@yaklabs-ai/plugin-sdk 0.15.3 → 0.26.3
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 +25 -5
- package/THIRD-PARTY-INVENTORY.json +9 -9
- package/THIRD-PARTY-NOTICES.md +8 -8
- package/dist/agent-conversation.d.ts +1 -1
- package/dist/canonical-transcript.d.ts +133 -123
- package/dist/canonical-transcript.js +111 -39
- package/dist/disclosure.d.ts +1582 -744
- package/dist/disclosure.js +48 -59
- package/dist/kay-agent-testing.d.ts +2505 -590
- package/dist/kay-agent-testing.js +96 -3
- package/dist/kay-agent.d.ts +1784 -1716
- package/dist/kay-agent.js +302 -310
- package/dist/kay-app-session-summary.d.ts +999 -144
- package/dist/kay-app-session-summary.js +15 -15
- package/dist/kay-app.d.ts +3414 -830
- package/dist/kay-app.js +412 -6
- package/dist/phase-shift.d.ts +4 -4
- package/dist/system-one.d.ts +13 -0
- package/dist/time.d.ts +2 -4
- package/dist/transcript-review.d.ts +10 -0
- package/dist/transcript-review.js +104 -31
- package/dist/transcript.d.ts +8 -6
- package/dist/vendored-mcp.d.ts +434 -305
- package/dist/vendored-mcp.js +278 -101
- package/dist/whiteboard.d.ts +82 -0
- package/dist/whiteboard.js +174 -0
- package/package.json +5 -1
package/dist/vendored-mcp.js
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
+
// packages/vendored-mcp-integration/dist/facts.js
|
|
2
|
+
var MAX_HINT_FLOWS = 3;
|
|
3
|
+
var MAX_TRIGGER_KEYWORDS = 8;
|
|
4
|
+
var ROUTE_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
5
|
+
function vendoredMcpUriModuleFacts(descriptor) {
|
|
6
|
+
const { namespace, displayName, summary } = descriptor;
|
|
7
|
+
const schemeRoot = `${namespace}://`;
|
|
8
|
+
return {
|
|
9
|
+
description: summary,
|
|
10
|
+
agentHint: {
|
|
11
|
+
summary,
|
|
12
|
+
commonFlows: descriptor.routes.slice(0, MAX_HINT_FLOWS).map((route) => ({
|
|
13
|
+
label: route.description,
|
|
14
|
+
example: `read(path: "${route.example}")`
|
|
15
|
+
})),
|
|
16
|
+
triggers: {
|
|
17
|
+
keywords: descriptor.triggerKeywords.slice(0, MAX_TRIGGER_KEYWORDS)
|
|
18
|
+
},
|
|
19
|
+
helpUri: schemeRoot,
|
|
20
|
+
skills: [...descriptor.skills]
|
|
21
|
+
},
|
|
22
|
+
verbs: {
|
|
23
|
+
readable: true,
|
|
24
|
+
writable: false,
|
|
25
|
+
editable: false,
|
|
26
|
+
listable: false
|
|
27
|
+
},
|
|
28
|
+
verbDocs: {
|
|
29
|
+
read: `Returns a reference card for a ${displayName} resource: what it is, its ids, and the ${displayName} URL that opens it. Reading calls no ${displayName} API.`
|
|
30
|
+
},
|
|
31
|
+
templates: descriptor.routes.map((route) => ({
|
|
32
|
+
uri: route.uri,
|
|
33
|
+
description: route.description,
|
|
34
|
+
operations: ["read"]
|
|
35
|
+
})),
|
|
36
|
+
// The scheme claim is added here rather than asked for: a module with no `{ kind: "scheme" }`
|
|
37
|
+
// claim fails the SDK's disclosure floor (`scheme-claim-missing`). It follows the route claims
|
|
38
|
+
// so a route's link is found first; the claim lookup reads the first match that declares one.
|
|
39
|
+
claims: [
|
|
40
|
+
...descriptor.routes.map((route) => {
|
|
41
|
+
const [, authority = "", pathname = ""] = /^[^:]+:\/\/([^/?#]+)(\/[^?#]*)$/.exec(route.uri) ?? [];
|
|
42
|
+
return {
|
|
43
|
+
kind: "uriPattern",
|
|
44
|
+
pattern: { protocol: namespace, hostname: authority, pathname },
|
|
45
|
+
normalizeTo: route.uri,
|
|
46
|
+
route: routeId(route.uri),
|
|
47
|
+
sourceUrl: route.webUrl
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
{ kind: "scheme", scheme: namespace },
|
|
51
|
+
...descriptor.claims.filter((claim) => claim.kind !== "scheme").map(copyClaim)
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function routeId(uri) {
|
|
56
|
+
const path = uri.replace(/^[^:]+:\/\//, "");
|
|
57
|
+
const segments = path.split("/");
|
|
58
|
+
const fixed = segments.filter((segment) => !segment.startsWith(":"));
|
|
59
|
+
const words = (fixed.length > 0 ? fixed : segments.map((s) => s.slice(1))).join("-").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
60
|
+
const id = ROUTE_RE.test(words) ? words : `route-${words}`;
|
|
61
|
+
return id;
|
|
62
|
+
}
|
|
63
|
+
function copyClaim(claim) {
|
|
64
|
+
const { examples, ...rest } = claim;
|
|
65
|
+
return {
|
|
66
|
+
...rest,
|
|
67
|
+
pattern: { ...rest.pattern },
|
|
68
|
+
...examples !== void 0 ? { examples: [...examples] } : {}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
1
72
|
// packages/herd-uri/dist/claims.js
|
|
2
73
|
var SCHEME_RE = /^([a-z][a-z0-9+.-]*):\/\//i;
|
|
3
74
|
var CAPTURE_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -18,57 +89,111 @@ function compileUriClaim(claim) {
|
|
|
18
89
|
};
|
|
19
90
|
}
|
|
20
91
|
const pattern = compileRoutePattern(claim.pattern);
|
|
92
|
+
const normalizeTo = claim.normalizeTo === void 0 ? void 0 : compileTemplate(claim.normalizeTo);
|
|
93
|
+
const sourceUrl = claim.kind === "uriPattern" && claim.sourceUrl !== void 0 ? compileTemplate(claim.sourceUrl) : void 0;
|
|
94
|
+
const matchAt = (target, selector) => {
|
|
95
|
+
const parsed = parsePatternInput(target);
|
|
96
|
+
if (parsed === void 0)
|
|
97
|
+
return void 0;
|
|
98
|
+
const captures = matchRoute(pattern, parsed);
|
|
99
|
+
if (captures === void 0)
|
|
100
|
+
return void 0;
|
|
101
|
+
const restCaptures = pattern.restCaptures ?? [];
|
|
102
|
+
const normalized = normalizeTo === void 0 ? void 0 : fillTemplate(normalizeTo, captures, restCaptures);
|
|
103
|
+
if (normalizeTo !== void 0 && normalized === void 0)
|
|
104
|
+
return void 0;
|
|
105
|
+
const filledSourceUrl = sourceUrl === void 0 ? void 0 : fillTemplate(sourceUrl, captures, restCaptures);
|
|
106
|
+
return {
|
|
107
|
+
claimKind: claim.kind,
|
|
108
|
+
...Object.keys(captures).length > 0 ? { captures } : {},
|
|
109
|
+
...normalized !== void 0 ? {
|
|
110
|
+
normalizedUri: withSelector(withInputSearch(claim, pattern, parsed, normalized), parsed.protocol, selector)
|
|
111
|
+
} : {},
|
|
112
|
+
...claim.route !== void 0 ? { route: claim.route } : {},
|
|
113
|
+
...filledSourceUrl !== void 0 ? { sourceUrl: filledSourceUrl } : {},
|
|
114
|
+
...claim.kind === "uriPattern" && claim.title !== void 0 ? { title: fillTitle(claim.title, captures) } : {}
|
|
115
|
+
};
|
|
116
|
+
};
|
|
21
117
|
return {
|
|
22
118
|
claim,
|
|
23
119
|
match(input) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...claim.normalizeTo !== void 0 ? {
|
|
34
|
-
normalizedUri: withInputSearch(claim, pattern, parsed, interpolateNormalizeTo(claim.normalizeTo, captures, pattern.restCaptures ?? []))
|
|
35
|
-
} : {}
|
|
36
|
-
};
|
|
120
|
+
if (claim.kind === "uriPattern") {
|
|
121
|
+
const { selector, rest } = parseUriConnectionSelector(input);
|
|
122
|
+
if (selector !== void 0) {
|
|
123
|
+
const match = matchAt(rest, selector);
|
|
124
|
+
if (match !== void 0)
|
|
125
|
+
return match;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return matchAt(input, void 0);
|
|
37
129
|
}
|
|
38
130
|
};
|
|
39
131
|
}
|
|
132
|
+
function fillTitle(template, captures) {
|
|
133
|
+
return template.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, (written, name) => captures[name] ?? written);
|
|
134
|
+
}
|
|
135
|
+
var CONNECTION_SELECTOR_RE = /^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)@([^/]+)(?:\/(.*))?$/;
|
|
136
|
+
function parseUriConnectionSelector(input) {
|
|
137
|
+
const match = CONNECTION_SELECTOR_RE.exec(input.trim());
|
|
138
|
+
if (match?.[1] === void 0 || match[2] === void 0) {
|
|
139
|
+
return { rest: input };
|
|
140
|
+
}
|
|
141
|
+
return { selector: match[2], rest: `${match[1]}${match[3] ?? ""}` };
|
|
142
|
+
}
|
|
143
|
+
function withSelector(normalized, inputProtocol, selector) {
|
|
144
|
+
if (selector === void 0)
|
|
145
|
+
return normalized;
|
|
146
|
+
if (templateProtocol(normalized) !== inputProtocol)
|
|
147
|
+
return normalized;
|
|
148
|
+
const schemeEnd = normalized.indexOf("://") + 3;
|
|
149
|
+
return `${normalized.slice(0, schemeEnd)}@${selector}/${normalized.slice(schemeEnd)}`;
|
|
150
|
+
}
|
|
40
151
|
function normalizeProtocol(value) {
|
|
41
152
|
return value.replace(/:$/, "").toLowerCase();
|
|
42
153
|
}
|
|
43
154
|
function parsePatternInput(input) {
|
|
155
|
+
const trimmed = input.trim();
|
|
156
|
+
let url;
|
|
44
157
|
try {
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
protocol: normalizeProtocol(url.protocol),
|
|
48
|
-
hostname: url.hostname.toLowerCase(),
|
|
49
|
-
pathname: url.pathname,
|
|
50
|
-
search: url.search.startsWith("?") ? url.search.slice(1) : url.search
|
|
51
|
-
};
|
|
158
|
+
url = new URL(trimmed);
|
|
52
159
|
} catch {
|
|
53
|
-
|
|
160
|
+
if (!trimmed.includes(" "))
|
|
161
|
+
return void 0;
|
|
162
|
+
try {
|
|
163
|
+
url = new URL(trimmed.replaceAll(" ", "%20"));
|
|
164
|
+
} catch {
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
54
167
|
}
|
|
168
|
+
return {
|
|
169
|
+
protocol: normalizeProtocol(url.protocol),
|
|
170
|
+
// A web host arrives lowercased; a custom scheme's keeps its case, so a capture of it
|
|
171
|
+
// (`projects://Acme`) names it as written. Literal host parts match either case.
|
|
172
|
+
hostname: url.hostname,
|
|
173
|
+
pathname: url.pathname,
|
|
174
|
+
search: url.search.startsWith("?") ? url.search.slice(1) : url.search
|
|
175
|
+
};
|
|
55
176
|
}
|
|
56
177
|
function compileRoutePattern(pattern) {
|
|
57
178
|
const pathname = pattern.pathname !== void 0 ? compileParts(pattern.pathname, "/", { allowRest: true }) : void 0;
|
|
58
179
|
return {
|
|
59
180
|
...pattern.protocol !== void 0 ? { protocol: normalizeProtocol(pattern.protocol) } : {},
|
|
60
|
-
...pattern.hostname !== void 0 ? {
|
|
181
|
+
...pattern.hostname !== void 0 ? {
|
|
182
|
+
hostname: compileParts(pattern.hostname.toLowerCase(), LONE_CAPTURE_RE.test(pattern.hostname) ? void 0 : ".")
|
|
183
|
+
} : {},
|
|
61
184
|
...pathname !== void 0 ? { pathname } : {},
|
|
185
|
+
...pattern.pathname?.endsWith("/") === true ? { pathnameEndsInSlash: true } : {},
|
|
62
186
|
...pathname !== void 0 ? {
|
|
63
187
|
restCaptures: pathname.filter((part) => part.rest === true).map((part) => part.capture)
|
|
64
188
|
} : {},
|
|
65
189
|
...pattern.search !== void 0 ? { search: compileParts(pattern.search.replace(/^\?/, ""), "&") } : {}
|
|
66
190
|
};
|
|
67
191
|
}
|
|
192
|
+
var LONE_CAPTURE_RE = /^:[A-Za-z_][A-Za-z0-9_]*(?:\([^()|]*\))?$/;
|
|
68
193
|
function compileParts(value, separator, options = {}) {
|
|
69
194
|
if (value === "")
|
|
70
195
|
return [];
|
|
71
|
-
const parts = value.split(separator);
|
|
196
|
+
const parts = separator === void 0 ? [value] : value.split(separator);
|
|
72
197
|
return parts.map((part, index) => {
|
|
73
198
|
const restMatch = REST_CAPTURE_RE.exec(part);
|
|
74
199
|
if (restMatch !== null) {
|
|
@@ -108,19 +233,30 @@ function matchRoute(pattern, input) {
|
|
|
108
233
|
return void 0;
|
|
109
234
|
}
|
|
110
235
|
const captures = {};
|
|
111
|
-
if (pattern.hostname !== void 0 && !matchParts(pattern.hostname, input.hostname, ".", captures)) {
|
|
236
|
+
if (pattern.hostname !== void 0 && !matchParts(pattern.hostname, input.hostname, isLoneCapture(pattern.hostname) ? void 0 : ".", captures, true)) {
|
|
112
237
|
return void 0;
|
|
113
238
|
}
|
|
114
|
-
if (pattern.pathname !== void 0 && !matchParts(pattern.pathname, input.pathname, "/", captures)) {
|
|
239
|
+
if (pattern.pathname !== void 0 && !matchParts(pattern.pathname, pattern.pathnameEndsInSlash === true ? input.pathname : withoutTrailingSlash(input), "/", captures)) {
|
|
115
240
|
return void 0;
|
|
116
241
|
}
|
|
117
|
-
if (pattern.search !== void 0 && !matchParts(pattern.search, input.search, "&", captures)) {
|
|
242
|
+
if (pattern.search !== void 0 && (pattern.search.length === 0 ? input.search !== "" : !matchParts(pattern.search, input.search, "&", captures))) {
|
|
118
243
|
return void 0;
|
|
119
244
|
}
|
|
120
245
|
return captures;
|
|
121
246
|
}
|
|
122
|
-
function
|
|
123
|
-
const
|
|
247
|
+
function withoutTrailingSlash(input) {
|
|
248
|
+
const { hostname, pathname } = input;
|
|
249
|
+
if (!pathname.endsWith("/") || pathname.endsWith("//"))
|
|
250
|
+
return pathname;
|
|
251
|
+
if (pathname === "/" && hostname === "")
|
|
252
|
+
return pathname;
|
|
253
|
+
return pathname.slice(0, -1);
|
|
254
|
+
}
|
|
255
|
+
function isLoneCapture(pattern) {
|
|
256
|
+
return pattern.length === 1 && pattern[0].capture !== void 0 && pattern[0].rest !== true;
|
|
257
|
+
}
|
|
258
|
+
function matchParts(pattern, value, separator, captures, foldLiterals = false) {
|
|
259
|
+
const parts = separator === void 0 ? [value] : value.split(separator);
|
|
124
260
|
let partIndex = 0;
|
|
125
261
|
for (let i = 0; i < pattern.length; i += 1) {
|
|
126
262
|
const expected = pattern[i];
|
|
@@ -128,7 +264,7 @@ function matchParts(pattern, value, separator, captures) {
|
|
|
128
264
|
const remaining = parts.slice(partIndex);
|
|
129
265
|
if (remaining.every((part) => part === ""))
|
|
130
266
|
return false;
|
|
131
|
-
captures[expected.capture] = remaining.join(separator);
|
|
267
|
+
captures[expected.capture] = remaining.join(separator ?? "");
|
|
132
268
|
return true;
|
|
133
269
|
}
|
|
134
270
|
if (partIndex >= parts.length)
|
|
@@ -143,8 +279,9 @@ function matchParts(pattern, value, separator, captures) {
|
|
|
143
279
|
partIndex += 1;
|
|
144
280
|
continue;
|
|
145
281
|
}
|
|
146
|
-
if (expected.literal !== actual)
|
|
282
|
+
if (expected.literal !== (foldLiterals ? actual.toLowerCase() : actual)) {
|
|
147
283
|
return false;
|
|
284
|
+
}
|
|
148
285
|
partIndex += 1;
|
|
149
286
|
}
|
|
150
287
|
return partIndex === parts.length;
|
|
@@ -165,31 +302,116 @@ function withInputSearch(claim, pattern, input, normalized) {
|
|
|
165
302
|
function templateProtocol(template) {
|
|
166
303
|
return SCHEME_RE.exec(template)?.[1]?.toLowerCase();
|
|
167
304
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
});
|
|
179
|
-
|
|
305
|
+
var TEMPLATE_TOKEN_RE = /\{([A-Za-z][A-Za-z0-9]*)\(([^)]*)\)\}|:([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
306
|
+
var TRANSFORMS = {
|
|
307
|
+
base64: (value) => {
|
|
308
|
+
const bytes = new TextEncoder().encode(value);
|
|
309
|
+
let binary = "";
|
|
310
|
+
for (const byte of bytes)
|
|
311
|
+
binary += String.fromCharCode(byte);
|
|
312
|
+
return btoa(binary).replace(/=+$/, "");
|
|
313
|
+
},
|
|
314
|
+
slackTimestamp: (value) => {
|
|
315
|
+
const match = /^p(\d+)(\d{6})$/.exec(value);
|
|
316
|
+
return match === null ? void 0 : `${match[1]}.${match[2]}`;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
function isTransform(name) {
|
|
320
|
+
return Object.prototype.hasOwnProperty.call(TRANSFORMS, name);
|
|
321
|
+
}
|
|
322
|
+
function compileTemplate(template) {
|
|
323
|
+
const parts = [];
|
|
324
|
+
let last = 0;
|
|
325
|
+
for (const token of template.matchAll(TEMPLATE_TOKEN_RE)) {
|
|
326
|
+
const offset = token.index;
|
|
327
|
+
if (offset > last)
|
|
328
|
+
parts.push({ literal: template.slice(last, offset) });
|
|
329
|
+
const position = templatePosition(template, offset);
|
|
330
|
+
const [full, transform = "", inner = "", capture] = token;
|
|
331
|
+
if (capture !== void 0) {
|
|
332
|
+
parts.push({ capture, position });
|
|
333
|
+
} else {
|
|
334
|
+
if (!isTransform(transform)) {
|
|
335
|
+
throw new Error(`Unknown URI claim template transform '${transform}'.`);
|
|
336
|
+
}
|
|
337
|
+
parts.push({
|
|
338
|
+
transform,
|
|
339
|
+
inner: compileTransformInput(inner),
|
|
340
|
+
position
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
last = offset + full.length;
|
|
344
|
+
}
|
|
345
|
+
if (last < template.length)
|
|
346
|
+
parts.push({ literal: template.slice(last) });
|
|
347
|
+
return parts;
|
|
180
348
|
}
|
|
181
|
-
function
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
349
|
+
function compileTransformInput(text) {
|
|
350
|
+
const parts = [];
|
|
351
|
+
let last = 0;
|
|
352
|
+
for (const token of text.matchAll(/:([A-Za-z_][A-Za-z0-9_]*)/g)) {
|
|
353
|
+
if (token.index > last)
|
|
354
|
+
parts.push({ literal: text.slice(last, token.index) });
|
|
355
|
+
parts.push({ capture: token[1] });
|
|
356
|
+
last = token.index + token[0].length;
|
|
357
|
+
}
|
|
358
|
+
if (last < text.length)
|
|
359
|
+
parts.push({ literal: text.slice(last) });
|
|
360
|
+
return parts;
|
|
361
|
+
}
|
|
362
|
+
function fillTemplate(parts, captures, restCaptures) {
|
|
363
|
+
let out = "";
|
|
364
|
+
for (const part of parts) {
|
|
365
|
+
if ("literal" in part) {
|
|
366
|
+
out += part.literal;
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
if ("capture" in part) {
|
|
370
|
+
const value = captures[part.capture];
|
|
371
|
+
if (value === void 0) {
|
|
372
|
+
out += `:${part.capture}`;
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
const escaped = restCaptures.includes(part.capture) ? escapeRestCapture(value) : escapeForPosition(value, part.position);
|
|
376
|
+
if (escaped === void 0)
|
|
377
|
+
return void 0;
|
|
378
|
+
out += escaped;
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
let raw = "";
|
|
382
|
+
for (const inner of part.inner) {
|
|
383
|
+
raw += "literal" in inner ? inner.literal : captures[inner.capture] ?? `:${inner.capture}`;
|
|
384
|
+
}
|
|
385
|
+
const transformed = TRANSFORMS[part.transform](raw);
|
|
386
|
+
if (transformed === void 0)
|
|
387
|
+
return void 0;
|
|
388
|
+
out += escapeForPosition(transformed, part.position);
|
|
389
|
+
}
|
|
390
|
+
return out;
|
|
186
391
|
}
|
|
187
|
-
function
|
|
392
|
+
function templatePosition(template, offset) {
|
|
188
393
|
const prefix = template.slice(0, offset);
|
|
394
|
+
if (prefix.includes("#"))
|
|
395
|
+
return "fragment";
|
|
396
|
+
if (prefix.includes("?"))
|
|
397
|
+
return "query";
|
|
189
398
|
const schemeIndex = prefix.lastIndexOf("://");
|
|
190
|
-
if (schemeIndex
|
|
191
|
-
return
|
|
192
|
-
|
|
399
|
+
if (schemeIndex !== -1 && !prefix.slice(schemeIndex + 3).includes("/")) {
|
|
400
|
+
return "host";
|
|
401
|
+
}
|
|
402
|
+
return "path";
|
|
403
|
+
}
|
|
404
|
+
function escapeForPosition(value, position) {
|
|
405
|
+
if (position === "host")
|
|
406
|
+
return encodeURIComponent(value.toLowerCase());
|
|
407
|
+
return encodeURIComponent(value).replace(/%(?:3A|40)/gi, (code) => decodeURIComponent(code));
|
|
408
|
+
}
|
|
409
|
+
function escapeRestCapture(value) {
|
|
410
|
+
const segments = value.split("/").map(safeDecode);
|
|
411
|
+
if (segments.some((segment) => segment === "." || segment === "..")) {
|
|
412
|
+
return void 0;
|
|
413
|
+
}
|
|
414
|
+
return segments.map(encodeURIComponent).join("/");
|
|
193
415
|
}
|
|
194
416
|
|
|
195
417
|
// packages/herd-uri/dist/errors.js
|
|
@@ -378,52 +600,22 @@ function captureNames(template) {
|
|
|
378
600
|
}
|
|
379
601
|
|
|
380
602
|
// packages/vendored-mcp-integration/dist/uri-module.js
|
|
381
|
-
var MAX_HINT_FLOWS = 3;
|
|
382
|
-
var MAX_TRIGGER_KEYWORDS = 8;
|
|
383
603
|
function createVendoredMcpUriModule(descriptor) {
|
|
384
604
|
const { namespace, displayName, resourceKind, summary, mcpServerName, mcpSummary } = descriptor;
|
|
385
605
|
const schemeRoot = `${namespace}://`;
|
|
386
606
|
const compiled = compileRoutes(namespace, descriptor.routes);
|
|
607
|
+
const facts = vendoredMcpUriModuleFacts(descriptor);
|
|
387
608
|
return {
|
|
388
609
|
id: descriptor.moduleId,
|
|
389
610
|
title: displayName,
|
|
390
|
-
|
|
391
|
-
// The scheme claim is added here rather than asked for: a module with no `{ kind: "scheme" }`
|
|
392
|
-
// claim fails the SDK's disclosure floor (`scheme-claim-missing`), and for a directory-origin
|
|
393
|
-
// plugin that is a load-time rejection. Every descriptor gets it right by construction.
|
|
394
|
-
claims: [{ kind: "scheme", scheme: namespace }, ...descriptor.claims],
|
|
395
|
-
agentHint: {
|
|
396
|
-
summary,
|
|
397
|
-
triggers: {
|
|
398
|
-
keywords: descriptor.triggerKeywords.slice(0, MAX_TRIGGER_KEYWORDS)
|
|
399
|
-
},
|
|
400
|
-
commonFlows: descriptor.routes.slice(0, MAX_HINT_FLOWS).map((route) => ({
|
|
401
|
-
label: route.description,
|
|
402
|
-
example: `read(path: "${route.example}")`
|
|
403
|
-
})),
|
|
404
|
-
helpUri: schemeRoot,
|
|
405
|
-
skills: [...descriptor.skills]
|
|
406
|
-
},
|
|
407
|
-
verbs: {
|
|
408
|
-
readable: true,
|
|
409
|
-
listable: false,
|
|
410
|
-
writable: false,
|
|
411
|
-
editable: false
|
|
412
|
-
},
|
|
413
|
-
verbDocs: {
|
|
414
|
-
read: `Returns a reference card for a ${displayName} resource: what it is, its ids, and the ${displayName} URL that opens it. Reading calls no ${displayName} API.`
|
|
415
|
-
},
|
|
611
|
+
...facts,
|
|
416
612
|
async help(input) {
|
|
417
613
|
return basicUriHelp({
|
|
418
614
|
uri: input,
|
|
419
615
|
title: displayName,
|
|
420
616
|
summary: `${summary} Kay recognises ${displayName} web links and stores them as ${schemeRoot} URIs. Use the '${mcpServerName}' MCP server for anything beyond the reference card: ${mcpSummary}`,
|
|
421
617
|
operations: ["help", "read"],
|
|
422
|
-
templates:
|
|
423
|
-
uri: route.uri,
|
|
424
|
-
description: route.description,
|
|
425
|
-
operations: ["read"]
|
|
426
|
-
})),
|
|
618
|
+
templates: facts.templates,
|
|
427
619
|
examples: descriptor.routes.map((route) => ({
|
|
428
620
|
task: route.description,
|
|
429
621
|
uri: route.example,
|
|
@@ -431,17 +623,6 @@ function createVendoredMcpUriModule(descriptor) {
|
|
|
431
623
|
}))
|
|
432
624
|
});
|
|
433
625
|
},
|
|
434
|
-
matches: (input) => input.trim().toLowerCase().startsWith(schemeRoot),
|
|
435
|
-
describe(input) {
|
|
436
|
-
const match = matchRoute2(compiled, input);
|
|
437
|
-
if (match === void 0)
|
|
438
|
-
return void 0;
|
|
439
|
-
return {
|
|
440
|
-
uri: match.canonicalUri,
|
|
441
|
-
title: referenceTitle(match, resourceKind),
|
|
442
|
-
sourceUrl: match.webUrl
|
|
443
|
-
};
|
|
444
|
-
},
|
|
445
626
|
async read(input) {
|
|
446
627
|
const match = matchRoute2(compiled, input);
|
|
447
628
|
if (match === void 0) {
|
|
@@ -461,11 +642,7 @@ function createVendoredMcpUriModule(descriptor) {
|
|
|
461
642
|
}
|
|
462
643
|
};
|
|
463
644
|
}
|
|
464
|
-
function referenceTitle(match, resourceKind) {
|
|
465
|
-
const values = Object.values(match.ids);
|
|
466
|
-
const last = values.at(-1);
|
|
467
|
-
return last === void 0 || last.length === 0 ? resourceKind : last;
|
|
468
|
-
}
|
|
469
645
|
export {
|
|
470
|
-
createVendoredMcpUriModule
|
|
646
|
+
createVendoredMcpUriModule,
|
|
647
|
+
vendoredMcpUriModuleFacts
|
|
471
648
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export declare const JsonSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
4
|
+
|
|
5
|
+
export declare type JsonSchema = z.infer<typeof JsonSchema>;
|
|
6
|
+
|
|
7
|
+
export declare type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
8
|
+
[key: string]: JsonValue;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export declare const JsonValue: z.ZodType<JsonValue>;
|
|
12
|
+
|
|
13
|
+
export declare const WhiteboardEntryEnvelope: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
typeId: z.ZodString;
|
|
16
|
+
schemaVersion: z.ZodNumber;
|
|
17
|
+
title: z.ZodString;
|
|
18
|
+
authorSessionId: z.ZodNullable<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
|
|
21
|
+
export declare type WhiteboardEntryEnvelope = Readonly<z.infer<typeof WhiteboardEntryEnvelope>>;
|
|
22
|
+
|
|
23
|
+
export declare const WhiteboardEntryInfo: z.ZodObject<{
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
revision: z.ZodString;
|
|
26
|
+
entry: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
typeId: z.ZodString;
|
|
29
|
+
schemaVersion: z.ZodNumber;
|
|
30
|
+
title: z.ZodString;
|
|
31
|
+
authorSessionId: z.ZodNullable<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
state: z.ZodEnum<{
|
|
34
|
+
unavailable: "unavailable";
|
|
35
|
+
available: "available";
|
|
36
|
+
"unsupported-version": "unsupported-version";
|
|
37
|
+
invalid: "invalid";
|
|
38
|
+
}>;
|
|
39
|
+
mutable: z.ZodBoolean;
|
|
40
|
+
diagnostics: z.ZodArray<z.ZodString>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
|
|
43
|
+
export declare type WhiteboardEntryInfo = Readonly<z.infer<typeof WhiteboardEntryInfo>>;
|
|
44
|
+
|
|
45
|
+
export declare const WhiteboardEntryInspection: z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
revision: z.ZodString;
|
|
48
|
+
entry: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
typeId: z.ZodString;
|
|
51
|
+
schemaVersion: z.ZodNumber;
|
|
52
|
+
title: z.ZodString;
|
|
53
|
+
authorSessionId: z.ZodNullable<z.ZodString>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
|
+
state: z.ZodEnum<{
|
|
56
|
+
unavailable: "unavailable";
|
|
57
|
+
available: "available";
|
|
58
|
+
"unsupported-version": "unsupported-version";
|
|
59
|
+
invalid: "invalid";
|
|
60
|
+
}>;
|
|
61
|
+
mutable: z.ZodBoolean;
|
|
62
|
+
diagnostics: z.ZodArray<z.ZodString>;
|
|
63
|
+
value: z.ZodOptional<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
64
|
+
text: z.ZodString;
|
|
65
|
+
truncated: z.ZodBoolean;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
|
|
68
|
+
export declare type WhiteboardEntryInspection = Readonly<z.infer<typeof WhiteboardEntryInspection>>;
|
|
69
|
+
|
|
70
|
+
export declare const WhiteboardTypeInfo: z.ZodObject<{
|
|
71
|
+
typeId: z.ZodString;
|
|
72
|
+
displayName: z.ZodString;
|
|
73
|
+
schemaVersion: z.ZodNumber;
|
|
74
|
+
available: z.ZodBoolean;
|
|
75
|
+
presentation: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
app: z.ZodString;
|
|
77
|
+
}, z.core.$strict>>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
|
|
80
|
+
export declare type WhiteboardTypeInfo = Readonly<z.infer<typeof WhiteboardTypeInfo>>;
|
|
81
|
+
|
|
82
|
+
export { }
|