Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ cp .env.example .env # .env を編集して ANTHROPIC_API_KEY を入力
python agents/s01_agent_loop.py # ここから開始
python agents/s12_worktree_task_isolation.py # 全セッションの到達点
python agents/s_full.py # 総括: 全メカニズム統合

cd agents-ts && npm install
npm run s01 # TypeScript 版の開始地点
npm run s12 # TypeScript 版の到達点
```

### Web プラットフォーム
Expand Down Expand Up @@ -291,6 +295,7 @@ s08 バックグラウンドタスク [6] s10 チームプロトコル
learn-claude-code/
|
|-- agents/ # Python リファレンス実装 (s01-s12 + s_full 総括)
|-- agents-ts/ # TypeScript 実行版 (s01-s12)
|-- docs/{en,zh,ja}/ # メンタルモデル優先のドキュメント (3言語)
|-- web/ # インタラクティブ学習プラットフォーム (Next.js)
|-- skills/ # s05 の Skill ファイル
Expand Down
5 changes: 5 additions & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ cp .env.example .env # 编辑 .env 填入你的 ANTHROPIC_API_KEY
python agents/s01_agent_loop.py # 从这里开始
python agents/s12_worktree_task_isolation.py # 完整递进终点
python agents/s_full.py # 总纲: 全部机制合一

cd agents-ts && npm install
npm run s01 # TypeScript 版本入口
npm run s12 # TypeScript 完整递进终点
```

### Web 平台
Expand Down Expand Up @@ -291,6 +295,7 @@ s08 后台任务 [6] s10 团队协议 [12]
learn-claude-code/
|
|-- agents/ # Python 参考实现 (s01-s12 + s_full 总纲)
|-- agents-ts/ # TypeScript 可运行实现 (s01-s12)
|-- docs/{en,zh,ja}/ # 心智模型优先的文档 (3 种语言)
|-- web/ # 交互式学习平台 (Next.js)
|-- skills/ # s05 的 Skill 文件
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ cp .env.example .env # Edit .env with your ANTHROPIC_API_KEY
python agents/s01_agent_loop.py # Start here
python agents/s12_worktree_task_isolation.py # Full progression endpoint
python agents/s_full.py # Capstone: all mechanisms combined

cd agents-ts && npm install
npm run s01 # TypeScript version entrypoint
npm run s12 # TypeScript full progression endpoint
```

### Web Platform
Expand Down Expand Up @@ -290,6 +294,7 @@ s08 Background Tasks [6] s10 Team Protocols [12]
learn-claude-code/
|
|-- agents/ # Python reference implementations (s01-s12 + s_full capstone)
|-- agents-ts/ # TypeScript runnable implementations (s01-s12)
|-- docs/{en,zh,ja}/ # Mental-model-first documentation (3 languages)
|-- web/ # Interactive learning platform (Next.js)
|-- skills/ # Skill files for s05
Expand Down
3 changes: 3 additions & 0 deletions agents-ts/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ANTHROPIC_API_KEY=sk-ant-xxx
MODEL_ID=claude-sonnet-4-6
# ANTHROPIC_BASE_URL=https://api.anthropic.com
2 changes: 2 additions & 0 deletions agents-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.env
58 changes: 58 additions & 0 deletions agents-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# TypeScript Agents

`agents-ts` 是一套可单独运行的 TypeScript 版本示例。

## 环境要求

- Node.js 20+
- npm 10+

## 安装

```bash
cd agents-ts
npm install
```

## 配置

复制 `.env.example` 为 `.env`,然后填写你的凭证。

默认接入参数:

- `MODEL_ID=claude-sonnet-4-6`
- `ANTHROPIC_BASE_URL` 留空时走 Anthropic 官方默认端点

鉴权优先级:

1. `ANTHROPIC_AUTH_TOKEN`
2. `ANTHROPIC_API_KEY`

## 运行

```bash
npm run s01
```


## 校验

```bash
npm run typecheck
```


## 章节脚本

- `npm run s01`
- `npm run s02`
- `npm run s03`
- `npm run s04`
- `npm run s05`
- `npm run s06`
- `npm run s07`
- `npm run s08`
- `npm run s09`
- `npm run s10`
- `npm run s11`
- `npm run s12`
35 changes: 35 additions & 0 deletions agents-ts/defaults.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import test from "node:test";
import assert from "node:assert/strict";
import { DEFAULT_BASE_URL, DEFAULT_MODEL, resolveModel } from "./shared";

test("TypeScript agents default model matches the Python repo", () => {
assert.equal(DEFAULT_MODEL, "claude-sonnet-4-6");
});

test("TypeScript agents do not hardcode a custom base URL by default", () => {
assert.equal(DEFAULT_BASE_URL, undefined);
});

test("resolveModel falls back to the shared default model", () => {
const previousModelId = process.env.MODEL_ID;
const previousAnthropicModel = process.env.ANTHROPIC_MODEL;

delete process.env.MODEL_ID;
delete process.env.ANTHROPIC_MODEL;

try {
assert.equal(resolveModel(), "claude-sonnet-4-6");
} finally {
if (previousModelId === undefined) {
delete process.env.MODEL_ID;
} else {
process.env.MODEL_ID = previousModelId;
}

if (previousAnthropicModel === undefined) {
delete process.env.ANTHROPIC_MODEL;
} else {
process.env.ANTHROPIC_MODEL = previousAnthropicModel;
}
}
});
Loading