@yaklabs-ai/plugin-protocol 0.34.0 → 0.36.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 +1 -1
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/index.d.ts +414 -174
- package/dist/index.js +235 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,12 +9,28 @@ var KAY_APP_DATA_SNAPSHOT_MAX_BYTES = 16 * 1024 * 1024;
|
|
|
9
9
|
var KAY_APP_DATA_CHANGE_MAX_BYTES = 256 * 1024;
|
|
10
10
|
var KAY_APP_DATA_READ_REQUEST_MAX_BYTES = 64 * 1024;
|
|
11
11
|
var KAY_APP_DATA_READ_RESULT_MAX_BYTES = 16 * 1024 * 1024;
|
|
12
|
+
function appDataSourceDeclaration(source) {
|
|
13
|
+
return {
|
|
14
|
+
sourceId: source.localId,
|
|
15
|
+
scope: source.scope,
|
|
16
|
+
snapshotVersion: source.snapshot.version,
|
|
17
|
+
changeVersion: source.change.version,
|
|
18
|
+
...source.read === void 0 ? {} : {
|
|
19
|
+
read: {
|
|
20
|
+
requestVersion: source.read.request.version,
|
|
21
|
+
resultVersion: source.read.result.version
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
...source.store === void 0 ? {} : { store: source.store }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
12
27
|
|
|
13
28
|
// packages/plugin-protocol/dist/ui-icon-paths.js
|
|
14
29
|
function declaredUiIconPaths(manifest) {
|
|
15
30
|
const contributes = manifest.targets?.kay?.ui?.contributes;
|
|
16
31
|
return [
|
|
17
32
|
...(contributes?.railEntries ?? []).flatMap((entry) => entry.icon === void 0 ? [] : [{ label: `kay.ui rail entry '${entry.id}' icon`, path: entry.icon }]),
|
|
33
|
+
...(contributes?.pages ?? []).flatMap((page) => page.icon === void 0 ? [] : [{ label: `kay.ui page '${page.id}' icon`, path: page.icon }]),
|
|
18
34
|
...(contributes?.commands ?? []).flatMap((command) => command.icon === void 0 ? [] : [
|
|
19
35
|
{
|
|
20
36
|
label: `kay.ui command '${command.localId}' icon`,
|
|
@@ -238,7 +254,7 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
|
|
|
238
254
|
var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
|
|
239
255
|
var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
|
|
240
256
|
var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
|
|
241
|
-
var KAY_PLUGIN_SDK_VERSION = "0.
|
|
257
|
+
var KAY_PLUGIN_SDK_VERSION = "0.36.0";
|
|
242
258
|
var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
|
|
243
259
|
"0.26.3",
|
|
244
260
|
"0.27.1",
|
|
@@ -247,7 +263,9 @@ var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
|
|
|
247
263
|
"0.30.0",
|
|
248
264
|
"0.31.0",
|
|
249
265
|
"0.32.0",
|
|
250
|
-
"0.33.0"
|
|
266
|
+
"0.33.0",
|
|
267
|
+
"0.34.0",
|
|
268
|
+
"0.35.0"
|
|
251
269
|
];
|
|
252
270
|
var KAY_PLUGIN_TARGET_NAMES = [
|
|
253
271
|
"kay.agent",
|
|
@@ -2720,6 +2738,7 @@ __export(contributions_exports, {
|
|
|
2720
2738
|
PluginNotificationRuleContribution: () => PluginNotificationRuleContribution,
|
|
2721
2739
|
PluginSkillSourceDeclaration: () => PluginSkillSourceDeclaration,
|
|
2722
2740
|
ReferenceOpenBehavior: () => ReferenceOpenBehavior,
|
|
2741
|
+
ReferencePresentationAddress: () => ReferencePresentationAddress,
|
|
2723
2742
|
ReferencePresentationContribution: () => ReferencePresentationContribution,
|
|
2724
2743
|
ReferencePresentationTooltip: () => ReferencePresentationTooltip,
|
|
2725
2744
|
ReferencePresentationUriPattern: () => ReferencePresentationUriPattern,
|
|
@@ -2740,6 +2759,7 @@ __export(contributions_exports, {
|
|
|
2740
2759
|
UiAppContribution: () => UiAppContribution,
|
|
2741
2760
|
UiCommandContribution: () => UiCommandContribution,
|
|
2742
2761
|
UiEventSubscriptionContribution: () => UiEventSubscriptionContribution,
|
|
2762
|
+
UiPageContribution: () => UiPageContribution,
|
|
2743
2763
|
UiRailEntryContribution: () => UiRailEntryContribution,
|
|
2744
2764
|
UiSlotContribution: () => UiSlotContribution,
|
|
2745
2765
|
UriModuleContribution: () => UriModuleContribution,
|
|
@@ -2833,20 +2853,7 @@ function createPluginEventsSchemas(canonical) {
|
|
|
2833
2853
|
var { PluginEventLocalId, PluginEventUri, PluginEventTimestamp, PluginEventRelated, PluginEventPublishSource, PluginEventSource, PluginEventId, PluginEventPublishInput, PluginEventEnvelope } = createPluginEventsSchemas(false);
|
|
2834
2854
|
var canonicalPluginEventSchemas = createPluginEventsSchemas(true);
|
|
2835
2855
|
|
|
2836
|
-
// packages/plugin-protocol/dist/
|
|
2837
|
-
function declarationsOfKind(plugins, kind) {
|
|
2838
|
-
return plugins.flatMap((plugin) => (plugin.contributes[kind] ?? []).map((declaration) => ({
|
|
2839
|
-
plugin,
|
|
2840
|
-
declaration
|
|
2841
|
-
})));
|
|
2842
|
-
}
|
|
2843
|
-
function declaredCommandId(pluginId, localId) {
|
|
2844
|
-
return `${pluginId}/${localId}`;
|
|
2845
|
-
}
|
|
2846
|
-
var WHERE_KEY_TYPES = {
|
|
2847
|
-
"account.signedIn": "boolean",
|
|
2848
|
-
"app.channel": "string"
|
|
2849
|
-
};
|
|
2856
|
+
// packages/plugin-protocol/dist/where-expression.js
|
|
2850
2857
|
var TOKEN = /\s*(?:(\|\||&&|==|!=|!|\(|\))|'([^']*)'|"([^"]*)"|([A-Za-z][A-Za-z0-9]*(?:\.[A-Za-z][A-Za-z0-9]*)*))/y;
|
|
2851
2858
|
function tokenize(source) {
|
|
2852
2859
|
const tokens = [];
|
|
@@ -2867,10 +2874,7 @@ function tokenize(source) {
|
|
|
2867
2874
|
}
|
|
2868
2875
|
return tokens;
|
|
2869
2876
|
}
|
|
2870
|
-
function
|
|
2871
|
-
return Object.hasOwn(WHERE_KEY_TYPES, text);
|
|
2872
|
-
}
|
|
2873
|
-
function parseTokens(tokens) {
|
|
2877
|
+
function parseTokens(tokens, keyTypes) {
|
|
2874
2878
|
let position = 0;
|
|
2875
2879
|
const takeOperator = (text) => {
|
|
2876
2880
|
const token = tokens[position];
|
|
@@ -2911,22 +2915,23 @@ function parseTokens(tokens) {
|
|
|
2911
2915
|
}
|
|
2912
2916
|
if (token.kind !== "word")
|
|
2913
2917
|
throw new Error(`unexpected '${token.text}'`);
|
|
2914
|
-
if (!
|
|
2915
|
-
throw new Error(`unknown key '${token.text}'; the keys are ${Object.keys(
|
|
2918
|
+
if (keyTypes !== void 0 && !Object.hasOwn(keyTypes, token.text)) {
|
|
2919
|
+
throw new Error(`unknown key '${token.text}'; the keys are ${Object.keys(keyTypes).join(", ")}`);
|
|
2916
2920
|
}
|
|
2917
2921
|
return parseKeyAtom(token.text);
|
|
2918
2922
|
};
|
|
2919
2923
|
const parseKeyAtom = (key) => {
|
|
2924
|
+
const keyType = keyTypes?.[key];
|
|
2920
2925
|
const negated = takeOperator("!=");
|
|
2921
2926
|
if (!negated && !takeOperator("==")) {
|
|
2922
|
-
if (
|
|
2927
|
+
if (keyType === "string") {
|
|
2923
2928
|
throw new Error(`'${key}' must be compared, with == or !=`);
|
|
2924
2929
|
}
|
|
2925
2930
|
return { kind: "key", key };
|
|
2926
2931
|
}
|
|
2927
2932
|
const value = parseLiteral();
|
|
2928
|
-
if (typeof value !==
|
|
2929
|
-
throw new Error(`'${key}' compares to a ${
|
|
2933
|
+
if (keyType !== void 0 && typeof value !== keyType) {
|
|
2934
|
+
throw new Error(`'${key}' compares to a ${keyType}`);
|
|
2930
2935
|
}
|
|
2931
2936
|
return { kind: "equals", key, value, negated };
|
|
2932
2937
|
};
|
|
@@ -2947,49 +2952,85 @@ function parseTokens(tokens) {
|
|
|
2947
2952
|
throw new Error(`unexpected '${extra.text}'`);
|
|
2948
2953
|
return where;
|
|
2949
2954
|
}
|
|
2950
|
-
function
|
|
2955
|
+
function parseWhere(source, keyTypes) {
|
|
2951
2956
|
try {
|
|
2952
|
-
return { ok: true, where: parseTokens(tokenize(source)) };
|
|
2957
|
+
return { ok: true, where: parseTokens(tokenize(source), keyTypes) };
|
|
2953
2958
|
} catch (error) {
|
|
2954
2959
|
return { ok: false, message: error.message };
|
|
2955
2960
|
}
|
|
2956
2961
|
}
|
|
2957
|
-
function resolve(where,
|
|
2962
|
+
function resolve(where, read) {
|
|
2958
2963
|
switch (where.kind) {
|
|
2959
2964
|
case "literal":
|
|
2960
2965
|
return where.value;
|
|
2961
2966
|
case "key": {
|
|
2962
|
-
const value =
|
|
2963
|
-
return value === void 0 ? void 0 : value
|
|
2967
|
+
const value = read(where.key);
|
|
2968
|
+
return value === void 0 ? void 0 : Boolean(value);
|
|
2964
2969
|
}
|
|
2965
2970
|
case "equals": {
|
|
2966
|
-
const value =
|
|
2971
|
+
const value = read(where.key);
|
|
2967
2972
|
if (value === void 0)
|
|
2968
2973
|
return void 0;
|
|
2969
2974
|
return value === where.value !== where.negated;
|
|
2970
2975
|
}
|
|
2971
2976
|
case "not": {
|
|
2972
|
-
const operand = resolve(where.operand,
|
|
2977
|
+
const operand = resolve(where.operand, read);
|
|
2973
2978
|
return operand === void 0 ? void 0 : !operand;
|
|
2974
2979
|
}
|
|
2975
2980
|
case "and": {
|
|
2976
|
-
const left = resolve(where.left,
|
|
2977
|
-
const right = resolve(where.right,
|
|
2981
|
+
const left = resolve(where.left, read);
|
|
2982
|
+
const right = resolve(where.right, read);
|
|
2978
2983
|
if (left === false || right === false)
|
|
2979
2984
|
return false;
|
|
2980
2985
|
return left === void 0 || right === void 0 ? void 0 : true;
|
|
2981
2986
|
}
|
|
2982
2987
|
case "or": {
|
|
2983
|
-
const left = resolve(where.left,
|
|
2984
|
-
const right = resolve(where.right,
|
|
2988
|
+
const left = resolve(where.left, read);
|
|
2989
|
+
const right = resolve(where.right, read);
|
|
2985
2990
|
if (left === true || right === true)
|
|
2986
2991
|
return true;
|
|
2987
2992
|
return left === void 0 || right === void 0 ? void 0 : false;
|
|
2988
2993
|
}
|
|
2989
2994
|
}
|
|
2990
2995
|
}
|
|
2996
|
+
function evaluateWhere(where, read) {
|
|
2997
|
+
return resolve(where, read) === true;
|
|
2998
|
+
}
|
|
2999
|
+
function rowMatchesWhere(where, row) {
|
|
3000
|
+
return evaluateWhere(where, (path) => {
|
|
3001
|
+
let value = row;
|
|
3002
|
+
for (const part of path.split(".")) {
|
|
3003
|
+
if (typeof value !== "object" || value === null || !Object.hasOwn(value, part)) {
|
|
3004
|
+
return null;
|
|
3005
|
+
}
|
|
3006
|
+
value = value[part];
|
|
3007
|
+
}
|
|
3008
|
+
return value ?? null;
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
// packages/plugin-protocol/dist/declared-commands.js
|
|
3013
|
+
function declarationsOfKind(plugins, kind) {
|
|
3014
|
+
return plugins.flatMap((plugin) => (plugin.contributes[kind] ?? []).map((declaration) => ({
|
|
3015
|
+
plugin,
|
|
3016
|
+
declaration
|
|
3017
|
+
})));
|
|
3018
|
+
}
|
|
3019
|
+
function declaredReferencePresentations(plugins) {
|
|
3020
|
+
return plugins.flatMap((plugin) => (plugin.contributes["referencePresentations"] ?? []).map((declaration) => ({ plugin, declaration })));
|
|
3021
|
+
}
|
|
3022
|
+
function declaredCommandId(pluginId, localId) {
|
|
3023
|
+
return `${pluginId}/${localId}`;
|
|
3024
|
+
}
|
|
3025
|
+
var WHERE_KEY_TYPES = {
|
|
3026
|
+
"account.signedIn": "boolean",
|
|
3027
|
+
"app.channel": "string"
|
|
3028
|
+
};
|
|
3029
|
+
function parseCommandWhere(source) {
|
|
3030
|
+
return parseWhere(source, WHERE_KEY_TYPES);
|
|
3031
|
+
}
|
|
2991
3032
|
function evaluateCommandWhere(where, values) {
|
|
2992
|
-
return
|
|
3033
|
+
return evaluateWhere(where, (key) => values[key]);
|
|
2993
3034
|
}
|
|
2994
3035
|
|
|
2995
3036
|
// packages/plugin-protocol/dist/contributions.js
|
|
@@ -3613,9 +3654,9 @@ function createContributionsSchemas(canonical) {
|
|
|
3613
3654
|
z12.strictObject({ kind: z12.literal("working-document") }),
|
|
3614
3655
|
z12.strictObject({ kind: z12.literal("browser-pane") }),
|
|
3615
3656
|
/**
|
|
3616
|
-
* Open one of the
|
|
3617
|
-
*
|
|
3618
|
-
* Needs no web address, so a plugin-only resource (`user-todo://items/3`) can pill.
|
|
3657
|
+
* Open one of the pages this manifest declares in `pages`. The window answers this from the
|
|
3658
|
+
* manifest, and the page gets the whole address as its `objectId` unless `addresses` says
|
|
3659
|
+
* otherwise. Needs no web address, so a plugin-only resource (`user-todo://items/3`) can pill.
|
|
3619
3660
|
*/
|
|
3620
3661
|
z12.strictObject({ kind: z12.literal("page"), pageId: NonEmptyString3 })
|
|
3621
3662
|
]);
|
|
@@ -3643,9 +3684,23 @@ function createContributionsSchemas(canonical) {
|
|
|
3643
3684
|
app: LocalContributionId2,
|
|
3644
3685
|
pattern: ReferencePresentationUriPattern2
|
|
3645
3686
|
});
|
|
3687
|
+
const ReferencePresentationAddress2 = z12.strictObject({
|
|
3688
|
+
pattern: ReferencePresentationUriPattern2,
|
|
3689
|
+
objectId: NonEmptyString3.optional(),
|
|
3690
|
+
open: z12.strictObject({ kind: z12.literal("none") }).optional()
|
|
3691
|
+
});
|
|
3646
3692
|
const ReferencePresentationContribution2 = z12.strictObject({
|
|
3647
3693
|
localId: LocalContributionId2,
|
|
3648
|
-
|
|
3694
|
+
/** This manifest's URI module. Leave it out only for an address another layer serves. */
|
|
3695
|
+
uriModule: LocalContributionId2.optional(),
|
|
3696
|
+
/**
|
|
3697
|
+
* The scheme this presentation opens, for an address with no module in this manifest. A
|
|
3698
|
+
* module's own schemes are filled in for the window. Every address of the scheme with something
|
|
3699
|
+
* after `://` opens the page, unless `addresses` narrows it.
|
|
3700
|
+
*/
|
|
3701
|
+
scheme: UriScheme2.optional(),
|
|
3702
|
+
/** Which of the addresses open the page, and on what. Read by the window. */
|
|
3703
|
+
addresses: z12.array(ReferencePresentationAddress2).min(1).optional(),
|
|
3649
3704
|
resourceKind: NonEmptyString3,
|
|
3650
3705
|
open: ReferenceOpenBehavior2,
|
|
3651
3706
|
/** MIME-specific resource kinds; absent keys use the base presentation. */
|
|
@@ -3662,6 +3717,38 @@ function createContributionsSchemas(canonical) {
|
|
|
3662
3717
|
message: "URL claims require browser-pane opening."
|
|
3663
3718
|
});
|
|
3664
3719
|
}
|
|
3720
|
+
if (value.uriModule === void 0 && value.scheme === void 0) {
|
|
3721
|
+
ctx.addIssue({
|
|
3722
|
+
code: "custom",
|
|
3723
|
+
path: ["uriModule"],
|
|
3724
|
+
message: "A reference presentation names a uriModule or a scheme."
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
if ((value.scheme !== void 0 || value.addresses !== void 0) && value.open.kind !== "page") {
|
|
3728
|
+
ctx.addIssue({
|
|
3729
|
+
code: "custom",
|
|
3730
|
+
path: ["open"],
|
|
3731
|
+
message: "scheme and addresses require page opening."
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3734
|
+
if (value.tooltip !== void 0 && value.open.kind === "page") {
|
|
3735
|
+
ctx.addIssue({
|
|
3736
|
+
code: "custom",
|
|
3737
|
+
path: ["tooltip"],
|
|
3738
|
+
message: "A presentation that opens a page has no tooltip."
|
|
3739
|
+
});
|
|
3740
|
+
}
|
|
3741
|
+
const protocols = [
|
|
3742
|
+
...value.scheme === void 0 ? [] : [value.scheme],
|
|
3743
|
+
...(value.addresses ?? []).map((row) => row.pattern.protocol)
|
|
3744
|
+
];
|
|
3745
|
+
if (protocols.some((protocol) => /^https?:?$/iu.test(protocol))) {
|
|
3746
|
+
ctx.addIssue({
|
|
3747
|
+
code: "custom",
|
|
3748
|
+
path: ["addresses"],
|
|
3749
|
+
message: "A web link never opens a page: use a plugin scheme."
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3665
3752
|
});
|
|
3666
3753
|
const RichViewContribution2 = z12.strictObject({
|
|
3667
3754
|
localId: LocalContributionId2,
|
|
@@ -3675,6 +3762,9 @@ function createContributionsSchemas(canonical) {
|
|
|
3675
3762
|
"sessions.create",
|
|
3676
3763
|
"artifacts.read",
|
|
3677
3764
|
"artifacts.preview",
|
|
3765
|
+
// Draws Bonsai's markdown document view in the app's page (`BonsaiMarkdownDocumentView`).
|
|
3766
|
+
// It reads and saves nothing: the app supplies the text and keeps the edits.
|
|
3767
|
+
"markdown.document-view",
|
|
3678
3768
|
"cost.read",
|
|
3679
3769
|
// Server-rated organization billing, distinct from local/provider cost.
|
|
3680
3770
|
"billing.read",
|
|
@@ -3722,6 +3812,25 @@ function createContributionsSchemas(canonical) {
|
|
|
3722
3812
|
}
|
|
3723
3813
|
}
|
|
3724
3814
|
});
|
|
3815
|
+
const UiRailBadge = z12.strictObject({
|
|
3816
|
+
source: LocalContributionId2,
|
|
3817
|
+
where: NonEmptyString3.optional(),
|
|
3818
|
+
label: z12.strictObject({
|
|
3819
|
+
one: NonEmptyString3.optional(),
|
|
3820
|
+
other: NonEmptyString3
|
|
3821
|
+
})
|
|
3822
|
+
}).superRefine((badge, ctx) => {
|
|
3823
|
+
if (badge.where === void 0)
|
|
3824
|
+
return;
|
|
3825
|
+
const parsed = parseWhere(badge.where);
|
|
3826
|
+
if (!parsed.ok) {
|
|
3827
|
+
ctx.addIssue({
|
|
3828
|
+
code: "custom",
|
|
3829
|
+
path: ["where"],
|
|
3830
|
+
message: `rail badge has an invalid where: ${parsed.message}`
|
|
3831
|
+
});
|
|
3832
|
+
}
|
|
3833
|
+
});
|
|
3725
3834
|
const UiRailEntryContribution2 = z12.strictObject({
|
|
3726
3835
|
id: LocalContributionId2,
|
|
3727
3836
|
title: NonEmptyString3,
|
|
@@ -3731,8 +3840,16 @@ function createContributionsSchemas(canonical) {
|
|
|
3731
3840
|
shortcut: NonEmptyString3.optional(),
|
|
3732
3841
|
order: z12.number().finite().optional(),
|
|
3733
3842
|
section: z12.enum(["primary", "plugins"]).optional(),
|
|
3843
|
+
badge: UiRailBadge.optional(),
|
|
3734
3844
|
panel: z12.strictObject({ body: LocalContributionId2 }).optional()
|
|
3735
3845
|
});
|
|
3846
|
+
const UiPageContribution2 = z12.strictObject({
|
|
3847
|
+
id: NonEmptyString3,
|
|
3848
|
+
title: NonEmptyString3.optional(),
|
|
3849
|
+
icon: PackageAssetPath2.optional(),
|
|
3850
|
+
companion: z12.boolean().optional(),
|
|
3851
|
+
openedEvent: NonEmptyString3.optional()
|
|
3852
|
+
});
|
|
3736
3853
|
const UiAppFields = z12.strictObject({
|
|
3737
3854
|
localId: LocalContributionId2,
|
|
3738
3855
|
displayName: NonEmptyString3,
|
|
@@ -3869,11 +3986,13 @@ function createContributionsSchemas(canonical) {
|
|
|
3869
3986
|
ReferencePresentationUriPattern: ReferencePresentationUriPattern2,
|
|
3870
3987
|
ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2,
|
|
3871
3988
|
ReferencePresentationTooltip: ReferencePresentationTooltip2,
|
|
3989
|
+
ReferencePresentationAddress: ReferencePresentationAddress2,
|
|
3872
3990
|
ReferencePresentationContribution: ReferencePresentationContribution2,
|
|
3873
3991
|
RichViewContribution: RichViewContribution2,
|
|
3874
3992
|
KayUiAppHostCapability: KayUiAppHostCapability2,
|
|
3875
3993
|
UiAppCapabilities: UiAppCapabilities2,
|
|
3876
3994
|
UiRailEntryContribution: UiRailEntryContribution2,
|
|
3995
|
+
UiPageContribution: UiPageContribution2,
|
|
3877
3996
|
UiAppContribution: UiAppContribution2,
|
|
3878
3997
|
ThemeContribution: ThemeContribution2,
|
|
3879
3998
|
CommandHandler: CommandHandler2,
|
|
@@ -3881,7 +4000,7 @@ function createContributionsSchemas(canonical) {
|
|
|
3881
4000
|
PluginContributionKind: PluginContributionKind2
|
|
3882
4001
|
};
|
|
3883
4002
|
}
|
|
3884
|
-
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, WorkflowContribution, 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, UiRailEntryContribution, UiAppContribution, ThemeContribution, CommandHandler, CommandContribution, PluginContributionKind } = createContributionsSchemas(false);
|
|
4003
|
+
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, WorkflowContribution, McpServerUrl, McpServerAuthMode, McpServerContribution, McpServerContributions, AppEventSubscription, ContextContributorContribution, PluginEventDefinitionContribution, PluginNotificationRuleContribution, UiEventSubscriptionContribution, DeviceDelegationContribution, SessionReaderContribution, UiCommandContribution, UiSlotContribution, SettingsPanelContribution, ResultRendererContribution, ReferenceOpenBehavior, ReferencePresentationVariant, ReferencePresentationVariants, ReferencePresentationUriPattern, ReferencePresentationUrlClaim, ReferencePresentationTooltip, ReferencePresentationAddress, ReferencePresentationContribution, RichViewContribution, KayUiAppHostCapability, UiAppCapabilities, UiRailEntryContribution, UiPageContribution, UiAppContribution, ThemeContribution, CommandHandler, CommandContribution, PluginContributionKind } = createContributionsSchemas(false);
|
|
3885
4004
|
var canonicalContributionSchemas = createContributionsSchemas(true);
|
|
3886
4005
|
|
|
3887
4006
|
// packages/plugin-protocol/dist/icon-shape.js
|
|
@@ -3955,7 +4074,7 @@ var KAY_UI_NATIVE_EVENT_SUBSCRIPTIONS = [
|
|
|
3955
4074
|
var KAY_UI_NATIVE_EVENT_ALLOWLIST = new Set(KAY_UI_NATIVE_EVENT_SUBSCRIPTIONS);
|
|
3956
4075
|
var RETIRED_COMPATIBILITY_KEYS = ["policy"];
|
|
3957
4076
|
function createManifestSchemas(canonical) {
|
|
3958
|
-
const { AgentRenderContribution: AgentRenderContribution2, ApprovalTypeContribution: ApprovalTypeContribution2, WorkflowContribution: WorkflowContribution2, AppDataMaterializerContribution: AppDataMaterializerContribution2, AppDataSourceContribution: AppDataSourceContribution2, AppUriModuleContribution: AppUriModuleContribution2, AppEventSubscription: AppEventSubscription2, ArtifactUriModuleContribution: ArtifactUriModuleContribution2, CliBindingContribution: CliBindingContribution2, CommandContribution: CommandContribution2, ContextContributorContribution: ContextContributorContribution2, ConverterContribution: ConverterContribution2, SessionReaderContribution: SessionReaderContribution2, DeviceDelegationContribution: DeviceDelegationContribution2, EndpointContribution: EndpointContribution2, EntityResolverContribution: EntityResolverContribution2, GitHostContribution: GitHostContribution2, McpServerContributions: McpServerContributions2, PluginEventDefinitionContribution: PluginEventDefinitionContribution2, PluginNotificationRuleContribution: PluginNotificationRuleContribution2, ResourceContribution: ResourceContribution2, ReferencePresentationContribution: ReferencePresentationContribution2, ResultRendererContribution: ResultRendererContribution2, RichViewContribution: RichViewContribution2, PluginSkillSourceDeclaration: PluginSkillSourceDeclaration2, InteractionDriverContribution: InteractionDriverContribution2, SearchProviderContribution: SearchProviderContribution2, SkillContribution: SkillContribution2, SettingsPanelContribution: SettingsPanelContribution2, ThemeContribution: ThemeContribution2, AgentToolContribution: AgentToolContribution2, ToolContribution: ToolContribution2, UiCommandContribution: UiCommandContribution2, UiAppContribution: UiAppContribution2, UiRailEntryContribution: UiRailEntryContribution2, UiEventSubscriptionContribution: UiEventSubscriptionContribution2, UiSlotContribution: UiSlotContribution2, UriModuleContribution: UriModuleContribution2, WhiteboardTypeContribution: WhiteboardTypeContribution2 } = canonical ? canonicalContributionSchemas : contributions_exports;
|
|
4077
|
+
const { AgentRenderContribution: AgentRenderContribution2, ApprovalTypeContribution: ApprovalTypeContribution2, WorkflowContribution: WorkflowContribution2, AppDataMaterializerContribution: AppDataMaterializerContribution2, AppDataSourceContribution: AppDataSourceContribution2, AppUriModuleContribution: AppUriModuleContribution2, AppEventSubscription: AppEventSubscription2, ArtifactUriModuleContribution: ArtifactUriModuleContribution2, CliBindingContribution: CliBindingContribution2, CommandContribution: CommandContribution2, ContextContributorContribution: ContextContributorContribution2, ConverterContribution: ConverterContribution2, SessionReaderContribution: SessionReaderContribution2, DeviceDelegationContribution: DeviceDelegationContribution2, EndpointContribution: EndpointContribution2, EntityResolverContribution: EntityResolverContribution2, GitHostContribution: GitHostContribution2, McpServerContributions: McpServerContributions2, PluginEventDefinitionContribution: PluginEventDefinitionContribution2, PluginNotificationRuleContribution: PluginNotificationRuleContribution2, ResourceContribution: ResourceContribution2, ReferencePresentationContribution: ReferencePresentationContribution2, ResultRendererContribution: ResultRendererContribution2, RichViewContribution: RichViewContribution2, PluginSkillSourceDeclaration: PluginSkillSourceDeclaration2, InteractionDriverContribution: InteractionDriverContribution2, SearchProviderContribution: SearchProviderContribution2, SkillContribution: SkillContribution2, SettingsPanelContribution: SettingsPanelContribution2, ThemeContribution: ThemeContribution2, AgentToolContribution: AgentToolContribution2, ToolContribution: ToolContribution2, UiCommandContribution: UiCommandContribution2, UiAppContribution: UiAppContribution2, UiRailEntryContribution: UiRailEntryContribution2, UiPageContribution: UiPageContribution2, UiEventSubscriptionContribution: UiEventSubscriptionContribution2, UiSlotContribution: UiSlotContribution2, UriModuleContribution: UriModuleContribution2, WhiteboardTypeContribution: WhiteboardTypeContribution2 } = canonical ? canonicalContributionSchemas : contributions_exports;
|
|
3959
4078
|
const { HttpsUrl: HttpsUrl2, LocalContributionId: LocalContributionId2, NonEmptyString: NonEmptyString3, PackageAssetPath: PackageAssetPath2, PluginId: PluginId2, PluginNamespace: PluginNamespace2, RegistrableDomain: RegistrableDomain2, SignedInStatusCode: SignedInStatusCode2, TargetEntrypoint: TargetEntrypoint2 } = canonical ? canonicalCommonSchemas : common_exports;
|
|
3960
4079
|
const { PluginPermissionManifest: PluginPermissionManifest2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
|
|
3961
4080
|
const KayAgentTargetManifest2 = z13.strictObject({
|
|
@@ -4078,6 +4197,7 @@ function createManifestSchemas(canonical) {
|
|
|
4078
4197
|
views: z13.array(RichViewContribution2).optional(),
|
|
4079
4198
|
apps: z13.array(UiAppContribution2).optional(),
|
|
4080
4199
|
railEntries: z13.array(UiRailEntryContribution2).optional(),
|
|
4200
|
+
pages: z13.array(UiPageContribution2).optional(),
|
|
4081
4201
|
themes: z13.array(ThemeContribution2).optional(),
|
|
4082
4202
|
eventSubscriptions: z13.array(UiEventSubscriptionContribution2).optional(),
|
|
4083
4203
|
dataMaterializers: z13.array(AppDataMaterializerContribution2).optional()
|
|
@@ -4549,6 +4669,34 @@ function createManifestSchemas(canonical) {
|
|
|
4549
4669
|
}
|
|
4550
4670
|
materializedAppDataSources.add(materializer.source);
|
|
4551
4671
|
}
|
|
4672
|
+
const declaredRowsStores = new Set(manifest.targets?.kay?.app?.contributes?.dataSources?.filter((source) => source.store?.shape === "rows").map((source) => source.localId) ?? []);
|
|
4673
|
+
for (const [index, entry] of (manifest.targets?.kay?.ui?.contributes?.railEntries ?? []).entries()) {
|
|
4674
|
+
if (entry.badge === void 0)
|
|
4675
|
+
continue;
|
|
4676
|
+
const path = [
|
|
4677
|
+
"targets",
|
|
4678
|
+
"kay",
|
|
4679
|
+
"ui",
|
|
4680
|
+
"contributes",
|
|
4681
|
+
"railEntries",
|
|
4682
|
+
index,
|
|
4683
|
+
"badge"
|
|
4684
|
+
];
|
|
4685
|
+
if (!declaredRowsStores.has(entry.badge.source)) {
|
|
4686
|
+
ctx.addIssue({
|
|
4687
|
+
code: "custom",
|
|
4688
|
+
path: [...path, "source"],
|
|
4689
|
+
message: `rail entry ${entry.id} counts ${entry.badge.source}, which is not one of this plugin's data sources with a rows store`
|
|
4690
|
+
});
|
|
4691
|
+
}
|
|
4692
|
+
if (manifest.targets?.kay?.ui?.entrypoint === void 0) {
|
|
4693
|
+
ctx.addIssue({
|
|
4694
|
+
code: "custom",
|
|
4695
|
+
path,
|
|
4696
|
+
message: `rail entry ${entry.id} declares a badge, so its plugin needs a kay.ui entrypoint: the window starts a plugin's data sources when it loads that code`
|
|
4697
|
+
});
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4552
4700
|
for (const source of declaredAppDataSources) {
|
|
4553
4701
|
if (materializedAppDataSources.has(source) || declaredAppDataStores.has(source))
|
|
4554
4702
|
continue;
|
|
@@ -4605,6 +4753,10 @@ function createManifestSchemas(canonical) {
|
|
|
4605
4753
|
...manifest.targets?.kay?.app?.contributes?.uriModules ?? []
|
|
4606
4754
|
].map((module) => module.localId));
|
|
4607
4755
|
const presentationByUriModule = /* @__PURE__ */ new Map();
|
|
4756
|
+
const declaredPageIds = /* @__PURE__ */ new Set([
|
|
4757
|
+
...(manifest.targets?.kay?.ui?.contributes?.pages ?? []).map((page) => page.id),
|
|
4758
|
+
...(manifest.targets?.kay?.ui?.contributes?.railEntries ?? []).map((entry) => entry.page)
|
|
4759
|
+
]);
|
|
4608
4760
|
for (const [index, presentation] of (manifest.targets?.kay?.ui?.contributes?.referencePresentations ?? []).entries()) {
|
|
4609
4761
|
const path = [
|
|
4610
4762
|
"targets",
|
|
@@ -4614,7 +4766,7 @@ function createManifestSchemas(canonical) {
|
|
|
4614
4766
|
"referencePresentations",
|
|
4615
4767
|
index
|
|
4616
4768
|
];
|
|
4617
|
-
if (!uriModuleIds.has(presentation.uriModule)) {
|
|
4769
|
+
if (presentation.uriModule !== void 0 && !uriModuleIds.has(presentation.uriModule)) {
|
|
4618
4770
|
ctx.addIssue({
|
|
4619
4771
|
code: "custom",
|
|
4620
4772
|
path: [...path, "uriModule"],
|
|
@@ -4628,6 +4780,15 @@ function createManifestSchemas(canonical) {
|
|
|
4628
4780
|
message: `reference presentation ${presentation.localId} references unknown ui app ${presentation.tooltip.app}`
|
|
4629
4781
|
});
|
|
4630
4782
|
}
|
|
4783
|
+
if (presentation.open.kind === "page" && !declaredPageIds.has(presentation.open.pageId)) {
|
|
4784
|
+
ctx.addIssue({
|
|
4785
|
+
code: "custom",
|
|
4786
|
+
path: [...path, "open", "pageId"],
|
|
4787
|
+
message: `reference presentation ${presentation.localId} opens page ${presentation.open.pageId}, which this manifest declares in neither pages nor railEntries`
|
|
4788
|
+
});
|
|
4789
|
+
}
|
|
4790
|
+
if (presentation.uriModule === void 0)
|
|
4791
|
+
continue;
|
|
4631
4792
|
const existing = presentationByUriModule.get(presentation.uriModule);
|
|
4632
4793
|
if (existing !== void 0) {
|
|
4633
4794
|
ctx.addIssue({
|
|
@@ -5318,7 +5479,7 @@ function boundPluginDiagnosticMessage(message) {
|
|
|
5318
5479
|
import { z as z14 } from "zod";
|
|
5319
5480
|
function createResolvedContractSchemas(canonical) {
|
|
5320
5481
|
const { PluginEventLocalId: PluginEventLocalId2 } = canonical ? canonicalPluginEventSchemas : plugin_events_exports;
|
|
5321
|
-
const { ApprovalTypeContribution: ApprovalTypeContribution2, KayUiAppHostCapability: KayUiAppHostCapability2, McpServerAuthMode: McpServerAuthMode2, McpServerUrl: McpServerUrl2, PluginContributionKind: PluginContributionKindSchema, ReferenceOpenBehavior: ReferenceOpenBehavior2, ReferencePresentationUriPattern: ReferencePresentationUriPattern2, ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2, ReferencePresentationVariants: ReferencePresentationVariants2, UriModuleFacts: UriModuleFacts2, WhiteboardTypeStorage: WhiteboardTypeStorage2 } = canonical ? canonicalContributionSchemas : contributions_exports;
|
|
5482
|
+
const { ApprovalTypeContribution: ApprovalTypeContribution2, KayUiAppHostCapability: KayUiAppHostCapability2, McpServerAuthMode: McpServerAuthMode2, McpServerUrl: McpServerUrl2, PluginContributionKind: PluginContributionKindSchema, ReferenceOpenBehavior: ReferenceOpenBehavior2, ReferencePresentationUriPattern: ReferencePresentationUriPattern2, ReferencePresentationAddress: ReferencePresentationAddress2, ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2, ReferencePresentationVariants: ReferencePresentationVariants2, UriModuleFacts: UriModuleFacts2, WhiteboardTypeStorage: WhiteboardTypeStorage2 } = canonical ? canonicalContributionSchemas : contributions_exports;
|
|
5322
5483
|
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;
|
|
5323
5484
|
const { PluginExternalCliConnect: PluginExternalCliConnect2, PluginOAuthClientSupplier: PluginOAuthClientSupplier2 } = canonical ? canonicalManifestSchemas : manifest_exports;
|
|
5324
5485
|
const { ResolvedPluginGrants: ResolvedPluginGrants2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
|
|
@@ -5481,7 +5642,10 @@ function createResolvedContractSchemas(canonical) {
|
|
|
5481
5642
|
const ResolvedReferencePresentation2 = z14.strictObject({
|
|
5482
5643
|
localId: LocalContributionId2,
|
|
5483
5644
|
globalId: GlobalContributionId2,
|
|
5484
|
-
uriModule: GlobalContributionId2,
|
|
5645
|
+
uriModule: GlobalContributionId2.optional(),
|
|
5646
|
+
/** The schemes a page-opening presentation answers for: its `scheme`, or its module's. */
|
|
5647
|
+
schemes: z14.array(UriScheme2).min(1).optional(),
|
|
5648
|
+
addresses: z14.array(ReferencePresentationAddress2).min(1).optional(),
|
|
5485
5649
|
resourceKind: NonEmptyString3,
|
|
5486
5650
|
open: ReferenceOpenBehavior2,
|
|
5487
5651
|
/** MIME-specific resource kinds; absent keys use the base presentation. */
|
|
@@ -6103,7 +6267,11 @@ function resolveKayPluginContractV1(manifest) {
|
|
|
6103
6267
|
const referencePresentations = manifest.targets?.kay?.ui?.contributes?.referencePresentations?.map((presentation) => ({
|
|
6104
6268
|
localId: presentation.localId,
|
|
6105
6269
|
globalId: resolveGlobalContributionId(namespace, presentation.localId),
|
|
6106
|
-
uriModule:
|
|
6270
|
+
...presentation.uriModule === void 0 ? {} : {
|
|
6271
|
+
uriModule: resolveGlobalContributionId(namespace, presentation.uriModule)
|
|
6272
|
+
},
|
|
6273
|
+
...presentationSchemes(manifest, presentation),
|
|
6274
|
+
...presentation.addresses === void 0 ? {} : { addresses: presentation.addresses },
|
|
6107
6275
|
resourceKind: presentation.resourceKind,
|
|
6108
6276
|
open: presentation.open,
|
|
6109
6277
|
...presentation.tooltip === void 0 ? {} : {
|
|
@@ -6188,6 +6356,19 @@ function safeResolveKayPluginContractV1(manifest) {
|
|
|
6188
6356
|
throw error;
|
|
6189
6357
|
}
|
|
6190
6358
|
}
|
|
6359
|
+
function presentationSchemes(manifest, presentation) {
|
|
6360
|
+
if (presentation.scheme !== void 0) {
|
|
6361
|
+
return { schemes: [presentation.scheme] };
|
|
6362
|
+
}
|
|
6363
|
+
if (presentation.open.kind !== "page")
|
|
6364
|
+
return {};
|
|
6365
|
+
const contributes = manifest.targets?.kay;
|
|
6366
|
+
const module = [
|
|
6367
|
+
...contributes?.agent?.contributes?.uriModules ?? [],
|
|
6368
|
+
...contributes?.app?.contributes?.uriModules ?? []
|
|
6369
|
+
].find((candidate) => candidate.localId === presentation.uriModule);
|
|
6370
|
+
return module === void 0 ? {} : { schemes: [...module.schemes] };
|
|
6371
|
+
}
|
|
6191
6372
|
function uriModuleFacts({ localId: _localId, schemes: _schemes, displayName: _displayName, authService: _authService, authScheme: _authScheme, knownResources: _knownResources, describesOperations: _describesOperations, ...facts }) {
|
|
6192
6373
|
return facts;
|
|
6193
6374
|
}
|
|
@@ -7033,6 +7214,7 @@ export {
|
|
|
7033
7214
|
RETIRED_PLUGIN_CAPABILITY_SLUGS,
|
|
7034
7215
|
RETIRED_WEB_SESSION_ROW_KEYS,
|
|
7035
7216
|
ReferenceOpenBehavior,
|
|
7217
|
+
ReferencePresentationAddress,
|
|
7036
7218
|
ReferencePresentationContribution,
|
|
7037
7219
|
ReferencePresentationTooltip,
|
|
7038
7220
|
ReferencePresentationUriPattern,
|
|
@@ -7100,6 +7282,7 @@ export {
|
|
|
7100
7282
|
UiAppContribution,
|
|
7101
7283
|
UiCommandContribution,
|
|
7102
7284
|
UiEventSubscriptionContribution,
|
|
7285
|
+
UiPageContribution,
|
|
7103
7286
|
UiRailEntryContribution,
|
|
7104
7287
|
UiSlotContribution,
|
|
7105
7288
|
UriModuleContribution,
|
|
@@ -7121,6 +7304,7 @@ export {
|
|
|
7121
7304
|
WhiteboardTypeStorage,
|
|
7122
7305
|
WhiteboardValue,
|
|
7123
7306
|
WorkflowContribution,
|
|
7307
|
+
appDataSourceDeclaration,
|
|
7124
7308
|
approvalKindSchema,
|
|
7125
7309
|
boundPluginDiagnosticMessage,
|
|
7126
7310
|
captureArtifactProvenance,
|
|
@@ -7131,10 +7315,12 @@ export {
|
|
|
7131
7315
|
configSectionKeysForManifest,
|
|
7132
7316
|
declarationsOfKind,
|
|
7133
7317
|
declaredCommandId,
|
|
7318
|
+
declaredReferencePresentations,
|
|
7134
7319
|
declaredUiIconPaths,
|
|
7135
7320
|
dedupeClaims,
|
|
7136
7321
|
deriveDirectoryPluginToolName,
|
|
7137
7322
|
evaluateCommandWhere,
|
|
7323
|
+
evaluateWhere,
|
|
7138
7324
|
finalizeArtifactProvenanceEnvelope,
|
|
7139
7325
|
findSkillSuggestionCitations,
|
|
7140
7326
|
hasClaim,
|
|
@@ -7162,6 +7348,7 @@ export {
|
|
|
7162
7348
|
parseKayUiBundleIndexV1,
|
|
7163
7349
|
parseResolvedPluginContractV1,
|
|
7164
7350
|
parseSemver,
|
|
7351
|
+
parseWhere,
|
|
7165
7352
|
pluginIconShape,
|
|
7166
7353
|
precedingPersonMessages,
|
|
7167
7354
|
readKayPluginDeclaredCompatibility,
|
|
@@ -7174,6 +7361,7 @@ export {
|
|
|
7174
7361
|
resolveSessionAncestry,
|
|
7175
7362
|
retiredCompatibilityKeysIn,
|
|
7176
7363
|
retiredPermissionAsksIn,
|
|
7364
|
+
rowMatchesWhere,
|
|
7177
7365
|
safeResolveKayPluginContractV1,
|
|
7178
7366
|
sameClaim,
|
|
7179
7367
|
satisfiesSemverRange,
|
package/package.json
CHANGED