fascicle 0.12.3 → 0.12.7

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 (38) hide show
  1. package/CHANGELOG.md +61 -6
  2. package/README.md +3 -2
  3. package/dist/agents.d.ts +1 -1
  4. package/dist/agents.js +1 -1
  5. package/dist/{core-DdJEhyQc.js → core-CFdEjtiT.js} +281 -270
  6. package/dist/core-CFdEjtiT.js.map +1 -0
  7. package/dist/{engine-J4lIxpw5.js → engine-DQiQHiy8.js} +182 -34
  8. package/dist/engine-DQiQHiy8.js.map +1 -0
  9. package/dist/index.d.ts +28 -2
  10. package/dist/index.js +48 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/{invoke-CH_eJZeS.js → invoke-eEYMZmWg.js} +3 -3
  13. package/dist/{invoke-CH_eJZeS.js.map → invoke-eEYMZmWg.js.map} +1 -1
  14. package/dist/{leading_system-BUCT-PwD.js → leading_system-DQmlA6Fs.js} +2 -2
  15. package/dist/{leading_system-BUCT-PwD.js.map → leading_system-DQmlA6Fs.js.map} +1 -1
  16. package/dist/mcp.d.ts +1 -1
  17. package/dist/mcp.js +1 -1
  18. package/dist/otel.d.ts +20 -2
  19. package/dist/otel.js +228 -8
  20. package/dist/otel.js.map +1 -1
  21. package/dist/stdio.js +1 -1
  22. package/dist/testing.d.ts +1 -1
  23. package/dist/testing.js +3 -3
  24. package/dist/{types-DU6cvoA4.d.ts → types-CLigYA62.d.ts} +28 -2
  25. package/dist/viewer-app/assets/index-BGb1-MwM.js +2 -0
  26. package/dist/viewer-app/assets/index-D7kvKs40.css +1 -0
  27. package/dist/viewer-app/fonts/sora-OFL.txt +93 -0
  28. package/dist/viewer-app/fonts/sora-latin.woff2 +0 -0
  29. package/dist/viewer-app/fonts/spline-sans-mono-OFL.txt +93 -0
  30. package/dist/viewer-app/fonts/spline-sans-mono-latin.woff2 +0 -0
  31. package/dist/viewer-app/index.html +13 -0
  32. package/dist/viewer.d.ts +17 -3
  33. package/dist/viewer.js +210 -50
  34. package/dist/viewer.js.map +1 -1
  35. package/package.json +14 -3
  36. package/dist/core-DdJEhyQc.js.map +0 -1
  37. package/dist/engine-J4lIxpw5.js.map +0 -1
  38. package/dist/static/viewer.html +0 -375
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as Step, c as StepMetadata, d as TrajectoryLogger, i as RunContext, l as StepOutput, n as CheckpointStore, o as StepFn, r as CleanupFn, s as StepInput, t as AnyStep, u as TrajectoryEvent } from "./types-DBpU27sQ.js";
2
2
  import { n as SchemaIssue, r as ToolSchema, t as AnySchema } from "./types-BK0UW28o.js";
3
3
  import { _ as parse_trajectory_event, a as ParsedTrajectoryEvent, c as SpanEndEvent, d as is_checkpoint_event, f as is_custom_trajectory_event, g as is_span_start_event, h as is_span_end_event, i as EmitEvent, l as SpanStartEvent, m as is_run_end_event, n as CheckpointStatus, o as RunEndEvent, p as is_emit_event, r as CustomTrajectoryEvent, s as RunEndStatus, t as CheckpointEvent, u as TrajectoryParseResult } from "./trajectory-ByoOQZ6T.js";
4
- import { A as TurnResult, B as ProviderTransport, C as StreamChunk, D as ToolCallRecord, E as ToolApprovalRequest, F as ExternalAgentAdapter, H as default_normalize_usage, I as NativeProviderAdapter, L as ProviderAdapter, M as UserContentPart, N as AiSdkProviderAdapter, O as ToolExecContext, P as EffortTranslation, R as ProviderCapability, S as StepRecord, T as ToolApprovalHandler, V as RawProviderUsage, _ as ProviderConfigMap, a as Engine, b as RetryFailureKind, c as FinishReason, d as Message, f as PrepareStepContext, g as PricingTable, h as Pricing, i as EffortLevel, j as UsageTotals, k as TurnRequest, l as GenerateOptions, m as PrepareStepResult, n as AssistantContentPart, o as EngineConfig, p as PrepareStepHook, r as CostBreakdown, s as EngineDefaults, t as AiSdkTelemetrySettings, u as GenerateResult, v as ProviderInit, w as Tool, x as RetryPolicy, y as ResolvedModel, z as ProviderFactory } from "./types-DU6cvoA4.js";
4
+ import { A as TurnRequest, B as ProviderFactory, C as StepTiming, D as ToolApprovalRequest, E as ToolApprovalHandler, F as EffortTranslation, H as RawProviderUsage, I as ExternalAgentAdapter, L as NativeProviderAdapter, M as UsageTotals, N as UserContentPart, O as ToolCallRecord, P as AiSdkProviderAdapter, R as ProviderAdapter, S as StepRecord, T as Tool, U as default_normalize_usage, V as ProviderTransport, _ as ProviderConfigMap, a as Engine, b as RetryFailureKind, c as FinishReason, d as Message, f as PrepareStepContext, g as PricingTable, h as Pricing, i as EffortLevel, j as TurnResult, k as ToolExecContext, l as GenerateOptions, m as PrepareStepResult, n as AssistantContentPart, o as EngineConfig, p as PrepareStepHook, r as CostBreakdown, s as EngineDefaults, t as AiSdkTelemetrySettings, u as GenerateResult, v as ProviderInit, w as StreamChunk, x as RetryPolicy, y as ResolvedModel, z as ProviderCapability } from "./types-CLigYA62.js";
5
5
 
6
6
  //#region src/core/flow-schema.json.d.ts
7
7
  declare let $schema: string;
@@ -1141,6 +1141,32 @@ declare function is_step_kind(value: unknown): value is StepKind;
1141
1141
  */
1142
1142
  declare function create_engine(config: EngineConfig): Engine;
1143
1143
  //#endregion
1144
+ //#region src/engine/throughput.d.ts
1145
+ type Throughput = {
1146
+ /** Output tokens per second over the measured window. Not rounded. */tokens_per_second: number;
1147
+ /**
1148
+ * 'decode' when every contributing step streamed, so each window excludes
1149
+ * its time-to-first-chunk; 'blended' when any window is a whole round-trip
1150
+ * (network + queueing + prefill included).
1151
+ */
1152
+ basis: 'decode' | 'blended'; /** Output tokens summed across the contributing steps. */
1153
+ output_tokens: number; /** The measured window in ms, summed across the contributing steps. */
1154
+ measured_ms: number;
1155
+ };
1156
+ /**
1157
+ * Compute output throughput from step timing: a whole GenerateResult, a step
1158
+ * array, or a single step.
1159
+ *
1160
+ * Only steps carrying `timing` contribute; tool-execution time between turns
1161
+ * never does, since StepTiming brackets the provider round-trip alone. Each
1162
+ * step's window is `duration_ms - first_chunk_ms` when the turn streamed and
1163
+ * the full `duration_ms` otherwise, with `basis` reporting 'decode' only when
1164
+ * no blended window contributed. Returns undefined when nothing is measurable:
1165
+ * no step has timing (an external adapter, a test seam), or the summed window
1166
+ * is 0 ms (a sub-millisecond stub turn), where a rate would divide by zero.
1167
+ */
1168
+ declare function throughput(source: GenerateResult<unknown> | StepRecord | ReadonlyArray<StepRecord>): Throughput | undefined;
1169
+ //#endregion
1144
1170
  //#region src/engine/errors.d.ts
1145
1171
  declare class rate_limit_error extends Error {
1146
1172
  readonly kind: "rate_limit_error";
@@ -1869,5 +1895,5 @@ declare function model_step<T = string>(cfg: Omit<ModelCallConfig<T>, 'project'>
1869
1895
  */
1870
1896
  declare function forward_standard_env(): Record<string, string>;
1871
1897
  //#endregion
1872
- export { type AdversarialBuildInput, type AdversarialConfig, type AdversarialCritiqueResult, type AdversarialResult, type AiSdkProviderAdapter, type AiSdkTelemetrySettings, type AnySchema, type AnyStep, type AssistantContentPart, type BenchCase, type BenchOptions, type BenchReport, type BenchSummary, type BracketRecord, type BranchConfig, type Candidate, type CaseResult, type Chain, type ChainOpen, type ChainStepOptions, type CheckpointConfig, type CheckpointEvent, type CheckpointStatus, type CheckpointStore, type ClaudeCliErrorReason, type CleanupFn, type ComposeConfig, 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 FallbackOptions, type FinishReason, type FlowNode, type FlowValue, type GateConfig, 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 LoopGuardPredicate, type LoopGuardResult, type LoopOutcome, type MapConfig, type Message, type ModelCallConfig, type ModelCallInput, type NativeProviderAdapter, type ParallelOptions, type ParsedTrajectoryEvent, type PerCaseDelta, type PipeOptions, 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 RetryConfig, type RetryFailureKind, type RetryPolicy, type RunContext, type RunEndEvent, type RunEndStatus, type RunOptions, type RunOutcome, STEP_KINDS, type SchemaIssue, type ScopeOptions, type Score, type ScoredCandidate, type SequenceOptions, type SpanEndEvent, type SpanStartEvent, type StashOptions, type Step, type StepFn, type StepInput, type StepKind, type StepMetadata, type StepOutput, type StepRecord, type StreamChunk, type StreamingRunHandle, type SuspendConfig, type TimeoutOptions, type Tool, type ToolApprovalHandler, type ToolApprovalRequest, type ToolCallRecord, type ToolExecContext, type ToolSchema, type TournamentConfig, type TournamentResult, type TrajectoryEvent, type TrajectoryLogger, type TrajectoryParseResult, type TrajectorySource, type TurnRequest, type TurnResult, type UsageTotals, type UseOptions, type UserContentPart, aborted_error, adversarial, assert_valid_step_id, bench, bench_suspend_error, branch, chain, checkpoint, claude_cli_error, compose, consensus, create_engine, default_normalize_usage, describe, describe_cycle_error, engine_config_error, engine_disposed_error, ensemble, ensemble_step, error_path, fallback, __json_default_export as flow_schema, forward_standard_env, gate, improve, incomplete_generation_error, is_checkpoint_event, is_custom_trajectory_event, is_emit_event, is_run_end_event, is_span_end_event, is_span_start_event, is_step, is_step_kind, is_valid_step_id, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, model_step, normalize_score, on_chunk_error, parallel, parse_trajectory_event, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, provider_required_error, rate_limit_error, read_baseline, regression_compare, resolve_display_name, resume_validation_error, retry, run, schema_validation_error, scope, sequence, stash, step, suggest_step_id, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, use, write_baseline };
1898
+ export { type AdversarialBuildInput, type AdversarialConfig, type AdversarialCritiqueResult, type AdversarialResult, type AiSdkProviderAdapter, type AiSdkTelemetrySettings, type AnySchema, type AnyStep, type AssistantContentPart, type BenchCase, type BenchOptions, type BenchReport, type BenchSummary, type BracketRecord, type BranchConfig, type Candidate, type CaseResult, type Chain, type ChainOpen, type ChainStepOptions, type CheckpointConfig, type CheckpointEvent, type CheckpointStatus, type CheckpointStore, type ClaudeCliErrorReason, type CleanupFn, type ComposeConfig, 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 FallbackOptions, type FinishReason, type FlowNode, type FlowValue, type GateConfig, 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 LoopGuardPredicate, type LoopGuardResult, type LoopOutcome, type MapConfig, type Message, type ModelCallConfig, type ModelCallInput, type NativeProviderAdapter, type ParallelOptions, type ParsedTrajectoryEvent, type PerCaseDelta, type PipeOptions, 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 RetryConfig, type RetryFailureKind, type RetryPolicy, type RunContext, type RunEndEvent, type RunEndStatus, type RunOptions, type RunOutcome, STEP_KINDS, type SchemaIssue, type ScopeOptions, type Score, type ScoredCandidate, type SequenceOptions, type SpanEndEvent, type SpanStartEvent, type StashOptions, type Step, type StepFn, type StepInput, type StepKind, type StepMetadata, type StepOutput, type StepRecord, type StepTiming, type StreamChunk, type StreamingRunHandle, type SuspendConfig, type Throughput, type TimeoutOptions, type Tool, type ToolApprovalHandler, type ToolApprovalRequest, type ToolCallRecord, type ToolExecContext, type ToolSchema, type TournamentConfig, type TournamentResult, type TrajectoryEvent, type TrajectoryLogger, type TrajectoryParseResult, type TrajectorySource, type TurnRequest, type TurnResult, type UsageTotals, type UseOptions, type UserContentPart, aborted_error, adversarial, assert_valid_step_id, bench, bench_suspend_error, branch, chain, checkpoint, claude_cli_error, compose, consensus, create_engine, default_normalize_usage, describe, describe_cycle_error, engine_config_error, engine_disposed_error, ensemble, ensemble_step, error_path, fallback, __json_default_export as flow_schema, forward_standard_env, gate, improve, incomplete_generation_error, is_checkpoint_event, is_custom_trajectory_event, is_emit_event, is_run_end_event, is_span_end_event, is_span_start_event, is_step, is_step_kind, is_valid_step_id, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, model_step, normalize_score, on_chunk_error, parallel, parse_trajectory_event, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, provider_required_error, rate_limit_error, read_baseline, regression_compare, resolve_display_name, resume_validation_error, retry, run, schema_validation_error, scope, sequence, stash, step, suggest_step_id, suspend, suspended_error, throughput, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, use, write_baseline };
1873
1899
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as error_path, C as step, D as run, E as suggest_step_id, M as suspended_error, N as timeout_error, O as aborted_error, P as resolve_display_name, S as is_step, T as is_valid_step_id, _ as map, a as suspend, b as sequence, c as checkpoint, d as timeout, f as fallback, g as pipe, i as use, j as resume_validation_error, k as describe_cycle_error, l as compose, n as scope, p as retry, r as stash, t as chain, u as loop, v as branch, w as assert_valid_step_id, x as describe, y as parallel } from "./core-DdJEhyQc.js";
2
- import { t as create_engine } from "./engine-J4lIxpw5.js";
1
+ import { A as describe_cycle_error, C as is_valid_step_id, D as resolve_display_name, E as describe, M as resume_validation_error, N as suspended_error, O as is_step, P as timeout_error, S as assert_valid_step_id, T as run, _ as map, a as suspend, b as sequence, c as checkpoint, d as timeout, f as fallback, g as pipe, i as use, j as error_path, k as aborted_error, l as compose, n as scope, p as retry, r as stash, t as chain, u as loop, v as branch, w as suggest_step_id, x as step, y as parallel } from "./core-CFdEjtiT.js";
2
+ import { t as create_engine } from "./engine-DQiQHiy8.js";
3
3
  import { a as is_span_end_event, i as is_run_end_event, n as is_custom_trajectory_event, o as is_span_start_event, r as is_emit_event, s as parse_trajectory_event, t as is_checkpoint_event } from "./trajectory-D1eq9eue.js";
4
4
  import { a as http_logger, n as tee_logger, o as filesystem_logger } from "./adapters-CutexJd3.js";
5
- import { _ as provider_required_error, b as tool_approval_denied_error, c as engine_config_error, d as model_required_error, f as on_chunk_error, g as provider_not_configured_error, h as provider_error, l as engine_disposed_error, m as provider_capability_error, n as default_normalize_usage, p as provider_auth_error, s as claude_cli_error, u as incomplete_generation_error, v as rate_limit_error, x as tool_error, y as schema_validation_error } from "./leading_system-BUCT-PwD.js";
5
+ import { _ as provider_required_error, b as tool_approval_denied_error, c as engine_config_error, d as model_required_error, f as on_chunk_error, g as provider_not_configured_error, h as provider_error, l as engine_disposed_error, m as provider_capability_error, n as default_normalize_usage, p as provider_auth_error, s as claude_cli_error, u as incomplete_generation_error, v as rate_limit_error, x as tool_error, y as schema_validation_error } from "./leading_system-DQmlA6Fs.js";
6
6
  import { createHash } from "node:crypto";
7
7
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
8
8
  import { dirname, join } from "node:path";
@@ -1886,6 +1886,50 @@ function validate_report(value, path) {
1886
1886
  if (!Array.isArray(v.cases) || typeof v.summary !== "object" || v.summary === null) throw new Error(`baseline at ${path} missing cases/summary`);
1887
1887
  }
1888
1888
  //#endregion
1889
+ //#region src/engine/throughput.ts
1890
+ /**
1891
+ * Narrow the accepted source union to its array member. A user-defined guard
1892
+ * because Array.isArray does not narrow a ReadonlyArray union member on its
1893
+ * own.
1894
+ */
1895
+ function is_step_list(source) {
1896
+ return Array.isArray(source);
1897
+ }
1898
+ /**
1899
+ * Compute output throughput from step timing: a whole GenerateResult, a step
1900
+ * array, or a single step.
1901
+ *
1902
+ * Only steps carrying `timing` contribute; tool-execution time between turns
1903
+ * never does, since StepTiming brackets the provider round-trip alone. Each
1904
+ * step's window is `duration_ms - first_chunk_ms` when the turn streamed and
1905
+ * the full `duration_ms` otherwise, with `basis` reporting 'decode' only when
1906
+ * no blended window contributed. Returns undefined when nothing is measurable:
1907
+ * no step has timing (an external adapter, a test seam), or the summed window
1908
+ * is 0 ms (a sub-millisecond stub turn), where a rate would divide by zero.
1909
+ */
1910
+ function throughput(source) {
1911
+ const steps = is_step_list(source) ? source : "steps" in source ? source.steps : [source];
1912
+ let output_tokens = 0;
1913
+ let measured_ms = 0;
1914
+ let all_decode = true;
1915
+ for (const step of steps) {
1916
+ if (step.timing === void 0) continue;
1917
+ output_tokens += step.usage.output_tokens;
1918
+ if (step.timing.first_chunk_ms !== void 0) measured_ms += step.timing.duration_ms - step.timing.first_chunk_ms;
1919
+ else {
1920
+ measured_ms += step.timing.duration_ms;
1921
+ all_decode = false;
1922
+ }
1923
+ }
1924
+ if (measured_ms <= 0) return void 0;
1925
+ return {
1926
+ tokens_per_second: output_tokens * 1e3 / measured_ms,
1927
+ basis: all_decode ? "decode" : "blended",
1928
+ output_tokens,
1929
+ measured_ms
1930
+ };
1931
+ }
1932
+ //#endregion
1889
1933
  //#region src/model_call.ts
1890
1934
  /**
1891
1935
  * model_call: the single sanctioned bridge between the composition and
@@ -2127,6 +2171,6 @@ function forward_standard_env() {
2127
2171
  return out;
2128
2172
  }
2129
2173
  //#endregion
2130
- export { STEP_KINDS, aborted_error, adversarial, assert_valid_step_id, bench, bench_suspend_error, branch, chain, checkpoint, claude_cli_error, compose, consensus, create_engine, default_normalize_usage, describe, describe_cycle_error, engine_config_error, engine_disposed_error, ensemble, ensemble_step, error_path, fallback, flow_schema_default as flow_schema, forward_standard_env, gate, improve, incomplete_generation_error, is_checkpoint_event, is_custom_trajectory_event, is_emit_event, is_run_end_event, is_span_end_event, is_span_start_event, is_step, is_step_kind, is_valid_step_id, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, model_step, normalize_score, on_chunk_error, parallel, parse_trajectory_event, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, provider_required_error, rate_limit_error, read_baseline, regression_compare, resolve_display_name, resume_validation_error, retry, run, schema_validation_error, scope, sequence, stash, step, suggest_step_id, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, use, write_baseline };
2174
+ export { STEP_KINDS, aborted_error, adversarial, assert_valid_step_id, bench, bench_suspend_error, branch, chain, checkpoint, claude_cli_error, compose, consensus, create_engine, default_normalize_usage, describe, describe_cycle_error, engine_config_error, engine_disposed_error, ensemble, ensemble_step, error_path, fallback, flow_schema_default as flow_schema, forward_standard_env, gate, improve, incomplete_generation_error, is_checkpoint_event, is_custom_trajectory_event, is_emit_event, is_run_end_event, is_span_end_event, is_span_start_event, is_step, is_step_kind, is_valid_step_id, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_required_error, model_step, normalize_score, on_chunk_error, parallel, parse_trajectory_event, pipe, provider_auth_error, provider_capability_error, provider_error, provider_not_configured_error, provider_required_error, rate_limit_error, read_baseline, regression_compare, resolve_display_name, resume_validation_error, retry, run, schema_validation_error, scope, sequence, stash, step, suggest_step_id, suspend, suspended_error, throughput, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, use, write_baseline };
2131
2175
 
2132
2176
  //# sourceMappingURL=index.js.map