@ancha-labs/cli 0.1.5 → 0.1.6
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/lib/ancha.mjs +485 -258
- package/lib/assets/docs/cloud.md +3 -3
- package/lib/assets/docs/run.md +7 -1
- package/lib/assets/harbor/companion.mjs +257 -195
- package/lib/assets/ui/app.js +28 -18
- package/lib/assets/ui/style.css +2 -0
- package/lib/mcp-entry.mjs +74 -12
- package/lib/worker.mjs +332 -210
- package/lib/world-server.mjs +257 -195
- package/package.json +1 -1
package/lib/assets/docs/cloud.md
CHANGED
|
@@ -12,17 +12,17 @@ The first line of every `ancha run` says where its worlds run and what the agent
|
|
|
12
12
|
|
|
13
13
|
## What runs where
|
|
14
14
|
|
|
15
|
-
- `ancha run`, `ancha doctor`, `ancha world up`, `ancha env`, `ancha sandbox` and `ancha replay` create their worlds on this computer, also when you're logged in. `--server-url`, `server.url` in `ancha.yaml` or `ANCHA_SERVER_URL` put them on that server instead, for example the hosted world server `https://app.ancha.io/t/<workspace>` (your agent still runs here; its tool URLs point at `…/t/<workspace>/e/<environment>/<tool>/…`). `--on cloud`
|
|
15
|
+
- `ancha run`, `ancha doctor`, `ancha world up`, `ancha env`, `ancha sandbox` and `ancha replay` create their worlds on this computer, also when you're logged in. `--server-url`, `server.url` in `ancha.yaml` or `ANCHA_SERVER_URL` put them on that server instead, for example the hosted world server `https://app.ancha.io/t/<workspace>` (your agent still runs here; its tool URLs point at `…/t/<workspace>/e/<environment>/<tool>/…`). Local scene/test import through `--on cloud` is currently rejected before remote work because its world and grading semantics cannot be preserved.
|
|
16
16
|
- `ancha agent` (except `agent detect`), `ancha world list|show|create|update|archive`, `ancha test`, `ancha runs`, `ancha attempt` and `ancha explain <play_…>` run in the hosted workspace: they list and change the same agents, worlds, tests and runs as the console, and every JSON object they print names its `workspace`. `--local` keeps them on this project's `.ancha/`. `ancha playground` stays on this computer.
|
|
17
17
|
- `ancha agent add|update --cwd <dir>` uploads the folder first: the files git tracks or would add, without `.anchaignore` patterns, hidden files, dependencies or credential-like files, at most 200 MB.
|
|
18
18
|
|
|
19
19
|
## Run the agent in the workspace
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
ancha
|
|
22
|
+
ancha runs start --agent <id> --world <saved-world> --test task.yaml --json
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
This
|
|
25
|
+
This runs an already connected agent against an explicitly selected saved world. `task.yaml` uses `version: 2`, `id`, `start.task`, and optional `attempts`, real-time `timeout` and supported native/process checks. Scene seeds, people, world rules, `until`, `deadline`, selective `pass` lists and judge checks are rejected by file/field with `CONFIG_INVALID` (exit 2), rather than discarded. `ancha run --on cloud` also rejects local scene/test imports and unsupported options before network requests, uploads or registration. Run full scenes/tests locally or in CI. The workspace's console owns accepted managed runs, so a dropped connection does not stop them; `ancha runs show <id>` and `ancha explain <id> --json` resume inspection.
|
|
26
26
|
|
|
27
27
|
## Results in the workspace
|
|
28
28
|
|
package/lib/assets/docs/run.md
CHANGED
|
@@ -6,6 +6,8 @@ The first line says where the worlds run: locally, or on the hosted workspace yo
|
|
|
6
6
|
|
|
7
7
|
## What the agent gets
|
|
8
8
|
|
|
9
|
+
New run summaries use `verdictVersion: 2`. Each scene has `counts.requested`, `completed`, `valid`, `passed`, `invalid` and `skipped`. The pass-rate denominator is the requested count, including invalid, skipped and unfinished trials. “Pass all k” requires all k requested trials to complete validly and pass. HTML and the console show invalid attempts separately. Older reports stay readable; comparison with an old baseline lacking these counts exits 2 and asks you to rerun the reference and save a fresh baseline.
|
|
10
|
+
|
|
9
11
|
Each trial gets the tools' URLs and fake credentials (`ancha docs integrations`), `ANCHA_TASK`, `ANCHA_ATTEMPT_ID`, `ANCHA_STATE_DIR` (keep memory there, so trials stay independent), `ANCHA_EVENTS_URL`, `ANCHA_EVENTS_TOKEN` and `ANCHA_DONE_URL` for agents that receive events or finish explicitly, and `ANCHA_AGENT_PORT` for HTTP agents. No SDK is installed and no paid AI call is made for you.
|
|
10
12
|
|
|
11
13
|
By default the agent runs as a process on this computer. It is not sealed: it can reach this computer's network. Its environment is limited to a base set from this shell (`PATH`, `HOME`, `USER`, `LOGNAME`, `SHELL`, `LANG`, `LC_*`, `TERM`, `TMPDIR`, `TZ`, `NODE_EXTRA_CA_CERTS`, `SSL_CERT_FILE`, `VIRTUAL_ENV`, `CONDA_PREFIX`, `PYTHONPATH`) plus Ancha's and the tools' variables. Real credentials in your shell, such as `GITHUB_TOKEN` or `DD_API_KEY`, never reach it unless you name them:
|
|
@@ -22,9 +24,11 @@ agent:
|
|
|
22
24
|
|
|
23
25
|
By default the agent runs once per attempt with the task in `ANCHA_TASK`. When the world has people who reply later, set `agent.input: per_event`: Ancha runs the command once per event addressed to the agent (a DM, a mention, a thread it is in), with the event in `ANCHA_EVENT_JSON` and a one-line summary in `ANCHA_TASK`, one conversation at a time. Simulated time skips ahead while nobody is working, and the attempt ends when the world is quiet with nothing scheduled before the deadline.
|
|
24
26
|
|
|
27
|
+
`per_event` is supported by the local scene runner, including local container execution. Managed/Harbor execution rejects `per_event` and `events` with `CONFIG_INVALID` (exit 2); its driver does not implement per-event invocations. It never substitutes a one-shot command.
|
|
28
|
+
|
|
25
29
|
## Where the agent runs
|
|
26
30
|
|
|
27
|
-
`--on local` starts it as a process on this computer
|
|
31
|
+
`--on local` starts it as a process on this computer; `--on docker` uses the sealed container below (never a process instead). Without `--on`, `ancha.yaml` decides. `--on cloud` currently rejects local scene and version 2 test imports with `CONFIG_INVALID` (exit 2): their world data, timing and checks cannot be preserved by that adapter. It names unsupported files, fields and options before any upload or registration. Run these tests locally or in CI. Explicit saved-world tasks use `ancha runs start`; that is a separate managed-task contract, not equivalent scene import.
|
|
28
32
|
|
|
29
33
|
`--upload` (or `ANCHA_UPLOAD=1`) sends the finished run to your workspace, where the console shows it; `ancha runs upload <run id | latest>` does that later. A failed upload is a warning unless `--upload-required`. `ancha docs cloud` says what is sent and what is redacted.
|
|
30
34
|
|
|
@@ -84,3 +88,5 @@ ancha world down --env <envId>
|
|
|
84
88
|
`ancha agent add` saves a reusable agent profile that the local console (`ancha ui`) and the CLI share, for scenarios and playgrounds: `ancha agent verify ID --scene KEY`, `ancha agent run ID --scene KEY -n 1`, `ancha explain RUN_ID`, `ancha agent rerun RUN_ID`, and `ancha test save RUN_ID --name NAME` for a reusable test. See `ancha docs playgrounds` for running saved agents in containers with plain-language tasks.
|
|
85
89
|
|
|
86
90
|
Native SDK methods may go beyond what a tool replica implements: check `ancha twins coverage <tool>` and `ancha connect <tool>`. Keep provider keys out of scenes and saved configuration.
|
|
91
|
+
|
|
92
|
+
For managed `runs start`, invalid harness captures exit 3, failed/skipped/incomplete grading exits 1, and a stopped run exits 2. The grade line uses requested attempts and names invalid/skipped counts.
|