@pstdio/sdk 0.24.0 → 0.25.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/api/index.js +1694 -10276
- package/dist/api.d.ts +1 -0
- package/dist/client/index.js +6 -21
- package/dist/client.d.ts +1 -0
- package/dist/data/index.js +9 -24
- package/dist/data.d.ts +2 -0
- package/dist/extensions/index.js +187 -108
- package/dist/extensions/react/index.js +2 -17
- package/dist/extensions.d.ts +22 -2
- package/dist/hooks.d.ts +1 -0
- package/dist/prompts/index.js +0 -15
- package/dist/resources/index.js +1694 -10276
- package/dist/testing/index.js +17 -20
- package/dist/testing.d.ts +11 -0
- package/package.json +1 -1
package/dist/testing/index.js
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
// src/testing/memory-resources.ts
|
|
17
2
|
var createMemoryResources = (prefixes, sequences = new Map) => ({
|
|
3
|
+
removed: async () => {},
|
|
18
4
|
allocate: async ({ kind }) => {
|
|
19
5
|
const prefix = prefixes[kind];
|
|
20
6
|
if (!prefix)
|
|
@@ -43,6 +29,7 @@ var makeCommandContext = (input) => {
|
|
|
43
29
|
project: { id: projectId, name: "Test Project", shorthand: "T" },
|
|
44
30
|
storage,
|
|
45
31
|
resources,
|
|
32
|
+
navigation: { open: () => {} },
|
|
46
33
|
invocation: { params },
|
|
47
34
|
events: { emit: async () => ({ delivered: 0 }) },
|
|
48
35
|
notify: { action: async () => ({}), dismiss: async () => [], resolve: async () => [], toast: async () => {} },
|
|
@@ -72,6 +59,11 @@ var createMemoryRepoFiles = () => {
|
|
|
72
59
|
writeText: async (path, value) => {
|
|
73
60
|
files.set(path, encoder.encode(value));
|
|
74
61
|
},
|
|
62
|
+
updateText: async (path, value) => {
|
|
63
|
+
if (!files.has(path))
|
|
64
|
+
throw new Error(`File not found: ${path}`);
|
|
65
|
+
files.set(path, encoder.encode(value));
|
|
66
|
+
},
|
|
75
67
|
readBytes: async (path) => {
|
|
76
68
|
const value = files.get(path);
|
|
77
69
|
if (value === undefined)
|
|
@@ -185,6 +177,11 @@ var createMemoryStorage = () => {
|
|
|
185
177
|
async put(id, value) {
|
|
186
178
|
store.set(id, value);
|
|
187
179
|
},
|
|
180
|
+
async update(id, value) {
|
|
181
|
+
if (!store.has(id))
|
|
182
|
+
throw new Error(`Item not found: ${id}`);
|
|
183
|
+
store.set(id, value);
|
|
184
|
+
},
|
|
188
185
|
async createIfAbsent(id, value) {
|
|
189
186
|
if (store.has(id))
|
|
190
187
|
return false;
|
|
@@ -213,10 +210,10 @@ var createMemoryStorage = () => {
|
|
|
213
210
|
return api;
|
|
214
211
|
};
|
|
215
212
|
export {
|
|
216
|
-
|
|
217
|
-
makeCommandArgs,
|
|
218
|
-
createMemoryStorage,
|
|
219
|
-
createMemoryResources,
|
|
213
|
+
commandParamsFor,
|
|
220
214
|
createMemoryRepoFiles,
|
|
221
|
-
|
|
215
|
+
createMemoryResources,
|
|
216
|
+
createMemoryStorage,
|
|
217
|
+
makeCommandArgs,
|
|
218
|
+
makeCommandContext
|
|
222
219
|
};
|
package/dist/testing.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ declare interface ArtifactMount {
|
|
|
10
10
|
exists(path: string): Promise<boolean>;
|
|
11
11
|
readText(path: string): Promise<string>;
|
|
12
12
|
writeText(path: string, value: string): Promise<void>;
|
|
13
|
+
/** Replace existing text. Fails if missing and never recreates a concurrently deleted file. */
|
|
14
|
+
updateText(path: string, value: string): Promise<void>;
|
|
13
15
|
readBytes(path: string): Promise<Uint8Array>;
|
|
14
16
|
writeBytes(path: string, value: Uint8Array): Promise<void>;
|
|
15
17
|
list(pattern?: string): Promise<ArtifactFile[]>;
|
|
@@ -88,6 +90,7 @@ declare type CommandOutcome<TResult = unknown> = {
|
|
|
88
90
|
ok: true;
|
|
89
91
|
status: "success";
|
|
90
92
|
value: TResult;
|
|
93
|
+
navigationRequests?: NavigationTarget[];
|
|
91
94
|
notices?: CommandNotice[];
|
|
92
95
|
diagnostics?: CommandDiagnostic[];
|
|
93
96
|
} | {
|
|
@@ -283,6 +286,10 @@ declare interface ExtensionContextBase<TSettings extends Record<string, unknown>
|
|
|
283
286
|
source?: CommandSource;
|
|
284
287
|
storage: ExtensionStorageApi;
|
|
285
288
|
resources: ExtensionResourcesApi;
|
|
289
|
+
/** Records navigation for the invoking UI; headless execution opens nothing. */
|
|
290
|
+
navigation: {
|
|
291
|
+
open(target: NavigationTarget): void;
|
|
292
|
+
};
|
|
286
293
|
artifacts: ExtensionArtifactApi;
|
|
287
294
|
/** Working tree of the invocation's repo, scoped to its root. Absent for non-repo (event/hook) invocations. */
|
|
288
295
|
repoFiles?: ArtifactMount;
|
|
@@ -394,6 +401,8 @@ declare interface ExtensionReposApi {
|
|
|
394
401
|
}
|
|
395
402
|
|
|
396
403
|
declare interface ExtensionResourcesApi {
|
|
404
|
+
/** Publish a committed removal to clients displaying this project resource. */
|
|
405
|
+
removed(resource: ResourceRef): Promise<void>;
|
|
397
406
|
allocate(input: {
|
|
398
407
|
kind: string;
|
|
399
408
|
}): Promise<{
|
|
@@ -480,6 +489,8 @@ declare interface ExtensionStorageCollectionApi<TItem = unknown> {
|
|
|
480
489
|
get(id: string): Promise<TItem | undefined>;
|
|
481
490
|
list(): Promise<TItem[]>;
|
|
482
491
|
put(id: string, value: TItem): Promise<void>;
|
|
492
|
+
/** Replace an existing item atomically. Throws if the item was deleted. */
|
|
493
|
+
update(id: string, value: TItem): Promise<void>;
|
|
483
494
|
createIfAbsent(id: string, value: TItem): Promise<boolean>;
|
|
484
495
|
deleteIfValue(id: string, value: TItem): Promise<boolean>;
|
|
485
496
|
create(value: TItem): Promise<TItem & {
|