@aui.io/apollo 0.1.76 → 0.1.80
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 +10 -0
- package/README.md +176 -82
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.d.ts +12 -0
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +75 -8
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js +7 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/package.json +3 -3
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.d.ts +130 -3
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js +23 -2
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.d.ts +14 -2
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.js +19 -2
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.d.ts +10 -0
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js +26 -0
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/validate.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +60 -15
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +157 -24
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +11 -3
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.d.ts +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.js +46 -10
- package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/package.json +1 -1
- package/node_modules/@aui.io/apollo-tui/package.json +2 -2
- package/package.json +18 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Terms of use — @aui.io/apollo
|
|
2
|
+
|
|
3
|
+
Copyright (c) AUI. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Use of this package, and of the Apollo APIs it calls, is governed by the
|
|
6
|
+
AUI API and Developer Package Terms of Service:
|
|
7
|
+
|
|
8
|
+
https://www.aui.io/api-and-developer-package-terms-of-service/
|
|
9
|
+
|
|
10
|
+
By installing or using this package you agree to those terms.
|
package/README.md
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apollo CLI — `@aui.io/apollo`
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Author, test, and operate Apollo agents from your terminal.**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This is the only published Apollo console package — the `apollo-core`, `apollo-cli`,
|
|
8
|
-
and `apollo-tui` workspaces are bundled inside it.
|
|
5
|
+
The Apollo CLI is the operator console for agents built on [Apollo-1](https://www.aui.io),
|
|
6
|
+
AUI's neuro-symbolic foundation model. One install gives you two surfaces:
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
- a scriptable command-line interface — `apollo <command>`, with a `--json` mode for
|
|
9
|
+
scripts and coding agents;
|
|
10
|
+
- a full-screen terminal UI (bare `apollo`) for the author → validate → test → push loop.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
apollo
|
|
15
|
-
|
|
12
|
+
An agent's program is a **typed YAML codebase** you keep in a local checkout, edit in your
|
|
13
|
+
IDE with schema support, validate, test against the live runtime, and push back as new
|
|
14
|
+
versions. The same agents are available in [the Playground](https://apollo.aui.io).
|
|
15
|
+
|
|
16
|
+
📘 Full documentation: **[docs.aui.io/cli](https://docs.aui.io/cli/overview)**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
16
21
|
|
|
17
22
|
| Requirement | Needed for |
|
|
18
23
|
|---|---|
|
|
19
|
-
|
|
|
24
|
+
| An AUI account — the login you use for [the Playground](https://apollo.aui.io) | everything |
|
|
25
|
+
| Node.js 20 or newer | everything |
|
|
20
26
|
| [Bun](https://bun.sh) (optional) | the interactive TUI only |
|
|
21
27
|
|
|
22
28
|
No npm login is required to install. The TUI is built on [OpenTUI](https://opentui.com)
|
|
@@ -24,97 +30,153 @@ and runs on Bun: when launched from Node, `apollo` transparently re-executes the
|
|
|
24
30
|
under `bun` from your `PATH`; without Bun it prints install guidance and the CLI
|
|
25
31
|
remains fully usable.
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
## Install
|
|
28
34
|
|
|
29
35
|
```bash
|
|
30
|
-
|
|
31
|
-
apollo
|
|
36
|
+
npm install -g @aui.io/apollo
|
|
37
|
+
apollo --version
|
|
38
|
+
apollo doctor # checks Node/Bun, the install, your terminal and connectivity
|
|
32
39
|
```
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
Upgrade later with:
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
```bash
|
|
44
|
+
apollo upgrade # install the latest version from npm
|
|
45
|
+
apollo upgrade --check # show the available version only
|
|
46
|
+
```
|
|
39
47
|
|
|
40
48
|
## Quick start
|
|
41
49
|
|
|
42
50
|
```bash
|
|
43
|
-
|
|
44
|
-
apollo
|
|
45
|
-
|
|
51
|
+
# 1. Sign in — opens the browser flow in the Playground
|
|
52
|
+
apollo login
|
|
53
|
+
|
|
54
|
+
# 2. Create a new agent, or import one you already have
|
|
55
|
+
apollo agent create "Returns Assistant" # or: apollo agent import <agent-id>
|
|
56
|
+
cd <the printed checkout directory> # defaults to ~/apollo/<profile>/<env>/<name>-<id>
|
|
46
57
|
|
|
47
|
-
#
|
|
58
|
+
# 3. Edit the program under bundle/src/
|
|
59
|
+
# program.yaml · vocabulary.yaml · situations.yaml · sources.yaml ·
|
|
60
|
+
# derivations.yaml · connections.yaml · capabilities/ · policies/
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
apollo
|
|
51
|
-
|
|
62
|
+
# 4. Validate — deterministic, with every finding located in a file
|
|
63
|
+
apollo validate
|
|
64
|
+
|
|
65
|
+
# 5. Talk to it against the live runtime WITHOUT deploying, and read the trace
|
|
66
|
+
apollo chat "I want to return an order" --local . --trace
|
|
67
|
+
|
|
68
|
+
# 6. Push the change as a new version, then publish it when it is ready
|
|
69
|
+
apollo push -m "Describe the change"
|
|
70
|
+
apollo version list
|
|
71
|
+
apollo version publish <tag>
|
|
52
72
|
```
|
|
53
73
|
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
`apollo status` always tells you where you stand — which profile, organization, project,
|
|
75
|
+
agent and version are active, and which runtime the checkout is pinned to.
|
|
76
|
+
|
|
77
|
+
## How the CLI thinks
|
|
56
78
|
|
|
57
|
-
|
|
79
|
+
Context is **positional**: the nearest `.apollorc` walking up from your current directory
|
|
80
|
+
selects the agent you are working on, so `cd` into a checkout and every command applies
|
|
81
|
+
to that agent.
|
|
58
82
|
|
|
59
83
|
| Layer | What it is | Commands |
|
|
60
84
|
|---|---|---|
|
|
61
|
-
| **Profile** |
|
|
62
|
-
| **
|
|
63
|
-
| **
|
|
64
|
-
| **
|
|
65
|
-
| **
|
|
66
|
-
| **Version** |
|
|
85
|
+
| **Profile** | A named credential slot (`default`, `work`, …) | `profile current / list / use` |
|
|
86
|
+
| **Organization** | The organization your session is scoped to | `org list / use` |
|
|
87
|
+
| **Project** | A container for agents | `project list / use / create` |
|
|
88
|
+
| **Agent** | The program you edit and test | `agent list / create / import / use / unlink` |
|
|
89
|
+
| **Checkout** | A local directory holding one agent: `.apollorc` + `bundle/src/` | `agent create / import` |
|
|
90
|
+
| **Version** | A tagged snapshot of the program: draft → published → archived (publishing an older version is the rollback) | `version list / get / use / create / publish / archive`, `pull` / `push` |
|
|
91
|
+
| **Runtime** | The engine build the checkout is pinned to | `runtime list / show / use` |
|
|
67
92
|
|
|
68
|
-
##
|
|
93
|
+
## Commands
|
|
69
94
|
|
|
70
95
|
```text
|
|
71
|
-
status
|
|
72
|
-
doctor
|
|
73
|
-
upgrade
|
|
74
|
-
login |
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
status [--check] active context (+ service connectivity)
|
|
97
|
+
doctor [--offline] diagnose the setup; exit 2 on problems
|
|
98
|
+
upgrade [version] [--check] [--force] upgrade from npm
|
|
99
|
+
login [--sso | --email <e> [--otp <c>] | --token <jwt>]
|
|
100
|
+
logout
|
|
101
|
+
profile current | list | use <name>
|
|
102
|
+
org list | use <id>
|
|
103
|
+
project list | use <id> | create <name>
|
|
104
|
+
agent list | create <name> [--dir <path>] [--template <id>]
|
|
105
|
+
| import [agent-id] [--tag <tag>] [--dir <path>] [--skills <targets>] [--force]
|
|
106
|
+
| use <target> | path | unlink
|
|
107
|
+
runtime list | show | use [version]
|
|
108
|
+
validate [directory] [--fix] validate the local program (exit 2 on errors)
|
|
109
|
+
diff [--remote] compare local files with the last baseline
|
|
110
|
+
pull [--tag] [--dir] [--force] [--skills cursor,claude,opencode] [--no-skills] [--no-schemas]
|
|
111
|
+
push -m <message> [--dry-run] validate and push local changes as a new version
|
|
112
|
+
version list | get <tag> | use <tag> | create [--from <tag> | --template <id>] [--label] [--notes]
|
|
113
|
+
| publish <tag> | archive <tag>
|
|
114
|
+
chat [text…] [--thread <id>] [--local <dir>] [--var k=v] [--trace]
|
|
115
|
+
thread create | list | get <id> | messages <id> | trace <id>
|
|
116
|
+
regress [--scenarios <codes>] [--judge] [--follow] [--status] [--cancel] [--pull]
|
|
117
|
+
evaluate [directory] [guidelines] [--simulations <n>] [--min-turns] [--max-turns] [--seed] [--world] [--follow]
|
|
118
|
+
advise <question> [--fresh] [--model] [--max-usd]
|
|
119
|
+
build <instruction> [-m] [--version-tag] [--publish] [--model] [--max-usd]
|
|
120
|
+
mockdb provision [--wire] | status | describe | export | keys | wire | clone --from <id> | delete --force
|
|
121
|
+
| collections create | update | list · seed · endpoint create | list | get | update | delete
|
|
122
|
+
| execute --slug <s> [--session] [--body] · session get | reset · rotate mgmt | runtime
|
|
123
|
+
| identities get | set · guide
|
|
124
|
+
vault set <NAME> | list | get <NAME> | rm <NAME> --force
|
|
125
|
+
kb list | status <name> | create <name> | add <hub> <files…> | add-url <hub> <urls…>
|
|
126
|
+
| check | export [name] | delete <name> --force
|
|
127
|
+
shell-init print the shell hook (see below)
|
|
94
128
|
```
|
|
95
129
|
|
|
96
|
-
Run `apollo <command> --help` for the live flag list on your installed version
|
|
130
|
+
Run `apollo <command> --help` for the live flag list on your installed version — the
|
|
131
|
+
command surface is verified against the CLI itself, so `--help` is always the authority.
|
|
97
132
|
|
|
98
133
|
### Global flags (before the subcommand)
|
|
99
134
|
|
|
100
135
|
`--json` (stable envelope for scripts) · `--quiet` · `--verbose` (extra diagnostics,
|
|
101
|
-
including one live line per API request) · `--no-input` · `--yes` ·
|
|
102
|
-
`--
|
|
136
|
+
including one live line per API request) · `--no-input` · `--yes` · `--profile <name>` ·
|
|
137
|
+
`--project <id>` · `--org <id>` · `--runtime-version <version>` · `--timeout <ms>`
|
|
103
138
|
|
|
104
139
|
JSON mode always emits `{"success":true,"data":…}` or
|
|
105
140
|
`{"success":false,"error":{"code","message","suggestion"}}`.
|
|
106
141
|
Exit codes: `0` success · `1` runtime/API failure · `2` validation failure ·
|
|
107
142
|
`3` auth/config failure.
|
|
108
143
|
|
|
144
|
+
## Authentication
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
apollo login # browser sign-in via the Playground (default)
|
|
148
|
+
apollo login --email you@example.com # email one-time code, then prompts for it
|
|
149
|
+
apollo login --token "$ACCESS_TOKEN" # store a pre-issued access token
|
|
150
|
+
apollo logout
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Credentials are stored per **profile** in `~/.apollo/credentials.json` (mode `0600`).
|
|
154
|
+
Use profiles to keep several accounts side by side (`apollo profile use work`, or
|
|
155
|
+
`--profile work` on a single command).
|
|
156
|
+
|
|
157
|
+
**CI and automation:** set `APOLLO_TOKEN` in the environment and run with
|
|
158
|
+
`--json --no-input`; nothing prompts, and every result is a machine-readable envelope.
|
|
159
|
+
|
|
160
|
+
## Working with coding agents
|
|
161
|
+
|
|
162
|
+
The CLI is designed to be driven by coding agents as much as by humans. `apollo agent
|
|
163
|
+
import` / `apollo pull` install the authoring **skill packs** and an `AGENTS.md` into the
|
|
164
|
+
checkout (`--skills cursor,claude,opencode` selects the targets; `--no-skills` skips them),
|
|
165
|
+
so tools such as Cursor, Claude Code and OpenCode can author, validate, test and push an
|
|
166
|
+
agent end to end. `apollo advise "<question>"` asks the server-side authoring advisor about
|
|
167
|
+
your checkout, and `apollo build "<instruction>"` runs one build turn over the pushed agent.
|
|
168
|
+
|
|
109
169
|
## The TUI in one minute
|
|
110
170
|
|
|
111
|
-
|
|
171
|
+
Bare `apollo` on a TTY launches the terminal UI (`apollo tui` / `--tui` force it; any
|
|
172
|
+
subcommand, `--json`, `--no-input` or a non-TTY always runs the CLI; `APOLLO_TUI=0` keeps a
|
|
173
|
+
bare TTY on the CLI). Two primary modes — **Author** (validate, diff, push, pull, versions,
|
|
112
174
|
resources, scenarios) and **Talk** (converse with the running agent).
|
|
113
175
|
|
|
114
176
|
| Input | Action |
|
|
115
177
|
|---|---|
|
|
116
178
|
| `Ctrl+1` / `Ctrl+2` (or `Tab`) | Author / Talk |
|
|
117
|
-
| `Ctrl+K` | Action palette — every operation, with CLI
|
|
179
|
+
| `Ctrl+K` | Action palette — every operation, with its CLI equivalent |
|
|
118
180
|
| `Ctrl+G` | Context switcher — profile / agent / project / org |
|
|
119
181
|
| `Ctrl+J` | Activity drawer — operations, retry, output, live API-request tail |
|
|
120
182
|
| `Esc` | Close overlay / cancel |
|
|
@@ -124,6 +186,26 @@ In Author, single letters run quick actions (`v` validate · `d` diff · `p` pus
|
|
|
124
186
|
text is a copilot instruction to the author backend. In Talk, the composer sends
|
|
125
187
|
everything to the agent verbatim.
|
|
126
188
|
|
|
189
|
+
## Testing an agent
|
|
190
|
+
|
|
191
|
+
| Lane | Command | What it proves |
|
|
192
|
+
|---|---|---|
|
|
193
|
+
| A conversation | `apollo chat "…" --trace` (`--local .` sends the working tree instead of the pushed version) | one turn, with the symbolic **trace** — the reasoning record behind the reply |
|
|
194
|
+
| Scripted regression | `apollo regress --follow` | every scenario in `bundle/build/scenarios.yaml`, said as written, as a real conversation |
|
|
195
|
+
| Simulated callers | `apollo evaluate "<guidelines>" --follow` | improvising simulated callers planned from your guidelines and graded by a judge |
|
|
196
|
+
| Threads | `apollo thread list / messages <id> / trace <id>` | inspect any conversation after the fact |
|
|
197
|
+
|
|
198
|
+
## Data your agent reads
|
|
199
|
+
|
|
200
|
+
- **Mock database** — `apollo mockdb …` provisions a per-agent, seedable mock database
|
|
201
|
+
with declared endpoints, so you can build and test against realistic data before a real
|
|
202
|
+
backend exists. `apollo mockdb guide` writes the complete how-to into your checkout.
|
|
203
|
+
- **Knowledge hubs** — `apollo kb …` creates hubs, uploads documents or scrapes URLs into
|
|
204
|
+
them, and checks the program's `hub:` references before you push.
|
|
205
|
+
- **Secrets** — `apollo vault set <NAME>` stores connection credentials by name; programs
|
|
206
|
+
reference them (`token_env`, `${NAME}`) in `bundle/src/connections.yaml` and never carry
|
|
207
|
+
a value.
|
|
208
|
+
|
|
127
209
|
## Diagnostics
|
|
128
210
|
|
|
129
211
|
```bash
|
|
@@ -132,21 +214,19 @@ apollo status --check # context + per-service reachability/auth
|
|
|
132
214
|
apollo --verbose <cmd> # stream each API call live to stderr
|
|
133
215
|
```
|
|
134
216
|
|
|
135
|
-
`apollo doctor` checks runtimes (Node/Bun), install origin, shell
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
reporting issues.
|
|
217
|
+
`apollo doctor` checks runtimes (Node/Bun), install origin, shell integration,
|
|
218
|
+
`APOLLO_*` overrides, terminal capabilities, credential permissions, token expiry, the
|
|
219
|
+
current checkout, and service reachability — read-only, with the fix attached to every
|
|
220
|
+
finding. Share its output when reporting issues.
|
|
140
221
|
|
|
141
|
-
`--verbose` streams one **redacted** line per API request (auth/token/key/secret
|
|
142
|
-
|
|
143
|
-
activity drawer.
|
|
222
|
+
`--verbose` streams one **redacted** line per API request (auth/token/key/secret values
|
|
223
|
+
never appear) to stderr; the TUI shows the same stream live in its activity drawer.
|
|
144
224
|
|
|
145
225
|
## Files and environment variables
|
|
146
226
|
|
|
147
227
|
```text
|
|
148
228
|
~/.apollo/
|
|
149
|
-
config.json # profile,
|
|
229
|
+
config.json # profile, default projects
|
|
150
230
|
credentials.json # tokens (mode 0600 — the only secret-bearing file)
|
|
151
231
|
checkouts.json # known-checkouts registry
|
|
152
232
|
baselines/… # sync hashes for diff/push
|
|
@@ -155,9 +235,17 @@ activity drawer.
|
|
|
155
235
|
<checkout>/bundle/src/ # the editable program source
|
|
156
236
|
```
|
|
157
237
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
238
|
+
| Variable | Effect |
|
|
239
|
+
|---|---|
|
|
240
|
+
| `APOLLO_PROFILE` | credential profile to use |
|
|
241
|
+
| `APOLLO_TOKEN` | access token for CI (no stored session needed) |
|
|
242
|
+
| `APOLLO_ORG_ID`, `APOLLO_PROJECT_ID` | override the active organization / project |
|
|
243
|
+
| `APOLLO_RUNTIME_VERSION` | override the checkout's pinned runtime |
|
|
244
|
+
| `APOLLO_TIMEOUT_MS` | request timeout |
|
|
245
|
+
| `APOLLO_TUI` | `0` keeps a bare TTY on the CLI |
|
|
246
|
+
|
|
247
|
+
The full table, including per-service URL overrides, is in the
|
|
248
|
+
[configuration reference](https://docs.aui.io/cli/configuration).
|
|
161
249
|
|
|
162
250
|
## Shell integration
|
|
163
251
|
|
|
@@ -165,11 +253,17 @@ The postinstall step offers a small shell hook (or add it yourself with
|
|
|
165
253
|
`eval "$(apollo shell-init)"`): it lets `apollo agent use / import / create` drop your
|
|
166
254
|
shell directly into the checkout directory.
|
|
167
255
|
|
|
168
|
-
## Documentation
|
|
256
|
+
## Documentation and support
|
|
257
|
+
|
|
258
|
+
- [CLI overview](https://docs.aui.io/cli/overview) · [Installation](https://docs.aui.io/cli/installation) · [Commands](https://docs.aui.io/cli/commands) · [Configuration](https://docs.aui.io/cli/configuration) · [Workflows](https://docs.aui.io/cli/workflows)
|
|
259
|
+
- [Apollo-1 documentation](https://docs.aui.io) — the program model, the Messaging API, the Agent Builder API and the SDK
|
|
260
|
+
- [The Playground](https://apollo.aui.io) — the same agents in the browser
|
|
261
|
+
- Questions or issues: run `apollo doctor`, then [contact AUI](https://www.aui.io/contact-us) with its output
|
|
262
|
+
|
|
263
|
+
## Terms of use
|
|
169
264
|
|
|
170
|
-
|
|
265
|
+
Use of this package, and of the Apollo APIs it calls, is governed by the
|
|
266
|
+
**[AUI API and Developer Package Terms of Service](https://www.aui.io/api-and-developer-package-terms-of-service/)**.
|
|
267
|
+
By installing or using `@aui.io/apollo` you agree to those terms.
|
|
171
268
|
|
|
172
|
-
|
|
173
|
-
- [Configuration](https://bitbucket.org/getstuff/runtime-v2/src/main/console/docs/CONFIGURATION.md) — every file and variable the console reads or writes
|
|
174
|
-
- [Architecture](https://bitbucket.org/getstuff/runtime-v2/src/main/console/docs/ARCHITECTURE.md) — services, auth, request handling
|
|
175
|
-
- [Keybindings](https://bitbucket.org/getstuff/runtime-v2/src/main/console/docs/KEYBINDINGS.md) — TUI input reference
|
|
269
|
+
© AUI. All rights reserved.
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
|
+
import type { EvaluationView } from "@aui.io/apollo-core/api/builder-api.js";
|
|
2
3
|
import type { CommandRuntime } from "./runtime.js";
|
|
4
|
+
/** The report, one line per scenario, with the judge's reasons (and trial
|
|
5
|
+
* errors) folded in; an evaluation adds its macro verdict and findings; any
|
|
6
|
+
* annotations come last. A live run renders as a progress line instead —
|
|
7
|
+
* polling is the progress surface. */
|
|
8
|
+
export declare function renderRun(view: EvaluationView): string;
|
|
9
|
+
/** The three grades per trial and per covered case (symbolic-judge-design.md
|
|
10
|
+
* §6, §7): the trace check, the judge, and what the trial counts as. A
|
|
11
|
+
* regression counts both; an evaluation shows the trace but counts the
|
|
12
|
+
* judge alone, and says so in the block's title. Rows settled before the
|
|
13
|
+
* grades existed carry none, and the block stays away. */
|
|
14
|
+
export declare function renderGrades(view: EvaluationView): string[];
|
|
3
15
|
export declare function registerBundles(program: Command, runtime: () => CommandRuntime): void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { access } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { renderValidation } from "@aui.io/apollo-core/bundle/validate.js";
|
|
4
|
+
import { renderBundleAudit, renderValidation } from "@aui.io/apollo-core/bundle/validate.js";
|
|
5
5
|
import { defaultCheckoutDir, listCheckouts, registerCheckout, } from "@aui.io/apollo-core/checkouts/registry.js";
|
|
6
6
|
import { ConfigError, ValidationError } from "@aui.io/apollo-core/errors/index.js";
|
|
7
7
|
import { assertRuntimeAvailable } from "@aui.io/apollo-core/runtime-version/availability.js";
|
|
8
8
|
import { adviseLocalBundle } from "@aui.io/apollo-core/services/advisor.js";
|
|
9
9
|
import { buildAgent } from "@aui.io/apollo-core/services/builds.js";
|
|
10
10
|
import { annotateRun, awaitRun, pullRun, receiptId, resolveRunId, startEvaluation, startRegression, } from "@aui.io/apollo-core/services/runs.js";
|
|
11
|
-
import { importBundle, listVersions, localDiff, pullCheckout, pushBundle, remoteDiff, validateLocalBundle, } from "@aui.io/apollo-core/services/bundles.js";
|
|
11
|
+
import { importBundle, listVersions, localDiff, pullCheckout, pushBundle, remoteDiff, applyBundleFixes, bundleSourceRoot, validateLocalBundle, } from "@aui.io/apollo-core/services/bundles.js";
|
|
12
12
|
import { checkoutSchemasDir, installSchemas, } from "@aui.io/apollo-core/schemas/install.js";
|
|
13
13
|
import { createClients } from "@aui.io/apollo-core/services/clients.js";
|
|
14
14
|
import { agentRuntimeVersion, listAgents, useVersion, } from "@aui.io/apollo-core/services/hierarchy.js";
|
|
@@ -48,7 +48,7 @@ function censusLines(result) {
|
|
|
48
48
|
* errors) folded in; an evaluation adds its macro verdict and findings; any
|
|
49
49
|
* annotations come last. A live run renders as a progress line instead —
|
|
50
50
|
* polling is the progress surface. */
|
|
51
|
-
function renderRun(view) {
|
|
51
|
+
export function renderRun(view) {
|
|
52
52
|
const kind = view.kind;
|
|
53
53
|
if (view.verdict === null && view.result === null && view.macro_verdict == null) {
|
|
54
54
|
const settled = view.trials.filter((trial) => trial.status !== "running" && trial.status !== "queued").length;
|
|
@@ -82,6 +82,7 @@ function renderRun(view) {
|
|
|
82
82
|
const marker = row.verdict === "pass" ? "PASS" : "FAIL";
|
|
83
83
|
lines.push(` ${marker} ${row.code} — ${row.passed}/${row.k} trial(s)${row.verdict !== "pass" && reasons ? ` — ${reasons}` : ""}`);
|
|
84
84
|
}
|
|
85
|
+
lines.push(...renderGrades(view));
|
|
85
86
|
if (view.annotations?.length) {
|
|
86
87
|
lines.push("annotations:");
|
|
87
88
|
for (const note of view.annotations) {
|
|
@@ -94,6 +95,33 @@ function renderRun(view) {
|
|
|
94
95
|
lines.push(`${kind} ${view.evaluation_id}`);
|
|
95
96
|
return lines.join("\n");
|
|
96
97
|
}
|
|
98
|
+
/** The three grades per trial and per covered case (symbolic-judge-design.md
|
|
99
|
+
* §6, §7): the trace check, the judge, and what the trial counts as. A
|
|
100
|
+
* regression counts both; an evaluation shows the trace but counts the
|
|
101
|
+
* judge alone, and says so in the block's title. Rows settled before the
|
|
102
|
+
* grades existed carry none, and the block stays away. */
|
|
103
|
+
export function renderGrades(view) {
|
|
104
|
+
const graded = view.trials.filter((trial) => trial.final != null);
|
|
105
|
+
if (graded.length === 0)
|
|
106
|
+
return [];
|
|
107
|
+
const trace = view.kind === "evaluation" ? "trace observed, not counted" : "trace";
|
|
108
|
+
const lines = [`grades (${trace} · judge · final)`];
|
|
109
|
+
const perCode = new Map();
|
|
110
|
+
for (const trial of graded) {
|
|
111
|
+
perCode.set(trial.scenario_code, (perCode.get(trial.scenario_code) ?? 0) + 1);
|
|
112
|
+
}
|
|
113
|
+
for (const trial of graded) {
|
|
114
|
+
const label = (perCode.get(trial.scenario_code) ?? 0) > 1
|
|
115
|
+
? `${trial.scenario_code}#${trial.iteration}`
|
|
116
|
+
: trial.scenario_code;
|
|
117
|
+
lines.push(` ${label}: ${trial.symbolic ?? "not_validated"} · ${trial.neural ?? "not_validated"} · ${trial.final ?? "not_validated"}`);
|
|
118
|
+
for (const [caseId, grades] of Object.entries(trial.cases ?? {})) {
|
|
119
|
+
const reasons = (grades.reasons ?? []).join("; ");
|
|
120
|
+
lines.push(` ${caseId}: ${grades.symbolic} · ${grades.neural} · ${grades.final}${reasons ? ` — ${reasons}` : ""}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return lines;
|
|
124
|
+
}
|
|
97
125
|
/** The read/act half both lanes share: `--status`, `--cancel`, `--pull` and
|
|
98
126
|
* `--annotate` name the checkout's last run of that lane (or `--id`) and
|
|
99
127
|
* never start one. Returns false when nothing was asked. */
|
|
@@ -229,20 +257,53 @@ export function registerBundles(program, runtime) {
|
|
|
229
257
|
.command("validate")
|
|
230
258
|
.description("Validate the local agent program via builder-api — the verdict plus the orphan and era censuses")
|
|
231
259
|
.argument("[directory]")
|
|
232
|
-
.
|
|
260
|
+
.option("--fix", "apply the build-bundle audit's mechanical repairs (files moved home, retired keys respelled, case prose lifted onto its need), then report what remains")
|
|
261
|
+
.action(async (directory, options) => {
|
|
233
262
|
const run = runtime();
|
|
234
263
|
const clients = createClients(run.context);
|
|
235
264
|
await assertRuntimeAvailable(run.context, clients);
|
|
236
|
-
const
|
|
265
|
+
const root = directory
|
|
237
266
|
? path.join(path.resolve(directory), "bundle", "src")
|
|
238
|
-
:
|
|
267
|
+
: bundleSourceRoot(run.context);
|
|
268
|
+
let result = await validateLocalBundle(run.context, clients.builder, root, {
|
|
269
|
+
fix: options.fix === true,
|
|
270
|
+
});
|
|
271
|
+
// With --fix the repairs are written HERE — builder-api planned them
|
|
272
|
+
// over a copy — and the tree is validated again, so the verdict below
|
|
273
|
+
// is the one the checkout now has. The applied list rides the result.
|
|
274
|
+
const applied = options.fix ? (result.fixes ?? []) : [];
|
|
275
|
+
if (applied.length > 0) {
|
|
276
|
+
await applyBundleFixes(applied, root);
|
|
277
|
+
result = await validateLocalBundle(run.context, clients.builder, root);
|
|
278
|
+
}
|
|
279
|
+
const appliedLines = options.fix
|
|
280
|
+
? applied.length > 0
|
|
281
|
+
? [
|
|
282
|
+
`Applied ${String(applied.length)} repair(s):`,
|
|
283
|
+
...applied.map((f) => ` ${f.op} ${f.path} — ${f.why}`),
|
|
284
|
+
"",
|
|
285
|
+
]
|
|
286
|
+
: ["Nothing mechanical to fix.", ""]
|
|
287
|
+
: [];
|
|
288
|
+
result = { ...result, ...(options.fix ? { applied } : {}) };
|
|
239
289
|
// Errors AND warnings, both paths. The success path used to print only
|
|
240
290
|
// "Program is valid." — every advisory finding silently dropped, which
|
|
241
291
|
// is the exact blindness a post-change validate exists to remove.
|
|
242
292
|
if (!result.valid) {
|
|
243
|
-
throw new ValidationError(renderValidation(result));
|
|
293
|
+
throw new ValidationError([...appliedLines, renderValidation(result), ...renderBundleAudit(result.bundle)].join("\n"));
|
|
244
294
|
}
|
|
245
|
-
|
|
295
|
+
// Valid is not pushable: the audit's existence errors (no brief, no
|
|
296
|
+
// needs, no cases) let a validate through and refuse a push — say so
|
|
297
|
+
// here, where the author looks before pushing.
|
|
298
|
+
run.output.result(result, () => [
|
|
299
|
+
...appliedLines,
|
|
300
|
+
renderValidation(result),
|
|
301
|
+
...renderBundleAudit(result.bundle),
|
|
302
|
+
...(result.pushable
|
|
303
|
+
? []
|
|
304
|
+
: [`Not pushable — ${String(result.bundle.errors.length)} build-bundle error(s) refuse a push.`]),
|
|
305
|
+
...censusLines(result),
|
|
306
|
+
].join("\n"));
|
|
246
307
|
});
|
|
247
308
|
withRunFlags(program
|
|
248
309
|
.command("regress")
|
|
@@ -496,6 +557,9 @@ export function registerBundles(program, runtime) {
|
|
|
496
557
|
result.build
|
|
497
558
|
? `Build bundle v${result.build.version}: ${result.build.written.length} file(s) into bundle/build.`
|
|
498
559
|
: "",
|
|
560
|
+
result.certificate
|
|
561
|
+
? `Certificate: ${result.certificate.revision ?? result.certificate.version} (${result.certificate.run}), ${result.certificate.cases.length} case(s) — bundle/build/certification.yaml.`
|
|
562
|
+
: "",
|
|
499
563
|
result.schemas ? `Schemas: ${result.schemas.length}.` : "",
|
|
500
564
|
result.skills ? `Skills: ${result.skills.length}.` : "",
|
|
501
565
|
result.removedSkills
|
|
@@ -556,6 +620,9 @@ export function registerBundles(program, runtime) {
|
|
|
556
620
|
"Validated via builder-api — the runtime validate lane was unreachable.",
|
|
557
621
|
]
|
|
558
622
|
: []),
|
|
623
|
+
// The audit's warnings and advisories ride the push report; its
|
|
624
|
+
// errors already refused above.
|
|
625
|
+
...renderBundleAudit(result.bundle),
|
|
559
626
|
renderDiff(combined),
|
|
560
627
|
].join("\n");
|
|
561
628
|
});
|