@yaklabs-ai/plugin-sdk 0.45.0 → 0.47.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 +2 -2
- package/THIRD-PARTY-INVENTORY.json +12 -1
- package/THIRD-PARTY-NOTICES.md +216 -1
- package/dist/artifact-provenance.d.ts +956 -0
- package/dist/artifact-provenance.js +565 -0
- package/dist/canonical-transcript.d.ts +1 -0
- package/dist/canonical-transcript.js +8 -5
- package/dist/disclosure.d.ts +33 -5
- package/dist/kay-agent-testing.d.ts +63 -13
- package/dist/kay-agent.d.ts +33 -5
- package/dist/kay-agent.js +19 -8
- package/dist/kay-app.d.ts +286 -12
- package/dist/kay-app.js +73 -5
- package/dist/vendored-mcp.d.ts +17 -0
- package/dist/vendored-mcp.js +19 -8
- package/dist/whiteboard.d.ts +0 -3
- package/dist/whiteboard.js +1 -5
- package/package.json +5 -1
- package/skills/directory-plugin-authoring/SKILL.md +19 -20
package/dist/vendored-mcp.js
CHANGED
|
@@ -76,12 +76,15 @@ var REST_CAPTURE_RE = /^:([A-Za-z_][A-Za-z0-9_]*)\*$/;
|
|
|
76
76
|
var CONSTRAINED_CAPTURE_RE = /^([A-Za-z_][A-Za-z0-9_]*)(?:\((.*)\))?(\.[A-Za-z0-9]+)?$/;
|
|
77
77
|
var MAX_CAPTURE_CONSTRAINT_LENGTH = 64;
|
|
78
78
|
function compileUriClaim(claim) {
|
|
79
|
+
return compileClaim(claim);
|
|
80
|
+
}
|
|
81
|
+
function compileClaim(claim) {
|
|
79
82
|
if (claim.kind === "scheme") {
|
|
80
83
|
const scheme = normalizeProtocol(claim.scheme);
|
|
81
84
|
return {
|
|
82
85
|
claim,
|
|
83
86
|
match(input) {
|
|
84
|
-
const actual = SCHEME_RE.exec(input.trim())?.[1]?.toLowerCase();
|
|
87
|
+
const actual = typeof input === "string" ? SCHEME_RE.exec(input.trim())?.[1]?.toLowerCase() : input.scheme;
|
|
85
88
|
if (actual !== scheme)
|
|
86
89
|
return void 0;
|
|
87
90
|
return { claimKind: claim.kind };
|
|
@@ -91,8 +94,7 @@ function compileUriClaim(claim) {
|
|
|
91
94
|
const pattern = compileRoutePattern(claim.pattern);
|
|
92
95
|
const normalizeTo = claim.normalizeTo === void 0 ? void 0 : compileTemplate(claim.normalizeTo);
|
|
93
96
|
const sourceUrl = claim.kind === "uriPattern" && claim.sourceUrl !== void 0 ? compileTemplate(claim.sourceUrl) : void 0;
|
|
94
|
-
const matchAt = (
|
|
95
|
-
const parsed = parsePatternInput(target);
|
|
97
|
+
const matchAt = (parsed, selector) => {
|
|
96
98
|
if (parsed === void 0)
|
|
97
99
|
return void 0;
|
|
98
100
|
const captures = matchRoute(pattern, parsed);
|
|
@@ -118,14 +120,14 @@ function compileUriClaim(claim) {
|
|
|
118
120
|
claim,
|
|
119
121
|
match(input) {
|
|
120
122
|
if (claim.kind === "uriPattern") {
|
|
121
|
-
const { selector, rest } = parseUriConnectionSelector(input);
|
|
123
|
+
const { selector, rest } = typeof input === "string" ? parseUriConnectionSelector(input) : input.connection;
|
|
122
124
|
if (selector !== void 0) {
|
|
123
|
-
const match = matchAt(rest, selector);
|
|
125
|
+
const match = matchAt(typeof input === "string" ? parsePatternInput(rest) : input.selected, selector);
|
|
124
126
|
if (match !== void 0)
|
|
125
127
|
return match;
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
|
-
return matchAt(input, void 0);
|
|
130
|
+
return matchAt(typeof input === "string" ? parsePatternInput(input) : input.raw, void 0);
|
|
129
131
|
}
|
|
130
132
|
};
|
|
131
133
|
}
|
|
@@ -323,7 +325,16 @@ var TRANSFORMS = {
|
|
|
323
325
|
slackTimestamp: (value) => {
|
|
324
326
|
const match = /^p(\d+)(\d{6})$/.exec(value);
|
|
325
327
|
return match === null ? void 0 : `${match[1]}.${match[2]}`;
|
|
326
|
-
}
|
|
328
|
+
},
|
|
329
|
+
beforeColon: (value) => {
|
|
330
|
+
const end = value.indexOf(":");
|
|
331
|
+
return end > 0 ? value.slice(0, end) : void 0;
|
|
332
|
+
},
|
|
333
|
+
beforeTilde: (value) => {
|
|
334
|
+
const end = value.lastIndexOf("~");
|
|
335
|
+
return end > 0 ? value.slice(0, end) : void 0;
|
|
336
|
+
},
|
|
337
|
+
encoded: encodeURIComponent
|
|
327
338
|
};
|
|
328
339
|
function isTransform(name) {
|
|
329
340
|
return Object.prototype.hasOwnProperty.call(TRANSFORMS, name);
|
|
@@ -394,7 +405,7 @@ function fillTemplate(parts, captures, restCaptures) {
|
|
|
394
405
|
const transformed = TRANSFORMS[part.transform](raw);
|
|
395
406
|
if (transformed === void 0)
|
|
396
407
|
return void 0;
|
|
397
|
-
out += escapeForPosition(transformed, part.position);
|
|
408
|
+
out += part.transform === "encoded" ? transformed : escapeForPosition(transformed, part.position);
|
|
398
409
|
}
|
|
399
410
|
return out;
|
|
400
411
|
}
|
package/dist/whiteboard.d.ts
CHANGED
|
@@ -72,9 +72,6 @@ export declare const WhiteboardTypeInfo: z.ZodObject<{
|
|
|
72
72
|
displayName: z.ZodString;
|
|
73
73
|
schemaVersion: z.ZodNumber;
|
|
74
74
|
available: z.ZodBoolean;
|
|
75
|
-
presentation: z.ZodOptional<z.ZodObject<{
|
|
76
|
-
app: z.ZodString;
|
|
77
|
-
}, z.core.$strict>>;
|
|
78
75
|
}, z.core.$strict>;
|
|
79
76
|
|
|
80
77
|
export declare type WhiteboardTypeInfo = Readonly<z.infer<typeof WhiteboardTypeInfo>>;
|
package/dist/whiteboard.js
CHANGED
|
@@ -160,11 +160,7 @@ var WhiteboardTypeInfo = z4.strictObject({
|
|
|
160
160
|
typeId: GlobalContributionId,
|
|
161
161
|
displayName: NonEmptyString,
|
|
162
162
|
schemaVersion: z4.number().int().positive(),
|
|
163
|
-
available: z4.boolean()
|
|
164
|
-
/** A plugin-owned readonly presentation; absent types use the host fallback. */
|
|
165
|
-
presentation: z4.strictObject({
|
|
166
|
-
app: GlobalContributionId
|
|
167
|
-
}).optional()
|
|
163
|
+
available: z4.boolean()
|
|
168
164
|
});
|
|
169
165
|
export {
|
|
170
166
|
JsonValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaklabs-ai/plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "The Kay plugin SDK — types and helpers for authoring a Kay directory plugin.",
|
|
5
5
|
"author": "YakLabs",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./dist/disclosure.d.ts",
|
|
34
34
|
"default": "./dist/disclosure.js"
|
|
35
35
|
},
|
|
36
|
+
"./artifact-provenance": {
|
|
37
|
+
"types": "./dist/artifact-provenance.d.ts",
|
|
38
|
+
"default": "./dist/artifact-provenance.js"
|
|
39
|
+
},
|
|
36
40
|
"./signals": {
|
|
37
41
|
"types": "./dist/signals.d.ts",
|
|
38
42
|
"default": "./dist/signals.js"
|
|
@@ -43,8 +43,8 @@ pnpm create-plugin --id com.example.widgets
|
|
|
43
43
|
Run from the root of a Bonsai checkout. It writes a working plugin (manifest, entrypoint, tsconfig,
|
|
44
44
|
README) that already typechecks and loads; `--tier starter` adds a URI module, a bundled skill,
|
|
45
45
|
and a standalone `node --test` test to copy from. Add `--ui` (either tier) when the plugin needs a
|
|
46
|
-
page: it writes `ui.tsx`, declares the `
|
|
47
|
-
described below. `--ui` also needs `pnpm --filter @bonsai/ui build` once per checkout; the scaffold
|
|
46
|
+
page: it writes `ui.tsx`, declares it under the manifest's `apps`, and generates the UI typecheck
|
|
47
|
+
config described below. `--ui` also needs `pnpm --filter @bonsai/ui build` once per checkout; the scaffold
|
|
48
48
|
stops and says so when that build is missing.
|
|
49
49
|
|
|
50
50
|
Never hand-build a plugin as a tsc-compiled package and copy the output into `~/.kay/plugins/`.
|
|
@@ -122,14 +122,15 @@ a plugin you install yourself.
|
|
|
122
122
|
|
|
123
123
|
A plugin with a UI has three targets. Each declared daemon target is a bundle root, so its
|
|
124
124
|
entrypoint may import other files in the plugin; `kay.agent` runs in the daemon per session and
|
|
125
|
-
`kay.app` runs in the daemon once.
|
|
126
|
-
|
|
127
|
-
plugin
|
|
128
|
-
|
|
129
|
-
`
|
|
125
|
+
`kay.app` runs in the daemon once. A page runs in the renderer: declare it under `apps` in
|
|
126
|
+
`targets.kay.ui.contributes`, with `entrypoint.module` naming your source and `entrypoint.export`
|
|
127
|
+
the component. Bonsai compiles it when it loads the plugin, so there is no build step: relative
|
|
128
|
+
imports work within the plugin's folder, and Tailwind classes work with no setup against Bonsai's
|
|
129
|
+
theme. A page imports only `react` and `@bonsai/plugin-ui-sdk`; a `kay.ui` `entrypoint` with an
|
|
130
|
+
`activate` function is for what a declaration cannot do yet, not for pages. A page gets its own
|
|
130
131
|
activity-rail button when the manifest declares it: `railEntries` under `targets.kay.ui.contributes`,
|
|
131
|
-
with `id`, `title` and `page
|
|
132
|
-
|
|
132
|
+
with `id`, `title` and `page` (`<namespace>.<app localId>`), and optionally `icon`, `shortcut`,
|
|
133
|
+
`order` and `section`. To give the entry a sidebar, add `panel: { body }` naming
|
|
133
134
|
an app in the same manifest with `contextOnly: true`. The sidebar is always there once declared, so
|
|
134
135
|
the app shows its own empty state. To give a notification rule's toast a "Show changes" preview, add
|
|
135
136
|
a `toastPreviews` entry under `targets.kay.ui.contributes` with `rule` (the rule's `localId`), `body`
|
|
@@ -143,11 +144,11 @@ on a small white tile). Set `icon` on a rail entry to show a single-colour glyph
|
|
|
143
144
|
the plugin (`"./assets/rail.svg"`). Only its shape is used, painted in the rail's colour, so colours
|
|
144
145
|
in the file are ignored, and it must be transparent where nothing should draw. A missing file is a
|
|
145
146
|
load diagnostic and the entry falls back to the plugin icon. The page the entry opens wears the same
|
|
146
|
-
icon
|
|
147
|
+
icon. Full
|
|
147
148
|
precedence: `packages/kay-frontend-sdk/ARCHITECTURE.md`, "Plugin icon".
|
|
148
149
|
|
|
149
|
-
`ui.tsx` has no `node_modules` of its own.
|
|
150
|
-
`@bonsai
|
|
150
|
+
`ui.tsx` has no `node_modules` of its own. Bonsai compiles it and rewrites its `react` and
|
|
151
|
+
`@bonsai/plugin-ui-sdk` imports to the host's `__KAY_UI_RUNTIME__` singletons, so the agent `tsconfig.json`
|
|
151
152
|
cannot cover it, and a plugin whose UI nothing typechecks has shipped three wrong API shapes at
|
|
152
153
|
once. `pnpm create-plugin --ui` generates `tsconfig.ui.json` for exactly this: its `paths` are
|
|
153
154
|
derived from the bundler's own shim set (`uiRuntimeShimModules` in `@bonsai/ui-app-bundler`), each
|
|
@@ -155,15 +156,13 @@ specifier mapped to the type entry the renderer binds it to, and `npm run typech
|
|
|
155
156
|
configs. Do not hand-write the map; when the bundler's set changes, the scaffold's test fails and
|
|
156
157
|
the generated config follows.
|
|
157
158
|
|
|
158
|
-
|
|
159
|
+
That config typechecks `ui.tsx` as a browser module: `Bundler` resolution, automatic JSX, DOM libs,
|
|
160
|
+
no Node globals. The agent config keeps `**/*.ts`, so the two programs never overlap. Add a new page
|
|
161
|
+
file to its `include`.
|
|
159
162
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
entry exports fails to compile there (TS1362, "exported using export type"), which is the
|
|
164
|
-
compiler telling you the running extension would receive `undefined`.
|
|
165
|
-
- It typechecks `ui.tsx` alone, as a browser module: `Bundler` resolution, automatic JSX, DOM
|
|
166
|
-
libs, no Node globals. The agent config keeps `**/*.ts`, so the two programs never overlap.
|
|
163
|
+
`pnpm plugin:check` also compiles a page declared as source, so a broken import or a refused
|
|
164
|
+
`@bonsai/*` package shows up there as `kay-ui-app-compile-failed`. If a class with a variant seems
|
|
165
|
+
to do nothing, see "How a plugin page gets Tailwind" in `docs/frontend-styling.md`.
|
|
167
166
|
|
|
168
167
|
For a plugin scaffolded before `--ui` existed, scaffold a throwaway `--ui` plugin from the same
|
|
169
168
|
checkout and copy its `tsconfig.ui.json` and the second `typecheck` command into yours; `--force`
|