@yaklabs-ai/plugin-sdk 0.15.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 +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 +119 -44
- package/dist/disclosure.d.ts +1588 -744
- package/dist/disclosure.js +48 -59
- package/dist/kay-agent-testing.d.ts +2577 -590
- package/dist/kay-agent-testing.js +96 -3
- package/dist/kay-agent.d.ts +1791 -1710
- package/dist/kay-agent.js +310 -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 +3303 -837
- package/dist/kay-app.js +233 -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
|
@@ -98,6 +98,65 @@ var SYSTEM_ONE_LIMITS = {
|
|
|
98
98
|
maxForecastHorizon: 64
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
// packages/plugin-sdk/dist/log.js
|
|
102
|
+
function createKayPluginLog(write, bound = {}) {
|
|
103
|
+
const at = (level) => (name, message, details) => {
|
|
104
|
+
try {
|
|
105
|
+
write({
|
|
106
|
+
level,
|
|
107
|
+
name,
|
|
108
|
+
message,
|
|
109
|
+
...details?.error === void 0 ? {} : { error: details.error },
|
|
110
|
+
...details?.sessionId === void 0 ? {} : { sessionId: details.sessionId },
|
|
111
|
+
attributes: { ...bound, ...details?.attributes }
|
|
112
|
+
});
|
|
113
|
+
} catch {
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
debug: at("debug"),
|
|
118
|
+
info: at("info"),
|
|
119
|
+
warn: at("warn"),
|
|
120
|
+
error: at("error"),
|
|
121
|
+
child: (attributes) => createKayPluginLog(write, { ...bound, ...attributes })
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// packages/plugin-sdk/dist/kay-agent/declared-tool.js
|
|
126
|
+
function permissionHint(permission) {
|
|
127
|
+
const { kind, ruleKey, resourceArgs } = permission;
|
|
128
|
+
return {
|
|
129
|
+
kind,
|
|
130
|
+
...ruleKey === void 0 ? {} : { ruleKey },
|
|
131
|
+
...resourceArgs === void 0 ? {} : {
|
|
132
|
+
deriveResources: (input) => resourceArgs.flatMap((arg) => {
|
|
133
|
+
const value = input[arg];
|
|
134
|
+
return typeof value === "string" ? [value] : [];
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function declaredToolDefinition(tool, execute) {
|
|
140
|
+
const { parameters, description, requiresAuth, permission } = tool;
|
|
141
|
+
if (parameters === void 0 || description === void 0) {
|
|
142
|
+
throw new Error(`Tool '${tool.toolName}' declares no parameters in kay-plugin.json, so its definition comes from code.`);
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
name: tool.toolName,
|
|
146
|
+
label: tool.displayName ?? tool.toolName,
|
|
147
|
+
description,
|
|
148
|
+
parameters,
|
|
149
|
+
...requiresAuth === void 0 ? {} : {
|
|
150
|
+
requiresAuth: {
|
|
151
|
+
serviceId: requiresAuth.serviceId,
|
|
152
|
+
...requiresAuth.schemeId === void 0 ? {} : { schemeId: requiresAuth.schemeId }
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
...permission === void 0 ? {} : { permission: permissionHint(permission) },
|
|
156
|
+
execute
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
101
160
|
// packages/plugin-primitives/dist/is-object.js
|
|
102
161
|
function isObject(value) {
|
|
103
162
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -205,6 +264,7 @@ function fauxKayAgentCapabilities() {
|
|
|
205
264
|
download: unwired("webSession.download")
|
|
206
265
|
},
|
|
207
266
|
process: { run: unwired("process.run") },
|
|
267
|
+
compiler: { bundleBrowser: unwired("compiler.bundleBrowser") },
|
|
208
268
|
whiteboard: {
|
|
209
269
|
listTypes: unwired("whiteboard.listTypes"),
|
|
210
270
|
forType: () => ({
|
|
@@ -227,6 +287,7 @@ function fauxKayAgentCapabilities() {
|
|
|
227
287
|
// surface as `{ ok: false }`, never a throw. A test driving one overrides this handle.
|
|
228
288
|
interaction: { browserPane: UNWIRED_SURFACE, desktop: UNWIRED_SURFACE },
|
|
229
289
|
interceptToolCall: () => void 0,
|
|
290
|
+
implementTool: () => void 0,
|
|
230
291
|
// Throws `not-served`, so the plugin's own `catch` runs. A test that wants answers overrides
|
|
231
292
|
// this handle after the spread.
|
|
232
293
|
systemOne: createUnavailableSystemOneClient(),
|
|
@@ -234,12 +295,15 @@ function fauxKayAgentCapabilities() {
|
|
|
234
295
|
// rejecting double would fail tests for a reason production never has. A test asserting what
|
|
235
296
|
// its plugin publishes overrides this handle after the spread.
|
|
236
297
|
events: { publish: () => void 0 },
|
|
237
|
-
// A test double has no user-time port, so it answers the zone as unknown
|
|
298
|
+
// A test double has no user-time port, so it answers the zone as unknown - the same contract
|
|
238
299
|
// the real capability keeps for a zone the host cannot read. A test that exercises a plugin's
|
|
239
300
|
// zone-of-record path overrides this handle after the spread.
|
|
240
301
|
time: {
|
|
241
302
|
snapshot: () => ({ nowMs: 0, zone: "UTC", zoneSource: "utc-fallback" })
|
|
242
303
|
},
|
|
304
|
+
// Accepts and drops, like `events`: the real logger never throws. A test asserting what its
|
|
305
|
+
// plugin logs overrides this handle after the spread.
|
|
306
|
+
log: createKayPluginLog(() => void 0),
|
|
243
307
|
// Answers every call `error` naming itself, keeping the real contract's promise never to
|
|
244
308
|
// reject. A test that exercises a plugin's file I/O overrides this handle after the spread.
|
|
245
309
|
userFiles: Object.fromEntries(USER_FILE_METHODS.map((name) => [
|
|
@@ -249,9 +313,30 @@ function fauxKayAgentCapabilities() {
|
|
|
249
313
|
detail: `userFiles.${name} is not wired in this test double`
|
|
250
314
|
})
|
|
251
315
|
])),
|
|
252
|
-
// A test double runs outside any session, so it has no family folder
|
|
316
|
+
// A test double runs outside any session, so it has no family folder - the same answer the
|
|
253
317
|
// real capability gives. A test that exercises one overrides this handle after the spread.
|
|
254
|
-
familyFolder: { path: async () => void 0 }
|
|
318
|
+
familyFolder: { path: async () => void 0 },
|
|
319
|
+
// Answers `failed` naming itself, keeping the real port's promise never to reject. It returns a
|
|
320
|
+
// port for any name, where the real one throws for a server the manifest does not declare. A
|
|
321
|
+
// test that exercises a plugin's MCP calls passes its own fake port.
|
|
322
|
+
vendoredMcp: {
|
|
323
|
+
port: (server) => ({
|
|
324
|
+
invoke: async () => ({
|
|
325
|
+
ok: false,
|
|
326
|
+
reason: "failed",
|
|
327
|
+
message: `vendoredMcp.port("${server}") is not wired in this test double`
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
},
|
|
331
|
+
// Answers `unavailable` naming itself, keeping the real call's promise never to reject. A test
|
|
332
|
+
// that exercises its plugin's own endpoints passes its own handle.
|
|
333
|
+
endpoints: {
|
|
334
|
+
invoke: async (endpoint) => ({
|
|
335
|
+
ok: false,
|
|
336
|
+
reason: "unavailable",
|
|
337
|
+
message: `endpoints.invoke("${endpoint}") is not wired in this test double`
|
|
338
|
+
})
|
|
339
|
+
}
|
|
255
340
|
};
|
|
256
341
|
}
|
|
257
342
|
function createTestClock(startMs, options = {}) {
|
|
@@ -296,6 +381,13 @@ function defaultTestToolContext() {
|
|
|
296
381
|
async function invokeToolForTest(tool, params, ctx = defaultTestToolContext()) {
|
|
297
382
|
return tool.execute("test-call", params, void 0, void 0, ctx);
|
|
298
383
|
}
|
|
384
|
+
function describedToolForTest(contract, localId, execute) {
|
|
385
|
+
const tool = contract.kayAgentTools?.find((declared) => declared.localId === localId);
|
|
386
|
+
if (tool === void 0) {
|
|
387
|
+
throw new Error(`The contract declares no kay.agent tool '${localId}'.`);
|
|
388
|
+
}
|
|
389
|
+
return declaredToolDefinition(tool, execute);
|
|
390
|
+
}
|
|
299
391
|
function producedResourcesForTest(result) {
|
|
300
392
|
const recorded = recordProducedResources(result.details).details;
|
|
301
393
|
const read = readProducedResourceDeclarations(recorded);
|
|
@@ -307,6 +399,7 @@ function producedResourcesForTest(result) {
|
|
|
307
399
|
}
|
|
308
400
|
export {
|
|
309
401
|
createTestClock,
|
|
402
|
+
describedToolForTest,
|
|
310
403
|
fauxAuthContext,
|
|
311
404
|
fauxKayAgentCapabilities,
|
|
312
405
|
invokeToolForTest,
|