@yaklabs-ai/plugin-protocol 0.26.3 → 0.27.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
@@ -11,7 +11,7 @@ flow.
11
11
  ```json
12
12
  {
13
13
  "dependencies": {
14
- "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.26.3"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.27.0"
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.26.3",
4
+ "version": "0.27.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -137,6 +137,41 @@ export declare const APPROVAL_KINDS: readonly ["message", "change", "action", "a
137
137
 
138
138
  export declare type ApprovalAnswer = (typeof APPROVAL_ANSWERS)[number];
139
139
 
140
+ export declare const ApprovalCardForm: z.ZodObject<{
141
+ uri: z.ZodUnion<readonly [z.ZodObject<{
142
+ fixed: z.ZodString;
143
+ }, z.core.$strict>, z.ZodObject<{
144
+ value: z.ZodString;
145
+ }, z.core.$strict>]>;
146
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
147
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
148
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
149
+ }, z.core.$strict>;
150
+
151
+ export declare type ApprovalCardForm = z.infer<typeof ApprovalCardForm>;
152
+
153
+ export declare const ApprovalCardStoredForm: z.ZodObject<{
154
+ uri: z.ZodUnion<readonly [z.ZodObject<{
155
+ fixed: z.ZodString;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ value: z.ZodString;
158
+ }, z.core.$strict>]>;
159
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
160
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
161
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
162
+ read: z.ZodObject<{
163
+ revision: z.ZodString;
164
+ body: z.ZodString;
165
+ subject: z.ZodOptional<z.ZodString>;
166
+ to: z.ZodOptional<z.ZodString>;
167
+ cc: z.ZodOptional<z.ZodString>;
168
+ bcc: z.ZodOptional<z.ZodString>;
169
+ attachments: z.ZodOptional<z.ZodString>;
170
+ }, z.core.$strict>;
171
+ }, z.core.$strict>;
172
+
173
+ export declare type ApprovalCardStoredForm = z.infer<typeof ApprovalCardStoredForm>;
174
+
140
175
  export declare type ApprovalKind = (typeof APPROVAL_KINDS)[number];
141
176
 
142
177
  export declare const approvalKindSchema: z.ZodEnum<{
@@ -158,12 +193,77 @@ export declare type ApprovalOrigin = z.infer<typeof ApprovalOrigin>;
158
193
 
159
194
  export declare const ApprovalTypeContribution: z.ZodObject<{
160
195
  localId: z.ZodString;
161
- kind: z.ZodEnum<{
162
- message: "message";
163
- change: "change";
164
- action: "action";
165
- access: "access";
166
- }>;
196
+ kind: z.ZodLiteral<"message">;
197
+ provider: z.ZodString;
198
+ uriModule: z.ZodString;
199
+ unknownMessage: z.ZodString;
200
+ fields: z.ZodObject<{
201
+ body: z.ZodObject<{
202
+ key: z.ZodString;
203
+ max: z.ZodNumber;
204
+ }, z.core.$strict>;
205
+ subject: z.ZodOptional<z.ZodObject<{
206
+ key: z.ZodString;
207
+ max: z.ZodNumber;
208
+ }, z.core.$strict>>;
209
+ }, z.core.$strict>;
210
+ presentation: z.ZodObject<{
211
+ showAccount: z.ZodBoolean;
212
+ recipient: z.ZodEnum<{
213
+ target: "target";
214
+ person: "person";
215
+ }>;
216
+ }, z.core.$strict>;
217
+ forms: z.ZodObject<{
218
+ inline: z.ZodOptional<z.ZodObject<{
219
+ uri: z.ZodUnion<readonly [z.ZodObject<{
220
+ fixed: z.ZodString;
221
+ }, z.core.$strict>, z.ZodObject<{
222
+ value: z.ZodString;
223
+ }, z.core.$strict>]>;
224
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
225
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
226
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
227
+ }, z.core.$strict>>;
228
+ saved: z.ZodOptional<z.ZodObject<{
229
+ uri: z.ZodUnion<readonly [z.ZodObject<{
230
+ fixed: z.ZodString;
231
+ }, z.core.$strict>, z.ZodObject<{
232
+ value: z.ZodString;
233
+ }, z.core.$strict>]>;
234
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
236
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
237
+ }, z.core.$strict>>;
238
+ stored: z.ZodOptional<z.ZodObject<{
239
+ uri: z.ZodUnion<readonly [z.ZodObject<{
240
+ fixed: z.ZodString;
241
+ }, z.core.$strict>, z.ZodObject<{
242
+ value: z.ZodString;
243
+ }, z.core.$strict>]>;
244
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
245
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
246
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
247
+ read: z.ZodObject<{
248
+ revision: z.ZodString;
249
+ body: z.ZodString;
250
+ subject: z.ZodOptional<z.ZodString>;
251
+ to: z.ZodOptional<z.ZodString>;
252
+ cc: z.ZodOptional<z.ZodString>;
253
+ bcc: z.ZodOptional<z.ZodString>;
254
+ attachments: z.ZodOptional<z.ZodString>;
255
+ }, z.core.$strict>;
256
+ }, z.core.$strict>>;
257
+ }, z.core.$strict>;
258
+ display: z.ZodOptional<z.ZodObject<{
259
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
260
+ replyField: z.ZodOptional<z.ZodString>;
261
+ replyLabel: z.ZodOptional<z.ZodString>;
262
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
263
+ label: z.ZodString;
264
+ field: z.ZodString;
265
+ }, z.core.$strict>>>;
266
+ }, z.core.$strict>>;
167
267
  }, z.core.$strict>;
168
268
 
169
269
  export declare type ApprovalTypeContribution = z.infer<typeof ApprovalTypeContribution>;
@@ -1509,6 +1609,8 @@ declare namespace authoringContributionSchemas {
1509
1609
  export {
1510
1610
  MCP_SIGN_IN_SCHEME_KIND,
1511
1611
  PLUGIN_NOTIFICATION_RULE_HOST_KEYS,
1612
+ ApprovalCardForm,
1613
+ ApprovalCardStoredForm,
1512
1614
  ApprovalTypeContribution,
1513
1615
  UriModuleFacts,
1514
1616
  ToolContribution,
@@ -1629,14 +1731,108 @@ declare const canonicalCommonSchemas: {
1629
1731
  };
1630
1732
 
1631
1733
  declare const canonicalContributionSchemas: {
1734
+ ApprovalCardForm: z.ZodObject<{
1735
+ uri: z.ZodUnion<readonly [z.ZodObject<{
1736
+ fixed: z.ZodString;
1737
+ }, z.core.$strict>, z.ZodObject<{
1738
+ value: z.ZodString;
1739
+ }, z.core.$strict>]>;
1740
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1741
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
1742
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
1743
+ }, z.core.$strict>;
1744
+ ApprovalCardStoredForm: z.ZodObject<{
1745
+ uri: z.ZodUnion<readonly [z.ZodObject<{
1746
+ fixed: z.ZodString;
1747
+ }, z.core.$strict>, z.ZodObject<{
1748
+ value: z.ZodString;
1749
+ }, z.core.$strict>]>;
1750
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1751
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
1752
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
1753
+ read: z.ZodObject<{
1754
+ revision: z.ZodString;
1755
+ body: z.ZodString;
1756
+ subject: z.ZodOptional<z.ZodString>;
1757
+ to: z.ZodOptional<z.ZodString>;
1758
+ cc: z.ZodOptional<z.ZodString>;
1759
+ bcc: z.ZodOptional<z.ZodString>;
1760
+ attachments: z.ZodOptional<z.ZodString>;
1761
+ }, z.core.$strict>;
1762
+ }, z.core.$strict>;
1632
1763
  ApprovalTypeContribution: z.ZodObject<{
1633
1764
  localId: z.ZodString;
1634
- kind: z.ZodEnum<{
1635
- message: "message";
1636
- change: "change";
1637
- action: "action";
1638
- access: "access";
1639
- }>;
1765
+ kind: z.ZodLiteral<"message">;
1766
+ provider: z.ZodString;
1767
+ uriModule: z.ZodString;
1768
+ unknownMessage: z.ZodString;
1769
+ fields: z.ZodObject<{
1770
+ body: z.ZodObject<{
1771
+ key: z.ZodString;
1772
+ max: z.ZodNumber;
1773
+ }, z.core.$strict>;
1774
+ subject: z.ZodOptional<z.ZodObject<{
1775
+ key: z.ZodString;
1776
+ max: z.ZodNumber;
1777
+ }, z.core.$strict>>;
1778
+ }, z.core.$strict>;
1779
+ presentation: z.ZodObject<{
1780
+ showAccount: z.ZodBoolean;
1781
+ recipient: z.ZodEnum<{
1782
+ target: "target";
1783
+ person: "person";
1784
+ }>;
1785
+ }, z.core.$strict>;
1786
+ forms: z.ZodObject<{
1787
+ inline: z.ZodOptional<z.ZodObject<{
1788
+ uri: z.ZodUnion<readonly [z.ZodObject<{
1789
+ fixed: z.ZodString;
1790
+ }, z.core.$strict>, z.ZodObject<{
1791
+ value: z.ZodString;
1792
+ }, z.core.$strict>]>;
1793
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1794
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
1795
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
1796
+ }, z.core.$strict>>;
1797
+ saved: z.ZodOptional<z.ZodObject<{
1798
+ uri: z.ZodUnion<readonly [z.ZodObject<{
1799
+ fixed: z.ZodString;
1800
+ }, z.core.$strict>, z.ZodObject<{
1801
+ value: z.ZodString;
1802
+ }, z.core.$strict>]>;
1803
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1804
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
1805
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
1806
+ }, z.core.$strict>>;
1807
+ stored: z.ZodOptional<z.ZodObject<{
1808
+ uri: z.ZodUnion<readonly [z.ZodObject<{
1809
+ fixed: z.ZodString;
1810
+ }, z.core.$strict>, z.ZodObject<{
1811
+ value: z.ZodString;
1812
+ }, z.core.$strict>]>;
1813
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
1814
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
1815
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
1816
+ read: z.ZodObject<{
1817
+ revision: z.ZodString;
1818
+ body: z.ZodString;
1819
+ subject: z.ZodOptional<z.ZodString>;
1820
+ to: z.ZodOptional<z.ZodString>;
1821
+ cc: z.ZodOptional<z.ZodString>;
1822
+ bcc: z.ZodOptional<z.ZodString>;
1823
+ attachments: z.ZodOptional<z.ZodString>;
1824
+ }, z.core.$strict>;
1825
+ }, z.core.$strict>>;
1826
+ }, z.core.$strict>;
1827
+ display: z.ZodOptional<z.ZodObject<{
1828
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
1829
+ replyField: z.ZodOptional<z.ZodString>;
1830
+ replyLabel: z.ZodOptional<z.ZodString>;
1831
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
1832
+ label: z.ZodString;
1833
+ field: z.ZodString;
1834
+ }, z.core.$strict>>>;
1835
+ }, z.core.$strict>>;
1640
1836
  }, z.core.$strict>;
1641
1837
  UriModuleFacts: z.ZodObject<{
1642
1838
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -2604,9 +2800,9 @@ declare const canonicalContributionSchemas: {
2604
2800
  endpoint: "endpoint";
2605
2801
  storage: "storage";
2606
2802
  command: "command";
2803
+ uriModule: "uriModule";
2607
2804
  authService: "authService";
2608
2805
  app: "app";
2609
- uriModule: "uriModule";
2610
2806
  configSection: "configSection";
2611
2807
  skill: "skill";
2612
2808
  converter: "converter";
@@ -3699,8 +3895,14 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
3699
3895
  * registers the named function on any such scheme, its own client's included, and the SDK refuses a
3700
3896
  * plugin whose lookup and manifest disagree. An own-client (`pkce`) scheme may carry the
3701
3897
  * `clientSecret` that goes with its `clientId`. A plugin with an `oauth2` sign-in declares ^0.26.3.
3898
+ *
3899
+ * 0.27.0 makes a message approval card manifest data (#14574). `approvalTypes` declares the card's
3900
+ * facts and forms, and Bonsai draws it with the module's `describeOperation` and sends it with its
3901
+ * `write`. `app.approvals`, its `prepare`, `finalize` and `resolveResource` are gone, and a write can
3902
+ * refuse in the person's words with `UriProviderError.refusalMessage`. No plugin outside this repo
3903
+ * declared a card, so 0.26.3 stays served. A plugin that declares a card declares ^0.27.0.
3702
3904
  */
3703
- export declare const KAY_PLUGIN_SDK_VERSION: "0.26.3";
3905
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.27.0";
3704
3906
 
3705
3907
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
3706
3908
 
@@ -4218,12 +4420,77 @@ export declare const KayAppTargetManifest: z.ZodObject<{
4218
4420
  }, z.core.$strict>>>;
4219
4421
  approvalTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
4220
4422
  localId: z.ZodString;
4221
- kind: z.ZodEnum<{
4222
- message: "message";
4223
- change: "change";
4224
- action: "action";
4225
- access: "access";
4226
- }>;
4423
+ kind: z.ZodLiteral<"message">;
4424
+ provider: z.ZodString;
4425
+ uriModule: z.ZodString;
4426
+ unknownMessage: z.ZodString;
4427
+ fields: z.ZodObject<{
4428
+ body: z.ZodObject<{
4429
+ key: z.ZodString;
4430
+ max: z.ZodNumber;
4431
+ }, z.core.$strict>;
4432
+ subject: z.ZodOptional<z.ZodObject<{
4433
+ key: z.ZodString;
4434
+ max: z.ZodNumber;
4435
+ }, z.core.$strict>>;
4436
+ }, z.core.$strict>;
4437
+ presentation: z.ZodObject<{
4438
+ showAccount: z.ZodBoolean;
4439
+ recipient: z.ZodEnum<{
4440
+ target: "target";
4441
+ person: "person";
4442
+ }>;
4443
+ }, z.core.$strict>;
4444
+ forms: z.ZodObject<{
4445
+ inline: z.ZodOptional<z.ZodObject<{
4446
+ uri: z.ZodUnion<readonly [z.ZodObject<{
4447
+ fixed: z.ZodString;
4448
+ }, z.core.$strict>, z.ZodObject<{
4449
+ value: z.ZodString;
4450
+ }, z.core.$strict>]>;
4451
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
4452
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
4453
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
4454
+ }, z.core.$strict>>;
4455
+ saved: z.ZodOptional<z.ZodObject<{
4456
+ uri: z.ZodUnion<readonly [z.ZodObject<{
4457
+ fixed: z.ZodString;
4458
+ }, z.core.$strict>, z.ZodObject<{
4459
+ value: z.ZodString;
4460
+ }, z.core.$strict>]>;
4461
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
4462
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
4463
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
4464
+ }, z.core.$strict>>;
4465
+ stored: z.ZodOptional<z.ZodObject<{
4466
+ uri: z.ZodUnion<readonly [z.ZodObject<{
4467
+ fixed: z.ZodString;
4468
+ }, z.core.$strict>, z.ZodObject<{
4469
+ value: z.ZodString;
4470
+ }, z.core.$strict>]>;
4471
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
4472
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
4473
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
4474
+ read: z.ZodObject<{
4475
+ revision: z.ZodString;
4476
+ body: z.ZodString;
4477
+ subject: z.ZodOptional<z.ZodString>;
4478
+ to: z.ZodOptional<z.ZodString>;
4479
+ cc: z.ZodOptional<z.ZodString>;
4480
+ bcc: z.ZodOptional<z.ZodString>;
4481
+ attachments: z.ZodOptional<z.ZodString>;
4482
+ }, z.core.$strict>;
4483
+ }, z.core.$strict>>;
4484
+ }, z.core.$strict>;
4485
+ display: z.ZodOptional<z.ZodObject<{
4486
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
4487
+ replyField: z.ZodOptional<z.ZodString>;
4488
+ replyLabel: z.ZodOptional<z.ZodString>;
4489
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
4490
+ label: z.ZodString;
4491
+ field: z.ZodString;
4492
+ }, z.core.$strict>>>;
4493
+ }, z.core.$strict>>;
4227
4494
  }, z.core.$strict>>>;
4228
4495
  eventDefinitions: z.ZodOptional<z.ZodArray<z.ZodObject<{
4229
4496
  localId: z.ZodString;
@@ -4905,12 +5172,77 @@ export declare const KayPluginManifestV1: z.ZodObject<{
4905
5172
  }, z.core.$strict>>>;
4906
5173
  approvalTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
4907
5174
  localId: z.ZodString;
4908
- kind: z.ZodEnum<{
4909
- message: "message";
4910
- change: "change";
4911
- action: "action";
4912
- access: "access";
4913
- }>;
5175
+ kind: z.ZodLiteral<"message">;
5176
+ provider: z.ZodString;
5177
+ uriModule: z.ZodString;
5178
+ unknownMessage: z.ZodString;
5179
+ fields: z.ZodObject<{
5180
+ body: z.ZodObject<{
5181
+ key: z.ZodString;
5182
+ max: z.ZodNumber;
5183
+ }, z.core.$strict>;
5184
+ subject: z.ZodOptional<z.ZodObject<{
5185
+ key: z.ZodString;
5186
+ max: z.ZodNumber;
5187
+ }, z.core.$strict>>;
5188
+ }, z.core.$strict>;
5189
+ presentation: z.ZodObject<{
5190
+ showAccount: z.ZodBoolean;
5191
+ recipient: z.ZodEnum<{
5192
+ target: "target";
5193
+ person: "person";
5194
+ }>;
5195
+ }, z.core.$strict>;
5196
+ forms: z.ZodObject<{
5197
+ inline: z.ZodOptional<z.ZodObject<{
5198
+ uri: z.ZodUnion<readonly [z.ZodObject<{
5199
+ fixed: z.ZodString;
5200
+ }, z.core.$strict>, z.ZodObject<{
5201
+ value: z.ZodString;
5202
+ }, z.core.$strict>]>;
5203
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
5204
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
5205
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
5206
+ }, z.core.$strict>>;
5207
+ saved: z.ZodOptional<z.ZodObject<{
5208
+ uri: z.ZodUnion<readonly [z.ZodObject<{
5209
+ fixed: z.ZodString;
5210
+ }, z.core.$strict>, z.ZodObject<{
5211
+ value: z.ZodString;
5212
+ }, z.core.$strict>]>;
5213
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
5214
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
5215
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
5216
+ }, z.core.$strict>>;
5217
+ stored: z.ZodOptional<z.ZodObject<{
5218
+ uri: z.ZodUnion<readonly [z.ZodObject<{
5219
+ fixed: z.ZodString;
5220
+ }, z.core.$strict>, z.ZodObject<{
5221
+ value: z.ZodString;
5222
+ }, z.core.$strict>]>;
5223
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
5224
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
5225
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
5226
+ read: z.ZodObject<{
5227
+ revision: z.ZodString;
5228
+ body: z.ZodString;
5229
+ subject: z.ZodOptional<z.ZodString>;
5230
+ to: z.ZodOptional<z.ZodString>;
5231
+ cc: z.ZodOptional<z.ZodString>;
5232
+ bcc: z.ZodOptional<z.ZodString>;
5233
+ attachments: z.ZodOptional<z.ZodString>;
5234
+ }, z.core.$strict>;
5235
+ }, z.core.$strict>>;
5236
+ }, z.core.$strict>;
5237
+ display: z.ZodOptional<z.ZodObject<{
5238
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
5239
+ replyField: z.ZodOptional<z.ZodString>;
5240
+ replyLabel: z.ZodOptional<z.ZodString>;
5241
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
5242
+ label: z.ZodString;
5243
+ field: z.ZodString;
5244
+ }, z.core.$strict>>>;
5245
+ }, z.core.$strict>>;
4914
5246
  }, z.core.$strict>>>;
4915
5247
  eventDefinitions: z.ZodOptional<z.ZodArray<z.ZodObject<{
4916
5248
  localId: z.ZodString;
@@ -8583,9 +8915,9 @@ export declare const PluginContributionKind: z.ZodEnum<{
8583
8915
  endpoint: "endpoint";
8584
8916
  storage: "storage";
8585
8917
  command: "command";
8918
+ uriModule: "uriModule";
8586
8919
  authService: "authService";
8587
8920
  app: "app";
8588
- uriModule: "uriModule";
8589
8921
  configSection: "configSection";
8590
8922
  skill: "skill";
8591
8923
  converter: "converter";
@@ -9541,6 +9873,12 @@ declare type PrereleaseIdentifier = string | number;
9541
9873
  */
9542
9874
  export declare const PRIVATE_PLUGIN_CAPABILITY_SLUGS: readonly PluginCapabilitySlug[];
9543
9875
 
9876
+ /**
9877
+ * What a manifest's JSON declares about compatibility, read the way a directory's verdict reads it:
9878
+ * apart from the strict schema, because a manifest written for another SDK may not pass that schema.
9879
+ */
9880
+ export declare function readKayPluginDeclaredCompatibility(manifest: unknown): DeclaredKayPluginCompatibility | undefined;
9881
+
9544
9882
  export declare const ReferenceOpenBehavior: z.ZodDiscriminatedUnion<[z.ZodObject<{
9545
9883
  kind: z.ZodLiteral<"working-document">;
9546
9884
  }, z.core.$strict>, z.ZodObject<{
@@ -10013,14 +10351,80 @@ export declare const ResolvedKayAgentUriModule: z.ZodObject<{
10013
10351
  export declare type ResolvedKayAgentUriModule = z.infer<typeof ResolvedKayAgentUriModule>;
10014
10352
 
10015
10353
  export declare const ResolvedKayAppApprovalType: z.ZodObject<{
10354
+ kind: z.ZodLiteral<"message">;
10016
10355
  localId: z.ZodString;
10356
+ provider: z.ZodString;
10357
+ unknownMessage: z.ZodString;
10358
+ fields: z.ZodObject<{
10359
+ body: z.ZodObject<{
10360
+ key: z.ZodString;
10361
+ max: z.ZodNumber;
10362
+ }, z.core.$strict>;
10363
+ subject: z.ZodOptional<z.ZodObject<{
10364
+ key: z.ZodString;
10365
+ max: z.ZodNumber;
10366
+ }, z.core.$strict>>;
10367
+ }, z.core.$strict>;
10368
+ presentation: z.ZodObject<{
10369
+ showAccount: z.ZodBoolean;
10370
+ recipient: z.ZodEnum<{
10371
+ target: "target";
10372
+ person: "person";
10373
+ }>;
10374
+ }, z.core.$strict>;
10375
+ forms: z.ZodObject<{
10376
+ inline: z.ZodOptional<z.ZodObject<{
10377
+ uri: z.ZodUnion<readonly [z.ZodObject<{
10378
+ fixed: z.ZodString;
10379
+ }, z.core.$strict>, z.ZodObject<{
10380
+ value: z.ZodString;
10381
+ }, z.core.$strict>]>;
10382
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
10383
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
10384
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
10385
+ }, z.core.$strict>>;
10386
+ saved: z.ZodOptional<z.ZodObject<{
10387
+ uri: z.ZodUnion<readonly [z.ZodObject<{
10388
+ fixed: z.ZodString;
10389
+ }, z.core.$strict>, z.ZodObject<{
10390
+ value: z.ZodString;
10391
+ }, z.core.$strict>]>;
10392
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
10393
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
10394
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
10395
+ }, z.core.$strict>>;
10396
+ stored: z.ZodOptional<z.ZodObject<{
10397
+ uri: z.ZodUnion<readonly [z.ZodObject<{
10398
+ fixed: z.ZodString;
10399
+ }, z.core.$strict>, z.ZodObject<{
10400
+ value: z.ZodString;
10401
+ }, z.core.$strict>]>;
10402
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
10403
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
10404
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
10405
+ read: z.ZodObject<{
10406
+ revision: z.ZodString;
10407
+ body: z.ZodString;
10408
+ subject: z.ZodOptional<z.ZodString>;
10409
+ to: z.ZodOptional<z.ZodString>;
10410
+ cc: z.ZodOptional<z.ZodString>;
10411
+ bcc: z.ZodOptional<z.ZodString>;
10412
+ attachments: z.ZodOptional<z.ZodString>;
10413
+ }, z.core.$strict>;
10414
+ }, z.core.$strict>>;
10415
+ }, z.core.$strict>;
10416
+ display: z.ZodOptional<z.ZodObject<{
10417
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
10418
+ replyField: z.ZodOptional<z.ZodString>;
10419
+ replyLabel: z.ZodOptional<z.ZodString>;
10420
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
10421
+ label: z.ZodString;
10422
+ field: z.ZodString;
10423
+ }, z.core.$strict>>>;
10424
+ }, z.core.$strict>>;
10017
10425
  globalId: z.ZodString;
10018
- kind: z.ZodEnum<{
10019
- message: "message";
10020
- change: "change";
10021
- action: "action";
10022
- access: "access";
10023
- }>;
10426
+ moduleId: z.ZodString;
10427
+ authService: z.ZodOptional<z.ZodString>;
10024
10428
  }, z.core.$strict>;
10025
10429
 
10026
10430
  export declare type ResolvedKayAppApprovalType = z.infer<typeof ResolvedKayAppApprovalType>;
@@ -10499,9 +10903,9 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
10499
10903
  endpoint: "endpoint";
10500
10904
  storage: "storage";
10501
10905
  command: "command";
10906
+ uriModule: "uriModule";
10502
10907
  authService: "authService";
10503
10908
  app: "app";
10504
- uriModule: "uriModule";
10505
10909
  configSection: "configSection";
10506
10910
  skill: "skill";
10507
10911
  converter: "converter";
@@ -11215,14 +11619,80 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
11215
11619
  toolName: z.ZodString;
11216
11620
  }, z.core.$strict>>>;
11217
11621
  kayAppApprovalTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
11622
+ kind: z.ZodLiteral<"message">;
11218
11623
  localId: z.ZodString;
11624
+ provider: z.ZodString;
11625
+ unknownMessage: z.ZodString;
11626
+ fields: z.ZodObject<{
11627
+ body: z.ZodObject<{
11628
+ key: z.ZodString;
11629
+ max: z.ZodNumber;
11630
+ }, z.core.$strict>;
11631
+ subject: z.ZodOptional<z.ZodObject<{
11632
+ key: z.ZodString;
11633
+ max: z.ZodNumber;
11634
+ }, z.core.$strict>>;
11635
+ }, z.core.$strict>;
11636
+ presentation: z.ZodObject<{
11637
+ showAccount: z.ZodBoolean;
11638
+ recipient: z.ZodEnum<{
11639
+ target: "target";
11640
+ person: "person";
11641
+ }>;
11642
+ }, z.core.$strict>;
11643
+ forms: z.ZodObject<{
11644
+ inline: z.ZodOptional<z.ZodObject<{
11645
+ uri: z.ZodUnion<readonly [z.ZodObject<{
11646
+ fixed: z.ZodString;
11647
+ }, z.core.$strict>, z.ZodObject<{
11648
+ value: z.ZodString;
11649
+ }, z.core.$strict>]>;
11650
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
11651
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
11652
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
11653
+ }, z.core.$strict>>;
11654
+ saved: z.ZodOptional<z.ZodObject<{
11655
+ uri: z.ZodUnion<readonly [z.ZodObject<{
11656
+ fixed: z.ZodString;
11657
+ }, z.core.$strict>, z.ZodObject<{
11658
+ value: z.ZodString;
11659
+ }, z.core.$strict>]>;
11660
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
11661
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
11662
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
11663
+ }, z.core.$strict>>;
11664
+ stored: z.ZodOptional<z.ZodObject<{
11665
+ uri: z.ZodUnion<readonly [z.ZodObject<{
11666
+ fixed: z.ZodString;
11667
+ }, z.core.$strict>, z.ZodObject<{
11668
+ value: z.ZodString;
11669
+ }, z.core.$strict>]>;
11670
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
11671
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
11672
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
11673
+ read: z.ZodObject<{
11674
+ revision: z.ZodString;
11675
+ body: z.ZodString;
11676
+ subject: z.ZodOptional<z.ZodString>;
11677
+ to: z.ZodOptional<z.ZodString>;
11678
+ cc: z.ZodOptional<z.ZodString>;
11679
+ bcc: z.ZodOptional<z.ZodString>;
11680
+ attachments: z.ZodOptional<z.ZodString>;
11681
+ }, z.core.$strict>;
11682
+ }, z.core.$strict>>;
11683
+ }, z.core.$strict>;
11684
+ display: z.ZodOptional<z.ZodObject<{
11685
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
11686
+ replyField: z.ZodOptional<z.ZodString>;
11687
+ replyLabel: z.ZodOptional<z.ZodString>;
11688
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
11689
+ label: z.ZodString;
11690
+ field: z.ZodString;
11691
+ }, z.core.$strict>>>;
11692
+ }, z.core.$strict>>;
11219
11693
  globalId: z.ZodString;
11220
- kind: z.ZodEnum<{
11221
- message: "message";
11222
- change: "change";
11223
- action: "action";
11224
- access: "access";
11225
- }>;
11694
+ moduleId: z.ZodString;
11695
+ authService: z.ZodOptional<z.ZodString>;
11226
11696
  }, z.core.$strict>>>;
11227
11697
  kayAppDataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
11228
11698
  localId: z.ZodString;
@@ -11403,9 +11873,9 @@ export declare const ResolvedPluginContributionId: z.ZodObject<{
11403
11873
  endpoint: "endpoint";
11404
11874
  storage: "storage";
11405
11875
  command: "command";
11876
+ uriModule: "uriModule";
11406
11877
  authService: "authService";
11407
11878
  app: "app";
11408
- uriModule: "uriModule";
11409
11879
  configSection: "configSection";
11410
11880
  skill: "skill";
11411
11881
  converter: "converter";
package/dist/index.js CHANGED
@@ -222,8 +222,8 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
222
222
  // packages/plugin-protocol/dist/common.js
223
223
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
224
224
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
225
- var KAY_PLUGIN_SDK_VERSION = "0.26.3";
226
- var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [];
225
+ var KAY_PLUGIN_SDK_VERSION = "0.27.0";
226
+ var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = ["0.26.3"];
227
227
  var KAY_PLUGIN_TARGET_NAMES = [
228
228
  "kay.agent",
229
229
  "kay.app",
@@ -2666,6 +2666,8 @@ __export(contributions_exports, {
2666
2666
  AppDataSourceContribution: () => AppDataSourceContribution,
2667
2667
  AppEventSubscription: () => AppEventSubscription,
2668
2668
  AppUriModuleContribution: () => AppUriModuleContribution,
2669
+ ApprovalCardForm: () => ApprovalCardForm,
2670
+ ApprovalCardStoredForm: () => ApprovalCardStoredForm,
2669
2671
  ApprovalTypeContribution: () => ApprovalTypeContribution,
2670
2672
  ArtifactUriModuleContribution: () => ArtifactUriModuleContribution,
2671
2673
  CliBindingContribution: () => CliBindingContribution,
@@ -2818,9 +2820,74 @@ function createContributionsSchemas(canonical) {
2818
2820
  const { AuthServiceReference: AuthServiceReference2, CliAuthEnvVarName: CliAuthEnvVarName2, CliBinaryName: CliBinaryName2, FileExtensionToken: FileExtensionToken2, GitBasicAuthUser: GitBasicAuthUser2, GitHostName: GitHostName2, LocalContributionId: LocalContributionId2, MimeTypeString: MimeTypeString2, NonEmptyString: NonEmptyString3, PackageAssetPath: PackageAssetPath2, PluginId: PluginId2, PluginToolName: PluginToolName2, TargetEntrypoint: TargetEntrypoint2, UriScheme: UriScheme2 } = canonical ? canonicalCommonSchemas : common_exports;
2819
2821
  const { ScopeRequirement: ScopeRequirement2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
2820
2822
  const OptionalDisplayName = NonEmptyString3.optional();
2823
+ const ApprovalCardValueName = z12.string().regex(/^[A-Za-z][A-Za-z0-9_]{0,63}$/u, "must be a plain field name");
2824
+ const ApprovalCardForm2 = z12.strictObject({
2825
+ /** Where the write goes: a fixed address, or the card value that names one. */
2826
+ uri: z12.union([
2827
+ z12.strictObject({ fixed: NonEmptyString3 }),
2828
+ z12.strictObject({ value: ApprovalCardValueName })
2829
+ ]),
2830
+ /** The delivery request fields this kind of card accepts, beyond provider and account. */
2831
+ requestFields: z12.array(ApprovalCardValueName).optional(),
2832
+ /** Payload field to the card value it is filled from. An absent value or empty list is left out. */
2833
+ payload: z12.record(ApprovalCardValueName, ApprovalCardValueName),
2834
+ /** Payload fields with a constant value. */
2835
+ fixed: z12.record(ApprovalCardValueName, z12.union([z12.string(), z12.boolean()])).optional()
2836
+ });
2837
+ const ApprovalCardStoredForm2 = ApprovalCardForm2.extend({
2838
+ read: z12.strictObject({
2839
+ revision: ApprovalCardValueName,
2840
+ body: ApprovalCardValueName,
2841
+ subject: ApprovalCardValueName.optional(),
2842
+ to: ApprovalCardValueName.optional(),
2843
+ cc: ApprovalCardValueName.optional(),
2844
+ bcc: ApprovalCardValueName.optional(),
2845
+ /** A list of `{ filename? }` objects: a card that has any cannot be sent by the app. */
2846
+ attachments: ApprovalCardValueName.optional()
2847
+ })
2848
+ });
2849
+ const ApprovalCardField = z12.strictObject({
2850
+ key: ApprovalCardValueName,
2851
+ max: z12.number().int().positive()
2852
+ });
2821
2853
  const ApprovalTypeContribution2 = z12.strictObject({
2822
2854
  localId: LocalContributionId2,
2823
- kind: approvalKindSchema
2855
+ kind: z12.literal("message"),
2856
+ /** The URI scheme of `uriModule` that cards of this type write to. */
2857
+ provider: UriScheme2,
2858
+ /** The local id of this plugin's URI module that handles the write. */
2859
+ uriModule: LocalContributionId2,
2860
+ /** Shown when a send's outcome cannot be confirmed: where the person checks. */
2861
+ unknownMessage: NonEmptyString3,
2862
+ /** The payload fields holding the text a person may edit. A `subject` makes this a mail type. */
2863
+ fields: z12.strictObject({
2864
+ body: ApprovalCardField,
2865
+ subject: ApprovalCardField.optional()
2866
+ }),
2867
+ presentation: z12.strictObject({
2868
+ showAccount: z12.boolean(),
2869
+ recipient: z12.enum(["person", "target"])
2870
+ }),
2871
+ /** One form per kind of card this provider supports. A kind left out is never bound. */
2872
+ forms: z12.strictObject({
2873
+ inline: ApprovalCardForm2.optional(),
2874
+ saved: ApprovalCardForm2.optional(),
2875
+ stored: ApprovalCardStoredForm2.optional()
2876
+ }),
2877
+ /** What the card shows beyond its text, read from the delivery request. */
2878
+ display: z12.strictObject({
2879
+ /** How the renderer reads the body. Absent is Markdown, or plain for a stored draft. */
2880
+ bodyFormat: z12.literal("mrkdwn").optional(),
2881
+ /** The request field naming what this card replies to. */
2882
+ replyField: ApprovalCardValueName.optional(),
2883
+ /** Shown instead of the reply's id when that id means nothing to a person. */
2884
+ replyLabel: NonEmptyString3.optional(),
2885
+ /** Further request fields shown as labelled lines. */
2886
+ facts: z12.array(z12.strictObject({
2887
+ label: NonEmptyString3,
2888
+ field: ApprovalCardValueName
2889
+ })).optional()
2890
+ }).optional()
2824
2891
  });
2825
2892
  const ToolContribution2 = z12.strictObject({
2826
2893
  localId: LocalContributionId2,
@@ -3488,6 +3555,8 @@ function createContributionsSchemas(canonical) {
3488
3555
  "configSection"
3489
3556
  ]);
3490
3557
  return {
3558
+ ApprovalCardForm: ApprovalCardForm2,
3559
+ ApprovalCardStoredForm: ApprovalCardStoredForm2,
3491
3560
  ApprovalTypeContribution: ApprovalTypeContribution2,
3492
3561
  UriModuleFacts: UriModuleFacts2,
3493
3562
  ToolContribution: ToolContribution2,
@@ -3544,7 +3613,7 @@ function createContributionsSchemas(canonical) {
3544
3613
  PluginContributionKind: PluginContributionKind2
3545
3614
  };
3546
3615
  }
3547
- var { ApprovalTypeContribution, UriModuleFacts, ToolContribution, ToolPermission, AgentToolContribution, ConverterContribution, UriModuleContribution, AppUriModuleContribution, AppDataSourceContribution, WhiteboardTypeStorage, WhiteboardTypeContribution, AppDataMaterializerContribution, ArtifactUriModuleContribution, CliBindingContribution, GitHostContribution, ResourceContribution, SkillContribution, PluginSkillSourceDeclaration, SearchProviderContribution, InteractionDriverContribution, EntityResolverContribution, AgentRenderContribution, EndpointContribution, McpServerUrl, McpServerAuthMode, McpServerContribution, McpServerContributions, AppEventSubscription, ContextContributorContribution, PluginEventDefinitionContribution, PluginNotificationRuleContribution, UiEventSubscriptionContribution, DeviceDelegationContribution, SessionReaderContribution, UiCommandContribution, UiSlotContribution, SettingsPanelContribution, ResultRendererContribution, ReferenceOpenBehavior, ReferencePresentationVariant, ReferencePresentationVariants, ReferencePresentationUriPattern, ReferencePresentationUrlClaim, ReferencePresentationTooltip, ReferencePresentationContribution, RichViewContribution, KayUiAppHostCapability, UiAppCapabilities, UiAppActivityRail, UiAppContribution, ThemeContribution, CommandHandler, CommandContribution, PluginContributionKind } = createContributionsSchemas(false);
3616
+ var { ApprovalCardForm, ApprovalCardStoredForm, ApprovalTypeContribution, UriModuleFacts, ToolContribution, ToolPermission, AgentToolContribution, ConverterContribution, UriModuleContribution, AppUriModuleContribution, AppDataSourceContribution, WhiteboardTypeStorage, WhiteboardTypeContribution, AppDataMaterializerContribution, ArtifactUriModuleContribution, CliBindingContribution, GitHostContribution, ResourceContribution, SkillContribution, PluginSkillSourceDeclaration, SearchProviderContribution, InteractionDriverContribution, EntityResolverContribution, AgentRenderContribution, EndpointContribution, McpServerUrl, McpServerAuthMode, McpServerContribution, McpServerContributions, AppEventSubscription, ContextContributorContribution, PluginEventDefinitionContribution, PluginNotificationRuleContribution, UiEventSubscriptionContribution, DeviceDelegationContribution, SessionReaderContribution, UiCommandContribution, UiSlotContribution, SettingsPanelContribution, ResultRendererContribution, ReferenceOpenBehavior, ReferencePresentationVariant, ReferencePresentationVariants, ReferencePresentationUriPattern, ReferencePresentationUrlClaim, ReferencePresentationTooltip, ReferencePresentationContribution, RichViewContribution, KayUiAppHostCapability, UiAppCapabilities, UiAppActivityRail, UiAppContribution, ThemeContribution, CommandHandler, CommandContribution, PluginContributionKind } = createContributionsSchemas(false);
3548
3617
  var canonicalContributionSchemas = createContributionsSchemas(true);
3549
3618
 
3550
3619
  // packages/plugin-protocol/dist/icon-shape.js
@@ -4271,6 +4340,27 @@ function createManifestSchemas(canonical) {
4271
4340
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "eventDefinitions"], manifest.targets?.kay?.app?.contributes?.eventDefinitions, "plugin event definition");
4272
4341
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "contextContributors"], manifest.targets?.kay?.app?.contributes?.contextContributors, "context contributor");
4273
4342
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "approvalTypes"], manifest.targets?.kay?.app?.contributes?.approvalTypes, "approval type");
4343
+ for (const [index, type] of (manifest.targets?.kay?.app?.contributes?.approvalTypes ?? []).entries()) {
4344
+ const module = [
4345
+ ...manifest.targets?.kay?.agent?.contributes?.uriModules ?? [],
4346
+ ...manifest.targets?.kay?.app?.contributes?.uriModules ?? []
4347
+ ].find((candidate) => candidate.localId === type.uriModule);
4348
+ if (module === void 0 || !module.schemes.includes(type.provider)) {
4349
+ ctx.addIssue({
4350
+ code: "custom",
4351
+ path: [
4352
+ "targets",
4353
+ "kay",
4354
+ "app",
4355
+ "contributes",
4356
+ "approvalTypes",
4357
+ index,
4358
+ "uriModule"
4359
+ ],
4360
+ message: `approval type ${type.localId} must name one of this plugin's URI modules, with provider ${type.provider} among its schemes`
4361
+ });
4362
+ }
4363
+ }
4274
4364
  const syntheticContributionIds = collectSyntheticContributionIds(manifest);
4275
4365
  for (const contribution of collectDeclaredContributionIds(manifest)) {
4276
4366
  if (syntheticContributionIds.has(contribution.localId)) {
@@ -4887,7 +4977,7 @@ function boundPluginDiagnosticMessage(message) {
4887
4977
  import { z as z14 } from "zod";
4888
4978
  function createResolvedContractSchemas(canonical) {
4889
4979
  const { PluginEventLocalId: PluginEventLocalId2 } = canonical ? canonicalPluginEventSchemas : plugin_events_exports;
4890
- const { KayUiAppHostCapability: KayUiAppHostCapability2, UiAppActivityRail: UiAppActivityRail2, McpServerAuthMode: McpServerAuthMode2, McpServerUrl: McpServerUrl2, PluginContributionKind: PluginContributionKindSchema, ReferenceOpenBehavior: ReferenceOpenBehavior2, ReferencePresentationUriPattern: ReferencePresentationUriPattern2, ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2, ReferencePresentationVariants: ReferencePresentationVariants2, UriModuleFacts: UriModuleFacts2, WhiteboardTypeStorage: WhiteboardTypeStorage2 } = canonical ? canonicalContributionSchemas : contributions_exports;
4980
+ const { ApprovalTypeContribution: ApprovalTypeContribution2, KayUiAppHostCapability: KayUiAppHostCapability2, UiAppActivityRail: UiAppActivityRail2, McpServerAuthMode: McpServerAuthMode2, McpServerUrl: McpServerUrl2, PluginContributionKind: PluginContributionKindSchema, ReferenceOpenBehavior: ReferenceOpenBehavior2, ReferencePresentationUriPattern: ReferencePresentationUriPattern2, ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2, ReferencePresentationVariants: ReferencePresentationVariants2, UriModuleFacts: UriModuleFacts2, WhiteboardTypeStorage: WhiteboardTypeStorage2 } = canonical ? canonicalContributionSchemas : contributions_exports;
4891
4981
  const { FileExtensionToken: FileExtensionToken2, GitBasicAuthUser: GitBasicAuthUser2, GitHostName: GitHostName2, GlobalContributionId: GlobalContributionId2, HttpsUrl: HttpsUrl2, LocalContributionId: LocalContributionId2, MimeTypeString: MimeTypeString2, NonEmptyString: NonEmptyString3, PackageAssetPath: PackageAssetPath2, PluginId: PluginId2, PluginNamespace: PluginNamespace2, PluginToolName: PluginToolName2, RegistrableDomain: RegistrableDomain2, SignedInStatusCode: SignedInStatusCode2, TargetEntrypoint: TargetEntrypoint2, UriScheme: UriScheme2 } = canonical ? canonicalCommonSchemas : common_exports;
4892
4982
  const { PluginExternalCliConnect: PluginExternalCliConnect2, PluginOAuthClientSupplier: PluginOAuthClientSupplier2 } = canonical ? canonicalManifestSchemas : manifest_exports;
4893
4983
  const { ResolvedPluginGrants: ResolvedPluginGrants2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
@@ -4952,10 +5042,14 @@ function createResolvedContractSchemas(canonical) {
4952
5042
  });
4953
5043
  }
4954
5044
  });
4955
- const ResolvedKayAppApprovalType2 = z14.strictObject({
4956
- localId: LocalContributionId2,
5045
+ const ResolvedKayAppApprovalType2 = ApprovalTypeContribution2.omit({
5046
+ uriModule: true
5047
+ }).extend({
4957
5048
  globalId: GlobalContributionId2,
4958
- kind: approvalKindSchema
5049
+ /** The global id of the URI module that handles the write. */
5050
+ moduleId: GlobalContributionId2,
5051
+ /** The auth service that module signs in through, whose accounts a card may send from. */
5052
+ authService: GlobalContributionId2.optional()
4959
5053
  });
4960
5054
  const ResolvedKayAppWhiteboardType2 = z14.strictObject({
4961
5055
  localId: LocalContributionId2,
@@ -5554,11 +5648,17 @@ function resolveKayPluginContractV1(manifest) {
5554
5648
  change: source.change,
5555
5649
  ...source.read === void 0 ? {} : { read: source.read }
5556
5650
  }));
5557
- const kayAppApprovalTypes = manifest.targets?.kay?.app?.contributes?.approvalTypes?.map((type) => ({
5558
- localId: type.localId,
5559
- globalId: resolveGlobalContributionId(namespace, type.localId),
5560
- kind: type.kind
5561
- }));
5651
+ const kayAppApprovalTypes = manifest.targets?.kay?.app?.contributes?.approvalTypes?.map(({ uriModule, ...type }) => {
5652
+ const authService = manifest.targets?.kay?.agent?.contributes?.uriModules?.find((candidate) => candidate.localId === uriModule)?.authService;
5653
+ return {
5654
+ ...type,
5655
+ globalId: resolveGlobalContributionId(namespace, type.localId),
5656
+ moduleId: resolveGlobalContributionId(namespace, uriModule),
5657
+ ...authService === void 0 ? {} : {
5658
+ authService: authService.includes(".") ? authService : resolveGlobalContributionId(namespace, authService)
5659
+ }
5660
+ };
5661
+ });
5562
5662
  const kayAppWhiteboardTypes = manifest.targets?.kay?.app?.contributes?.whiteboardTypes?.map((type) => ({
5563
5663
  localId: type.localId,
5564
5664
  globalId: resolveGlobalContributionId(namespace, type.localId),
@@ -5888,6 +5988,10 @@ function keepNamespaceDerivedTools(contract, grandfathered) {
5888
5988
  misnamedTools
5889
5989
  };
5890
5990
  }
5991
+ function readKayPluginDeclaredCompatibility(manifest) {
5992
+ const head = ReadableManifestHead.safeParse(manifest);
5993
+ return head.success ? head.data.compatibility : void 0;
5994
+ }
5891
5995
  function namedIn(head) {
5892
5996
  if (head.id === void 0)
5893
5997
  return KAY_PLUGIN_MANIFEST_FILENAME;
@@ -6399,6 +6503,8 @@ export {
6399
6503
  AppDataSourceRead,
6400
6504
  AppEventSubscription,
6401
6505
  AppUriModuleContribution,
6506
+ ApprovalCardForm,
6507
+ ApprovalCardStoredForm,
6402
6508
  ApprovalOrigin,
6403
6509
  ApprovalTypeContribution,
6404
6510
  ArtifactGenerationId,
@@ -6670,6 +6776,7 @@ export {
6670
6776
  parseSemver,
6671
6777
  pluginIconShape,
6672
6778
  precedingPersonMessages,
6779
+ readKayPluginDeclaredCompatibility,
6673
6780
  refineWebSessionScopeConfined,
6674
6781
  resolveAdapterId,
6675
6782
  resolveGlobalContributionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.26.3",
3
+ "version": "0.27.0",
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",