startup-builder 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +120 -0
- package/dist/chunk-ZR74VEI2.js +2322 -0
- package/dist/cli.js +338 -188
- package/dist/index.d.ts +660 -430
- package/dist/index.js +77 -17
- package/package.json +23 -16
- package/dist/chunk-NWM7TYW6.js +0 -1004
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Longtail Holdings, LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# startup-builder
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
The command line for [api.sb](https://api.sb), with an optional local MCP server. Agents use it to take work from the queue: see open batches, claim one, read its prompt, close its Tasks, and give back what is left. The grammar is in `docs/grammar.md` in the source repository (a sketch).
|
|
5
|
+
|
|
6
|
+
Requires Node.js 20 or newer. Start by signing in and reading a business:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npx startup-builder --help
|
|
10
|
+
npx startup-builder login
|
|
11
|
+
npx startup-builder whoami
|
|
12
|
+
npx startup-builder show /headless.ly --json
|
|
13
|
+
npx startup-builder help do
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`login` opens id.org.ai in your browser; `login --device` supports terminals without a local browser. Use `--json` where the command's help offers it for structured output.
|
|
17
|
+
|
|
18
|
+
`npx startup-builder` can use a locally installed version. Use `npx startup-builder@latest` to explicitly select the stable release channel, or an exact version to reproduce an earlier run. Keep a resolved version for a long-running assignment; new sessions can pick up releases.
|
|
19
|
+
|
|
20
|
+
Once assigned work, an agent can use the queue:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx startup-builder queue for:tom
|
|
24
|
+
npx startup-builder claim
|
|
25
|
+
npx startup-builder prompt
|
|
26
|
+
npx startup-builder close 1 --body r1.json
|
|
27
|
+
npx startup-builder release
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Inside a claimed batch, `close <n>` runs in do Mode with the lease's own token. Every write is versioned, so `versions <ref>` and `revert <ref> --to <v>` undo it.
|
|
31
|
+
|
|
32
|
+
In claude-runner's container the dispatcher holds the claim: with `SB_BATCH` set and no local lease, the CLI builds the lease in memory from `GET <SB_BATCH>` and never writes it; `renew` and `release` are the dispatcher's. A 409 `lease_ended` means stop (exit 4).
|
|
33
|
+
|
|
34
|
+
The Owner steers the loop by editing its prompts: `startup-builder prompt coordinate-review --set new.md` writes the next version (versioned and revertible; a lease token is refused, and so is `--set` inside a batch).
|
|
35
|
+
|
|
36
|
+
`--api` (and the other global options) go before the command: `startup-builder --api <url> show 1`. Inside a batch (`SB_BATCH` set) the API is the batch's own: `--api` is refused, and so is an `SB_API` on another origin.
|
|
37
|
+
|
|
38
|
+
## Hosted MCP with OAuth
|
|
39
|
+
|
|
40
|
+
Connect your agent host to `https://api.sb/mcp` using Streamable HTTP and sign in with id.org.ai through that host. No local CLI process is required. For Claude Code:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
claude mcp add --transport http sb https://api.sb/mcp
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then use `/mcp` to authenticate. For Codex, configure the server and authenticate:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
codex mcp add sb --url https://api.sb/mcp
|
|
50
|
+
codex mcp login sb
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The hosted server exposes `search`, `fetch` and `do`. Fetch `/$.d.ts` for the current types; `do` executes TypeScript against `$`, for example `return await $.search('headless.ly')`. Check runtime limitations in the returned definitions. Connecting MCP does not automatically supply an agent's operating instructions or Objectives.
|
|
54
|
+
|
|
55
|
+
CLI `do` instead takes a noun verb and a target. The interfaces share api.sb but do not expose identical tools. Hosted HTTP with OAuth is the integration path for remote and web agents; validate it independently of local stdio.
|
|
56
|
+
|
|
57
|
+
## Optional local MCP over stdio
|
|
58
|
+
|
|
59
|
+
The CLI's queue verbs are available as MCP tools (`queue`, `claim`, `prompt`, `show`, `close`, `renew`, `release`, `worklist`, `versions`, `changes`), with the same compact answers:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
claude mcp add startup-builder -- npx -y startup-builder mcp
|
|
63
|
+
# with a bearer instead of the stored sign-in:
|
|
64
|
+
claude mcp add startup-builder -e SB_TOKEN=… -- npx -y startup-builder mcp
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Authentication works the same as the CLI: `SB_TOKEN`, else the stored sign-in (`startup-builder login`), and for the claimed batch its lease. Leases live in `~/.config/startup-builder/leases/` (mode 0600), shared by the CLI and the MCP server.
|
|
68
|
+
|
|
69
|
+
The Owner's tools are off by default. `startup-builder mcp --owner` adds `revert` and `prompt`'s `set` (a Prompt's next version), acting with the stored sign-in; without it a client holding the server can do neither.
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
claude mcp add startup-builder-owner -- npx -y startup-builder mcp --owner
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Run a worker loop
|
|
76
|
+
|
|
77
|
+
`work` claims the next batch, hands its prompt to an agent, renews the lease while it works, and releases the batch when the agent exits. Unclosed Tasks go back to the queue. Then it claims the next batch.
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
npx startup-builder work --agent claude --for scout # loop until the queue is empty
|
|
81
|
+
npx startup-builder work --agent claude --once # one batch
|
|
82
|
+
npx startup-builder work --agent claude --wait --max-batches 20
|
|
83
|
+
npx startup-builder work --agent claude --max-minutes 45 # a batch's wall-clock cap (default 30)
|
|
84
|
+
npx startup-builder work --agent print # print the prompt; a person or another harness closes the Tasks
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- **`--agent claude`** runs the local Claude Code non-interactively (`claude -p`, stream-json), on the account `claude` is logged into, a Max subscription. Its environment loses API keys, gateway and cloud-provider switches (`ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL`, `ANTHROPIC_CUSTOM_HEADERS`, Bedrock, Vertex, Foundry, AWS credentials), other bearers (`SB_RUNNER_TOKEN`) and your lease directory.
|
|
88
|
+
- The model is `claude-opus-5-5` (`DEFAULT_MODEL` in `src/next/models.ts`); `--model` overrides it.
|
|
89
|
+
- Its tools are scoped: the batch subcommands of this CLI (`close`, `show`, `prompt`, `versions`), files in its own working directory, and web reads. `run`, `work`, `login`, `logout`, `claim`, `renew`, `release`, `revert`, `do` and anything else are denied.
|
|
90
|
+
- It is isolated from the machine: `--restricted` ignores your own Claude Code settings (allow rules, auto mode) and keeps file tools inside its working directory, `--strict-mcp-config` loads none of your MCP servers, and `--permission-mode dontAsk` denies anything not allowed.
|
|
91
|
+
- What it runs is out of its reach. Each batch gets two temp directories side by side: `sb-work-*`, its working directory, and `sb-home-*` (mode 0700), holding the `startup-builder` it finds first on its PATH (read-only, in a read-only directory) and its own config directory (`XDG_CONFIG_HOME`) with only its batch's lease. Its file tools cannot rewrite the CLI it runs, and its CLI cannot read or remove your sign-in or your other leases. Both directories are deleted when the batch ends.
|
|
92
|
+
- The lease token reaches it only as `SB_TOKEN` in its environment, never in the prompt or on a command line.
|
|
93
|
+
|
|
94
|
+
### Isolation: what a batch agent can and cannot do
|
|
95
|
+
|
|
96
|
+
Inside a batch (`SB_BATCH` set) the CLI holds to the batch:
|
|
97
|
+
|
|
98
|
+
- **One API.** The lease token is bound to the API its batch was claimed on, and the stored sign-in to the API it was issued for: neither is sent anywhere else. `--api` is refused, and so is an `SB_API` on another origin.
|
|
99
|
+
- **One directory.** `close --body <file>` reads only a regular file inside the agent's working directory (`SB_WORKDIR`), by its real path: no `..`, no absolute path elsewhere, no symlink out. Anything else is refused before it is read. `--body -` reads stdin.
|
|
100
|
+
- **No lease management.** `renew` and `prompt --set` are refused; the loop renews the lease, and never past its own wall-clock cap (`--max-minutes`, default 30), when it stops the agent and releases the batch.
|
|
101
|
+
|
|
102
|
+
**Accepted risk: the agent holds its own lease token.** It is `SB_TOKEN` in the agent's environment. Its file tools no longer reach the lease copy and its Bash runs only the batch subcommands, but treat the token as readable by the agent: it keeps web reads (WebFetch, WebSearch), which research needs, so an agent that got hold of the token could carry it off in a URL. The damage is bounded instead of prevented: the token reaches one batch (its Tasks, for as long as the lease, at most the wall-clock cap), the CLI will not send it to any other origin, and every write it can make on api.sb is versioned and revertible (`versions`, `revert`).
|
|
103
|
+
- **`--agent codex`** runs `codex exec -` with the prompt on stdin, the same scrubbed environment (including `OPENAI_API_KEY`: codex uses its own `codex login`) and its own config directory. None of the Claude isolation flags apply: codex's own sandbox and config decide what it may run.
|
|
104
|
+
- **Logs:** each batch writes one compact line per event to stdout, and the agent's stream-json to `~/.config/startup-builder/logs/`. Ctrl-C releases the batch before exiting.
|
|
105
|
+
|
|
106
|
+
`run --cloud for:<worker>` hands a Worker's worklist to claude-runner. There is no local `run`: a local agent runs through `work`.
|
|
107
|
+
|
|
108
|
+
On Cloudflare the same loop runs without a laptop. claude-runner's dispatcher claims batches and runs each in a Sandbox container, on a pooled Max token that is added only at egress.
|
|
109
|
+
|
|
110
|
+
With 15 Max accounts, run one `work` per logged-in account (one machine or container each). Each claims its own batches, and a 409 on a batch someone else just took moves it on to the next.
|
|
111
|
+
|
|
112
|
+
## Library
|
|
113
|
+
|
|
114
|
+
`import { Api, Session, work } from 'startup-builder'` uses the same client and work loop as the CLI.
|
|
115
|
+
|
|
116
|
+
### Migrating from 0.2
|
|
117
|
+
|
|
118
|
+
0.3 replaces the Foundation Sprint interface with the api.sb CLI. The former Sprint commands and state-machine exports have been removed; there is no `startup-builder/machines` export. Applications using 0.2's library API must migrate before upgrading. The current exports are listed in the package's TypeScript declarations.
|
|
119
|
+
|
|
120
|
+
The client sends its bearer only to the API's own origin (https, or http on loopback). A URL on another origin is read without it, and a write to one is refused.
|