@ancha-labs/cli 0.4.21 → 0.4.22

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.
@@ -1,5 +1,7 @@
1
1
  # Compare agent changes
2
2
 
3
+ Baseline saving checks that every reference trial finished with a valid harness and that the test fingerprints are verified. For invalid harness trials, run `ancha explain <runId> --json`, fix the setup it names and rerun the affected tests before saving. Rerun skipped or unfinished reference trials before saving as well. A valid agent failure can be saved as the reference for an improvement.
4
+
3
5
  Run `ancha run --json`, then `ancha baseline save before` to freeze a completed reference. Inspect `ancha explain latest --json`, edit the agent and run `ancha run --compare before --json`. Use the same --out directory when you set one. Consult `ancha baseline --help --json` and `ancha run --help --json` for installed reference options.
4
6
 
5
7
  `ancha baseline save <name> [--from <runId|latest>] [--force] [--out <runs-dir>]` defaults to the most recent run from this project, on this computer or in the workspace; `--from run_cloud_…` takes a cloud run's summary from the workspace. It copies the summary into `.ancha/baselines/<name>.json`, or a baselines directory next to a custom runs directory. Later changes to latest leave the snapshot intact. Saving an existing name requires --force. Names use 1–64 letters, digits, hyphens or underscores; latest and names beginning with run_ are reserved. `ancha run --compare <runId|baseline-name>` resolves its reference before starting agents or updating latest.
@@ -25,3 +25,6 @@ Fix the agent after reading the evidence, then prove the fix with `ancha run --c
25
25
  It reports whether the agent acted differently and where: the first of its writes that differs from the attempt (`diverged`, with the recorded and the new call), then every check against the attempt's outcome (`was`). With the same agent, nothing diverges and no model is called. Once the agent acts differently, people answer live with `--people live` (your `OPENROUTER_API_KEY`, or the workspace's model credit after `ancha login`), or the replay stops there with `--people strict`, the default when there is no model. A replay stopped that way is invalid (exit 3, `invalidReason: "diverged"`): its checks say nothing about the agent. `ancha schema replay_finished` describes the JSON.
26
26
 
27
27
  For wrapped functions, `ancha explain` shows the actual return value or exception type and message. Each function call counts once. It identifies an unconfirmed outcome when the function's completion report was absent at capture.
28
+ ## Invalid setup before comparison
29
+
30
+ When a run has invalid harness attempts, `ancha explain <runId> --json` puts their setup reasons in `next`, followed by the rerun command. Fix those reasons and rerun the tests before saving a baseline. `harnessIssues` keeps the affected test, trial and diagnostic separate from agent failures.
@@ -1,5 +1,20 @@
1
1
  # Create and validate tests
2
2
 
3
+ `ancha test list --json` lists project test files and saved setups. `ancha test show <file or id> --json` shows a file's world, task and checks, or a saved setup's agent and pinned scenarios; `kind` identifies `file` or `saved`. A file's declared id also works. `ancha test validate <files...> --json` validates tests and world files with the same rules as `ancha scene validate`. Read this topic with `ancha docs tests` or `ancha docs scenes`.
4
+
5
+ ## Reuse a scene's world
6
+
7
+ For the default starter, `ancha init --on local` also writes `ancha/worlds/starter.yaml`, using the same tools and starting data. `ancha test import evals.jsonl --json` uses that world automatically. `ancha test new "Reply to the customer" --json` drafts a test for it with a model.
8
+
9
+ For a project with existing scenes, save a reusable world directly:
10
+
11
+ ```sh
12
+ ancha world from scenes/starter/scene.yaml --json
13
+ ancha test import evals.jsonl --world starter --json
14
+ ```
15
+
16
+ `ancha world from <scene> [--id <id>]` writes `ancha/worlds/<id>.yaml` from the scene's native tools, seed, simulation start time, time scale, rules and people. It needs no model. The default id is the scene's id; choose another with `--id` when a world file already exists. The scene keeps its task, checks and deadline and continues to run as before.
17
+
3
18
  ## Tests with people (version 2)
4
19
 
5
20
  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.
@@ -74,3 +74,47 @@ To run an agent in a sealed container against these tools, with tasks and graded
74
74
  Offline trace import generates a records adapter for tools answered with `tools.run` (`ancha docs traces`). Bind the actual store, then open it before constructing tools. TypeScript exports `readRecords`, `Records`, `mappingStore` and `openRecordsStore` from `@ancha-labs/tools/records`; Python exports `read_records`, `Records`, `mapping_store` and `open_records_store` from `ancha.records`.
75
75
 
76
76
  `Records.types()` lists sorted type names; `all(type)`, `get(type, id)` and `require(type, id)` return independent copies of business records. `entries()` returns `{type,id,record}` envelopes for store bindings. IDs remain strings. Invalid JSONL and duplicate identities identify the source file and line. A binding loads, clears, snapshots and probes the same store the tools use. `ancha doctor` reports its verification as `records-adapter`.
77
+
78
+ ## GitHub issue search
79
+
80
+ `GET /search/issues` serves Octokit's `search.issuesAndPullRequests`:
81
+
82
+ ```ts
83
+ const page = await github.search.issuesAndPullRequests({
84
+ q: 'repo:acme/orders is:issue state:open created:<2026-11-01T00:00:00Z',
85
+ sort: 'created', order: 'asc', per_page: 100, page: 1,
86
+ });
87
+ ```
88
+
89
+ Use `repo:`, `is:issue`, `is:pr`, `type:`, `state:`, `is:open`, `is:closed`, `label:`, `author:`, `assignee:`, `mentions:`, `no:label`, and `no:assignee`. Repeat `label:` to require every label; quote names containing spaces, such as `label:"needs review"`. Combine words with `in:title` or `in:body`. `created:`, `updated:` and `closed:` accept dates or timestamps with `<`, `<=`, `>`, `>=` and inclusive `start..end` ranges. `comments:` accepts counts, comparisons and ranges. Sort by `created`, `updated` or `comments`, with `order: 'asc'` or `'desc'`.
90
+
91
+ The response carries `total_count`, `incomplete_results: false` and `items`; pull request items include `pull_request`. Follow the `Link` header for further pages. `advanced_search: 'true'` is accepted. Public repositories are searchable; private repositories require the token's user to own the repository, belong to its organization, or be a collaborator. The starter bot has explicit collaborator access. Seed issue and pull request assignments with `assignees: [$github_ben]`.
92
+
93
+ ## Slack assistant threads and streaming
94
+
95
+ `assistant.threads.setStatus`, `assistant.threads.setSuggestedPrompts` and `assistant.threads.setTitle` use a bot token with `assistant:write`. Supply `channel_id` and `thread_ts`. Status accepts `loading_messages`; prompts are an array of up to four `{title, message}` objects with an optional heading `title`. A reply clears the thread's status. Current values appear in the world's `assistant_threads` state.
96
+
97
+ `chat.postEphemeral` takes `channel`, `user`, `text` or `blocks`, and an optional `thread_ts`. Its `message_ts` identifies a message visible to the named recipient; ephemeral messages stay separate from conversation history and replies.
98
+
99
+ Use `chat.startStream`, `chat.appendStream` and `chat.stopStream` with a bot token and `chat:write`:
100
+
101
+ ```ts
102
+ const stream = await slack.chat.startStream({
103
+ channel, thread_ts, recipient_user_id, recipient_team_id,
104
+ markdown_text: 'Export ',
105
+ });
106
+ await slack.chat.appendStream({ channel, ts: stream.ts!, markdown_text: 'complete' });
107
+ await slack.chat.stopStream({ channel, ts: stream.ts! });
108
+ ```
109
+
110
+ Provide the recipient's user and team IDs when starting outside a DM. Each call updates the same message; `conversations.replies` reads its current text. Chunks accept `markdown_text`, `blocks`, `plan_update` and `task_update` objects. `stopStream` can append final text, chunks and blocks. Check the reply with the existing state check:
111
+
112
+ ```yaml
113
+ id: export_answered
114
+ state:
115
+ slack.message:
116
+ channel: $slack_support
117
+ from: $slack_bot
118
+ in_thread_of: $slack_question
119
+ text_contains: Export complete
120
+ ```