fascicle 0.8.16 → 0.9.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 +25 -0
- package/README.md +1 -0
- package/dist/{adapters-DdUx-_b3.js → adapters-Dbx3M8m-.js} +3 -2
- package/dist/{adapters-DdUx-_b3.js.map → adapters-Dbx3M8m-.js.map} +1 -1
- package/dist/adapters.d.ts +1 -1
- package/dist/adapters.js +1 -1
- package/dist/{core-BhmclJzj.js → core-CYpxskeT.js} +3 -2
- package/dist/core-CYpxskeT.js.map +1 -0
- package/dist/{index-ORrmFF1x.d.ts → index-CJRUqgsV.d.ts} +2 -2
- package/dist/{index-CEj6hY9z.d.ts → index-JhJahQNi.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +29 -30
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/dist/stdio.d.ts +1 -1
- package/dist/stdio.js +2 -2
- package/dist/stdio.js.map +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +4 -0
- package/dist/ui.js.map +1 -1
- package/package.json +40 -38
- package/dist/core-BhmclJzj.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as timeout_error, C as describe, D as describe_cycle_error, E as aborted_error, O as resume_validation_error, S as sequence, T as run, _ as retry, a as trajectory_event_schema, b as branch, c as scope, d as suspend, f as checkpoint, g as fallback, h as timeout, i as span_start_event_schema, j as flow_schema_default, k as suspended_error, l as stash, m as loop, n as emit_event_schema, o as STEP_KINDS, p as compose, r as span_end_event_schema, s as is_step_kind, t as custom_event_schema, u as use, v as pipe, w as step, x as parallel, y as map } from "./core-
|
|
2
|
-
import { a as http_logger, n as tee_logger, o as filesystem_logger } from "./adapters-
|
|
1
|
+
import { A as timeout_error, C as describe, D as describe_cycle_error, E as aborted_error, O as resume_validation_error, S as sequence, T as run, _ as retry, a as trajectory_event_schema, b as branch, c as scope, d as suspend, f as checkpoint, g as fallback, h as timeout, i as span_start_event_schema, j as flow_schema_default, k as suspended_error, l as stash, m as loop, n as emit_event_schema, o as STEP_KINDS, p as compose, r as span_end_event_schema, s as is_step_kind, t as custom_event_schema, u as use, v as pipe, w as step, x as parallel, y as map } from "./core-CYpxskeT.js";
|
|
2
|
+
import { a as http_logger, n as tee_logger, o as filesystem_logger } from "./adapters-Dbx3M8m-.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { mkdir, open, readFile, readdir, stat, writeFile } from "node:fs/promises";
|
|
@@ -7,7 +7,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
7
7
|
import { createReadStream, existsSync, mkdtempSync, statSync, watch, writeFileSync } from "node:fs";
|
|
8
8
|
import { tmpdir } from "node:os";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
|
-
import { NoObjectGeneratedError, Output, generateText,
|
|
10
|
+
import { NoObjectGeneratedError, Output, generateText, isStepCount, streamText, tool } from "ai";
|
|
11
11
|
import { createServer } from "node:http";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
@@ -1023,14 +1023,14 @@ function regression_compare(current, baseline, options = {}) {
|
|
|
1023
1023
|
function compute_per_case(current, baseline, score_threshold, cost_threshold) {
|
|
1024
1024
|
const by_id_current = index_by_case_id(current.cases);
|
|
1025
1025
|
const by_id_baseline = index_by_case_id(baseline.cases);
|
|
1026
|
-
const all_ids = new Set([...by_id_current.keys(), ...by_id_baseline.keys()]);
|
|
1026
|
+
const all_ids = /* @__PURE__ */ new Set([...by_id_current.keys(), ...by_id_baseline.keys()]);
|
|
1027
1027
|
const out = [];
|
|
1028
1028
|
for (const id of all_ids) {
|
|
1029
1029
|
const c = by_id_current.get(id);
|
|
1030
1030
|
const b = by_id_baseline.get(id);
|
|
1031
1031
|
const score_deltas = {};
|
|
1032
1032
|
let any_score_regression = false;
|
|
1033
|
-
const judge_names = new Set([...Object.keys(c?.scores ?? {}), ...Object.keys(b?.scores ?? {})]);
|
|
1033
|
+
const judge_names = /* @__PURE__ */ new Set([...Object.keys(c?.scores ?? {}), ...Object.keys(b?.scores ?? {})]);
|
|
1034
1034
|
for (const name of judge_names) {
|
|
1035
1035
|
const delta = score_value(c?.scores[name]) - score_value(b?.scores[name]);
|
|
1036
1036
|
score_deltas[name] = delta;
|
|
@@ -1065,7 +1065,7 @@ function index_by_case_id(cases) {
|
|
|
1065
1065
|
return m;
|
|
1066
1066
|
}
|
|
1067
1067
|
function collect_judge_names(a, b) {
|
|
1068
|
-
return [
|
|
1068
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(a.summary.mean_scores), ...Object.keys(b.summary.mean_scores)])].toSorted();
|
|
1069
1069
|
}
|
|
1070
1070
|
async function read_baseline(path) {
|
|
1071
1071
|
const text = await readFile(path, "utf8");
|
|
@@ -1085,7 +1085,7 @@ function validate_report(value, path) {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
//#endregion
|
|
1087
1087
|
//#region src/engine/pricing.ts
|
|
1088
|
-
const FREE_PROVIDERS = new Set(["ollama", "lmstudio"]);
|
|
1088
|
+
const FREE_PROVIDERS = /* @__PURE__ */ new Set(["ollama", "lmstudio"]);
|
|
1089
1089
|
const DEFAULT_PRICING = Object.freeze({
|
|
1090
1090
|
"anthropic:claude-opus-4-8": {
|
|
1091
1091
|
input_per_million: 5,
|
|
@@ -1530,7 +1530,7 @@ function translate_anthropic_effort(effort) {
|
|
|
1530
1530
|
function normalize_anthropic_usage(raw) {
|
|
1531
1531
|
return default_normalize_usage(raw);
|
|
1532
1532
|
}
|
|
1533
|
-
const SUPPORTED$7 = new Set([
|
|
1533
|
+
const SUPPORTED$7 = /* @__PURE__ */ new Set([
|
|
1534
1534
|
"text",
|
|
1535
1535
|
"tools",
|
|
1536
1536
|
"schema",
|
|
@@ -1578,7 +1578,7 @@ function translate_openai_effort(effort) {
|
|
|
1578
1578
|
function normalize_openai_usage(raw) {
|
|
1579
1579
|
return default_normalize_usage(raw);
|
|
1580
1580
|
}
|
|
1581
|
-
const SUPPORTED$6 = new Set([
|
|
1581
|
+
const SUPPORTED$6 = /* @__PURE__ */ new Set([
|
|
1582
1582
|
"text",
|
|
1583
1583
|
"tools",
|
|
1584
1584
|
"schema",
|
|
@@ -1628,7 +1628,7 @@ function translate_google_effort(effort) {
|
|
|
1628
1628
|
function normalize_google_usage(raw) {
|
|
1629
1629
|
return default_normalize_usage(raw);
|
|
1630
1630
|
}
|
|
1631
|
-
const SUPPORTED$5 = new Set([
|
|
1631
|
+
const SUPPORTED$5 = /* @__PURE__ */ new Set([
|
|
1632
1632
|
"text",
|
|
1633
1633
|
"tools",
|
|
1634
1634
|
"schema",
|
|
@@ -1669,7 +1669,7 @@ function normalize_ollama_usage(raw) {
|
|
|
1669
1669
|
delete base.reasoning_tokens;
|
|
1670
1670
|
return base;
|
|
1671
1671
|
}
|
|
1672
|
-
const SUPPORTED$4 = new Set([
|
|
1672
|
+
const SUPPORTED$4 = /* @__PURE__ */ new Set([
|
|
1673
1673
|
"text",
|
|
1674
1674
|
"tools",
|
|
1675
1675
|
"schema",
|
|
@@ -1705,7 +1705,7 @@ function normalize_lmstudio_usage(raw) {
|
|
|
1705
1705
|
delete base.reasoning_tokens;
|
|
1706
1706
|
return base;
|
|
1707
1707
|
}
|
|
1708
|
-
const SUPPORTED$3 = new Set([
|
|
1708
|
+
const SUPPORTED$3 = /* @__PURE__ */ new Set([
|
|
1709
1709
|
"text",
|
|
1710
1710
|
"tools",
|
|
1711
1711
|
"schema",
|
|
@@ -1721,7 +1721,8 @@ const create_lmstudio_adapter = (init) => {
|
|
|
1721
1721
|
async build_model(model_id) {
|
|
1722
1722
|
return (await load_optional_peer("@ai-sdk/openai-compatible")).createOpenAICompatible({
|
|
1723
1723
|
name: "lmstudio",
|
|
1724
|
-
baseURL: base_url
|
|
1724
|
+
baseURL: base_url,
|
|
1725
|
+
includeUsage: true
|
|
1725
1726
|
})(model_id);
|
|
1726
1727
|
},
|
|
1727
1728
|
translate_effort: translate_lmstudio_effort,
|
|
@@ -1744,7 +1745,7 @@ function translate_openrouter_effort(effort) {
|
|
|
1744
1745
|
function normalize_openrouter_usage(raw) {
|
|
1745
1746
|
return default_normalize_usage(raw);
|
|
1746
1747
|
}
|
|
1747
|
-
const SUPPORTED$2 = new Set([
|
|
1748
|
+
const SUPPORTED$2 = /* @__PURE__ */ new Set([
|
|
1748
1749
|
"text",
|
|
1749
1750
|
"tools",
|
|
1750
1751
|
"schema",
|
|
@@ -1803,7 +1804,7 @@ function translate_bedrock_effort(effort) {
|
|
|
1803
1804
|
function normalize_bedrock_usage(raw) {
|
|
1804
1805
|
return default_normalize_usage(raw);
|
|
1805
1806
|
}
|
|
1806
|
-
const SUPPORTED$1 = new Set([
|
|
1807
|
+
const SUPPORTED$1 = /* @__PURE__ */ new Set([
|
|
1807
1808
|
"text",
|
|
1808
1809
|
"tools",
|
|
1809
1810
|
"schema",
|
|
@@ -3166,7 +3167,7 @@ function create_option_ignored_dedup(trajectory) {
|
|
|
3166
3167
|
* dispose, supports }` — no `build_model`, `translate_effort`, or
|
|
3167
3168
|
* `normalize_usage` members.
|
|
3168
3169
|
*/
|
|
3169
|
-
const SUPPORTED = new Set([
|
|
3170
|
+
const SUPPORTED = /* @__PURE__ */ new Set([
|
|
3170
3171
|
"text",
|
|
3171
3172
|
"tools",
|
|
3172
3173
|
"schema",
|
|
@@ -3458,7 +3459,7 @@ function create_claude_cli_adapter(init) {
|
|
|
3458
3459
|
* a frozen Map; runtime provider registration beyond the built-in set is
|
|
3459
3460
|
* deferred (spec §5.9).
|
|
3460
3461
|
*/
|
|
3461
|
-
const BUILTIN_PROVIDERS = new Map([
|
|
3462
|
+
const BUILTIN_PROVIDERS = /* @__PURE__ */ new Map([
|
|
3462
3463
|
["anthropic", create_anthropic_adapter],
|
|
3463
3464
|
["openai", create_openai_adapter],
|
|
3464
3465
|
["google", create_google_adapter],
|
|
@@ -4542,8 +4543,9 @@ function to_sdk_messages(messages) {
|
|
|
4542
4543
|
* as potentially attacker-controlled: it warns on every call (and newer `ai`
|
|
4543
4544
|
* versions throw unless `allowSystemInMessages` is set). fascicle's system
|
|
4544
4545
|
* content is the developer's own prompt, and the SDK's own recommendation is to
|
|
4545
|
-
* deliver it through the top-level `
|
|
4546
|
-
* at its source rather than
|
|
4546
|
+
* deliver it through the top-level `instructions` option (v7's rename of the
|
|
4547
|
+
* former `system` option), which removes the warning at its source rather than
|
|
4548
|
+
* suppressing it.
|
|
4547
4549
|
*
|
|
4548
4550
|
* Only the *leading* run is hoisted (fascicle's only shape: one or more system
|
|
4549
4551
|
* messages, then the conversation). A system message that appears after a
|
|
@@ -4616,11 +4618,7 @@ function map_stream_part_to_chunk(part, step_index) {
|
|
|
4616
4618
|
}
|
|
4617
4619
|
}
|
|
4618
4620
|
function default_usage_from_sdk(usage) {
|
|
4619
|
-
|
|
4620
|
-
return {
|
|
4621
|
-
input_tokens: raw.input_tokens ?? 0,
|
|
4622
|
-
output_tokens: raw.output_tokens ?? 0
|
|
4623
|
-
};
|
|
4621
|
+
return default_normalize_usage(to_raw_provider_usage(usage));
|
|
4624
4622
|
}
|
|
4625
4623
|
async function collect_stream(params, step_index, dispatcher, on_first_chunk, internal_controller, adapter) {
|
|
4626
4624
|
const stream_result = streamText(params);
|
|
@@ -4629,7 +4627,7 @@ async function collect_stream(params, step_index, dispatcher, on_first_chunk, in
|
|
|
4629
4627
|
let finish_reason = "stop";
|
|
4630
4628
|
let raw_usage = {};
|
|
4631
4629
|
let first = true;
|
|
4632
|
-
for await (const part of stream_result.
|
|
4630
|
+
for await (const part of stream_result.stream) {
|
|
4633
4631
|
if (first) {
|
|
4634
4632
|
first = false;
|
|
4635
4633
|
on_first_chunk();
|
|
@@ -4686,7 +4684,7 @@ async function collect_non_stream(params, adapter) {
|
|
|
4686
4684
|
};
|
|
4687
4685
|
}
|
|
4688
4686
|
/**
|
|
4689
|
-
* When `
|
|
4687
|
+
* When `output` (structured output) is in play, `generateText` eagerly parses the
|
|
4690
4688
|
* model's text against the schema and throws `NoObjectGeneratedError` if it
|
|
4691
4689
|
* does not conform. That parse is the SDK's, not fascicle's: turning it into a
|
|
4692
4690
|
* thrown error would skip the engine's own schema-parse + repair loop (and the
|
|
@@ -4840,12 +4838,12 @@ async function generate(opts_in, engine) {
|
|
|
4840
4838
|
model,
|
|
4841
4839
|
messages: sdk_messages,
|
|
4842
4840
|
abortSignal: internal_controller.signal,
|
|
4843
|
-
stopWhen:
|
|
4841
|
+
stopWhen: isStepCount(1),
|
|
4844
4842
|
maxRetries: 0
|
|
4845
4843
|
};
|
|
4846
|
-
if (hoisted_system !== void 0) base_params.
|
|
4844
|
+
if (hoisted_system !== void 0) base_params.instructions = hoisted_system;
|
|
4847
4845
|
if (sdk_tools !== void 0) base_params.tools = sdk_tools;
|
|
4848
|
-
if (output_spec !== void 0) base_params.
|
|
4846
|
+
if (output_spec !== void 0) base_params.output = output_spec;
|
|
4849
4847
|
if (provider_options !== void 0) base_params.providerOptions = provider_options;
|
|
4850
4848
|
if (opts.temperature !== void 0) base_params.temperature = opts.temperature;
|
|
4851
4849
|
if (opts.max_tokens !== void 0) base_params.maxOutputTokens = opts.max_tokens;
|
|
@@ -5331,8 +5329,9 @@ function start_server(options) {
|
|
|
5331
5329
|
http_server.listen(port, host, () => {
|
|
5332
5330
|
http_server.removeListener("error", res_err);
|
|
5333
5331
|
const addr = http_server.address();
|
|
5332
|
+
const bound_port = addr !== null && typeof addr === "object" && "port" in addr ? addr.port : port;
|
|
5334
5333
|
res_ok({
|
|
5335
|
-
url: `http://${host}:${
|
|
5334
|
+
url: `http://${host}:${bound_port}`,
|
|
5336
5335
|
close: () => close_server(http_server)
|
|
5337
5336
|
});
|
|
5338
5337
|
});
|