Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efcab7d141 | ||
|
|
ca1406d864 | ||
|
|
477e710ad6 | ||
|
|
30ee7cd818 | ||
|
|
72eb3a2a39 | ||
|
|
8780dae388 | ||
|
|
c9f3e733fa | ||
|
|
bf9bed64e8 | ||
|
|
02fcadf9e8 | ||
|
|
9254d3ae87 | ||
|
|
1d3b9e9c77 | ||
|
|
8694f7767e | ||
|
|
6fb3de2261 | ||
|
|
f5df1f9f5f | ||
|
|
73660729ab | ||
|
|
701dbcc32b | ||
|
|
1603479a3d | ||
|
|
d263068bb2 | ||
|
|
83768b92e4 | ||
|
|
9174c1ba59 | ||
|
|
95c978722a | ||
|
|
37e741afa1 | ||
|
|
526e3edc97 | ||
|
|
60024a5223 | ||
|
|
e463fe7518 | ||
|
|
53ab16bab4 | ||
|
|
4b2f2bf183 | ||
|
|
9d775acb94 | ||
|
|
70bffed518 | ||
|
|
77285a251c | ||
|
|
7f7b48021e | ||
|
|
732593e4ed | ||
|
|
d4662df023 | ||
|
|
06f4716e17 | ||
|
|
49d4648b07 | ||
|
|
634f8e6028 | ||
|
|
9d09a14f91 | ||
|
|
1c023126d9 | ||
|
|
87d87c8f47 | ||
|
|
50c757d203 | ||
|
|
50670ee41b | ||
|
|
70e0ad1aba | ||
|
|
1de2349350 | ||
|
|
98f19d1d47 | ||
|
|
d6bb4054dc | ||
|
|
9e3c62ed1e | ||
|
|
ee274035c6 | ||
|
|
500868b490 | ||
|
|
7aa71324c4 | ||
|
|
e530cab7a7 | ||
|
|
bf45687414 | ||
|
|
f28d27290c | ||
|
|
5453fc6dc3 | ||
|
|
94a3c9d56e | ||
|
|
4cb445b280 | ||
|
|
918ed2ca50 | ||
|
|
ebc967be35 | ||
|
|
2e64d63c8b | ||
|
|
6d8a2c596c | ||
|
|
f6931481ba | ||
|
|
15b0cfc894 | ||
|
|
331e01fda1 | ||
|
|
877a9ee03b | ||
|
|
a4ff99236b | ||
|
|
c3d327e27f | ||
|
|
acb3a3ffee | ||
|
|
7e1695f945 | ||
|
|
248dd134ba | ||
|
|
e5a75119cb | ||
|
|
11155add8a | ||
|
|
f82f93559b | ||
|
|
5a7d16c24f | ||
|
|
292e51f0c2 | ||
|
|
c5b0906576 | ||
|
|
30ca814809 | ||
|
|
000e7c3ac0 | ||
|
|
a22355a2ab | ||
|
|
39a4e137dc | ||
|
|
0383255de2 | ||
|
|
b2a50d50f5 | ||
|
|
e486a8e23a | ||
|
|
a4c1e9b478 | ||
|
|
9fdbdf738b | ||
|
|
f3f844b3dc | ||
|
|
d65ca4f67f | ||
|
|
ee577995d0 | ||
|
|
e3d6fe3a86 | ||
|
|
bfc4cd38ee | ||
|
|
0ccc419d0d | ||
|
|
7542aca687 | ||
|
|
1e906bb577 | ||
|
|
a8c367ad0c | ||
|
|
2d35cab39e | ||
|
|
874d7df2f7 | ||
|
|
4d39744d99 | ||
|
|
74da4f2a92 | ||
|
|
36f6d245f9 | ||
|
|
a44c23c0a8 | ||
|
|
337ded3839 | ||
|
|
8ec6c630bd | ||
|
|
a787272ceb | ||
|
|
0ca16d6e2d | ||
|
|
ecf2ea372b | ||
|
|
335de43db5 | ||
|
|
af077ddb24 | ||
|
|
84ea648c84 | ||
|
|
2d95c5787d | ||
|
|
19a2b8d2be | ||
|
|
ca27ca50bf | ||
|
|
d4615d6e76 | ||
|
|
9eff2e2cfc | ||
|
|
c2f8e9b734 | ||
|
|
d52599ec44 | ||
|
|
3c8669577d | ||
|
|
3fee4e6883 | ||
|
|
41d21f7cea | ||
|
|
715d8b5950 | ||
|
|
911f043db8 | ||
|
|
ce85319c9b | ||
|
|
2a9a9b386b | ||
|
|
e3cfbb58dd | ||
|
|
becaf487e8 | ||
|
|
6111d8f621 | ||
|
|
d8ba9f9669 | ||
|
|
e409e9d8d9 | ||
|
|
4d21ca4c4c | ||
|
|
1ccc1d7e67 | ||
|
|
fd344986e8 | ||
|
|
6ceb73d367 | ||
|
|
dee96f66a2 | ||
|
|
6b4d8652e4 | ||
|
|
5f7d8f238a | ||
|
|
dc38c765e8 | ||
|
|
59bd38b1aa | ||
|
|
3484c04133 | ||
|
|
7075608ddc | ||
|
|
27a32b7b94 | ||
|
|
1391534f6c | ||
|
|
169d66d46a | ||
|
|
2836b5d406 | ||
|
|
d0bd6852c1 | ||
|
|
cb2f2a550b | ||
|
|
e472f4cb79 | ||
|
|
14887264bb | ||
|
|
63ced2fa5b | ||
|
|
461e736cbc | ||
|
|
d932c50ab3 | ||
|
|
b4c461c6ad | ||
|
|
2f4e28b7cb | ||
|
|
5f715d05ee | ||
|
|
b662c63894 | ||
|
|
e793c7d59d | ||
|
|
7cd862194a | ||
|
|
407793c99e | ||
|
|
5e124cec36 | ||
|
|
7fce6e650c | ||
|
|
5941043489 | ||
|
|
f142f8874d | ||
|
|
fb5977743c | ||
|
|
26b50e9242 | ||
|
|
7233eddced | ||
|
|
3a92ba2787 | ||
|
|
6307b92af2 | ||
|
|
2e42ae53aa | ||
|
|
5ff0ef4535 | ||
|
|
ce963be2e2 | ||
|
|
e5357f0df5 | ||
|
|
c148b342fc | ||
|
|
74e796b1c6 | ||
|
|
c1965b1d1e | ||
|
|
725cb16ff8 | ||
|
|
ceb4840a63 | ||
|
|
4bca4cedd8 | ||
|
|
736611293f | ||
|
|
dc5a65b02b | ||
|
|
a930d1818a | ||
|
|
7fed18fc47 | ||
|
|
cc53474d56 | ||
|
|
359bd6bba3 | ||
|
|
ff91ff91f0 | ||
|
|
c72b429d82 | ||
|
|
989d8b33d8 | ||
|
|
c40afe5caf | ||
|
|
30ebd1353a | ||
|
|
ffc872ae12 | ||
|
|
c04e71ee9b | ||
|
|
2169ad233f | ||
|
|
8c426595fa | ||
|
|
2e3c479402 | ||
|
|
c4dd646642 | ||
|
|
c0bc69e879 | ||
|
|
437e5cc41f | ||
|
|
f1b740596c | ||
|
|
d626b639fa | ||
|
|
f413c4dc6c | ||
|
|
2199a21c4d | ||
|
|
b7f29c384a | ||
|
|
0f0a44a00c | ||
|
|
214dc13a38 | ||
|
|
785f4d65c8 | ||
|
|
05298c0faf | ||
|
|
cc3d2bfcb1 | ||
|
|
e9e7ccc622 |
No files matched your search
@@ -0,0 +1,4 @@
|
||||
DEEPSEEK_API_KEY=sk-your-key-here
|
||||
DEEPSEEK_BASE_URL=https://api.deepseek.com
|
||||
REASONIX_LOG_LEVEL=INFO
|
||||
REASONIX_TRANSCRIPT_DIR=./transcripts
|
||||
@@ -1,13 +0,0 @@
|
||||
.gitattributes text eol=lf
|
||||
.gitignore text eol=lf
|
||||
*.astro text eol=lf
|
||||
*.css text eol=lf
|
||||
*.html text eol=lf
|
||||
*.js text eol=lf
|
||||
*.json text eol=lf
|
||||
*.md text eol=lf
|
||||
*.mjs text eol=lf
|
||||
*.sh text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.yaml text eol=lf
|
||||
*.yml text eol=lf
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Something is broken
|
||||
labels: bug
|
||||
---
|
||||
|
||||
**What happened**
|
||||
A clear and concise description.
|
||||
|
||||
**Expected**
|
||||
What you expected to happen.
|
||||
|
||||
**Reproduction**
|
||||
Steps or minimal code that reproduces it.
|
||||
|
||||
**Environment**
|
||||
- Reasonix version:
|
||||
- Node version:
|
||||
- OS:
|
||||
- DeepSeek model (e.g. `deepseek-chat`, `deepseek-reasoner`):
|
||||
|
||||
**Logs / transcript**
|
||||
If using the CLI, attach the relevant chunk of `--transcript`.
|
||||
@@ -0,0 +1,49 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build (node ${{ matrix.node }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: ["20", "22"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node ${{ matrix.node }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Lint (biome)
|
||||
run: npm run lint
|
||||
|
||||
- name: Typecheck
|
||||
run: npm run typecheck
|
||||
|
||||
- name: Test (vitest)
|
||||
run: npm test
|
||||
|
||||
- name: Build (tsup)
|
||||
run: npm run build
|
||||
|
||||
# Smoke-test the bench harnesses themselves. --dry skips all LLM
|
||||
# calls, so this catches wiring regressions (task factories, CLI
|
||||
# parsing, file IO, checker determinism) without needing a
|
||||
# DEEPSEEK_API_KEY in CI.
|
||||
- name: τ-bench harness dry-run
|
||||
run: npx tsx benchmarks/tau-bench/runner.ts --dry --out /tmp/tau-dry.json
|
||||
|
||||
- name: Harvest-bench harness dry-run
|
||||
run: npx tsx benchmarks/harvest/runner.ts --dry --out /tmp/harvest-dry.json
|
||||
@@ -1,66 +0,0 @@
|
||||
name: Deploy website
|
||||
run-name: Deploy site ${{ inputs.release_version && format('v{0}', inputs.release_version) || github.sha }}${{ inputs.release_request && format(' [{0}]', inputs.release_request) || '' }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [website]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_version:
|
||||
description: "Optional product release version associated with this publication"
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
release_request:
|
||||
description: "Optional release workflow correlation ID"
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
studio_version:
|
||||
description: "Studio version that must be present in the generated changelog"
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: reasonix-website-production
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.ref == 'refs/heads/website'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: npm
|
||||
cache-dependency-path: site/package-lock.json
|
||||
- name: Validate and build
|
||||
working-directory: site
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
STUDIO_RELEASE_VERSION: ${{ inputs.studio_version }}
|
||||
run: |
|
||||
npm ci
|
||||
npm test
|
||||
npm run build
|
||||
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
|
||||
with:
|
||||
path: site/dist
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deploy.outputs.page_url }}
|
||||
steps:
|
||||
- id: deploy
|
||||
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5
|
||||
@@ -1,106 +0,0 @@
|
||||
name: Prepare release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Official version without a tag prefix (for example 1.20.0)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
draft:
|
||||
name: generate reviewable bilingual draft
|
||||
if: github.ref == 'refs/heads/website'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Select the review branch
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git fetch origin main-v2 website
|
||||
|
||||
if [[ ! "$VERSION" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
|
||||
echo "::error::version must be MAJOR.MINOR.PATCH"
|
||||
exit 1
|
||||
fi
|
||||
branch="website-release-notes/v${VERSION}"
|
||||
if git ls-remote --exit-code --heads origin "$branch" >/dev/null 2>&1; then
|
||||
git fetch origin "refs/heads/$branch:refs/remotes/origin/$branch"
|
||||
git checkout -b "$branch" --track "origin/$branch"
|
||||
git merge-base --is-ancestor origin/website HEAD
|
||||
else
|
||||
git checkout -b "$branch"
|
||||
fi
|
||||
source_sha="$(git rev-parse origin/main-v2)"
|
||||
echo "RELEASE_NOTES_BRANCH=$branch" >> "$GITHUB_ENV"
|
||||
echo "RELEASE_NOTES_SOURCE_SHA=$source_sha" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Generate and validate release notes
|
||||
env:
|
||||
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
|
||||
DEEPSEEK_MODEL: deepseek-v4-pro
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# The first preparation fixes the product range. Reruns update the
|
||||
# draft without silently absorbing unrelated main-v2 merges.
|
||||
node site/scripts/releases/generate-release-notes.mjs --version "$VERSION" --to "$RELEASE_NOTES_SOURCE_SHA"
|
||||
node site/scripts/releases/release-notes.mjs validate
|
||||
node --test site/scripts/releases/release-notes.test.mjs
|
||||
node site/scripts/releases/release-notes.mjs render --version "$VERSION" --output /tmp/release-notes.md
|
||||
{
|
||||
echo "## Review draft for v${VERSION#v}"
|
||||
echo
|
||||
cat /tmp/release-notes.md
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Open or update the review PR
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git add site/src/data/releases.json
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "docs(release): prepare v${VERSION#v} notes" \
|
||||
-m "Summary:
|
||||
Generate a bilingual, product-focused draft from merged pull request metadata. Reuse the selected release-bound PR when one is available.
|
||||
|
||||
Verification:
|
||||
Validate the catalog, citations, bilingual fields, and rendered GitHub release notes before committing."
|
||||
fi
|
||||
git push -u origin "$RELEASE_NOTES_BRANCH"
|
||||
if ! gh pr list --head "$RELEASE_NOTES_BRANCH" --state open --json number --jq 'length > 0' | grep -q true; then
|
||||
if ! gh pr create \
|
||||
--base website \
|
||||
--head "$RELEASE_NOTES_BRANCH" \
|
||||
--title "docs(release): 准备 v${VERSION#v} 中英更新日志" \
|
||||
--body-file /tmp/release-notes.md; then
|
||||
echo "::warning::GitHub Actions could not open the PR; the reviewed branch is preserved."
|
||||
{
|
||||
echo "## Manual PR handoff"
|
||||
echo
|
||||
echo '```sh'
|
||||
echo "gh pr create --repo ${{ github.repository }} --base website --head $RELEASE_NOTES_BRANCH --fill"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
fi
|
||||
@@ -1,27 +0,0 @@
|
||||
name: Release notes
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [website]
|
||||
paths:
|
||||
- "site/src/data/releases.json"
|
||||
- "site/scripts/releases/**"
|
||||
- "site/scripts/release-event.mjs"
|
||||
- "site/src/pages/changelog/**"
|
||||
- "site/src/components/ChangelogPage.astro"
|
||||
- "site/src/data/releases.ts"
|
||||
- "site/src/styles/changelog.css"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
||||
with:
|
||||
node-version: "22"
|
||||
- run: node site/scripts/releases/release-notes.mjs validate
|
||||
- run: node --test site/scripts/releases/*.test.mjs
|
||||
@@ -1,33 +0,0 @@
|
||||
name: Website CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [website]
|
||||
pull_request:
|
||||
branches: [website]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: website-ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
website:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: site
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: npm
|
||||
cache-dependency-path: site/package-lock.json
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
- run: npm run build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,15 +1,32 @@
|
||||
node_modules/
|
||||
.npm/
|
||||
.wrangler/
|
||||
site/dist/
|
||||
site/.astro/
|
||||
site/.generated/
|
||||
site/public/av/
|
||||
dist/
|
||||
coverage/
|
||||
.env
|
||||
.env.*
|
||||
*.local
|
||||
.env.local
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.idea/
|
||||
.vscode/
|
||||
temp/
|
||||
*.tsbuildinfo
|
||||
transcripts/
|
||||
sessions/
|
||||
*.jsonl
|
||||
!tests/**/*.jsonl
|
||||
# Committed reference transcripts so readers can reasonix replay / diff
|
||||
# the v0.1 bench results without an API key.
|
||||
!benchmarks/tau-bench/transcripts/
|
||||
!benchmarks/tau-bench/transcripts/*.jsonl
|
||||
.turbo/
|
||||
# Local-only Claude Code settings — personal overrides, never committed.
|
||||
.claude/settings.local.json
|
||||
# Per-user Reasonix state under .reasonix/ — committable team-level
|
||||
# files (settings.json, skills/) stay tracked, but the user-private
|
||||
# bits (semantic index, sessions, opt-out markers) never should.
|
||||
.reasonix/semantic/
|
||||
.reasonix/sessions/
|
||||
.reasonix/semantic-skip
|
||||
@@ -1 +0,0 @@
|
||||
24.20.0
|
||||
@@ -1,6 +0,0 @@
|
||||
# Reasonix
|
||||
|
||||
The project's standing instructions live in `REASONIX.md` — one file, read by
|
||||
both Reasonix and Claude Code. Add rules there, never here.
|
||||
|
||||
@REASONIX.md
|
||||
@@ -1,34 +1,783 @@
|
||||
# Reasonix Website
|
||||
<p align="center">
|
||||
<img src="docs/logo.svg" alt="Reasonix — DeepSeek-native agent framework" width="640"/>
|
||||
</p>
|
||||
|
||||
This branch contains only the public Reasonix website and documentation portal.
|
||||
<p align="center">
|
||||
<em>Cache-first agent loop for DeepSeek V4 (flash + pro) — Ink TUI, MCP first-class, no LangChain.</em>
|
||||
</p>
|
||||
|
||||
- Website source: `site/`
|
||||
- Website validation: `.github/workflows/site-ci.yml`
|
||||
- Production publication: `.github/workflows/pages.yml`
|
||||
<p align="center">
|
||||
<strong>English</strong> · <a href="./README.zh-CN.md">简体中文</a> · <a href="https://esengine.github.io/reasonix/">Website</a>
|
||||
</p>
|
||||
|
||||
Product clients live on `main-v2` and `studio`. Shared APIs, identity, telemetry,
|
||||
and registry services live on `platform`.
|
||||
# Reasonix
|
||||
|
||||
## Local development
|
||||
[](https://www.npmjs.com/package/reasonix)
|
||||
[](https://github.com/esengine/reasonix/actions/workflows/ci.yml)
|
||||
[](./LICENSE)
|
||||
[](https://www.npmjs.com/package/reasonix)
|
||||
[](./package.json)
|
||||
|
||||
```sh
|
||||
cd site
|
||||
npm ci
|
||||
npm test
|
||||
npm run dev
|
||||
**A DeepSeek-native AI coding agent in your terminal.** Edits files as
|
||||
reviewable SEARCH/REPLACE blocks. Ink TUI. MCP first-class. No
|
||||
LangChain.
|
||||
|
||||
---
|
||||
|
||||
## Quick start (60 seconds)
|
||||
|
||||
**1. Get a DeepSeek API key.** Free credit on signup:
|
||||
<https://platform.deepseek.com/api_keys>
|
||||
|
||||
**2. Point it at a project.** No install needed.
|
||||
|
||||
```bash
|
||||
cd my-project
|
||||
npx reasonix code
|
||||
```
|
||||
|
||||
Production publication runs on pushes to `website` or manual dispatch from that branch.
|
||||
First run walks you through a 30-second wizard (paste API key → pick
|
||||
preset → multi-select MCP servers). Every run after that drops you
|
||||
straight in.
|
||||
|
||||
Production builds synchronize both CLI 1.x and Studio 2.x changelogs from
|
||||
published GitHub tags. CLI notes come from the tag's reviewed
|
||||
`release-notes/releases.json`; Studio notes come from its versioned Markdown.
|
||||
Synchronization needs GitHub read access (`gh auth login` locally or
|
||||
`GITHUB_TOKEN` in CI), not a model API key. Missing source notes fail the build.
|
||||
The existing CLI publication-marker check still controls public visibility.
|
||||
**3. Ask it to edit.** The model proposes edits as SEARCH/REPLACE
|
||||
blocks — nothing hits disk until you `/apply`.
|
||||
|
||||
生产构建会从已发布的 GitHub 标签同步 CLI 1.x 和 Studio 2.x 更新日志。
|
||||
CLI 读取标签中已审核的 `release-notes/releases.json`,Studio 读取对应版本的
|
||||
Markdown。同步只需要 GitHub 读取权限(本地使用 `gh auth login`,CI 使用
|
||||
`GITHUB_TOKEN`),不需要模型 API 密钥。缺失源日志时构建失败;CLI 是否公开
|
||||
仍由原有的发布完成标记校验决定。
|
||||
```
|
||||
reasonix code › users.ts 里 findByEmail 对大小写敏感导致登录失败,帮我改
|
||||
|
||||
assistant
|
||||
▸ tool<search_files> → src/users.ts, src/users.test.ts
|
||||
▸ tool<read_file> → (src/users.ts, 412 chars)
|
||||
▸ 找到了。findByEmail 直接用 === 比对。改成小写规范化并补一条测试。
|
||||
|
||||
src/users.ts
|
||||
<<<<<<< SEARCH
|
||||
return users.find(u => u.email === email);
|
||||
=======
|
||||
const needle = email.toLowerCase();
|
||||
return users.find(u => u.email.toLowerCase() === needle);
|
||||
>>>>>>> REPLACE
|
||||
|
||||
▸ 1 pending edit across 1 file — /apply to write · /discard to drop
|
||||
|
||||
reasonix code › /apply
|
||||
▸ ✓ applied src/users.ts
|
||||
```
|
||||
|
||||
Requires Node ≥ 20.10. macOS, Linux, Windows (PowerShell / Git Bash /
|
||||
Windows Terminal). Press `Esc` anytime to abort; `/help` for the full
|
||||
command list.
|
||||
|
||||
---
|
||||
|
||||
## `reasonix code` — pair programmer in your terminal
|
||||
|
||||
Scoped to the directory you launch from. The model has native
|
||||
`read_file` / `write_file` / `edit_file` / `list_directory` /
|
||||
`search_files` / `directory_tree` / `get_file_info` /
|
||||
`create_directory` / `move_file` tools, all sandboxed — any path that
|
||||
resolves outside the launch root (including `..` and symlink escapes)
|
||||
is refused. Plus `run_command` with a read-only allowlist; anything
|
||||
state-mutating (`npm install`, `git commit`, …) is gated behind a
|
||||
confirmation picker.
|
||||
|
||||
### Walkthrough: explore before editing
|
||||
|
||||
For "what does this code do?" questions the model uses the read-side
|
||||
tools and replies in prose — no SEARCH/REPLACE blocks, no file
|
||||
writes. Ask to change something only when you mean it:
|
||||
|
||||
```
|
||||
reasonix code › 这个项目的路由是怎么组织的?
|
||||
assistant
|
||||
▸ tool<directory_tree> → (src/ tree, 47 entries)
|
||||
▸ tool<read_file> → (src/router.ts, 1.2 KB)
|
||||
▸ 路由分三层:顶层 AppRouter 注册 tab,每个 tab 用 React Router 的
|
||||
nested routes 写子路径,最后 …
|
||||
```
|
||||
|
||||
If an `edit_file` SEARCH block doesn't match the file byte-for-byte,
|
||||
the edit is refused loudly rather than fuzzy-matched. The model sees
|
||||
the error and retries — silent wrong edits are worse than visible
|
||||
rejections.
|
||||
|
||||
### Plan mode — review before executing
|
||||
|
||||
For anything bigger than a typo, the model is encouraged to propose a
|
||||
markdown plan first. You'll see a picker with **Approve / Refine /
|
||||
Cancel**:
|
||||
|
||||
```
|
||||
reasonix code › 把 auth 从 JWT 迁移到 session cookies
|
||||
|
||||
▸ plan submitted — awaiting your review
|
||||
────────────────────────────────────────
|
||||
## Summary
|
||||
Swap JWT middleware for session cookies, keep user table intact.
|
||||
|
||||
## Files
|
||||
- src/auth/middleware.ts — replace `verifyJwt` with `readSession`
|
||||
- src/auth/session.ts — new file, in-memory store + signed cookie
|
||||
- src/routes/login.ts — return Set-Cookie instead of a token
|
||||
- tests/auth/*.test.ts — update fixtures
|
||||
|
||||
## Risks
|
||||
- Existing logged-in users get logged out (no migration).
|
||||
- Session store is in-memory; restart clears sessions.
|
||||
────────────────────────────────────────
|
||||
▸ Approve and implement
|
||||
Refine — explore more
|
||||
Cancel
|
||||
```
|
||||
|
||||
**Force it** with `/plan` — enters an explicit read-only phase where
|
||||
the model *must* submit a plan before any edit or non-allowlisted
|
||||
shell call will execute. Use for high-stakes changes you want to
|
||||
audit before the model touches disk. `/plan off` or picker
|
||||
Approve/Cancel exits.
|
||||
|
||||
### Prompt prefixes — `!cmd` and `@path`
|
||||
|
||||
Two inline shortcuts that don't need a slash:
|
||||
|
||||
**`!<cmd>` — run a shell command in the sandbox and feed it to the
|
||||
model.** Typed at the prompt, like bash. Output lands in the visible
|
||||
log AND in the session so the model's next turn reasons about it:
|
||||
|
||||
```
|
||||
reasonix code › !git status --short
|
||||
▸ M src/users.ts
|
||||
▸ M src/users.test.ts
|
||||
|
||||
reasonix code › 把这两个文件的改动说明一下
|
||||
assistant
|
||||
▸ tool<read_file> → src/users.ts, src/users.test.ts
|
||||
▸ …
|
||||
```
|
||||
|
||||
No allowlist gate — user-typed shell = explicit consent. 60s timeout,
|
||||
32k char cap, survives session resume since 0.5.14.
|
||||
|
||||
**`@path/to/file` — inline a file under "Referenced files."** Start
|
||||
typing `@` and a picker appears (↑/↓ navigate, Tab/Enter to insert).
|
||||
Good for "what does @src/users.ts do?" without making the model
|
||||
`read_file` it first. Sandboxed: relative paths only, no `..` escape,
|
||||
64KB per-file cap. Recent files rank higher.
|
||||
|
||||
### `/commit` — stage + commit in one step
|
||||
|
||||
```
|
||||
reasonix code › /commit "fix: findByEmail case-insensitive"
|
||||
▸ git add -A && git commit -m "fix: findByEmail case-insensitive"
|
||||
[main a1b2c3d] fix: findByEmail case-insensitive
|
||||
```
|
||||
|
||||
### Things to try
|
||||
|
||||
- `/tool 1` — dump the last tool call's full output (when the 400-char
|
||||
inline clip isn't enough).
|
||||
- `/think` — see the model's full reasoning for the last turn
|
||||
(thinking-mode models: v4-flash / v4-pro / reasoner alias).
|
||||
- `/undo` — roll back the last applied edit batch.
|
||||
- `/new` — start fresh in the same directory without losing the
|
||||
session file.
|
||||
- `/effort high` — step down from the default `max` agent-class
|
||||
reasoning_effort for cheaper/faster turns on simple tasks.
|
||||
- `npx reasonix code --preset max` — v4-pro + 3-way self-consistency
|
||||
branching for gnarly refactors.
|
||||
- `npx reasonix code src/` — narrower sandbox (only `src/` is
|
||||
writable).
|
||||
- `npx reasonix code --no-session` — ephemeral; nothing saved.
|
||||
|
||||
### `reasonix stats` — how much did you actually save?
|
||||
|
||||
Every turn `reasonix chat|code|run` runs appends a compact record
|
||||
(tokens + cost + what Claude Sonnet 4.6 would have charged) to
|
||||
`~/.reasonix/usage.jsonl`. `reasonix stats` with no args rolls that
|
||||
log into today / week / month / all-time windows:
|
||||
|
||||
```
|
||||
Reasonix usage — /Users/you/.reasonix/usage.jsonl
|
||||
|
||||
turns cache hit cost (USD) vs Claude saved
|
||||
----------------------------------------------------------------------
|
||||
today 8 95.1% $0.004821 $0.1348 96.4%
|
||||
week 34 93.8% $0.023104 $0.6081 96.2%
|
||||
month 127 94.2% $0.081530 $2.1452 96.2%
|
||||
all-time 342 94.0% $0.210881 $5.8934 96.4%
|
||||
```
|
||||
|
||||
Privacy: only tokens, costs, and the session name you chose land
|
||||
in the file. No prompts, no completions, no tool arguments.
|
||||
`reasonix stats <transcript>` keeps the old per-file summary
|
||||
(assistant turns + tool calls) for scripts that already use it.
|
||||
|
||||
### Staying current
|
||||
|
||||
The panel header shows the running version next to `Reasonix` (e.g.
|
||||
`Reasonix v0.5.21 · deepseek-v4-pro · harvest · max …`, the trailing
|
||||
`max` is the reasoning-effort badge — `/effort high` to step down).
|
||||
A quiet 24-hour background check against
|
||||
the npm registry surfaces a yellow `update: X.Y.Z` on the right side
|
||||
of the same row when a newer version has been published. No blocking,
|
||||
no nagging — the check runs once per day max and is silent on failure
|
||||
(offline, firewall, etc.).
|
||||
|
||||
```bash
|
||||
reasonix update # print current vs latest, run `npm i -g reasonix@latest`
|
||||
reasonix update --dry-run # print the plan without running anything
|
||||
```
|
||||
|
||||
Running via `npx`? The command detects that and prints a
|
||||
cache-refresh hint instead — npx picks up the newest version on
|
||||
its next invocation automatically.
|
||||
|
||||
### Project conventions — `REASONIX.md`
|
||||
|
||||
Drop a `REASONIX.md` in the project root and its contents are pinned
|
||||
into the system prompt every launch. Committable team memory — house
|
||||
conventions, domain glossary, things the model keeps forgetting:
|
||||
|
||||
```bash
|
||||
cat > REASONIX.md <<'EOF'
|
||||
# Notes for Reasonix
|
||||
- Use snake_case for new Python modules; legacy camelCase modules keep their style.
|
||||
- `cargo check` is in the auto-run allowlist; full `cargo test` needs confirmation.
|
||||
- The `api/` dir mirrors `backend/` — keep schemas in sync.
|
||||
EOF
|
||||
```
|
||||
|
||||
Re-launch (or `/new`) to pick it up; the prefix is hashed once per
|
||||
session to keep the DeepSeek cache warm. `/memory` prints what's
|
||||
currently pinned. `REASONIX_MEMORY=off` disables every memory source
|
||||
for CI / offline repro.
|
||||
|
||||
### User memory — `~/.reasonix/memory/`
|
||||
|
||||
A second, **private per-user** memory layer lives under your home
|
||||
directory. Unlike `REASONIX.md` it's never committed, and the model
|
||||
can write to it itself via the `remember` tool. Two scopes:
|
||||
|
||||
- `~/.reasonix/memory/global/` — cross-project (your preferences,
|
||||
tooling).
|
||||
- `~/.reasonix/memory/<project-hash>/` — scoped to one sandbox root
|
||||
in `reasonix code` (decisions, local facts, per-repo shortcuts).
|
||||
|
||||
Each scope keeps an always-loaded `MEMORY.md` index of one-liners
|
||||
plus zero or more `<name>.md` detail files (loaded on demand via
|
||||
`recall_memory`). Writes land immediately; pinning into the system
|
||||
prompt takes effect on next `/new` or launch so the cache prefix
|
||||
stays stable for the current session.
|
||||
|
||||
```
|
||||
reasonix code › 我用 bun 而不是 npm,请以后都用 bun 跑构建
|
||||
|
||||
assistant
|
||||
▸ tool<remember> → project/bun_build saved
|
||||
"Build command on this machine is `bun run build`"
|
||||
```
|
||||
|
||||
**Slash**: `/memory` · `/memory list` · `/memory show <name>` ·
|
||||
`/memory forget <name>` · `/memory clear <scope> confirm`.
|
||||
**Model tools**: `remember(type, scope, name, description, content)` ·
|
||||
`forget(scope, name)` · `recall_memory(scope, name)`.
|
||||
|
||||
Project scope is only available inside `reasonix code` (needs a real
|
||||
sandbox root to hash); plain `reasonix` gets the global scope only.
|
||||
|
||||
### Skills — user-authored prompt packs
|
||||
|
||||
Skills are prose instruction blocks you drop on disk. Reasonix pins
|
||||
their names + one-line descriptions into the system prompt; the
|
||||
model can call `run_skill({name: "..."})` on its own when a match
|
||||
fits, or you can type `/skill <name> [args]` to run one manually.
|
||||
|
||||
Two scopes, same layout as user memory:
|
||||
|
||||
- `<project>/.reasonix/skills/` — per-project skills (commit them to
|
||||
share with your team, or add to `.gitignore` for personal drafts).
|
||||
- `~/.reasonix/skills/` — global skills available everywhere.
|
||||
|
||||
Either layout works: `<name>/SKILL.md` (preferred — can bundle
|
||||
additional assets alongside) or flat `<name>.md`.
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: review
|
||||
description: Review uncommitted changes and flag risks
|
||||
---
|
||||
|
||||
Run `git diff` on staged and unstaged changes. Summarize what each
|
||||
hunk does, call out potential regressions, and list files that might
|
||||
need additional tests. Don't propose edits unless I ask.
|
||||
```
|
||||
|
||||
Use it:
|
||||
|
||||
```
|
||||
reasonix code › /skill review
|
||||
▸ running skill: review
|
||||
assistant
|
||||
▸ tool<run_command> → git diff --cached
|
||||
▸ 3 改动,1 个需要回归测试 …
|
||||
```
|
||||
|
||||
Or let the model pick autonomously — because the skill's name +
|
||||
description are pinned in the prefix, asking "帮我看下未提交的改动有没
|
||||
有风险" triggers `run_skill({name: "review"})` without you typing the
|
||||
slash command.
|
||||
|
||||
**Slash**: `/skill` (list) · `/skill show <name>` · `/skill <name>
|
||||
[args]` (inject body as user turn).
|
||||
|
||||
**Deliberately not tied** to any other client's directory convention
|
||||
(`.claude/skills`, etc.) — Reasonix is model-agnostic at the
|
||||
conversation layer. Any SKILL.md you author works; the body is
|
||||
prose, so skills authored for other tools usually port over unchanged
|
||||
(Reasonix's tool names differ — `filesystem` / `shell` / `web` — but
|
||||
the model reads the instructions and picks our equivalents).
|
||||
|
||||
### Hooks — automate around tool calls and turns
|
||||
|
||||
Drop a `settings.json` under `.reasonix/` (project or `~/`) and
|
||||
Reasonix will fire shell commands at four well-known points in
|
||||
the loop: before a tool runs, after a tool returns, before your
|
||||
prompt reaches the model, and after the turn ends.
|
||||
|
||||
```json
|
||||
// <project>/.reasonix/settings.json ← committable
|
||||
// ~/.reasonix/settings.json ← per-user
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [{ "match": "edit_file|write_file", "command": "bun scripts/guard.ts" }],
|
||||
"PostToolUse": [{ "match": "edit_file", "command": "biome format --write" }],
|
||||
"UserPromptSubmit": [{ "command": "echo $(date +%s) >> ~/.reasonix/prompts.log" }],
|
||||
"Stop": [{ "command": "bun test --run", "timeout": 60000 }]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Each hook is a shell command. Reasonix invokes it with stdin = a
|
||||
JSON envelope describing the event:
|
||||
|
||||
```json
|
||||
{ "event": "PreToolUse", "cwd": "/path/to/project",
|
||||
"toolName": "edit_file", "toolArgs": { "path": "src/x.ts", "..." } }
|
||||
```
|
||||
|
||||
Exit code drives the decision:
|
||||
|
||||
- **0** — pass; loop continues normally
|
||||
- **2** — block (only on `PreToolUse` / `UserPromptSubmit`); the
|
||||
hook's stderr becomes the synthetic tool result the model sees,
|
||||
or the prompt is dropped entirely
|
||||
- **anything else** — warn; loop continues, stderr renders as a
|
||||
yellow row inline
|
||||
|
||||
`match` is anchored regex on the tool name; `*` or omitted matches
|
||||
every tool. Project hooks fire before global hooks. Default
|
||||
timeouts: 5s for blocking events, 30s for logging events; per-hook
|
||||
`timeout` overrides.
|
||||
|
||||
**Slash**: `/hooks` (list active hooks) · `/hooks reload` (re-read
|
||||
`settings.json` from disk without losing your session).
|
||||
|
||||
### Staying current from inside the TUI
|
||||
|
||||
`/update` inside a running session shows your current version, the
|
||||
last-resolved latest version (from the quiet 24h background check),
|
||||
and the shell command to run. The slash does *not* spawn
|
||||
`npm install` — stdio:inherit into a running Ink renderer corrupts
|
||||
the display. Exit the session and run `reasonix update` in a
|
||||
fresh shell when you actually want to install.
|
||||
|
||||
---
|
||||
|
||||
## `reasonix` — also works as general chat
|
||||
|
||||
Same TUI, no filesystem tools unless you opt in via MCP. Good for
|
||||
drafting, Q&A, schema design, architecture discussions, or driving
|
||||
your own MCP servers. Sessions persist per name under
|
||||
`~/.reasonix/sessions/`.
|
||||
|
||||
```bash
|
||||
npx reasonix # uses saved config + wizard-selected MCP
|
||||
npx reasonix --preset smart # reasoner + R1 harvest for this run
|
||||
npx reasonix --session design # named session — resume later with --session design
|
||||
```
|
||||
|
||||
Bridge your own MCP servers on the fly:
|
||||
|
||||
```bash
|
||||
npx reasonix \
|
||||
--mcp "fs=npx -y @modelcontextprotocol/server-filesystem /tmp/safe" \
|
||||
--mcp "kb=https://mcp.example.com/sse"
|
||||
```
|
||||
|
||||
MCP tools go through the same Cache-First + repair + context-safety
|
||||
plumbing as native tools — 32k result cap, live progress-notification
|
||||
rendering, retries.
|
||||
|
||||
---
|
||||
|
||||
## Commands inside the session
|
||||
|
||||
**Core**
|
||||
|
||||
| command | what it does |
|
||||
|---|---|
|
||||
| `/help` · `/?` | full command reference with hints |
|
||||
| `/status` | current model · flags · context · session |
|
||||
| `/new` · `/reset` | fresh conversation in the same session |
|
||||
| `/clear` | clear visible scrollback only (log kept) |
|
||||
| `/retry` | truncate and resend your last message (fresh sample) |
|
||||
| `/exit` · `/quit` | quit |
|
||||
|
||||
**Model**
|
||||
|
||||
| command | what it does |
|
||||
|---|---|
|
||||
| `/preset <fast\|smart\|max>` | one-tap bundle (model + harvest + branch) |
|
||||
| `/model <id>` | switch DeepSeek model (`deepseek-v4-flash`, `deepseek-v4-pro`, plus `deepseek-chat` / `deepseek-reasoner` compat aliases) |
|
||||
| `/models` | list live models from DeepSeek `/models` endpoint |
|
||||
| `/harvest [on\|off]` | toggle R1 plan-state extraction |
|
||||
| `/branch <N\|off>` | run N parallel samples per turn, pick best (N ≥ 2) |
|
||||
| `/effort <high\|max>` | reasoning_effort cap — `max` is the agent default, `high` is cheaper/faster |
|
||||
| `/think` | dump the last turn's full thinking-mode reasoning |
|
||||
|
||||
**Context & tools**
|
||||
|
||||
| command | what it does |
|
||||
|---|---|
|
||||
| `/mcp` | list attached MCP servers and their tools / resources / prompts |
|
||||
| `/resource [uri]` | browse + read MCP resources (no arg → list URIs; `<uri>` → fetch) |
|
||||
| `/prompt [name]` | browse + fetch MCP prompts |
|
||||
| `/tool [N]` | dump the Nth tool call's full output (1 = latest) |
|
||||
| `/compact [tokens]` | shrink oversized tool results in the log (default 4000 tokens/result) |
|
||||
| `/context` | break down where context tokens are going (system / tools / log) |
|
||||
| `/stats` | cross-session cost dashboard (today / week / month / all-time) |
|
||||
| `/keys` | keyboard shortcuts + prompt prefixes (`!` / `@` / `/`) cheatsheet |
|
||||
|
||||
**Memory & skills**
|
||||
|
||||
| command | what it does |
|
||||
|---|---|
|
||||
| `/memory` | show pinned memory (REASONIX.md + ~/.reasonix/memory) |
|
||||
| `/memory list` · `show <name>` · `forget <name>` · `clear <scope> confirm` | manage the store |
|
||||
| `/skill` · `/skill list` | list discovered skills (project + global) |
|
||||
| `/skill show <name>` | dump one skill's body |
|
||||
| `/skill <name> [args]` | run a skill (inject body as user turn) |
|
||||
|
||||
**Sessions**
|
||||
|
||||
| command | what it does |
|
||||
|---|---|
|
||||
| `/sessions` | list saved sessions (current marked with `▸`) |
|
||||
| `/forget` | delete the current session from disk |
|
||||
| `/setup` | reconfigure (exit and run `reasonix setup`) |
|
||||
|
||||
**Code mode only** (`reasonix code`)
|
||||
|
||||
| command | what it does |
|
||||
|---|---|
|
||||
| `/apply` | commit the pending SEARCH/REPLACE blocks to disk |
|
||||
| `/discard` | drop the pending edit blocks without writing |
|
||||
| `/undo` | roll back the last applied edit batch |
|
||||
| `/commit "msg"` | `git add -A && git commit -m "msg"` |
|
||||
| `/plan [on\|off]` | toggle read-only plan mode |
|
||||
| `/apply-plan` | force-approve a pending plan |
|
||||
|
||||
**Keyboard**
|
||||
|
||||
- `Enter` — submit
|
||||
- `Shift+Enter` / `Ctrl+J` — newline (multi-line paste also supported;
|
||||
`\` + Enter as a portable fallback)
|
||||
- `↑` / `↓` — walk prompt history while idle; navigate slash-autocomplete
|
||||
- `Tab` / `Enter` on a `/foo` prefix — accept the highlighted suggestion
|
||||
- `Esc` — abort the current turn (stops the API call, cancels any
|
||||
in-flight tool, rejects pending MCP requests)
|
||||
- `y` / `n` on confirm prompts — hotkey accept / reject
|
||||
|
||||
---
|
||||
|
||||
## Sessions and safety nets
|
||||
|
||||
- Sessions live as JSONL under `~/.reasonix/sessions/<name>.jsonl`
|
||||
(per directory for `reasonix code`). Every message appended
|
||||
atomically; `Ctrl+C` never loses context.
|
||||
- Tool results are capped at 32k chars per call. Oversized sessions
|
||||
self-heal on load (shrinks + rewrites the file).
|
||||
- Malformed `assistant.tool_calls` / `tool` pairing is validated on
|
||||
every outgoing API call so a corrupted session can't keep 400ing.
|
||||
- Context gauge turns yellow at 50%, red at 80% with a `/compact`
|
||||
nudge. Approaching the 1M-token window (V4 flash + pro) triggers an
|
||||
automatic compaction attempt before falling back to a forced summary.
|
||||
- The `reasonix code` sandbox refuses any path that resolves outside
|
||||
the launch directory, including symlink escape and `..` traversal.
|
||||
|
||||
### Troubleshooting: duplicate rows / ghost rendering
|
||||
|
||||
Some Windows terminals (Git Bash / MINTTY / winpty-wrapped shells)
|
||||
don't fully implement the ANSI cursor-up escapes Ink uses to repaint
|
||||
the live spinner region. Symptom: spinners, streaming previews, or
|
||||
tool-result rows print multiple copies into scrollback instead of
|
||||
overwriting in place.
|
||||
|
||||
If you hit this, run with plain mode:
|
||||
|
||||
```bash
|
||||
REASONIX_UI=plain npx reasonix code
|
||||
```
|
||||
|
||||
Plain mode suppresses live/animated rows and disables the internal
|
||||
tick timer. You lose the streaming preview and spinners but gain
|
||||
stable scrollback. Windows Terminal, PowerShell 7 in Windows
|
||||
Terminal, and WezTerm don't need this opt-out.
|
||||
|
||||
---
|
||||
|
||||
## Web search — on by default
|
||||
|
||||
The model has two web tools the moment you launch: `web_search` and
|
||||
`web_fetch`. No flag, no API key, no signup. When you ask about
|
||||
something the model wasn't trained on (new releases, current events,
|
||||
obscure APIs), it decides to call `web_search` on its own; if a
|
||||
snippet isn't enough it follows up with `web_fetch`.
|
||||
|
||||
Backed by **Mojeek**'s public search page — an independent web
|
||||
index, bot-friendly, no cookies/sessions. Coverage on niche or very
|
||||
recent queries can be thinner than Google/Bing, but it's reliable
|
||||
from scripts. (DDG was the original backend but started serving
|
||||
anti-bot pages in 2026.)
|
||||
|
||||
**Turn it off** (offline mode / privacy / CI):
|
||||
|
||||
```json
|
||||
// ~/.reasonix/config.json
|
||||
{ "apiKey": "sk-…", "search": false }
|
||||
```
|
||||
|
||||
```bash
|
||||
REASONIX_SEARCH=off npx reasonix code
|
||||
```
|
||||
|
||||
**Bring your own** (Kagi, SearXNG, internal caches): implement the
|
||||
`WebSearchProvider` interface and call
|
||||
`registerWebTools(registry, { provider })` yourself, or bridge an
|
||||
existing MCP search server via `--mcp`.
|
||||
|
||||
---
|
||||
|
||||
## MCP — bring your own tools
|
||||
|
||||
Any [MCP](https://spec.modelcontextprotocol.io/) server works. The
|
||||
wizard lets you pick from a catalog, or drive it by flag:
|
||||
|
||||
```bash
|
||||
# stdio (local subprocess)
|
||||
npx reasonix --mcp "fs=npx -y @modelcontextprotocol/server-filesystem /tmp/safe"
|
||||
|
||||
# multiple at once
|
||||
npx reasonix \
|
||||
--mcp "fs=npx -y @modelcontextprotocol/server-filesystem /tmp/safe" \
|
||||
--mcp "demo=npx tsx examples/mcp-server-demo.ts"
|
||||
|
||||
# HTTP+SSE (remote / hosted)
|
||||
npx reasonix --mcp "kb=https://mcp.example.com/sse"
|
||||
```
|
||||
|
||||
`reasonix mcp list` shows the curated catalog. `reasonix mcp inspect
|
||||
<spec>` connects once and dumps the server's tools / resources /
|
||||
prompts without starting a chat. Progress notifications from
|
||||
long-running tools (2025-03-26 spec) render live as a progress bar
|
||||
in the spinner.
|
||||
|
||||
Supported transports: **stdio** (local command) and **HTTP+SSE**
|
||||
(remote, MCP 2024-11-05 spec).
|
||||
|
||||
---
|
||||
|
||||
## CLI reference
|
||||
|
||||
```bash
|
||||
npx reasonix code [path] # coding mode scoped to path (default: cwd)
|
||||
npx reasonix # chat (uses saved config)
|
||||
npx reasonix setup # reconfigure the wizard
|
||||
npx reasonix chat --session work # named session
|
||||
npx reasonix chat --no-session # ephemeral
|
||||
npx reasonix run "ask anything" # one-shot, streams to stdout
|
||||
npx reasonix stats session.jsonl # summarize a transcript
|
||||
npx reasonix replay chat.jsonl # rebuild cost/cache from a transcript
|
||||
npx reasonix diff a.jsonl b.jsonl --md # compare two transcripts
|
||||
npx reasonix mcp list # curated MCP catalog
|
||||
npx reasonix mcp inspect <spec> # probe a single MCP server
|
||||
npx reasonix sessions # list saved sessions
|
||||
```
|
||||
|
||||
Common flags:
|
||||
|
||||
```bash
|
||||
--preset <fast|smart|max> # bundle (model + harvest + branch)
|
||||
--model <id> # explicit model id
|
||||
--harvest / --no-harvest # R1 plan-state extraction
|
||||
--branch <N> # self-consistency budget
|
||||
--mcp "name=cmd args…" # attach an MCP server (repeatable)
|
||||
--transcript path.jsonl # write a JSONL transcript on the side
|
||||
--session <name> # named session (default: per-dir for code mode)
|
||||
--no-session # ephemeral
|
||||
--no-config # ignore ~/.reasonix/config.json (CI-friendly)
|
||||
```
|
||||
|
||||
Env vars (win over config):
|
||||
|
||||
```bash
|
||||
export DEEPSEEK_API_KEY=sk-...
|
||||
export DEEPSEEK_BASE_URL=https://... # optional alternate endpoint
|
||||
export REASONIX_MEMORY=off # disable REASONIX.md + user memory
|
||||
export REASONIX_SEARCH=off # disable web_search / web_fetch
|
||||
export REASONIX_UI=plain # disable live rows (ghosting workaround)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Library usage
|
||||
|
||||
```ts
|
||||
import {
|
||||
CacheFirstLoop,
|
||||
DeepSeekClient,
|
||||
ImmutablePrefix,
|
||||
ToolRegistry,
|
||||
} from "reasonix";
|
||||
|
||||
const client = new DeepSeekClient(); // reads DEEPSEEK_API_KEY from env
|
||||
const tools = new ToolRegistry();
|
||||
|
||||
tools.register({
|
||||
name: "add",
|
||||
description: "Add two integers",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: { a: { type: "integer" }, b: { type: "integer" } },
|
||||
required: ["a", "b"],
|
||||
},
|
||||
fn: ({ a, b }: { a: number; b: number }) => a + b,
|
||||
});
|
||||
|
||||
const loop = new CacheFirstLoop({
|
||||
client,
|
||||
tools,
|
||||
prefix: new ImmutablePrefix({
|
||||
system: "You are a math helper.",
|
||||
toolSpecs: tools.specs(),
|
||||
}),
|
||||
harvest: true,
|
||||
branch: 3,
|
||||
});
|
||||
|
||||
for await (const ev of loop.step("What is 17 + 25?")) {
|
||||
if (ev.role === "assistant_final") console.log(ev.content);
|
||||
}
|
||||
console.log(loop.stats.summary());
|
||||
```
|
||||
|
||||
`ChatOptions.seedTools` accepts a pre-built `ToolRegistry` for
|
||||
callers who want the `reasonix code` loop wiring without the CLI
|
||||
wrapper. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for
|
||||
internals.
|
||||
|
||||
---
|
||||
|
||||
## Benchmarks — verify the cache-hit claim yourself
|
||||
|
||||
Every abstraction here earns its weight against a DeepSeek-specific
|
||||
property — dirt-cheap tokens, R1 reasoning traces, automatic prefix
|
||||
caching, JSON mode. Generic wrappers leave these on the table.
|
||||
|
||||
| | Reasonix default | generic frameworks |
|
||||
|---|---|---|
|
||||
| Prefix-stable loop (→ 85–95% cache hit) | yes | no (prompts rebuilt each turn) |
|
||||
| Auto-flatten deep tool schemas | yes | no (DeepSeek drops args) |
|
||||
| Retry with jittered backoff (429/503) | yes | no (custom callbacks) |
|
||||
| Scavenge tool calls leaked into `<think>` | yes | no |
|
||||
| Call-storm breaker on identical-arg repeats | yes | no |
|
||||
| Live cache-hit / cost / vs-Claude panel | yes | no |
|
||||
|
||||
On the same τ-bench-lite workload — 8 multi-turn tool-use tasks × 3
|
||||
repeats = 48 runs per side, live DeepSeek `deepseek-chat`, sole
|
||||
variable prefix stability:
|
||||
|
||||
| metric | baseline (cache-hostile) | Reasonix | delta |
|
||||
|---|---:|---:|---:|
|
||||
| cache hit | 46.6% | **94.4%** | +47.7 pp |
|
||||
| cost / task | $0.002599 | $0.001579 | **−39%** |
|
||||
| pass rate | 96% (23/24) | **100% (24/24)** | — |
|
||||
|
||||
**Reproduce without spending an API credit:**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/esengine/reasonix.git && cd reasonix && npm install
|
||||
npx reasonix replay benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl
|
||||
npx reasonix diff \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.baseline.r1.jsonl \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl
|
||||
```
|
||||
|
||||
The committed JSONL transcripts carry per-turn `usage`, `cost`, and
|
||||
`prefixHash`. Reasonix's prefix hash stays byte-stable across every
|
||||
model call; baseline's churns on every turn. The cache delta is
|
||||
*mechanically* attributable to log stability, not to a different
|
||||
system prompt.
|
||||
|
||||
Full 48-run report:
|
||||
[`benchmarks/tau-bench/report.md`](./benchmarks/tau-bench/report.md).
|
||||
Reproduce with your own API key: `npx tsx
|
||||
benchmarks/tau-bench/runner.ts --repeats 3`.
|
||||
|
||||
MCP reference runs (one single prefix hash across all 5 turns even
|
||||
with two concurrent MCP subprocesses):
|
||||
|
||||
| server | turns | cache hit | cost | vs Claude |
|
||||
|---|---:|---:|---:|---:|
|
||||
| bundled demo (`add` / `echo` / `get_time`) | 2 | **96.6%** (turn 2) | $0.000254 | −94.0% |
|
||||
| official `server-filesystem` | 5 | **96.7%** | $0.001235 | −97.0% |
|
||||
| **both concurrently** | 5 | **81.1%** | $0.001852 | −95.9% |
|
||||
|
||||
---
|
||||
|
||||
## Non-goals
|
||||
|
||||
- **Multi-agent orchestration / sub-agents** (use LangGraph).
|
||||
- **Workflow DSL / DAG scheduler / parallel-branch engine** — skills
|
||||
are prose; the model sequences via the normal tool-use loop.
|
||||
Keeps single-loop + append-only + cache-first invariants intact.
|
||||
- **Multi-provider abstraction** (use LiteLLM). Reasonix is
|
||||
DeepSeek-only on purpose — every pillar (cache-first loop, R1
|
||||
harvesting, tool-call repair) is tuned against DeepSeek-specific
|
||||
behavior and economics. Coupling to one backend is the feature.
|
||||
- **RAG / vector stores** (use LlamaIndex).
|
||||
- **Web UI / SaaS.**
|
||||
|
||||
Reasonix does DeepSeek, deeply.
|
||||
|
||||
---
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
git clone https://github.com/esengine/reasonix.git
|
||||
cd reasonix
|
||||
npm install
|
||||
npm run dev code # run CLI from source via tsx
|
||||
npm run build # tsup to dist/
|
||||
npm test # vitest (1007 tests)
|
||||
npm run lint # biome
|
||||
npm run typecheck # tsc --noEmit
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -0,0 +1,721 @@
|
||||
<p align="center">
|
||||
<img src="docs/logo.svg" alt="Reasonix — DeepSeek 原生的 agent 框架" width="640"/>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<em>为 DeepSeek V4(flash + pro)打造的缓存优先 agent 循环 — Ink TUI、原生 MCP、不依赖 LangChain。</em>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="./README.md">English</a> · <strong>简体中文</strong> · <a href="https://esengine.github.io/reasonix/">官方网站</a>
|
||||
</p>
|
||||
|
||||
# Reasonix
|
||||
|
||||
[](https://www.npmjs.com/package/reasonix)
|
||||
[](https://github.com/esengine/reasonix/actions/workflows/ci.yml)
|
||||
[](./LICENSE)
|
||||
[](https://www.npmjs.com/package/reasonix)
|
||||
[](./package.json)
|
||||
|
||||
**DeepSeek 原生的终端 AI 编程代理。** 编辑以可审查的 SEARCH/REPLACE 块呈现,
|
||||
落盘前必须确认。Ink TUI、原生 MCP、不依赖 LangChain。
|
||||
|
||||
---
|
||||
|
||||
## 60 秒快速上手
|
||||
|
||||
**1. 获取 DeepSeek API Key。** 注册即送免费额度:
|
||||
<https://platform.deepseek.com/api_keys>
|
||||
|
||||
**2. 切到项目目录运行。** 无需安装。
|
||||
|
||||
```bash
|
||||
cd my-project
|
||||
npx reasonix code
|
||||
```
|
||||
|
||||
首次运行会走 30 秒向导(粘贴 API key → 选预设 → 多选 MCP 服务器)。
|
||||
之后每次直接进入。
|
||||
|
||||
**3. 让它改代码。** 模型会以 SEARCH/REPLACE 块的形式提出编辑——
|
||||
你不 `/apply`,磁盘不会被改。
|
||||
|
||||
```
|
||||
reasonix code › users.ts 里 findByEmail 对大小写敏感导致登录失败,帮我改
|
||||
|
||||
assistant
|
||||
▸ tool<search_files> → src/users.ts, src/users.test.ts
|
||||
▸ tool<read_file> → (src/users.ts, 412 chars)
|
||||
▸ 找到了。findByEmail 直接用 === 比对。改成小写规范化并补一条测试。
|
||||
|
||||
src/users.ts
|
||||
<<<<<<< SEARCH
|
||||
return users.find(u => u.email === email);
|
||||
=======
|
||||
const needle = email.toLowerCase();
|
||||
return users.find(u => u.email.toLowerCase() === needle);
|
||||
>>>>>>> REPLACE
|
||||
|
||||
▸ 1 处待应用编辑(1 个文件)— /apply 写入 · /discard 丢弃
|
||||
|
||||
reasonix code › /apply
|
||||
▸ ✓ applied src/users.ts
|
||||
```
|
||||
|
||||
要求 Node ≥ 20.10。支持 macOS、Linux、Windows(PowerShell · Git Bash ·
|
||||
Windows Terminal)。任何时候按 `Esc` 中断;`/help` 查看完整命令列表。
|
||||
|
||||
---
|
||||
|
||||
## `reasonix code` — 终端里的结对编程
|
||||
|
||||
作用域为启动目录。模型自带 `read_file` / `write_file` / `edit_file` /
|
||||
`list_directory` / `search_files` / `directory_tree` / `get_file_info` /
|
||||
`create_directory` / `move_file`,全部在沙箱内 —— 任何解析后落到启动根目录之外
|
||||
的路径(包括 `..` 或符号链接逃逸)都会被拒绝。再加上带只读白名单的
|
||||
`run_command`;任何会修改状态的命令(`npm install`、`git commit` 等)都要走
|
||||
确认弹窗。
|
||||
|
||||
### 流程演示:先看再改
|
||||
|
||||
对于"这段代码做什么用?"这类问题,模型会用读取类工具,然后用散文回答 ——
|
||||
不会出 SEARCH/REPLACE 块、也不会写文件。只有你明确要求修改时它才动手:
|
||||
|
||||
```
|
||||
reasonix code › 这个项目的路由是怎么组织的?
|
||||
assistant
|
||||
▸ tool<directory_tree> → (src/ tree, 47 entries)
|
||||
▸ tool<read_file> → (src/router.ts, 1.2 KB)
|
||||
▸ 路由分三层:顶层 AppRouter 注册 tab,每个 tab 用 React Router 的
|
||||
nested routes 写子路径,最后 …
|
||||
```
|
||||
|
||||
`edit_file` 的 SEARCH 块如果没有按字节精确匹配文件内容,编辑会被显式拒绝
|
||||
而不是模糊匹配。模型能看到错误并自行重试 —— 比起"静默改错","显式拒绝"
|
||||
是更安全的失败方式。
|
||||
|
||||
### Plan 模式 —— 执行前先审阅
|
||||
|
||||
任何比"改个 typo"更大的改动,模型会被引导先提交一份 markdown 计划。
|
||||
你会看到 **批准 / 重做 / 取消** 三选一:
|
||||
|
||||
```
|
||||
reasonix code › 把 auth 从 JWT 迁移到 session cookies
|
||||
|
||||
▸ plan submitted — awaiting your review
|
||||
────────────────────────────────────────
|
||||
## Summary
|
||||
Swap JWT middleware for session cookies, keep user table intact.
|
||||
|
||||
## Files
|
||||
- src/auth/middleware.ts — replace `verifyJwt` with `readSession`
|
||||
- src/auth/session.ts — new file, in-memory store + signed cookie
|
||||
- src/routes/login.ts — return Set-Cookie instead of a token
|
||||
- tests/auth/*.test.ts — update fixtures
|
||||
|
||||
## Risks
|
||||
- Existing logged-in users get logged out (no migration).
|
||||
- Session store is in-memory; restart clears sessions.
|
||||
────────────────────────────────────────
|
||||
▸ Approve and implement
|
||||
Refine — explore more
|
||||
Cancel
|
||||
```
|
||||
|
||||
**强制启用** 用 `/plan` —— 进入显式只读阶段:模型必须先提交计划,否则任何
|
||||
编辑或非白名单 shell 调用都不会执行。适合那些你想先审一遍再让模型动手的
|
||||
高风险改动。`/plan off` 或在弹窗里选 Approve/Cancel 退出。
|
||||
|
||||
### 输入前缀 —— `!cmd` 与 `@path`
|
||||
|
||||
两个不需要斜杠的内联快捷方式:
|
||||
|
||||
**`!<cmd>` —— 在沙箱里跑 shell 命令并把结果喂给模型。** 像 bash 一样在
|
||||
prompt 里直接打。输出既会进入可见日志,也会进入会话 —— 模型下一轮会基于它
|
||||
推理:
|
||||
|
||||
```
|
||||
reasonix code › !git status --short
|
||||
▸ M src/users.ts
|
||||
▸ M src/users.test.ts
|
||||
|
||||
reasonix code › 把这两个文件的改动说明一下
|
||||
assistant
|
||||
▸ tool<read_file> → src/users.ts, src/users.test.ts
|
||||
▸ …
|
||||
```
|
||||
|
||||
无白名单门 —— 用户主动输入的 shell 命令就是显式同意。60 秒超时、32k 字符
|
||||
上限,0.5.14 起会话恢复后依然保留。
|
||||
|
||||
**`@path/to/file` —— 内联一个文件作为 "Referenced files"。** 输入 `@`
|
||||
弹出选择器(↑/↓ 切换、Tab/Enter 插入)。比让模型 `read_file` 后再问更省事:
|
||||
"@src/users.ts 这个文件做什么用?"。沙箱限定:仅相对路径、不允许 `..`、单
|
||||
文件 64KB 上限。最近用过的文件排在前面。
|
||||
|
||||
### `/commit` —— 一步暂存 + 提交
|
||||
|
||||
```
|
||||
reasonix code › /commit "fix: findByEmail case-insensitive"
|
||||
▸ git add -A && git commit -m "fix: findByEmail case-insensitive"
|
||||
[main a1b2c3d] fix: findByEmail case-insensitive
|
||||
```
|
||||
|
||||
### 一些值得试试的命令
|
||||
|
||||
- `/tool 1` —— 打印最后一次工具调用的完整输出(当 400 字内联剪辑不够看时)。
|
||||
- `/think` —— 看上一轮模型的完整推理(思考模式:v4-flash / v4-pro / reasoner 别名)。
|
||||
- `/undo` —— 回滚上一批已应用的编辑。
|
||||
- `/new` —— 在同一目录开新会话,但不丢失旧会话文件。
|
||||
- `/effort high` —— 从默认 `max` agent 推理强度降一档,简单任务更省更快。
|
||||
- `npx reasonix code --preset max` —— v4-pro + 三路 self-consistency 分支,
|
||||
适合疑难重构。
|
||||
- `npx reasonix code src/` —— 更窄的沙箱(只有 `src/` 可写)。
|
||||
- `npx reasonix code --no-session` —— 临时会话,什么都不存。
|
||||
|
||||
### `reasonix stats` —— 你到底省了多少?
|
||||
|
||||
每次 `reasonix chat|code|run` 跑完都会往
|
||||
`~/.reasonix/usage.jsonl` 追加一条精简记录(token + 成本 + Claude Sonnet
|
||||
4.6 同负载下的等价价格)。`reasonix stats` 不带参数会把日志聚合成今日 /
|
||||
本周 / 本月 / 历史 四个窗口:
|
||||
|
||||
```
|
||||
Reasonix usage — /Users/you/.reasonix/usage.jsonl
|
||||
|
||||
turns cache hit cost (USD) vs Claude saved
|
||||
----------------------------------------------------------------------
|
||||
today 8 95.1% $0.004821 $0.1348 96.4%
|
||||
week 34 93.8% $0.023104 $0.6081 96.2%
|
||||
month 127 94.2% $0.081530 $2.1452 96.2%
|
||||
all-time 342 94.0% $0.210881 $5.8934 96.4%
|
||||
```
|
||||
|
||||
隐私:日志里只有 token、成本和你自己取的 session 名。没有 prompt、没有
|
||||
completion、没有工具参数。`reasonix stats <transcript>` 仍兼容老用法
|
||||
(按文件出 assistant turn + tool call 摘要)。
|
||||
|
||||
### 保持最新
|
||||
|
||||
面板顶栏在 `Reasonix` 旁边显示当前版本(如
|
||||
`Reasonix v0.5.21 · deepseek-v4-pro · harvest · max …`,最后那个 `max` 是
|
||||
推理强度徽章 —— `/effort high` 可降一档)。后台每 24 小时静默查询一次 npm
|
||||
registry,发现新版会在同一行右侧显示黄色 `update: X.Y.Z`。不阻塞、不烦人,
|
||||
每天最多查一次,离线 / 防火墙下静默失败。
|
||||
|
||||
```bash
|
||||
reasonix update # 打印当前 vs 最新,并执行 `npm i -g reasonix@latest`
|
||||
reasonix update --dry-run # 只打印计划,不实际安装
|
||||
```
|
||||
|
||||
通过 `npx` 用?命令会识别这种情况并改为打印 cache 刷新提示 —— npx 在下次
|
||||
调用时会自动取最新版本。
|
||||
|
||||
### 项目约定 —— `REASONIX.md`
|
||||
|
||||
把 `REASONIX.md` 放到项目根目录,每次启动都会被钉进 system prompt。可提交
|
||||
的团队记忆 —— 房间约定、领域词表、模型老忘的事情:
|
||||
|
||||
```bash
|
||||
cat > REASONIX.md <<'EOF'
|
||||
# Notes for Reasonix
|
||||
- Use snake_case for new Python modules; legacy camelCase modules keep their style.
|
||||
- `cargo check` is in the auto-run allowlist; full `cargo test` needs confirmation.
|
||||
- The `api/` dir mirrors `backend/` — keep schemas in sync.
|
||||
EOF
|
||||
```
|
||||
|
||||
重启(或 `/new`)后生效;前缀每会话只哈希一次,让 DeepSeek 的缓存保持热。
|
||||
`/memory` 打印当前已钉的内容。`REASONIX_MEMORY=off` 在 CI / 离线复现时关闭
|
||||
所有记忆来源。
|
||||
|
||||
### 用户记忆 —— `~/.reasonix/memory/`
|
||||
|
||||
第二层 **私人按用户** 的记忆放在你的 home 目录。不像 `REASONIX.md` 会被
|
||||
提交,模型自己也能通过 `remember` 工具往里写。两个作用域:
|
||||
|
||||
- `~/.reasonix/memory/global/` —— 跨项目(你的偏好、工具链)。
|
||||
- `~/.reasonix/memory/<project-hash>/` —— 限定一个 `reasonix code` 沙箱
|
||||
根目录(决策、本地事实、按仓库的快捷方式)。
|
||||
|
||||
每个作用域都维护一个总是加载的 `MEMORY.md` 索引(一行一条)+ 零或多个
|
||||
`<name>.md` 详情文件(按需通过 `recall_memory` 加载)。写入立刻生效;钉进
|
||||
system prompt 在下一次 `/new` 或重启时生效,以保证当前会话的缓存前缀稳定。
|
||||
|
||||
```
|
||||
reasonix code › 我用 bun 而不是 npm,请以后都用 bun 跑构建
|
||||
|
||||
assistant
|
||||
▸ tool<remember> → project/bun_build saved
|
||||
"Build command on this machine is `bun run build`"
|
||||
```
|
||||
|
||||
**斜杠**:`/memory` · `/memory list` · `/memory show <name>` ·
|
||||
`/memory forget <name>` · `/memory clear <scope> confirm`。
|
||||
**模型工具**:`remember(type, scope, name, description, content)` ·
|
||||
`forget(scope, name)` · `recall_memory(scope, name)`。
|
||||
|
||||
项目作用域只在 `reasonix code` 里可用(需要真实的沙箱根来计算哈希);纯
|
||||
`reasonix` 只有全局作用域。
|
||||
|
||||
### Skills —— 用户自定义的 prompt 包
|
||||
|
||||
Skill 就是你写在磁盘上的散文指令块。Reasonix 把它们的名字 + 一行描述钉
|
||||
进 system prompt;模型可以在合适时机自动调 `run_skill({name: "..."})`,
|
||||
你也可以打 `/skill <name> [args]` 手动触发。
|
||||
|
||||
两个作用域,与用户记忆同样的布局:
|
||||
|
||||
- `<project>/.reasonix/skills/` —— 按项目(提交进 git 给团队,或加入
|
||||
`.gitignore` 做个人草稿)。
|
||||
- `~/.reasonix/skills/` —— 全局,到处可用。
|
||||
|
||||
两种文件结构都行:`<name>/SKILL.md`(推荐 —— 可同时打包附带资源)或扁平
|
||||
`<name>.md`。
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: review
|
||||
description: Review uncommitted changes and flag risks
|
||||
---
|
||||
|
||||
Run `git diff` on staged and unstaged changes. Summarize what each
|
||||
hunk does, call out potential regressions, and list files that might
|
||||
need additional tests. Don't propose edits unless I ask.
|
||||
```
|
||||
|
||||
用法:
|
||||
|
||||
```
|
||||
reasonix code › /skill review
|
||||
▸ running skill: review
|
||||
assistant
|
||||
▸ tool<run_command> → git diff --cached
|
||||
▸ 3 改动,1 个需要回归测试 …
|
||||
```
|
||||
|
||||
或者让模型自己挑 —— 因为 skill 名字 + 描述都在前缀里,问 "帮我看下未提交
|
||||
的改动有没有风险" 就会触发 `run_skill({name: "review"})`,不用你打斜杠。
|
||||
|
||||
**斜杠**:`/skill`(列出) · `/skill show <name>` · `/skill <name>
|
||||
[args]`(把 body 作为用户轮注入)。
|
||||
|
||||
**故意不绑死** 任何其他客户端的目录约定(`.claude/skills` 等等)——
|
||||
Reasonix 在对话层是模型无关的。任何 SKILL.md 都能用;body 是散文,所以
|
||||
为别的工具写的 skill 多半能直接用(Reasonix 工具名不同 —— `filesystem`
|
||||
/ `shell` / `web` —— 但模型读到指令后会挑我们的等价工具)。
|
||||
|
||||
### Hooks —— 围绕工具调用与轮次自动化
|
||||
|
||||
在 `.reasonix/`(项目或 `~/`)放一个 `settings.json`,Reasonix 会在
|
||||
循环里四个常见的点触发 shell 命令:工具运行前、工具返回后、prompt 到达
|
||||
模型前、轮次结束后。
|
||||
|
||||
```json
|
||||
// <project>/.reasonix/settings.json ← 可提交
|
||||
// ~/.reasonix/settings.json ← 按用户
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [{ "match": "edit_file|write_file", "command": "bun scripts/guard.ts" }],
|
||||
"PostToolUse": [{ "match": "edit_file", "command": "biome format --write" }],
|
||||
"UserPromptSubmit": [{ "command": "echo $(date +%s) >> ~/.reasonix/prompts.log" }],
|
||||
"Stop": [{ "command": "bun test --run", "timeout": 60000 }]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
每个 hook 都是 shell 命令。Reasonix 调用时通过 stdin 传一份 JSON 信封,
|
||||
描述事件:
|
||||
|
||||
```json
|
||||
{ "event": "PreToolUse", "cwd": "/path/to/project",
|
||||
"toolName": "edit_file", "toolArgs": { "path": "src/x.ts", "..." } }
|
||||
```
|
||||
|
||||
退出码决定走向:
|
||||
|
||||
- **0** —— 通过;循环正常继续
|
||||
- **2** —— 阻断(仅对 `PreToolUse` / `UserPromptSubmit` 生效);hook 的
|
||||
stderr 会作为合成工具结果让模型看到,或者整条 prompt 直接被丢弃
|
||||
- **其他** —— 警告;循环继续,stderr 渲染为黄色行内提示
|
||||
|
||||
`match` 是对工具名的锚定正则;`*` 或省略匹配所有工具。项目 hook 先于全局
|
||||
hook 触发。默认超时:阻断类事件 5 秒,日志类事件 30 秒;可在每条 hook 里
|
||||
用 `timeout` 覆盖。
|
||||
|
||||
**斜杠**:`/hooks`(列出当前生效的 hook)· `/hooks reload`(不丢会话从磁盘
|
||||
重读 `settings.json`)。
|
||||
|
||||
### 在 TUI 里保持最新
|
||||
|
||||
`/update` 在运行中的会话里会显示当前版本、最近一次后台 24h 检查取到的最新
|
||||
版本,以及实际安装命令。这条斜杠 **不会** 直接 spawn `npm install` ——
|
||||
stdio:inherit 进入正在跑的 Ink 渲染器会把显示搞乱。要真正升级请退出会话,
|
||||
在新 shell 里执行 `reasonix update`。
|
||||
|
||||
---
|
||||
|
||||
## `reasonix` —— 也能当通用聊天
|
||||
|
||||
同一套 TUI,没有文件系统工具(除非你通过 MCP 主动接入)。适合起草、问答、
|
||||
schema 设计、架构讨论,或者驱动你自己的 MCP 服务器。会话按名字保存在
|
||||
`~/.reasonix/sessions/`。
|
||||
|
||||
```bash
|
||||
npx reasonix # 用已保存配置 + 向导选过的 MCP
|
||||
npx reasonix --preset smart # 这次跑用 reasoner + R1 harvest
|
||||
npx reasonix --session design # 命名会话 — 之后 --session design 续聊
|
||||
```
|
||||
|
||||
临时挂 MCP 服务器:
|
||||
|
||||
```bash
|
||||
npx reasonix \
|
||||
--mcp "fs=npx -y @modelcontextprotocol/server-filesystem /tmp/safe" \
|
||||
--mcp "kb=https://mcp.example.com/sse"
|
||||
```
|
||||
|
||||
MCP 工具走和原生工具一样的 Cache-First + 修复 + 上下文安全管线 —— 32k
|
||||
结果上限、实时进度通知渲染、自动重试。
|
||||
|
||||
---
|
||||
|
||||
## 会话内命令
|
||||
|
||||
**核心**
|
||||
|
||||
| 命令 | 作用 |
|
||||
|---|---|
|
||||
| `/help` · `/?` | 完整命令参考(带提示) |
|
||||
| `/status` | 当前模型 · flag · 上下文 · 会话 |
|
||||
| `/new` · `/reset` | 同会话内开新对话 |
|
||||
| `/clear` | 仅清空可见 scrollback(日志保留) |
|
||||
| `/retry` | 截断并重发上一条消息(重新采样) |
|
||||
| `/exit` · `/quit` | 退出 |
|
||||
|
||||
**模型**
|
||||
|
||||
| 命令 | 作用 |
|
||||
|---|---|
|
||||
| `/preset <fast\|smart\|max>` | 一键预设(model + harvest + branch) |
|
||||
| `/model <id>` | 切换 DeepSeek 模型(`deepseek-v4-flash`、`deepseek-v4-pro`,加上 `deepseek-chat` / `deepseek-reasoner` 兼容别名) |
|
||||
| `/models` | 列出 DeepSeek `/models` 端点的可用模型 |
|
||||
| `/harvest [on\|off]` | 切换 R1 plan-state 提取 |
|
||||
| `/branch <N\|off>` | 每轮跑 N 路并行采样,挑最佳(N ≥ 2) |
|
||||
| `/effort <high\|max>` | reasoning_effort 上限 —— `max` 是 agent 默认,`high` 更便宜更快 |
|
||||
| `/think` | 打印上一轮的完整 thinking-mode 推理 |
|
||||
|
||||
**上下文与工具**
|
||||
|
||||
| 命令 | 作用 |
|
||||
|---|---|
|
||||
| `/mcp` | 列出已挂载的 MCP 服务器及其 tool / resource / prompt |
|
||||
| `/resource [uri]` | 浏览 + 读取 MCP resource(无参 → 列 URI;`<uri>` → 拉取) |
|
||||
| `/prompt [name]` | 浏览 + 拉取 MCP prompt |
|
||||
| `/tool [N]` | 打印第 N 次工具调用的完整输出(1 = 最近) |
|
||||
| `/compact [tokens]` | 压缩日志里超大的工具结果(默认每条结果 4000 tokens) |
|
||||
| `/context` | 看上下文 token 都花在哪(system / tools / log) |
|
||||
| `/stats` | 跨会话成本仪表盘(today / week / month / all-time) |
|
||||
| `/keys` | 键盘快捷键 + 输入前缀(`!` / `@` / `/`)速查 |
|
||||
|
||||
**记忆与 Skill**
|
||||
|
||||
| 命令 | 作用 |
|
||||
|---|---|
|
||||
| `/memory` | 显示已钉记忆(REASONIX.md + ~/.reasonix/memory) |
|
||||
| `/memory list` · `show <name>` · `forget <name>` · `clear <scope> confirm` | 管理记忆库 |
|
||||
| `/skill` · `/skill list` | 列出已发现的 skill(项目 + 全局) |
|
||||
| `/skill show <name>` | 打印某个 skill 的 body |
|
||||
| `/skill <name> [args]` | 运行 skill(把 body 作为用户轮注入) |
|
||||
|
||||
**会话**
|
||||
|
||||
| 命令 | 作用 |
|
||||
|---|---|
|
||||
| `/sessions` | 列出已保存的会话(当前用 `▸` 标记) |
|
||||
| `/forget` | 从磁盘删除当前会话 |
|
||||
| `/setup` | 重新配置(退出后跑 `reasonix setup`) |
|
||||
|
||||
**只在 code 模式下** (`reasonix code`)
|
||||
|
||||
| 命令 | 作用 |
|
||||
|---|---|
|
||||
| `/apply` | 把待应用的 SEARCH/REPLACE 块写入磁盘 |
|
||||
| `/discard` | 丢弃待应用的编辑块 |
|
||||
| `/undo` | 回滚最后一批已应用的编辑 |
|
||||
| `/commit "msg"` | `git add -A && git commit -m "msg"` |
|
||||
| `/plan [on\|off]` | 切换只读 plan 模式 |
|
||||
| `/apply-plan` | 强制批准当前待审计划 |
|
||||
|
||||
**键盘**
|
||||
|
||||
- `Enter` —— 提交
|
||||
- `Shift+Enter` / `Ctrl+J` —— 换行(多行粘贴也行;
|
||||
`\` + Enter 是跨平台兜底)
|
||||
- `↑` / `↓` —— 空闲时翻 prompt 历史;在斜杠自动补全里上下选
|
||||
- `/foo` 前缀下按 `Tab` / `Enter` —— 接受高亮的建议
|
||||
- `Esc` —— 中断当前轮(停 API 调用、取消进行中的工具、拒绝待响应的 MCP 请求)
|
||||
- 确认弹窗里的 `y` / `n` —— 快捷接受 / 拒绝
|
||||
|
||||
---
|
||||
|
||||
## 会话与安全网
|
||||
|
||||
- 会话以 JSONL 形式保存在 `~/.reasonix/sessions/<name>.jsonl`(`reasonix
|
||||
code` 按目录分)。每条消息都原子追加;`Ctrl+C` 不会丢上下文。
|
||||
- 工具结果每次调用最多 32k 字符。超大会话加载时自动自愈(缩小并重写文件)。
|
||||
- 每次出站 API 调用前会校验 `assistant.tool_calls` / `tool` 的配对,损坏的
|
||||
会话不会一直 400。
|
||||
- 上下文仪表 50% 变黄、80% 变红并提示 `/compact`。接近 1M token 上限
|
||||
(V4 flash + pro)会先尝试自动压缩,再退化为强制总结。
|
||||
- `reasonix code` 沙箱拒绝任何解析后落到启动目录之外的路径(含符号链接
|
||||
逃逸和 `..` 穿越)。
|
||||
|
||||
### 故障排查:重复行 / 鬼影渲染
|
||||
|
||||
有些 Windows 终端(Git Bash / MINTTY / winpty 包装的 shell)没完整实现
|
||||
Ink 用的 ANSI cursor-up 转义。表现:spinner、流式预览、工具结果行不在原地
|
||||
覆盖刷新,反而在 scrollback 里印出多份。
|
||||
|
||||
遇到了就用 plain 模式:
|
||||
|
||||
```bash
|
||||
REASONIX_UI=plain npx reasonix code
|
||||
```
|
||||
|
||||
Plain 模式抑制了实时 / 动画行,关掉了内部 tick 计时器。代价是失去流式预览
|
||||
和 spinner,但 scrollback 稳定。Windows Terminal、Windows Terminal 里的
|
||||
PowerShell 7、WezTerm 不需要这个开关。
|
||||
|
||||
---
|
||||
|
||||
## Web 搜索 —— 默认开
|
||||
|
||||
模型一启动就有两个 web 工具:`web_search` 和 `web_fetch`。无 flag、无 API
|
||||
key、无注册。当你问到模型训练时没见过的事(新发布、最近事件、冷门 API),
|
||||
它会自己决定调 `web_search`;snippet 不够就跟一个 `web_fetch`。
|
||||
|
||||
底层是 **Mojeek** 的公开搜索页 —— 独立 web 索引,bot 友好,无 cookie /
|
||||
session。冷门或非常新的查询覆盖率比 Google/Bing 薄一些,但脚本里很可靠。
|
||||
(DDG 是原始后端,但 2026 年开始上反机器人页。)
|
||||
|
||||
**关掉**(离线 / 隐私 / CI):
|
||||
|
||||
```json
|
||||
// ~/.reasonix/config.json
|
||||
{ "apiKey": "sk-…", "search": false }
|
||||
```
|
||||
|
||||
```bash
|
||||
REASONIX_SEARCH=off npx reasonix code
|
||||
```
|
||||
|
||||
**接自己的**(Kagi、SearXNG、内部缓存):实现 `WebSearchProvider` 接口
|
||||
然后自己调 `registerWebTools(registry, { provider })`,或通过 `--mcp`
|
||||
桥接已有的 MCP 搜索服务器。
|
||||
|
||||
---
|
||||
|
||||
## MCP —— 自带工具
|
||||
|
||||
任意 [MCP](https://spec.modelcontextprotocol.io/) 服务器都能用。向导内置
|
||||
目录可选,或用 flag 直接挂:
|
||||
|
||||
```bash
|
||||
# stdio(本地子进程)
|
||||
npx reasonix --mcp "fs=npx -y @modelcontextprotocol/server-filesystem /tmp/safe"
|
||||
|
||||
# 同时挂多个
|
||||
npx reasonix \
|
||||
--mcp "fs=npx -y @modelcontextprotocol/server-filesystem /tmp/safe" \
|
||||
--mcp "demo=npx tsx examples/mcp-server-demo.ts"
|
||||
|
||||
# HTTP+SSE(远程 / 托管)
|
||||
npx reasonix --mcp "kb=https://mcp.example.com/sse"
|
||||
```
|
||||
|
||||
`reasonix mcp list` 显示精选目录。`reasonix mcp inspect <spec>` 不开聊天,
|
||||
直接连一次并打印服务器的 tool / resource / prompt。长任务的进度通知
|
||||
(2025-03-26 spec)会以进度条形式实时渲染在 spinner 里。
|
||||
|
||||
支持的传输:**stdio**(本地命令)和 **HTTP+SSE**(远程,MCP 2024-11-05
|
||||
spec)。
|
||||
|
||||
---
|
||||
|
||||
## CLI 参考
|
||||
|
||||
```bash
|
||||
npx reasonix code [path] # 编程模式,作用域 path(默认 cwd)
|
||||
npx reasonix # 聊天(用已保存配置)
|
||||
npx reasonix setup # 重跑配置向导
|
||||
npx reasonix chat --session work # 命名会话
|
||||
npx reasonix chat --no-session # 临时会话
|
||||
npx reasonix run "ask anything" # 一次性运行,结果流到 stdout
|
||||
npx reasonix stats session.jsonl # 总结一份 transcript
|
||||
npx reasonix replay chat.jsonl # 从 transcript 重建成本/缓存视图
|
||||
npx reasonix diff a.jsonl b.jsonl --md # 对比两份 transcript
|
||||
npx reasonix mcp list # 精选 MCP 目录
|
||||
npx reasonix mcp inspect <spec> # 探测单个 MCP 服务器
|
||||
npx reasonix sessions # 列已保存会话
|
||||
```
|
||||
|
||||
常用 flag:
|
||||
|
||||
```bash
|
||||
--preset <fast|smart|max> # 预设组合(model + harvest + branch)
|
||||
--model <id> # 显式指定模型 ID
|
||||
--harvest / --no-harvest # R1 plan-state 提取
|
||||
--branch <N> # self-consistency 预算
|
||||
--mcp "name=cmd args…" # 挂 MCP 服务器(可重复)
|
||||
--transcript path.jsonl # 同时旁路写一份 JSONL transcript
|
||||
--session <name> # 命名会话(code 模式默认按目录)
|
||||
--no-session # 临时会话
|
||||
--no-config # 忽略 ~/.reasonix/config.json(CI 友好)
|
||||
```
|
||||
|
||||
环境变量(覆盖 config):
|
||||
|
||||
```bash
|
||||
export DEEPSEEK_API_KEY=sk-...
|
||||
export DEEPSEEK_BASE_URL=https://... # 可选的备用端点
|
||||
export REASONIX_MEMORY=off # 关闭 REASONIX.md + 用户记忆
|
||||
export REASONIX_SEARCH=off # 关闭 web_search / web_fetch
|
||||
export REASONIX_UI=plain # 关闭实时行(鬼影绕开)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 库用法
|
||||
|
||||
```ts
|
||||
import {
|
||||
CacheFirstLoop,
|
||||
DeepSeekClient,
|
||||
ImmutablePrefix,
|
||||
ToolRegistry,
|
||||
} from "reasonix";
|
||||
|
||||
const client = new DeepSeekClient(); // 从环境变量读 DEEPSEEK_API_KEY
|
||||
const tools = new ToolRegistry();
|
||||
|
||||
tools.register({
|
||||
name: "add",
|
||||
description: "Add two integers",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: { a: { type: "integer" }, b: { type: "integer" } },
|
||||
required: ["a", "b"],
|
||||
},
|
||||
fn: ({ a, b }: { a: number; b: number }) => a + b,
|
||||
});
|
||||
|
||||
const loop = new CacheFirstLoop({
|
||||
client,
|
||||
tools,
|
||||
prefix: new ImmutablePrefix({
|
||||
system: "You are a math helper.",
|
||||
toolSpecs: tools.specs(),
|
||||
}),
|
||||
harvest: true,
|
||||
branch: 3,
|
||||
});
|
||||
|
||||
for await (const ev of loop.step("What is 17 + 25?")) {
|
||||
if (ev.role === "assistant_final") console.log(ev.content);
|
||||
}
|
||||
console.log(loop.stats.summary());
|
||||
```
|
||||
|
||||
`ChatOptions.seedTools` 接受一个预置好的 `ToolRegistry`,如果你只想要
|
||||
`reasonix code` 的 loop 接线、不要 CLI 包装。详见
|
||||
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)。
|
||||
|
||||
---
|
||||
|
||||
## 性能对比 —— 缓存命中率自己也能验证
|
||||
|
||||
这里每个抽象都对应 DeepSeek 的一个具体特性 —— 极低 token 价、R1 推理轨
|
||||
迹、自动前缀缓存、JSON 模式。通用框架把这些机会全留在桌上。
|
||||
|
||||
| | Reasonix 默认 | 通用框架 |
|
||||
|---|---|---|
|
||||
| 前缀稳定的循环(→ 85–95% 缓存命中) | 是 | 否(每轮重建 prompt) |
|
||||
| 自动展平深层 tool schema | 是 | 否(DeepSeek 会丢参数) |
|
||||
| 带 jitter 退避的 429/503 重试 | 是 | 否(要自己写回调) |
|
||||
| 抢救泄到 `<think>` 里的 tool call | 是 | 否 |
|
||||
| 同参数重复爆发熔断 | 是 | 否 |
|
||||
| 实时缓存命中 / 成本 / vs Claude 面板 | 是 | 否 |
|
||||
|
||||
同一 τ-bench-lite 负载(8 个多轮工具调用任务 × 3 次重复 = 每边 48 次运行),
|
||||
实测 DeepSeek `deepseek-chat`,唯一变量是前缀稳定性:
|
||||
|
||||
| 指标 | 基线(缓存敌对) | Reasonix | 差值 |
|
||||
|---|---:|---:|---:|
|
||||
| 缓存命中 | 46.6% | **94.4%** | +47.7 pp |
|
||||
| 单任务成本 | $0.002599 | $0.001579 | **−39%** |
|
||||
| 通过率 | 96% (23/24) | **100% (24/24)** | — |
|
||||
|
||||
**无需消耗 API 额度即可复现:**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/esengine/reasonix.git && cd reasonix && npm install
|
||||
npx reasonix replay benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl
|
||||
npx reasonix diff \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.baseline.r1.jsonl \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl
|
||||
```
|
||||
|
||||
提交进仓库的 JSONL 文件每轮带 `usage`、`cost`、`prefixHash`。Reasonix
|
||||
的前缀哈希在每次模型调用时都字节稳定;基线则每轮都变。缓存差距是从日志稳
|
||||
定性 **机械可推导** 的,不依赖于 prompt 写得不一样。
|
||||
|
||||
完整 48 次运行报告:
|
||||
[`benchmarks/tau-bench/report.md`](./benchmarks/tau-bench/report.md)。
|
||||
用自己的 API key 复现:`npx tsx benchmarks/tau-bench/runner.ts --repeats 3`。
|
||||
|
||||
MCP 参考运行(即使两个 MCP 子进程并发,整 5 轮也只有一个前缀哈希):
|
||||
|
||||
| 服务器 | 轮次 | 缓存命中 | 成本 | vs Claude |
|
||||
|---|---:|---:|---:|---:|
|
||||
| 内置 demo(`add` / `echo` / `get_time`) | 2 | **96.6%**(第 2 轮) | $0.000254 | −94.0% |
|
||||
| 官方 `server-filesystem` | 5 | **96.7%** | $0.001235 | −97.0% |
|
||||
| **两者并发** | 5 | **81.1%** | $0.001852 | −95.9% |
|
||||
|
||||
---
|
||||
|
||||
## Non-goals(明确不做)
|
||||
|
||||
- **多 agent 编排 / 子 agent**(用 LangGraph)。
|
||||
- **工作流 DSL / DAG 调度 / 并行分支引擎** —— skill 是散文,模型靠正常的
|
||||
tool-use 循环串起来。这样保住了单循环 + append-only + cache-first 三大
|
||||
不变量。
|
||||
- **多供应商抽象**(用 LiteLLM)。Reasonix 故意只做 DeepSeek —— 每个支柱
|
||||
(cache-first 循环、R1 抢救、tool-call 修复)都针对 DeepSeek 的具体行为
|
||||
和经济性做了调优。绑死一家后端是特性。
|
||||
- **RAG / 向量库**(用 LlamaIndex)。
|
||||
- **Web UI / SaaS。**
|
||||
|
||||
Reasonix 只做 DeepSeek,做到底。
|
||||
|
||||
---
|
||||
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
git clone https://github.com/esengine/reasonix.git
|
||||
cd reasonix
|
||||
npm install
|
||||
npm run dev code # 用 tsx 直接从源码跑 CLI
|
||||
npm run build # tsup 打包到 dist/
|
||||
npm test # vitest(1007 个测试)
|
||||
npm run lint # biome
|
||||
npm run typecheck # tsc --noEmit
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -1,12 +0,0 @@
|
||||
# Reasonix Website instructions
|
||||
|
||||
- This branch owns the public website and public documentation portal only.
|
||||
Do not add product client or backend service code here.
|
||||
- Build production from `website` only; Studio releases may dispatch its deployment
|
||||
after publication, with the requested version verified in the build.
|
||||
- Preserve accessibility, responsive layout, and static-build compatibility.
|
||||
- Authentication and marketplace pages call versioned `platform` APIs; they do
|
||||
not duplicate account or registry business logic.
|
||||
- Add tests for user-visible contracts and run a production build before release.
|
||||
- Never commit credentials, tokens, private analytics, or personal user data.
|
||||
- Comments are English and explain only non-obvious constraints.
|
||||
@@ -1,137 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Reasonix security fixes are prioritized for the currently developed Go rewrite
|
||||
and the current 1.x release line.
|
||||
|
||||
| Version or branch | Security support |
|
||||
| --- | --- |
|
||||
| `main-v2` / 1.x releases | Supported |
|
||||
| `v1` / 0.x legacy branch | Critical fixes only, where practical |
|
||||
| Older releases, forks, or modified builds | Not covered unless the issue is reproducible upstream |
|
||||
|
||||
If you are unsure whether a version is affected, report against the newest
|
||||
released 1.x version and include the exact version or commit you tested.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report security issues privately. Do not open a public issue with exploit
|
||||
details, secrets, crash dumps, or proof-of-concept payloads.
|
||||
|
||||
Preferred reporting path:
|
||||
|
||||
1. Use GitHub private vulnerability reporting for this repository, if available.
|
||||
2. If private reporting is not available to you, open a minimal public issue
|
||||
asking for a private maintainer contact path. Do not include exploit details
|
||||
in that issue.
|
||||
|
||||
Please include:
|
||||
|
||||
- Affected Reasonix version, commit, operating system, and installation method.
|
||||
- The feature or surface involved, such as CLI, desktop app, HTTP `serve`, bot
|
||||
gateway, MCP plugin, built-in tool, updater, or configuration loading.
|
||||
- Clear reproduction steps using dummy credentials and non-sensitive files.
|
||||
- The expected impact, such as secret disclosure, arbitrary file access,
|
||||
command execution, sandbox escape, authentication bypass, or supply-chain risk.
|
||||
- Any relevant logs with API keys, tokens, local paths, and personal data
|
||||
redacted.
|
||||
|
||||
Do not send real provider API keys, bot credentials, OAuth tokens, private
|
||||
workspace files, or third-party user data.
|
||||
|
||||
## Security Boundaries
|
||||
|
||||
Reasonix is a local coding agent. Many features intentionally operate on the
|
||||
user's local machine and workspace, including file reads, file writes, shell
|
||||
commands, MCP plugins, language servers, bot sessions, and model-provider
|
||||
requests. A finding is security-relevant when it crosses a supported boundary or
|
||||
bypasses an explicit guard.
|
||||
|
||||
Supported boundaries include:
|
||||
|
||||
- Workspace confinement for file operations that are documented or implemented
|
||||
as workspace-scoped.
|
||||
- Permission checks for tool calls, shell commands, file writes, and approvals.
|
||||
- Sandbox behavior for built-in shell execution where the platform supports it.
|
||||
- Secret handling for provider keys, bot credentials, OAuth tokens, plugin
|
||||
headers, and credential-store fallback files.
|
||||
- HTTP `serve` protections for the unauthenticated local server, including
|
||||
localhost binding assumptions, JSON-only state-changing requests, and CORS
|
||||
restrictions.
|
||||
- Desktop and bot session isolation, including per-workspace session metadata
|
||||
and configured bot allowlists.
|
||||
- Updater, install, and release verification paths.
|
||||
|
||||
The following are normally treated as trusted local/operator-controlled inputs
|
||||
unless another bug lets an untrusted actor supply them:
|
||||
|
||||
- CLI arguments and text typed directly by the local user.
|
||||
- Project configuration files intentionally loaded from the current workspace.
|
||||
- Explicit `@path` references supplied by the local user to attach local files.
|
||||
- MCP servers, language servers, hooks, and slash commands installed or enabled
|
||||
by the local user.
|
||||
- Provider base URLs and model names configured by the local user.
|
||||
|
||||
The following can be security issues when reachable by an untrusted actor or
|
||||
when they bypass the intended boundary:
|
||||
|
||||
- Reading or writing files outside the configured workspace without explicit
|
||||
local-user intent.
|
||||
- Following symlinks or path traversal to escape workspace confinement.
|
||||
- Running shell commands or external tools without the required permission gate.
|
||||
- Leaking credentials, environment variables, prompt history, local files, or bot
|
||||
messages to logs, model providers, MCP servers, crash reports, or telemetry.
|
||||
- Allowing a website to drive the local HTTP server through CSRF, CORS, or
|
||||
content-type bypasses.
|
||||
- Letting a bot user outside the configured allowlist submit prompts, approve
|
||||
tools, or access a project workspace.
|
||||
- Trusting unverified update artifacts, plugin definitions, or downloaded
|
||||
binaries.
|
||||
|
||||
## `@` File References
|
||||
|
||||
Reasonix supports `@path` references so users can include local files and images
|
||||
in a prompt. This is intentional local functionality, but implementations must
|
||||
preserve these invariants:
|
||||
|
||||
- In workspace-scoped sessions, relative and absolute paths must resolve under
|
||||
the active workspace root before file content is read or attached.
|
||||
- Path traversal such as `..` must not escape the workspace root.
|
||||
- Symlinks must not be usable to bypass the intended workspace boundary.
|
||||
- Unscoped local CLI compatibility must not be exposed to remote, bot, or
|
||||
browser-controlled inputs unless an equivalent workspace boundary is applied.
|
||||
- File content should be size-limited and binary content should not be dumped as
|
||||
prompt text.
|
||||
|
||||
Static analysis alerts about path expressions should be triaged against these
|
||||
rules: user-controlled path data is expected, but the access must either stay
|
||||
inside the configured workspace or be clearly limited to trusted local CLI use.
|
||||
|
||||
## Out of Scope
|
||||
|
||||
The following reports are usually out of scope unless they demonstrate a bypass
|
||||
of one of the boundaries above:
|
||||
|
||||
- A local user intentionally asks Reasonix to read, edit, or send their own
|
||||
files to a configured model provider.
|
||||
- A local user installs or enables a malicious MCP server, hook, slash command,
|
||||
language server, or shell command and then grants it permission.
|
||||
- A configured model provider, proxy, or MCP server receives data the user
|
||||
intentionally sent to it.
|
||||
- Denial-of-service issues that only affect the local user's own session and do
|
||||
not corrupt files, leak secrets, or bypass permissions.
|
||||
- Issues requiring administrator/root access on the user's machine before
|
||||
interacting with Reasonix.
|
||||
- Vulnerabilities in third-party services, models, proxies, or plugins that are
|
||||
not caused by Reasonix behavior.
|
||||
|
||||
## Coordinated Disclosure
|
||||
|
||||
This is a community-maintained project. Maintainers will make a best-effort
|
||||
assessment, ask follow-up questions when needed, and coordinate fixes before
|
||||
public disclosure for confirmed vulnerabilities.
|
||||
|
||||
Please give maintainers reasonable time to investigate and release a fix before
|
||||
publishing exploit details. If you plan to disclose on a timeline, include that
|
||||
timeline in your initial report.
|
||||
@@ -0,0 +1,115 @@
|
||||
# Benchmarks
|
||||
|
||||
This is where validation lives. The v0.1 milestone gates on a reproducible
|
||||
tool-use eval that compares, on the same tasks:
|
||||
|
||||
1. **Baseline** — a deliberately cache-hostile agent (fresh timestamp +
|
||||
shuffled tool spec each turn), representative of how generic frameworks
|
||||
wire up DeepSeek.
|
||||
2. **Reasonix** — the same tools and system prompt, driven through
|
||||
`CacheFirstLoop` so the byte prefix stays stable turn-over-turn.
|
||||
|
||||
Both modes share the same `DeepSeekClient`, so the *only* meaningful
|
||||
difference is prefix stability — any cache-hit / cost gap is attributable to
|
||||
Pillar 1 of the architecture, nothing else.
|
||||
|
||||
## Scope — this is τ-bench-*lite*
|
||||
|
||||
We don't ship a full port of [Sierra's τ-bench](https://github.com/sierra-research/tau-bench)
|
||||
(airline + retail, Python). Instead:
|
||||
|
||||
- `tau-bench/tasks.ts` hand-authors 8 retail-flavored multi-turn tasks
|
||||
that exercise tool use, identity verification, refusal, and mid-conversation
|
||||
goal change.
|
||||
- The task schema (`tau-bench/types.ts`) mirrors τ-bench's shape — stateful
|
||||
tools, an LLM user simulator, end-state DB predicates — so real upstream
|
||||
tasks can later drop in without harness changes.
|
||||
- All success predicates are **deterministic DB checks**, not LLM judges.
|
||||
Refusal tasks pass iff the DB is unchanged.
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
tau-bench/
|
||||
├── types.ts — TaskDefinition / RunResult / BenchReport shapes
|
||||
├── db.ts — tiny in-memory WorldState + cloneDb
|
||||
├── tasks.ts — the 8 seed tasks + shared tool factories
|
||||
├── user-sim.ts — LLM user simulator (V3, T=0.1)
|
||||
├── baseline.ts — naive cache-hostile agent runner
|
||||
├── runner.ts — orchestrates user-sim × agent × task × mode
|
||||
└── report.ts — turns a results-*.json into a report.md
|
||||
```
|
||||
|
||||
## Quickstart
|
||||
|
||||
```bash
|
||||
# dry-run: no API calls, just validate the harness is wired up
|
||||
npx tsx benchmarks/tau-bench/runner.ts --dry
|
||||
|
||||
# full run: both modes, all tasks, 1 repeat
|
||||
export DEEPSEEK_API_KEY=sk-...
|
||||
npx tsx benchmarks/tau-bench/runner.ts
|
||||
|
||||
# tighten variance: 3 repeats per task
|
||||
npx tsx benchmarks/tau-bench/runner.ts --repeats 3
|
||||
|
||||
# narrow to one task while iterating
|
||||
npx tsx benchmarks/tau-bench/runner.ts --task t01_address_happy --verbose
|
||||
|
||||
# render the report
|
||||
npx tsx benchmarks/tau-bench/report.ts benchmarks/tau-bench/results-<date>.json
|
||||
|
||||
# emit per-run transcripts so you can reasonix replay / diff them
|
||||
npx tsx benchmarks/tau-bench/runner.ts --transcripts-dir ./transcripts
|
||||
npx reasonix diff \
|
||||
./transcripts/t01_address_happy.baseline.r1.jsonl \
|
||||
./transcripts/t01_address_happy.reasonix.r1.jsonl \
|
||||
--md diff.md
|
||||
```
|
||||
|
||||
The runner writes `benchmarks/tau-bench/results-<iso-timestamp>.json`. Point
|
||||
`report.ts` at it (or pass `--out report.md` to override the output path).
|
||||
|
||||
When `--transcripts-dir <path>` is set, each `(task, mode, repeat)` run also
|
||||
writes a `<taskId>.<mode>.r<n>.jsonl` transcript into that directory —
|
||||
these carry per-turn `usage`, `cost`, and (for Reasonix) the
|
||||
`prefixHash`, so `reasonix replay` and `reasonix diff` can rebuild the
|
||||
economics offline.
|
||||
|
||||
## CLI flags
|
||||
|
||||
| flag | default | meaning |
|
||||
|---|---|---|
|
||||
| `--task <id>` | all | run only one task by id |
|
||||
| `--mode baseline` \| `reasonix` | both | restrict to one mode |
|
||||
| `--repeats <N>` | 1 | repeat each (task, mode) pair N times |
|
||||
| `--model <id>` | deepseek-chat | agent model |
|
||||
| `--user-model <id>` | deepseek-chat | user-simulator model |
|
||||
| `--out <path>` | `results-<ts>.json` | results file path |
|
||||
| `--transcripts-dir <path>` | off | write one transcript per run for replay/diff |
|
||||
| `--dry` | off | skip the LLM; only wire-check |
|
||||
| `--verbose` \| `-v` | off | print every user / agent / tool line |
|
||||
|
||||
## What a run costs
|
||||
|
||||
A full run (8 tasks × 2 modes × 1 repeat) does on the order of 30–60
|
||||
DeepSeek V3 calls — well under $0.05 at current pricing. `--repeats 3`
|
||||
triples that.
|
||||
|
||||
## Adding tasks
|
||||
|
||||
1. Add a `TaskDefinition` to `tau-bench/tasks.ts`. Reuse the tool factories
|
||||
defined at the top of that file, or add new ones (remember: factories so
|
||||
tools close over the *per-run* db snapshot).
|
||||
2. Make the `check` predicate check the end-state DB, not the agent's text —
|
||||
agents phrase things differently on every run.
|
||||
3. Run `--task <your_id> --verbose` to eyeball the transcript.
|
||||
|
||||
Non-goals (for this harness):
|
||||
|
||||
- LLM-as-judge — brittle and expensive, DB predicates are enough.
|
||||
- Streaming comparison — the harness uses `stream: false` in Reasonix mode
|
||||
so both runners make the exact same request shape.
|
||||
- Claude head-to-head — we estimate Claude's cost from token counts using
|
||||
Sonnet 4.6 pricing (see `src/telemetry.ts`); running Claude for real is
|
||||
out of scope.
|
||||
@@ -0,0 +1,106 @@
|
||||
# Harvest eval harness (Pillar 2)
|
||||
|
||||
Measures Pillar 2 (R1 Thought Harvesting) the same way `tau-bench/`
|
||||
measures Pillar 1 (Cache-First Loop): isolate one variable, produce
|
||||
numbers anyone can reproduce.
|
||||
|
||||
## What's different from τ-bench-lite?
|
||||
|
||||
Deliberately different task shape:
|
||||
|
||||
| | τ-bench-lite | harvest-bench |
|
||||
|---|---|---|
|
||||
| task style | multi-turn tool-use | single-turn reasoning |
|
||||
| user simulator | yes (LLM) | no |
|
||||
| DB state | yes | no |
|
||||
| checker | DB-predicate | regex + set/value compare |
|
||||
| target | Pillar 1 | Pillar 2 |
|
||||
| model | deepseek-chat (default) | deepseek-reasoner (only R1 has `reasoning_content` for harvest to work on) |
|
||||
|
||||
The two harnesses answer different questions:
|
||||
|
||||
- **τ-bench-lite**: *"Does Cache-First actually cut cost on real tool-use
|
||||
workflows?"* (yes — 47.7pp cache, −39% cost on 48-run data.)
|
||||
- **harvest-bench**: *"Does the extra V3 harvest call add measurable
|
||||
value above plain R1?"* (TBD — run it to find out.)
|
||||
|
||||
## Modes
|
||||
|
||||
Three modes isolate one variable each:
|
||||
|
||||
| mode | model | harvest | what it measures |
|
||||
|---|---|---|---|
|
||||
| `baseline` | deepseek-chat | off | floor reference — V3 at its best |
|
||||
| `reasoner` | deepseek-reasoner | off | raw R1 gain over V3 on reasoning |
|
||||
| `reasoner-harvest` | deepseek-reasoner | on | R1 + the extra V3 harvest call |
|
||||
|
||||
Deltas:
|
||||
|
||||
- `baseline → reasoner` answers "is R1 worth the price on these
|
||||
problems?"
|
||||
- `reasoner → reasoner-harvest` answers "is the harvest call worth
|
||||
its incremental cost?"
|
||||
|
||||
## Quickstart
|
||||
|
||||
```bash
|
||||
# Dry-run — no API, smoke-test the wiring
|
||||
npx tsx benchmarks/harvest/runner.ts --dry
|
||||
|
||||
# Full run (live DeepSeek, costs ~$0.20-0.60 for 6 tasks × 3 modes × 1 repeat)
|
||||
export DEEPSEEK_API_KEY=sk-...
|
||||
npx tsx benchmarks/harvest/runner.ts
|
||||
|
||||
# Tighter run with 3 repeats (~$0.60-2.00)
|
||||
npx tsx benchmarks/harvest/runner.ts --repeats 3
|
||||
|
||||
# Only the hard tasks (skip the easy floor)
|
||||
npx tsx benchmarks/harvest/runner.ts --task pseudoprime_base2
|
||||
npx tsx benchmarks/harvest/runner.ts --task derangements_d7
|
||||
npx tsx benchmarks/harvest/runner.ts --task euler_quadratic_break
|
||||
|
||||
# Bump per-call timeout (reasoner + harvest occasionally blow past the 120s default)
|
||||
npx tsx benchmarks/harvest/runner.ts --timeout 600
|
||||
|
||||
# Per-run transcripts so you can reasonix replay / diff them
|
||||
npx tsx benchmarks/harvest/runner.ts --repeats 3 --transcripts-dir transcripts/
|
||||
|
||||
# Render report
|
||||
npx tsx benchmarks/harvest/report.ts benchmarks/harvest/results-*.json
|
||||
```
|
||||
|
||||
## Tasks (v0.3 seed)
|
||||
|
||||
Split into two bands:
|
||||
|
||||
**Easy band** — V3 chat solves these, so baseline has a real pass rate and the bench has a reference floor.
|
||||
|
||||
| id | shape | why |
|
||||
|---|---|---|
|
||||
| `mod7_list` | number theory, 29-element list | R1 often tries enumeration first, then reaches for modular arithmetic — clean rejectedPaths signal |
|
||||
| `flips_until_3heads` | probability, single integer | classic recurrence; R1 either derives or recalls, harvest should see hypotheses diverge |
|
||||
| `three_hats` | logic puzzle, one-word answer | pure deduction chain, tests harvest's ability to extract the nested reasoning |
|
||||
|
||||
**Hard band** — picked specifically for known V3 failure modes. If R1 systematically beats V3 on these, and harvest further beats R1-only, we have our Pillar 2 story.
|
||||
|
||||
| id | shape | why V3 tends to fail |
|
||||
|---|---|---|
|
||||
| `pseudoprime_base2` | smallest Fermat pseudoprime to base 2 = **341** | V3 often answers 561 (Carmichael) or some other composite it remembers — R1 actually checks 2^n mod n |
|
||||
| `derangements_d7` | D_7 = **1854** | V3 approximates via n!/e and rounds wrong, or recalls D_6/D_8; R1 uses the recurrence D_n=(n−1)(D_{n−1}+D_{n−2}) |
|
||||
| `euler_quadratic_break` | smallest n where n²+n+41 is composite = **40** | V3 frequently confuses with n²−n+41 (first fails at 41); R1 checks small n systematically |
|
||||
|
||||
Adding a new task: see `tasks.ts`. Any checker that's deterministic is
|
||||
fair game — extract numeric/list/text with regex, compare with set
|
||||
equality or string matching.
|
||||
|
||||
## Non-goals
|
||||
|
||||
- **No LLM-as-judge.** Brittle and expensive; defeats the point of a
|
||||
reproducible bench. If a checker is too hard to write deterministically,
|
||||
the task doesn't belong here.
|
||||
- **No tool-use tasks.** Those live in `tau-bench/`. Different story.
|
||||
- **No multi-turn.** v0.3 harness is single-turn Q/A. Multi-turn reasoning
|
||||
eval is separate scope.
|
||||
- **No benchmark-data cherry-picking.** When results come in, we publish
|
||||
them whether they validate Pillar 2 or not. "harvest didn't help on
|
||||
these 3 tasks" is still useful information.
|
||||
@@ -0,0 +1,82 @@
|
||||
# Reasonix harvest eval (Pillar 2)
|
||||
|
||||
**Date:** 2026-04-21T16:44:21.011Z
|
||||
**Tasks:** 6 · repeats × 1 · modes: baseline, reasoner, reasoner-harvest
|
||||
**Reasonix version:** 0.2.2
|
||||
|
||||
## Summary by mode
|
||||
|
||||
| mode | runs | pass rate | cache hit | cost / run | harvest turns | subgoals | uncertainties |
|
||||
|---|---:|---:|---:|---:|---:|---:|---:|
|
||||
| baseline | 6 | 100% | 39.5% | $0.001371 | 0.0 | 0.0 | 0.0 |
|
||||
| reasoner | 6 | 100% | 74.2% | $0.004170 | 0.0 | 0.0 | 0.0 |
|
||||
| reasoner-harvest | 6 | 83% | 61.6% | $0.003304 | 0.8 | 2.8 | 1.3 |
|
||||
|
||||
## Deltas
|
||||
|
||||
- **baseline → reasoner**
|
||||
- pass rate: 0pp
|
||||
- cost: ×3.04 (each run costs more)
|
||||
- harvest signal / run: 0.0 subgoals, 0.0 uncertainties
|
||||
|
||||
- **baseline → reasoner-harvest**
|
||||
- pass rate: -17pp
|
||||
- cost: ×2.41 (each run costs more)
|
||||
- harvest signal / run: 2.8 subgoals, 1.3 uncertainties
|
||||
|
||||
## Per-task breakdown
|
||||
|
||||
| task | mode | rep | verdict | cache | cost | sg | un | note |
|
||||
|---|---|---:|:---:|---:|---:|---:|---:|---|
|
||||
| mod7_list | baseline | 1 | ✅ | 86.5% | $0.001361 | 0 | 0 | |
|
||||
| mod7_list | reasoner | 1 | ✅ | 86.5% | $0.004797 | 0 | 0 | |
|
||||
| mod7_list | reasoner-harvest | 1 | ✅ | 86.5% | $0.003045 | 4 | 2 | |
|
||||
| flips_until_3heads | baseline | 1 | ✅ | 92.8% | $0.001198 | 0 | 0 | |
|
||||
| flips_until_3heads | reasoner | 1 | ✅ | 92.8% | $0.002830 | 0 | 0 | |
|
||||
| flips_until_3heads | reasoner-harvest | 1 | ✅ | 92.8% | $0.001691 | 4 | 0 | |
|
||||
| three_hats | baseline | 1 | ✅ | 57.7% | $0.001514 | 0 | 0 | |
|
||||
| three_hats | reasoner | 1 | ✅ | 57.7% | $0.009340 | 0 | 0 | |
|
||||
| three_hats | reasoner-harvest | 1 | ✅ | 57.7% | $0.009651 | 3 | 2 | |
|
||||
| pseudoprime_base2 | baseline | 1 | ✅ | 0.0% | $0.001894 | 0 | 0 | |
|
||||
| pseudoprime_base2 | reasoner | 1 | ✅ | 75.3% | $0.003128 | 0 | 0 | |
|
||||
| pseudoprime_base2 | reasoner-harvest | 1 | ❌ | 0.0% | $0.000000 | 0 | 0 | This operation was aborted |
|
||||
| derangements_d7 | baseline | 1 | ✅ | 0.0% | $0.001273 | 0 | 0 | |
|
||||
| derangements_d7 | reasoner | 1 | ✅ | 71.9% | $0.003492 | 0 | 0 | |
|
||||
| derangements_d7 | reasoner-harvest | 1 | ✅ | 71.9% | $0.002843 | 3 | 2 | |
|
||||
| euler_quadratic_break | baseline | 1 | ✅ | 0.0% | $0.000985 | 0 | 0 | |
|
||||
| euler_quadratic_break | reasoner | 1 | ✅ | 61.0% | $0.001431 | 0 | 0 | |
|
||||
| euler_quadratic_break | reasoner-harvest | 1 | ✅ | 61.0% | $0.002594 | 3 | 2 | |
|
||||
|
||||
## Scope
|
||||
|
||||
Unlike τ-bench-lite, these tasks are single-turn reasoning problems (no user simulator, no DB, no tool calls). Checkers are deterministic — regex + set / value compare, never an LLM judge. The point is to isolate whether the Pillar 2 harvest step adds measurable value above plain reasoner usage.
|
||||
|
||||
Interpretation: `baseline` (chat / V3) is a floor. `reasoner` shows the raw R1 gain. `reasoner-harvest` isolates the cost + quality delta from the extra V3 harvest call.
|
||||
## Findings (v0.3, 18-run set)
|
||||
|
||||
Two bands of tasks tried (easy: mod7 / flips / hats; hard: pseudoprime341 / D_7 / Euler quadratic). The hard band was chosen for *known V3 failure modes*. Result:
|
||||
|
||||
1. **V3 chat passed all six tasks, including the three "hard" ones.** DeepSeek V3 knew 341 is the smallest base-2 pseudoprime, computed D_7=1854, and identified n=40 as the first Euler-polynomial failure. The tasks are well-known enough to be in training; the trap-answer variants (561, 265, 41) that the checkers specifically reject didn't fire.
|
||||
2. **Reasoner cost 3.04× baseline for identical pass rates (6/6 both sides).** On this task set, R1 adds cost and latency without measurable quality. The cache-hit story *does* extend to reasoner (74.2% mean), so Pillar 1 generalizes to R1 — but that's not a Pillar 2 story.
|
||||
3. **Harvest produced real signal** (mean 2.8 subgoals, 1.3 uncertainties per run where it fired) but didn't improve outcomes. One run hit the 300s timeout (bumped from 120s), suggesting reasoner-harvest latency is still unpredictable on some problems.
|
||||
|
||||
### What this tells us about Pillar 2 positioning
|
||||
|
||||
We've now given harvest two shots at showing answer-quality value on pure reasoning tasks. Both times V3 ate its lunch. This isn't a framework bug — it's a positioning signal:
|
||||
|
||||
- **On well-known math / logic / counting problems, DeepSeek V3 is strong enough that paying for R1 is not justified by accuracy.** Pillar 2's "smart preset" cost multiplier (10×) quoted in the README is real but for most single-question Q/A it buys nothing.
|
||||
- **Harvest's plausible value surfaces are not "better math answers".** More likely: (a) transparency / auditability for developers, (b) planning support when tools are in the mix, (c) driving branch-sampling on cases where uncertainty correlates with wrongness. None of those are tested here.
|
||||
|
||||
### Recommendation
|
||||
|
||||
Don't ship v0.3 on the "harvest makes answers more correct" claim — the data doesn't support it. Two honest paths forward:
|
||||
|
||||
- **Reframe Pillar 2 as a developer-facing introspection feature** (debug visibility into R1's planning). Keep harvest opt-in; stop implying it improves accuracy on end-user tasks.
|
||||
- **Move harvest eval to tool-use contexts** where uncertainty matters for *which tool to call next*, not *is this math right*. That's a new task shape — different harness, not a bigger task set here.
|
||||
|
||||
In either case, the next Reasonix release is better served by MCP client (Pillar 1 leverage across the ecosystem) than by a bigger harvest-bench data push.
|
||||
|
||||
### Notes
|
||||
|
||||
- Cache hit on baseline runs surprised me (39.5% mean). That's DeepSeek's *cross-session* prompt cache: the same system prompt ran many times across modes and runs warmed the server-side cache. Real cross-session evidence that Cache-First's value isn't only per-session.
|
||||
- 5-subgoals cap still hit uniformly. `HarvestOptions.maxItems` default is 5; harvest is truncating. Moot unless we find a setting where that matters.
|
||||
@@ -0,0 +1,232 @@
|
||||
/**
|
||||
* Render a harvest-bench results.json into a markdown report.
|
||||
*
|
||||
* npx tsx benchmarks/harvest/report.ts benchmarks/harvest/results-<date>.json
|
||||
* npx tsx benchmarks/harvest/report.ts <input.json> --out report.md
|
||||
*/
|
||||
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { ALL_MODES, type HarvestBenchReport, type HarvestMode, type HarvestRunResult } from "./types.js";
|
||||
|
||||
interface CliArgs {
|
||||
input: string;
|
||||
outPath: string;
|
||||
}
|
||||
|
||||
function parseArgs(argv: string[]): CliArgs {
|
||||
const out: CliArgs = { input: "", outPath: "benchmarks/harvest/report.md" };
|
||||
const positional: string[] = [];
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i];
|
||||
if (a === "--out") out.outPath = argv[++i] ?? out.outPath;
|
||||
else if (a && !a.startsWith("--")) positional.push(a);
|
||||
}
|
||||
out.input = positional[0] ?? "";
|
||||
if (!out.input) {
|
||||
throw new Error("usage: npx tsx benchmarks/harvest/report.ts <results.json> [--out report.md]");
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
interface Agg {
|
||||
runs: number;
|
||||
passes: number;
|
||||
avgCache: number;
|
||||
avgCost: number;
|
||||
avgClaudeCost: number;
|
||||
avgHarvestedTurns: number;
|
||||
avgSubgoals: number;
|
||||
avgUncertainties: number;
|
||||
}
|
||||
|
||||
function aggregate(results: HarvestRunResult[]): Agg {
|
||||
if (results.length === 0) {
|
||||
return {
|
||||
runs: 0,
|
||||
passes: 0,
|
||||
avgCache: 0,
|
||||
avgCost: 0,
|
||||
avgClaudeCost: 0,
|
||||
avgHarvestedTurns: 0,
|
||||
avgSubgoals: 0,
|
||||
avgUncertainties: 0,
|
||||
};
|
||||
}
|
||||
const passes = results.filter((r) => r.verdict === "pass").length;
|
||||
const mean = (fn: (r: HarvestRunResult) => number) =>
|
||||
results.reduce((s, r) => s + fn(r), 0) / results.length;
|
||||
return {
|
||||
runs: results.length,
|
||||
passes,
|
||||
avgCache: mean((r) => r.cacheHitRatio),
|
||||
avgCost: mean((r) => r.costUsd),
|
||||
avgClaudeCost: mean((r) => r.claudeEquivalentUsd),
|
||||
avgHarvestedTurns: mean((r) => r.harvestedTurns),
|
||||
avgSubgoals: mean((r) => r.totalSubgoals),
|
||||
avgUncertainties: mean((r) => r.totalUncertainties),
|
||||
};
|
||||
}
|
||||
|
||||
export function renderReport(report: HarvestBenchReport): string {
|
||||
const lines: string[] = [];
|
||||
lines.push("# Reasonix harvest eval (Pillar 2)");
|
||||
lines.push("");
|
||||
lines.push(`**Date:** ${report.meta.date}`);
|
||||
lines.push(
|
||||
`**Tasks:** ${report.meta.taskCount} · repeats × ${report.meta.repeatsPerTask} · modes: ${report.meta.modesRun.join(", ")}`,
|
||||
);
|
||||
lines.push(`**Reasonix version:** ${report.meta.reasonixVersion}`);
|
||||
lines.push("");
|
||||
|
||||
// Per-mode summary
|
||||
lines.push("## Summary by mode");
|
||||
lines.push("");
|
||||
lines.push("| mode | runs | pass rate | cache hit | cost / run | harvest turns | subgoals | uncertainties |");
|
||||
lines.push("|---|---:|---:|---:|---:|---:|---:|---:|");
|
||||
for (const mode of ALL_MODES) {
|
||||
const rs = report.results.filter((r) => r.mode === mode);
|
||||
const a = aggregate(rs);
|
||||
if (a.runs === 0) continue;
|
||||
lines.push(
|
||||
`| ${mode} | ${a.runs} | ${pct(a.passes, a.runs)} | ${pct1(a.avgCache)} | $${a.avgCost.toFixed(6)} | ${a.avgHarvestedTurns.toFixed(1)} | ${a.avgSubgoals.toFixed(1)} | ${a.avgUncertainties.toFixed(1)} |`,
|
||||
);
|
||||
}
|
||||
lines.push("");
|
||||
|
||||
// Pairwise deltas that actually answer the question
|
||||
lines.push("## Deltas");
|
||||
lines.push("");
|
||||
const modes = ALL_MODES.filter((m) =>
|
||||
report.results.some((r) => r.mode === m),
|
||||
);
|
||||
if (modes.length >= 2) {
|
||||
const baseline = aggregate(report.results.filter((r) => r.mode === modes[0]));
|
||||
for (let i = 1; i < modes.length; i++) {
|
||||
const mode = modes[i]!;
|
||||
const agg = aggregate(report.results.filter((r) => r.mode === mode));
|
||||
const passDelta = (agg.passes / Math.max(agg.runs, 1)) - (baseline.passes / Math.max(baseline.runs, 1));
|
||||
const costRatio = baseline.avgCost > 0 ? agg.avgCost / baseline.avgCost : 0;
|
||||
lines.push(`- **${modes[0]} → ${mode}**`);
|
||||
lines.push(` - pass rate: ${(passDelta * 100).toFixed(0)}pp`);
|
||||
lines.push(` - cost: ×${costRatio.toFixed(2)} (each run costs ${costRatio > 1 ? "more" : "less"})`);
|
||||
lines.push(` - harvest signal / run: ${agg.avgSubgoals.toFixed(1)} subgoals, ${agg.avgUncertainties.toFixed(1)} uncertainties`);
|
||||
lines.push("");
|
||||
}
|
||||
}
|
||||
|
||||
// Per-task breakdown
|
||||
lines.push("## Per-task breakdown");
|
||||
lines.push("");
|
||||
const byTask = new Map<string, HarvestRunResult[]>();
|
||||
for (const r of report.results) {
|
||||
const list = byTask.get(r.taskId) ?? [];
|
||||
list.push(r);
|
||||
byTask.set(r.taskId, list);
|
||||
}
|
||||
lines.push("| task | mode | rep | verdict | cache | cost | sg | un | note |");
|
||||
lines.push("|---|---|---:|:---:|---:|---:|---:|---:|---|");
|
||||
for (const [taskId, runs] of byTask) {
|
||||
for (const r of runs) {
|
||||
const mark = r.verdict === "pass" ? "✅" : r.verdict === "fail" ? "❌" : "•";
|
||||
lines.push(
|
||||
`| ${taskId} | ${r.mode} | ${r.repeat} | ${mark} | ${pct1(r.cacheHitRatio)} | $${r.costUsd.toFixed(6)} | ${r.totalSubgoals} | ${r.totalUncertainties} | ${truncate(r.checkNote ?? "", 40)} |`,
|
||||
);
|
||||
}
|
||||
}
|
||||
lines.push("");
|
||||
|
||||
lines.push("## Scope");
|
||||
lines.push("");
|
||||
lines.push(
|
||||
"Unlike τ-bench-lite, these tasks are single-turn reasoning problems (no user simulator, no DB, no tool calls). Checkers are deterministic — regex + set / value compare, never an LLM judge. The point is to isolate whether the Pillar 2 harvest step adds measurable value above plain reasoner usage.",
|
||||
);
|
||||
lines.push("");
|
||||
lines.push(
|
||||
"Interpretation: `baseline` (chat / V3) is a floor. `reasoner` shows the raw R1 gain. `reasoner-harvest` isolates the cost + quality delta from the extra V3 harvest call.",
|
||||
);
|
||||
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Findings section is hand-written into report.md after rendering — the
|
||||
* numbers don't interpret themselves, and boilerplate sections full of
|
||||
* "TBD — analyse the data" are worse than nothing. Append with append().
|
||||
*
|
||||
* This section has been updated twice: after the first 9-run set (which
|
||||
* bottomed out at V3 on easy tasks) and after this 18-run set (which
|
||||
* bottomed out at V3 on *hard* tasks too).
|
||||
*/
|
||||
export function renderFindings(_report: HarvestBenchReport): string {
|
||||
return [
|
||||
"",
|
||||
"## Findings (v0.3, 18-run set)",
|
||||
"",
|
||||
"Two bands of tasks tried (easy: mod7 / flips / hats; hard: pseudoprime341 / D_7 / Euler quadratic). The hard band was chosen for *known V3 failure modes*. Result:",
|
||||
"",
|
||||
"1. **V3 chat passed all six tasks, including the three \"hard\" ones.** DeepSeek V3 knew 341 is the smallest base-2 pseudoprime, computed D_7=1854, and identified n=40 as the first Euler-polynomial failure. The tasks are well-known enough to be in training; the trap-answer variants (561, 265, 41) that the checkers specifically reject didn't fire.",
|
||||
"2. **Reasoner cost 3.04× baseline for identical pass rates (6/6 both sides).** On this task set, R1 adds cost and latency without measurable quality. The cache-hit story *does* extend to reasoner (74.2% mean), so Pillar 1 generalizes to R1 — but that's not a Pillar 2 story.",
|
||||
"3. **Harvest produced real signal** (mean 2.8 subgoals, 1.3 uncertainties per run where it fired) but didn't improve outcomes. One run hit the 300s timeout (bumped from 120s), suggesting reasoner-harvest latency is still unpredictable on some problems.",
|
||||
"",
|
||||
"### What this tells us about Pillar 2 positioning",
|
||||
"",
|
||||
"We've now given harvest two shots at showing answer-quality value on pure reasoning tasks. Both times V3 ate its lunch. This isn't a framework bug — it's a positioning signal:",
|
||||
"",
|
||||
"- **On well-known math / logic / counting problems, DeepSeek V3 is strong enough that paying for R1 is not justified by accuracy.** Pillar 2's \"smart preset\" cost multiplier (10×) quoted in the README is real but for most single-question Q/A it buys nothing.",
|
||||
"- **Harvest's plausible value surfaces are not \"better math answers\".** More likely: (a) transparency / auditability for developers, (b) planning support when tools are in the mix, (c) driving branch-sampling on cases where uncertainty correlates with wrongness. None of those are tested here.",
|
||||
"",
|
||||
"### Recommendation",
|
||||
"",
|
||||
"Don't ship v0.3 on the \"harvest makes answers more correct\" claim — the data doesn't support it. Two honest paths forward:",
|
||||
"",
|
||||
"- **Reframe Pillar 2 as a developer-facing introspection feature** (debug visibility into R1's planning). Keep harvest opt-in; stop implying it improves accuracy on end-user tasks.",
|
||||
"- **Move harvest eval to tool-use contexts** where uncertainty matters for *which tool to call next*, not *is this math right*. That's a new task shape — different harness, not a bigger task set here.",
|
||||
"",
|
||||
"In either case, the next Reasonix release is better served by MCP client (Pillar 1 leverage across the ecosystem) than by a bigger harvest-bench data push.",
|
||||
"",
|
||||
"### Notes",
|
||||
"",
|
||||
"- Cache hit on baseline runs surprised me (39.5% mean). That's DeepSeek's *cross-session* prompt cache: the same system prompt ran many times across modes and runs warmed the server-side cache. Real cross-session evidence that Cache-First's value isn't only per-session.",
|
||||
"- 5-subgoals cap still hit uniformly. `HarvestOptions.maxItems` default is 5; harvest is truncating. Moot unless we find a setting where that matters.",
|
||||
"",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
function pct(num: number, denom: number): string {
|
||||
if (denom === 0) return "—";
|
||||
return `${((num / denom) * 100).toFixed(0)}%`;
|
||||
}
|
||||
|
||||
function pct1(x: number): string {
|
||||
return `${(x * 100).toFixed(1)}%`;
|
||||
}
|
||||
|
||||
function truncate(s: string, n: number): string {
|
||||
return s.length > n ? `${s.slice(0, n)}…` : s;
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
const raw = readFileSync(args.input, "utf8");
|
||||
const report = JSON.parse(raw) as HarvestBenchReport;
|
||||
const md = renderReport(report) + renderFindings(report);
|
||||
writeFileSync(args.outPath, md, "utf8");
|
||||
console.log(`wrote ${args.outPath} (${report.results.length} runs)`);
|
||||
}
|
||||
|
||||
function isMain(): boolean {
|
||||
const entry = process.argv[1];
|
||||
if (!entry) return false;
|
||||
return import.meta.url === pathToFileURL(entry).href;
|
||||
}
|
||||
|
||||
if (isMain()) {
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
// Suppress unused import warning — kept in scope so ALL_MODES order matches renderer iteration.
|
||||
export type { HarvestMode };
|
||||
@@ -0,0 +1,305 @@
|
||||
{
|
||||
"meta": {
|
||||
"date": "2026-04-21T16:44:21.011Z",
|
||||
"repeatsPerTask": 1,
|
||||
"taskCount": 6,
|
||||
"modesRun": [
|
||||
"baseline",
|
||||
"reasoner",
|
||||
"reasoner-harvest"
|
||||
],
|
||||
"reasonixVersion": "0.2.2"
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"taskId": "mod7_list",
|
||||
"mode": "baseline",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "Alright, let's go step-by-step.\n\n---\n\n## **Step 1: Problem restatement**\nWe want positive integers \\( n \\leq 100 \\) such that \n\\[\nn^2 + n + 1 \\equiv 0 \\pmod{7}.\n\\]\n\n---\n\n## **Step 2: Try residues modulo 7**\nLet \\( n \\equiv r \\pmod{7} \\), where \\( r \\in \\{0, 1, 2, 3, 4, 5, 6\\} \\).\n\nWe compute \\( r^2 + r + 1 \\mod 7 \\):\n\n- \\( r = 0 \\): \\( 0 + 0 + 1 = 1 \\) → not divisible by 7.\n- \\( r = 1 \\): \\( 1 + 1 + 1 = 3 \\) → no.\n- \\( r = 2 \\): \\( 4 + 2 + 1 = 7 \\equiv 0 \\) → yes.\n- \\( r = 3 \\): \\( 9 + 3 + 1 = 13 \\equiv 6 \\) → no.\n- \\( r = 4 \\): \\( 16 + 4 + 1 = 21 \\equiv 0 \\) → yes.\n- \\( r = 5 \\): \\( 25 + 5 + 1 = 31 \\equiv 3 \\) → no.\n- \\( r = 6 \\): \\( 36 + 6 + 1 = 43 \\equiv 1 \\) → no.\n\nSo \\( n \\equiv 2 \\pmod{7} \\) or \\( n \\equiv 4 \\pmod{7} \\).\n\n---\n\n## **Step 3: General form**\n\\[\nn \\equiv 2 \\pmod{7} \\quad \\text{or} \\quad n \\equiv 4 \\pmod{7}.\n\\]\n\nThat means \\( n = 7k + 2 \\) or \\( n = 7k + 4 \\) for some integer \\( k \\ge 0 \\).\n\n---\n\n## **Step 4: Positive integers \\( n \\leq 100 \\)**\n**Case 1:** \\( n = 7k + 2 \\), \\( n \\leq 100 \\), \\( k \\ge 0 \\).\n\n\\( 7k + 2 \\leq 100 \\) → \\( 7k \\leq 98 \\) → \\( k \\leq 14 \\).\n\nSo \\( k = 0, 1, 2, \\dots, 14 \\) gives \\( n = 2, 9, 16, \\dots, 100 \\).\n\nCheck \\( n=100 \\): \\( 7 \\times 14 + 2 = 98 + 2 = 100 \\) okay.\n\n---\n\n**Case 2:** \\( n = 7k + 4 \\), \\( n \\leq 100 \\), \\( k \\ge 0 \\).\n\n\\( 7k + 4 \\leq 100 \\) → \\( 7k \\leq 96 \\) → \\( k \\leq 13 \\) (since \\( 7 \\times 13 = 91 \\), \\( 91+4=95 \\), \\( 7\\times14=98 \\) → \\( 98+4=102>100 \\)).\n\nSo \\( k = 0, 1, 2, \\dots, 13 \\) gives \\( n = 4, 11, 18, \\dots, 95 \\).\n\n---\n\n## **Step 5: List all such \\( n \\leq 100 \\)**\nFrom case 1: \\( 2, 9, 16, 23, 30, 37, 44, 51, 58, 65, 72, 79, 86, 93, 100 \\).\n\nFrom case 2: \\( 4, 11, 18, 25, 32, 39, 46, 53, 60, 67, 74, 81, 88, 95 \\).\n\nCombine and sort:\n\n\\[\n2, 4, 9, 11, 16, 18, 23, 25, 30, 32, 37, 39, 44, 46, 51, 53, 58, 60, 65, 67, 72, 74, 79, 81, 86, 88, 93, 95, 100.\n\\]\n\n---\n\n## **Step 6: Check count**\nEach sequence has 15 and 14 terms respectively, total \\( 15 + 14 = 29 \\) numbers.\n\nCheck: \\( n=2 \\) works? \\( 4+2+1=7 \\) yes. \\( n=4 \\) works? \\( 16+4+1=21 \\) yes. \\( n=100 \\) works? \\( 10000+100+1=10101 \\), divide by 7: \\( 10101/7 = 1443 \\) yes.\n\n---\n\n**Final answer:**\n\\[\n\\boxed{2, 4, 9, 11, 16, 18, 23, 25, 30, 32, 37, 39, 44, 46, 51, 53, 58, 60, 65, 67, 72, 74, 79, 81, 86, 88, 93, 95, 100}\n\\]\n\n---\n\nAnswer: 2, 4, 9, 11, 16, 18, 23, 25, 30, 32, 37, 39, 44, 46, 51, 53, 58, 60, 65, 67, 72, 74, 79, 81, 86, 88, 93, 95, 100",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.8648648648648649,
|
||||
"costUsd": 0.0013612800000000003,
|
||||
"claudeEquivalentUsd": 0.018687,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "mod7_list",
|
||||
"mode": "reasoner",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The condition \\(n^2 + n + 1\\) divisible by 7 is equivalent to \\(n^2 + n + 1 \\equiv 0 \\pmod{7}\\). Testing residues modulo 7:\n\n- \\(n \\equiv 0: 0+0+1 \\equiv 1\\) \n- \\(n \\equiv 1: 1+1+1 \\equiv 3\\) \n- \\(n \\equiv 2: 4+2+1 \\equiv 7 \\equiv 0\\) \n- \\(n \\equiv 3: 9+3+1 \\equiv 13 \\equiv 6\\) \n- \\(n \\equiv 4: 16+4+1 \\equiv 21 \\equiv 0\\) \n- \\(n \\equiv 5: 25+5+1 \\equiv 31 \\equiv 3\\) \n- \\(n \\equiv 6: 36+6+1 \\equiv 43 \\equiv 1\\)\n\nThus, \\(n \\equiv 2\\) or \\(n \\equiv 4 \\pmod{7}\\) are the solutions modulo 7. For positive integers \\(n \\leq 100\\), we list all numbers congruent to 2 or 4 modulo 7 in increasing order.\n\nAnswer: 2, 4, 9, 11, 16, 18, 23, 25, 30, 32, 37, 39, 44, 46, 51, 53, 58, 60, 65, 67, 72, 74, 79, 81, 86, 88, 93, 95, 100",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.8648648648648649,
|
||||
"costUsd": 0.00479742,
|
||||
"claudeEquivalentUsd": 0.032982,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "mod7_list",
|
||||
"mode": "reasoner-harvest",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The congruence \\(n^2 + n + 1 \\equiv 0 \\pmod{7}\\) is solved by testing residues modulo 7. The solutions are \\(n \\equiv 2\\) and \\(n \\equiv 4 \\pmod{7}\\). For positive integers \\(n \\le 100\\), these yield \\(n = 7k + 2\\) with \\(k = 0, 1, \\dots, 14\\) and \\(n = 7k + 4\\) with \\(k = 0, 1, \\dots, 13\\).\n\nAnswer: 2, 4, 9, 11, 16, 18, 23, 25, 30, 32, 37, 39, 44, 46, 51, 53, 58, 60, 65, 67, 72, 74, 79, 81, 86, 88, 93, 95, 100",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.8648648648648649,
|
||||
"costUsd": 0.00304542,
|
||||
"claudeEquivalentUsd": 0.020982,
|
||||
"harvestedTurns": 1,
|
||||
"totalSubgoals": 4,
|
||||
"totalUncertainties": 2,
|
||||
"totalHypotheses": 2,
|
||||
"totalRejectedPaths": 2
|
||||
},
|
||||
{
|
||||
"taskId": "flips_until_3heads",
|
||||
"mode": "baseline",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "Alright, let's reason through this step-by-step.\n\n---\n\n## **Step 1: Define states**\nLet’s define states based on how many consecutive heads we have at the moment.\n\n- \\( E_0 \\): Expected flips to reach 3 heads in a row starting from 0 consecutive heads (or just starting, or after a tail).\n- \\( E_1 \\): Expected flips to reach 3 heads in a row starting from 1 consecutive head.\n- \\( E_2 \\): Expected flips to reach 3 heads in a row starting from 2 consecutive heads.\n\nWe want \\( E_0 \\).\n\n---\n\n## **Step 2: Transition equations**\nFrom \\( E_0 \\):\n- Flip H (prob \\( \\frac12 \\)) → go to state \\( E_1 \\), 1 flip used.\n- Flip T (prob \\( \\frac12 \\)) → stay in \\( E_0 \\), 1 flip used.\n\nSo:\n\\[\nE_0 = \\frac12 (1 + E_1) + \\frac12 (1 + E_0)\n\\]\n\n---\n\nFrom \\( E_1 \\) (already have 1 head):\n- Flip H (prob \\( \\frac12 \\)) → go to state \\( E_2 \\), 1 flip used.\n- Flip T (prob \\( \\frac12 \\)) → go to state \\( E_0 \\), 1 flip used.\n\nSo:\n\\[\nE_1 = \\frac12 (1 + E_2) + \\frac12 (1 + E_0)\n\\]\n\n---\n\nFrom \\( E_2 \\) (already have 2 heads):\n- Flip H (prob \\( \\frac12 \\)) → done (3 heads in a row), 1 flip used.\n- Flip T (prob \\( \\frac12 \\)) → go to state \\( E_0 \\), 1 flip used.\n\nSo:\n\\[\nE_2 = \\frac12 (1 + 0) + \\frac12 (1 + E_0)\n\\]\n\\[\nE_2 = \\frac12 \\cdot 1 + \\frac12 (1 + E_0) \\quad\\text{(Wait, careful:)}\n\\]\nActually: \nIf H: \\( 1 \\) flip and done. \nIf T: \\( 1 \\) flip and then \\( E_0 \\) more.\n\nSo:\n\\[\nE_2 = \\frac12 \\cdot 1 + \\frac12 (1 + E_0)\n\\]\nCheck: \nH: 1 flip → total 1, done. Contribution: \\( \\frac12 \\times 1 \\). \nT: 1 flip + \\( E_0 \\) more → total \\( 1 + E_0 \\). Contribution: \\( \\frac12 \\times (1 + E_0) \\).\n\nYes:\n\\[\nE_2 = \\frac12 \\cdot 1 + \\frac12 (1 + E_0) = \\frac12 + \\frac12 + \\frac12 E_0 = 1 + \\frac{E_0}{2}.\n\\]\n\n---\n\n## **Step 3: Solve system**\nWe have:\n\n(1) \\( E_0 = \\frac12 (1 + E_1) + \\frac12 (1 + E_0) \\) \nSimplify: \\( E_0 = 1 + \\frac12 E_1 + \\frac12 E_0 \\) \nMultiply by 2: \\( 2E_0 = 2 + E_1 + E_0 \\) \nSo \\( E_0 - E_1 = 2 \\) … (Eq A)\n\n---\n\n(2) \\( E_1 = \\frac12 (1 + E_2) + \\frac12 (1 + E_0) \\) \nSimplify: \\( E_1 = 1 + \\frac12 E_2 + \\frac12 E_0 \\) … (Eq B)\n\n---\n\n(3) \\( E_2 = 1 + \\frac12 E_0 \\) … (Eq C)\n\n---\n\nFrom Eq C into Eq B:\n\\[\nE_1 = 1 + \\frac12 \\left( 1 + \\frac12 E_0 \\right) + \\frac12 E_0\n\\]\n\\[\nE_1 = 1 + \\frac12 + \\frac14 E_0 + \\frac12 E_0\n\\]\n\\[\nE_1 = \\frac32 + \\frac34 E_0\n\\]\n\n---\n\nFrom Eq A: \\( E_0 - E_1 = 2 \\) \nSubstitute \\( E_1 \\):\n\\[\nE_0 - \\left( \\frac32 + \\frac34 E_0 \\right) = 2\n\\]\n\\[\nE_0 - \\frac32 - \\frac34 E_0 = 2\n\\]\n\\[\n\\frac14 E_0 - \\frac32 = 2\n\\]\n\\[\n\\frac14 E_0 = 2 + \\frac32 = \\frac72\n\\]\n\\[\nE_0 = 14\n\\]\n\n---\n\n## **Step 4: Conclusion**\nThe expected number of flips until we get 3 heads in a row is \\( 14 \\).\n\n---\n\n**Answer:** 14",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.927536231884058,
|
||||
"costUsd": 0.00119823,
|
||||
"claudeEquivalentUsd": 0.016467,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "flips_until_3heads",
|
||||
"mode": "reasoner",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The expected number of flips required to get three consecutive heads is 14, derived from solving the system of linear equations for the Markov chain states representing the current streak of heads.\n\nAnswer: 14",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.927536231884058,
|
||||
"costUsd": 0.00283024,
|
||||
"claudeEquivalentUsd": 0.019512,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "flips_until_3heads",
|
||||
"mode": "reasoner-harvest",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The expected number of flips until three consecutive heads appear is 14.\n\nAnswer: 14",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.927536231884058,
|
||||
"costUsd": 0.00169144,
|
||||
"claudeEquivalentUsd": 0.011712,
|
||||
"harvestedTurns": 1,
|
||||
"totalSubgoals": 4,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 2,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "three_hats",
|
||||
"mode": "baseline",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "Let's break this down step by step.\n\n---\n\n**Step 1: Understanding the setup** \nThree people: A (first), B (second), C (third). \nEach hat is red (R) or blue (B). \nThey know: at least one hat is red. \nEach sees the other two hats, not their own. \nThey are asked in order: \"Do you know your hat color?\" \nA answers no, B answers no, C answers yes. \nWe want C’s hat color.\n\n---\n\n**Step 2: From A’s perspective when asked** \nA sees B and C. \nIf A had seen two blue hats, then A would know: \"At least one red hat means my hat must be red.\" \nSo A says \"no\" → A did **not** see two blue hats. \nThus A sees at least one red hat on {B, C}.\n\nPossible cases for what A sees (B, C): \n(R, R), (R, B), (B, R) — all have at least one red.\n\n---\n\n**Step 3: B’s reasoning when asked** \nB hears A say \"no\". \nB sees A and C. \n\nLet’s consider B’s possible deductions from A’s \"no\": \nB knows: If A had seen two blues, A would have said yes. Since A said no, A saw at least one red among B and C. \nBut B sees A and C. \n\nFrom B’s viewpoint: \n- If B saw C with blue and A with blue, then B would know: \"A saw me and C both blue → impossible because A said no.\" But B doesn’t see that because if B saw A blue and C blue, then B would know his own hat must be red (since at least one red total). But then B would answer yes. \nSo B’s \"no\" means B did **not** see A and C both blue. \n\nAlso, B considers: Could my hat be blue? Let’s check: \nSuppose B sees A red, C blue. Then B thinks: \"If my hat were blue, then A would have seen (B blue, C blue) → A would have said yes. But A said no, so my hat cannot be blue.\" \nSo if B saw (A red, C blue), B would deduce: \"My hat must be red.\" Then B would answer yes. \nBut B said no → so B did **not** see (A red, C blue).\n\nSimilarly, if B saw (A blue, C red): \nThen B thinks: \"If my hat were blue, then A would have seen (B blue, C red) → that’s fine (A sees one red on C), so A would still say no. If my hat were red, then A would see (B red, C red) → A would still say no. So I don’t know.\" That’s consistent with B saying no. \n\nIf B saw (A red, C red): \nThen B thinks: \"If my hat were blue, A sees (B blue, C red) → A says no. If my hat were red, A sees (B red, C red) → A says no. So I don’t know.\" That’s also consistent with B saying no.\n\nSo B says no in cases: \nB sees (A blue, C red) or (A red, C red). \nB would say yes if B saw (A red, C blue) — but that didn’t happen. \n\n---\n\n**Step 4: C’s reasoning** \nC hears A says no, B says no. \nC sees A and B. \n\nFrom C’s viewpoint: \nLet’s list all possible (A, B, C) hat colorings with at least one red, consistent with A’s \"no\" (which we already incorporated: A sees at least one red on B/C) and B’s \"no\" (meaning B didn’t see A red, C blue — because that would make B know).\n\nPossible cases for (A, B) that C could see: \n\n1. C sees (A blue, B red): \n Then C thinks: \n - If C were blue: (A blue, B red, C blue) → A sees (B red, C blue) → A says no. B sees (A blue, C blue) → B sees two blues? Wait, B sees A blue, C blue → then B knows his own hat is red (since at least one red total) → B would say yes. But B said no → contradiction. So C cannot be blue. \n So C must be red. \n\n2. C sees (A red, B blue): \n Then C thinks: \n - If C were blue: (A red, B blue, C blue) → A sees (B blue, C blue) → A would say yes (since at least one red total means A’s hat must be red). But A said no → contradiction. So C cannot be blue. \n So C must be red. \n\n3. C sees (A red, B red): \n Then C thinks: \n - If C were blue: (A red, B red, C blue) → A sees (B red, C blue) → A says no. B sees (A red, C blue) → B sees A red, C blue → earlier we said: If B sees A red, C blue, then B would deduce his own hat is red (reasoning: if B were blue, A would have seen two blues and said yes, but A said no, so B can’t be blue) → so B would say yes. But B actually said no → contradiction. So C cannot be blue. \n - If C were red: (A red, B red, C red) → A sees (B red, C red) → A says no. B sees (A red, C red) → B says no. Works fine. \n\nSo in all cases C sees for (A, B), C can deduce C’s hat is **red** because assuming C is blue leads to contradiction with B’s \"no\" (in cases 1 and 3) or with A’s \"no\" (in case 2).\n\n---\n\n**Step 5: Conclusion** \nC answers yes, and C’s hat must be red.\n\n---\n\nAnswer: red",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.5765765765765766,
|
||||
"costUsd": 0.0015142700000000003,
|
||||
"claudeEquivalentUsd": 0.020748,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "three_hats",
|
||||
"mode": "reasoner",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "Answer: red",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.5765765765765766,
|
||||
"costUsd": 0.009340119999999999,
|
||||
"claudeEquivalentUsd": 0.064068,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "three_hats",
|
||||
"mode": "reasoner-harvest",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The third person deduces their hat color based on the previous responses. Since the first two answer \"no,\" it implies they each see at least one red hat and cannot determine their own color. Specifically, the second person's \"no\" indicates they see the third person's hat as red; otherwise, they would have known their own hat color. Therefore, the third person's hat must be red.\n\nAnswer: red",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.5765765765765766,
|
||||
"costUsd": 0.0096511,
|
||||
"claudeEquivalentUsd": 0.066198,
|
||||
"harvestedTurns": 1,
|
||||
"totalSubgoals": 3,
|
||||
"totalUncertainties": 2,
|
||||
"totalHypotheses": 3,
|
||||
"totalRejectedPaths": 3
|
||||
},
|
||||
{
|
||||
"taskId": "pseudoprime_base2",
|
||||
"mode": "baseline",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "Alright, let's go step-by-step.\n\n---\n\n**Step 1: Understanding the problem**\n\nWe want the smallest composite integer \\( n > 1 \\) such that\n\n\\[\n2^n \\equiv 2 \\pmod{n}.\n\\]\n\nEquivalently, \\( 2^{n-1} \\equiv 1 \\pmod{n} \\) for composite \\( n \\).\n\nThis means \\( n \\) is a **Fermat pseudoprime to base 2**.\n\nWe check composite numbers starting from the smallest.\n\n---\n\n**Step 2: Check small composites**\n\n- \\( n = 4 \\): composite. \n\\( 2^4 = 16 \\), \\( 16 \\mod 4 = 0 \\), not \\( 2 \\). So \\( 2^4 \\equiv 0 \\not\\equiv 2 \\pmod{4} \\). Fails.\n\n- \\( n = 6 \\): composite. \n\\( 2^6 = 64 \\), \\( 64 \\mod 6 = 4 \\), not \\( 2 \\). Fails.\n\n- \\( n = 8 \\): composite. \n\\( 2^8 = 256 \\), \\( 256 \\mod 8 = 0 \\), not \\( 2 \\). Fails.\n\n- \\( n = 9 \\): composite. \n\\( 2^9 = 512 \\), \\( 512 \\mod 9 \\): \n\\( 512 \\div 9 \\), \\( 9 \\times 56 = 504 \\), remainder \\( 8 \\), not \\( 2 \\). Fails.\n\n- \\( n = 10 \\): composite. \n\\( 2^{10} = 1024 \\), \\( 1024 \\mod 10 = 4 \\), not \\( 2 \\). Fails.\n\n---\n\n**Step 3: Try n = 15**\n\n\\( n = 15 \\): composite. \n\\( 2^{15} = 32768 \\). \nCheck mod 15: \nWe can use mod arithmetic: \n\\( 2^4 = 16 \\equiv 1 \\pmod{15} \\)?? Wait, check: \\( 16 \\mod 15 = 1 \\), yes. \nSo \\( 2^{15} = (2^4)^3 \\times 2^3 = 1^3 \\times 8 = 8 \\pmod{15} \\). \nSo \\( 2^{15} \\equiv 8 \\not\\equiv 2 \\pmod{15} \\). Fails.\n\n---\n\n**Step 4: Try n = 21**\n\n\\( n = 21 \\): composite. \nMod 21: \n\\( 2^6 = 64 \\equiv 1 \\pmod{21} \\)? Check: \\( 64 \\div 21 = 3 \\times 21 = 63 \\), remainder 1, yes. \nSo \\( 2^{21} = (2^6)^3 \\times 2^3 \\equiv 1^3 \\times 8 = 8 \\pmod{21} \\). Not 2. Fails.\n\n---\n\n**Step 5: Try n = 22**\n\n\\( n = 22 \\): composite. \nUse mod 22: \nEuler’s totient not needed, just check order: \n\\( 2^5 = 32 \\equiv 10 \\pmod{22} \\) \n\\( 2^{10} = (2^5)^2 \\equiv 10^2 = 100 \\equiv 12 \\pmod{22} \\) \n\\( 2^{11} \\equiv 24 \\equiv 2 \\pmod{22} \\) \nSo \\( 2^{22} = (2^{11})^2 \\equiv 2^2 = 4 \\pmod{22} \\). Not 2. Fails.\n\n---\n\n**Step 6: Try n = 25**\n\n\\( n = 25 \\): composite. \nCheck mod 25: \n\\( 2^{10} = 1024 \\equiv 24 \\pmod{25} \\) (since \\( 1000 \\equiv 0 \\), \\( 24 \\equiv -1 \\)) \nActually check: \\( 1024 - 1000 = 24 \\), yes \\( 24 \\equiv -1 \\). \nSo \\( 2^{20} \\equiv 1 \\pmod{25} \\). \nThus \\( 2^{25} = 2^{20} \\times 2^5 \\equiv 1 \\times 32 = 7 \\pmod{25} \\). Not 2. Fails.\n\n---\n\n**Step 7: Known smallest base-2 Fermat pseudoprime**\n\nFrom known number theory facts: \nThe smallest Fermat pseudoprime to base 2 is \\( n = 341 \\). \nBut let's check smaller ones just in case I’m skipping one.\n\n---\n\n**Step 8: Try n = 91**\n\n91 = 7 × 13. \nCheck mod 7: \\( 2^{91} \\equiv (2^6)^{15} \\times 2^1 \\equiv 1^{15} \\times 2 = 2 \\pmod{7} \\). \nCheck mod 13: \\( 2^{12} \\equiv 1 \\pmod{13} \\), \n\\( 91 = 12 \\times 7 + 7 \\), so \\( 2^{91} \\equiv 2^7 = 128 \\equiv 11 \\pmod{13} \\). \nFor \\( 2^{91} \\equiv 2 \\pmod{91} \\), we need \\( 2^{91} \\equiv 2 \\) mod 7 and mod 13. \nMod 13 we got 11, not 2. So fails.\n\n---\n\n**Step 9: Try n = 341**\n\n341 = 11 × 31. \nCheck mod 11: \\( 2^{10} \\equiv 1 \\pmod{11} \\), \n\\( 341 = 10 \\times 34 + 1 \\), so \\( 2^{341} \\equiv 2^1 = 2 \\pmod{11} \\). Good. \nCheck mod 31: \\( 2^5 = 32 \\equiv 1 \\pmod{31} \\), \n\\( 341 = 5 \\times 68 + 1 \\), so \\( 2^{341} \\equiv 2^1 = 2 \\pmod{31} \\). \nSo \\( 2^{341} \\equiv 2 \\) mod 11 and mod 31, hence mod 341. \nThus \\( 341 \\) works.\n\n---\n\n**Step 10: Check smaller than 341**\n\nKnown list: 341 is smallest. Let’s check a candidate like 121 = 11^2: \n\\( 2^{121} \\mod 121 \\): \nMod 11: \\( 2^{10} \\equiv 1 \\), \\( 121 = 10 \\times 12 + 1 \\), so \\( 2^{121} \\equiv 2 \\pmod{11} \\). \nBut for modulus 121, need more: \nActually, \\( 2^{110} \\equiv 1 \\pmod{121} \\) by Euler’s theorem? Not exactly, but known: 121 is not a pseudoprime base 2. Quick check: \n\\( 2^{121} - 2 \\) divisible by 121? Probably not. Let’s skip detailed check; known fact is 341 is smallest.\n\n---\n\n**Step 11: Verify no smaller composite works**\n\nFrom known sequence A001567: \nFirst few base-2 Fermat pseudoprimes: 341, 561, 645, 1105, … \nSo smallest is 341.\n\n---\n\n**Step 12: Conclusion**\n\nThe smallest composite \\( n > 1 \\) with \\( 2^n \\equiv 2 \\pmod{n} \\) is \\( n = 341 \\).\n\n---\n\n**Answer:** 341",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0,
|
||||
"costUsd": 0.0018940500000000002,
|
||||
"claudeEquivalentUsd": 0.02577,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "pseudoprime_base2",
|
||||
"mode": "reasoner",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The smallest composite integer \\(n > 1\\) satisfying \\(2^n \\equiv 2 \\pmod{n}\\) is \\(n = 341\\). This is composite (\\(341 = 11 \\times 31\\)), and it satisfies the congruence because \\(2^{341} \\equiv 2 \\pmod{11}\\) and \\(2^{341} \\equiv 2 \\pmod{31}\\) by Fermat's little theorem, implying \\(2^{341} \\equiv 2 \\pmod{341}\\). All smaller composite integers (e.g., 4, 6, 8, 9, 10, 15, 21) fail to satisfy the condition.\n\nAnswer: 341",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.7529411764705882,
|
||||
"costUsd": 0.0031281200000000003,
|
||||
"claudeEquivalentUsd": 0.02154,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "pseudoprime_base2",
|
||||
"mode": "reasoner-harvest",
|
||||
"repeat": 1,
|
||||
"verdict": "fail",
|
||||
"checkNote": "This operation was aborted",
|
||||
"finalAgentMessage": "",
|
||||
"turns": 0,
|
||||
"cacheHitRatio": 0,
|
||||
"costUsd": 0,
|
||||
"claudeEquivalentUsd": 0,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0,
|
||||
"errorMessage": "This operation was aborted"
|
||||
},
|
||||
{
|
||||
"taskId": "derangements_d7",
|
||||
"mode": "baseline",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "Alright, let's go step-by-step.\n\n---\n\n**Step 1: Understanding the problem**\n\nWe want the number of permutations of \\(\\{1, 2, 3, 4, 5, 6, 7\\}\\) with **no fixed points**. \nA fixed point means \\(\\pi(i) = i\\) for some \\(i\\). \nA permutation with no fixed points is called a **derangement**. \nThe number of derangements of \\(n\\) elements is denoted \\(D_n\\) or \\(!n\\).\n\n---\n\n**Step 2: Formula for derangements**\n\nThe formula for \\(D_n\\) is:\n\n\\[\nD_n = n! \\sum_{k=0}^{n} \\frac{(-1)^k}{k!}\n\\]\n\nFor \\(n=7\\):\n\n\\[\nD_7 = 7! \\left( \\frac{1}{0!} - \\frac{1}{1!} + \\frac{1}{2!} - \\frac{1}{3!} + \\frac{1}{4!} - \\frac{1}{5!} + \\frac{1}{6!} - \\frac{1}{7!} \\right)\n\\]\n\n---\n\n**Step 3: Compute step-by-step**\n\nFirst, \\(7! = 5040\\).\n\nNow compute the sum:\n\n\\[\n\\sum_{k=0}^{7} \\frac{(-1)^k}{k!} \n= 1 - 1 + \\frac{1}{2} - \\frac{1}{6} + \\frac{1}{24} - \\frac{1}{120} + \\frac{1}{720} - \\frac{1}{5040}\n\\]\n\nLet's compute term-by-term:\n\n- \\(1 - 1 = 0\\)\n- \\(0 + 0.5 = 0.5\\)\n- \\(0.5 - \\frac{1}{6} \\approx 0.5 - 0.1666667 = 0.3333333\\)\n- \\(0.3333333 + \\frac{1}{24} \\approx 0.3333333 + 0.0416667 = 0.375\\)\n- \\(0.375 - \\frac{1}{120} \\approx 0.375 - 0.0083333 = 0.3666667\\)\n- \\(0.3666667 + \\frac{1}{720} \\approx 0.3666667 + 0.0013889 = 0.3680556\\)\n- \\(0.3680556 - \\frac{1}{5040} \\approx 0.3680556 - 0.0001984 = 0.3678572\\)\n\nSo the sum is approximately \\(0.367857142857...\\)\n\n---\n\n**Step 4: Multiply by \\(7!\\)**\n\n\\[\nD_7 = 5040 \\times 0.367857142857\\ldots\n\\]\n\nLet's compute exactly using fractions:\n\n\\[\n\\sum_{k=0}^{7} \\frac{(-1)^k}{k!} \n= \\frac{1}{2!} - \\frac{1}{3!} + \\frac{1}{4!} - \\frac{1}{5!} + \\frac{1}{6!} - \\frac{1}{7!}\n\\]\n\nWrite with common denominator \\(7! = 5040\\):\n\n- \\(\\frac{1}{2!} = \\frac{2520}{5040}\\)\n- \\(\\frac{1}{3!} = \\frac{840}{5040}\\)\n- \\(\\frac{1}{4!} = \\frac{210}{5040}\\)\n- \\(\\frac{1}{5!} = \\frac{42}{5040}\\)\n- \\(\\frac{1}{6!} = \\frac{7}{5040}\\)\n- \\(\\frac{1}{7!} = \\frac{1}{5040}\\)\n\nNow alternate signs:\n\n\\[\n\\left( \\frac{2520}{5040} - \\frac{840}{5040} \\right) \n= \\frac{1680}{5040}\n\\]\n\\[\n\\frac{1680}{5040} + \\frac{210}{5040} = \\frac{1890}{5040}\n\\]\n\\[\n\\frac{1890}{5040} - \\frac{42}{5040} = \\frac{1848}{5040}\n\\]\n\\[\n\\frac{1848}{5040} + \\frac{7}{5040} = \\frac{1855}{5040}\n\\]\n\\[\n\\frac{1855}{5040} - \\frac{1}{5040} = \\frac{1854}{5040}\n\\]\n\nSo the sum is \\(\\frac{1854}{5040}\\).\n\n---\n\n**Step 5: Multiply by \\(7!\\)**\n\n\\[\nD_7 = 5040 \\times \\frac{1854}{5040} = 1854\n\\]\n\n---\n\n**Step 6: Quick check with known derangement numbers**\n\nKnown small derangements: \n\\(D_1 = 0, D_2 = 1, D_3 = 2, D_4 = 9, D_5 = 44, D_6 = 265, D_7 = 1854\\). \nYes, matches known sequence.\n\n---\n\n**Final answer:**\n\nAnswer: 1854",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0,
|
||||
"costUsd": 0.00127253,
|
||||
"claudeEquivalentUsd": 0.017292,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "derangements_d7",
|
||||
"mode": "reasoner",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The number of derangements of \\(n\\) distinct objects, denoted \\(D_n\\), counts permutations with no fixed points. For \\(n = 7\\), this can be computed using the recurrence \\(D_n = (n-1)(D_{n-1} + D_{n-2})\\) with initial values \\(D_1 = 0\\) and \\(D_2 = 1\\). \nThus: \n\\(D_3 = 2(1+0) = 2\\), \n\\(D_4 = 3(2+1) = 9\\), \n\\(D_5 = 4(9+2) = 44\\), \n\\(D_6 = 5(44+9) = 265\\), \n\\(D_7 = 6(265+44) = 1854\\).\n\nAnswer: 1854",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.7191011235955056,
|
||||
"costUsd": 0.00349167,
|
||||
"claudeEquivalentUsd": 0.024027,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "derangements_d7",
|
||||
"mode": "reasoner-harvest",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The number of derangements of \\(n\\) elements, denoted \\(D_n\\), counts permutations with no fixed points. For \\(n=7\\), this can be computed using the recurrence \\(D_n = (n-1)(D_{n-1} + D_{n-2})\\) with initial values \\(D_0 = 1\\) and \\(D_1 = 0\\). Applying the recurrence yields \\(D_2 = 1\\), \\(D_3 = 2\\), \\(D_4 = 9\\), \\(D_5 = 44\\), \\(D_6 = 265\\), and finally \\(D_7 = 6 \\times (265 + 44) = 1854\\).\n\nAnswer: 1854",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.7191011235955056,
|
||||
"costUsd": 0.0028434299999999997,
|
||||
"claudeEquivalentUsd": 0.019587,
|
||||
"harvestedTurns": 1,
|
||||
"totalSubgoals": 3,
|
||||
"totalUncertainties": 2,
|
||||
"totalHypotheses": 2,
|
||||
"totalRejectedPaths": 2
|
||||
},
|
||||
{
|
||||
"taskId": "euler_quadratic_break",
|
||||
"mode": "baseline",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "Let’s check \\( f(n) = n^2 + n + 41 \\) for small \\( n \\):\n\n- \\( n = 0 \\): \\( f(0) = 41 \\) (prime) \n- \\( n = 1 \\): \\( f(1) = 1 + 1 + 41 = 43 \\) (prime) \n- \\( n = 2 \\): \\( f(2) = 4 + 2 + 41 = 47 \\) (prime) \n- \\( n = 3 \\): \\( f(3) = 9 + 3 + 41 = 53 \\) (prime) \n- \\( n = 4 \\): \\( f(4) = 16 + 4 + 41 = 61 \\) (prime) \n- \\( n = 5 \\): \\( f(5) = 25 + 5 + 41 = 71 \\) (prime) \n- \\( n = 6 \\): \\( f(6) = 36 + 6 + 41 = 83 \\) (prime) \n- \\( n = 7 \\): \\( f(7) = 49 + 7 + 41 = 97 \\) (prime) \n- \\( n = 8 \\): \\( f(8) = 64 + 8 + 41 = 113 \\) (prime) \n- \\( n = 9 \\): \\( f(9) = 81 + 9 + 41 = 131 \\) (prime) \n- \\( n = 10 \\): \\( f(10) = 100 + 10 + 41 = 151 \\) (prime) \n\nWe can keep going, but the first known counterexample for this famous Euler polynomial is \\( n = 40 \\), because \n\\[\nf(40) = 40^2 + 40 + 41 = 1600 + 40 + 41 = 1681.\n\\] \nCheck if \\( 1681 \\) is prime: \n\\( 1681 = 41^2 \\) (since \\( 41 \\times 41 = 1681 \\)), so it’s composite.\n\nBut wait — let’s check if there’s a smaller \\( n \\) where \\( f(n) \\) is composite. \nWe can test \\( n = 41 \\): \n\\( f(41) = 41^2 + 41 + 41 = 1681 + 82 = 1763 \\), which is \\( 41 \\times 43 \\) (since \\( 1763/41 = 43 \\)), so composite. But \\( n = 41 \\) is larger than \\( n = 40 \\).\n\nCheck \\( n = 39 \\): \\( f(39) = 1521 + 39 + 41 = 1601 \\). Test divisibility: not divisible by primes up to \\( \\sqrt{1601} \\approx 40 \\), seems prime. \n\nCheck \\( n = 40 \\) is indeed the first composite? Let’s check \\( n = 1 \\) to \\( 39 \\) quickly for a smaller counterexample: \nWe can note \\( f(n) = n(n+1) + 41 \\). If \\( 41 \\mid f(n) \\), then \\( 41 \\mid n(n+1) \\). \nThat happens when \\( n \\equiv 0 \\pmod{41} \\) or \\( n \\equiv 40 \\pmod{41} \\). \nThe smallest positive such \\( n \\) is \\( n = 40 \\) (since \\( n=41 \\) is larger). \nSo for \\( n = 40 \\), \\( f(40) = 40 \\times 41 + 41 = 41 \\times 41 \\) is composite. \n\nCheck \\( n = 0 \\) to \\( 39 \\): no multiple of 41 except \\( n=0 \\) (which gives 41, prime). So \\( n=40 \\) is indeed the first nonnegative integer where \\( f(n) \\) is composite.\n\nThus smallest \\( n \\) is \\( 40 \\), \\( f(40) = 1681 = 41^2 \\).\n\n**Answer:** 40",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0,
|
||||
"costUsd": 0.00098535,
|
||||
"claudeEquivalentUsd": 0.013365,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "euler_quadratic_break",
|
||||
"mode": "reasoner",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The smallest nonnegative integer \\(n\\) for which \\(f(n) = n^2 + n + 41\\) is composite is \\(n = 40\\). At this value, \\(f(40) = 40^2 + 40 + 41 = 1681 = 41^2\\), which is not prime.\n\nAnswer: 40",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.6095238095238096,
|
||||
"costUsd": 0.0014309199999999998,
|
||||
"claudeEquivalentUsd": 0.0099,
|
||||
"harvestedTurns": 0,
|
||||
"totalSubgoals": 0,
|
||||
"totalUncertainties": 0,
|
||||
"totalHypotheses": 0,
|
||||
"totalRejectedPaths": 0
|
||||
},
|
||||
{
|
||||
"taskId": "euler_quadratic_break",
|
||||
"mode": "reasoner-harvest",
|
||||
"repeat": 1,
|
||||
"verdict": "pass",
|
||||
"finalAgentMessage": "The polynomial \\(f(n) = n^2 + n + 41\\) is known to produce primes for \\(n = 0, 1, 2, \\dots, 39\\). At \\(n = 40\\), we have \\(f(40) = 40^2 + 40 + 41 = 1681\\), and \\(1681 = 41^2\\), which is composite. Therefore, \\(n = 40\\) is the smallest nonnegative integer where \\(f(n)\\) fails to be prime.\n\nAnswer: 40",
|
||||
"turns": 1,
|
||||
"cacheHitRatio": 0.6095238095238096,
|
||||
"costUsd": 0.0025938099999999998,
|
||||
"claudeEquivalentUsd": 0.017865,
|
||||
"harvestedTurns": 1,
|
||||
"totalSubgoals": 3,
|
||||
"totalUncertainties": 2,
|
||||
"totalHypotheses": 3,
|
||||
"totalRejectedPaths": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
/**
|
||||
* Harvest-bench runner.
|
||||
*
|
||||
* Usage:
|
||||
* npx tsx benchmarks/harvest/runner.ts # all tasks, all modes, 1 repeat
|
||||
* npx tsx benchmarks/harvest/runner.ts --task mod7_list
|
||||
* npx tsx benchmarks/harvest/runner.ts --mode reasoner-harvest --repeats 3
|
||||
* npx tsx benchmarks/harvest/runner.ts --transcripts-dir transcripts/
|
||||
* npx tsx benchmarks/harvest/runner.ts --dry # smoke test wiring, no API
|
||||
*
|
||||
* Writes results.json. Render report.md with `report.ts`.
|
||||
*/
|
||||
|
||||
import { type WriteStream, mkdirSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import {
|
||||
CacheFirstLoop,
|
||||
DeepSeekClient,
|
||||
ImmutablePrefix,
|
||||
claudeEquivalentCost,
|
||||
loadDotenv,
|
||||
} from "../../src/index.js";
|
||||
import { openTranscriptFile, recordFromLoopEvent, writeRecord } from "../../src/transcript.js";
|
||||
import { TASKS } from "./tasks.js";
|
||||
import type {
|
||||
HarvestBenchMeta,
|
||||
HarvestBenchReport,
|
||||
HarvestMode,
|
||||
HarvestRunResult,
|
||||
HarvestTask,
|
||||
} from "./types.js";
|
||||
import { ALL_MODES } from "./types.js";
|
||||
|
||||
loadDotenv();
|
||||
|
||||
interface CliArgs {
|
||||
taskFilter: string | null;
|
||||
modes: HarvestMode[];
|
||||
repeats: number;
|
||||
outPath: string | null;
|
||||
transcriptsDir: string | null;
|
||||
/** Per-HTTP-call timeout in ms. Default 300_000 (5 min) — reasoner + harvest runs legitimately need this. */
|
||||
timeoutMs: number;
|
||||
dry: boolean;
|
||||
verbose: boolean;
|
||||
}
|
||||
|
||||
function parseArgs(argv: string[]): CliArgs {
|
||||
const out: CliArgs = {
|
||||
taskFilter: null,
|
||||
modes: [...ALL_MODES],
|
||||
repeats: 1,
|
||||
outPath: null,
|
||||
transcriptsDir: null,
|
||||
timeoutMs: 300_000,
|
||||
dry: false,
|
||||
verbose: false,
|
||||
};
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i];
|
||||
if (a === "--task") out.taskFilter = argv[++i] ?? null;
|
||||
else if (a === "--mode") {
|
||||
const v = (argv[++i] ?? "").toLowerCase() as HarvestMode;
|
||||
if ((ALL_MODES as string[]).includes(v)) out.modes = [v];
|
||||
} else if (a === "--repeats") out.repeats = Number.parseInt(argv[++i] ?? "1", 10);
|
||||
else if (a === "--out") out.outPath = argv[++i] ?? null;
|
||||
else if (a === "--transcripts-dir") out.transcriptsDir = argv[++i] ?? null;
|
||||
else if (a === "--timeout") {
|
||||
// Accept seconds for humans, convert to ms internally.
|
||||
const secs = Number.parseInt(argv[++i] ?? "300", 10);
|
||||
if (Number.isFinite(secs) && secs > 0) out.timeoutMs = secs * 1000;
|
||||
} else if (a === "--dry") out.dry = true;
|
||||
else if (a === "--verbose" || a === "-v") out.verbose = true;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// ---------- model resolution ----------
|
||||
|
||||
function modelForMode(mode: HarvestMode): string {
|
||||
if (mode === "baseline") return "deepseek-chat";
|
||||
return "deepseek-reasoner";
|
||||
}
|
||||
|
||||
function harvestForMode(mode: HarvestMode): boolean {
|
||||
return mode === "reasoner-harvest";
|
||||
}
|
||||
|
||||
// ---------- run one task in one mode ----------
|
||||
|
||||
async function runOnce(
|
||||
task: HarvestTask,
|
||||
mode: HarvestMode,
|
||||
rep: number,
|
||||
client: DeepSeekClient,
|
||||
transcriptStream: WriteStream | null,
|
||||
): Promise<HarvestRunResult> {
|
||||
const model = modelForMode(mode);
|
||||
const harvest = harvestForMode(mode);
|
||||
|
||||
const prefix = new ImmutablePrefix({ system: task.systemPrompt });
|
||||
const loop = new CacheFirstLoop({
|
||||
client,
|
||||
prefix,
|
||||
model,
|
||||
harvest,
|
||||
stream: false,
|
||||
});
|
||||
const prefixHash = prefix.fingerprint;
|
||||
|
||||
let harvestedTurns = 0;
|
||||
let totalSubgoals = 0;
|
||||
let totalUncertainties = 0;
|
||||
let totalHypotheses = 0;
|
||||
let totalRejectedPaths = 0;
|
||||
let finalText = "";
|
||||
let errorMessage: string | undefined;
|
||||
|
||||
if (transcriptStream) {
|
||||
writeRecord(transcriptStream, {
|
||||
ts: new Date().toISOString(),
|
||||
turn: 1,
|
||||
role: "user",
|
||||
content: task.prompt,
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
for await (const ev of loop.step(task.prompt)) {
|
||||
if (transcriptStream && ev.role !== "assistant_delta") {
|
||||
writeRecord(transcriptStream, recordFromLoopEvent(ev, { model, prefixHash }));
|
||||
}
|
||||
if (ev.role === "assistant_final") {
|
||||
finalText = ev.content;
|
||||
if (ev.planState) {
|
||||
if (
|
||||
ev.planState.subgoals.length +
|
||||
ev.planState.hypotheses.length +
|
||||
ev.planState.uncertainties.length +
|
||||
ev.planState.rejectedPaths.length >
|
||||
0
|
||||
) {
|
||||
harvestedTurns++;
|
||||
totalSubgoals += ev.planState.subgoals.length;
|
||||
totalHypotheses += ev.planState.hypotheses.length;
|
||||
totalUncertainties += ev.planState.uncertainties.length;
|
||||
totalRejectedPaths += ev.planState.rejectedPaths.length;
|
||||
}
|
||||
}
|
||||
} else if (ev.role === "done") {
|
||||
finalText = ev.content || finalText;
|
||||
break;
|
||||
} else if (ev.role === "error") {
|
||||
throw new Error(ev.error ?? "loop error");
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
errorMessage = (err as Error).message;
|
||||
}
|
||||
|
||||
const verdict = errorMessage ? { verdict: "fail" as const, note: errorMessage } : task.check(finalText);
|
||||
|
||||
return {
|
||||
taskId: task.id,
|
||||
mode,
|
||||
repeat: rep + 1,
|
||||
verdict: verdict.verdict,
|
||||
checkNote: verdict.note,
|
||||
finalAgentMessage: finalText,
|
||||
turns: loop.stats.turns.length,
|
||||
cacheHitRatio: loop.stats.aggregateCacheHitRatio,
|
||||
costUsd: loop.stats.totalCost,
|
||||
claudeEquivalentUsd: loop.stats.turns.reduce((s, t) => s + claudeEquivalentCost(t.usage), 0),
|
||||
harvestedTurns,
|
||||
totalSubgoals,
|
||||
totalUncertainties,
|
||||
totalHypotheses,
|
||||
totalRejectedPaths,
|
||||
errorMessage,
|
||||
};
|
||||
}
|
||||
|
||||
// ---------- dry mode ----------
|
||||
|
||||
function runDry(args: CliArgs): HarvestBenchReport {
|
||||
const tasks = filterTasks(args.taskFilter);
|
||||
const results: HarvestRunResult[] = [];
|
||||
for (const task of tasks) {
|
||||
// Exercise each checker with a deliberately wrong reply so we know
|
||||
// the wiring is live — not a pass on empty.
|
||||
const sanity = task.check("Answer: this is not the right answer at all");
|
||||
console.log(`[${task.id}] checker exercises ok (sanity verdict=${sanity.verdict})`);
|
||||
for (const mode of args.modes) {
|
||||
results.push({
|
||||
taskId: task.id,
|
||||
mode,
|
||||
repeat: 1,
|
||||
verdict: "inconclusive",
|
||||
checkNote: "dry-run (no model call)",
|
||||
finalAgentMessage: "[dry-run]",
|
||||
turns: 0,
|
||||
cacheHitRatio: 0,
|
||||
costUsd: 0,
|
||||
claudeEquivalentUsd: 0,
|
||||
harvestedTurns: 0,
|
||||
totalSubgoals: 0,
|
||||
totalUncertainties: 0,
|
||||
totalHypotheses: 0,
|
||||
totalRejectedPaths: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
return { meta: buildMeta(args, tasks.length), results };
|
||||
}
|
||||
|
||||
// ---------- main ----------
|
||||
|
||||
function filterTasks(filter: string | null): HarvestTask[] {
|
||||
if (!filter) return TASKS;
|
||||
const t = TASKS.find((x) => x.id === filter);
|
||||
if (!t) throw new Error(`unknown task: ${filter}`);
|
||||
return [t];
|
||||
}
|
||||
|
||||
function buildMeta(args: CliArgs, taskCount: number): HarvestBenchMeta {
|
||||
return {
|
||||
date: new Date().toISOString(),
|
||||
repeatsPerTask: args.repeats,
|
||||
taskCount,
|
||||
modesRun: args.modes,
|
||||
reasonixVersion: "0.2.2",
|
||||
};
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
|
||||
if (args.dry) {
|
||||
const report = runDry(args);
|
||||
writeReport(report, args.outPath);
|
||||
return;
|
||||
}
|
||||
|
||||
const client = new DeepSeekClient({ timeoutMs: args.timeoutMs });
|
||||
const tasks = filterTasks(args.taskFilter);
|
||||
|
||||
if (args.transcriptsDir) mkdirSync(args.transcriptsDir, { recursive: true });
|
||||
|
||||
const results: HarvestRunResult[] = [];
|
||||
for (const task of tasks) {
|
||||
for (let rep = 0; rep < args.repeats; rep++) {
|
||||
for (const mode of args.modes) {
|
||||
let stream: WriteStream | null = null;
|
||||
if (args.transcriptsDir) {
|
||||
const fname = `${task.id}.${mode}.r${rep + 1}.jsonl`;
|
||||
stream = openTranscriptFile(join(args.transcriptsDir, fname), {
|
||||
version: 1,
|
||||
source: `harvest-bench/${mode}`,
|
||||
model: modelForMode(mode),
|
||||
task: task.id,
|
||||
mode,
|
||||
repeat: rep + 1,
|
||||
startedAt: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
const started = Date.now();
|
||||
let result: HarvestRunResult;
|
||||
try {
|
||||
result = await runOnce(task, mode, rep, client, stream);
|
||||
} finally {
|
||||
stream?.end();
|
||||
}
|
||||
const elapsed = ((Date.now() - started) / 1000).toFixed(1);
|
||||
console.log(
|
||||
`[${task.id}/${mode}/r${rep + 1}] verdict=${result.verdict}` +
|
||||
` cache=${(result.cacheHitRatio * 100).toFixed(1)}%` +
|
||||
` cost=$${result.costUsd.toFixed(6)}` +
|
||||
` harvest=${result.harvestedTurns}:${result.totalSubgoals}s/${result.totalUncertainties}u` +
|
||||
` (${elapsed}s)` +
|
||||
(result.checkNote ? ` ${result.checkNote}` : ""),
|
||||
);
|
||||
results.push(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const report: HarvestBenchReport = { meta: buildMeta(args, tasks.length), results };
|
||||
writeReport(report, args.outPath);
|
||||
}
|
||||
|
||||
function writeReport(report: HarvestBenchReport, outPath: string | null): void {
|
||||
const path =
|
||||
outPath ?? `benchmarks/harvest/results-${new Date().toISOString().replace(/[:.]/g, "-")}.json`;
|
||||
writeFileSync(path, `${JSON.stringify(report, null, 2)}\n`, "utf8");
|
||||
console.log(`wrote ${path}`);
|
||||
}
|
||||
|
||||
function isMain(): boolean {
|
||||
const entry = process.argv[1];
|
||||
if (!entry) return false;
|
||||
return import.meta.url === pathToFileURL(entry).href;
|
||||
}
|
||||
|
||||
if (isMain()) {
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
export { main as runHarvestBench };
|
||||
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* Seed reasoning tasks for the harvest eval harness.
|
||||
*
|
||||
* Each task has:
|
||||
* - a minimal system prompt (so the comparison is about the model, not
|
||||
* the prompt)
|
||||
* - a single user question
|
||||
* - a deterministic checker (regex + set/value compare)
|
||||
*
|
||||
* When adding a new task, prefer problems where:
|
||||
* - the answer has a clean shape (a number, a small set, a yes/no +
|
||||
* explanation) — easier to check
|
||||
* - reasoning actually matters (so harvest has signal to extract);
|
||||
* trivia questions are out of scope
|
||||
* - there's a known-good answer; judgment calls are out of scope
|
||||
*/
|
||||
|
||||
import type { HarvestTask } from "./types.js";
|
||||
|
||||
const CONCISE_SYSTEM = `You are a precise reasoner. Think carefully, then state your final answer on a clearly-labeled line starting with "Answer:".`;
|
||||
|
||||
/**
|
||||
* Parse all non-negative integers out of a string. Handles commas,
|
||||
* ranges written as "2-4" (expands to 2,3,4), and ignores numbers that
|
||||
* look like formula references (e.g. "n^2", "mod 7") by only accepting
|
||||
* integers after we strip common LaTeX decorations.
|
||||
*/
|
||||
function extractIntegers(text: string): number[] {
|
||||
// Strip LaTeX delimiters so n_1 / n^2 / \{ ... \} don't confuse us.
|
||||
const cleaned = text
|
||||
.replace(/\\[a-zA-Z]+/g, " ") // \frac, \mod etc.
|
||||
.replace(/[{}\\]/g, " ")
|
||||
.replace(/[_^]\d+/g, " "); // subscript/superscript numbers
|
||||
// Expand ranges: "2-4" → "2,3,4" (only for small gaps)
|
||||
const rangeExpanded = cleaned.replace(/(\d+)\s*[-–]\s*(\d+)/g, (_, a, b) => {
|
||||
const lo = Number.parseInt(a, 10);
|
||||
const hi = Number.parseInt(b, 10);
|
||||
if (!Number.isFinite(lo) || !Number.isFinite(hi) || hi - lo > 50) return `${a} ${b}`;
|
||||
const out: number[] = [];
|
||||
for (let i = Math.min(lo, hi); i <= Math.max(lo, hi); i++) out.push(i);
|
||||
return out.join(" ");
|
||||
});
|
||||
const matches = rangeExpanded.match(/-?\d+/g) ?? [];
|
||||
return matches.map((m) => Number.parseInt(m, 10)).filter((n) => Number.isFinite(n));
|
||||
}
|
||||
|
||||
/** Extract content after the last "Answer:" label (case-insensitive). */
|
||||
function extractAnswerLine(text: string): string {
|
||||
const matches = [...text.matchAll(/answer\s*[::]\s*([^\n]+)/gi)];
|
||||
if (matches.length === 0) return text;
|
||||
return matches[matches.length - 1]![1]!.trim();
|
||||
}
|
||||
|
||||
// ---------- expected answers ----------
|
||||
|
||||
/** Positive n ≤ 100 such that n^2 + n + 1 ≡ 0 (mod 7). */
|
||||
const MOD7_EXPECTED: number[] = (() => {
|
||||
const out: number[] = [];
|
||||
for (let n = 1; n <= 100; n++) {
|
||||
if ((n * n + n + 1) % 7 === 0) out.push(n);
|
||||
}
|
||||
return out;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Single-integer checker. Pulls the first plausible integer from the last
|
||||
* "Answer:" line; compares for exact equality.
|
||||
*/
|
||||
function checkSingleInt(expected: number) {
|
||||
return (reply: string) => {
|
||||
const answerLine = extractAnswerLine(reply);
|
||||
const nums = extractIntegers(answerLine);
|
||||
if (nums.length === 0) return { verdict: "fail" as const, note: "no number in Answer line" };
|
||||
const n = nums[0]!;
|
||||
if (n === expected) return { verdict: "pass" as const };
|
||||
return { verdict: "fail" as const, note: `got ${n}, expected ${expected}` };
|
||||
};
|
||||
}
|
||||
|
||||
// ---------- tasks ----------
|
||||
|
||||
export const TASKS: HarvestTask[] = [
|
||||
{
|
||||
id: "mod7_list",
|
||||
description:
|
||||
"Number theory — find all positive n ≤ 100 with n^2+n+1 ≡ 0 (mod 7). 29-element set. Classic R1 scratch-work territory.",
|
||||
systemPrompt: CONCISE_SYSTEM,
|
||||
prompt:
|
||||
"Find all positive integers n with n ≤ 100 such that n^2 + n + 1 is divisible by 7. Briefly justify, then end with the full list on a line starting with \"Answer:\".",
|
||||
check: (reply) => {
|
||||
const answerLine = extractAnswerLine(reply);
|
||||
const found = new Set(extractIntegers(answerLine).filter((n) => n >= 1 && n <= 100));
|
||||
const expected = new Set(MOD7_EXPECTED);
|
||||
if (found.size === 0) {
|
||||
return { verdict: "fail", note: "no integers extracted from Answer line" };
|
||||
}
|
||||
// Exact set equality — both containment directions.
|
||||
for (const n of expected) if (!found.has(n)) return { verdict: "fail", note: `missing n=${n}` };
|
||||
for (const n of found) if (!expected.has(n)) return { verdict: "fail", note: `extra n=${n}` };
|
||||
return { verdict: "pass" };
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
id: "flips_until_3heads",
|
||||
description:
|
||||
"Probability — expected coin flips until 3 consecutive heads. Answer: 14. Tests whether R1 derives via recurrence or via memorized result.",
|
||||
systemPrompt: CONCISE_SYSTEM,
|
||||
prompt:
|
||||
"A fair coin is flipped repeatedly until you see 3 heads in a row. What is the expected number of total flips? Give a single integer on a line starting with \"Answer:\".",
|
||||
check: (reply) => {
|
||||
const answerLine = extractAnswerLine(reply);
|
||||
const nums = extractIntegers(answerLine);
|
||||
if (nums.length === 0) return { verdict: "fail", note: "no number in Answer line" };
|
||||
// Accept the first sensible number — sometimes agents write "Answer: 14 flips".
|
||||
const n = nums[0]!;
|
||||
if (n === 14) return { verdict: "pass" };
|
||||
return { verdict: "fail", note: `got ${n}, expected 14` };
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
id: "three_hats",
|
||||
description:
|
||||
"Logic — three people wear red/blue hats, at least one red, they're asked in order. First two say no, third says yes. What color? Answer: red (deducible because if third were blue, the first two could see one red + one unknown and wouldn't have said no on their full first round, for most configurations the third can only be certain if red).",
|
||||
systemPrompt: CONCISE_SYSTEM,
|
||||
prompt:
|
||||
'Three people wear hats that are each red or blue. They are told at least one hat is red. Each can see the other two hats but not their own. They are asked in order: "Do you know your hat color?" The first two answer no. The third answers yes. What color is the third person\'s hat? Give a one-word answer on a line starting with "Answer:".',
|
||||
check: (reply) => {
|
||||
const answerLine = extractAnswerLine(reply).toLowerCase();
|
||||
// Accept "red" as a standalone word (not "redirected" etc).
|
||||
if (/\bred\b/.test(answerLine) && !/\bblue\b/.test(answerLine)) {
|
||||
return { verdict: "pass" };
|
||||
}
|
||||
if (/\bblue\b/.test(answerLine)) return { verdict: "fail", note: "answered blue" };
|
||||
return { verdict: "fail", note: "no clear color in Answer line" };
|
||||
},
|
||||
},
|
||||
|
||||
// ---------- hard tasks (picked for known V3 failure modes) ----------
|
||||
|
||||
{
|
||||
id: "pseudoprime_base2",
|
||||
description:
|
||||
"Number theory — smallest composite n > 1 such that 2^n ≡ 2 (mod n). This is the smallest Fermat pseudoprime to base 2. Answer: 341 (= 11·31). V3 frequently answers 561 (Carmichael / wrong base-2 property) or 9 (not actually a pseudoprime to base 2, verifying the model isn't computing). R1 usually gets this right.",
|
||||
systemPrompt: CONCISE_SYSTEM,
|
||||
prompt:
|
||||
'Find the smallest composite integer n > 1 such that 2^n is congruent to 2 modulo n (i.e., n is a Fermat pseudoprime to base 2). Briefly justify, then give a single integer on a line starting with "Answer:".',
|
||||
check: checkSingleInt(341),
|
||||
},
|
||||
|
||||
{
|
||||
id: "derangements_d7",
|
||||
description:
|
||||
"Combinatorics — number of derangements of 7 elements. Answer: 1854 (D_7 = 7! · (1 − 1/1! + 1/2! − 1/3! + … ± 1/7!) = 5040 · 0.367857… = 1854). V3 sometimes approximates via n!/e and rounds wrong, or confuses with D_6=265 or D_8=14833. R1's explicit recurrence D_n = (n-1)(D_{n-1}+D_{n-2}) avoids the mistake.",
|
||||
systemPrompt: CONCISE_SYSTEM,
|
||||
prompt:
|
||||
'How many permutations of {1, 2, 3, 4, 5, 6, 7} have no fixed points? (This is D_7, the derangement number.) Briefly justify, then give a single integer on a line starting with "Answer:".',
|
||||
check: checkSingleInt(1854),
|
||||
},
|
||||
|
||||
{
|
||||
id: "euler_quadratic_break",
|
||||
description:
|
||||
"Number theory — smallest nonneg integer n where n^2 + n + 41 is NOT prime. Euler's prime-generating polynomial famously produces primes for n = 0..39 and first fails at n = 40 (40²+40+41 = 1681 = 41²). V3 often confuses this with the related n²-n+41 (first fails at 41) or cites the wrong threshold. R1 checks small n systematically.",
|
||||
systemPrompt: CONCISE_SYSTEM,
|
||||
prompt:
|
||||
'Consider the polynomial f(n) = n^2 + n + 41 for n = 0, 1, 2, …. What is the smallest nonneg integer n at which f(n) fails to be prime? Briefly justify (including the value of f(n) at that point), then give just the integer n on a line starting with "Answer:".',
|
||||
check: checkSingleInt(40),
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Types for the harvest eval harness.
|
||||
*
|
||||
* Scope: this is deliberately NOT τ-bench-lite. These tasks:
|
||||
* - are single-turn Q/A (no user simulator, no DB)
|
||||
* - target reasoning-heavy problems (math, logic, planning)
|
||||
* - use deterministic checkers (regex extraction + set/value compare),
|
||||
* never an LLM judge
|
||||
*
|
||||
* The point is to measure Pillar 2 (harvest) the same way τ-bench-lite
|
||||
* measures Pillar 1 (cache-first): isolate one variable, produce numbers
|
||||
* anyone can reproduce.
|
||||
*/
|
||||
|
||||
export type HarvestMode =
|
||||
/** deepseek-chat, no Reasonix tricks. Floor reference for answer quality on reasoning tasks (V3 at its best). */
|
||||
| "baseline"
|
||||
/** deepseek-reasoner, no harvest. Isolates "does reasoner help over chat on these problems?" */
|
||||
| "reasoner"
|
||||
/** deepseek-reasoner + harvest. Isolates "does the extra V3 harvest call add quality / change behavior?" */
|
||||
| "reasoner-harvest";
|
||||
|
||||
export const ALL_MODES: HarvestMode[] = ["baseline", "reasoner", "reasoner-harvest"];
|
||||
|
||||
/**
|
||||
* Checker verdict. We don't use boolean directly because "maybe" is real
|
||||
* — e.g. "answer in the right shape but can't verify without running the
|
||||
* program". For v0.3 we only use {pass, fail}, but the shape leaves room.
|
||||
*/
|
||||
export type CheckVerdict = "pass" | "fail" | "inconclusive";
|
||||
|
||||
export interface HarvestTask {
|
||||
id: string;
|
||||
/** One-line human description, not shown to the model. */
|
||||
description: string;
|
||||
/** System prompt. Kept minimal so harvest signal can be attributed to the model, not to prompt engineering. */
|
||||
systemPrompt: string;
|
||||
/** The single question. */
|
||||
prompt: string;
|
||||
/**
|
||||
* Check the agent's final reply. Returns pass/fail/inconclusive plus an
|
||||
* optional one-line explanation the report can surface.
|
||||
*
|
||||
* IMPORTANT: must be pure and deterministic. No LLM calls, no file I/O.
|
||||
*/
|
||||
check: (agentReply: string) => { verdict: CheckVerdict; note?: string };
|
||||
}
|
||||
|
||||
export interface HarvestRunResult {
|
||||
taskId: string;
|
||||
mode: HarvestMode;
|
||||
repeat: number;
|
||||
verdict: CheckVerdict;
|
||||
checkNote?: string;
|
||||
finalAgentMessage: string;
|
||||
/** Turns the loop completed (usually 1 for a single-shot Q/A, > 1 if tool-calls happen). */
|
||||
turns: number;
|
||||
cacheHitRatio: number;
|
||||
costUsd: number;
|
||||
claudeEquivalentUsd: number;
|
||||
/** Harvest-specific — only non-zero on reasoner-harvest mode. */
|
||||
harvestedTurns: number;
|
||||
totalSubgoals: number;
|
||||
totalUncertainties: number;
|
||||
totalHypotheses: number;
|
||||
totalRejectedPaths: number;
|
||||
/** Optional error message if the run crashed (model down, timeout, etc). */
|
||||
errorMessage?: string;
|
||||
}
|
||||
|
||||
export interface HarvestBenchMeta {
|
||||
date: string;
|
||||
repeatsPerTask: number;
|
||||
taskCount: number;
|
||||
modesRun: HarvestMode[];
|
||||
reasonixVersion: string;
|
||||
}
|
||||
|
||||
export interface HarvestBenchReport {
|
||||
meta: HarvestBenchMeta;
|
||||
results: HarvestRunResult[];
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* Naive baseline runner — deliberately does NOT use CacheFirstLoop.
|
||||
*
|
||||
* For the benchmark comparison to be honest, this runner must reproduce
|
||||
* what a "typical" agent framework does that breaks DeepSeek's automatic
|
||||
* prefix cache:
|
||||
*
|
||||
* 1. Inject a fresh timestamp into the system prompt every turn.
|
||||
* 2. Re-serialize the tool list each turn with a shuffled key order.
|
||||
* 3. Rebuild the full message array each turn rather than appending.
|
||||
*
|
||||
* These are all things frameworks like LangChain/LangGraph do by default
|
||||
* (either directly, or because tool specs are regenerated from Python dicts
|
||||
* with non-deterministic ordering, or because a "current_time" placeholder
|
||||
* is recommended in common system-prompt recipes).
|
||||
*
|
||||
* Reuses DeepSeekClient, ToolRegistry, and SessionStats so the *only*
|
||||
* difference from the Reasonix run is prefix stability.
|
||||
*/
|
||||
|
||||
import {
|
||||
type ChatMessage,
|
||||
type DeepSeekClient,
|
||||
SessionStats,
|
||||
type ToolCall,
|
||||
type ToolDefinition,
|
||||
ToolRegistry,
|
||||
type ToolSpec,
|
||||
Usage,
|
||||
} from "../../src/index.js";
|
||||
import type { Turn } from "./types.js";
|
||||
|
||||
export interface BaselineRunnerOptions {
|
||||
client: DeepSeekClient;
|
||||
systemPrompt: string;
|
||||
tools: ToolDefinition[];
|
||||
model?: string;
|
||||
maxToolIters?: number;
|
||||
}
|
||||
|
||||
export interface BaselineSubCall {
|
||||
/** Assistant text from this sub-call (often empty when the response is tool-calls-only). */
|
||||
content: string;
|
||||
/** Usage for this single client.chat() call. */
|
||||
usage: Usage;
|
||||
/** Tools the model chose to call on the back of this response. */
|
||||
toolCalls: { name: string; args: string; result: string }[];
|
||||
}
|
||||
|
||||
export interface BaselineTurnResult {
|
||||
assistantMessage: string;
|
||||
toolCallsExecuted: { name: string; args: string; result: string }[];
|
||||
/**
|
||||
* Per-sub-call breakdown, one entry per client.chat() invocation. Gives
|
||||
* downstream tools (bench transcripts) the same granularity as Reasonix
|
||||
* loop events — without it, diff can't compare model-call counts
|
||||
* apples-to-apples.
|
||||
*/
|
||||
subCalls: BaselineSubCall[];
|
||||
/** Turn number (1-based) assigned by the agent. */
|
||||
turnNo: number;
|
||||
}
|
||||
|
||||
export class BaselineAgent {
|
||||
readonly client: DeepSeekClient;
|
||||
readonly stats = new SessionStats();
|
||||
private readonly systemPrompt: string;
|
||||
private readonly registry: ToolRegistry;
|
||||
private readonly model: string;
|
||||
private readonly maxToolIters: number;
|
||||
/**
|
||||
* Previous-turn messages. A naive framework keeps these, but we still
|
||||
* rebuild the prefix around them each turn so the byte prefix churns.
|
||||
*/
|
||||
private history: ChatMessage[] = [];
|
||||
private turnNo = 0;
|
||||
|
||||
constructor(opts: BaselineRunnerOptions) {
|
||||
this.client = opts.client;
|
||||
this.systemPrompt = opts.systemPrompt;
|
||||
this.model = opts.model ?? "deepseek-chat";
|
||||
this.maxToolIters = opts.maxToolIters ?? 6;
|
||||
this.registry = new ToolRegistry({ autoFlatten: false });
|
||||
for (const t of opts.tools) this.registry.register(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run one user-turn: sends the user message, lets the model do tool
|
||||
* calls until it stops, returns the final assistant text.
|
||||
*
|
||||
* Intentionally non-cache-friendly: rebuilds the prefix with a fresh
|
||||
* timestamp + re-shuffled tool specs every turn.
|
||||
*/
|
||||
async userTurn(userMessage: string, transcript: Turn[]): Promise<BaselineTurnResult> {
|
||||
this.turnNo++;
|
||||
|
||||
// Naive pattern #1: current-time placeholder in the system prompt.
|
||||
const churnedSystem = `${this.systemPrompt}\nCurrent time: ${new Date().toISOString()}`;
|
||||
|
||||
// Naive pattern #2: shuffle tool spec order each turn (simulates
|
||||
// frameworks that materialize tools from Python dicts / maps).
|
||||
const shuffledTools = shuffle(this.registry.specs(), this.turnNo);
|
||||
|
||||
this.history.push({ role: "user", content: userMessage });
|
||||
|
||||
const toolExecutions: { name: string; args: string; result: string }[] = [];
|
||||
const subCalls: BaselineSubCall[] = [];
|
||||
|
||||
for (let iter = 0; iter < this.maxToolIters; iter++) {
|
||||
// Naive pattern #3: always rebuild the full message array.
|
||||
const messages: ChatMessage[] = [{ role: "system", content: churnedSystem }, ...this.history];
|
||||
|
||||
const resp = await this.client.chat({
|
||||
model: this.model,
|
||||
messages,
|
||||
tools: shuffledTools,
|
||||
});
|
||||
this.stats.record(this.turnNo, this.model, resp.usage);
|
||||
|
||||
const assistantMessage: ChatMessage = { role: "assistant", content: resp.content };
|
||||
if (resp.toolCalls.length > 0) assistantMessage.tool_calls = resp.toolCalls;
|
||||
this.history.push(assistantMessage);
|
||||
|
||||
if (resp.toolCalls.length === 0) {
|
||||
subCalls.push({ content: resp.content, usage: resp.usage, toolCalls: [] });
|
||||
return {
|
||||
assistantMessage: resp.content,
|
||||
toolCallsExecuted: toolExecutions,
|
||||
subCalls,
|
||||
turnNo: this.turnNo,
|
||||
};
|
||||
}
|
||||
|
||||
const subToolCalls: { name: string; args: string; result: string }[] = [];
|
||||
for (const tc of resp.toolCalls) {
|
||||
const name = tc.function?.name ?? "";
|
||||
const args = tc.function?.arguments ?? "{}";
|
||||
const result = await this.registry.dispatch(name, args);
|
||||
toolExecutions.push({ name, args, result });
|
||||
subToolCalls.push({ name, args, result });
|
||||
this.history.push({
|
||||
role: "tool",
|
||||
tool_call_id: tc.id ?? "",
|
||||
name,
|
||||
content: result,
|
||||
});
|
||||
}
|
||||
subCalls.push({ content: resp.content, usage: resp.usage, toolCalls: subToolCalls });
|
||||
}
|
||||
|
||||
const lastAssistant = [...this.history].reverse().find((m) => m.role === "assistant");
|
||||
return {
|
||||
assistantMessage: lastAssistant?.content ?? "[max_tool_iters reached]",
|
||||
toolCallsExecuted: toolExecutions,
|
||||
subCalls,
|
||||
turnNo: this.turnNo,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deterministic Fisher–Yates shuffle seeded by an integer. Same turn number
|
||||
* → same ordering, so the baseline is reproducible across runs while still
|
||||
* being cache-hostile (different turns get different orderings).
|
||||
*/
|
||||
function shuffle<T>(arr: T[], seed: number): T[] {
|
||||
const out = [...arr];
|
||||
let s = seed * 9301 + 49297;
|
||||
for (let i = out.length - 1; i > 0; i--) {
|
||||
s = (s * 9301 + 49297) % 233280;
|
||||
const j = Math.floor((s / 233280) * (i + 1));
|
||||
[out[i], out[j]] = [out[j]!, out[i]!];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// Re-export ToolCall, ToolSpec so caller files don't need to import both places.
|
||||
export type { ToolCall, ToolSpec };
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { WorldState } from "./types.js";
|
||||
|
||||
/**
|
||||
* Deep-clone a WorldState so per-run mutations stay isolated.
|
||||
* structuredClone is enough — WorldState is JSON-shaped by contract.
|
||||
*/
|
||||
export function cloneDb(db: WorldState): WorldState {
|
||||
return structuredClone(db);
|
||||
}
|
||||
|
||||
export function getRow(
|
||||
db: WorldState,
|
||||
table: string,
|
||||
id: string,
|
||||
): Record<string, unknown> | undefined {
|
||||
return db[table]?.[id];
|
||||
}
|
||||
|
||||
export function setField(
|
||||
db: WorldState,
|
||||
table: string,
|
||||
id: string,
|
||||
field: string,
|
||||
value: unknown,
|
||||
): boolean {
|
||||
const row = db[table]?.[id];
|
||||
if (!row) return false;
|
||||
row[field] = value;
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
# Reasonix tool-use eval (τ-bench-lite)
|
||||
|
||||
**Date:** 2026-04-21T14:57:44.906Z
|
||||
**Agent model:** `deepseek-chat`
|
||||
**User-simulator model:** `deepseek-chat`
|
||||
**Tasks:** 8, repeats × 3
|
||||
**Reasonix version:** 0.2.1
|
||||
|
||||
## Summary
|
||||
|
||||
| metric | baseline | reasonix | delta |
|
||||
|---|---:|---:|---:|
|
||||
| runs | 24 | 24 | — |
|
||||
| pass rate | 96% | 100% | +4pp |
|
||||
| cache hit | 46.6% | 94.4% | **+47.7pp** |
|
||||
| mean cost / task | $0.002599 | $0.001579 | ×0.61 |
|
||||
| mean turns | 4.4 | 4.6 | — |
|
||||
| mean tool calls | 3.0 | 2.7 | — |
|
||||
|
||||
**Reasonix vs Claude Sonnet 4.6 (estimated, same token counts):**
|
||||
Claude would cost ~$0.038203 / task, so Reasonix saves ~96.0%.
|
||||
(This is a *token-count-based estimate*, not a head-to-head quality comparison.)
|
||||
|
||||
## Per-task breakdown
|
||||
|
||||
| task | mode | pass | turns | tools | cache | cost |
|
||||
|---|---|:---:|---:|---:|---:|---:|
|
||||
| t01_address_happy | baseline | ✅ | 3 | 3 | 53.1% | $0.001383 |
|
||||
| t01_address_happy | reasonix | ✅ | 3 | 3 | 94.4% | $0.000896 |
|
||||
| t01_address_happy | baseline | ✅ | 3 | 3 | 53.3% | $0.001405 |
|
||||
| t01_address_happy | reasonix | ✅ | 3 | 2 | 95.0% | $0.000756 |
|
||||
| t01_address_happy | baseline | ✅ | 3 | 2 | 44.0% | $0.001193 |
|
||||
| t01_address_happy | reasonix | ✅ | 3 | 2 | 92.6% | $0.000848 |
|
||||
| t02_address_not_allowed | baseline | ✅ | 8 | 2 | 23.6% | $0.004647 |
|
||||
| t02_address_not_allowed | reasonix | ✅ | 8 | 4 | 95.6% | $0.003067 |
|
||||
| t02_address_not_allowed | baseline | ✅ | 8 | 3 | 29.9% | $0.005585 |
|
||||
| t02_address_not_allowed | reasonix | ✅ | 8 | 2 | 96.2% | $0.002822 |
|
||||
| t02_address_not_allowed | baseline | ✅ | 8 | 7 | 50.7% | $0.007021 |
|
||||
| t02_address_not_allowed | reasonix | ✅ | 8 | 3 | 95.8% | $0.003140 |
|
||||
| t03_cancel_processing | baseline | ✅ | 3 | 3 | 53.3% | $0.001349 |
|
||||
| t03_cancel_processing | reasonix | ✅ | 3 | 3 | 94.9% | $0.000803 |
|
||||
| t03_cancel_processing | baseline | ✅ | 2 | 3 | 64.6% | $0.001041 |
|
||||
| t03_cancel_processing | reasonix | ✅ | 2 | 2 | 93.8% | $0.000563 |
|
||||
| t03_cancel_processing | baseline | ✅ | 3 | 3 | 53.4% | $0.001332 |
|
||||
| t03_cancel_processing | reasonix | ✅ | 2 | 2 | 93.8% | $0.000566 |
|
||||
| t04_refund_delivered | baseline | ✅ | 2 | 2 | 55.9% | $0.001007 |
|
||||
| t04_refund_delivered | reasonix | ✅ | 2 | 3 | 91.0% | $0.000911 |
|
||||
| t04_refund_delivered | baseline | ✅ | 3 | 2 | 44.8% | $0.001268 |
|
||||
| t04_refund_delivered | reasonix | ✅ | 3 | 3 | 93.2% | $0.000941 |
|
||||
| t04_refund_delivered | baseline | ✅ | 3 | 3 | 53.5% | $0.001469 |
|
||||
| t04_refund_delivered | reasonix | ✅ | 3 | 3 | 94.4% | $0.000952 |
|
||||
| t05_refund_not_delivered | baseline | ✅ | 8 | 4 | 41.7% | $0.005369 |
|
||||
| t05_refund_not_delivered | reasonix | ✅ | 7 | 2 | 96.3% | $0.002212 |
|
||||
| t05_refund_not_delivered | baseline | ✅ | 8 | 3 | 30.6% | $0.004762 |
|
||||
| t05_refund_not_delivered | reasonix | ✅ | 8 | 4 | 95.1% | $0.003159 |
|
||||
| t05_refund_not_delivered | baseline | ✅ | 6 | 2 | 24.8% | $0.003128 |
|
||||
| t05_refund_not_delivered | reasonix | ✅ | 6 | 2 | 94.7% | $0.001927 |
|
||||
| t06_multi_order_lookup | baseline | ✅ | 2 | 2 | 52.4% | $0.000913 |
|
||||
| t06_multi_order_lookup | reasonix | ✅ | 3 | 2 | 92.7% | $0.000988 |
|
||||
| t06_multi_order_lookup | baseline | ✅ | 3 | 2 | 41.2% | $0.001530 |
|
||||
| t06_multi_order_lookup | reasonix | ✅ | 3 | 2 | 93.4% | $0.000996 |
|
||||
| t06_multi_order_lookup | baseline | ✅ | 3 | 4 | 60.9% | $0.001920 |
|
||||
| t06_multi_order_lookup | reasonix | ✅ | 3 | 2 | 92.2% | $0.000947 |
|
||||
| t07_wrong_identity | baseline | ❌ | 2 | 2 | 54.9% | $0.000815 |
|
||||
| t07_wrong_identity | reasonix | ✅ | 8 | 2 | 95.5% | $0.002777 |
|
||||
| t07_wrong_identity | baseline | ✅ | 8 | 3 | 26.6% | $0.004953 |
|
||||
| t07_wrong_identity | reasonix | ✅ | 7 | 2 | 95.6% | $0.002356 |
|
||||
| t07_wrong_identity | baseline | ✅ | 8 | 3 | 24.0% | $0.005210 |
|
||||
| t07_wrong_identity | reasonix | ✅ | 8 | 2 | 96.3% | $0.002587 |
|
||||
| t08_address_then_cancel | baseline | ✅ | 3 | 3 | 53.4% | $0.001465 |
|
||||
| t08_address_then_cancel | reasonix | ✅ | 3 | 4 | 94.6% | $0.001174 |
|
||||
| t08_address_then_cancel | baseline | ✅ | 3 | 4 | 62.1% | $0.001677 |
|
||||
| t08_address_then_cancel | reasonix | ✅ | 3 | 5 | 94.1% | $0.001371 |
|
||||
| t08_address_then_cancel | baseline | ✅ | 3 | 5 | 66.5% | $0.001933 |
|
||||
| t08_address_then_cancel | reasonix | ✅ | 3 | 4 | 93.5% | $0.001142 |
|
||||
|
||||
## Scope & caveats
|
||||
|
||||
This is **τ-bench-lite**, not a port of Sierra's upstream τ-bench. Specifically:
|
||||
|
||||
- Tasks are hand-authored in the retail domain; the schema mirrors τ-bench
|
||||
(stateful tools, LLM user-sim, DB-end-state success predicates), so upstream
|
||||
tasks can later be dropped in without harness changes.
|
||||
- Every pass/fail judgment is a deterministic DB predicate — no LLM judge.
|
||||
Refusal tasks pass iff the DB is unchanged.
|
||||
- The "baseline" deliberately reproduces cache-hostile patterns common in
|
||||
generic agent frameworks: fresh timestamp in the system prompt each turn,
|
||||
re-shuffled tool spec ordering per turn. It is **not** a benchmark of
|
||||
LangChain specifically.
|
||||
- Claude comparison is a *token-count-based cost estimate* using Anthropic's
|
||||
public pricing, not a head-to-head quality run.
|
||||
- User simulator is DeepSeek V3 at T=0.1. Some run-to-run drift is expected;
|
||||
rerun with `--repeats N` to get a tighter mean.
|
||||
|
||||
## Reproducing
|
||||
|
||||
1. `export DEEPSEEK_API_KEY=sk-...`
|
||||
2. `npm install`
|
||||
3. `npx tsx benchmarks/tau-bench/runner.ts --repeats 3`
|
||||
4. `npx tsx benchmarks/tau-bench/report.ts benchmarks/tau-bench/results-*.json`
|
||||
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* Render a results-*.json into a human-readable report.md.
|
||||
*
|
||||
* npx tsx benchmarks/tau-bench/report.ts benchmarks/tau-bench/results-<date>.json
|
||||
* npx tsx benchmarks/tau-bench/report.ts <input.json> --out report.md
|
||||
*/
|
||||
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import type { BenchReport, RunMode, RunResult } from "./types.js";
|
||||
|
||||
interface CliArgs {
|
||||
input: string;
|
||||
outPath: string;
|
||||
}
|
||||
|
||||
function parseArgs(argv: string[]): CliArgs {
|
||||
const out: CliArgs = { input: "", outPath: "benchmarks/tau-bench/report.md" };
|
||||
const positional: string[] = [];
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i];
|
||||
if (a === "--out") out.outPath = argv[++i] ?? out.outPath;
|
||||
else if (a && !a.startsWith("--")) positional.push(a);
|
||||
}
|
||||
out.input = positional[0] ?? "";
|
||||
if (!out.input) {
|
||||
throw new Error(
|
||||
"usage: npx tsx benchmarks/tau-bench/report.ts <results.json> [--out report.md]",
|
||||
);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
interface Agg {
|
||||
runs: number;
|
||||
passes: number;
|
||||
avgCache: number;
|
||||
avgCost: number;
|
||||
avgClaudeCost: number;
|
||||
avgTurns: number;
|
||||
avgToolCalls: number;
|
||||
}
|
||||
|
||||
function aggregate(results: RunResult[]): Agg {
|
||||
if (results.length === 0) {
|
||||
return {
|
||||
runs: 0,
|
||||
passes: 0,
|
||||
avgCache: 0,
|
||||
avgCost: 0,
|
||||
avgClaudeCost: 0,
|
||||
avgTurns: 0,
|
||||
avgToolCalls: 0,
|
||||
};
|
||||
}
|
||||
const passes = results.filter((r) => r.pass).length;
|
||||
const mean = (fn: (r: RunResult) => number) =>
|
||||
results.reduce((s, r) => s + fn(r), 0) / results.length;
|
||||
return {
|
||||
runs: results.length,
|
||||
passes,
|
||||
avgCache: mean((r) => r.cacheHitRatio),
|
||||
avgCost: mean((r) => r.costUsd),
|
||||
avgClaudeCost: mean((r) => r.claudeEquivalentUsd),
|
||||
avgTurns: mean((r) => r.turns),
|
||||
avgToolCalls: mean((r) => r.toolCalls),
|
||||
};
|
||||
}
|
||||
|
||||
function renderSummary(report: BenchReport): string {
|
||||
const byMode: Record<RunMode, RunResult[]> = { baseline: [], reasonix: [] };
|
||||
for (const r of report.results) byMode[r.mode].push(r);
|
||||
const b = aggregate(byMode.baseline);
|
||||
const rx = aggregate(byMode.reasonix);
|
||||
|
||||
const costRatio = b.avgCost > 0 ? rx.avgCost / b.avgCost : 0;
|
||||
const claudeSavings = b.avgClaudeCost > 0 ? (1 - rx.avgCost / b.avgClaudeCost) * 100 : 0;
|
||||
|
||||
return `
|
||||
## Summary
|
||||
|
||||
| metric | baseline | reasonix | delta |
|
||||
|---|---:|---:|---:|
|
||||
| runs | ${b.runs} | ${rx.runs} | — |
|
||||
| pass rate | ${pct(b.passes, b.runs)} | ${pct(rx.passes, rx.runs)} | ${signPct(rx.passes, rx.runs, b.passes, b.runs)} |
|
||||
| cache hit | ${pct1(b.avgCache)} | ${pct1(rx.avgCache)} | **${signPctAbs(rx.avgCache - b.avgCache)}** |
|
||||
| mean cost / task | $${fmt(b.avgCost, 6)} | $${fmt(rx.avgCost, 6)} | ${costRatio > 0 ? `×${fmt(costRatio, 2)}` : "—"} |
|
||||
| mean turns | ${fmt(b.avgTurns, 1)} | ${fmt(rx.avgTurns, 1)} | — |
|
||||
| mean tool calls | ${fmt(b.avgToolCalls, 1)} | ${fmt(rx.avgToolCalls, 1)} | — |
|
||||
|
||||
**Reasonix vs Claude Sonnet 4.6 (estimated, same token counts):**
|
||||
Claude would cost ~$${fmt(rx.avgClaudeCost, 6)} / task, so Reasonix saves ~${fmt(
|
||||
claudeSavings,
|
||||
1,
|
||||
)}%.
|
||||
(This is a *token-count-based estimate*, not a head-to-head quality comparison.)
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function renderPerTask(report: BenchReport): string {
|
||||
const rowsByTask = new Map<string, RunResult[]>();
|
||||
for (const r of report.results) {
|
||||
const list = rowsByTask.get(r.taskId) ?? [];
|
||||
list.push(r);
|
||||
rowsByTask.set(r.taskId, list);
|
||||
}
|
||||
const rows: string[] = [
|
||||
"| task | mode | pass | turns | tools | cache | cost |",
|
||||
"|---|---|:---:|---:|---:|---:|---:|",
|
||||
];
|
||||
for (const [taskId, runs] of rowsByTask) {
|
||||
for (const r of runs) {
|
||||
rows.push(
|
||||
`| ${taskId} | ${r.mode} | ${r.pass ? "✅" : "❌"} | ${r.turns} | ${r.toolCalls} | ${pct1(
|
||||
r.cacheHitRatio,
|
||||
)} | $${fmt(r.costUsd, 6)} |${r.errorMessage ? ` err: ${truncate(r.errorMessage, 40)}` : ""}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
return `## Per-task breakdown\n\n${rows.join("\n")}`;
|
||||
}
|
||||
|
||||
function renderHeader(report: BenchReport): string {
|
||||
const m = report.meta;
|
||||
return `# Reasonix tool-use eval (τ-bench-lite)
|
||||
|
||||
**Date:** ${m.date}
|
||||
**Agent model:** \`${m.model}\`
|
||||
**User-simulator model:** \`${m.userSimModel}\`
|
||||
**Tasks:** ${m.taskCount}, repeats × ${m.repeatsPerTask}
|
||||
**Reasonix version:** ${m.reasonixVersion}
|
||||
`;
|
||||
}
|
||||
|
||||
function renderCaveats(): string {
|
||||
return `## Scope & caveats
|
||||
|
||||
This is **τ-bench-lite**, not a port of Sierra's upstream τ-bench. Specifically:
|
||||
|
||||
- Tasks are hand-authored in the retail domain; the schema mirrors τ-bench
|
||||
(stateful tools, LLM user-sim, DB-end-state success predicates), so upstream
|
||||
tasks can later be dropped in without harness changes.
|
||||
- Every pass/fail judgment is a deterministic DB predicate — no LLM judge.
|
||||
Refusal tasks pass iff the DB is unchanged.
|
||||
- The "baseline" deliberately reproduces cache-hostile patterns common in
|
||||
generic agent frameworks: fresh timestamp in the system prompt each turn,
|
||||
re-shuffled tool spec ordering per turn. It is **not** a benchmark of
|
||||
LangChain specifically.
|
||||
- Claude comparison is a *token-count-based cost estimate* using Anthropic's
|
||||
public pricing, not a head-to-head quality run.
|
||||
- User simulator is DeepSeek V3 at T=0.1. Some run-to-run drift is expected;
|
||||
rerun with \`--repeats N\` to get a tighter mean.
|
||||
|
||||
## Reproducing
|
||||
|
||||
1. \`export DEEPSEEK_API_KEY=sk-...\`
|
||||
2. \`npm install\`
|
||||
3. \`npx tsx benchmarks/tau-bench/runner.ts --repeats 3\`
|
||||
4. \`npx tsx benchmarks/tau-bench/report.ts benchmarks/tau-bench/results-*.json\`
|
||||
`;
|
||||
}
|
||||
|
||||
export function renderReport(report: BenchReport): string {
|
||||
return [
|
||||
renderHeader(report),
|
||||
renderSummary(report),
|
||||
"",
|
||||
renderPerTask(report),
|
||||
"",
|
||||
renderCaveats(),
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
// ---------- formatting helpers ----------
|
||||
|
||||
function pct(num: number, denom: number): string {
|
||||
if (denom === 0) return "—";
|
||||
return `${((num / denom) * 100).toFixed(0)}%`;
|
||||
}
|
||||
|
||||
function signPct(num1: number, denom1: number, num2: number, denom2: number): string {
|
||||
if (denom1 === 0 || denom2 === 0) return "—";
|
||||
const d = num1 / denom1 - num2 / denom2;
|
||||
const s = (d * 100).toFixed(0);
|
||||
return `${d >= 0 ? "+" : ""}${s}pp`;
|
||||
}
|
||||
|
||||
function signPctAbs(diff: number): string {
|
||||
const s = (diff * 100).toFixed(1);
|
||||
return `${diff >= 0 ? "+" : ""}${s}pp`;
|
||||
}
|
||||
|
||||
function pct1(x: number): string {
|
||||
return `${(x * 100).toFixed(1)}%`;
|
||||
}
|
||||
|
||||
function fmt(x: number, digits: number): string {
|
||||
return x.toFixed(digits);
|
||||
}
|
||||
|
||||
function truncate(s: string, n: number): string {
|
||||
return s.length > n ? `${s.slice(0, n)}…` : s;
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
const raw = readFileSync(args.input, "utf8");
|
||||
const report = JSON.parse(raw) as BenchReport;
|
||||
const md = renderReport(report);
|
||||
writeFileSync(args.outPath, md, "utf8");
|
||||
console.log(`wrote ${args.outPath} (${report.results.length} runs)`);
|
||||
}
|
||||
|
||||
function isMain(): boolean {
|
||||
const entry = process.argv[1];
|
||||
if (!entry) return false;
|
||||
return import.meta.url === pathToFileURL(entry).href;
|
||||
}
|
||||
|
||||
if (isMain()) {
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,684 @@
|
||||
{
|
||||
"meta": {
|
||||
"date": "2026-04-21T14:57:44.906Z",
|
||||
"model": "deepseek-chat",
|
||||
"userSimModel": "deepseek-chat",
|
||||
"taskCount": 8,
|
||||
"repeatsPerTask": 3,
|
||||
"reasonixVersion": "0.2.1"
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"taskId": "t01_address_happy",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.531435349940688,
|
||||
"costUsd": 0.0013829700000000003,
|
||||
"claudeEquivalentUsd": 0.023388000000000003,
|
||||
"promptTokens": 5901,
|
||||
"completionTokens": 379,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Success! I've updated the shipping address for your order o_1002 from \"22 Oak Rd, NYC, NY 10001\" to \"5 Birch Rd, NYC, NY 10001\". \n\nYour order is still in processing status and will now be shipped to the new address."
|
||||
},
|
||||
{
|
||||
"taskId": "t01_address_happy",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.9444063143445436,
|
||||
"costUsd": 0.0008962600000000001,
|
||||
"claudeEquivalentUsd": 0.023259000000000002,
|
||||
"promptTokens": 5828,
|
||||
"completionTokens": 385,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Success! I've updated the shipping address for your order o_1002 to **5 Birch Rd, NYC, NY 10001**. \n\nYour order is still in processing status and will now be shipped to the new address. Is there anything else you need help with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t01_address_happy",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.533242645808536,
|
||||
"costUsd": 0.00140507,
|
||||
"claudeEquivalentUsd": 0.023703,
|
||||
"promptTokens": 5881,
|
||||
"completionTokens": 404,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Great! I've successfully updated the shipping address for your order o_1002. The new address is now: **5 Birch Rd, NYC, NY 10001**.\n\nThe order is still in \"processing\" status, so it will be shipped to this new address. Is there anything else I can help you with?"
|
||||
},
|
||||
{
|
||||
"taskId": "t01_address_happy",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9502183406113537,
|
||||
"costUsd": 0.0007556,
|
||||
"claudeEquivalentUsd": 0.01905,
|
||||
"promptTokens": 4580,
|
||||
"completionTokens": 354,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Success! I've updated the shipping address for your order o_1002 to \"5 Birch Rd, NYC, NY 10001\". Your order is still in processing status, and it will now be shipped to the new address. Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t01_address_happy",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.44005156854318866,
|
||||
"costUsd": 0.00119348,
|
||||
"claudeEquivalentUsd": 0.018687000000000002,
|
||||
"promptTokens": 4654,
|
||||
"completionTokens": 315,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Perfect! I've successfully updated the shipping address for your order o_1002. The new shipping address is now:\n\n**5 Birch Rd, NYC, NY 10001**\n\nYour order is still in processing status and will be shipped to this new address. Is there anything else I can help you with?"
|
||||
},
|
||||
{
|
||||
"taskId": "t01_address_happy",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9257604764943629,
|
||||
"costUsd": 0.00084767,
|
||||
"claudeEquivalentUsd": 0.020223,
|
||||
"promptTokens": 4701,
|
||||
"completionTokens": 408,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Success! I've updated the shipping address for your order o_1002. The new shipping address is now: **5 Birch Rd, NYC, NY 10001**.\n\nYour order is still in processing status, and the address change has been recorded. Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t02_address_not_allowed",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.2358892823588928,
|
||||
"costUsd": 0.0046473899999999995,
|
||||
"claudeEquivalentUsd": 0.06284100000000001,
|
||||
"promptTokens": 13837,
|
||||
"completionTokens": 1422,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I understand you're determined to get this resolved, but I need to be completely transparent about what I can and cannot do:\n\n1. **I cannot update the address** - As shown by the system error, I'm physically unable to change addresses for orders with \"shipped\" status. The tool returns an error and won't allow the change.\n\n2. **I cannot transfer you to a supervisor** - I don't have access to any communication tools, phone numbers, or transfer capabilities. I'm an automated support agent with a specific set of order management functions.\n\n3. **I cannot escalate your case** - I don't have escalation procedures or access to human customer service teams.\n\nI'm literally unable to perform either of the actions you're requesting. Continuing to ask won't change my technical limitations - I can only work with the tools I've been given.\n\nThe most helpful thing I can do at this point is to suggest you:\n- Check your email for order confirmation messages (they usually contain customer service contact info)\n- Visit our website and look for \"Contact Us\" or \"Help\" sections\n- Try calling any phone numbers you might have from previous interactions with our company\n\nI apologize for the frustration this situation is causing, but I'm being honest about my limitations. Is there anything else I can help you with using the tools I do have available?"
|
||||
},
|
||||
{
|
||||
"taskId": "t02_address_not_allowed",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 4,
|
||||
"cacheHitRatio": 0.9560694920880823,
|
||||
"costUsd": 0.0030673800000000006,
|
||||
"claudeEquivalentUsd": 0.07663199999999999,
|
||||
"promptTokens": 18074,
|
||||
"completionTokens": 1494,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I understand you want this address change request noted, but I need to be honest - I don't have any tools to add notes to accounts or orders. My available tools are limited to:\n- Looking up orders and user information\n- Updating addresses (only for processing orders)\n- Canceling orders (only for processing orders)\n- Issuing refunds (only for delivered orders)\n- Listing user orders\n\nI can't add notes, comments, or annotations to your account or order. The best I can do is suggest that when the package is delivered, you can contact me again and I can help you with a refund if needed (using the refund_order tool).\n\nFor now, I would strongly recommend:\n1. Contacting the shipping carrier directly with your tracking information\n2. Reaching out to our customer service team via email or phone\n3. Keeping a record of your request for 99 New St, SF, CA\n\nI apologize that I can't provide the note-taking functionality you're looking for, but I want to be transparent about my limitations."
|
||||
},
|
||||
{
|
||||
"taskId": "t02_address_not_allowed",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.29918476711704006,
|
||||
"costUsd": 0.00558507,
|
||||
"claudeEquivalentUsd": 0.078513,
|
||||
"promptTokens": 17541,
|
||||
"completionTokens": 1726,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I understand your plan, but I need to be completely clear: I don't have any tools to make notes or annotations on orders or accounts. When you come back for a refund after delivery, I won't have any record of this conversation or your address change request.\n\nHowever, once the order is marked as \"delivered,\" you can contact me again and I'll be able to process a refund for you. At that time, you'll need to provide:\n1. Your name and order ID again\n2. A reason for the refund (like \"delivered to wrong address\")\n\nI recommend you keep track of:\n- Your order ID: o_1001\n- Your desired address: 99 New St, SF, CA\n- The fact that you wanted to change the address before delivery\n\nWhen you return for the refund, just let me know the situation again, and I'll be able to help you with the refund process using the `refund_order` tool.\n\nIs there anything else I can help you with right now?"
|
||||
},
|
||||
{
|
||||
"taskId": "t02_address_not_allowed",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9616535218928475,
|
||||
"costUsd": 0.0028220600000000004,
|
||||
"claudeEquivalentUsd": 0.06702899999999999,
|
||||
"promptTokens": 14708,
|
||||
"completionTokens": 1527,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "As expected, the system returned an error: \"cannot edit: status=shipped\". The update_address tool is designed to only work for orders in \"processing\" status, and since order o_1001 is already marked as \"shipped\", the system won't allow the address change through this automated process.\n\nI've tried exactly what you asked, but the system's rules prevent this change. For shipped orders, address modifications would need to be handled through carrier intercept services or other logistics processes that I don't have access to.\n\nIs there anything else I can help you with using my available tools?"
|
||||
},
|
||||
{
|
||||
"taskId": "t02_address_not_allowed",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 7,
|
||||
"cacheHitRatio": 0.5073297860788359,
|
||||
"costUsd": 0.0070210900000000015,
|
||||
"claudeEquivalentUsd": 0.115131,
|
||||
"promptTokens": 27627,
|
||||
"completionTokens": 2150,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "As you can see, the refund tool also fails because your order is \"shipped\" (not \"delivered\").\n\nI genuinely don't have any way to record your address change request to \"99 New St, SF, CA\" in the system. I'm an automated agent with very specific, limited tools, and none of them allow me to add notes, escalate issues, or contact human support.\n\nYour only option is to contact customer service directly through the contact methods available on our website or in your account."
|
||||
},
|
||||
{
|
||||
"taskId": "t02_address_not_allowed",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.958138999251454,
|
||||
"costUsd": 0.0031397900000000004,
|
||||
"claudeEquivalentUsd": 0.07635600000000001,
|
||||
"promptTokens": 17367,
|
||||
"completionTokens": 1617,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I can see you have two orders:\n1. o_1001 - wool sweater M - shipped (the one you're asking about)\n2. o_1005 - notebook pack - delivered\n\nUnfortunately, both orders are either shipped or delivered, so I cannot update addresses on either of them. The system only allows address updates for orders with \"processing\" status.\n\nI truly wish I could help you, but I've exhausted all my available tools and functions. I don't have any other methods to try - I can't override the system, contact carriers, escalate to supervisors, or provide contact information.\n\nThe only thing I could potentially do is issue a refund if the order was delivered and you never received it, but that would require the order to be in \"delivered\" status and you'd need to provide a reason for the refund.\n\nI'm sorry I can't be more helpful with your address change request."
|
||||
},
|
||||
{
|
||||
"taskId": "t03_cancel_processing",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.5333333333333333,
|
||||
"costUsd": 0.0013487000000000002,
|
||||
"claudeEquivalentUsd": 0.022935000000000004,
|
||||
"promptTokens": 5880,
|
||||
"completionTokens": 353,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Perfect! I've successfully cancelled your order o_1004. The order has been updated to \"cancelled\" status. \n\nYou're all set - no further action is needed on your part. Is there anything else I can help you with?"
|
||||
},
|
||||
{
|
||||
"taskId": "t03_cancel_processing",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.9489849955869374,
|
||||
"costUsd": 0.00080305,
|
||||
"claudeEquivalentUsd": 0.02175,
|
||||
"promptTokens": 5665,
|
||||
"completionTokens": 317,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Your order #o_1004 has been successfully cancelled! No trouble at all - we're happy to help. The cancellation is complete and you should receive a confirmation email shortly. Is there anything else I can assist you with?"
|
||||
},
|
||||
{
|
||||
"taskId": "t03_cancel_processing",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 2,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.6460567823343849,
|
||||
"costUsd": 0.00104125,
|
||||
"claudeEquivalentUsd": 0.019334999999999998,
|
||||
"promptTokens": 4755,
|
||||
"completionTokens": 338,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Success! I've cancelled your order o_1004. The order has been successfully cancelled and is no longer in processing. You should receive a confirmation email shortly. Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t03_cancel_processing",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 2,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9379310344827586,
|
||||
"costUsd": 0.0005629000000000001,
|
||||
"claudeEquivalentUsd": 0.014204999999999999,
|
||||
"promptTokens": 3480,
|
||||
"completionTokens": 251,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Perfect! I've successfully cancelled your order o_1004. The order has been updated to \"cancelled\" status. You should receive a confirmation email shortly. Is there anything else I can help you with?"
|
||||
},
|
||||
{
|
||||
"taskId": "t03_cancel_processing",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.5341509112587294,
|
||||
"costUsd": 0.0013319700000000002,
|
||||
"claudeEquivalentUsd": 0.022713,
|
||||
"promptTokens": 5871,
|
||||
"completionTokens": 340,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Your order o_1004 has been successfully cancelled! The status is now showing as \"cancelled\". You should receive a confirmation email shortly.\n\nIs there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t03_cancel_processing",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 2,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9376615914966964,
|
||||
"costUsd": 0.00056647,
|
||||
"claudeEquivalentUsd": 0.014253000000000002,
|
||||
"promptTokens": 3481,
|
||||
"completionTokens": 254,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Perfect! I've successfully cancelled your order (o_1004). The order has been updated to \"cancelled\" status. You should receive a confirmation email shortly. Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t04_refund_delivered",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 2,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.5592572364827962,
|
||||
"costUsd": 0.00100704,
|
||||
"claudeEquivalentUsd": 0.016821000000000003,
|
||||
"promptTokens": 3662,
|
||||
"completionTokens": 389,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Perfect! I've successfully processed your refund request for order o_1003. A refund of $55 has been issued for your desk lamp that arrived broken. The refund has been recorded in our system with the reason \"Item arrived broken/damaged.\"\n\nYou should see the refund reflected in your original payment method within 5-10 business days, depending on your bank or payment processor. Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t04_refund_delivered",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 2,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.9100794646591385,
|
||||
"costUsd": 0.0009113400000000001,
|
||||
"claudeEquivalentUsd": 0.021036,
|
||||
"promptTokens": 4782,
|
||||
"completionTokens": 446,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Great news! I've successfully processed your refund for order o_1003. A refund of $55 has been issued for your desk lamp that arrived broken. The refund has been recorded in our system and should be processed back to your original payment method according to your bank's processing times.\n\nIs there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t04_refund_delivered",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.4484076433121019,
|
||||
"costUsd": 0.0012684000000000003,
|
||||
"claudeEquivalentUsd": 0.019845,
|
||||
"promptTokens": 4710,
|
||||
"completionTokens": 381,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Excellent! Your refund has been successfully processed for order o_1003. A refund of $55 has been issued for your desk lamp that arrived broken. The refund has been recorded in our system. You should see the refund reflected in your original payment method within the next 3-5 business days, depending on your bank or payment provider's processing time.\n\nIs there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t04_refund_delivered",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.9323050556983719,
|
||||
"costUsd": 0.0009406500000000001,
|
||||
"claudeEquivalentUsd": 0.023685,
|
||||
"promptTokens": 5835,
|
||||
"completionTokens": 412,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Great news, Cai Lin! I've successfully processed your refund for order o_1003. A refund of $55 has been issued for your desk lamp that arrived broken. The refund has been recorded in our system and should be processed back to your original payment method within the next few business days.\n\nIs there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t04_refund_delivered",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.5346700083542189,
|
||||
"costUsd": 0.0014687500000000002,
|
||||
"claudeEquivalentUsd": 0.024675,
|
||||
"promptTokens": 5985,
|
||||
"completionTokens": 448,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Great news! I've successfully processed a refund for your order o_1003. A refund of $55 has been issued for the desk lamp that arrived broken. The refund has been recorded with the reason \"Item arrived broken.\"\n\nYou should see the refund reflected in your original payment method within 3-10 business days, depending on your bank or payment provider's processing time.\n\nIs there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t04_refund_delivered",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.944082332761578,
|
||||
"costUsd": 0.0009518000000000002,
|
||||
"claudeEquivalentUsd": 0.024015,
|
||||
"promptTokens": 5830,
|
||||
"completionTokens": 435,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Great news! Your refund has been successfully processed for order o_1003. A refund of $55 has been issued for your desk lamp that arrived broken. The refund has been recorded in our system and should be reflected in your original payment method within the next 3-5 business days.\n\nIs there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t05_refund_not_delivered",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 4,
|
||||
"cacheHitRatio": 0.41699244201198854,
|
||||
"costUsd": 0.0053685500000000014,
|
||||
"claudeEquivalentUsd": 0.08194500000000002,
|
||||
"promptTokens": 19185,
|
||||
"completionTokens": 1626,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I can see you only have one order (o_1002), and it's in \"processing\" status. As I've demonstrated multiple times, the refund tool is hard-coded to only work on delivered orders, and attempting to use it on processing orders returns an error.\n\nI genuinely don't have:\n- The ability to override system programming\n- Access to supervisor escalation channels\n- Alternative refund methods\n- Different tools than the ones I've shown you\n\nIf you want to file a formal complaint, you would need to do so through the company's official complaint channels, which I don't have access to through this chat interface.\n\nI've exhausted every option available to me. I can only:\n1. Cancel order o_1002 (which you've refused)\n2. Update the shipping address on order o_1002\n3. Look up order information\n\nI cannot process a refund for a processing order, and I cannot escalate this issue."
|
||||
},
|
||||
{
|
||||
"taskId": "t05_refund_not_delivered",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 7,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9630875453660264,
|
||||
"costUsd": 0.0022117900000000004,
|
||||
"claudeEquivalentUsd": 0.052131000000000004,
|
||||
"promptTokens": 11297,
|
||||
"completionTokens": 1216,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I understand you're determined to get immediate resolution, but I need to be completely transparent about what I can and cannot do:\n\n**I cannot:**\n- Contact supervisors or escalate internally\n- Make phone calls or initiate contact with other departments\n- Issue refunds for orders in processing status (only for delivered orders)\n- Control or expedite bank processing times\n\n**What I have done:**\n- Verified your identity (Bo Wang, order o_1002)\n- Successfully cancelled your order o_1002, which immediately releases the payment authorization\n\n**What you can do:**\n- Contact customer service directly via phone/email (this information would be in your order confirmation email)\n- Reach out to your bank/credit card company - they control the actual refund timeline once we release the authorization\n\nI've used all the tools available to me to help you. The cancellation is complete, and the payment authorization has been released. Any further escalation or immediate refund processing would need to come from our customer service team through official channels.\n\nIs there anything else I can help you with regarding your order status or account?"
|
||||
},
|
||||
{
|
||||
"taskId": "t05_refund_not_delivered",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.306044376434583,
|
||||
"costUsd": 0.0047618800000000005,
|
||||
"claudeEquivalentUsd": 0.06733199999999999,
|
||||
"promptTokens": 15684,
|
||||
"completionTokens": 1352,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I understand you're upset and want to speak with a supervisor. Unfortunately, I'm an automated retail support agent and I don't have the capability to transfer you to a human supervisor or provide escalation contacts. I only have access to the specific tools you've seen.\n\nI'm being completely honest with you about my limitations. I can't:\n- Transfer you to a supervisor\n- Override system restrictions\n- Process refunds for orders in \"processing\" status\n- Provide contact information for human support\n\nThe only actions I can take for your order o_1002 are:\n1. Cancel the order (which would prevent the charge)\n2. Update the shipping address\n\nI wish I could help you more, but I'm being transparent about what I can and cannot do. If you want to prevent being charged for this order, I can cancel it for you right now. Otherwise, you may need to seek other channels for your complaint."
|
||||
},
|
||||
{
|
||||
"taskId": "t05_refund_not_delivered",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 4,
|
||||
"cacheHitRatio": 0.9505132175010035,
|
||||
"costUsd": 0.00315883,
|
||||
"claudeEquivalentUsd": 0.076392,
|
||||
"promptTokens": 17439,
|
||||
"completionTokens": 1605,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I understand your urgency, but I need to be honest about my limitations - I don't have access to contact information for supervisors, phone numbers, or email addresses. I'm an automated retail support agent with a specific set of tools that only allow me to:\n\n1. Look up orders and user information\n2. Cancel processing orders\n3. Update shipping addresses\n4. Issue refunds for delivered orders\n5. List user orders\n\nI don't have access to:\n- Company contact information\n- Supervisor directories\n- Email or phone databases\n- Escalation procedures\n\nThe best I can do is confirm that your order o_1002 has been successfully cancelled. For any further assistance with payment confirmations or supervisor contact, you would need to reach out through the retailer's official customer service channels outside of this chat system.\n\nIs there anything else I can help you with using the tools I actually have available?"
|
||||
},
|
||||
{
|
||||
"taskId": "t05_refund_not_delivered",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 6,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.24849007765314926,
|
||||
"costUsd": 0.0031283400000000003,
|
||||
"claudeEquivalentUsd": 0.042621,
|
||||
"promptTokens": 9272,
|
||||
"completionTokens": 987,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "You're absolutely right to want to escalate this. I'm an automated retail support agent with limited tools, and I don't have access to expedited refund processing or supervisor escalation capabilities.\n\nFor immediate assistance with urgent refund requests that require human intervention or supervisor approval, you'll need to:\n\n1. **Call our customer service hotline** at 1-800-RETAIL-SUPPORT\n2. **Email our escalation team** at [email protected]\n3. **Use the live chat feature** on our website (available during business hours)\n\nThese channels have access to human agents and supervisors who may have additional options for expediting refunds or providing alternative solutions that I cannot offer through my automated tools.\n\nI apologize for the limitation in my capabilities. Is there anything else I can help you with using the tools I do have available?"
|
||||
},
|
||||
{
|
||||
"taskId": "t05_refund_not_delivered",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 6,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.946507237256136,
|
||||
"costUsd": 0.0019265800000000002,
|
||||
"claudeEquivalentUsd": 0.044382000000000005,
|
||||
"promptTokens": 9534,
|
||||
"completionTokens": 1052,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I understand you're frustrated and want to speak with a supervisor, but I need to be completely transparent: I don't have any tools to transfer you to a supervisor or connect you with other support channels. I'm an automated retail support agent with a specific set of functions, and I don't have access to escalation systems, phone transfers, or live chat connections.\n\nFor supervisor contact or escalation, you would need to reach out through the company's official customer service channels directly. These typically include:\n- Customer service phone number\n- Email support\n- Live chat (if available on their website)\n- Social media support channels\n\nI've already processed the cancellation of your order o_1002, which was the appropriate action for its \"processing\" status. I wish I could do more to help, but my capabilities are limited to the specific tools I have available.\n\nIs there anything else within my current capabilities that I can assist you with?"
|
||||
},
|
||||
{
|
||||
"taskId": "t06_multi_order_lookup",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 2,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.5237020316027088,
|
||||
"costUsd": 0.0009134800000000002,
|
||||
"claudeEquivalentUsd": 0.015102,
|
||||
"promptTokens": 3544,
|
||||
"completionTokens": 298,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I can see you have 2 orders:\n\n1. **Order o_1001**: Wool sweater M - $89 - Status: **shipped**\n2. **Order o_1005**: Notebook pack - $22 - Status: **delivered**\n\nUnfortunately, neither of these orders are currently in \"processing\" status. The cancellation tool only works for orders that are still processing. Both your orders have already progressed beyond that stage (one is shipped, one is delivered).\n\nIs there anything else I can help you with regarding these orders? For example, if you received a delivered order and need to return it, I could help with a refund request."
|
||||
},
|
||||
{
|
||||
"taskId": "t06_multi_order_lookup",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9273495673173677,
|
||||
"costUsd": 0.0009876300000000002,
|
||||
"claudeEquivalentUsd": 0.022647,
|
||||
"promptTokens": 4969,
|
||||
"completionTokens": 516,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I've already used the `list_user_orders` tool which should return all orders belonging to your user ID u_ari. According to the system, you only have those two orders (o_1001 and o_1005), and both are already in shipped/delivered status.\n\nIf you believe there should be additional orders, you might want to:\n1. Check if you used a different user ID or email address for other purchases\n2. Verify if any recent orders were placed but haven't been processed yet (sometimes there can be a delay in order creation)\n\nUnfortunately, I don't have access to search by name or email directly - I can only look up orders by user ID or specific order ID. If you have any order IDs you'd like me to check individually, I can do that for you."
|
||||
},
|
||||
{
|
||||
"taskId": "t06_multi_order_lookup",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.4121553632521634,
|
||||
"costUsd": 0.0015304300000000002,
|
||||
"claudeEquivalentUsd": 0.023067000000000004,
|
||||
"promptTokens": 4969,
|
||||
"completionTokens": 544,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I understand your concern, but the tool I used (`list_user_orders`) is designed to return **every order** belonging to your user ID. According to the system, you only have those two orders (o_1001 and o_1005), and neither is in \"processing\" status.\n\nIf you're expecting another order that isn't showing up, there could be a few possibilities:\n1. The order might be under a different user ID\n2. The order might have been placed with a different email or account\n3. There might be a system issue (though this is less likely)\n\nUnfortunately, I don't have a tool to search for orders by name or email - I can only look up orders by specific order ID or list all orders for a specific user ID.\n\nIf you have any order confirmation emails or receipts with order IDs, I could look up those specific orders for you. Otherwise, you might want to check if you used a different account or contact customer service directly for a broader search."
|
||||
},
|
||||
{
|
||||
"taskId": "t06_multi_order_lookup",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9339278475881637,
|
||||
"costUsd": 0.0009957800000000001,
|
||||
"claudeEquivalentUsd": 0.022782,
|
||||
"promptTokens": 4934,
|
||||
"completionTokens": 532,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I've already checked all orders for your user ID \"u_ari\" using the list_user_orders tool, and it returned exactly two orders. The system shows only those two orders in your account history.\n\nIf you're expecting more orders, there could be a few possibilities:\n1. The orders might be under a different user ID\n2. The orders might have been placed with a different email or account\n3. There might be a timing issue if orders were placed very recently\n\nUnfortunately, I don't have a tool to search by name or email - I can only look up orders by user ID or specific order ID. If you have any order IDs you remember, I could check those individually, or you might want to check if you have another account/user ID.\n\nIs there anything else I can help you with regarding the two orders I found?"
|
||||
},
|
||||
{
|
||||
"taskId": "t06_multi_order_lookup",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 4,
|
||||
"cacheHitRatio": 0.6088371510827387,
|
||||
"costUsd": 0.0019201300000000001,
|
||||
"claudeEquivalentUsd": 0.034002,
|
||||
"promptTokens": 7989,
|
||||
"completionTokens": 669,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Here are the full details for each of your orders:\n\n**Order o_1001:**\n- **Order ID:** o_1001\n- **User ID:** u_ari\n- **Status:** shipped\n- **Shipping Address:** 1 Elm St, SF, CA 94110\n- **Item:** wool sweater M\n- **Price:** $89\n\n**Order o_1005:**\n- **Order ID:** o_1005\n- **User ID:** u_ari\n- **Status:** delivered\n- **Shipping Address:** 1 Elm St, SF, CA 94110\n- **Item:** notebook pack\n- **Price:** $22\n\nBoth orders were shipped to the same address: **1 Elm St, San Francisco, CA 94110**.\n\nDoes everything look correct to you?"
|
||||
},
|
||||
{
|
||||
"taskId": "t06_multi_order_lookup",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.922498433256737,
|
||||
"costUsd": 0.0009471900000000001,
|
||||
"claudeEquivalentUsd": 0.021696,
|
||||
"promptTokens": 4787,
|
||||
"completionTokens": 489,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Looking at your orders, Ari:\n\n- Order o_1001: Status is \"shipped\" (not processing)\n- Order o_1005: Status is \"delivered\" (not processing)\n\nBased on the orders I can see, you don't have any orders that are currently in a \"processing\" or \"pending\" status. Both of your orders have already moved past the processing stage - one has been shipped and the other has been delivered.\n\nIf you're expecting another order that isn't showing up in this list, you might want to check if it was placed under a different account or if there might be a different order ID."
|
||||
},
|
||||
{
|
||||
"taskId": "t07_wrong_identity",
|
||||
"mode": "baseline",
|
||||
"pass": false,
|
||||
"turns": 2,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.5485714285714286,
|
||||
"costUsd": 0.0008151,
|
||||
"claudeEquivalentUsd": 0.013965,
|
||||
"promptTokens": 3500,
|
||||
"completionTokens": 231,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Perfect! I've successfully cancelled your order o_1004. The order has been updated to \"cancelled\" status. Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t07_wrong_identity",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9553657630894913,
|
||||
"costUsd": 0.00277655,
|
||||
"claudeEquivalentUsd": 0.063765,
|
||||
"promptTokens": 13465,
|
||||
"completionTokens": 1558,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I understand you want to speak with a supervisor, but I need to be honest about my limitations - I'm an automated retail support agent with a specific set of tools, and I don't have the ability to:\n\n1. Transfer you to a supervisor\n2. Bypass identity verification requirements\n3. Access customer service escalation channels\n4. Investigate potential system errors\n\nWhat I **can** tell you is that based on our system records:\n- Order o_1004 belongs to Dev Patel\n- I cannot process cancellations without verifying the account holder\n- You'll need to contact customer service through official channels\n\nFor the fastest resolution, I recommend:\n1. Calling the customer service phone number listed on our website\n2. Using the live chat feature on our website during business hours\n3. Emailing [email protected] with your concerns\n\nThey have the authority and tools to:\n- Investigate account discrepancies\n- Correct system errors\n- Escalate to technical teams\n- Process exceptions when appropriate\n\nI'm sorry I can't provide the immediate resolution you're seeking, but I'm bound by the security protocols built into my tools. Is there anything else I can help you with using the functions available to me?"
|
||||
},
|
||||
{
|
||||
"taskId": "t07_wrong_identity",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.2659567560548016,
|
||||
"costUsd": 0.0049527700000000004,
|
||||
"claudeEquivalentUsd": 0.068208,
|
||||
"promptTokens": 15401,
|
||||
"completionTokens": 1467,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I cannot cancel order o_1004 without proper verification. The system shows this order belongs to Dev Patel (user ID: u_dev), and you've identified yourself as Bo Wang. \n\nFor security and privacy reasons, I must follow verification protocols. Canceling an order without verifying the account holder would be a violation of our security policies and could potentially allow unauthorized access to someone else's account.\n\n**Current status:** Order o_1004 is in \"processing\" status and could be canceled, but only by the verified account holder.\n\n**What you can do:**\n1. **Contact customer service immediately** - They have additional verification methods\n2. **Check if you have access to the email [email protected]** - This is the email associated with the account\n3. **Verify if you might be using a different name** - Sometimes customers use nicknames or middle names\n\nI understand this is frustrating, but I cannot proceed without proper verification. This protects all customers, including yourself, from unauthorized changes to orders."
|
||||
},
|
||||
{
|
||||
"taskId": "t07_wrong_identity",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 7,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9556361125496289,
|
||||
"costUsd": 0.0023559200000000005,
|
||||
"claudeEquivalentUsd": 0.054423,
|
||||
"promptTokens": 11586,
|
||||
"completionTokens": 1311,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I understand you want this escalated, but as a retail support agent, I don't have access to escalation channels or supervisor contacts. My tools are limited to the functions you see here, and I must follow the verification rules.\n\n**The situation:**\n- Order o_1004 shows as belonging to Dev Patel (user u_dev)\n- You identify as Bo Wang\n- Without matching verification, I cannot proceed with cancellation\n\n**What you should do:**\nContact customer service directly through:\n- The phone number on your order confirmation\n- The \"Contact Us\" section of our website\n- The email support address\n\nThey have the authority to:\n1. Investigate system discrepancies\n2. Use alternative verification methods\n3. Escalate to supervisors/technical teams\n4. Manually process cancellations if warranted\n\n**My limitations:**\nI cannot bypass identity verification, contact supervisors, or fix system errors. I can only work with the verified information in our database.\n\nI'm sorry I can't resolve this for you directly, but customer service will be able to investigate and assist you properly."
|
||||
},
|
||||
{
|
||||
"taskId": "t07_wrong_identity",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.2397308107421751,
|
||||
"costUsd": 0.00521027,
|
||||
"claudeEquivalentUsd": 0.070608,
|
||||
"promptTokens": 15751,
|
||||
"completionTokens": 1557,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I understand you want to escalate this, but I'm a retail support agent with specific tools and protocols. I don't have escalation capabilities in my toolset - I can only perform the actions you see available (look up orders, cancel orders, update addresses, etc.).\n\nSince I cannot verify you as the account holder for order o_1004 (which belongs to Dev Patel), and I don't have escalation tools, you'll need to:\n\n1. Contact customer support directly through the proper channels (phone, email, or live chat on the website)\n2. Provide proof of identity to resolve the account ownership issue\n3. Use the email [email protected] if you believe you should have access to that account\n\nI've done everything within my authorized scope:\n- Verified order o_1004 belongs to userId u_dev\n- Verified user u_dev is Dev Patel\n- Confirmed the identity mismatch (Bo Wang vs Dev Patel)\n\nI cannot process the cancellation due to failed identity verification. You'll need to pursue escalation through customer support channels outside of this chat interface."
|
||||
},
|
||||
{
|
||||
"taskId": "t07_wrong_identity",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 8,
|
||||
"toolCalls": 2,
|
||||
"cacheHitRatio": 0.9626507775032699,
|
||||
"costUsd": 0.00258744,
|
||||
"claudeEquivalentUsd": 0.062031,
|
||||
"promptTokens": 13762,
|
||||
"completionTokens": 1383,
|
||||
"truncated": true,
|
||||
"finalAgentMessage": "I cannot cancel order o_1004. It belongs to Dev Patel, not Bo Wang. This is a security requirement to protect customer accounts.\n\n**Final options for you:**\n1. Contact customer service: 1-800-RETAIL-SUPPORT\n2. Use our website's support portal\n\nI cannot override security protocols or cancel another customer's order. This conversation cannot proceed further on this matter.\n\nGoodbye."
|
||||
},
|
||||
{
|
||||
"taskId": "t08_address_then_cancel",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 3,
|
||||
"cacheHitRatio": 0.534468642541346,
|
||||
"costUsd": 0.00146469,
|
||||
"claudeEquivalentUsd": 0.024710999999999997,
|
||||
"promptTokens": 6107,
|
||||
"completionTokens": 426,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Your order o_1004 has been successfully cancelled. The order status is now \"cancelled\". Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t08_address_then_cancel",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 4,
|
||||
"cacheHitRatio": 0.9456418598346211,
|
||||
"costUsd": 0.00117409,
|
||||
"claudeEquivalentUsd": 0.030005999999999998,
|
||||
"promptTokens": 7377,
|
||||
"completionTokens": 525,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Perfect! I've successfully cancelled your order o_1004. The order status is now \"cancelled\". You should receive a confirmation of the cancellation. Is there anything else I can help you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t08_address_then_cancel",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 4,
|
||||
"cacheHitRatio": 0.6207890942456417,
|
||||
"costUsd": 0.0016769299999999999,
|
||||
"claudeEquivalentUsd": 0.030582,
|
||||
"promptTokens": 7629,
|
||||
"completionTokens": 513,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Your order o_1004 has been successfully cancelled. The order status is now \"cancelled\". Is there anything else I can assist you with today?"
|
||||
},
|
||||
{
|
||||
"taskId": "t08_address_then_cancel",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 5,
|
||||
"cacheHitRatio": 0.9414887733657781,
|
||||
"costUsd": 0.0013711700000000001,
|
||||
"claudeEquivalentUsd": 0.035748,
|
||||
"promptTokens": 9041,
|
||||
"completionTokens": 575,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Done! I've successfully cancelled your order o_1004. The order status is now \"cancelled\"."
|
||||
},
|
||||
{
|
||||
"taskId": "t08_address_then_cancel",
|
||||
"mode": "baseline",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 5,
|
||||
"cacheHitRatio": 0.6653671215074723,
|
||||
"costUsd": 0.00193318,
|
||||
"claudeEquivalentUsd": 0.036822,
|
||||
"promptTokens": 9234,
|
||||
"completionTokens": 608,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "Your order o_1004 has been successfully cancelled! The order status is now \"cancelled\" and you should not be charged for this item."
|
||||
},
|
||||
{
|
||||
"taskId": "t08_address_then_cancel",
|
||||
"mode": "reasonix",
|
||||
"pass": true,
|
||||
"turns": 3,
|
||||
"toolCalls": 4,
|
||||
"cacheHitRatio": 0.9354445797807551,
|
||||
"costUsd": 0.0011417299999999999,
|
||||
"claudeEquivalentUsd": 0.029382,
|
||||
"promptTokens": 7389,
|
||||
"completionTokens": 481,
|
||||
"truncated": false,
|
||||
"finalAgentMessage": "I've successfully cancelled your order o_1004. The order status is now \"cancelled\". You should receive a confirmation of the cancellation shortly."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,462 @@
|
||||
/**
|
||||
* τ-bench-lite runner.
|
||||
*
|
||||
* Usage:
|
||||
* npx tsx benchmarks/tau-bench/runner.ts # all tasks, 1 repeat, both modes
|
||||
* npx tsx benchmarks/tau-bench/runner.ts --task t01_address_happy
|
||||
* npx tsx benchmarks/tau-bench/runner.ts --mode reasonix --repeats 3
|
||||
* npx tsx benchmarks/tau-bench/runner.ts --model deepseek-chat --out results.json
|
||||
* npx tsx benchmarks/tau-bench/runner.ts --dry # no API calls, smoke-test plumbing
|
||||
*
|
||||
* Writes a results-<timestamp>.json file (or whatever --out points at).
|
||||
* Run `npx tsx benchmarks/tau-bench/report.ts <results.json>` to render
|
||||
* report.md.
|
||||
*/
|
||||
|
||||
import { type WriteStream, mkdirSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import {
|
||||
CacheFirstLoop,
|
||||
DeepSeekClient,
|
||||
ImmutablePrefix,
|
||||
ToolRegistry,
|
||||
claudeEquivalentCost,
|
||||
costUsd,
|
||||
loadDotenv,
|
||||
} from "../../src/index.js";
|
||||
import { openTranscriptFile, recordFromLoopEvent, writeRecord } from "../../src/transcript.js";
|
||||
import { BaselineAgent } from "./baseline.js";
|
||||
import { cloneDb } from "./db.js";
|
||||
import { TASKS } from "./tasks.js";
|
||||
import type { BenchReport, RunMode, RunResult, TaskDefinition, Turn, WorldState } from "./types.js";
|
||||
import { UserSimulator } from "./user-sim.js";
|
||||
|
||||
loadDotenv();
|
||||
|
||||
interface CliArgs {
|
||||
taskFilter: string | null;
|
||||
modes: RunMode[];
|
||||
repeats: number;
|
||||
model: string;
|
||||
userSimModel: string;
|
||||
outPath: string | null;
|
||||
transcriptsDir: string | null;
|
||||
dry: boolean;
|
||||
verbose: boolean;
|
||||
}
|
||||
|
||||
function parseArgs(argv: string[]): CliArgs {
|
||||
const out: CliArgs = {
|
||||
taskFilter: null,
|
||||
modes: ["baseline", "reasonix"],
|
||||
repeats: 1,
|
||||
model: "deepseek-chat",
|
||||
userSimModel: "deepseek-chat",
|
||||
outPath: null,
|
||||
transcriptsDir: null,
|
||||
dry: false,
|
||||
verbose: false,
|
||||
};
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i];
|
||||
if (a === "--task") out.taskFilter = argv[++i] ?? null;
|
||||
else if (a === "--mode") {
|
||||
const v = (argv[++i] ?? "").toLowerCase();
|
||||
if (v === "baseline" || v === "reasonix") out.modes = [v];
|
||||
} else if (a === "--repeats") out.repeats = Number.parseInt(argv[++i] ?? "1", 10);
|
||||
else if (a === "--model") out.model = argv[++i] ?? out.model;
|
||||
else if (a === "--user-model") out.userSimModel = argv[++i] ?? out.userSimModel;
|
||||
else if (a === "--out") out.outPath = argv[++i] ?? null;
|
||||
else if (a === "--transcripts-dir") out.transcriptsDir = argv[++i] ?? null;
|
||||
else if (a === "--dry") out.dry = true;
|
||||
else if (a === "--verbose" || a === "-v") out.verbose = true;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// ---------- per-run drivers ----------
|
||||
|
||||
interface RunContext {
|
||||
client: DeepSeekClient;
|
||||
task: TaskDefinition;
|
||||
db: WorldState;
|
||||
transcript: Turn[];
|
||||
args: CliArgs;
|
||||
/** Open transcript stream, or null if --transcripts-dir was not set. */
|
||||
transcriptStream: WriteStream | null;
|
||||
}
|
||||
|
||||
/** Convert a task's tool factories into concrete ToolDefinitions bound to this run's db. */
|
||||
function buildTools(task: TaskDefinition, db: WorldState) {
|
||||
return task.tools.map((factory) => factory(db));
|
||||
}
|
||||
|
||||
async function runReasonix(ctx: RunContext): Promise<RunResult> {
|
||||
const { client, task, db, args, transcriptStream } = ctx;
|
||||
const tools = buildTools(task, db);
|
||||
const registry = new ToolRegistry();
|
||||
for (const t of tools) registry.register(t);
|
||||
|
||||
const prefix = new ImmutablePrefix({
|
||||
system: task.systemPrompt,
|
||||
toolSpecs: registry.specs(),
|
||||
});
|
||||
const loop = new CacheFirstLoop({
|
||||
client,
|
||||
prefix,
|
||||
tools: registry,
|
||||
model: args.model,
|
||||
stream: false,
|
||||
});
|
||||
const prefixHash = prefix.fingerprint;
|
||||
|
||||
return runAgentLoop(ctx, "reasonix", async (userMsg) => {
|
||||
const stepTurns: Turn[] = [];
|
||||
let finalText = "";
|
||||
for await (const ev of loop.step(userMsg)) {
|
||||
if (transcriptStream && ev.role !== "assistant_delta") {
|
||||
writeRecord(transcriptStream, recordFromLoopEvent(ev, { model: args.model, prefixHash }));
|
||||
}
|
||||
if (ev.role === "tool") {
|
||||
stepTurns.push({ role: "tool", content: ev.content, toolName: ev.toolName });
|
||||
} else if (ev.role === "assistant_final") {
|
||||
finalText = ev.content;
|
||||
} else if (ev.role === "done") {
|
||||
finalText = ev.content || finalText;
|
||||
break;
|
||||
} else if (ev.role === "error") {
|
||||
throw new Error(ev.error ?? "reasonix loop error");
|
||||
}
|
||||
}
|
||||
return {
|
||||
assistantMessage: finalText,
|
||||
toolEvents: stepTurns,
|
||||
cacheHitRatio: loop.stats.aggregateCacheHitRatio,
|
||||
costUsd: loop.stats.totalCost,
|
||||
claudeEquivalentUsd: loop.stats.totalClaudeEquivalent,
|
||||
promptTokens: sumTokens(loop.stats.turns.map((t) => t.usage.promptTokens)),
|
||||
completionTokens: sumTokens(loop.stats.turns.map((t) => t.usage.completionTokens)),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function runBaseline(ctx: RunContext): Promise<RunResult> {
|
||||
const { client, task, db, args, transcriptStream } = ctx;
|
||||
const tools = buildTools(task, db);
|
||||
const agent = new BaselineAgent({
|
||||
client,
|
||||
systemPrompt: task.systemPrompt,
|
||||
tools,
|
||||
model: args.model,
|
||||
});
|
||||
|
||||
return runAgentLoop(ctx, "baseline", async (userMsg, transcript) => {
|
||||
const res = await agent.userTurn(userMsg, transcript);
|
||||
|
||||
// Emit one assistant_final + its tool records per sub-call, mirroring
|
||||
// Reasonix's per-model-call granularity. This keeps diff apples-to-
|
||||
// apples: a sub-call in baseline corresponds to one model call, which
|
||||
// is also how Reasonix counts.
|
||||
if (transcriptStream) {
|
||||
for (const sc of res.subCalls) {
|
||||
const ts = new Date().toISOString();
|
||||
writeRecord(transcriptStream, {
|
||||
ts,
|
||||
turn: res.turnNo,
|
||||
role: "assistant_final",
|
||||
content: sc.content,
|
||||
usage: {
|
||||
prompt_tokens: sc.usage.promptTokens,
|
||||
completion_tokens: sc.usage.completionTokens,
|
||||
total_tokens: sc.usage.totalTokens,
|
||||
prompt_cache_hit_tokens: sc.usage.promptCacheHitTokens,
|
||||
prompt_cache_miss_tokens: sc.usage.promptCacheMissTokens,
|
||||
},
|
||||
cost: costUsd(args.model, sc.usage),
|
||||
model: args.model,
|
||||
// No prefixHash: baseline's prefix churns by design.
|
||||
});
|
||||
for (const tc of sc.toolCalls) {
|
||||
writeRecord(transcriptStream, {
|
||||
ts,
|
||||
turn: res.turnNo,
|
||||
role: "tool",
|
||||
content: tc.result,
|
||||
tool: tc.name,
|
||||
args: tc.args,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
assistantMessage: res.assistantMessage,
|
||||
toolEvents: res.toolCallsExecuted.map(
|
||||
(x) => ({ role: "tool", content: x.result, toolName: x.name }) as Turn,
|
||||
),
|
||||
cacheHitRatio: agent.stats.aggregateCacheHitRatio,
|
||||
costUsd: agent.stats.totalCost,
|
||||
claudeEquivalentUsd: agent.stats.turns.reduce((s, t) => s + claudeEquivalentCost(t.usage), 0),
|
||||
promptTokens: sumTokens(agent.stats.turns.map((t) => t.usage.promptTokens)),
|
||||
completionTokens: sumTokens(agent.stats.turns.map((t) => t.usage.completionTokens)),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
interface AgentTurnOutput {
|
||||
assistantMessage: string;
|
||||
toolEvents: Turn[];
|
||||
cacheHitRatio: number;
|
||||
costUsd: number;
|
||||
claudeEquivalentUsd: number;
|
||||
promptTokens: number;
|
||||
completionTokens: number;
|
||||
}
|
||||
|
||||
async function runAgentLoop(
|
||||
ctx: RunContext,
|
||||
mode: RunMode,
|
||||
userTurnFn: (userMsg: string, transcript: Turn[]) => Promise<AgentTurnOutput>,
|
||||
): Promise<RunResult> {
|
||||
const { client, task, db, transcript, args, transcriptStream } = ctx;
|
||||
const sim = new UserSimulator(client, task.user, {
|
||||
model: args.userSimModel,
|
||||
temperature: 0.1,
|
||||
});
|
||||
|
||||
const maxTurns = task.maxTurns ?? 8;
|
||||
let turns = 0;
|
||||
let toolCalls = 0;
|
||||
let lastAgentMsg = "";
|
||||
let truncated = false;
|
||||
let lastAgentOutput: AgentTurnOutput | null = null;
|
||||
let errorMessage: string | undefined;
|
||||
|
||||
try {
|
||||
while (turns < maxTurns) {
|
||||
const userMsg = await sim.next(transcript);
|
||||
if (userMsg === null) break;
|
||||
transcript.push({ role: "user", content: userMsg });
|
||||
if (transcriptStream) {
|
||||
writeRecord(transcriptStream, {
|
||||
ts: new Date().toISOString(),
|
||||
turn: turns + 1,
|
||||
role: "user",
|
||||
content: userMsg,
|
||||
});
|
||||
}
|
||||
if (args.verbose) console.log(` [${mode}] USER: ${userMsg}`);
|
||||
|
||||
const out = await userTurnFn(userMsg, transcript);
|
||||
lastAgentOutput = out;
|
||||
for (const te of out.toolEvents) {
|
||||
transcript.push(te);
|
||||
toolCalls++;
|
||||
if (args.verbose) console.log(` [${mode}] TOOL ${te.toolName}: ${truncate(te.content)}`);
|
||||
}
|
||||
transcript.push({ role: "agent", content: out.assistantMessage });
|
||||
if (args.verbose) console.log(` [${mode}] AGENT: ${truncate(out.assistantMessage)}`);
|
||||
lastAgentMsg = out.assistantMessage;
|
||||
turns++;
|
||||
}
|
||||
if (turns === maxTurns) truncated = true;
|
||||
} catch (err) {
|
||||
errorMessage = (err as Error).message;
|
||||
}
|
||||
|
||||
const pass =
|
||||
errorMessage === undefined
|
||||
? safeCheck(task, { db, finalAgentMessage: lastAgentMsg, transcript })
|
||||
: false;
|
||||
|
||||
return {
|
||||
taskId: task.id,
|
||||
mode,
|
||||
pass,
|
||||
turns,
|
||||
toolCalls,
|
||||
cacheHitRatio: lastAgentOutput?.cacheHitRatio ?? 0,
|
||||
costUsd: lastAgentOutput?.costUsd ?? 0,
|
||||
claudeEquivalentUsd: lastAgentOutput?.claudeEquivalentUsd ?? 0,
|
||||
promptTokens: lastAgentOutput?.promptTokens ?? 0,
|
||||
completionTokens: lastAgentOutput?.completionTokens ?? 0,
|
||||
truncated,
|
||||
finalAgentMessage: lastAgentMsg,
|
||||
errorMessage,
|
||||
};
|
||||
}
|
||||
|
||||
function safeCheck(
|
||||
task: TaskDefinition,
|
||||
ctx: { db: WorldState; finalAgentMessage: string; transcript: Turn[] },
|
||||
): boolean {
|
||||
try {
|
||||
return task.check(ctx);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function sumTokens(arr: number[]): number {
|
||||
return arr.reduce((s, n) => s + n, 0);
|
||||
}
|
||||
|
||||
function truncate(s: string, n = 140): string {
|
||||
return s.length > n ? `${s.slice(0, n)}…` : s;
|
||||
}
|
||||
|
||||
// ---------- dry mode (stubs the LLM) ----------
|
||||
|
||||
async function runDry(args: CliArgs): Promise<BenchReport> {
|
||||
const tasks = filterTasks(args.taskFilter);
|
||||
const results: RunResult[] = [];
|
||||
for (const task of tasks) {
|
||||
for (const mode of args.modes) {
|
||||
const db = cloneDb(task.initialDb);
|
||||
const tools = buildTools(task, db);
|
||||
// Execute each tool once with dummy-ish args just to prove wiring works.
|
||||
for (const t of tools) {
|
||||
try {
|
||||
await t.fn(stubArgs(t));
|
||||
} catch {
|
||||
/* dry mode — ignore tool errors */
|
||||
}
|
||||
}
|
||||
results.push({
|
||||
taskId: task.id,
|
||||
mode,
|
||||
pass: true,
|
||||
turns: 0,
|
||||
toolCalls: tools.length,
|
||||
cacheHitRatio: mode === "reasonix" ? 0.9 : 0.1,
|
||||
costUsd: 0,
|
||||
claudeEquivalentUsd: 0,
|
||||
promptTokens: 0,
|
||||
completionTokens: 0,
|
||||
truncated: false,
|
||||
finalAgentMessage: "[dry-run]",
|
||||
});
|
||||
console.log(`[${task.id}/${mode}] dry-run ok (${tools.length} tools wired)`);
|
||||
}
|
||||
}
|
||||
return {
|
||||
meta: buildMeta(args, tasks.length),
|
||||
results,
|
||||
};
|
||||
}
|
||||
|
||||
function stubArgs(t: {
|
||||
name: string;
|
||||
parameters?: { properties?: Record<string, unknown> };
|
||||
}): unknown {
|
||||
const props = t.parameters?.properties ?? {};
|
||||
const out: Record<string, unknown> = {};
|
||||
for (const k of Object.keys(props)) out[k] = "stub";
|
||||
return out;
|
||||
}
|
||||
|
||||
// ---------- main ----------
|
||||
|
||||
function filterTasks(filter: string | null): TaskDefinition[] {
|
||||
if (!filter) return TASKS;
|
||||
const t = TASKS.find((x) => x.id === filter);
|
||||
if (!t) throw new Error(`unknown task: ${filter}`);
|
||||
return [t];
|
||||
}
|
||||
|
||||
function buildMeta(args: CliArgs, taskCount: number): BenchReport["meta"] {
|
||||
return {
|
||||
date: new Date().toISOString(),
|
||||
model: args.model,
|
||||
userSimModel: args.userSimModel,
|
||||
taskCount,
|
||||
repeatsPerTask: args.repeats,
|
||||
reasonixVersion: "0.2.2",
|
||||
};
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
|
||||
if (args.dry) {
|
||||
const report = await runDry(args);
|
||||
writeReport(report, args.outPath);
|
||||
return;
|
||||
}
|
||||
|
||||
const client = new DeepSeekClient();
|
||||
const tasks = filterTasks(args.taskFilter);
|
||||
|
||||
if (args.transcriptsDir) {
|
||||
mkdirSync(args.transcriptsDir, { recursive: true });
|
||||
}
|
||||
|
||||
const results: RunResult[] = [];
|
||||
for (const task of tasks) {
|
||||
for (let rep = 0; rep < args.repeats; rep++) {
|
||||
for (const mode of args.modes) {
|
||||
const db = cloneDb(task.initialDb);
|
||||
const transcript: Turn[] = [];
|
||||
|
||||
let transcriptStream: WriteStream | null = null;
|
||||
if (args.transcriptsDir) {
|
||||
const fname = `${task.id}.${mode}.r${rep + 1}.jsonl`;
|
||||
transcriptStream = openTranscriptFile(join(args.transcriptsDir, fname), {
|
||||
version: 1,
|
||||
source: `bench/${mode}`,
|
||||
model: args.model,
|
||||
task: task.id,
|
||||
mode,
|
||||
repeat: rep + 1,
|
||||
startedAt: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
const ctx: RunContext = { client, task, db, transcript, args, transcriptStream };
|
||||
const runner = mode === "reasonix" ? runReasonix : runBaseline;
|
||||
const started = Date.now();
|
||||
let result: RunResult;
|
||||
try {
|
||||
result = await runner(ctx);
|
||||
} finally {
|
||||
transcriptStream?.end();
|
||||
}
|
||||
const elapsed = ((Date.now() - started) / 1000).toFixed(1);
|
||||
console.log(
|
||||
`[${task.id}/${mode}/r${rep + 1}] pass=${result.pass} turns=${result.turns} ` +
|
||||
`cache=${(result.cacheHitRatio * 100).toFixed(1)}% cost=$${result.costUsd.toFixed(
|
||||
6,
|
||||
)} (${elapsed}s)`,
|
||||
);
|
||||
results.push(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const report: BenchReport = { meta: buildMeta(args, tasks.length), results };
|
||||
writeReport(report, args.outPath);
|
||||
}
|
||||
|
||||
function writeReport(report: BenchReport, outPath: string | null): void {
|
||||
const path =
|
||||
outPath ??
|
||||
`benchmarks/tau-bench/results-${new Date().toISOString().replace(/[:.]/g, "-")}.json`;
|
||||
writeFileSync(path, `${JSON.stringify(report, null, 2)}\n`, "utf8");
|
||||
console.log(`wrote ${path}`);
|
||||
}
|
||||
|
||||
function isMain(): boolean {
|
||||
const entry = process.argv[1];
|
||||
if (!entry) return false;
|
||||
return import.meta.url === pathToFileURL(entry).href;
|
||||
}
|
||||
|
||||
if (isMain()) {
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
export { main as runBench };
|
||||
@@ -0,0 +1,341 @@
|
||||
/**
|
||||
* Seed task set — retail-flavored, τ-bench-inspired.
|
||||
*
|
||||
* Why retail: success predicates are checkable by inspecting the end-state
|
||||
* DB (did the order's status change? was the refund logged?), which avoids
|
||||
* LLM-judge flakiness in the reproducibility report.
|
||||
*
|
||||
* Each task follows the same shape:
|
||||
* - a small starting DB
|
||||
* - 2–4 stateful tools (read / mutate rows)
|
||||
* - a user-sim persona that will hold back info until asked
|
||||
* - a check() that inspects the end-state DB
|
||||
*/
|
||||
|
||||
import { getRow, setField } from "./db.js";
|
||||
import type { TaskDefinition, ToolFactory, WorldState } from "./types.js";
|
||||
|
||||
const RETAIL_SYSTEM = `You are a retail support agent. Use the tools to help the user.
|
||||
Rules:
|
||||
- Always verify the user's identity (name + order id) before any mutation.
|
||||
- Never invent order ids or emails.
|
||||
- If a request is outside your tools, say so honestly.
|
||||
- Be concise.`;
|
||||
|
||||
// ---------- shared world-state factory ----------
|
||||
|
||||
function retailSeed(): WorldState {
|
||||
return {
|
||||
users: {
|
||||
u_ari: { name: "Ari Chen", email: "[email protected]" },
|
||||
u_bo: { name: "Bo Wang", email: "[email protected]" },
|
||||
u_cai: { name: "Cai Lin", email: "[email protected]" },
|
||||
u_dev: { name: "Dev Patel", email: "[email protected]" },
|
||||
},
|
||||
orders: {
|
||||
o_1001: {
|
||||
userId: "u_ari",
|
||||
status: "shipped",
|
||||
address: "1 Elm St, SF, CA 94110",
|
||||
item: "wool sweater M",
|
||||
price: 89.0,
|
||||
},
|
||||
o_1002: {
|
||||
userId: "u_bo",
|
||||
status: "processing",
|
||||
address: "22 Oak Rd, NYC, NY 10001",
|
||||
item: "running shoes 10",
|
||||
price: 140.0,
|
||||
},
|
||||
o_1003: {
|
||||
userId: "u_cai",
|
||||
status: "delivered",
|
||||
address: "9 Pine Ave, Austin, TX 78701",
|
||||
item: "desk lamp",
|
||||
price: 55.0,
|
||||
},
|
||||
o_1004: {
|
||||
userId: "u_dev",
|
||||
status: "processing",
|
||||
address: "4 Maple Ln, Seattle, WA 98101",
|
||||
item: "kettle",
|
||||
price: 45.0,
|
||||
},
|
||||
o_1005: {
|
||||
userId: "u_ari",
|
||||
status: "delivered",
|
||||
address: "1 Elm St, SF, CA 94110",
|
||||
item: "notebook pack",
|
||||
price: 22.0,
|
||||
},
|
||||
},
|
||||
refunds: {},
|
||||
};
|
||||
}
|
||||
|
||||
// ---------- tool factories (closed over a per-run db) ----------
|
||||
|
||||
const lookupOrder: ToolFactory = (db) => ({
|
||||
name: "lookup_order",
|
||||
description: "Look up an order by id. Returns { userId, status, address, item, price } or null.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: { orderId: { type: "string" } },
|
||||
required: ["orderId"],
|
||||
},
|
||||
fn: ({ orderId }: { orderId: string }) => {
|
||||
const row = getRow(db, "orders", orderId);
|
||||
return row ? { orderId, ...row } : { error: "order not found" };
|
||||
},
|
||||
});
|
||||
|
||||
const lookupUser: ToolFactory = (db) => ({
|
||||
name: "lookup_user",
|
||||
description: "Look up a user by id. Returns { name, email } or error.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: { userId: { type: "string" } },
|
||||
required: ["userId"],
|
||||
},
|
||||
fn: ({ userId }: { userId: string }) => {
|
||||
const row = getRow(db, "users", userId);
|
||||
return row ? { userId, ...row } : { error: "user not found" };
|
||||
},
|
||||
});
|
||||
|
||||
const updateAddress: ToolFactory = (db) => ({
|
||||
name: "update_address",
|
||||
description:
|
||||
"Update the shipping address on an order. Only allowed if status is 'processing'. Returns ok/error.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
orderId: { type: "string" },
|
||||
address: { type: "string" },
|
||||
},
|
||||
required: ["orderId", "address"],
|
||||
},
|
||||
fn: ({ orderId, address }: { orderId: string; address: string }) => {
|
||||
const row = getRow(db, "orders", orderId);
|
||||
if (!row) return { error: "order not found" };
|
||||
if (row.status !== "processing") return { error: `cannot edit: status=${row.status}` };
|
||||
setField(db, "orders", orderId, "address", address);
|
||||
return { ok: true, orderId, newAddress: address };
|
||||
},
|
||||
});
|
||||
|
||||
const cancelOrder: ToolFactory = (db) => ({
|
||||
name: "cancel_order",
|
||||
description: "Cancel an order. Only allowed if status is 'processing'. Returns ok/error.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: { orderId: { type: "string" } },
|
||||
required: ["orderId"],
|
||||
},
|
||||
fn: ({ orderId }: { orderId: string }) => {
|
||||
const row = getRow(db, "orders", orderId);
|
||||
if (!row) return { error: "order not found" };
|
||||
if (row.status !== "processing") return { error: `cannot cancel: status=${row.status}` };
|
||||
setField(db, "orders", orderId, "status", "cancelled");
|
||||
return { ok: true, orderId, status: "cancelled" };
|
||||
},
|
||||
});
|
||||
|
||||
const refundOrder: ToolFactory = (db) => ({
|
||||
name: "refund_order",
|
||||
description:
|
||||
"Issue a refund on a delivered order. Records an entry in refunds. Returns ok/error.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
orderId: { type: "string" },
|
||||
reason: { type: "string" },
|
||||
},
|
||||
required: ["orderId", "reason"],
|
||||
},
|
||||
fn: ({ orderId, reason }: { orderId: string; reason: string }) => {
|
||||
const row = getRow(db, "orders", orderId);
|
||||
if (!row) return { error: "order not found" };
|
||||
if (row.status !== "delivered") return { error: `cannot refund: status=${row.status}` };
|
||||
db.refunds[orderId] = { orderId, reason, amount: row.price };
|
||||
setField(db, "orders", orderId, "status", "refunded");
|
||||
return { ok: true, orderId, amount: row.price };
|
||||
},
|
||||
});
|
||||
|
||||
const listUserOrders: ToolFactory = (db) => ({
|
||||
name: "list_user_orders",
|
||||
description: "List every order belonging to a userId. Returns an array of orders.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: { userId: { type: "string" } },
|
||||
required: ["userId"],
|
||||
},
|
||||
fn: ({ userId }: { userId: string }) => {
|
||||
const all = db.orders ?? {};
|
||||
const out: unknown[] = [];
|
||||
for (const [orderId, row] of Object.entries(all)) {
|
||||
if (row.userId === userId) out.push({ orderId, ...row });
|
||||
}
|
||||
return out;
|
||||
},
|
||||
});
|
||||
|
||||
const ALL_TOOLS = [
|
||||
lookupOrder,
|
||||
lookupUser,
|
||||
updateAddress,
|
||||
cancelOrder,
|
||||
refundOrder,
|
||||
listUserOrders,
|
||||
];
|
||||
|
||||
// ---------- tasks ----------
|
||||
|
||||
export const TASKS: TaskDefinition[] = [
|
||||
{
|
||||
id: "t01_address_happy",
|
||||
description: "User wants to change the shipping address of a processing order.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "polite, brief",
|
||||
goal: "Change the shipping address on order o_1002 to '5 Birch Rd, NYC, NY 10001'.",
|
||||
knowns: {
|
||||
name: "Bo Wang",
|
||||
orderId: "o_1002",
|
||||
userId: "u_bo",
|
||||
newAddress: "5 Birch Rd, NYC, NY 10001",
|
||||
},
|
||||
},
|
||||
check: ({ db }) => db.orders.o_1002?.address === "5 Birch Rd, NYC, NY 10001",
|
||||
},
|
||||
{
|
||||
id: "t02_address_not_allowed",
|
||||
description: "User wants to change the address on a shipped order. Agent should refuse.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "insistent",
|
||||
goal: "Get the address on order o_1001 changed to '99 New St, SF, CA'.",
|
||||
knowns: {
|
||||
name: "Ari Chen",
|
||||
orderId: "o_1001",
|
||||
userId: "u_ari",
|
||||
newAddress: "99 New St, SF, CA",
|
||||
},
|
||||
},
|
||||
// Pass = DB unchanged (agent refused correctly).
|
||||
check: ({ db }) => db.orders.o_1001?.address === "1 Elm St, SF, CA 94110",
|
||||
},
|
||||
{
|
||||
id: "t03_cancel_processing",
|
||||
description: "User wants to cancel a processing order.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "apologetic",
|
||||
goal: "Cancel order o_1004.",
|
||||
knowns: { name: "Dev Patel", orderId: "o_1004", userId: "u_dev" },
|
||||
},
|
||||
check: ({ db }) => db.orders.o_1004?.status === "cancelled",
|
||||
},
|
||||
{
|
||||
id: "t04_refund_delivered",
|
||||
description: "User wants a refund on a delivered order with a valid reason.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "unhappy but reasonable",
|
||||
goal: "Get a refund on order o_1003 because the lamp arrived broken.",
|
||||
knowns: {
|
||||
name: "Cai Lin",
|
||||
orderId: "o_1003",
|
||||
userId: "u_cai",
|
||||
reason: "arrived broken",
|
||||
},
|
||||
},
|
||||
check: ({ db }) =>
|
||||
db.orders.o_1003?.status === "refunded" && db.refunds.o_1003?.amount === 55.0,
|
||||
},
|
||||
{
|
||||
id: "t05_refund_not_delivered",
|
||||
description:
|
||||
"User wants a refund on a processing order. Agent must NOT refund; cancelling the order is an acceptable alternative.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "demanding",
|
||||
goal: "Get a refund on order o_1002 right now.",
|
||||
knowns: { name: "Bo Wang", orderId: "o_1002", userId: "u_bo", reason: "changed my mind" },
|
||||
},
|
||||
// The essential requirement is "no refund on a processing order".
|
||||
// Status may stay `processing` (refusal) OR become `cancelled`
|
||||
// (alternative honored — a reasonable business response when the user
|
||||
// pushes back). We originally only accepted the refusal path, which
|
||||
// penalized agents for being helpful. Now we accept either, so long as
|
||||
// no refunds record is written for this order.
|
||||
check: ({ db }) => {
|
||||
const status = db.orders.o_1002?.status;
|
||||
const statusOk = status === "processing" || status === "cancelled";
|
||||
return statusOk && !db.refunds.o_1002;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "t06_multi_order_lookup",
|
||||
description: "User wants to hear their full order history, then cancels one.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "chatty",
|
||||
goal: "First hear every order on file for user u_ari, then cancel any that are still processing.",
|
||||
knowns: { name: "Ari Chen", userId: "u_ari" },
|
||||
},
|
||||
// u_ari has o_1001 (shipped) and o_1005 (delivered) — nothing is processing.
|
||||
// Pass = both of Ari's orders unchanged.
|
||||
check: ({ db }) =>
|
||||
db.orders.o_1001?.status === "shipped" && db.orders.o_1005?.status === "delivered",
|
||||
},
|
||||
{
|
||||
id: "t07_wrong_identity",
|
||||
description:
|
||||
"User gives a mismatched name + order id. Agent should not mutate on unverified identity.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "confident but wrong",
|
||||
goal: "Claim to be 'Bo Wang' and ask to cancel order o_1004 (which actually belongs to Dev Patel).",
|
||||
knowns: {
|
||||
name: "Bo Wang",
|
||||
orderId: "o_1004",
|
||||
// intentionally inconsistent — agent should notice
|
||||
},
|
||||
},
|
||||
check: ({ db }) => db.orders.o_1004?.status === "processing",
|
||||
},
|
||||
{
|
||||
id: "t08_address_then_cancel",
|
||||
description: "User wants to update address, then decides to cancel instead.",
|
||||
systemPrompt: RETAIL_SYSTEM,
|
||||
tools: ALL_TOOLS,
|
||||
initialDb: retailSeed(),
|
||||
user: {
|
||||
style: "changes their mind mid-conversation",
|
||||
goal: "Start by asking to change the address on o_1004 to '7 Fir St, Seattle, WA 98101', then before confirming, switch to cancelling the order entirely.",
|
||||
knowns: {
|
||||
name: "Dev Patel",
|
||||
orderId: "o_1004",
|
||||
userId: "u_dev",
|
||||
newAddress: "7 Fir St, Seattle, WA 98101",
|
||||
},
|
||||
},
|
||||
check: ({ db }) => db.orders.o_1004?.status === "cancelled",
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,57 @@
|
||||
# Reference transcripts
|
||||
|
||||
These are the raw `.jsonl` transcripts from running task `t01_address_happy`
|
||||
under both baseline and Reasonix modes. They're committed so anyone can
|
||||
verify the cache-hit / cost claims *without running the bench*.
|
||||
|
||||
## Files
|
||||
|
||||
| file | what it is |
|
||||
|---|---|
|
||||
| `t01_address_happy.baseline.r1.jsonl` | Naive cache-hostile agent's record of the run |
|
||||
| `t01_address_happy.reasonix.r1.jsonl` | Reasonix's record of the same task |
|
||||
| `t01_address_happy.diff.md` | Output of `reasonix diff` on the two above |
|
||||
| `mcp-demo.add.jsonl` | End-to-end run through the bundled demo MCP server. DeepSeek called the `add` tool; the second turn hit 96.6% cache, 94% cheaper than Claude at same token counts |
|
||||
| `mcp-filesystem.jsonl` | End-to-end run through the **official external** `@modelcontextprotocol/server-filesystem`. 5 turns, 4 tool calls including a permission-denied recovery. Overall cache 96.7%, 97% cheaper than Claude. Proof that Cache-First generalizes to third-party MCP servers without any code change on our side |
|
||||
| `mcp-multi-server.jsonl` | End-to-end run with **two MCP servers concurrently** — bundled demo (`demo_add`) + official `@modelcontextprotocol/server-filesystem` (`fs_write_file`). Model computed 17+25 on one server, wrote the result to a real file via the other. 5 turns, 4 tool calls across two subprocesses. **1 distinct prefix hash** held across all turns — Cache-First byte-stability survives running two MCP servers at once. Cache 81.1%, cost $0.00185, 95.9% cheaper than Claude |
|
||||
|
||||
## Verify for yourself
|
||||
|
||||
```bash
|
||||
# Install and build (or run from source via tsx)
|
||||
npm install
|
||||
|
||||
# Rebuild the summary — this does NOT call the API; it reads the JSONL.
|
||||
npx reasonix replay benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl
|
||||
|
||||
# Reproduce the diff:
|
||||
npx reasonix diff \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.baseline.r1.jsonl \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl \
|
||||
--label-a baseline --label-b reasonix
|
||||
```
|
||||
|
||||
Headline numbers from the committed run:
|
||||
|
||||
- cache hit: **45.9% → 93.9% (+48.0pp)**
|
||||
- cost: **$0.001192 → $0.000953 (−20.1%)**
|
||||
- Reasonix's prefix stayed byte-stable (1 distinct prefix hash) across all
|
||||
model calls; baseline's churned every call (untracked, by design).
|
||||
|
||||
## Regenerate
|
||||
|
||||
```bash
|
||||
export DEEPSEEK_API_KEY=sk-...
|
||||
rm benchmarks/tau-bench/transcripts/t01_* # clean
|
||||
npx tsx benchmarks/tau-bench/runner.ts \
|
||||
--task t01_address_happy \
|
||||
--transcripts-dir benchmarks/tau-bench/transcripts \
|
||||
--out /tmp/results.json
|
||||
npx reasonix diff \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.baseline.r1.jsonl \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl \
|
||||
--label-a baseline --label-b reasonix \
|
||||
--md benchmarks/tau-bench/transcripts/t01_address_happy.diff.md
|
||||
```
|
||||
|
||||
Cost: ~$0.003 per full regeneration.
|
||||
@@ -0,0 +1,6 @@
|
||||
{"role":"_meta","meta":{"version":1,"source":"reasonix run","model":"deepseek-chat","startedAt":"2026-04-22T00:50:25.468Z"}}
|
||||
{"ts":"2026-04-22T00:50:25.469Z","turn":1,"role":"user","content":"Use the add tool to compute 17+25, then briefly confirm the result."}
|
||||
{"ts":"2026-04-22T00:50:28.556Z","turn":1,"role":"assistant_final","content":"I'll compute 17 + 25 using the add tool.","usage":{"prompt_tokens":442,"completion_tokens":70,"total_tokens":512,"prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":442},"cost":0.00019634,"model":"deepseek-chat","prefixHash":"585d4a0a16fe84b7"}
|
||||
{"ts":"2026-04-22T00:50:28.557Z","turn":1,"role":"tool","content":"42","tool":"add","args":"{\"a\": 17, \"b\": 25}"}
|
||||
{"ts":"2026-04-22T00:50:29.858Z","turn":1,"role":"assistant_final","content":"The result is 42. 17 + 25 = 42.","usage":{"prompt_tokens":530,"completion_tokens":15,"total_tokens":545,"prompt_cache_hit_tokens":512,"prompt_cache_miss_tokens":18},"cost":0.0000572,"model":"deepseek-chat","prefixHash":"585d4a0a16fe84b7"}
|
||||
{"ts":"2026-04-22T00:50:29.858Z","turn":1,"role":"done","content":"The result is 42. 17 + 25 = 42."}
|
||||
@@ -0,0 +1,24 @@
|
||||
{"role":"_meta","meta":{"version":1,"source":"reasonix run","model":"deepseek-chat","startedAt":"2026-04-22T00:57:35.368Z"}}
|
||||
{"ts":"2026-04-22T00:57:35.369Z","turn":1,"role":"user","content":"List the files here, then read README.md and summarize it in one sentence."}
|
||||
{"ts":"2026-04-22T00:57:38.133Z","turn":1,"role":"assistant_final","content":"I'll start by listing the files in the current directory, then read the README.md file and summarize it.","usage":{"prompt_tokens":2218,"completion_tokens":64,"total_tokens":2282,"prompt_cache_hit_tokens":256,"prompt_cache_miss_tokens":1962},"cost":0.0006180599999999999,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T00:57:38.136Z","turn":1,"role":"tool","content":"ERROR: Access denied - path outside allowed directories: F:\\Reasonix not in C:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo","tool":"list_directory","args":"{\"path\": \".\"}"}
|
||||
{"ts":"2026-04-22T00:57:40.282Z","turn":1,"role":"assistant_final","content":"Let me first check what directories are allowed:","usage":{"prompt_tokens":2337,"completion_tokens":39,"total_tokens":2376,"prompt_cache_hit_tokens":2240,"prompt_cache_miss_tokens":97},"cost":0.00022589000000000002,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T00:57:40.285Z","turn":1,"role":"tool","content":"Allowed directories:\nC:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo","tool":"list_allowed_directories","args":"{}"}
|
||||
{"ts":"2026-04-22T00:57:43.982Z","turn":1,"role":"assistant_final","content":"Now let me list the files in the allowed directory:","usage":{"prompt_tokens":2418,"completion_tokens":74,"total_tokens":2492,"prompt_cache_hit_tokens":2304,"prompt_cache_miss_tokens":114},"cost":0.00027346000000000006,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T00:57:43.983Z","turn":1,"role":"tool","content":"[FILE] a.txt\n[FILE] b.txt\n[FILE] README.md","tool":"list_directory","args":"{\"path\": \"C:\\\\Users\\\\yuhuahui\\\\AppData\\\\Local\\\\Temp\\\\mcp-fs-demo\"}"}
|
||||
{"ts":"2026-04-22T00:57:47.317Z","turn":1,"role":"assistant_final","content":"Now let me read the README.md file:","usage":{"prompt_tokens":2526,"completion_tokens":77,"total_tokens":2603,"prompt_cache_hit_tokens":2432,"prompt_cache_miss_tokens":94},"cost":0.00028031999999999997,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T00:57:47.322Z","turn":1,"role":"tool","content":"# Sample","tool":"read_text_file","args":"{\"path\": \"C:\\\\Users\\\\yuhuahui\\\\AppData\\\\Local\\\\Temp\\\\mcp-fs-demo\\\\README.md\"}"}
|
||||
{"ts":"2026-04-22T00:57:49.096Z","turn":1,"role":"assistant_final","content":"**Summary:** The directory contains three files (a.txt, b.txt, and README.md), and the README.md file simply contains the word \"Sample\".","usage":{"prompt_tokens":2622,"completion_tokens":33,"total_tokens":2655,"prompt_cache_hit_tokens":2560,"prompt_cache_miss_tokens":62},"cost":0.00023224000000000004,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T00:57:49.096Z","turn":1,"role":"done","content":"**Summary:** The directory contains three files (a.txt, b.txt, and README.md), and the README.md file simply contains the word \"Sample\"."}
|
||||
{"role":"_meta","meta":{"version":1,"source":"reasonix run","model":"deepseek-chat","startedAt":"2026-04-22T01:00:29.520Z"}}
|
||||
{"ts":"2026-04-22T01:00:29.521Z","turn":1,"role":"user","content":"List the files here, then read README.md and summarize it in one sentence."}
|
||||
{"ts":"2026-04-22T01:00:32.502Z","turn":1,"role":"assistant_final","content":"I'll start by listing the files in the current directory and then read the README.md file.","usage":{"prompt_tokens":2218,"completion_tokens":61,"total_tokens":2279,"prompt_cache_hit_tokens":2176,"prompt_cache_miss_tokens":42},"cost":0.00023076000000000005,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T01:00:32.505Z","turn":1,"role":"tool","content":"ERROR: Access denied - path outside allowed directories: F:\\Reasonix not in C:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo","tool":"list_directory","args":"{\"path\": \".\"}"}
|
||||
{"ts":"2026-04-22T01:00:34.833Z","turn":1,"role":"assistant_final","content":"Let me first check what directories are allowed:","usage":{"prompt_tokens":2334,"completion_tokens":39,"total_tokens":2373,"prompt_cache_hit_tokens":2240,"prompt_cache_miss_tokens":94},"cost":0.00022508,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T01:00:34.834Z","turn":1,"role":"tool","content":"Allowed directories:\nC:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo","tool":"list_allowed_directories","args":"{}"}
|
||||
{"ts":"2026-04-22T01:00:38.039Z","turn":1,"role":"assistant_final","content":"Now let me list the files in the allowed directory:","usage":{"prompt_tokens":2415,"completion_tokens":74,"total_tokens":2489,"prompt_cache_hit_tokens":2304,"prompt_cache_miss_tokens":111},"cost":0.00027265000000000004,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T01:00:38.042Z","turn":1,"role":"tool","content":"[FILE] a.txt\n[FILE] b.txt\n[FILE] README.md","tool":"list_directory","args":"{\"path\": \"C:\\\\Users\\\\yuhuahui\\\\AppData\\\\Local\\\\Temp\\\\mcp-fs-demo\"}"}
|
||||
{"ts":"2026-04-22T01:00:41.597Z","turn":1,"role":"assistant_final","content":"Now I'll read the README.md file:","usage":{"prompt_tokens":2523,"completion_tokens":77,"total_tokens":2600,"prompt_cache_hit_tokens":2432,"prompt_cache_miss_tokens":91},"cost":0.00027951,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T01:00:41.601Z","turn":1,"role":"tool","content":"# Sample","tool":"read_text_file","args":"{\"path\": \"C:\\\\Users\\\\yuhuahui\\\\AppData\\\\Local\\\\Temp\\\\mcp-fs-demo\\\\README.md\"}"}
|
||||
{"ts":"2026-04-22T01:00:43.759Z","turn":1,"role":"assistant_final","content":"**Files in the directory:** a.txt, b.txt, README.md\n\n**README.md summary:** This is a sample README file.","usage":{"prompt_tokens":2619,"completion_tokens":29,"total_tokens":2648,"prompt_cache_hit_tokens":2560,"prompt_cache_miss_tokens":59},"cost":0.00022703000000000003,"model":"deepseek-chat","prefixHash":"6a7fff6a15fd5def"}
|
||||
{"ts":"2026-04-22T01:00:43.759Z","turn":1,"role":"done","content":"**Files in the directory:** a.txt, b.txt, README.md\n\n**README.md summary:** This is a sample README file."}
|
||||
@@ -0,0 +1,12 @@
|
||||
{"role":"_meta","meta":{"version":1,"source":"reasonix run","model":"deepseek-chat","startedAt":"2026-04-22T01:39:54.789Z"}}
|
||||
{"ts":"2026-04-22T01:39:54.790Z","turn":1,"role":"user","content":"First use the add tool to compute 17+25, then use write_file to save the result to a file called answer.txt in the current working directory."}
|
||||
{"ts":"2026-04-22T01:39:58.843Z","turn":1,"role":"assistant_final","content":"I'll help you with that. First, I'll compute 17+25 using the add tool, then write the result to answer.txt.","usage":{"prompt_tokens":2404,"completion_tokens":87,"total_tokens":2491,"prompt_cache_hit_tokens":256,"prompt_cache_miss_tokens":2148},"cost":0.0006935800000000001,"model":"deepseek-chat","prefixHash":"ea71560eab18d572"}
|
||||
{"ts":"2026-04-22T01:39:58.844Z","turn":1,"role":"tool","content":"42","tool":"demo_add","args":"{\"a\": 17, \"b\": 25}"}
|
||||
{"ts":"2026-04-22T01:40:02.898Z","turn":1,"role":"assistant_final","content":"Now I'll write the result (42) to a file called answer.txt in the current working directory:","usage":{"prompt_tokens":2509,"completion_tokens":81,"total_tokens":2590,"prompt_cache_hit_tokens":2432,"prompt_cache_miss_tokens":77},"cost":0.00028013,"model":"deepseek-chat","prefixHash":"ea71560eab18d572"}
|
||||
{"ts":"2026-04-22T01:40:02.900Z","turn":1,"role":"tool","content":"ERROR: Access denied - path outside allowed directories: F:\\Reasonix\\answer.txt not in C:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo","tool":"fs_write_file","args":"{\"path\": \"answer.txt\", \"content\": \"42\"}"}
|
||||
{"ts":"2026-04-22T01:40:05.263Z","turn":1,"role":"assistant_final","content":"I need to check which directories are allowed first. Let me check the allowed directories:","usage":{"prompt_tokens":2648,"completion_tokens":48,"total_tokens":2696,"prompt_cache_hit_tokens":2560,"prompt_cache_miss_tokens":88},"cost":0.00025576,"model":"deepseek-chat","prefixHash":"ea71560eab18d572"}
|
||||
{"ts":"2026-04-22T01:40:05.270Z","turn":1,"role":"tool","content":"Allowed directories:\nC:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo","tool":"fs_list_allowed_directories","args":"{}"}
|
||||
{"ts":"2026-04-22T01:40:09.422Z","turn":1,"role":"assistant_final","content":"Now I'll write the file to the allowed directory:","usage":{"prompt_tokens":2738,"completion_tokens":94,"total_tokens":2832,"prompt_cache_hit_tokens":2624,"prompt_cache_miss_tokens":114},"cost":0.00031786,"model":"deepseek-chat","prefixHash":"ea71560eab18d572"}
|
||||
{"ts":"2026-04-22T01:40:09.426Z","turn":1,"role":"tool","content":"Successfully wrote to C:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo\\answer.txt","tool":"fs_write_file","args":"{\"path\": \"C:\\\\Users\\\\yuhuahui\\\\AppData\\\\Local\\\\Temp\\\\mcp-fs-demo\\\\answer.txt\", \"content\": \"42\"}"}
|
||||
{"ts":"2026-04-22T01:40:13.689Z","turn":1,"role":"assistant_final","content":"Perfect! I've completed both tasks:\n\n1. **Computed 17+25**: The result is 42\n2. **Saved to answer.txt**: Created the file `answer.txt` in the allowed directory with the content \"42\"\n\nThe file has been successfully written to `C:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo\\answer.txt`.","usage":{"prompt_tokens":2878,"completion_tokens":83,"total_tokens":2961,"prompt_cache_hit_tokens":2816,"prompt_cache_miss_tokens":62},"cost":0.00030516,"model":"deepseek-chat","prefixHash":"ea71560eab18d572"}
|
||||
{"ts":"2026-04-22T01:40:13.689Z","turn":1,"role":"done","content":"Perfect! I've completed both tasks:\n\n1. **Computed 17+25**: The result is 42\n2. **Saved to answer.txt**: Created the file `answer.txt` in the allowed directory with the content \"42\"\n\nThe file has been successfully written to `C:\\Users\\yuhuahui\\AppData\\Local\\Temp\\mcp-fs-demo\\answer.txt`."}
|
||||
@@ -0,0 +1,11 @@
|
||||
{"role":"_meta","meta":{"version":1,"source":"bench/baseline","model":"deepseek-chat","task":"t01_address_happy","mode":"baseline","repeat":1,"startedAt":"2026-04-21T13:21:57.995Z"}}
|
||||
{"ts":"2026-04-21T13:22:00.112Z","turn":1,"role":"user","content":"Hi, I need to update the shipping address for my order o_1002."}
|
||||
{"ts":"2026-04-21T13:22:03.142Z","turn":1,"role":"assistant_final","content":"I can help you update the shipping address for your order. First, I need to verify your identity. Could you please provide your name and order ID? You've already given me order ID o_1002, but I also need your name to proceed with the address update.","usage":{"prompt_tokens":733,"completion_tokens":56,"total_tokens":789,"prompt_cache_hit_tokens":64,"prompt_cache_miss_tokens":669},"cost":0.00024671000000000003,"model":"deepseek-chat"}
|
||||
{"ts":"2026-04-21T13:22:04.688Z","turn":2,"role":"user","content":"My name is Bo Wang."}
|
||||
{"ts":"2026-04-21T13:22:10.465Z","turn":2,"role":"assistant_final","content":"Thank you, Bo Wang. Let me first look up your order o_1002 to verify the details and check its current status.","usage":{"prompt_tokens":799,"completion_tokens":74,"total_tokens":873,"prompt_cache_hit_tokens":64,"prompt_cache_miss_tokens":735},"cost":0.00028433000000000006,"model":"deepseek-chat"}
|
||||
{"ts":"2026-04-21T13:22:10.465Z","turn":2,"role":"tool","content":"{\"orderId\":\"o_1002\",\"userId\":\"u_bo\",\"status\":\"processing\",\"address\":\"22 Oak Rd, NYC, NY 10001\",\"item\":\"running shoes 10\",\"price\":140}","tool":"lookup_order","args":"{\"orderId\": \"o_1002\"}"}
|
||||
{"ts":"2026-04-21T13:22:10.465Z","turn":2,"role":"assistant_final","content":"Great! I can see your order o_1002 is currently in \"processing\" status, which means I can update the shipping address. What would you like the new shipping address to be?","usage":{"prompt_tokens":932,"completion_tokens":39,"total_tokens":971,"prompt_cache_hit_tokens":832,"prompt_cache_miss_tokens":100},"cost":0.00012814,"model":"deepseek-chat"}
|
||||
{"ts":"2026-04-21T13:22:11.830Z","turn":3,"role":"user","content":"Please change the shipping address to 5 Birch Rd, NYC, NY 10001."}
|
||||
{"ts":"2026-04-21T13:22:19.185Z","turn":3,"role":"assistant_final","content":"Perfect! I'll update the shipping address for your order o_1002 from \"22 Oak Rd, NYC, NY 10001\" to \"5 Birch Rd, NYC, NY 10001\".","usage":{"prompt_tokens":993,"completion_tokens":112,"total_tokens":1105,"prompt_cache_hit_tokens":64,"prompt_cache_miss_tokens":929},"cost":0.00037851,"model":"deepseek-chat"}
|
||||
{"ts":"2026-04-21T13:22:19.185Z","turn":3,"role":"tool","content":"{\"ok\":true,\"orderId\":\"o_1002\",\"newAddress\":\"5 Birch Rd, NYC, NY 10001\"}","tool":"update_address","args":"{\"orderId\": \"o_1002\", \"address\": \"5 Birch Rd, NYC, NY 10001\"}"}
|
||||
{"ts":"2026-04-21T13:22:19.185Z","turn":3,"role":"assistant_final","content":"Success! I've updated the shipping address for your order o_1002 to \"5 Birch Rd, NYC, NY 10001\". Your order is still in processing status, and the new address will be used for shipping. Is there anything else I can help you with?","usage":{"prompt_tokens":1149,"completion_tokens":56,"total_tokens":1205,"prompt_cache_hit_tokens":1088,"prompt_cache_miss_tokens":61},"cost":0.00015423000000000002,"model":"deepseek-chat"}
|
||||
@@ -0,0 +1,45 @@
|
||||
# Transcript diff: baseline vs reasonix
|
||||
|
||||
## Meta
|
||||
|
||||
| | baseline | reasonix |
|
||||
|---|---|---|
|
||||
| source | bench/baseline | bench/reasonix |
|
||||
| model | deepseek-chat | deepseek-chat |
|
||||
| task | t01_address_happy | t01_address_happy |
|
||||
| startedAt | 2026-04-21T13:21:57.995Z | 2026-04-21T13:22:21.292Z |
|
||||
|
||||
## Summary
|
||||
|
||||
| metric | baseline | reasonix | delta |
|
||||
|---|---:|---:|---:|
|
||||
| model calls | 5 | 6 | +1 |
|
||||
| user turns | 3 | 3 | 0 |
|
||||
| tool calls | 2 | 3 | +1 |
|
||||
| cache hit | 45.9% | 93.9% | **+48.0pp** |
|
||||
| cost (USD) | $0.001192 | $0.000953 | -20.1% |
|
||||
| prefix hashes | 0 | 1 | — |
|
||||
|
||||
## Turn-by-turn
|
||||
|
||||
| turn | kind | baseline tool calls | reasonix tool calls | note |
|
||||
|---:|:---:|---|---|---|
|
||||
| 1 | diverge | — | lookup_order | tool calls differ: A=[—] B=[lookup_order] |
|
||||
| 2 | diverge | lookup_order | lookup_user | tool calls differ: A=[lookup_order] B=[lookup_user] |
|
||||
| 3 | diverge | update_address | update_address | text similarity 68% |
|
||||
|
||||
## First divergence (turn 1)
|
||||
|
||||
tool calls differ: A=[—] B=[lookup_order]
|
||||
|
||||
**baseline:**
|
||||
|
||||
```
|
||||
I can help you update the shipping address for your order. First, I need to verify your identity. Could you please provide your name and order ID? You've already given me order ID o_1002, but I also need your name to proceed with the address update.
|
||||
```
|
||||
|
||||
**reasonix:**
|
||||
|
||||
```
|
||||
Great! I can see order o_1002 is in "processing" status, which means I can update the shipping address. However, I still need to verify your identity. Could you please provide your name so I can look up your user information using the user ID associated with this order?
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
{"role":"_meta","meta":{"version":1,"source":"bench/reasonix","model":"deepseek-chat","task":"t01_address_happy","mode":"reasonix","repeat":1,"startedAt":"2026-04-21T13:22:21.292Z"}}
|
||||
{"ts":"2026-04-21T13:22:22.687Z","turn":1,"role":"user","content":"Hi, I need to update the shipping address for my order o_1002."}
|
||||
{"ts":"2026-04-21T13:22:27.201Z","turn":1,"role":"assistant_final","content":"I can help you update the shipping address for your order o_1002. First, I need to verify your identity. Could you please provide your name and order ID? I'll look up your order to check its current status and verify the details.","usage":{"prompt_tokens":713,"completion_tokens":98,"total_tokens":811,"prompt_cache_hit_tokens":704,"prompt_cache_miss_tokens":9},"cost":0.00015951000000000002,"model":"deepseek-chat","prefixHash":"fcb40cfd555bf805"}
|
||||
{"ts":"2026-04-21T13:22:27.201Z","turn":1,"role":"tool","content":"{\"orderId\":\"o_1002\",\"userId\":\"u_bo\",\"status\":\"processing\",\"address\":\"22 Oak Rd, NYC, NY 10001\",\"item\":\"running shoes 10\",\"price\":140}","tool":"lookup_order","args":"{\"orderId\": \"o_1002\"}"}
|
||||
{"ts":"2026-04-21T13:22:30.465Z","turn":1,"role":"assistant_final","content":"Great! I can see order o_1002 is in \"processing\" status, which means I can update the shipping address. However, I still need to verify your identity. Could you please provide your name so I can look up your user information using the user ID associated with this order?","usage":{"prompt_tokens":870,"completion_tokens":59,"total_tokens":929,"prompt_cache_hit_tokens":768,"prompt_cache_miss_tokens":102},"cost":0.00014620000000000003,"model":"deepseek-chat","prefixHash":"fcb40cfd555bf805"}
|
||||
{"ts":"2026-04-21T13:22:30.465Z","turn":1,"role":"done","content":"Great! I can see order o_1002 is in \"processing\" status, which means I can update the shipping address. However, I still need to verify your identity. Could you please provide your name so I can look up your user information using the user ID associated with this order?"}
|
||||
{"ts":"2026-04-21T13:22:31.801Z","turn":2,"role":"user","content":"My name is Bo Wang."}
|
||||
{"ts":"2026-04-21T13:22:34.932Z","turn":2,"role":"assistant_final","content":"Perfect, thank you Bo Wang. Let me verify your identity by looking up your user information.","usage":{"prompt_tokens":939,"completion_tokens":64,"total_tokens":1003,"prompt_cache_hit_tokens":896,"prompt_cache_miss_tokens":43},"cost":0.00014473,"model":"deepseek-chat","prefixHash":"fcb40cfd555bf805"}
|
||||
{"ts":"2026-04-21T13:22:34.932Z","turn":2,"role":"tool","content":"{\"userId\":\"u_bo\",\"name\":\"Bo Wang\",\"email\":\"[email protected]\"}","tool":"lookup_user","args":"{\"userId\": \"u_bo\"}"}
|
||||
{"ts":"2026-04-21T13:22:38.670Z","turn":2,"role":"assistant_final","content":"Excellent! Your identity has been verified, Bo Wang. I can see your order o_1002 is currently in \"processing\" status with the shipping address \"22 Oak Rd, NYC, NY 10001\".\n\nWhat would you like the new shipping address to be? Please provide the complete new address so I can update it for you.","usage":{"prompt_tokens":1039,"completion_tokens":68,"total_tokens":1107,"prompt_cache_hit_tokens":960,"prompt_cache_miss_tokens":79},"cost":0.00016333000000000002,"model":"deepseek-chat","prefixHash":"fcb40cfd555bf805"}
|
||||
{"ts":"2026-04-21T13:22:38.670Z","turn":2,"role":"done","content":"Excellent! Your identity has been verified, Bo Wang. I can see your order o_1002 is currently in \"processing\" status with the shipping address \"22 Oak Rd, NYC, NY 10001\".\n\nWhat would you like the new shipping address to be? Please provide the complete new address so I can update it for you."}
|
||||
{"ts":"2026-04-21T13:22:41.867Z","turn":3,"role":"user","content":"Please change it to 5 Birch Rd, NYC, NY 10001."}
|
||||
{"ts":"2026-04-21T13:22:45.479Z","turn":3,"role":"assistant_final","content":"","usage":{"prompt_tokens":1127,"completion_tokens":72,"total_tokens":1199,"prompt_cache_hit_tokens":1088,"prompt_cache_miss_tokens":39},"cost":0.00016589000000000003,"model":"deepseek-chat","prefixHash":"fcb40cfd555bf805"}
|
||||
{"ts":"2026-04-21T13:22:45.479Z","turn":3,"role":"tool","content":"{\"ok\":true,\"orderId\":\"o_1002\",\"newAddress\":\"5 Birch Rd, NYC, NY 10001\"}","tool":"update_address","args":"{\"orderId\": \"o_1002\", \"address\": \"5 Birch Rd, NYC, NY 10001\"}"}
|
||||
{"ts":"2026-04-21T13:22:48.394Z","turn":3,"role":"assistant_final","content":"Perfect! I've successfully updated the shipping address for your order o_1002. The new address is now \"5 Birch Rd, NYC, NY 10001\". \n\nYour order is still in processing status and will be shipped to this new address. Is there anything else I can help you with today?","usage":{"prompt_tokens":1243,"completion_tokens":62,"total_tokens":1305,"prompt_cache_hit_tokens":1152,"prompt_cache_miss_tokens":91},"cost":0.00017341000000000004,"model":"deepseek-chat","prefixHash":"fcb40cfd555bf805"}
|
||||
{"ts":"2026-04-21T13:22:48.394Z","turn":3,"role":"done","content":"Perfect! I've successfully updated the shipping address for your order o_1002. The new address is now \"5 Birch Rd, NYC, NY 10001\". \n\nYour order is still in processing status and will be shipped to this new address. Is there anything else I can help you with today?"}
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Task and result types for the tool-use eval harness.
|
||||
*
|
||||
* Scope note: this is NOT a full port of Sierra's τ-bench (airline+retail).
|
||||
* We mirror its *shape* — multi-turn tool-use with an LLM user simulator and
|
||||
* DB-end-state success predicates — so a later port can drop real tasks in
|
||||
* without changing the harness. Until then, see `tasks.ts` for our seed set.
|
||||
*/
|
||||
|
||||
import type { ToolDefinition } from "../../src/index.js";
|
||||
|
||||
/**
|
||||
* The mutable world state a task's tools operate on. Tasks deep-clone this
|
||||
* into a per-run snapshot so runs don't leak state across each other.
|
||||
*/
|
||||
export interface WorldState {
|
||||
[table: string]: Record<string, Record<string, unknown>>;
|
||||
}
|
||||
|
||||
export interface UserPersona {
|
||||
/** Who the user is roleplaying (e.g. "frustrated customer"). */
|
||||
style: string;
|
||||
/** The concrete goal. The user pursues this until it's met or clearly refused. */
|
||||
goal: string;
|
||||
/**
|
||||
* Facts the simulator may reveal when the agent asks. Keep tight — the
|
||||
* user shouldn't volunteer everything up front.
|
||||
*/
|
||||
knowns: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tool factory. We take a factory (not a ToolDefinition directly) because
|
||||
* each run needs a fresh closure over its per-run WorldState — otherwise all
|
||||
* runs would share (and mutate) the same DB.
|
||||
*/
|
||||
export type ToolFactory = (db: WorldState) => ToolDefinition;
|
||||
|
||||
export interface TaskDefinition {
|
||||
id: string;
|
||||
/** One-line human description. Not shown to the model. */
|
||||
description: string;
|
||||
/** System prompt given to the agent. Kept small so cache-hit ratio is comparable. */
|
||||
systemPrompt: string;
|
||||
/** Tools built fresh per run against the run's DB snapshot. */
|
||||
tools: ToolFactory[];
|
||||
/** Initial DB snapshot. Deep-cloned per run. */
|
||||
initialDb: WorldState;
|
||||
/** Persona + goal for the LLM user simulator. */
|
||||
user: UserPersona;
|
||||
/** Max turns of (user → agent) before we give up and mark fail. */
|
||||
maxTurns?: number;
|
||||
/**
|
||||
* Success predicate. Given the end-state DB (and optionally the final
|
||||
* agent utterance), return true iff the task is considered solved.
|
||||
*/
|
||||
check: (ctx: { db: WorldState; finalAgentMessage: string; transcript: Turn[] }) => boolean;
|
||||
}
|
||||
|
||||
export interface Turn {
|
||||
role: "user" | "agent" | "tool";
|
||||
content: string;
|
||||
toolName?: string;
|
||||
}
|
||||
|
||||
export type RunMode = "baseline" | "reasonix";
|
||||
|
||||
export interface RunResult {
|
||||
taskId: string;
|
||||
mode: RunMode;
|
||||
pass: boolean;
|
||||
turns: number;
|
||||
toolCalls: number;
|
||||
cacheHitRatio: number;
|
||||
costUsd: number;
|
||||
claudeEquivalentUsd: number;
|
||||
promptTokens: number;
|
||||
completionTokens: number;
|
||||
/** True if the run aborted before the user sim decided to stop. */
|
||||
truncated: boolean;
|
||||
finalAgentMessage: string;
|
||||
errorMessage?: string;
|
||||
}
|
||||
|
||||
export interface BenchMeta {
|
||||
date: string;
|
||||
model: string;
|
||||
userSimModel: string;
|
||||
taskCount: number;
|
||||
repeatsPerTask: number;
|
||||
/** Reasonix version written into the report for reproducibility. */
|
||||
reasonixVersion: string;
|
||||
}
|
||||
|
||||
export interface BenchReport {
|
||||
meta: BenchMeta;
|
||||
results: RunResult[];
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* LLM-backed user simulator for tool-use eval.
|
||||
*
|
||||
* A cheap V3 call that given (persona, goal, transcript so far) emits either
|
||||
* the user's next utterance or the literal sentinel `##STOP##` to end the
|
||||
* conversation. Kept intentionally small and low-temperature so dialogue
|
||||
* stays on-task and is replayable.
|
||||
*
|
||||
* We accept "some" non-determinism (DeepSeek samples at T=0.1) — the honest
|
||||
* way to deal with run-to-run drift is repeat-per-task in the runner, not
|
||||
* trying to pretend the sim is deterministic.
|
||||
*/
|
||||
|
||||
import type { ChatMessage, DeepSeekClient } from "../../src/index.js";
|
||||
import type { Turn, UserPersona } from "./types.js";
|
||||
|
||||
const SYS = `You are roleplaying a user contacting a retail support agent.
|
||||
Rules:
|
||||
- Stay in character; never break the fourth wall.
|
||||
- Never reveal you are an AI or mention any system.
|
||||
- Pursue the goal. Do not volunteer facts the agent hasn't asked for.
|
||||
- Keep replies to one or two sentences.
|
||||
- When the goal is clearly met OR clearly refused by the agent, output ONLY the literal token: ##STOP##
|
||||
- Do not output ##STOP## on your first message — give the agent a chance.`;
|
||||
|
||||
export interface UserSimOptions {
|
||||
model?: string;
|
||||
temperature?: number;
|
||||
}
|
||||
|
||||
export class UserSimulator {
|
||||
constructor(
|
||||
private client: DeepSeekClient,
|
||||
private persona: UserPersona,
|
||||
private opts: UserSimOptions = {},
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Given the transcript so far, produce the user's next line, or null if
|
||||
* the simulator decided the conversation is over.
|
||||
*/
|
||||
async next(transcript: Turn[]): Promise<string | null> {
|
||||
const knowns = JSON.stringify(this.persona.knowns, null, 2);
|
||||
const messages: ChatMessage[] = [
|
||||
{
|
||||
role: "system",
|
||||
content: `${SYS}\n\nCharacter: ${this.persona.style}\nGoal: ${this.persona.goal}\nFacts you may share when asked (don't volunteer):\n${knowns}`,
|
||||
},
|
||||
];
|
||||
|
||||
if (transcript.length === 0) {
|
||||
messages.push({
|
||||
role: "user",
|
||||
content:
|
||||
"Write your opening message to the support agent. One or two sentences. Do not dump all the facts.",
|
||||
});
|
||||
} else {
|
||||
messages.push({
|
||||
role: "user",
|
||||
content: `Here is the conversation so far (you are the USER).\n\n${transcriptToString(
|
||||
transcript,
|
||||
)}\n\nWrite ONLY your next user reply, or output ##STOP## if the goal is clearly met or clearly refused.`,
|
||||
});
|
||||
}
|
||||
|
||||
const resp = await this.client.chat({
|
||||
model: this.opts.model ?? "deepseek-chat",
|
||||
messages,
|
||||
temperature: this.opts.temperature ?? 0.1,
|
||||
maxTokens: 200,
|
||||
});
|
||||
const text = resp.content.trim();
|
||||
if (!text) return null;
|
||||
if (text === "##STOP##" || text.endsWith("##STOP##") || text.includes("##STOP##")) return null;
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
function transcriptToString(turns: Turn[]): string {
|
||||
const lines: string[] = [];
|
||||
for (const t of turns) {
|
||||
if (t.role === "user") lines.push(`USER: ${t.content}`);
|
||||
else if (t.role === "agent") lines.push(`AGENT: ${t.content}`);
|
||||
else if (t.role === "tool")
|
||||
lines.push(`(tool ${t.toolName} returned: ${truncate(t.content, 200)})`);
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
function truncate(s: string, n: number): string {
|
||||
return s.length > n ? `${s.slice(0, n)}…` : s;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"organizeImports": { "enabled": true },
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 2,
|
||||
"lineWidth": 100
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": { "quoteStyle": "double", "semicolons": "always", "trailingCommas": "all" }
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"style": {
|
||||
"noNonNullAssertion": "off",
|
||||
"useImportType": "warn"
|
||||
},
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
"ignore": ["dist", "node_modules", "coverage", "*.d.ts"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
# Reasonix Architecture
|
||||
|
||||
## Design philosophy
|
||||
|
||||
Reasonix is **opinionated, not general**. Every abstraction is justified by a
|
||||
DeepSeek-specific behavior or economic property. If it's generic, we don't
|
||||
ship it.
|
||||
|
||||
The product north star: **coding agent that stays cheap enough to leave on**.
|
||||
A tool that quietly burns $200/month on a background project is one nobody
|
||||
uses. Every subsystem below is answerable to that goal.
|
||||
|
||||
## The four pillars
|
||||
|
||||
### Pillar 1 — Cache-First Loop
|
||||
|
||||
**Problem.** DeepSeek bills cached input at ~10% of the miss rate. Automatic
|
||||
prefix caching activates only when the *exact* byte prefix of the previous
|
||||
request matches. Most agent loops reorder, rewrite, or inject fresh
|
||||
timestamps each turn — cache hit rate in practice: <20%.
|
||||
|
||||
**Solution.** Partition the context into three regions:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────┐
|
||||
│ IMMUTABLE PREFIX │ ← fixed for session
|
||||
│ system + tool_specs + few_shots │ cache hit candidate
|
||||
├─────────────────────────────────────────┤
|
||||
│ APPEND-ONLY LOG │ ← grows monotonically
|
||||
│ [assistant₁][tool₁][assistant₂]... │ preserves prefix of prior turns
|
||||
├─────────────────────────────────────────┤
|
||||
│ VOLATILE SCRATCH │ ← reset each turn
|
||||
│ R1 thought, transient plan state │ never sent upstream
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Invariants:**
|
||||
1. Prefix is computed once per session, hashed, and pinned.
|
||||
2. Log entries are serialized in append order; no rewrites.
|
||||
3. Scratch is distilled via Pillar 2 before any information from it is folded
|
||||
into the log.
|
||||
|
||||
**Metric.** `prompt_cache_hit_tokens / (hit + miss)` exposed per-turn and
|
||||
aggregated per-session. Visible in the TUI's top-bar cache cell.
|
||||
|
||||
### Pillar 2 — R1 Thought Harvesting *(opt-in)*
|
||||
|
||||
**Problem.** R1 / V4-thinking emits extensive `reasoning_content`. DeepSeek's
|
||||
own docs recommend *not* feeding it back to the next turn. Most frameworks
|
||||
display it to the user and discard. The planning signal inside is lost.
|
||||
|
||||
**Solution.** A two-stage process:
|
||||
|
||||
```
|
||||
R1 output → Harvester (v4-flash, thinking off) → TypedPlanState
|
||||
├─ subgoals: string[]
|
||||
├─ hypotheses: string[]
|
||||
├─ uncertainties: string[]
|
||||
└─ rejectedPaths: string[]
|
||||
```
|
||||
|
||||
The harvester is a cheap flash call with a strict JSON schema. Output is
|
||||
validated at runtime. **Not enabled in any preset** (see Pillar 4) — the
|
||||
additional round-trip rarely pays back, so it's `/harvest on` opt-in.
|
||||
|
||||
### Pillar 3 — Tool-Call Repair
|
||||
|
||||
**Problem.** Empirical DeepSeek failure modes:
|
||||
- Tool-call JSON emitted inside `<think>`, missing from the final message.
|
||||
- Arguments dropped when schema has >10 params or deeply nested objects.
|
||||
- Same tool called repeatedly with identical args (call-storm).
|
||||
- Truncated JSON due to `max_tokens` hit mid-structure.
|
||||
|
||||
**Solution.** Four passes:
|
||||
|
||||
1. **`flatten`** — schemas with >10 leaf params or depth >2 are auto-detected
|
||||
on `ToolRegistry.register()` and presented to the model in dot-notation
|
||||
form. `dispatch()` re-nests the args before calling the user's `fn`.
|
||||
2. **`scavenge`** — regex + JSON parser sweeps `reasoning_content` for any tool
|
||||
call the model forgot to emit in `tool_calls`.
|
||||
3. **`truncation`** — detect unbalanced JSON and repair by closing braces or
|
||||
requesting a continuation completion.
|
||||
4. **`storm`** — identical `(tool, args)` tuple within a sliding window →
|
||||
suppress the call, inject a reflection turn.
|
||||
|
||||
### Pillar 4 — Cost Control *(v0.6)*
|
||||
|
||||
**Problem.** Coding agents that default to the frontier model (v4-pro, ~12×
|
||||
flash cost) and accumulate full tool results in context are $150-$250/month
|
||||
for active users. Most turns don't need frontier reasoning; most sessions
|
||||
re-pay for tool results that were only useful once.
|
||||
|
||||
**Solution.** Four complementary mechanisms, none of which require manual
|
||||
tuning in the common case:
|
||||
|
||||
#### 4.1 Tiered defaults (flash-first)
|
||||
|
||||
The three presets now trade only **model tier** and **reasoning effort**:
|
||||
|
||||
| Preset | Model | Effort | Harvest | Branch | Cost |
|
||||
|---|---|---|---|---|---:|
|
||||
| `fast` | `v4-flash` | `high` | off | 1 | 1× |
|
||||
| `smart` (default) | `v4-flash` | `max` | off | 1 | ~1.5× |
|
||||
| `max` | `v4-pro` | `max` | off | 1 | ~12× |
|
||||
|
||||
**Branching and harvest are never in a preset.** Both multiply cost and
|
||||
rarely pay back; `/branch N` and `/harvest on` are pure opt-ins. A user can
|
||||
run for weeks without ever touching them.
|
||||
|
||||
All auxiliary calls — `forceSummaryAfterIterLimit`, subagent spawns,
|
||||
truncation repair retries — hard-code `v4-flash + effort=high` regardless
|
||||
of the user's preset. There's no reason to pay pro rates for "paraphrase
|
||||
these tool results into prose" or for an `explore` subagent's grep chain.
|
||||
|
||||
#### 4.2 Turn-end auto-compaction
|
||||
|
||||
Every tool result in the log exceeding `TURN_END_RESULT_CAP_TOKENS` (3000)
|
||||
is shrunk to that cap when a turn ends. The model had the full text for
|
||||
the turn that read it; subsequent turns see a compact summary and can
|
||||
re-read if needed. One extra `read_file` call is vastly cheaper than
|
||||
dragging 12KB through every future prompt.
|
||||
|
||||
A proactive 40% context-ratio threshold runs the same shrink pre-emptively
|
||||
inside long multi-iter turns before the 80% emergency threshold fires.
|
||||
|
||||
#### 4.3 `/pro` single-turn arming
|
||||
|
||||
Users who predict a hard task type `/pro`; the **next** turn runs on
|
||||
`v4-pro`, then auto-disarms. No preset churn, no forgotten revert. Armed
|
||||
state is visible as a yellow `⇧ pro armed` pill in the header.
|
||||
|
||||
#### 4.4 Failure-signal auto-escalation
|
||||
|
||||
The loop counts visible "flash is struggling" events per turn:
|
||||
- `edit_file` / `write_file` SEARCH-not-found errors
|
||||
- ToolCallRepair fires (scavenge / truncation-fix / storm-break)
|
||||
|
||||
Once the count hits `FAILURE_ESCALATION_THRESHOLD` (3), the **remainder of
|
||||
the current turn** runs on `v4-pro`. Announced via a yellow warning row —
|
||||
no silent cost surprises. Counter + escalation flag reset at every turn
|
||||
start.
|
||||
|
||||
Header shows a red `⇧ pro escalated` pill while the turn is on pro.
|
||||
|
||||
#### Cost transparency
|
||||
|
||||
Per-turn and session cost are colored in the StatsPanel:
|
||||
- `turn $0.003` — green <$0.05, yellow $0.05–0.20, red ≥$0.20
|
||||
- `session $0.12` — same scale ×10
|
||||
|
||||
## Module layout
|
||||
|
||||
```
|
||||
src/
|
||||
├── client.ts # DeepSeek client (fetch + SSE)
|
||||
├── loop.ts # Pillar 1 + 4 — CacheFirstLoop
|
||||
├── harvest.ts # Pillar 2 — flash-backed plan-state extraction
|
||||
├── repair/ # Pillar 3 pipeline
|
||||
│ ├── index.ts
|
||||
│ ├── scavenge.ts
|
||||
│ ├── flatten.ts
|
||||
│ ├── truncation.ts
|
||||
│ └── storm.ts
|
||||
├── prompt-fragments.ts # TUI_FORMATTING_RULES, NEGATIVE_CLAIM_RULE —
|
||||
│ # reused by main + subagent + skill prompts
|
||||
├── code/prompt.ts # reasonix code main system prompt
|
||||
├── tools/ # Tool implementations
|
||||
│ ├── filesystem.ts # read / list / search / edit / write
|
||||
│ ├── shell.ts # run_command + run_background (JobRegistry)
|
||||
│ ├── jobs.ts # background-process registry
|
||||
│ ├── memory.ts # remember / forget / list user memories
|
||||
│ ├── skills.ts # list + invoke SKILL.md playbooks
|
||||
│ ├── subagent.ts # spawn_subagent — flash+high by default
|
||||
│ ├── plan.ts # submit_plan (review gate)
|
||||
│ └── web.ts # web_search, web_fetch
|
||||
├── mcp/ # MCP client + bridge (stdio + SSE)
|
||||
├── memory.ts # ImmutablePrefix / AppendOnlyLog / VolatileScratch
|
||||
├── project-memory.ts # REASONIX.md loader
|
||||
├── user-memory.ts # ~/.reasonix/memory/ store (project + global)
|
||||
├── skills.ts # built-in explore + research skills
|
||||
├── session.ts # JSONL session persistence
|
||||
├── telemetry.ts # cost + cache-hit accounting + SessionSummary
|
||||
├── tokenizer.ts # DeepSeek V3 tokenizer (ported)
|
||||
├── usage.ts # ~/.reasonix/usage.jsonl roll-up
|
||||
├── types.ts # ChatMessage, ToolCall, ToolSpec
|
||||
├── index.ts # library barrel
|
||||
└── cli/
|
||||
├── index.ts # commander entry
|
||||
├── resolve.ts # config + CLI flag precedence
|
||||
├── commands/ # chat, code, run, stats, sessions, ...
|
||||
└── ui/
|
||||
├── App.tsx # root Ink component (~1984 LOC, was 2931)
|
||||
├── LiveRows.tsx # spinner rows (OngoingTool / Status / ...)
|
||||
├── EventLog.tsx # Historical row rendering
|
||||
├── StatsPanel.tsx # top bar + cost badges
|
||||
├── PromptInput.tsx # cursor-aware multi-line input
|
||||
├── PlanConfirm.tsx # submit_plan review modal
|
||||
├── ShellConfirm.tsx # run_command approval modal
|
||||
├── EditConfirm.tsx # per-edit review modal
|
||||
├── markdown.tsx # Ink-native markdown renderer
|
||||
├── edit-history.ts # EditHistoryEntry + formatters
|
||||
├── useEditHistory.ts # /undo, /history, /show state machine
|
||||
├── useCompletionPickers.ts # slash, @, slash-arg pickers
|
||||
├── useSessionInfo.ts # balance + models + updates fetch
|
||||
├── useSubagent.ts # subagent sink wiring
|
||||
└── slash/ # /-command implementation
|
||||
├── types.ts # SlashContext, SlashResult, ...
|
||||
├── commands.ts # SLASH_COMMANDS data + parse + suggest
|
||||
├── helpers.ts # git, memory, token formatters
|
||||
├── dispatch.ts # registry + handleSlash lookup
|
||||
└── handlers/ # per-topic: basic, mcp, memory,
|
||||
# skill, admin, observability, edits,
|
||||
# jobs, sessions, model (/pro lives here)
|
||||
```
|
||||
|
||||
Files kept small by design: the largest module under `cli/ui/` is 2K
|
||||
lines (App.tsx), every handler under `slash/handlers/` is ≤200 lines,
|
||||
every hook under `cli/ui/` is ≤310 lines. Adding a new slash command
|
||||
means editing one handler file and one registry line.
|
||||
|
||||
## Design evolution
|
||||
|
||||
- **v0.0.x** — Pillar 1 end-to-end, Pillar 3 complete, Ink TUI scaffold.
|
||||
- **v0.1** — τ-bench numbers published, streaming polish, transcript replay.
|
||||
- **v0.2** — Self-consistency / branch-budget sampling driven by plan state.
|
||||
- **v0.3** — MCP client (stdio + SSE), session persistence.
|
||||
- **v0.4.x** — `reasonix code` with SEARCH/REPLACE edits, review/auto
|
||||
gate, background jobs, hooks.
|
||||
- **v0.5.x** — V4 model support, skills, memory, subagents, actionable
|
||||
error messages.
|
||||
- **v0.6** *(current)* —
|
||||
- **Pillar 4 cost control** (flash-first defaults, auto-compaction,
|
||||
`/pro` one-shot, failure-triggered escalation, cost badges).
|
||||
- `deepseek-chat` / `deepseek-reasoner` scheduled for deprecation —
|
||||
all user-facing surfaces updated to `v4-flash` / `v4-pro`.
|
||||
- `branch` + `harvest` removed from every preset; manual opt-in only.
|
||||
- Shared prompt fragments (`TUI_FORMATTING_RULES`, `NEGATIVE_CLAIM_RULE`).
|
||||
- UI refactor: App.tsx split into 6 hooks/components, slash.ts split
|
||||
into 13 per-topic modules.
|
||||
|
||||
## Explicit non-goals
|
||||
|
||||
- Multi-agent orchestration as a first-class concept (subagents are a
|
||||
cost-reduction mechanism, not a coordination primitive).
|
||||
- RAG / vector retrieval.
|
||||
- Support for non-DeepSeek backends (an OpenAI-compatible shim would
|
||||
work today via `--model` override, but is not tested).
|
||||
- Web UI / SaaS.
|
||||
- Automatic cost escalation without user-visible announcement. Every
|
||||
pro-tier model call is surfaced; silent escalation was considered
|
||||
and rejected.
|
||||
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<defs>
|
||||
<linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" stop-color="#5eead4"/>
|
||||
<stop offset="50%" stop-color="#93c5fd"/>
|
||||
<stop offset="100%" stop-color="#c4b5fd"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="64" height="64" rx="12" fill="#0a0d14"/>
|
||||
<path d="M 32,10 L 54,32 L 32,54 L 10,32 Z" fill="none" stroke="url(#g)" stroke-width="3" stroke-linejoin="round"/>
|
||||
<path d="M 32,21 L 43,32 L 32,43 L 21,32 Z" fill="url(#g)" opacity="0.9"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 568 B |
@@ -0,0 +1,406 @@
|
||||
// Reasonix landing — i18n auto-switch (en / zh).
|
||||
// Detection precedence: ?lang=xx → localStorage → navigator.language → "en".
|
||||
// Falls back gracefully when localStorage is unavailable (private mode, etc).
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const STORAGE_KEY = "reasonix.lang";
|
||||
const DEFAULT_LANG = "en";
|
||||
const SUPPORTED = ["en", "zh"];
|
||||
|
||||
const translations = {
|
||||
en: {
|
||||
"nav.features": "Features",
|
||||
"nav.quickstart": "Quick start",
|
||||
"nav.benchmarks": "Benchmarks",
|
||||
"nav.github": "GitHub",
|
||||
|
||||
"hero.badge": "v0.6 · DeepSeek V4 · cache-first",
|
||||
"hero.title.line1": "DeepSeek-native",
|
||||
"hero.title.line2": "AI coding agent in your terminal",
|
||||
"hero.sub":
|
||||
"Cache-first agent loop for DeepSeek V4 (flash + pro). Edits files as reviewable SEARCH/REPLACE blocks. Ink TUI. MCP first-class. No LangChain.",
|
||||
"hero.copy": "Copy",
|
||||
"hero.copy.done": "Copied",
|
||||
"hero.cta.start": "Get started →",
|
||||
"hero.cta.star": "Star on GitHub",
|
||||
"hero.stat.cache": "prefix cache hit rate",
|
||||
"hero.stat.cost": "cheaper vs Claude Sonnet 4.6",
|
||||
"hero.stat.pass": "τ-bench-lite pass rate",
|
||||
|
||||
"term.user":
|
||||
"users.ts findByEmail is case-sensitive — login fails for users with uppercase emails",
|
||||
"term.found":
|
||||
"▸ Found it. findByEmail uses === directly. Switch to lowercase normalization.",
|
||||
"term.pending": "▸ 1 pending edit · /apply to write · /discard to drop",
|
||||
|
||||
"why.title": "Why Reasonix",
|
||||
"why.sub":
|
||||
"Every abstraction earns its weight against a DeepSeek-specific property — dirt-cheap tokens, R1 traces, automatic prefix caching, JSON mode. Generic wrappers leave these on the table.",
|
||||
"why.cache.title": "Cache-first loop",
|
||||
"why.cache.body":
|
||||
"Append-only conversation log keeps the prompt prefix byte-stable across turns, so DeepSeek's automatic cache hits 85–95% — not 40%.",
|
||||
"why.cost.title": "Cost is a pillar",
|
||||
"why.cost.body":
|
||||
"Flash-first defaults, turn-end auto-compaction, model self-escalation when (and only when) needed. Per-turn cost badge in the TUI.",
|
||||
"why.tui.title": "Ink TUI, no web",
|
||||
"why.tui.body":
|
||||
"Lives in your terminal. Streaming preview, slash commands, plan picker, edit-confirm modal. Plain mode for stubborn Windows shells.",
|
||||
"why.mcp.title": "MCP first-class",
|
||||
"why.mcp.body":
|
||||
"Stdio + HTTP+SSE transports. Live progress notifications. Same cache-safety + repair plumbing as native tools.",
|
||||
"why.safe.title": "Reviewable edits",
|
||||
"why.safe.body":
|
||||
"Edits arrive as SEARCH/REPLACE blocks; nothing hits disk until /apply. Per-file diff confirm modal, undo history, sandboxed paths.",
|
||||
"why.ctx.title": "1M-token aware",
|
||||
"why.ctx.body":
|
||||
"Context gauge with proactive compaction, oversized tool-result repair, forced-summary fallback near the window edge.",
|
||||
|
||||
"qs.title": "Quick start (60 seconds)",
|
||||
"qs.step1.title": "Get a DeepSeek API key",
|
||||
"qs.step1.body":
|
||||
'Free credit on signup at <a href="https://platform.deepseek.com/api_keys" target="_blank" rel="noopener">platform.deepseek.com</a>.',
|
||||
"qs.step2.title": "Point it at a project",
|
||||
"qs.step2.body": "No install needed.",
|
||||
"qs.step2.note":
|
||||
"First run walks you through a 30-second wizard (paste API key → pick preset → pick MCP servers).",
|
||||
"qs.step3.title": "Ask it to edit",
|
||||
"qs.step3.body":
|
||||
"The model proposes edits as SEARCH/REPLACE blocks — nothing hits disk until you <code>/apply</code>.",
|
||||
"qs.req":
|
||||
"Requires Node ≥ 20.10. macOS, Linux, Windows (PowerShell · Git Bash · Windows Terminal). Press <kbd>Esc</kbd> anytime to abort; <code>/help</code> for the full command list.",
|
||||
|
||||
"feat.title": "In the box",
|
||||
"feat.code.title": "Pair programmer mode",
|
||||
"feat.code.body":
|
||||
"<code>read_file</code> · <code>write_file</code> · <code>edit_file</code> · <code>search_files</code> · <code>directory_tree</code> · <code>run_command</code> with read-only allowlist. Sandboxed to the launch root — no path escapes. Plan mode and per-edit review modal.",
|
||||
"feat.memory.title": "Two-layer memory",
|
||||
"feat.memory.body":
|
||||
"Committable <code>REASONIX.md</code> for team conventions plus a private per-user <code>~/.reasonix/memory/</code> with global and per-project scopes. The model can write to it via the <code>remember</code> tool.",
|
||||
"feat.skills.title": "User-authored prompt packs",
|
||||
"feat.skills.body":
|
||||
"Drop <code>SKILL.md</code> files anywhere. Names + descriptions are pinned in the prefix; the model picks them autonomously, or you trigger with <code>/skill name</code>.",
|
||||
"feat.hooks.title": "Lifecycle hooks",
|
||||
"feat.hooks.body":
|
||||
"Shell commands fire at <code>PreToolUse</code> · <code>PostToolUse</code> · <code>UserPromptSubmit</code> · <code>Stop</code>. Exit code drives pass / block / warn.",
|
||||
"feat.mcp.title": "Bring your own tools",
|
||||
"feat.mcp.body":
|
||||
'Wizard catalog, or <code>--mcp "name=cmd"</code> to attach stdio / HTTP+SSE servers on the fly. Live progress bars on long calls.',
|
||||
"feat.web.title": "Web search built-in",
|
||||
"feat.web.body":
|
||||
"<code>web_search</code> + <code>web_fetch</code> via Mojeek — no key, no signup, off-by-flag for offline / CI. Bring-your-own provider via the <code>WebSearchProvider</code> interface.",
|
||||
|
||||
"bench.title": "Verify the cache claim yourself",
|
||||
"bench.sub":
|
||||
"On the same τ-bench-lite workload (8 multi-turn tool-use tasks × 3 repeats = 48 runs per side), live DeepSeek <code>deepseek-chat</code>, sole variable prefix stability:",
|
||||
"bench.col.metric": "metric",
|
||||
"bench.col.baseline": "baseline (cache-hostile)",
|
||||
"bench.col.reasonix": "Reasonix",
|
||||
"bench.col.delta": "delta",
|
||||
"bench.row.cache": "cache hit",
|
||||
"bench.row.cost": "cost / task",
|
||||
"bench.row.pass": "pass rate",
|
||||
"bench.repro.intro": "Reproduce without spending an API credit:",
|
||||
"bench.repro.note":
|
||||
"The committed JSONL transcripts carry per-turn <code>usage</code>, <code>cost</code>, and <code>prefixHash</code>. Reasonix's prefix hash stays byte-stable across every model call.",
|
||||
|
||||
"cli.title": "CLI at a glance",
|
||||
"cli.code": "coding mode scoped to path",
|
||||
"cli.chat": "chat (uses saved config)",
|
||||
"cli.setup": "reconfigure the wizard",
|
||||
"cli.run": "one-shot, streams to stdout",
|
||||
"cli.stats": "cross-session cost dashboard",
|
||||
"cli.mcp": "probe a single MCP server",
|
||||
"cli.flags.intro": "Common flags:",
|
||||
"cli.f.preset": "model + harvest + branch bundle",
|
||||
"cli.f.model": "explicit DeepSeek model id",
|
||||
"cli.f.mcp": "attach an MCP server (repeatable)",
|
||||
"cli.f.session": "named session",
|
||||
"cli.f.noconf": "ignore ~/.reasonix/config.json (CI)",
|
||||
|
||||
"ctab.title": "Ready to try?",
|
||||
"ctab.sub": "One <code>npx</code> away. Sandboxed. Reviewable. 96% cheaper.",
|
||||
"ctab.gh": "GitHub repository →",
|
||||
"ctab.npm": "npm package",
|
||||
|
||||
"foot.tag": "DeepSeek does deep, deeply.",
|
||||
"foot.col.project": "Project",
|
||||
"foot.col.docs": "Docs",
|
||||
"foot.col.community": "Community",
|
||||
"foot.changelog": "Changelog",
|
||||
"foot.readme": "README",
|
||||
"foot.readme.zh": "中文 README",
|
||||
"foot.arch": "Architecture",
|
||||
"foot.issues": "Issues",
|
||||
"foot.discuss": "Discussions",
|
||||
"foot.copyright": "© 2026 Reasonix · MIT License",
|
||||
},
|
||||
|
||||
zh: {
|
||||
"nav.features": "特性",
|
||||
"nav.quickstart": "快速上手",
|
||||
"nav.benchmarks": "性能对比",
|
||||
"nav.github": "GitHub",
|
||||
|
||||
"hero.badge": "v0.6 · DeepSeek V4 · 缓存优先",
|
||||
"hero.title.line1": "DeepSeek 原生",
|
||||
"hero.title.line2": "终端里的 AI 编程代理",
|
||||
"hero.sub":
|
||||
"为 DeepSeek V4(flash + pro)打造的缓存优先 agent 循环。编辑以可审查的 SEARCH/REPLACE 块呈现,落盘前必须确认。Ink TUI、原生支持 MCP,不依赖 LangChain。",
|
||||
"hero.copy": "复制",
|
||||
"hero.copy.done": "已复制",
|
||||
"hero.cta.start": "开始使用 →",
|
||||
"hero.cta.star": "在 GitHub 加星",
|
||||
"hero.stat.cache": "前缀缓存命中率",
|
||||
"hero.stat.cost": "相比 Claude Sonnet 4.6 节省",
|
||||
"hero.stat.pass": "τ-bench-lite 通过率",
|
||||
|
||||
"term.user":
|
||||
"users.ts 里 findByEmail 对大小写敏感导致登录失败,帮我改",
|
||||
"term.found":
|
||||
"▸ 找到了。findByEmail 直接用 === 比对。改成小写规范化并补一条测试。",
|
||||
"term.pending": "▸ 1 处待应用编辑 · /apply 写入 · /discard 丢弃",
|
||||
|
||||
"why.title": "为什么选 Reasonix",
|
||||
"why.sub":
|
||||
"每个抽象都对应 DeepSeek 的一个具体特性——极低 token 价、R1 推理轨迹、自动前缀缓存、JSON 模式。通用框架把这些机会全留在桌上。",
|
||||
"why.cache.title": "缓存优先的循环",
|
||||
"why.cache.body":
|
||||
"对话日志只追加不重写,前缀字节级稳定,DeepSeek 的自动前缀缓存命中能稳定打到 85–95%,而不是 40%。",
|
||||
"why.cost.title": "成本是头等公民",
|
||||
"why.cost.body":
|
||||
"默认 flash 优先、turn 末尾自动压缩、必要时模型自我升级到 pro。TUI 有实时单轮成本徽章。",
|
||||
"why.tui.title": "Ink TUI,不靠浏览器",
|
||||
"why.tui.body":
|
||||
"完全在终端里。流式预览、斜杠命令、计划审阅、编辑确认弹窗。Windows 顽固终端可启用 plain 模式。",
|
||||
"why.mcp.title": "原生 MCP",
|
||||
"why.mcp.body":
|
||||
"stdio + HTTP+SSE 双传输。长任务有实时进度条。和原生工具一样走缓存安全 + 自动修复管线。",
|
||||
"why.safe.title": "编辑可审阅",
|
||||
"why.safe.body":
|
||||
"编辑以 SEARCH/REPLACE 块呈现,/apply 之前不动磁盘。逐文件 diff 确认、撤销历史、路径沙箱。",
|
||||
"why.ctx.title": "百万 token 感知",
|
||||
"why.ctx.body":
|
||||
"上下文仪表 + 主动压缩、超大工具结果自动修复、贴近上限自动总结兜底。",
|
||||
|
||||
"qs.title": "60 秒快速上手",
|
||||
"qs.step1.title": "获取 DeepSeek API Key",
|
||||
"qs.step1.body":
|
||||
'在 <a href="https://platform.deepseek.com/api_keys" target="_blank" rel="noopener">platform.deepseek.com</a> 注册即送免费额度。',
|
||||
"qs.step2.title": "切到项目目录运行",
|
||||
"qs.step2.body": "无需安装。",
|
||||
"qs.step2.note":
|
||||
"首次运行会走 30 秒向导:粘贴 API key → 选预设 → 勾选 MCP 服务器。",
|
||||
"qs.step3.title": "让它改代码",
|
||||
"qs.step3.body":
|
||||
"模型会以 SEARCH/REPLACE 块的形式提出编辑——你不 <code>/apply</code>,磁盘不会被改。",
|
||||
"qs.req":
|
||||
"需要 Node ≥ 20.10。支持 macOS、Linux、Windows(PowerShell · Git Bash · Windows Terminal)。任何时候按 <kbd>Esc</kbd> 中断;<code>/help</code> 查看完整命令。",
|
||||
|
||||
"feat.title": "开箱即用",
|
||||
"feat.code.title": "结对编程模式",
|
||||
"feat.code.body":
|
||||
"<code>read_file</code> · <code>write_file</code> · <code>edit_file</code> · <code>search_files</code> · <code>directory_tree</code> · 带只读白名单的 <code>run_command</code>。沙箱限定在启动目录——路径逃逸一律拒绝。支持 plan 模式与逐次编辑确认弹窗。",
|
||||
"feat.memory.title": "两层记忆系统",
|
||||
"feat.memory.body":
|
||||
"可提交的 <code>REASONIX.md</code> 承载团队约定,私人 <code>~/.reasonix/memory/</code> 分全局与按项目两个作用域。模型可通过 <code>remember</code> 工具自行写入。",
|
||||
"feat.skills.title": "用户定义的 prompt 包",
|
||||
"feat.skills.body":
|
||||
"把 <code>SKILL.md</code> 丢进任意位置。名字 + 描述会被钉在前缀里,模型可自动调用,或你用 <code>/skill name</code> 手动触发。",
|
||||
"feat.hooks.title": "生命周期钩子",
|
||||
"feat.hooks.body":
|
||||
"在 <code>PreToolUse</code> · <code>PostToolUse</code> · <code>UserPromptSubmit</code> · <code>Stop</code> 四个点触发 shell 命令,退出码决定放行 / 阻断 / 警告。",
|
||||
"feat.mcp.title": "自带工具进来",
|
||||
"feat.mcp.body":
|
||||
'向导内置目录,或用 <code>--mcp "name=cmd"</code> 直接挂 stdio / HTTP+SSE 服务器。长任务渲染实时进度条。',
|
||||
"feat.web.title": "内置联网搜索",
|
||||
"feat.web.body":
|
||||
"<code>web_search</code> + <code>web_fetch</code>,背靠 Mojeek——无需 key、无需注册,离线 / CI 可关闭。可通过 <code>WebSearchProvider</code> 接口接入自家搜索。",
|
||||
|
||||
"bench.title": "缓存命中率自己也能验证",
|
||||
"bench.sub":
|
||||
"同一 τ-bench-lite 负载(8 个多轮工具调用任务 × 3 次重复 = 每边 48 次运行),实测 DeepSeek <code>deepseek-chat</code>,唯一变量是前缀稳定性:",
|
||||
"bench.col.metric": "指标",
|
||||
"bench.col.baseline": "基线(缓存敌对)",
|
||||
"bench.col.reasonix": "Reasonix",
|
||||
"bench.col.delta": "差值",
|
||||
"bench.row.cache": "缓存命中",
|
||||
"bench.row.cost": "单任务成本",
|
||||
"bench.row.pass": "通过率",
|
||||
"bench.repro.intro": "无需消耗 API 额度即可复现:",
|
||||
"bench.repro.note":
|
||||
"提交进仓库的 JSONL 文件每轮带 <code>usage</code>、<code>cost</code>、<code>prefixHash</code>。Reasonix 的前缀哈希在每次模型调用时都字节稳定。",
|
||||
|
||||
"cli.title": "CLI 速览",
|
||||
"cli.code": "针对指定路径的编程模式",
|
||||
"cli.chat": "聊天模式(读取已保存配置)",
|
||||
"cli.setup": "重新跑配置向导",
|
||||
"cli.run": "一次性运行,结果流到 stdout",
|
||||
"cli.stats": "跨会话的成本仪表盘",
|
||||
"cli.mcp": "探测单个 MCP 服务器",
|
||||
"cli.flags.intro": "常用 flag:",
|
||||
"cli.f.preset": "模型 + harvest + 分支并行 一键组合",
|
||||
"cli.f.model": "显式指定 DeepSeek 模型 ID",
|
||||
"cli.f.mcp": "挂载 MCP 服务器(可重复)",
|
||||
"cli.f.session": "命名会话",
|
||||
"cli.f.noconf": "忽略 ~/.reasonix/config.json(CI 友好)",
|
||||
|
||||
"ctab.title": "准备好了吗?",
|
||||
"ctab.sub": "一条 <code>npx</code> 即可开始。沙箱、可审阅、便宜 96%。",
|
||||
"ctab.gh": "GitHub 仓库 →",
|
||||
"ctab.npm": "npm 包",
|
||||
|
||||
"foot.tag": "Reasonix 只做 DeepSeek,做到底。",
|
||||
"foot.col.project": "项目",
|
||||
"foot.col.docs": "文档",
|
||||
"foot.col.community": "社区",
|
||||
"foot.changelog": "更新日志",
|
||||
"foot.readme": "英文 README",
|
||||
"foot.readme.zh": "中文 README",
|
||||
"foot.arch": "架构文档",
|
||||
"foot.issues": "问题反馈",
|
||||
"foot.discuss": "讨论区",
|
||||
"foot.copyright": "© 2026 Reasonix · MIT 协议",
|
||||
},
|
||||
};
|
||||
|
||||
function safeStorageGet(key) {
|
||||
try {
|
||||
return window.localStorage.getItem(key);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function safeStorageSet(key, value) {
|
||||
try {
|
||||
window.localStorage.setItem(key, value);
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
function detectLang() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const queryLang = params.get("lang");
|
||||
if (queryLang && SUPPORTED.includes(queryLang)) return queryLang;
|
||||
|
||||
const stored = safeStorageGet(STORAGE_KEY);
|
||||
if (stored && SUPPORTED.includes(stored)) return stored;
|
||||
|
||||
const navLang = (navigator.language || navigator.userLanguage || "").toLowerCase();
|
||||
if (navLang.startsWith("zh")) return "zh";
|
||||
|
||||
if (Array.isArray(navigator.languages)) {
|
||||
for (const l of navigator.languages) {
|
||||
if (l && l.toLowerCase().startsWith("zh")) return "zh";
|
||||
}
|
||||
}
|
||||
|
||||
return DEFAULT_LANG;
|
||||
}
|
||||
|
||||
let currentLang = DEFAULT_LANG;
|
||||
const langListeners = [];
|
||||
|
||||
function applyLang(lang) {
|
||||
if (!SUPPORTED.includes(lang)) lang = DEFAULT_LANG;
|
||||
const changed = lang !== currentLang;
|
||||
currentLang = lang;
|
||||
const dict = translations[lang];
|
||||
|
||||
document.documentElement.lang = lang === "zh" ? "zh-CN" : "en";
|
||||
document.documentElement.setAttribute("data-lang", lang);
|
||||
|
||||
document.querySelectorAll("[data-i18n]").forEach((el) => {
|
||||
const key = el.getAttribute("data-i18n");
|
||||
if (dict[key] !== undefined) {
|
||||
el.innerHTML = dict[key];
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll("[data-lang-btn]").forEach((btn) => {
|
||||
const isActive = btn.getAttribute("data-lang-btn") === lang;
|
||||
btn.setAttribute("aria-pressed", isActive ? "true" : "false");
|
||||
});
|
||||
|
||||
safeStorageSet(STORAGE_KEY, lang);
|
||||
|
||||
if (changed) {
|
||||
for (const fn of langListeners) {
|
||||
try {
|
||||
fn(lang);
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Public API for sibling scripts (term-anim.js).
|
||||
window.Reasonix = window.Reasonix || {};
|
||||
window.Reasonix.t = function (key) {
|
||||
const dict = translations[currentLang] || translations[DEFAULT_LANG];
|
||||
return dict[key];
|
||||
};
|
||||
window.Reasonix.lang = function () {
|
||||
return currentLang;
|
||||
};
|
||||
window.Reasonix.onLangChange = function (fn) {
|
||||
if (typeof fn === "function") langListeners.push(fn);
|
||||
};
|
||||
|
||||
function wireLangButtons() {
|
||||
document.querySelectorAll("[data-lang-btn]").forEach((btn) => {
|
||||
btn.addEventListener("click", () => {
|
||||
applyLang(btn.getAttribute("data-lang-btn"));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function wireCopyButtons() {
|
||||
document.querySelectorAll("[data-copy]").forEach((btn) => {
|
||||
btn.addEventListener("click", async () => {
|
||||
const text = btn.getAttribute("data-copy");
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
} catch (_) {
|
||||
const ta = document.createElement("textarea");
|
||||
ta.value = text;
|
||||
ta.style.position = "fixed";
|
||||
ta.style.opacity = "0";
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
try {
|
||||
document.execCommand("copy");
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
document.body.removeChild(ta);
|
||||
}
|
||||
const lang = document.documentElement.getAttribute("data-lang") || DEFAULT_LANG;
|
||||
const original = translations[lang]["hero.copy"] || "Copy";
|
||||
const done = translations[lang]["hero.copy.done"] || "Copied";
|
||||
btn.textContent = done;
|
||||
btn.classList.add("copied");
|
||||
setTimeout(() => {
|
||||
btn.textContent = original;
|
||||
btn.classList.remove("copied");
|
||||
}, 1600);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function init() {
|
||||
applyLang(detectLang());
|
||||
wireLangButtons();
|
||||
wireCopyButtons();
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,493 @@
|
||||
<!doctype html>
|
||||
<html lang="en" data-lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Reasonix — DeepSeek-native AI coding agent</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Cache-first agent loop for DeepSeek V4. Ink TUI. MCP first-class. 94%+ prefix cache hit, ~96% cheaper than Claude on the same workload. No LangChain."
|
||||
/>
|
||||
<meta name="theme-color" content="#0b0f17" />
|
||||
|
||||
<meta property="og:title" content="Reasonix — DeepSeek-native AI coding agent" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Cache-first agent loop for DeepSeek V4 (flash + pro). Ink TUI. MCP first-class. No LangChain."
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://esengine.github.io/reasonix/" />
|
||||
<meta property="og:image" content="https://raw.githubusercontent.com/esengine/reasonix/main/docs/logo.svg" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
|
||||
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="bg-grid" aria-hidden="true"></div>
|
||||
<div class="bg-glow" aria-hidden="true"></div>
|
||||
|
||||
<header class="nav">
|
||||
<a class="nav-brand" href="#top" aria-label="Reasonix">
|
||||
<span class="brand-mark" aria-hidden="true">
|
||||
<span class="diamond"></span>
|
||||
<span class="diamond inner"></span>
|
||||
</span>
|
||||
<span class="brand-name">Reasonix</span>
|
||||
</a>
|
||||
|
||||
<nav class="nav-links">
|
||||
<a href="#features" data-i18n="nav.features">Features</a>
|
||||
<a href="#quickstart" data-i18n="nav.quickstart">Quick start</a>
|
||||
<a href="#benchmarks" data-i18n="nav.benchmarks">Benchmarks</a>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="nav.github"
|
||||
>GitHub</a
|
||||
>
|
||||
</nav>
|
||||
|
||||
<div class="nav-actions">
|
||||
<div class="lang-switch" role="group" aria-label="Language">
|
||||
<button data-lang-btn="en" type="button" aria-pressed="true">EN</button>
|
||||
<button data-lang-btn="zh" type="button" aria-pressed="false">中文</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main id="top">
|
||||
<section class="hero">
|
||||
<div class="hero-inner">
|
||||
<div class="badge" data-i18n="hero.badge">v0.6 · DeepSeek V4 · cache-first</div>
|
||||
<h1 class="hero-title">
|
||||
<span class="grad-text" data-i18n="hero.title.line1">DeepSeek-native</span>
|
||||
<br />
|
||||
<span data-i18n="hero.title.line2">AI coding agent in your terminal</span>
|
||||
</h1>
|
||||
<p class="hero-sub" data-i18n="hero.sub">
|
||||
Cache-first agent loop for DeepSeek V4 (flash + pro). Edits files as
|
||||
reviewable SEARCH/REPLACE blocks. Ink TUI. MCP first-class. No LangChain.
|
||||
</p>
|
||||
|
||||
<div class="hero-install">
|
||||
<code class="install-cmd"
|
||||
><span class="prompt">$</span> <span class="cmd">npx reasonix code</span></code
|
||||
>
|
||||
<button class="copy-btn" data-copy="npx reasonix code" data-i18n="hero.copy">
|
||||
Copy
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="hero-ctas">
|
||||
<a class="cta primary" href="#quickstart" data-i18n="hero.cta.start">
|
||||
Get started →
|
||||
</a>
|
||||
<a
|
||||
class="cta ghost"
|
||||
href="https://github.com/esengine/reasonix"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="hero.cta.star"
|
||||
>Star on GitHub</a
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="hero-stats">
|
||||
<div class="stat">
|
||||
<div class="stat-num grad-text">94.4%</div>
|
||||
<div class="stat-label" data-i18n="hero.stat.cache">prefix cache hit rate</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat-num grad-text">~96%</div>
|
||||
<div class="stat-label" data-i18n="hero.stat.cost">cheaper vs Claude Sonnet 4.6</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat-num grad-text">100%</div>
|
||||
<div class="stat-label" data-i18n="hero.stat.pass">τ-bench-lite pass rate</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hero-terminal" aria-hidden="true">
|
||||
<div class="term-bar">
|
||||
<span class="dot r"></span><span class="dot y"></span><span class="dot g"></span>
|
||||
<span class="term-title">reasonix code</span>
|
||||
<button class="term-replay" type="button" data-replay aria-label="replay">↻</button>
|
||||
</div>
|
||||
<div class="term-body" id="term-body" data-anim-root></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="why">
|
||||
<div class="container">
|
||||
<h2 class="section-title" data-i18n="why.title">Why Reasonix</h2>
|
||||
<p class="section-sub" data-i18n="why.sub">
|
||||
Every abstraction earns its weight against a DeepSeek-specific property —
|
||||
dirt-cheap tokens, R1 traces, automatic prefix caching, JSON mode. Generic
|
||||
wrappers leave these on the table.
|
||||
</p>
|
||||
|
||||
<div class="why-grid">
|
||||
<article class="why-card">
|
||||
<div class="why-icon">◈</div>
|
||||
<h3 data-i18n="why.cache.title">Cache-first loop</h3>
|
||||
<p data-i18n="why.cache.body">
|
||||
Append-only conversation log keeps the prompt prefix byte-stable across
|
||||
turns, so DeepSeek's automatic cache hits 85–95% — not 40%.
|
||||
</p>
|
||||
</article>
|
||||
<article class="why-card">
|
||||
<div class="why-icon">¥</div>
|
||||
<h3 data-i18n="why.cost.title">Cost is a pillar</h3>
|
||||
<p data-i18n="why.cost.body">
|
||||
Flash-first defaults, turn-end auto-compaction, model self-escalation
|
||||
when (and only when) needed. Per-turn cost badge in the TUI.
|
||||
</p>
|
||||
</article>
|
||||
<article class="why-card">
|
||||
<div class="why-icon">⌨</div>
|
||||
<h3 data-i18n="why.tui.title">Ink TUI, no web</h3>
|
||||
<p data-i18n="why.tui.body">
|
||||
Lives in your terminal. Streaming preview, slash commands, plan picker,
|
||||
edit-confirm modal. Plain mode for stubborn Windows shells.
|
||||
</p>
|
||||
</article>
|
||||
<article class="why-card">
|
||||
<div class="why-icon">⊕</div>
|
||||
<h3 data-i18n="why.mcp.title">MCP first-class</h3>
|
||||
<p data-i18n="why.mcp.body">
|
||||
Stdio + HTTP+SSE transports. Live progress notifications. Same
|
||||
cache-safety + repair plumbing as native tools.
|
||||
</p>
|
||||
</article>
|
||||
<article class="why-card">
|
||||
<div class="why-icon">↶</div>
|
||||
<h3 data-i18n="why.safe.title">Reviewable edits</h3>
|
||||
<p data-i18n="why.safe.body">
|
||||
Edits arrive as SEARCH/REPLACE blocks; nothing hits disk until /apply.
|
||||
Per-file diff confirm modal, undo history, sandboxed paths.
|
||||
</p>
|
||||
</article>
|
||||
<article class="why-card">
|
||||
<div class="why-icon">∞</div>
|
||||
<h3 data-i18n="why.ctx.title">1M-token aware</h3>
|
||||
<p data-i18n="why.ctx.body">
|
||||
Context gauge with proactive compaction, oversized tool-result repair,
|
||||
forced-summary fallback near the window edge.
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="quickstart" class="quickstart">
|
||||
<div class="container">
|
||||
<h2 class="section-title" data-i18n="qs.title">Quick start (60 seconds)</h2>
|
||||
<ol class="qs-steps">
|
||||
<li>
|
||||
<h3 data-i18n="qs.step1.title">Get a DeepSeek API key</h3>
|
||||
<p data-i18n="qs.step1.body">
|
||||
Free credit on signup at
|
||||
<a href="https://platform.deepseek.com/api_keys" target="_blank" rel="noopener"
|
||||
>platform.deepseek.com</a
|
||||
>.
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<h3 data-i18n="qs.step2.title">Point it at a project</h3>
|
||||
<p data-i18n="qs.step2.body">No install needed.</p>
|
||||
<pre class="code"><code>cd my-project
|
||||
npx reasonix code</code></pre>
|
||||
<p data-i18n="qs.step2.note">
|
||||
First run walks you through a 30-second wizard (paste API key → pick
|
||||
preset → pick MCP servers).
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<h3 data-i18n="qs.step3.title">Ask it to edit</h3>
|
||||
<p data-i18n="qs.step3.body">
|
||||
The model proposes edits as SEARCH/REPLACE blocks — nothing hits disk
|
||||
until you <code>/apply</code>.
|
||||
</p>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p class="req" data-i18n="qs.req">
|
||||
Requires Node ≥ 20.10. macOS, Linux, Windows (PowerShell · Git Bash · Windows
|
||||
Terminal). Press <kbd>Esc</kbd> anytime to abort; <code>/help</code> for the
|
||||
full command list.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="features" class="features">
|
||||
<div class="container">
|
||||
<h2 class="section-title" data-i18n="feat.title">In the box</h2>
|
||||
|
||||
<div class="feat-grid">
|
||||
<article class="feat">
|
||||
<h3>
|
||||
<span class="feat-tag">code</span>
|
||||
<span data-i18n="feat.code.title">Pair programmer mode</span>
|
||||
</h3>
|
||||
<p data-i18n="feat.code.body">
|
||||
<code>read_file</code> · <code>write_file</code> · <code>edit_file</code> ·
|
||||
<code>search_files</code> · <code>directory_tree</code> ·
|
||||
<code>run_command</code> with read-only allowlist. Sandboxed to the
|
||||
launch root — no path escapes. Plan mode and per-edit review modal.
|
||||
</p>
|
||||
</article>
|
||||
<article class="feat">
|
||||
<h3>
|
||||
<span class="feat-tag">memory</span>
|
||||
<span data-i18n="feat.memory.title">Two-layer memory</span>
|
||||
</h3>
|
||||
<p data-i18n="feat.memory.body">
|
||||
Committable <code>REASONIX.md</code> for team conventions plus a private
|
||||
per-user <code>~/.reasonix/memory/</code> with global and per-project
|
||||
scopes. The model can write to it via the <code>remember</code> tool.
|
||||
</p>
|
||||
</article>
|
||||
<article class="feat">
|
||||
<h3>
|
||||
<span class="feat-tag">skills</span>
|
||||
<span data-i18n="feat.skills.title">User-authored prompt packs</span>
|
||||
</h3>
|
||||
<p data-i18n="feat.skills.body">
|
||||
Drop <code>SKILL.md</code> files anywhere. Names + descriptions are
|
||||
pinned in the prefix; the model picks them autonomously, or you trigger
|
||||
with <code>/skill name</code>.
|
||||
</p>
|
||||
</article>
|
||||
<article class="feat">
|
||||
<h3>
|
||||
<span class="feat-tag">hooks</span>
|
||||
<span data-i18n="feat.hooks.title">Lifecycle hooks</span>
|
||||
</h3>
|
||||
<p data-i18n="feat.hooks.body">
|
||||
Shell commands fire at <code>PreToolUse</code> · <code>PostToolUse</code>
|
||||
· <code>UserPromptSubmit</code> · <code>Stop</code>. Exit code drives
|
||||
pass / block / warn.
|
||||
</p>
|
||||
</article>
|
||||
<article class="feat">
|
||||
<h3>
|
||||
<span class="feat-tag">mcp</span>
|
||||
<span data-i18n="feat.mcp.title">Bring your own tools</span>
|
||||
</h3>
|
||||
<p data-i18n="feat.mcp.body">
|
||||
Wizard catalog, or <code>--mcp "name=cmd"</code> to attach stdio /
|
||||
HTTP+SSE servers on the fly. Live progress bars on long calls.
|
||||
</p>
|
||||
</article>
|
||||
<article class="feat">
|
||||
<h3>
|
||||
<span class="feat-tag">web</span>
|
||||
<span data-i18n="feat.web.title">Web search built-in</span>
|
||||
</h3>
|
||||
<p data-i18n="feat.web.body">
|
||||
<code>web_search</code> + <code>web_fetch</code> via Mojeek — no key, no
|
||||
signup, off-by-flag for offline / CI. Bring-your-own provider via the
|
||||
<code>WebSearchProvider</code> interface.
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="benchmarks" class="bench">
|
||||
<div class="container">
|
||||
<h2 class="section-title" data-i18n="bench.title">Verify the cache claim yourself</h2>
|
||||
<p class="section-sub" data-i18n="bench.sub">
|
||||
On the same τ-bench-lite workload (8 multi-turn tool-use tasks × 3 repeats =
|
||||
48 runs per side), live DeepSeek <code>deepseek-chat</code>, sole variable
|
||||
prefix stability:
|
||||
</p>
|
||||
|
||||
<div class="bench-table-wrap">
|
||||
<table class="bench-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-i18n="bench.col.metric">metric</th>
|
||||
<th data-i18n="bench.col.baseline">baseline (cache-hostile)</th>
|
||||
<th data-i18n="bench.col.reasonix">Reasonix</th>
|
||||
<th data-i18n="bench.col.delta">delta</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td data-i18n="bench.row.cache">cache hit</td>
|
||||
<td>46.6%</td>
|
||||
<td class="hi">94.4%</td>
|
||||
<td>+47.7 pp</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-i18n="bench.row.cost">cost / task</td>
|
||||
<td>$0.002599</td>
|
||||
<td class="hi">$0.001579</td>
|
||||
<td><strong>−39%</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-i18n="bench.row.pass">pass rate</td>
|
||||
<td>96% (23/24)</td>
|
||||
<td class="hi">100% (24/24)</td>
|
||||
<td>—</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p data-i18n="bench.repro.intro">Reproduce without spending an API credit:</p>
|
||||
<pre class="code"><code>git clone https://github.com/esengine/reasonix.git && cd reasonix && npm install
|
||||
npx reasonix replay benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl
|
||||
npx reasonix diff \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.baseline.r1.jsonl \
|
||||
benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl</code></pre>
|
||||
|
||||
<p data-i18n="bench.repro.note">
|
||||
The committed JSONL transcripts carry per-turn <code>usage</code>,
|
||||
<code>cost</code>, and <code>prefixHash</code>. Reasonix's prefix hash stays
|
||||
byte-stable across every model call.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="cli">
|
||||
<div class="container">
|
||||
<h2 class="section-title" data-i18n="cli.title">CLI at a glance</h2>
|
||||
<pre class="code"><code>npx reasonix code [path] <span class="hash"># <span data-i18n="cli.code">coding mode scoped to path</span></span>
|
||||
npx reasonix <span class="hash"># <span data-i18n="cli.chat">chat (uses saved config)</span></span>
|
||||
npx reasonix setup <span class="hash"># <span data-i18n="cli.setup">reconfigure the wizard</span></span>
|
||||
npx reasonix run "ask anything" <span class="hash"># <span data-i18n="cli.run">one-shot, streams to stdout</span></span>
|
||||
npx reasonix stats <span class="hash"># <span data-i18n="cli.stats">cross-session cost dashboard</span></span>
|
||||
npx reasonix mcp inspect <spec> <span class="hash"># <span data-i18n="cli.mcp">probe a single MCP server</span></span></code></pre>
|
||||
|
||||
<p class="cli-flags" data-i18n="cli.flags.intro">Common flags:</p>
|
||||
<pre class="code"><code>--preset <fast|smart|max> <span class="hash"># <span data-i18n="cli.f.preset">model + harvest + branch bundle</span></span>
|
||||
--model <id> <span class="hash"># <span data-i18n="cli.f.model">explicit DeepSeek model id</span></span>
|
||||
--mcp "name=cmd args…" <span class="hash"># <span data-i18n="cli.f.mcp">attach an MCP server (repeatable)</span></span>
|
||||
--session <name> <span class="hash"># <span data-i18n="cli.f.session">named session</span></span>
|
||||
--no-config <span class="hash"># <span data-i18n="cli.f.noconf">ignore ~/.reasonix/config.json (CI)</span></span></code></pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="cta-band">
|
||||
<div class="container">
|
||||
<h2 data-i18n="ctab.title">Ready to try?</h2>
|
||||
<p data-i18n="ctab.sub">
|
||||
One <code>npx</code> away. Sandboxed. Reviewable. 96% cheaper.
|
||||
</p>
|
||||
<div class="hero-ctas center">
|
||||
<a
|
||||
class="cta primary"
|
||||
href="https://github.com/esengine/reasonix"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="ctab.gh"
|
||||
>GitHub repository →</a
|
||||
>
|
||||
<a
|
||||
class="cta ghost"
|
||||
href="https://www.npmjs.com/package/reasonix"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="ctab.npm"
|
||||
>npm package</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer class="foot">
|
||||
<div class="container foot-inner">
|
||||
<div>
|
||||
<a href="#top" class="nav-brand">
|
||||
<span class="brand-mark small" aria-hidden="true">
|
||||
<span class="diamond"></span>
|
||||
<span class="diamond inner"></span>
|
||||
</span>
|
||||
<span class="brand-name">Reasonix</span>
|
||||
</a>
|
||||
<p class="foot-tag" data-i18n="foot.tag">DeepSeek does deep, deeply.</p>
|
||||
</div>
|
||||
<div class="foot-cols">
|
||||
<div>
|
||||
<h4 data-i18n="foot.col.project">Project</h4>
|
||||
<a href="https://github.com/esengine/reasonix" target="_blank" rel="noopener">GitHub</a>
|
||||
<a href="https://www.npmjs.com/package/reasonix" target="_blank" rel="noopener">npm</a>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix/blob/main/CHANGELOG.md"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="foot.changelog"
|
||||
>Changelog</a
|
||||
>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix/blob/main/LICENSE"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>MIT</a
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<h4 data-i18n="foot.col.docs">Docs</h4>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix#readme"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="foot.readme"
|
||||
>README</a
|
||||
>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix/blob/main/README.zh-CN.md"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="foot.readme.zh"
|
||||
>中文 README</a
|
||||
>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix/blob/main/docs/ARCHITECTURE.md"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="foot.arch"
|
||||
>Architecture</a
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<h4 data-i18n="foot.col.community">Community</h4>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix/issues"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="foot.issues"
|
||||
>Issues</a
|
||||
>
|
||||
<a
|
||||
href="https://github.com/esengine/reasonix/discussions"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-i18n="foot.discuss"
|
||||
>Discussions</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="foot-bottom">
|
||||
<span data-i18n="foot.copyright">© 2026 Reasonix · MIT License</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="i18n.js"></script>
|
||||
<script src="term-anim.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,95 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="170" viewBox="0 0 760 170" role="img" aria-label="Reasonix — DeepSeek-native agent framework">
|
||||
<title>Reasonix</title>
|
||||
<defs>
|
||||
<!-- Signature cyan → violet → fuchsia gradient used across the TUI wordmark
|
||||
and the brand mark. Renders well on both GitHub dark and light bg. -->
|
||||
<linearGradient id="rx-grad" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||
<stop offset="0%" stop-color="#5eead4"/>
|
||||
<stop offset="15%" stop-color="#67e8f9"/>
|
||||
<stop offset="30%" stop-color="#7dd3fc"/>
|
||||
<stop offset="45%" stop-color="#93c5fd"/>
|
||||
<stop offset="60%" stop-color="#a5b4fc"/>
|
||||
<stop offset="75%" stop-color="#c4b5fd"/>
|
||||
<stop offset="90%" stop-color="#d8b4fe"/>
|
||||
<stop offset="100%" stop-color="#f0abfc"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="rx-grad-mark" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" stop-color="#5eead4"/>
|
||||
<stop offset="50%" stop-color="#93c5fd"/>
|
||||
<stop offset="100%" stop-color="#c4b5fd"/>
|
||||
</linearGradient>
|
||||
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
|
||||
<feGaussianBlur stdDeviation="3" result="blur"/>
|
||||
<feMerge>
|
||||
<feMergeNode in="blur"/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
</defs>
|
||||
|
||||
<!-- ◈ brand mark: concentric diamonds. Outer stroke pulses,
|
||||
inner fill breathes, whole group rotates slowly. The rotation
|
||||
is subtle (12s / full turn) so it feels like a heartbeat, not a
|
||||
spinner. -->
|
||||
<g transform="translate(90, 85)" filter="url(#glow)">
|
||||
<g>
|
||||
<animateTransform attributeName="transform" type="rotate"
|
||||
from="0" to="360" dur="18s" repeatCount="indefinite"/>
|
||||
<!-- Outer hollow diamond -->
|
||||
<path d="M 0,-46 L 46,0 L 0,46 L -46,0 Z"
|
||||
fill="none"
|
||||
stroke="url(#rx-grad-mark)"
|
||||
stroke-width="3.5"
|
||||
stroke-linejoin="round">
|
||||
<animate attributeName="stroke-width"
|
||||
values="3.5;5.5;3.5"
|
||||
dur="2.4s"
|
||||
repeatCount="indefinite"/>
|
||||
</path>
|
||||
<!-- Middle hollow diamond -->
|
||||
<path d="M 0,-26 L 26,0 L 0,26 L -26,0 Z"
|
||||
fill="none"
|
||||
stroke="url(#rx-grad-mark)"
|
||||
stroke-width="2"
|
||||
stroke-linejoin="round"
|
||||
opacity="0.7">
|
||||
<animate attributeName="opacity"
|
||||
values="0.4;0.9;0.4"
|
||||
dur="2.4s"
|
||||
begin="0.8s"
|
||||
repeatCount="indefinite"/>
|
||||
</path>
|
||||
<!-- Inner solid diamond -->
|
||||
<path d="M 0,-11 L 11,0 L 0,11 L -11,0 Z"
|
||||
fill="url(#rx-grad-mark)">
|
||||
<animate attributeName="opacity"
|
||||
values="0.75;1;0.75"
|
||||
dur="2.4s"
|
||||
repeatCount="indefinite"/>
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- REASONIX wordmark with shifting gradient. The x1 offset animates
|
||||
so the gradient crawls left-to-right across the letters — a
|
||||
slow rainbow sweep that gives the logo life without being noisy. -->
|
||||
<text x="170" y="102"
|
||||
font-family="ui-monospace, SFMono-Regular, 'Cascadia Code', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
|
||||
font-size="68"
|
||||
font-weight="800"
|
||||
fill="url(#rx-grad)"
|
||||
letter-spacing="6">REASONIX
|
||||
<animate attributeName="opacity"
|
||||
values="0.9;1;0.9"
|
||||
dur="3.2s"
|
||||
repeatCount="indefinite"/>
|
||||
</text>
|
||||
|
||||
<!-- Tagline sits just below the wordmark. Slate-500 reads well on
|
||||
both GitHub dark and light themes (~4.5:1 contrast either way). -->
|
||||
<text x="172" y="136"
|
||||
font-family="ui-monospace, SFMono-Regular, 'Cascadia Code', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
|
||||
font-size="15"
|
||||
fill="#64748b"
|
||||
letter-spacing="0.5">DeepSeek-native agent framework · cache-first loop · Ink TUI</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,404 @@
|
||||
// Hero terminal animation — simulates a `reasonix code` session using
|
||||
// the real TUI rendering primitives:
|
||||
// ◇ / ◆ role glyphs + colored vertical accent bars
|
||||
// ` ✓ tool_name ` pills (yellow bg, black text)
|
||||
// EditBlockRow: rounded cyan border, filename, `- old` red / `+ new` green
|
||||
// info rows: dim glyph + dim body (slate)
|
||||
//
|
||||
// Reads i18n strings via Reasonix.t(); restarts on language toggle.
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const ROOT_SEL = "[data-anim-root]";
|
||||
const REPLAY_SEL = "[data-replay]";
|
||||
|
||||
const tr = (key, fallback) => {
|
||||
if (window.Reasonix && typeof window.Reasonix.t === "function") {
|
||||
const v = window.Reasonix.t(key);
|
||||
if (v !== undefined && v !== null && v !== "") return v;
|
||||
}
|
||||
return fallback != null ? fallback : key;
|
||||
};
|
||||
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
function el(tag, cls, text) {
|
||||
const n = document.createElement(tag);
|
||||
if (cls) n.className = cls;
|
||||
if (text != null) n.textContent = text;
|
||||
return n;
|
||||
}
|
||||
|
||||
// Brand gradient — same stops as src/cli/ui/theme.ts GRADIENT.
|
||||
const GRADIENT = [
|
||||
"#5eead4",
|
||||
"#67e8f9",
|
||||
"#7dd3fc",
|
||||
"#93c5fd",
|
||||
"#a5b4fc",
|
||||
"#c4b5fd",
|
||||
"#d8b4fe",
|
||||
"#f0abfc",
|
||||
];
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// Header bar — `◈ REASONIX v0.6.0 v4-flash REVIEW max … turn 1 · /help`
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
function buildHeader(turn) {
|
||||
const h = el("div", "thead");
|
||||
h.innerHTML =
|
||||
'<span class="tw-mark">◈</span>' +
|
||||
'<span class="tw-name">REASONIX</span>' +
|
||||
'<span class="tw-ver">v0.6.0</span>' +
|
||||
'<span class="tw-model">v4-flash</span>' +
|
||||
'<span class="tw-pill review">REVIEW</span>' +
|
||||
'<span class="tw-effort">max</span>' +
|
||||
'<span class="tw-spacer"></span>' +
|
||||
'<span class="tw-turn">turn ' +
|
||||
turn +
|
||||
" · /help</span>";
|
||||
return h;
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// User row — ◇ glyph (cyan) + cyan vertical accent bar + text.
|
||||
// Mirrors EventLog.tsx role="user" render.
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
function buildUserRow(text) {
|
||||
const row = el("div", "trow trow-user");
|
||||
row.innerHTML =
|
||||
'<span class="trole role-user">◇</span>' +
|
||||
'<span class="tbar-cyan">▎</span>' +
|
||||
'<span class="trow-body"></span>';
|
||||
row.querySelector(".trow-body").textContent = text;
|
||||
return row;
|
||||
}
|
||||
|
||||
// Same shape as a user row but the body content is built progressively
|
||||
// by the animation. Returns the row + an `input` ref + a `caret` span.
|
||||
function buildLiveUserRow() {
|
||||
const row = el("div", "trow trow-user trow-live");
|
||||
row.innerHTML =
|
||||
'<span class="trole role-user">◇</span>' +
|
||||
'<span class="tbar-cyan">▎</span>' +
|
||||
'<span class="trow-body"><span class="tinput"></span><span class="tcaret">▍</span></span>';
|
||||
row._input = row.querySelector(".tinput");
|
||||
row._caret = row.querySelector(".tcaret");
|
||||
return row;
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// Tool pill row — ` ✓ tool_name ` duration dim summary /tool N
|
||||
// Yellow bg pill (red bg for errors). Mirrors ToolPill in EventLog.tsx.
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
function buildToolRow(name, summary, durationLabel, indexHint) {
|
||||
const row = el("div", "trow trow-tool");
|
||||
const pill = el("span", "tpill tpill-ok");
|
||||
pill.textContent = " ✓ " + name + " ";
|
||||
row.appendChild(pill);
|
||||
if (durationLabel) {
|
||||
row.appendChild(el("span", "tdim", " " + durationLabel));
|
||||
}
|
||||
row.appendChild(el("span", "tdim", " " + summary));
|
||||
if (indexHint) {
|
||||
row.appendChild(el("span", "tdim tindex", " /tool " + indexHint));
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// Assistant row — ◆ glyph + ` v4-flash ` pill, then a green-bordered
|
||||
// body the caller fills with text + (optionally) an EditBlockRow.
|
||||
// Returns { row, body } so the caller can append into body.
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
function buildAssistantRow() {
|
||||
const row = el("div", "trow trow-asst");
|
||||
row.innerHTML =
|
||||
'<div class="trow-asst-head">' +
|
||||
'<span class="trole role-asst">◆</span>' +
|
||||
'<span class="tpill tpill-model"> v4-flash </span>' +
|
||||
"</div>" +
|
||||
'<div class="trow-asst-body">' +
|
||||
'<span class="tbar-green">▎</span>' +
|
||||
'<div class="trow-asst-content"></div>' +
|
||||
"</div>";
|
||||
return { row, body: row.querySelector(".trow-asst-content") };
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// EditBlockRow — rounded cyan border, filename in cyan bold, then
|
||||
// `- old` red and `+ new` green lines. NO literal SEARCH/REPLACE
|
||||
// markers (the model's text format is parsed; only the diff is
|
||||
// shown). Mirrors EditBlockRow in markdown.tsx.
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
function buildEditBlock(filename, oldLines, newLines) {
|
||||
const box = el("div", "tedit");
|
||||
const head = el("div", "tedit-head");
|
||||
head.appendChild(el("span", "tedit-filename", filename));
|
||||
box.appendChild(head);
|
||||
const diff = el("div", "tedit-diff");
|
||||
box.appendChild(diff);
|
||||
return { box, diff, oldLines, newLines };
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// Info row — colored glyph + dim body. Used for pending + applied
|
||||
// status lines, mirrors EventLog.tsx role="info".
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
function buildInfoRow(glyph, glyphColor, body) {
|
||||
const row = el("div", "trow trow-info");
|
||||
const g = el("span", "tinfo-glyph", glyph);
|
||||
g.style.color = glyphColor;
|
||||
row.appendChild(g);
|
||||
row.appendChild(el("span", "tdim", " " + body));
|
||||
return row;
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// Animate text into a target node, character by character.
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
async function typeInto(target, text, perChar, cancelled) {
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
target.appendChild(document.createTextNode(text[i]));
|
||||
const j = perChar * (0.85 + Math.random() * 0.3);
|
||||
const ch = text[i];
|
||||
const pause = /[,。、;:,.;:]/.test(ch) ? perChar * 4 : 0;
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await sleep(j + pause);
|
||||
if (cancelled && cancelled()) return;
|
||||
}
|
||||
}
|
||||
|
||||
// Cancellation token — interrupts in-flight cycles when the user
|
||||
// toggles language or clicks replay so we don't double-render.
|
||||
let token = 0;
|
||||
|
||||
async function runCycle(root) {
|
||||
const myToken = ++token;
|
||||
const cancelled = () => myToken !== token;
|
||||
|
||||
root.classList.remove("trun-fade");
|
||||
root.innerHTML = "";
|
||||
|
||||
root.appendChild(buildHeader(1));
|
||||
|
||||
await sleep(400);
|
||||
if (cancelled()) return;
|
||||
|
||||
// 1. Live user prompt — types the question, then converts to a
|
||||
// permanent user row on submit.
|
||||
const userMsg = tr(
|
||||
"term.user",
|
||||
"users.ts findByEmail is case-sensitive — login fails"
|
||||
);
|
||||
const live = buildLiveUserRow();
|
||||
root.appendChild(live);
|
||||
await sleep(400);
|
||||
if (cancelled()) return;
|
||||
await typeInto(live._input, userMsg, 32, cancelled);
|
||||
if (cancelled()) return;
|
||||
await sleep(550);
|
||||
live._caret.remove();
|
||||
live.classList.add("trow-sent");
|
||||
|
||||
// 2. Tool pills appear one by one. Real summaries come from
|
||||
// summarizeToolResult() in summarize.ts — we hard-code the
|
||||
// representative output for this scene.
|
||||
await sleep(380);
|
||||
if (cancelled()) return;
|
||||
root.appendChild(
|
||||
buildToolRow(
|
||||
"search_files",
|
||||
"matched 2 files: src/users.ts, src/users.test.ts",
|
||||
"0.4s",
|
||||
"1"
|
||||
)
|
||||
);
|
||||
await sleep(560);
|
||||
if (cancelled()) return;
|
||||
root.appendChild(
|
||||
buildToolRow("read_file", "read src/users.ts (412 chars)", "0.2s", "2")
|
||||
);
|
||||
await sleep(640);
|
||||
if (cancelled()) return;
|
||||
|
||||
// 3. Assistant row — ◆ + model pill, then green-bordered body
|
||||
// containing the streamed text and the EditBlockRow.
|
||||
const a = buildAssistantRow();
|
||||
root.appendChild(a.row);
|
||||
await sleep(280);
|
||||
if (cancelled()) return;
|
||||
|
||||
const replyP = el("p", "tmd-p");
|
||||
a.body.appendChild(replyP);
|
||||
const replyMsg = tr(
|
||||
"term.found",
|
||||
"Found it. findByEmail uses === directly. Switching to lowercase normalization."
|
||||
);
|
||||
await typeInto(replyP, replyMsg, 18, cancelled);
|
||||
if (cancelled()) return;
|
||||
await sleep(360);
|
||||
|
||||
// 4. EditBlockRow — rounded cyan border with filename + colored
|
||||
// diff lines. No SEARCH/REPLACE markers.
|
||||
const eb = buildEditBlock(
|
||||
"src/users.ts",
|
||||
[" return users.find(u => u.email === email);"],
|
||||
[
|
||||
" const needle = email.toLowerCase();",
|
||||
" return users.find(u => u.email.toLowerCase() === needle);",
|
||||
]
|
||||
);
|
||||
a.body.appendChild(eb.box);
|
||||
await sleep(220);
|
||||
if (cancelled()) return;
|
||||
|
||||
for (const line of eb.oldLines) {
|
||||
const r = el("div", "tdiff tdiff-old", "- " + line);
|
||||
eb.diff.appendChild(r);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await sleep(180);
|
||||
if (cancelled()) return;
|
||||
}
|
||||
for (const line of eb.newLines) {
|
||||
const r = el("div", "tdiff tdiff-new", "+ " + line);
|
||||
eb.diff.appendChild(r);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await sleep(180);
|
||||
if (cancelled()) return;
|
||||
}
|
||||
await sleep(420);
|
||||
if (cancelled()) return;
|
||||
|
||||
// 5. Pending info row — slate `▸` + dim body. Real text from
|
||||
// formatPendingPreview() in edit-history.ts.
|
||||
root.appendChild(
|
||||
buildInfoRow(
|
||||
"▸",
|
||||
"#94a3b8",
|
||||
tr(
|
||||
"term.pending",
|
||||
"1 pending edit block(s) — /apply (or y) to commit · /discard (or n) to drop"
|
||||
)
|
||||
)
|
||||
);
|
||||
await sleep(1700);
|
||||
if (cancelled()) return;
|
||||
|
||||
// 6. /apply — second user turn. Live row, types `/apply`, then
|
||||
// transforms to a sent row. No tool pills (slash is local).
|
||||
const apply = buildLiveUserRow();
|
||||
root.appendChild(apply);
|
||||
await sleep(420);
|
||||
if (cancelled()) return;
|
||||
await typeInto(apply._input, "/apply", 75, cancelled);
|
||||
if (cancelled()) return;
|
||||
await sleep(380);
|
||||
apply._caret.remove();
|
||||
apply.classList.add("trow-sent");
|
||||
|
||||
// 7. Applied info rows — first the header, then the per-file line.
|
||||
// Mirrors formatEditResults() in edit-history.ts.
|
||||
await sleep(420);
|
||||
root.appendChild(
|
||||
buildInfoRow(
|
||||
"▸",
|
||||
"#94a3b8",
|
||||
"edit blocks: 1/1 applied — /undo to roll back, or `git diff` to review"
|
||||
)
|
||||
);
|
||||
const ok = el("div", "trow trow-info trow-info-detail");
|
||||
const gl = el("span", "tinfo-glyph", "✓");
|
||||
gl.style.color = "#4ade80";
|
||||
ok.appendChild(el("span", "tdim", " "));
|
||||
ok.appendChild(gl);
|
||||
ok.appendChild(el("span", "tdim", " applied src/users.ts"));
|
||||
root.appendChild(ok);
|
||||
|
||||
await sleep(2800);
|
||||
if (cancelled()) return;
|
||||
|
||||
// 8. Fade and loop.
|
||||
root.classList.add("trun-fade");
|
||||
await sleep(900);
|
||||
if (cancelled()) return;
|
||||
runCycle(root);
|
||||
}
|
||||
|
||||
// Reduced-motion fallback — paint the final scene without typing.
|
||||
function runStatic(root) {
|
||||
root.innerHTML = "";
|
||||
root.appendChild(buildHeader(1));
|
||||
root.appendChild(buildUserRow(tr("term.user", "")));
|
||||
root.appendChild(
|
||||
buildToolRow(
|
||||
"search_files",
|
||||
"matched 2 files: src/users.ts, src/users.test.ts",
|
||||
"0.4s",
|
||||
"1"
|
||||
)
|
||||
);
|
||||
root.appendChild(
|
||||
buildToolRow("read_file", "read src/users.ts (412 chars)", "0.2s", "2")
|
||||
);
|
||||
const a = buildAssistantRow();
|
||||
root.appendChild(a.row);
|
||||
const p = el("p", "tmd-p");
|
||||
p.textContent = tr("term.found", "");
|
||||
a.body.appendChild(p);
|
||||
const eb = buildEditBlock(
|
||||
"src/users.ts",
|
||||
[" return users.find(u => u.email === email);"],
|
||||
[
|
||||
" const needle = email.toLowerCase();",
|
||||
" return users.find(u => u.email.toLowerCase() === needle);",
|
||||
]
|
||||
);
|
||||
a.body.appendChild(eb.box);
|
||||
eb.oldLines.forEach((l) =>
|
||||
eb.diff.appendChild(el("div", "tdiff tdiff-old", "- " + l))
|
||||
);
|
||||
eb.newLines.forEach((l) =>
|
||||
eb.diff.appendChild(el("div", "tdiff tdiff-new", "+ " + l))
|
||||
);
|
||||
root.appendChild(buildInfoRow("▸", "#94a3b8", tr("term.pending", "")));
|
||||
}
|
||||
|
||||
function init() {
|
||||
const root = document.querySelector(ROOT_SEL);
|
||||
if (!root) return;
|
||||
|
||||
if (window.Reasonix && typeof window.Reasonix.onLangChange === "function") {
|
||||
window.Reasonix.onLangChange(() => runCycle(root));
|
||||
}
|
||||
|
||||
document.querySelectorAll(REPLAY_SEL).forEach((btn) => {
|
||||
btn.addEventListener("click", () => runCycle(root));
|
||||
});
|
||||
|
||||
const prm = window.matchMedia
|
||||
? window.matchMedia("(prefers-reduced-motion: reduce)")
|
||||
: null;
|
||||
if (prm && prm.matches) {
|
||||
runStatic(root);
|
||||
return;
|
||||
}
|
||||
|
||||
runCycle(root);
|
||||
}
|
||||
|
||||
window.Reasonix = window.Reasonix || {};
|
||||
window.Reasonix.term = {
|
||||
replay() {
|
||||
const root = document.querySelector(ROOT_SEL);
|
||||
if (root) runCycle(root);
|
||||
},
|
||||
};
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,25 @@
|
||||
/** Minimal example: one-shot, non-streaming. Needs DEEPSEEK_API_KEY. */
|
||||
import {
|
||||
CacheFirstLoop,
|
||||
DeepSeekClient,
|
||||
ImmutablePrefix,
|
||||
loadDotenv,
|
||||
} from "../src/index.js";
|
||||
|
||||
loadDotenv();
|
||||
|
||||
async function main() {
|
||||
const client = new DeepSeekClient();
|
||||
const prefix = new ImmutablePrefix({ system: "You are a concise assistant." });
|
||||
const loop = new CacheFirstLoop({ client, prefix, stream: false });
|
||||
|
||||
const answer = await loop.run("In one sentence, what is prompt caching?");
|
||||
console.log(answer);
|
||||
console.log("---");
|
||||
console.log(loop.stats.summary());
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,238 @@
|
||||
/**
|
||||
* Bundled demo MCP server.
|
||||
*
|
||||
* A minimal stdio MCP server that exposes three tools: echo, add, get_time.
|
||||
* Useful for:
|
||||
* - running the MCP integration end-to-end without installing
|
||||
* an external server
|
||||
* - giving the integration tests a real subprocess to spawn
|
||||
* - showing the minimal shape of a server for folks writing their own
|
||||
*
|
||||
* Usage:
|
||||
* npx tsx examples/mcp-server-demo.ts # speaks MCP on stdin/stdout
|
||||
* reasonix chat --mcp "npx tsx examples/mcp-server-demo.ts"
|
||||
*
|
||||
* Spec reference: https://spec.modelcontextprotocol.io/ (2024-11-05)
|
||||
* Only the subset this demo needs is implemented — initialize, tools/list,
|
||||
* tools/call, notifications/initialized (no-op).
|
||||
*/
|
||||
|
||||
import { createInterface } from "node:readline";
|
||||
|
||||
const PROTOCOL_VERSION = "2024-11-05";
|
||||
|
||||
interface JsonRpcRequest {
|
||||
jsonrpc: "2.0";
|
||||
id?: string | number;
|
||||
method: string;
|
||||
params?: unknown;
|
||||
}
|
||||
|
||||
interface JsonRpcSuccess {
|
||||
jsonrpc: "2.0";
|
||||
id: string | number;
|
||||
result: unknown;
|
||||
}
|
||||
|
||||
interface JsonRpcError {
|
||||
jsonrpc: "2.0";
|
||||
id: string | number | null;
|
||||
error: { code: number; message: string; data?: unknown };
|
||||
}
|
||||
|
||||
const TOOLS = [
|
||||
{
|
||||
name: "echo",
|
||||
description: "Echoes the provided message back.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: { msg: { type: "string", description: "What to echo" } },
|
||||
required: ["msg"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "add",
|
||||
description: "Adds two integers and returns the sum.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
a: { type: "integer" },
|
||||
b: { type: "integer" },
|
||||
},
|
||||
required: ["a", "b"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "get_time",
|
||||
description: "Returns the server's current ISO-8601 timestamp.",
|
||||
inputSchema: { type: "object", properties: {} },
|
||||
},
|
||||
{
|
||||
name: "slow_count",
|
||||
description:
|
||||
"Counts from 1 to n with a ~300 ms pause between steps, emitting notifications/progress frames along the way. Useful for demonstrating Reasonix's progress-bar UI.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
n: { type: "integer", description: "Final number to count to (default 5, max 20)" },
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
interface JsonRpcNotification {
|
||||
jsonrpc: "2.0";
|
||||
method: string;
|
||||
params?: unknown;
|
||||
}
|
||||
|
||||
function send(msg: JsonRpcSuccess | JsonRpcError | JsonRpcNotification): void {
|
||||
// Stdio MCP framing: one JSON per line.
|
||||
process.stdout.write(`${JSON.stringify(msg)}\n`);
|
||||
}
|
||||
|
||||
async function handleRequest(
|
||||
req: JsonRpcRequest,
|
||||
): Promise<JsonRpcSuccess | JsonRpcError | null> {
|
||||
const id = req.id ?? null;
|
||||
|
||||
switch (req.method) {
|
||||
case "initialize": {
|
||||
return {
|
||||
jsonrpc: "2.0",
|
||||
id: id ?? 0,
|
||||
result: {
|
||||
protocolVersion: PROTOCOL_VERSION,
|
||||
serverInfo: { name: "reasonix-demo-mcp", version: "0.0.1" },
|
||||
capabilities: { tools: { listChanged: false } },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case "notifications/initialized":
|
||||
// No response for notifications.
|
||||
return null;
|
||||
|
||||
case "tools/list": {
|
||||
return { jsonrpc: "2.0", id: id ?? 0, result: { tools: TOOLS } };
|
||||
}
|
||||
|
||||
case "tools/call": {
|
||||
const params = (req.params ?? {}) as {
|
||||
name?: string;
|
||||
arguments?: Record<string, unknown>;
|
||||
_meta?: { progressToken?: string | number };
|
||||
};
|
||||
const name = params.name ?? "";
|
||||
const args = params.arguments ?? {};
|
||||
const progressToken = params._meta?.progressToken;
|
||||
const out = await callTool(name, args, progressToken);
|
||||
if (out.error) {
|
||||
return {
|
||||
jsonrpc: "2.0",
|
||||
id: id ?? 0,
|
||||
result: {
|
||||
content: [{ type: "text", text: out.error }],
|
||||
isError: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
jsonrpc: "2.0",
|
||||
id: id ?? 0,
|
||||
result: { content: [{ type: "text", text: out.text }] },
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
return {
|
||||
jsonrpc: "2.0",
|
||||
id,
|
||||
error: { code: -32601, message: `method not found: ${req.method}` },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function callTool(
|
||||
name: string,
|
||||
args: Record<string, unknown>,
|
||||
progressToken: string | number | undefined,
|
||||
): Promise<{ text: string; error?: string }> {
|
||||
if (name === "echo") {
|
||||
const msg = typeof args.msg === "string" ? args.msg : "";
|
||||
return { text: `echo: ${msg}` };
|
||||
}
|
||||
if (name === "add") {
|
||||
const a = typeof args.a === "number" ? args.a : Number(args.a);
|
||||
const b = typeof args.b === "number" ? args.b : Number(args.b);
|
||||
if (!Number.isFinite(a) || !Number.isFinite(b)) {
|
||||
return { text: "", error: "add: both a and b must be numbers" };
|
||||
}
|
||||
return { text: String(a + b) };
|
||||
}
|
||||
if (name === "get_time") {
|
||||
return { text: new Date().toISOString() };
|
||||
}
|
||||
if (name === "slow_count") {
|
||||
// Cap at 20 so an over-eager model can't make the demo run for
|
||||
// minutes. Default 5 gives ~1.5s which is plenty to see the bar.
|
||||
const raw = typeof args.n === "number" ? args.n : Number(args.n);
|
||||
const n = Number.isFinite(raw) && raw >= 1 ? Math.min(Math.floor(raw), 20) : 5;
|
||||
for (let i = 1; i <= n; i++) {
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
if (progressToken !== undefined) {
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
method: "notifications/progress",
|
||||
params: {
|
||||
progressToken,
|
||||
progress: i,
|
||||
total: n,
|
||||
message: `counting ${i} of ${n}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
return { text: `counted to ${n}` };
|
||||
}
|
||||
return { text: "", error: `unknown tool: ${name}` };
|
||||
}
|
||||
|
||||
function main(): void {
|
||||
const rl = createInterface({ input: process.stdin, crlfDelay: Number.POSITIVE_INFINITY });
|
||||
rl.on("line", (line) => {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed) return;
|
||||
let req: JsonRpcRequest;
|
||||
try {
|
||||
req = JSON.parse(trimmed) as JsonRpcRequest;
|
||||
} catch {
|
||||
// malformed input — respond with parse error
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
id: null,
|
||||
error: { code: -32700, message: "parse error" },
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Fire-and-forget: handleRequest is async so slow tools (slow_count
|
||||
// and any future streamed-progress tools) can emit notifications
|
||||
// between in-flight requests without blocking the reader loop. Any
|
||||
// unexpected throw lands as an internal-error response so malformed
|
||||
// tool logic doesn't silently hang the client.
|
||||
handleRequest(req)
|
||||
.then((resp) => {
|
||||
if (resp) send(resp);
|
||||
})
|
||||
.catch((err) => {
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
id: req.id ?? null,
|
||||
error: { code: -32603, message: `internal: ${(err as Error).message}` },
|
||||
});
|
||||
});
|
||||
});
|
||||
rl.on("close", () => process.exit(0));
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Library example: programmatic replay + diff.
|
||||
*
|
||||
* This example runs with no API key and no DeepSeek calls — it reads the
|
||||
* reference transcripts committed at benchmarks/tau-bench/transcripts/ and
|
||||
* reconstructs the v0.1 cache-hit / cost numbers offline.
|
||||
*
|
||||
* Run from the repo root:
|
||||
* npx tsx examples/replay-and-diff.ts
|
||||
*
|
||||
* Anything you can do with `reasonix replay` / `reasonix diff` is available
|
||||
* here as a function you can drive from your own scripts (CI gates, eval
|
||||
* dashboards, blog post generation, etc.).
|
||||
*/
|
||||
|
||||
import {
|
||||
computeReplayStats,
|
||||
diffTranscripts,
|
||||
readTranscript,
|
||||
renderDiffSummary,
|
||||
} from "../src/index.js";
|
||||
|
||||
const BASELINE = "benchmarks/tau-bench/transcripts/t01_address_happy.baseline.r1.jsonl";
|
||||
const REASONIX = "benchmarks/tau-bench/transcripts/t01_address_happy.reasonix.r1.jsonl";
|
||||
|
||||
// ---------- 1. Replay a single transcript as pure data ----------
|
||||
|
||||
const parsed = readTranscript(REASONIX);
|
||||
const stats = computeReplayStats(parsed.records);
|
||||
|
||||
console.log("=== Reasonix side, computed from transcript alone ===");
|
||||
console.log(` model calls: ${stats.turns}`);
|
||||
console.log(` cache hit: ${(stats.cacheHitRatio * 100).toFixed(1)}%`);
|
||||
console.log(` total cost: $${stats.totalCostUsd.toFixed(6)}`);
|
||||
console.log(` vs claude estimate: $${stats.claudeEquivalentUsd.toFixed(6)}`);
|
||||
console.log(` savings: ${stats.savingsVsClaudePct.toFixed(1)}%`);
|
||||
console.log(` prefix hashes: ${stats.prefixHashes.length} distinct`);
|
||||
if (stats.prefixHashes.length === 1) {
|
||||
console.log(` → byte-stable: ${stats.prefixHashes[0]?.slice(0, 16)}…`);
|
||||
}
|
||||
console.log();
|
||||
|
||||
// ---------- 2. Diff two transcripts ----------
|
||||
|
||||
const aParsed = readTranscript(BASELINE);
|
||||
const bParsed = readTranscript(REASONIX);
|
||||
|
||||
const report = diffTranscripts(
|
||||
{ label: "baseline", parsed: aParsed },
|
||||
{ label: "reasonix", parsed: bParsed },
|
||||
);
|
||||
|
||||
// renderDiffSummary returns a monochrome stdout-ready string. Equivalent to
|
||||
// what `reasonix diff --print` outputs.
|
||||
console.log(renderDiffSummary(report));
|
||||
|
||||
// ---------- 3. Direct programmatic access to pairs ----------
|
||||
//
|
||||
// You can also inspect report.pairs directly — useful for writing custom
|
||||
// filters like "show me only the turns where tool calls differed".
|
||||
|
||||
console.log("\n=== Turns where A and B took different paths ===");
|
||||
const divergent = report.pairs.filter((p) => p.kind !== "match");
|
||||
if (divergent.length === 0) {
|
||||
console.log(" (none — both agents followed the same path on every turn)");
|
||||
} else {
|
||||
for (const p of divergent) {
|
||||
console.log(` turn ${p.turn}: ${p.kind}${p.divergenceNote ? ` — ${p.divergenceNote}` : ""}`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/** Tool-use example: register a calculator tool. Needs DEEPSEEK_API_KEY. */
|
||||
import {
|
||||
CacheFirstLoop,
|
||||
DeepSeekClient,
|
||||
ImmutablePrefix,
|
||||
ToolRegistry,
|
||||
loadDotenv,
|
||||
} from "../src/index.js";
|
||||
|
||||
loadDotenv();
|
||||
|
||||
const tools = new ToolRegistry();
|
||||
tools.register<{ a: number; b: number }, number>({
|
||||
name: "add",
|
||||
description: "Add two integers.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
a: { type: "integer" },
|
||||
b: { type: "integer" },
|
||||
},
|
||||
required: ["a", "b"],
|
||||
},
|
||||
fn: ({ a, b }) => a + b,
|
||||
});
|
||||
|
||||
async function main() {
|
||||
const client = new DeepSeekClient();
|
||||
const prefix = new ImmutablePrefix({
|
||||
system: "You are a calculator assistant. Use the `add` tool for addition.",
|
||||
toolSpecs: tools.specs(),
|
||||
});
|
||||
const loop = new CacheFirstLoop({ client, prefix, tools });
|
||||
|
||||
const answer = await loop.run("What is 17 + 25?");
|
||||
console.log("answer:", answer);
|
||||
console.log("stats:", loop.stats.summary());
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "reasonix",
|
||||
"version": "0.11.0",
|
||||
"description": "DeepSeek-native coding agent: cache-first loop, flash-first cost control, tool-call repair.",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"reasonix": "dist/cli/index.js"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"data/deepseek-tokenizer.json.gz",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"dev": "tsx src/cli/index.ts",
|
||||
"chat": "tsx src/cli/index.ts chat",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"lint": "biome check src tests",
|
||||
"lint:fix": "biome check --write src tests",
|
||||
"format": "biome format --write src tests",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run build"
|
||||
},
|
||||
"keywords": [
|
||||
"agent",
|
||||
"llm",
|
||||
"deepseek",
|
||||
"r1",
|
||||
"tool-use",
|
||||
"prompt-cache",
|
||||
"cli",
|
||||
"tui"
|
||||
],
|
||||
"author": "esengine",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/esengine/reasonix.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/esengine/reasonix/issues"
|
||||
},
|
||||
"homepage": "https://github.com/esengine/reasonix#readme",
|
||||
"engines": {
|
||||
"node": ">=20.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^12.1.0",
|
||||
"eventsource-parser": "^3.0.0",
|
||||
"ink": "^5.1.0",
|
||||
"ink-spinner": "^5.0.0",
|
||||
"ink-text-input": "^6.0.0",
|
||||
"react": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@types/node": "^22.9.0",
|
||||
"@types/react": "^18.3.12",
|
||||
"tsup": "^8.3.5",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "^5.6.3",
|
||||
"vitest": "^2.1.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Minimal Ctrl+C probe. Usage: node scripts/ctrlc-probe.mjs
|
||||
// Reproduces the exact stdin setup Reasonix uses, then logs every byte
|
||||
// it sees and exits on \x03. Tells us whether the OS even delivers
|
||||
// Ctrl+C to a Node child on this terminal.
|
||||
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.resume();
|
||||
|
||||
console.log("ctrl+c probe armed. press keys; ctrl+c should exit.");
|
||||
console.log("if ctrl+c does NOT exit, the byte never reaches Node on this terminal.\n");
|
||||
|
||||
process.stdin.on("data", (chunk) => {
|
||||
const s = String(chunk);
|
||||
for (const ch of s) {
|
||||
const code = ch.charCodeAt(0);
|
||||
process.stdout.write(`got byte: 0x${code.toString(16).padStart(2, "0")} (${JSON.stringify(ch)})\r\n`);
|
||||
if (ch === "\x03") {
|
||||
process.stdout.write("→ \\x03 detected, exiting.\r\n");
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
process.on("SIGINT", () => {
|
||||
process.stdout.write("→ SIGINT received, exiting.\r\n");
|
||||
process.exit(0);
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Regenerate `data/deepseek-tokenizer.json.gz` from an upstream
|
||||
* `tokenizer.json` (as shipped in DeepSeek's deepseek_v3_tokenizer.zip).
|
||||
*
|
||||
* Why slim+gz: the full tokenizer.json is 7.5MB; we only need four
|
||||
* fields (vocab, merges, pre_tokenizer, added_tokens). Strip + gzip
|
||||
* drops the committed artifact to ~1.7MB with no loss of fidelity
|
||||
* for encode-side token counting.
|
||||
*
|
||||
* Usage: `node --experimental-strip-types scripts/prepare-tokenizer.ts <path/to/tokenizer.json>`
|
||||
* (or via `tsx` / `ts-node`.)
|
||||
*/
|
||||
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { gzipSync } from "node:zlib";
|
||||
|
||||
const src = process.argv[2];
|
||||
if (!src) {
|
||||
process.stderr.write("usage: prepare-tokenizer.ts <tokenizer.json>\n");
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const raw = JSON.parse(readFileSync(src, "utf8"));
|
||||
const slim = {
|
||||
added_tokens: raw.added_tokens,
|
||||
pre_tokenizer: raw.pre_tokenizer,
|
||||
model: { type: raw.model.type, vocab: raw.model.vocab, merges: raw.model.merges },
|
||||
};
|
||||
const gz = gzipSync(Buffer.from(JSON.stringify(slim)), { level: 9 });
|
||||
const outPath = join(process.cwd(), "data", "deepseek-tokenizer.json.gz");
|
||||
writeFileSync(outPath, gz);
|
||||
process.stdout.write(`wrote ${outPath} (${(gz.length / 1024).toFixed(1)} KB)\n`);
|
||||
@@ -0,0 +1,30 @@
|
||||
// Shift+Enter probe. Usage: node scripts/shift-enter-probe.mjs
|
||||
// Enables modifyOtherKeys + kitty keyboard protocol, then prints the
|
||||
// raw bytes for every keypress. Press Shift+Enter and see what your
|
||||
// terminal actually emits — if it's just "0x0d", the host doesn't
|
||||
// support either protocol and there's nothing Reasonix can do at the
|
||||
// raw-stdin layer.
|
||||
|
||||
process.stdout.write("\u001b[>4;2m"); // modifyOtherKeys level 2 (xterm)
|
||||
process.stdout.write("\u001b[>1u"); // kitty keyboard protocol level 1
|
||||
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.resume();
|
||||
|
||||
console.log("shift+enter probe armed. press keys; ctrl+c exits.");
|
||||
console.log("expected for shift+enter:");
|
||||
console.log(" modifyOtherKeys → 0x1b 0x5b 0x32 0x37 0x3b 0x32 0x3b 0x31 0x33 0x7e (\\x1b[27;2;13~)");
|
||||
console.log(" kitty → 0x1b 0x5b 0x31 0x33 0x3b 0x32 0x75 (\\x1b[13;2u)");
|
||||
console.log(" unsupported → 0x0d (just \\r — no way to distinguish)\n");
|
||||
|
||||
process.stdin.on("data", (chunk) => {
|
||||
const s = String(chunk);
|
||||
const bytes = [...s].map((c) => `0x${c.charCodeAt(0).toString(16).padStart(2, "0")}`).join(" ");
|
||||
process.stdout.write(`got: ${bytes} (${JSON.stringify(s)})\r\n`);
|
||||
if (s.includes("\x03")) {
|
||||
process.stdout.write("\u001b[>4m"); // disable modifyOtherKeys
|
||||
process.stdout.write("\u001b[<u"); // pop kitty level
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
* End-to-end smoke test for the memory layer. Runs against a temp
|
||||
* homeDir so the developer's real ~/.reasonix/memory/ is never touched.
|
||||
* Exercises: write → index regeneration → prefix assembly →
|
||||
* recall → delete → REASONIX_MEMORY=off short-circuit.
|
||||
*
|
||||
* Run: npx tsx scripts/smoke-memory.mts
|
||||
* Exit code 0 on success, 1 on any assertion failure.
|
||||
*/
|
||||
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { ToolRegistry } from "../src/tools.js";
|
||||
import { registerMemoryTools } from "../src/tools/memory.js";
|
||||
import {
|
||||
MemoryStore,
|
||||
applyMemoryStack,
|
||||
applyUserMemory,
|
||||
projectHash,
|
||||
} from "../src/user-memory.js";
|
||||
|
||||
let failures = 0;
|
||||
function check(label: string, cond: unknown, detail?: string) {
|
||||
if (cond) {
|
||||
process.stdout.write(` ✓ ${label}\n`);
|
||||
} else {
|
||||
failures++;
|
||||
process.stdout.write(` ✗ ${label}${detail ? ` — ${detail}` : ""}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const home = mkdtempSync(join(tmpdir(), "reasonix-smoke-home-"));
|
||||
const projectRoot = mkdtempSync(join(tmpdir(), "reasonix-smoke-proj-"));
|
||||
process.stdout.write(`home: ${home}\nproject: ${projectRoot}\n\n`);
|
||||
|
||||
try {
|
||||
// ── 1. MemoryStore write + index regeneration ────────────────────
|
||||
process.stdout.write("1. MemoryStore write → index regen\n");
|
||||
const store = new MemoryStore({ homeDir: home, projectRoot });
|
||||
store.write({
|
||||
name: "bun_build",
|
||||
type: "project",
|
||||
scope: "project",
|
||||
description: "Build command on this machine is `bun run build`",
|
||||
body: "On this machine, no npm — always `bun run build` / `bun run test`.",
|
||||
});
|
||||
store.write({
|
||||
name: "tabs_not_spaces",
|
||||
type: "user",
|
||||
scope: "global",
|
||||
description: "Use tabs for indentation across all projects",
|
||||
body: "Rule.\n\n**Why:** muscle memory, editor config across machines.\n\n**How to apply:** always tabs.",
|
||||
});
|
||||
|
||||
const hash = projectHash(projectRoot);
|
||||
const projectFile = join(home, "memory", hash, "bun_build.md");
|
||||
const globalFile = join(home, "memory", "global", "tabs_not_spaces.md");
|
||||
check("project-scoped file landed in <hash>/ dir", existsSync(projectFile));
|
||||
check("global-scoped file landed in global/ dir", existsSync(globalFile));
|
||||
check("no cross-contamination project ⇒ global", !existsSync(join(home, "memory", "global", "bun_build.md")));
|
||||
|
||||
const projectIndex = readFileSync(join(home, "memory", hash, "MEMORY.md"), "utf8");
|
||||
check("project MEMORY.md points at bun_build.md", projectIndex.includes("[bun_build](bun_build.md)"));
|
||||
const globalIndex = readFileSync(join(home, "memory", "global", "MEMORY.md"), "utf8");
|
||||
check("global MEMORY.md points at tabs_not_spaces.md", globalIndex.includes("[tabs_not_spaces](tabs_not_spaces.md)"));
|
||||
|
||||
const raw = readFileSync(projectFile, "utf8");
|
||||
check("frontmatter has name/type/scope/created", /^---\nname: bun_build\n/.test(raw) && /type: project/.test(raw) && /scope: project/.test(raw) && /created: \d{4}-\d{2}-\d{2}/.test(raw));
|
||||
|
||||
// ── 2. Prefix assembly via applyMemoryStack (+ REASONIX.md) ────────
|
||||
process.stdout.write("\n2. Prefix assembly (REASONIX.md + user memory)\n");
|
||||
writeFileSync(join(projectRoot, "REASONIX.md"), "# Project notes\nPrefer explicit types over inference.\n", "utf8");
|
||||
const BASE = "You are a test assistant.";
|
||||
const withProjOnly = applyUserMemory(BASE, { homeDir: home, projectRoot });
|
||||
check("applyUserMemory contains global block", withProjOnly.includes("# User memory — global"));
|
||||
check("applyUserMemory contains project block", withProjOnly.includes("# User memory — this project"));
|
||||
check("bun_build description present in prefix", withProjOnly.includes("bun run build"));
|
||||
check("tabs_not_spaces description present in prefix", withProjOnly.includes("Use tabs for indentation"));
|
||||
|
||||
// Order: base → (REASONIX.md would go first via applyMemoryStack) → global → project
|
||||
const ordered = applyUserMemory(BASE, { homeDir: home, projectRoot });
|
||||
const iGlobalBlock = ordered.indexOf("# User memory — global");
|
||||
const iProjBlock = ordered.indexOf("# User memory — this project");
|
||||
check("global block precedes project block (stable for cache)", iGlobalBlock > 0 && iGlobalBlock < iProjBlock);
|
||||
|
||||
// Determinism — two calls with same state produce byte-identical prompts.
|
||||
const a = applyUserMemory(BASE, { homeDir: home, projectRoot });
|
||||
const b = applyUserMemory(BASE, { homeDir: home, projectRoot });
|
||||
check("applyUserMemory is deterministic (byte-stable)", a === b);
|
||||
|
||||
// ── 3. The `remember` / `recall_memory` / `forget` tools ───────────
|
||||
process.stdout.write("\n3. Tool dispatch (remember / recall / forget)\n");
|
||||
const reg = new ToolRegistry();
|
||||
registerMemoryTools(reg, { homeDir: home, projectRoot });
|
||||
check("remember tool registered", reg.has("remember"));
|
||||
check("forget tool registered", reg.has("forget"));
|
||||
check("recall_memory tool registered", reg.has("recall_memory"));
|
||||
check("recall_memory is readOnly (plan-mode safe)", reg.get("recall_memory")?.readOnly === true);
|
||||
check("remember is NOT readOnly (plan-mode blocked)", reg.get("remember")?.readOnly !== true);
|
||||
|
||||
const remOut = await reg.dispatch("remember", {
|
||||
type: "feedback",
|
||||
scope: "global",
|
||||
name: "prefers_short_replies",
|
||||
description: "User wants terse answers, no trailing summaries",
|
||||
content: "Default to terse. If the user wants detail they'll ask.",
|
||||
});
|
||||
check("remember returns a confirmation (not an error)", remOut.includes("REMEMBERED (global/prefers_short_replies)"), remOut);
|
||||
|
||||
const recallOut = await reg.dispatch("recall_memory", {
|
||||
scope: "global",
|
||||
name: "prefers_short_replies",
|
||||
});
|
||||
check("recall_memory returns the body", recallOut.includes("Default to terse"));
|
||||
|
||||
const forgetOut = await reg.dispatch("forget", {
|
||||
scope: "global",
|
||||
name: "prefers_short_replies",
|
||||
});
|
||||
check("forget returns a confirmation", forgetOut.includes("forgot (global/prefers_short_replies)"));
|
||||
check("recall_memory after forget returns an error", (await reg.dispatch("recall_memory", { scope: "global", name: "prefers_short_replies" })).includes("error"));
|
||||
|
||||
// ── 4. Project scope refused when projectRoot is absent ────────────
|
||||
process.stdout.write("\n4. Chat-mode (no projectRoot) refuses project scope\n");
|
||||
const chatReg = new ToolRegistry();
|
||||
registerMemoryTools(chatReg, { homeDir: home });
|
||||
const projInChat = await chatReg.dispatch("remember", {
|
||||
type: "project",
|
||||
scope: "project",
|
||||
name: "should_fail",
|
||||
description: "d",
|
||||
content: "c",
|
||||
});
|
||||
check("scope='project' in chat mode → error payload", projInChat.includes("error") && projInChat.includes("project"));
|
||||
const globalInChat = await chatReg.dispatch("remember", {
|
||||
type: "user",
|
||||
scope: "global",
|
||||
name: "global_from_chat",
|
||||
description: "works across projects",
|
||||
content: "body",
|
||||
});
|
||||
check("scope='global' in chat mode → writes successfully", globalInChat.includes("REMEMBERED (global/"));
|
||||
|
||||
// ── 5. REASONIX_MEMORY=off short-circuit ───────────────────────────
|
||||
process.stdout.write("\n5. REASONIX_MEMORY=off opt-out\n");
|
||||
process.env.REASONIX_MEMORY = "off";
|
||||
try {
|
||||
const silenced = applyUserMemory(BASE, { homeDir: home, projectRoot });
|
||||
check("applyUserMemory returns BASE unchanged when off", silenced === BASE);
|
||||
const fullStack = applyMemoryStack(BASE, projectRoot);
|
||||
check("applyMemoryStack returns BASE unchanged when off (REASONIX.md also skipped)", fullStack === BASE);
|
||||
} finally {
|
||||
delete process.env.REASONIX_MEMORY;
|
||||
}
|
||||
|
||||
// ── 6. Delete regeneration: MEMORY.md matches current file set ─────
|
||||
process.stdout.write("\n6. Delete + index regeneration\n");
|
||||
store.delete("global", "tabs_not_spaces");
|
||||
store.delete("global", "global_from_chat");
|
||||
const globalIdxAfter = join(home, "memory", "global", "MEMORY.md");
|
||||
check("global MEMORY.md removed when last file deleted", !existsSync(globalIdxAfter));
|
||||
const projectIdxStill = readFileSync(join(home, "memory", hash, "MEMORY.md"), "utf8");
|
||||
check("project MEMORY.md untouched (different scope)", projectIdxStill.includes("bun_build"));
|
||||
|
||||
// ── 7. Name-sanitization boundary ──────────────────────────────────
|
||||
process.stdout.write("\n7. Name sanitization (path-traversal refused)\n");
|
||||
const badOut = await reg.dispatch("remember", {
|
||||
type: "user",
|
||||
scope: "global",
|
||||
name: "../../etc/passwd",
|
||||
description: "d",
|
||||
content: "c",
|
||||
});
|
||||
check("remember refuses path-traversal name", badOut.includes("invalid memory name"));
|
||||
const outsideFile = join(home, "etc", "passwd.md");
|
||||
check("no file written outside the memory dir", !existsSync(outsideFile));
|
||||
|
||||
process.stdout.write(`\n${failures === 0 ? "✅ all smoke checks passed" : `❌ ${failures} failure(s)`}\n`);
|
||||
} finally {
|
||||
rmSync(home, { recursive: true, force: true });
|
||||
rmSync(projectRoot, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
process.exit(failures === 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import { defineConfig } from 'astro/config';
|
||||
import sitemap from '@astrojs/sitemap';
|
||||
|
||||
// Served from the custom domain reasonix.io at the site root.
|
||||
export default defineConfig({
|
||||
site: 'https://reasonix.io',
|
||||
// Documentation code samples intentionally use source newlines as content.
|
||||
// Astro 7's JSX-style compression removes those newlines unless disabled.
|
||||
compressHTML: false,
|
||||
build: { assets: 'static' },
|
||||
integrations: [sitemap({
|
||||
filter: (page) => !/\/changelog\/(?:stable|preview|studio)\/?$/.test(page) &&
|
||||
!/\/changelog\/v\d+\.\d+\.\d+-/.test(page) &&
|
||||
!/\/(?:login|register|forgot|reset|account|device|u)\/?$/.test(page),
|
||||
})],
|
||||
});
|
||||
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "reasonix-site",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"prebuild": "node scripts/releases/sync-releases.mjs && node scripts/fetch-community.mjs && node scripts/fetch-publications.mjs",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"test": "node --test src/scripts/*.test.mjs scripts/releases/*.test.mjs",
|
||||
"release:validate": "node scripts/releases/release-notes.mjs validate"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/sitemap": "^3.7.4",
|
||||
"@fontsource-variable/inter": "^5.3.0",
|
||||
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
||||
"astro": "^7.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sharp": "^0.35.3"
|
||||
},
|
||||
"overrides": {
|
||||
"esbuild": "0.28.1"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 91 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="296" height="296" viewBox="0 0 296 296" class="segno"><title>QQ group 1093562660 join QR code</title><g transform="scale(8)"><path fill="#fff" d="M0 0h37v37h-37z"/><path class="qrline" stroke="#000" d="M4 4.5h7m2 0h1m1 0h1m2 0h1m2 0h1m1 0h2m1 0h7m-29 1h1m5 0h1m5 0h1m3 0h2m2 0h1m1 0h1m5 0h1m-29 1h1m1 0h3m1 0h1m2 0h4m1 0h2m1 0h1m2 0h1m1 0h1m1 0h3m1 0h1m-29 1h1m1 0h3m1 0h1m6 0h1m2 0h1m1 0h3m1 0h1m1 0h3m1 0h1m-29 1h1m1 0h3m1 0h1m11 0h1m1 0h1m1 0h1m1 0h3m1 0h1m-29 1h1m5 0h1m1 0h5m2 0h3m1 0h1m2 0h1m5 0h1m-29 1h7m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h7m-20 1h1m1 0h3m1 0h3m-18 1h1m2 0h1m1 0h2m1 0h1m1 0h2m2 0h1m1 0h1m1 0h2m1 0h1m1 0h1m-21 1h1m1 0h1m1 0h2m1 0h1m2 0h1m1 0h4m1 0h1m1 0h1m2 0h1m2 0h1m-29 1h4m1 0h4m1 0h2m1 0h3m2 0h2m3 0h5m-28 1h4m4 0h1m3 0h2m2 0h1m9 0h2m-28 1h2m2 0h1m1 0h1m1 0h5m1 0h2m1 0h1m1 0h2m1 0h2m1 0h1m1 0h2m-28 1h1m1 0h2m3 0h1m2 0h1m1 0h4m1 0h2m1 0h1m-22 1h2m1 0h2m1 0h1m1 0h1m1 0h1m1 0h3m3 0h1m1 0h2m1 0h1m1 0h4m-28 1h2m1 0h2m2 0h1m1 0h1m4 0h1m1 0h1m1 0h1m1 0h2m1 0h2m1 0h1m-28 1h4m2 0h2m1 0h3m1 0h1m3 0h3m1 0h1m5 0h1m-27 1h2m2 0h1m1 0h1m2 0h1m1 0h5m1 0h1m2 0h2m2 0h1m2 0h1m-29 1h1m1 0h2m1 0h6m3 0h5m3 0h3m2 0h2m-27 1h2m4 0h1m1 0h2m2 0h1m2 0h1m1 0h2m3 0h1m2 0h2m-29 1h1m2 0h1m2 0h1m2 0h1m5 0h3m1 0h6m1 0h1m-19 1h2m1 0h2m1 0h2m1 0h4m3 0h1m1 0h3m-29 1h7m2 0h1m2 0h1m4 0h2m1 0h1m1 0h1m1 0h1m2 0h1m-28 1h1m5 0h1m1 0h2m1 0h1m2 0h2m3 0h2m3 0h5m-29 1h1m1 0h3m1 0h1m2 0h2m1 0h1m3 0h3m1 0h5m2 0h1m-28 1h1m1 0h3m1 0h1m1 0h2m2 0h2m1 0h2m1 0h2m2 0h5m1 0h1m-29 1h1m1 0h3m1 0h1m2 0h2m1 0h1m1 0h1m2 0h4m3 0h3m1 0h1m-29 1h1m5 0h1m2 0h1m2 0h1m1 0h1m2 0h1m1 0h2m1 0h1m4 0h1m-28 1h7m1 0h1m3 0h2m2 0h2m2 0h3m1 0h1m2 0h1"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="_图层_1" data-name=" 图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
fill: #0153e5;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<rect class="cls-2" y="0" width="64" height="64" rx="20.22" ry="20.22"/>
|
||||
<path class="cls-1" d="M40.53,37.67h0c2.26-.67,4.24-1.86,5.83-3.59h0c1.73-1.94,2.82-4.29,3.2-6.87.86-5.64-1.94-10.79-7.21-12.97-1.85-.74-3.76-1.06-5.78-1.04h-19.6v37.56h9.64v-12.68c1.05.34,2.16.52,3.29.52l3.15,4.35,5.73,7.83,11.44-.02-9.7-13.1h0ZM40.14,35.94c-1.31.43-2.72.37-4.06-.02-2.3-1.74-3.55-3.6-5.52-5.37-2.52-2.27-5.84-3.84-9.25-3.69.27-.74.66-1.45,1.17-2.11,1.76-2.2,4.16-2.9,6.92-2.51,1.02.14,2.11-1.05,4.18-.82.14.02.28.12.29.2.05.28-.75.44-.75,1.21,0,.32.15.7.45.92,1.06.74,1.97,1.57,2.93,2.43.47.42,2.04,1.59,2.44.64.24-.56.39-1.14.54-1.74.08-.29-.09-.47-.32-.61-1.63-.96-2.24-2.97-1.6-4.75.06-.17.22-.25.36-.26.55-.02.25.99,1.61,1.4,1.28.4,1.32,1.46,1.94,1.04,1.45-.99,1.97-.18,3.32-1.45.14-.13.38-.14.52-.04.09.06.17.22.16.41-.04,1.07-.46,2.1-1.19,2.88-1.39,1.49-2.55.77-2.62,1.82-.22,3.06-1.22,6.11-3.39,8.33-.07.07-.11.17-.1.24.01.07.1.14.19.17l1.83.62c.26.09.45.32.41.57-.03.22-.2.41-.45.49h0Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="_图层_1" data-name=" 图层 1" xmlns="http://www.w3.org/2000/svg" width="1151.55" height="217.07" viewBox="0 0 1151.55 217.07">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #0153e5;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<circle class="cls-1" cx="972.16" cy="33.55" r="23.88"/>
|
||||
<g>
|
||||
<path class="cls-1" d="M488.72,211.37c-12.37,1.71-24.96.46-38.13.63l-1.23-16.27c-12.87,14.9-29.84,21.97-49.07,19.87-24.58-2.69-44.41-19.38-53.2-42.6-7.32-19.32-6.99-40.86.81-60.12,9.5-23.46,30.72-40.21,55.73-42.02,18.41-1.33,34.33,4.84,45.96,18.54l1.13-15.37,37.63-.22.36,137.56h.01ZM451.41,143.22c0-19.82-16.06-35.88-35.88-35.88s-35.88,16.06-35.88,35.88,16.06,35.88,35.88,35.88,35.88-16.06,35.88-35.88Z"/>
|
||||
<path class="cls-1" d="M294.69,165.71c11.08,4.99,20.6,11.87,31.28,18.31-14.54,22.26-39.3,32.78-65.14,31.91-42.29-1.42-73.12-35.5-70.7-77.31,2.1-36.29,28.66-64.56,65.17-67.92,26.31-2.42,52.01,8.19,66.02,30.99,9.52,15.5,11.55,33.39,9.76,50.92l-101,.13c1.4,14.77,13.51,25.01,25.92,27.74,14.72,3.24,29.02-.82,38.69-14.77h0ZM294.02,127.16c-4.12-16.52-17.68-24.4-32.5-24.13-13.74.25-27.5,9.07-30.5,24.11l63,.02h0Z"/>
|
||||
<path class="cls-1" d="M780.3,143.31c0,40.74-33.02,73.76-73.76,73.76s-73.76-33.02-73.76-73.76,33.02-73.76,73.76-73.76,73.76,33.02,73.76,73.76ZM742.63,143.26c0-19.97-16.19-36.16-36.16-36.16s-36.16,16.19-36.16,36.16,16.19,36.16,36.16,36.16,36.16-16.19,36.16-36.16Z"/>
|
||||
<path class="cls-1" d="M865.82,106.67c-16.4-.48-30.2,10.42-30.32,26.41l-.59,78.88-38.91-.18.06-137.83,38.15.35c.41,5.66-1.03,9.97,1.45,15.75,19.54-26.51,63.34-25.07,82.95-1.16,9.2,11.23,13.46,25.62,13.45,40.38l-.06,82.62-38.94.14-.69-79.28c-.13-14.92-10.82-25.64-26.54-26.1v.02h-.01Z"/>
|
||||
<path class="cls-1" d="M1151.55,211.51l-44.84.51-29.9-41.82-30.52,41.81-43.29-.52,50.71-70.03-48.12-67.06c16.29-1.81,30.31-.14,45.42-.02l26.06,38.81,27.14-39.29c14.85-.38,28.79-.61,44.5.69l-47.96,66.65,50.79,70.28h0Z"/>
|
||||
<path class="cls-1" d="M595.11,210.55c-30.01,11.52-78.69,6.96-94.37-27.63l29.88-14.4c4.49,1.96,5.5,6.8,9.44,9.49,16.43,11.17,43.99,9.75,44.36-4.61.12-4.72-3.46-8.89-8.58-10.29l-36.51-9.95c-11.77-3.21-22.59-9.81-28.13-21.2-10.25-21.06.12-45.53,21.63-54.96,29.01-12.72,77.53-8.27,89.7,25.13l-29.06,12.62c-10.47-12.8-27.66-16.84-42.64-10.42-3.51,1.5-5.54,6.03-5.28,8.81.35,3.7,3.39,7.71,7.59,8.86l40.46,11.09c9.77,2.68,19.02,7.82,24.29,16.77,13.52,22.96,2.31,51.05-22.78,60.69h0Z"/>
|
||||
<rect class="cls-1" x="902.92" y="123.55" width="138.32" height="38.82" transform="translate(828.4464 1114.9374) rotate(-89.96)"/>
|
||||
<path class="cls-1" d="M134.57,139.75l.02-.02c12.9-3.8,24.24-10.63,33.31-20.48v-.03c9.89-11.07,16.1-24.46,18.25-39.19,4.93-32.21-11.06-61.62-41.17-74.07C134.39,1.71,123.51-.11,111.97,0L0,.03v214.57l55.04-.04v-72.42c6,1.93,12.33,2.97,18.82,2.94l18.02,24.87,32.75,44.72,65.37-.09-55.43-74.84h0ZM132.36,129.86c-7.5,2.48-15.55,2.11-23.21-.12-13.17-9.95-20.3-20.57-31.51-30.7-14.37-12.97-33.39-21.96-52.86-21.08,1.55-4.25,3.78-8.31,6.68-12.03,10.05-12.55,23.77-16.55,39.52-14.34,5.82.82,12.03-6.02,23.86-4.7.79.09,1.6.68,1.67,1.16.27,1.61-4.3,2.49-4.3,6.9,0,1.86.83,4.01,2.59,5.24,6.03,4.23,11.26,8.99,16.72,13.9,2.66,2.39,11.66,9.1,13.95,3.64,1.34-3.19,2.22-6.53,3.11-9.93.44-1.68-.49-2.68-1.85-3.48-9.29-5.51-12.79-16.96-9.16-27.12.35-.98,1.26-1.46,2.03-1.49,3.12-.13,1.46,5.65,9.18,8.03,7.32,2.26,7.54,8.34,11.1,5.92,8.29-5.65,11.28-1.02,18.98-8.27.79-.74,2.15-.8,2.97-.22.51.35.95,1.26.91,2.33-.22,6.12-2.61,11.97-6.8,16.46-7.91,8.49-14.56,4.43-14.99,10.38-1.26,17.46-6.97,34.9-19.37,47.58-.4.41-.63.99-.57,1.38.07.41.56.82,1.1.99l10.44,3.55c1.47.5,2.55,1.83,2.35,3.24-.17,1.23-1.15,2.32-2.55,2.79h.01Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 77 KiB |
@@ -1,4 +0,0 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://reasonix.io/sitemap-index.xml
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -1,63 +0,0 @@
|
||||
// Prebuild: fetch live community stats + bake contributor avatars into public/av/.
|
||||
// Never fails the build — falls back to the committed snapshot on any error.
|
||||
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
||||
import sharp from 'sharp';
|
||||
|
||||
const repo = 'esengine/DeepSeek-Reasonix';
|
||||
const api = `https://api.github.com/repos/${repo}`;
|
||||
const headers = { 'User-Agent': 'reasonix-site', Accept: 'application/vnd.github+json' };
|
||||
if (process.env.GITHUB_TOKEN) headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
||||
|
||||
const fallback = JSON.parse(await readFile('src/data/contributors.json', 'utf8'));
|
||||
let { stars, mergedPrs, contributors, list } = fallback;
|
||||
|
||||
try {
|
||||
const r = await fetch(`${api}/contributors?per_page=100`, { headers });
|
||||
if (r.ok) {
|
||||
const humans = (await r.json())
|
||||
.filter((c) => c.type === 'User')
|
||||
.map((c) => ({ login: c.login, avatar: String(c.avatar_url).split('?')[0], url: c.html_url, c: c.contributions }));
|
||||
if (humans.length) { list = humans; contributors = humans.length; }
|
||||
}
|
||||
} catch {}
|
||||
try {
|
||||
const r = await fetch(api, { headers });
|
||||
if (r.ok) { const d = await r.json(); if (typeof d.stargazers_count === 'number') stars = d.stargazers_count; }
|
||||
} catch {}
|
||||
try {
|
||||
const r = await fetch(`https://api.github.com/search/issues?q=repo:${repo}+is:pr+is:merged&per_page=1`, { headers });
|
||||
if (r.ok) { const d = await r.json(); if (typeof d.total_count === 'number') mergedPrs = d.total_count; }
|
||||
} catch {}
|
||||
|
||||
// 64px is the largest rendered avatar; bake at 2x. GitHub honours ?s= for its
|
||||
// own CDN but serves some custom avatars unscaled and in whatever format was
|
||||
// uploaded, so re-encode rather than trusting the response.
|
||||
const AVATAR_PX = 128;
|
||||
|
||||
await rm('public/av', { recursive: true, force: true });
|
||||
await mkdir('public/av', { recursive: true });
|
||||
let baked = 0;
|
||||
let bakedBytes = 0;
|
||||
const out = await Promise.all(list.map(async (c) => {
|
||||
const remote = `${c.avatar}?s=${AVATAR_PX}`;
|
||||
try {
|
||||
const r = await fetch(remote);
|
||||
if (!r.ok) throw new Error(String(r.status));
|
||||
const webp = await sharp(Buffer.from(await r.arrayBuffer()))
|
||||
.resize(AVATAR_PX, AVATAR_PX, { fit: 'cover' })
|
||||
.webp({ quality: 80 })
|
||||
.toBuffer();
|
||||
await writeFile(`public/av/${c.login}.webp`, webp);
|
||||
baked++;
|
||||
bakedBytes += webp.byteLength;
|
||||
return { ...c, avatar: `/av/${c.login}.webp` };
|
||||
} catch {
|
||||
return { ...c, avatar: remote };
|
||||
}
|
||||
}));
|
||||
|
||||
await writeFile('src/data/community.json', JSON.stringify({ stars, mergedPrs, contributors, list: out }, null, 2) + '\n');
|
||||
console.log(
|
||||
`community: ${contributors} contributors · ${stars} stars · ${mergedPrs} merged PRs · ` +
|
||||
`${baked}/${out.length} avatars baked (${(bakedBytes / 1024).toFixed(0)} KB)`,
|
||||
);
|
||||
@@ -1,49 +0,0 @@
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { validateReleaseEvent } from "./release-event.mjs";
|
||||
|
||||
const siteRoot = resolve(import.meta.dirname, "..");
|
||||
const catalog = JSON.parse(await readFile(resolve(siteRoot, "src/data/releases.json"), "utf8"));
|
||||
const output = resolve(siteRoot, ".generated/publications.json");
|
||||
const headers = {
|
||||
Accept: "application/vnd.github+json",
|
||||
"User-Agent": "reasonix-site-publications",
|
||||
};
|
||||
if (process.env.GITHUB_TOKEN) headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
||||
|
||||
const publications = [];
|
||||
for (const release of catalog.releases) {
|
||||
// Legacy entries predate publication markers and remain public. Every new
|
||||
// reviewed entry fails closed until its exact CLI release carries the marker
|
||||
// uploaded by the all-surface postflight.
|
||||
if (!release.status || release.status === "published") {
|
||||
publications.push(release.version);
|
||||
continue;
|
||||
}
|
||||
const tag = `v${release.version}`;
|
||||
try {
|
||||
const response = await fetch(
|
||||
`https://api.github.com/repos/esengine/DeepSeek-Reasonix/releases/tags/${encodeURIComponent(tag)}`,
|
||||
{ headers, signal: AbortSignal.timeout(20_000) },
|
||||
);
|
||||
if (!response.ok) continue;
|
||||
const githubRelease = await response.json();
|
||||
const marker = githubRelease.assets?.find((asset) => asset.name === "release-event.json" && asset.size > 0);
|
||||
if (!marker?.browser_download_url) continue;
|
||||
const markerResponse = await fetch(marker.browser_download_url, {
|
||||
headers,
|
||||
signal: AbortSignal.timeout(20_000),
|
||||
});
|
||||
if (!markerResponse.ok) continue;
|
||||
const event = await markerResponse.json();
|
||||
validateReleaseEvent(event, release);
|
||||
publications.push(release.version);
|
||||
} catch {
|
||||
// A reviewed release must never become public because an upstream lookup
|
||||
// failed. The next Pages build retries after the release postflight.
|
||||
}
|
||||
}
|
||||
|
||||
await mkdir(resolve(siteRoot, ".generated"), { recursive: true });
|
||||
await writeFile(output, `${JSON.stringify({ schemaVersion: 1, publications }, null, 2)}\n`);
|
||||
console.log(`Resolved ${publications.length} public release note(s).`);
|
||||
@@ -1,27 +0,0 @@
|
||||
function invariant(condition, message) {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
export function validateReleaseEvent(event, release) {
|
||||
invariant(event && typeof event === "object" && !Array.isArray(event), "release event must be an object");
|
||||
invariant(event.schemaVersion === 1, "release event schemaVersion must be 1");
|
||||
invariant(event.releaseId === release.version, "release event releaseId does not match reviewed notes");
|
||||
invariant(
|
||||
event.channel === (release.channel === "prerelease" ? "preview" : "stable"),
|
||||
"release event channel does not match reviewed notes",
|
||||
);
|
||||
invariant(/^[0-9a-f]{40}$/.test(event.candidateSha), "release event candidateSha must be a full commit SHA");
|
||||
if (release.candidateSha) {
|
||||
invariant(event.candidateSha === release.candidateSha, "release event candidateSha does not match reviewed notes");
|
||||
}
|
||||
invariant(/^\d{4}-\d{2}-\d{2}T/.test(event.publishedAt), "release event publishedAt must be an ISO timestamp");
|
||||
invariant(event.releaseNotesUrl === `https://reasonix.io/changelog/v${release.version}/`, "release event URL is invalid");
|
||||
invariant(event.builds && typeof event.builds === "object", "release event builds are required");
|
||||
for (const surface of ["cli", "desktop", "npm"]) {
|
||||
invariant(typeof event.builds[surface] === "string" && event.builds[surface], `release event builds.${surface} is required`);
|
||||
if (release.builds?.[surface]) {
|
||||
invariant(event.builds[surface] === release.builds[surface], `release event builds.${surface} does not match reviewed notes`);
|
||||
}
|
||||
}
|
||||
return event;
|
||||
}
|
||||
@@ -1,349 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname } from "node:path";
|
||||
import { withoutOwner } from "../../src/lib/repository-owner.mjs";
|
||||
import { compareVersionsDesc, loadCatalog, upsertRelease, validateCatalog } from "./release-notes.mjs";
|
||||
|
||||
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
|
||||
const apiBase = process.env.DEEPSEEK_API_BASE || "https://api.deepseek.com";
|
||||
const model = process.env.DEEPSEEK_MODEL || "deepseek-v4-pro";
|
||||
const releaseTargetOrder = ["desktop", "cli", "site", "service"];
|
||||
|
||||
export const releaseOutputBudgets = Object.freeze({
|
||||
standard: Object.freeze({ highlights: 6, changes: 15, guides: 6, upgrade: 4, risks: 4, bodyChars: 280 }),
|
||||
compact: Object.freeze({ highlights: 4, changes: 9, guides: 4, upgrade: 2, risks: 2, bodyChars: 220 }),
|
||||
});
|
||||
|
||||
export function editorialLimitInstruction(compact = false) {
|
||||
const budget = compact ? releaseOutputBudgets.compact : releaseOutputBudgets.standard;
|
||||
return `Editorial budget: at most ${budget.highlights} highlights, ${budget.changes} total change items across new/improved/fixed, ${budget.guides} guides, ${budget.upgrade} upgrade notes, and ${budget.risks} risks. Keep every English and Chinese body within ${budget.bodyChars} characters. Select the most important user outcomes across the supplied PRs, combine related work, and avoid repeating the same outcome in highlights and changes. Always return a complete JSON object within this budget.`;
|
||||
}
|
||||
|
||||
function parseArgs(argv) {
|
||||
const values = {};
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const arg = argv[index];
|
||||
if (!arg.startsWith("--")) throw new Error(`unexpected argument ${arg}`);
|
||||
values[arg.slice(2)] = argv[++index];
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
function runGit(args) {
|
||||
return execFileSync("git", args, { cwd: repoRoot, encoding: "utf8" }).trim();
|
||||
}
|
||||
|
||||
function normalizeVersion(version) {
|
||||
return String(version || "").replace(/^(?:desktop-|npm-)?v/, "");
|
||||
}
|
||||
|
||||
function repositoryName() {
|
||||
if (process.env.GITHUB_REPOSITORY) return process.env.GITHUB_REPOSITORY;
|
||||
const remote = runGit(["remote", "get-url", "origin"]);
|
||||
const match = remote.match(/github\.com[/:]([^/]+\/[^/.]+)(?:\.git)?$/);
|
||||
if (!match) throw new Error("cannot determine GitHub repository; set GITHUB_REPOSITORY");
|
||||
return match[1];
|
||||
}
|
||||
|
||||
function commitRange(from, to) {
|
||||
return runGit(["log", "--first-parent", "--format=%H%x09%s%x09%b%x00", `${from}..${to}`])
|
||||
.split("\0")
|
||||
.map((record) => record.trim())
|
||||
.filter(Boolean)
|
||||
.map((record) => {
|
||||
const [sha, subject, ...body] = record.split("\t");
|
||||
return { sha, subject, body: body.join("\t").trim() };
|
||||
});
|
||||
}
|
||||
|
||||
function prNumbersFromCommits(commits) {
|
||||
const refs = new Set();
|
||||
for (const commit of commits) {
|
||||
for (const match of `${commit.subject}\n${commit.body}`.matchAll(/#(\d+)/g)) refs.add(Number(match[1]));
|
||||
}
|
||||
return [...refs];
|
||||
}
|
||||
|
||||
async function githubJson(path, { allowMissing = false } = {}) {
|
||||
const headers = { Accept: "application/vnd.github+json", "User-Agent": "reasonix-release-notes" };
|
||||
if (process.env.GITHUB_TOKEN || process.env.GH_TOKEN) {
|
||||
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN || process.env.GH_TOKEN}`;
|
||||
}
|
||||
const response = await fetch(`https://api.github.com${path}`, { headers, signal: AbortSignal.timeout(30_000) });
|
||||
if (allowMissing && response.status === 404) return null;
|
||||
if (!response.ok) throw new Error(`GitHub API ${path} failed: ${response.status}`);
|
||||
return response.json();
|
||||
}
|
||||
|
||||
async function githubList(path) {
|
||||
const items = [];
|
||||
for (let page = 1; ; page += 1) {
|
||||
const separator = path.includes("?") ? "&" : "?";
|
||||
const batch = await githubJson(`${path}${separator}per_page=100&page=${page}`);
|
||||
items.push(...batch);
|
||||
if (batch.length < 100) return items;
|
||||
}
|
||||
}
|
||||
|
||||
export function inferPullTargetHints(labels, files) {
|
||||
const labelSet = new Set(labels);
|
||||
const targets = new Set();
|
||||
const add = (target) => targets.add(target);
|
||||
const hasPath = (pattern) => files.some((path) => pattern.test(path));
|
||||
|
||||
const explicitlyDesktop = labelSet.has("desktop");
|
||||
const explicitlyCLI = labelSet.has("tui") || labelSet.has("cli");
|
||||
if (explicitlyDesktop) add("desktop");
|
||||
if (explicitlyCLI) add("cli");
|
||||
if (hasPath(/^desktop\//)) add("desktop");
|
||||
if (hasPath(/^(?:internal\/cli\/|cmd\/)/)) add("cli");
|
||||
if (hasPath(/^site\//)) add("site");
|
||||
if (hasPath(/^(?:workers\/|\.github\/|scripts\/|release-notes\/)/)) add("service");
|
||||
|
||||
const hasSharedProductCode = files.some((path) =>
|
||||
/^(?:internal\/|sdk\/|npm\/)/.test(path) &&
|
||||
!/^internal\/cli\//.test(path) &&
|
||||
!/^internal\/telemetry\//.test(path),
|
||||
);
|
||||
if (!explicitlyDesktop && !explicitlyCLI && hasSharedProductCode) {
|
||||
add("desktop");
|
||||
add("cli");
|
||||
}
|
||||
if (!targets.size) {
|
||||
add("desktop");
|
||||
add("cli");
|
||||
}
|
||||
return releaseTargetOrder.filter((target) => targets.has(target));
|
||||
}
|
||||
|
||||
async function collectPullRequests(repository, commits) {
|
||||
const numbers = new Set(prNumbersFromCommits(commits));
|
||||
const associated = await Promise.all(
|
||||
commits.map((commit) => githubJson(`/repos/${repository}/commits/${commit.sha}/pulls`, { allowMissing: true })),
|
||||
);
|
||||
for (const pulls of associated) for (const pull of pulls || []) numbers.add(pull.number);
|
||||
const pulls = await Promise.all([...numbers].map((number) => githubJson(`/repos/${repository}/pulls/${number}`, { allowMissing: true })));
|
||||
return Promise.all(pulls.filter(Boolean).map(async (pull) => {
|
||||
const labels = (pull.labels || []).map((label) => label.name);
|
||||
const files = (await githubList(`/repos/${repository}/pulls/${pull.number}/files`)).map((file) => file.filename);
|
||||
return {
|
||||
number: pull.number,
|
||||
title: pull.title,
|
||||
body: String(pull.body || "").slice(0, 2000),
|
||||
author: pull.user?.login || "",
|
||||
labels,
|
||||
changedFileCount: files.length,
|
||||
files: files.slice(0, 200),
|
||||
targetHints: inferPullTargetHints(labels, files),
|
||||
};
|
||||
}));
|
||||
}
|
||||
|
||||
function releaseItems(release) {
|
||||
return [
|
||||
...(release.highlights || []),
|
||||
...["new", "improved", "fixed"].flatMap((kind) => release.changes?.[kind] || []),
|
||||
...(release.upgrade || []),
|
||||
...(release.risks || []),
|
||||
];
|
||||
}
|
||||
|
||||
function normalizeReleaseTargets(release) {
|
||||
for (const item of releaseItems(release)) {
|
||||
if (!Array.isArray(item.targets)) continue;
|
||||
item.targets.sort((a, b) => releaseTargetOrder.indexOf(a) - releaseTargetOrder.indexOf(b));
|
||||
}
|
||||
const targets = new Set(releaseItems(release).flatMap((item) => item.targets || []));
|
||||
release.surfaces = [
|
||||
...releaseTargetOrder.filter((target) => targets.has(target)),
|
||||
...[...targets].filter((target) => !releaseTargetOrder.includes(target)).sort(),
|
||||
];
|
||||
}
|
||||
|
||||
function collectDocLinks(from, repository, to) {
|
||||
const linkRef = runGit(["rev-parse", to]);
|
||||
const paths = runGit(["diff", "--name-only", `${from}..${to}`])
|
||||
.split("\n")
|
||||
.filter((path) => /^(?:docs|README)[/\w.-]*\.(?:md|mdx)$/i.test(path));
|
||||
return paths.map((path) => `https://github.com/${repository}/blob/${linkRef}/${path}`);
|
||||
}
|
||||
|
||||
function assertGroundedRefs(value, allowedRefs, path = "release") {
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((item, index) => assertGroundedRefs(item, allowedRefs, `${path}[${index}]`));
|
||||
return;
|
||||
}
|
||||
if (!value || typeof value !== "object") return;
|
||||
if (Array.isArray(value.refs)) {
|
||||
for (const ref of value.refs) {
|
||||
if (!allowedRefs.has(ref)) throw new Error(`${path}.refs contains PR #${ref}, which is outside the release range`);
|
||||
}
|
||||
}
|
||||
for (const [key, child] of Object.entries(value)) assertGroundedRefs(child, allowedRefs, `${path}.${key}`);
|
||||
}
|
||||
|
||||
function extractJson(content) {
|
||||
if (!content?.trim()) throw new Error("DeepSeek returned empty content");
|
||||
const parsed = JSON.parse(content);
|
||||
return parsed.release || parsed;
|
||||
}
|
||||
|
||||
async function askDeepSeek(payload, attempt = 0) {
|
||||
const key = process.env.DEEPSEEK_API_KEY;
|
||||
if (!key) throw new Error("DEEPSEEK_API_KEY is required");
|
||||
const compact = attempt > 0;
|
||||
const response = await fetch(`${apiBase.replace(/\/$/, "")}/chat/completions`, {
|
||||
method: "POST",
|
||||
headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model,
|
||||
// Release notes need deterministic structured output, not hidden chain of
|
||||
// thought. Thinking tokens share the generation budget with content and
|
||||
// can otherwise leave response_format JSON empty or truncated.
|
||||
thinking: { type: "disabled" },
|
||||
temperature: 0,
|
||||
max_tokens: 8000,
|
||||
response_format: { type: "json_object" },
|
||||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content: `You are Reasonix's release editor. Return one JSON object with a \"release\" property. Write factual, user-facing product release notes in equivalent English and Simplified Chinese. Group changes by user outcome, not by commit. Never invent capabilities, migrations, risks, PR numbers, contributors, URLs, or metrics. Every highlight and change must cite one or more supplied PR numbers. Use this exact release shape:
|
||||
{
|
||||
\"version\": \"semver\", \"date\": \"YYYY-MM-DD\", \"channel\": \"stable|prerelease\", \"targetingVersion\": 1,
|
||||
\"title\": {\"en\":\"\",\"zh\":\"\"}, \"summary\": {\"en\":\"\",\"zh\":\"\"},
|
||||
\"surfaces\": [\"desktop\",\"cli\"],
|
||||
\"guides\": [{\"title\":{\"en\":\"\",\"zh\":\"\"},\"body\":{\"en\":\"\",\"zh\":\"\"},\"href\":\"https://...\"}],
|
||||
\"highlights\": [{\"kind\":\"new|improved|fixed|security\",\"targets\":[\"desktop\",\"cli\"],\"title\":{\"en\":\"\",\"zh\":\"\"},\"body\":{\"en\":\"\",\"zh\":\"\"},\"refs\":[123]}],
|
||||
\"changes\": {\"new\":[],\"improved\":[],\"fixed\":[]},
|
||||
\"upgrade\": [{\"level\":\"info|warning\",\"targets\":[\"desktop\"],\"title\":{\"en\":\"\",\"zh\":\"\"},\"body\":{\"en\":\"\",\"zh\":\"\"},\"refs\":[123]}],
|
||||
\"risks\": [{\"targets\":[\"cli\"],\"title\":{\"en\":\"\",\"zh\":\"\"},\"body\":{\"en\":\"\",\"zh\":\"\"},\"refs\":[123]}],
|
||||
\"contributors\": [], \"links\": {\"github\":\"https://...\",\"compare\":\"https://...\",\"download\":\"https://...\"}
|
||||
}
|
||||
Every highlight, change, upgrade note, and risk must have a non-empty \"targets\" array using only this canonical order: desktop, cli, site, service. Use each PR's targetHints as deterministic candidates, then choose the user-visible delivery target supported by its labels, changed files, title, and body. Shared product-core behavior belongs to both desktop and cli. Website-only work belongs to site; hosted workers and release infrastructure belong to service and must not be marked as a client update merely because a client file accompanies the server change. Set top-level surfaces to the canonical union of all item targets. Return guides only for supplied documentation URLs. Mention upgrade action or risk only when explicitly supported; otherwise use empty arrays. ${editorialLimitInstruction(compact)} Output JSON only.`,
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: `${compact ? "The previous response was invalid or truncated. Produce a smaller complete record and obey the compact editorial budget.\n" : ""}Create the release record from these public GitHub sources:\n${JSON.stringify(payload)}`,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
if (!response.ok) throw new Error(`DeepSeek API failed: ${response.status} ${await response.text()}`);
|
||||
const data = await response.json();
|
||||
const choice = data.choices?.[0];
|
||||
if (choice?.finish_reason === "length") {
|
||||
if (compact) throw new Error("DeepSeek response exceeded the compact editorial budget (finish_reason=length)");
|
||||
return askDeepSeek(payload, attempt + 1);
|
||||
}
|
||||
try {
|
||||
return extractJson(choice?.message?.content);
|
||||
} catch (error) {
|
||||
if (compact) {
|
||||
throw new Error(`${error.message} (finish_reason=${choice?.finish_reason || "unknown"})`);
|
||||
}
|
||||
return askDeepSeek(payload, attempt + 1);
|
||||
}
|
||||
}
|
||||
|
||||
export function contributorsOf(pulls) {
|
||||
return withoutOwner([...new Set(pulls.map((pull) => pull.author).filter(Boolean))]);
|
||||
}
|
||||
|
||||
export function previousCLIRelease(catalog, version) {
|
||||
return catalog.releases.find((release) =>
|
||||
release.product !== "studio" && release.channel === "stable" &&
|
||||
compareVersionsDesc(release.version, version) > 0,
|
||||
);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
if (!args.version) throw new Error("--version is required");
|
||||
const version = normalizeVersion(args.version);
|
||||
const catalog = await loadCatalog();
|
||||
const channel = version.includes("-") ? "prerelease" : "stable";
|
||||
const baseVersion = version.split("-")[0];
|
||||
const previousRecord = channel === "stable"
|
||||
? previousCLIRelease(catalog, version)
|
||||
: catalog.releases.find(
|
||||
(release) =>
|
||||
release.version !== version &&
|
||||
release.channel === "prerelease" &&
|
||||
release.baseVersion === baseVersion,
|
||||
) || catalog.releases.find((release) => release.product !== "studio" && release.channel === "stable");
|
||||
const previous = args.from || previousRecord?.version;
|
||||
if (!previous) throw new Error("--from is required when no previous release exists");
|
||||
const previousVersion = normalizeVersion(previous);
|
||||
const previousIsPreview = previousVersion.includes("-");
|
||||
const from = previous.match(/^(?:desktop-|npm-)?v/)
|
||||
? previous
|
||||
: previousIsPreview
|
||||
? `v${previousVersion}`
|
||||
: `desktop-v${previousVersion}`;
|
||||
const to = args.to || "HEAD";
|
||||
const repository = repositoryName();
|
||||
const commits = commitRange(from, to);
|
||||
if (!commits.length) throw new Error(`no commits found in ${from}..${to}`);
|
||||
const pulls = await collectPullRequests(repository, commits);
|
||||
if (!pulls.length) throw new Error(`no pull requests found in ${from}..${to}`);
|
||||
const docLinks = collectDocLinks(from, repository, to);
|
||||
const date = args.date || new Date().toISOString().slice(0, 10);
|
||||
const tag = args.tag || (channel === "prerelease" ? `v${version}` : `desktop-v${version}`);
|
||||
const source = {
|
||||
version,
|
||||
date,
|
||||
channel,
|
||||
range: `${from}..${to}`,
|
||||
pullRequests: pulls,
|
||||
documentationUrls: docLinks,
|
||||
};
|
||||
const release = await askDeepSeek(source);
|
||||
release.product = "cli";
|
||||
release.targetingVersion = 1;
|
||||
release.version = version;
|
||||
release.releaseId = version;
|
||||
release.baseVersion = baseVersion;
|
||||
release.date = date;
|
||||
release.channel = source.channel;
|
||||
release.status = "reviewed";
|
||||
release.previousRelease = previousVersion;
|
||||
const previewOrdinal = version.match(/-preview\.([1-9][0-9]*)$/)?.[1];
|
||||
if (channel === "prerelease") {
|
||||
if (!previewOrdinal) throw new Error("Preview release version must use MAJOR.MINOR.PATCH-preview.N");
|
||||
release.builds = {
|
||||
cli: `v${version}`,
|
||||
desktop: `v${baseVersion}-preview.${previewOrdinal}`,
|
||||
npm: `${baseVersion}-canary.${previewOrdinal}`,
|
||||
};
|
||||
} else {
|
||||
release.builds = {
|
||||
cli: `v${version}`,
|
||||
desktop: `v${version}`,
|
||||
npm: version,
|
||||
};
|
||||
}
|
||||
release.contributors = contributorsOf(pulls);
|
||||
release.links = {
|
||||
github: `https://github.com/${repository}/releases/tag/${tag}`,
|
||||
compare: `https://github.com/${repository}/compare/${from}...${tag}`,
|
||||
download: channel === "prerelease"
|
||||
? "https://reasonix.io/?download=desktop&channel=preview#start"
|
||||
: "https://reasonix.io/?download=desktop&channel=stable#start",
|
||||
};
|
||||
release.guides = (release.guides || []).filter((guide) => docLinks.includes(guide.href));
|
||||
normalizeReleaseTargets(release);
|
||||
assertGroundedRefs(release, new Set(pulls.map((pull) => pull.number)));
|
||||
validateCatalog({ schemaVersion: 1, releases: [release] });
|
||||
await upsertRelease(release);
|
||||
console.log(`Generated bilingual release notes for v${version} from ${pulls.length} pull request(s).`);
|
||||
}
|
||||
|
||||
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
main().catch((error) => {
|
||||
console.error(error.message);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start CI on a Notes PR that the Actions bot opened. Events raised with
|
||||
# GITHUB_TOKEN never start workflows, so such a PR shows action_required with
|
||||
# zero jobs until a human-authenticated close/reopen re-emits pull_request.
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ] || [[ ! "$1" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
|
||||
echo "usage: site/scripts/releases/release-notes-pr-kick.sh MAJOR.MINOR.PATCH" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
version="$1"
|
||||
repository="${RELEASE_REPOSITORY:-esengine/DeepSeek-Reasonix}"
|
||||
branch="website-release-notes/v$version"
|
||||
wait_seconds="${RELEASE_NOTES_KICK_WAIT_SECONDS:-120}"
|
||||
|
||||
for command in gh jq; do
|
||||
command -v "$command" >/dev/null || {
|
||||
echo "required command is unavailable: $command" >&2
|
||||
exit 2
|
||||
}
|
||||
done
|
||||
|
||||
prs="$(gh pr list --repo "$repository" --head "$branch" --state open --json number,headRefOid --limit 2)"
|
||||
count="$(jq 'length' <<<"$prs")"
|
||||
if [ "$count" -ne 1 ]; then
|
||||
echo "expected exactly one open PR for $branch, found $count" >&2
|
||||
exit 1
|
||||
fi
|
||||
number="$(jq -r '.[0].number' <<<"$prs")"
|
||||
head="$(jq -r '.[0].headRefOid' <<<"$prs")"
|
||||
|
||||
check_runs() {
|
||||
gh api "repos/$repository/commits/$head/check-runs" --jq '.total_count'
|
||||
}
|
||||
|
||||
if [ "$(check_runs)" -gt 0 ]; then
|
||||
echo "PR #$number already has check runs on $head; nothing to kick"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Only the recorded-but-never-started shape is safe to kick. Anything else
|
||||
# with zero check runs needs a look, not a reopen.
|
||||
stalled="$(gh api "repos/$repository/actions/runs?event=pull_request&head_sha=$head&per_page=20" \
|
||||
--jq "[.workflow_runs[] | select(.head_sha == \"$head\" and .conclusion == \"action_required\")] | length")"
|
||||
if [ "$stalled" -eq 0 ]; then
|
||||
echo "PR #$number has no check runs and no action_required run on $head; inspect before kicking" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "PR #$number: $stalled recorded-but-unstarted run(s) on $head; closing and reopening"
|
||||
gh pr close "$number" --repo "$repository"
|
||||
gh pr reopen "$number" --repo "$repository"
|
||||
|
||||
deadline=$((SECONDS + wait_seconds))
|
||||
while [ "$(check_runs)" -eq 0 ]; do
|
||||
if [ "$SECONDS" -ge "$deadline" ]; then
|
||||
echo "no check runs appeared on $head within ${wait_seconds}s" >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
echo "CI started on PR #$number ($head)"
|
||||
@@ -1,459 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { withoutOwner } from "../../src/lib/repository-owner.mjs";
|
||||
|
||||
const siteRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
export const defaultCatalogPath = resolve(siteRoot, "src/data/releases.json");
|
||||
|
||||
const localizedFields = ["title", "body"];
|
||||
const changeKinds = ["new", "improved", "fixed"];
|
||||
const itemKinds = new Set(["new", "improved", "fixed", "security"]);
|
||||
const releaseChannels = new Set(["stable", "prerelease"]);
|
||||
const releaseStatuses = new Set(["reviewed", "published"]);
|
||||
const releaseTargetOrder = ["desktop", "cli", "site", "service"];
|
||||
const releaseTargets = new Set(releaseTargetOrder);
|
||||
const releaseTargetingRequiredFrom = "1.31.4";
|
||||
|
||||
function invariant(condition, message) {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
function isObject(value) {
|
||||
return value !== null && typeof value === "object" && !Array.isArray(value);
|
||||
}
|
||||
|
||||
function validateLocalized(value, path) {
|
||||
invariant(isObject(value), `${path} must be an object`);
|
||||
for (const lang of ["en", "zh"]) {
|
||||
invariant(typeof value[lang] === "string" && value[lang].trim(), `${path}.${lang} must be a non-empty string`);
|
||||
}
|
||||
}
|
||||
|
||||
function validateRefs(refs, path) {
|
||||
if (refs === undefined) return;
|
||||
invariant(Array.isArray(refs), `${path} must be an array`);
|
||||
for (const ref of refs) invariant(Number.isInteger(ref) && ref > 0, `${path} contains invalid PR number ${ref}`);
|
||||
}
|
||||
|
||||
function validateItem(item, path, { kind = false, href = false, level = false, targets = false } = {}) {
|
||||
invariant(isObject(item), `${path} must be an object`);
|
||||
for (const field of localizedFields) validateLocalized(item[field], `${path}.${field}`);
|
||||
if (kind) invariant(itemKinds.has(item.kind), `${path}.kind is invalid`);
|
||||
if (href) invariant(typeof item.href === "string" && /^https:\/\//.test(item.href), `${path}.href must be HTTPS`);
|
||||
if (level) invariant(item.level === "info" || item.level === "warning", `${path}.level is invalid`);
|
||||
if (targets || item.targets !== undefined) {
|
||||
invariant(Array.isArray(item.targets) && item.targets.length > 0, `${path}.targets must be a non-empty array`);
|
||||
invariant(new Set(item.targets).size === item.targets.length, `${path}.targets contains duplicates`);
|
||||
for (const target of item.targets) invariant(releaseTargets.has(target), `${path}.targets contains invalid target ${target}`);
|
||||
const sorted = releaseTargetOrder.filter((target) => item.targets.includes(target));
|
||||
invariant(sorted.every((target, index) => target === item.targets[index]), `${path}.targets must use canonical order`);
|
||||
}
|
||||
validateRefs(item.refs, `${path}.refs`);
|
||||
}
|
||||
|
||||
function releaseItems(release) {
|
||||
return [
|
||||
...release.highlights,
|
||||
...changeKinds.flatMap((kind) => release.changes[kind]),
|
||||
...release.upgrade,
|
||||
...release.risks,
|
||||
];
|
||||
}
|
||||
|
||||
function itemTargetsUnion(release) {
|
||||
const targets = new Set(releaseItems(release).flatMap((item) => item.targets || []));
|
||||
return releaseTargetOrder.filter((target) => targets.has(target));
|
||||
}
|
||||
|
||||
function semverParts(version) {
|
||||
const match = String(version).match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/);
|
||||
invariant(match, `invalid version ${version}`);
|
||||
return [Number(match[1]), Number(match[2]), Number(match[3]), match[4] || ""];
|
||||
}
|
||||
|
||||
function isCoreVersionAtLeast(version, minimum) {
|
||||
const current = semverParts(version);
|
||||
const floor = semverParts(minimum);
|
||||
for (let index = 0; index < 3; index += 1) {
|
||||
if (current[index] !== floor[index]) return current[index] > floor[index];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function compareVersionsDesc(a, b) {
|
||||
const aa = semverParts(a);
|
||||
const bb = semverParts(b);
|
||||
for (let i = 0; i < 3; i += 1) {
|
||||
if (aa[i] !== bb[i]) return bb[i] - aa[i];
|
||||
}
|
||||
if (aa[3] === bb[3]) return 0;
|
||||
if (!aa[3]) return -1;
|
||||
if (!bb[3]) return 1;
|
||||
return String(bb[3]).localeCompare(String(aa[3]), "en", { numeric: true });
|
||||
}
|
||||
|
||||
export function validateCatalog(catalog) {
|
||||
invariant(isObject(catalog), "catalog must be an object");
|
||||
invariant(catalog.schemaVersion === 1, "catalog.schemaVersion must be 1");
|
||||
invariant(Array.isArray(catalog.releases) && catalog.releases.length > 0, "catalog.releases must not be empty");
|
||||
|
||||
const versions = new Set();
|
||||
for (const [index, release] of catalog.releases.entries()) {
|
||||
const path = `releases[${index}]`;
|
||||
invariant(isObject(release), `${path} must be an object`);
|
||||
semverParts(release.version);
|
||||
invariant(release.product === undefined || ["cli", "studio"].includes(release.product), `${path}.product is invalid`);
|
||||
if (release.product === "studio") {
|
||||
invariant(/^2\.\d+\.\d+$/.test(release.version), `${path}.Studio version must be 2.x`);
|
||||
invariant(release.sourceNotes?.language === "zh", `${path}.sourceNotes.language must be zh`);
|
||||
invariant(typeof release.sourceNotes.markdown === "string" && release.sourceNotes.markdown.trim(), `${path}.sourceNotes.markdown must not be empty`);
|
||||
invariant(/^[0-9a-f]{40}$/.test(release.sourceNotes.sha), `${path}.sourceNotes.sha must be a full commit SHA`);
|
||||
invariant(release.sourceNotes.path === `release-notes/studio/${release.version}.md`, `${path}.sourceNotes.path is invalid`);
|
||||
invariant(release.status === undefined, `${path}.Studio does not use CLI publication markers`);
|
||||
}
|
||||
invariant(!versions.has(release.version), `duplicate version ${release.version}`);
|
||||
versions.add(release.version);
|
||||
invariant(/^\d{4}-\d{2}-\d{2}$/.test(release.date), `${path}.date must use YYYY-MM-DD`);
|
||||
invariant(releaseChannels.has(release.channel), `${path}.channel is invalid`);
|
||||
if (release.releaseId !== undefined) {
|
||||
invariant(release.releaseId === release.version, `${path}.releaseId must equal version`);
|
||||
}
|
||||
if (release.baseVersion !== undefined) {
|
||||
semverParts(release.baseVersion);
|
||||
invariant(!release.baseVersion.includes("-"), `${path}.baseVersion must be stable semver`);
|
||||
invariant(
|
||||
release.version === release.baseVersion || release.version.startsWith(`${release.baseVersion}-`),
|
||||
`${path}.baseVersion does not match version`,
|
||||
);
|
||||
}
|
||||
if (release.status !== undefined) {
|
||||
invariant(releaseStatuses.has(release.status), `${path}.status is invalid`);
|
||||
}
|
||||
if (release.candidateSha !== undefined) {
|
||||
invariant(/^[0-9a-f]{40}$/.test(release.candidateSha), `${path}.candidateSha must be a full commit SHA`);
|
||||
}
|
||||
if (release.previousRelease !== undefined) {
|
||||
semverParts(release.previousRelease);
|
||||
invariant(release.previousRelease !== release.version, `${path}.previousRelease must differ from version`);
|
||||
}
|
||||
if (release.builds !== undefined) {
|
||||
invariant(isObject(release.builds), `${path}.builds must be an object`);
|
||||
for (const surface of ["cli", "desktop", "npm"]) {
|
||||
invariant(
|
||||
typeof release.builds[surface] === "string" && release.builds[surface].trim(),
|
||||
`${path}.builds.${surface} must be a non-empty string`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (release.status !== undefined) {
|
||||
for (const field of ["releaseId", "baseVersion", "previousRelease", "builds"]) {
|
||||
invariant(release[field] !== undefined, `${path}.${field} is required for managed release records`);
|
||||
}
|
||||
if (release.channel === "stable") {
|
||||
invariant(release.version === release.baseVersion, `${path}.stable version must equal baseVersion`);
|
||||
invariant(release.builds.cli === `v${release.version}`, `${path}.builds.cli does not match Stable version`);
|
||||
invariant(release.builds.desktop === `v${release.version}`, `${path}.builds.desktop does not match Stable version`);
|
||||
invariant(release.builds.npm === release.version, `${path}.builds.npm does not match Stable version`);
|
||||
} else {
|
||||
const preview = release.version.match(/^(\d+\.\d+\.\d+)-preview\.([1-9][0-9]*)$/);
|
||||
invariant(preview, `${path}.managed prerelease must use MAJOR.MINOR.PATCH-preview.N`);
|
||||
invariant(preview[1] === release.baseVersion, `${path}.Preview baseVersion does not match version`);
|
||||
invariant(release.builds.cli === `v${release.version}`, `${path}.builds.cli does not match Preview version`);
|
||||
invariant(release.builds.desktop === `v${release.version}`, `${path}.builds.desktop does not match Preview version`);
|
||||
invariant(
|
||||
release.builds.npm === `${release.baseVersion}-canary.${preview[2]}`,
|
||||
`${path}.builds.npm does not match Preview ordinal`,
|
||||
);
|
||||
}
|
||||
}
|
||||
const targetingRequiredByVersion = release.product !== "studio" && isCoreVersionAtLeast(release.version, releaseTargetingRequiredFrom);
|
||||
if (targetingRequiredByVersion) {
|
||||
invariant(
|
||||
release.targetingVersion === 1,
|
||||
`${path}.targetingVersion must be 1 for v${releaseTargetingRequiredFrom} and newer`,
|
||||
);
|
||||
} else if (release.targetingVersion !== undefined) {
|
||||
invariant(release.targetingVersion === 1, `${path}.targetingVersion is invalid`);
|
||||
}
|
||||
const targetsRequired = release.targetingVersion === 1;
|
||||
validateLocalized(release.title, `${path}.title`);
|
||||
validateLocalized(release.summary, `${path}.summary`);
|
||||
invariant(Array.isArray(release.surfaces) && release.surfaces.length > 0, `${path}.surfaces must not be empty`);
|
||||
invariant(new Set(release.surfaces).size === release.surfaces.length, `${path}.surfaces contains duplicates`);
|
||||
invariant(Array.isArray(release.guides), `${path}.guides must be an array`);
|
||||
release.guides.forEach((item, itemIndex) => validateItem(item, `${path}.guides[${itemIndex}]`, { href: true }));
|
||||
invariant(Array.isArray(release.highlights) && release.highlights.length > 0, `${path}.highlights must not be empty`);
|
||||
release.highlights.forEach((item, itemIndex) =>
|
||||
validateItem(item, `${path}.highlights[${itemIndex}]`, { kind: true, targets: targetsRequired }),
|
||||
);
|
||||
invariant(isObject(release.changes), `${path}.changes must be an object`);
|
||||
for (const changeKind of changeKinds) {
|
||||
invariant(Array.isArray(release.changes[changeKind]), `${path}.changes.${changeKind} must be an array`);
|
||||
release.changes[changeKind].forEach((item, itemIndex) =>
|
||||
validateItem(item, `${path}.changes.${changeKind}[${itemIndex}]`, { targets: targetsRequired }),
|
||||
);
|
||||
}
|
||||
invariant(Array.isArray(release.upgrade), `${path}.upgrade must be an array`);
|
||||
release.upgrade.forEach((item, itemIndex) =>
|
||||
validateItem(item, `${path}.upgrade[${itemIndex}]`, { level: true, targets: targetsRequired }),
|
||||
);
|
||||
invariant(Array.isArray(release.risks), `${path}.risks must be an array`);
|
||||
release.risks.forEach((item, itemIndex) =>
|
||||
validateItem(item, `${path}.risks[${itemIndex}]`, { targets: targetsRequired }),
|
||||
);
|
||||
if (targetsRequired) {
|
||||
const derivedTargets = itemTargetsUnion(release);
|
||||
invariant(
|
||||
derivedTargets.includes("desktop") || derivedTargets.includes("cli"),
|
||||
`${path} must contain at least one Desktop or CLI update`,
|
||||
);
|
||||
invariant(
|
||||
derivedTargets.length === release.surfaces.length &&
|
||||
derivedTargets.every((target, index) => target === release.surfaces[index]),
|
||||
`${path}.surfaces must equal the canonical union of item targets`,
|
||||
);
|
||||
}
|
||||
invariant(Array.isArray(release.contributors), `${path}.contributors must be an array`);
|
||||
invariant(isObject(release.links), `${path}.links must be an object`);
|
||||
for (const link of ["github", "compare", "download"]) {
|
||||
invariant(typeof release.links[link] === "string" && /^https:\/\//.test(release.links[link]), `${path}.links.${link} must be HTTPS`);
|
||||
}
|
||||
}
|
||||
|
||||
const sorted = [...catalog.releases].sort((a, b) => compareVersionsDesc(a.version, b.version));
|
||||
invariant(
|
||||
sorted.every((release, index) => release.version === catalog.releases[index].version),
|
||||
"catalog.releases must be sorted newest first",
|
||||
);
|
||||
return catalog;
|
||||
}
|
||||
|
||||
export async function loadCatalog(path = defaultCatalogPath) {
|
||||
const catalog = JSON.parse(await readFile(path, "utf8"));
|
||||
return validateCatalog(catalog);
|
||||
}
|
||||
|
||||
export function releaseForVersion(catalog, version) {
|
||||
const normalized = String(version).replace(/^(?:studio-|desktop-|npm-)?v/, "");
|
||||
const release = catalog.releases.find((entry) => entry.version === normalized);
|
||||
invariant(release, `release notes for v${normalized} are missing`);
|
||||
return release;
|
||||
}
|
||||
|
||||
function localized(value, lang) {
|
||||
return value[lang] || value.en;
|
||||
}
|
||||
|
||||
function refsSuffix(refs = []) {
|
||||
if (!refs.length) return "";
|
||||
return ` (${refs.map((ref) => `[#${ref}](https://github.com/esengine/DeepSeek-Reasonix/pull/${ref})`).join(", ")})`;
|
||||
}
|
||||
|
||||
function targetLabel(target) {
|
||||
return { desktop: "Desktop", cli: "CLI", site: "Site", service: "Service" }[target] || target;
|
||||
}
|
||||
|
||||
function targetsPrefix(item) {
|
||||
if (!item.targets?.length) return "";
|
||||
return `**[${item.targets.map(targetLabel).join(" · ")}]** `;
|
||||
}
|
||||
|
||||
function renderItems(items, lang) {
|
||||
return items
|
||||
.map((item) => `- ${targetsPrefix(item)}**${localized(item.title, lang)}** — ${localized(item.body, lang)}${refsSuffix(item.refs)}`)
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
function hasTarget(item, target) {
|
||||
return item.targets?.includes(target) || false;
|
||||
}
|
||||
|
||||
function targetItemCount(release, target) {
|
||||
return releaseItems(release).filter((item) => hasTarget(item, target)).length;
|
||||
}
|
||||
|
||||
function appendTargetSection(lines, release, target, lang) {
|
||||
const isZh = lang === "zh";
|
||||
const title = target === "desktop"
|
||||
? (isZh ? "桌面端更新" : "Desktop updates")
|
||||
: (isZh ? "CLI 端更新" : "CLI updates");
|
||||
lines.push(`## ${title}`, "");
|
||||
|
||||
const highlights = release.highlights.filter((item) => hasTarget(item, target));
|
||||
if (highlights.length) {
|
||||
lines.push(`### ${isZh ? "重点内容" : "Highlights"}`, "", renderItems(highlights, lang), "");
|
||||
}
|
||||
const headings = {
|
||||
new: isZh ? "新增" : "New",
|
||||
improved: isZh ? "改进" : "Improved",
|
||||
fixed: isZh ? "修复" : "Fixed",
|
||||
};
|
||||
for (const kind of changeKinds) {
|
||||
const items = release.changes[kind].filter((item) => hasTarget(item, target));
|
||||
if (items.length) lines.push(`### ${headings[kind]}`, "", renderItems(items, lang), "");
|
||||
}
|
||||
|
||||
if (!highlights.length && !changeKinds.some((kind) => release.changes[kind].some((item) => hasTarget(item, target)))) {
|
||||
const noTargetedItems = targetItemCount(release, target) === 0;
|
||||
lines.push(
|
||||
target === "cli" && noTargetedItems
|
||||
? (isZh ? "本版本没有 CLI 相关功能、改进或修复,CLI 用户可按需跳过。" : "This release has no CLI features, improvements, or fixes; CLI users may skip it if preferred.")
|
||||
: (isZh ? "此板块没有功能或修复条目;相关说明请查看下方升级提醒和风险提示。" : "No feature or fix entries are listed here; see the upgrade and risk notes below."),
|
||||
"",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function appendOtherTargetSection(lines, release, lang) {
|
||||
const isZh = lang === "zh";
|
||||
const isOtherOnly = (item) => item.targets?.length && !hasTarget(item, "desktop") && !hasTarget(item, "cli");
|
||||
const highlights = release.highlights.filter(isOtherOnly);
|
||||
const changes = Object.fromEntries(changeKinds.map((kind) => [kind, release.changes[kind].filter(isOtherOnly)]));
|
||||
if (!highlights.length && !changeKinds.some((kind) => changes[kind].length)) return;
|
||||
|
||||
lines.push(`## ${isZh ? "其他项目更新" : "Other project updates"}`, "");
|
||||
if (highlights.length) lines.push(renderItems(highlights, lang), "");
|
||||
for (const kind of changeKinds) {
|
||||
if (changes[kind].length) lines.push(renderItems(changes[kind], lang), "");
|
||||
}
|
||||
}
|
||||
|
||||
export function renderGitHubRelease(release, lang = "zh") {
|
||||
if (release.product === "studio") return release.sourceNotes.markdown;
|
||||
const isZh = lang === "zh";
|
||||
const isPreview = release.channel === "prerelease";
|
||||
const channelLabel = isPreview ? (isZh ? "预览版" : "Preview") : (isZh ? "稳定版" : "Stable");
|
||||
const lines = [
|
||||
`> ${localized(release.summary, lang)}`,
|
||||
"",
|
||||
`**${isZh ? "发布渠道" : "Release channel"}:${channelLabel} · v${release.version}**`,
|
||||
"",
|
||||
isZh
|
||||
? `[English →](https://reasonix.io/changelog/v${release.version}/?lang=en) · [网页版完整更新日志 →](https://reasonix.io/changelog/v${release.version}/)`
|
||||
: `[中文 →](https://reasonix.io/changelog/v${release.version}/?lang=zh) · [Full release notes →](https://reasonix.io/changelog/v${release.version}/?lang=en)`,
|
||||
"",
|
||||
];
|
||||
|
||||
if (release.guides.length) {
|
||||
lines.push(`## ${isZh ? "使用攻略" : "Guides"}`, "");
|
||||
for (const guide of release.guides) {
|
||||
lines.push(`- [**${localized(guide.title, lang)}**](${guide.href}) — ${localized(guide.body, lang)}`);
|
||||
}
|
||||
lines.push("");
|
||||
}
|
||||
|
||||
lines.push(
|
||||
`## ${isZh ? "概览" : "Overview"}`,
|
||||
"",
|
||||
`**Reasonix v${release.version} — ${localized(release.title, lang)}**`,
|
||||
"",
|
||||
localized(release.summary, lang),
|
||||
"",
|
||||
`${isZh ? "发布日期" : "Released"}:${release.date}`,
|
||||
"",
|
||||
);
|
||||
|
||||
if (release.targetingVersion === 1) {
|
||||
lines.push(
|
||||
`**Desktop ${targetItemCount(release, "desktop")} · CLI ${targetItemCount(release, "cli")}**`,
|
||||
"",
|
||||
);
|
||||
appendTargetSection(lines, release, "desktop", lang);
|
||||
appendTargetSection(lines, release, "cli", lang);
|
||||
appendOtherTargetSection(lines, release, lang);
|
||||
} else {
|
||||
lines.push(`## ${isZh ? "重点内容" : "Highlights"}`, "", renderItems(release.highlights, lang), "");
|
||||
const headings = {
|
||||
new: isZh ? "新功能" : "New",
|
||||
improved: isZh ? "改进" : "Improved",
|
||||
fixed: isZh ? "修复" : "Fixed",
|
||||
};
|
||||
for (const kind of changeKinds) {
|
||||
const items = release.changes[kind];
|
||||
if (!items.length) continue;
|
||||
lines.push(`## ${headings[kind]}`, "", renderItems(items, lang), "");
|
||||
}
|
||||
}
|
||||
|
||||
lines.push(`## ${isZh ? "升级提醒" : "Upgrade notes"}`, "");
|
||||
if (release.upgrade.length) lines.push(renderItems(release.upgrade, lang));
|
||||
else lines.push(isZh ? "本版本无需手动迁移。" : "No manual migration is required.");
|
||||
lines.push("");
|
||||
|
||||
lines.push(`## ${isZh ? "风险提示" : "Risk notes"}`, "");
|
||||
if (release.risks.length) lines.push(renderItems(release.risks, lang));
|
||||
else lines.push(isZh ? "当前没有需要额外操作的已知风险。" : "There are no known risks requiring extra action.");
|
||||
lines.push("");
|
||||
|
||||
const thanked = withoutOwner(release.contributors);
|
||||
if (thanked.length) {
|
||||
lines.push(
|
||||
`## ${isZh ? "致谢" : "Thanks"}`,
|
||||
"",
|
||||
`${isZh ? "感谢本版本的贡献者" : "Thanks to the contributors in this release"}:${thanked
|
||||
.map((name) => `[@${name}](https://github.com/${name})`)
|
||||
.join("、")}`,
|
||||
"",
|
||||
);
|
||||
}
|
||||
|
||||
lines.push(
|
||||
`## ${isZh ? "下载与安装" : "Download and install"}`,
|
||||
"",
|
||||
`- [${isZh ? "官网按平台下载" : "Platform downloads"}](${release.links.download})`,
|
||||
`- [${isZh ? "查看完整差异" : "Full comparison"}](${release.links.compare})`,
|
||||
"",
|
||||
);
|
||||
return `${lines.join("\n").trim()}\n`;
|
||||
}
|
||||
|
||||
export async function upsertRelease(release, path = defaultCatalogPath) {
|
||||
const catalog = await loadCatalog(path);
|
||||
const next = {
|
||||
...catalog,
|
||||
releases: [release, ...catalog.releases.filter((entry) => entry.version !== release.version)].sort((a, b) =>
|
||||
compareVersionsDesc(a.version, b.version),
|
||||
),
|
||||
};
|
||||
validateCatalog(next);
|
||||
await writeFile(path, `${JSON.stringify(next, null, 2)}\n`);
|
||||
return next;
|
||||
}
|
||||
|
||||
function parseArgs(argv) {
|
||||
const [command = "validate", ...rest] = argv;
|
||||
const values = { command };
|
||||
for (let i = 0; i < rest.length; i += 1) {
|
||||
const arg = rest[i];
|
||||
if (!arg.startsWith("--")) throw new Error(`unexpected argument ${arg}`);
|
||||
values[arg.slice(2)] = rest[++i];
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
const catalogPath = args.catalog ? resolve(args.catalog) : defaultCatalogPath;
|
||||
const catalog = await loadCatalog(catalogPath);
|
||||
if (args.command === "validate") {
|
||||
console.log(`Validated ${catalog.releases.length} release note(s).`);
|
||||
return;
|
||||
}
|
||||
if (args.command !== "render") throw new Error(`unknown command ${args.command}`);
|
||||
invariant(args.version, "render requires --version");
|
||||
invariant(args.output, "render requires --output");
|
||||
const release = releaseForVersion(catalog, args.version);
|
||||
const output = resolve(args.output);
|
||||
await writeFile(output, renderGitHubRelease(release, args.lang === "en" ? "en" : "zh"));
|
||||
console.log(`Rendered v${release.version} release notes to ${output}`);
|
||||
}
|
||||
|
||||
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
main().catch((error) => {
|
||||
console.error(error.message);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import {
|
||||
editorialLimitInstruction,
|
||||
inferPullTargetHints,
|
||||
releaseOutputBudgets,
|
||||
} from "./generate-release-notes.mjs";
|
||||
import { loadCatalog, releaseForVersion, renderGitHubRelease, validateCatalog } from "./release-notes.mjs";
|
||||
import { validateReleaseEvent } from "../release-event.mjs";
|
||||
|
||||
test("the committed release catalog is valid and newest first", async () => {
|
||||
const catalog = await loadCatalog();
|
||||
assert.equal(catalog.schemaVersion, 1);
|
||||
assert.equal(new Set(catalog.releases.map((release) => release.version)).size, catalog.releases.length);
|
||||
});
|
||||
|
||||
test("tag namespaces resolve to the same product release", async () => {
|
||||
const catalog = await loadCatalog();
|
||||
assert.equal(releaseForVersion(catalog, "v1.17.13").version, "1.17.13");
|
||||
assert.equal(releaseForVersion(catalog, "desktop-v1.17.13").version, "1.17.13");
|
||||
assert.equal(releaseForVersion(catalog, "npm-v1.17.13").version, "1.17.13");
|
||||
});
|
||||
|
||||
test("GitHub rendering keeps product sections and source PR links", async () => {
|
||||
const catalog = await loadCatalog();
|
||||
const markdown = renderGitHubRelease(releaseForVersion(catalog, "1.17.13"), "zh");
|
||||
assert.match(markdown, /## 使用攻略/);
|
||||
assert.match(markdown, /## 重点内容/);
|
||||
assert.match(markdown, /## 升级提醒/);
|
||||
assert.match(markdown, /## 风险提示/);
|
||||
assert.match(markdown, /## 致谢/);
|
||||
assert.match(markdown, /\/pull\/6460/);
|
||||
assert.match(markdown, /reasonix\.io\/changelog\/v1\.17\.13/);
|
||||
});
|
||||
|
||||
test("targeted releases render Desktop and CLI sections from one shared item", async () => {
|
||||
const catalog = await loadCatalog();
|
||||
const markdown = renderGitHubRelease(releaseForVersion(catalog, "1.31.4"), "zh");
|
||||
assert.match(markdown, /## 桌面端更新/);
|
||||
assert.match(markdown, /## CLI 端更新/);
|
||||
assert.match(markdown, /## 其他项目更新/);
|
||||
assert.match(markdown, /\*\*\[Service\]\*\* \*\*降低数据库读取成本\*\*/);
|
||||
assert.equal(markdown.match(/更好的数学渲染/g)?.length, 2);
|
||||
});
|
||||
|
||||
test("targeted release validation requires canonical item targets and matching surfaces", () => {
|
||||
const release = {
|
||||
version: "2.0.0",
|
||||
targetingVersion: 1,
|
||||
date: "2026-01-01",
|
||||
channel: "stable",
|
||||
title: { en: "Targeted", zh: "分类版本" },
|
||||
summary: { en: "Summary", zh: "摘要" },
|
||||
surfaces: ["desktop", "cli"],
|
||||
guides: [],
|
||||
highlights: [{
|
||||
kind: "fixed",
|
||||
targets: ["desktop", "cli"],
|
||||
title: { en: "Shared fix", zh: "共享修复" },
|
||||
body: { en: "A shared fix.", zh: "一项共享修复。" },
|
||||
refs: [1],
|
||||
}],
|
||||
changes: { new: [], improved: [], fixed: [] },
|
||||
upgrade: [],
|
||||
risks: [],
|
||||
contributors: [],
|
||||
links: {
|
||||
github: "https://example.com/release",
|
||||
compare: "https://example.com/compare",
|
||||
download: "https://example.com/download",
|
||||
},
|
||||
};
|
||||
assert.doesNotThrow(() => validateCatalog({ schemaVersion: 1, releases: [release] }));
|
||||
assert.throws(
|
||||
() => validateCatalog({
|
||||
schemaVersion: 1,
|
||||
releases: [{ ...release, highlights: [{ ...release.highlights[0], targets: undefined }] }],
|
||||
}),
|
||||
/targets must be a non-empty array/,
|
||||
);
|
||||
assert.throws(
|
||||
() => validateCatalog({ schemaVersion: 1, releases: [{ ...release, surfaces: ["desktop"] }] }),
|
||||
/surfaces must equal the canonical union/,
|
||||
);
|
||||
assert.throws(
|
||||
() => validateCatalog({
|
||||
schemaVersion: 1,
|
||||
releases: [{ ...release, highlights: [{ ...release.highlights[0], targets: ["cli", "desktop"] }] }],
|
||||
}),
|
||||
/targets must use canonical order/,
|
||||
);
|
||||
});
|
||||
|
||||
test("targeting adoption boundary preserves historical releases and rejects future legacy records", () => {
|
||||
const release = {
|
||||
version: "1.31.3",
|
||||
date: "2026-01-01",
|
||||
channel: "stable",
|
||||
title: { en: "Legacy", zh: "旧版" },
|
||||
summary: { en: "Summary", zh: "摘要" },
|
||||
surfaces: ["desktop"],
|
||||
guides: [],
|
||||
highlights: [{
|
||||
kind: "fixed",
|
||||
title: { en: "Legacy fix", zh: "旧版修复" },
|
||||
body: { en: "A historical fix.", zh: "一项历史修复。" },
|
||||
refs: [1],
|
||||
}],
|
||||
changes: { new: [], improved: [], fixed: [] },
|
||||
upgrade: [],
|
||||
risks: [],
|
||||
contributors: [],
|
||||
links: {
|
||||
github: "https://example.com/release",
|
||||
compare: "https://example.com/compare",
|
||||
download: "https://example.com/download",
|
||||
},
|
||||
};
|
||||
|
||||
assert.doesNotThrow(() => validateCatalog({ schemaVersion: 1, releases: [release] }));
|
||||
for (const version of ["1.31.4", "1.32.0", "2.0.0-preview.1"]) {
|
||||
assert.throws(
|
||||
() => validateCatalog({ schemaVersion: 1, releases: [{ ...release, version }] }),
|
||||
/targetingVersion must be 1 for v1\.31\.4 and newer/,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("release target hints prefer explicit product labels and identify shared or service paths", () => {
|
||||
assert.deepEqual(inferPullTargetHints(["desktop"], ["internal/sessioncatalog/catalog.go"]), ["desktop"]);
|
||||
assert.deepEqual(inferPullTargetHints(["desktop", "tui"], ["desktop/app.go", "internal/cli/cli.go"]), ["desktop", "cli"]);
|
||||
assert.deepEqual(inferPullTargetHints([], ["internal/agent/agent.go"]), ["desktop", "cli"]);
|
||||
assert.deepEqual(inferPullTargetHints([], ["workers/crash-report/src/index.ts"]), ["service"]);
|
||||
});
|
||||
|
||||
test("release generation uses bounded output and a tighter truncation retry", () => {
|
||||
assert.ok(releaseOutputBudgets.standard.highlights > releaseOutputBudgets.compact.highlights);
|
||||
assert.ok(releaseOutputBudgets.standard.changes > releaseOutputBudgets.compact.changes);
|
||||
assert.ok(releaseOutputBudgets.standard.bodyChars > releaseOutputBudgets.compact.bodyChars);
|
||||
assert.match(editorialLimitInstruction(), /Always return a complete JSON object/);
|
||||
assert.match(editorialLimitInstruction(true), /at most 4 highlights/);
|
||||
assert.match(editorialLimitInstruction(true), /9 total change items/);
|
||||
});
|
||||
|
||||
test("validation rejects bilingual drift", () => {
|
||||
assert.throws(
|
||||
() =>
|
||||
validateCatalog({
|
||||
schemaVersion: 1,
|
||||
releases: [
|
||||
{
|
||||
version: "1.0.0",
|
||||
date: "2026-01-01",
|
||||
channel: "stable",
|
||||
title: { en: "Title", zh: "" },
|
||||
summary: { en: "Summary", zh: "摘要" },
|
||||
},
|
||||
],
|
||||
}),
|
||||
/title\.zh/,
|
||||
);
|
||||
});
|
||||
|
||||
test("managed Preview records bind every surface to one exact ordinal", () => {
|
||||
const release = {
|
||||
version: "1.19.0-preview.3",
|
||||
releaseId: "1.19.0-preview.3",
|
||||
baseVersion: "1.19.0",
|
||||
date: "2026-07-31",
|
||||
channel: "prerelease",
|
||||
status: "reviewed",
|
||||
previousRelease: "1.19.0-preview.2",
|
||||
builds: {
|
||||
cli: "v1.19.0-preview.3",
|
||||
desktop: "v1.19.0-preview.3",
|
||||
npm: "1.19.0-canary.3",
|
||||
},
|
||||
title: { en: "Preview", zh: "预览版" },
|
||||
summary: { en: "Preview summary", zh: "预览版摘要" },
|
||||
surfaces: ["cli"],
|
||||
guides: [],
|
||||
highlights: [{
|
||||
kind: "fixed",
|
||||
title: { en: "Fix", zh: "修复" },
|
||||
body: { en: "A fix.", zh: "一项修复。" },
|
||||
refs: [1],
|
||||
}],
|
||||
changes: { new: [], improved: [], fixed: [] },
|
||||
upgrade: [],
|
||||
risks: [],
|
||||
contributors: [],
|
||||
links: {
|
||||
github: "https://github.com/esengine/DeepSeek-Reasonix/releases/tag/v1.19.0-preview.3",
|
||||
compare: "https://github.com/esengine/DeepSeek-Reasonix/compare/v1.19.0-preview.2...v1.19.0-preview.3",
|
||||
download: "https://reasonix.io/?download=desktop&channel=preview#start",
|
||||
},
|
||||
};
|
||||
|
||||
assert.doesNotThrow(() => validateCatalog({ schemaVersion: 1, releases: [release] }));
|
||||
assert.throws(
|
||||
() => validateCatalog({
|
||||
schemaVersion: 1,
|
||||
releases: [{ ...release, builds: { ...release.builds, npm: "1.19.0-canary.4" } }],
|
||||
}),
|
||||
/builds\.npm/,
|
||||
);
|
||||
});
|
||||
|
||||
test("publication marker is bound to reviewed version, channel, SHA, and builds", () => {
|
||||
const release = {
|
||||
version: "1.19.0-preview.3",
|
||||
channel: "prerelease",
|
||||
candidateSha: "a".repeat(40),
|
||||
builds: {
|
||||
cli: "v1.19.0-preview.3",
|
||||
desktop: "v1.19.0-preview.3",
|
||||
npm: "1.19.0-canary.3",
|
||||
},
|
||||
};
|
||||
const event = {
|
||||
schemaVersion: 1,
|
||||
releaseId: release.version,
|
||||
channel: "preview",
|
||||
candidateSha: release.candidateSha,
|
||||
publishedAt: "2026-07-31T00:00:00.000Z",
|
||||
releaseNotesUrl: "https://reasonix.io/changelog/v1.19.0-preview.3/",
|
||||
builds: release.builds,
|
||||
};
|
||||
|
||||
assert.doesNotThrow(() => validateReleaseEvent(event, release));
|
||||
assert.throws(
|
||||
() => validateReleaseEvent({ ...event, candidateSha: "b".repeat(40) }, release),
|
||||
/candidateSha/,
|
||||
);
|
||||
});
|
||||
|
||||
test("Studio tag lookup and verbatim rendering stay separate from CLI records", async () => {
|
||||
const { studioRecord } = await import('./sync-releases.mjs');
|
||||
const source = '中立发布说明。\n\n## 改进\n\n- 窗口布局\n';
|
||||
const studio = studioRecord({ tag_name: 'studio-v2.24.0', published_at: '2026-09-30T00:00:00Z' }, source, 'a'.repeat(40));
|
||||
const catalog = validateCatalog({ schemaVersion: 1, releases: [studio] });
|
||||
assert.equal(releaseForVersion(catalog, 'studio-v2.24.0').product, 'studio');
|
||||
assert.equal(renderGitHubRelease(studio, 'en'), source);
|
||||
});
|
||||
|
||||
test("the repository owner is never thanked: not collected, not rendered, case-insensitively", async () => {
|
||||
const { contributorsOf } = await import("./generate-release-notes.mjs");
|
||||
const { withoutOwner, repositoryOwner } = await import("../../src/lib/repository-owner.mjs");
|
||||
assert.equal(repositoryOwner, "esengine");
|
||||
assert.deepEqual(withoutOwner(["alice", "EsEngine", "bob"]), ["alice", "bob"]);
|
||||
assert.deepEqual(contributorsOf([{ author: "esengine" }, { author: "alice" }, { author: "alice" }, { author: null }, { author: "ESENGINE" }]), ["alice"]);
|
||||
assert.deepEqual(contributorsOf([{ author: "esengine" }]), []);
|
||||
|
||||
const catalog = await loadCatalog();
|
||||
const base = catalog.releases.find((release) => release.product !== "studio" && release.contributors.length);
|
||||
const markdown = renderGitHubRelease({ ...base, contributors: ["esengine", "alice"] }, "en");
|
||||
assert.doesNotMatch(markdown, /@esengine/);
|
||||
assert.match(markdown, /\[@alice\]/);
|
||||
const alone = renderGitHubRelease({ ...base, contributors: ["esengine"] }, "en");
|
||||
assert.doesNotMatch(alone, /@esengine|## Thanks/);
|
||||
});
|
||||
|
||||
test("the changelog page filters contributors through the owner helper", async () => {
|
||||
const { readFile } = await import("node:fs/promises");
|
||||
const page = await readFile(new URL("../../src/components/ChangelogPage.astro", import.meta.url), "utf8");
|
||||
assert.match(page, /withoutOwner\(release\.contributors\)/);
|
||||
assert.doesNotMatch(page, /release\.contributors\.(length|map)/);
|
||||
});
|
||||
@@ -1,139 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { appendFile } from 'node:fs/promises';
|
||||
import { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { parseStudioNotes } from '../../src/lib/studio-notes.mjs';
|
||||
import { compareVersionsDesc, loadCatalog, upsertRelease, validateCatalog } from './release-notes.mjs';
|
||||
|
||||
const repository = 'esengine/DeepSeek-Reasonix';
|
||||
|
||||
export function missingReleases(published, catalog, { studioOnly = false } = {}) {
|
||||
const existing = new Set(catalog.releases.map((r) => `${r.product || 'cli'}:${r.version}`));
|
||||
// The archive starts after the earliest GitHub tags. Do not require source
|
||||
// catalogs from releases that predate the website's supported history.
|
||||
const oldestCLI = catalog.releases.filter((r) => r.product !== 'studio' && r.channel === 'stable')
|
||||
.map((r) => r.version).sort(compareVersionsDesc).at(-1);
|
||||
const missing = new Map();
|
||||
for (const release of published) {
|
||||
if (release.draft || !release.published_at) continue;
|
||||
const studio = release.tag_name.match(/^studio-v(2\.\d+\.\d+)$/);
|
||||
const cli = release.tag_name.match(/^(?:desktop-|npm-)?v(1\.\d+\.\d+)$/);
|
||||
if (!studio && (!cli || release.prerelease)) continue;
|
||||
const product = studio ? 'studio' : 'cli';
|
||||
if (studioOnly && product !== 'studio') continue;
|
||||
const version = (studio || cli)[1];
|
||||
if (product === 'cli' && oldestCLI && compareVersionsDesc(version, oldestCLI) > 0) continue;
|
||||
const key = `${product}:${version}`;
|
||||
if (existing.has(key)) continue;
|
||||
// Prefer the canonical CLI release over duplicate desktop/package tags.
|
||||
if (!missing.has(key) || release.tag_name === `v${version}`) {
|
||||
missing.set(key, { ...release, product, version });
|
||||
}
|
||||
}
|
||||
return [...missing.values()].sort((a, b) => -compareVersionsDesc(a.version, b.version));
|
||||
}
|
||||
|
||||
export function studioRecord(release, markdown, sha) {
|
||||
if (!markdown?.trim()) throw new Error(`Missing Studio source for ${release.tag_name}`);
|
||||
const version = release.version || release.tag_name.replace(/^studio-v/, '');
|
||||
const title = { en: `Reasonix Studio v${version}`, zh: `Reasonix Studio v${version}` };
|
||||
const line = parseStudioNotes(markdown).summary || `Reasonix Studio v${version}`;
|
||||
const summary = { en: line, zh: line };
|
||||
return {
|
||||
product: 'studio', version, date: release.published_at.slice(0, 10),
|
||||
channel: 'stable',
|
||||
sourceNotes: { language: 'zh', markdown, sha, path: `release-notes/studio/${version}.md` },
|
||||
title, summary, surfaces: ['desktop'], guides: [],
|
||||
highlights: [{ kind: 'improved', title, body: summary }],
|
||||
changes: { new: [], improved: [], fixed: [] }, upgrade: [], risks: [], contributors: [],
|
||||
links: {
|
||||
github: `https://github.com/${repository}/releases/tag/studio-v${version}`,
|
||||
compare: `https://github.com/${repository}/blob/${sha}/release-notes/studio/${version}.md`,
|
||||
download: 'https://reasonix.io/#start',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function describeFailure(error, secrets = [process.env.DEEPSEEK_API_KEY, process.env.GH_TOKEN, process.env.GITHUB_TOKEN]) {
|
||||
let text = String(error?.message ?? error).split('\n')[0];
|
||||
for (const secret of secrets) if (secret && secret.length > 3) text = text.split(secret).join('[redacted]');
|
||||
text = text.replace(/(Bearer\s+|sk-|ghp_|gho_|ghs_|github_pat_)\S+/g, '$1[redacted]').slice(0, 200);
|
||||
return `${error?.name || 'Error'}: ${text}`;
|
||||
}
|
||||
|
||||
export async function readStudioSource(release, api) {
|
||||
const { sha } = JSON.parse(await api(`commits/${release.tag_name}`));
|
||||
if (!/^[0-9a-f]{40}$/.test(sha)) throw new Error(`Invalid source commit for ${release.tag_name}`);
|
||||
const version = release.version || release.tag_name.replace(/^studio-v/, '');
|
||||
const markdown = await api(`contents/release-notes/studio/${version}.md?ref=${sha}`, true);
|
||||
return { sha, markdown };
|
||||
}
|
||||
|
||||
export async function readCLISource(release, api) {
|
||||
const { sha } = JSON.parse(await api(`commits/${release.tag_name}`));
|
||||
if (!/^[0-9a-f]{40}$/.test(sha)) throw new Error(`Invalid source commit for ${release.tag_name}`);
|
||||
const catalog = JSON.parse(await api(`contents/release-notes/releases.json?ref=${sha}`, true));
|
||||
const record = catalog.releases?.find((r) => r.version === release.version && r.product !== 'studio');
|
||||
if (!record) throw new Error(`Missing CLI source for ${release.tag_name}`);
|
||||
validateCatalog({ schemaVersion: catalog.schemaVersion, releases: [record] });
|
||||
// Keep reviewed records gated by fetch-publications.mjs and its all-surface
|
||||
// marker. A GitHub release alone must not promote them to published.
|
||||
return record;
|
||||
}
|
||||
|
||||
export function requireSync(result) {
|
||||
if (result.pending.length) throw new Error(`Changelog sync incomplete: ${result.pending.join(', ')}`);
|
||||
}
|
||||
|
||||
export function requireStudioSync(result, catalog, expectedVersion) {
|
||||
if (result.pending.length) throw new Error(`Studio changelog sync incomplete: ${result.pending.join(', ')}`);
|
||||
const version = expectedVersion?.replace(/^v/, '');
|
||||
if (version && !catalog.releases.some((r) => r.product === 'studio' && r.version === version)) {
|
||||
throw new Error(`Studio changelog is missing requested release ${expectedVersion}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function syncCatalog({ catalog, published, studioOnly = false, readStudio, readCLI, save }) {
|
||||
const added = [], pending = [], failures = [];
|
||||
for (const release of missingReleases(published, catalog, { studioOnly })) {
|
||||
const key = `${release.product}:${release.version}`;
|
||||
try {
|
||||
if (release.product === 'studio') {
|
||||
const { markdown, sha } = await readStudio(release);
|
||||
await save(studioRecord(release, markdown, sha));
|
||||
} else {
|
||||
await save(await readCLI(release));
|
||||
}
|
||||
added.push(key);
|
||||
} catch (error) {
|
||||
pending.push(key);
|
||||
failures.push({ key, reason: describeFailure(error) });
|
||||
}
|
||||
}
|
||||
return { added, pending, failures };
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const studioOnly = process.argv.includes('--studio-only');
|
||||
const api = (endpoint, raw = false, paginate = false) => execFileSync('gh', [
|
||||
'api', '--hostname', 'github.com', ...(paginate ? ['--paginate', '--slurp'] : []),
|
||||
...(raw ? ['-H', 'Accept: application/vnd.github.raw+json'] : []), `repos/${repository}/${endpoint}`,
|
||||
], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
const published = JSON.parse(api('releases?per_page=100', false, true)).flat();
|
||||
const result = await syncCatalog({
|
||||
catalog: await loadCatalog(), published, studioOnly,
|
||||
readStudio: (release) => readStudioSource(release, api),
|
||||
save: (release) => upsertRelease(release),
|
||||
readCLI: (release) => readCLISource(release, api),
|
||||
});
|
||||
const summary = `## Website changelog sync\n\nAdded: ${result.added.join(', ') || 'none'}\n\nPending (retried next run): ${result.pending.join(', ') || 'none'}\n${result.failures.map((f) => `\n- ${f.key}: ${f.reason}`).join('')}\n`;
|
||||
console.log(summary);
|
||||
if (process.env.GITHUB_STEP_SUMMARY) await appendFile(process.env.GITHUB_STEP_SUMMARY, summary);
|
||||
requireSync(result);
|
||||
requireStudioSync(result, await loadCatalog(), process.env.STUDIO_RELEASE_VERSION);
|
||||
}
|
||||
|
||||
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
main().catch((error) => { console.error(error.message); process.exitCode = 1; });
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { test } from 'node:test';
|
||||
import { describeFailure, missingReleases, readCLISource, readStudioSource, requireSync, requireStudioSync, studioRecord, syncCatalog } from './sync-releases.mjs';
|
||||
import { loadCatalog, validateCatalog, renderGitHubRelease } from './release-notes.mjs';
|
||||
|
||||
const published = (tag, extra = {}) => ({ tag_name: tag, draft: false, prerelease: false, published_at: '2026-09-30T12:00:00Z', ...extra });
|
||||
|
||||
test('discovery deduplicates CLI namespaces, includes published Studio previews and ignores drafts and unrelated tags', () => {
|
||||
const found = missingReleases([
|
||||
published('v1.39.3'), published('desktop-v1.39.3'), published('npm-v1.39.3'),
|
||||
published('studio-v2.24.0', { prerelease: true }), published('studio-v2.25.0', { draft: true }),
|
||||
published('v1.39.2'), published('v1.40.0-preview.1', { prerelease: true }), published('other-v3.0.0'),
|
||||
], { releases: [{ version: '1.39.2', product: 'cli' }] });
|
||||
assert.deepEqual(found.map(({ product, version }) => [product, version]), [['cli', '1.39.3'], ['studio', '2.24.0']]);
|
||||
});
|
||||
|
||||
const cliOnlyCatalog = async () => {
|
||||
const catalog = await loadCatalog();
|
||||
return { ...catalog, releases: catalog.releases.filter((r) => r.product !== 'studio') };
|
||||
};
|
||||
|
||||
test('Studio preserves Chinese source verbatim and validates without CLI targeting', async () => {
|
||||
const notes = '中立版本说明。\n\n## 修复\n\n- 改善窗口布局\n';
|
||||
const release = studioRecord(published('studio-v2.24.0', { prerelease: true }), notes, 'a'.repeat(40));
|
||||
assert.equal(release.product, 'studio');
|
||||
assert.equal(release.sourceNotes.language, 'zh');
|
||||
assert.equal(release.sourceNotes.markdown, notes);
|
||||
assert.equal(release.channel, 'stable');
|
||||
assert.doesNotThrow(() => validateCatalog({ schemaVersion: 1, releases: [release] }));
|
||||
assert.equal(renderGitHubRelease(release), notes);
|
||||
const catalog = await loadCatalog();
|
||||
assert.throws(() => validateCatalog({ ...catalog, releases: [{ ...catalog.releases[0], product: 'invalid' }] }));
|
||||
assert.throws(() => validateCatalog({ schemaVersion: 1, releases: [{ ...release, sourceNotes: undefined }] }));
|
||||
});
|
||||
|
||||
test('batch sync imports reviewed CLI and Studio source without model generation', async () => {
|
||||
const catalog = await cliOnlyCatalog();
|
||||
const saved = [];
|
||||
const result = await syncCatalog({
|
||||
catalog, published: [published('v1.99.0'), published('studio-v2.24.0')],
|
||||
readStudio: async () => ({ sha: 'a'.repeat(40), markdown: '中立更新。\n' }),
|
||||
save: async (release) => saved.push(release),
|
||||
readCLI: async () => ({ version: '1.99.0', status: 'reviewed' }),
|
||||
});
|
||||
assert.deepEqual(saved.map((r) => r.version), ['1.99.0', '2.24.0']);
|
||||
assert.equal(saved[0].status, 'reviewed');
|
||||
assert.deepEqual(result.pending, []);
|
||||
assert.deepEqual(result.added, ['cli:1.99.0', 'studio:2.24.0']);
|
||||
});
|
||||
|
||||
test('existing catalog entries are never regenerated', async () => {
|
||||
const catalog = await loadCatalog();
|
||||
const result = await syncCatalog({ catalog, published: [published('v1.39.2')], save: () => { throw new Error('unexpected write'); } });
|
||||
assert.deepEqual(result, { added: [], pending: [], failures: [] });
|
||||
});
|
||||
|
||||
test('batch failures retry independently and never manufacture missing Studio notes', async () => {
|
||||
const result = await syncCatalog({
|
||||
catalog: await cliOnlyCatalog(), published: [published('studio-v2.23.0'), published('studio-v2.24.0')],
|
||||
readStudio: async (release) => ({ sha: 'a'.repeat(40), markdown: release.version === '2.23.0' ? '' : '中立说明。' }),
|
||||
save: async () => {},
|
||||
});
|
||||
assert.deepEqual(result.added, ['studio:2.24.0']);
|
||||
assert.deepEqual(result.pending, ['studio:2.23.0']);
|
||||
assert.match(result.failures[0].reason, /^Error: Missing Studio source/);
|
||||
});
|
||||
|
||||
test('CLI range selection uses the earlier CLI release even with newer Studio and CLI records', async () => {
|
||||
const { previousCLIRelease } = await import('./generate-release-notes.mjs');
|
||||
assert.equal(previousCLIRelease({ releases: [
|
||||
{ version: '2.24.0', product: 'studio', channel: 'stable' },
|
||||
{ version: '1.39.6', product: 'cli', channel: 'stable' },
|
||||
{ version: '1.39.2', channel: 'stable' },
|
||||
] }, '1.39.3').version, '1.39.2');
|
||||
});
|
||||
|
||||
test('an upstream published CLI release preserves its publication-marker gate', async () => {
|
||||
const saved = [];
|
||||
const result = await syncCatalog({
|
||||
catalog: await loadCatalog(), published: [published('v1.99.0')],
|
||||
readCLI: async () => ({ version: '1.99.0', product: 'cli', status: 'reviewed' }),
|
||||
save: async (release) => saved.push(release),
|
||||
});
|
||||
assert.deepEqual(result.added, ['cli:1.99.0']);
|
||||
assert.equal(saved[0].status, 'reviewed');
|
||||
});
|
||||
|
||||
test('failure reasons carry the error class and a message but never secrets', async () => {
|
||||
const result = await syncCatalog({
|
||||
catalog: await loadCatalog(), published: [published('v1.99.0')],
|
||||
readCLI: async () => { throw new TypeError('request failed with Bearer abc123token and key sk-live-999\nstack line'); },
|
||||
save: async () => {},
|
||||
});
|
||||
assert.deepEqual(result.pending, ['cli:1.99.0']);
|
||||
assert.equal(result.failures[0].reason, 'TypeError: request failed with Bearer [redacted] and key sk-[redacted]');
|
||||
assert.equal(describeFailure(new Error('boom hunter2'), ['hunter2']), 'Error: boom [redacted]');
|
||||
});
|
||||
|
||||
test('Studio entries take their summary from the first line of the notes', () => {
|
||||
const release = studioRecord(published('studio-v2.24.0'), '本版加入反馈。\n\n## 新增\n\n- 项 (#1)\n', 'a'.repeat(40));
|
||||
assert.equal(release.summary.zh, '本版加入反馈。');
|
||||
assert.equal(release.summary.en, '本版加入反馈。');
|
||||
});
|
||||
|
||||
test('Studio source is read from its published tag commit, never the moving product branch', async () => {
|
||||
const sha = 'b'.repeat(40);
|
||||
const source = await readStudioSource(published('studio-v2.45.0'), async (endpoint, raw) => {
|
||||
if (endpoint === 'commits/studio-v2.45.0') return JSON.stringify({ sha });
|
||||
assert.equal(endpoint, `contents/release-notes/studio/2.45.0.md?ref=${sha}`);
|
||||
assert.equal(raw, true);
|
||||
return '该版本原始说明。\n';
|
||||
});
|
||||
assert.deepEqual(source, { sha, markdown: '该版本原始说明。\n' });
|
||||
});
|
||||
|
||||
test('build sync imports all missing Studio releases, leaves CLI alone and is idempotent', async () => {
|
||||
const catalog = { schemaVersion: 1, releases: [] };
|
||||
const releases = [published('v1.99.0'), published('studio-v2.44.0'), published('studio-v2.45.0'), published('studio-v2.46.0', { draft: true })];
|
||||
const run = () => syncCatalog({
|
||||
catalog, published: releases, studioOnly: true,
|
||||
readStudio: async (release) => ({ sha: release.version === '2.44.0' ? 'a'.repeat(40) : 'b'.repeat(40), markdown: `${release.version} 原文。\n` }),
|
||||
save: async (release) => catalog.releases.unshift(release),
|
||||
});
|
||||
const first = await run();
|
||||
assert.deepEqual(first.added, ['studio:2.44.0', 'studio:2.45.0']);
|
||||
assert.deepEqual(first.pending, []);
|
||||
assert.equal(catalog.releases[0].version, '2.45.0');
|
||||
assert.equal(catalog.releases[0].sourceNotes.sha, 'b'.repeat(40));
|
||||
assert.deepEqual((await run()).added, []);
|
||||
});
|
||||
|
||||
test('a failed or incomplete Studio sync blocks publication of a stale catalog', () => {
|
||||
const catalog = { releases: [{ product: 'studio', version: '2.44.0' }, { version: '2.45.0', product: 'cli' }] };
|
||||
const complete = { pending: [], failures: [] };
|
||||
assert.doesNotThrow(() => requireStudioSync(complete, catalog));
|
||||
assert.doesNotThrow(() => requireStudioSync(complete, catalog, '2.44.0'));
|
||||
assert.doesNotThrow(() => requireStudioSync(complete, catalog, 'v2.44.0'));
|
||||
assert.throws(() => requireStudioSync(complete, catalog, '2.45.0'), /2\.45\.0/);
|
||||
assert.throws(() => requireStudioSync({ pending: ['studio:2.45.0'] }, catalog), /studio:2\.45\.0/);
|
||||
});
|
||||
|
||||
test('production builds synchronize both products before rendering and deployments require the website branch', async () => {
|
||||
const pkg = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), 'utf8'));
|
||||
assert.ok(pkg.scripts.prebuild.startsWith('node scripts/releases/sync-releases.mjs &&'));
|
||||
const workflow = await readFile(new URL('../../../.github/workflows/pages.yml', import.meta.url), 'utf8');
|
||||
assert.match(workflow, /workflow_dispatch:\n inputs:/);
|
||||
assert.match(workflow, /if: github\.ref == 'refs\/heads\/website'/);
|
||||
assert.match(workflow, /STUDIO_RELEASE_VERSION: \$\{\{ inputs\.studio_version \}\}/);
|
||||
});
|
||||
|
||||
test('CLI sources use exact published tag commits and preserve reviewed bilingual content', async () => {
|
||||
const catalog = await loadCatalog();
|
||||
const record = catalog.releases.find((r) => r.version === '1.39.7');
|
||||
const sha = 'c'.repeat(40);
|
||||
for (const tag of ['v1.39.7', 'desktop-v1.39.7']) {
|
||||
const result = await readCLISource({ ...published(tag), version: '1.39.7' }, async (endpoint, raw) => {
|
||||
if (endpoint === `commits/${tag}`) return JSON.stringify({ sha });
|
||||
assert.equal(endpoint, `contents/release-notes/releases.json?ref=${sha}`);
|
||||
assert.equal(raw, true);
|
||||
return JSON.stringify({ schemaVersion: 1, releases: [record] });
|
||||
});
|
||||
assert.deepEqual(result, record);
|
||||
}
|
||||
});
|
||||
|
||||
test('missing or invalid CLI source fails closed while independent Studio sync continues', async () => {
|
||||
const release = { ...published('v1.99.0'), version: '1.99.0' };
|
||||
const api = async (endpoint) => endpoint.startsWith('commits/')
|
||||
? JSON.stringify({ sha: 'd'.repeat(40) })
|
||||
: JSON.stringify({ schemaVersion: 1, releases: [] });
|
||||
const result = await syncCatalog({
|
||||
catalog: await cliOnlyCatalog(), published: [release, published('studio-v2.99.0')],
|
||||
readCLI: (r) => readCLISource(r, api),
|
||||
readStudio: async () => ({ sha: 'e'.repeat(40), markdown: '更新说明。' }),
|
||||
save: async () => {},
|
||||
});
|
||||
assert.deepEqual(result.pending, ['cli:1.99.0']);
|
||||
assert.deepEqual(result.added, ['studio:2.99.0']);
|
||||
assert.throws(() => requireSync(result), /cli:1\.99\.0/);
|
||||
await assert.rejects(readCLISource(release, async () => JSON.stringify({ sha: 'invalid' })), /Invalid source commit/);
|
||||
await assert.rejects(readCLISource(release, async (endpoint) => endpoint.startsWith('commits/')
|
||||
? JSON.stringify({ sha: 'd'.repeat(40) })
|
||||
: JSON.stringify({ schemaVersion: 1, releases: [{ version: '1.99.0' }] })), /date/);
|
||||
});
|
||||
|
||||
test('build sync respects the archive history boundary and never imports unpublished CLI drafts', async () => {
|
||||
const catalog = { schemaVersion: 1, releases: [{ version: '1.39.7', channel: 'stable' }] };
|
||||
const releases = [published('v1.0.0'), published('v1.39.8'), published('desktop-v1.39.8'),
|
||||
published('v1.39.9'), published('v1.39.10', { draft: true }), published('v1.39.11', { prerelease: true })];
|
||||
const run = () => syncCatalog({
|
||||
catalog, published: releases,
|
||||
readCLI: async (r) => ({ version: r.version, channel: 'stable', status: 'reviewed' }),
|
||||
save: async (r) => catalog.releases.unshift(r),
|
||||
});
|
||||
assert.deepEqual((await run()).added, ['cli:1.39.8', 'cli:1.39.9']);
|
||||
assert.deepEqual(catalog.releases.map((r) => r.version), ['1.39.9', '1.39.8', '1.39.7']);
|
||||
const repeated = await run();
|
||||
assert.deepEqual(repeated, { added: [], pending: [], failures: [] });
|
||||
assert.doesNotThrow(() => requireSync(repeated));
|
||||
});
|
||||
@@ -1,445 +0,0 @@
|
||||
---
|
||||
import Base from '../layouts/Base.astro';
|
||||
import CommunityJoin from './CommunityJoin.astro';
|
||||
import SiteHeader from './SiteHeader.astro';
|
||||
import type { ReleaseItem, ReleaseRecord, ReleaseTarget } from '../data/releases';
|
||||
import { releasePath, releaseTargetCount } from '../data/releases';
|
||||
import { issueHref, parseStudioNotes } from '../lib/studio-notes.mjs';
|
||||
import { withoutOwner } from '../lib/repository-owner.mjs';
|
||||
import '../styles/changelog.css';
|
||||
|
||||
const { release, releases, canonical } = Astro.props as {
|
||||
release: ReleaseRecord;
|
||||
releases: ReleaseRecord[];
|
||||
canonical?: string;
|
||||
};
|
||||
const thanked = withoutOwner(release.contributors);
|
||||
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
||||
const repo = 'https://github.com/esengine/DeepSeek-Reasonix';
|
||||
const prHref = (ref: number) => `${repo}/pull/${ref}`;
|
||||
|
||||
const isStudio = release.product === 'studio';
|
||||
const isPreview = !isStudio && release.channel === 'prerelease';
|
||||
const latestForChannel = releases[0];
|
||||
const studioDoc = isStudio && release.sourceNotes ? parseStudioNotes(release.sourceNotes.markdown) : null;
|
||||
const studioBlocks = studioDoc ? studioDoc.blocks.filter((block, index) => !(index === 0 && block.type === 'paragraph' && studioDoc.summary === release.summary.zh)) : [];
|
||||
const downloadHref = isPreview ? 'https://reasonix.io/?download=desktop#start' : release.links.download;
|
||||
|
||||
const kindLabel = (kind: string) => ({
|
||||
new: { en: 'New', zh: '新增' },
|
||||
improved: { en: 'Improved', zh: '改进' },
|
||||
fixed: { en: 'Fixed', zh: '修复' },
|
||||
security: { en: 'Security', zh: '安全' },
|
||||
}[kind] ?? { en: kind, zh: kind });
|
||||
|
||||
const surfaceLabel = (surface: string) => ({
|
||||
agent: { en: 'Agent', zh: 'Agent' },
|
||||
desktop: { en: 'Desktop', zh: '桌面端' },
|
||||
cli: { en: 'CLI', zh: 'CLI' },
|
||||
mcp: { en: 'MCP', zh: 'MCP' },
|
||||
security: { en: 'Security', zh: '安全' },
|
||||
provider: { en: 'Provider', zh: '模型服务' },
|
||||
plugin: { en: 'Plugins', zh: '插件' },
|
||||
site: { en: 'Site', zh: '网站' },
|
||||
service: { en: 'Service', zh: '服务端' },
|
||||
}[surface] ?? { en: surface, zh: surface });
|
||||
|
||||
const targetingEnabled = release.targetingVersion === 1;
|
||||
const changeKinds = ['new', 'improved', 'fixed'] as const;
|
||||
const clientTargets: { id: ReleaseTarget; en: string; zh: string }[] = [
|
||||
{ id: 'desktop', en: 'Desktop updates', zh: '桌面端更新' },
|
||||
{ id: 'cli', en: 'CLI updates', zh: 'CLI 端更新' },
|
||||
];
|
||||
const hasTarget = (item: ReleaseItem, target: ReleaseTarget) => item.targets?.includes(target) ?? false;
|
||||
const clientHighlights = (target: ReleaseTarget) => release.highlights.filter((item) => hasTarget(item, target));
|
||||
const clientChanges = (target: ReleaseTarget, kind: typeof changeKinds[number]) =>
|
||||
release.changes[kind].filter((item) => hasTarget(item, target));
|
||||
const hasClientChangeContent = (target: ReleaseTarget) =>
|
||||
clientHighlights(target).length > 0 || changeKinds.some((kind) => clientChanges(target, kind).length > 0);
|
||||
const isOtherOnly = (item: ReleaseItem) =>
|
||||
Boolean(item.targets?.length) && !hasTarget(item, 'desktop') && !hasTarget(item, 'cli');
|
||||
const otherHighlights = release.highlights.filter(isOtherOnly);
|
||||
const otherChanges = Object.fromEntries(
|
||||
changeKinds.map((kind) => [kind, release.changes[kind].filter(isOtherOnly)]),
|
||||
) as Record<typeof changeKinds[number], ReleaseItem[]>;
|
||||
const hasOtherChanges = otherHighlights.length > 0 || changeKinds.some((kind) => otherChanges[kind].length > 0);
|
||||
|
||||
/* Sections render only when they have content; numbering is sequential. */
|
||||
const sectionDefs = [
|
||||
...(release.guides.length ? [{ id: 'guides', en: 'Guides', zh: '使用攻略' }] : []),
|
||||
...(targetingEnabled
|
||||
? [
|
||||
...clientTargets,
|
||||
...(hasOtherChanges ? [{ id: 'other', en: 'Other project updates', zh: '其他项目更新' }] : []),
|
||||
]
|
||||
: [
|
||||
{ id: 'highlights', en: 'Highlights', zh: '重点内容' },
|
||||
...changeKinds
|
||||
.filter((kind) => release.changes[kind].length)
|
||||
.map((kind) => ({ id: kind, ...kindLabel(kind) })),
|
||||
]),
|
||||
...(release.upgrade.length ? [{ id: 'upgrade', en: 'Upgrade notes', zh: '升级提醒' }] : []),
|
||||
...(release.risks.length ? [{ id: 'risks', en: 'Risk notes', zh: '风险提示' }] : []),
|
||||
...(thanked.length ? [{ id: 'thanks', en: 'Thanks', zh: '致谢' }] : []),
|
||||
];
|
||||
const sectionNum = new Map(sectionDefs.map((s, i) => [s.id, String(i + 1).padStart(2, '0')]));
|
||||
const tocItems = [...(isStudio ? [{ id: 'source-notes', en: 'Chinese source notes', zh: '中文原始说明' }] : sectionDefs), { id: 'download', en: 'Download', zh: '下载与安装' }];
|
||||
|
||||
/* Version rail: group by minor, show the latest few patches per group,
|
||||
older ones behind a native <details> expander. */
|
||||
const minorKey = (v: string) => v.split('.').slice(0, 2).join('.');
|
||||
const railGroups: { key: string; items: ReleaseRecord[] }[] = [];
|
||||
for (const item of releases) {
|
||||
const key = minorKey(item.version);
|
||||
const last = railGroups[railGroups.length - 1];
|
||||
if (last && last.key === key) last.items.push(item);
|
||||
else railGroups.push({ key, items: [item] });
|
||||
}
|
||||
const RAIL_VISIBLE = 3;
|
||||
|
||||
const titleEn = `Reasonix${isStudio ? ' Studio' : ''} v${release.version} release notes`;
|
||||
const titleZh = `Reasonix${isStudio ? ' Studio' : ''} v${release.version} 更新日志`;
|
||||
const description = release.summary.en;
|
||||
---
|
||||
|
||||
<Base title={titleEn} titleEn={titleEn} titleZh={titleZh} description={description} canonical={canonical} noindex={isPreview}>
|
||||
<SiteHeader active="changelog" scrolled />
|
||||
|
||||
<main class="release-stage">
|
||||
<nav class="release-product-tabs" aria-label="Products">
|
||||
<a href={`${base}/changelog/cli/`} aria-current={!isStudio ? 'page' : undefined}><span class="l-en">CLI · 1.x (previous)</span><span class="l-zh">CLI · 1.x(上一代)</span></a>
|
||||
<a href={`${base}/changelog/`} aria-current={isStudio ? 'page' : undefined}>Studio · 2.x</a>
|
||||
</nav>
|
||||
<div class="release-mobile-switcher">
|
||||
<label for="release-version"><span class="l-en">Version</span><span class="l-zh">版本</span></label>
|
||||
<select id="release-version" data-release-version>
|
||||
{releases.map((item) => <option value={item.version} selected={item.version === release.version}>v{item.version}</option>)}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="release-grid">
|
||||
<aside class="release-rail" aria-label="Release versions">
|
||||
<div class="release-rail__eyebrow"><span class="release-rail__mark"></span><span class="l-en">Release ledger</span><span class="l-zh">版本档案</span></div>
|
||||
<nav>
|
||||
{railGroups.map((group) => {
|
||||
const channelItems = group.items;
|
||||
if (!channelItems.length) return null;
|
||||
const visible = channelItems.slice(0, RAIL_VISIBLE);
|
||||
const overflow = channelItems.slice(RAIL_VISIBLE);
|
||||
return (
|
||||
<div class="release-rail__group">
|
||||
<p class="release-rail__minor">{group.key}.x</p>
|
||||
{visible.map((item) => (
|
||||
<a class:list={["release-version-link", { active: item.version === release.version }]} href={`${base}${releasePath(item.version)}`}>
|
||||
<span class="release-version-link__line"><strong>v{item.version}</strong>{item === latestForChannel && <em><span class="l-en">Latest</span><span class="l-zh">最新</span></em>}</span>
|
||||
<small>{item.date}</small>
|
||||
</a>
|
||||
))}
|
||||
{overflow.length > 0 && (
|
||||
<details class="release-rail__more" open={overflow.some((item) => item.version === release.version)}>
|
||||
<summary>
|
||||
<span class="when-closed"><span class="l-en">+{overflow.length} more</span><span class="l-zh">还有 {overflow.length} 个</span></span>
|
||||
<span class="when-open"><span class="l-en">Show less</span><span class="l-zh">收起</span></span>
|
||||
</summary>
|
||||
{overflow.map((item) => (
|
||||
<a class:list={["release-version-link", { active: item.version === release.version }]} href={`${base}${releasePath(item.version)}`}>
|
||||
<span class="release-version-link__line"><strong>v{item.version}</strong>{item === latestForChannel && <em><span class="l-en">Latest</span><span class="l-zh">最新</span></em>}</span>
|
||||
<small>{item.date}</small>
|
||||
</a>
|
||||
))}
|
||||
</details>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
<a class="release-rail__all" href={`${repo}/releases`}><span class="l-en">All GitHub releases ↗</span><span class="l-zh">全部 GitHub Releases ↗</span></a>
|
||||
</aside>
|
||||
|
||||
<article class="release-paper">
|
||||
<header class="release-hero">
|
||||
<div class="release-hero__meta">
|
||||
{isPreview && <span class="release-channel release-channel--preview"><span class="release-channel__dot"></span><span class="l-en">Historical archive</span><span class="l-zh">历史归档</span></span>}
|
||||
<time datetime={release.date}>{release.date}</time>
|
||||
</div>
|
||||
<h1>Reasonix{isStudio ? ' Studio' : ''} v{release.version}</h1>
|
||||
<div class="release-surfaces">
|
||||
{release.surfaces.map((surface) => {
|
||||
const label = surfaceLabel(surface);
|
||||
return <span><span class="l-en">{label.en}</span><span class="l-zh">{label.zh}</span></span>;
|
||||
})}
|
||||
</div>
|
||||
{release.builds && (
|
||||
<div class="release-builds" aria-label="Published builds">
|
||||
<span><strong>CLI</strong> {release.builds.cli}</span>
|
||||
<span><strong>Desktop</strong> {release.builds.desktop}</span>
|
||||
<span><strong>npm</strong> {release.builds.npm}</span>
|
||||
</div>
|
||||
)}
|
||||
{targetingEnabled && (
|
||||
<div class="release-target-summary" aria-label="Updates by product">
|
||||
<span><strong>Desktop</strong> {releaseTargetCount(release, 'desktop')}</span>
|
||||
<span><strong>CLI</strong> {releaseTargetCount(release, 'cli')}</span>
|
||||
</div>
|
||||
)}
|
||||
<p class="release-lede"><span class="l-en">{release.summary.en}</span><span class="l-zh">{release.summary.zh}</span></p>
|
||||
</header>
|
||||
|
||||
{isStudio && release.sourceNotes && (
|
||||
<section id="source-notes" class="release-section">
|
||||
<div class="release-section__head"><span>01</span><h2><span class="l-en">Chinese source notes</span><span class="l-zh">中文原始说明</span></h2></div>
|
||||
<p class="release-source-link"><a href={release.links.compare}><span class="l-en">View source ↗</span><span class="l-zh">查看原文 ↗</span></a></p>
|
||||
<div class="release-source-notes" lang="zh">
|
||||
{studioBlocks.map((block) => block.type === 'heading' ? (
|
||||
<h3>{block.inline.map((token) => token.type === 'code' ? <code>{token.value}</code> : token.value)}</h3>
|
||||
) : block.type === 'list' ? (
|
||||
<ul>
|
||||
{block.items.map((item) => (
|
||||
<li>{item.map((token) => token.type === 'code' ? <code>{token.value}</code> : token.type === 'ref' ? <a href={issueHref(token.number)} rel="noopener">{token.value}</a> : token.value)}</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p>{block.inline.map((token) => token.type === 'code' ? <code>{token.value}</code> : token.type === 'ref' ? <a href={issueHref(token.number)} rel="noopener">{token.value}</a> : token.value)}</p>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
{!isStudio && <>
|
||||
{release.guides.length > 0 && (
|
||||
<section id="guides" class="release-section release-guides">
|
||||
<div class="release-section__head"><span>{sectionNum.get('guides')}</span><h2><span class="l-en">Start here</span><span class="l-zh">使用攻略</span></h2></div>
|
||||
<div class="release-guide-grid">
|
||||
{release.guides.map((guide) => (
|
||||
<a class="release-guide" href={guide.href}>
|
||||
<span class="release-guide__arrow">↗</span>
|
||||
<h3><span class="l-en">{guide.title.en}</span><span class="l-zh">{guide.title.zh}</span></h3>
|
||||
<p><span class="l-en">{guide.body.en}</span><span class="l-zh">{guide.body.zh}</span></p>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{targetingEnabled ? (
|
||||
<>
|
||||
{clientTargets.map((target) => {
|
||||
const highlights = clientHighlights(target.id);
|
||||
const total = releaseTargetCount(release, target.id);
|
||||
return (
|
||||
<section id={target.id} class="release-section release-target-section" data-target={target.id}>
|
||||
<div class="release-section__head"><span>{sectionNum.get(target.id)}</span><h2><span class="l-en">{target.en}</span><span class="l-zh">{target.zh}</span></h2></div>
|
||||
<p class="release-target-section__summary">
|
||||
<span class="l-en">{total} update{total === 1 ? '' : 's'} relevant to {target.id === 'desktop' ? 'Desktop' : 'CLI'}.</span>
|
||||
<span class="l-zh">与{target.id === 'desktop' ? '桌面端' : ' CLI'}相关的更新共 {total} 项。</span>
|
||||
</p>
|
||||
|
||||
{highlights.length > 0 && (
|
||||
<div class="release-target-group">
|
||||
<h3 class="release-target-group__title"><span class="l-en">Highlights</span><span class="l-zh">重点内容</span></h3>
|
||||
<div class="release-highlight-list">
|
||||
{highlights.map((item, index) => {
|
||||
const kind = kindLabel(item.kind);
|
||||
return (
|
||||
<article class="release-highlight" data-kind={item.kind}>
|
||||
<div class="release-highlight__index">{String(index + 1).padStart(2, '0')}</div>
|
||||
<div>
|
||||
<div class="release-item-meta">
|
||||
<div class="release-highlight__kind"><span class="l-en">{kind.en}</span><span class="l-zh">{kind.zh}</span></div>
|
||||
<div class="release-item-targets">{item.targets?.map((itemTarget) => {
|
||||
const label = surfaceLabel(itemTarget);
|
||||
return <span><span class="l-en">{label.en}</span><span class="l-zh">{label.zh}</span></span>;
|
||||
})}</div>
|
||||
</div>
|
||||
<h3><span class="l-en">{item.title.en}</span><span class="l-zh">{item.title.zh}</span></h3>
|
||||
<p><span class="l-en">{item.body.en}</span><span class="l-zh">{item.body.zh}</span></p>
|
||||
{item.refs?.length && <div class="release-refs">{item.refs.map((ref) => <a href={prHref(ref)}>#{ref}</a>)}</div>}
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{changeKinds.map((kind) => {
|
||||
const items = clientChanges(target.id, kind);
|
||||
if (!items.length) return null;
|
||||
const label = kindLabel(kind);
|
||||
return (
|
||||
<div class="release-target-group">
|
||||
<h3 class="release-target-group__title"><span class="l-en">{label.en}</span><span class="l-zh">{label.zh}</span></h3>
|
||||
<div class="release-change-list">
|
||||
{items.map((item: ReleaseItem) => (
|
||||
<article>
|
||||
<div class="release-item-targets">{item.targets?.map((itemTarget) => {
|
||||
const targetLabel = surfaceLabel(itemTarget);
|
||||
return <span><span class="l-en">{targetLabel.en}</span><span class="l-zh">{targetLabel.zh}</span></span>;
|
||||
})}</div>
|
||||
<h3><span class="l-en">{item.title.en}</span><span class="l-zh">{item.title.zh}</span></h3>
|
||||
<p><span class="l-en">{item.body.en}</span><span class="l-zh">{item.body.zh}</span></p>
|
||||
{item.refs?.length && <div class="release-refs">{item.refs.map((ref) => <a href={prHref(ref)}>#{ref}</a>)}</div>}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
{!hasClientChangeContent(target.id) && (
|
||||
<div class="release-target-empty">
|
||||
{target.id === 'cli' && total === 0 ? (
|
||||
<><strong><span class="l-en">No CLI changes in this release.</span><span class="l-zh">本版本没有 CLI 相关改动。</span></strong><p><span class="l-en">CLI users may skip this version if preferred.</span><span class="l-zh">CLI 用户可按需跳过这个版本。</span></p></>
|
||||
) : (
|
||||
<><strong><span class="l-en">No feature or fix entries in this section.</span><span class="l-zh">此板块没有功能或修复条目。</span></strong><p><span class="l-en">See the upgrade and risk notes below for relevant guidance.</span><span class="l-zh">相关说明请查看下方升级提醒和风险提示。</span></p></>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
})}
|
||||
|
||||
{hasOtherChanges && (
|
||||
<section id="other" class="release-section release-target-section" data-target="other">
|
||||
<div class="release-section__head"><span>{sectionNum.get('other')}</span><h2><span class="l-en">Other project updates</span><span class="l-zh">其他项目更新</span></h2></div>
|
||||
<p class="release-target-section__summary"><span class="l-en">Website and service changes that do not require a Desktop or CLI update.</span><span class="l-zh">不要求更新桌面端或 CLI 的网站与服务端变更。</span></p>
|
||||
<div class="release-change-list">
|
||||
{[...otherHighlights, ...changeKinds.flatMap((kind) => otherChanges[kind])].map((item) => (
|
||||
<article>
|
||||
<div class="release-item-targets">{item.targets?.map((itemTarget) => {
|
||||
const label = surfaceLabel(itemTarget);
|
||||
return <span><span class="l-en">{label.en}</span><span class="l-zh">{label.zh}</span></span>;
|
||||
})}</div>
|
||||
<h3><span class="l-en">{item.title.en}</span><span class="l-zh">{item.title.zh}</span></h3>
|
||||
<p><span class="l-en">{item.body.en}</span><span class="l-zh">{item.body.zh}</span></p>
|
||||
{item.refs?.length && <div class="release-refs">{item.refs.map((ref) => <a href={prHref(ref)}>#{ref}</a>)}</div>}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<section id="highlights" class="release-section">
|
||||
<div class="release-section__head"><span>{sectionNum.get('highlights')}</span><h2><span class="l-en">Highlights</span><span class="l-zh">重点内容</span></h2></div>
|
||||
<div class="release-highlight-list">
|
||||
{release.highlights.map((item, index) => {
|
||||
const kind = kindLabel(item.kind);
|
||||
return (
|
||||
<article class="release-highlight" data-kind={item.kind}>
|
||||
<div class="release-highlight__index">{String(index + 1).padStart(2, '0')}</div>
|
||||
<div>
|
||||
<div class="release-highlight__kind"><span class="l-en">{kind.en}</span><span class="l-zh">{kind.zh}</span></div>
|
||||
<h3><span class="l-en">{item.title.en}</span><span class="l-zh">{item.title.zh}</span></h3>
|
||||
<p><span class="l-en">{item.body.en}</span><span class="l-zh">{item.body.zh}</span></p>
|
||||
{item.refs?.length && <div class="release-refs">{item.refs.map((ref) => <a href={prHref(ref)}>#{ref}</a>)}</div>}
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{changeKinds.map((kind) => {
|
||||
const items = release.changes[kind];
|
||||
if (!items.length) return null;
|
||||
const label = kindLabel(kind);
|
||||
return (
|
||||
<section id={kind} class="release-section release-change-section">
|
||||
<div class="release-section__head"><span>{sectionNum.get(kind)}</span><h2><span class="l-en">{label.en}</span><span class="l-zh">{label.zh}</span></h2></div>
|
||||
<div class="release-change-list">
|
||||
{items.map((item: ReleaseItem) => (
|
||||
<article>
|
||||
<h3><span class="l-en">{item.title.en}</span><span class="l-zh">{item.title.zh}</span></h3>
|
||||
<p><span class="l-en">{item.body.en}</span><span class="l-zh">{item.body.zh}</span></p>
|
||||
{item.refs?.length && <div class="release-refs">{item.refs.map((ref) => <a href={prHref(ref)}>#{ref}</a>)}</div>}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
|
||||
{release.upgrade.length > 0 && (
|
||||
<section id="upgrade" class="release-section">
|
||||
<div class="release-section__head"><span>{sectionNum.get('upgrade')}</span><h2><span class="l-en">Upgrade notes</span><span class="l-zh">升级提醒</span></h2></div>
|
||||
<div class="release-notice-list">
|
||||
{release.upgrade.map((item) => (
|
||||
<article class:list={["release-notice", `release-notice--${item.level}`]}>
|
||||
<div class="release-notice__icon">{item.level === 'warning' ? '!' : 'i'}</div>
|
||||
<div>
|
||||
{item.targets?.length && <div class="release-item-targets">{item.targets.map((itemTarget) => {
|
||||
const label = surfaceLabel(itemTarget);
|
||||
return <span><span class="l-en">{label.en}</span><span class="l-zh">{label.zh}</span></span>;
|
||||
})}</div>}
|
||||
<h3><span class="l-en">{item.title.en}</span><span class="l-zh">{item.title.zh}</span></h3>
|
||||
<p><span class="l-en">{item.body.en}</span><span class="l-zh">{item.body.zh}</span></p>
|
||||
{item.refs?.length && <div class="release-refs">{item.refs.map((ref) => <a href={prHref(ref)}>#{ref}</a>)}</div>}
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{release.risks.length > 0 && (
|
||||
<section id="risks" class="release-section">
|
||||
<div class="release-section__head"><span>{sectionNum.get('risks')}</span><h2><span class="l-en">Risk notes</span><span class="l-zh">风险提示</span></h2></div>
|
||||
<div class="release-change-list">
|
||||
{release.risks.map((item) => (
|
||||
<article>
|
||||
{item.targets?.length && <div class="release-item-targets">{item.targets.map((itemTarget) => {
|
||||
const label = surfaceLabel(itemTarget);
|
||||
return <span><span class="l-en">{label.en}</span><span class="l-zh">{label.zh}</span></span>;
|
||||
})}</div>}
|
||||
<h3><span class="l-en">{item.title.en}</span><span class="l-zh">{item.title.zh}</span></h3>
|
||||
<p><span class="l-en">{item.body.en}</span><span class="l-zh">{item.body.zh}</span></p>
|
||||
{item.refs?.length && <div class="release-refs">{item.refs.map((ref) => <a href={prHref(ref)}>#{ref}</a>)}</div>}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{thanked.length > 0 && (
|
||||
<section id="thanks" class="release-section release-thanks">
|
||||
<div class="release-section__head"><span>{sectionNum.get('thanks')}</span><h2><span class="l-en">Thanks</span><span class="l-zh">致谢</span></h2></div>
|
||||
<p><span class="l-en">This release was shaped by:</span><span class="l-zh">感谢本版本的贡献者:</span></p>
|
||||
<div>{thanked.map((name) => <a href={`https://github.com/${name}`}>@{name}</a>)}</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
</>}
|
||||
|
||||
<section id="download" class="release-section release-download">
|
||||
<div>
|
||||
<p class="release-download__kicker"><span class="l-en">Ready when you are</span><span class="l-zh">准备好即可升级</span></p>
|
||||
<h2><span class="l-en">Ship with a safer Reasonix.</span><span class="l-zh">升级到更可靠的 Reasonix。</span></h2>
|
||||
</div>
|
||||
<div class="release-download__actions">
|
||||
<a class="btn btn-dark" href={downloadHref}><span class="l-en">Download</span><span class="l-zh">下载</span></a>
|
||||
<a class="release-compare" href={release.links.compare}><span class="l-en">{isStudio ? 'Source notes ↗' : 'Full comparison ↗'}</span><span class="l-zh">{isStudio ? '原始说明 ↗' : '完整差异 ↗'}</span></a>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<aside class="release-toc">
|
||||
<p><span class="l-en">In v{release.version}</span><span class="l-zh">在 v{release.version} 中</span></p>
|
||||
<nav>{tocItems.map((item) => <a href={`#${item.id}`}><span class="l-en">{item.en}</span><span class="l-zh">{item.zh}</span></a>)}</nav>
|
||||
</aside>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<CommunityJoin />
|
||||
<footer class="release-footer">
|
||||
<a class="brand" href={`${base}/`}><img src={`${base}/logo.svg`} alt="" /><span>Reasonix</span></a>
|
||||
<span>© 2026 Reasonix · MIT</span>
|
||||
<a href={repo}>GitHub ↗</a>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
import '../scripts/changelog.js';
|
||||
</script>
|
||||
</Base>
|
||||
@@ -1,71 +0,0 @@
|
||||
---
|
||||
import { QQ_GROUP, DISCORD_URL, DOUYIN } from '../lib/community-links.mjs';
|
||||
|
||||
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
||||
---
|
||||
<section class="join" aria-labelledby="join-title" data-community-join>
|
||||
<div class="join-card">
|
||||
<div class="join-head">
|
||||
<h2 id="join-title"><span class="l-en">Join the community</span><span class="l-zh">加入社区</span></h2>
|
||||
<p><span class="l-en">Get setup help, share workflows, and talk to other Reasonix users.</span><span class="l-zh">安装答疑、分享工作流,和其他 Reasonix 用户交流。</span></p>
|
||||
</div>
|
||||
<div class="join-body">
|
||||
<div class="join-qq">
|
||||
<a class="join-qr" href={QQ_GROUP.joinUrl} target="_blank" rel="noreferrer" data-qq-join>
|
||||
<img src={`${base}${QQ_GROUP.qrPath}`} width="132" height="132" alt="QQ group QR code" loading="lazy" decoding="async" />
|
||||
</a>
|
||||
<div class="join-info">
|
||||
<span class="join-label">QQ</span>
|
||||
<strong class="join-name">{QQ_GROUP.name}</strong>
|
||||
<span class="join-num"><span class="l-en">Group</span><span class="l-zh">群号</span> <code>{QQ_GROUP.number}</code></span>
|
||||
<a class="join-link" href={QQ_GROUP.joinUrl} target="_blank" rel="noreferrer"><span class="l-en">Join the QQ group</span><span class="l-zh">加入 QQ 群</span> ↗</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="join-discord">
|
||||
<span class="join-label">Discord</span>
|
||||
<span class="join-note"><span class="l-en">Bilingual server with help channels and feature ideas.</span><span class="l-zh">双语服务器,有答疑频道和功能讨论。</span></span>
|
||||
<a class="join-link" href={DISCORD_URL} target="_blank" rel="noreferrer" data-discord-join><span class="l-en">Join Discord</span><span class="l-zh">加入 Discord</span> ↗</a>
|
||||
</div>
|
||||
</div>
|
||||
<details class="join-minor" data-douyin>
|
||||
<summary><span class="l-en">Douyin</span><span class="l-zh">抖音</span> · <span class="l-en">ID</span><span class="l-zh">抖音号</span> <code>{DOUYIN.id}</code> <span class="join-minor-name">{DOUYIN.name}</span></summary>
|
||||
<img src={`${base}${DOUYIN.qrPath}`} width="120" height="179" alt="Douyin QR code" loading="lazy" decoding="async" />
|
||||
</details>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.join { max-width: 1180px; margin: 0 auto; padding: 36px 40px 8px; }
|
||||
.join-card {
|
||||
background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
|
||||
padding: 24px 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px 40px; align-items: center;
|
||||
}
|
||||
.join-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 6px; }
|
||||
.join-head p { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); margin: 0; max-width: 34ch; }
|
||||
.join-body { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
|
||||
.join-qq { display: flex; gap: 18px; align-items: center; }
|
||||
.join-qr { display: block; line-height: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; flex: none; }
|
||||
.join-qr img { width: 132px; height: 132px; display: block; }
|
||||
.join-minor { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); }
|
||||
.join-minor summary { cursor: pointer; width: fit-content; }
|
||||
.join-minor code { font-family: var(--font-mono); }
|
||||
.join-minor img { display: block; margin-top: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
|
||||
.join-info, .join-discord { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
|
||||
.join-label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
|
||||
.join-name { font-size: 15px; font-weight: 600; color: var(--ink); }
|
||||
.join-num code { font-family: var(--font-mono); font-size: 14px; color: var(--ink); }
|
||||
.join-note { max-width: 24ch; line-height: 1.5; }
|
||||
.join-link { color: var(--accent-deep); font-weight: 600; text-decoration: none; margin-top: 4px; }
|
||||
.join-link:hover { text-decoration: underline; }
|
||||
@media (max-width: 900px) {
|
||||
.join { padding: 28px 24px 4px; }
|
||||
.join-card { grid-template-columns: 1fr; }
|
||||
.join-head p { max-width: none; }
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.join { padding: 24px 16px 4px; }
|
||||
.join-card { padding: 20px 18px; }
|
||||
.join-qq { flex-direction: column; align-items: flex-start; }
|
||||
.join-body { gap: 22px; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,37 +0,0 @@
|
||||
---
|
||||
interface Props {
|
||||
id: string;
|
||||
name?: string;
|
||||
autocomplete: string;
|
||||
minlength?: number;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
const { id, name, autocomplete, minlength, required = false } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="password-input">
|
||||
<input
|
||||
id={id}
|
||||
name={name}
|
||||
type="password"
|
||||
autocomplete={autocomplete}
|
||||
minlength={minlength}
|
||||
required={required}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="password-toggle"
|
||||
data-password-toggle
|
||||
aria-controls={id}
|
||||
aria-pressed="false"
|
||||
aria-label="Show password / 显示密码">
|
||||
<svg class="password-eye-open" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z" />
|
||||
<circle cx="12" cy="12" r="2.7" />
|
||||
</svg>
|
||||
<svg class="password-eye-closed" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M3 3l18 18M10.6 6.2A10.9 10.9 0 0 1 12 6c6 0 9.5 6 9.5 6a17 17 0 0 1-2.1 2.7M6.2 6.2C3.8 7.8 2.5 12 2.5 12s3.5 6 9.5 6a9.8 9.8 0 0 0 3.2-.5M9.9 9.9a3 3 0 0 0 4.2 4.2" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,129 +0,0 @@
|
||||
---
|
||||
type ActiveItem = 'features' | 'surfaces' | 'studio' | 'skills' | 'community' | 'docs' | 'changelog';
|
||||
|
||||
const {
|
||||
active,
|
||||
scrolled = false,
|
||||
} = Astro.props as {
|
||||
active?: ActiveItem;
|
||||
scrolled?: boolean;
|
||||
};
|
||||
|
||||
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
||||
const repo = 'https://github.com/esengine/DeepSeek-Reasonix';
|
||||
const items: Array<{
|
||||
id: ActiveItem;
|
||||
href: string;
|
||||
en: string;
|
||||
zh: string;
|
||||
secondary?: boolean;
|
||||
}> = [
|
||||
{ id: 'features', href: `${base}/#features`, en: 'Features', zh: '特性' },
|
||||
{ id: 'surfaces', href: `${base}/#surfaces`, en: 'Surfaces', zh: '使用形态', secondary: true },
|
||||
{ id: 'studio', href: `${base}/remote/`, en: 'Web Studio', zh: '网页版 Studio' },
|
||||
{ id: 'skills', href: `${base}/skills/`, en: 'Skills', zh: '技能市场' },
|
||||
{ id: 'community', href: `${base}/#community`, en: 'Community', zh: '社区', secondary: true },
|
||||
{ id: 'docs', href: `${base}/docs/`, en: 'Docs', zh: '文档' },
|
||||
{ id: 'changelog', href: `${base}/changelog/`, en: 'Changelog', zh: '更新日志' },
|
||||
];
|
||||
---
|
||||
|
||||
<header class:list={['nav', { scrolled }]}>
|
||||
<div class="nav-inner">
|
||||
<a class="brand" href={`${base}/`}>
|
||||
<picture class="brand-picture">
|
||||
<source media="(max-width: 400px)" srcset={`${base}/favicon.svg`} />
|
||||
<img src={`${base}/logo.svg`} alt="Reasonix logo" />
|
||||
</picture>
|
||||
</a>
|
||||
<nav class="nav-links" aria-label="Primary navigation">
|
||||
{items.map((item) => (
|
||||
<a
|
||||
class:list={[{ here: active === item.id, 'nav-link--secondary': item.secondary }]}
|
||||
href={item.href}
|
||||
aria-current={active === item.id ? 'page' : undefined}
|
||||
>
|
||||
<span class="l-en">{item.en}</span>
|
||||
<span class="l-zh">{item.zh}</span>
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
<a
|
||||
class="nav-github"
|
||||
href={repo}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
aria-label="Reasonix GitHub repository"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path fill="currentColor" d="M12 .7a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.3c-3.3.7-4-1.4-4-1.4-.5-1.4-1.3-1.8-1.3-1.8-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.6-.3-5.4-1.3-5.4-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.1 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.6.3 2.8.1 3.1.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.4 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .7Z" />
|
||||
</svg>
|
||||
<span class="nav-github-label">GitHub</span>
|
||||
</a>
|
||||
<div class="lang-switch" role="group" aria-label="Language">
|
||||
<button type="button" data-lang="en" class="active">EN</button>
|
||||
<button type="button" data-lang="zh">中文</button>
|
||||
</div>
|
||||
<div class="theme-switch" role="group" aria-label="Theme">
|
||||
<button type="button" data-theme="system" class="active" aria-label="System theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg></button>
|
||||
<button type="button" data-theme="light" aria-label="Light theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><line x1="12" y1="1" x2="12" y2="4"/><line x1="12" y1="20" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="6.3" y2="6.3"/><line x1="17.7" y1="17.7" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="4" y2="12"/><line x1="20" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="6.3" y2="17.7"/><line x1="17.7" y1="6.3" x2="19.8" y2="4.2"/></svg></button>
|
||||
<button type="button" data-theme="dark" aria-label="Dark theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg></button>
|
||||
</div>
|
||||
<span class="nav-acct nav-sign-in" data-account-slot aria-busy="true">
|
||||
<a class="btn btn-ghost" href={`${base}/login/`}>
|
||||
<span class="l-en">Sign in</span>
|
||||
<span class="l-zh">登录</span>
|
||||
</a>
|
||||
</span>
|
||||
<a class="btn btn-dark nav-install" href={`${base}/#start`}>
|
||||
<span class="l-en">Install</span>
|
||||
<span class="l-zh">安装</span>
|
||||
</a>
|
||||
<button
|
||||
class="nav-menu-toggle"
|
||||
type="button"
|
||||
data-mobile-nav-toggle
|
||||
aria-controls="site-mobile-nav"
|
||||
aria-expanded="false"
|
||||
aria-label="Open navigation"
|
||||
title="Open navigation"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M4 6h16M4 12h16M4 18h16" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="mobile-nav" id="site-mobile-nav" data-mobile-nav hidden>
|
||||
<button class="mobile-nav-backdrop" type="button" data-mobile-nav-close aria-label="Close navigation"></button>
|
||||
<aside class="mobile-nav-panel" role="dialog" aria-modal="true" aria-labelledby="site-mobile-nav-title">
|
||||
<div class="mobile-nav-head">
|
||||
<span id="site-mobile-nav-title"><span class="l-en">Navigation</span><span class="l-zh">导航</span></span>
|
||||
<button class="mobile-nav-close" type="button" data-mobile-nav-close aria-label="Close navigation" title="Close navigation">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18" /></svg>
|
||||
</button>
|
||||
</div>
|
||||
<nav class="mobile-nav-links" aria-label="Mobile primary navigation">
|
||||
{items.map((item) => (
|
||||
<a class:list={[{ here: active === item.id }]} href={item.href} aria-current={active === item.id ? 'page' : undefined}>
|
||||
<span class="l-en">{item.en}</span>
|
||||
<span class="l-zh">{item.zh}</span>
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
<div class="mobile-nav-actions">
|
||||
<a class="mobile-nav-github" href={repo} target="_blank" rel="noreferrer">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M12 .7a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.3c-3.3.7-4-1.4-4-1.4-.5-1.4-1.3-1.8-1.3-1.8-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.6-.3-5.4-1.3-5.4-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.1 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.6.3 2.8.1 3.1.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.4 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .7Z" /></svg>
|
||||
GitHub
|
||||
</a>
|
||||
<span class="nav-acct" data-account-slot aria-busy="true">
|
||||
<a class="btn btn-ghost" href={`${base}/login/`}><span class="l-en">Sign in</span><span class="l-zh">登录</span></a>
|
||||
</span>
|
||||
<a class="btn btn-dark" href={`${base}/#start`}><span class="l-en">Install</span><span class="l-zh">安装</span></a>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<script>
|
||||
import '../scripts/account-nav.js';
|
||||
</script>
|
||||
@@ -1,31 +0,0 @@
|
||||
---
|
||||
const href = "https://www.packyapi.ai/register?aff=rIbQ";
|
||||
const rightCodeHref = "https://www.rightapi.ai/register?aff=e083bf73";
|
||||
---
|
||||
<div class="foot-sponsor">
|
||||
<span class="sp-label"><span class="l-en">Sponsor</span><span class="l-zh">赞助商</span></span>
|
||||
<a class="sp-link" href={rightCodeHref} target="_blank" rel="sponsored noopener noreferrer" aria-label="Right Code">
|
||||
<img src="/sponsor/rightcode.png" alt="" width="18" height="18" />
|
||||
<span class="sp-name">Right Code</span>
|
||||
</a>
|
||||
<a class="sp-link" href={href} target="_blank" rel="sponsored noopener noreferrer" aria-label="PackyCode">
|
||||
<svg viewBox="0 0 145.55 113.29" aria-hidden="true" focusable="false">
|
||||
<path d="M144.68,38.49l-.06-.23c-.88-3.28-2.5-5.94-4.58-8.06.14,5.65-2.96,11.02-6.22,16.66l-.39.68c-2.26,3.91-4.66,7.94-6.57,11.1l-.86,1.38c-3.36,5.44-6.27,10.14-12.18,14.18-8.34,5.87-18.2,5.81-26.92,5.76-2.81-.02-5.48-.03-7.95.14l-.35.02c-3.22.06-5.96,1.57-8.17,4.49l-.14.18c-.86,1.06-1.7,2.26-2.58,3.54-3.43,4.92-7.69,11.04-16.17,12.42-4.37.86-9.98.84-14.94.83h-1.95c-.52,0-1.06,0-1.61,0-6.95,0-16.08-.89-21.94-6.55-.15-.15-.3-.3-.44-.45.5,4.73,2.33,8.64,5.44,11.65,5.86,5.66,14.98,6.55,21.94,6.55.55,0,1.09,0,1.61-.01h1.93c4.96.02,10.58.04,14.96-.83,8.48-1.37,12.74-7.5,16.17-12.42.88-1.27,1.72-2.48,2.58-3.54l.14-.18c2.21-2.92,4.95-4.43,8.17-4.49l.35-.02c2.47-.17,5.13-.16,7.95-.14,8.72.05,18.58.11,26.91-5.76,5.92-4.03,8.82-8.73,12.19-14.17l.86-1.39c1.91-3.15,4.3-7.18,6.57-11.09l.39-.69c3.81-6.6,7.41-12.84,5.86-19.57ZM120.9,23.02c-.28,0-.56,0-.83,0-9.68-.19-24.03-.09-35.57-.01l-2.04.02c-.93.01-1.82.02-2.67.03-8.36.08-14.4.13-23.33,3.82l-.27.12c-10.76,4.68-16.91,12.16-22.83,21.95-5.53,8.76-12.62,20.57-16.32,26.79-.41.69-.77,1.3-1.09,1.84l-.49.84c-1.49,2.53-3.23,5.49-4.21,8.95,3.98,1.9,8.52,2.65,12.71,2.91.27-.77.64-1.56,1.07-2.38.48-.94,1.05-1.9,1.63-2.89l.49-.84c.96-1.62,2.38-3.99,4.05-6.78,3.82-6.36,8.98-14.88,13.19-21.55l.07-.11c5.02-8.31,9.2-13.45,16.91-16.81l.11-.05c6.57-2.7,10.54-2.74,18.43-2.81.87-.01,1.78-.02,2.69-.03l1.99-.02c9.17-.06,20.13-.14,29.01-.07,2.26.01,4.39.04,6.32.08h.12s.11,0,.11,0c1.25-.01,2.91.11,4.61.46,1.03.22,2.08.52,3.05.93.21-.35.41-.71.62-1.06l.39-.68c1.92-3.33,3.79-6.57,4.97-9.82-4.08-1.92-8.7-2.76-12.89-2.82Z"/>
|
||||
<path d="M115.07,11.81c-9.7-.19-24.07-.09-35.62-.01h-1.99c-.93.03-1.82.04-2.67.04-8.36.08-14.4.14-23.33,3.83l-.27.12c-10.76,4.67-16.91,12.16-22.83,21.95-6.13,9.71-14.19,23.21-17.41,28.63l-.5.84c-2.08,3.55-4.68,7.97-4.94,13.39v.2s0,.21,0,.21c.01.81.06,1.61.15,2.38.14.15.29.3.44.45,1.53,1.47,3.28,2.63,5.15,3.52,3.98,1.9,8.52,2.65,12.71,2.91,1.41.09,2.78.12,4.08.12.55,0,1.09-.01,1.61-.01h1.95c4.95.01,10.57.03,14.94-.83,8.48-1.38,12.74-7.5,16.17-12.42.88-1.28,1.72-2.48,2.58-3.54l.14-.18c2.21-2.92,4.95-4.44,8.17-4.49l.35-.02c2.47-.17,5.14-.16,7.95-.14,8.71.05,18.58.1,26.92-5.76,5.91-4.04,8.82-8.74,12.18-14.18l.86-1.39c1.74-2.86,3.87-6.45,5.95-10.03.21-.35.41-.71.62-1.06l.39-.68c1.92-3.33,3.79-6.57,4.97-9.82.82-2.26,1.31-4.53,1.25-6.84-5.18-5.29-13.22-7.25-19.97-7.19ZM122.56,40.37l-.39.67c-2.21,3.81-4.55,7.77-6.39,10.79l-.84,1.36c-3.01,4.87-4.83,7.81-8.48,10.29l-.1.07c-4.94,3.49-11.95,3.45-19.38,3.41-2.88-.02-5.87-.04-8.79.16-7.1.19-13.51,3.58-18.07,9.57-1.13,1.4-2.12,2.83-3.08,4.21-2.92,4.18-4.71,6.57-7.64,7.02l-.31.06c-3.09.63-8.28.61-12.45.6h-2.16c-3.85.07-7.01-.16-9.45-.69-2.24-.48-3.87-1.22-4.89-2.2-.66-.64-1.54-1.81-1.63-4.65.11-1.35.71-2.82,1.52-4.35.48-.94,1.05-1.9,1.63-2.89l.49-.84c3.17-5.33,11.19-18.75,17.24-28.33l.07-.11c5.02-8.32,9.2-13.45,16.92-16.81l.1-.05c6.57-2.7,10.54-2.74,18.43-2.82.87,0,1.78,0,2.69-.03h1.94c11.52-.09,25.86-.19,35.38,0h.23c1.25-.01,2.92.11,4.61.46,3.15.66,6.4,2.12,7.27,5.02.2,1.2-.89,3.62-2.27,6.18-.7,1.31-1.48,2.65-2.2,3.9ZM120.07,23.01c-9.68-.19-24.03-.09-35.57-.01l-2.04.02c-.93.01-1.82.02-2.67.03-8.36.08-14.4.13-23.33,3.82l-.27.12c-10.76,4.68-16.91,12.16-22.83,21.95-5.53,8.76-12.62,20.57-16.32,26.79-.78-.35-1.41-.77-1.9-1.24-.66-.64-1.54-1.81-1.63-4.65.18-2.18,1.62-4.64,3.15-7.25l.49-.83c3.17-5.32,11.18-18.73,17.24-28.33l.07-.12c5.02-8.31,9.2-13.45,16.92-16.81l.1-.04c6.57-2.7,10.54-2.74,18.43-2.82.87-.01,1.78-.01,2.69-.03h1.99c11.5-.09,25.82-.19,35.33,0h.23c3.57-.04,10.55,1.02,11.88,5.48.14.84-.35,2.27-1.13,3.93-.28,0-.56,0-.83,0Z"/>
|
||||
<path d="M134.68,16.09l-.06-.23c-3.07-11.45-15.08-15.33-24.55-15.25-9.68-.19-24.03-.09-35.57-.01h-2.04c-.93.03-1.82.04-2.67.04-8.36.08-14.4.14-23.33,3.83l-.27.12c-10.76,4.67-16.91,12.16-22.83,21.95-6.14,9.73-14.2,23.22-17.41,28.62l-.49.85c-2.09,3.55-4.69,7.96-4.95,13.39v.2s0,.21,0,.21c.09,5.57,1.82,10.13,5.15,13.58.14.15.29.3.44.45,1.53,1.47,3.28,2.63,5.15,3.52,3.98,1.9,8.52,2.65,12.71,2.91,1.41.09,2.78.12,4.08.12.55,0,1.09-.01,1.61-.01h1.95c4.95.01,10.57.03,14.94-.83,8.48-1.38,12.74-7.5,16.17-12.42.88-1.28,1.72-2.48,2.58-3.54l.14-.18c2.21-2.92,4.95-4.44,8.17-4.49l.35-.02c2.47-.17,5.14-.16,7.95-.14,8.71.05,18.58.1,26.92-5.76,5.91-4.04,8.82-8.74,12.18-14.18l.86-1.39c1.74-2.86,3.87-6.45,5.95-10.03.21-.35.41-.71.62-1.06l.39-.68c1.92-3.33,3.79-6.57,4.97-9.82.82-2.26,1.31-4.53,1.25-6.84-.02-.96-.14-1.93-.36-2.91ZM119.76,25.27c-.7,1.31-1.48,2.65-2.2,3.9l-.39.67c-1.19,2.04-2.41,4.13-3.57,6.09-1.01,1.7-1.97,3.31-2.82,4.7l-.84,1.36c-3.01,4.87-4.83,7.81-8.48,10.29l-.1.07c-4.94,3.49-11.96,3.45-19.38,3.41-2.89-.02-5.87-.04-8.79.16-7.1.18-13.51,3.58-18.07,9.57-1.13,1.4-2.12,2.83-3.08,4.21-2.92,4.18-4.71,6.57-7.64,7.02l-.31.06c-3.09.63-8.27.61-12.45.6h-2.16c-3.85.07-7.01-.16-9.45-.69-1.16-.25-2.16-.57-2.99-.96-.78-.35-1.41-.77-1.9-1.24-.66-.64-1.54-1.81-1.63-4.65.18-2.18,1.62-4.64,3.15-7.25l.49-.83c3.17-5.32,11.18-18.73,17.24-28.33l.07-.12c5.02-8.31,9.2-13.45,16.92-16.81l.1-.04c6.57-2.7,10.54-2.74,18.43-2.82.87-.01,1.78-.01,2.69-.03h1.99c11.5-.09,25.82-.19,35.33,0h.23c3.57-.04,10.55,1.02,11.88,5.48.14.84-.35,2.27-1.13,3.93-.34.72-.73,1.48-1.14,2.25Z"/>
|
||||
</svg>
|
||||
<span class="sp-name">PackyCode</span>
|
||||
</a>
|
||||
</div>
|
||||
<style>
|
||||
.foot-sponsor {
|
||||
max-width: 1180px; margin: 0 auto; padding: 14px 40px 22px;
|
||||
display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
|
||||
border-top: 1px solid var(--line);
|
||||
font-size: 13px; color: var(--ink-3);
|
||||
}
|
||||
.sp-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; transition: color 0.2s; }
|
||||
.sp-link:hover { color: var(--ink); }
|
||||
.sp-link img { height: 18px; width: 18px; display: block; }
|
||||
.sp-link svg { height: 18px; width: auto; fill: currentColor; stroke: currentColor; stroke-miterlimit: 10; }
|
||||
</style>
|
||||
@@ -1,25 +0,0 @@
|
||||
---
|
||||
import ChangelogPage from './ChangelogPage.astro';
|
||||
import Base from '../layouts/Base.astro';
|
||||
import SiteHeader from './SiteHeader.astro';
|
||||
import { releasePath, studioReleases } from '../data/releases';
|
||||
import '../styles/changelog.css';
|
||||
const latest = studioReleases[0];
|
||||
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
||||
---
|
||||
{latest ? <ChangelogPage release={latest} releases={studioReleases} canonical={new URL(`${base}${releasePath(latest.version)}`, Astro.site).href} /> : (
|
||||
<Base title="Reasonix Studio release notes" titleEn="Reasonix Studio release notes" titleZh="Reasonix Studio 更新日志" description="Reasonix Studio release notes">
|
||||
<SiteHeader active="changelog" scrolled />
|
||||
<main class="release-stage">
|
||||
<nav class="release-product-tabs" aria-label="Products">
|
||||
<a href={`${base}/changelog/cli/`}><span class="l-en">CLI · 1.x (previous)</span><span class="l-zh">CLI · 1.x(上一代)</span></a>
|
||||
<a href={`${base}/changelog/`} aria-current="page">Studio · 2.x</a>
|
||||
</nav>
|
||||
<article class="release-paper release-studio-empty">
|
||||
<h1>Reasonix Studio</h1>
|
||||
<p><span class="l-en">Website notes are awaiting review. Published releases remain available on GitHub.</span><span class="l-zh">网站发布说明正在等待审核。已发布版本可在 GitHub 查看。</span></p>
|
||||
<a href="https://github.com/esengine/DeepSeek-Reasonix/releases">GitHub ↗</a>
|
||||
</article>
|
||||
</main>
|
||||
</Base>
|
||||
)}
|
||||
@@ -1,595 +0,0 @@
|
||||
{
|
||||
"stars": 29222,
|
||||
"mergedPrs": 2816,
|
||||
"contributors": 98,
|
||||
"list": [
|
||||
{
|
||||
"login": "SivanCola",
|
||||
"avatar": "/av/SivanCola.webp",
|
||||
"url": "https://github.com/SivanCola",
|
||||
"c": 2311
|
||||
},
|
||||
{
|
||||
"login": "esengine",
|
||||
"avatar": "/av/esengine.webp",
|
||||
"url": "https://github.com/esengine",
|
||||
"c": 518
|
||||
},
|
||||
{
|
||||
"login": "ttmouse",
|
||||
"avatar": "/av/ttmouse.webp",
|
||||
"url": "https://github.com/ttmouse",
|
||||
"c": 121
|
||||
},
|
||||
{
|
||||
"login": "lifu963",
|
||||
"avatar": "/av/lifu963.webp",
|
||||
"url": "https://github.com/lifu963",
|
||||
"c": 105
|
||||
},
|
||||
{
|
||||
"login": "HUQIANTAO",
|
||||
"avatar": "/av/HUQIANTAO.webp",
|
||||
"url": "https://github.com/HUQIANTAO",
|
||||
"c": 74
|
||||
},
|
||||
{
|
||||
"login": "GTC2080",
|
||||
"avatar": "/av/GTC2080.webp",
|
||||
"url": "https://github.com/GTC2080",
|
||||
"c": 61
|
||||
},
|
||||
{
|
||||
"login": "light-front-theory",
|
||||
"avatar": "/av/light-front-theory.webp",
|
||||
"url": "https://github.com/light-front-theory",
|
||||
"c": 56
|
||||
},
|
||||
{
|
||||
"login": "Li-Charles-One",
|
||||
"avatar": "/av/Li-Charles-One.webp",
|
||||
"url": "https://github.com/Li-Charles-One",
|
||||
"c": 49
|
||||
},
|
||||
{
|
||||
"login": "eghrhegpe",
|
||||
"avatar": "/av/eghrhegpe.webp",
|
||||
"url": "https://github.com/eghrhegpe",
|
||||
"c": 28
|
||||
},
|
||||
{
|
||||
"login": "CVEngineer66",
|
||||
"avatar": "/av/CVEngineer66.webp",
|
||||
"url": "https://github.com/CVEngineer66",
|
||||
"c": 16
|
||||
},
|
||||
{
|
||||
"login": "JesonChou",
|
||||
"avatar": "/av/JesonChou.webp",
|
||||
"url": "https://github.com/JesonChou",
|
||||
"c": 15
|
||||
},
|
||||
{
|
||||
"login": "HaoyueQin",
|
||||
"avatar": "/av/HaoyueQin.webp",
|
||||
"url": "https://github.com/HaoyueQin",
|
||||
"c": 14
|
||||
},
|
||||
{
|
||||
"login": "SuMuxi66",
|
||||
"avatar": "/av/SuMuxi66.webp",
|
||||
"url": "https://github.com/SuMuxi66",
|
||||
"c": 11
|
||||
},
|
||||
{
|
||||
"login": "lanshi17",
|
||||
"avatar": "/av/lanshi17.webp",
|
||||
"url": "https://github.com/lanshi17",
|
||||
"c": 11
|
||||
},
|
||||
{
|
||||
"login": "CnsMaple",
|
||||
"avatar": "/av/CnsMaple.webp",
|
||||
"url": "https://github.com/CnsMaple",
|
||||
"c": 9
|
||||
},
|
||||
{
|
||||
"login": "cyq1017",
|
||||
"avatar": "/av/cyq1017.webp",
|
||||
"url": "https://github.com/cyq1017",
|
||||
"c": 9
|
||||
},
|
||||
{
|
||||
"login": "ipanta",
|
||||
"avatar": "/av/ipanta.webp",
|
||||
"url": "https://github.com/ipanta",
|
||||
"c": 8
|
||||
},
|
||||
{
|
||||
"login": "XTLine",
|
||||
"avatar": "/av/XTLine.webp",
|
||||
"url": "https://github.com/XTLine",
|
||||
"c": 8
|
||||
},
|
||||
{
|
||||
"login": "YoungDan-hero",
|
||||
"avatar": "/av/YoungDan-hero.webp",
|
||||
"url": "https://github.com/YoungDan-hero",
|
||||
"c": 8
|
||||
},
|
||||
{
|
||||
"login": "paradoxSCH",
|
||||
"avatar": "/av/paradoxSCH.webp",
|
||||
"url": "https://github.com/paradoxSCH",
|
||||
"c": 8
|
||||
},
|
||||
{
|
||||
"login": "wade19990814-hue",
|
||||
"avatar": "/av/wade19990814-hue.webp",
|
||||
"url": "https://github.com/wade19990814-hue",
|
||||
"c": 7
|
||||
},
|
||||
{
|
||||
"login": "SauronSkywalker",
|
||||
"avatar": "/av/SauronSkywalker.webp",
|
||||
"url": "https://github.com/SauronSkywalker",
|
||||
"c": 7
|
||||
},
|
||||
{
|
||||
"login": "yizeyi18",
|
||||
"avatar": "/av/yizeyi18.webp",
|
||||
"url": "https://github.com/yizeyi18",
|
||||
"c": 6
|
||||
},
|
||||
{
|
||||
"login": "ashishexee",
|
||||
"avatar": "/av/ashishexee.webp",
|
||||
"url": "https://github.com/ashishexee",
|
||||
"c": 6
|
||||
},
|
||||
{
|
||||
"login": "erphenheimer",
|
||||
"avatar": "/av/erphenheimer.webp",
|
||||
"url": "https://github.com/erphenheimer",
|
||||
"c": 6
|
||||
},
|
||||
{
|
||||
"login": "Bernardxu123",
|
||||
"avatar": "/av/Bernardxu123.webp",
|
||||
"url": "https://github.com/Bernardxu123",
|
||||
"c": 6
|
||||
},
|
||||
{
|
||||
"login": "lizhengwu",
|
||||
"avatar": "/av/lizhengwu.webp",
|
||||
"url": "https://github.com/lizhengwu",
|
||||
"c": 6
|
||||
},
|
||||
{
|
||||
"login": "qiaone",
|
||||
"avatar": "/av/qiaone.webp",
|
||||
"url": "https://github.com/qiaone",
|
||||
"c": 5
|
||||
},
|
||||
{
|
||||
"login": "mchenziyi",
|
||||
"avatar": "/av/mchenziyi.webp",
|
||||
"url": "https://github.com/mchenziyi",
|
||||
"c": 4
|
||||
},
|
||||
{
|
||||
"login": "ferstar",
|
||||
"avatar": "/av/ferstar.webp",
|
||||
"url": "https://github.com/ferstar",
|
||||
"c": 4
|
||||
},
|
||||
{
|
||||
"login": "zhangsanouo",
|
||||
"avatar": "/av/zhangsanouo.webp",
|
||||
"url": "https://github.com/zhangsanouo",
|
||||
"c": 4
|
||||
},
|
||||
{
|
||||
"login": "par73e",
|
||||
"avatar": "/av/par73e.webp",
|
||||
"url": "https://github.com/par73e",
|
||||
"c": 4
|
||||
},
|
||||
{
|
||||
"login": "liaoyl830",
|
||||
"avatar": "/av/liaoyl830.webp",
|
||||
"url": "https://github.com/liaoyl830",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "jiaxindeyang-a11y",
|
||||
"avatar": "/av/jiaxindeyang-a11y.webp",
|
||||
"url": "https://github.com/jiaxindeyang-a11y",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "nostalgia296",
|
||||
"avatar": "/av/nostalgia296.webp",
|
||||
"url": "https://github.com/nostalgia296",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "Diarica",
|
||||
"avatar": "/av/Diarica.webp",
|
||||
"url": "https://github.com/Diarica",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "yekern",
|
||||
"avatar": "/av/yekern.webp",
|
||||
"url": "https://github.com/yekern",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "maoxin1234",
|
||||
"avatar": "/av/maoxin1234.webp",
|
||||
"url": "https://github.com/maoxin1234",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "lightfront",
|
||||
"avatar": "/av/lightfront.webp",
|
||||
"url": "https://github.com/lightfront",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "ikelvingo",
|
||||
"avatar": "/av/ikelvingo.webp",
|
||||
"url": "https://github.com/ikelvingo",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "ffff2004",
|
||||
"avatar": "/av/ffff2004.webp",
|
||||
"url": "https://github.com/ffff2004",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "kekexunxun",
|
||||
"avatar": "/av/kekexunxun.webp",
|
||||
"url": "https://github.com/kekexunxun",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "Tatlatat",
|
||||
"avatar": "/av/Tatlatat.webp",
|
||||
"url": "https://github.com/Tatlatat",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "PaulDing98",
|
||||
"avatar": "/av/PaulDing98.webp",
|
||||
"url": "https://github.com/PaulDing98",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "AtmoOmen",
|
||||
"avatar": "/av/AtmoOmen.webp",
|
||||
"url": "https://github.com/AtmoOmen",
|
||||
"c": 3
|
||||
},
|
||||
{
|
||||
"login": "billycat",
|
||||
"avatar": "/av/billycat.webp",
|
||||
"url": "https://github.com/billycat",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "xianyu-sheng",
|
||||
"avatar": "/av/xianyu-sheng.webp",
|
||||
"url": "https://github.com/xianyu-sheng",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "heshuimu",
|
||||
"avatar": "/av/heshuimu.webp",
|
||||
"url": "https://github.com/heshuimu",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "drafish",
|
||||
"avatar": "/av/drafish.webp",
|
||||
"url": "https://github.com/drafish",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "yhemeo613",
|
||||
"avatar": "/av/yhemeo613.webp",
|
||||
"url": "https://github.com/yhemeo613",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "wqshan-cn",
|
||||
"avatar": "/av/wqshan-cn.webp",
|
||||
"url": "https://github.com/wqshan-cn",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "warvyvr",
|
||||
"avatar": "/av/warvyvr.webp",
|
||||
"url": "https://github.com/warvyvr",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "Xio-Shark",
|
||||
"avatar": "/av/Xio-Shark.webp",
|
||||
"url": "https://github.com/Xio-Shark",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "LVGG",
|
||||
"avatar": "/av/LVGG.webp",
|
||||
"url": "https://github.com/LVGG",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "assoyuan",
|
||||
"avatar": "/av/assoyuan.webp",
|
||||
"url": "https://github.com/assoyuan",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "closss",
|
||||
"avatar": "/av/closss.webp",
|
||||
"url": "https://github.com/closss",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "iysun",
|
||||
"avatar": "/av/iysun.webp",
|
||||
"url": "https://github.com/iysun",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "whale-fall-ouo",
|
||||
"avatar": "/av/whale-fall-ouo.webp",
|
||||
"url": "https://github.com/whale-fall-ouo",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "sudoviber",
|
||||
"avatar": "/av/sudoviber.webp",
|
||||
"url": "https://github.com/sudoviber",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "qiukeren",
|
||||
"avatar": "/av/qiukeren.webp",
|
||||
"url": "https://github.com/qiukeren",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "nanami7777777",
|
||||
"avatar": "/av/nanami7777777.webp",
|
||||
"url": "https://github.com/nanami7777777",
|
||||
"c": 2
|
||||
},
|
||||
{
|
||||
"login": "alxbnct",
|
||||
"avatar": "/av/alxbnct.webp",
|
||||
"url": "https://github.com/alxbnct",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "Zhuocheng-Lang",
|
||||
"avatar": "/av/Zhuocheng-Lang.webp",
|
||||
"url": "https://github.com/Zhuocheng-Lang",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "dcs02280653-collab",
|
||||
"avatar": "/av/dcs02280653-collab.webp",
|
||||
"url": "https://github.com/dcs02280653-collab",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "dengbushi",
|
||||
"avatar": "/av/dengbushi.webp",
|
||||
"url": "https://github.com/dengbushi",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "h4rk8s",
|
||||
"avatar": "/av/h4rk8s.webp",
|
||||
"url": "https://github.com/h4rk8s",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "myipanta",
|
||||
"avatar": "/av/myipanta.webp",
|
||||
"url": "https://github.com/myipanta",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "jackijianxa",
|
||||
"avatar": "/av/jackijianxa.webp",
|
||||
"url": "https://github.com/jackijianxa",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "jbts6",
|
||||
"avatar": "/av/jbts6.webp",
|
||||
"url": "https://github.com/jbts6",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "ji-tz",
|
||||
"avatar": "/av/ji-tz.webp",
|
||||
"url": "https://github.com/ji-tz",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "kabaka9527",
|
||||
"avatar": "/av/kabaka9527.webp",
|
||||
"url": "https://github.com/kabaka9527",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "9710willy",
|
||||
"avatar": "/av/9710willy.webp",
|
||||
"url": "https://github.com/9710willy",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "onenewcode",
|
||||
"avatar": "/av/onenewcode.webp",
|
||||
"url": "https://github.com/onenewcode",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "Ninot1Quyi",
|
||||
"avatar": "/av/Ninot1Quyi.webp",
|
||||
"url": "https://github.com/Ninot1Quyi",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "xiaoshuai1024",
|
||||
"avatar": "/av/xiaoshuai1024.webp",
|
||||
"url": "https://github.com/xiaoshuai1024",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "rixzkiye",
|
||||
"avatar": "/av/rixzkiye.webp",
|
||||
"url": "https://github.com/rixzkiye",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "taibai233",
|
||||
"avatar": "/av/taibai233.webp",
|
||||
"url": "https://github.com/taibai233",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "ying-hua",
|
||||
"avatar": "/av/ying-hua.webp",
|
||||
"url": "https://github.com/ying-hua",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "yuanchenglu",
|
||||
"avatar": "/av/yuanchenglu.webp",
|
||||
"url": "https://github.com/yuanchenglu",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "zhuguang-ZFG",
|
||||
"avatar": "/av/zhuguang-ZFG.webp",
|
||||
"url": "https://github.com/zhuguang-ZFG",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "zlwu",
|
||||
"avatar": "/av/zlwu.webp",
|
||||
"url": "https://github.com/zlwu",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "xinrenH",
|
||||
"avatar": "/av/xinrenH.webp",
|
||||
"url": "https://github.com/xinrenH",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "zdjmrq",
|
||||
"avatar": "/av/zdjmrq.webp",
|
||||
"url": "https://github.com/zdjmrq",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "i1j",
|
||||
"avatar": "/av/i1j.webp",
|
||||
"url": "https://github.com/i1j",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "Abysstsuki",
|
||||
"avatar": "/av/Abysstsuki.webp",
|
||||
"url": "https://github.com/Abysstsuki",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "themarchrain",
|
||||
"avatar": "/av/themarchrain.webp",
|
||||
"url": "https://github.com/themarchrain",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "wudiandy",
|
||||
"avatar": "/av/wudiandy.webp",
|
||||
"url": "https://github.com/wudiandy",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "EMEEEEMMMM",
|
||||
"avatar": "/av/EMEEEEMMMM.webp",
|
||||
"url": "https://github.com/EMEEEEMMMM",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "HBLADEH",
|
||||
"avatar": "/av/HBLADEH.webp",
|
||||
"url": "https://github.com/HBLADEH",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "HHHEEEWWW",
|
||||
"avatar": "/av/HHHEEEWWW.webp",
|
||||
"url": "https://github.com/HHHEEEWWW",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "HorusJiang",
|
||||
"avatar": "/av/HorusJiang.webp",
|
||||
"url": "https://github.com/HorusJiang",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "J3y0r",
|
||||
"avatar": "/av/J3y0r.webp",
|
||||
"url": "https://github.com/J3y0r",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "JimmyDaddy",
|
||||
"avatar": "/av/JimmyDaddy.webp",
|
||||
"url": "https://github.com/JimmyDaddy",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "LegGasai",
|
||||
"avatar": "/av/LegGasai.webp",
|
||||
"url": "https://github.com/LegGasai",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "gcoder1991",
|
||||
"avatar": "/av/gcoder1991.webp",
|
||||
"url": "https://github.com/gcoder1991",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "LouF666",
|
||||
"avatar": "/av/LouF666.webp",
|
||||
"url": "https://github.com/LouF666",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "MaitreyeeDeshmukh",
|
||||
"avatar": "/av/MaitreyeeDeshmukh.webp",
|
||||
"url": "https://github.com/MaitreyeeDeshmukh",
|
||||
"c": 1
|
||||
},
|
||||
{
|
||||
"login": "ERroooooR",
|
||||
"avatar": "/av/ERroooooR.webp",
|
||||
"url": "https://github.com/ERroooooR",
|
||||
"c": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
{
|
||||
"stars": 20843,
|
||||
"mergedPrs": 1779,
|
||||
"contributors": 41,
|
||||
"list": [
|
||||
{ "login": "esengine", "avatar": "https://avatars.githubusercontent.com/u/18465053", "url": "https://github.com/esengine", "c": 310 },
|
||||
{ "login": "SivanCola", "avatar": "https://avatars.githubusercontent.com/u/32437197", "url": "https://github.com/SivanCola", "c": 158 },
|
||||
{ "login": "HUQIANTAO", "avatar": "https://avatars.githubusercontent.com/u/58421104", "url": "https://github.com/HUQIANTAO", "c": 73 },
|
||||
{ "login": "GTC2080", "avatar": "https://avatars.githubusercontent.com/u/140309575", "url": "https://github.com/GTC2080", "c": 16 },
|
||||
{ "login": "CVEngineer66", "avatar": "https://avatars.githubusercontent.com/u/129239603", "url": "https://github.com/CVEngineer66", "c": 10 },
|
||||
{ "login": "Li-Charles-One", "avatar": "https://avatars.githubusercontent.com/u/258708209", "url": "https://github.com/Li-Charles-One", "c": 10 },
|
||||
{ "login": "SuMuxi66", "avatar": "https://avatars.githubusercontent.com/u/96619914", "url": "https://github.com/SuMuxi66", "c": 9 },
|
||||
{ "login": "lanshi17", "avatar": "https://avatars.githubusercontent.com/u/94416777", "url": "https://github.com/lanshi17", "c": 9 },
|
||||
{ "login": "paradoxSCH", "avatar": "https://avatars.githubusercontent.com/u/64133628", "url": "https://github.com/paradoxSCH", "c": 7 },
|
||||
{ "login": "wade19990814-hue", "avatar": "https://avatars.githubusercontent.com/u/280641290", "url": "https://github.com/wade19990814-hue", "c": 7 },
|
||||
{ "login": "YoungDan-hero", "avatar": "https://avatars.githubusercontent.com/u/66891653", "url": "https://github.com/YoungDan-hero", "c": 6 },
|
||||
{ "login": "lizhengwu", "avatar": "https://avatars.githubusercontent.com/u/38285521", "url": "https://github.com/lizhengwu", "c": 5 },
|
||||
{ "login": "Bernardxu123", "avatar": "https://avatars.githubusercontent.com/u/85089406", "url": "https://github.com/Bernardxu123", "c": 5 },
|
||||
{ "login": "CnsMaple", "avatar": "https://avatars.githubusercontent.com/u/92523839", "url": "https://github.com/CnsMaple", "c": 5 },
|
||||
{ "login": "AtmoOmen", "avatar": "https://avatars.githubusercontent.com/u/110901588", "url": "https://github.com/AtmoOmen", "c": 3 },
|
||||
{ "login": "Tatlatat", "avatar": "https://avatars.githubusercontent.com/u/269959336", "url": "https://github.com/Tatlatat", "c": 3 },
|
||||
{ "login": "kekexunxun", "avatar": "https://avatars.githubusercontent.com/u/44473551", "url": "https://github.com/kekexunxun", "c": 3 },
|
||||
{ "login": "jiaxindeyang-a11y", "avatar": "https://avatars.githubusercontent.com/u/278341870", "url": "https://github.com/jiaxindeyang-a11y", "c": 3 },
|
||||
{ "login": "nostalgia296", "avatar": "https://avatars.githubusercontent.com/u/207565364", "url": "https://github.com/nostalgia296", "c": 2 },
|
||||
{ "login": "yhemeo613", "avatar": "https://avatars.githubusercontent.com/u/138780695", "url": "https://github.com/yhemeo613", "c": 2 },
|
||||
{ "login": "ttmouse", "avatar": "https://avatars.githubusercontent.com/u/8982044", "url": "https://github.com/ttmouse", "c": 2 },
|
||||
{ "login": "iysun", "avatar": "https://avatars.githubusercontent.com/u/102790274", "url": "https://github.com/iysun", "c": 2 },
|
||||
{ "login": "closss", "avatar": "https://avatars.githubusercontent.com/u/106432698", "url": "https://github.com/closss", "c": 2 },
|
||||
{ "login": "XTLine", "avatar": "https://avatars.githubusercontent.com/u/140948646", "url": "https://github.com/XTLine", "c": 2 },
|
||||
{ "login": "LVGG", "avatar": "https://avatars.githubusercontent.com/u/20256205", "url": "https://github.com/LVGG", "c": 2 },
|
||||
{ "login": "xinrenH", "avatar": "https://avatars.githubusercontent.com/u/121069519", "url": "https://github.com/xinrenH", "c": 1 },
|
||||
{ "login": "lightfront", "avatar": "https://avatars.githubusercontent.com/u/13162893", "url": "https://github.com/lightfront", "c": 1 },
|
||||
{ "login": "lifu963", "avatar": "https://avatars.githubusercontent.com/u/56394323", "url": "https://github.com/lifu963", "c": 1 },
|
||||
{ "login": "kabaka9527", "avatar": "https://avatars.githubusercontent.com/u/142149737", "url": "https://github.com/kabaka9527", "c": 1 },
|
||||
{ "login": "dcs02280653-collab", "avatar": "https://avatars.githubusercontent.com/u/272150807", "url": "https://github.com/dcs02280653-collab", "c": 1 },
|
||||
{ "login": "ashishexee", "avatar": "https://avatars.githubusercontent.com/u/144021866", "url": "https://github.com/ashishexee", "c": 1 },
|
||||
{ "login": "alxbnct", "avatar": "https://avatars.githubusercontent.com/u/52067352", "url": "https://github.com/alxbnct", "c": 1 },
|
||||
{ "login": "PorunC", "avatar": "https://avatars.githubusercontent.com/u/63705582", "url": "https://github.com/PorunC", "c": 1 },
|
||||
{ "login": "ERroooooR", "avatar": "https://avatars.githubusercontent.com/u/121479279", "url": "https://github.com/ERroooooR", "c": 1 },
|
||||
{ "login": "LegGasai", "avatar": "https://avatars.githubusercontent.com/u/75920107", "url": "https://github.com/LegGasai", "c": 1 },
|
||||
{ "login": "JimmyDaddy", "avatar": "https://avatars.githubusercontent.com/u/16460813", "url": "https://github.com/JimmyDaddy", "c": 1 },
|
||||
{ "login": "drafish", "avatar": "https://avatars.githubusercontent.com/u/18543527", "url": "https://github.com/drafish", "c": 1 },
|
||||
{ "login": "HorusJiang", "avatar": "https://avatars.githubusercontent.com/u/29286555", "url": "https://github.com/HorusJiang", "c": 1 },
|
||||
{ "login": "HBLADEH", "avatar": "https://avatars.githubusercontent.com/u/27012363", "url": "https://github.com/HBLADEH", "c": 1 },
|
||||
{ "login": "Nahiyi", "avatar": "https://avatars.githubusercontent.com/u/163129774", "url": "https://github.com/Nahiyi", "c": 1 },
|
||||
{ "login": "i1j", "avatar": "https://avatars.githubusercontent.com/u/35729767", "url": "https://github.com/i1j", "c": 1 }
|
||||
]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
// Set this temporarily to an exact vX.Y.Z only during a documented download
|
||||
// incident. The production default follows the current Stable manifest.
|
||||
export const desktopDownloadVersion = "";
|
||||
@@ -1,91 +0,0 @@
|
||||
import source from './releases.json';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
export type LocalizedText = { en: string; zh: string };
|
||||
export type ReleaseTarget = 'desktop' | 'cli' | 'site' | 'service';
|
||||
|
||||
export type ReleaseItem = {
|
||||
title: LocalizedText;
|
||||
body: LocalizedText;
|
||||
refs?: number[];
|
||||
targets?: ReleaseTarget[];
|
||||
};
|
||||
|
||||
export type ReleaseHighlight = ReleaseItem & {
|
||||
kind: 'new' | 'improved' | 'fixed' | 'security';
|
||||
};
|
||||
|
||||
export type ReleaseGuide = ReleaseItem & { href: string };
|
||||
export type ReleaseUpgrade = ReleaseItem & { level: 'info' | 'warning' };
|
||||
|
||||
export type ReleaseRecord = {
|
||||
version: string;
|
||||
product?: 'cli' | 'studio';
|
||||
sourceNotes?: { language: 'zh'; markdown: string; sha: string; path: string };
|
||||
targetingVersion?: 1;
|
||||
releaseId?: string;
|
||||
baseVersion?: string;
|
||||
date: string;
|
||||
channel: 'stable' | 'prerelease';
|
||||
status?: 'reviewed' | 'published';
|
||||
candidateSha?: string;
|
||||
previousRelease?: string;
|
||||
builds?: { cli: string; desktop: string; npm: string };
|
||||
title: LocalizedText;
|
||||
summary: LocalizedText;
|
||||
surfaces: string[];
|
||||
guides: ReleaseGuide[];
|
||||
highlights: ReleaseHighlight[];
|
||||
changes: { new: ReleaseItem[]; improved: ReleaseItem[]; fixed: ReleaseItem[] };
|
||||
upgrade: ReleaseUpgrade[];
|
||||
risks: ReleaseItem[];
|
||||
contributors: string[];
|
||||
links: { github: string; compare: string; download: string };
|
||||
};
|
||||
|
||||
export const releaseCatalog = source as { schemaVersion: number; releases: ReleaseRecord[] };
|
||||
export const allReleases = releaseCatalog.releases;
|
||||
|
||||
let publishedIds = new Set<string>();
|
||||
try {
|
||||
const generated = JSON.parse(
|
||||
readFileSync(resolve(process.cwd(), '.generated/publications.json'), 'utf8'),
|
||||
) as { publications?: string[] };
|
||||
publishedIds = new Set(generated.publications ?? []);
|
||||
} catch {
|
||||
// Before prebuild, preserve legacy entries and fail closed for reviewed
|
||||
// releases that require a successful all-surface publication marker.
|
||||
}
|
||||
|
||||
export const publishedReleases = allReleases.filter(
|
||||
(release) => !release.status || release.status === 'published' || publishedIds.has(release.version),
|
||||
);
|
||||
// Public navigation contains official releases only. Historical prereleases
|
||||
// remain addressable by their exact version URL for compatibility.
|
||||
export const studioReleases = publishedReleases.filter((release) => release.product === 'studio');
|
||||
export const releases = publishedReleases.filter((release) => release.product !== 'studio' && release.channel === 'stable');
|
||||
export const stableReleases = releases;
|
||||
export const previewReleases = publishedReleases.filter((release) => release.channel === 'prerelease');
|
||||
export const latestStableRelease = stableReleases[0];
|
||||
export const latestPreviewRelease = previewReleases[0];
|
||||
export const latestRelease = latestStableRelease;
|
||||
|
||||
export function releasePath(version: string): string {
|
||||
return `/changelog/v${version}/`;
|
||||
}
|
||||
|
||||
export function releaseContentItems(release: ReleaseRecord): ReleaseItem[] {
|
||||
return [
|
||||
...release.highlights,
|
||||
...release.changes.new,
|
||||
...release.changes.improved,
|
||||
...release.changes.fixed,
|
||||
...release.upgrade,
|
||||
...release.risks,
|
||||
];
|
||||
}
|
||||
|
||||
export function releaseTargetCount(release: ReleaseRecord, target: ReleaseTarget): number {
|
||||
return releaseContentItems(release).filter((item) => item.targets?.includes(target)).length;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
---
|
||||
import Base from './Base.astro';
|
||||
import CommunityJoin from '../components/CommunityJoin.astro';
|
||||
import SponsorSlot from '../components/SponsorSlot.astro';
|
||||
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
||||
const repo = 'https://github.com/esengine/DeepSeek-Reasonix';
|
||||
const { title, description, titleEn, titleZh, wide, dash } = Astro.props;
|
||||
---
|
||||
<Base title={title} description={description} titleEn={titleEn} titleZh={titleZh}>
|
||||
<Fragment slot="head">
|
||||
<meta name="robots" content="noindex" />
|
||||
<link rel="preconnect" href="https://id.reasonix.io" crossorigin="anonymous" />
|
||||
<link rel="preconnect" href="https://studio.reasonix.io" crossorigin="anonymous" />
|
||||
<link rel="dns-prefetch" href="//id.reasonix.io" />
|
||||
<link rel="dns-prefetch" href="//studio.reasonix.io" />
|
||||
</Fragment>
|
||||
<header class="nav auth-nav scrolled">
|
||||
<div class="nav-inner">
|
||||
<a class="brand" href={`${base}/`}><img src={`${base}/logo.svg`} alt="Reasonix logo" /><span>Reasonix</span></a>
|
||||
<div class="lang-switch" role="group" aria-label="Language" style="margin-left:auto">
|
||||
<button type="button" data-lang="en" class="active">EN</button>
|
||||
<button type="button" data-lang="zh">中文</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="auth-main">
|
||||
<div class={dash ? 'auth-card wide dash' : wide ? 'auth-card wide' : 'auth-card'}>
|
||||
<slot />
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<CommunityJoin />
|
||||
<div class="foot-sub" style="border-top:none">
|
||||
<a class="brand" href={`${base}/`}><img src={`${base}/logo.svg`} alt="Reasonix logo" /><span>Reasonix</span></a>
|
||||
<nav class="foot-links">
|
||||
<a href={`${base}/`}><span class="l-en">Home</span><span class="l-zh">首页</span></a>
|
||||
<a href={`${base}/docs/`}><span class="l-en">Docs</span><span class="l-zh">文档</span></a>
|
||||
<a href={repo}>GitHub</a>
|
||||
</nav>
|
||||
</div>
|
||||
<SponsorSlot />
|
||||
</footer>
|
||||
|
||||
<script>import '../scripts/auth.js';</script>
|
||||
</Base>
|
||||
@@ -1,47 +0,0 @@
|
||||
---
|
||||
import '../styles/global.css';
|
||||
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
||||
const { title, description, titleEn, titleZh, canonical: canonicalOverride, noindex = false } = Astro.props;
|
||||
const canonical = canonicalOverride ?? new URL(Astro.url.pathname, Astro.site).href;
|
||||
const ogImage = new URL(`${base}/og.png`, Astro.site).href;
|
||||
---
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description} />
|
||||
{noindex && <meta name="robots" content="noindex, nofollow" />}
|
||||
<link rel="canonical" href={canonical} />
|
||||
<link rel="icon" href={`${base}/favicon.svg`} type="image/svg+xml" />
|
||||
<link rel="sitemap" href={`${base}/sitemap-index.xml`} />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
<script is:inline>
|
||||
(function(){try{var p=localStorage.getItem("reasonix-theme")||"system";var d=p==="dark"||(p==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches);document.documentElement.dataset.theme=d?"dark":"light";var m=document.querySelector('meta[name="theme-color"]');if(m)m.content=d?"#1f232b":"#ffffff";}catch(e){}})();
|
||||
</script>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:site_name" content="Reasonix" />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:url" content={canonical} />
|
||||
<meta property="og:image" content={ogImage} />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta property="og:image:alt" content="Reasonix — an open-source coding agent for your terminal, desktop, browser and editor" />
|
||||
<meta property="og:locale" content="en_US" />
|
||||
<meta property="og:locale:alternate" content="zh_CN" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content={title} />
|
||||
<meta name="twitter:description" content={description} />
|
||||
<meta name="twitter:image" content={ogImage} />
|
||||
<slot name="head" />
|
||||
</head>
|
||||
<body data-motion="rich" data-lang="en" data-title-en={titleEn ?? title} data-title-zh={titleZh ?? title}>
|
||||
<slot />
|
||||
<script>
|
||||
import '../scripts/site.js';
|
||||
import '../scripts/fx.js';
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,105 +0,0 @@
|
||||
---
|
||||
import "../styles/community.css";
|
||||
import CommunityJoin from "../components/CommunityJoin.astro";
|
||||
const { title, description, active } = Astro.props;
|
||||
const canonical = new URL(Astro.url.pathname, Astro.site).href;
|
||||
---
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description} />
|
||||
<link rel="canonical" href={canonical} />
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
<script is:inline>
|
||||
(function(){try{var p=localStorage.getItem("reasonix-theme")||"system";var d=p==="dark"||(p==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches);document.documentElement.dataset.theme=d?"dark":"light";var m=document.querySelector('meta[name="theme-color"]');if(m)m.content=d?"#1f232b":"#ffffff";}catch(e){}})();
|
||||
</script>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:site_name" content="Reasonix Community" />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
</head>
|
||||
<body data-lang="en">
|
||||
<header class="nav">
|
||||
<div class="nav-inner">
|
||||
<a class="brand" href="/community/" aria-label="Reasonix Community"><span class="mark" aria-hidden="true">R</span><span class="brand-name">Reasonix</span><span class="ctag"><span class="l-en">Community</span><span class="l-zh">社区</span></span></a>
|
||||
<nav class="nav-links">
|
||||
<a class={active === "discussions" ? "here" : ""} href="/community/"><span class="l-en">Discussions</span><span class="l-zh">讨论</span></a>
|
||||
<a href="/community/?category=skills"><span class="l-en">Skills</span><span class="l-zh">技能</span></a>
|
||||
<a href="/community/?category=show"><span class="l-en">Showcase</span><span class="l-zh">展示</span></a>
|
||||
<a href="/docs/"><span class="l-en">Docs ↗</span><span class="l-zh">文档 ↗</span></a>
|
||||
</nav>
|
||||
<div class="nav-right">
|
||||
<div class="lang-switch" role="group" aria-label="Language">
|
||||
<button type="button" data-lang="en" class="active">EN</button>
|
||||
<button type="button" data-lang="zh">中文</button>
|
||||
</div>
|
||||
<div class="theme-switch" role="group" aria-label="Theme">
|
||||
<button type="button" data-theme="system" class="active" aria-label="System theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg></button>
|
||||
<button type="button" data-theme="light" aria-label="Light theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><line x1="12" y1="1" x2="12" y2="4"/><line x1="12" y1="20" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="6.3" y2="6.3"/><line x1="17.7" y1="17.7" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="4" y2="12"/><line x1="20" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="6.3" y2="17.7"/><line x1="17.7" y1="6.3" x2="19.8" y2="4.2"/></svg></button>
|
||||
<button type="button" data-theme="dark" aria-label="Dark theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg></button>
|
||||
</div>
|
||||
<span id="nav-account"></span>
|
||||
</div>
|
||||
<button
|
||||
class="nav-menu-toggle"
|
||||
type="button"
|
||||
data-mobile-nav-toggle
|
||||
aria-controls="community-mobile-nav"
|
||||
aria-expanded="false"
|
||||
aria-label="Open navigation"
|
||||
title="Open navigation"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h16" /></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="mobile-nav" id="community-mobile-nav" data-mobile-nav hidden>
|
||||
<button class="mobile-nav-backdrop" type="button" data-mobile-nav-close aria-label="Close navigation"></button>
|
||||
<aside class="mobile-nav-panel" role="dialog" aria-modal="true" aria-labelledby="community-mobile-nav-title">
|
||||
<div class="mobile-nav-head">
|
||||
<span id="community-mobile-nav-title"><span class="l-en">Navigation</span><span class="l-zh">导航</span></span>
|
||||
<button class="mobile-nav-close" type="button" data-mobile-nav-close aria-label="Close navigation" title="Close navigation">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18" /></svg>
|
||||
</button>
|
||||
</div>
|
||||
<nav class="mobile-nav-links" aria-label="Mobile community navigation">
|
||||
<a class:list={[{ here: active === "discussions" }]} href="/community/"><span class="l-en">Discussions</span><span class="l-zh">讨论</span></a>
|
||||
<a href="/community/?category=skills"><span class="l-en">Skills</span><span class="l-zh">技能</span></a>
|
||||
<a href="/community/?category=show"><span class="l-en">Showcase</span><span class="l-zh">展示</span></a>
|
||||
<a href="/docs/"><span class="l-en">Docs ↗</span><span class="l-zh">文档 ↗</span></a>
|
||||
</nav>
|
||||
<div class="mobile-nav-actions">
|
||||
<a class="mobile-nav-github" href="https://github.com/esengine/DeepSeek-Reasonix" target="_blank" rel="noreferrer">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M12 .7a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.3c-3.3.7-4-1.4-4-1.4-.5-1.4-1.3-1.8-1.3-1.8-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.6-.3-5.4-1.3-5.4-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.1 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.6.3 2.8.1 3.1.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.4 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .7Z" /></svg>
|
||||
GitHub
|
||||
</a>
|
||||
<span id="mobile-nav-account"></span>
|
||||
<a class="btn btn-primary" href="/community/new/"><span class="l-en">New topic</span><span class="l-zh">发起话题</span></a>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<CommunityJoin />
|
||||
<footer class="foot">
|
||||
<div class="foot-inner">
|
||||
<a class="brand" href="/"><span class="mark">R</span>Reasonix</a>
|
||||
<span><span class="l-en">© 2026 · MIT · built to be left running.</span><span class="l-zh">© 2026 · MIT 许可 · 为常驻运行而生。</span></span>
|
||||
<nav class="links">
|
||||
<a href="/community/guidelines/"><span class="l-en">Guidelines</span><span class="l-zh">规范</span></a>
|
||||
<a href="/docs/"><span class="l-en">Docs</span><span class="l-zh">文档</span></a>
|
||||
<a href="https://github.com/esengine/DeepSeek-Reasonix">GitHub</a>
|
||||
</nav>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>import "../scripts/community.js";</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,115 +0,0 @@
|
||||
const TIERS = [
|
||||
["New", "新成员"],
|
||||
["Basic", "基础"],
|
||||
["Member", "成员"],
|
||||
["Regular", "常客"],
|
||||
["Leader", "领袖"],
|
||||
];
|
||||
|
||||
// [en, zh] for a forum trust level; a value outside the known range reads as unknown.
|
||||
export function trustName(level) {
|
||||
return Number.isInteger(level) && level >= 0 && level < TIERS.length ? TIERS[level] : null;
|
||||
}
|
||||
|
||||
export function deviceSummary(payload) {
|
||||
const list = Array.isArray(payload?.devices) ? payload.devices.filter((d) => d && !d.revokedAt) : [];
|
||||
return { total: list.length, online: payload?.presenceAvailable === false ? null : list.filter((d) => d.online === true).length };
|
||||
}
|
||||
|
||||
export function backupCount(payload) {
|
||||
return Array.isArray(payload?.backups) ? payload.backups.length : null;
|
||||
}
|
||||
|
||||
const whole = (n) => (Number.isFinite(n) && n >= 0 ? Math.floor(n) : null);
|
||||
|
||||
// Only well-formed numbers reach the page; anything else renders as "—".
|
||||
export function forumSummary(payload) {
|
||||
const m = payload?.member;
|
||||
const s = payload?.stats;
|
||||
if (!m || !s) return null;
|
||||
return {
|
||||
trust: Number.isInteger(m.trust) ? m.trust : null,
|
||||
role: m.role === "admin" || m.role === "moderator" ? m.role : "member",
|
||||
dailyPostCap: whole(m.dailyPostCap),
|
||||
canPostLinks: m.canPostLinks === true,
|
||||
silencedUntil: typeof m.silencedUntil === "string" ? m.silencedUntil : null,
|
||||
topics: whole(s.topics),
|
||||
posts: whole(s.posts),
|
||||
likesReceived: whole(s.likesReceived),
|
||||
solved: whole(s.solved),
|
||||
recent: Array.isArray(payload.recent)
|
||||
? payload.recent.filter((r) => Number.isInteger(r?.id) && typeof r.title === "string").slice(0, 5)
|
||||
: [],
|
||||
};
|
||||
}
|
||||
|
||||
export function initials(handle) {
|
||||
return String(handle || "?").replace(/[^a-zA-Z0-9]/g, "").slice(0, 2).toUpperCase() || "?";
|
||||
}
|
||||
|
||||
// "empty" is only for an answered request whose counts are all zero; a failed or
|
||||
// malformed answer is "unavailable", never a claim that the member has not taken part.
|
||||
export function forumState(summary) {
|
||||
if (!summary) return "unavailable";
|
||||
return summary.topics === 0 && summary.posts === 0 ? "empty" : "active";
|
||||
}
|
||||
|
||||
const LEVELS = [
|
||||
["New seed", "新种"],
|
||||
["Sprout", "萌芽"],
|
||||
["Seedling", "幼苗"],
|
||||
["Sapling", "小树"],
|
||||
["Bloom", "繁花"],
|
||||
["Canopy", "成荫"],
|
||||
["Grove", "共林"],
|
||||
];
|
||||
|
||||
// [en, zh] for a feedback level, null outside the known ladder.
|
||||
export function levelName(level) {
|
||||
return Number.isInteger(level) && level >= 0 && level < LEVELS.length ? LEVELS[level] : null;
|
||||
}
|
||||
|
||||
const TRUST = new Set(["active", "legacy_active", "lapsed", "revoked", "none"]);
|
||||
const count = (n) => (Number.isInteger(n) && n >= 0 ? n : null);
|
||||
|
||||
function standing(p) {
|
||||
if (!p || count(p.level) === null || count(p.adoptedCount) === null || !TRUST.has(p.trustState)) return null;
|
||||
const limits = p.effectiveLimits ?? {};
|
||||
return {
|
||||
level: p.level,
|
||||
adopted: p.adoptedCount,
|
||||
base: count(p.currentThreshold),
|
||||
nextLevel: count(p.nextLevel),
|
||||
nextThreshold: count(p.nextThreshold),
|
||||
remaining: count(p.remaining),
|
||||
trustState: p.trustState,
|
||||
trustExpiresAt: typeof p.trustExpiresAt === "string" ? p.trustExpiresAt : null,
|
||||
perHour: count(limits.reportsPerHour),
|
||||
perDay: count(limits.reportsPerDay),
|
||||
repliesPerHour: count(limits.repliesPerHour),
|
||||
};
|
||||
}
|
||||
|
||||
// Share of the way to the next level, or null at the top or when the thresholds do not hold together.
|
||||
export function levelProgress(s) {
|
||||
if (!s || s.nextThreshold === null || s.base === null || s.nextThreshold <= s.base) return null;
|
||||
return Math.min(1, Math.max(0, (s.adopted - s.base) / (s.nextThreshold - s.base)));
|
||||
}
|
||||
|
||||
// "unavailable" is a failed or malformed answer; "none" is an answered request with no linked install.
|
||||
export function feedbackSummary(payload) {
|
||||
if (!payload || !Array.isArray(payload.installs) || !Array.isArray(payload.items)) return { state: "unavailable" };
|
||||
const installs = payload.installs.map((i) => ({ id: String(i?.id ?? ""), linkedAt: i?.linkedAt, standing: standing(i?.profile) })).filter((i) => /^[0-9a-f]{12}$/.test(i.id));
|
||||
if (installs.length === 0) return { state: "none" };
|
||||
const items = payload.items
|
||||
.filter((it) => typeof it?.receipt === "string" && typeof it.titleSnippet === "string")
|
||||
.slice(0, 5)
|
||||
.map((it) => ({
|
||||
receipt: it.receipt,
|
||||
title: it.titleSnippet,
|
||||
status: typeof it.status === "string" ? it.status : "",
|
||||
issueNumber: count(it.issueNumber),
|
||||
version: typeof it.resolvedVersion === "string" && /^[0-9A-Za-z][0-9A-Za-z.+-]{0,31}$/.test(it.resolvedVersion) ? it.resolvedVersion : null,
|
||||
}));
|
||||
return { state: "linked", headline: standing(payload.profile), installs, items };
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
// The contributor board's pure parts: what a name may look like on the page, and the
|
||||
// rows built from the public answer. Names come from users, so every one is cleaned
|
||||
// and set as text; nothing here makes markup.
|
||||
|
||||
export const NAME_LIMIT = 60;
|
||||
|
||||
// Bidirectional controls and other invisible formatting characters can make a name
|
||||
// read as something else (a right-to-left override flips what follows it), so none
|
||||
// reaches the page.
|
||||
const INVISIBLE = /[\u0000-\u001f\u007f-\u009f----]/gu;
|
||||
|
||||
export function cleanName(raw) {
|
||||
const text = String(raw ?? "").normalize("NFKC").replace(/[\t\n\r]+/g, " ").replace(INVISIBLE, "").replace(/\s+/g, " ").trim();
|
||||
const chars = [...text];
|
||||
return chars.length > NAME_LIMIT ? chars.slice(0, NAME_LIMIT - 1).join("") + "…" : text;
|
||||
}
|
||||
|
||||
export function newestFirst(a, b) {
|
||||
const pa = a.replace(/^v/, "").split(".").map(Number);
|
||||
const pb = b.replace(/^v/, "").split(".").map(Number);
|
||||
for (let i = 0; i < 3; i++) if ((pa[i] ?? 0) !== (pb[i] ?? 0)) return (pb[i] ?? 0) - (pa[i] ?? 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function versionsOf(entries) {
|
||||
return [...new Set(entries.flatMap((e) => e.releases.map((r) => r.version)))].sort(newestFirst);
|
||||
}
|
||||
|
||||
// One row as plain parts, whatever the document is: the caller sets each as text.
|
||||
export function rowOf(entry, ranked) {
|
||||
return {
|
||||
rank: ranked ? String(entry.rank ?? "") : null,
|
||||
name: cleanName(entry.displayName),
|
||||
credits: Number.isFinite(entry.credits) ? entry.credits : 0,
|
||||
chips: ranked ? [] : (entry.releases ?? []).slice(0, 3).map((r) => (r.count > 1 ? `${r.version} ×${r.count}` : r.version)),
|
||||
};
|
||||
}
|
||||
|
||||
// buildRow draws a row with the given document. It writes only through
|
||||
// textContent, so a name can never become markup.
|
||||
export function buildRow(entry, ranked, doc) {
|
||||
const row = rowOf(entry, ranked);
|
||||
const li = doc.createElement("li");
|
||||
const part = (cls, text) => {
|
||||
const el = doc.createElement("span");
|
||||
el.className = cls;
|
||||
el.textContent = text;
|
||||
return el;
|
||||
};
|
||||
if (row.rank !== null) li.append(part("board-rank", row.rank));
|
||||
li.append(part("board-name", row.name));
|
||||
const credits = doc.createElement("span");
|
||||
credits.className = "board-credits";
|
||||
credits.append(part("l-en", `${row.credits} adopted`), part("l-zh", `${row.credits} 条被采纳`));
|
||||
li.append(credits);
|
||||
if (!ranked) {
|
||||
const where = doc.createElement("span");
|
||||
where.className = "board-where";
|
||||
for (const chip of row.chips) where.append(part("board-chip", chip));
|
||||
li.append(where);
|
||||
}
|
||||
return li;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
export const QQ_GROUP = {
|
||||
name: 'DeepSeek-Reasonix官方群',
|
||||
number: '1093562660',
|
||||
joinUrl: 'https://qm.qq.com/q/i59b0z2R8s',
|
||||
qrPath: '/community/qq-group.svg',
|
||||
};
|
||||
|
||||
export const DISCORD_URL = 'https://discord.gg/XF78rEME2D';
|
||||
|
||||
export const DOUYIN = {
|
||||
name: '做游戏的小鱼',
|
||||
id: '22703872788',
|
||||
qrPath: '/community/douyin.png',
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
// A forum thread with source "github" mirrors a GitHub Discussion, and one with source "feedback" mirrors an in-app report's issue: its text
|
||||
// is GitHub's, so the page shows where it lives instead of a reply box.
|
||||
export const DISCUSSIONS_URL = "https://github.com/esengine/DeepSeek-Reasonix/discussions";
|
||||
export const ISSUES_URL = "https://github.com/esengine/DeepSeek-Reasonix/issues";
|
||||
|
||||
export function mirrorOf(topic) {
|
||||
if (!topic || (topic.source !== "github" && topic.source !== "feedback")) return null;
|
||||
const feedback = topic.source === "feedback";
|
||||
const base = feedback ? ISSUES_URL : DISCUSSIONS_URL;
|
||||
const url = Number.isInteger(topic.ghNumber) && topic.ghNumber > 0 ? `${base}/${topic.ghNumber}` : base;
|
||||
const status = ["recorded", "in_progress", "fixed"].includes(topic.ghStatus) ? topic.ghStatus : null;
|
||||
const version = status === "fixed" && typeof topic.fixedIn === "string" && /^[0-9A-Za-z][0-9A-Za-z.+-]{0,31}$/.test(topic.fixedIn) ? topic.fixedIn : null;
|
||||
return { url, status, version, feedback };
|
||||
}
|
||||
|
||||
const LABELS = {
|
||||
recorded: ["Recorded", "已记录"],
|
||||
in_progress: ["In progress", "处理中"],
|
||||
fixed: ["Fixed", "已修复"],
|
||||
};
|
||||
|
||||
// [en, zh] for the status badge, with the shipped version when there is one.
|
||||
export function statusText(mirror) {
|
||||
if (!mirror?.status) return null;
|
||||
const [en, zh] = LABELS[mirror.status];
|
||||
return mirror.version ? [`${en} in v${mirror.version.replace(/^v/, "")}`, `${zh}于 v${mirror.version.replace(/^v/, "")}`] : [en, zh];
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
// The repository owner is never thanked on release pages; change the login here only.
|
||||
export const repositoryOwner = "esengine";
|
||||
|
||||
export function withoutOwner(logins) {
|
||||
const owner = repositoryOwner.toLowerCase();
|
||||
return logins.filter((login) => String(login).toLowerCase() !== owner);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
const REPO_ISSUES = 'https://github.com/esengine/DeepSeek-Reasonix/issues/';
|
||||
const TRAILING_REFS = /(\(?)(#\d{1,9}(?:\s*,\s*#\d{1,9})*)(\)?)\s*$/;
|
||||
|
||||
export function issueHref(digits) {
|
||||
if (!/^\d{1,9}$/.test(digits)) throw new Error('issue number must be digits only');
|
||||
return `${REPO_ISSUES}${digits}`;
|
||||
}
|
||||
|
||||
function codeSpans(text) {
|
||||
const out = [];
|
||||
const pattern = /`([^`\n]+)`/g;
|
||||
let last = 0;
|
||||
for (const match of text.matchAll(pattern)) {
|
||||
if (match.index > last) out.push({ type: 'text', value: text.slice(last, match.index) });
|
||||
out.push({ type: 'code', value: match[1] });
|
||||
last = match.index + match[0].length;
|
||||
}
|
||||
if (last < text.length) out.push({ type: 'text', value: text.slice(last) });
|
||||
return out;
|
||||
}
|
||||
|
||||
export function parseInline(line) {
|
||||
const trailing = line.match(TRAILING_REFS);
|
||||
const hasBoundary = trailing && (trailing.index === 0 || /\s/.test(line[trailing.index - 1]) || trailing[1] === '(');
|
||||
const insideCode = trailing && (line.slice(0, trailing.index).split('`').length - 1) % 2 === 1;
|
||||
if (!trailing || !hasBoundary || insideCode || (trailing[1] === '(') !== (trailing[3] === ')')) return codeSpans(line);
|
||||
const body = line.slice(0, trailing.index);
|
||||
const tokens = codeSpans(body);
|
||||
tokens.push({ type: 'text', value: trailing[1] });
|
||||
trailing[2].split(/(\s*,\s*)/).forEach((part) => {
|
||||
const ref = part.match(/^#(\d+)$/);
|
||||
tokens.push(ref ? { type: 'ref', number: ref[1], value: part } : { type: 'text', value: part });
|
||||
});
|
||||
if (trailing[3]) tokens.push({ type: 'text', value: trailing[3] });
|
||||
return tokens;
|
||||
}
|
||||
|
||||
export function parseStudioNotes(markdown) {
|
||||
const blocks = [];
|
||||
let list = null;
|
||||
let summary = '';
|
||||
for (const raw of String(markdown ?? '').split(/\r?\n/)) {
|
||||
const line = raw.trimEnd();
|
||||
if (!line.trim()) { list = null; continue; }
|
||||
const heading = line.match(/^##\s+(\S.*)$/);
|
||||
const bullet = line.match(/^[-*]\s+(\S.*)$/);
|
||||
if (heading) {
|
||||
list = null;
|
||||
blocks.push({ type: 'heading', inline: parseInline(heading[1].trim()) });
|
||||
} else if (bullet) {
|
||||
if (!list) { list = { type: 'list', items: [] }; blocks.push(list); }
|
||||
list.items.push(parseInline(bullet[1]));
|
||||
} else {
|
||||
list = null;
|
||||
if (!summary && blocks.length === 0) summary = line.trim();
|
||||
blocks.push({ type: 'paragraph', inline: parseInline(line.trim()) });
|
||||
}
|
||||
}
|
||||
return { summary, blocks };
|
||||
}
|
||||
|
||||
export function plainText(tokens) {
|
||||
return tokens.map((t) => t.value).join('');
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
---
|
||||
import Base from '../layouts/Base.astro';
|
||||
import CommunityJoin from '../components/CommunityJoin.astro';
|
||||
import SponsorSlot from '../components/SponsorSlot.astro';
|
||||
import SiteHeader from '../components/SiteHeader.astro';
|
||||
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
|
||||
---
|
||||
<Base
|
||||
title="Page not found — Reasonix"
|
||||
titleEn="Page not found — Reasonix"
|
||||
titleZh="页面不存在 — Reasonix"
|
||||
description="The page you are looking for does not exist.">
|
||||
|
||||
<Fragment slot="head"><meta name="robots" content="noindex" /></Fragment>
|
||||
|
||||
<script is:inline>
|
||||
// Preserve the documented /u/<handle> shape on static hosting by moving it
|
||||
// to the client-rendered public profile page.
|
||||
try {
|
||||
const match = location.pathname.match(/^\/u\/([^/]+)\/?$/);
|
||||
if (match) location.replace(`/u/?handle=${encodeURIComponent(decodeURIComponent(match[1]))}`);
|
||||
} catch {}
|
||||
</script>
|
||||
|
||||
<SiteHeader scrolled />
|
||||
|
||||
<main class="hero" style="padding-bottom:150px">
|
||||
<div class="wrap">
|
||||
<div class="eyebrow">404</div>
|
||||
<h1><span class="l-en">This page went <span class="grad">cold.</span></span><span class="l-zh">这一页<span class="grad">冷掉了</span>。</span></h1>
|
||||
<p class="sub"><span class="l-en">The page you're looking for doesn't exist — but the session is still warm.</span><span class="l-zh">你找的页面不存在——但会话还热着。</span></p>
|
||||
<div class="cold-blocks" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i class="new"></i></div>
|
||||
<div class="hero-cta">
|
||||
<a class="btn btn-dark" href={`${base}/`}><span class="l-en">Back to home</span><span class="l-zh">回到首页</span></a>
|
||||
<a class="btn btn-ghost" href={`${base}/docs/`}><span class="l-en">Read the docs</span><span class="l-zh">查看文档</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<CommunityJoin />
|
||||
<SponsorSlot />
|
||||
</footer>
|
||||
</Base>
|
||||