@yaklabs-ai/plugin-sdk 0.10.0 → 0.12.2
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 +13 -20
- package/THIRD-PARTY-NOTICES.md +12 -36
- package/dist/disclosure.d.ts +511 -27
- package/dist/disclosure.js +30 -0
- package/dist/jev.d.ts +145 -18
- package/dist/jev.js +14 -0
- package/dist/kay-agent-testing.d.ts +563 -43
- package/dist/kay-agent-testing.js +124 -1
- package/dist/kay-agent.d.ts +644 -42
- package/dist/kay-agent.js +126 -0
- package/dist/kay-app.d.ts +686 -73
- package/dist/kay-app.js +126 -0
- package/dist/signals.d.ts +113 -18
- package/dist/signals.js +4 -0
- package/package.json +2 -3
package/dist/kay-agent.js
CHANGED
|
@@ -115,6 +115,26 @@ function filesystemStampDigest(revision) {
|
|
|
115
115
|
return parts.length === 6 ? parts[5] : void 0;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
// packages/herd-uri/dist/produced-resources.js
|
|
119
|
+
var SCHEME_URI = /^[a-z][a-z0-9+.-]*:\/\/./;
|
|
120
|
+
var WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]./;
|
|
121
|
+
function isProducedResourceUri(value) {
|
|
122
|
+
if (typeof value !== "string" || value.trim() !== value)
|
|
123
|
+
return false;
|
|
124
|
+
return SCHEME_URI.test(value) || value.startsWith("/") && value.length > 1 || WINDOWS_ABSOLUTE_PATH.test(value);
|
|
125
|
+
}
|
|
126
|
+
function isProducedResourceDeclaration(value) {
|
|
127
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
const keys = Object.keys(value);
|
|
131
|
+
if (keys.length !== 2 || !keys.includes("uri") || !keys.includes("action")) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
const record = value;
|
|
135
|
+
return isProducedResourceUri(record.uri) && (record.action === "created" || record.action === "updated");
|
|
136
|
+
}
|
|
137
|
+
|
|
118
138
|
// packages/herd-uri/dist/template-route.js
|
|
119
139
|
var PLACEHOLDER_RE = /<([^<>]+)>/g;
|
|
120
140
|
var REST_SUFFIX = "...";
|
|
@@ -580,6 +600,19 @@ function capability(spec) {
|
|
|
580
600
|
}
|
|
581
601
|
|
|
582
602
|
// packages/plugin-sdk/dist/jev.js
|
|
603
|
+
var JevCallError = class extends Error {
|
|
604
|
+
transport;
|
|
605
|
+
kind;
|
|
606
|
+
/** The final attempt's HTTP status, when a response arrived. */
|
|
607
|
+
status;
|
|
608
|
+
constructor(init) {
|
|
609
|
+
super(`Jev call failed on the ${init.transport} route: ${init.kind}${init.status === void 0 ? "" : ` (HTTP ${init.status})`}.`);
|
|
610
|
+
this.name = "JevCallError";
|
|
611
|
+
this.transport = init.transport;
|
|
612
|
+
this.kind = init.kind;
|
|
613
|
+
this.status = init.status;
|
|
614
|
+
}
|
|
615
|
+
};
|
|
583
616
|
function createFallbackOnlyWithJev() {
|
|
584
617
|
return async (_use, fallback, options = {}) => {
|
|
585
618
|
if (typeof fallback !== "function") {
|
|
@@ -887,6 +920,59 @@ function toToolParameters(schema) {
|
|
|
887
920
|
return rest;
|
|
888
921
|
}
|
|
889
922
|
|
|
923
|
+
// packages/herd-agent/dist/core/is-object.js
|
|
924
|
+
function isObject(value) {
|
|
925
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// packages/herd-agent/dist/core/tools/produced-resources.js
|
|
929
|
+
var DECLARATIONS = Symbol.for("herd.producedResources.declarations");
|
|
930
|
+
function declareProducedResources(result, declarations) {
|
|
931
|
+
const details = declarableDetails(result.details);
|
|
932
|
+
const claims = [...claimsOn(details), ...claimsFrom(declarations)];
|
|
933
|
+
const next = { ...details };
|
|
934
|
+
if (claims.length > 0)
|
|
935
|
+
next[DECLARATIONS] = Object.freeze(claims);
|
|
936
|
+
return {
|
|
937
|
+
...result,
|
|
938
|
+
details: next
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
function declarableDetails(details) {
|
|
942
|
+
if (details === void 0)
|
|
943
|
+
return {};
|
|
944
|
+
if (!isObject(details)) {
|
|
945
|
+
throw new TypeError(`declareProducedResources needs a tool result whose details is an object or undefined, not ${Array.isArray(details) ? "an array" : typeof details}.`);
|
|
946
|
+
}
|
|
947
|
+
return details;
|
|
948
|
+
}
|
|
949
|
+
function channelOf(details) {
|
|
950
|
+
return Object.hasOwn(details, DECLARATIONS) ? details[DECLARATIONS] : void 0;
|
|
951
|
+
}
|
|
952
|
+
function claimsOn(details) {
|
|
953
|
+
const channel = channelOf(details);
|
|
954
|
+
return channel === void 0 ? [] : claimsFrom(channel);
|
|
955
|
+
}
|
|
956
|
+
function claimsFrom(claimed) {
|
|
957
|
+
try {
|
|
958
|
+
return Array.isArray(claimed) ? Array.from(claimed, snapshotClaim) : [snapshotClaim(claimed)];
|
|
959
|
+
} catch (error) {
|
|
960
|
+
return [`<unreadable claim: ${typeof error}>`];
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
function snapshotClaim(value) {
|
|
964
|
+
if (!isObject(value))
|
|
965
|
+
return jsonValue(value);
|
|
966
|
+
const copy = Object.fromEntries(Object.entries(value).map(([key, field]) => [key, jsonValue(field)]));
|
|
967
|
+
return isProducedResourceDeclaration(copy) ? Object.freeze({ uri: copy.uri, action: copy.action }) : Object.freeze(copy);
|
|
968
|
+
}
|
|
969
|
+
function jsonValue(value) {
|
|
970
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
|
|
971
|
+
return value;
|
|
972
|
+
}
|
|
973
|
+
return `<${Array.isArray(value) ? "array" : typeof value}>`;
|
|
974
|
+
}
|
|
975
|
+
|
|
890
976
|
// packages/plugin-primitives/dist/results.js
|
|
891
977
|
function textResult(text, details) {
|
|
892
978
|
const content = [{ type: "text", text }];
|
|
@@ -1041,6 +1127,26 @@ function numLike(record, key) {
|
|
|
1041
1127
|
return void 0;
|
|
1042
1128
|
}
|
|
1043
1129
|
|
|
1130
|
+
// packages/plugin-sdk/dist/kay-agent/interaction.js
|
|
1131
|
+
var INTERACTION_CREDENTIAL_GUARD = "kay.credential-guard/v1";
|
|
1132
|
+
function unavailableInteractionSurface(message) {
|
|
1133
|
+
const refused = async () => ({ ok: false, reason: "unavailable", message });
|
|
1134
|
+
return {
|
|
1135
|
+
isAvailable: async () => false,
|
|
1136
|
+
targets: refused,
|
|
1137
|
+
observe: refused,
|
|
1138
|
+
act: refused,
|
|
1139
|
+
screenshot: refused,
|
|
1140
|
+
open: refused
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
function unavailableInteractionSurfaces(message) {
|
|
1144
|
+
return {
|
|
1145
|
+
browserPane: unavailableInteractionSurface(message),
|
|
1146
|
+
desktop: unavailableInteractionSurface(message)
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1044
1150
|
// packages/plugin-sdk/dist/kay-agent/base64.js
|
|
1045
1151
|
var BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1046
1152
|
function bytesToBase64(bytes) {
|
|
@@ -1257,6 +1363,17 @@ function defineTool(definition) {
|
|
|
1257
1363
|
function defineAuthedTool(definition, schema, binding, body) {
|
|
1258
1364
|
return withResolvedAuth({ ...definition, parameters: toolParameters(schema) }, binding, (toolCallId, rawParams, signal, onUpdate, ctx, resolvedAuth) => body(toolCallId, schema.parse(rawParams), signal, onUpdate, ctx, resolvedAuth));
|
|
1259
1365
|
}
|
|
1366
|
+
var DELEGATED_REFRESH_REJECTED = Symbol.for("kay.plugin-sdk.delegated-refresh-rejected");
|
|
1367
|
+
var DelegatedRefreshRejectedError = class extends Error {
|
|
1368
|
+
[DELEGATED_REFRESH_REJECTED] = true;
|
|
1369
|
+
constructor(message, options) {
|
|
1370
|
+
super(message, options);
|
|
1371
|
+
this.name = "DelegatedRefreshRejectedError";
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
function isDelegatedRefreshRejected(error) {
|
|
1375
|
+
return typeof error === "object" && error !== null && error[DELEGATED_REFRESH_REJECTED] === true;
|
|
1376
|
+
}
|
|
1260
1377
|
var KayAgentFilesystemError = class extends Error {
|
|
1261
1378
|
code;
|
|
1262
1379
|
constructor(code, message) {
|
|
@@ -1265,6 +1382,7 @@ var KayAgentFilesystemError = class extends Error {
|
|
|
1265
1382
|
this.code = code;
|
|
1266
1383
|
}
|
|
1267
1384
|
};
|
|
1385
|
+
var KAY_FAMILY_WHITEBOARD_FILESYSTEM_ROOT = "family-whiteboard";
|
|
1268
1386
|
var KayAgentCapabilityError = class extends Error {
|
|
1269
1387
|
refusal;
|
|
1270
1388
|
constructor(refusal, message) {
|
|
@@ -1284,6 +1402,10 @@ var KayAgentWebSessionError = class extends Error {
|
|
|
1284
1402
|
}
|
|
1285
1403
|
};
|
|
1286
1404
|
export {
|
|
1405
|
+
DelegatedRefreshRejectedError,
|
|
1406
|
+
INTERACTION_CREDENTIAL_GUARD,
|
|
1407
|
+
JevCallError,
|
|
1408
|
+
KAY_FAMILY_WHITEBOARD_FILESYSTEM_ROOT,
|
|
1287
1409
|
KayAgentCapabilityError,
|
|
1288
1410
|
KayAgentFilesystemError,
|
|
1289
1411
|
KayAgentWebSessionError,
|
|
@@ -1309,6 +1431,7 @@ export {
|
|
|
1309
1431
|
contentResult,
|
|
1310
1432
|
createFallbackOnlyWithJev,
|
|
1311
1433
|
createJsonApiClient,
|
|
1434
|
+
declareProducedResources,
|
|
1312
1435
|
defineAuthedTool,
|
|
1313
1436
|
defineKayAgentAdvertisement,
|
|
1314
1437
|
defineTool,
|
|
@@ -1316,6 +1439,7 @@ export {
|
|
|
1316
1439
|
formatIsoDate,
|
|
1317
1440
|
formatNumber,
|
|
1318
1441
|
getBytes,
|
|
1442
|
+
isDelegatedRefreshRejected,
|
|
1319
1443
|
jsonResource,
|
|
1320
1444
|
lintUriHelpContracts,
|
|
1321
1445
|
lintUriTemplate,
|
|
@@ -1333,6 +1457,8 @@ export {
|
|
|
1333
1457
|
textResult,
|
|
1334
1458
|
toJsonSchema,
|
|
1335
1459
|
toolParameters,
|
|
1460
|
+
unavailableInteractionSurface,
|
|
1461
|
+
unavailableInteractionSurfaces,
|
|
1336
1462
|
uriParam,
|
|
1337
1463
|
uriTextEditPayloadSchema,
|
|
1338
1464
|
withResolvedAuth,
|