@silo-code/sdk 0.41.0 → 0.42.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/dist/extension-storage.d.ts +53 -2
- package/dist/extension-storage.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/permissions.d.ts +24 -0
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +30 -0
- package/dist/permissions.js.map +1 -1
- package/package.json +1 -1
- package/src/extension-storage.ts +53 -2
- package/src/index.ts +3 -2
- package/src/permissions.ts +31 -0
|
@@ -34,8 +34,9 @@ export interface ExtensionStorage {
|
|
|
34
34
|
subscribe(listener: () => void): Disposable;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* The
|
|
38
|
-
* {@link ExtensionContext.storage}
|
|
37
|
+
* The persisted-storage scopes available to an extension, exposed as
|
|
38
|
+
* {@link ExtensionContext.storage}: two key/value bags for settings-sized
|
|
39
|
+
* state, and the two matching **directories** for real data files.
|
|
39
40
|
*
|
|
40
41
|
* @category Consumer Services
|
|
41
42
|
* @public
|
|
@@ -52,5 +53,55 @@ export interface ExtensionStorageScopes {
|
|
|
52
53
|
* toggles). The bag is swapped when the active workspace changes.
|
|
53
54
|
*/
|
|
54
55
|
readonly workspace: ExtensionStorage;
|
|
56
|
+
/**
|
|
57
|
+
* An absolute path to a **directory of your own**, shared across every
|
|
58
|
+
* workspace — the filesystem counterpart to {@link ExtensionStorageScopes.global}.
|
|
59
|
+
* Use it for real data files (a `.jsonl` log, a cache, an export) rather than
|
|
60
|
+
* inventing a path under the user's home directory.
|
|
61
|
+
*
|
|
62
|
+
* The directory is created on first call and lives under Silo's user-config
|
|
63
|
+
* root, namespaced by your extension id:
|
|
64
|
+
* `~/.config/silo/extension-storage/<your-id>/global`. The path is stable
|
|
65
|
+
* across calls, activations, and restarts.
|
|
66
|
+
*
|
|
67
|
+
* **No filesystem permission is needed inside it.** Paths beneath this
|
|
68
|
+
* directory are readable and writable through {@link ExtensionContext.files}
|
|
69
|
+
* without declaring `fs:read` or `fs:write` — your own storage is inside your
|
|
70
|
+
* sandbox, the same way the open workspace folder is. The lift stops at
|
|
71
|
+
* `ctx.files`: running a process with a working directory in here still needs
|
|
72
|
+
* the `process` permission (passing the path to a command as an *argument*
|
|
73
|
+
* needs nothing extra).
|
|
74
|
+
*
|
|
75
|
+
* Relative paths passed to `ctx.files` still resolve against the **workspace**,
|
|
76
|
+
* not this directory — always join onto the absolute path you get back.
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* const dir = await ctx.storage.globalDir();
|
|
80
|
+
* await ctx.files.writeText(`${dir}/tasks.jsonl`, body);
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* Uninstalling your extension does **not** delete this directory unless the
|
|
84
|
+
* user opts in; the data survives a reinstall.
|
|
85
|
+
*/
|
|
86
|
+
globalDir(): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* An absolute path to a directory of your own scoped to the **active
|
|
89
|
+
* workspace** — the filesystem counterpart to
|
|
90
|
+
* {@link ExtensionStorageScopes.workspace}. Created on first call, at
|
|
91
|
+
* `~/.config/silo/extension-storage/<your-id>/workspaces/<workspaceId>`.
|
|
92
|
+
*
|
|
93
|
+
* Everything {@link ExtensionStorageScopes.globalDir} says about permissions
|
|
94
|
+
* and relative paths applies here too. Call it again after the active
|
|
95
|
+
* workspace changes — the path changes with it, so don't cache it across a
|
|
96
|
+
* workspace switch.
|
|
97
|
+
*
|
|
98
|
+
* The directory follows the workspace's **identity**, not its folder path:
|
|
99
|
+
* deleting a workspace and re-adding the same folder gives you a new, empty
|
|
100
|
+
* directory (the same rule {@link ExtensionStorageScopes.workspace} follows).
|
|
101
|
+
* Deleting a workspace leaves the directory on disk.
|
|
102
|
+
*
|
|
103
|
+
* Rejects with `NoWorkspaceError` when no workspace is open.
|
|
104
|
+
*/
|
|
105
|
+
workspaceDir(): Promise<string>;
|
|
55
106
|
}
|
|
56
107
|
//# sourceMappingURL=extension-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-storage.d.ts","sourceRoot":"","sources":["../src/extension-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IACnC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IACpC,kDAAkD;IAClD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,gDAAgD;IAChD,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;CAC7C;AAED
|
|
1
|
+
{"version":3,"file":"extension-storage.d.ts","sourceRoot":"","sources":["../src/extension-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IACnC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IACpC,kDAAkD;IAClD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,gDAAgD;IAChD,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type { ToolbarSurface, ToolbarItemContext, ToolbarItemFields, ToolbarComm
|
|
|
33
33
|
export type { FileService, FileMeta, FileChangeKind, FileChangeEvent, } from "./file-service.js";
|
|
34
34
|
export type { SearchService, SearchOptions, SearchMatch, SearchFileResult, SearchResponse, } from "./search-service.js";
|
|
35
35
|
export type { Permission } from "./permissions.js";
|
|
36
|
-
export { PathDeniedError } from "./permissions.js";
|
|
36
|
+
export { PathDeniedError, NoWorkspaceError } from "./permissions.js";
|
|
37
37
|
export type { ThemeService, ThemeState, ThemePreset, ResolvedTheme, ThemeBase, ThemeVars, CustomTheme, ThemeExport, } from "./theme-service.js";
|
|
38
38
|
export type { ExtensionStorage, ExtensionStorageScopes, } from "./extension-storage.js";
|
|
39
39
|
export type { DndService, DndItem, DndMime, DragInit, DndMode, DropContext, DropTargetHandlers, } from "./dnd-service.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WA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AAC5B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,8BAA8B,EAC9B,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,EAC5B,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,gBAAgB,EACh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mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
export { activityFromAgent } from "./activity.js";
|
|
19
19
|
export { ActivityGlyph } from "./ActivityGlyph.js";
|
|
20
|
-
export { PathDeniedError } from "./permissions.js";
|
|
20
|
+
export { PathDeniedError, NoWorkspaceError } from "./permissions.js";
|
|
21
21
|
export { DND_MIME } from "./dnd-service.js";
|
|
22
22
|
// Server-side HTTP client — bypasses CORS, readable response headers.
|
|
23
23
|
export { NetworkError } from "./network-service.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsHH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsHH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAiChD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA6BlE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAyBzC,sEAAsE;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAkCjD,8EAA8E;AAC9E,8EAA8E;AAC9E,6DAA6D;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,yEAAyE;AACzE,iFAAiF;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AAqB,CAAC;AAEtD,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAUvE,6EAA6E;AAC7E,wEAAwE;AACxE,+CAA+C;AAC/C,OAAO,EACL,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC"}
|
package/dist/permissions.d.ts
CHANGED
|
@@ -43,4 +43,28 @@ export declare class PathDeniedError extends Error {
|
|
|
43
43
|
readonly path: string;
|
|
44
44
|
constructor(path: string, message?: string);
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Thrown when an API that needs the **active workspace** is called while no
|
|
48
|
+
* workspace is open — today, {@link ExtensionStorageScopes.workspaceDir}.
|
|
49
|
+
*
|
|
50
|
+
* It is deliberately not a {@link PathDeniedError}: nothing was denied, there
|
|
51
|
+
* is simply nothing to scope to yet. Catch it to fall back to
|
|
52
|
+
* {@link ExtensionStorageScopes.globalDir | globalDir} or to defer the work
|
|
53
|
+
* until a workspace opens:
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* try {
|
|
57
|
+
* const dir = await ctx.storage.workspaceDir();
|
|
58
|
+
* } catch (err) {
|
|
59
|
+
* if (err instanceof NoWorkspaceError) return; // nothing to persist yet
|
|
60
|
+
* throw err;
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @category Core Types
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export declare class NoWorkspaceError extends Error {
|
|
68
|
+
constructor(message?: string);
|
|
69
|
+
}
|
|
46
70
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAS3C"}
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAS3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,CAAC,EAAE,MAAM;CAO7B"}
|
package/dist/permissions.js
CHANGED
|
@@ -37,4 +37,34 @@ export class PathDeniedError extends Error {
|
|
|
37
37
|
Object.setPrototypeOf(this, PathDeniedError.prototype);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Thrown when an API that needs the **active workspace** is called while no
|
|
42
|
+
* workspace is open — today, {@link ExtensionStorageScopes.workspaceDir}.
|
|
43
|
+
*
|
|
44
|
+
* It is deliberately not a {@link PathDeniedError}: nothing was denied, there
|
|
45
|
+
* is simply nothing to scope to yet. Catch it to fall back to
|
|
46
|
+
* {@link ExtensionStorageScopes.globalDir | globalDir} or to defer the work
|
|
47
|
+
* until a workspace opens:
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* try {
|
|
51
|
+
* const dir = await ctx.storage.workspaceDir();
|
|
52
|
+
* } catch (err) {
|
|
53
|
+
* if (err instanceof NoWorkspaceError) return; // nothing to persist yet
|
|
54
|
+
* throw err;
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @category Core Types
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export class NoWorkspaceError extends Error {
|
|
62
|
+
constructor(message) {
|
|
63
|
+
super(message ?? "No workspace is open");
|
|
64
|
+
this.name = "NoWorkspaceError";
|
|
65
|
+
// Same prototype-chain restoration as PathDeniedError — `instanceof` has to
|
|
66
|
+
// survive the down-leveled build and the host↔extension boundary.
|
|
67
|
+
Object.setPrototypeOf(this, NoWorkspaceError.prototype);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
40
70
|
//# sourceMappingURL=permissions.js.map
|
package/dist/permissions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,qEAAqE;AA+BrE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAIxC,YAAY,IAAY,EAAE,OAAgB;QACxC,KAAK,CAAC,OAAO,IAAI,kCAAkC,IAAI,EAAE,CAAC,CAAC;QAJ7D,8DAA8D;QACrD;;;;;WAAa;QAIpB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,4EAA4E;QAC5E,4EAA4E;QAC5E,yCAAyC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,qEAAqE;AA+BrE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAIxC,YAAY,IAAY,EAAE,OAAgB;QACxC,KAAK,CAAC,OAAO,IAAI,kCAAkC,IAAI,EAAE,CAAC,CAAC;QAJ7D,8DAA8D;QACrD;;;;;WAAa;QAIpB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,4EAA4E;QAC5E,4EAA4E;QAC5E,yCAAyC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,sBAAsB,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,4EAA4E;QAC5E,kEAAkE;QAClE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
package/package.json
CHANGED
package/src/extension-storage.ts
CHANGED
|
@@ -36,8 +36,9 @@ export interface ExtensionStorage {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* The
|
|
40
|
-
* {@link ExtensionContext.storage}
|
|
39
|
+
* The persisted-storage scopes available to an extension, exposed as
|
|
40
|
+
* {@link ExtensionContext.storage}: two key/value bags for settings-sized
|
|
41
|
+
* state, and the two matching **directories** for real data files.
|
|
41
42
|
*
|
|
42
43
|
* @category Consumer Services
|
|
43
44
|
* @public
|
|
@@ -54,4 +55,54 @@ export interface ExtensionStorageScopes {
|
|
|
54
55
|
* toggles). The bag is swapped when the active workspace changes.
|
|
55
56
|
*/
|
|
56
57
|
readonly workspace: ExtensionStorage;
|
|
58
|
+
/**
|
|
59
|
+
* An absolute path to a **directory of your own**, shared across every
|
|
60
|
+
* workspace — the filesystem counterpart to {@link ExtensionStorageScopes.global}.
|
|
61
|
+
* Use it for real data files (a `.jsonl` log, a cache, an export) rather than
|
|
62
|
+
* inventing a path under the user's home directory.
|
|
63
|
+
*
|
|
64
|
+
* The directory is created on first call and lives under Silo's user-config
|
|
65
|
+
* root, namespaced by your extension id:
|
|
66
|
+
* `~/.config/silo/extension-storage/<your-id>/global`. The path is stable
|
|
67
|
+
* across calls, activations, and restarts.
|
|
68
|
+
*
|
|
69
|
+
* **No filesystem permission is needed inside it.** Paths beneath this
|
|
70
|
+
* directory are readable and writable through {@link ExtensionContext.files}
|
|
71
|
+
* without declaring `fs:read` or `fs:write` — your own storage is inside your
|
|
72
|
+
* sandbox, the same way the open workspace folder is. The lift stops at
|
|
73
|
+
* `ctx.files`: running a process with a working directory in here still needs
|
|
74
|
+
* the `process` permission (passing the path to a command as an *argument*
|
|
75
|
+
* needs nothing extra).
|
|
76
|
+
*
|
|
77
|
+
* Relative paths passed to `ctx.files` still resolve against the **workspace**,
|
|
78
|
+
* not this directory — always join onto the absolute path you get back.
|
|
79
|
+
*
|
|
80
|
+
* ```ts
|
|
81
|
+
* const dir = await ctx.storage.globalDir();
|
|
82
|
+
* await ctx.files.writeText(`${dir}/tasks.jsonl`, body);
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* Uninstalling your extension does **not** delete this directory unless the
|
|
86
|
+
* user opts in; the data survives a reinstall.
|
|
87
|
+
*/
|
|
88
|
+
globalDir(): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* An absolute path to a directory of your own scoped to the **active
|
|
91
|
+
* workspace** — the filesystem counterpart to
|
|
92
|
+
* {@link ExtensionStorageScopes.workspace}. Created on first call, at
|
|
93
|
+
* `~/.config/silo/extension-storage/<your-id>/workspaces/<workspaceId>`.
|
|
94
|
+
*
|
|
95
|
+
* Everything {@link ExtensionStorageScopes.globalDir} says about permissions
|
|
96
|
+
* and relative paths applies here too. Call it again after the active
|
|
97
|
+
* workspace changes — the path changes with it, so don't cache it across a
|
|
98
|
+
* workspace switch.
|
|
99
|
+
*
|
|
100
|
+
* The directory follows the workspace's **identity**, not its folder path:
|
|
101
|
+
* deleting a workspace and re-adding the same folder gives you a new, empty
|
|
102
|
+
* directory (the same rule {@link ExtensionStorageScopes.workspace} follows).
|
|
103
|
+
* Deleting a workspace leaves the directory on disk.
|
|
104
|
+
*
|
|
105
|
+
* Rejects with `NoWorkspaceError` when no workspace is open.
|
|
106
|
+
*/
|
|
107
|
+
workspaceDir(): Promise<string>;
|
|
57
108
|
}
|
package/src/index.ts
CHANGED
|
@@ -163,9 +163,10 @@ export type {
|
|
|
163
163
|
} from "./search-service";
|
|
164
164
|
// The permission surface: the capability vocabulary an extension declares, and
|
|
165
165
|
// the error the host throws when an extension reaches outside the workspace
|
|
166
|
-
// without the matching grant. `PathDeniedError`
|
|
166
|
+
// without the matching grant. `PathDeniedError` and `NoWorkspaceError` are
|
|
167
|
+
// classes (runtime values).
|
|
167
168
|
export type { Permission } from "./permissions";
|
|
168
|
-
export { PathDeniedError } from "./permissions";
|
|
169
|
+
export { PathDeniedError, NoWorkspaceError } from "./permissions";
|
|
169
170
|
// The theme domain: the consumer service + its state/resolve shapes, the
|
|
170
171
|
// `ThemePreset` contribution type (registered via ctx.registerThemePreset), and
|
|
171
172
|
// the underlying theme types (re-exported from ./domain-types via theme-service).
|
package/src/permissions.ts
CHANGED
|
@@ -63,3 +63,34 @@ export class PathDeniedError extends Error {
|
|
|
63
63
|
Object.setPrototypeOf(this, PathDeniedError.prototype);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Thrown when an API that needs the **active workspace** is called while no
|
|
69
|
+
* workspace is open — today, {@link ExtensionStorageScopes.workspaceDir}.
|
|
70
|
+
*
|
|
71
|
+
* It is deliberately not a {@link PathDeniedError}: nothing was denied, there
|
|
72
|
+
* is simply nothing to scope to yet. Catch it to fall back to
|
|
73
|
+
* {@link ExtensionStorageScopes.globalDir | globalDir} or to defer the work
|
|
74
|
+
* until a workspace opens:
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* try {
|
|
78
|
+
* const dir = await ctx.storage.workspaceDir();
|
|
79
|
+
* } catch (err) {
|
|
80
|
+
* if (err instanceof NoWorkspaceError) return; // nothing to persist yet
|
|
81
|
+
* throw err;
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @category Core Types
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export class NoWorkspaceError extends Error {
|
|
89
|
+
constructor(message?: string) {
|
|
90
|
+
super(message ?? "No workspace is open");
|
|
91
|
+
this.name = "NoWorkspaceError";
|
|
92
|
+
// Same prototype-chain restoration as PathDeniedError — `instanceof` has to
|
|
93
|
+
// survive the down-leveled build and the host↔extension boundary.
|
|
94
|
+
Object.setPrototypeOf(this, NoWorkspaceError.prototype);
|
|
95
|
+
}
|
|
96
|
+
}
|