@yaklabs-ai/plugin-sdk 0.13.9 → 0.14.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/README.md CHANGED
@@ -13,7 +13,7 @@ it under the name your plugin code actually imports:
13
13
  ```json
14
14
  {
15
15
  "dependencies": {
16
- "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.13.9"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.14.0"
17
17
  }
18
18
  }
19
19
  ```
@@ -62,7 +62,7 @@ Every tool the entrypoint registers is declared in the manifest too:
62
62
  "description": "Greets people by name.",
63
63
  "version": "0.1.0",
64
64
  "namespace": "widgets",
65
- "compatibility": { "sdk": "^0.13.9" },
65
+ "compatibility": { "sdk": "^0.14.0" },
66
66
  "targets": {
67
67
  "kay": {
68
68
  "agent": {
@@ -139,6 +139,14 @@ sign-in names one of the plugin's auth services in `authService`; that service m
139
139
  one `delegated` scheme, which Bonsai uses to sign the person in to the server. Bonsai declares that
140
140
  scheme at runtime; the plugin's code must not declare it again.
141
141
 
142
+ From 0.13.10 the manifest schema carries two facts Bonsai reads for its own plugins only; another
143
+ plugin's are ignored, with a load diagnostic. An `external-cli` auth scheme's `cli` says how Bonsai
144
+ connects a local CLI: the `binary`, the `probe` argv (a zero exit is the connection) with the CLI's
145
+ signed-out marker (required with `login`), an optional `login` argv the CLI runs itself, the `hints` a person reads, and the
146
+ `install` argv, which Bonsai only shows or hands to an agent session and never runs. A `kay.agent`
147
+ auth grant on another plugin's sign-in (`google.account`) can carry a `frontDoor`: the door `id` and
148
+ label a product is offered under, and an optional file picker.
149
+
142
150
  `kay-agent/host` is intentionally not published; it is Bonsai's own loading
143
151
  machinery, not an authoring API.
144
152
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-sdk",
4
- "version": "0.13.9",
4
+ "version": "0.14.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -1690,118 +1690,6 @@ declare function IsUnsafe(value: unknown): value is TUnsafe;
1690
1690
  /** Returns true if the given value is TVoid. */
1691
1691
  declare function IsVoid(value: unknown): value is TVoid;
1692
1692
 
1693
- /** The answer shape one question gets back. */
1694
- declare type JevAnswerFor<Q> = Q extends JevBoolQuestion ? JevBoolAnswer : Q extends JevChoiceQuestion<infer L> ? JevChoiceAnswer<L> : Q extends JevScoreQuestion ? JevScoreAnswer : never;
1695
-
1696
- declare interface JevBoolAnswer {
1697
- readonly type: "bool";
1698
- /** P(yes), from 0 to 1. */
1699
- readonly probability: number;
1700
- }
1701
-
1702
- /** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
1703
- declare interface JevBoolQuestion {
1704
- readonly type: "bool";
1705
- readonly instructions: string;
1706
- readonly criteria?: {
1707
- readonly true: string;
1708
- readonly false: string;
1709
- };
1710
- }
1711
-
1712
- declare interface JevChoiceAnswer<L extends string = string> {
1713
- readonly type: "choice";
1714
- readonly choice: L;
1715
- readonly confidence: number;
1716
- /** P(label) for every offered label. */
1717
- readonly probabilities: Readonly<Record<L, number>>;
1718
- }
1719
-
1720
- /** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
1721
- declare interface JevChoiceQuestion<L extends string = string> {
1722
- readonly type: "choice";
1723
- readonly instructions: string;
1724
- readonly criteria: Readonly<Record<L, string>>;
1725
- }
1726
-
1727
- /** One answered request: every asked question has an answer of its own kind. */
1728
- declare interface JevClassification<Q extends JevQuestions = JevQuestions> {
1729
- /** The Jev model the host asked. */
1730
- readonly model: string;
1731
- readonly answers: {
1732
- readonly [K in keyof Q]: JevAnswerFor<Q[K]>;
1733
- };
1734
- /** Token counts, when the route reported them. */
1735
- readonly usage?: {
1736
- readonly inputTokens: number;
1737
- readonly outputTokens: number;
1738
- };
1739
- }
1740
-
1741
- declare interface JevClassifyRequest<Q extends JevQuestions = JevQuestions> {
1742
- readonly state: JevState;
1743
- readonly questions: Q;
1744
- }
1745
-
1746
- /**
1747
- * The Jev client a `use` body receives. `classify` either resolves with an answer for every
1748
- * asked question, each of its question's kind, or rejects with a {@link JevCallError}; it never
1749
- * resolves with a partial or substituted answer.
1750
- */
1751
- declare interface JevClient {
1752
- classify<const Q extends JevQuestions>(request: JevClassifyRequest<Q>, options?: {
1753
- readonly signal?: AbortSignal;
1754
- }): Promise<JevClassification<Q>>;
1755
- }
1756
-
1757
- declare type JevQuestion = JevBoolQuestion | JevChoiceQuestion | JevScoreQuestion;
1758
-
1759
- /** A rubric: questions keyed by the name each answer comes back under. */
1760
- declare type JevQuestions = Readonly<Record<string, JevQuestion>>;
1761
-
1762
- declare interface JevScoreAnswer {
1763
- readonly type: "score";
1764
- /** The expected score, from 0 to the number of rungs minus one. */
1765
- readonly score: number;
1766
- readonly confidence: number;
1767
- }
1768
-
1769
- /** A score over ordered rungs: the first criterion scores 0, the next 1, and so on. */
1770
- declare interface JevScoreQuestion {
1771
- readonly type: "score";
1772
- readonly instructions: string;
1773
- readonly criteria: readonly string[];
1774
- }
1775
-
1776
- /**
1777
- * ---
1778
- * responsibility: The plugin-facing CONTRACT for Jev typed-decision inference — the shape of
1779
- * `api.withJev` on both plugin SDK targets, the {@link JevClient} a `use` body receives, the
1780
- * question and answer vocabulary it speaks, and the fallback-only implementation a host
1781
- * without a Jev lane binds.
1782
- * owns:
1783
- * - {@link WithJev}, {@link WithJevOptions}, {@link createFallbackOnlyWithJev}.
1784
- * - {@link JevClient}, the {@link JevQuestion} and {@link JevAnswer} vocabulary, and
1785
- * {@link JevCallError}.
1786
- * does_not_own:
1787
- * - The wire. The host serves `classify` over whichever route the user's Jev provider order
1788
- * picks; a plugin never sees a vendor client, a vendor type, or a route.
1789
- * - Credential resolution, the `jev.use` decision, the Jev-branch budget, or usage accounting.
1790
- * Those are host-side (`@bonsai/agent-runtime`'s `kay/jev/`).
1791
- * ---
1792
- *
1793
- * The vocabulary is Bonsai's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
1794
- * and plugins coded against a vendor's types. It follows pi's classifier contract, which the host
1795
- * runs Jev through: a yes/no question is `bool` and answers a `probability`, every instruction and
1796
- * criterion is text, and the state is a JSON object.
1797
- */
1798
- /**
1799
- * The state a rubric reads: a JSON object, never text or an array. Every value must survive
1800
- * `JSON.stringify` unchanged (no functions or class instances), because it is sent as JSON.
1801
- * Typed as `object` so a state declared as an interface fits without an index signature.
1802
- */
1803
- declare type JevState = object;
1804
-
1805
1693
  declare type JsonPrimitive = string | number | boolean | null;
1806
1694
 
1807
1695
  declare type JsonSchema = Record<string, unknown>;
@@ -2023,20 +1911,10 @@ declare interface KayAgentPluginApi {
2023
1911
  * {@link KayAgentPluginApi.registerInteractionDriver} to make it drivable by the agent.
2024
1912
  */
2025
1913
  readonly interaction: KayAgentInteractionSurfaces;
2026
- /**
2027
- * Jev typed-decision inference, as an OPTIONAL accelerator with a REQUIRED fallback. Each call
2028
- * is checked against `jev.use` — but a refused grant or no usable Jev provider both
2029
- * produce the same outcome: your `fallback` runs.
2030
- *
2031
- * Always present, on every host. That is the point: with no absent state to feature-detect,
2032
- * there is no shape of code that reaches Jev without having written the baseline too. Do not
2033
- * guard it with `if (api.withJev !== undefined)`.
2034
- */
2035
- readonly withJev: WithJev;
2036
1914
  /**
2037
1915
  * System One: fast, cheap judgment calls (`decide`) and typed field extraction (`extract`) on
2038
- * small models (Jev, Clef, Clef Flash, Clairic). Each call is checked against `jev.use`; a call
2039
- * that cannot be served or is not permitted throws a `SystemOneError` whose `cause.kind` says
1916
+ * small models (Jev, Clef, Clef Flash, Clairic). Each call is checked against `systemOne.use`; a
1917
+ * call that cannot be served or is not permitted throws a `SystemOneError` whose `cause.kind` says
2040
1918
  * why, so put the feature's cheaper path in the call's own `catch`. Always present, on every
2041
1919
  * host; a host with no System One throws `not-served`. Types: `@bonsai/plugin-sdk/system-one`
2042
1920
  * (SDK 0.13.8).
@@ -2059,7 +1937,7 @@ declare interface KayAgentPluginApi {
2059
1937
  readonly userFiles: KayAppUserFiles;
2060
1938
  /**
2061
1939
  * Publish the plugin's declared events, for example so a default notification rule can tell the
2062
- * user what the agent just did. Always present, like {@link withJev}: there is nothing to
1940
+ * user what the agent just did. Always present, like {@link systemOne}: there is nothing to
2063
1941
  * feature-detect, and a host that composed no events lane drops what is published.
2064
1942
  */
2065
1943
  readonly events: KayAgentEvents;
@@ -3918,18 +3796,10 @@ declare function ReturnType_2<Type extends TSchema>(type: Type, options?: TSchem
3918
3796
  /** Creates a deferred ReturnType action. */
3919
3797
  declare function ReturnTypeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnTypeDeferred<Type>;
3920
3798
 
3921
- /**
3922
- * ---
3923
- * responsibility: The closed vocabulary of why a model run failed, as plain data.
3924
- * owns:
3925
- * - {@link RunFailureReason}.
3926
- * does_not_own:
3927
- * - Classifying a failure into a reason (`./run-failure-classifier.ts`), or the engine's
3928
- * run-error mapping and recovery policy (`@herd/herd-agent`).
3929
- * ---
3930
- */
3931
- /** Provider-neutral factual category for a failed model run. */
3932
- declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_disabled" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
3799
+ /** Observed cause of a failed request or interrupted run. */
3800
+ declare const RUN_FAILURE_REASONS: readonly ["auth", "cancelled", "content_blocked", "context_overflow", "invalid_request", "model_disabled", "model_unavailable", "network", "organization_unavailable", "overloaded", "quota_exhausted", "rate_limit", "runtime_interrupted", "safeguard_block", "seat_unpaid", "server_error", "sign_in_required", "stream_interrupted", "timeout", "unknown"];
3801
+
3802
+ declare type RunFailureReason = (typeof RUN_FAILURE_REASONS)[number];
3933
3803
 
3934
3804
  declare namespace S {
3935
3805
  export {
@@ -9612,53 +9482,6 @@ declare const WithElementList_0: (input: string, result?: unknown[]) => [unknown
9612
9482
 
9613
9483
  declare function WithElementListMapping(input: [unknown, unknown, unknown] | []): unknown;
9614
9484
 
9615
- /**
9616
- * Run `use` against a live Jev client, falling back to `fallback` whenever Jev cannot serve the
9617
- * call. The wrapper exists so a feature can ASK for a typed decision without ever depending on
9618
- * one: `fallback` is required, and it runs whenever no provider in the user's Jev provider
9619
- * order holds a usable credential, the user has not granted `jev.use`, the branch exceeds its budget, `use` throws, or
9620
- * `use` declines by returning `undefined`. With valid options, this rejects on an explicit
9621
- * `signal` abort, reaching `deadlineAt`, or `fallback` itself throwing.
9622
- *
9623
- * ALWAYS PRESENT on the plugin API, on every host. A host that composed no Jev lane binds
9624
- * {@link createFallbackOnlyWithJev}, so a caller never branches on availability — branching is
9625
- * exactly how a fallback gets skipped.
9626
- *
9627
- * `jev` is a {@link JevClient} on the host's Jev model. It is valid only for the duration of
9628
- * the callback: a reference retained past `use`'s scope is refused at the transport, and an
9629
- * in-flight request is aborted when the call stops waiting.
9630
- * The callback itself is ABANDONED, not interrupted — a host cannot stop arbitrary JavaScript
9631
- * that is already running, so `use` must not perform side effects it would mind completing
9632
- * unobserved. The same applies to a running fallback: abort/deadline stops waiting for it but
9633
- * cannot interrupt its JavaScript.
9634
- */
9635
- declare type WithJev = <T>(
9636
- /** Return `undefined` to decline (the fallback runs). A feature whose real result can itself be
9637
- * `undefined` should return `null` or its own wrapper type instead. */
9638
- use: (jev: JevClient) => T | undefined | PromiseLike<T | undefined>,
9639
- /** Required. The behaviour the feature has without Jev. */
9640
- fallback: () => T | PromiseLike<T>, options?: WithJevOptions) => Promise<T>;
9641
-
9642
- /** Per-call knobs for {@link WithJev}. Every field is optional; the host applies its own default
9643
- * budget when none is given, so the Jev branch is never unbounded. */
9644
- declare interface WithJevOptions {
9645
- /**
9646
- * Explicit cancellation. Always propagates as a rejection; never substituted with `fallback`,
9647
- * because an aborted call means "stop", not "use the cheaper path".
9648
- */
9649
- readonly signal?: AbortSignal;
9650
- /** Bounds the Jev branch alone, measured from the call. */
9651
- readonly timeoutMs?: number;
9652
- /**
9653
- * Absolute epoch-ms hard deadline for the WHOLE call, `fallback` included. A deadline already
9654
- * passed rejects (like `signal`); one still ahead derives the Jev branch's budget from it and
9655
- * keeps a small reserve so `fallback` has a window to run.
9656
- */
9657
- readonly deadlineAt?: number;
9658
- /** Attribution slug for host usage accounting. Never sent to Jev. */
9659
- readonly purpose?: string;
9660
- }
9661
-
9662
9485
  declare function WithMapping(input: [unknown, unknown] | []): unknown;
9663
9486
 
9664
9487
  declare const WithNull: (input: string) => [unknown, string] | [];
@@ -834,7 +834,6 @@ var INERT_WHITEBOARD = {
834
834
  remove: inertResult
835
835
  })
836
836
  };
837
- var INERT_WITH_JEV = async (_use, fallback) => fallback();
838
837
  function createKayAgentProbeCapabilityHandles() {
839
838
  return {
840
839
  network: INERT_NETWORK,
@@ -845,7 +844,6 @@ function createKayAgentProbeCapabilityHandles() {
845
844
  interaction: unavailableInteractionSurfaces("Interaction surfaces are not available while a plugin is being probed."),
846
845
  interceptToolCall: () => {
847
846
  },
848
- withJev: INERT_WITH_JEV,
849
847
  // Throws `not-served` at once, the outcome a plugin's own `catch` already handles.
850
848
  systemOne: createUnavailableSystemOneClient(),
851
849
  // Fire-and-forget on the real api too, so dropping is the inert shape: nothing to hang on.
@@ -1046,7 +1046,7 @@ declare function FactorMapping(input: [unknown, unknown, unknown, unknown, unkno
1046
1046
  export declare function fauxAuthContext(overrides?: Partial<ExtensionAuthContext>): ExtensionAuthContext;
1047
1047
 
1048
1048
  /** The capability handles a `KayAgentPluginApi` always carries — authority is decided per call. */
1049
- export declare type FauxKayAgentCapabilities = Pick<KayAgentPluginApi, "network" | "webSession" | "process" | "whiteboard" | "interaction" | "interceptToolCall" | "withJev" | "systemOne" | "events" | "time" | "userFiles" | "familyFolder">;
1049
+ export declare type FauxKayAgentCapabilities = Pick<KayAgentPluginApi, "network" | "webSession" | "process" | "whiteboard" | "interaction" | "interceptToolCall" | "systemOne" | "events" | "time" | "userFiles" | "familyFolder">;
1050
1050
 
1051
1051
  export declare function fauxKayAgentCapabilities(): FauxKayAgentCapabilities;
1052
1052
 
@@ -1607,118 +1607,6 @@ declare function IsUnsafe(value: unknown): value is TUnsafe;
1607
1607
  /** Returns true if the given value is TVoid. */
1608
1608
  declare function IsVoid(value: unknown): value is TVoid;
1609
1609
 
1610
- /** The answer shape one question gets back. */
1611
- declare type JevAnswerFor<Q> = Q extends JevBoolQuestion ? JevBoolAnswer : Q extends JevChoiceQuestion<infer L> ? JevChoiceAnswer<L> : Q extends JevScoreQuestion ? JevScoreAnswer : never;
1612
-
1613
- declare interface JevBoolAnswer {
1614
- readonly type: "bool";
1615
- /** P(yes), from 0 to 1. */
1616
- readonly probability: number;
1617
- }
1618
-
1619
- /** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
1620
- declare interface JevBoolQuestion {
1621
- readonly type: "bool";
1622
- readonly instructions: string;
1623
- readonly criteria?: {
1624
- readonly true: string;
1625
- readonly false: string;
1626
- };
1627
- }
1628
-
1629
- declare interface JevChoiceAnswer<L extends string = string> {
1630
- readonly type: "choice";
1631
- readonly choice: L;
1632
- readonly confidence: number;
1633
- /** P(label) for every offered label. */
1634
- readonly probabilities: Readonly<Record<L, number>>;
1635
- }
1636
-
1637
- /** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
1638
- declare interface JevChoiceQuestion<L extends string = string> {
1639
- readonly type: "choice";
1640
- readonly instructions: string;
1641
- readonly criteria: Readonly<Record<L, string>>;
1642
- }
1643
-
1644
- /** One answered request: every asked question has an answer of its own kind. */
1645
- declare interface JevClassification<Q extends JevQuestions = JevQuestions> {
1646
- /** The Jev model the host asked. */
1647
- readonly model: string;
1648
- readonly answers: {
1649
- readonly [K in keyof Q]: JevAnswerFor<Q[K]>;
1650
- };
1651
- /** Token counts, when the route reported them. */
1652
- readonly usage?: {
1653
- readonly inputTokens: number;
1654
- readonly outputTokens: number;
1655
- };
1656
- }
1657
-
1658
- declare interface JevClassifyRequest<Q extends JevQuestions = JevQuestions> {
1659
- readonly state: JevState;
1660
- readonly questions: Q;
1661
- }
1662
-
1663
- /**
1664
- * The Jev client a `use` body receives. `classify` either resolves with an answer for every
1665
- * asked question, each of its question's kind, or rejects with a {@link JevCallError}; it never
1666
- * resolves with a partial or substituted answer.
1667
- */
1668
- declare interface JevClient {
1669
- classify<const Q extends JevQuestions>(request: JevClassifyRequest<Q>, options?: {
1670
- readonly signal?: AbortSignal;
1671
- }): Promise<JevClassification<Q>>;
1672
- }
1673
-
1674
- declare type JevQuestion = JevBoolQuestion | JevChoiceQuestion | JevScoreQuestion;
1675
-
1676
- /** A rubric: questions keyed by the name each answer comes back under. */
1677
- declare type JevQuestions = Readonly<Record<string, JevQuestion>>;
1678
-
1679
- declare interface JevScoreAnswer {
1680
- readonly type: "score";
1681
- /** The expected score, from 0 to the number of rungs minus one. */
1682
- readonly score: number;
1683
- readonly confidence: number;
1684
- }
1685
-
1686
- /** A score over ordered rungs: the first criterion scores 0, the next 1, and so on. */
1687
- declare interface JevScoreQuestion {
1688
- readonly type: "score";
1689
- readonly instructions: string;
1690
- readonly criteria: readonly string[];
1691
- }
1692
-
1693
- /**
1694
- * ---
1695
- * responsibility: The plugin-facing CONTRACT for Jev typed-decision inference — the shape of
1696
- * `api.withJev` on both plugin SDK targets, the {@link JevClient} a `use` body receives, the
1697
- * question and answer vocabulary it speaks, and the fallback-only implementation a host
1698
- * without a Jev lane binds.
1699
- * owns:
1700
- * - {@link WithJev}, {@link WithJevOptions}, {@link createFallbackOnlyWithJev}.
1701
- * - {@link JevClient}, the {@link JevQuestion} and {@link JevAnswer} vocabulary, and
1702
- * {@link JevCallError}.
1703
- * does_not_own:
1704
- * - The wire. The host serves `classify` over whichever route the user's Jev provider order
1705
- * picks; a plugin never sees a vendor client, a vendor type, or a route.
1706
- * - Credential resolution, the `jev.use` decision, the Jev-branch budget, or usage accounting.
1707
- * Those are host-side (`@bonsai/agent-runtime`'s `kay/jev/`).
1708
- * ---
1709
- *
1710
- * The vocabulary is Bonsai's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
1711
- * and plugins coded against a vendor's types. It follows pi's classifier contract, which the host
1712
- * runs Jev through: a yes/no question is `bool` and answers a `probability`, every instruction and
1713
- * criterion is text, and the state is a JSON object.
1714
- */
1715
- /**
1716
- * The state a rubric reads: a JSON object, never text or an array. Every value must survive
1717
- * `JSON.stringify` unchanged (no functions or class instances), because it is sent as JSON.
1718
- * Typed as `object` so a state declared as an interface fits without an index signature.
1719
- */
1720
- declare type JevState = object;
1721
-
1722
1610
  declare type JsonPrimitive = string | number | boolean | null;
1723
1611
 
1724
1612
  declare type JsonSchema = Record<string, unknown>;
@@ -1937,20 +1825,10 @@ declare interface KayAgentPluginApi {
1937
1825
  * {@link KayAgentPluginApi.registerInteractionDriver} to make it drivable by the agent.
1938
1826
  */
1939
1827
  readonly interaction: KayAgentInteractionSurfaces;
1940
- /**
1941
- * Jev typed-decision inference, as an OPTIONAL accelerator with a REQUIRED fallback. Each call
1942
- * is checked against `jev.use` — but a refused grant or no usable Jev provider both
1943
- * produce the same outcome: your `fallback` runs.
1944
- *
1945
- * Always present, on every host. That is the point: with no absent state to feature-detect,
1946
- * there is no shape of code that reaches Jev without having written the baseline too. Do not
1947
- * guard it with `if (api.withJev !== undefined)`.
1948
- */
1949
- readonly withJev: WithJev;
1950
1828
  /**
1951
1829
  * System One: fast, cheap judgment calls (`decide`) and typed field extraction (`extract`) on
1952
- * small models (Jev, Clef, Clef Flash, Clairic). Each call is checked against `jev.use`; a call
1953
- * that cannot be served or is not permitted throws a `SystemOneError` whose `cause.kind` says
1830
+ * small models (Jev, Clef, Clef Flash, Clairic). Each call is checked against `systemOne.use`; a
1831
+ * call that cannot be served or is not permitted throws a `SystemOneError` whose `cause.kind` says
1954
1832
  * why, so put the feature's cheaper path in the call's own `catch`. Always present, on every
1955
1833
  * host; a host with no System One throws `not-served`. Types: `@bonsai/plugin-sdk/system-one`
1956
1834
  * (SDK 0.13.8).
@@ -1973,7 +1851,7 @@ declare interface KayAgentPluginApi {
1973
1851
  readonly userFiles: KayAppUserFiles;
1974
1852
  /**
1975
1853
  * Publish the plugin's declared events, for example so a default notification rule can tell the
1976
- * user what the agent just did. Always present, like {@link withJev}: there is nothing to
1854
+ * user what the agent just did. Always present, like {@link systemOne}: there is nothing to
1977
1855
  * feature-detect, and a host that composed no events lane drops what is published.
1978
1856
  */
1979
1857
  readonly events: KayAgentEvents;
@@ -3829,18 +3707,10 @@ declare function ReturnType_2<Type extends TSchema>(type: Type, options?: TSchem
3829
3707
  /** Creates a deferred ReturnType action. */
3830
3708
  declare function ReturnTypeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnTypeDeferred<Type>;
3831
3709
 
3832
- /**
3833
- * ---
3834
- * responsibility: The closed vocabulary of why a model run failed, as plain data.
3835
- * owns:
3836
- * - {@link RunFailureReason}.
3837
- * does_not_own:
3838
- * - Classifying a failure into a reason (`./run-failure-classifier.ts`), or the engine's
3839
- * run-error mapping and recovery policy (`@herd/herd-agent`).
3840
- * ---
3841
- */
3842
- /** Provider-neutral factual category for a failed model run. */
3843
- declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_disabled" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
3710
+ /** Observed cause of a failed request or interrupted run. */
3711
+ declare const RUN_FAILURE_REASONS: readonly ["auth", "cancelled", "content_blocked", "context_overflow", "invalid_request", "model_disabled", "model_unavailable", "network", "organization_unavailable", "overloaded", "quota_exhausted", "rate_limit", "runtime_interrupted", "safeguard_block", "seat_unpaid", "server_error", "sign_in_required", "stream_interrupted", "timeout", "unknown"];
3712
+
3713
+ declare type RunFailureReason = (typeof RUN_FAILURE_REASONS)[number];
3844
3714
 
3845
3715
  declare namespace S {
3846
3716
  export {
@@ -9535,53 +9405,6 @@ declare const WithElementList_0: (input: string, result?: unknown[]) => [unknown
9535
9405
 
9536
9406
  declare function WithElementListMapping(input: [unknown, unknown, unknown] | []): unknown;
9537
9407
 
9538
- /**
9539
- * Run `use` against a live Jev client, falling back to `fallback` whenever Jev cannot serve the
9540
- * call. The wrapper exists so a feature can ASK for a typed decision without ever depending on
9541
- * one: `fallback` is required, and it runs whenever no provider in the user's Jev provider
9542
- * order holds a usable credential, the user has not granted `jev.use`, the branch exceeds its budget, `use` throws, or
9543
- * `use` declines by returning `undefined`. With valid options, this rejects on an explicit
9544
- * `signal` abort, reaching `deadlineAt`, or `fallback` itself throwing.
9545
- *
9546
- * ALWAYS PRESENT on the plugin API, on every host. A host that composed no Jev lane binds
9547
- * {@link createFallbackOnlyWithJev}, so a caller never branches on availability — branching is
9548
- * exactly how a fallback gets skipped.
9549
- *
9550
- * `jev` is a {@link JevClient} on the host's Jev model. It is valid only for the duration of
9551
- * the callback: a reference retained past `use`'s scope is refused at the transport, and an
9552
- * in-flight request is aborted when the call stops waiting.
9553
- * The callback itself is ABANDONED, not interrupted — a host cannot stop arbitrary JavaScript
9554
- * that is already running, so `use` must not perform side effects it would mind completing
9555
- * unobserved. The same applies to a running fallback: abort/deadline stops waiting for it but
9556
- * cannot interrupt its JavaScript.
9557
- */
9558
- declare type WithJev = <T>(
9559
- /** Return `undefined` to decline (the fallback runs). A feature whose real result can itself be
9560
- * `undefined` should return `null` or its own wrapper type instead. */
9561
- use: (jev: JevClient) => T | undefined | PromiseLike<T | undefined>,
9562
- /** Required. The behaviour the feature has without Jev. */
9563
- fallback: () => T | PromiseLike<T>, options?: WithJevOptions) => Promise<T>;
9564
-
9565
- /** Per-call knobs for {@link WithJev}. Every field is optional; the host applies its own default
9566
- * budget when none is given, so the Jev branch is never unbounded. */
9567
- declare interface WithJevOptions {
9568
- /**
9569
- * Explicit cancellation. Always propagates as a rejection; never substituted with `fallback`,
9570
- * because an aborted call means "stop", not "use the cheaper path".
9571
- */
9572
- readonly signal?: AbortSignal;
9573
- /** Bounds the Jev branch alone, measured from the call. */
9574
- readonly timeoutMs?: number;
9575
- /**
9576
- * Absolute epoch-ms hard deadline for the WHOLE call, `fallback` included. A deadline already
9577
- * passed rejects (like `signal`); one still ahead derives the Jev branch's budget from it and
9578
- * keeps a small reserve so `fallback` has a window to run.
9579
- */
9580
- readonly deadlineAt?: number;
9581
- /** Attribution slug for host usage accounting. Never sent to Jev. */
9582
- readonly purpose?: string;
9583
- }
9584
-
9585
9408
  declare function WithMapping(input: [unknown, unknown] | []): unknown;
9586
9409
 
9587
9410
  declare const WithNull: (input: string) => [unknown, string] | [];
@@ -225,12 +225,6 @@ function fauxKayAgentCapabilities() {
225
225
  // surface as `{ ok: false }`, never a throw. A test driving one overrides this handle.
226
226
  interaction: { browserPane: UNWIRED_SURFACE, desktop: UNWIRED_SURFACE },
227
227
  interceptToolCall: () => void 0,
228
- // The one handle that does NOT refuse on use. `withJev`'s contract is that it always produces
229
- // the baseline, so a rejecting double would make a plugin's Jev path untestable and teach the
230
- // wrong lesson besides: the fallback is the normal outcome, not an error. It reaches no
231
- // client, no key, and no network, which is all a double here has to guarantee. A test that
232
- // wants a real Jev answer overrides this handle after the spread, like any other.
233
- withJev: async (_use, fallback) => fallback(),
234
228
  // Throws `not-served`, so the plugin's own `catch` runs. A test that wants answers overrides
235
229
  // this handle after the spread.
236
230
  systemOne: createUnavailableSystemOneClient(),