@yaklabs-ai/plugin-sdk 0.13.7 → 0.13.9
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 +10 -5
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/disclosure.d.ts +303 -0
- package/dist/disclosure.js +64 -0
- package/dist/kay-agent-testing.d.ts +304 -1
- package/dist/kay-agent-testing.js +65 -0
- package/dist/kay-agent.d.ts +303 -0
- package/dist/kay-app.d.ts +330 -7
- package/dist/kay-app.js +13 -11
- package/dist/system-one.d.ts +326 -0
- package/dist/system-one.js +69 -0
- package/dist/zod.d.ts +5 -0
- package/dist/zod.js +5 -0
- package/package.json +9 -1
- package/skills/directory-plugin-authoring/SKILL.md +2 -1
package/dist/kay-app.d.ts
CHANGED
|
@@ -248,6 +248,12 @@ declare interface AuthAccount {
|
|
|
248
248
|
readonly needsReconnect?: boolean;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
declare interface Availability {
|
|
252
|
+
readonly available: boolean;
|
|
253
|
+
readonly reason?: string;
|
|
254
|
+
readonly cause?: SystemOneFailureCause;
|
|
255
|
+
}
|
|
256
|
+
|
|
251
257
|
/**
|
|
252
258
|
* The availability-facts message: who the user is connected as, which auth-gated tools are
|
|
253
259
|
* waiting on a connect, and which installed plugins are not connected. DURABLE and never
|
|
@@ -810,6 +816,85 @@ declare type DaemonServiceTurnMessage = CustomMessage<DaemonServiceTurnDetails>
|
|
|
810
816
|
readonly display: true;
|
|
811
817
|
};
|
|
812
818
|
|
|
819
|
+
declare type DecideAnswerFor<Q> = Q extends DecideBoolQuestion ? DecideBoolAnswer : Q extends DecideChoiceQuestion<infer L> ? DecideChoiceAnswer<L> : Q extends DecideScoreQuestion ? DecideScoreAnswer : never;
|
|
820
|
+
|
|
821
|
+
declare interface DecideBoolAnswer {
|
|
822
|
+
readonly type: "bool";
|
|
823
|
+
/** P(yes), from 0 to 1. */
|
|
824
|
+
readonly probability: number;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
|
|
828
|
+
declare interface DecideBoolQuestion {
|
|
829
|
+
readonly type: "bool";
|
|
830
|
+
readonly instructions: DecideInstructions;
|
|
831
|
+
readonly criteria?: {
|
|
832
|
+
readonly true: string;
|
|
833
|
+
readonly false: string;
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
declare interface DecideChoiceAnswer<L extends string = string> {
|
|
838
|
+
readonly type: "choice";
|
|
839
|
+
readonly choice: L;
|
|
840
|
+
readonly confidence: number;
|
|
841
|
+
/** P(label) for every offered label. */
|
|
842
|
+
readonly probabilities: Readonly<Record<L, number>>;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
|
|
846
|
+
declare interface DecideChoiceQuestion<L extends string = string> {
|
|
847
|
+
readonly type: "choice";
|
|
848
|
+
readonly instructions: DecideInstructions;
|
|
849
|
+
readonly criteria: Readonly<Record<L, string>>;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/** What a question asks: text, or a JSON object the client sends as its JSON text. */
|
|
853
|
+
declare type DecideInstructions = string | object;
|
|
854
|
+
|
|
855
|
+
declare type DecideModelId = "jev" | "clef" | "clef-flash";
|
|
856
|
+
|
|
857
|
+
declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
|
|
858
|
+
|
|
859
|
+
/** Questions keyed by the name each answer comes back under. */
|
|
860
|
+
declare type DecideQuestions = Readonly<Record<string, DecideQuestion>>;
|
|
861
|
+
|
|
862
|
+
declare interface DecideRequest<Q extends DecideQuestions = DecideQuestions> {
|
|
863
|
+
/** Defaults to `jev`. */
|
|
864
|
+
readonly model?: DecideModelId;
|
|
865
|
+
readonly state: DecideState;
|
|
866
|
+
readonly questions: Q;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
declare interface DecideScoreAnswer {
|
|
870
|
+
readonly type: "score";
|
|
871
|
+
/** The expected level, from 0 to the number of levels minus one. */
|
|
872
|
+
readonly score: number;
|
|
873
|
+
readonly confidence: number;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/** A score over ordered levels: the first criterion scores 0, the next 1, and so on. */
|
|
877
|
+
declare interface DecideScoreQuestion {
|
|
878
|
+
readonly type: "score";
|
|
879
|
+
readonly instructions: DecideInstructions;
|
|
880
|
+
readonly criteria: readonly string[];
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* What a decide call reads. A JSON value is sent as JSON; every value must survive
|
|
885
|
+
* `JSON.stringify` unchanged.
|
|
886
|
+
*/
|
|
887
|
+
declare type DecideState = string | object;
|
|
888
|
+
|
|
889
|
+
/** Every asked question has an answer of its own kind. */
|
|
890
|
+
declare interface Decision<Q extends DecideQuestions = DecideQuestions> {
|
|
891
|
+
readonly model: DecideModelId;
|
|
892
|
+
readonly answers: {
|
|
893
|
+
readonly [K in keyof Q]: DecideAnswerFor<Q[K]>;
|
|
894
|
+
};
|
|
895
|
+
readonly usage?: SystemOneTokenUsage;
|
|
896
|
+
}
|
|
897
|
+
|
|
813
898
|
/** Createsa uni-directional Codec with Decode only. The Decode function is called on Value.Decode */
|
|
814
899
|
declare function Decode<Type extends TSchema, Callback extends TDecodeCallback<StaticDecode<Type>, unknown>>(type: Type, callback: Callback): TCodec<Type, ReturnType<Callback>>;
|
|
815
900
|
|
|
@@ -887,6 +972,8 @@ declare interface DroppedContribution {
|
|
|
887
972
|
readonly reason: "timeout" | "error";
|
|
888
973
|
}
|
|
889
974
|
|
|
975
|
+
declare type DurationUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years";
|
|
976
|
+
|
|
890
977
|
/**
|
|
891
978
|
* The Dynamic Context message: retrieval-produced context delivered right after human
|
|
892
979
|
* text enters the conversation (prompt, steer, or a drained follow-up batch — one
|
|
@@ -989,6 +1076,18 @@ declare function Enum<Values extends TEnumValue[]>(values: readonly [...Values],
|
|
|
989
1076
|
/** Creates an Enum type from a TypeScript enum declaration. */
|
|
990
1077
|
declare function Enum<Enum extends TTypeScriptEnumLike>(value: Enum, options?: TSchemaOptions): TEnum<TTypeScriptEnumToEnumValues<Enum>>;
|
|
991
1078
|
|
|
1079
|
+
declare interface EstimateDistribution<V> {
|
|
1080
|
+
readonly value: V | null;
|
|
1081
|
+
readonly mean?: V;
|
|
1082
|
+
readonly median?: V;
|
|
1083
|
+
readonly p10?: V;
|
|
1084
|
+
readonly p90?: V;
|
|
1085
|
+
/** P(value < min). */
|
|
1086
|
+
readonly pBelow?: number;
|
|
1087
|
+
/** P(value > max). */
|
|
1088
|
+
readonly pAbove?: number;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
992
1091
|
/** Applies an Evaluate action to a type. */
|
|
993
1092
|
declare function Evaluate<Type extends TSchema>(type: Type, options?: TSchemaOptions): TEvaluate<Type>;
|
|
994
1093
|
|
|
@@ -1166,13 +1265,135 @@ declare interface ExtensionPaths {
|
|
|
1166
1265
|
/** Applies an Extract action using the given types. */
|
|
1167
1266
|
declare function Extract_2<Left extends TSchema, Right extends TSchema>(left: Left, right: Right, options?: TSchemaOptions): TExtract<Left, Right>;
|
|
1168
1267
|
|
|
1268
|
+
declare type ExtractAnswerFor<F> = F extends ExtractTextField ? ExtractValueAnswer<"text", string> : F extends ExtractNumberField ? ExtractValueAnswer<"number", number> : F extends ExtractDateTimeField ? ExtractValueAnswer<F["type"], string> : F extends ExtractDurationField ? ExtractValueAnswer<"duration", number> : F extends ExtractListField ? ExtractListAnswer<F["items"] extends "number" ? number : string> : F extends ExtractEstimateField ? ExtractEstimateAnswer<F["min"] extends string ? string : number> : F extends ExtractForecastField ? ExtractForecastAnswer : never;
|
|
1269
|
+
|
|
1270
|
+
/** `date` answers are ISO dates, `time` ISO times, `datetime` ISO date-times. */
|
|
1271
|
+
declare interface ExtractDateTimeField extends ExtractFieldBase {
|
|
1272
|
+
readonly type: "date" | "time" | "datetime";
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1169
1275
|
/** Creates a deferred Extract action. */
|
|
1170
1276
|
declare function ExtractDeferred<Left extends TSchema, Right extends TSchema>(left: Left, right: Right, options?: TSchemaOptions): TExtractDeferred<Left, Right>;
|
|
1171
1277
|
|
|
1278
|
+
declare interface ExtractDurationField extends ExtractFieldBase {
|
|
1279
|
+
readonly type: "duration";
|
|
1280
|
+
/** Seconds when omitted. */
|
|
1281
|
+
readonly unit?: DurationUnit;
|
|
1282
|
+
readonly integer?: boolean;
|
|
1283
|
+
readonly decimals?: number;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
declare interface ExtractEstimateAnswer<V = number | string> extends EstimateDistribution<V> {
|
|
1287
|
+
readonly type: "estimate";
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/** A distribution over one value. `min`/`max` are numbers, or ISO dates for a date estimate. */
|
|
1291
|
+
declare interface ExtractEstimateField extends ExtractFieldBase {
|
|
1292
|
+
readonly type: "estimate";
|
|
1293
|
+
readonly min: number | string;
|
|
1294
|
+
readonly max: number | string;
|
|
1295
|
+
/** Grid step: a positive number (days for a date estimate), `month` or `year`. */
|
|
1296
|
+
readonly step?: number | "month" | "year";
|
|
1297
|
+
readonly scale?: "linear" | "log";
|
|
1298
|
+
readonly unit?: string;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
declare type ExtractField = ExtractTextField | ExtractNumberField | ExtractDateTimeField | ExtractDurationField | ExtractListField | ExtractEstimateField | ExtractForecastField;
|
|
1302
|
+
|
|
1303
|
+
declare interface ExtractFieldBase {
|
|
1304
|
+
readonly instructions?: string;
|
|
1305
|
+
/** P(null) above which the value is null. Clairic's default is 0.5. */
|
|
1306
|
+
readonly nullThreshold?: number;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/** Fields keyed by name. A name matches `^[A-Za-z_][A-Za-z0-9_.\-]{0,63}$`. */
|
|
1310
|
+
declare type ExtractFields = Readonly<Record<string, ExtractField>>;
|
|
1311
|
+
|
|
1312
|
+
declare interface ExtractForecastAnswer {
|
|
1313
|
+
readonly type: "forecast";
|
|
1314
|
+
/** One value per step; `null` when the state does not determine the forecast. */
|
|
1315
|
+
readonly value: readonly number[] | null;
|
|
1316
|
+
readonly steps: readonly EstimateDistribution<number>[];
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
/** One distribution per future step. */
|
|
1320
|
+
declare interface ExtractForecastField extends ExtractFieldBase {
|
|
1321
|
+
readonly type: "forecast";
|
|
1322
|
+
readonly min: number;
|
|
1323
|
+
readonly max: number;
|
|
1324
|
+
/** Number of steps, 1 to 64. */
|
|
1325
|
+
readonly horizon: number;
|
|
1326
|
+
readonly interval?: ForecastInterval;
|
|
1327
|
+
readonly scale?: "linear" | "log";
|
|
1328
|
+
readonly unit?: string;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
declare interface Extraction<F extends ExtractFields = ExtractFields> {
|
|
1332
|
+
readonly model: ExtractModelId;
|
|
1333
|
+
readonly answers: {
|
|
1334
|
+
readonly [K in keyof F]: ExtractAnswerFor<F[K]>;
|
|
1335
|
+
};
|
|
1336
|
+
/** The state was cut to fit the model's context. */
|
|
1337
|
+
readonly truncated: boolean;
|
|
1338
|
+
readonly usage?: SystemOneTokenUsage;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
declare interface ExtractListAnswer<V> {
|
|
1342
|
+
readonly type: "list";
|
|
1343
|
+
readonly value: readonly V[] | null;
|
|
1344
|
+
readonly confidence?: number;
|
|
1345
|
+
/** One per item in `value`. */
|
|
1346
|
+
readonly confidences?: readonly number[];
|
|
1347
|
+
readonly spans?: readonly TextSpan[];
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
declare interface ExtractListField extends ExtractFieldBase {
|
|
1351
|
+
readonly type: "list";
|
|
1352
|
+
readonly items: "text" | "number" | "date";
|
|
1353
|
+
readonly decimals?: number;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
declare type ExtractModelId = "clairic";
|
|
1357
|
+
|
|
1358
|
+
declare interface ExtractNumberField extends ExtractFieldBase {
|
|
1359
|
+
readonly type: "number";
|
|
1360
|
+
readonly unit?: string;
|
|
1361
|
+
readonly integer?: boolean;
|
|
1362
|
+
/** 0 to 6. */
|
|
1363
|
+
readonly decimals?: number;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
declare interface ExtractRequest<F extends ExtractFields = ExtractFields> {
|
|
1367
|
+
readonly model: ExtractModelId;
|
|
1368
|
+
/** Text only; JSON is not accepted. */
|
|
1369
|
+
readonly state: string;
|
|
1370
|
+
readonly fields: F;
|
|
1371
|
+
/** ISO date that anchors dates written without a year. */
|
|
1372
|
+
readonly referenceDate?: string;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
declare interface ExtractTextField extends ExtractFieldBase {
|
|
1376
|
+
readonly type: "text";
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
declare interface ExtractValueAnswer<T extends "text" | "number" | "date" | "time" | "datetime" | "duration", V> {
|
|
1380
|
+
readonly type: T;
|
|
1381
|
+
/** `null` when the state does not determine the value. */
|
|
1382
|
+
readonly value: V | null;
|
|
1383
|
+
/** The best candidate even when `value` is null. */
|
|
1384
|
+
readonly guess?: V;
|
|
1385
|
+
readonly confidence?: number;
|
|
1386
|
+
readonly pNull?: number;
|
|
1387
|
+
readonly span?: TextSpan;
|
|
1388
|
+
readonly unit?: string;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1172
1391
|
declare const Factor: (input: string) => [unknown, string] | [];
|
|
1173
1392
|
|
|
1174
1393
|
declare function FactorMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown;
|
|
1175
1394
|
|
|
1395
|
+
declare type ForecastInterval = "step" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
1396
|
+
|
|
1176
1397
|
/** Creates a Function type. */
|
|
1177
1398
|
declare function _Function_<Parameters extends TSchema[], ReturnType extends TSchema>(parameters: [...Parameters], returnType: ReturnType, options?: TSchemaOptions): TFunction<Parameters, ReturnType>;
|
|
1178
1399
|
|
|
@@ -1848,7 +2069,7 @@ declare interface KayAgentWhiteboardUpdateInput {
|
|
|
1848
2069
|
}
|
|
1849
2070
|
|
|
1850
2071
|
/**
|
|
1851
|
-
* The signed-in Bonsai account. Always present on
|
|
2072
|
+
* The signed-in Bonsai account. Always present on `KayAppPluginApi`.
|
|
1852
2073
|
*
|
|
1853
2074
|
* Reading the profile is ungated: it exposes the signed-in user's own identity to a plugin they
|
|
1854
2075
|
* explicitly enabled. The two stronger operations are separate claims, checked per call —
|
|
@@ -1907,7 +2128,7 @@ export declare interface KayAppAccount {
|
|
|
1907
2128
|
* `profile`/`assertResult`, compare against the last-seen identity, and act only on a
|
|
1908
2129
|
* real move (kay#8553 is the looping-reconnect bug the looser reading licensed). A gate
|
|
1909
2130
|
* that re-registers account-scoped sources must also act when a registration reports
|
|
1910
|
-
*
|
|
2131
|
+
* `KayAppDataSourceRegistration.isRetired`: the host's identity change is not always
|
|
1911
2132
|
* one `profile` shows, and a gate reading only the identity leaves the source retired.
|
|
1912
2133
|
*/
|
|
1913
2134
|
subscribe(listener: () => void): () => void;
|
|
@@ -1995,6 +2216,11 @@ export declare type KayAppAccountAssertionResult = {
|
|
|
1995
2216
|
readonly status: "signed-out";
|
|
1996
2217
|
};
|
|
1997
2218
|
|
|
2219
|
+
/**
|
|
2220
|
+
* The plugin-facing `kay.app` account contract (`app.account`): who is signed in to Bonsai, a
|
|
2221
|
+
* verifiable assertion of that identity, why one is unavailable, and the profile update. Changes to
|
|
2222
|
+
* this contract belong in this module.
|
|
2223
|
+
*/
|
|
1998
2224
|
/**
|
|
1999
2225
|
* Who is signed in to Bonsai. Metadata only — this carries no secret and cannot be presented to
|
|
2000
2226
|
* anyone as proof. Derived from the Bonsai product-account record's stored identity.
|
|
@@ -2963,7 +3189,7 @@ export declare interface KayAppContextContributor {
|
|
|
2963
3189
|
|
|
2964
3190
|
/**
|
|
2965
3191
|
* Raw read access to every stored session's transcript. Always present on
|
|
2966
|
-
*
|
|
3192
|
+
* `KayAppPluginApi`; each read is checked against the `corpus.read` claim, and refused
|
|
2967
3193
|
* unless the user has granted it. Data is raw and un-redacted — the plugin filters to what it
|
|
2968
3194
|
* needs. Invocation queries are bounded pages. Transcript reads materialize a whole session
|
|
2969
3195
|
* before yielding; the iterable does not promise per-entry streaming or an allocation bound.
|
|
@@ -3194,6 +3420,11 @@ export declare type KayAppDataSourceSnapshot = {
|
|
|
3194
3420
|
readonly reason?: KayAppDataUnavailableReason;
|
|
3195
3421
|
};
|
|
3196
3422
|
|
|
3423
|
+
/**
|
|
3424
|
+
* The plugin-facing `kay.app` app-data contract (`app.data`): registering the live definitions
|
|
3425
|
+
* behind manifest-declared data sources, app-wide or per session, and the closed reasons a source
|
|
3426
|
+
* reports no data. Changes to this contract belong in this module.
|
|
3427
|
+
*/
|
|
3197
3428
|
/**
|
|
3198
3429
|
* Why a source has no data right now — a CLOSED classification, never a message.
|
|
3199
3430
|
*
|
|
@@ -3823,6 +4054,14 @@ export declare interface KayAppPluginApi {
|
|
|
3823
4054
|
* `if (app.withJev !== undefined)`.
|
|
3824
4055
|
*/
|
|
3825
4056
|
readonly withJev: WithJev;
|
|
4057
|
+
/**
|
|
4058
|
+
* System One: fast, cheap judgment calls (`decide`) and typed field extraction (`extract`) on
|
|
4059
|
+
* small models (Jev, Clef, Clef Flash, Clairic). Each call is checked against `jev.use`; a call
|
|
4060
|
+
* that cannot be served or is not permitted throws a `SystemOneError` whose `cause.kind` says
|
|
4061
|
+
* why, so put the feature's cheaper path in the call's own `catch`. Always present, on every
|
|
4062
|
+
* host. Types: `@bonsai/plugin-sdk/system-one` (SDK 0.13.8).
|
|
4063
|
+
*/
|
|
4064
|
+
readonly systemOne: SystemOneClient;
|
|
3826
4065
|
/**
|
|
3827
4066
|
* Recorded Jev signals. `observe` runs a Jev inference and records the answer as a durable,
|
|
3828
4067
|
* provenance-stamped row; each call is checked against `jev.use`, and a refused grant, no
|
|
@@ -3874,7 +4113,7 @@ export declare interface KayAppPluginApi {
|
|
|
3874
4113
|
/**
|
|
3875
4114
|
* Register a session tool this plugin's manifest declares under
|
|
3876
4115
|
* `targets.kay.app.contributes.tools`. Injected into every session under the declared
|
|
3877
|
-
* `toolName`; each call's
|
|
4116
|
+
* `toolName`; each call's `KayAppToolContext` is host-stamped with the calling session.
|
|
3878
4117
|
* Registering an undeclared `localId`, or one twice, throws and disables the plugin —
|
|
3879
4118
|
* fail-closed at activation, exactly like {@link registerUriModule}.
|
|
3880
4119
|
*/
|
|
@@ -4391,8 +4630,8 @@ export declare interface KayAppSessionRunInput {
|
|
|
4391
4630
|
readonly activeToolNames?: readonly KayAppSessionRunHostToolName[] | undefined;
|
|
4392
4631
|
/**
|
|
4393
4632
|
* The run's model, as either an exact pin (a provider-qualified reference from
|
|
4394
|
-
*
|
|
4395
|
-
* see
|
|
4633
|
+
* `KayAppModels.list`) or a tier word (`small`/`medium`/`large`/`ultra` —
|
|
4634
|
+
* see `KayAppModels.listTiers`); absent, the daemon resolves
|
|
4396
4635
|
* the configured default. A tier word resolves through the same chokepoint every
|
|
4397
4636
|
* other tier selection does — the daemon picks the concrete model, never the
|
|
4398
4637
|
* plugin. An unavailable pin fails the run rather than silently substituting.
|
|
@@ -5153,6 +5392,11 @@ export declare interface KayAppStorage {
|
|
|
5153
5392
|
readonly dataDir?: KayAppDataDirStorage;
|
|
5154
5393
|
}
|
|
5155
5394
|
|
|
5395
|
+
/**
|
|
5396
|
+
* The plugin-facing `kay.app` models contract (`app.models`): the plugin-safe model catalog and
|
|
5397
|
+
* tiers, image-model resolution, the direct-completion broker, and the reasoning-effort ladder that
|
|
5398
|
+
* sessions and completions share. Changes to this contract belong in this module.
|
|
5399
|
+
*/
|
|
5156
5400
|
/** Bonsai's reasoning-effort ladder, in ascending order. */
|
|
5157
5401
|
export declare type KayAppThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
5158
5402
|
|
|
@@ -5244,7 +5488,7 @@ export declare interface KayAppToolContext {
|
|
|
5244
5488
|
|
|
5245
5489
|
/**
|
|
5246
5490
|
* A session tool a `kay.app` plugin implements — the tool counterpart of an app-scoped
|
|
5247
|
-
*
|
|
5491
|
+
* `UriModule`: registered once at activation, injected into every session. The kernel
|
|
5248
5492
|
* `ToolDefinition` shape minus `name` (the host stamps the manifest-declared `toolName`; a
|
|
5249
5493
|
* plugin never names its own model-facing tool at registration) and minus `requiresAuth`
|
|
5250
5494
|
* (extension-auth binding is a `kay.agent` seam; an app tool acts through its granted app
|
|
@@ -5991,6 +6235,12 @@ export declare interface KayAppWorkspaceExecuteContext {
|
|
|
5991
6235
|
readonly sessionId: string;
|
|
5992
6236
|
}
|
|
5993
6237
|
|
|
6238
|
+
/**
|
|
6239
|
+
* The plugin-facing `kay.app` workspace contract (`app.workspace`): the desktop workspace snapshot
|
|
6240
|
+
* and the arrangement commands a plugin may run. This package does not import
|
|
6241
|
+
* `@bonsai/agent-runtime-protocol`, so these types are JSON-safe, hand-copied twins of that
|
|
6242
|
+
* package's workspace shapes. Changes to this contract belong in this module.
|
|
6243
|
+
*/
|
|
5994
6244
|
/**
|
|
5995
6245
|
* What one pane item shows. A JSON-safe, hand-copied twin of `WorkspacePaneContent` in
|
|
5996
6246
|
* `@bonsai/agent-runtime-protocol` — this package cannot import that protocol package (see this
|
|
@@ -8361,6 +8611,76 @@ declare interface SystemMessage {
|
|
|
8361
8611
|
timestamp: number;
|
|
8362
8612
|
}
|
|
8363
8613
|
|
|
8614
|
+
declare interface SystemOneCallOptions {
|
|
8615
|
+
readonly signal?: AbortSignal;
|
|
8616
|
+
/** Bounds the whole call, retries included. */
|
|
8617
|
+
readonly timeoutMs?: number;
|
|
8618
|
+
/** What the call is for, carried to the host's usage accounting. Never sent to a provider. */
|
|
8619
|
+
readonly purpose?: string;
|
|
8620
|
+
}
|
|
8621
|
+
|
|
8622
|
+
declare interface SystemOneClient {
|
|
8623
|
+
decide<const Q extends DecideQuestions>(request: DecideRequest<Q>, options?: SystemOneCallOptions): Promise<Decision<Q>>;
|
|
8624
|
+
extract<const F extends ExtractFields>(request: ExtractRequest<F>, options?: SystemOneCallOptions): Promise<Extraction<F>>;
|
|
8625
|
+
/** Whether some provider in the current order can serve `(kind, model)`. Never rejects. */
|
|
8626
|
+
availability(kind: SystemOneKind, model?: SystemOneModelId): Promise<Availability>;
|
|
8627
|
+
}
|
|
8628
|
+
|
|
8629
|
+
/**
|
|
8630
|
+
* Why a call failed or a provider can't serve, as a closed set. Never prose, and never the
|
|
8631
|
+
* vendor's body: bodies can echo the request's state.
|
|
8632
|
+
*/
|
|
8633
|
+
declare type SystemOneFailureCause = {
|
|
8634
|
+
readonly kind: "no-credential";
|
|
8635
|
+
} | {
|
|
8636
|
+
readonly kind: "credential-store";
|
|
8637
|
+
} | {
|
|
8638
|
+
readonly kind: "not-served";
|
|
8639
|
+
} | {
|
|
8640
|
+
readonly kind: "not-permitted";
|
|
8641
|
+
} | {
|
|
8642
|
+
readonly kind: "unknown-model";
|
|
8643
|
+
} | {
|
|
8644
|
+
readonly kind: "invalid-request";
|
|
8645
|
+
readonly detail: string;
|
|
8646
|
+
} | {
|
|
8647
|
+
readonly kind: "too-large";
|
|
8648
|
+
} | {
|
|
8649
|
+
readonly kind: "http";
|
|
8650
|
+
readonly status: number;
|
|
8651
|
+
} | {
|
|
8652
|
+
readonly kind: "transport";
|
|
8653
|
+
} | {
|
|
8654
|
+
readonly kind: "timeout";
|
|
8655
|
+
} | {
|
|
8656
|
+
readonly kind: "aborted";
|
|
8657
|
+
} | {
|
|
8658
|
+
readonly kind: "invalid-answer";
|
|
8659
|
+
};
|
|
8660
|
+
|
|
8661
|
+
/**
|
|
8662
|
+
* ---
|
|
8663
|
+
* responsibility: The data shapes of the System One surface: models, the decide and extract
|
|
8664
|
+
* vocabularies, providers, and the failure causes.
|
|
8665
|
+
* owns:
|
|
8666
|
+
* - The caller-facing question, field, answer, and result types, in Bonsai's own words
|
|
8667
|
+
* (`bool` for yes/no, camelCase options). The vendors' words (`noul`, snake_case) appear
|
|
8668
|
+
* only in `wire.ts`.
|
|
8669
|
+
* - {@link SystemOneProvider}, the seam a transport implements.
|
|
8670
|
+
* does_not_own:
|
|
8671
|
+
* - Which models exist (`models.ts`), how answers are checked (`wire.ts`), or how a provider is
|
|
8672
|
+
* picked (`system-one-client.ts`).
|
|
8673
|
+
* ---
|
|
8674
|
+
*/
|
|
8675
|
+
declare type SystemOneKind = "decide" | "extract";
|
|
8676
|
+
|
|
8677
|
+
declare type SystemOneModelId = DecideModelId | ExtractModelId;
|
|
8678
|
+
|
|
8679
|
+
declare interface SystemOneTokenUsage {
|
|
8680
|
+
readonly inputTokens: number;
|
|
8681
|
+
readonly outputTokens: number;
|
|
8682
|
+
}
|
|
8683
|
+
|
|
8364
8684
|
declare namespace T {
|
|
8365
8685
|
export {
|
|
8366
8686
|
Codec,
|
|
@@ -9418,6 +9738,9 @@ declare type TExtractType<Left extends TSchema, Right extends TSchema, Check ext
|
|
|
9418
9738
|
|
|
9419
9739
|
declare type TExtractUnion<Left extends TSchema[], Right extends TSchema, Result extends TSchema[] = []> = (Left extends [infer Head extends TSchema, ...infer Tail extends TSchema[]] ? TExtractUnion<Tail, Right, [...Result, ...TExtractType<Head, Right>]> : Result);
|
|
9420
9740
|
|
|
9741
|
+
/** `[start, end)` character offsets into the state. */
|
|
9742
|
+
declare type TextSpan = readonly [number, number];
|
|
9743
|
+
|
|
9421
9744
|
declare type TFactor<Input extends string> = (TKeyOf<Input> extends [infer _0, infer Input extends string] ? (TBase<Input> extends [infer _1, infer Input extends string] ? (TIndexArray<Input> extends [infer _2, infer Input extends string] ? (TExtends_2<Input> extends [infer _3, infer Input extends string] ? (TWith<Input> extends [infer _4, infer Input extends string] ? [[_0, _1, _2, _3, _4], Input] : []) : []) : []) : []) : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFactorMapping<_0>, Input] : [];
|
|
9422
9745
|
|
|
9423
9746
|
declare type TFactorExtends<Type extends T.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? S_2.TConditionalDeferred<Type, Right, True, False> : Type);
|
package/dist/kay-app.js
CHANGED
|
@@ -506,6 +506,19 @@ function payload(name, schema, options = {}) {
|
|
|
506
506
|
};
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
+
// packages/plugin-sdk/dist/kay-app/account.js
|
|
510
|
+
function isRetryable(result) {
|
|
511
|
+
return result.status === "not-ready";
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// packages/plugin-sdk/dist/kay-app/automations.js
|
|
515
|
+
var KAY_APP_AUTOMATION_CONDITION_KINDS = [
|
|
516
|
+
"time",
|
|
517
|
+
"uri-change",
|
|
518
|
+
"occurrence",
|
|
519
|
+
"delayed-occurrence"
|
|
520
|
+
];
|
|
521
|
+
|
|
509
522
|
// packages/plugin-sdk/dist/kay-app/skills.js
|
|
510
523
|
function createUnavailableSkills(message) {
|
|
511
524
|
const unavailable = {
|
|
@@ -577,17 +590,6 @@ var KAY_APP_DATA_SNAPSHOT_MAX_BYTES = 16 * 1024 * 1024;
|
|
|
577
590
|
var KAY_APP_DATA_CHANGE_MAX_BYTES = 256 * 1024;
|
|
578
591
|
var KAY_APP_DATA_READ_REQUEST_MAX_BYTES = 64 * 1024;
|
|
579
592
|
var KAY_APP_DATA_READ_RESULT_MAX_BYTES = 16 * 1024 * 1024;
|
|
580
|
-
|
|
581
|
-
// packages/plugin-sdk/dist/kay-app/index.js
|
|
582
|
-
function isRetryable(result) {
|
|
583
|
-
return result.status === "not-ready";
|
|
584
|
-
}
|
|
585
|
-
var KAY_APP_AUTOMATION_CONDITION_KINDS = [
|
|
586
|
-
"time",
|
|
587
|
-
"uri-change",
|
|
588
|
-
"occurrence",
|
|
589
|
-
"delayed-occurrence"
|
|
590
|
-
];
|
|
591
593
|
export {
|
|
592
594
|
JevCallError,
|
|
593
595
|
JsonSchema,
|