@yaklabs-ai/plugin-sdk 0.40.0 → 0.41.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 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.40.0"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.41.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.40.0" },
65
+ "compatibility": { "sdk": "^0.41.0" },
66
66
  "targets": {
67
67
  "kay": {
68
68
  "agent": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-sdk",
4
- "version": "0.40.0",
4
+ "version": "0.41.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -2414,8 +2414,11 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2414
2414
  * feed may now declare a `store`. It removes the `cost.read`, `skills.read`, `memory.read` and
2415
2415
  * `self-improvement.read` host capabilities, so a manifest still listing one no longer parses and
2416
2416
  * lists the feed instead. A plugin that lists feeds declares ^0.40.0.
2417
+ *
2418
+ * 0.41.0 adds app.mcp.callTool for background calls to a plugin's own manifest-declared MCP
2419
+ * servers, using Bonsai's managed connection without a session or working directory (#16172).
2417
2420
  */
2418
- declare const KAY_PLUGIN_SDK_VERSION: "0.40.0";
2421
+ declare const KAY_PLUGIN_SDK_VERSION: "0.41.0";
2419
2422
 
2420
2423
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2421
2424
 
@@ -2468,8 +2468,11 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2468
2468
  * feed may now declare a `store`. It removes the `cost.read`, `skills.read`, `memory.read` and
2469
2469
  * `self-improvement.read` host capabilities, so a manifest still listing one no longer parses and
2470
2470
  * lists the feed instead. A plugin that lists feeds declares ^0.40.0.
2471
+ *
2472
+ * 0.41.0 adds app.mcp.callTool for background calls to a plugin's own manifest-declared MCP
2473
+ * servers, using Bonsai's managed connection without a session or working directory (#16172).
2471
2474
  */
2472
- declare const KAY_PLUGIN_SDK_VERSION: "0.40.0";
2475
+ declare const KAY_PLUGIN_SDK_VERSION: "0.41.0";
2473
2476
 
2474
2477
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2475
2478
 
@@ -2743,8 +2743,11 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2743
2743
  * feed may now declare a `store`. It removes the `cost.read`, `skills.read`, `memory.read` and
2744
2744
  * `self-improvement.read` host capabilities, so a manifest still listing one no longer parses and
2745
2745
  * lists the feed instead. A plugin that lists feeds declares ^0.40.0.
2746
+ *
2747
+ * 0.41.0 adds app.mcp.callTool for background calls to a plugin's own manifest-declared MCP
2748
+ * servers, using Bonsai's managed connection without a session or working directory (#16172).
2746
2749
  */
2747
- declare const KAY_PLUGIN_SDK_VERSION: "0.40.0";
2750
+ declare const KAY_PLUGIN_SDK_VERSION: "0.41.0";
2748
2751
 
2749
2752
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2750
2753
 
package/dist/kay-app.d.ts CHANGED
@@ -2719,8 +2719,11 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2719
2719
  * feed may now declare a `store`. It removes the `cost.read`, `skills.read`, `memory.read` and
2720
2720
  * `self-improvement.read` host capabilities, so a manifest still listing one no longer parses and
2721
2721
  * lists the feed instead. A plugin that lists feeds declares ^0.40.0.
2722
+ *
2723
+ * 0.41.0 adds app.mcp.callTool for background calls to a plugin's own manifest-declared MCP
2724
+ * servers, using Bonsai's managed connection without a session or working directory (#16172).
2722
2725
  */
2723
- declare const KAY_PLUGIN_SDK_VERSION: "0.40.0";
2726
+ declare const KAY_PLUGIN_SDK_VERSION: "0.41.0";
2724
2727
 
2725
2728
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2726
2729
 
@@ -4615,6 +4618,21 @@ export declare interface KayAppMarketplaceContributors {
4615
4618
  };
4616
4619
  }
4617
4620
 
4621
+ /** Calls tools on this plugin's manifest-declared MCP servers through Bonsai's managed connection. */
4622
+ export declare interface KayAppMcp {
4623
+ /**
4624
+ * Uses the current app-wide server set, without a session or working directory.
4625
+ * Refuses undeclared or no-longer-hosted servers. Sign-in and tool failures return typed outcomes;
4626
+ * credentials remain with the host. Like the agent-side vendored MCP API, calls can read or write
4627
+ * and do not use the agent's per-tool approval path.
4628
+ */
4629
+ callTool(input: {
4630
+ readonly server: string;
4631
+ readonly tool: string;
4632
+ readonly args: Readonly<Record<string, unknown>>;
4633
+ }): Promise<VendoredMcpOutcome>;
4634
+ }
4635
+
4618
4636
  /**
4619
4637
  * Notes through Memory's ordinary notebook operations, without a chat session. Each call checks
4620
4638
  * `memory.read` or `memory.write`; a missing notebook or refused grant rejects. Paths are note
@@ -5087,6 +5105,7 @@ export declare interface KayAppPhaseShiftSessionEvent extends KayAppSessionEvent
5087
5105
  * physical sandbox against ambient Node imports.
5088
5106
  */
5089
5107
  export declare interface KayAppPluginApi {
5108
+ readonly mcp: KayAppMcp;
5090
5109
  /** This plugin's canonical id (already validated by the host registry). */
5091
5110
  readonly id: string;
5092
5111
  /** Register app-lifetime cleanup for plugin-owned processes, sockets, watchers, or timers. */
@@ -16731,6 +16750,52 @@ declare type UserShellCommandMessage = CustomMessage<UserShellCommandDetails> &
16731
16750
  readonly display: true;
16732
16751
  };
16733
16752
 
16753
+ /**
16754
+ * ---
16755
+ * responsibility: The one interface through which a vendored-MCP plugin's code calls a tool on its
16756
+ * own vendored MCP server, so every read-through plugin and the daemon that implements the port
16757
+ * agree on the same shape by construction.
16758
+ * owns:
16759
+ * - {@link VendoredMcpPort} - what a plugin's URI module and tools call.
16760
+ * - {@link VendoredMcpOutcome} - the typed result a plugin decodes, including every failure it
16761
+ * must surface to the agent rather than swallow.
16762
+ * does_not_own:
16763
+ * - The implementation. A plugin never dials MCP itself: it takes the port from
16764
+ * `api.vendoredMcp.port(server)` (`@bonsai/plugin-sdk/kay-agent`), which the daemon binds to the
16765
+ * plugin's own hosted server over its MCP host. Plugin source stays host-free, and a plugin
16766
+ * under test substitutes a fake port.
16767
+ * - Which tool names exist. `TTool` is the plugin's own union of the vendor tools it calls; the
16768
+ * port is generic so a typo in a tool name fails typecheck inside the plugin.
16769
+ * ---
16770
+ */
16771
+ /**
16772
+ * Why a call failed, as the plugin must tell the agent. `needs-auth` carries the exact service to
16773
+ * reconnect (`serviceId`) so a plugin can name it in its error instead of returning an empty
16774
+ * result; today's plugins name their statically declared `requiresAuth` service instead, which is
16775
+ * the same service for a single-service plugin. `unknown-server` and `unknown-tool` are wiring
16776
+ * faults (a server Bonsai does not host for this plugin, or a tool name the server does not have)
16777
+ * and stay loud for the same reason: an unreachable host must never decode as "no data".
16778
+ */
16779
+ declare type VendoredMcpFailureReason = "needs-auth" | "unknown-server" | "unknown-tool" | "failed";
16780
+
16781
+ declare type VendoredMcpOutcome =
16782
+ /**
16783
+ * `value` is the tool's `structuredContent` when it sent one, else its text content parsed as
16784
+ * JSON, else that text as a string: a vendor tool that answers in prose (a transcript, a
16785
+ * markdown summary) is a result, not a failure. A route that needs a record rejects a string
16786
+ * itself, with its own message.
16787
+ */
16788
+ {
16789
+ readonly ok: true;
16790
+ readonly value: unknown;
16791
+ } | {
16792
+ readonly ok: false;
16793
+ readonly reason: VendoredMcpFailureReason;
16794
+ readonly message: string;
16795
+ /** Exact reconnect target supplied by the MCP host for an auth failure. */
16796
+ readonly serviceId?: string;
16797
+ };
16798
+
16734
16799
  /** Creates a Void type. */
16735
16800
  declare function Void(options?: TSchemaOptions): TVoid;
16736
16801
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
4
4
  "description": "The Kay plugin SDK — types and helpers for authoring a Kay directory plugin.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",