fascicle 0.4.0 → 0.5.0
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/CHANGELOG.md +53 -0
- package/README.md +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.js +241 -126
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.5.0 — 2026-06-03
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Two-axis model resolution. `model` now names either a **family** (`opus`, `sonnet`, `haiku`, `gpt`, `gemini` — "latest of that family") or a specific vendor id (`claude-opus-4-8`), and a new `provider` axis names the transport (`anthropic`, `claude_cli`, `openrouter`, …). `provider` is accepted per-call on `generate` / `model_call` and as an engine default; the same `model: 'opus'` now runs on any transport by swapping `provider`.
|
|
7
|
+
- `MODEL_FAMILIES` catalog mapping each family to the latest id per provider, plus a `families` engine-config field that deep-merges per `(family, provider)` so you can pin newer ids or add new families. Exported `FamilyCatalog` type.
|
|
8
|
+
- `examples/swebench`: `claude_cli` provider option, selectable via `SWEBENCH_PROVIDER`.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **Breaking.** `create_engine` no longer ships default aliases — the alias table starts empty and is reserved for your own named pins. The built-in `cli-*`, `or:*`, `gemini-pro`/`gemini-flash`, and `gpt-4o*` aliases are gone; use `{ model, provider }` pairs (e.g. `{ model: 'sonnet', provider: 'claude_cli' }`) or the colon form (`openrouter:meta-llama/llama-3.3-70b-instruct`).
|
|
12
|
+
- **Breaking.** `resolve_model` signature is now `resolve_model(model, provider, { families, aliases })`. Resolution order: colon-form `provider:id` → user alias → family lookup → pass-through specific id. When `model`/`provider` are omitted, `model` defaults to `sonnet` and `provider` resolves to per-call → `defaults.provider` → the sole configured provider → `anthropic`.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- A family with no entry for the chosen provider (e.g. `opus` on `openai`) now throws the descriptive `model_family_unavailable_error` instead of the generic not-found path.
|
|
16
|
+
|
|
17
|
+
## v0.4.3 — 2026-05-10
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- `examples/swebench` — 5-instance smoke harness against SWE-bench Verified. Ships a `Sandbox` seam (`noop` / `local` / `docker` factories), five per-case tools (`read_file`, `write_file`, `run_command` argv-only, `list_files`, `grep_files`), a `solve_instance` flow that captures `git diff` against `base_commit`, and `evaluate_with_sb_cli` for the real eval. Scaling to the 500-instance Verified set is a scale change, not a shape change.
|
|
21
|
+
- `examples/pr-improve` Phase C, PR B: builder dispatches by provider. `make_builder_call` now takes `worktree_root` and `provider` explicit params; under `claude_cli` it keeps the schema-only path that delegates to the CLI's built-in Read/Write/Edit, and under API providers (`anthropic`, `openrouter`) it returns a `model_call` configured with the worktree-scoped tools from `make_builder_tools(worktree_root)`. The `Step<string, GenerateResult<Handoff>>` contract is unchanged; `flow.ts` ripples in one place via a new `FlowEnv = { worktree_root, provider }` arg to `build_flow`. The portability proof — same end-to-end result under `--provider claude_cli` and `--provider anthropic` — is now live.
|
|
22
|
+
|
|
23
|
+
### Internal
|
|
24
|
+
- `examples/pr-improve`: split `CLOUD_SPEC.md` out as the active spec for the remaining AWS/Fargate/Terraform deployment work (Fargate worker, webhook Lambda, single Terraform module). `SPEC.md` keeps a deprecation banner and is preserved as historical context.
|
|
25
|
+
- `examples/pr-improve` `post_improvement_pr`: dropped the "re-run with `--provider claude_cli`" hint from the no-edits follow-up message, now obsolete since API providers also edit files.
|
|
26
|
+
- `vitest.config.ts`: include `examples/pr-improve/src/stages/**/*.{test,spec}.ts` so the new builder-dispatch test runs alongside the tool tests.
|
|
27
|
+
|
|
28
|
+
## v0.4.2 — 2026-05-09
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- `examples/pr-improve` Phase C, PR A: worktree-scoped builder tools and a safety harness. The builder runs in an isolated git worktree (clean cwd, branch named `fascicle/improve-<n>`) and gets bounded `read_file`, `write_file`, `edit_file`, `list_dir`, and `run_shell` tools that refuse paths outside the worktree, follow no symlinks past the root, and cap stdout/stderr per call.
|
|
32
|
+
- `@repo/engine` `claude_cli` provider: typed parsing for `rate_limit_event` stream lines. Trajectories now record a structured `cli_rate_limit_event` (status, rate-limit type, reset times, overage flag) instead of falling through to opaque `cli_unknown_event` blobs. Every field is optional in the schema for forward-compat with future CLI variants.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- `@repo/engine` `parse_with_schema` now surfaces the first parseable candidate's schema-validation error, not the last. With multi-candidate JSON extraction (text → fenced blocks → outermost-brace slice → outermost-bracket slice), the bracket-slice fallback could grab an inner array and produce an "expected object, received array" error that buried the real shape mismatch and actively misdirected the schema-repair prompt. The first JSON-parseable candidate represents the model's intent and is what repair feedback should describe.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
- `examples/pr-improve` stage prompts: the pragmatist, builder, and build-reviewer system prompts now describe their JSON output contracts explicitly — exact field names, length caps, and an emphatic "JSON only" footer (especially important for the builder, which uses tools and was previously ending its turn with markdown narration). Without the schema spelled out, models invented field names (`id` for `suggestion_id`, `summary` for `one_liner`) or exceeded the 120-char `one_liner` cap, exhausting the schema-repair budget.
|
|
39
|
+
- `examples/pr-improve` `run_shell` (auto-applied via PR #5): stream-byte caps now use `Buffer.byteLength` instead of UTF-16 string length, so non-ASCII output is truncated at the correct byte count. Promise settlement is deferred to the `close` event so `AbortController`-driven timeouts return `RunShellOutput { timed_out: true }` instead of always rejecting from the abort-triggered `error` event. Spawn environment strips `ANTHROPIC_*`, `GITHUB_*`, and `AWS_*` keys to prevent credential exfiltration via model-controlled commands.
|
|
40
|
+
- `examples/pr-improve` `read_file` / `edit_file` (auto-applied via PR #5): replaced the post-assert `stat()` with `lstat()`, closing a race window where a symlink swapped in after the initial symlink guard could be silently followed.
|
|
41
|
+
- `examples/pr-improve` `claude_cli` stall timeout bumped from the 5-minute default to 15 minutes. The default watchdog tripped on legitimate long thinking phases when the CLI's between-turn heartbeat events (session/rate-limit) fired infrequently.
|
|
42
|
+
- `examples/pr-improve` `run_shell` error narrowing now uses `'code' in err` type guards instead of unsafe casts to `{ code?: unknown }`. The auto-applied improvement landed casts that the project's `no-unsafe-type-assertion` rule rejected, breaking `pnpm check` on main.
|
|
43
|
+
|
|
44
|
+
### Internal
|
|
45
|
+
- `examples/pr-improve` docs: marked Phase B done and detailed the Phase C tool surface.
|
|
46
|
+
|
|
47
|
+
## v0.4.1 — 2026-05-09
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
- `examples/pr-improve`: an automated PR-improvement pipeline composed as a four-stage fascicle flow — reviewer (sonnet) → pragmatist (opus, default-reject) → builder (sonnet) → build-reviewer (opus) — inside a bounded `loop` with `guard`-driven convergence. Routes every model call through the engine, so the same flow runs against `anthropic`, `openrouter`, or a local `claude_cli` subprocess by changing one env var. Includes `--pr` mode for posting review suggestions back to a GitHub PR via safe-spawn `gh`/`git` wrappers, and a `bin/pr-improve` entrypoint.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
- `@repo/engine` schema validation: `schema.ts` now tolerates fenced JSON code blocks in model output and emits a new `schema_validation_failed` trajectory event when validation fails, instead of throwing without observability. `generate.ts` extracts multiple JSON candidates from a single response and picks the first that parses, recovering from leading prose or partial fences.
|
|
54
|
+
- `@repo/engine` `claude_cli` provider: schema-repair attempt count is now configurable (was: hard-coded), giving callers control over the retry-vs-fail-fast tradeoff.
|
|
55
|
+
|
|
3
56
|
## v0.4.0 — 2026-05-07
|
|
4
57
|
|
|
5
58
|
### Fixed
|
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ try {
|
|
|
78
78
|
|
|
79
79
|
Plus `run`, `run.stream`, and `describe`.
|
|
80
80
|
|
|
81
|
-
**AI engine.** `create_engine(config)` returns one `generate` surface across seven providers.
|
|
81
|
+
**AI engine.** `create_engine(config)` returns one `generate` surface across seven providers. Two axes: `model` names a family (`sonnet`, `opus`, `gpt` — latest of that family) or a specific id (`claude-opus-4-8`), and `provider` names the transport (`anthropic`, `claude_cli`, `openrouter`, …) — so the same `model: 'opus'` runs anywhere. Reasoning effort (`'low' | 'medium' | 'high'`) is translated per provider. Cost estimation uses a pricing table with per-engine overrides.
|
|
82
82
|
|
|
83
83
|
**Adapters injected per run.** Trajectory loggers and checkpoint stores ship under the `fascicle/adapters` subpath:
|
|
84
84
|
|
package/dist/index.d.ts
CHANGED
|
@@ -325,7 +325,7 @@ type CustomTrajectoryEvent = z.infer<typeof custom_event_schema>;
|
|
|
325
325
|
type ParsedTrajectoryEvent = z.infer<typeof trajectory_event_schema>;
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region packages/core/src/version.d.ts
|
|
328
|
-
declare const version = "0.
|
|
328
|
+
declare const version = "0.5.0";
|
|
329
329
|
//#endregion
|
|
330
330
|
//#region packages/core/src/index.d.ts
|
|
331
331
|
declare const flow_schema: {
|
|
@@ -977,7 +977,7 @@ declare function read_baseline(path: string): Promise<BenchReport>;
|
|
|
977
977
|
declare function write_baseline(path: string, report: BenchReport): Promise<void>;
|
|
978
978
|
//#endregion
|
|
979
979
|
//#region packages/engine/src/version.d.ts
|
|
980
|
-
declare const version$1 = "0.
|
|
980
|
+
declare const version$1 = "0.5.0";
|
|
981
981
|
//#endregion
|
|
982
982
|
//#region packages/engine/src/providers/claude_cli/types.d.ts
|
|
983
983
|
/**
|
|
@@ -1048,6 +1048,11 @@ type AliasTarget = {
|
|
|
1048
1048
|
};
|
|
1049
1049
|
};
|
|
1050
1050
|
type AliasTable = Readonly<Record<string, AliasTarget>>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Family catalog: family name -> provider name -> the latest model id to send
|
|
1053
|
+
* to that provider for the family. See `MODEL_FAMILIES` in aliases.ts.
|
|
1054
|
+
*/
|
|
1055
|
+
type FamilyCatalog = Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
1051
1056
|
type Pricing = {
|
|
1052
1057
|
input_per_million: number;
|
|
1053
1058
|
output_per_million: number;
|
|
@@ -1188,6 +1193,7 @@ type StreamChunk = {
|
|
|
1188
1193
|
};
|
|
1189
1194
|
type GenerateOptions<t = string> = {
|
|
1190
1195
|
model?: string;
|
|
1196
|
+
provider?: string;
|
|
1191
1197
|
prompt: string | Message[];
|
|
1192
1198
|
system?: string;
|
|
1193
1199
|
schema?: z.ZodType<t>;
|
|
@@ -1260,7 +1266,8 @@ type ProviderConfigMap = {
|
|
|
1260
1266
|
*
|
|
1261
1267
|
* | Field | Rule |
|
|
1262
1268
|
* | --------------------------------------------------------------------- | ----------------------------------------- |
|
|
1263
|
-
* | `model` | per-call wins; else default; else
|
|
1269
|
+
* | `model` | per-call wins; else default; else `sonnet` |
|
|
1270
|
+
* | `provider` | per-call wins; else default; else sole configured provider; else `anthropic` |
|
|
1264
1271
|
* | `system`, `effort`, `max_steps`, `tool_error_policy`, `schema_repair_attempts` | per-call wins (nullish coalesce) |
|
|
1265
1272
|
* | `retry_policy` | per-call replaces wholesale |
|
|
1266
1273
|
* | `provider_options` | two-level: per-provider-key shallow merge |
|
|
@@ -1268,6 +1275,7 @@ type ProviderConfigMap = {
|
|
|
1268
1275
|
*/
|
|
1269
1276
|
type EngineDefaults = {
|
|
1270
1277
|
readonly model?: string;
|
|
1278
|
+
readonly provider?: string;
|
|
1271
1279
|
readonly system?: string;
|
|
1272
1280
|
readonly effort?: EffortLevel;
|
|
1273
1281
|
readonly max_steps?: number;
|
|
@@ -1279,6 +1287,7 @@ type EngineDefaults = {
|
|
|
1279
1287
|
type EngineConfig = {
|
|
1280
1288
|
providers: ProviderConfigMap;
|
|
1281
1289
|
aliases?: AliasTable;
|
|
1290
|
+
families?: FamilyCatalog;
|
|
1282
1291
|
pricing?: PricingTable;
|
|
1283
1292
|
default_retry?: RetryPolicy;
|
|
1284
1293
|
default_effort?: EffortLevel;
|
|
@@ -1388,6 +1397,12 @@ type ModelCallConfig<T = unknown> = {
|
|
|
1388
1397
|
* `defaults.model` is used. Errors at call time if neither is set.
|
|
1389
1398
|
*/
|
|
1390
1399
|
readonly model?: string;
|
|
1400
|
+
/**
|
|
1401
|
+
* Transport for the model: `anthropic` | `claude_cli` | `openrouter` | ...
|
|
1402
|
+
* Optional: if omitted, the engine's `defaults.provider` (or sole configured
|
|
1403
|
+
* provider, else `anthropic`) is used.
|
|
1404
|
+
*/
|
|
1405
|
+
readonly provider?: string;
|
|
1391
1406
|
readonly id?: string;
|
|
1392
1407
|
readonly system?: string;
|
|
1393
1408
|
readonly tools?: ReadonlyArray<Tool>;
|