@yaklabs-ai/plugin-protocol 0.13.4 → 0.13.6

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.13.4"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.13.6"
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.13.4",
4
+ "version": "0.13.6",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -263,6 +263,7 @@ export declare const ArtifactProvenanceCaptureContextSchema: z.ZodObject<{
263
263
  "turn-settled": "turn-settled";
264
264
  "phase-shift": "phase-shift";
265
265
  "human-message": "human-message";
266
+ "assistant-message": "assistant-message";
266
267
  "ui-action": "ui-action";
267
268
  }>;
268
269
  entryId: z.ZodString;
@@ -356,6 +357,7 @@ export declare const ArtifactProvenanceCaptureContextSchema: z.ZodObject<{
356
357
  "turn-settled": "turn-settled";
357
358
  "phase-shift": "phase-shift";
358
359
  "human-message": "human-message";
360
+ "assistant-message": "assistant-message";
359
361
  "ui-action": "ui-action";
360
362
  }>;
361
363
  entryId: z.ZodString;
@@ -453,6 +455,7 @@ export declare const ArtifactProvenanceCause: z.ZodDiscriminatedUnion<[z.ZodObje
453
455
  "turn-settled": "turn-settled";
454
456
  "phase-shift": "phase-shift";
455
457
  "human-message": "human-message";
458
+ "assistant-message": "assistant-message";
456
459
  "ui-action": "ui-action";
457
460
  }>;
458
461
  entryId: z.ZodString;
@@ -531,6 +534,7 @@ export declare const ArtifactProvenanceEnvelopeV1: z.ZodPipe<z.ZodUnknown, z.Zod
531
534
  "turn-settled": "turn-settled";
532
535
  "phase-shift": "phase-shift";
533
536
  "human-message": "human-message";
537
+ "assistant-message": "assistant-message";
534
538
  "ui-action": "ui-action";
535
539
  }>;
536
540
  entryId: z.ZodString;
@@ -623,6 +627,7 @@ export declare const ArtifactProvenanceEnvelopeV1: z.ZodPipe<z.ZodUnknown, z.Zod
623
627
  "turn-settled": "turn-settled";
624
628
  "phase-shift": "phase-shift";
625
629
  "human-message": "human-message";
630
+ "assistant-message": "assistant-message";
626
631
  "ui-action": "ui-action";
627
632
  }>;
628
633
  entryId: z.ZodString;
@@ -740,6 +745,7 @@ export declare const ArtifactProvenanceEnvelopeV1: z.ZodPipe<z.ZodUnknown, z.Zod
740
745
  "turn-settled": "turn-settled";
741
746
  "phase-shift": "phase-shift";
742
747
  "human-message": "human-message";
748
+ "assistant-message": "assistant-message";
743
749
  "ui-action": "ui-action";
744
750
  }>;
745
751
  entryId: z.ZodString;
@@ -912,6 +918,7 @@ export declare const ArtifactProvenanceMutation: z.ZodObject<{
912
918
  "turn-settled": "turn-settled";
913
919
  "phase-shift": "phase-shift";
914
920
  "human-message": "human-message";
921
+ "assistant-message": "assistant-message";
915
922
  "ui-action": "ui-action";
916
923
  }>;
917
924
  entryId: z.ZodString;
@@ -1008,6 +1015,7 @@ export declare const ArtifactProvenanceOperation: z.ZodObject<{
1008
1015
  "turn-settled": "turn-settled";
1009
1016
  "phase-shift": "phase-shift";
1010
1017
  "human-message": "human-message";
1018
+ "assistant-message": "assistant-message";
1011
1019
  "ui-action": "ui-action";
1012
1020
  }>;
1013
1021
  entryId: z.ZodString;
@@ -1149,6 +1157,7 @@ export declare const ArtifactProvenanceSession: z.ZodObject<{
1149
1157
  "turn-settled": "turn-settled";
1150
1158
  "phase-shift": "phase-shift";
1151
1159
  "human-message": "human-message";
1160
+ "assistant-message": "assistant-message";
1152
1161
  "ui-action": "ui-action";
1153
1162
  }>;
1154
1163
  entryId: z.ZodString;
@@ -1322,6 +1331,9 @@ export declare const AuthServiceReference: z.ZodString;
1322
1331
 
1323
1332
  export declare type AuthServiceReference = z.infer<typeof AuthServiceReference>;
1324
1333
 
1334
+ /** Cap a plugin-controlled message at {@link PLUGIN_DIAGNOSTIC_MESSAGE_CAP} characters. */
1335
+ export declare function boundPluginDiagnosticMessage(message: string): string;
1336
+
1325
1337
  /**
1326
1338
  * {@link mintOperation} and {@link resolveSessionAncestry}, composed into one capture.
1327
1339
  *
@@ -1368,7 +1380,7 @@ export declare function captureFailedContext(input: {
1368
1380
  readonly detail: string;
1369
1381
  }, clock?: CaptureClock): ArtifactProvenanceCaptureContext;
1370
1382
 
1371
- export declare function checkKayPluginHostCompatibility(compatibility: PluginCompatibilityManifest | undefined, host: KayPluginHostCompatibility): KayPluginCompatibilityReport;
1383
+ export declare function checkKayPluginHostCompatibility(compatibility: DeclaredKayPluginCompatibility | undefined, host: KayPluginHostCompatibility): KayPluginCompatibilityReport;
1372
1384
 
1373
1385
  /**
1374
1386
  * The env var name a `cliBindings` contribution injects a resolved credential
@@ -1682,9 +1694,35 @@ export declare const CorpusResourceKind: z.ZodEnum<{
1682
1694
 
1683
1695
  export declare type CorpusResourceKind = z.infer<typeof CorpusResourceKind>;
1684
1696
 
1697
+ /**
1698
+ * The `compatibility` block as the check reads it. Structural rather than the parsed
1699
+ * `PluginCompatibilityManifest`, so a host can judge the block of a manifest whose other fields
1700
+ * this build's strict schema would refuse (`judgeKayPluginDirectory` does, before the parse).
1701
+ */
1702
+ export declare interface DeclaredKayPluginCompatibility {
1703
+ readonly supportedProtocols?: readonly string[] | undefined;
1704
+ readonly minKayVersion?: string | undefined;
1705
+ readonly sdk?: string | undefined;
1706
+ }
1707
+
1685
1708
  /** Drop repeats under {@link sameClaim}, preserving first-seen order (a sort settles the rest). */
1686
1709
  export declare function dedupeClaims(claims: readonly PluginCapabilityClaimV1[]): PluginCapabilityClaimV1[];
1687
1710
 
1711
+ /**
1712
+ * The one `toolName` a directory plugin may declare for the tool `localId`: every `.` in
1713
+ * `namespace` becomes `_`, then one more `_` joins `localId`. The directory verdict drops a tool
1714
+ * that declares anything else. Bundled plugins are not held to it.
1715
+ *
1716
+ * Injective over every schema-valid pair, so two directory plugins can only derive the same tool
1717
+ * name by sharing both namespace and localId. Neither input can contain `_` (`PLUGIN_ID_PATTERN`
1718
+ * and `LOCAL_CONTRIBUTION_ID_PATTERN` exclude it), so every `_` in the output was inserted here,
1719
+ * and splitting on `_` recovers the namespace's segments and then `localId` (which has no `.`).
1720
+ *
1721
+ * A `-` is deliberately left alone: mapping it to `_` too would send `("a", "b-c")` and
1722
+ * `("a-b", "c")` to the same `a_b_c`. The tool-name alphabet admits `-` for that reason (#4341).
1723
+ */
1724
+ export declare function deriveDirectoryPluginToolName(namespace: string, localId: string): string;
1725
+
1688
1726
  export declare const DeviceDelegationContribution: z.ZodObject<{
1689
1727
  localId: z.ZodString;
1690
1728
  device: z.ZodEnum<{
@@ -1952,6 +1990,26 @@ export declare type JsonValue = string | number | boolean | null | JsonValue[] |
1952
1990
 
1953
1991
  export declare const JsonValue: z.ZodType<JsonValue>;
1954
1992
 
1993
+ /** Judge one plugin directory. Never throws for a bad plugin: every finding is a diagnostic. */
1994
+ export declare function judgeKayPluginDirectory(input: JudgeKayPluginDirectoryInput): Promise<KayPluginDirectoryVerdict>;
1995
+
1996
+ export declare interface JudgeKayPluginDirectoryInput {
1997
+ readonly tree: KayPluginTreeReader;
1998
+ /** The root the directory was found under, and the directory's name there: diagnostic provenance. */
1999
+ readonly root: string;
2000
+ readonly dir: string;
2001
+ /**
2002
+ * The host to judge `compatibility` against. `undefined` skips that step: a host that cannot
2003
+ * state its own version has no evidence a plugin is incompatible.
2004
+ */
2005
+ readonly host: KayPluginHostCompatibility | undefined;
2006
+ /**
2007
+ * Set when the caller already knows this directory is a commit of a plugin, so a missing
2008
+ * manifest is a refusal naming that commit rather than "not a plugin".
2009
+ */
2010
+ readonly revision?: string | undefined;
2011
+ }
2012
+
1955
2013
  /** Maximum UTF-8 JSON size of one plugin app-data live change. */
1956
2014
  export declare const KAY_APP_DATA_CHANGE_MAX_BYTES: number;
1957
2015
 
@@ -1973,7 +2031,13 @@ export declare const KAY_APP_DATA_SNAPSHOT_MAX_BYTES: number;
1973
2031
  export declare const KAY_EVENT_PUBLISHER_ID: "kay";
1974
2032
 
1975
2033
  /** Released SDK contracts still implemented by the host, alongside its current SDK. */
1976
- export declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly ["0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.10.0", "0.11.0", "0.11.1", "0.12.0", "0.12.1", "0.12.2", "0.12.3", "0.12.4", "0.12.5", "0.13.0", "0.13.1", "0.13.2", "0.13.3"];
2034
+ export declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly ["0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.10.0", "0.11.0", "0.11.1", "0.12.0", "0.12.1", "0.12.2", "0.12.3", "0.12.4", "0.12.5", "0.13.0", "0.13.1", "0.13.2", "0.13.3", "0.13.4", "0.13.5"];
2035
+
2036
+ /** The file whose presence makes a directory a plugin. A directory without one is not a plugin. */
2037
+ export declare const KAY_PLUGIN_MANIFEST_FILENAME = "kay-plugin.json";
2038
+
2039
+ /** Manifest byte cap: a larger file is refused unread. */
2040
+ export declare const KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES: number;
1977
2041
 
1978
2042
  export declare const KAY_PLUGIN_PROTOCOL_PACKAGE_NAME: "@bonsai/plugin-protocol";
1979
2043
 
@@ -2229,8 +2293,29 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2229
2293
  * in one call, and such a plugin reads in bounded chunks (a file handle's `read`,
2230
2294
  * `createReadStream`, `readLines`), which work on every 0.13 host. File calls sent to a host worker
2231
2295
  * that fail are also logged to the daemon log as `runtime.user-files.*` events.
2296
+ *
2297
+ * 0.13.5 loads a `kay.agent` or `kay.app` entrypoint's default export when the manifest's
2298
+ * `entrypoint.export` names none, the way Pi writes extensions; a module with no default export
2299
+ * still loads from a named `activate`. A plugin whose entrypoint has only a default
2300
+ * export declares `^0.13.5`, so an older host, which reads only `activate`, refuses it at load
2301
+ * instead of failing to find the export. It also renamed three published types with no aliases,
2302
+ * a break in the authoring types that shipped in this patch: `kay-app`'s `SessionTreeEntry`
2303
+ * became `TranscriptEntry`, and `transcript`'s `TranscriptEntry` and `TranscriptSourceEntry`
2304
+ * became `TranscriptEntryLike` and `TranscriptSourceEntryLike`.
2305
+ *
2306
+ * 0.13.6 publishes the pure contracts Bonsai's own plugins took from its internal libraries, so a
2307
+ * plugin needs less beside the SDK. A new `@bonsai/plugin-sdk/time` carries `Temporal` (the
2308
+ * host's own instance, like `z`), `canonicalZone`, `isValidZone` and `sameZone`, and the time
2309
+ * door's types. `kay-app` adds
2310
+ * the `JsonSchema` and `JsonValue` schemas, `PluginAgentDefinitionPermissionRule`,
2311
+ * `KAY_APP_DATA_SNAPSHOT_MAX_BYTES`, and the URI types `UriHelp`, `RawResource`, `UriPayload`,
2312
+ * `UriListParams`, `UriListResult`, `UriSearchParams` and `UriSearchResult`. `kay-agent` adds
2313
+ * `compileUriClaim`, `kay-agent/testing` adds `createTestClock`, and `transcript` adds the turn walk
2314
+ * (`turnSegments`), the run records and the work-block and work-headline helpers. Additive: a
2315
+ * plugin compiled against 0.13.5 never imports them. A plugin that imports one declares `^0.13.6`,
2316
+ * so an older host refuses a directory or repository plugin at load instead of the import failing.
2232
2317
  */
2233
- export declare const KAY_PLUGIN_SDK_VERSION: "0.13.4";
2318
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.13.6";
2234
2319
 
2235
2320
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2236
2321
 
@@ -2354,6 +2439,7 @@ export declare const KayAgentTargetManifest: z.ZodObject<{
2354
2439
  }, z.core.$strict>>>;
2355
2440
  }, z.core.$strict>>;
2356
2441
  primer: z.ZodOptional<z.ZodString>;
2442
+ onboarding: z.ZodOptional<z.ZodString>;
2357
2443
  prompt: z.ZodOptional<z.ZodString>;
2358
2444
  skillSources: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2359
2445
  channel: z.ZodLiteral<"installer">;
@@ -2519,6 +2605,23 @@ export declare type KayAppTargetManifest = z.infer<typeof KayAppTargetManifest>;
2519
2605
 
2520
2606
  declare type KayAppWhiteboardCapabilityOperation = Extract<WhiteboardCapabilityOperation, "discover" | "read">;
2521
2607
 
2608
+ /**
2609
+ * What is worth saying about a LOADING plugin's compatibility block (an undeclared SDK range, an
2610
+ * unmet `minKayVersion`), as `source-scan` diagnostics scoped to the root.
2611
+ *
2612
+ * Root-scoped on purpose: a diagnostic naming a `dir` renders as a plugin that failed to load,
2613
+ * and this plugin loaded. Without a `dir` the note rides its source's row as ordinary text.
2614
+ * Because nothing in it names the plugin's directory, a host that keeps only some of the plugins
2615
+ * it scanned must derive these for the plugins it keeps, after choosing them.
2616
+ */
2617
+ export declare function kayPluginCompatibilityAdvisories(input: {
2618
+ readonly manifest: Pick<KayPluginManifestV1, "id" | "displayName" | "compatibility">;
2619
+ readonly host: KayPluginHostCompatibility;
2620
+ readonly root: string;
2621
+ /** A plugin that ships inside Bonsai; see `KayPluginHostCompatibility.bundled`. */
2622
+ readonly bundled?: boolean;
2623
+ }): readonly PluginLoadDiagnostic[];
2624
+
2522
2625
  export declare type KayPluginCompatibilityAdvisoryCode = "sdk-range-undeclared" | "min-kay-version-unmet" | "min-kay-version-unparseable";
2523
2626
 
2524
2627
  export declare interface KayPluginCompatibilityNote<TCode extends string> {
@@ -2545,6 +2648,25 @@ export declare class KayPluginContractResolutionError extends Error {
2545
2648
  constructor(message: string);
2546
2649
  }
2547
2650
 
2651
+ export declare type KayPluginDirectoryVerdict = {
2652
+ /** The plugin SDK version the compatibility step judged against; `undefined` when it was skipped. */
2653
+ readonly hostSdkVersion: string | undefined;
2654
+ } & ({
2655
+ readonly outcome: "not-a-plugin";
2656
+ } | {
2657
+ readonly outcome: "refused";
2658
+ readonly refusal: PluginLoadDiagnostic;
2659
+ /** Notes raised before the refusal; the author still meets them once it is fixed. */
2660
+ readonly warnings: readonly PluginLoadDiagnostic[];
2661
+ } | {
2662
+ readonly outcome: "loads";
2663
+ readonly manifest: KayPluginManifestV1;
2664
+ readonly contract: ResolvedPluginContractV1;
2665
+ readonly warnings: readonly PluginLoadDiagnostic[];
2666
+ /** See {@link kayPluginCompatibilityAdvisories}. */
2667
+ readonly advisories: readonly PluginLoadDiagnostic[];
2668
+ });
2669
+
2548
2670
  /** The host facts a manifest's `compatibility` block is judged against. */
2549
2671
  export declare interface KayPluginHostCompatibility {
2550
2672
  /** The host's plugin protocol version, e.g. `KAY_PLUGIN_PROTOCOL_VERSION`. */
@@ -2568,6 +2690,9 @@ export declare interface KayPluginHostCompatibility {
2568
2690
  readonly bundled?: boolean | undefined;
2569
2691
  }
2570
2692
 
2693
+ /** The host facts of the build this package ships in, for a host whose app version is `appVersion`. */
2694
+ export declare function kayPluginHostCompatibility(appVersion: string): KayPluginHostCompatibility;
2695
+
2571
2696
  export declare const KayPluginManifestV1: z.ZodObject<{
2572
2697
  protocol: z.ZodLiteral<"kay.plugin.v1">;
2573
2698
  id: z.ZodString;
@@ -2694,6 +2819,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
2694
2819
  }, z.core.$strict>>>;
2695
2820
  }, z.core.$strict>>;
2696
2821
  primer: z.ZodOptional<z.ZodString>;
2822
+ onboarding: z.ZodOptional<z.ZodString>;
2697
2823
  prompt: z.ZodOptional<z.ZodString>;
2698
2824
  skillSources: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2699
2825
  channel: z.ZodLiteral<"installer">;
@@ -2996,8 +3122,8 @@ export declare const KayPluginManifestV1: z.ZodObject<{
2996
3122
  kind: z.ZodLiteral<"oauth2">;
2997
3123
  exchange: z.ZodLiteral<"pkce">;
2998
3124
  clientSuppliers: z.ZodArray<z.ZodEnum<{
2999
- kay: "kay";
3000
3125
  user: "user";
3126
+ kay: "kay";
3001
3127
  }>>;
3002
3128
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3003
3129
  displayName: z.ZodOptional<z.ZodString>;
@@ -3366,6 +3492,31 @@ export declare const KayPluginProtocolVersion: z.ZodLiteral<"kay.plugin.v1">;
3366
3492
 
3367
3493
  export declare type KayPluginProtocolVersion = z.infer<typeof KayPluginProtocolVersion>;
3368
3494
 
3495
+ /** What sits at a path in a plugin directory, without following a symlink at that path. */
3496
+ export declare interface KayPluginTreeEntry {
3497
+ readonly kind: "file" | "directory" | "other";
3498
+ readonly size: number;
3499
+ }
3500
+
3501
+ /**
3502
+ * Read access to one plugin directory. Every `path` is relative to the plugin directory: the
3503
+ * manifest's own filename, or a path as the manifest declares it.
3504
+ */
3505
+ export declare interface KayPluginTreeReader {
3506
+ /** What is at `path`, or `undefined` when nothing is. Any other failure throws. */
3507
+ entry(path: string): Promise<KayPluginTreeEntry | undefined>;
3508
+ /** `path`'s contents as UTF-8. Throws when it cannot be read. */
3509
+ readText(path: string): Promise<string>;
3510
+ /** The plugin directory's real location (every symlink resolved), or `undefined` when unresolvable. */
3511
+ realDirectory(): Promise<string | undefined>;
3512
+ /**
3513
+ * Whether `path`, with every symlink followed, lands inside `realDirectory`. A path that does not
3514
+ * exist is judged by its nearest existing ancestor, so a missing `../x` is still outside. Never
3515
+ * throws: a path that cannot be resolved is outside.
3516
+ */
3517
+ isInside(realDirectory: string, path: string): Promise<boolean>;
3518
+ }
3519
+
3369
3520
  export declare const KayUiAppHostCapability: z.ZodEnum<{
3370
3521
  "skills.read": "skills.read";
3371
3522
  "automations.run": "automations.run";
@@ -3759,6 +3910,10 @@ export declare function parseSemver(value: string): ParsedSemver | undefined;
3759
3910
  /** Every capability slug {@link PluginCapabilityClaimV1} can express, for exhaustive table checks. */
3760
3911
  export declare const PLUGIN_CAPABILITY_SLUGS: readonly ["sessions.run", "network.connect", "web-session.request", "web-session.download", "process.spawn", "corpus.read", "signals.read", "skills.read", "tools.describe", "workspace.command", "sessions.create", "sessions.update", "models.complete", "jev.use", "automations.write", "automations.run", "workflows.define", "session-events.subscribe", "agents.run", "dynamic-context.register", "app-data.register", "account.assert", "account.update", "agents.permissions", "tool-interception.register", "interaction.surface", "config.declare-section", "auth.own-service", "auth.shared-identity", "cli.bind", "whiteboard.discover", "whiteboard.read", "whiteboard.create", "whiteboard.update", "whiteboard.remove"];
3761
3912
 
3913
+ /** Diagnostic messages carry plugin-controlled text (parse errors, module errors); bound it so a
3914
+ * hostile or accidental multi-megabyte error can never blow up a log line or a render surface. */
3915
+ export declare const PLUGIN_DIAGNOSTIC_MESSAGE_CAP = 300;
3916
+
3762
3917
  /** The root `<svg>` attribute a tile icon declares itself with. */
3763
3918
  export declare const PLUGIN_ICON_SHAPE_ATTRIBUTE = "data-icon-shape";
3764
3919
 
@@ -3807,8 +3962,8 @@ export declare const PluginAuthManifest: z.ZodObject<{
3807
3962
  kind: z.ZodLiteral<"oauth2">;
3808
3963
  exchange: z.ZodLiteral<"pkce">;
3809
3964
  clientSuppliers: z.ZodArray<z.ZodEnum<{
3810
- kay: "kay";
3811
3965
  user: "user";
3966
+ kay: "kay";
3812
3967
  }>>;
3813
3968
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3814
3969
  displayName: z.ZodOptional<z.ZodString>;
@@ -3918,8 +4073,8 @@ export declare const PluginAuthScheme: z.ZodDiscriminatedUnion<[z.ZodDiscriminat
3918
4073
  kind: z.ZodLiteral<"oauth2">;
3919
4074
  exchange: z.ZodLiteral<"pkce">;
3920
4075
  clientSuppliers: z.ZodArray<z.ZodEnum<{
3921
- kay: "kay";
3922
4076
  user: "user";
4077
+ kay: "kay";
3923
4078
  }>>;
3924
4079
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3925
4080
  displayName: z.ZodOptional<z.ZodString>;
@@ -4009,8 +4164,8 @@ export declare const PluginAuthService: z.ZodObject<{
4009
4164
  kind: z.ZodLiteral<"oauth2">;
4010
4165
  exchange: z.ZodLiteral<"pkce">;
4011
4166
  clientSuppliers: z.ZodArray<z.ZodEnum<{
4012
- kay: "kay";
4013
4167
  user: "user";
4168
+ kay: "kay";
4014
4169
  }>>;
4015
4170
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
4016
4171
  displayName: z.ZodOptional<z.ZodString>;
@@ -5169,6 +5324,61 @@ export declare const PluginId: z.ZodString;
5169
5324
 
5170
5325
  export declare type PluginId = z.infer<typeof PluginId>;
5171
5326
 
5327
+ /**
5328
+ * Why a plugin, target, or contribution is not fully loaded. A closed discriminated union: adding a
5329
+ * failure mode means adding a `stage` member here, so no path can raise an unclassified diagnostic.
5330
+ * Stages run in order, earliest first: `source-scan`, `manifest-parse`, `contract-resolve`,
5331
+ * `target-load`, `cross-plugin`.
5332
+ *
5333
+ * Provenance is stage-dependent by construction. `source-scan`, `manifest-parse`, and
5334
+ * `contract-resolve` fire BEFORE a trustworthy plugin id exists, so they are located by
5335
+ * `{root, dir}` on disk (a `source-scan` failure of an unreadable ROOT has no `dir` yet). Once the
5336
+ * manifest's id is validated, `target-load` and `cross-plugin` carry the `pluginId` instead.
5337
+ */
5338
+ export declare type PluginLoadDiagnostic = (PluginLoadDiagnosticMessage & {
5339
+ readonly stage: "source-scan";
5340
+ /** The scanned root. Always present — a scan failure is always attributable to its root. */
5341
+ readonly root: string;
5342
+ /** The offending immediate subdirectory, when the failure is dir-scoped (oversize, unreadable
5343
+ * dir); absent for root-scoped failures (unreadable root, scan timeout). */
5344
+ readonly dir?: string;
5345
+ }) | (PluginLoadDiagnosticMessage & {
5346
+ readonly stage: "manifest-parse";
5347
+ readonly root: string;
5348
+ readonly dir: string;
5349
+ }) | (PluginLoadDiagnosticMessage & {
5350
+ readonly stage: "contract-resolve";
5351
+ readonly root: string;
5352
+ readonly dir: string;
5353
+ }) | (PluginLoadDiagnosticMessage & {
5354
+ readonly stage: "target-load";
5355
+ readonly pluginId: string;
5356
+ /** Which target failed to load — the cell whose runtime status flips to `failed`. */
5357
+ readonly target: PluginTargetName;
5358
+ /**
5359
+ * Where the failing target came from, when the source knew it. The kay.agent/kay.app
5360
+ * preparation step has the registration in hand, so it can name both the plugin AND the
5361
+ * directory — which is what lets an item yield survive the registration being REPLACED by
5362
+ * this diagnostic (a first enable of a plugin that throws at import).
5363
+ */
5364
+ readonly root?: string;
5365
+ readonly dir?: string;
5366
+ /** The unresolved SDK subpath, when the failure is a missing virtual-module subpath (contract
5367
+ * §"Module loading": name the subpath, never a bare `ERR_MODULE_NOT_FOUND`). */
5368
+ readonly subpath?: string;
5369
+ }) | (PluginLoadDiagnosticMessage & {
5370
+ readonly stage: "cross-plugin";
5371
+ readonly pluginId: string;
5372
+ });
5373
+
5374
+ /** The message payload every diagnostic carries regardless of stage. */
5375
+ declare interface PluginLoadDiagnosticMessage {
5376
+ /** A short, stable slug for the failure class (e.g. `"oversize-manifest"`, `"id-collision"`). */
5377
+ readonly code: string;
5378
+ /** Human-facing detail; length-bounded and escaped at its render surface, never trusted markup. */
5379
+ readonly message: string;
5380
+ }
5381
+
5172
5382
  export declare const PluginNamespace: z.ZodString;
5173
5383
 
5174
5384
  export declare type PluginNamespace = z.infer<typeof PluginNamespace>;
@@ -5211,8 +5421,8 @@ export declare type PluginNotificationRuleContribution = z.infer<typeof PluginNo
5211
5421
  * literal values are re-declared here, not aliased; a herd↔protocol parity test pins them equal.
5212
5422
  */
5213
5423
  export declare const PluginOAuthClientSupplier: z.ZodEnum<{
5214
- kay: "kay";
5215
5424
  user: "user";
5425
+ kay: "kay";
5216
5426
  }>;
5217
5427
 
5218
5428
  export declare type PluginOAuthClientSupplier = z.infer<typeof PluginOAuthClientSupplier>;
@@ -5799,6 +6009,15 @@ export declare const RegistrableDomain: z.ZodString;
5799
6009
 
5800
6010
  export declare type RegistrableDomain = z.infer<typeof RegistrableDomain>;
5801
6011
 
6012
+ /**
6013
+ * Id namespaces a directory plugin may never claim. `herd.` is the kernel's first-party namespace
6014
+ * (`HERD_RESERVED_ID_PREFIX`: the kernel's extension loader throws on it without a first-party
6015
+ * opt-in) and `kay.` is the product's bundled and app-extension namespace. Refusing them here keeps
6016
+ * a reserved id from reaching either kernel throw, which would abort a whole extension batch and
6017
+ * drop every sibling plugin with it.
6018
+ */
6019
+ export declare const RESERVED_DIRECTORY_PLUGIN_ID_PREFIXES: readonly ["herd.", "kay."];
6020
+
5802
6021
  /**
5803
6022
  * Resolves the runtime selection key for a provider-shaped contribution — the
5804
6023
  * value an *adapter binding* names to make one implementation live.
@@ -6127,8 +6346,8 @@ export declare type ResolvedKayUiAppEndpointCapability = z.infer<typeof Resolved
6127
6346
  export declare const ResolvedPluginAuthScheme: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
6128
6347
  exchange: z.ZodLiteral<"pkce">;
6129
6348
  clientSuppliers: z.ZodArray<z.ZodEnum<{
6130
- kay: "kay";
6131
6349
  user: "user";
6350
+ kay: "kay";
6132
6351
  }>>;
6133
6352
  localId: z.ZodString;
6134
6353
  globalId: z.ZodString;
@@ -6234,8 +6453,8 @@ export declare const ResolvedPluginAuthService: z.ZodObject<{
6234
6453
  schemes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
6235
6454
  exchange: z.ZodLiteral<"pkce">;
6236
6455
  clientSuppliers: z.ZodArray<z.ZodEnum<{
6237
- kay: "kay";
6238
6456
  user: "user";
6457
+ kay: "kay";
6239
6458
  }>>;
6240
6459
  localId: z.ZodString;
6241
6460
  globalId: z.ZodString;
@@ -6403,8 +6622,8 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
6403
6622
  schemes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
6404
6623
  exchange: z.ZodLiteral<"pkce">;
6405
6624
  clientSuppliers: z.ZodArray<z.ZodEnum<{
6406
- kay: "kay";
6407
6625
  user: "user";
6626
+ kay: "kay";
6408
6627
  }>>;
6409
6628
  localId: z.ZodString;
6410
6629
  globalId: z.ZodString;
@@ -7713,6 +7932,7 @@ export declare const SessionCausedByEvent: z.ZodObject<{
7713
7932
  "turn-settled": "turn-settled";
7714
7933
  "phase-shift": "phase-shift";
7715
7934
  "human-message": "human-message";
7935
+ "assistant-message": "assistant-message";
7716
7936
  "ui-action": "ui-action";
7717
7937
  }>;
7718
7938
  entryId: z.ZodString;
@@ -7937,6 +8157,7 @@ export declare const SessionProvenanceRecord: z.ZodObject<{
7937
8157
  "turn-settled": "turn-settled";
7938
8158
  "phase-shift": "phase-shift";
7939
8159
  "human-message": "human-message";
8160
+ "assistant-message": "assistant-message";
7940
8161
  "ui-action": "ui-action";
7941
8162
  }>;
7942
8163
  entryId: z.ZodString;