@yaklabs-ai/plugin-sdk 0.48.1 → 0.49.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 +33 -19
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/disclosure.d.ts +41 -2
- package/dist/disclosure.js +16 -0
- package/dist/kay-agent-testing.d.ts +42 -3
- package/dist/kay-agent-testing.js +10 -0
- package/dist/kay-agent.d.ts +59 -9
- package/dist/kay-agent.js +16 -0
- package/dist/kay-app.d.ts +49 -57
- package/dist/kay-app.js +634 -608
- package/dist/uri.d.ts +380 -0
- package/dist/uri.js +81 -0
- package/dist/vendored-mcp.d.ts +2 -0
- package/package.json +5 -1
package/dist/uri.d.ts
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable digest of a read's content, the revision a module without one gets.
|
|
3
|
+
* Prefixed so a provider revision can never collide with it by accident.
|
|
4
|
+
*/
|
|
5
|
+
export declare function contentDigest(content: string | Uint8Array): string;
|
|
6
|
+
|
|
7
|
+
export declare function createUnavailableUriCaller(message: string): PluginUriCaller;
|
|
8
|
+
|
|
9
|
+
declare type JsonPrimitive = string | number | boolean | null;
|
|
10
|
+
|
|
11
|
+
declare type JsonValue = JsonPrimitive | {
|
|
12
|
+
readonly [key: string]: JsonValue;
|
|
13
|
+
} | readonly JsonValue[];
|
|
14
|
+
|
|
15
|
+
declare interface LineRange {
|
|
16
|
+
readonly start: number;
|
|
17
|
+
readonly end: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare interface LineSelector {
|
|
21
|
+
readonly ranges: readonly LineRange[];
|
|
22
|
+
readonly raw: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A source-native read of one URI, shaped for downstream indexing rather than
|
|
27
|
+
* direct model consumption. A module's read returns it in
|
|
28
|
+
* `RawResource.observations`, built from the same fetch as the content, once
|
|
29
|
+
* per document it wants indexed; absence means "not indexed".
|
|
30
|
+
*
|
|
31
|
+
* Gone signal: the index retires a doc when a read throws `UriNotFoundError`
|
|
32
|
+
* or an error whose `.status === 404`. A module whose vendor signals "gone"
|
|
33
|
+
* differently (HTTP 410, a 200-body `{ok:false}`/`archived:true`, a
|
|
34
|
+
* 403/404-ambiguous lost-access response) must translate that into one of
|
|
35
|
+
* those two shapes itself; losing access to a resource counts as gone too.
|
|
36
|
+
* A read that cannot build a complete observation (a secondary fetch failed)
|
|
37
|
+
* returns none rather than a partial one.
|
|
38
|
+
*
|
|
39
|
+
* Account-qualified identity: a module whose read can resolve against more
|
|
40
|
+
* than one connected account (the account selector is stripped before route
|
|
41
|
+
* parsing, so two accounts reading the same opaque provider id would
|
|
42
|
+
* otherwise collide on one doc key) must fold `ctx.auth.credential.accountId`
|
|
43
|
+
* into `uri` - e.g. `gmail://@<accountId>/threads/<threadId>` - never the
|
|
44
|
+
* user-renamable connection/selector label. `ctx.auth.credential` is the
|
|
45
|
+
* reliable source of the resolved account at a `requiresAuth` module's
|
|
46
|
+
* `read()`: it is always populated once auth resolution runs (an
|
|
47
|
+
* `authContext`-style check already throws first when no credential
|
|
48
|
+
* resolved). `ctx.connection` may ALSO be populated by dispatch - a
|
|
49
|
+
* connection-required module receives it whenever the host has a tracked
|
|
50
|
+
* connection for the account - so do not assume it is absent; a module that
|
|
51
|
+
* wants the human-facing label rather than the account id reads
|
|
52
|
+
* `ctx.connection?.displayName`.
|
|
53
|
+
*
|
|
54
|
+
* `accountId` is guaranteed stable only for the life of the stored credential
|
|
55
|
+
* record, not necessarily across a disconnect/reconnect of the same
|
|
56
|
+
* real-world provider account. A scheme that mints an opaque id at connect
|
|
57
|
+
* time (the default for an api-key or delegated scheme, absent a
|
|
58
|
+
* provider-derived override) gets a fresh id on every connect; a scheme that
|
|
59
|
+
* instead derives the id from provider data (an oauth2-pkce scheme supplying
|
|
60
|
+
* `resolveAccountId`, e.g. reading an OIDC `sub`) keeps the same id across
|
|
61
|
+
* reconnect. A module on a scheme without a provider-stable id has two honest
|
|
62
|
+
* choices: derive its own stable identity from provider data at read time
|
|
63
|
+
* (call the provider's own account/"who am I" endpoint with the resolved
|
|
64
|
+
* credential and fold THAT into `uri` instead of `accountId`), or
|
|
65
|
+
* account-qualify with `accountId` knowing a disconnect/reconnect of the same
|
|
66
|
+
* real-world account re-keys its documents under a new id rather than
|
|
67
|
+
* updating them in place - nothing on the host side reconciles the old and
|
|
68
|
+
* new keys.
|
|
69
|
+
*/
|
|
70
|
+
declare interface ObservationMaterial {
|
|
71
|
+
/** Canonical URI of the observed resource - may differ from the input URI. */
|
|
72
|
+
readonly uri: string;
|
|
73
|
+
/** Scheme-prefixed content type, e.g. `"github.pr"`, `"gmail.thread"`, `"wikipedia.article"`. */
|
|
74
|
+
readonly kind: string;
|
|
75
|
+
readonly title?: string;
|
|
76
|
+
/** Source-native seams: one element per message/comment/section, in source order. */
|
|
77
|
+
readonly text?: readonly string[];
|
|
78
|
+
/** ISO-8601 creation time; provenance only - not persisted by the store yet. */
|
|
79
|
+
readonly createdAt?: string;
|
|
80
|
+
/** ISO-8601 last-update time; provenance only - not persisted by the store yet. */
|
|
81
|
+
readonly updatedAt?: string;
|
|
82
|
+
/** Source-native revision/version marker, when the source exposes one. */
|
|
83
|
+
readonly version?: string;
|
|
84
|
+
/**
|
|
85
|
+
* How long this resource stays worth semantically searching, measured from
|
|
86
|
+
* the LAST time it was observed - not from when it was first indexed. Every
|
|
87
|
+
* observation of an unchanged resource pushes the deadline out again, so a
|
|
88
|
+
* thread that keeps getting read keeps living and a quiet one ages out.
|
|
89
|
+
*
|
|
90
|
+
* Retention is opt-in per resource: absent means the index keeps the
|
|
91
|
+
* resource until its source says it is gone. A route declares this only
|
|
92
|
+
* when staleness is real for that shape - a chat thread or an inbox
|
|
93
|
+
* conversation goes cold, a durable note the user wrote does not.
|
|
94
|
+
*/
|
|
95
|
+
readonly retainForMs?: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Sessionless resource calls. Each call checks the calling target's exact scheme and verb grant.
|
|
100
|
+
* Results retain provider bytes, metadata and revisions; provider failures retain their URI tags.
|
|
101
|
+
* A cancellation or lost response does not prove a mutation was not applied.
|
|
102
|
+
*/
|
|
103
|
+
export declare interface PluginUriCaller {
|
|
104
|
+
read(input: string, options?: PluginUriReadOptions): Promise<RawResource>;
|
|
105
|
+
list(input: string, params?: UriListParams, options?: PluginUriCallOptions): Promise<UriListResult>;
|
|
106
|
+
search(input: string, params: UriSearchParams, options?: PluginUriCallOptions): Promise<UriSearchResult>;
|
|
107
|
+
write(input: string, content?: UriPayload | Uint8Array, options?: PluginUriWriteOptions): Promise<UriMutationResult | void>;
|
|
108
|
+
edit(input: string, payload: UriPayload, options?: PluginUriMutationOptions): Promise<UriMutationResult>;
|
|
109
|
+
delete(input: string, options?: PluginUriMutationOptions): Promise<UriMutationResult>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare interface PluginUriCallOptions {
|
|
113
|
+
readonly cwd?: string;
|
|
114
|
+
readonly signal?: AbortSignal;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export declare interface PluginUriMutationOptions extends PluginUriCallOptions {
|
|
118
|
+
readonly expectedRevision?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export declare interface PluginUriReadOptions extends PluginUriCallOptions {
|
|
122
|
+
readonly knownRevision?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export declare interface PluginUriWriteOptions extends PluginUriMutationOptions {
|
|
126
|
+
readonly sources?: readonly UriWriteSource[];
|
|
127
|
+
readonly writeSource?: UriSourceDescriptor;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare interface RawResource {
|
|
131
|
+
readonly uri: string;
|
|
132
|
+
readonly content: string | Uint8Array;
|
|
133
|
+
readonly mimeType: string;
|
|
134
|
+
readonly metadata?: RawResourceMetadata;
|
|
135
|
+
readonly selector?: SelectorDisposition;
|
|
136
|
+
/**
|
|
137
|
+
* The indexable forms of this resource, built from the same fetch as
|
|
138
|
+
* `content`: one per document the read wants indexed (a thread read offers
|
|
139
|
+
* one per message). Absent or empty means nothing is indexed. The read tool
|
|
140
|
+
* takes them off before the cache and the model; other host reads
|
|
141
|
+
* (out-of-band host reads) return them untouched.
|
|
142
|
+
*/
|
|
143
|
+
readonly observations?: readonly ObservationMaterial[];
|
|
144
|
+
/** How long the host may cache this result; see {@link UriCachePolicy.ttlMs}. */
|
|
145
|
+
readonly cachePolicy?: Pick<UriCachePolicy, "ttlMs">;
|
|
146
|
+
/**
|
|
147
|
+
* A short name for the resource this call touched, for the transcript row; absent shows the
|
|
148
|
+
* address. Render-only: the host stamps it on the tool result's `details`, never in `content`.
|
|
149
|
+
*/
|
|
150
|
+
readonly label?: UriResourceLabel;
|
|
151
|
+
/**
|
|
152
|
+
* Answer to a `read` called with `ctx.knownRevision`: the module checked the source's current
|
|
153
|
+
* revision and it equals `knownRevision`, so `content` is empty and `metadata.revision` equals
|
|
154
|
+
* `knownRevision`. Set it only when that check was made and matched; a module that cannot
|
|
155
|
+
* check cheaply, or that found a different revision, returns the full resource without it.
|
|
156
|
+
*/
|
|
157
|
+
readonly unchanged?: true;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare interface RawResourceCacheControl {
|
|
161
|
+
/** False marks degraded/fallback content that read-through caches must not store. */
|
|
162
|
+
readonly store?: boolean;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
declare interface RawResourceIdentity {
|
|
166
|
+
readonly id: string;
|
|
167
|
+
readonly version: string;
|
|
168
|
+
readonly variantId?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare interface RawResourceMetadata {
|
|
172
|
+
readonly size?: number;
|
|
173
|
+
readonly finalUrl?: string;
|
|
174
|
+
/** Provider resource MIME type; absent when the source does not report one. */
|
|
175
|
+
readonly sourceMimeType?: string;
|
|
176
|
+
readonly notes?: readonly string[];
|
|
177
|
+
readonly cache?: RawResourceCacheControl;
|
|
178
|
+
/**
|
|
179
|
+
* The absolute local filesystem path the resource's bytes were read from,
|
|
180
|
+
* when the transport read them from local disk. Converter-facing
|
|
181
|
+
* provenance: finalize threads it into the content probe so a converter
|
|
182
|
+
* can direct shell tools at the file (e.g. archive extraction). Absent for
|
|
183
|
+
* remote/synthesized content.
|
|
184
|
+
*/
|
|
185
|
+
readonly localPath?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Opaque source-native revision suitable only for a later equality check.
|
|
188
|
+
* A host records it as the session's witness for this resource; when a
|
|
189
|
+
* module reports none, the host records a content digest of `content`
|
|
190
|
+
* instead (`contentDigest`, prefixed `sha256:`), which the module can
|
|
191
|
+
* reproduce at mutation time from the same content its read returns.
|
|
192
|
+
*/
|
|
193
|
+
readonly revision?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Opaque immutable identity for the exact resource bytes returned by a
|
|
196
|
+
* provider. Transport preserves it for observers; it never parses it.
|
|
197
|
+
*/
|
|
198
|
+
readonly resourceIdentity?: RawResourceIdentity;
|
|
199
|
+
/**
|
|
200
|
+
* The resource's stable public address when `uri` reports something more
|
|
201
|
+
* specific than the address a consumer names it by - a retained revision
|
|
202
|
+
* (`skill://<id>/@revision/<version>`) served for a `skill://<source>/<name>`
|
|
203
|
+
* read. Present only when the two differ. Consumers that attribute by name
|
|
204
|
+
* (the read tool's `skillName` detail, and everything keyed off it) read
|
|
205
|
+
* this; consumers that need the exact bytes keep `uri`.
|
|
206
|
+
*/
|
|
207
|
+
readonly canonicalUri?: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare type SelectorDisposition = {
|
|
211
|
+
readonly kind: "deferred";
|
|
212
|
+
readonly window?: LineSelector;
|
|
213
|
+
} | {
|
|
214
|
+
readonly kind: "applied";
|
|
215
|
+
} | {
|
|
216
|
+
readonly kind: "invalid";
|
|
217
|
+
readonly message: string;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
declare interface UriCacheInvalidation {
|
|
221
|
+
/** Drop cached entries whose cache URI starts with this prefix. */
|
|
222
|
+
readonly prefix?: string;
|
|
223
|
+
/** Drop the exact cache URI. */
|
|
224
|
+
readonly uri?: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare interface UriCachePolicy {
|
|
228
|
+
/** Read-family cache TTL in milliseconds; absent or zero means not cached. */
|
|
229
|
+
readonly ttlMs?: number;
|
|
230
|
+
/** Mutation directive applied after a successful write/edit/delete. */
|
|
231
|
+
readonly invalidate?: readonly UriCacheInvalidation[];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare interface UriListItem {
|
|
235
|
+
readonly uri: string;
|
|
236
|
+
readonly title?: string;
|
|
237
|
+
readonly summary?: string;
|
|
238
|
+
/** Provider resource MIME type; absent when the source does not report one. */
|
|
239
|
+
readonly sourceMimeType?: string;
|
|
240
|
+
readonly operations?: readonly UriOperation[];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare interface UriListMetadata {
|
|
244
|
+
readonly totalCount?: number;
|
|
245
|
+
readonly totalCountLabel?: string;
|
|
246
|
+
readonly returnedCount?: number;
|
|
247
|
+
/**
|
|
248
|
+
* True when the provider could not search/enumerate the whole corpus for this
|
|
249
|
+
* page, so the result may be missing matches (e.g. a federated query that spans
|
|
250
|
+
* multiple stores and timed out part way). The caller should treat the result as
|
|
251
|
+
* partial and, where possible, narrow the scope. Omit when results are complete.
|
|
252
|
+
*/
|
|
253
|
+
readonly incompleteSearch?: boolean;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare interface UriListParams {
|
|
257
|
+
readonly cursor?: string;
|
|
258
|
+
readonly limit?: number;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
declare interface UriListResult {
|
|
262
|
+
readonly uri: string;
|
|
263
|
+
readonly items: readonly UriListItem[];
|
|
264
|
+
readonly nextCursor?: string;
|
|
265
|
+
readonly metadata?: UriListMetadata;
|
|
266
|
+
/** How long the host may cache this result; see {@link UriCachePolicy.ttlMs}. */
|
|
267
|
+
readonly cachePolicy?: Pick<UriCachePolicy, "ttlMs">;
|
|
268
|
+
/** The module's own markdown for this result, shown instead of the host's default rendering. */
|
|
269
|
+
readonly markdown?: string;
|
|
270
|
+
/** The touched resource's name for the transcript row, as on `RawResource.label`. */
|
|
271
|
+
readonly label?: UriResourceLabel;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** Authoritative lifecycle facts for a successful record-like URI mutation. */
|
|
275
|
+
declare interface UriMutationReceipt {
|
|
276
|
+
readonly uri: string;
|
|
277
|
+
readonly operation: "create" | "update" | "trash" | "restore" | "delete";
|
|
278
|
+
readonly state: "active" | "trashed" | "deleted";
|
|
279
|
+
readonly revision?: string;
|
|
280
|
+
readonly changedFields?: readonly string[];
|
|
281
|
+
readonly recoverable: boolean;
|
|
282
|
+
readonly recoveryUri?: string;
|
|
283
|
+
readonly originalUri?: string;
|
|
284
|
+
readonly restoreTarget?: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare interface UriMutationResult {
|
|
288
|
+
readonly uri: string;
|
|
289
|
+
readonly summary?: string;
|
|
290
|
+
readonly resource?: RawResource | JsonValue;
|
|
291
|
+
readonly validation?: readonly UriValidationMessage[];
|
|
292
|
+
readonly metadata?: Record<string, unknown>;
|
|
293
|
+
/** Typed state/recovery evidence; successful callers may trust it without a proof read. */
|
|
294
|
+
readonly receipt?: UriMutationReceipt;
|
|
295
|
+
/** Opaque source-native revision after this successful mutation. */
|
|
296
|
+
readonly revision?: string;
|
|
297
|
+
/** Cached reads this mutation made stale; see {@link UriCachePolicy.invalidate}. */
|
|
298
|
+
readonly cachePolicy?: Pick<UriCachePolicy, "invalidate">;
|
|
299
|
+
/** The module's own markdown for this result, shown instead of the host's default rendering. */
|
|
300
|
+
readonly markdown?: string;
|
|
301
|
+
/** The touched resource's name for the transcript row, as on `RawResource.label`. */
|
|
302
|
+
readonly label?: UriResourceLabel;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
declare type UriOperation = "help" | "read" | "write" | "edit" | "list" | "search" | "delete";
|
|
306
|
+
|
|
307
|
+
declare type UriPayload = string | JsonValue;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* What a settled call touched, as a person would name it.
|
|
311
|
+
*
|
|
312
|
+
* `name` is the resource itself (`#lane-analytics`). `section` is the part of it the address
|
|
313
|
+
* reaches into (`thread`), and is absent when the address is the resource.
|
|
314
|
+
*/
|
|
315
|
+
declare interface UriResourceLabel {
|
|
316
|
+
readonly name: string;
|
|
317
|
+
readonly section?: string;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
declare interface UriSearchItem {
|
|
321
|
+
readonly uri: string;
|
|
322
|
+
readonly title?: string;
|
|
323
|
+
readonly summary?: string;
|
|
324
|
+
/** Provider resource MIME type; absent when the source does not report one. */
|
|
325
|
+
readonly sourceMimeType?: string;
|
|
326
|
+
readonly score?: number;
|
|
327
|
+
readonly reason?: string;
|
|
328
|
+
readonly operations?: readonly UriOperation[];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
declare interface UriSearchParams {
|
|
332
|
+
readonly query: string;
|
|
333
|
+
readonly limit?: number;
|
|
334
|
+
readonly cursor?: string;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
declare interface UriSearchResult {
|
|
338
|
+
readonly uri: string;
|
|
339
|
+
readonly query: string;
|
|
340
|
+
readonly items: readonly UriSearchItem[];
|
|
341
|
+
readonly nextCursor?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Optional result-set metadata, mirroring {@link UriListResult.metadata}. Lets a
|
|
344
|
+
* search surface completeness signals such as {@link UriListMetadata.incompleteSearch}
|
|
345
|
+
* so the caller knows the matches may be partial.
|
|
346
|
+
*/
|
|
347
|
+
readonly metadata?: UriListMetadata;
|
|
348
|
+
/** How long the host may cache this result; see {@link UriCachePolicy.ttlMs}. */
|
|
349
|
+
readonly cachePolicy?: Pick<UriCachePolicy, "ttlMs">;
|
|
350
|
+
/** The module's own markdown for this result, shown instead of the host's default rendering. */
|
|
351
|
+
readonly markdown?: string;
|
|
352
|
+
/** The touched resource's name for the transcript row, as on `RawResource.label`. */
|
|
353
|
+
readonly label?: UriResourceLabel;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* What a copied resource IS, minus its bytes: the identity half of a mediated
|
|
358
|
+
* source. The host derives it once (filename inferred from the source address,
|
|
359
|
+
* `mimeType` carried from the source module's own `RawResource.mimeType`) and
|
|
360
|
+
* delivers it inside each `UriWriteSource`, and on `ctx.writeSource` for a
|
|
361
|
+
* `source` copy - so a remote sink can name and type what it stores without
|
|
362
|
+
* re-deriving either from raw bytes.
|
|
363
|
+
*/
|
|
364
|
+
declare interface UriSourceDescriptor {
|
|
365
|
+
readonly uri: string;
|
|
366
|
+
readonly filename: string;
|
|
367
|
+
readonly mimeType?: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
declare interface UriValidationMessage {
|
|
371
|
+
readonly path?: string;
|
|
372
|
+
readonly message: string;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** A mediated resource supplied beside structured write content without entering model context. */
|
|
376
|
+
declare interface UriWriteSource extends UriSourceDescriptor {
|
|
377
|
+
readonly content: string | Uint8Array;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export { }
|
package/dist/uri.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// packages/herd-uri/dist/resource-witness.js
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
function contentDigest(content) {
|
|
4
|
+
const hash = createHash("sha256");
|
|
5
|
+
hash.update(typeof content === "string" ? new TextEncoder().encode(content) : content);
|
|
6
|
+
return `${DIGEST_PREFIX}${hash.digest("base64url")}`;
|
|
7
|
+
}
|
|
8
|
+
var DIGEST_PREFIX = "sha256:";
|
|
9
|
+
|
|
10
|
+
// packages/herd-uri/dist/operations.js
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
var URI_OPERATIONS = [
|
|
13
|
+
"help",
|
|
14
|
+
"read",
|
|
15
|
+
"write",
|
|
16
|
+
"edit",
|
|
17
|
+
"list",
|
|
18
|
+
"search",
|
|
19
|
+
"delete"
|
|
20
|
+
];
|
|
21
|
+
var UriOperationSchema = z.enum(URI_OPERATIONS);
|
|
22
|
+
|
|
23
|
+
// packages/herd-uri/dist/help-schema.js
|
|
24
|
+
import { z as z2 } from "zod";
|
|
25
|
+
var UriContractJsonSchema = z2.record(z2.string(), z2.unknown());
|
|
26
|
+
var UriParameterSchema = z2.strictObject({
|
|
27
|
+
name: z2.string().min(1),
|
|
28
|
+
in: z2.enum(["uri", "query", "selector"]),
|
|
29
|
+
required: z2.boolean(),
|
|
30
|
+
description: z2.string().optional(),
|
|
31
|
+
schema: UriContractJsonSchema,
|
|
32
|
+
examples: z2.array(z2.unknown()).optional()
|
|
33
|
+
});
|
|
34
|
+
var UriPayloadContractSchema = z2.strictObject({
|
|
35
|
+
name: z2.string().min(1),
|
|
36
|
+
mediaType: z2.string().optional(),
|
|
37
|
+
description: z2.string().optional(),
|
|
38
|
+
schema: UriContractJsonSchema.optional(),
|
|
39
|
+
semanticConstraints: z2.array(z2.string().min(1)).min(1).optional(),
|
|
40
|
+
examples: z2.array(z2.unknown()).optional()
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// packages/herd-uri/dist/text-edit.js
|
|
44
|
+
import { z as z3 } from "zod";
|
|
45
|
+
var findReplaceArm = z3.strictObject({
|
|
46
|
+
find: z3.string().min(1),
|
|
47
|
+
replace: z3.string(),
|
|
48
|
+
all: z3.boolean().optional()
|
|
49
|
+
});
|
|
50
|
+
var oldNewEntry = z3.strictObject({
|
|
51
|
+
oldText: z3.string().min(1),
|
|
52
|
+
newText: z3.string()
|
|
53
|
+
});
|
|
54
|
+
var uriTextEditPayloadArms = z3.union([
|
|
55
|
+
findReplaceArm,
|
|
56
|
+
z3.strictObject({ edits: z3.array(oldNewEntry).min(1) }),
|
|
57
|
+
oldNewEntry,
|
|
58
|
+
z3.array(oldNewEntry).min(1)
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
// packages/herd-uri/dist/schema/to-json-schema.js
|
|
62
|
+
import { z as z4 } from "zod";
|
|
63
|
+
|
|
64
|
+
// packages/plugin-sdk/dist/uri.js
|
|
65
|
+
function createUnavailableUriCaller(message) {
|
|
66
|
+
const unavailable = async () => {
|
|
67
|
+
throw new Error(message);
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
read: unavailable,
|
|
71
|
+
list: unavailable,
|
|
72
|
+
search: unavailable,
|
|
73
|
+
write: unavailable,
|
|
74
|
+
edit: unavailable,
|
|
75
|
+
delete: unavailable
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
contentDigest,
|
|
80
|
+
createUnavailableUriCaller
|
|
81
|
+
};
|
package/dist/vendored-mcp.d.ts
CHANGED
|
@@ -901,6 +901,8 @@ declare interface UriResolveContext {
|
|
|
901
901
|
* resolve a URI outside any verb call.
|
|
902
902
|
*/
|
|
903
903
|
readonly sessionId?: string;
|
|
904
|
+
/** Host-stamped calling plugin; absent for session dispatch and resolver matching. */
|
|
905
|
+
readonly callerPluginId?: string;
|
|
904
906
|
/**
|
|
905
907
|
* WHO the dispatching session acts as, stamped by the host at the same dispatch site as
|
|
906
908
|
* {@link UriResolveContext.sessionId} and just as un-influenceable by the caller - so a module
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaklabs-ai/plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.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",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"types": "./dist/kay-app.d.ts",
|
|
18
18
|
"default": "./dist/kay-app.js"
|
|
19
19
|
},
|
|
20
|
+
"./uri": {
|
|
21
|
+
"types": "./dist/uri.d.ts",
|
|
22
|
+
"default": "./dist/uri.js"
|
|
23
|
+
},
|
|
20
24
|
"./kay-app/session-summary": {
|
|
21
25
|
"types": "./dist/kay-app-session-summary.d.ts",
|
|
22
26
|
"default": "./dist/kay-app-session-summary.js"
|