@yaklabs-ai/plugin-sdk 0.12.5 → 0.13.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 CHANGED
@@ -13,7 +13,7 @@ it under the name your plugin code actually imports:
13
13
  ```json
14
14
  {
15
15
  "dependencies": {
16
- "@kay/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.12.5"
16
+ "@kay/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.13.0"
17
17
  }
18
18
  }
19
19
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-sdk",
4
- "version": "0.12.5",
4
+ "version": "0.13.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -1024,52 +1024,14 @@ declare interface KayAgentEvents {
1024
1024
  publish(localId: string, payload: unknown): void;
1025
1025
  }
1026
1026
 
1027
- /**
1028
- * Claim-checked filesystem operations. Paths are root-relative; canonical host paths never cross
1029
- * the seam. Writes are atomic: readers see the old file or the new one, never a partial write. A
1030
- * replace keeps the file's mode but makes a new file, so owner and extended attributes are not
1031
- * carried over. On a volume without hard links an exclusive create can briefly show an empty file.
1032
- */
1033
- declare interface KayAgentFilesystem {
1034
- readText(location: KayAgentFilesystemLocation): Promise<string>;
1035
- writeText(location: KayAgentFilesystemLocation, content: string, options?: KayAgentFilesystemWriteOptions): Promise<void>;
1036
- /** The whole file, or the requested window of it. */
1037
- readBytes(location: KayAgentFilesystemLocation, range?: KayAgentFilesystemByteRange): Promise<Uint8Array>;
1038
- writeBytes(location: KayAgentFilesystemLocation, bytes: Uint8Array, options?: KayAgentFilesystemWriteOptions): Promise<void>;
1039
- mkdir(location: KayAgentFilesystemLocation): Promise<void>;
1040
- readDir(location: KayAgentFilesystemLocation): Promise<readonly KayAgentFilesystemEntry[]>;
1041
- stat(location: KayAgentFilesystemLocation): Promise<KayAgentFilesystemStat>;
1042
- rename(from: KayAgentFilesystemLocation, to: KayAgentFilesystemLocation): Promise<void>;
1043
- /** Returns the canonical path relative to the selected grant root. */
1044
- realpath(location: KayAgentFilesystemLocation): Promise<string>;
1045
- }
1046
-
1047
- /** A byte window of a file; `maxBytes` is capped by the host. */
1048
- declare interface KayAgentFilesystemByteRange {
1049
- readonly offset: number;
1050
- readonly maxBytes: number;
1051
- }
1052
-
1053
- declare interface KayAgentFilesystemEntry {
1054
- readonly name: string;
1055
- readonly kind: "file" | "directory" | "symlink" | "other";
1056
- }
1057
-
1058
- declare interface KayAgentFilesystemLocation {
1059
- /** Exact `root` selector the host bound for this target, plus a path relative to it. */
1060
- readonly root: string;
1061
- readonly path: string;
1062
- }
1063
-
1064
- declare interface KayAgentFilesystemStat {
1065
- readonly kind: "file" | "directory" | "other";
1066
- readonly size: number;
1067
- readonly modifiedAtMs: number;
1068
- }
1069
-
1070
- declare interface KayAgentFilesystemWriteOptions {
1071
- /** Fail with `already_exists` instead of replacing a file already at the location. */
1072
- readonly exclusive?: boolean;
1027
+ /** This plugin's folder in the session family's shared Whiteboard. */
1028
+ declare interface KayAgentFamilyFolder {
1029
+ /**
1030
+ * The folder's absolute path, created on first use. The plugin that owns the Whiteboard gets
1031
+ * the whole family folder; every other plugin gets its own `plugins/<plugin-id>/` inside it.
1032
+ * Undefined outside a session.
1033
+ */
1034
+ path(): Promise<string | undefined>;
1073
1035
  }
1074
1036
 
1075
1037
  declare interface KayAgentInteractionSurfaces {
@@ -1211,11 +1173,8 @@ declare interface KayAgentPluginApi {
1211
1173
  /** Register a whole URI module (a scheme handler that owns its address space, e.g. `drive://`). */
1212
1174
  registerModule(module: UriExtensionModule): void;
1213
1175
  };
1214
- /**
1215
- * Always present; each call is checked against `filesystem.read {root}` / `filesystem.write
1216
- * {root}` for the root it touches, and against the host's binding for that root.
1217
- */
1218
- readonly filesystem: KayAgentFilesystem;
1176
+ /** This plugin's folder in the session family's shared Whiteboard, created on first use. Undefined outside a session. */
1177
+ readonly familyFolder: KayAgentFamilyFolder;
1219
1178
  /** Absent unless the `knowledgeSearch` grant is requested and effectively granted. */
1220
1179
  readonly knowledgeSearch?: KayAgentKnowledgeSearch;
1221
1180
  /** Absent unless the `knownResources` grant is requested and effectively granted. */
@@ -1268,9 +1227,8 @@ declare interface KayAgentPluginApi {
1268
1227
  readonly time: KayAppTime;
1269
1228
  /**
1270
1229
  * File I/O in user folders, run by the host on its own worker threads under a deadline and
1271
- * answered as a typed result. Always present and ungated: unlike {@link filesystem} it takes
1272
- * absolute paths and checks no grant, because it adds no authority a plugin's `node:fs` does not
1273
- * already have. What it adds is that a slow or unresponsive folder never blocks the daemon. See
1230
+ * answered as a typed result. Always present and ungated: it takes absolute paths and checks no
1231
+ * grant, because it adds no authority a plugin's `node:fs` does not already have. What it adds is that a slow or unresponsive folder never blocks the daemon. See
1274
1232
  * {@link KayAppUserFiles}.
1275
1233
  */
1276
1234
  readonly userFiles: KayAppUserFiles;
@@ -765,17 +765,6 @@ function unavailableInteractionSurfaces(message) {
765
765
  // packages/plugin-sdk/dist/disclosure/probe-kay-agent-capabilities.js
766
766
  var inertResult = () => new Promise(() => {
767
767
  });
768
- var INERT_FILESYSTEM = {
769
- readText: inertResult,
770
- writeText: inertResult,
771
- readBytes: inertResult,
772
- writeBytes: inertResult,
773
- mkdir: inertResult,
774
- readDir: inertResult,
775
- stat: inertResult,
776
- rename: inertResult,
777
- realpath: inertResult
778
- };
779
768
  var INERT_NETWORK = {
780
769
  fetch: inertResult
781
770
  };
@@ -807,7 +796,6 @@ var INERT_WHITEBOARD = {
807
796
  var INERT_WITH_JEV = async (_use, fallback) => fallback();
808
797
  function createKayAgentProbeCapabilityHandles() {
809
798
  return {
810
- filesystem: INERT_FILESYSTEM,
811
799
  network: INERT_NETWORK,
812
800
  webSession: INERT_WEB_SESSION,
813
801
  process: INERT_PROCESS,
@@ -825,7 +813,7 @@ function createKayAgentProbeCapabilityHandles() {
825
813
  time: {
826
814
  snapshot: () => ({ nowMs: 0, zone: "UTC", zoneSource: "utc-fallback" })
827
815
  },
828
- // Inert like the filesystem broker: a probe must never touch the user's disk.
816
+ // Inert like the process broker: a probe must never touch the user's disk.
829
817
  userFiles: {
830
818
  stat: inertResult,
831
819
  readText: inertResult,
@@ -835,7 +823,9 @@ function createKayAgentProbeCapabilityHandles() {
835
823
  writeText: inertResult,
836
824
  mkdir: inertResult,
837
825
  rename: inertResult
838
- }
826
+ },
827
+ // A probe runs outside any session, and must not create a folder on the user's disk.
828
+ familyFolder: { path: async () => void 0 }
839
829
  };
840
830
  }
841
831
 
package/dist/fs.d.ts ADDED
@@ -0,0 +1,156 @@
1
+ import { constants } from 'node:fs';
2
+ import { FileHandle } from 'node:fs/promises';
3
+ import * as nodeFsp from 'node:fs/promises';
4
+
5
+ export declare const access: typeof nodeFsp.access;
6
+
7
+ export declare const appendFile: typeof nodeFsp.appendFile;
8
+
9
+ export declare const chmod: typeof nodeFsp.chmod;
10
+
11
+ export declare const chown: typeof nodeFsp.chown;
12
+
13
+ export { constants }
14
+
15
+ export declare const copyFile: typeof nodeFsp.copyFile;
16
+
17
+ export declare const cp: typeof nodeFsp.cp;
18
+
19
+ declare const _default: {
20
+ access: typeof nodeFsp.access;
21
+ appendFile: typeof nodeFsp.appendFile;
22
+ chmod: typeof nodeFsp.chmod;
23
+ chown: typeof nodeFsp.chown;
24
+ constants: typeof constants;
25
+ copyFile: typeof nodeFsp.copyFile;
26
+ cp: typeof nodeFsp.cp;
27
+ glob: typeof nodeFsp.glob;
28
+ lchmod: typeof nodeFsp.lchmod;
29
+ lchown: typeof nodeFsp.lchown;
30
+ link: typeof nodeFsp.link;
31
+ lstat: typeof nodeFsp.lstat;
32
+ lutimes: typeof nodeFsp.lutimes;
33
+ mkdir: typeof nodeFsp.mkdir;
34
+ mkdtemp: typeof nodeFsp.mkdtemp;
35
+ mkdtempDisposable: (prefix: string, options?: unknown) => Promise<{
36
+ path: string;
37
+ remove(): Promise<void>;
38
+ [Symbol.asyncDispose](): Promise<void>;
39
+ }>;
40
+ open: typeof nodeFsp.open;
41
+ opendir: typeof nodeFsp.opendir;
42
+ readdir: typeof nodeFsp.readdir;
43
+ readFile: typeof nodeFsp.readFile;
44
+ readlink: typeof nodeFsp.readlink;
45
+ realpath: typeof nodeFsp.realpath;
46
+ rename: typeof nodeFsp.rename;
47
+ rm: typeof nodeFsp.rm;
48
+ rmdir: typeof nodeFsp.rmdir;
49
+ stat: typeof nodeFsp.stat;
50
+ statfs: typeof nodeFsp.statfs;
51
+ symlink: typeof nodeFsp.symlink;
52
+ truncate: typeof nodeFsp.truncate;
53
+ unlink: typeof nodeFsp.unlink;
54
+ utimes: typeof nodeFsp.utimes;
55
+ watch: typeof nodeFsp.watch;
56
+ writeFile: typeof nodeFsp.writeFile;
57
+ writeFileAtomic: typeof writeFileAtomic;
58
+ withTimeout: typeof withTimeout;
59
+ };
60
+ export default _default;
61
+
62
+ export { FileHandle }
63
+
64
+ export declare const glob: typeof nodeFsp.glob;
65
+
66
+ /** Not tried: a call at or above this path missed its deadline recently. */
67
+ export declare const KAY_FS_COOLING_DOWN = "ERR_KAY_FS_COOLING_DOWN";
68
+
69
+ /** The call did not finish by its deadline; the host abandoned the worker running it. */
70
+ export declare const KAY_FS_DEADLINE = "ERR_KAY_FS_DEADLINE";
71
+
72
+ /** A call's deadline when its options name none. */
73
+ export declare const KAY_FS_DEFAULT_TIMEOUT_MS = 30000;
74
+
75
+ /** Not tried: the host's file workers are all stuck on other paths. */
76
+ export declare const KAY_FS_SATURATED = "ERR_KAY_FS_SATURATED";
77
+
78
+ /** The host's file service is closed, or its worker could not start or died mid-call. */
79
+ export declare const KAY_FS_UNAVAILABLE = "ERR_KAY_FS_UNAVAILABLE";
80
+
81
+ /** An option or function this module does not implement (see the module docs). */
82
+ export declare const KAY_FS_UNSUPPORTED = "ERR_KAY_FS_UNSUPPORTED";
83
+
84
+ export declare const lchmod: typeof nodeFsp.lchmod;
85
+
86
+ export declare const lchown: typeof nodeFsp.lchown;
87
+
88
+ export declare const link: typeof nodeFsp.link;
89
+
90
+ export declare const lstat: typeof nodeFsp.lstat;
91
+
92
+ export declare const lutimes: typeof nodeFsp.lutimes;
93
+
94
+ export declare const mkdir: typeof nodeFsp.mkdir;
95
+
96
+ export declare const mkdtemp: typeof nodeFsp.mkdtemp;
97
+
98
+ /** Node 24's disposable temporary directory, built on {@link mkdtemp} and {@link rm}. */
99
+ export declare const mkdtempDisposable: (prefix: string, options?: unknown) => Promise<{
100
+ path: string;
101
+ remove(): Promise<void>;
102
+ [Symbol.asyncDispose](): Promise<void>;
103
+ }>;
104
+
105
+ export declare const open: typeof nodeFsp.open;
106
+
107
+ export declare const opendir: typeof nodeFsp.opendir;
108
+
109
+ export declare const readdir: typeof nodeFsp.readdir;
110
+
111
+ export declare const readFile: typeof nodeFsp.readFile;
112
+
113
+ export declare const readlink: typeof nodeFsp.readlink;
114
+
115
+ export declare const realpath: typeof nodeFsp.realpath;
116
+
117
+ export declare const rename: typeof nodeFsp.rename;
118
+
119
+ export declare const rm: typeof nodeFsp.rm;
120
+
121
+ export declare const rmdir: typeof nodeFsp.rmdir;
122
+
123
+ export declare const stat: typeof nodeFsp.stat;
124
+
125
+ export declare const statfs: typeof nodeFsp.statfs;
126
+
127
+ export declare const symlink: typeof nodeFsp.symlink;
128
+
129
+ export declare const truncate: typeof nodeFsp.truncate;
130
+
131
+ export declare const unlink: typeof nodeFsp.unlink;
132
+
133
+ export declare const utimes: typeof nodeFsp.utimes;
134
+
135
+ export declare const watch: typeof nodeFsp.watch;
136
+
137
+ /**
138
+ * Run `run` with `timeoutMs` as the deadline of every call it makes that names none itself,
139
+ * including calls without an options object (`open`, `stat`, a file handle's methods). Not in
140
+ * Node; with no host installed it only runs `run`.
141
+ */
142
+ export declare function withTimeout<T>(timeoutMs: number, run: () => T): T;
143
+
144
+ export declare const writeFile: typeof nodeFsp.writeFile;
145
+
146
+ /**
147
+ * Replace `path` so a reader never sees a partial file: write a temporary file beside it, flush
148
+ * it to disk, then rename it over `path`. Not in Node; works with or without a host.
149
+ */
150
+ export declare function writeFileAtomic(path: string | URL, data: string | NodeJS.ArrayBufferView, options?: {
151
+ readonly encoding?: BufferEncoding;
152
+ readonly mode?: number;
153
+ readonly timeoutMs?: number;
154
+ }): Promise<void>;
155
+
156
+ export { }