@pstdio/sdk 0.21.0 → 0.22.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 +22 -192
- package/dist/api/index.js +419 -298
- package/dist/api.d.ts +3767 -0
- package/dist/client/index.js +1 -0
- package/dist/client.d.ts +1714 -0
- package/dist/extensions/index.js +120 -19
- package/dist/extensions/react/index.js +2 -1
- package/dist/{extensions/react/index.d.ts → extensions-react.d.ts} +23 -16
- package/dist/extensions.d.ts +3826 -0
- package/dist/hooks.d.ts +1775 -0
- package/dist/{prompts/render-prompt.d.ts → prompts.d.ts} +3 -1
- package/dist/resources/index.js +419 -298
- package/dist/resources.d.ts +422 -0
- package/package.json +12 -31
- package/dist/api/extensions.d.ts +0 -1
- package/dist/api/index.d.ts +0 -9
- package/dist/api/projects.d.ts +0 -1
- package/dist/api/sessions.d.ts +0 -2
- package/dist/api/settings.d.ts +0 -1
- package/dist/api/skills.d.ts +0 -1
- package/dist/api/terminal.d.ts +0 -49
- package/dist/api/workspaces.d.ts +0 -12
- package/dist/client/agents.d.ts +0 -10
- package/dist/client/automation.d.ts +0 -12
- package/dist/client/client.d.ts +0 -26
- package/dist/client/extensions.d.ts +0 -15
- package/dist/client/index.d.ts +0 -14
- package/dist/client/notifications.d.ts +0 -23
- package/dist/client/projects.d.ts +0 -14
- package/dist/client/request.d.ts +0 -25
- package/dist/client/runtime.d.ts +0 -5
- package/dist/client/sessions.d.ts +0 -45
- package/dist/client/settings.d.ts +0 -7
- package/dist/client/skills.d.ts +0 -9
- package/dist/client/sse.d.ts +0 -15
- package/dist/client/sync.d.ts +0 -35
- package/dist/client/workspaces.d.ts +0 -20
- package/dist/extensions/command-outcome.d.ts +0 -5
- package/dist/extensions/define-command.d.ts +0 -28
- package/dist/extensions/define-contribution.d.ts +0 -36
- package/dist/extensions/define-extension-view.d.ts +0 -58
- package/dist/extensions/define-extension.d.ts +0 -24
- package/dist/extensions/index.d.ts +0 -14
- package/dist/extensions/params.d.ts +0 -33
- package/dist/extensions/refs.d.ts +0 -8
- package/dist/extensions/terminal-session-bridge.d.ts +0 -32
- package/dist/extensions/webview-client.d.ts +0 -41
- package/dist/extensions/when.d.ts +0 -11
- package/dist/hooks/base.d.ts +0 -17
- package/dist/hooks/entities.d.ts +0 -8
- package/dist/hooks/index.d.ts +0 -3
- package/dist/hooks/session.d.ts +0 -12
- package/dist/hooks/worktree.d.ts +0 -53
- package/dist/prompts/index.d.ts +0 -1
- package/dist/resources/agent.d.ts +0 -2
- package/dist/resources/file.d.ts +0 -1
- package/dist/resources/index.d.ts +0 -9
- package/dist/resources/project.d.ts +0 -1
- package/dist/resources/session.d.ts +0 -1
- package/dist/resources/settings.d.ts +0 -1
- package/dist/resources/skill.d.ts +0 -1
- package/dist/resources/workspace.d.ts +0 -3
package/dist/extensions/index.js
CHANGED
|
@@ -13,19 +13,25 @@ var __export = (target, all) => {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
// ../pstdio-api-contracts/src/extension-kernel/types/composition.ts
|
|
17
|
+
var dockedWorkbenchRegions = ["sidenav", "main", "secondary", "side"];
|
|
18
|
+
var extensionPanelRegions = ["main", "secondary", "side"];
|
|
19
|
+
|
|
16
20
|
// ../pstdio-api-contracts/src/extension-kernel/builtin-refs.ts
|
|
17
21
|
var hostRef = (kind, id) => ({ extensionId: "pstdio", kind, id });
|
|
18
|
-
var workbenchCommands = {
|
|
19
|
-
switchMode: hostRef("command", "workbench.action.switchMode")
|
|
20
|
-
};
|
|
21
22
|
var workbenchModes = {
|
|
22
23
|
project: hostRef("mode", "project"),
|
|
24
|
+
sessions: hostRef("mode", "sessions"),
|
|
23
25
|
settings: hostRef("mode", "settings")
|
|
24
26
|
};
|
|
27
|
+
var workbenchModeDefinitions = {
|
|
28
|
+
project: { ref: workbenchModes.project, regions: dockedWorkbenchRegions },
|
|
29
|
+
sessions: { ref: workbenchModes.sessions, regions: dockedWorkbenchRegions },
|
|
30
|
+
settings: { ref: workbenchModes.settings, regions: dockedWorkbenchRegions }
|
|
31
|
+
};
|
|
25
32
|
var hostResourceKind = (id, label, menuSlots) => ({
|
|
26
33
|
id,
|
|
27
34
|
ref: hostRef("resource-kind", id),
|
|
28
|
-
surface: "primary",
|
|
29
35
|
label,
|
|
30
36
|
menuSlots
|
|
31
37
|
});
|
|
@@ -43,12 +49,65 @@ var workbenchResourceKinds = {
|
|
|
43
49
|
session: workbenchResourceKindDefinitions.session.ref,
|
|
44
50
|
workspace: workbenchResourceKindDefinitions.workspace.ref
|
|
45
51
|
};
|
|
52
|
+
var workbenchPages = {
|
|
53
|
+
start: hostRef("page", "start"),
|
|
54
|
+
sessions: hostRef("page", "sessions"),
|
|
55
|
+
session: hostRef("page", "session"),
|
|
56
|
+
workspaces: hostRef("page", "workspaces"),
|
|
57
|
+
workspace: hostRef("page", "workspace")
|
|
58
|
+
};
|
|
59
|
+
var workbenchPageDefinitions = {
|
|
60
|
+
start: {
|
|
61
|
+
ref: workbenchPages.start,
|
|
62
|
+
mode: workbenchModes.project,
|
|
63
|
+
path: "",
|
|
64
|
+
primary: { cardinality: "one", resourceKinds: [] }
|
|
65
|
+
},
|
|
66
|
+
sessions: {
|
|
67
|
+
ref: workbenchPages.sessions,
|
|
68
|
+
mode: workbenchModes.sessions,
|
|
69
|
+
path: "sessions",
|
|
70
|
+
primary: { cardinality: "one", resourceKinds: [] }
|
|
71
|
+
},
|
|
72
|
+
session: {
|
|
73
|
+
ref: workbenchPages.session,
|
|
74
|
+
mode: workbenchModes.sessions,
|
|
75
|
+
path: "session",
|
|
76
|
+
primary: { cardinality: "one", resourceKinds: ["session", "session-draft"] }
|
|
77
|
+
},
|
|
78
|
+
workspaces: {
|
|
79
|
+
ref: workbenchPages.workspaces,
|
|
80
|
+
mode: workbenchModes.project,
|
|
81
|
+
path: "workspaces",
|
|
82
|
+
primary: { cardinality: "one", resourceKinds: [] }
|
|
83
|
+
},
|
|
84
|
+
workspace: {
|
|
85
|
+
ref: workbenchPages.workspace,
|
|
86
|
+
mode: workbenchModes.project,
|
|
87
|
+
path: "workspace",
|
|
88
|
+
primary: { cardinality: "many", resourceKinds: ["workspace"] }
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var workbenchPanels = {
|
|
92
|
+
projectSession: hostRef("placement", "project-session")
|
|
93
|
+
};
|
|
94
|
+
var workbenchPanelDefinitions = {
|
|
95
|
+
projectSession: {
|
|
96
|
+
ref: workbenchPanels.projectSession,
|
|
97
|
+
mode: workbenchModes.project,
|
|
98
|
+
cardinality: "many",
|
|
99
|
+
resourceKinds: ["session", "session-draft"]
|
|
100
|
+
}
|
|
101
|
+
};
|
|
46
102
|
var workbenchSlots = {
|
|
47
|
-
projectNavigation: hostRef("navigation-item", "project.navigation"),
|
|
48
103
|
projectSettings: hostRef("settings-panel", "project.settings"),
|
|
49
104
|
statusBarLeading: hostRef("status-bar-item", "status-bar.leading"),
|
|
50
105
|
statusBarTrailing: hostRef("status-bar-item", "status-bar.trailing")
|
|
51
106
|
};
|
|
107
|
+
// ../pstdio-api-contracts/src/extension-kernel/contribution-id.ts
|
|
108
|
+
var localContributionIdPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)*$/;
|
|
109
|
+
var isValidLocalContributionId = (id) => localContributionIdPattern.test(id);
|
|
110
|
+
var localContributionIdGrammar = 'lowercase kebab-case segments separated by dots, such as "ticket-status.create"';
|
|
52
111
|
// ../pstdio-api-contracts/src/extension-kernel/refs.ts
|
|
53
112
|
var createCommandRef = (input) => ({ ...input, kind: "command" });
|
|
54
113
|
var commandRef = Object.assign(createCommandRef, {
|
|
@@ -125,15 +184,14 @@ var packageAsset = (path, baseUrl) => ({
|
|
|
125
184
|
path,
|
|
126
185
|
baseUrl
|
|
127
186
|
});
|
|
128
|
-
// ../pstdio-api-contracts/src/extension-kernel/types/composition.ts
|
|
129
|
-
var dockedWorkbenchRegions = ["sidenav", "main", "secondary", "side"];
|
|
130
187
|
// ../pstdio-api-contracts/src/extension-kernel/types/extension.ts
|
|
131
|
-
var EXTENSION_API_VERSION = "1.0.0-alpha.
|
|
188
|
+
var EXTENSION_API_VERSION = "1.0.0-alpha.10";
|
|
132
189
|
// ../pstdio-api-contracts/src/extension-kernel/types/webview-capabilities.ts
|
|
133
190
|
var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
|
|
134
191
|
var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
135
192
|
"commands.execute",
|
|
136
|
-
"
|
|
193
|
+
"navigation.open",
|
|
194
|
+
"placement.close",
|
|
137
195
|
"notification.show",
|
|
138
196
|
"notification.action",
|
|
139
197
|
"notification.resolve",
|
|
@@ -149,9 +207,11 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
|
149
207
|
"files.list",
|
|
150
208
|
"files.delete"
|
|
151
209
|
];
|
|
210
|
+
var WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES = ["artifacts.read"];
|
|
152
211
|
var ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES = ["host.dispatchKeyboardEvent"];
|
|
153
212
|
var WEBVIEW_HOST_CAPABILITIES = [
|
|
154
213
|
...WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
214
|
+
...WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
155
215
|
...ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
156
216
|
];
|
|
157
217
|
// src/extensions/command-outcome.ts
|
|
@@ -183,14 +243,16 @@ var defineView = defineContribution("view");
|
|
|
183
243
|
var defineViewMenu = defineContribution("view-menu");
|
|
184
244
|
var definePlacement = defineContribution("placement");
|
|
185
245
|
var defineResourceKind = defineContribution("resource-kind");
|
|
186
|
-
var resourceSlotRef = (resourceKind, id) => ({
|
|
187
|
-
resourceKind,
|
|
188
|
-
id
|
|
189
|
-
});
|
|
190
246
|
var resourceMenuSlotRef2 = (resourceKind, id) => defineSlot(`${resourceKind.id}.${id}`, { kind: "menu" });
|
|
191
|
-
var defineResourceView = defineContribution("resource-view");
|
|
192
247
|
var defineNavigationItem = defineContribution("navigation-item");
|
|
248
|
+
var defineNavigationTree = defineContribution("navigation-tree");
|
|
193
249
|
var defineMode = defineContribution("mode");
|
|
250
|
+
var createPage = (definition) => {
|
|
251
|
+
const ref = { kind: "page", id: definition.id };
|
|
252
|
+
const panels = Object.fromEntries(definition.slots.map((slot) => [slot.id, { kind: "page-slot", page: ref, id: slot.id }]));
|
|
253
|
+
return { ...definition, ref, panels };
|
|
254
|
+
};
|
|
255
|
+
var definePage = createPage;
|
|
194
256
|
var defineStatusBarItem = defineContribution("status-bar-item");
|
|
195
257
|
var defineStatuses = defineContribution("status");
|
|
196
258
|
var defineSettingsPanel = defineContribution("settings-panel");
|
|
@@ -242,7 +304,7 @@ var createFilesClient = (host) => ({
|
|
|
242
304
|
upload: (input) => host.call("files.upload", input),
|
|
243
305
|
list: async (input) => {
|
|
244
306
|
const response = await host.call("files.list", input ?? {});
|
|
245
|
-
return response.files
|
|
307
|
+
return response.files;
|
|
246
308
|
},
|
|
247
309
|
delete: (id) => host.call("files.delete", { id })
|
|
248
310
|
});
|
|
@@ -293,16 +355,30 @@ var params = {
|
|
|
293
355
|
}),
|
|
294
356
|
repo: (options) => ({ type: "repo", ...options }),
|
|
295
357
|
harness: (options) => ({ type: "harness", ...options }),
|
|
358
|
+
template: (options) => {
|
|
359
|
+
const { type: templateType, ...rest } = options;
|
|
360
|
+
return { type: "template", templateType, ...rest };
|
|
361
|
+
},
|
|
296
362
|
resource: (options) => ({ type: "resource", ...options }),
|
|
297
363
|
json: (options) => ({ type: "json", ...options }),
|
|
298
364
|
list: (options) => ({ type: "list", ...options })
|
|
299
365
|
};
|
|
366
|
+
// src/extensions/qualify-ref.ts
|
|
367
|
+
function qualifyRef(owner, ref) {
|
|
368
|
+
if (ref.kind === "page-slot")
|
|
369
|
+
return { ...ref, page: qualifyRef(owner, ref.page) };
|
|
370
|
+
return { ...ref, extensionId: owner };
|
|
371
|
+
}
|
|
300
372
|
// src/extensions/refs.ts
|
|
301
373
|
var commandEvent = (command, phase) => ({
|
|
302
374
|
...command.extensionId ? { extensionId: command.extensionId } : {},
|
|
303
375
|
kind: "event",
|
|
304
376
|
id: `command.${phase}:${command.id}`
|
|
305
377
|
});
|
|
378
|
+
// src/extensions/resource-key.ts
|
|
379
|
+
function resourceKey(resource) {
|
|
380
|
+
return resource && JSON.stringify([resource.extensionId ?? "", resource.projectId ?? "", resource.type, resource.id]);
|
|
381
|
+
}
|
|
306
382
|
// src/extensions/terminal-session-bridge.ts
|
|
307
383
|
var TERMINAL_SESSION_CAPABILITY = "terminal.session";
|
|
308
384
|
var createTerminalSessionBridge = (host) => ({
|
|
@@ -375,6 +451,9 @@ var createTerminalSessionBridge = (host) => ({
|
|
|
375
451
|
};
|
|
376
452
|
}
|
|
377
453
|
});
|
|
454
|
+
// src/extensions/webview-capabilities.ts
|
|
455
|
+
var artifactMountId = (mount) => typeof mount === "string" ? mount : mount.id;
|
|
456
|
+
var artifactsRead = (mount) => `artifacts.read:${artifactMountId(mount)}`;
|
|
378
457
|
// src/extensions/webview-client.ts
|
|
379
458
|
var createWebviewClient = (host, options) => {
|
|
380
459
|
const extensionId = options?.extensionId ?? host.extensionId;
|
|
@@ -402,7 +481,16 @@ var createWebviewClient = (host, options) => {
|
|
|
402
481
|
await host.call("extension.settings.set", { key, value });
|
|
403
482
|
}
|
|
404
483
|
};
|
|
405
|
-
|
|
484
|
+
const artifacts = {
|
|
485
|
+
list: (mount, prefix) => host.call("artifacts.read", {
|
|
486
|
+
op: "list",
|
|
487
|
+
mount: artifactMountId(mount),
|
|
488
|
+
...prefix === undefined ? {} : { prefix }
|
|
489
|
+
}),
|
|
490
|
+
readText: (mount, path) => host.call("artifacts.read", { op: "readText", mount: artifactMountId(mount), path }),
|
|
491
|
+
imageUrl: (mount, path) => host.call("artifacts.read", { op: "imageUrl", mount: artifactMountId(mount), path })
|
|
492
|
+
};
|
|
493
|
+
return { artifacts, commands, settings };
|
|
406
494
|
};
|
|
407
495
|
// src/extensions/when.ts
|
|
408
496
|
var matchesResourceWhen = (when, resourceType) => {
|
|
@@ -418,21 +506,30 @@ export {
|
|
|
418
506
|
workbenchSlots,
|
|
419
507
|
workbenchResourceKinds,
|
|
420
508
|
workbenchResourceKindDefinitions,
|
|
509
|
+
workbenchPanels,
|
|
510
|
+
workbenchPanelDefinitions,
|
|
511
|
+
workbenchPages,
|
|
512
|
+
workbenchPageDefinitions,
|
|
421
513
|
workbenchModes,
|
|
422
|
-
|
|
514
|
+
workbenchModeDefinitions,
|
|
423
515
|
unwrapCommandOutcome,
|
|
424
516
|
sessionSlots,
|
|
425
517
|
sessionEvents,
|
|
426
|
-
resourceSlotRef,
|
|
427
518
|
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
519
|
+
resourceKey,
|
|
520
|
+
qualifyRef,
|
|
428
521
|
projectSlots,
|
|
429
522
|
projectEvents,
|
|
430
523
|
params,
|
|
431
524
|
packageAsset,
|
|
432
525
|
matchesResourceWhen,
|
|
526
|
+
localContributionIdPattern,
|
|
527
|
+
localContributionIdGrammar,
|
|
433
528
|
l10n,
|
|
529
|
+
isValidLocalContributionId,
|
|
434
530
|
isLocalizedString,
|
|
435
531
|
gitEvents,
|
|
532
|
+
extensionPanelRegions,
|
|
436
533
|
eventRef,
|
|
437
534
|
dockedWorkbenchRegions,
|
|
438
535
|
defineWorkspaceType,
|
|
@@ -448,10 +545,11 @@ export {
|
|
|
448
545
|
defineSettingsSection,
|
|
449
546
|
defineSettingsPanel,
|
|
450
547
|
defineSchedule,
|
|
451
|
-
defineResourceView,
|
|
452
548
|
defineResourceKind,
|
|
453
549
|
defineResourceHierarchyProvider,
|
|
454
550
|
definePlacement,
|
|
551
|
+
definePage,
|
|
552
|
+
defineNavigationTree,
|
|
455
553
|
defineNavigationItem,
|
|
456
554
|
defineMode,
|
|
457
555
|
defineMiddleware,
|
|
@@ -470,6 +568,9 @@ export {
|
|
|
470
568
|
createTerminalSessionBridge,
|
|
471
569
|
commandRef,
|
|
472
570
|
commandEvent,
|
|
571
|
+
artifactsRead,
|
|
572
|
+
artifactMountId,
|
|
573
|
+
WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
473
574
|
WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
474
575
|
WEBVIEW_HOST_CAPABILITIES,
|
|
475
576
|
WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
@@ -17,12 +17,13 @@ var __export = (target, all) => {
|
|
|
17
17
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
18
18
|
var useCommandQuery = (input) => {
|
|
19
19
|
const { command, enabled, queryKey, staleTime } = input;
|
|
20
|
-
|
|
20
|
+
const query = useQuery({
|
|
21
21
|
queryKey,
|
|
22
22
|
enabled,
|
|
23
23
|
staleTime,
|
|
24
24
|
queryFn: () => command()
|
|
25
25
|
});
|
|
26
|
+
return query;
|
|
26
27
|
};
|
|
27
28
|
var useCommandMutation = (input) => {
|
|
28
29
|
const { command, invalidate } = input;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { QueryKey } from '@tanstack/react-query';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
4
|
+
|
|
5
|
+
declare interface CommandMutationInput<TParams, TResult> {
|
|
6
|
+
command: (params: TParams) => Promise<TResult>;
|
|
7
|
+
invalidate?: QueryKey[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare interface CommandQueryInput<TResult> {
|
|
11
|
+
queryKey: QueryKey;
|
|
12
|
+
command: () => Promise<TResult>;
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
staleTime?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Writes server state via a typed client command and refreshes affected queries on success. */
|
|
18
|
+
export declare const useCommandMutation: <TParams, TResult>(input: CommandMutationInput<TParams, TResult>) => UseMutationResult<TResult, Error, TParams, unknown>;
|
|
19
|
+
|
|
20
|
+
/** Reads server state via a typed client command, cached and deduped by react-query. */
|
|
21
|
+
export declare const useCommandQuery: <TResult>(input: CommandQueryInput<TResult>) => UseQueryResult<TResult>;
|
|
22
|
+
|
|
23
|
+
export { }
|