@evolvingmachines/evolve 0.0.55-project-sable.20260916.db0bc0bb

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.
Files changed (98) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +25 -0
  3. package/dist/chunk-5GVMBEYI.js +11 -0
  4. package/dist/chunk-HQJI3HHU.js +1 -0
  5. package/dist/chunk-JS2UTK2I.js +427 -0
  6. package/dist/cli/index.cjs +73 -0
  7. package/dist/cli/index.d.cts +270 -0
  8. package/dist/cli/index.d.ts +270 -0
  9. package/dist/cli/index.js +54 -0
  10. package/dist/index.cjs +669 -0
  11. package/dist/index.d.cts +5023 -0
  12. package/dist/index.d.ts +5023 -0
  13. package/dist/index.js +230 -0
  14. package/dist/managed-modal-IJW62SSK.js +4 -0
  15. package/dist/resumable-HFSICSH3.js +1 -0
  16. package/dist/tar-GVC4KE52.js +1 -0
  17. package/dist/types-DlpTxdR_.d.cts +4777 -0
  18. package/dist/types-DlpTxdR_.d.ts +4777 -0
  19. package/dist/upload-KPYDMWFJ.js +1 -0
  20. package/docs-agents/SKILL.md +138 -0
  21. package/docs-agents/index.md +81 -0
  22. package/docs-agents/python/01-getting-started.md +511 -0
  23. package/docs-agents/python/02-configuration.md +855 -0
  24. package/docs-agents/python/03-runtime.md +899 -0
  25. package/docs-agents/python/04-streaming.md +451 -0
  26. package/docs-agents/python/05-swarm-pipeline.md +953 -0
  27. package/docs-agents/python/index.md +122 -0
  28. package/docs-agents/typescript/01-getting-started.md +494 -0
  29. package/docs-agents/typescript/02-configuration.md +841 -0
  30. package/docs-agents/typescript/03-runtime.md +864 -0
  31. package/docs-agents/typescript/04-streaming.md +478 -0
  32. package/docs-agents/typescript/05-swarm-pipeline.md +957 -0
  33. package/docs-agents/typescript/index.md +121 -0
  34. package/docs-evals/SKILL.md +112 -0
  35. package/docs-evals/cli-reference/agent.mdx +67 -0
  36. package/docs-evals/cli-reference/analysis.mdx +91 -0
  37. package/docs-evals/cli-reference/analyze.mdx +74 -0
  38. package/docs-evals/cli-reference/auth.mdx +60 -0
  39. package/docs-evals/cli-reference/check.mdx +146 -0
  40. package/docs-evals/cli-reference/dataset.mdx +133 -0
  41. package/docs-evals/cli-reference/index.mdx +108 -0
  42. package/docs-evals/cli-reference/job.mdx +239 -0
  43. package/docs-evals/cli-reference/run.mdx +196 -0
  44. package/docs-evals/cli-reference/secrets.mdx +95 -0
  45. package/docs-evals/cli-reference/skill.mdx +51 -0
  46. package/docs-evals/cli-reference/skills.mdx +81 -0
  47. package/docs-evals/cli-reference/trial.mdx +112 -0
  48. package/docs-evals/cli-reference/upload.mdx +36 -0
  49. package/docs-evals/core-concepts/agents.mdx +106 -0
  50. package/docs-evals/core-concepts/analyze.mdx +86 -0
  51. package/docs-evals/core-concepts/check.mdx +51 -0
  52. package/docs-evals/core-concepts/datasets.mdx +138 -0
  53. package/docs-evals/core-concepts/index.mdx +42 -0
  54. package/docs-evals/core-concepts/jobs.mdx +136 -0
  55. package/docs-evals/core-concepts/models.mdx +68 -0
  56. package/docs-evals/core-concepts/sandboxes.mdx +52 -0
  57. package/docs-evals/core-concepts/secrets.mdx +41 -0
  58. package/docs-evals/core-concepts/skills.mdx +42 -0
  59. package/docs-evals/core-concepts/tasks.mdx +216 -0
  60. package/docs-evals/core-concepts/trial-outputs.mdx +103 -0
  61. package/docs-evals/core-concepts/trials.mdx +103 -0
  62. package/docs-evals/core-concepts/upload.mdx +45 -0
  63. package/docs-evals/dashboard/checks.mdx +15 -0
  64. package/docs-evals/dashboard/datasets.mdx +24 -0
  65. package/docs-evals/dashboard/jobs.mdx +65 -0
  66. package/docs-evals/dashboard/traces.mdx +15 -0
  67. package/docs-evals/dashboard/trial-viewer.mdx +30 -0
  68. package/docs-evals/docs.json +180 -0
  69. package/docs-evals/getting-started/installation.mdx +56 -0
  70. package/docs-evals/getting-started/quick-start.mdx +85 -0
  71. package/docs-evals/index.mdx +36 -0
  72. package/docs-evals/sdk/python.mdx +139 -0
  73. package/docs-evals/sdk/typescript.mdx +141 -0
  74. package/docs-evals/sdk-reference/agents.mdx +105 -0
  75. package/docs-evals/sdk-reference/analyses.mdx +125 -0
  76. package/docs-evals/sdk-reference/auth.mdx +76 -0
  77. package/docs-evals/sdk-reference/checks.mdx +166 -0
  78. package/docs-evals/sdk-reference/datasets.mdx +305 -0
  79. package/docs-evals/sdk-reference/errors.mdx +199 -0
  80. package/docs-evals/sdk-reference/index.mdx +58 -0
  81. package/docs-evals/sdk-reference/jobs.mdx +731 -0
  82. package/docs-evals/sdk-reference/meta.mdx +52 -0
  83. package/docs-evals/sdk-reference/skills.mdx +68 -0
  84. package/docs-evals/sdk-reference/trials.mdx +232 -0
  85. package/docs-evals/sdk-reference/types.mdx +272 -0
  86. package/docs-evals/snippets/global-options.mdx +13 -0
  87. package/docs-evals/snippets/list-flags.mdx +23 -0
  88. package/harness-capabilities.json +430 -0
  89. package/hosted-error-codes.json +120 -0
  90. package/package.json +163 -0
  91. package/skills/create-adapter/SKILL.md +287 -0
  92. package/skills/create-task/SKILL.md +491 -0
  93. package/skills/evolve/SKILL.md +39 -0
  94. package/skills/publish/SKILL.md +142 -0
  95. package/skills/rewardkit/SKILL.md +330 -0
  96. package/spec/atif/README.md +45 -0
  97. package/spec/atif/trajectory.schema.json +865 -0
  98. package/spec/openapi.yaml +13447 -0
@@ -0,0 +1,330 @@
1
+ ---
2
+ name: rewardkit
3
+ description: Write Harbor-format task verifiers using Reward Kit. Use when creating or editing a
4
+ task's tests/ directory, adding grading criteria, setting up LLM/agent judges, or designing
5
+ verifiers that produce a reward score.
6
+ metadata:
7
+ internal: true
8
+ ---
9
+
10
+ Help the user write task verifiers with Reward Kit. Reward Kit is a lightweight Python
11
+ package that turns a directory of criteria files into a reward score. Each criterion is a
12
+ Python function call or a TOML judge file; folders become separate rewards.
13
+
14
+ ## Setup in a task
15
+
16
+ Put criteria alongside `test.sh` in the task's `tests/` directory:
17
+
18
+ ```
19
+ tests/
20
+ ├── test.sh
21
+ ├── checks.py # programmatic criteria
22
+ └── judge.toml # optional LLM/agent judge
23
+ ```
24
+
25
+ `tests/test.sh`:
26
+ ```bash
27
+ #!/bin/bash
28
+ uvx --from 'harbor-rewardkit==0.2.*' rewardkit /tests
29
+ ```
30
+
31
+ This runs all criteria in `/tests/` against the workspace at `/app` and writes
32
+ `/logs/verifier/reward.json`. Defaults match Harbor's conventions — no extra config needed.
33
+
34
+ Run `evolve check "<task-path>" --watch` to run the verifier against the task's reference
35
+ solution before publishing the task.
36
+
37
+ If judge criteria need API keys, request them through `task.toml`:
38
+ ```toml
39
+ [verifier.env]
40
+ ANTHROPIC_API_KEY = "${ANTHROPIC_API_KEY}"
41
+ ```
42
+
43
+ On Evolve you never put a real key in the task: write the template exactly as above, as
44
+ the whole value, and the judge's credential is supplied at run time. The rubric names the
45
+ judge model, or Reward Kit's own default applies. A job can override the judge for every
46
+ verifier with `evolve run --ve REWARDKIT_JUDGE=<judge> --ve REWARDKIT_MODEL=<model>`; no
47
+ other verifier env key is accepted on a job.
48
+
49
+ Ask whether Reward Kit should run in the agent's shared environment or in a
50
+ separate verifier environment. Prefer a separate verifier environment when judge
51
+ prompts, grading dependencies, API keys, or clean-room checks should not be
52
+ available to the agent:
53
+
54
+ ```toml
55
+ [environment]
56
+ network_mode = "no-network" # Agent env baseline — offline during agent.run()
57
+
58
+ [verifier]
59
+ environment_mode = "separate"
60
+
61
+ [verifier.environment]
62
+ network_mode = "public" # Verifier env baseline — LLM judge API calls
63
+ docker_image = "python:3.12-slim"
64
+ ```
65
+
66
+ In shared mode, the verifier runs in the agent container and inherits
67
+ `[environment].network_mode`. A `[verifier].network_mode` that differs from that
68
+ baseline is refused at import on Evolve, because a shared verify cannot switch
69
+ egress. If agent and verifier need different network access, use
70
+ `environment_mode = "separate"` and set `[verifier.environment].network_mode`.
71
+
72
+ Judge criteria that call external APIs need a `public` baseline or allowlist on
73
+ the verifier environment. Programmatic checks that only read local files can use
74
+ `no-network`.
75
+
76
+ In separate mode with no `[verifier.environment].docker_image`, `tests/` is the
77
+ verifier image's build context and its `tests/Dockerfile` must provide
78
+ `/tests/test.sh`. When the verifier pins the task's own image, the platform
79
+ uploads `tests/` to `/tests` instead. When it pins a distinct image, that image
80
+ boots as it is with nothing uploaded, so it must carry `/tests/test.sh` itself.
81
+
82
+ ## Programmatic criteria
83
+
84
+ Call built-ins from any `.py` file in `tests/`:
85
+
86
+ ```python
87
+ import rewardkit as rk
88
+
89
+ rk.file_exists("output.txt")
90
+ rk.file_contains("output.txt", "hello")
91
+ rk.command_succeeds("python main.py", weight=2.0)
92
+ rk.json_key_equals("result.json", "status", "ok")
93
+ ```
94
+
95
+ All criteria accept `weight` (default `1.0`) and `isolated` (default `False`, runs in
96
+ overlayfs so side effects don't leak).
97
+
98
+ ### Available built-ins
99
+
100
+ - **Files**: `file_exists`, `file_not_exists`, `file_contains`, `file_contains_regex`,
101
+ `file_matches`, `files_equal`, `diff_ratio`
102
+ - **Commands**: `command_succeeds`, `command_output_contains`, `command_output_matches`,
103
+ `command_output_matches_regex` (30s default timeout, optional `cwd`)
104
+ - **Data**: `json_key_equals`, `json_path_equals`, `csv_cell_equals`, `xlsx_cell_equals`
105
+ (needs `[office]` extra), `sqlite_query_equals`
106
+ - **HTTP**: `http_status_equals`, `http_response_contains`
107
+ - **Images**: `image_similarity`, `image_size_equals` (needs `[image]` extra)
108
+ - **Trajectory**: `trajectory_tool_used`, `trajectory_tool_not_used`, `trajectory_turn_count`
109
+
110
+ For extras, install with `uv tool install harbor-rewardkit[all]`.
111
+
112
+ ## Custom criteria
113
+
114
+ Use the `@criterion` decorator. First parameter is always `workspace: Path`. Returns
115
+ `bool` or `float`:
116
+
117
+ ```python
118
+ from pathlib import Path
119
+ from rewardkit import criterion
120
+
121
+ @criterion
122
+ def has_valid_output(workspace: Path) -> bool:
123
+ return (workspace / "output.txt").read_text().strip() != ""
124
+ ```
125
+
126
+ Zero-parameter criteria auto-register. Criteria with extra args must be called via `rk`:
127
+
128
+ ```python
129
+ @criterion(description="output has at least {n} lines")
130
+ def has_n_lines(workspace: Path, n: int) -> bool:
131
+ return len((workspace / "output.txt").read_text().splitlines()) >= n
132
+
133
+ rk.has_n_lines(10, weight=2.0)
134
+ rk.has_n_lines(50, weight=1.0)
135
+ ```
136
+
137
+ For criteria shared across reward subdirs, define with `shared=True` in a root-level file
138
+ and call from subdirs.
139
+
140
+ ## Judge criteria (LLM or agent-as-a-judge)
141
+
142
+ For subjective checks (quality, readability, edge cases), create a TOML file:
143
+
144
+ ```toml
145
+ [judge]
146
+ judge = "anthropic/claude-sonnet-5" # LiteLLM model string
147
+ files = ["/app/main.py"]
148
+
149
+ [[criterion]]
150
+ description = "Is the code correct?"
151
+ type = "binary"
152
+
153
+ [[criterion]]
154
+ description = "How readable is the code?"
155
+ type = "likert"
156
+ points = 5
157
+ weight = 2.0
158
+ ```
159
+
160
+ Criterion types:
161
+ - `binary` — yes/no → 1.0 or 0.0
162
+ - `likert` — 1..points, normalized to [0, 1]
163
+ - `numeric` — min..max, normalized to [0, 1]
164
+
165
+ ### Agent judges
166
+
167
+ Agent judges shell out to a CLI and can explore the filesystem:
168
+
169
+ ```toml
170
+ [judge]
171
+ judge = "claude-code"
172
+ model = "anthropic/claude-sonnet-5"
173
+ isolated = true
174
+
175
+ [[criterion]]
176
+ description = "Does the solution handle edge cases?"
177
+ type = "binary"
178
+ ```
179
+
180
+ Slower and more expensive than LLM judges, but they can run commands and inspect files.
181
+
182
+ ### Useful `[judge]` options
183
+
184
+ `timeout` (default 300), `reasoning_effort` (`low`|`medium`|`high`), `reference` (path to
185
+ reference solution), `atif-trajectory` (evaluate the agent's trajectory), `weight`,
186
+ `prompt_template` (custom prompt with `{criteria}` placeholder).
187
+
188
+ ### Scoring aggregation (within one judge TOML)
189
+
190
+ ```toml
191
+ [scoring]
192
+ aggregation = "all-pass" # weighted-mean | weighted-sum | all-pass | any-pass | threshold | required-pass
193
+ threshold = 0.7 # only for threshold
194
+ ```
195
+
196
+ Only affects how this file's own criteria combine. To aggregate *across*
197
+ dimensions, see [Aggregating dimensions](#aggregating-dimensions).
198
+
199
+ ### Scoring config for programmatic files
200
+
201
+ Each `.py` file that registers criteria is an equal-weighted scoring component
202
+ named after its filename stem. Files that only provide imports or shared
203
+ criterion factories and register no checks are ignored. To change how criteria
204
+ within a file combine, use `[scoring.<stem>]` in the same directory's
205
+ `reward.toml`:
206
+
207
+ ```toml
208
+ # tests/structure/reward.toml
209
+ [scoring.files_exist] # configures files_exist.py
210
+ aggregation = "all-pass"
211
+
212
+ [scoring.behavior] # configures behavior.py
213
+ aggregation = "threshold"
214
+ threshold = 0.75
215
+ ```
216
+
217
+ Each entry takes the same aggregation values as a judge TOML. Unknown keys and
218
+ stems that do not resolve to a criterion-bearing Python file raise.
219
+
220
+ Directories may be nested recursively. A non-root directory can aggregate its
221
+ local Python files, local judges, and immediate child directories with one
222
+ unnamed `[[reward]]` table:
223
+
224
+ ```toml
225
+ # tests/correctness/reward.toml
226
+ [[reward]]
227
+ aggregation = "weighted-mean"
228
+ weights = { files = 2.0, behavior = 1.0 }
229
+ ```
230
+
231
+ Membership is implicit. Child directories have weight 1.0 unless overridden;
232
+ use filename stems for local Python files and judge TOMLs, and directory names
233
+ for child groups. Without `[[reward]]`, the directory defaults to weighted mean.
234
+
235
+ ## Multi-reward tasks
236
+
237
+ Put criteria in subdirectories — each becomes a separate reward:
238
+
239
+ ```
240
+ tests/
241
+ ├── test.sh
242
+ ├── correctness/
243
+ │ └── check.py
244
+ ├── structure/
245
+ │ └── files_exist.py
246
+ └── quality/
247
+ └── quality.toml
248
+ ```
249
+
250
+ Judge TOMLs may also sit directly at the tests root alongside reward
251
+ subdirectories. Each is exposed as a top-level reward named after its filename
252
+ stem and can be referenced by a root aggregation.
253
+
254
+ Criterion-bearing Python files at the tests root are also top-level dimensions
255
+ named after their stems. Root support files that register no criteria are
256
+ ignored.
257
+
258
+ Produces:
259
+ ```json
260
+ { "correctness": 0.75, "structure": 1.0, "quality": 0.6 }
261
+ ```
262
+
263
+ ### Aggregating dimensions
264
+
265
+ To add aggregated scores on top of the per-dimension keys, add a root-level
266
+ `tests/reward.toml` with one or more `[[reward]]` tables. Each adds one key to
267
+ `reward.json`, aggregating the dimensions with the same modes as `[scoring]`:
268
+
269
+ ```toml
270
+ # tests/reward.toml
271
+ [[reward]]
272
+ name = "reward"
273
+ aggregation = "all-pass" # weighted-mean | weighted-sum | all-pass | any-pass | threshold | required-pass
274
+ # threshold = 0.7 # only for threshold
275
+ weights = { correctness = 2.0, quality = 1.0 }
276
+ ```
277
+
278
+ ```json
279
+ { "correctness": 0.75, "structure": 1.0, "quality": 0.6, "reward": 0.0 }
280
+ ```
281
+
282
+ The per-dimension scores stay; aggregated keys are added alongside them (a
283
+ `name` may not collide with a dimension). Top-level dimensions have equal
284
+ weight unless that aggregation's inline map overrides them;
285
+ `reward-details.json` keeps the full recursive breakdown.
286
+
287
+ ## Output files
288
+
289
+ - `/logs/verifier/reward.json` — per-reward scores
290
+ - `/logs/verifier/reward-details.json` — per-criterion results, judge reasoning, errors
291
+
292
+ ## Multi-step tasks
293
+
294
+ In a multi-step task, each step has its own `tests/` under
295
+ `steps/{name}/tests/`, and the verifier runs once per step. Reward Kit behaves
296
+ the same as in a single-step task: for each step it reads `/tests`, runs the
297
+ criteria against `/app`, and writes `/logs/verifier/reward.json` for that step.
298
+ The platform then aggregates per-step results into a trial-level reward via
299
+ `multi_step_reward_strategy` in `task.toml` — aggregation happens *outside*
300
+ Reward Kit, so don't try to encode cross-step logic in your criteria.
301
+
302
+ A task-level `tests/` directory (at the task root) is uploaded to `/tests`
303
+ first, then the step's own `tests/` is layered on top (same-name files win).
304
+ Put shared helpers (common `checks.py` functions with `shared=True`, fixture
305
+ files, a fallback `test.sh`) at the task level, and step-specific criteria
306
+ under each step.
307
+
308
+ Multi-reward subdirectories still work *within* a step: `steps/foo/tests/`
309
+ can contain `correctness/`, `structure/`, `quality/` — each produces a
310
+ separate reward key for that step, and `multi_step_reward_strategy = "mean"`
311
+ averages each key across steps. Use `"final"` when the last step is an
312
+ end-to-end check whose rewards already represent the full task.
313
+
314
+ ## When to reach for what
315
+
316
+ - **Use built-ins** for file existence, string matches, command output, JSON/CSV checks,
317
+ HTTP probes.
318
+ - **Use `@criterion`** when logic is task-specific but still programmatic.
319
+ - **Use LLM judges** for subjective quality dimensions (readability, correctness of prose).
320
+ - **Use agent judges** when the rubric requires exploring the filesystem or running code
321
+ (e.g. "does the test suite actually pass?").
322
+ - **Use subdirectories** when you want separate scores (correctness vs structure vs
323
+ quality) rather than one blended number.
324
+ - **Use `isolated=True`** for any criterion that runs mutating commands, so it doesn't
325
+ corrupt the workspace for other criteria.
326
+
327
+ ## Working example
328
+
329
+ See https://github.com/laude-institute/harbor/tree/main/examples/tasks/reward-kit-example.
330
+ Reward Kit's own documentation: https://docs.harborframework.com/core-concepts/rewardkit/quick-start.
@@ -0,0 +1,45 @@
1
+ # ATIF trajectory schema
2
+
3
+ `trajectory.schema.json` is the language-neutral JSON Schema for the ATIF
4
+ trajectory documents this platform emits (`agent/trajectory.json` inside a
5
+ job download, and the `?stream=trajectory` trial artifact).
6
+
7
+ ## Provenance
8
+
9
+ The schema is GENERATED, never hand-edited. It is emitted by pydantic's
10
+ `model_json_schema()` from Harbor's own trajectory models — the same models
11
+ Harbor's tooling validates trajectories with — rooted at `Trajectory`:
12
+
13
+ - Source: `src/harbor/models/trajectories/` in the Harbor repository
14
+ - Pinned Harbor commit: `4698544ea9d5ee95d01b05aeaa9ccbd161d5a7f6`
15
+ - Draft: JSON Schema 2020-12 (pydantic's output dialect)
16
+
17
+ To regenerate against a newer Harbor, from a checkout of that commit's
18
+ repository with its own venv:
19
+
20
+ ```
21
+ python - <<'EOF'
22
+ import json
23
+ from harbor.models.trajectories import Trajectory
24
+
25
+ document = {
26
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
27
+ "$comment": "GENERATED — do not hand-edit. ... Harbor commit <commit>. ...",
28
+ "title": "ATIF Trajectory",
29
+ }
30
+ document.update(Trajectory.model_json_schema())
31
+ with open("spec/atif/trajectory.schema.json", "w") as f:
32
+ json.dump(document, f, indent=2, sort_keys=True)
33
+ f.write("\n")
34
+ EOF
35
+ ```
36
+
37
+ Update the pinned commit in the `$comment` and in this file in the same
38
+ change — the two must always agree.
39
+
40
+ ## The mirror
41
+
42
+ The server repository keeps a byte-identical copy at its own `spec/atif/`,
43
+ held by a drift gate exactly like the `spec/openapi.yaml` mirror: the server's
44
+ ATIF tests validate every emitted document against this schema, so the emitter
45
+ and the schema cannot disagree silently.