@yaklabs-ai/plugin-protocol 0.55.4 → 0.55.5

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
@@ -11,7 +11,7 @@ flow.
11
11
  ```json
12
12
  {
13
13
  "dependencies": {
14
- "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.55.4"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.55.5"
15
15
  }
16
16
  }
17
17
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-protocol",
4
- "version": "0.55.4",
4
+ "version": "0.55.5",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
package/dist/index.d.ts CHANGED
@@ -4138,6 +4138,9 @@ export declare function isKayPluginCompatibilityRefusal(code: string): code is K
4138
4138
  /** Whether `name` can name a declared event: the shape above, and not the journal's own family. */
4139
4139
  export declare function isPluginProductEventName(name: string): boolean;
4140
4140
 
4141
+ /** Whether a custom entry type is a plugin state entry's. */
4142
+ export declare function isPluginStateEntryCustomType(customType: string): boolean;
4143
+
4141
4144
  /** Whether only plugins the release carries may hold `claim` ({@link PRIVATE_PLUGIN_CAPABILITY_SLUGS}). */
4142
4145
  export declare function isPrivateCapabilityClaim(claim: PluginCapabilityClaimV1): boolean;
4143
4146
 
@@ -4968,8 +4971,14 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
4968
4971
  * of the installed, enabled plugins, with the plugin's id and display name and whether the person
4969
4972
  * has connected it. No account, identity or scope. Built-ins hold the claim; any other plugin needs
4970
4973
  * a grant. Additive; plugins calling it declare ^0.55.4.
4974
+ *
4975
+ * 0.55.5 adds `app.sessions.readState()` and `writeState()` under the new `sessions.state` claim:
4976
+ * a plugin keeps its own state entries in a session's transcript, stored as `plugin-state:<pluginId>:<name>`,
4977
+ * and each write names the newest entry it was computed from, so a write from a stale base is
4978
+ * answered with the newest one instead of landing (compaction plan, phase 2). Additive; plugins
4979
+ * calling them declare ^0.55.5.
4971
4980
  */
4972
- export declare const KAY_PLUGIN_SDK_VERSION: "0.55.4";
4981
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.55.5";
4973
4982
 
4974
4983
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
4975
4984
 
@@ -8791,7 +8800,7 @@ export declare function parseSemver(value: string): ParsedSemver | undefined;
8791
8800
  export declare function parseWhere(source: string, keyTypes?: WhereKeyTypes): WhereParseResult;
8792
8801
 
8793
8802
  /** Every capability slug {@link PluginCapabilityClaimV1} can express, for exhaustive table checks. */
8794
- export declare const PLUGIN_CAPABILITY_SLUGS: readonly ["sessions.run", "network.connect", "web-session.request", "web-session.download", "process.spawn", "sessions.read", "signals.read", "uri.call", "endpoints.invoke", "skills.read", "skills.write", "skills.share", "plugins.set-enabled", "plugins.read", "sessions.assign-project", "artifacts.resolve-file", "process.run", "sessions.annotate", "sessions.compact", "soul.write", "tools.describe", "workspace.command", "sessions.create", "sessions.update", "models.complete", "systemOne.use", "automations.write", "automations.run", "workflows.define", "workflows.signals", "session-events.subscribe", "agents.run", "dynamic-context.register", "app-data.register", "app-data.read", "knowledge-source.register", "artifacts.read", "session-artifacts.read", "session-artifacts.create", "account.assert", "account.update", "agents.permissions", "tool-interception.register", "interaction.surface", "config.declare-section", "auth.own-service", "auth.shared-identity", "cli.bind", "mcp.host-server", "prompt.resident", "skills.declared-source", "family-folder.root", "whiteboard.discover", "whiteboard.read", "whiteboard.create", "whiteboard.update", "whiteboard.remove", "model-selection.register", "system-prompt.register"];
8803
+ export declare const PLUGIN_CAPABILITY_SLUGS: readonly ["sessions.run", "network.connect", "web-session.request", "web-session.download", "process.spawn", "sessions.read", "signals.read", "uri.call", "endpoints.invoke", "skills.read", "skills.write", "skills.share", "plugins.set-enabled", "plugins.read", "sessions.assign-project", "artifacts.resolve-file", "process.run", "sessions.annotate", "sessions.compact", "sessions.state", "soul.write", "tools.describe", "workspace.command", "sessions.create", "sessions.update", "models.complete", "systemOne.use", "automations.write", "automations.run", "workflows.define", "workflows.signals", "session-events.subscribe", "agents.run", "dynamic-context.register", "app-data.register", "app-data.read", "knowledge-source.register", "artifacts.read", "session-artifacts.read", "session-artifacts.create", "account.assert", "account.update", "agents.permissions", "tool-interception.register", "interaction.surface", "config.declare-section", "auth.own-service", "auth.shared-identity", "cli.bind", "mcp.host-server", "prompt.resident", "skills.declared-source", "family-folder.root", "whiteboard.discover", "whiteboard.read", "whiteboard.create", "whiteboard.update", "whiteboard.remove", "model-selection.register", "system-prompt.register"];
8795
8804
 
8796
8805
  /** Diagnostic messages carry plugin-controlled text (parse errors, module errors); bound it so a
8797
8806
  * hostile or accidental multi-megabyte error can never blow up a log line or a render surface. */
@@ -8846,6 +8855,25 @@ export declare const PLUGIN_SIGNAL_SNIPPET_MAX = 500;
8846
8855
 
8847
8856
  export declare const PLUGIN_SIGNAL_TITLE_MAX = 300;
8848
8857
 
8858
+ /**
8859
+ * The most one entry may hold, as serialized UTF-8 JSON: 256 KiB, a quarter of what one
8860
+ * `session/readCustomEntries` read returns, so the newest entry is always read back whole.
8861
+ */
8862
+ export declare const PLUGIN_STATE_ENTRY_MAX_BYTES: number;
8863
+
8864
+ /** The deepest nesting of arrays and objects one entry may hold. */
8865
+ export declare const PLUGIN_STATE_ENTRY_MAX_DEPTH = 64;
8866
+
8867
+ /** A plugin's own entry name: a local contribution id (lowercase letters, digits, dashes), at most 64 characters. */
8868
+ export declare const PLUGIN_STATE_ENTRY_NAME_PATTERN: RegExp;
8869
+
8870
+ /**
8871
+ * The prefix of every plugin state entry's custom type. Its own namespace, apart from herd's
8872
+ * `ext:<extensionId>:` for an extension's own entries, so the host can tell a plugin's state
8873
+ * from every other entry: it is no activity, and a snapshot carries only its newest entry.
8874
+ */
8875
+ export declare const PLUGIN_STATE_ENTRY_TYPE_PREFIX = "plugin-state:";
8876
+
8849
8877
  export declare const PluginAgentDefinitionPermissionRule: z.ZodObject<{
8850
8878
  effect: z.ZodEnum<{
8851
8879
  allow: "allow";
@@ -9529,6 +9557,10 @@ export declare const PluginCapabilityClaimInputV1: z.ZodCustom<{
9529
9557
  target: "kay.app";
9530
9558
  slug: "sessions.compact";
9531
9559
  envelope: Record<string, never>;
9560
+ } | {
9561
+ target: "kay.app";
9562
+ slug: "sessions.state";
9563
+ envelope: Record<string, never>;
9532
9564
  } | {
9533
9565
  target: "kay.app";
9534
9566
  slug: "soul.write";
@@ -9823,6 +9855,10 @@ export declare const PluginCapabilityClaimInputV1: z.ZodCustom<{
9823
9855
  target: "kay.app";
9824
9856
  slug: "sessions.compact";
9825
9857
  envelope: Record<string, never>;
9858
+ } | {
9859
+ target: "kay.app";
9860
+ slug: "sessions.state";
9861
+ envelope: Record<string, never>;
9826
9862
  } | {
9827
9863
  target: "kay.app";
9828
9864
  slug: "soul.write";
@@ -10127,6 +10163,10 @@ export declare const PluginCapabilityClaimV1: z.ZodDiscriminatedUnion<[z.ZodObje
10127
10163
  target: z.ZodLiteral<"kay.app">;
10128
10164
  slug: z.ZodLiteral<"sessions.compact">;
10129
10165
  envelope: z.ZodObject<{}, z.core.$strict>;
10166
+ }, z.core.$strict>, z.ZodObject<{
10167
+ target: z.ZodLiteral<"kay.app">;
10168
+ slug: z.ZodLiteral<"sessions.state">;
10169
+ envelope: z.ZodObject<{}, z.core.$strict>;
10130
10170
  }, z.core.$strict>, z.ZodObject<{
10131
10171
  target: z.ZodLiteral<"kay.app">;
10132
10172
  slug: z.ZodLiteral<"soul.write">;
@@ -10477,6 +10517,10 @@ export declare const PluginCapabilityDecisionV1: z.ZodDiscriminatedUnion<[z.ZodO
10477
10517
  target: z.ZodLiteral<"kay.app">;
10478
10518
  slug: z.ZodLiteral<"sessions.compact">;
10479
10519
  envelope: z.ZodObject<{}, z.core.$strict>;
10520
+ }, z.core.$strict>, z.ZodObject<{
10521
+ target: z.ZodLiteral<"kay.app">;
10522
+ slug: z.ZodLiteral<"sessions.state">;
10523
+ envelope: z.ZodObject<{}, z.core.$strict>;
10480
10524
  }, z.core.$strict>, z.ZodObject<{
10481
10525
  target: z.ZodLiteral<"kay.app">;
10482
10526
  slug: z.ZodLiteral<"soul.write">;
@@ -10826,6 +10870,10 @@ export declare const PluginCapabilityDecisionV1: z.ZodDiscriminatedUnion<[z.ZodO
10826
10870
  target: z.ZodLiteral<"kay.app">;
10827
10871
  slug: z.ZodLiteral<"sessions.compact">;
10828
10872
  envelope: z.ZodObject<{}, z.core.$strict>;
10873
+ }, z.core.$strict>, z.ZodObject<{
10874
+ target: z.ZodLiteral<"kay.app">;
10875
+ slug: z.ZodLiteral<"sessions.state">;
10876
+ envelope: z.ZodObject<{}, z.core.$strict>;
10829
10877
  }, z.core.$strict>, z.ZodObject<{
10830
10878
  target: z.ZodLiteral<"kay.app">;
10831
10879
  slug: z.ZodLiteral<"soul.write">;
@@ -11209,6 +11257,10 @@ export declare const PluginCapabilityRefusalV1: z.ZodObject<{
11209
11257
  target: z.ZodLiteral<"kay.app">;
11210
11258
  slug: z.ZodLiteral<"sessions.compact">;
11211
11259
  envelope: z.ZodObject<{}, z.core.$strict>;
11260
+ }, z.core.$strict>, z.ZodObject<{
11261
+ target: z.ZodLiteral<"kay.app">;
11262
+ slug: z.ZodLiteral<"sessions.state">;
11263
+ envelope: z.ZodObject<{}, z.core.$strict>;
11212
11264
  }, z.core.$strict>, z.ZodObject<{
11213
11265
  target: z.ZodLiteral<"kay.app">;
11214
11266
  slug: z.ZodLiteral<"soul.write">;
@@ -12695,6 +12747,14 @@ export declare const PluginSourceClass: z.ZodEnum<{
12695
12747
 
12696
12748
  export declare type PluginSourceClass = z.infer<typeof PluginSourceClass>;
12697
12749
 
12750
+ /**
12751
+ * The custom entry type a plugin's entry `name` is stored under: `plugin-state:<pluginId>:<name>`.
12752
+ * A plugin id holds no `:`, and the name grammar holds no `.`, `:` or `_`, so no kernel or daemon
12753
+ * type (`herd.permission_rules`, `session_steward`, ...) and no other plugin's entry can be
12754
+ * reached. Returns `undefined` for a name outside the grammar.
12755
+ */
12756
+ export declare function pluginStateEntryCustomType(pluginId: string, name: string): string | undefined;
12757
+
12698
12758
  export declare const PluginStorageManifest: z.ZodObject<{
12699
12759
  sqlite: z.ZodOptional<z.ZodObject<{
12700
12760
  enabled: z.ZodBoolean;
package/dist/index.js CHANGED
@@ -260,8 +260,9 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
260
260
  var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
261
261
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
262
262
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
263
- var KAY_PLUGIN_SDK_VERSION = "0.55.4";
263
+ var KAY_PLUGIN_SDK_VERSION = "0.55.5";
264
264
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
265
+ "0.55.4",
265
266
  "0.55.3",
266
267
  "0.55.2",
267
268
  "0.55.1",
@@ -1815,6 +1816,7 @@ var PLUGIN_CAPABILITY_SLUGS = [
1815
1816
  "process.run",
1816
1817
  "sessions.annotate",
1817
1818
  "sessions.compact",
1819
+ "sessions.state",
1818
1820
  "soul.write",
1819
1821
  "tools.describe",
1820
1822
  "workspace.command",
@@ -2063,6 +2065,15 @@ function createAuthoritySchemas(canonical) {
2063
2065
  slug: z11.literal("sessions.compact"),
2064
2066
  envelope: z11.strictObject({})
2065
2067
  }),
2068
+ z11.strictObject({
2069
+ // Read and write this plugin's own state entries in a session's transcript
2070
+ // (`app.sessions.readState` / `writeState`): custom entries stored under the plugin's own
2071
+ // id, each write checked against the newest one. A write is bound like `sessions.annotate`
2072
+ // to the session whose event the calling handler is answering; a read is not bound.
2073
+ target: z11.literal("kay.app"),
2074
+ slug: z11.literal("sessions.state"),
2075
+ envelope: z11.strictObject({})
2076
+ }),
2066
2077
  z11.strictObject({
2067
2078
  // Read and rewrite the soul file every new conversation is told. Private
2068
2079
  // (PRIVATE_PLUGIN_CAPABILITY_SLUGS): only a plugin the release carries may hold it.
@@ -2382,6 +2393,7 @@ function sameClaim(a, b) {
2382
2393
  case "process.run":
2383
2394
  case "sessions.annotate":
2384
2395
  case "sessions.compact":
2396
+ case "sessions.state":
2385
2397
  case "soul.write":
2386
2398
  case "tools.describe":
2387
2399
  case "workspace.command":
@@ -2478,6 +2490,7 @@ function envelopePairs(a, b) {
2478
2490
  case "process.run":
2479
2491
  case "sessions.annotate":
2480
2492
  case "sessions.compact":
2493
+ case "sessions.state":
2481
2494
  case "soul.write":
2482
2495
  case "tools.describe":
2483
2496
  case "workspace.command":
@@ -8073,6 +8086,18 @@ function sessionHealthPWellDecile(pWell) {
8073
8086
  return Math.min(9, Math.floor(pWell * 10));
8074
8087
  }
8075
8088
 
8089
+ // packages/plugin-protocol/dist/session-state.js
8090
+ var PLUGIN_STATE_ENTRY_NAME_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
8091
+ var PLUGIN_STATE_ENTRY_MAX_BYTES = 256 * 1024;
8092
+ var PLUGIN_STATE_ENTRY_MAX_DEPTH = 64;
8093
+ var PLUGIN_STATE_ENTRY_TYPE_PREFIX = "plugin-state:";
8094
+ function pluginStateEntryCustomType(pluginId, name) {
8095
+ return PLUGIN_STATE_ENTRY_NAME_PATTERN.test(name) ? `${PLUGIN_STATE_ENTRY_TYPE_PREFIX}${pluginId}:${name}` : void 0;
8096
+ }
8097
+ function isPluginStateEntryCustomType(customType) {
8098
+ return customType.startsWith(PLUGIN_STATE_ENTRY_TYPE_PREFIX);
8099
+ }
8100
+
8076
8101
  // packages/plugin-protocol/dist/resource-invocations.js
8077
8102
  import { z as z23 } from "zod";
8078
8103
 
@@ -8638,6 +8663,10 @@ export {
8638
8663
  PLUGIN_SIGNAL_RELATED_KEYS,
8639
8664
  PLUGIN_SIGNAL_SNIPPET_MAX,
8640
8665
  PLUGIN_SIGNAL_TITLE_MAX,
8666
+ PLUGIN_STATE_ENTRY_MAX_BYTES,
8667
+ PLUGIN_STATE_ENTRY_MAX_DEPTH,
8668
+ PLUGIN_STATE_ENTRY_NAME_PATTERN,
8669
+ PLUGIN_STATE_ENTRY_TYPE_PREFIX,
8641
8670
  PRIVATE_PLUGIN_CAPABILITY_SLUGS,
8642
8671
  PackageAssetPath,
8643
8672
  PluginAgentDefinitionPermissionRule,
@@ -8830,6 +8859,7 @@ export {
8830
8859
  isDeclaredLocalAppLink,
8831
8860
  isKayPluginCompatibilityRefusal,
8832
8861
  isPluginProductEventName,
8862
+ isPluginStateEntryCustomType,
8833
8863
  isPrivateCapabilityClaim,
8834
8864
  isQualifiedAuthSchemeRef,
8835
8865
  isQualifiedAuthServiceRef,
@@ -8854,6 +8884,7 @@ export {
8854
8884
  parseWhere,
8855
8885
  pluginIconShape,
8856
8886
  pluginSignalPayloadJsonSchema,
8887
+ pluginStateEntryCustomType,
8857
8888
  precedingPersonMessages,
8858
8889
  readKayPluginDeclaredCompatibility,
8859
8890
  refineWebSessionScopeConfined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.55.4",
3
+ "version": "0.55.5",
4
4
  "description": "The Kay plugin manifest schema (`kay.plugin.v1`) — parse and validate a kay-plugin.json.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",