@yaklabs-ai/plugin-sdk 0.13.10 → 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 +2 -2
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/disclosure.d.ts +3 -172
- package/dist/disclosure.js +0 -2
- package/dist/kay-agent-testing.d.ts +4 -173
- package/dist/kay-agent-testing.js +0 -6
- package/dist/kay-agent.d.ts +4 -216
- package/dist/kay-agent.js +0 -76
- package/dist/kay-app-session-summary.d.ts +7041 -0
- package/dist/kay-app-session-summary.js +949 -0
- package/dist/kay-app.d.ts +152 -224
- package/dist/kay-app.js +1 -77
- package/dist/signals.d.ts +57 -81
- package/dist/signals.js +1 -1
- package/package.json +5 -5
- package/skills/directory-plugin-authoring/SKILL.md +1 -1
- package/dist/jev.d.ts +0 -203
- package/dist/jev.js +0 -77
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.
|
|
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.
|
|
65
|
+
"compatibility": { "sdk": "^0.14.0" },
|
|
66
66
|
"targets": {
|
|
67
67
|
"kay": {
|
|
68
68
|
"agent": {
|
package/dist/disclosure.d.ts
CHANGED
|
@@ -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 `
|
|
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
|
|
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;
|
|
@@ -9604,53 +9482,6 @@ declare const WithElementList_0: (input: string, result?: unknown[]) => [unknown
|
|
|
9604
9482
|
|
|
9605
9483
|
declare function WithElementListMapping(input: [unknown, unknown, unknown] | []): unknown;
|
|
9606
9484
|
|
|
9607
|
-
/**
|
|
9608
|
-
* Run `use` against a live Jev client, falling back to `fallback` whenever Jev cannot serve the
|
|
9609
|
-
* call. The wrapper exists so a feature can ASK for a typed decision without ever depending on
|
|
9610
|
-
* one: `fallback` is required, and it runs whenever no provider in the user's Jev provider
|
|
9611
|
-
* order holds a usable credential, the user has not granted `jev.use`, the branch exceeds its budget, `use` throws, or
|
|
9612
|
-
* `use` declines by returning `undefined`. With valid options, this rejects on an explicit
|
|
9613
|
-
* `signal` abort, reaching `deadlineAt`, or `fallback` itself throwing.
|
|
9614
|
-
*
|
|
9615
|
-
* ALWAYS PRESENT on the plugin API, on every host. A host that composed no Jev lane binds
|
|
9616
|
-
* {@link createFallbackOnlyWithJev}, so a caller never branches on availability — branching is
|
|
9617
|
-
* exactly how a fallback gets skipped.
|
|
9618
|
-
*
|
|
9619
|
-
* `jev` is a {@link JevClient} on the host's Jev model. It is valid only for the duration of
|
|
9620
|
-
* the callback: a reference retained past `use`'s scope is refused at the transport, and an
|
|
9621
|
-
* in-flight request is aborted when the call stops waiting.
|
|
9622
|
-
* The callback itself is ABANDONED, not interrupted — a host cannot stop arbitrary JavaScript
|
|
9623
|
-
* that is already running, so `use` must not perform side effects it would mind completing
|
|
9624
|
-
* unobserved. The same applies to a running fallback: abort/deadline stops waiting for it but
|
|
9625
|
-
* cannot interrupt its JavaScript.
|
|
9626
|
-
*/
|
|
9627
|
-
declare type WithJev = <T>(
|
|
9628
|
-
/** Return `undefined` to decline (the fallback runs). A feature whose real result can itself be
|
|
9629
|
-
* `undefined` should return `null` or its own wrapper type instead. */
|
|
9630
|
-
use: (jev: JevClient) => T | undefined | PromiseLike<T | undefined>,
|
|
9631
|
-
/** Required. The behaviour the feature has without Jev. */
|
|
9632
|
-
fallback: () => T | PromiseLike<T>, options?: WithJevOptions) => Promise<T>;
|
|
9633
|
-
|
|
9634
|
-
/** Per-call knobs for {@link WithJev}. Every field is optional; the host applies its own default
|
|
9635
|
-
* budget when none is given, so the Jev branch is never unbounded. */
|
|
9636
|
-
declare interface WithJevOptions {
|
|
9637
|
-
/**
|
|
9638
|
-
* Explicit cancellation. Always propagates as a rejection; never substituted with `fallback`,
|
|
9639
|
-
* because an aborted call means "stop", not "use the cheaper path".
|
|
9640
|
-
*/
|
|
9641
|
-
readonly signal?: AbortSignal;
|
|
9642
|
-
/** Bounds the Jev branch alone, measured from the call. */
|
|
9643
|
-
readonly timeoutMs?: number;
|
|
9644
|
-
/**
|
|
9645
|
-
* Absolute epoch-ms hard deadline for the WHOLE call, `fallback` included. A deadline already
|
|
9646
|
-
* passed rejects (like `signal`); one still ahead derives the Jev branch's budget from it and
|
|
9647
|
-
* keeps a small reserve so `fallback` has a window to run.
|
|
9648
|
-
*/
|
|
9649
|
-
readonly deadlineAt?: number;
|
|
9650
|
-
/** Attribution slug for host usage accounting. Never sent to Jev. */
|
|
9651
|
-
readonly purpose?: string;
|
|
9652
|
-
}
|
|
9653
|
-
|
|
9654
9485
|
declare function WithMapping(input: [unknown, unknown] | []): unknown;
|
|
9655
9486
|
|
|
9656
9487
|
declare const WithNull: (input: string) => [unknown, string] | [];
|
package/dist/disclosure.js
CHANGED
|
@@ -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" | "
|
|
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 `
|
|
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
|
|
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;
|
|
@@ -9527,53 +9405,6 @@ declare const WithElementList_0: (input: string, result?: unknown[]) => [unknown
|
|
|
9527
9405
|
|
|
9528
9406
|
declare function WithElementListMapping(input: [unknown, unknown, unknown] | []): unknown;
|
|
9529
9407
|
|
|
9530
|
-
/**
|
|
9531
|
-
* Run `use` against a live Jev client, falling back to `fallback` whenever Jev cannot serve the
|
|
9532
|
-
* call. The wrapper exists so a feature can ASK for a typed decision without ever depending on
|
|
9533
|
-
* one: `fallback` is required, and it runs whenever no provider in the user's Jev provider
|
|
9534
|
-
* order holds a usable credential, the user has not granted `jev.use`, the branch exceeds its budget, `use` throws, or
|
|
9535
|
-
* `use` declines by returning `undefined`. With valid options, this rejects on an explicit
|
|
9536
|
-
* `signal` abort, reaching `deadlineAt`, or `fallback` itself throwing.
|
|
9537
|
-
*
|
|
9538
|
-
* ALWAYS PRESENT on the plugin API, on every host. A host that composed no Jev lane binds
|
|
9539
|
-
* {@link createFallbackOnlyWithJev}, so a caller never branches on availability — branching is
|
|
9540
|
-
* exactly how a fallback gets skipped.
|
|
9541
|
-
*
|
|
9542
|
-
* `jev` is a {@link JevClient} on the host's Jev model. It is valid only for the duration of
|
|
9543
|
-
* the callback: a reference retained past `use`'s scope is refused at the transport, and an
|
|
9544
|
-
* in-flight request is aborted when the call stops waiting.
|
|
9545
|
-
* The callback itself is ABANDONED, not interrupted — a host cannot stop arbitrary JavaScript
|
|
9546
|
-
* that is already running, so `use` must not perform side effects it would mind completing
|
|
9547
|
-
* unobserved. The same applies to a running fallback: abort/deadline stops waiting for it but
|
|
9548
|
-
* cannot interrupt its JavaScript.
|
|
9549
|
-
*/
|
|
9550
|
-
declare type WithJev = <T>(
|
|
9551
|
-
/** Return `undefined` to decline (the fallback runs). A feature whose real result can itself be
|
|
9552
|
-
* `undefined` should return `null` or its own wrapper type instead. */
|
|
9553
|
-
use: (jev: JevClient) => T | undefined | PromiseLike<T | undefined>,
|
|
9554
|
-
/** Required. The behaviour the feature has without Jev. */
|
|
9555
|
-
fallback: () => T | PromiseLike<T>, options?: WithJevOptions) => Promise<T>;
|
|
9556
|
-
|
|
9557
|
-
/** Per-call knobs for {@link WithJev}. Every field is optional; the host applies its own default
|
|
9558
|
-
* budget when none is given, so the Jev branch is never unbounded. */
|
|
9559
|
-
declare interface WithJevOptions {
|
|
9560
|
-
/**
|
|
9561
|
-
* Explicit cancellation. Always propagates as a rejection; never substituted with `fallback`,
|
|
9562
|
-
* because an aborted call means "stop", not "use the cheaper path".
|
|
9563
|
-
*/
|
|
9564
|
-
readonly signal?: AbortSignal;
|
|
9565
|
-
/** Bounds the Jev branch alone, measured from the call. */
|
|
9566
|
-
readonly timeoutMs?: number;
|
|
9567
|
-
/**
|
|
9568
|
-
* Absolute epoch-ms hard deadline for the WHOLE call, `fallback` included. A deadline already
|
|
9569
|
-
* passed rejects (like `signal`); one still ahead derives the Jev branch's budget from it and
|
|
9570
|
-
* keeps a small reserve so `fallback` has a window to run.
|
|
9571
|
-
*/
|
|
9572
|
-
readonly deadlineAt?: number;
|
|
9573
|
-
/** Attribution slug for host usage accounting. Never sent to Jev. */
|
|
9574
|
-
readonly purpose?: string;
|
|
9575
|
-
}
|
|
9576
|
-
|
|
9577
9408
|
declare function WithMapping(input: [unknown, unknown] | []): unknown;
|
|
9578
9409
|
|
|
9579
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(),
|