@yaklabs-ai/plugin-sdk 0.13.10 → 0.14.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/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 +24 -220
- 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 +181 -238
- 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/dist/kay-agent.d.ts
CHANGED
|
@@ -696,17 +696,6 @@ export declare interface ConvertedArtifact {
|
|
|
696
696
|
*/
|
|
697
697
|
declare function Create(hidden: ObjectLike_2, enumerable: ObjectLike_2, options?: ObjectLike_2): ObjectLike_2;
|
|
698
698
|
|
|
699
|
-
/**
|
|
700
|
-
* The `withJev` a host with no Jev lane binds: `use` is never called, no client is ever built,
|
|
701
|
-
* and no network is ever touched. It keeps the cancellation contract identical to the real
|
|
702
|
-
* wrapper's so a caller's `signal`/`deadlineAt` handling does not change with host composition.
|
|
703
|
-
*
|
|
704
|
-
* Deliberately here rather than in the runtime: this is the DEFAULT for the SDK's own host
|
|
705
|
-
* factory, which cannot import the runtime uphill. The runtime also delegates fallback execution
|
|
706
|
-
* here, so both paths share cancellation, deadline enforcement, and cleanup.
|
|
707
|
-
*/
|
|
708
|
-
export declare function createFallbackOnlyWithJev(): WithJev;
|
|
709
|
-
|
|
710
699
|
/**
|
|
711
700
|
* Build a plugin's JSON API client. Carries **no credentials at construction** — every method
|
|
712
701
|
* takes per-call `headers`, because the kernel resolves tokens per call (refresh-near-expiry,
|
|
@@ -1924,150 +1913,6 @@ declare function IsUnsafe(value: unknown): value is TUnsafe;
|
|
|
1924
1913
|
/** Returns true if the given value is TVoid. */
|
|
1925
1914
|
declare function IsVoid(value: unknown): value is TVoid;
|
|
1926
1915
|
|
|
1927
|
-
export declare type JevAnswer = JevBoolAnswer | JevChoiceAnswer | JevScoreAnswer;
|
|
1928
|
-
|
|
1929
|
-
/** The answer shape one question gets back. */
|
|
1930
|
-
export declare type JevAnswerFor<Q> = Q extends JevBoolQuestion ? JevBoolAnswer : Q extends JevChoiceQuestion<infer L> ? JevChoiceAnswer<L> : Q extends JevScoreQuestion ? JevScoreAnswer : never;
|
|
1931
|
-
|
|
1932
|
-
export declare interface JevBoolAnswer {
|
|
1933
|
-
readonly type: "bool";
|
|
1934
|
-
/** P(yes), from 0 to 1. */
|
|
1935
|
-
readonly probability: number;
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
/** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
|
|
1939
|
-
export declare interface JevBoolQuestion {
|
|
1940
|
-
readonly type: "bool";
|
|
1941
|
-
readonly instructions: string;
|
|
1942
|
-
readonly criteria?: {
|
|
1943
|
-
readonly true: string;
|
|
1944
|
-
readonly false: string;
|
|
1945
|
-
};
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
/**
|
|
1949
|
-
* The one error `classify` rejects with. It carries a classification, never the provider's own
|
|
1950
|
-
* message or body: those can echo the request state, and this error reaches logs.
|
|
1951
|
-
*/
|
|
1952
|
-
export declare class JevCallError extends Error {
|
|
1953
|
-
readonly transport: JevTransport;
|
|
1954
|
-
readonly kind: JevCallErrorKind;
|
|
1955
|
-
/** The final attempt's HTTP status, when a response arrived. */
|
|
1956
|
-
readonly status: number | undefined;
|
|
1957
|
-
constructor(init: {
|
|
1958
|
-
readonly transport: JevTransport;
|
|
1959
|
-
readonly kind: JevCallErrorKind;
|
|
1960
|
-
readonly status?: number | undefined;
|
|
1961
|
-
});
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* Why a Jev call failed, as a closed set:
|
|
1966
|
-
*
|
|
1967
|
-
* - `http`: the route answered with an error status (`status` says which).
|
|
1968
|
-
* - `too-large`: the route refused the request's size (413, or a 400 naming the token limit).
|
|
1969
|
-
* - `network`: no response arrived.
|
|
1970
|
-
* - `aborted`: the call was cancelled.
|
|
1971
|
-
* - `invalid-answer`: the route answered, but not with an answer for every asked question.
|
|
1972
|
-
*/
|
|
1973
|
-
export declare type JevCallErrorKind = "http" | "too-large" | "network" | "aborted" | "invalid-answer";
|
|
1974
|
-
|
|
1975
|
-
export declare interface JevChoiceAnswer<L extends string = string> {
|
|
1976
|
-
readonly type: "choice";
|
|
1977
|
-
readonly choice: L;
|
|
1978
|
-
readonly confidence: number;
|
|
1979
|
-
/** P(label) for every offered label. */
|
|
1980
|
-
readonly probabilities: Readonly<Record<L, number>>;
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
/** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
|
|
1984
|
-
export declare interface JevChoiceQuestion<L extends string = string> {
|
|
1985
|
-
readonly type: "choice";
|
|
1986
|
-
readonly instructions: string;
|
|
1987
|
-
readonly criteria: Readonly<Record<L, string>>;
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
/** One answered request: every asked question has an answer of its own kind. */
|
|
1991
|
-
export declare interface JevClassification<Q extends JevQuestions = JevQuestions> {
|
|
1992
|
-
/** The Jev model the host asked. */
|
|
1993
|
-
readonly model: string;
|
|
1994
|
-
readonly answers: {
|
|
1995
|
-
readonly [K in keyof Q]: JevAnswerFor<Q[K]>;
|
|
1996
|
-
};
|
|
1997
|
-
/** Token counts, when the route reported them. */
|
|
1998
|
-
readonly usage?: {
|
|
1999
|
-
readonly inputTokens: number;
|
|
2000
|
-
readonly outputTokens: number;
|
|
2001
|
-
};
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
export declare interface JevClassifyRequest<Q extends JevQuestions = JevQuestions> {
|
|
2005
|
-
readonly state: JevState;
|
|
2006
|
-
readonly questions: Q;
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
/**
|
|
2010
|
-
* The Jev client a `use` body receives. `classify` either resolves with an answer for every
|
|
2011
|
-
* asked question, each of its question's kind, or rejects with a {@link JevCallError}; it never
|
|
2012
|
-
* resolves with a partial or substituted answer.
|
|
2013
|
-
*/
|
|
2014
|
-
export declare interface JevClient {
|
|
2015
|
-
classify<const Q extends JevQuestions>(request: JevClassifyRequest<Q>, options?: {
|
|
2016
|
-
readonly signal?: AbortSignal;
|
|
2017
|
-
}): Promise<JevClassification<Q>>;
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
export declare type JevQuestion = JevBoolQuestion | JevChoiceQuestion | JevScoreQuestion;
|
|
2021
|
-
|
|
2022
|
-
/** A rubric: questions keyed by the name each answer comes back under. */
|
|
2023
|
-
export declare type JevQuestions = Readonly<Record<string, JevQuestion>>;
|
|
2024
|
-
|
|
2025
|
-
export declare interface JevScoreAnswer {
|
|
2026
|
-
readonly type: "score";
|
|
2027
|
-
/** The expected score, from 0 to the number of rungs minus one. */
|
|
2028
|
-
readonly score: number;
|
|
2029
|
-
readonly confidence: number;
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
/** A score over ordered rungs: the first criterion scores 0, the next 1, and so on. */
|
|
2033
|
-
export declare interface JevScoreQuestion {
|
|
2034
|
-
readonly type: "score";
|
|
2035
|
-
readonly instructions: string;
|
|
2036
|
-
readonly criteria: readonly string[];
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
/**
|
|
2040
|
-
* ---
|
|
2041
|
-
* responsibility: The plugin-facing CONTRACT for Jev typed-decision inference — the shape of
|
|
2042
|
-
* `api.withJev` on both plugin SDK targets, the {@link JevClient} a `use` body receives, the
|
|
2043
|
-
* question and answer vocabulary it speaks, and the fallback-only implementation a host
|
|
2044
|
-
* without a Jev lane binds.
|
|
2045
|
-
* owns:
|
|
2046
|
-
* - {@link WithJev}, {@link WithJevOptions}, {@link createFallbackOnlyWithJev}.
|
|
2047
|
-
* - {@link JevClient}, the {@link JevQuestion} and {@link JevAnswer} vocabulary, and
|
|
2048
|
-
* {@link JevCallError}.
|
|
2049
|
-
* does_not_own:
|
|
2050
|
-
* - The wire. The host serves `classify` over whichever route the user's Jev provider order
|
|
2051
|
-
* picks; a plugin never sees a vendor client, a vendor type, or a route.
|
|
2052
|
-
* - Credential resolution, the `jev.use` decision, the Jev-branch budget, or usage accounting.
|
|
2053
|
-
* Those are host-side (`@bonsai/agent-runtime`'s `kay/jev/`).
|
|
2054
|
-
* ---
|
|
2055
|
-
*
|
|
2056
|
-
* The vocabulary is Bonsai's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
|
|
2057
|
-
* and plugins coded against a vendor's types. It follows pi's classifier contract, which the host
|
|
2058
|
-
* runs Jev through: a yes/no question is `bool` and answers a `probability`, every instruction and
|
|
2059
|
-
* criterion is text, and the state is a JSON object.
|
|
2060
|
-
*/
|
|
2061
|
-
/**
|
|
2062
|
-
* The state a rubric reads: a JSON object, never text or an array. Every value must survive
|
|
2063
|
-
* `JSON.stringify` unchanged (no functions or class instances), because it is sent as JSON.
|
|
2064
|
-
* Typed as `object` so a state declared as an interface fits without an index signature.
|
|
2065
|
-
*/
|
|
2066
|
-
export declare type JevState = object;
|
|
2067
|
-
|
|
2068
|
-
/** The route a Jev call took: the user's own TypeSafe key, or Bonsai's hosted gateway. */
|
|
2069
|
-
export declare type JevTransport = "direct" | "hosted";
|
|
2070
|
-
|
|
2071
1916
|
/** The frozen `createJsonApiClient` surface — see the module doc for why it stops at these three. */
|
|
2072
1917
|
export declare interface JsonApiClient {
|
|
2073
1918
|
getJson<TBody = unknown>(url: string, options?: PluginApiQueryOptions): Promise<PluginApiResponse<TBody>>;
|
|
@@ -2380,20 +2225,10 @@ export declare interface KayAgentPluginApi {
|
|
|
2380
2225
|
* {@link KayAgentPluginApi.registerInteractionDriver} to make it drivable by the agent.
|
|
2381
2226
|
*/
|
|
2382
2227
|
readonly interaction: KayAgentInteractionSurfaces;
|
|
2383
|
-
/**
|
|
2384
|
-
* Jev typed-decision inference, as an OPTIONAL accelerator with a REQUIRED fallback. Each call
|
|
2385
|
-
* is checked against `jev.use` — but a refused grant or no usable Jev provider both
|
|
2386
|
-
* produce the same outcome: your `fallback` runs.
|
|
2387
|
-
*
|
|
2388
|
-
* Always present, on every host. That is the point: with no absent state to feature-detect,
|
|
2389
|
-
* there is no shape of code that reaches Jev without having written the baseline too. Do not
|
|
2390
|
-
* guard it with `if (api.withJev !== undefined)`.
|
|
2391
|
-
*/
|
|
2392
|
-
readonly withJev: WithJev;
|
|
2393
2228
|
/**
|
|
2394
2229
|
* System One: fast, cheap judgment calls (`decide`) and typed field extraction (`extract`) on
|
|
2395
|
-
* small models (Jev, Clef, Clef Flash, Clairic). Each call is checked against `
|
|
2396
|
-
* that cannot be served or is not permitted throws a `SystemOneError` whose `cause.kind` says
|
|
2230
|
+
* small models (Jev, Clef, Clef Flash, Clairic). Each call is checked against `systemOne.use`; a
|
|
2231
|
+
* call that cannot be served or is not permitted throws a `SystemOneError` whose `cause.kind` says
|
|
2397
2232
|
* why, so put the feature's cheaper path in the call's own `catch`. Always present, on every
|
|
2398
2233
|
* host; a host with no System One throws `not-served`. Types: `@bonsai/plugin-sdk/system-one`
|
|
2399
2234
|
* (SDK 0.13.8).
|
|
@@ -2416,7 +2251,7 @@ export declare interface KayAgentPluginApi {
|
|
|
2416
2251
|
readonly userFiles: KayAppUserFiles;
|
|
2417
2252
|
/**
|
|
2418
2253
|
* Publish the plugin's declared events, for example so a default notification rule can tell the
|
|
2419
|
-
* user what the agent just did. Always present, like {@link
|
|
2254
|
+
* user what the agent just did. Always present, like {@link systemOne}: there is nothing to
|
|
2420
2255
|
* feature-detect, and a host that composed no events lane drops what is published.
|
|
2421
2256
|
*/
|
|
2422
2257
|
readonly events: KayAgentEvents;
|
|
@@ -3419,6 +3254,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
|
|
|
3419
3254
|
schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3420
3255
|
operations: z.ZodArray<z.ZodEnum<{
|
|
3421
3256
|
status: "status";
|
|
3257
|
+
list: "list";
|
|
3422
3258
|
connect: "connect";
|
|
3423
3259
|
disconnect: "disconnect";
|
|
3424
3260
|
resolve: "resolve";
|
|
@@ -3513,6 +3349,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
|
|
|
3513
3349
|
schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3514
3350
|
operations: z.ZodArray<z.ZodEnum<{
|
|
3515
3351
|
status: "status";
|
|
3352
|
+
list: "list";
|
|
3516
3353
|
connect: "connect";
|
|
3517
3354
|
disconnect: "disconnect";
|
|
3518
3355
|
resolve: "resolve";
|
|
@@ -3607,6 +3444,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
|
|
|
3607
3444
|
schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3608
3445
|
operations: z.ZodArray<z.ZodEnum<{
|
|
3609
3446
|
status: "status";
|
|
3447
|
+
list: "list";
|
|
3610
3448
|
connect: "connect";
|
|
3611
3449
|
disconnect: "disconnect";
|
|
3612
3450
|
resolve: "resolve";
|
|
@@ -4442,9 +4280,10 @@ export declare interface OsascriptFailureAdvice {
|
|
|
4442
4280
|
}
|
|
4443
4281
|
|
|
4444
4282
|
/**
|
|
4445
|
-
* The activation options every osascript plugin's agent factory
|
|
4446
|
-
*
|
|
4447
|
-
*
|
|
4283
|
+
* The activation options every osascript plugin's agent factory accepted, so the daemon's
|
|
4284
|
+
* simulator roster set each the same way. Absent `simulator`, the plugin is exactly the shipped one.
|
|
4285
|
+
*
|
|
4286
|
+
* @deprecated See {@link OsascriptSimulatorOptions}.
|
|
4448
4287
|
*/
|
|
4449
4288
|
export declare interface OsascriptKayAgentOptions {
|
|
4450
4289
|
readonly simulator?: OsascriptSimulatorOptions;
|
|
@@ -4481,6 +4320,10 @@ export declare interface OsascriptRunner {
|
|
|
4481
4320
|
/**
|
|
4482
4321
|
* The runners a module's verbs use: the host's exactly when `simulator` is absent, or the
|
|
4483
4322
|
* simulator's in its place, per dispatch, after the host's connection gate.
|
|
4323
|
+
*
|
|
4324
|
+
* @deprecated A Bonsai daemon substitutes the runner itself, so a module uses
|
|
4325
|
+
* {@link requireExternalCli} and `ctx.auth?.externalCli` directly. Kept so a plugin built against
|
|
4326
|
+
* an earlier SDK keeps compiling.
|
|
4484
4327
|
*/
|
|
4485
4328
|
readonly dispatch: (simulator: OsascriptSimulatedRunner | undefined) => OsascriptDispatch;
|
|
4486
4329
|
/**
|
|
@@ -4526,7 +4369,11 @@ export declare interface OsascriptRunnerOptions {
|
|
|
4526
4369
|
readonly appNotRunning?: OsascriptFailureAdvice;
|
|
4527
4370
|
}
|
|
4528
4371
|
|
|
4529
|
-
/**
|
|
4372
|
+
/**
|
|
4373
|
+
* A simulated runner, as a module sees it: the runner one dispatch uses in the host's place. A
|
|
4374
|
+
* Bonsai daemon that simulates an osascript plugin hands `runnerFor(ctx)` to the module as
|
|
4375
|
+
* `ctx.auth.externalCli`; `@bonsai/uri-simulator-kit/osascript` builds one.
|
|
4376
|
+
*/
|
|
4530
4377
|
export declare interface OsascriptSimulatedRunner {
|
|
4531
4378
|
readonly runnerFor: (ctx: UriResolveContext) => UriExternalCliRunner;
|
|
4532
4379
|
}
|
|
@@ -4535,6 +4382,10 @@ export declare interface OsascriptSimulatedRunner {
|
|
|
4535
4382
|
* How a plugin is told to serve its module from its simulator instead of osascript: the one
|
|
4536
4383
|
* option shape every osascript plugin's agent factory accepts as `simulator`. Only the daemon's
|
|
4537
4384
|
* URI simulator roster sets it, for evals and dev; an ordinary install never does.
|
|
4385
|
+
*
|
|
4386
|
+
* @deprecated A Bonsai daemon now hands the module a simulated runner as `ctx.auth.externalCli`,
|
|
4387
|
+
* so a plugin needs no simulator option; no Bonsai plugin sets this. Kept so a plugin built against
|
|
4388
|
+
* an earlier SDK keeps compiling.
|
|
4538
4389
|
*/
|
|
4539
4390
|
export declare interface OsascriptSimulatorOptions {
|
|
4540
4391
|
/** The directory holding the simulator's world; the daemon's process config names it. */
|
|
@@ -5086,7 +4937,7 @@ declare const PluginCapabilityRefusalV1: z.ZodObject<{
|
|
|
5086
4937
|
envelope: z.ZodObject<{}, z.core.$strict>;
|
|
5087
4938
|
}, z.core.$strict>, z.ZodObject<{
|
|
5088
4939
|
target: z.ZodLiteral<"kay.app">;
|
|
5089
|
-
slug: z.ZodLiteral<"
|
|
4940
|
+
slug: z.ZodLiteral<"systemOne.use">;
|
|
5090
4941
|
envelope: z.ZodObject<{}, z.core.$strict>;
|
|
5091
4942
|
}, z.core.$strict>, z.ZodObject<{
|
|
5092
4943
|
target: z.ZodLiteral<"kay.app">;
|
|
@@ -11841,53 +11692,6 @@ declare const WithElementList_0: (input: string, result?: unknown[]) => [unknown
|
|
|
11841
11692
|
|
|
11842
11693
|
declare function WithElementListMapping(input: [unknown, unknown, unknown] | []): unknown;
|
|
11843
11694
|
|
|
11844
|
-
/**
|
|
11845
|
-
* Run `use` against a live Jev client, falling back to `fallback` whenever Jev cannot serve the
|
|
11846
|
-
* call. The wrapper exists so a feature can ASK for a typed decision without ever depending on
|
|
11847
|
-
* one: `fallback` is required, and it runs whenever no provider in the user's Jev provider
|
|
11848
|
-
* order holds a usable credential, the user has not granted `jev.use`, the branch exceeds its budget, `use` throws, or
|
|
11849
|
-
* `use` declines by returning `undefined`. With valid options, this rejects on an explicit
|
|
11850
|
-
* `signal` abort, reaching `deadlineAt`, or `fallback` itself throwing.
|
|
11851
|
-
*
|
|
11852
|
-
* ALWAYS PRESENT on the plugin API, on every host. A host that composed no Jev lane binds
|
|
11853
|
-
* {@link createFallbackOnlyWithJev}, so a caller never branches on availability — branching is
|
|
11854
|
-
* exactly how a fallback gets skipped.
|
|
11855
|
-
*
|
|
11856
|
-
* `jev` is a {@link JevClient} on the host's Jev model. It is valid only for the duration of
|
|
11857
|
-
* the callback: a reference retained past `use`'s scope is refused at the transport, and an
|
|
11858
|
-
* in-flight request is aborted when the call stops waiting.
|
|
11859
|
-
* The callback itself is ABANDONED, not interrupted — a host cannot stop arbitrary JavaScript
|
|
11860
|
-
* that is already running, so `use` must not perform side effects it would mind completing
|
|
11861
|
-
* unobserved. The same applies to a running fallback: abort/deadline stops waiting for it but
|
|
11862
|
-
* cannot interrupt its JavaScript.
|
|
11863
|
-
*/
|
|
11864
|
-
export declare type WithJev = <T>(
|
|
11865
|
-
/** Return `undefined` to decline (the fallback runs). A feature whose real result can itself be
|
|
11866
|
-
* `undefined` should return `null` or its own wrapper type instead. */
|
|
11867
|
-
use: (jev: JevClient) => T | undefined | PromiseLike<T | undefined>,
|
|
11868
|
-
/** Required. The behaviour the feature has without Jev. */
|
|
11869
|
-
fallback: () => T | PromiseLike<T>, options?: WithJevOptions) => Promise<T>;
|
|
11870
|
-
|
|
11871
|
-
/** Per-call knobs for {@link WithJev}. Every field is optional; the host applies its own default
|
|
11872
|
-
* budget when none is given, so the Jev branch is never unbounded. */
|
|
11873
|
-
export declare interface WithJevOptions {
|
|
11874
|
-
/**
|
|
11875
|
-
* Explicit cancellation. Always propagates as a rejection; never substituted with `fallback`,
|
|
11876
|
-
* because an aborted call means "stop", not "use the cheaper path".
|
|
11877
|
-
*/
|
|
11878
|
-
readonly signal?: AbortSignal;
|
|
11879
|
-
/** Bounds the Jev branch alone, measured from the call. */
|
|
11880
|
-
readonly timeoutMs?: number;
|
|
11881
|
-
/**
|
|
11882
|
-
* Absolute epoch-ms hard deadline for the WHOLE call, `fallback` included. A deadline already
|
|
11883
|
-
* passed rejects (like `signal`); one still ahead derives the Jev branch's budget from it and
|
|
11884
|
-
* keeps a small reserve so `fallback` has a window to run.
|
|
11885
|
-
*/
|
|
11886
|
-
readonly deadlineAt?: number;
|
|
11887
|
-
/** Attribution slug for host usage accounting. Never sent to Jev. */
|
|
11888
|
-
readonly purpose?: string;
|
|
11889
|
-
}
|
|
11890
|
-
|
|
11891
11695
|
declare function WithMapping(input: [unknown, unknown] | []): unknown;
|
|
11892
11696
|
|
|
11893
11697
|
declare const WithNull: (input: string) => [unknown, string] | [];
|
package/dist/kay-agent.js
CHANGED
|
@@ -797,80 +797,6 @@ function capability(spec) {
|
|
|
797
797
|
return { ...spec };
|
|
798
798
|
}
|
|
799
799
|
|
|
800
|
-
// packages/plugin-sdk/dist/jev.js
|
|
801
|
-
var JevCallError = class extends Error {
|
|
802
|
-
transport;
|
|
803
|
-
kind;
|
|
804
|
-
/** The final attempt's HTTP status, when a response arrived. */
|
|
805
|
-
status;
|
|
806
|
-
constructor(init) {
|
|
807
|
-
super(`Jev call failed on the ${init.transport} route: ${init.kind}${init.status === void 0 ? "" : ` (HTTP ${init.status})`}.`);
|
|
808
|
-
this.name = "JevCallError";
|
|
809
|
-
this.transport = init.transport;
|
|
810
|
-
this.kind = init.kind;
|
|
811
|
-
this.status = init.status;
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
function createFallbackOnlyWithJev() {
|
|
815
|
-
return async (_use, fallback, options = {}) => {
|
|
816
|
-
if (typeof fallback !== "function") {
|
|
817
|
-
throw new TypeError("withJev requires a `fallback` function as its second argument.");
|
|
818
|
-
}
|
|
819
|
-
const { signal, deadlineAt } = options;
|
|
820
|
-
if (deadlineAt !== void 0 && !Number.isFinite(deadlineAt)) {
|
|
821
|
-
throw new TypeError("withJev's `deadlineAt` must be a finite epoch-ms timestamp.");
|
|
822
|
-
}
|
|
823
|
-
const assertWithinBoundaries = () => {
|
|
824
|
-
if (signal?.aborted === true) {
|
|
825
|
-
throw signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
826
|
-
}
|
|
827
|
-
if (deadlineAt !== void 0 && Date.now() >= deadlineAt) {
|
|
828
|
-
throw new Error("withJev's deadline has passed.");
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
assertWithinBoundaries();
|
|
832
|
-
let timer;
|
|
833
|
-
let onAbort;
|
|
834
|
-
const stopped = new Promise((_resolve, reject) => {
|
|
835
|
-
if (signal !== void 0) {
|
|
836
|
-
onAbort = () => reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
|
|
837
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
838
|
-
}
|
|
839
|
-
if (deadlineAt !== void 0) {
|
|
840
|
-
const checkDeadline = () => {
|
|
841
|
-
const remaining = deadlineAt - Date.now();
|
|
842
|
-
if (remaining <= 0) {
|
|
843
|
-
reject(new Error("withJev's deadline has passed."));
|
|
844
|
-
} else {
|
|
845
|
-
timer = setTimeout(checkDeadline, Math.min(remaining, 2147483647));
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
checkDeadline();
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
try {
|
|
852
|
-
const result = await Promise.race([
|
|
853
|
-
Promise.resolve().then(() => {
|
|
854
|
-
assertWithinBoundaries();
|
|
855
|
-
return fallback();
|
|
856
|
-
}),
|
|
857
|
-
stopped
|
|
858
|
-
]);
|
|
859
|
-
assertWithinBoundaries();
|
|
860
|
-
return result;
|
|
861
|
-
} catch (error) {
|
|
862
|
-
assertWithinBoundaries();
|
|
863
|
-
throw error;
|
|
864
|
-
} finally {
|
|
865
|
-
if (timer !== void 0)
|
|
866
|
-
clearTimeout(timer);
|
|
867
|
-
if (signal !== void 0 && onAbort !== void 0) {
|
|
868
|
-
signal.removeEventListener("abort", onAbort);
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
|
|
874
800
|
// packages/herd-uri-extensions/dist/limits.js
|
|
875
801
|
var MAX_BYTES = 50 * 1024 * 1024;
|
|
876
802
|
var MAX_OUTPUT_CHARS = 5e5;
|
|
@@ -1748,7 +1674,6 @@ var KayAgentWebSessionError = class extends Error {
|
|
|
1748
1674
|
export {
|
|
1749
1675
|
DelegatedRefreshRejectedError,
|
|
1750
1676
|
INTERACTION_CREDENTIAL_GUARD,
|
|
1751
|
-
JevCallError,
|
|
1752
1677
|
KayAgentCapabilityError,
|
|
1753
1678
|
KayAgentWebSessionError,
|
|
1754
1679
|
OBSERVATION_MIME,
|
|
@@ -1774,7 +1699,6 @@ export {
|
|
|
1774
1699
|
compileUriClaim,
|
|
1775
1700
|
contentDigest,
|
|
1776
1701
|
contentResult,
|
|
1777
|
-
createFallbackOnlyWithJev,
|
|
1778
1702
|
createJsonApiClient,
|
|
1779
1703
|
createOsascriptRunner,
|
|
1780
1704
|
declareProducedResources,
|