@pstdio/sdk 0.4.2 → 0.6.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/extensions.d.ts +1 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/skills.d.ts +1 -0
- package/dist/client/extensions.d.ts +4 -1
- package/dist/client/index.js +7 -1
- package/dist/client/skills.d.ts +2 -1
- package/dist/extensions/define-extension-view.d.ts +29 -0
- package/dist/extensions/define-extension.d.ts +7 -8
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.js +33 -3
- package/dist/extensions/kernel-slots.d.ts +1 -0
- package/dist/extensions/package-asset.d.ts +1 -1
- package/dist/extensions/refs.d.ts +11 -9
- package/dist/extensions/types/context.d.ts +2 -1
- package/dist/extensions/types/contributions.d.ts +17 -7
- package/dist/extensions/types/extension.d.ts +27 -17
- package/dist/extensions/types/index.d.ts +1 -0
- package/dist/extensions/types/webview-capabilities.d.ts +55 -0
- package/dist/hooks/session.d.ts +1 -1
- package/dist/plugins/helpers/create-session.d.ts +2 -1
- package/dist/plugins/helpers/followup-session.d.ts +2 -1
- package/package.json +15 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse, } from "pstdio-api-contracts";
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type { ActionResult, ExecuteActionInput } from "./actions";
|
|
2
2
|
export type { SetupAgentInput, SetupAvailableAgentsInput, UpdateAgentInput } from "./agents";
|
|
3
|
+
export type { UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse } from "./extensions";
|
|
3
4
|
export type { CreateProjectInput, RegisterRepoInput } from "./projects";
|
|
4
5
|
export type { ApprovalInput, CreateSessionInput, FollowUpInput, ResolveSessionIdInput, ResolveSessionIdResponse, SessionConversationResponse, } from "./sessions";
|
|
6
|
+
export type { UpdateSkillInput } from "./skills";
|
|
5
7
|
export type { CreateAttemptStatusInput, CreateStatusInput } from "./statuses";
|
|
6
8
|
export type { CreateTagInput, CreateTagOptionInput, UpdateTagInput, UpdateTagOptionInput } from "./tags";
|
|
7
9
|
export type { CreateTemplateInput, UpdateTemplateInput } from "./templates";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { UpdateSkillInput } from "pstdio-api-contracts";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type { CommandExecuteRequest, CommandExecuteResponse, EnableInstalledExtensionRequest, EnableInstalledExtensionResponse } from "pstdio-api-contracts";
|
|
1
|
+
import type { CommandExecuteRequest, CommandExecuteResponse, EnableInstalledExtensionRequest, EnableInstalledExtensionResponse, ListExtensionAppearanceResponse, ListExtensionCommandsResponse, UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse } from "pstdio-api-contracts";
|
|
2
2
|
import type { RequestFn } from "./request";
|
|
3
3
|
export type ExtensionClient = {
|
|
4
4
|
enableInstalled(projectId: string, installName: string, request: EnableInstalledExtensionRequest): Promise<EnableInstalledExtensionResponse>;
|
|
5
|
+
updateInstalledTemplate(installName: string, templateKey: string, input: UpdateInstalledExtensionTemplateInput): Promise<UpdateInstalledExtensionTemplateResponse>;
|
|
6
|
+
listAppearance(projectId: string): Promise<ListExtensionAppearanceResponse>;
|
|
7
|
+
listCommands(projectId: string): Promise<ListExtensionCommandsResponse>;
|
|
5
8
|
execute(commandId: string, request: CommandExecuteRequest): Promise<CommandExecuteResponse>;
|
|
6
9
|
};
|
|
7
10
|
export declare const createExtensionClient: (request: RequestFn) => ExtensionClient;
|
package/dist/client/index.js
CHANGED
|
@@ -24,6 +24,12 @@ var createExtensionClient = (request) => ({
|
|
|
24
24
|
method: "POST",
|
|
25
25
|
body
|
|
26
26
|
}),
|
|
27
|
+
updateInstalledTemplate: (installName, templateKey, body) => request(`/v1/extensions/installed/${encodeURIComponent(installName)}/templates/${encodeURIComponent(templateKey)}`, {
|
|
28
|
+
method: "PUT",
|
|
29
|
+
body
|
|
30
|
+
}),
|
|
31
|
+
listAppearance: (projectId) => request(`/v1/projects/${projectId}/extensions/appearance`),
|
|
32
|
+
listCommands: (projectId) => request(`/v1/projects/${projectId}/extensions/commands`),
|
|
27
33
|
execute: (commandId, input) => {
|
|
28
34
|
const { projectId, ...body } = input;
|
|
29
35
|
return request(`/v1/projects/${projectId}/extensions/commands/${encodeURIComponent(commandId)}/execute`, {
|
|
@@ -159,7 +165,7 @@ var createSessionClient = (request) => ({
|
|
|
159
165
|
var createSkillClient = (request) => ({
|
|
160
166
|
list: (projectId) => request(`/v1/projects/${projectId}/skills`),
|
|
161
167
|
get: (projectId, skillId) => request(`/v1/projects/${projectId}/skills/${skillId}`),
|
|
162
|
-
|
|
168
|
+
updatePreferences: (projectId, skillName, input) => request(`/v1/projects/${projectId}/skills/${skillName}`, { method: "PUT", body: input })
|
|
163
169
|
});
|
|
164
170
|
|
|
165
171
|
// src/client/statuses.ts
|
package/dist/client/skills.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { UpdateSkillInput } from "../api/skills";
|
|
1
2
|
import type { Skill, SkillWithContent } from "../resources";
|
|
2
3
|
import type { RequestFn } from "./request";
|
|
3
4
|
export type SkillClient = {
|
|
4
5
|
list(projectId: string): Promise<Skill[]>;
|
|
5
6
|
get(projectId: string, skillId: string): Promise<SkillWithContent>;
|
|
6
|
-
|
|
7
|
+
updatePreferences(projectId: string, skillName: string, input: UpdateSkillInput): Promise<Skill>;
|
|
7
8
|
};
|
|
8
9
|
export declare const createSkillClient: (request: RequestFn) => SkillClient;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guest-side contract for extension webviews. The host (dashboard) loads a small bridge
|
|
3
|
+
* runtime in an iframe, applies theme variables onto the iframe document, then dynamically
|
|
4
|
+
* imports the extension's bundled module and calls `view.mount(mount, host, propsStore)`.
|
|
5
|
+
*
|
|
6
|
+
* Extensions export `defineExtensionView({ render })` as the default export of their entry
|
|
7
|
+
* module. `render` receives the mount element, an RPC handle for invoking host capabilities
|
|
8
|
+
* (e.g. `host.call("commands.execute", …)`), and a subscribable `propsStore` that the host
|
|
9
|
+
* can push updates into.
|
|
10
|
+
*/
|
|
11
|
+
export type GuestHost = {
|
|
12
|
+
call: <TResult = unknown>(method: string, params?: unknown) => Promise<TResult>;
|
|
13
|
+
};
|
|
14
|
+
export type PropsStore<TProps = unknown> = {
|
|
15
|
+
get: () => TProps;
|
|
16
|
+
subscribe: (listener: (props: TProps) => void) => () => void;
|
|
17
|
+
};
|
|
18
|
+
export type ExtensionViewRenderContext<TProps = unknown> = {
|
|
19
|
+
mount: HTMLElement;
|
|
20
|
+
host: GuestHost;
|
|
21
|
+
propsStore: PropsStore<TProps>;
|
|
22
|
+
};
|
|
23
|
+
export type ExtensionViewRender<TProps = unknown> = (context: ExtensionViewRenderContext<TProps>) => void | (() => void) | Promise<void | (() => void)>;
|
|
24
|
+
export type ExtensionViewModule<TProps = unknown> = {
|
|
25
|
+
mount: (mount: HTMLElement, host: GuestHost, propsStore: PropsStore<TProps>) => Promise<() => void> | (() => void) | void;
|
|
26
|
+
};
|
|
27
|
+
export declare const defineExtensionView: <TProps = unknown>(definition: {
|
|
28
|
+
render: ExtensionViewRender<TProps>;
|
|
29
|
+
}) => ExtensionViewModule<TProps>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { ExtensionDefinition } from "./types/extension";
|
|
2
|
+
type ExactExtensionDefinition<TExtension extends ExtensionDefinition> = TExtension & Record<Exclude<keyof TExtension, keyof ExtensionDefinition>, never>;
|
|
2
3
|
/**
|
|
3
|
-
* Identity helper that preserves the literal type of the passed
|
|
4
|
-
* full autocomplete on contributions, and `commandsOf(ext)` can derive typed refs
|
|
5
|
-
* the returned definition.
|
|
4
|
+
* Identity helper that preserves the literal type of the passed contributions. Authors
|
|
5
|
+
* get full autocomplete on contributions, and `commandsOf(packageName, ext)` can derive typed refs
|
|
6
|
+
* from the returned definition. Extension identity (id, name, version, description,
|
|
7
|
+
* publisher, engines.pstdio) lives in package.json.
|
|
6
8
|
*
|
|
7
9
|
* @example
|
|
8
10
|
* export default defineExtension({
|
|
9
|
-
* id: "pstdio.example",
|
|
10
|
-
* namespace: "example",
|
|
11
|
-
* name: "Example",
|
|
12
|
-
* apiVersion: "1",
|
|
13
11
|
* commands: { ... },
|
|
14
12
|
* });
|
|
15
13
|
*/
|
|
16
|
-
export declare const defineExtension: <const TExtension extends ExtensionDefinition>(extension: TExtension) => TExtension;
|
|
14
|
+
export declare const defineExtension: <const TExtension extends ExtensionDefinition>(extension: ExactExtensionDefinition<TExtension>) => TExtension;
|
|
15
|
+
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export { defineCommand, defineHook, defineMiddleware } from "./define-command";
|
|
2
2
|
export { defineExtension } from "./define-extension";
|
|
3
|
+
export { defineExtensionView, type ExtensionViewModule, type ExtensionViewRender, type ExtensionViewRenderContext, type GuestHost, type PropsStore, } from "./define-extension-view";
|
|
3
4
|
export { projectEvents, projectSlots, sessionEvents, sessionSlots, workspaceEvents, workspaceSlots, } from "./kernel-slots";
|
|
4
5
|
export { packageAsset } from "./package-asset";
|
|
5
6
|
export { params } from "./params";
|
|
6
7
|
export { commandEvent, commandRef, commandsOf, eventRef } from "./refs";
|
|
7
8
|
export { defineSlot } from "./slots";
|
|
8
9
|
export type * from "./types";
|
|
10
|
+
export { EXTENSION_API_VERSION } from "./types/extension";
|
|
11
|
+
export { ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES, WEBVIEW_DECLARABLE_CAPABILITIES, WEBVIEW_HOST_CAPABILITIES, WEBVIEW_HOST_CAPABILITY_VERSION, } from "./types/webview-capabilities";
|
package/dist/extensions/index.js
CHANGED
|
@@ -4,17 +4,24 @@ var defineMiddleware = (definition) => definition;
|
|
|
4
4
|
var defineHook = (definition) => definition;
|
|
5
5
|
// src/extensions/define-extension.ts
|
|
6
6
|
var defineExtension = (extension) => extension;
|
|
7
|
+
// src/extensions/define-extension-view.ts
|
|
8
|
+
var defineExtensionView = (definition) => ({
|
|
9
|
+
mount: async (mount, host, propsStore) => {
|
|
10
|
+
const cleanup = await definition.render({ mount, host, propsStore });
|
|
11
|
+
return typeof cleanup === "function" ? cleanup : () => {};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
7
14
|
// src/extensions/refs.ts
|
|
8
15
|
var commandRef = (id) => ({ id });
|
|
9
16
|
var eventRef = (id) => ({ id });
|
|
10
17
|
var commandEvent = (command, phase) => ({
|
|
11
18
|
id: `command.${phase}:${command.id}`
|
|
12
19
|
});
|
|
13
|
-
var commandsOf = (extension) => {
|
|
20
|
+
var commandsOf = (packageName, extension) => {
|
|
14
21
|
const refs = {};
|
|
15
22
|
const commands = extension.commands ?? {};
|
|
16
23
|
for (const key of Object.keys(commands)) {
|
|
17
|
-
refs[key] = { id: `${
|
|
24
|
+
refs[key] = { id: `${packageName}.${key}` };
|
|
18
25
|
}
|
|
19
26
|
return refs;
|
|
20
27
|
};
|
|
@@ -34,6 +41,7 @@ var projectSlots = {
|
|
|
34
41
|
sidebar: defineSlot("project.sidebar", { kind: "view" }),
|
|
35
42
|
headerPrimary: defineSlot("project.headerPrimary", { kind: "menu" }),
|
|
36
43
|
headerOverflow: defineSlot("project.headerOverflow", { kind: "menu" }),
|
|
44
|
+
commandPanel: defineSlot("project.commandPanel", { kind: "menu" }),
|
|
37
45
|
settingsPanels: defineSlot("project.settingsPanels", { kind: "settings" })
|
|
38
46
|
};
|
|
39
47
|
var sessionSlots = {
|
|
@@ -90,6 +98,22 @@ var params = {
|
|
|
90
98
|
resource: (options) => ({ type: "resource", ...options }),
|
|
91
99
|
json: (options = {}) => ({ type: "json", ...options })
|
|
92
100
|
};
|
|
101
|
+
// src/extensions/types/extension.ts
|
|
102
|
+
var EXTENSION_API_VERSION = "1.0.0";
|
|
103
|
+
// src/extensions/types/webview-capabilities.ts
|
|
104
|
+
var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
|
|
105
|
+
var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
106
|
+
"commands.execute",
|
|
107
|
+
"resource.open",
|
|
108
|
+
"notification.show",
|
|
109
|
+
"preferences.get",
|
|
110
|
+
"preferences.set"
|
|
111
|
+
];
|
|
112
|
+
var ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES = ["host.dispatchKeyboardEvent"];
|
|
113
|
+
var WEBVIEW_HOST_CAPABILITIES = [
|
|
114
|
+
...WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
115
|
+
...ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
116
|
+
];
|
|
93
117
|
export {
|
|
94
118
|
workspaceSlots,
|
|
95
119
|
workspaceEvents,
|
|
@@ -103,9 +127,15 @@ export {
|
|
|
103
127
|
defineSlot,
|
|
104
128
|
defineMiddleware,
|
|
105
129
|
defineHook,
|
|
130
|
+
defineExtensionView,
|
|
106
131
|
defineExtension,
|
|
107
132
|
defineCommand,
|
|
108
133
|
commandsOf,
|
|
109
134
|
commandRef,
|
|
110
|
-
commandEvent
|
|
135
|
+
commandEvent,
|
|
136
|
+
WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
137
|
+
WEBVIEW_HOST_CAPABILITIES,
|
|
138
|
+
WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
139
|
+
EXTENSION_API_VERSION,
|
|
140
|
+
ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
111
141
|
};
|
|
@@ -5,6 +5,7 @@ export declare const projectSlots: {
|
|
|
5
5
|
sidebar: import("./types").SlotRef<object, "view">;
|
|
6
6
|
headerPrimary: import("./types").SlotRef<object, "menu">;
|
|
7
7
|
headerOverflow: import("./types").SlotRef<object, "menu">;
|
|
8
|
+
commandPanel: import("./types").SlotRef<object, "menu">;
|
|
8
9
|
settingsPanels: import("./types").SlotRef<object, "settings">;
|
|
9
10
|
};
|
|
10
11
|
export declare const sessionSlots: {
|
|
@@ -5,6 +5,6 @@ import type { PackageAssetDescriptor } from "./types/resources";
|
|
|
5
5
|
* so the runtime can locate the file no matter where the extension is installed.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* webview: { entry: packageAsset("./
|
|
8
|
+
* webview: { entry: packageAsset("./src/page.tsx", import.meta.url) }
|
|
9
9
|
*/
|
|
10
10
|
export declare const packageAsset: (path: string, baseUrl: string) => PackageAssetDescriptor;
|
|
@@ -4,9 +4,9 @@ import type { CommandDefinition } from "./types/extension";
|
|
|
4
4
|
import type { Struct } from "./types/json";
|
|
5
5
|
import type { ParamObjectSchema, ParamsOf } from "./types/params";
|
|
6
6
|
/**
|
|
7
|
-
* Build a typed reference to a command by id. Authors generally prefer
|
|
8
|
-
* which derives refs from the extension definition
|
|
9
|
-
* error at every call site.
|
|
7
|
+
* Build a typed reference to a command by id. Authors generally prefer
|
|
8
|
+
* `commandsOf(packageName, ext)`, which derives refs from the extension definition
|
|
9
|
+
* so a renamed command becomes a type error at every call site.
|
|
10
10
|
*/
|
|
11
11
|
export declare const commandRef: <TParams extends Struct = Struct, TResult = unknown>(id: string) => CommandRef<TParams, TResult>;
|
|
12
12
|
/** Build a typed reference to an event by id. */
|
|
@@ -23,16 +23,18 @@ type CommandsRefMap<TCommands extends CommandsRecord> = {
|
|
|
23
23
|
[K in keyof TCommands]: CommandRefFromDefinition<TCommands[K]>;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* Derive typed `CommandRef`s from an extension. Renaming a
|
|
27
|
-
* surfaces as a type error wherever the ref is used.
|
|
26
|
+
* Derive typed `CommandRef`s from an extension contribution object. Renaming a
|
|
27
|
+
* command in the definition surfaces as a type error wherever the ref is used.
|
|
28
|
+
*
|
|
29
|
+
* The package name is explicit because identity now lives in package.json, not in
|
|
30
|
+
* `defineExtension()`.
|
|
28
31
|
*
|
|
29
32
|
* @example
|
|
30
|
-
* const ext = defineExtension({
|
|
31
|
-
* const labCommands = commandsOf(ext);
|
|
33
|
+
* const ext = defineExtension({ commands: { ... } });
|
|
34
|
+
* const labCommands = commandsOf("extension-lab", ext);
|
|
32
35
|
* labCommands.awaken; // CommandRef<{ title: string }, ...>
|
|
33
36
|
*/
|
|
34
37
|
export declare const commandsOf: <TExtension extends {
|
|
35
|
-
namespace: string;
|
|
36
38
|
commands?: CommandsRecord;
|
|
37
|
-
}>(extension: TExtension) => CommandsRefMap<NonNullable<TExtension["commands"]>>;
|
|
39
|
+
}>(packageName: string, extension: TExtension) => CommandsRefMap<NonNullable<TExtension["commands"]>>;
|
|
38
40
|
export {};
|
|
@@ -151,7 +151,8 @@ export interface ExtensionSettingsApi<TSettings extends Struct = Struct> {
|
|
|
151
151
|
export interface ExtensionContextBase {
|
|
152
152
|
projectId: string;
|
|
153
153
|
extensionId: string;
|
|
154
|
-
|
|
154
|
+
/** Extension package name. Used for grouping/prefixing user-facing references. */
|
|
155
|
+
name: string;
|
|
155
156
|
repo?: RepoContext;
|
|
156
157
|
source?: CommandSource;
|
|
157
158
|
storage: ExtensionStorageApi;
|
|
@@ -2,6 +2,7 @@ import type { CommandRef, CommandSource } from "./commands";
|
|
|
2
2
|
import type { JsonObject, Struct } from "./json";
|
|
3
3
|
import type { PackageAssetDescriptor } from "./resources";
|
|
4
4
|
import type { SlotRef } from "./slots";
|
|
5
|
+
import type { WebviewCapabilityDeclaration } from "./webview-capabilities";
|
|
5
6
|
export interface CliContribution {
|
|
6
7
|
path?: string[];
|
|
7
8
|
globalAliases?: string[][];
|
|
@@ -14,11 +15,6 @@ export interface WhenExpression {
|
|
|
14
15
|
resourceType?: string[];
|
|
15
16
|
metadata?: JsonObject;
|
|
16
17
|
}
|
|
17
|
-
export interface CommandPanelContribution {
|
|
18
|
-
group?: string;
|
|
19
|
-
keywords?: string[];
|
|
20
|
-
when?: WhenExpression;
|
|
21
|
-
}
|
|
22
18
|
export interface MenuContribution<TSlotContext extends Struct = Struct, TParams extends Struct = Struct> {
|
|
23
19
|
slot: SlotRef<TSlotContext, "menu"> | string;
|
|
24
20
|
label?: string;
|
|
@@ -45,7 +41,7 @@ export interface NavigationContribution<TSlotContext extends Struct = Struct, TP
|
|
|
45
41
|
export interface WebviewContribution {
|
|
46
42
|
entry: PackageAssetDescriptor;
|
|
47
43
|
title?: string;
|
|
48
|
-
|
|
44
|
+
capabilities?: WebviewCapabilityDeclaration[];
|
|
49
45
|
}
|
|
50
46
|
export interface ViewContribution<TSlotContext extends Struct = Struct> {
|
|
51
47
|
title: string;
|
|
@@ -70,7 +66,7 @@ export interface RendererContribution<TSlotContext extends Struct = Struct> {
|
|
|
70
66
|
webview: WebviewContribution;
|
|
71
67
|
}
|
|
72
68
|
export interface ArtifactMountContribution {
|
|
73
|
-
/** Relative path under .pstdio/<extension.
|
|
69
|
+
/** Relative path under .pstdio/<extension.name>/. */
|
|
74
70
|
path: string;
|
|
75
71
|
label: string;
|
|
76
72
|
repoRole?: "default" | "selected" | "workspace";
|
|
@@ -90,3 +86,17 @@ export interface SkillContribution {
|
|
|
90
86
|
source: PackageAssetDescriptor;
|
|
91
87
|
description?: string;
|
|
92
88
|
}
|
|
89
|
+
export type ThemeMode = "light" | "dark";
|
|
90
|
+
export interface ThemeContribution {
|
|
91
|
+
title: string;
|
|
92
|
+
source: PackageAssetDescriptor;
|
|
93
|
+
format: "vscode-color-theme";
|
|
94
|
+
mode?: ThemeMode;
|
|
95
|
+
description?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface FileIconThemeContribution {
|
|
98
|
+
title: string;
|
|
99
|
+
source: PackageAssetDescriptor;
|
|
100
|
+
format: "vscode-file-icon-theme";
|
|
101
|
+
description?: string;
|
|
102
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CommandRef } from "./commands";
|
|
2
2
|
import type { CommandMiddlewareHandler, CommandRunHandler, EventContext, ExtensionContextBase, MigrationContext, SetupContext } from "./context";
|
|
3
|
-
import type { ArtifactMountContribution, CliContribution,
|
|
3
|
+
import type { ArtifactMountContribution, CliContribution, FileIconThemeContribution, MenuContribution, NavigationContribution, RendererContribution, RouteContribution, SettingsPanelContribution, SkillContribution, TemplateContribution, TemplateTypeContribution, ThemeContribution, ViewContribution } from "./contributions";
|
|
4
4
|
import type { EventRef } from "./events";
|
|
5
5
|
import type { JsonObject, MaybePromise, Struct } from "./json";
|
|
6
6
|
import type { ParamObjectSchema, ParamsOf } from "./params";
|
|
7
7
|
import type { SlotRef } from "./slots";
|
|
8
|
-
/** API version
|
|
9
|
-
export
|
|
8
|
+
/** Current host extension API version. `engines.pstdio` in package.json is a semver range checked against this. */
|
|
9
|
+
export declare const EXTENSION_API_VERSION = "1.0.0";
|
|
10
10
|
type SchemaParams<TSchema extends ParamObjectSchema | undefined> = TSchema extends ParamObjectSchema ? ParamsOf<TSchema> : Struct;
|
|
11
11
|
/**
|
|
12
12
|
* A command exposed by an extension. The `params` schema (typed via `params.*`) drives
|
|
@@ -16,8 +16,6 @@ export interface CommandDefinition<TSchema extends ParamObjectSchema | undefined
|
|
|
16
16
|
title: string;
|
|
17
17
|
description?: string;
|
|
18
18
|
params?: TSchema;
|
|
19
|
-
/** Defaults to true. */
|
|
20
|
-
commandPanel?: boolean | CommandPanelContribution;
|
|
21
19
|
menus?: MenuContribution[];
|
|
22
20
|
cli?: boolean | CliContribution;
|
|
23
21
|
run: CommandRunHandler<SchemaParams<TSchema>, TResult>;
|
|
@@ -98,21 +96,29 @@ export interface LocalExtensionSource {
|
|
|
98
96
|
export interface ProjectExtensionInstance {
|
|
99
97
|
projectId: string;
|
|
100
98
|
extensionId: string;
|
|
101
|
-
|
|
99
|
+
name: string;
|
|
102
100
|
sourceName: string;
|
|
103
101
|
enabled: boolean;
|
|
104
102
|
config: JsonObject;
|
|
105
103
|
}
|
|
106
|
-
/**
|
|
107
|
-
export interface
|
|
108
|
-
|
|
109
|
-
namespace: string;
|
|
104
|
+
/** Validated view of an extension's package.json identity fields. */
|
|
105
|
+
export interface PackageManifest {
|
|
106
|
+
/** Extension package name. Matches `^[a-z][a-z0-9-]*$`. */
|
|
110
107
|
name: string;
|
|
111
|
-
version
|
|
108
|
+
/** Package version (semver). */
|
|
109
|
+
version: string;
|
|
110
|
+
/** Optional human-friendly name. Falls back to `name`. */
|
|
111
|
+
displayName?: string;
|
|
112
|
+
/** Optional package description. */
|
|
112
113
|
description?: string;
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
/** Publisher segment of the extension id. Matches `^[a-z][a-z0-9-]*$`. */
|
|
115
|
+
publisher: string;
|
|
116
|
+
/** Relative path to the contributions entry module. */
|
|
117
|
+
main: string;
|
|
118
|
+
/** Semver range checked against the host extension API version. */
|
|
119
|
+
enginesPstdio: string;
|
|
120
|
+
/** Derived `${publisher}.${name}`. */
|
|
121
|
+
id: string;
|
|
116
122
|
}
|
|
117
123
|
/** UI surface contributions: slots, routes, panels, renderers. */
|
|
118
124
|
export interface UiContributions {
|
|
@@ -137,6 +143,8 @@ export interface AssetContributions {
|
|
|
137
143
|
templateTypes?: Record<string, TemplateTypeContribution>;
|
|
138
144
|
templates?: Record<string, TemplateContribution>;
|
|
139
145
|
skills?: Record<string, SkillContribution>;
|
|
146
|
+
themes?: Record<string, ThemeContribution>;
|
|
147
|
+
fileIconThemes?: Record<string, FileIconThemeContribution>;
|
|
140
148
|
}
|
|
141
149
|
/** Provider contributions: harnesses, workspace types. */
|
|
142
150
|
export interface ProviderContributions {
|
|
@@ -149,10 +157,12 @@ export interface ExtensionLifecycle {
|
|
|
149
157
|
migrate?: (ctx: MigrationContext, fromVersion: string | null) => MaybePromise<void>;
|
|
150
158
|
}
|
|
151
159
|
/**
|
|
152
|
-
* The full shape of an extension
|
|
153
|
-
*
|
|
160
|
+
* The full shape of an extension's contributions module. Identity (id, name, version,
|
|
161
|
+
* description, etc.) lives in `package.json`; `defineExtension` only accepts
|
|
162
|
+
* contribution surfaces.
|
|
154
163
|
*/
|
|
155
|
-
export interface ExtensionDefinition extends
|
|
164
|
+
export interface ExtensionDefinition extends UiContributions, BehaviourContributions, AssetContributions, ProviderContributions, ExtensionLifecycle {
|
|
165
|
+
settings?: ParamObjectSchema;
|
|
156
166
|
}
|
|
157
167
|
export type ExtensionSourceKind = "local" | "package" | "builtin";
|
|
158
168
|
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { JsonObject } from "./json";
|
|
2
|
+
import type { RepoContext, ResourceRef } from "./resources";
|
|
3
|
+
export declare const WEBVIEW_HOST_CAPABILITY_VERSION = 1;
|
|
4
|
+
export declare const WEBVIEW_DECLARABLE_CAPABILITIES: readonly ["commands.execute", "resource.open", "notification.show", "preferences.get", "preferences.set"];
|
|
5
|
+
export declare const ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES: readonly ["host.dispatchKeyboardEvent"];
|
|
6
|
+
export declare const WEBVIEW_HOST_CAPABILITIES: readonly ["commands.execute", "resource.open", "notification.show", "preferences.get", "preferences.set", "host.dispatchKeyboardEvent"];
|
|
7
|
+
export type WebviewHostCapability = (typeof WEBVIEW_HOST_CAPABILITIES)[number];
|
|
8
|
+
export type WebviewDeclarableCapability = (typeof WEBVIEW_DECLARABLE_CAPABILITIES)[number];
|
|
9
|
+
export type WebviewCapabilityDeclaration = WebviewDeclarableCapability | `${WebviewDeclarableCapability}@${typeof WEBVIEW_HOST_CAPABILITY_VERSION}`;
|
|
10
|
+
export interface WebviewCommandsExecuteParams {
|
|
11
|
+
commandId: string;
|
|
12
|
+
params?: JsonObject;
|
|
13
|
+
resource?: ResourceRef;
|
|
14
|
+
repo?: RepoContext;
|
|
15
|
+
metadata?: JsonObject;
|
|
16
|
+
}
|
|
17
|
+
export interface WebviewResourceOpenParams {
|
|
18
|
+
href?: string;
|
|
19
|
+
resource?: ResourceRef;
|
|
20
|
+
input?: {
|
|
21
|
+
replaceActive?: boolean;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface WebviewNotificationShowParams {
|
|
25
|
+
level: "info" | "success" | "warning" | "error";
|
|
26
|
+
title: string;
|
|
27
|
+
message?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface WebviewPreferencesGetParams {
|
|
30
|
+
name: string;
|
|
31
|
+
scope?: {
|
|
32
|
+
scope: "default" | "user" | "project" | "repo" | "workspace" | "extension" | "session";
|
|
33
|
+
scopeId?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface WebviewPreferencesSetParams extends WebviewPreferencesGetParams {
|
|
37
|
+
value: boolean | number | string | string[] | number[] | boolean[] | Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface WebviewKeyboardEventParams {
|
|
40
|
+
key?: string;
|
|
41
|
+
code?: string;
|
|
42
|
+
ctrlKey?: boolean;
|
|
43
|
+
metaKey?: boolean;
|
|
44
|
+
altKey?: boolean;
|
|
45
|
+
shiftKey?: boolean;
|
|
46
|
+
repeat?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface WebviewHostCapabilityParams {
|
|
49
|
+
"commands.execute": WebviewCommandsExecuteParams;
|
|
50
|
+
"resource.open": WebviewResourceOpenParams;
|
|
51
|
+
"notification.show": WebviewNotificationShowParams;
|
|
52
|
+
"preferences.get": WebviewPreferencesGetParams;
|
|
53
|
+
"preferences.set": WebviewPreferencesSetParams;
|
|
54
|
+
"host.dispatchKeyboardEvent": WebviewKeyboardEventParams;
|
|
55
|
+
}
|
package/dist/hooks/session.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { BaseHookContext } from "./base";
|
|
|
2
2
|
import type { HookTicket, HookWorkspace } from "./entities";
|
|
3
3
|
export type SessionHookContext = BaseHookContext & {
|
|
4
4
|
sessionId: string;
|
|
5
|
-
sessionStatus: "in_progress" | "awaiting_input" | "completed" | "failed" | "cancelled" | "disconnected";
|
|
5
|
+
sessionStatus: "in_progress" | "awaiting_input" | "queued" | "completed" | "failed" | "cancelled" | "disconnected";
|
|
6
6
|
originalSessionId?: string;
|
|
7
7
|
workspace?: HookWorkspace;
|
|
8
8
|
workspaceId?: string;
|
|
@@ -5,11 +5,12 @@ export declare const createSession: (ctx: PluginHelperContext, input: CreateSess
|
|
|
5
5
|
id: string;
|
|
6
6
|
project_id: string | null;
|
|
7
7
|
title: string;
|
|
8
|
-
status: "in_progress" | "awaiting_input" | "completed" | "failed" | "cancelled" | "disconnected";
|
|
8
|
+
status: "in_progress" | "awaiting_input" | "queued" | "completed" | "failed" | "cancelled" | "disconnected";
|
|
9
9
|
archived: boolean;
|
|
10
10
|
last_request_started: string | null;
|
|
11
11
|
last_request_ended: string | null;
|
|
12
12
|
agent: string | null;
|
|
13
|
+
last_selected_model: string | null;
|
|
13
14
|
agent_session_id: string | null;
|
|
14
15
|
session_file_id: string | null;
|
|
15
16
|
original_session_id: string | null;
|
|
@@ -7,11 +7,12 @@ export declare const followupSession: (ctx: PluginHelperContext, input: Followup
|
|
|
7
7
|
id: string;
|
|
8
8
|
project_id: string | null;
|
|
9
9
|
title: string;
|
|
10
|
-
status: "in_progress" | "awaiting_input" | "completed" | "failed" | "cancelled" | "disconnected";
|
|
10
|
+
status: "in_progress" | "awaiting_input" | "queued" | "completed" | "failed" | "cancelled" | "disconnected";
|
|
11
11
|
archived: boolean;
|
|
12
12
|
last_request_started: string | null;
|
|
13
13
|
last_request_ended: string | null;
|
|
14
14
|
agent: string | null;
|
|
15
|
+
last_selected_model: string | null;
|
|
15
16
|
agent_session_id: string | null;
|
|
16
17
|
session_file_id: string | null;
|
|
17
18
|
original_session_id: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pstdio/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/pufflyai/prompt-studio"
|
|
@@ -14,32 +14,32 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
"./resources": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"types": "./dist/resources/index.d.ts",
|
|
18
|
+
"import": "./dist/resources/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./api": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"types": "./dist/api/index.d.ts",
|
|
22
|
+
"import": "./dist/api/index.js"
|
|
23
23
|
},
|
|
24
24
|
"./client": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"types": "./dist/client/index.d.ts",
|
|
26
|
+
"import": "./dist/client/index.js"
|
|
27
27
|
},
|
|
28
28
|
"./extensions": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"types": "./dist/extensions/index.d.ts",
|
|
30
|
+
"import": "./dist/extensions/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./plugins": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"types": "./dist/plugins/index.d.ts",
|
|
34
|
+
"import": "./dist/plugins/index.js"
|
|
35
35
|
},
|
|
36
36
|
"./prompts": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"types": "./dist/prompts/index.d.ts",
|
|
38
|
+
"import": "./dist/prompts/index.js"
|
|
39
39
|
},
|
|
40
40
|
"./hooks": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"types": "./dist/hooks/index.d.ts",
|
|
42
|
+
"import": "./dist/hooks/index.js"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|