fascicle 0.10.0 → 0.10.1
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 +12 -0
- package/dist/agents.d.ts +1 -1
- package/dist/{index-D20uBog5.d.ts → index-BNgtkeUf.d.ts} +18 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.10.1 — 2026-08-07
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **A schema call that finished without finishing no longer returns unchecked text typed as your schema.** `generate` gated schema parsing on `finish_reason === 'stop'` and, on any other finish, fell through to returning the raw model text cast to `T`. A Bedrock guardrail block, a `max_tokens` truncation, or a step-cap exit therefore produced a `GenerateResult<T>` whose `content` was a string wearing the schema's type: reading a field off it crashed, and a defensive consumer got `undefined` fields instead, so a blocked call could score as a low-risk one. The gate now throws `incomplete_generation_error` (exported from `fascicle`) carrying `finish_reason`, `raw_text`, and `provider_reported`, the last so a guardrail's own assessment stays reachable from the catch without logging the matched text. Repair is still not attempted, which was the one correct half of the old behaviour: re-prompting a model that was blocked or cut off cannot produce the missing value. The error is deliberately distinct from `schema_validation_error`, which continues to mean a response that completed normally and then failed validation. **Breaking for schema callers** who relied on the old return: those calls now reject, and a streamed one rejects after its text deltas without emitting a `finish` chunk, matching what `schema_validation_error` already did. Calls without a schema are untouched — `content_filter` and `length` still return the partial text with the finish reason. `claude_cli` was never affected (it validates unconditionally and reports every completion as `stop`), so this closes a divergence between the transports rather than opening one. The flipped criterion is pinned in `spec_coverage.test.ts`, the finish reasons and the no-repair guarantee in `generate.test.ts`, and the payload's survival onto the error across plain, streamed, and multi-step runs in `provider_reported.test.ts`.
|
|
8
|
+
|
|
9
|
+
- **A schema that validates to `undefined` returned the raw model text instead of the validated value.** `generate` tracked its parsed value in a `T | undefined` and gated the final read on `content_parsed !== undefined`, so a schema whose `.transform()` or `.catch()` legitimately yields `undefined` parsed successfully and was then discarded in favour of the raw string, cast to `T`. The parsed value now rides a `{ value: T }` holder, which distinguishes "validated to undefined" from "nothing parsed" and collapses the three-way final-content branch to two. This also retires the comment claiming the fallthrough was unreachable: it was reachable before this release, and the branch that remains is the no-schema one.
|
|
10
|
+
|
|
11
|
+
### Internal
|
|
12
|
+
|
|
13
|
+
- **The two grandfathered `unused_class_members` findings on `errors.ts` are resolved rather than baselined.** `turn_timeout_error.kind` and `schema_validation_error.kind` have no in-repo production reader — `classify_retryable` reaches them through `read_string(err, 'kind')` on an `unknown`, and external consumers switch on the discriminant outside this repo — so the finding was a limitation of static analysis, not real debt. Both now carry an inline `fallow-ignore-next-line` with the reason beside the field, and the baseline entries are gone. The entries were anchored by `line:col`, so any edit above them re-surfaced frozen debt as a new finding; documenting the intent at the field removes that fragility.
|
|
14
|
+
|
|
3
15
|
## v0.10.0 — 2026-08-05
|
|
4
16
|
|
|
5
17
|
### Added
|
package/dist/agents.d.ts
CHANGED
|
@@ -706,6 +706,22 @@ declare class provider_auth_error extends Error {
|
|
|
706
706
|
refresh_command?: string;
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
|
+
/**
|
|
710
|
+
* A generate call that set a schema finished for a reason other than 'stop'
|
|
711
|
+
* (content_filter, length, max_steps, tool_calls), so no schema-validated
|
|
712
|
+
* value exists and validation was never attempted. Carries the raw model text
|
|
713
|
+
* and the last provider-reported payload, so a guardrail trace or other
|
|
714
|
+
* block detail stays reachable from the catch. Distinct from
|
|
715
|
+
* schema_validation_error, which covers a response that completed normally
|
|
716
|
+
* and then failed validation after its repair attempts ran out.
|
|
717
|
+
*/
|
|
718
|
+
declare class incomplete_generation_error extends Error {
|
|
719
|
+
readonly kind: "incomplete_generation_error";
|
|
720
|
+
readonly finish_reason: FinishReason;
|
|
721
|
+
readonly raw_text: string;
|
|
722
|
+
readonly provider_reported: Record<string, unknown> | undefined;
|
|
723
|
+
constructor(finish_reason: FinishReason, raw_text: string, provider_reported?: Record<string, unknown>);
|
|
724
|
+
}
|
|
709
725
|
//#endregion
|
|
710
|
-
export {
|
|
711
|
-
//# sourceMappingURL=index-
|
|
726
|
+
export { ProviderCapability as $, Pricing as A, ToolApprovalHandler as B, FinishReason as C, PrepareStepContext as D, Message as E, RetryFailureKind as F, TurnResult as G, ToolCallRecord as H, RetryPolicy as I, AiSdkProviderAdapter as J, UsageTotals as K, StepRecord as L, ProviderConfigMap as M, ProviderInit as N, PrepareStepHook as O, ResolvedModel as P, ProviderAdapter as Q, StreamChunk as R, EngineDefaults as S, GenerateResult as T, ToolExecContext as U, ToolApprovalRequest as V, TurnRequest as W, ExternalAgentAdapter as X, EffortTranslation as Y, NativeProviderAdapter as Z, AssistantContentPart as _, model_required_error as a, Engine as b, provider_capability_error as c, rate_limit_error as d, ProviderFactory as et, schema_validation_error as f, AiSdkTelemetrySettings as g, create_engine as h, incomplete_generation_error as i, PricingTable as j, PrepareStepResult as k, provider_error as l, tool_error as m, engine_config_error as n, RawProviderUsage as nt, on_chunk_error as o, tool_approval_denied_error as p, UserContentPart as q, engine_disposed_error as r, default_normalize_usage as rt, provider_auth_error as s, claude_cli_error as t, ProviderTransport as tt, provider_not_configured_error as u, CostBreakdown as v, GenerateOptions as w, EngineConfig as x, EffortLevel as y, Tool as z };
|
|
727
|
+
//# sourceMappingURL=index-BNgtkeUf.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as fallback, B as describe, C as checkpoint, D as LoopResult, E as LoopGuardResult, F as parallel, G as Step, H as run, I as sequence, J as TrajectoryLogger, K as StepMetadata, L as DescribeOptions, M as pipe, N as map, O as loop, P as branch, R as FlowNode, S as suspend, T as LoopConfig, U as CheckpointStore, V as step, W as RunContext, Y as __json_default_export, _ as suspended_error, a as SpanStartEvent, b as stash, c as span_end_event_schema, d as STEP_KINDS, f as StepKind, g as resume_validation_error, h as describe_cycle_error, i as SpanEndEvent, j as retry, k as timeout, l as span_start_event_schema, m as aborted_error, n as EmitEvent, o as custom_event_schema, p as is_step_kind, q as TrajectoryEvent, r as ParsedTrajectoryEvent, s as emit_event_schema, t as CustomTrajectoryEvent, u as trajectory_event_schema, v as timeout_error, w as compose, x as use, y as scope, z as FlowValue } from "./index-SkPG_Rew.js";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as ProviderCapability, A as Pricing, B as ToolApprovalHandler, C as FinishReason, D as PrepareStepContext, E as Message, F as RetryFailureKind, G as TurnResult, H as ToolCallRecord, I as RetryPolicy, J as AiSdkProviderAdapter, K as UsageTotals, L as StepRecord, M as ProviderConfigMap, N as ProviderInit, O as PrepareStepHook, P as ResolvedModel, Q as ProviderAdapter, R as StreamChunk, S as EngineDefaults, T as GenerateResult, U as ToolExecContext, V as ToolApprovalRequest, W as TurnRequest, X as ExternalAgentAdapter, Y as EffortTranslation, Z as NativeProviderAdapter, _ as AssistantContentPart, a as model_required_error, b as Engine, c as provider_capability_error, d as rate_limit_error, et as ProviderFactory, f as schema_validation_error, g as AiSdkTelemetrySettings, h as create_engine, i as incomplete_generation_error, j as PricingTable, k as PrepareStepResult, l as provider_error, m as tool_error, n as engine_config_error, nt as RawProviderUsage, o as on_chunk_error, p as tool_approval_denied_error, q as UserContentPart, r as engine_disposed_error, rt as default_normalize_usage, s as provider_auth_error, t as claude_cli_error, tt as ProviderTransport, u as provider_not_configured_error, v as CostBreakdown, w as GenerateOptions, x as EngineConfig, y as EffortLevel, z as Tool } from "./index-BNgtkeUf.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/composites/adversarial.d.ts
|
|
@@ -532,5 +532,5 @@ declare function start_viewer(options?: StartViewerOptions): Promise<ViewerHandl
|
|
|
532
532
|
*/
|
|
533
533
|
declare function run_viewer_cli(argv: readonly string[]): Promise<void>;
|
|
534
534
|
//#endregion
|
|
535
|
-
export { type AdversarialBuildInput, type AdversarialConfig, type AdversarialCritiqueResult, type AdversarialResult, type AiSdkProviderAdapter, type AiSdkTelemetrySettings, type AssistantContentPart, type BenchCase, type BenchOptions, type BenchReport, type BenchSummary, type BracketRecord, type Candidate, type CaseResult, type CheckpointStore, type ConsensusConfig, type ConsensusResult, type CostBreakdown, type CustomTrajectoryEvent, type DescribeOptions, type EffortLevel, type EffortTranslation, type EmitEvent, type Engine, type EngineConfig, type EngineDefaults, type EnsembleConfig, type EnsembleResult, type EnsembleStepConfig, type EnsembleStepResult, type ExternalAgentAdapter, type FinishReason, type FlowNode, type FlowValue, type GenerateOptions, type GenerateResult, type HistoryEntry, type ImproveBudget, type ImproveConfig, type ImproveResult, type ImproveRoundInput, type Improvement, type Judge, type JudgeArgs, type JudgeLlmConfig, type JudgeWithFn, type LearnConfig, type LearnInput, type LearnResult, type Lesson, type LoopConfig, type LoopGuardResult, type LoopResult, type Message, type ModelCallConfig, type ModelCallInput, type NativeProviderAdapter, type ParsedTrajectoryEvent, type PerCaseDelta, type PrepareStepContext, type PrepareStepHook, type PrepareStepResult, type Pricing, type PricingTable, type ProviderAdapter, type ProviderCapability, type ProviderConfigMap, type ProviderFactory, type ProviderInit, type ProviderTransport, type RawProviderUsage, type RegressionCompareOptions, type RegressionDelta, type RegressionReport, type ResolvedModel, type RetryFailureKind, type RetryPolicy, type RunContext, STEP_KINDS, type Score, type ScoredCandidate, type SpanEndEvent, type SpanStartEvent, type StartViewerOptions, type Step, type StepKind, type StepMetadata, type StepRecord, type StreamChunk, type Tool, type ToolApprovalHandler, type ToolApprovalRequest, type ToolCallRecord, type ToolExecContext, type TournamentConfig, type TournamentResult, type TrajectoryEvent, type TrajectoryLogger, type TrajectorySource, type TurnRequest, type TurnResult, type UsageTotals, type UserContentPart, type ViewerHandle, aborted_error, adversarial, bench, branch, checkpoint, claude_cli_error, compose, consensus, create_engine, custom_event_schema, default_normalize_usage, describe, describe_cycle_error, emit_event_schema, engine_config_error, engine_disposed_error, ensemble, ensemble_step, fallback, __json_default_export as flow_schema, forward_standard_env, improve, is_step_kind, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, normalize_score, on_chunk_error, parallel, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, rate_limit_error, read_baseline, regression_compare, resume_validation_error, retry, run, run_viewer_cli, schema_validation_error, scope, sequence, span_end_event_schema, span_start_event_schema, start_viewer, stash, step, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, trajectory_event_schema, use, write_baseline };
|
|
535
|
+
export { type AdversarialBuildInput, type AdversarialConfig, type AdversarialCritiqueResult, type AdversarialResult, type AiSdkProviderAdapter, type AiSdkTelemetrySettings, type AssistantContentPart, type BenchCase, type BenchOptions, type BenchReport, type BenchSummary, type BracketRecord, type Candidate, type CaseResult, type CheckpointStore, type ConsensusConfig, type ConsensusResult, type CostBreakdown, type CustomTrajectoryEvent, type DescribeOptions, type EffortLevel, type EffortTranslation, type EmitEvent, type Engine, type EngineConfig, type EngineDefaults, type EnsembleConfig, type EnsembleResult, type EnsembleStepConfig, type EnsembleStepResult, type ExternalAgentAdapter, type FinishReason, type FlowNode, type FlowValue, type GenerateOptions, type GenerateResult, type HistoryEntry, type ImproveBudget, type ImproveConfig, type ImproveResult, type ImproveRoundInput, type Improvement, type Judge, type JudgeArgs, type JudgeLlmConfig, type JudgeWithFn, type LearnConfig, type LearnInput, type LearnResult, type Lesson, type LoopConfig, type LoopGuardResult, type LoopResult, type Message, type ModelCallConfig, type ModelCallInput, type NativeProviderAdapter, type ParsedTrajectoryEvent, type PerCaseDelta, type PrepareStepContext, type PrepareStepHook, type PrepareStepResult, type Pricing, type PricingTable, type ProviderAdapter, type ProviderCapability, type ProviderConfigMap, type ProviderFactory, type ProviderInit, type ProviderTransport, type RawProviderUsage, type RegressionCompareOptions, type RegressionDelta, type RegressionReport, type ResolvedModel, type RetryFailureKind, type RetryPolicy, type RunContext, STEP_KINDS, type Score, type ScoredCandidate, type SpanEndEvent, type SpanStartEvent, type StartViewerOptions, type Step, type StepKind, type StepMetadata, type StepRecord, type StreamChunk, type Tool, type ToolApprovalHandler, type ToolApprovalRequest, type ToolCallRecord, type ToolExecContext, type TournamentConfig, type TournamentResult, type TrajectoryEvent, type TrajectoryLogger, type TrajectorySource, type TurnRequest, type TurnResult, type UsageTotals, type UserContentPart, type ViewerHandle, aborted_error, adversarial, bench, branch, checkpoint, claude_cli_error, compose, consensus, create_engine, custom_event_schema, default_normalize_usage, describe, describe_cycle_error, emit_event_schema, engine_config_error, engine_disposed_error, ensemble, ensemble_step, fallback, __json_default_export as flow_schema, forward_standard_env, improve, incomplete_generation_error, is_step_kind, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, normalize_score, on_chunk_error, parallel, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, rate_limit_error, read_baseline, regression_compare, resume_validation_error, retry, run, run_viewer_cli, schema_validation_error, scope, sequence, span_end_event_schema, span_start_event_schema, start_viewer, stash, step, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, trajectory_event_schema, use, write_baseline };
|
|
536
536
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1560,6 +1560,28 @@ var provider_auth_error = class extends Error {
|
|
|
1560
1560
|
this.refresh_command = metadata.refresh_command;
|
|
1561
1561
|
}
|
|
1562
1562
|
};
|
|
1563
|
+
/**
|
|
1564
|
+
* A generate call that set a schema finished for a reason other than 'stop'
|
|
1565
|
+
* (content_filter, length, max_steps, tool_calls), so no schema-validated
|
|
1566
|
+
* value exists and validation was never attempted. Carries the raw model text
|
|
1567
|
+
* and the last provider-reported payload, so a guardrail trace or other
|
|
1568
|
+
* block detail stays reachable from the catch. Distinct from
|
|
1569
|
+
* schema_validation_error, which covers a response that completed normally
|
|
1570
|
+
* and then failed validation after its repair attempts ran out.
|
|
1571
|
+
*/
|
|
1572
|
+
var incomplete_generation_error = class extends Error {
|
|
1573
|
+
kind = "incomplete_generation_error";
|
|
1574
|
+
finish_reason;
|
|
1575
|
+
raw_text;
|
|
1576
|
+
provider_reported;
|
|
1577
|
+
constructor(finish_reason, raw_text, provider_reported) {
|
|
1578
|
+
super(`generation finished with '${finish_reason}' before a schema-validated response was produced`);
|
|
1579
|
+
this.name = "incomplete_generation_error";
|
|
1580
|
+
this.finish_reason = finish_reason;
|
|
1581
|
+
this.raw_text = raw_text;
|
|
1582
|
+
this.provider_reported = provider_reported;
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1563
1585
|
//#endregion
|
|
1564
1586
|
//#region src/engine/retry.ts
|
|
1565
1587
|
const DEFAULT_RETRY = {
|
|
@@ -7775,7 +7797,12 @@ function build_native_invoke(cfg) {
|
|
|
7775
7797
|
* resolved transport, and drives it through `run_tool_loop`. When a schema
|
|
7776
7798
|
* is set and the model's output fails validation, it appends a repair
|
|
7777
7799
|
* message and re-invokes the loop, until the response parses, repair
|
|
7778
|
-
* attempts run out, or `max_steps` is reached.
|
|
7800
|
+
* attempts run out, or `max_steps` is reached. When a schema is set and the
|
|
7801
|
+
* loop finishes for any reason other than `'stop'` (a content filter, the
|
|
7802
|
+
* token limit, the step cap), no validated value can exist, so it throws
|
|
7803
|
+
* `incomplete_generation_error` carrying the finish reason, the raw text,
|
|
7804
|
+
* and the last `provider_reported` payload rather than returning unchecked
|
|
7805
|
+
* text. Without a schema those finish reasons return normally.
|
|
7779
7806
|
*/
|
|
7780
7807
|
async function generate(opts_in, engine) {
|
|
7781
7808
|
if (opts_in.abort?.aborted === true) throw new aborted_error("aborted", { reason: opts_in.abort.reason });
|
|
@@ -7890,7 +7917,6 @@ async function generate(opts_in, engine) {
|
|
|
7890
7917
|
let finish_reason = "stop";
|
|
7891
7918
|
let repair_remaining = schema_repair_attempts;
|
|
7892
7919
|
let content_parsed;
|
|
7893
|
-
let schema_satisfied = opts.schema === void 0;
|
|
7894
7920
|
const salvage_budget = tool_call_repair_attempts > 0 ? { remaining: tool_call_repair_attempts } : void 0;
|
|
7895
7921
|
try {
|
|
7896
7922
|
while (true) {
|
|
@@ -7920,11 +7946,10 @@ async function generate(opts_in, engine) {
|
|
|
7920
7946
|
text = loop_result.text;
|
|
7921
7947
|
finish_reason = loop_result.finish_reason;
|
|
7922
7948
|
if (opts.schema === void 0) break;
|
|
7923
|
-
if (finish_reason !== "stop")
|
|
7949
|
+
if (finish_reason !== "stop") throw new incomplete_generation_error(finish_reason, text, last_provider_reported(steps_accum));
|
|
7924
7950
|
const parse = parse_with_schema(opts.schema, text);
|
|
7925
7951
|
if (parse.ok) {
|
|
7926
|
-
content_parsed = parse.value;
|
|
7927
|
-
schema_satisfied = true;
|
|
7952
|
+
content_parsed = { value: parse.value };
|
|
7928
7953
|
break;
|
|
7929
7954
|
}
|
|
7930
7955
|
record_schema_validation_failed(trajectory, {
|
|
@@ -7939,8 +7964,7 @@ async function generate(opts_in, engine) {
|
|
|
7939
7964
|
const aggregated_usage = sum_usage(steps_accum);
|
|
7940
7965
|
const aggregated_cost = aggregate_cost(steps_accum, target.provider);
|
|
7941
7966
|
let final_content;
|
|
7942
|
-
if (
|
|
7943
|
-
else if (schema_satisfied && content_parsed !== void 0) final_content = content_parsed;
|
|
7967
|
+
if (content_parsed !== void 0) final_content = content_parsed.value;
|
|
7944
7968
|
else final_content = text;
|
|
7945
7969
|
const result = {
|
|
7946
7970
|
content: final_content,
|
|
@@ -8974,6 +8998,6 @@ if (process.argv[1] !== void 0 && process.argv[1] === fileURLToPath(import.meta.
|
|
|
8974
8998
|
process.exit(1);
|
|
8975
8999
|
});
|
|
8976
9000
|
//#endregion
|
|
8977
|
-
export { STEP_KINDS, aborted_error, adversarial, bench, branch, checkpoint, claude_cli_error, compose, consensus, create_engine, custom_event_schema, default_normalize_usage, describe, describe_cycle_error, emit_event_schema, engine_config_error, engine_disposed_error, ensemble, ensemble_step, fallback, flow_schema_default as flow_schema, forward_standard_env, improve, is_step_kind, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, normalize_score, on_chunk_error, parallel, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, rate_limit_error, read_baseline, regression_compare, resume_validation_error, retry, run, run_viewer_cli, schema_validation_error, scope, sequence, span_end_event_schema, span_start_event_schema, start_viewer, stash, step, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, trajectory_event_schema, use, write_baseline };
|
|
9001
|
+
export { STEP_KINDS, aborted_error, adversarial, bench, branch, checkpoint, claude_cli_error, compose, consensus, create_engine, custom_event_schema, default_normalize_usage, describe, describe_cycle_error, emit_event_schema, engine_config_error, engine_disposed_error, ensemble, ensemble_step, fallback, flow_schema_default as flow_schema, forward_standard_env, improve, incomplete_generation_error, is_step_kind, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, normalize_score, on_chunk_error, parallel, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, rate_limit_error, read_baseline, regression_compare, resume_validation_error, retry, run, run_viewer_cli, schema_validation_error, scope, sequence, span_end_event_schema, span_start_event_schema, start_viewer, stash, step, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, trajectory_event_schema, use, write_baseline };
|
|
8978
9002
|
|
|
8979
9003
|
//# sourceMappingURL=index.js.map
|