fascicle 0.17.1 → 0.17.2
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 +17 -0
- package/dist/AGENTS.md +8 -8
- package/dist/acp.js +1 -1
- package/dist/agents.js +1 -1
- package/dist/{core-BOFcG3tp.js → core-Dwir3pkb.js} +231 -15
- package/dist/core-Dwir3pkb.js.map +1 -0
- package/dist/diagram_bin.js +1 -1
- package/dist/{engine-Bde18P7H.js → engine-DPPqAVdZ.js} +49 -20
- package/dist/engine-DPPqAVdZ.js.map +1 -0
- package/dist/index.d.ts +53 -4
- package/dist/index.js +131 -18
- package/dist/index.js.map +1 -1
- package/dist/{invoke-BbJLQcLl.js → invoke-DF7YLovL.js} +3 -3
- package/dist/{invoke-BbJLQcLl.js.map → invoke-DF7YLovL.js.map} +1 -1
- package/dist/{leading_system-DmNxhvzL.js → leading_system-DJvuhESU.js} +2 -2
- package/dist/{leading_system-DmNxhvzL.js.map → leading_system-DJvuhESU.js.map} +1 -1
- package/dist/mcp.js +1 -1
- package/dist/stdio.js +1 -1
- package/dist/testing.js +3 -3
- package/dist/viewer.js +1 -1
- package/package.json +1 -1
- package/dist/core-BOFcG3tp.js.map +0 -1
- package/dist/engine-Bde18P7H.js.map +0 -1
package/dist/diagram_bin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as describe, k as is_step } from "./core-Dwir3pkb.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as aborted_error, T as validate_schema, f as compute_backoff, p as wait_with_abort, w as format_schema_issues } from "./core-Dwir3pkb.js";
|
|
2
2
|
import { n as is_record$1 } from "./records-1HU7mWXf.js";
|
|
3
|
-
import { A as tool_approval_denied_error, C as provider_auth_error, D as provider_required_error, E as provider_not_configured_error, M as turn_timeout_error, O as rate_limit_error, S as on_chunk_error, T as provider_error, _ as claude_cli_error, b as incomplete_generation_error, c as parse_tool_call_arguments, d as default_normalize_usage, f as load_optional_peer, g as translate_effort_to_sdk_reasoning, h as resolve_transport, i as invoke_http_turn, j as tool_error, k as schema_validation_error, l as read_dialect_init, m as normalize_local_usage, n as consume_framed_stream, o as map_messages_by_role, p as missing_peer_error, r as create_line_splitter, s as network_failure, t as split_leading_system_run, u as split_assistant_parts, v as engine_config_error, w as provider_capability_error, x as model_required_error, y as engine_disposed_error } from "./leading_system-
|
|
3
|
+
import { A as tool_approval_denied_error, C as provider_auth_error, D as provider_required_error, E as provider_not_configured_error, M as turn_timeout_error, O as rate_limit_error, S as on_chunk_error, T as provider_error, _ as claude_cli_error, b as incomplete_generation_error, c as parse_tool_call_arguments, d as default_normalize_usage, f as load_optional_peer, g as translate_effort_to_sdk_reasoning, h as resolve_transport, i as invoke_http_turn, j as tool_error, k as schema_validation_error, l as read_dialect_init, m as normalize_local_usage, n as consume_framed_stream, o as map_messages_by_role, p as missing_peer_error, r as create_line_splitter, s as network_failure, t as split_leading_system_run, u as split_assistant_parts, v as engine_config_error, w as provider_capability_error, x as model_required_error, y as engine_disposed_error } from "./leading_system-DJvuhESU.js";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { mkdtempSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
@@ -465,36 +465,58 @@ function to_abort_error(reason) {
|
|
|
465
465
|
return new aborted_error("aborted", { reason });
|
|
466
466
|
}
|
|
467
467
|
/**
|
|
468
|
-
* Build the `rate_limit_error`
|
|
469
|
-
* failing attempt's own `Retry-After`, falling back to the most
|
|
470
|
-
* prior attempt carried (`last_rate_limit_after`)
|
|
468
|
+
* Build the `rate_limit_error` for a 429 that this layer won't retry again.
|
|
469
|
+
* Prefers the failing attempt's own `Retry-After`, falling back to the most
|
|
470
|
+
* recent one a prior attempt carried (`last_rate_limit_after`), and carries
|
|
471
|
+
* the failure's own message, or `fallback` when it had none.
|
|
471
472
|
*/
|
|
472
|
-
function build_rate_limit_error(retryable, attempt, last_rate_limit_after) {
|
|
473
|
+
function build_rate_limit_error(retryable, attempt, last_rate_limit_after, fallback) {
|
|
473
474
|
const metadata = { attempts: attempt };
|
|
474
475
|
if (retryable.retry_after_ms !== void 0) metadata.retry_after_ms = retryable.retry_after_ms;
|
|
475
476
|
else if (last_rate_limit_after !== void 0) metadata.retry_after_ms = last_rate_limit_after;
|
|
476
477
|
if (retryable.status !== void 0) metadata.status = retryable.status;
|
|
477
|
-
return new rate_limit_error(retryable.message ??
|
|
478
|
+
return new rate_limit_error(retryable.message ?? fallback, metadata);
|
|
478
479
|
}
|
|
479
480
|
/**
|
|
480
|
-
* Build the `provider_error`
|
|
481
|
-
* Timeout collapses onto the `network` cause; only
|
|
481
|
+
* Build the `provider_error` for a 5xx, network, or timeout failure that this
|
|
482
|
+
* layer won't retry again. Timeout collapses onto the `network` cause; only
|
|
483
|
+
* 5xx carries status/body. The failure's own message wins over `fallback`.
|
|
482
484
|
*/
|
|
483
|
-
function build_provider_error(retryable,
|
|
485
|
+
function build_provider_error(retryable, fallback) {
|
|
484
486
|
const metadata = { cause_kind: retryable.kind === "provider_5xx" ? "provider_5xx" : "network" };
|
|
485
487
|
if (retryable.kind === "provider_5xx") {
|
|
486
488
|
if (retryable.status !== void 0) metadata.status = retryable.status;
|
|
487
489
|
if (retryable.body !== void 0) metadata.body = retryable.body;
|
|
488
490
|
}
|
|
489
|
-
return new provider_error(retryable.message ??
|
|
491
|
+
return new provider_error(retryable.message ?? fallback, metadata);
|
|
490
492
|
}
|
|
491
493
|
/**
|
|
492
|
-
* Map
|
|
493
|
-
* `rate_limit_error` for 429s, `provider_error` for
|
|
494
|
+
* Map a classified failure that this layer won't retry again onto the error
|
|
495
|
+
* it rejects with: `rate_limit_error` for 429s, `provider_error` for
|
|
496
|
+
* everything else, after `attempt` failures in all. `fallback` is the message
|
|
497
|
+
* for a failure that carried none of its own.
|
|
494
498
|
*/
|
|
495
|
-
function
|
|
496
|
-
if (retryable.kind === "rate_limit") return build_rate_limit_error(retryable, attempt, last_rate_limit_after);
|
|
497
|
-
return build_provider_error(retryable,
|
|
499
|
+
function build_typed_error(retryable, attempt, last_rate_limit_after, fallback) {
|
|
500
|
+
if (retryable.kind === "rate_limit") return build_rate_limit_error(retryable, attempt, last_rate_limit_after, fallback);
|
|
501
|
+
return build_provider_error(retryable, fallback);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The error for a failure whose kind `retry_on` leaves out. One that's
|
|
505
|
+
* already an `Error`, such as `turn_timeout_error` or a native adapter's
|
|
506
|
+
* network failure, is rethrown as it is, so a caller that catches its class
|
|
507
|
+
* still gets it. A plain record that `classify_provider_error` built becomes
|
|
508
|
+
* the typed error that exhaustion would have thrown for its kind, so a
|
|
509
|
+
* caller never gets a value that prints as `[object Object]`.
|
|
510
|
+
*/
|
|
511
|
+
function build_left_out_error(err, retryable, attempt, last_rate_limit_after) {
|
|
512
|
+
if (err instanceof Error) return err;
|
|
513
|
+
return build_typed_error(retryable, attempt, last_rate_limit_after, `${retryable.kind} not retried: retry_on leaves ${retryable.kind} out`);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* The message for an exhausted failure that carried none of its own.
|
|
517
|
+
*/
|
|
518
|
+
function exhaustion_message(retryable, attempt) {
|
|
519
|
+
return retryable.kind === "rate_limit" ? `rate limited after ${attempt} attempts` : `${retryable.kind} after ${attempt} attempts`;
|
|
498
520
|
}
|
|
499
521
|
/**
|
|
500
522
|
* The server's `Retry-After`, in milliseconds, that a 429 or a 5xx carried,
|
|
@@ -552,6 +574,12 @@ function build_attempt_info(retryable, attempt, delay_ms) {
|
|
|
552
574
|
* exhaustion, throws `rate_limit_error` (for 429s) or `provider_error` (for
|
|
553
575
|
* 5xx/network/timeout).
|
|
554
576
|
*
|
|
577
|
+
* A failure whose kind `retry_on` leaves out isn't retried. It's rethrown as
|
|
578
|
+
* it is when it's already an `Error`, and a plain record becomes the
|
|
579
|
+
* `rate_limit_error` or `provider_error` that exhaustion would throw for its
|
|
580
|
+
* kind, counting every failure so far in `attempts`, with the record's own
|
|
581
|
+
* message, or else one that says `retry_on` leaves its kind out.
|
|
582
|
+
*
|
|
555
583
|
* `on_retry` fires once per retried failure, just before its backoff wait.
|
|
556
584
|
* It does NOT fire for a first attempt that succeeds, a non-retryable
|
|
557
585
|
* failure, or the final failure that exhausts the policy (those two throw
|
|
@@ -572,9 +600,10 @@ async function retry_with_policy(fn, policy = DEFAULT_RETRY, abort, on_retry) {
|
|
|
572
600
|
return await fn(attempt);
|
|
573
601
|
} catch (err) {
|
|
574
602
|
const retryable = classify_retryable(err);
|
|
575
|
-
if (retryable === void 0
|
|
603
|
+
if (retryable === void 0) throw err;
|
|
576
604
|
attempt += 1;
|
|
577
|
-
if (
|
|
605
|
+
if (!is_retryable(retryable.kind, policy)) throw build_left_out_error(err, retryable, attempt, last_rate_limit_after);
|
|
606
|
+
if (attempt >= policy.max_attempts) throw build_typed_error(retryable, attempt, last_rate_limit_after, exhaustion_message(retryable, attempt));
|
|
578
607
|
const backoff = next_backoff(retryable, backoff_policy, attempt);
|
|
579
608
|
last_rate_limit_after = carry_rate_limit_after(retryable, backoff, last_rate_limit_after);
|
|
580
609
|
on_retry?.(build_attempt_info(retryable, attempt, backoff.delay));
|
|
@@ -7710,7 +7739,7 @@ async function build_ai_sdk_transport(cfg) {
|
|
|
7710
7739
|
const provider_options = combined_provider_options !== void 0 && Object.keys(combined_provider_options).length > 0 ? combined_provider_options : void 0;
|
|
7711
7740
|
let ai_sdk_invoke_mod;
|
|
7712
7741
|
try {
|
|
7713
|
-
ai_sdk_invoke_mod = await import("./invoke-
|
|
7742
|
+
ai_sdk_invoke_mod = await import("./invoke-DF7YLovL.js");
|
|
7714
7743
|
} catch (err) {
|
|
7715
7744
|
throw missing_peer_error("ai", err);
|
|
7716
7745
|
}
|
|
@@ -8347,4 +8376,4 @@ function create_engine(config) {
|
|
|
8347
8376
|
//#endregion
|
|
8348
8377
|
export { to_json_schema as n, create_engine as t };
|
|
8349
8378
|
|
|
8350
|
-
//# sourceMappingURL=engine-
|
|
8379
|
+
//# sourceMappingURL=engine-DPPqAVdZ.js.map
|