Skip to content

Commit 5edd2db

Browse files
salim4nclaude
andcommitted
docs: all 5 @ignitionai/* packages live on npm — remove callouts
All three remaining backend packages published at v0.1.0: - @ignitionai/backend-onnx - @ignitionai/storage - @ignitionai/environments Docs updated post-publish: - Quickstart: replaced the inlined 60-line CartPoleEnv with a clean import from @ignitionai/environments. Back to the original 7-line promise in the page title. - Landing hero + components/quickstart.tsx: install command now lists all three published install-time packages (core, backend-tfjs, environments). - index.mdx intro: updated install section to explain the three packages and note that environments is optional if you want to write your own TrainingEnv from scratch. - how-it-works/{index,backend-onnx,storage}.mdx: import lines go back to '@ignitionai/environments' instead of the './cartpole-env' workaround. Added a note about the fifth package on the monorepo map page. - how-it-works/backend-onnx.mdx + storage.mdx + tutorials/onnx-unity.mdx: removed the "publish pending" <Callout> blocks. ONNX tutorial prereq updated to `npm install @ignitionai/backend-onnx`. - research.md R3 + roadmap Phase 1.4: marked all 5 packages as ✓ published, noted the post-publish doc cleanup. package.json autocorrect: `npm pkg fix` normalized the repository.url on @ignitionai/environments during publish. Kept the normalized form. Build: 23 routes, 0 errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 21fc7bd commit 5edd2db

11 files changed

Lines changed: 42 additions & 123 deletions

File tree

packages/environments/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "Reference training environments for IgnitionAI — GridWorld, CartPole, MountainCar",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7-
"files": ["dist"],
7+
"files": [
8+
"dist"
9+
],
810
"scripts": {
911
"build": "tsc",
1012
"test": "vitest run"
@@ -21,6 +23,6 @@
2123
"license": "MIT",
2224
"repository": {
2325
"type": "git",
24-
"url": "https://github.com/IgnitionAI/ignition"
26+
"url": "git+https://github.com/IgnitionAI/ignition.git"
2527
}
2628
}

packages/web/components/hero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function Hero() {
5656
<div className="mt-12" data-aos="fade-down" data-aos-delay="600">
5757
<div className="inline-flex items-center gap-2 bg-slate-900/60 border border-slate-800 rounded-lg px-4 py-2 font-mono text-sm text-slate-300">
5858
<span className="text-indigo-400">$</span>
59-
<span>npm install @ignitionai/core @ignitionai/backend-tfjs</span>
59+
<span>npm install @ignitionai/core @ignitionai/backend-tfjs @ignitionai/environments</span>
6060
</div>
6161
</div>
6262

packages/web/components/quickstart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default function QuickStart() {
22
const code = `import { IgnitionEnvTFJS } from '@ignitionai/backend-tfjs';
3-
import { CartPoleEnv } from '@ignitionai/core';
3+
import { CartPoleEnv } from '@ignitionai/environments';
44
55
const cartpole = new CartPoleEnv();
66
const env = new IgnitionEnvTFJS(cartpole);

packages/web/content/how-it-works/backend-onnx.mdx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ description: The ONNX bridge — train in the browser with TF.js, export to ONNX
99

1010
**Source**: [`packages/backend-onnx/src/`](https://github.com/IgnitionAI/ignition/tree/main/packages/backend-onnx/src) on GitHub.
1111

12-
import { Callout } from 'nextra/components'
13-
14-
<Callout type="warning">
15-
**Publish status**: `@ignitionai/backend-onnx` ships with the monorepo but is not yet on the public npm registry. Build it from source with `pnpm --filter @ignitionai/backend-onnx build`. A public release is tracked in the roadmap.
16-
</Callout>
17-
1812
## What "Train → Deploy" means in practice
1913

2014
The pipeline has four stages:
@@ -47,7 +41,7 @@ Nothing new here — you're using `@ignitionai/backend-tfjs` exactly as describe
4741

4842
```ts filename="train.ts"
4943
import { IgnitionEnvTFJS } from '@ignitionai/backend-tfjs'
50-
import { CartPoleEnv } from './cartpole-env' // from the Quickstart
44+
import { CartPoleEnv } from '@ignitionai/environments'
5145

5246
const env = new IgnitionEnvTFJS(new CartPoleEnv())
5347
env.train('dqn')
@@ -135,7 +129,7 @@ Three lines. The model runs at full speed on WebGPU where available, and because
135129
```ts filename="play.ts"
136130
import { IgnitionEnv } from '@ignitionai/core'
137131
import { OnnxAgent } from '@ignitionai/backend-onnx'
138-
import { CartPoleEnv } from './cartpole-env' // from the Quickstart
132+
import { CartPoleEnv } from '@ignitionai/environments'
139133

140134
const env = new IgnitionEnv(new CartPoleEnv())
141135
const agent = new OnnxAgent({ modelPath: './model.onnx', actionSize: 2 })

packages/web/content/how-it-works/index.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,17 @@ When you write:
2424

2525
```ts
2626
import { IgnitionEnvTFJS } from '@ignitionai/backend-tfjs'
27-
import { CartPoleEnv } from './cartpole-env' // the env you defined yourself
27+
import { CartPoleEnv } from '@ignitionai/environments'
2828

2929
const env = new IgnitionEnvTFJS(new CartPoleEnv())
3030
env.train('dqn')
3131
```
3232

33-
(The `CartPoleEnv` class comes from your own project — see the [Quickstart](/docs/quickstart) for a complete copy-paste definition.)
34-
3533
Here's what happens across the packages:
3634

37-
1. **`@ignitionai/core`** provides the `TrainingEnv` interface contract and the `IgnitionEnv` base class with the generic training loop.
38-
2. **`@ignitionai/backend-tfjs`** provides `IgnitionEnvTFJS`, which extends `IgnitionEnv` and registers the TF.js-backed `DQNAgent`, `PPOAgent`, and `QTableAgent` as the available algorithm factories.
35+
1. **`@ignitionai/environments`** ships `CartPoleEnv` as a built-in `TrainingEnv` (also `GridWorldEnv` and `MountainCarEnv`).
36+
2. **`@ignitionai/core`** provides the `TrainingEnv` interface contract and the `IgnitionEnv` base class with the generic training loop.
37+
3. **`@ignitionai/backend-tfjs`** provides `IgnitionEnvTFJS`, which extends `IgnitionEnv` and registers the TF.js-backed `DQNAgent`, `PPOAgent`, and `QTableAgent` as the available algorithm factories.
3938
3. When you call `env.train('dqn')`, `core`'s `IgnitionEnv.train()` method is invoked. It looks up the `'dqn'` factory (registered by the TFJS backend), deduces `inputSize` from `observe()` and `actionSize` from `actions`, calls the factory, and starts the training loop.
4039
4. The training loop lives entirely in `core`. It doesn't know anything about TensorFlow.js — it just calls the generic `AgentInterface` methods (`getAction`, `remember`, `train`) on whatever agent the backend registered.
4140

@@ -50,6 +49,8 @@ Each subsequent page in this section does an annotated walkthrough of one packag
5049
3. **[backend-onnx](/docs/how-it-works/backend-onnx)** — the deploy pipeline.
5150
4. **[storage](/docs/how-it-works/storage)** — persistence and HF Hub integration.
5251

52+
(There's a fifth package, [`@ignitionai/environments`](https://www.npmjs.com/package/@ignitionai/environments), that ships the built-in envs used in the docs. It's a thin wrapper around the `TrainingEnv` interface and doesn't need its own page — read [any env's source](https://github.com/IgnitionAI/ignition/tree/main/packages/environments/src) to see how the interface is actually implemented.)
53+
5354
---
5455

5556
Previous: **[← Q-Table](/docs/algorithms/q-table)** · Next: **[@ignitionai/core](/docs/how-it-works/core)**

packages/web/content/how-it-works/storage.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ description: Persistent model storage for IgnitionAI agents — save and load tr
99

1010
**Source**: [`packages/storage/src/`](https://github.com/IgnitionAI/ignition/tree/main/packages/storage/src) on GitHub.
1111

12-
import { Callout } from 'nextra/components'
13-
14-
<Callout type="warning">
15-
**Publish status**: `@ignitionai/storage` ships with the monorepo but is not yet on the public npm registry. Build it from source with `pnpm --filter @ignitionai/storage build`. A public release is tracked in the roadmap.
16-
</Callout>
17-
1812
## Public API surface
1913

2014
| Export | Kind | Purpose |
@@ -61,7 +55,7 @@ export HF_REPO_ID=your-user/my-rl-agent
6155

6256
```ts filename="save-and-load.ts"
6357
import { IgnitionEnvTFJS } from '@ignitionai/backend-tfjs'
64-
import { CartPoleEnv } from './cartpole-env' // from the Quickstart
58+
import { CartPoleEnv } from '@ignitionai/environments'
6559
import { HuggingFaceProvider, parseHFConfig } from '@ignitionai/storage'
6660

6761
// 1. Train an agent

packages/web/content/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ None of these is strictly better than the others — they target different audie
4545
## Install
4646

4747
```bash
48-
npm install @ignitionai/core @ignitionai/backend-tfjs
48+
npm install @ignitionai/core @ignitionai/backend-tfjs @ignitionai/environments
4949
```
5050

51-
Two packages. `core` contains the training loop and interfaces; `backend-tfjs` provides the TensorFlow.js agents (DQN, PPO, Q-Table).
51+
Three packages to get started. `core` contains the training loop and the `TrainingEnv` interface. `backend-tfjs` provides the TensorFlow.js agents (DQN, PPO, Q-Table). `environments` ships ready-made envs (`CartPoleEnv`, `GridWorldEnv`, `MountainCarEnv`) so you can train something in 30 seconds. Drop `environments` from the list if you'd rather write your own env from scratch — the [tutorials](/docs/tutorials) walk through that exact flow.
5252

5353
## Where to go next
5454

packages/web/content/quickstart.mdx

Lines changed: 10 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -5,99 +5,25 @@ description: Train your first RL agent in the browser in under 10 lines of code.
55

66
# Quickstart
77

8-
By the end of this page, you will have trained a reinforcement-learning agent to balance a pole in the browser. The entire setup is 9 lines of code. You will not configure a neural network, pick hyperparameters, or write a training loop.
8+
By the end of this page, you will have trained a reinforcement-learning agent to balance a pole in the browser. The entire setup is 7 lines of code. You will not configure a neural network, pick hyperparameters, or write a training loop.
99

1010
## Install
1111

1212
```bash
13-
npm install @ignitionai/core @ignitionai/backend-tfjs
13+
npm install @ignitionai/core @ignitionai/backend-tfjs @ignitionai/environments
1414
```
1515

1616
You need:
1717
- Node.js 20 or later
1818
- A bundler that can serve ES modules (Vite, Next.js, Webpack 5, etc.)
1919

20-
## Step 1 — Define the environment
21-
22-
IgnitionAI doesn't ship built-in envs on npm yet — you write yours, and the framework learns to play it. Here's a complete cart-pole env. Copy it into `src/cartpole-env.ts`:
23-
24-
```ts filename="src/cartpole-env.ts"
25-
import type { TrainingEnv } from '@ignitionai/core'
26-
27-
const GRAVITY = 9.8
28-
const CART_MASS = 1.0
29-
const POLE_MASS = 0.1
30-
const TOTAL_MASS = CART_MASS + POLE_MASS
31-
const POLE_HALF_LENGTH = 0.5
32-
const POLE_MASS_LENGTH = POLE_MASS * POLE_HALF_LENGTH
33-
const FORCE_MAG = 10.0
34-
const DT = 0.02
35-
const THETA_LIMIT = (12 * Math.PI) / 180
36-
const X_LIMIT = 2.4
37-
const MAX_STEPS = 500
38-
39-
export class CartPoleEnv implements TrainingEnv {
40-
actions = ['push_left', 'push_right']
41-
private x = 0
42-
private xDot = 0
43-
private theta = 0
44-
private thetaDot = 0
45-
private stepCount = 0
46-
47-
constructor() { this.reset() }
48-
49-
observe(): number[] {
50-
return [this.x, this.xDot, this.theta, this.thetaDot]
51-
}
52-
53-
step(action: number | number[]): void {
54-
const a = typeof action === 'number' ? action : action[0]
55-
const force = a === 1 ? FORCE_MAG : -FORCE_MAG
56-
const cosTheta = Math.cos(this.theta)
57-
const sinTheta = Math.sin(this.theta)
58-
const temp = (force + POLE_MASS_LENGTH * this.thetaDot ** 2 * sinTheta) / TOTAL_MASS
59-
const thetaAcc =
60-
(GRAVITY * sinTheta - cosTheta * temp) /
61-
(POLE_HALF_LENGTH * (4 / 3 - (POLE_MASS * cosTheta ** 2) / TOTAL_MASS))
62-
const xAcc = temp - (POLE_MASS_LENGTH * thetaAcc * cosTheta) / TOTAL_MASS
63-
this.x += DT * this.xDot
64-
this.xDot += DT * xAcc
65-
this.theta += DT * this.thetaDot
66-
this.thetaDot += DT * thetaAcc
67-
this.stepCount++
68-
}
69-
70-
reward(): number {
71-
return this.done() ? 0 : 1
72-
}
73-
74-
done(): boolean {
75-
return (
76-
Math.abs(this.theta) > THETA_LIMIT ||
77-
Math.abs(this.x) > X_LIMIT ||
78-
this.stepCount >= MAX_STEPS
79-
)
80-
}
81-
82-
reset(): void {
83-
this.x = (Math.random() - 0.5) * 0.1
84-
this.xDot = (Math.random() - 0.5) * 0.1
85-
this.theta = (Math.random() - 0.5) * 0.1
86-
this.thetaDot = (Math.random() - 0.5) * 0.1
87-
this.stepCount = 0
88-
}
89-
}
90-
```
91-
92-
This is roughly 60 lines, most of which is physics. The RL-relevant surface area is the six `TrainingEnv` methods at the top — that's your contract with the framework.
20+
## Train a CartPole agent
9321

94-
## Step 2 — Train it
95-
96-
Now create `src/main.ts`:
22+
Create `src/main.ts` and paste this in exactly:
9723

9824
```ts filename="src/main.ts"
9925
import { IgnitionEnvTFJS } from '@ignitionai/backend-tfjs'
100-
import { CartPoleEnv } from './cartpole-env'
26+
import { CartPoleEnv } from '@ignitionai/environments'
10127

10228
const env = new IgnitionEnvTFJS(new CartPoleEnv())
10329

@@ -106,10 +32,12 @@ env.train('dqn') // Zero config. It just works.
10632
// env.setSpeed(50) // Turbo training — 50× faster.
10733
```
10834

109-
**Five lines.** That's the entire training setup. No neural network code, no hyperparameter tuning, no config files.
35+
**Seven lines.** That's the entire training setup. No neural network code, no hyperparameter tuning, no config files.
11036

11137
Open the page in your browser, pop the devtools console, and you'll see reward logs scrolling as the agent learns. Within a few dozen seconds on most machines, the pole will start staying up.
11238

39+
That's it. If you want to understand *how* to write your own `TrainingEnv` from scratch (instead of using the built-in `CartPoleEnv`), jump to the [GridWorld tutorial](/docs/tutorials/grid-world) — it walks through the full 5-method interface.
40+
11341
## What just happened
11442

11543
Let's map each line of the example to a concept you'll see explained in more depth elsewhere in the docs.
@@ -118,9 +46,9 @@ Let's map each line of the example to a concept you'll see explained in more dep
11846

11947
`IgnitionEnvTFJS` is the **training environment** that runs on TensorFlow.js. It owns the training loop, the agent instance, and the TF.js backend selection. You'll see its internals in [How it works → backend-tfjs](/docs/how-it-works/backend-tfjs).
12048

121-
### Line 2 — `import { CartPoleEnv } from './cartpole-env'`
49+
### Line 2 — `import { CartPoleEnv } from '@ignitionai/environments'`
12250

123-
`CartPoleEnv` is the `TrainingEnv` you just wrote. It describes the classic cart-pole world: a cart that can move left or right, a pole balanced on top, Euler-integrated physics, and a done condition when the pole tips past 12° or the cart leaves the track. The `TrainingEnv` interface is what you'll implement for your own worlds. See [How it works → core](/docs/how-it-works/core) for the full interface.
51+
`CartPoleEnv` is a built-in `TrainingEnv` that describes the classic cart-pole world: a cart that can move left or right, a pole balanced on top, Euler-integrated physics, and a done condition when the pole tips past 12° or the cart leaves the track. The `@ignitionai/environments` package also ships `GridWorldEnv` and `MountainCarEnv`. The `TrainingEnv` interface is what you'll implement for your own worlds — see [How it works → core](/docs/how-it-works/core).
12452

12553
### Line 4 — `new IgnitionEnvTFJS(new CartPoleEnv())`
12654

packages/web/content/tutorials/onnx-unity.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,12 @@ This tutorial is the entire IgnitionAI deploy story in one page. You'll train a
99

1010
Estimated time: **50–75 minutes**. Most of it is installing Python and Unity if you don't already have them.
1111

12-
import { Callout } from 'nextra/components'
13-
14-
<Callout type="warning">
15-
**Publish status**: `@ignitionai/backend-onnx` ships with the monorepo but is not yet on the public npm registry. For now, clone the [IgnitionAI repo](https://github.com/IgnitionAI/ignition) and run `pnpm --filter @ignitionai/backend-onnx build`, then link it into your project with `pnpm pack` + `npm install ./ignitionai-backend-onnx-0.1.0.tgz`. A public release is tracked in the roadmap.
16-
</Callout>
17-
1812
## Prerequisites
1913

2014
- You've done the [Quickstart](/docs/quickstart) and trained a CartPole policy. You have `src/cartpole-env.ts` + `src/main.ts` working.
2115
- **Python 3.9+** with `pip`. Check with `python --version`.
2216
- **Unity 2022.3 LTS or newer** with the **Sentis** package. If you don't have Unity, this tutorial doubles as a reason to install it.
23-
- Built `@ignitionai/backend-onnx` locally (per the callout above).
17+
- `@ignitionai/backend-onnx` installed: `npm install @ignitionai/backend-onnx`.
2418

2519
## Stage 1 — Train the model
2620

roadmap.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@
5353
- [ ] Social card image for Twitter/OG (not yet done)
5454
- [ ] Hero GIF of Car Circuit demo in README (README currently text-only)
5555

56-
### 1.4 npm publish v0.1.0
56+
### 1.4 npm publish v0.1.0
5757
- [x] `@ignitionai/core` published at 0.1.0
5858
- [x] `@ignitionai/backend-tfjs` published at 0.1.0
59-
- [ ] `@ignitionai/backend-onnx` — built locally, not yet on npm (docs carry "publish pending" callout)
60-
- [ ] `@ignitionai/storage` — built locally, not yet on npm (docs carry "publish pending" callout)
61-
- [ ] `@ignitionai/environments` — CartPoleEnv / GridWorldEnv / MountainCarEnv not yet on npm. Quickstart inlines CartPoleEnv to avoid depending on an unpublished package.
62-
- [ ] Tag v0.1.0 in git after all four @ignitionai/* backend packages are live
59+
- [x] `@ignitionai/backend-onnx` published at 0.1.0
60+
- [x] `@ignitionai/storage` published at 0.1.0
61+
- [x] `@ignitionai/environments` published at 0.1.0 (ships `CartPoleEnv`, `GridWorldEnv`, `MountainCarEnv`)
62+
- [x] Docs updated post-publish: "publish pending" callouts removed, Quickstart imports `CartPoleEnv` from `@ignitionai/environments` directly
63+
- [ ] Tag v0.1.0 in git once the post-publish commit is merged
6364

6465
**Known framework bug surfaced during docs**: `backend-tfjs/src/defaults.ts:3-13` disagrees with `agents/dqn.ts:43` on `targetUpdateFrequency` (100 vs 1000). Docs cite the runtime value (1000). Needs a cleanup commit in the framework after merge.
6566

0 commit comments

Comments
 (0)