@pstdio/sdk 0.4.2 → 0.5.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 +3 -1
- package/dist/client/index.js +6 -1
- package/dist/client/skills.d.ts +2 -1
- package/dist/extensions/define-extension-view.d.ts +29 -0
- package/dist/extensions/index.d.ts +1 -0
- package/dist/extensions/index.js +9 -0
- package/dist/extensions/kernel-slots.d.ts +1 -0
- package/dist/extensions/types/contributions.d.ts +0 -5
- package/dist/extensions/types/extension.d.ts +1 -3
- package/dist/plugins/helpers/create-session.d.ts +1 -0
- package/dist/plugins/helpers/followup-session.d.ts +1 -0
- 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,9 @@
|
|
|
1
|
-
import type { CommandExecuteRequest, CommandExecuteResponse, EnableInstalledExtensionRequest, EnableInstalledExtensionResponse } from "pstdio-api-contracts";
|
|
1
|
+
import type { CommandExecuteRequest, CommandExecuteResponse, EnableInstalledExtensionRequest, EnableInstalledExtensionResponse, 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
|
+
listCommands(projectId: string): Promise<ListExtensionCommandsResponse>;
|
|
5
7
|
execute(commandId: string, request: CommandExecuteRequest): Promise<CommandExecuteResponse>;
|
|
6
8
|
};
|
|
7
9
|
export declare const createExtensionClient: (request: RequestFn) => ExtensionClient;
|
package/dist/client/index.js
CHANGED
|
@@ -24,6 +24,11 @@ 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
|
+
listCommands: (projectId) => request(`/v1/projects/${projectId}/extensions/commands`),
|
|
27
32
|
execute: (commandId, input) => {
|
|
28
33
|
const { projectId, ...body } = input;
|
|
29
34
|
return request(`/v1/projects/${projectId}/extensions/commands/${encodeURIComponent(commandId)}/execute`, {
|
|
@@ -159,7 +164,7 @@ var createSessionClient = (request) => ({
|
|
|
159
164
|
var createSkillClient = (request) => ({
|
|
160
165
|
list: (projectId) => request(`/v1/projects/${projectId}/skills`),
|
|
161
166
|
get: (projectId, skillId) => request(`/v1/projects/${projectId}/skills/${skillId}`),
|
|
162
|
-
|
|
167
|
+
updatePreferences: (projectId, skillName, input) => request(`/v1/projects/${projectId}/skills/${skillName}`, { method: "PUT", body: input })
|
|
163
168
|
});
|
|
164
169
|
|
|
165
170
|
// 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,5 +1,6 @@
|
|
|
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";
|
package/dist/extensions/index.js
CHANGED
|
@@ -4,6 +4,13 @@ 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 });
|
|
@@ -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 = {
|
|
@@ -103,6 +111,7 @@ export {
|
|
|
103
111
|
defineSlot,
|
|
104
112
|
defineMiddleware,
|
|
105
113
|
defineHook,
|
|
114
|
+
defineExtensionView,
|
|
106
115
|
defineExtension,
|
|
107
116
|
defineCommand,
|
|
108
117
|
commandsOf,
|
|
@@ -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: {
|
|
@@ -14,11 +14,6 @@ export interface WhenExpression {
|
|
|
14
14
|
resourceType?: string[];
|
|
15
15
|
metadata?: JsonObject;
|
|
16
16
|
}
|
|
17
|
-
export interface CommandPanelContribution {
|
|
18
|
-
group?: string;
|
|
19
|
-
keywords?: string[];
|
|
20
|
-
when?: WhenExpression;
|
|
21
|
-
}
|
|
22
17
|
export interface MenuContribution<TSlotContext extends Struct = Struct, TParams extends Struct = Struct> {
|
|
23
18
|
slot: SlotRef<TSlotContext, "menu"> | string;
|
|
24
19
|
label?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
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, MenuContribution, NavigationContribution, RendererContribution, RouteContribution, SettingsPanelContribution, SkillContribution, TemplateContribution, TemplateTypeContribution, 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";
|
|
@@ -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>;
|
|
@@ -10,6 +10,7 @@ export declare const createSession: (ctx: PluginHelperContext, input: CreateSess
|
|
|
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;
|
|
@@ -12,6 +12,7 @@ export declare const followupSession: (ctx: PluginHelperContext, input: Followup
|
|
|
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.5.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": {
|