@yaklabs-ai/plugin-sdk 0.53.0 → 0.54.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 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.53.0"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.54.1"
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.53.0" },
65
+ "compatibility": { "sdk": "^0.54.1" },
66
66
  "targets": {
67
67
  "kay": {
68
68
  "agent": {
@@ -134,24 +134,26 @@ naming both versions, instead of loading it and finding no `activate`.
134
134
 
135
135
  ## Entrypoints
136
136
 
137
- | Import | What it gives you |
138
- | --------------------------------------- | ---------------------------------------------------------------------------------------- |
139
- | `@bonsai/plugin-sdk/kay-agent` | Tools, URI modules, search providers, auth — the per-session agent surface |
140
- | `@bonsai/plugin-sdk/kay-app` | App-lifetime surface: storage, endpoints, app-scoped URI modules |
141
- | `@bonsai/plugin-sdk/uri` | Sessionless resource caller types, revision digest and unavailable fallback, from 0.49.0 |
142
- | `@bonsai/plugin-sdk/endpoints` | Sessionless cross-plugin endpoint caller and outcome types, from 0.50.0 |
143
- | `@bonsai/plugin-sdk/kay-agent/testing` | `invokeToolForTest`, `fauxAuthContext` — for your own `node --test` runs |
144
- | `@bonsai/plugin-sdk/disclosure` | The conformance audit Bonsai gates your plugin with — run it before you ship |
145
- | `@bonsai/plugin-sdk/time` | `Temporal` (Bonsai's own instance) and the time-zone helpers, from 0.13.6 |
146
- | `@bonsai/plugin-sdk/transcript` | The active-branch walk; the turn walk and run records from 0.13.6 |
147
- | `@bonsai/plugin-sdk/transcript-review` | The review fold: a session's spans, tool-call attempts and records, from 0.13.7 |
148
- | `@bonsai/plugin-sdk/agent-conversation` | How a session's agent-to-agent traffic groups into conversations, from 0.13.7 |
149
- | `@bonsai/plugin-sdk/app-data` | The app-data size caps, on an entry with no other import, from 0.13.7 |
150
- | `@bonsai/plugin-sdk/vendored-mcp` | The kit for a plugin built on a vendor's hosted MCP server, from 0.13.7 |
151
- | `@bonsai/plugin-sdk/system-one` | The types and error class for `api.systemOne` / `app.systemOne`, from 0.13.8 |
152
- | `@bonsai/plugin-sdk/zod` | `z` (the host's in the daemon), on an entry with no other import, from 0.13.9 |
153
-
154
- A plugin that imports these subpaths declares the current supported SDK range (`^0.53.0`).
137
+ | Import | What it gives you |
138
+ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
139
+ | `@bonsai/plugin-sdk/kay-agent` | Tools, URI modules, search providers, auth — the per-session agent surface |
140
+ | `@bonsai/plugin-sdk/kay-app` | App-lifetime surface: storage, endpoints, app-scoped URI modules |
141
+ | `@bonsai/plugin-sdk/uri` | Sessionless resource caller types, revision digest and unavailable fallback, from 0.49.0 |
142
+ | `@bonsai/plugin-sdk/endpoints` | Sessionless cross-plugin endpoint caller and outcome types, from 0.50.0; `projectDirectories` endpoint shapes |
143
+ | `@bonsai/plugin-sdk/kay-agent/testing` | `invokeToolForTest`, `fauxAuthContext` — for your own `node --test` runs |
144
+ | `@bonsai/plugin-sdk/disclosure` | The conformance audit Bonsai gates your plugin with — run it before you ship |
145
+ | `@bonsai/plugin-sdk/time` | `Temporal` (Bonsai's own instance) and the time-zone helpers, from 0.13.6 |
146
+ | `@bonsai/plugin-sdk/transcript` | Active-branch and turn walks, message origin, preceding messages, and skill evidence folds |
147
+ | `@bonsai/plugin-sdk/transcript-review` | The review fold: a session's spans, tool-call attempts and records, from 0.13.7 |
148
+ | `@bonsai/plugin-sdk/agent-conversation` | How a session's agent-to-agent traffic groups into conversations, from 0.13.7 |
149
+ | `@bonsai/plugin-sdk/text-diff` | Word-level draft comparison and Unicode-safe text clipping |
150
+ | `@bonsai/plugin-sdk/fs` | File I/O, shared keyed work ordering and committed-change notices |
151
+ | `@bonsai/plugin-sdk/app-data` | The app-data size caps, on an entry with no other import, from 0.13.7 |
152
+ | `@bonsai/plugin-sdk/vendored-mcp` | The kit for a plugin built on a vendor's hosted MCP server, from 0.13.7 |
153
+ | `@bonsai/plugin-sdk/system-one` | The types and error class for `api.systemOne` / `app.systemOne`, from 0.13.8 |
154
+ | `@bonsai/plugin-sdk/zod` | `z` (the host's in the daemon), on an entry with no other import, from 0.13.9 |
155
+
156
+ A plugin that imports these subpaths declares the current supported SDK range (`^0.54.1`).
155
157
  The rows record when each subpath appeared, not retained runtime compatibility. `vendored-mcp` builds the plugin's URI module (its link cards and help); hosting the
156
158
  vendor's MCP server itself is a separate host decision: Bonsai hosts it once a person approves
157
159
  the plugin's `mcp.host-server` grant for that server's name and URL. A server that needs an OAuth
@@ -159,7 +161,7 @@ sign-in names one of the plugin's auth services in `authService`; that service m
159
161
  one `delegated` scheme, which Bonsai uses to sign the person in to the server. Bonsai declares that
160
162
  scheme at runtime; the plugin's code must not declare it again. From 0.16.2 a plugin's code can also
161
163
  call the server's tools through `api.vendoredMcp.port(<server>)`, typed by this subpath's
162
- `VendoredMcpPort` and `VendoredMcpOutcome` (declare `^0.53.0`).
164
+ `VendoredMcpPort` and `VendoredMcpOutcome` (declare `^0.54.1`).
163
165
 
164
166
  From 0.13.10 the manifest schema carries two facts Bonsai reads for its own plugins only; another
165
167
  plugin's are ignored, with a load diagnostic. An `external-cli` auth scheme's `cli` says how Bonsai
@@ -241,7 +243,7 @@ Provider schemas remain authoritative; declaring a dependency grants no authorit
241
243
  through `app.uri`, parse returned Markdown in the consuming plugin, and retain the read's
242
244
  revision (or `contentDigest` from `/uri`) for edits. The old `memory.read` and `memory.write`
243
245
  grants do not authorize the replacement scheme-and-verb calls. Contracts before 0.49.0 are
244
- refused; migrate and declare `^0.53.0`. The current host also serves the 0.49.0 resource contract.
246
+ refused; migrate and declare `^0.54.1`. The current host also serves the 0.49.0 resource contract.
245
247
 
246
248
  ## What this package is, and is not, at runtime
247
249
 
@@ -306,3 +308,14 @@ relative imports. Multi-file entrypoints are supported, and TypeScript syntax
306
308
  that native stripping cannot execute, such as enums, namespaces, constructor
307
309
  parameter properties, and decorators, is compiled into the bundle. The host
308
310
  SDK remains external and is supplied by the running Bonsai app.
311
+
312
+ ## Plugin workers
313
+
314
+ SDK 0.54.1 lets either backend target run a declared module in a fresh child process.
315
+ Declare `workers: [{ localId: "analyze", module: "./src/analyze.ts" }]` at the manifest's top
316
+ level, export `run(input)` from that module, and call
317
+ `api.workers.run("analyze", input, { timeoutMs: 10_000 })` (or `app.workers.run`). Input and
318
+ return values must be JSON. An optional `signal` cancels the call. The host terminates the child
319
+ on cancellation, timeout or plugin disposal; limits and child failures reject with
320
+ `PluginWorkerError`. Import the capability and error from `@bonsai/plugin-sdk/workers`.
321
+ Calls identify only a worker declared by this plugin and cannot supply executable paths or code.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-sdk",
4
- "version": "0.53.0",
4
+ "version": "0.54.1",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -31,6 +31,19 @@ declare type AgentSessionEvent = Exclude<HerdHarnessEvent, {
31
31
 
32
32
  declare const Alpha: TAlpha;
33
33
 
34
+ /**
35
+ * The ids of the blocks that start a new answer stretch. A person's mid-turn message
36
+ * (`steer_message`) always does. A background input does when the agent answered both before
37
+ * it and after it, so the reply it wakes never turns the earlier answer into a folded middle
38
+ * one. An input with no answer on one side cannot fold one, so it joins the stretch it lands
39
+ * in: a result absorbed mid-run, or a wake the agent left unanswered, starts nothing. When
40
+ * several inputs arrive between two answers, the first one starts the stretch.
41
+ *
42
+ * The turn's opening (the person's message that caused it) is not a block and is never listed;
43
+ * the first stretch starts there.
44
+ */
45
+ export declare function answerStretchStarts(blocks: readonly CanonicalAgentBlock[]): ReadonlySet<string>;
46
+
34
47
  /** Compatibility settings for Anthropic Messages-compatible APIs. */
35
48
  declare interface AnthropicMessagesCompat extends Static<typeof AnthropicMessagesCompatSchema> {
36
49
  }
@@ -1343,6 +1356,16 @@ declare function DependentOptions(type: TDependent): TSchemaOptions;
1343
1356
  */
1344
1357
  declare type DetachedWorkResultChannel = "next_turn" | "steer";
1345
1358
 
1359
+ declare interface DetailsAudienceRow extends TranscriptTypeRowBase {
1360
+ /** `undefined` when the details carry no discriminant this row can read. */
1361
+ readonly audience: (details: unknown) => TranscriptAudience | undefined;
1362
+ /**
1363
+ * What a surface does with a message whose audience cannot be read: hide it, show a generic
1364
+ * version, or show it as unrecognized.
1365
+ */
1366
+ readonly onUndecodable: "hide" | "generic" | "unrecognized";
1367
+ }
1368
+
1346
1369
  declare interface DiagnosticErrorInfo {
1347
1370
  name?: string;
1348
1371
  message: string;
@@ -1647,6 +1670,10 @@ declare interface FinalOutputCapture {
1647
1670
  readonly sessionTitle?: string;
1648
1671
  }
1649
1672
 
1673
+ declare interface FixedAudienceRow extends TranscriptTypeRowBase {
1674
+ readonly audience: TranscriptAudience;
1675
+ }
1676
+
1650
1677
  /** Creates a Function type. */
1651
1678
  declare function _Function_<Parameters extends TSchema[], ReturnType extends TSchema>(parameters: [...Parameters], returnType: ReturnType, options?: TSchemaOptions): TFunction<Parameters, ReturnType>;
1652
1679
 
@@ -4535,6 +4562,15 @@ declare type StaticVoid = void;
4535
4562
 
4536
4563
  declare type StopReason = "pending" | "stop" | "length" | "toolUse" | "error" | "aborted" | "deferred";
4537
4564
 
4565
+ /**
4566
+ * The settled helper and command results that open the stretch starting at `blocks[start]`: the
4567
+ * results among the custom messages that arrived together there, before the agent's next step.
4568
+ * A bar whose stretch opens with any shows its background result line in place of a work
4569
+ * headline, so the headline writer labels no such bar. Empty for a stretch a person's message,
4570
+ * a bare wake or an automation starts.
4571
+ */
4572
+ export declare function stretchOpeningResults(blocks: readonly CanonicalAgentBlock[], start: number): readonly CanonicalCustomMessageBlock[];
4573
+
4538
4574
  /** Matches a literal String with the given quotes */
4539
4575
  declare function String_2<Quotes extends string[], Input extends string>(quotes: [...Quotes], input: Input): TString<Quotes, Input>;
4540
4576
 
@@ -7229,6 +7265,36 @@ declare type TPropertyValues<Properties extends TProperties, Keys extends string
7229
7265
 
7230
7266
  declare type TPropertyValuesReduce<Properties extends TProperties, Keys extends string[], Result extends TSchema[] = []> = Keys extends [infer Left extends string, ...infer Right extends string[]] ? Left extends keyof Properties ? TPropertyValuesReduce<Properties, Right, [...Result, Properties[Left]]> : TPropertyValuesReduce<Properties, Right, Result> : Result;
7231
7267
 
7268
+ /** Every row, keyed by `customType`. */
7269
+ export declare const TRANSCRIPT_TYPE_TABLE: ReadonlyMap<string, TranscriptTypeRow>;
7270
+
7271
+ /**
7272
+ * Who a type is written for: the person reading the transcript, the model only, or the host
7273
+ * alone (records the daemon or the kernel reads back and no surface shows).
7274
+ */
7275
+ declare type TranscriptAudience = "person" | "model" | "host-only";
7276
+
7277
+ /** The kind of information a row carries; `unrecognized` is content the app cannot classify. */
7278
+ declare type TranscriptKind = "said" | "work" | "ask" | "result" | "context" | "notice" | "unrecognized";
7279
+
7280
+ /** The card a message answers: the `ui_render` call that drew it, and the element when known. */
7281
+ declare interface TranscriptTypeAnswer {
7282
+ readonly toolCallId: string;
7283
+ readonly elementId?: string;
7284
+ }
7285
+
7286
+ declare type TranscriptTypeRow = FixedAudienceRow | DetailsAudienceRow;
7287
+
7288
+ declare interface TranscriptTypeRowBase extends CustomMessagePlacementRow {
7289
+ /** Every kind this type can carry; a type whose kind depends on its details lists each. */
7290
+ readonly kinds: readonly [TranscriptKind, ...TranscriptKind[]];
7291
+ /**
7292
+ * Present on a type the card it answers draws (the answer, a sent-draft record), so it paints
7293
+ * no row of its own whatever its audience.
7294
+ */
7295
+ readonly answers?: (details: unknown) => TranscriptTypeAnswer | undefined;
7296
+ }
7297
+
7232
7298
  declare type TReadonly<Type extends TSchema = TSchema> = (Type & {
7233
7299
  '~readonly': true;
7234
7300
  });