@atypica/foundry 0.0.0-stage → 0.1.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/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +129 -2
- package/dist/index.d.ts +1300 -0
- package/dist/index.js +7129 -0
- package/dist/index.js.map +1 -0
- package/package.json +70 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@atypica/foundry` are documented here.
|
|
4
|
+
|
|
5
|
+
## 0.1.0 — 2026-12-05
|
|
6
|
+
|
|
7
|
+
Initial public release.
|
|
8
|
+
|
|
9
|
+
- Provider-agnostic agents, model tiers and fallback.
|
|
10
|
+
- Declarative workflows with structured artifacts, conditions, loops and
|
|
11
|
+
parallel groups.
|
|
12
|
+
- Embedded, client and isolated runtime modes.
|
|
13
|
+
- Harness-run command gates and fail-closed verification nodes.
|
|
14
|
+
- Repository-state artifacts and budgets with usage telemetry.
|
|
15
|
+
- Reference architect, engineer, reviewer and verifier agents.
|
|
16
|
+
|
|
17
|
+
See the [roadmap](docs/roadmap.md) for what is intentionally deferred.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Foundry contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,130 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @atypica/foundry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Fundamental primitives for defining and running LLM agents on top of the
|
|
4
|
+
[OpenCode SDK](https://opencode.ai/docs/sdk/).
|
|
5
|
+
|
|
6
|
+
The shared core of the foundry software factory: provider-agnostic **agents**, a
|
|
7
|
+
**model policy** that maps capability tiers to concrete provider/models, a
|
|
8
|
+
declarative **workflow** layer (conditions, loops, and parallel groups), and a
|
|
9
|
+
thin runtime that boots an embedded OpenCode host and streams results. It is the
|
|
10
|
+
common foundation reused by every agent we build — and it ships a reference
|
|
11
|
+
Architect/Engineer/Reviewer library as a working example.
|
|
12
|
+
|
|
13
|
+
> **Status: pre-1.0.** The core APIs are usable, but may change before 1.0.
|
|
14
|
+
> See the
|
|
15
|
+
> [changelog](https://github.com/atypica-uk/codename-foundry/blob/main/CHANGELOG.md)
|
|
16
|
+
> and
|
|
17
|
+
> [roadmap](https://github.com/atypica-uk/codename-foundry/blob/main/docs/roadmap.md).
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install @atypica/foundry @opencode/sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Requires Node ≥ 24 and a provider supported by OpenCode. The package is ESM-only.
|
|
26
|
+
Client mode also needs `@opencode/client`. Isolated mode needs a Linux host with
|
|
27
|
+
Docker 20.10+ (the tested path); `containerCommand` can point at Podman.
|
|
28
|
+
Docker Desktop and Podman VMs on macOS cannot bridge the container-created Unix
|
|
29
|
+
sockets (see the [runtime guide](docs/guide/runtime.md#isolated-executor)).
|
|
30
|
+
|
|
31
|
+
## Define and run an agent
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { createFoundry, defineAgent, defineModelPolicy } from "@atypica/foundry";
|
|
35
|
+
|
|
36
|
+
const modelPolicy = defineModelPolicy({
|
|
37
|
+
tiers: {
|
|
38
|
+
fast: { providerID: "ollama", modelID: "llama3.2" },
|
|
39
|
+
balanced: { providerID: "anthropic", modelID: "claude-sonnet-4" },
|
|
40
|
+
powerful: { providerID: "openrouter", modelID: "some/model" },
|
|
41
|
+
},
|
|
42
|
+
defaultTier: "balanced",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const agent = defineAgent({
|
|
46
|
+
id: "assistant",
|
|
47
|
+
description: "A helpful assistant",
|
|
48
|
+
system: "You are a helpful assistant.",
|
|
49
|
+
model: { tier: "balanced" },
|
|
50
|
+
tools: ["read", "grep", "glob"],
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const foundry = await createFoundry({ modelPolicy, agents: [agent] });
|
|
54
|
+
const result = await foundry.run("assistant", { prompt: "Say hello." });
|
|
55
|
+
console.log(result.output);
|
|
56
|
+
await foundry.close();
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
- [Getting started](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/getting-started.md)
|
|
62
|
+
- [Local models with Ollama](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/local-models.md)
|
|
63
|
+
- [Agents](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/agents.md)
|
|
64
|
+
- [Workflows](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/workflows.md)
|
|
65
|
+
- [Control flow](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/control-flow.md)
|
|
66
|
+
- [Runtime](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/runtime.md)
|
|
67
|
+
- [Agent library](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/agent-library.md)
|
|
68
|
+
- [API reference](https://github.com/atypica-uk/codename-foundry/blob/main/docs/api/README.md)
|
|
69
|
+
|
|
70
|
+
## Security
|
|
71
|
+
|
|
72
|
+
Embedded and client modes run agents with tool access on the host they use —
|
|
73
|
+
your machine in embedded mode, the remote server's in client mode — and neither
|
|
74
|
+
is a sandbox. For an untrusted repository, `runtime: { mode: "isolated" }` runs
|
|
75
|
+
the agent in a credential-free container with no network, a proxy sidecar holding
|
|
76
|
+
provider keys, repository configuration and instructions suppressed, and
|
|
77
|
+
tool/path guards; see
|
|
78
|
+
[Runtime](https://github.com/atypica-uk/codename-foundry/blob/main/docs/guide/runtime.md#isolated-executor).
|
|
79
|
+
It is still not a complete sandbox: the workspace is writable (including any
|
|
80
|
+
secrets in it), shell is arbitrary inside the container, the local server API and
|
|
81
|
+
proxy token are reachable, and budgets are operational guardrails rather than a
|
|
82
|
+
security boundary. Per-turn capabilities are shipped. Read
|
|
83
|
+
[SECURITY.md](https://github.com/atypica-uk/codename-foundry/blob/main/SECURITY.md)
|
|
84
|
+
and the
|
|
85
|
+
[threat model](https://github.com/atypica-uk/codename-foundry/blob/main/docs/security/threat-model.md)
|
|
86
|
+
before pointing it at a repository you do not control.
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
mise install # node + pnpm
|
|
92
|
+
mise run install # dependencies
|
|
93
|
+
mise run test # unit tests (offline, no secrets)
|
|
94
|
+
mise run typecheck
|
|
95
|
+
mise run build
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Integration tests (opt-in, calls a real model)
|
|
99
|
+
|
|
100
|
+
`test/integration/` boots the real embedded OpenCode host and runs an agent
|
|
101
|
+
against OpenRouter (`deepseek/deepseek-v4.1-flash`). It is **excluded from
|
|
102
|
+
`mise run test`** and only runs when opted in with a key available:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
mise run test-integration # sets FOUNDRY_INTEGRATION=1
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The key is resolved in this order:
|
|
109
|
+
|
|
110
|
+
1. `OPENROUTER_API_KEY` environment variable
|
|
111
|
+
2. `.env` in the repo root (git-ignored — copy `.env.example`)
|
|
112
|
+
3. `~/.local/share/opencode/auth.json` (your existing OpenCode login)
|
|
113
|
+
|
|
114
|
+
Without a key (or without `FOUNDRY_INTEGRATION=1`) the tests skip cleanly. They
|
|
115
|
+
are opt-in and are **not** part of the default CI; a deployment that wants them
|
|
116
|
+
should provide `OPENROUTER_API_KEY` through its own secret store. Keys are never
|
|
117
|
+
logged or committed.
|
|
118
|
+
|
|
119
|
+
## Contributing
|
|
120
|
+
|
|
121
|
+
See
|
|
122
|
+
[CONTRIBUTING.md](https://github.com/atypica-uk/codename-foundry/blob/main/CONTRIBUTING.md)
|
|
123
|
+
for local setup, the checks a change must pass, and the PR flow. Security reports
|
|
124
|
+
should follow
|
|
125
|
+
[SECURITY.md](https://github.com/atypica-uk/codename-foundry/blob/main/SECURITY.md).
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT — see
|
|
130
|
+
[LICENSE](https://github.com/atypica-uk/codename-foundry/blob/main/LICENSE).
|