@yaklabs-ai/plugin-sdk 0.13.1 → 0.13.3
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 +13 -13
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/disclosure.d.ts +38 -6
- package/dist/fs.js +1 -1
- package/dist/jev.d.ts +1 -1
- package/dist/kay-agent-testing.d.ts +36 -4
- package/dist/kay-agent.d.ts +266 -5
- package/dist/kay-agent.js +169 -2
- package/dist/kay-app.d.ts +267 -18
- package/dist/kay-app.js +16 -0
- package/dist/signals.d.ts +2 -2
- package/package.json +1 -1
- package/skills/directory-plugin-authoring/SKILL.md +18 -18
package/README.md
CHANGED
|
@@ -13,16 +13,16 @@ it under the name your plugin code actually imports:
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@
|
|
16
|
+
"@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.13.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
**The alias is not cosmetic.** The package is published as
|
|
22
22
|
`@yaklabs-ai/plugin-sdk`, but Bonsai's daemon resolves the specifier
|
|
23
|
-
`@
|
|
23
|
+
`@bonsai/plugin-sdk` when it loads your entrypoint, so that is the name your source
|
|
24
24
|
must import. The alias installs the published package at
|
|
25
|
-
`node_modules/@
|
|
25
|
+
`node_modules/@bonsai/plugin-sdk`, satisfying both.
|
|
26
26
|
|
|
27
27
|
<details>
|
|
28
28
|
<summary>Installing a release older than 0.8.0</summary>
|
|
@@ -48,7 +48,7 @@ this.
|
|
|
48
48
|
Working with an agent? This package ships the skill that teaches one the whole
|
|
49
49
|
authoring flow — scaffold, the SDK resolution contract, the reload loop, and
|
|
50
50
|
the diagnostics to read when a plugin does not load. Point your agent at
|
|
51
|
-
`node_modules/@
|
|
51
|
+
`node_modules/@bonsai/plugin-sdk/skills/directory-plugin-authoring/SKILL.md`
|
|
52
52
|
before it writes any plugin code.
|
|
53
53
|
|
|
54
54
|
```ts
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
toolParameters,
|
|
59
59
|
z,
|
|
60
60
|
type KayAgentActivate,
|
|
61
|
-
} from "@
|
|
61
|
+
} from "@bonsai/plugin-sdk/kay-agent";
|
|
62
62
|
|
|
63
63
|
const greet = defineTool({
|
|
64
64
|
name: "widgets_greet",
|
|
@@ -79,12 +79,12 @@ export default activate;
|
|
|
79
79
|
|
|
80
80
|
## Entrypoints
|
|
81
81
|
|
|
82
|
-
| Import
|
|
83
|
-
|
|
|
84
|
-
| `@
|
|
85
|
-
| `@
|
|
86
|
-
| `@
|
|
87
|
-
| `@
|
|
82
|
+
| Import | What it gives you |
|
|
83
|
+
| -------------------------------------- | ---------------------------------------------------------------------------- |
|
|
84
|
+
| `@bonsai/plugin-sdk/kay-agent` | Tools, URI modules, search providers, auth — the per-session agent surface |
|
|
85
|
+
| `@bonsai/plugin-sdk/kay-app` | App-lifetime surface: storage, endpoints, app-scoped URI modules |
|
|
86
|
+
| `@bonsai/plugin-sdk/kay-agent/testing` | `invokeToolForTest`, `fauxAuthContext` — for your own `node --test` runs |
|
|
87
|
+
| `@bonsai/plugin-sdk/disclosure` | The conformance audit Bonsai gates your plugin with — run it before you ship |
|
|
88
88
|
|
|
89
89
|
`kay-agent/host` is intentionally not published; it is Bonsai's own loading
|
|
90
90
|
machinery, not an authoring API.
|
|
@@ -100,7 +100,7 @@ run below is the run Bonsai does.
|
|
|
100
100
|
import {
|
|
101
101
|
auditPluginDisclosure,
|
|
102
102
|
collectUriModulesFromKayAgentActivate,
|
|
103
|
-
} from "@
|
|
103
|
+
} from "@bonsai/plugin-sdk/disclosure";
|
|
104
104
|
|
|
105
105
|
import activate from "../src/kay-agent.ts";
|
|
106
106
|
import manifest from "../kay-plugin.json" with { type: "json" };
|
|
@@ -152,7 +152,7 @@ Installing this SDK gives you **types, editor completion, and a runtime you can
|
|
|
152
152
|
execute in your own tests**. It is not what runs inside Bonsai.
|
|
153
153
|
|
|
154
154
|
When the daemon loads your plugin, chord bundles its declared target and keeps
|
|
155
|
-
`@
|
|
155
|
+
`@bonsai/plugin-sdk/*` as a host external. Those imports resolve to the SDK
|
|
156
156
|
**bundled with the Bonsai app**. The host's copy always wins. That is deliberate —
|
|
157
157
|
one implementation, the one the daemon is built against — but it has a
|
|
158
158
|
consequence worth stating plainly:
|
package/dist/disclosure.d.ts
CHANGED
|
@@ -271,6 +271,10 @@ declare interface BackgroundTaskCompletion {
|
|
|
271
271
|
readonly resultDelivery?: BackgroundTaskResultDelivery;
|
|
272
272
|
readonly output?: string;
|
|
273
273
|
readonly error?: string;
|
|
274
|
+
/** The thrown Error's stack, when a failed task threw one. */
|
|
275
|
+
readonly errorStack?: string;
|
|
276
|
+
/** Why a failed AGENT task's run failed, classified from what it threw; absent for other kinds. */
|
|
277
|
+
readonly failureReason?: RunFailureReason;
|
|
274
278
|
}
|
|
275
279
|
|
|
276
280
|
declare type BackgroundTaskInspector = () => Promise<string> | string;
|
|
@@ -346,14 +350,14 @@ export declare interface CapturedKayAgentAuthDeclarations {
|
|
|
346
350
|
* Api-key schemes declared this run — the `displayName`/`inputLabel`/`setup`/`validate`
|
|
347
351
|
* runtime declaration a manifest's identity-only scheme row cannot carry. Daemon acquisition
|
|
348
352
|
* composition maps these onto the connect dispatch's api-key roster the same way
|
|
349
|
-
* `oauthPkceSchemes` maps onto the PKCE arm — see `@
|
|
353
|
+
* `oauthPkceSchemes` maps onto the PKCE arm — see `@bonsai/agent-runtime`'s `kay/composition/`.
|
|
350
354
|
* Empty for a plugin that declares none.
|
|
351
355
|
*/
|
|
352
356
|
readonly apiKeySchemes: readonly CapturedApiKeyDeclaration[];
|
|
353
357
|
/**
|
|
354
358
|
* Delegated schemes declared this run. Daemon acquisition composition maps these onto a
|
|
355
359
|
* delegated connect-roster entry the same way `oauthPkceSchemes` maps onto the PKCE arm — see
|
|
356
|
-
* `@
|
|
360
|
+
* `@bonsai/agent-runtime`'s `kay/composition/`. Empty for a plugin that declares none.
|
|
357
361
|
*/
|
|
358
362
|
readonly delegatedSchemes: readonly CapturedDelegatedDeclaration[];
|
|
359
363
|
}
|
|
@@ -664,7 +668,7 @@ declare interface ImageContent {
|
|
|
664
668
|
|
|
665
669
|
/**
|
|
666
670
|
* The value a Browser Interaction driver sets as `credentialGuard` to declare that every act runs
|
|
667
|
-
* the page-side credential guard from `@
|
|
671
|
+
* the page-side credential guard from `@bonsai/interaction-page-scripts` (never type into or click a
|
|
668
672
|
* sign-in form). The engine refuses to register a browser driver without it.
|
|
669
673
|
*/
|
|
670
674
|
declare const INTERACTION_CREDENTIAL_GUARD = "kay.credential-guard/v1";
|
|
@@ -969,7 +973,7 @@ declare interface JevScoreQuestion {
|
|
|
969
973
|
* - The wire. The host serves `classify` over whichever route the user's Jev provider order
|
|
970
974
|
* picks; a plugin never sees a vendor client, a vendor type, or a route.
|
|
971
975
|
* - Credential resolution, the `jev.use` decision, the Jev-branch budget, or usage accounting.
|
|
972
|
-
* Those are host-side (`@
|
|
976
|
+
* Those are host-side (`@bonsai/agent-runtime`'s `kay/jev/`).
|
|
973
977
|
* ---
|
|
974
978
|
*
|
|
975
979
|
* The vocabulary is Bonsai's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
|
|
@@ -1515,7 +1519,7 @@ declare interface KayAppTimeSnapshot {
|
|
|
1515
1519
|
* The time zone the user is in, as an IANA id in the spelling ICU resolves (`America/New_York`).
|
|
1516
1520
|
* One zone can have two ids, and ICU picks one: `Asia/Kolkata` comes back as `Asia/Calcutta`. So
|
|
1517
1521
|
* never compare zone ids with `===`. A first-party plugin compares with `sameZone` from
|
|
1518
|
-
* `@
|
|
1522
|
+
* `@bonsai/time`. A plugin that imports only this SDK and node builtins resolves each id with
|
|
1519
1523
|
* `new Intl.DateTimeFormat("en-US", { timeZone: id }).resolvedOptions().timeZone` and compares the
|
|
1520
1524
|
* results. Pass `zone` as the `timeZone` of `Intl.DateTimeFormat` or `toLocaleString` to format a
|
|
1521
1525
|
* time for the user.
|
|
@@ -2406,6 +2410,28 @@ declare interface ResolveTokenSuccess {
|
|
|
2406
2410
|
readonly auth: ResolvedAuth;
|
|
2407
2411
|
}
|
|
2408
2412
|
|
|
2413
|
+
/**
|
|
2414
|
+
* Pure, provider-neutral classification of a failed model run.
|
|
2415
|
+
*
|
|
2416
|
+
* This is a leaf module with no runtime imports, because two callers that
|
|
2417
|
+
* cannot share a bundle must reach the same verdict: the kernel failure path
|
|
2418
|
+
* (`run-error.ts`, which reaches Pi and Node) and the browser-safe interactive
|
|
2419
|
+
* reducer that projects an errored message for a surface to render. Routing the
|
|
2420
|
+
* reducer through `run-error.ts` would drag `pi-agent-core` into the renderer
|
|
2421
|
+
* bundle; duplicating the rules there would let the reason a run was *retried
|
|
2422
|
+
* for* drift from the reason a user is *told about*.
|
|
2423
|
+
*
|
|
2424
|
+
* The leaf rule is why {@link readableFailureText} carries its own small HTML
|
|
2425
|
+
* extractor instead of reaching for `core/web/markdown.ts`. That module imports
|
|
2426
|
+
* `@herd/plugin-primitives`, and the browser-safety guard externalizes bare
|
|
2427
|
+
* specifiers, so it could not prove the import stays renderer-safe. It is also
|
|
2428
|
+
* the wrong tool: it emits markdown into what must remain a plain diagnostic,
|
|
2429
|
+
* and it discards `<head>`, where a gateway page puts the one line naming the
|
|
2430
|
+
* failure.
|
|
2431
|
+
*/
|
|
2432
|
+
/** Provider-neutral factual category for a failed model run. */
|
|
2433
|
+
declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
|
|
2434
|
+
|
|
2409
2435
|
/** One all-of arm in an ordered scope requirement. */
|
|
2410
2436
|
declare interface ScopeAlternative {
|
|
2411
2437
|
readonly allOf: readonly ScopeNeed[];
|
|
@@ -3230,6 +3256,12 @@ declare interface UriHelp {
|
|
|
3230
3256
|
readonly templates?: readonly UriTemplate[];
|
|
3231
3257
|
readonly examples?: readonly UriExample[];
|
|
3232
3258
|
readonly notes?: readonly string[];
|
|
3259
|
+
/**
|
|
3260
|
+
* Set when this help, for the address it was asked about, carries text a third party wrote and
|
|
3261
|
+
* the module relays as it received it (an MCP server's own tool names and descriptions), rather
|
|
3262
|
+
* than text the module's author wrote. Absent: the module's own text.
|
|
3263
|
+
*/
|
|
3264
|
+
readonly thirdPartyContent?: true;
|
|
3233
3265
|
}
|
|
3234
3266
|
|
|
3235
3267
|
declare interface UriHintTriggers {
|
|
@@ -3909,7 +3941,7 @@ declare interface UriValidationMessage {
|
|
|
3909
3941
|
* applies label changes"), never wire mechanics or URI shapes. Verbs the
|
|
3910
3942
|
* module does not support are omitted; at runtime a supported verb with no
|
|
3911
3943
|
* entry simply renders undocumented (fail-open metadata) — but for a plugin's
|
|
3912
|
-
* `kay.agent` URI modules, `auditPluginDisclosure` (`@
|
|
3944
|
+
* `kay.agent` URI modules, `auditPluginDisclosure` (`@bonsai/plugin-sdk/
|
|
3913
3945
|
* disclosure`) enforces coverage of every supported verb at authoring/load
|
|
3914
3946
|
* time.
|
|
3915
3947
|
*
|
package/dist/fs.js
CHANGED
|
@@ -156,7 +156,7 @@ function abortError(signal) {
|
|
|
156
156
|
return assignFields(error, { code: "ABORT_ERR" });
|
|
157
157
|
}
|
|
158
158
|
function unsupported(syscall, what) {
|
|
159
|
-
return kayError(KAY_FS_UNSUPPORTED, `${what} is not supported by @
|
|
159
|
+
return kayError(KAY_FS_UNSUPPORTED, `${what} is not supported by @bonsai/plugin-sdk/fs`, syscall, void 0);
|
|
160
160
|
}
|
|
161
161
|
function finishedOf(error) {
|
|
162
162
|
return error?.[FINISHED];
|
package/dist/jev.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export declare interface JevScoreQuestion {
|
|
|
135
135
|
* - The wire. The host serves `classify` over whichever route the user's Jev provider order
|
|
136
136
|
* picks; a plugin never sees a vendor client, a vendor type, or a route.
|
|
137
137
|
* - Credential resolution, the `jev.use` decision, the Jev-branch budget, or usage accounting.
|
|
138
|
-
* Those are host-side (`@
|
|
138
|
+
* Those are host-side (`@bonsai/agent-runtime`'s `kay/jev/`).
|
|
139
139
|
* ---
|
|
140
140
|
*
|
|
141
141
|
* The vocabulary is Bonsai's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
|
|
@@ -225,6 +225,10 @@ declare interface BackgroundTaskCompletion {
|
|
|
225
225
|
readonly resultDelivery?: BackgroundTaskResultDelivery;
|
|
226
226
|
readonly output?: string;
|
|
227
227
|
readonly error?: string;
|
|
228
|
+
/** The thrown Error's stack, when a failed task threw one. */
|
|
229
|
+
readonly errorStack?: string;
|
|
230
|
+
/** Why a failed AGENT task's run failed, classified from what it threw; absent for other kinds. */
|
|
231
|
+
readonly failureReason?: RunFailureReason;
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
declare type BackgroundTaskInspector = () => Promise<string> | string;
|
|
@@ -550,7 +554,7 @@ declare interface ImageContent {
|
|
|
550
554
|
|
|
551
555
|
/**
|
|
552
556
|
* The value a Browser Interaction driver sets as `credentialGuard` to declare that every act runs
|
|
553
|
-
* the page-side credential guard from `@
|
|
557
|
+
* the page-side credential guard from `@bonsai/interaction-page-scripts` (never type into or click a
|
|
554
558
|
* sign-in form). The engine refuses to register a browser driver without it.
|
|
555
559
|
*/
|
|
556
560
|
declare const INTERACTION_CREDENTIAL_GUARD = "kay.credential-guard/v1";
|
|
@@ -873,7 +877,7 @@ declare interface JevScoreQuestion {
|
|
|
873
877
|
* - The wire. The host serves `classify` over whichever route the user's Jev provider order
|
|
874
878
|
* picks; a plugin never sees a vendor client, a vendor type, or a route.
|
|
875
879
|
* - Credential resolution, the `jev.use` decision, the Jev-branch budget, or usage accounting.
|
|
876
|
-
* Those are host-side (`@
|
|
880
|
+
* Those are host-side (`@bonsai/agent-runtime`'s `kay/jev/`).
|
|
877
881
|
* ---
|
|
878
882
|
*
|
|
879
883
|
* The vocabulary is Bonsai's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
|
|
@@ -1416,7 +1420,7 @@ declare interface KayAppTimeSnapshot {
|
|
|
1416
1420
|
* The time zone the user is in, as an IANA id in the spelling ICU resolves (`America/New_York`).
|
|
1417
1421
|
* One zone can have two ids, and ICU picks one: `Asia/Kolkata` comes back as `Asia/Calcutta`. So
|
|
1418
1422
|
* never compare zone ids with `===`. A first-party plugin compares with `sameZone` from
|
|
1419
|
-
* `@
|
|
1423
|
+
* `@bonsai/time`. A plugin that imports only this SDK and node builtins resolves each id with
|
|
1420
1424
|
* `new Intl.DateTimeFormat("en-US", { timeZone: id }).resolvedOptions().timeZone` and compares the
|
|
1421
1425
|
* results. Pass `zone` as the `timeZone` of `Intl.DateTimeFormat` or `toLocaleString` to format a
|
|
1422
1426
|
* time for the user.
|
|
@@ -2304,6 +2308,28 @@ declare interface ResolveTokenSuccess {
|
|
|
2304
2308
|
readonly auth: ResolvedAuth;
|
|
2305
2309
|
}
|
|
2306
2310
|
|
|
2311
|
+
/**
|
|
2312
|
+
* Pure, provider-neutral classification of a failed model run.
|
|
2313
|
+
*
|
|
2314
|
+
* This is a leaf module with no runtime imports, because two callers that
|
|
2315
|
+
* cannot share a bundle must reach the same verdict: the kernel failure path
|
|
2316
|
+
* (`run-error.ts`, which reaches Pi and Node) and the browser-safe interactive
|
|
2317
|
+
* reducer that projects an errored message for a surface to render. Routing the
|
|
2318
|
+
* reducer through `run-error.ts` would drag `pi-agent-core` into the renderer
|
|
2319
|
+
* bundle; duplicating the rules there would let the reason a run was *retried
|
|
2320
|
+
* for* drift from the reason a user is *told about*.
|
|
2321
|
+
*
|
|
2322
|
+
* The leaf rule is why {@link readableFailureText} carries its own small HTML
|
|
2323
|
+
* extractor instead of reaching for `core/web/markdown.ts`. That module imports
|
|
2324
|
+
* `@herd/plugin-primitives`, and the browser-safety guard externalizes bare
|
|
2325
|
+
* specifiers, so it could not prove the import stays renderer-safe. It is also
|
|
2326
|
+
* the wrong tool: it emits markdown into what must remain a plain diagnostic,
|
|
2327
|
+
* and it discards `<head>`, where a gateway page puts the one line naming the
|
|
2328
|
+
* failure.
|
|
2329
|
+
*/
|
|
2330
|
+
/** Provider-neutral factual category for a failed model run. */
|
|
2331
|
+
declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
|
|
2332
|
+
|
|
2307
2333
|
/** One all-of arm in an ordered scope requirement. */
|
|
2308
2334
|
declare interface ScopeAlternative {
|
|
2309
2335
|
readonly allOf: readonly ScopeNeed[];
|
|
@@ -3128,6 +3154,12 @@ declare interface UriHelp {
|
|
|
3128
3154
|
readonly templates?: readonly UriTemplate[];
|
|
3129
3155
|
readonly examples?: readonly UriExample[];
|
|
3130
3156
|
readonly notes?: readonly string[];
|
|
3157
|
+
/**
|
|
3158
|
+
* Set when this help, for the address it was asked about, carries text a third party wrote and
|
|
3159
|
+
* the module relays as it received it (an MCP server's own tool names and descriptions), rather
|
|
3160
|
+
* than text the module's author wrote. Absent: the module's own text.
|
|
3161
|
+
*/
|
|
3162
|
+
readonly thirdPartyContent?: true;
|
|
3131
3163
|
}
|
|
3132
3164
|
|
|
3133
3165
|
declare interface UriHintTriggers {
|
|
@@ -3807,7 +3839,7 @@ declare interface UriValidationMessage {
|
|
|
3807
3839
|
* applies label changes"), never wire mechanics or URI shapes. Verbs the
|
|
3808
3840
|
* module does not support are omitted; at runtime a supported verb with no
|
|
3809
3841
|
* entry simply renders undocumented (fail-open metadata) — but for a plugin's
|
|
3810
|
-
* `kay.agent` URI modules, `auditPluginDisclosure` (`@
|
|
3842
|
+
* `kay.agent` URI modules, `auditPluginDisclosure` (`@bonsai/plugin-sdk/
|
|
3811
3843
|
* disclosure`) enforces coverage of every supported verb at authoring/load
|
|
3812
3844
|
* time.
|
|
3813
3845
|
*
|