@pstdio/sdk 0.11.0 → 0.13.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.d.ts +0 -1
- package/dist/client/agents.d.ts +5 -8
- package/dist/client/index.js +17 -7
- package/dist/extensions/command-outcome.d.ts +1 -1
- package/dist/extensions/define-command.d.ts +1 -3
- package/dist/extensions/define-extension-view.d.ts +2 -2
- package/dist/extensions/define-extension.d.ts +1 -4
- package/dist/extensions/index.d.ts +3 -8
- package/dist/extensions/index.js +145 -129
- package/dist/extensions/params.d.ts +1 -1
- package/dist/extensions/refs.d.ts +2 -14
- package/dist/extensions/when.d.ts +1 -1
- package/dist/prompts/index.js +15 -0
- package/dist/resources/agent.d.ts +2 -1
- package/dist/resources/index.d.ts +2 -3
- package/dist/resources/index.js +14738 -19
- package/package.json +2 -2
- package/dist/api/agents.d.ts +0 -1
- package/dist/extensions/kernel-slots.d.ts +0 -112
- package/dist/extensions/l10n.d.ts +0 -10
- package/dist/extensions/package-asset.d.ts +0 -10
- package/dist/extensions/slots.d.ts +0 -6
- package/dist/extensions/types/commands.d.ts +0 -125
- package/dist/extensions/types/context.d.ts +0 -258
- package/dist/extensions/types/contributions.d.ts +0 -374
- package/dist/extensions/types/events.d.ts +0 -10
- package/dist/extensions/types/extension.d.ts +0 -183
- package/dist/extensions/types/index.d.ts +0 -11
- package/dist/extensions/types/json.d.ts +0 -7
- package/dist/extensions/types/params.d.ts +0 -83
- package/dist/extensions/types/resources.d.ts +0 -25
- package/dist/extensions/types/slots.d.ts +0 -22
- package/dist/extensions/types/tree-renderer.d.ts +0 -89
- package/dist/extensions/types/webview-capabilities.d.ts +0 -93
- package/dist/extensions/workbench-targets.d.ts +0 -124
- package/dist/resources/known-agents.d.ts +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pstdio/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/pufflyai/prompt-studio"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "rm -rf ./dist && bun run build:js && bun run build:types",
|
|
43
|
-
"build:js": "bun build ./src/api/index.ts ./src/client/index.ts ./src/extensions/index.ts ./src/prompts/index.ts ./src/hooks/index.ts ./src/resources/index.ts --outdir ./dist --root ./src --target node --format esm --
|
|
43
|
+
"build:js": "bun build ./src/api/index.ts ./src/client/index.ts ./src/extensions/index.ts ./src/prompts/index.ts ./src/hooks/index.ts ./src/resources/index.ts --outdir ./dist --root ./src --target node --format esm --external mustache",
|
|
44
44
|
"build:types": "tsc --project ./tsconfig.build.json",
|
|
45
45
|
"prepack": "bun run build",
|
|
46
46
|
"typecheck": "tsc --noEmit",
|
package/dist/api/agents.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { SetupAgentInput, SetupAvailableAgentsInput, UpdateAgentInput } from "pstdio-api-contracts";
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { ExtensionWorkspace } from "./types/context";
|
|
2
|
-
import type { ResourceAnchor } from "./types/resources";
|
|
3
|
-
export interface WorktreeCreatedEventPayload {
|
|
4
|
-
projectId: string;
|
|
5
|
-
repoPath: string;
|
|
6
|
-
worktreePath: string;
|
|
7
|
-
branch: string;
|
|
8
|
-
workspace: string;
|
|
9
|
-
workspaceId: string;
|
|
10
|
-
anchors?: ResourceAnchor[];
|
|
11
|
-
}
|
|
12
|
-
export interface SessionLifecyclePayload {
|
|
13
|
-
projectId: string;
|
|
14
|
-
sessionId: string;
|
|
15
|
-
sessionStatus?: string;
|
|
16
|
-
originalSessionId?: string;
|
|
17
|
-
workspace?: ExtensionWorkspace;
|
|
18
|
-
workspaceId?: string;
|
|
19
|
-
worktreePath?: string;
|
|
20
|
-
branch?: string;
|
|
21
|
-
anchors?: ResourceAnchor[];
|
|
22
|
-
}
|
|
23
|
-
export interface WorktreeRemovedPayload {
|
|
24
|
-
projectId: string;
|
|
25
|
-
repoPath?: string;
|
|
26
|
-
worktreePath: string;
|
|
27
|
-
workspace?: ExtensionWorkspace;
|
|
28
|
-
workspaceId?: string;
|
|
29
|
-
anchors?: ResourceAnchor[];
|
|
30
|
-
}
|
|
31
|
-
export interface CommitPayload {
|
|
32
|
-
projectId: string;
|
|
33
|
-
repoPath?: string;
|
|
34
|
-
worktreePath?: string;
|
|
35
|
-
branch?: string;
|
|
36
|
-
commitSha?: string;
|
|
37
|
-
workspace?: ExtensionWorkspace;
|
|
38
|
-
anchors?: ResourceAnchor[];
|
|
39
|
-
}
|
|
40
|
-
export interface RebasePayload {
|
|
41
|
-
projectId: string;
|
|
42
|
-
repoPath?: string;
|
|
43
|
-
worktreePath?: string;
|
|
44
|
-
branch?: string;
|
|
45
|
-
workspace?: ExtensionWorkspace;
|
|
46
|
-
anchors?: ResourceAnchor[];
|
|
47
|
-
}
|
|
48
|
-
export interface MergePayload extends CommitPayload {
|
|
49
|
-
}
|
|
50
|
-
export interface ConflictPayload {
|
|
51
|
-
projectId: string;
|
|
52
|
-
operation: "rebase" | "merge";
|
|
53
|
-
repoPath?: string;
|
|
54
|
-
worktreePath?: string;
|
|
55
|
-
branch?: string;
|
|
56
|
-
workspace?: ExtensionWorkspace;
|
|
57
|
-
anchors?: ResourceAnchor[];
|
|
58
|
-
}
|
|
59
|
-
export declare const projectSlots: {
|
|
60
|
-
sidebar: import("./types").SlotRef<object, "view">;
|
|
61
|
-
headerPrimary: import("./types").SlotRef<object, "menu">;
|
|
62
|
-
headerOverflow: import("./types").SlotRef<object, "menu">;
|
|
63
|
-
settingsPanels: import("./types").SlotRef<object, "settings">;
|
|
64
|
-
};
|
|
65
|
-
export declare const sessionSlots: {
|
|
66
|
-
headerPrimary: import("./types").SlotRef<object, "menu">;
|
|
67
|
-
headerOverflow: import("./types").SlotRef<object, "menu">;
|
|
68
|
-
transcriptActions: import("./types").SlotRef<object, "menu">;
|
|
69
|
-
};
|
|
70
|
-
export declare const workspaceSlots: {
|
|
71
|
-
headerPrimary: import("./types").SlotRef<object, "menu">;
|
|
72
|
-
headerOverflow: import("./types").SlotRef<object, "menu">;
|
|
73
|
-
sidebar: import("./types").SlotRef<object, "view">;
|
|
74
|
-
};
|
|
75
|
-
export declare const projectEvents: {
|
|
76
|
-
opened: import("./types").EventRef<{
|
|
77
|
-
projectId: string;
|
|
78
|
-
}>;
|
|
79
|
-
};
|
|
80
|
-
export declare const sessionEvents: {
|
|
81
|
-
started: import("./types").EventRef<SessionLifecyclePayload & {
|
|
82
|
-
anchors?: ResourceAnchor[];
|
|
83
|
-
}>;
|
|
84
|
-
resumed: import("./types").EventRef<SessionLifecyclePayload>;
|
|
85
|
-
awaitingInput: import("./types").EventRef<SessionLifecyclePayload>;
|
|
86
|
-
succeeded: import("./types").EventRef<SessionLifecyclePayload>;
|
|
87
|
-
failed: import("./types").EventRef<SessionLifecyclePayload>;
|
|
88
|
-
completed: import("./types").EventRef<SessionLifecyclePayload & {
|
|
89
|
-
anchors?: ResourceAnchor[];
|
|
90
|
-
}>;
|
|
91
|
-
};
|
|
92
|
-
export declare const workspaceEvents: {
|
|
93
|
-
created: import("./types").EventRef<{
|
|
94
|
-
workspace: ExtensionWorkspace;
|
|
95
|
-
}>;
|
|
96
|
-
archived: import("./types").EventRef<{
|
|
97
|
-
workspace: ExtensionWorkspace;
|
|
98
|
-
}>;
|
|
99
|
-
deleted: import("./types").EventRef<{
|
|
100
|
-
workspace: ExtensionWorkspace;
|
|
101
|
-
}>;
|
|
102
|
-
};
|
|
103
|
-
export declare const worktreeEvents: {
|
|
104
|
-
created: import("./types").EventRef<WorktreeCreatedEventPayload>;
|
|
105
|
-
removed: import("./types").EventRef<WorktreeRemovedPayload>;
|
|
106
|
-
};
|
|
107
|
-
export declare const gitEvents: {
|
|
108
|
-
committed: import("./types").EventRef<CommitPayload>;
|
|
109
|
-
rebased: import("./types").EventRef<RebasePayload>;
|
|
110
|
-
merged: import("./types").EventRef<MergePayload>;
|
|
111
|
-
conflicted: import("./types").EventRef<ConflictPayload>;
|
|
112
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface LocalizedString {
|
|
2
|
-
readonly $l10n: string;
|
|
3
|
-
readonly default?: string;
|
|
4
|
-
}
|
|
5
|
-
export type Localizable<T extends string = string> = T | LocalizedString;
|
|
6
|
-
export declare const l10n: (key: string, defaultValue?: string) => {
|
|
7
|
-
default?: string | undefined;
|
|
8
|
-
$l10n: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const isLocalizedString: (value: unknown) => value is LocalizedString;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PackageAssetDescriptor } from "./types/resources";
|
|
2
|
-
/**
|
|
3
|
-
* Reference an asset shipped alongside the extension's compiled output. `path` is
|
|
4
|
-
* resolved relative to `baseUrl`; in practice authors always pass `import.meta.url`
|
|
5
|
-
* so the runtime can locate the file no matter where the extension is installed.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* webview: { entry: packageAsset("./src/page.tsx", import.meta.url) }
|
|
9
|
-
*/
|
|
10
|
-
export declare const packageAsset: (path: string, baseUrl: string) => PackageAssetDescriptor;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Struct } from "./types/json";
|
|
2
|
-
import type { SlotOptions, SlotRef, UiSlotKind } from "./types/slots";
|
|
3
|
-
/**
|
|
4
|
-
* Define a host-owned UI slot that extension contributions can target.
|
|
5
|
-
*/
|
|
6
|
-
export declare const defineSlot: <TContext extends Struct = Struct, TKind extends UiSlotKind = UiSlotKind>(id: string, options: SlotOptions<TKind>) => SlotRef<TContext, TKind>;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import type { WorkbenchAttachmentTarget } from "../workbench-targets";
|
|
2
|
-
import type { JsonObject, JsonValue, Struct } from "./json";
|
|
3
|
-
import type { RepoContext, ResourceRef } from "./resources";
|
|
4
|
-
import type { SlotInvocationContext } from "./slots";
|
|
5
|
-
export type CommandSource = "cli" | "dashboard" | "api" | "schedule" | "event" | "automation" | "command-panel";
|
|
6
|
-
export interface CommandRef<TParams extends Struct = Struct, TResult = unknown> {
|
|
7
|
-
id: string;
|
|
8
|
-
params?: TParams;
|
|
9
|
-
result?: TResult;
|
|
10
|
-
}
|
|
11
|
-
export interface SerializedError {
|
|
12
|
-
name?: string;
|
|
13
|
-
message: string;
|
|
14
|
-
stack?: string;
|
|
15
|
-
cause?: JsonValue;
|
|
16
|
-
}
|
|
17
|
-
export interface WorkbenchAttachmentInvocationContext {
|
|
18
|
-
target: WorkbenchAttachmentTarget;
|
|
19
|
-
mode?: string;
|
|
20
|
-
projectId?: string;
|
|
21
|
-
resource?: ResourceRef;
|
|
22
|
-
}
|
|
23
|
-
export interface CommandInvocation<TParams extends Struct = Struct> {
|
|
24
|
-
params: TParams;
|
|
25
|
-
resource?: ResourceRef;
|
|
26
|
-
repoId?: string;
|
|
27
|
-
repoPath?: string;
|
|
28
|
-
attachment?: WorkbenchAttachmentInvocationContext;
|
|
29
|
-
slot?: SlotInvocationContext;
|
|
30
|
-
metadata?: JsonObject;
|
|
31
|
-
}
|
|
32
|
-
export interface CommandContinue {
|
|
33
|
-
type: "continue";
|
|
34
|
-
}
|
|
35
|
-
export interface CommandPatchParams<TParams extends Struct = Struct> {
|
|
36
|
-
type: "patchParams";
|
|
37
|
-
params: Partial<TParams>;
|
|
38
|
-
}
|
|
39
|
-
export interface CommandReplaceParams<TParams extends Struct = Struct> {
|
|
40
|
-
type: "replaceParams";
|
|
41
|
-
params: TParams;
|
|
42
|
-
}
|
|
43
|
-
export interface CommandReplaceInvocation<TParams extends Struct = Struct> {
|
|
44
|
-
type: "replaceInvocation";
|
|
45
|
-
invocation: CommandInvocation<TParams>;
|
|
46
|
-
}
|
|
47
|
-
export interface CommandReject {
|
|
48
|
-
type: "reject";
|
|
49
|
-
code?: string;
|
|
50
|
-
reason: string;
|
|
51
|
-
data?: JsonObject;
|
|
52
|
-
}
|
|
53
|
-
export type CommandMiddlewareResult<TParams extends Struct = Struct> = void | CommandContinue | CommandPatchParams<TParams> | CommandReplaceParams<TParams> | CommandReplaceInvocation<TParams> | CommandReject;
|
|
54
|
-
export interface CommandNotice {
|
|
55
|
-
type: "info" | "success" | "warning" | "error";
|
|
56
|
-
title?: string;
|
|
57
|
-
message: string;
|
|
58
|
-
metadata?: JsonObject;
|
|
59
|
-
}
|
|
60
|
-
export interface CommandDiagnostic {
|
|
61
|
-
code: string;
|
|
62
|
-
message: string;
|
|
63
|
-
severity: "info" | "warning" | "error";
|
|
64
|
-
extensionId?: string;
|
|
65
|
-
commandId?: string;
|
|
66
|
-
metadata?: JsonObject;
|
|
67
|
-
}
|
|
68
|
-
export type CommandOutcome<TResult = unknown> = {
|
|
69
|
-
ok: true;
|
|
70
|
-
status: "success";
|
|
71
|
-
value: TResult;
|
|
72
|
-
notices?: CommandNotice[];
|
|
73
|
-
diagnostics?: CommandDiagnostic[];
|
|
74
|
-
} | {
|
|
75
|
-
ok: false;
|
|
76
|
-
status: "rejected";
|
|
77
|
-
code?: string;
|
|
78
|
-
reason: string;
|
|
79
|
-
data?: JsonObject;
|
|
80
|
-
notices?: CommandNotice[];
|
|
81
|
-
diagnostics?: CommandDiagnostic[];
|
|
82
|
-
} | {
|
|
83
|
-
ok: false;
|
|
84
|
-
status: "error";
|
|
85
|
-
code?: string;
|
|
86
|
-
reason: string;
|
|
87
|
-
error?: SerializedError;
|
|
88
|
-
notices?: CommandNotice[];
|
|
89
|
-
diagnostics?: CommandDiagnostic[];
|
|
90
|
-
};
|
|
91
|
-
export interface CommandHelpersApi {
|
|
92
|
-
execute<TParams extends Struct = Struct, TResult = unknown>(command: CommandRef<TParams, TResult> | string, invocation: CommandInvocation<TParams>): Promise<CommandOutcome<TResult>>;
|
|
93
|
-
continue(): CommandContinue;
|
|
94
|
-
patchParams<TParams extends Struct = Struct>(params: Partial<TParams>): CommandPatchParams<TParams>;
|
|
95
|
-
replaceParams<TParams extends Struct = Struct>(params: TParams): CommandReplaceParams<TParams>;
|
|
96
|
-
replaceInvocation<TParams extends Struct = Struct>(invocation: CommandInvocation<TParams>): CommandReplaceInvocation<TParams>;
|
|
97
|
-
reject(input: Omit<CommandReject, "type">): CommandReject;
|
|
98
|
-
}
|
|
99
|
-
export interface CommandRequestedEvent<TParams extends Struct = Struct> {
|
|
100
|
-
commandId: string;
|
|
101
|
-
invocationId: string;
|
|
102
|
-
source?: CommandSource;
|
|
103
|
-
params: TParams;
|
|
104
|
-
resource?: ResourceRef;
|
|
105
|
-
repo?: RepoContext;
|
|
106
|
-
}
|
|
107
|
-
export interface CommandStartedEvent<TParams extends Struct = Struct> extends CommandRequestedEvent<TParams> {
|
|
108
|
-
}
|
|
109
|
-
export interface CommandCompletedEvent<TParams extends Struct = Struct, TResult = unknown> extends CommandStartedEvent<TParams> {
|
|
110
|
-
result: TResult;
|
|
111
|
-
elapsedMs: number;
|
|
112
|
-
}
|
|
113
|
-
export interface CommandRejectedEvent<TParams extends Struct = Struct> extends CommandRequestedEvent<TParams> {
|
|
114
|
-
code?: string;
|
|
115
|
-
reason: string;
|
|
116
|
-
data?: JsonObject;
|
|
117
|
-
}
|
|
118
|
-
export interface CommandFailedEvent<TParams extends Struct = Struct> extends CommandRequestedEvent<TParams> {
|
|
119
|
-
code?: string;
|
|
120
|
-
reason: string;
|
|
121
|
-
error?: SerializedError;
|
|
122
|
-
elapsedMs: number;
|
|
123
|
-
}
|
|
124
|
-
export type CommandLifecyclePhase = "requested" | "started" | "completed" | "rejected" | "failed";
|
|
125
|
-
export type CommandLifecycleEventPayload<TPhase extends CommandLifecyclePhase, TParams extends Struct = Struct, TResult = unknown> = TPhase extends "requested" ? CommandRequestedEvent<TParams> : TPhase extends "started" ? CommandStartedEvent<TParams> : TPhase extends "completed" ? CommandCompletedEvent<TParams, TResult> : TPhase extends "rejected" ? CommandRejectedEvent<TParams> : CommandFailedEvent<TParams>;
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import type { SessionStatus } from "pstdio-api-contracts";
|
|
2
|
-
import type { CommandHelpersApi, CommandInvocation, CommandMiddlewareResult, CommandNotice, CommandSource, WorkbenchAttachmentInvocationContext } from "./commands";
|
|
3
|
-
import type { EventDeliveryResult, EventRef } from "./events";
|
|
4
|
-
import type { JsonObject, MaybePromise, Struct } from "./json";
|
|
5
|
-
import type { RepoContext, ResourceAnchor, ResourceRef } from "./resources";
|
|
6
|
-
import type { SlotInvocationContext } from "./slots";
|
|
7
|
-
export interface ExtensionStorageCollectionApi<TItem = unknown> {
|
|
8
|
-
get(id: string): Promise<TItem | undefined>;
|
|
9
|
-
list(): Promise<TItem[]>;
|
|
10
|
-
put(id: string, value: TItem): Promise<void>;
|
|
11
|
-
create(value: TItem): Promise<TItem & {
|
|
12
|
-
id: string;
|
|
13
|
-
}>;
|
|
14
|
-
delete(id: string): Promise<void>;
|
|
15
|
-
attachments(itemId: string): ExtensionBlobsApi;
|
|
16
|
-
}
|
|
17
|
-
export type StorageScope = {
|
|
18
|
-
type: "project";
|
|
19
|
-
} | {
|
|
20
|
-
type: "repo";
|
|
21
|
-
repoId: string;
|
|
22
|
-
} | {
|
|
23
|
-
type: "resource";
|
|
24
|
-
resource: ResourceRef;
|
|
25
|
-
} | {
|
|
26
|
-
type: string;
|
|
27
|
-
id: string;
|
|
28
|
-
};
|
|
29
|
-
export interface ExtensionStorageApi {
|
|
30
|
-
scope(scope: StorageScope): ExtensionStorageApi;
|
|
31
|
-
files: ExtensionBlobsApi;
|
|
32
|
-
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
33
|
-
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
34
|
-
delete(key: string): Promise<void>;
|
|
35
|
-
collection<TItem = unknown>(name: string): ExtensionStorageCollectionApi<TItem>;
|
|
36
|
-
}
|
|
37
|
-
export interface ExtensionBlobRef {
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
mimeType: string | null;
|
|
41
|
-
size: number;
|
|
42
|
-
hash: string | null;
|
|
43
|
-
url: string;
|
|
44
|
-
createdAt: string;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
}
|
|
47
|
-
export interface ExtensionBlobInput {
|
|
48
|
-
name: string;
|
|
49
|
-
data: Uint8Array | ArrayBuffer;
|
|
50
|
-
mimeType?: string | null;
|
|
51
|
-
}
|
|
52
|
-
export interface ExtensionBlobsApi {
|
|
53
|
-
put(input: ExtensionBlobInput): Promise<ExtensionBlobRef>;
|
|
54
|
-
get(id: string): Promise<ExtensionBlobRef | undefined>;
|
|
55
|
-
getBytes(id: string): Promise<Uint8Array>;
|
|
56
|
-
list(): Promise<ExtensionBlobRef[]>;
|
|
57
|
-
delete(id: string): Promise<void>;
|
|
58
|
-
urlFor(id: string): string;
|
|
59
|
-
}
|
|
60
|
-
export interface ArtifactFile {
|
|
61
|
-
path: string;
|
|
62
|
-
size?: number;
|
|
63
|
-
updatedAt?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface ArtifactMount {
|
|
66
|
-
exists(path: string): Promise<boolean>;
|
|
67
|
-
readText(path: string): Promise<string>;
|
|
68
|
-
writeText(path: string, value: string): Promise<void>;
|
|
69
|
-
readBytes(path: string): Promise<Uint8Array>;
|
|
70
|
-
writeBytes(path: string, value: Uint8Array): Promise<void>;
|
|
71
|
-
list(pattern?: string): Promise<ArtifactFile[]>;
|
|
72
|
-
listDirs(path?: string): Promise<string[]>;
|
|
73
|
-
delete(path: string): Promise<void>;
|
|
74
|
-
}
|
|
75
|
-
export interface ExtensionArtifactApi {
|
|
76
|
-
mount(key: string): ArtifactMount;
|
|
77
|
-
}
|
|
78
|
-
export interface ExtensionFilesApi {
|
|
79
|
-
readText(fileId: string): Promise<string>;
|
|
80
|
-
writeText(fileId: string, value: string): Promise<void>;
|
|
81
|
-
createText(input: {
|
|
82
|
-
name: string;
|
|
83
|
-
content: string;
|
|
84
|
-
metadata?: JsonObject;
|
|
85
|
-
}): Promise<{
|
|
86
|
-
id: string;
|
|
87
|
-
}>;
|
|
88
|
-
delete(fileId: string): Promise<void>;
|
|
89
|
-
}
|
|
90
|
-
export interface ExtensionSessionResource {
|
|
91
|
-
type: "session";
|
|
92
|
-
id: string;
|
|
93
|
-
title: string;
|
|
94
|
-
status: SessionStatus;
|
|
95
|
-
}
|
|
96
|
-
export interface ExtensionSessionsApi {
|
|
97
|
-
get(id: string): Promise<{
|
|
98
|
-
id: string;
|
|
99
|
-
title: string;
|
|
100
|
-
status?: string;
|
|
101
|
-
original_session_id?: string | null;
|
|
102
|
-
cwd?: string | null;
|
|
103
|
-
anchors_json?: ResourceAnchor[];
|
|
104
|
-
} | null>;
|
|
105
|
-
create(input: {
|
|
106
|
-
title: string;
|
|
107
|
-
prompt?: string;
|
|
108
|
-
template?: string;
|
|
109
|
-
vars?: JsonObject;
|
|
110
|
-
harness?: ExtensionHarnessInput;
|
|
111
|
-
workspaceId?: string;
|
|
112
|
-
repoId?: string;
|
|
113
|
-
anchors?: ResourceAnchor[];
|
|
114
|
-
originalSessionId?: string;
|
|
115
|
-
}): Promise<ExtensionSessionResource>;
|
|
116
|
-
followup(input: {
|
|
117
|
-
sessionId: string;
|
|
118
|
-
prompt?: string;
|
|
119
|
-
template?: string;
|
|
120
|
-
vars?: JsonObject;
|
|
121
|
-
}): Promise<void>;
|
|
122
|
-
}
|
|
123
|
-
export interface ExtensionHarnessInput {
|
|
124
|
-
harnessId: string;
|
|
125
|
-
model?: string;
|
|
126
|
-
}
|
|
127
|
-
export interface ExtensionWorkspace {
|
|
128
|
-
id: string;
|
|
129
|
-
name?: string;
|
|
130
|
-
project_id?: string;
|
|
131
|
-
workspace_shorthand?: string;
|
|
132
|
-
branch?: string | null;
|
|
133
|
-
worktree_path?: string | null;
|
|
134
|
-
anchors_json?: ResourceAnchor[];
|
|
135
|
-
initializing?: boolean;
|
|
136
|
-
created_at?: string;
|
|
137
|
-
updated_at?: string;
|
|
138
|
-
}
|
|
139
|
-
export interface ExtensionWorkspacesApi {
|
|
140
|
-
list(): Promise<ExtensionWorkspace[]>;
|
|
141
|
-
get(id: string): Promise<ExtensionWorkspace | null>;
|
|
142
|
-
getByShorthand(shorthand: string): Promise<ExtensionWorkspace | null>;
|
|
143
|
-
create(input: JsonObject): Promise<ExtensionWorkspace>;
|
|
144
|
-
archive(id: string): Promise<void>;
|
|
145
|
-
delete(id: string): Promise<void>;
|
|
146
|
-
}
|
|
147
|
-
export interface BootstrapWorktreeInput {
|
|
148
|
-
repoPath: string;
|
|
149
|
-
worktreePath: string;
|
|
150
|
-
}
|
|
151
|
-
export interface ExtensionWorktreesApi {
|
|
152
|
-
bootstrap(input: BootstrapWorktreeInput): Promise<void>;
|
|
153
|
-
}
|
|
154
|
-
export interface ExtensionReposApi {
|
|
155
|
-
list(): Promise<RepoContext[]>;
|
|
156
|
-
get(repoId: string): Promise<RepoContext>;
|
|
157
|
-
getDefault(): Promise<RepoContext | undefined>;
|
|
158
|
-
resolvePath(repoId: string, relativePath: string, options?: {
|
|
159
|
-
basePath?: string;
|
|
160
|
-
}): Promise<string>;
|
|
161
|
-
}
|
|
162
|
-
export interface ExtensionEventsApi {
|
|
163
|
-
emit<TPayload extends Struct>(event: EventRef<TPayload> | string, payload: TPayload): Promise<EventDeliveryResult>;
|
|
164
|
-
}
|
|
165
|
-
export interface ExtensionActivityApi {
|
|
166
|
-
record(input: {
|
|
167
|
-
message: string;
|
|
168
|
-
target?: ResourceRef;
|
|
169
|
-
related?: ResourceRef[];
|
|
170
|
-
metadata?: JsonObject;
|
|
171
|
-
}): Promise<{
|
|
172
|
-
id: string;
|
|
173
|
-
}>;
|
|
174
|
-
}
|
|
175
|
-
export interface ExtensionNotifyApi {
|
|
176
|
-
toast(notice: CommandNotice): Promise<void>;
|
|
177
|
-
}
|
|
178
|
-
export interface ProcessRunResult {
|
|
179
|
-
exitCode: number;
|
|
180
|
-
stdout: string;
|
|
181
|
-
stderr: string;
|
|
182
|
-
}
|
|
183
|
-
export interface ProcessRunInput {
|
|
184
|
-
command: string[];
|
|
185
|
-
cwd?: string;
|
|
186
|
-
env?: Record<string, string>;
|
|
187
|
-
timeoutMs?: number;
|
|
188
|
-
}
|
|
189
|
-
export interface ExtensionProcessApi {
|
|
190
|
-
run(input: ProcessRunInput): Promise<ProcessRunResult>;
|
|
191
|
-
runOrThrow(input: ProcessRunInput): Promise<ProcessRunResult>;
|
|
192
|
-
spawnDetached(input: {
|
|
193
|
-
command: string[];
|
|
194
|
-
cwd?: string;
|
|
195
|
-
env?: Record<string, string>;
|
|
196
|
-
}): Promise<{
|
|
197
|
-
pid?: number;
|
|
198
|
-
}>;
|
|
199
|
-
}
|
|
200
|
-
export interface ExtensionNetApi {
|
|
201
|
-
findFreePort(input?: {
|
|
202
|
-
host?: string;
|
|
203
|
-
}): Promise<number>;
|
|
204
|
-
}
|
|
205
|
-
export interface ExtensionLoggerApi {
|
|
206
|
-
info(message: string, metadata?: JsonObject): void;
|
|
207
|
-
warn(message: string, metadata?: JsonObject): void;
|
|
208
|
-
error(message: string, metadata?: JsonObject): void;
|
|
209
|
-
}
|
|
210
|
-
export interface ExtensionSettingsApi<TSettings extends Record<string, unknown> = Record<string, unknown>> {
|
|
211
|
-
all(): Promise<Partial<TSettings>>;
|
|
212
|
-
get<TKey extends keyof TSettings & string>(key: TKey): Promise<TSettings[TKey] | undefined>;
|
|
213
|
-
set<TKey extends keyof TSettings & string>(key: TKey, value: TSettings[TKey]): Promise<void>;
|
|
214
|
-
delete<TKey extends keyof TSettings & string>(key: TKey): Promise<void>;
|
|
215
|
-
}
|
|
216
|
-
export interface ExtensionContextBase<TSettings extends Record<string, unknown> = Record<string, unknown>> {
|
|
217
|
-
projectId: string;
|
|
218
|
-
extensionId: string;
|
|
219
|
-
/** Extension package name. Used for grouping/prefixing user-facing references. */
|
|
220
|
-
name: string;
|
|
221
|
-
repo?: RepoContext;
|
|
222
|
-
source?: CommandSource;
|
|
223
|
-
storage: ExtensionStorageApi;
|
|
224
|
-
artifacts: ExtensionArtifactApi;
|
|
225
|
-
/** Working tree of the invocation's repo, scoped to its root. Absent for non-repo (event/hook) invocations. */
|
|
226
|
-
repoFiles?: ArtifactMount;
|
|
227
|
-
files: ExtensionFilesApi;
|
|
228
|
-
sessions: ExtensionSessionsApi;
|
|
229
|
-
workspaces: ExtensionWorkspacesApi;
|
|
230
|
-
worktrees: ExtensionWorktreesApi;
|
|
231
|
-
repos: ExtensionReposApi;
|
|
232
|
-
commands: CommandHelpersApi;
|
|
233
|
-
events: ExtensionEventsApi;
|
|
234
|
-
activity: ExtensionActivityApi;
|
|
235
|
-
notify: ExtensionNotifyApi;
|
|
236
|
-
process: ExtensionProcessApi;
|
|
237
|
-
net: ExtensionNetApi;
|
|
238
|
-
logger: ExtensionLoggerApi;
|
|
239
|
-
settings: ExtensionSettingsApi<TSettings>;
|
|
240
|
-
}
|
|
241
|
-
export interface CommandContext<TParams extends Struct = Struct, TSettings extends Record<string, unknown> = Record<string, unknown>> extends ExtensionContextBase<TSettings> {
|
|
242
|
-
commandId: string;
|
|
243
|
-
invocationId: string;
|
|
244
|
-
invocation: CommandInvocation<TParams>;
|
|
245
|
-
resource?: ResourceRef;
|
|
246
|
-
attachment?: WorkbenchAttachmentInvocationContext;
|
|
247
|
-
slot?: SlotInvocationContext;
|
|
248
|
-
params: TParams;
|
|
249
|
-
}
|
|
250
|
-
export type CommandMiddlewareContext<TParams extends Struct = Struct> = CommandContext<TParams>;
|
|
251
|
-
export type CommandMiddlewareHandler<TParams extends Struct = Struct> = (ctx: CommandMiddlewareContext<TParams>) => MaybePromise<CommandMiddlewareResult<TParams>>;
|
|
252
|
-
export type CommandRunHandler<TParams extends Struct = Struct, TResult = unknown, TSettings extends Record<string, unknown> = Record<string, unknown>> = (ctx: CommandContext<TParams, TSettings>) => MaybePromise<TResult>;
|
|
253
|
-
export interface EventContext extends ExtensionContextBase {
|
|
254
|
-
eventId: string;
|
|
255
|
-
deliveryId: string;
|
|
256
|
-
}
|
|
257
|
-
export type SetupContext = ExtensionContextBase;
|
|
258
|
-
export type MigrationContext = ExtensionContextBase;
|