@ancha-labs/cli 0.1.3 → 0.1.4
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/THIRD_PARTY_NOTICES.md +1 -1
- package/lib/ancha.mjs +14892 -12603
- package/lib/assets/SKILL.md +4 -2
- package/lib/assets/agents-section.md +1 -1
- package/lib/assets/docs/cloud.md +1 -1
- package/lib/assets/docs/explain.md +3 -3
- package/lib/assets/docs/run.md +3 -3
- package/lib/assets/docs/scenes.md +15 -1
- package/lib/assets/docs/tools.md +1 -0
- package/lib/assets/harbor/companion.mjs +10208 -9128
- package/lib/assets/templates/starter/oracle.mjs +34 -12
- package/lib/assets/templates/starter/tasks.json +21 -1
- package/lib/assets/ui/app.js +142 -78
- package/lib/mcp-entry.mjs +10193 -9116
- package/lib/worker.mjs +10585 -9384
- package/lib/world-server.mjs +10012 -8938
- package/package.json +1 -1
package/lib/assets/SKILL.md
CHANGED
|
@@ -23,7 +23,7 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
|
|
|
23
23
|
6. Fix the agent's code.
|
|
24
24
|
7. `ancha run --compare before --json` proves the fix: exit 0 means every check passes and nothing regressed.
|
|
25
25
|
|
|
26
|
-
The starter scene only proves that the agent reaches each tool.
|
|
26
|
+
The starter scene only proves that the agent reaches each tool. For the agent's real job, `ancha test new "<the test in one sentence>" --json` drafts a test with people for the project's world (`ancha init --intent "<company and scenario>"` makes the world and a first test). Review its checks before you run it. To write a seed yourself, `ancha twins seed <tool> --json` prints the tool's fields, an example that validates as written, and the checks a scene can make on it. More: `ancha docs scenes`.
|
|
27
27
|
|
|
28
28
|
## The rule
|
|
29
29
|
|
|
@@ -43,7 +43,9 @@ Each trial gives the agent its tools as environment variables, with fake credent
|
|
|
43
43
|
|
|
44
44
|
`ancha connect <tool> --lang ts|py` prints the SDK settings. `ancha twins coverage <tool>` lists the endpoints each replica implements.
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Google clients (`googleapis`, `@googleapis/*`) take the replica's URL in each call's options: `drive.files.list(params, { rootUrl: process.env.GOOGLE_DRIVE_API_URL + '/' })`. A `rootUrl` set on the client keeps only the host; Ancha still routes those calls by their token, but the client sends file uploads to www.googleapis.com.
|
|
47
|
+
|
|
48
|
+
`ancha run` starts the agent on this computer. It has this computer's network, and an environment limited to Ancha's variables, the tools' variables and the names allowed in `agent.pass_env` in `ancha.yaml` (or `--pass-env NAME`). The agent's own model key is one of those names: `agent.pass_env: [OPENROUTER_API_KEY]` passes it from this shell, and `agent.env` sets fixed values, such as the path of a key file. Without it, an agent that calls a model stops at its first call. For a sealed run, set `agent.execution: { mode: container, image: node:24-slim }` in `ancha.yaml`; it needs Docker.
|
|
47
49
|
|
|
48
50
|
## Hosted workspace
|
|
49
51
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
6. Fix the agent's code.
|
|
10
10
|
7. `ancha run --compare before --json` proves the fix: exit 0 means every check passes and nothing regressed.
|
|
11
11
|
|
|
12
|
-
The starter scene only proves that the agent reaches each tool.
|
|
12
|
+
The starter scene only proves that the agent reaches each tool. For the agent's real job, `ancha test new "<the test in one sentence>" --json` drafts a test with people for the project's world (`ancha init --intent "<company and scenario>"` makes the world and a first test). Review its checks before you run it. To write a seed yourself, `ancha twins seed <tool> --json` prints the tool's fields, an example that validates as written, and the checks a scene can make on it. More: `ancha docs scenes`.
|
|
13
13
|
|
|
14
14
|
Fix the agent, not `ancha.yaml`, the scenes or their checks. The exception is a check that is wrong for the real API, such as a method the official SDK never sends. Then don't quietly edit it: tell the user, show the evidence (the call from `ancha explain`, the vendor's documentation), and change it only with their agreement.
|
|
15
15
|
|
package/lib/assets/docs/cloud.md
CHANGED
|
@@ -8,7 +8,7 @@ A hosted workspace at https://app.ancha.io runs your worlds on a machine of your
|
|
|
8
8
|
|
|
9
9
|
`ancha whoami --json` shows the workspace and where that choice came from (`--server-url`, `server.url` in `ancha.yaml`, `ANCHA_SERVER_URL`, or the saved login), and in `worlds` where `ancha run` puts its worlds. `ancha whoami --verify` also asks the server whether it accepts the key. `ancha logout` forgets the saved login. `--local` keeps a command's worlds on this computer.
|
|
10
10
|
|
|
11
|
-
The first line of every `ancha run` says where its worlds run
|
|
11
|
+
The first line of every `ancha run` says where its worlds run and what the agent can reach: `running locally; agent not sealed (network open, 7 variables from this shell)`, or `running on hosted https://app.ancha.io/t/<workspace> (from ANCHA_SERVER_URL; --local to run here); …` when a server was asked for. After a login, the last line says how to send the run to your workspace: `ancha runs upload <run id> sends this run to https://app.ancha.io/t/<workspace>`. Its JSON events and summary carry `workspace` (that URL, or `local:<project path>`) and `target` (`local` for a process on this computer, `docker` for a container).
|
|
12
12
|
|
|
13
13
|
## What runs where
|
|
14
14
|
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
It reports, in order:
|
|
6
6
|
|
|
7
7
|
- harness issues: a part of Ancha that failed, which makes the trial invalid rather than a failure of the agent;
|
|
8
|
-
- agents that crashed or timed out, with the end of `agent.log
|
|
8
|
+
- agents that crashed or timed out, with the end of `agent.log`, and, when it names a variable this shell has but the agent didn't get (`missing OPENROUTER_API_KEY`), the `--pass-env` that passes it;
|
|
9
9
|
- each failed check: what was expected, what happened, and the agent's calls and world events behind it. For message and people checks it also shows what the world recorded: the messages that came closest, decisions and what people learned (each at its simulated time, such as `+3m`), the conversation around them, and what each person the check names knew and decided;
|
|
10
10
|
- coverage gaps, with or without `--strict`: "the agent called POST /api/chat.scheduleMessage, which the slack twin doesn't implement; it answered unknown_method". The agent's call may be right; check `ancha twins coverage <tool>` before changing it;
|
|
11
|
-
- when the agent ran on this computer, how many of this shell's variables were withheld from it. If it needs one, such as a provider key, pass it with `--pass-env NAME` or `agent.pass_env`.
|
|
11
|
+
- when the agent ran on this computer and no crash named a variable, how many of this shell's variables were withheld from it. If it needs one, such as a provider key, pass it with `--pass-env NAME` or `agent.pass_env`.
|
|
12
12
|
|
|
13
|
-
JSON keys: `runId`, `agentIssues`, `harnessIssues`, `failures` (each with `check`, `expected`, `actual`, `explanation`, `traceExcerpt`, and when the world recorded them `kind`, `evidence` (each with `type`, `simAt`, `at`, `from`, `to`, `where`, `excerpt`), `conversation` and `people`), `coverageGaps` (each with `service`, `method`, `path`, `count`, the twin's `status` and `error`, and a `hint`), `agentEnvironment` (`target`, and for this computer `inherited` and `withheld
|
|
13
|
+
JSON keys: `runId`, `agentIssues` (each with `exit`, `exitCode`, `log`, `logTail`, and a `hint` when its log names a withheld variable), `harnessIssues`, `failures` (each with `check`, `expected`, `actual`, `explanation`, `traceExcerpt`, and when the world recorded them `kind`, `evidence` (each with `type`, `simAt`, `at`, `from`, `to`, `where`, `excerpt`), `conversation` and `people`), `coverageGaps` (each with `service`, `method`, `path`, `count`, the twin's `status` and `error`, and a `hint`), `agentEnvironment` (`target`, and for this computer `inherited`, `withheld` and `withheldInLogs`, the withheld variables a crashed agent's log names), and `gradingWarnings` when a check produced one.
|
|
14
14
|
|
|
15
15
|
A clean process exit doesn't mean the task passed, and an invalid trial isn't an agent failure. The reference companions (`oracle.mjs`, `null.mjs`) prove the scene and harness behave; they aren't evidence that an AI agent solved the task.
|
|
16
16
|
|
package/lib/assets/docs/run.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`ancha run --json` loads `ancha.yaml` and runs the configured agent against every scene its `scenes:` globs match, `trials` times each, in fresh worlds. Pass scene files to run only those. `--agent "<command>"` overrides `agent.command`; `-n 1 --parallel 1` runs one diagnostic trial; `--out <dir>` chooses where results go (use the same `--out` for `explain`, `report` and `compare`). Paths are relative to the directory you run `ancha` from.
|
|
4
4
|
|
|
5
|
-
The first line says where the worlds run: locally, or on the hosted workspace you signed in to (`--local` keeps them on this computer). NDJSON starts with `run_started`, which carries `workspace` and `target`, and ends with `run_finished` after a completed run. The agent's exit code and the checks are independent: a clean exit with failed checks is a failure. Exits: 0 success; 1 failed checks, threshold or regression; 2 usage, config, scene or authentication error; 3 infrastructure or a trial the harness couldn't complete; 4 an unimplemented endpoint under `--strict`. A harness failure takes precedence over thresholds and strict gaps.
|
|
5
|
+
The first line says where the worlds run: locally, or on the hosted workspace you signed in to (`--local` keeps them on this computer). NDJSON starts with `run_started`, which carries `workspace` and `target`, and ends with `run_finished` after a completed run. Without `--json`, each finished trial prints one line, such as `trial 2 ✗ 3m02s · 3 checks failed`, before the summary. The agent's exit code and the checks are independent: a clean exit with failed checks is a failure. Exits: 0 success; 1 failed checks, threshold or regression; 2 usage, config, scene or authentication error; 3 infrastructure or a trial the harness couldn't complete; 4 an unimplemented endpoint under `--strict`. A harness failure takes precedence over thresholds and strict gaps.
|
|
6
6
|
|
|
7
7
|
## What the agent gets
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ agent:
|
|
|
16
16
|
pass_env: [OPENAI_API_KEY] # names only; values come from this shell at run time
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
`--pass-env NAME` (repeatable) adds names for one run. `--inherit-env` passes the whole shell environment, as before 0.1.2, and prints a warning. The run
|
|
19
|
+
`--pass-env NAME` (repeatable) adds names for one run. `--inherit-env` passes the whole shell environment, as before 0.1.2, and prints a warning. The run's first line says what the agent got: `running locally; agent not sealed (network open, <n> variables from this shell)`. When an agent crashes, the summary quotes the end of its log, and if the log names a variable this shell has but the agent didn't get, it says so: `OPENROUTER_API_KEY is set in this shell but was withheld from the agent: pass it with --pass-env OPENROUTER_API_KEY or list it under agent.pass_env in ancha.yaml`.
|
|
20
20
|
|
|
21
21
|
## Agents that wait for people
|
|
22
22
|
|
|
@@ -75,7 +75,7 @@ ancha check --env <envId> --json # the scene's checks, as ancha run grades the
|
|
|
75
75
|
ancha world down --env <envId>
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
`ancha world state --env <id> --json` and `ancha world trace --env <id> --json` show the world while it runs, and `ancha check --test <file>` applies another file's checks. A world is removed after `--ttl` (default 30m) with no call from the agent and no `ancha world` or `ancha check` command on it. Worlds go where `ancha run` would put them (your workspace after `ancha login`); `--on local` or `--on cloud` chooses.
|
|
78
|
+
`ancha world state --env <id> --json` and `ancha world trace --env <id> --json` show the world while it runs, and `ancha check --test <file>` applies another file's checks. `ancha check --env <id> --check '{"id":"asked","revealed":["laura.workspace"]}'` applies check objects instead (repeat `--check`; each is required), for a harness that asks what holds right now. A world is removed after `--ttl` (default 30m) with no call from the agent and no `ancha world` or `ancha check` command on it. Worlds go where `ancha run` would put them (your workspace after `ancha login`); `--on local` or `--on cloud` chooses.
|
|
79
79
|
|
|
80
80
|
## Saved agents
|
|
81
81
|
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Create and validate scenes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Tests with people (version 2)
|
|
4
|
+
|
|
5
|
+
A version 2 test names a world (`ancha/worlds/<id>.yaml`: the company, its people with what they know and decide, and the tools' history) and says what starts an attempt, when it ends, and the checks: on what people learned, decided and were told, and on the tools.
|
|
6
|
+
|
|
7
|
+
- `ancha world gen "<company and scenario>" --json` writes a world. `ancha init --intent "<…>"` does that while setting up the project, and drafts a first test for it.
|
|
8
|
+
- `ancha test new "<the test in one sentence>" --json` drafts a test for the project's world (`--world <id>` when there are several) into `ancha/tests/<id>.yaml`, with a `.gen.json` record of the prompt. The draft is validated against the world (every ref exists, every check can be evaluated) before it is written. Read its checks before you run it: each should pass for an agent that does the job and fail for one that doesn't.
|
|
9
|
+
- Run it like a scene: `ancha run ancha/tests/<id>.yaml --json`. Both commands use a model: your `OPENROUTER_API_KEY`, or your workspace's credit when you're logged in.
|
|
10
|
+
|
|
11
|
+
## Scenes
|
|
12
|
+
|
|
13
|
+
`ancha scene new my-scene --twins slack,okta` creates scene.yaml with a seed for every requested tool (the packaged template's for Slack, GitHub, Datadog and PagerDuty, the tool's example otherwise) and an access check where the reference companion can read the tool, plus oracle.ts/null.ts and dependency-free Node companions oracle.mjs/null.mjs. Choose a path-safe lowercase id. Unknown/duplicate twins and existing destinations are rejected. Scenes are strict YAML, not runtime includes.
|
|
14
|
+
|
|
15
|
+
## Seeds
|
|
16
|
+
|
|
17
|
+
`ancha twins seed <tool>` prints what `seed.<tool>` takes: the fields with their types and defaults, an example cut from the tool's starter data that validates as written, the state checks and scripted events a scene can use on the tool, the variables the agent gets and the SDK settings. `--json` prints the same as data (the fields as JSON Schema); `--full` uses the complete starter data as the example. A scene whose seed has an unknown, missing or mistyped field fails validation with a hint that names this command.
|
|
4
18
|
|
|
5
19
|
Validate with `ancha scene validate scenes/my-scene/scene.yaml --json`. Reference checks: run `ancha run scenes/my-scene/scene.yaml --agent "node scenes/my-scene/oracle.mjs" -n 1 --parallel 1 --json` and repeat with null.mjs. Oracle should pass; null should exit cleanly while business checks fail. Test validity, business outcome and process completion independently. The starter checks read access; replace its task and trace checks with your own business checks.
|
|
6
20
|
|
package/lib/assets/docs/tools.md
CHANGED