@pstdio/sdk 0.20.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 +932 -483
- package/dist/api.d.ts +3767 -0
- package/dist/client/index.js +21 -14
- package/dist/client.d.ts +1714 -0
- package/dist/extensions/index.js +262 -140
- 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 +932 -483
- 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 -10
- 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/templates.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/client.d.ts +0 -26
- package/dist/client/extensions.d.ts +0 -12
- 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/templates.d.ts +0 -11
- 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 -26
- package/dist/extensions/define-extension-view.d.ts +0 -58
- package/dist/extensions/define-extension.d.ts +0 -54
- package/dist/extensions/index.d.ts +0 -13
- package/dist/extensions/params.d.ts +0 -36
- 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 -9
- 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 -10
- 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/template.d.ts +0 -1
- package/dist/resources/workspace.d.ts +0 -3
package/dist/extensions/index.js
CHANGED
|
@@ -13,9 +13,110 @@ 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
|
+
|
|
20
|
+
// ../pstdio-api-contracts/src/extension-kernel/builtin-refs.ts
|
|
21
|
+
var hostRef = (kind, id) => ({ extensionId: "pstdio", kind, id });
|
|
22
|
+
var workbenchModes = {
|
|
23
|
+
project: hostRef("mode", "project"),
|
|
24
|
+
sessions: hostRef("mode", "sessions"),
|
|
25
|
+
settings: hostRef("mode", "settings")
|
|
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
|
+
};
|
|
32
|
+
var hostResourceKind = (id, label, menuSlots) => ({
|
|
33
|
+
id,
|
|
34
|
+
ref: hostRef("resource-kind", id),
|
|
35
|
+
label,
|
|
36
|
+
menuSlots
|
|
37
|
+
});
|
|
38
|
+
var headerMenuSlots = [
|
|
39
|
+
{ id: "headerPrimary", placement: "header-primary", access: "public" },
|
|
40
|
+
{ id: "headerOverflow", placement: "header-overflow", access: "public" }
|
|
41
|
+
];
|
|
42
|
+
var workbenchResourceKindDefinitions = {
|
|
43
|
+
project: hostResourceKind("project", "Extension", headerMenuSlots),
|
|
44
|
+
session: hostResourceKind("session", "Session", headerMenuSlots),
|
|
45
|
+
workspace: hostResourceKind("workspace", "Workspace", headerMenuSlots)
|
|
46
|
+
};
|
|
47
|
+
var workbenchResourceKinds = {
|
|
48
|
+
project: workbenchResourceKindDefinitions.project.ref,
|
|
49
|
+
session: workbenchResourceKindDefinitions.session.ref,
|
|
50
|
+
workspace: workbenchResourceKindDefinitions.workspace.ref
|
|
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
|
+
};
|
|
102
|
+
var workbenchSlots = {
|
|
103
|
+
projectSettings: hostRef("settings-panel", "project.settings"),
|
|
104
|
+
statusBarLeading: hostRef("status-bar-item", "status-bar.leading"),
|
|
105
|
+
statusBarTrailing: hostRef("status-bar-item", "status-bar.trailing")
|
|
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"';
|
|
16
111
|
// ../pstdio-api-contracts/src/extension-kernel/refs.ts
|
|
17
|
-
var
|
|
18
|
-
var
|
|
112
|
+
var createCommandRef = (input) => ({ ...input, kind: "command" });
|
|
113
|
+
var commandRef = Object.assign(createCommandRef, {
|
|
114
|
+
forExtension: (owner) => (id) => createCommandRef({ extensionId: `${owner.publisher}.${owner.name}`, id })
|
|
115
|
+
});
|
|
116
|
+
var eventRef = (input) => ({
|
|
117
|
+
...input,
|
|
118
|
+
kind: "event"
|
|
119
|
+
});
|
|
19
120
|
|
|
20
121
|
// ../pstdio-api-contracts/src/extension-kernel/slots.ts
|
|
21
122
|
var defineSlot = (id, options) => ({
|
|
@@ -27,48 +128,49 @@ var defineSlot = (id, options) => ({
|
|
|
27
128
|
});
|
|
28
129
|
|
|
29
130
|
// ../pstdio-api-contracts/src/extension-kernel/kernel-slots.ts
|
|
131
|
+
var hostEventRef = (id) => eventRef({ extensionId: "pstdio", id });
|
|
132
|
+
var resourceMenuSlotRef = (resourceKind, id) => defineSlot(`${resourceKind.id}.${id}`, { kind: "menu" });
|
|
30
133
|
var projectSlots = {
|
|
31
134
|
sidenav: defineSlot("project.sidenav", { kind: "panel" }),
|
|
32
|
-
headerPrimary:
|
|
33
|
-
headerOverflow:
|
|
135
|
+
headerPrimary: resourceMenuSlotRef(workbenchResourceKinds.project, "headerPrimary"),
|
|
136
|
+
headerOverflow: resourceMenuSlotRef(workbenchResourceKinds.project, "headerOverflow"),
|
|
34
137
|
settingsPanels: defineSlot("project.settingsPanels", { kind: "settings" })
|
|
35
138
|
};
|
|
36
139
|
var sessionSlots = {
|
|
37
|
-
headerPrimary:
|
|
38
|
-
headerOverflow:
|
|
39
|
-
transcriptActions: defineSlot("session.transcriptActions", { kind: "menu" })
|
|
140
|
+
headerPrimary: resourceMenuSlotRef(workbenchResourceKinds.session, "headerPrimary"),
|
|
141
|
+
headerOverflow: resourceMenuSlotRef(workbenchResourceKinds.session, "headerOverflow")
|
|
40
142
|
};
|
|
41
143
|
var workspaceSlots = {
|
|
42
|
-
headerPrimary:
|
|
43
|
-
headerOverflow:
|
|
144
|
+
headerPrimary: resourceMenuSlotRef(workbenchResourceKinds.workspace, "headerPrimary"),
|
|
145
|
+
headerOverflow: resourceMenuSlotRef(workbenchResourceKinds.workspace, "headerOverflow"),
|
|
44
146
|
sidenav: defineSlot("workspace.sidenav", { kind: "panel" })
|
|
45
147
|
};
|
|
46
148
|
var projectEvents = {
|
|
47
|
-
opened:
|
|
149
|
+
opened: hostEventRef("project.opened")
|
|
48
150
|
};
|
|
49
151
|
var sessionEvents = {
|
|
50
|
-
started:
|
|
51
|
-
resumed:
|
|
52
|
-
awaitingInput:
|
|
53
|
-
succeeded:
|
|
54
|
-
failed:
|
|
55
|
-
completed:
|
|
152
|
+
started: hostEventRef("session.started"),
|
|
153
|
+
resumed: hostEventRef("session.resumed"),
|
|
154
|
+
awaitingInput: hostEventRef("session.awaitingInput"),
|
|
155
|
+
succeeded: hostEventRef("session.succeeded"),
|
|
156
|
+
failed: hostEventRef("session.failed"),
|
|
157
|
+
completed: hostEventRef("session.completed")
|
|
56
158
|
};
|
|
57
159
|
var workspaceEvents = {
|
|
58
|
-
created:
|
|
59
|
-
provision:
|
|
60
|
-
ready:
|
|
61
|
-
archived:
|
|
62
|
-
deleted:
|
|
160
|
+
created: hostEventRef("workspace.created"),
|
|
161
|
+
provision: hostEventRef("workspace.provision"),
|
|
162
|
+
ready: hostEventRef("workspace.ready"),
|
|
163
|
+
archived: hostEventRef("workspace.archived"),
|
|
164
|
+
deleted: hostEventRef("workspace.deleted")
|
|
63
165
|
};
|
|
64
166
|
var worktreeEvents = {
|
|
65
|
-
removed:
|
|
167
|
+
removed: hostEventRef("worktree.removed")
|
|
66
168
|
};
|
|
67
169
|
var gitEvents = {
|
|
68
|
-
committed:
|
|
69
|
-
rebased:
|
|
70
|
-
merged:
|
|
71
|
-
conflicted:
|
|
170
|
+
committed: hostEventRef("git.committed"),
|
|
171
|
+
rebased: hostEventRef("git.rebased"),
|
|
172
|
+
merged: hostEventRef("git.merged"),
|
|
173
|
+
conflicted: hostEventRef("git.conflicted")
|
|
72
174
|
};
|
|
73
175
|
// ../pstdio-api-contracts/src/extension-kernel/l10n.ts
|
|
74
176
|
var l10n = (key, defaultValue) => ({
|
|
@@ -82,15 +184,14 @@ var packageAsset = (path, baseUrl) => ({
|
|
|
82
184
|
path,
|
|
83
185
|
baseUrl
|
|
84
186
|
});
|
|
85
|
-
// ../pstdio-api-contracts/src/extension-kernel/types/composition.ts
|
|
86
|
-
var dockedWorkbenchRegions = ["sidenav", "main", "secondary", "side"];
|
|
87
187
|
// ../pstdio-api-contracts/src/extension-kernel/types/extension.ts
|
|
88
|
-
var EXTENSION_API_VERSION = "1.0.0-alpha.
|
|
188
|
+
var EXTENSION_API_VERSION = "1.0.0-alpha.10";
|
|
89
189
|
// ../pstdio-api-contracts/src/extension-kernel/types/webview-capabilities.ts
|
|
90
190
|
var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
|
|
91
191
|
var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
92
192
|
"commands.execute",
|
|
93
|
-
"
|
|
193
|
+
"navigation.open",
|
|
194
|
+
"placement.close",
|
|
94
195
|
"notification.show",
|
|
95
196
|
"notification.action",
|
|
96
197
|
"notification.resolve",
|
|
@@ -106,95 +207,13 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
|
106
207
|
"files.list",
|
|
107
208
|
"files.delete"
|
|
108
209
|
];
|
|
210
|
+
var WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES = ["artifacts.read"];
|
|
109
211
|
var ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES = ["host.dispatchKeyboardEvent"];
|
|
110
212
|
var WEBVIEW_HOST_CAPABILITIES = [
|
|
111
213
|
...WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
214
|
+
...WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
112
215
|
...ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
113
216
|
];
|
|
114
|
-
// ../pstdio-api-contracts/src/extension-kernel/workbench-targets.ts
|
|
115
|
-
var workbenchMenuTargets = ["workbench.nav.actions", "workbench.nav.overflow"];
|
|
116
|
-
var workbenchTreeTargets = [
|
|
117
|
-
"workbench.left.tree",
|
|
118
|
-
"workbench.main.left.tree",
|
|
119
|
-
"workbench.main.right.tree"
|
|
120
|
-
];
|
|
121
|
-
var workbenchRegions = [
|
|
122
|
-
"nav",
|
|
123
|
-
"activity",
|
|
124
|
-
"sidenav-header",
|
|
125
|
-
"sidenav",
|
|
126
|
-
"main-header",
|
|
127
|
-
"main",
|
|
128
|
-
"secondary-header",
|
|
129
|
-
"secondary",
|
|
130
|
-
"side-header",
|
|
131
|
-
"side",
|
|
132
|
-
"status",
|
|
133
|
-
"overlay"
|
|
134
|
-
];
|
|
135
|
-
var workbenchViewTargets = [
|
|
136
|
-
"workbench.main",
|
|
137
|
-
"workbench.main.left",
|
|
138
|
-
"workbench.main.right",
|
|
139
|
-
"workbench.secondary"
|
|
140
|
-
];
|
|
141
|
-
var workbenchSettingsTargets = ["workbench.settings"];
|
|
142
|
-
var workbenchSettingsScopes = ["project", "global"];
|
|
143
|
-
var workbenchModePanels = ["main", "secondary", "side"];
|
|
144
|
-
var workbenchModeLayoutTargets = [
|
|
145
|
-
"workbench.left",
|
|
146
|
-
"workbench.main.left",
|
|
147
|
-
"workbench.main",
|
|
148
|
-
"workbench.main.right",
|
|
149
|
-
"workbench.secondary"
|
|
150
|
-
];
|
|
151
|
-
var workbenchModeLayoutTargetPanels = {
|
|
152
|
-
"workbench.left": undefined,
|
|
153
|
-
"workbench.main.left": "main",
|
|
154
|
-
"workbench.main": "main",
|
|
155
|
-
"workbench.main.right": "main",
|
|
156
|
-
"workbench.secondary": "secondary"
|
|
157
|
-
};
|
|
158
|
-
var getWorkbenchModeLayoutTargetPanel = (target) => workbenchModeLayoutTargetPanels[target];
|
|
159
|
-
var workbenchTargets = [
|
|
160
|
-
{
|
|
161
|
-
id: "workbench.nav.actions",
|
|
162
|
-
allowedKinds: ["menu"],
|
|
163
|
-
granularity: "surface",
|
|
164
|
-
rationale: "Primary command surface in the host-owned nav (top) workbench chrome."
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
id: "workbench.nav.overflow",
|
|
168
|
-
allowedKinds: ["menu"],
|
|
169
|
-
granularity: "surface",
|
|
170
|
-
rationale: "Secondary command surface in the host-owned nav (top) workbench chrome."
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
id: "workbench.left.tree",
|
|
174
|
-
allowedKinds: ["treeItem"],
|
|
175
|
-
granularity: "areaTree",
|
|
176
|
-
rationale: "Tree entries for the active tree renderer mounted in the left area."
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
id: "workbench.main.left.tree",
|
|
180
|
-
allowedKinds: ["treeItem"],
|
|
181
|
-
granularity: "areaTree",
|
|
182
|
-
rationale: "Tree entries for the active tree renderer mounted in the main-left area."
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
id: "workbench.main.right.tree",
|
|
186
|
-
allowedKinds: ["treeItem"],
|
|
187
|
-
granularity: "areaTree",
|
|
188
|
-
rationale: "Tree entries for the active tree renderer mounted in the main-right area."
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
id: "workbench.settings",
|
|
192
|
-
allowedKinds: ["settings"],
|
|
193
|
-
granularity: "surface",
|
|
194
|
-
rationale: "Settings panel placement in host-owned settings navigation."
|
|
195
|
-
}
|
|
196
|
-
];
|
|
197
|
-
var getWorkbenchTargetDefinition = (id) => workbenchTargets.find((target) => target.id === id);
|
|
198
217
|
// src/extensions/command-outcome.ts
|
|
199
218
|
var unwrapCommandOutcome = (response, fallbackReason = "Command failed.") => {
|
|
200
219
|
const { outcome } = response;
|
|
@@ -204,9 +223,57 @@ var unwrapCommandOutcome = (response, fallbackReason = "Command failed.") => {
|
|
|
204
223
|
return outcome.value;
|
|
205
224
|
};
|
|
206
225
|
// src/extensions/define-command.ts
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
226
|
+
function defineCommand(definition) {
|
|
227
|
+
return { ...definition, ref: { kind: "command", id: definition.id } };
|
|
228
|
+
}
|
|
229
|
+
var defineMiddleware = (definition) => ({
|
|
230
|
+
...definition,
|
|
231
|
+
ref: { kind: "middleware", id: definition.id }
|
|
232
|
+
});
|
|
233
|
+
var defineHook = (definition) => ({
|
|
234
|
+
...definition,
|
|
235
|
+
ref: { kind: "hook", id: definition.id }
|
|
236
|
+
});
|
|
237
|
+
// src/extensions/define-contribution.ts
|
|
238
|
+
var defineContribution = (_kind) => (definition) => ({
|
|
239
|
+
...definition,
|
|
240
|
+
ref: { kind: _kind, id: definition.id }
|
|
241
|
+
});
|
|
242
|
+
var defineView = defineContribution("view");
|
|
243
|
+
var defineViewMenu = defineContribution("view-menu");
|
|
244
|
+
var definePlacement = defineContribution("placement");
|
|
245
|
+
var defineResourceKind = defineContribution("resource-kind");
|
|
246
|
+
var resourceMenuSlotRef2 = (resourceKind, id) => defineSlot(`${resourceKind.id}.${id}`, { kind: "menu" });
|
|
247
|
+
var defineNavigationItem = defineContribution("navigation-item");
|
|
248
|
+
var defineNavigationTree = defineContribution("navigation-tree");
|
|
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;
|
|
256
|
+
var defineStatusBarItem = defineContribution("status-bar-item");
|
|
257
|
+
var defineStatuses = defineContribution("status");
|
|
258
|
+
var defineSettingsPanel = defineContribution("settings-panel");
|
|
259
|
+
var defineActivityItem = defineContribution("activity-item");
|
|
260
|
+
var defineSettingsSection = defineContribution("settings-section");
|
|
261
|
+
var defineCommandPaletteResource = defineContribution("command-palette-resource");
|
|
262
|
+
var defineKeybinding = defineContribution("keybinding");
|
|
263
|
+
var defineSchedule = defineContribution("schedule");
|
|
264
|
+
var defineArtifactMount = defineContribution("artifact-mount");
|
|
265
|
+
var defineTemplateType = defineContribution("template-type");
|
|
266
|
+
var defineTemplate = defineContribution("template");
|
|
267
|
+
var defineSkill = defineContribution("skill");
|
|
268
|
+
var defineTheme = defineContribution("theme");
|
|
269
|
+
var defineFileIconTheme = defineContribution("file-icon-theme");
|
|
270
|
+
var defineWorkspaceType = defineContribution("workspace-type");
|
|
271
|
+
var defineHarness = defineContribution("harness");
|
|
272
|
+
var defineConnection = defineContribution("connection");
|
|
273
|
+
var defineResourceHierarchyProvider = (definition) => ({
|
|
274
|
+
...definition,
|
|
275
|
+
ref: { kind: "resource-hierarchy-provider", id: definition.id }
|
|
276
|
+
});
|
|
210
277
|
// src/extensions/define-extension.ts
|
|
211
278
|
var defineExtension = (extension) => extension;
|
|
212
279
|
// src/extensions/define-extension-view.ts
|
|
@@ -237,7 +304,7 @@ var createFilesClient = (host) => ({
|
|
|
237
304
|
upload: (input) => host.call("files.upload", input),
|
|
238
305
|
list: async (input) => {
|
|
239
306
|
const response = await host.call("files.list", input ?? {});
|
|
240
|
-
return response.files
|
|
307
|
+
return response.files;
|
|
241
308
|
},
|
|
242
309
|
delete: (id) => host.call("files.delete", { id })
|
|
243
310
|
});
|
|
@@ -288,23 +355,30 @@ var params = {
|
|
|
288
355
|
}),
|
|
289
356
|
repo: (options) => ({ type: "repo", ...options }),
|
|
290
357
|
harness: (options) => ({ type: "harness", ...options }),
|
|
291
|
-
template: (options) =>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
defaultValue: options.defaultValue,
|
|
296
|
-
metadata: options.metadata,
|
|
297
|
-
type: "template",
|
|
298
|
-
templateType: options.type
|
|
299
|
-
}),
|
|
358
|
+
template: (options) => {
|
|
359
|
+
const { type: templateType, ...rest } = options;
|
|
360
|
+
return { type: "template", templateType, ...rest };
|
|
361
|
+
},
|
|
300
362
|
resource: (options) => ({ type: "resource", ...options }),
|
|
301
363
|
json: (options) => ({ type: "json", ...options }),
|
|
302
364
|
list: (options) => ({ type: "list", ...options })
|
|
303
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
|
+
}
|
|
304
372
|
// src/extensions/refs.ts
|
|
305
373
|
var commandEvent = (command, phase) => ({
|
|
374
|
+
...command.extensionId ? { extensionId: command.extensionId } : {},
|
|
375
|
+
kind: "event",
|
|
306
376
|
id: `command.${phase}:${command.id}`
|
|
307
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
|
+
}
|
|
308
382
|
// src/extensions/terminal-session-bridge.ts
|
|
309
383
|
var TERMINAL_SESSION_CAPABILITY = "terminal.session";
|
|
310
384
|
var createTerminalSessionBridge = (host) => ({
|
|
@@ -377,6 +451,9 @@ var createTerminalSessionBridge = (host) => ({
|
|
|
377
451
|
};
|
|
378
452
|
}
|
|
379
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)}`;
|
|
380
457
|
// src/extensions/webview-client.ts
|
|
381
458
|
var createWebviewClient = (host, options) => {
|
|
382
459
|
const extensionId = options?.extensionId ?? host.extensionId;
|
|
@@ -385,7 +462,7 @@ var createWebviewClient = (host, options) => {
|
|
|
385
462
|
}
|
|
386
463
|
const runCommand = async (commandKey, params2) => {
|
|
387
464
|
const response = await host.call("commands.execute", {
|
|
388
|
-
commandId: `${extensionId}.${commandKey}`,
|
|
465
|
+
commandId: `${extensionId}.command.${commandKey}`,
|
|
389
466
|
params: params2
|
|
390
467
|
});
|
|
391
468
|
return unwrapCommandOutcome(response);
|
|
@@ -404,51 +481,96 @@ var createWebviewClient = (host, options) => {
|
|
|
404
481
|
await host.call("extension.settings.set", { key, value });
|
|
405
482
|
}
|
|
406
483
|
};
|
|
407
|
-
|
|
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 };
|
|
408
494
|
};
|
|
409
495
|
// src/extensions/when.ts
|
|
410
496
|
var matchesResourceWhen = (when, resourceType) => {
|
|
411
497
|
const resourceTypes = when?.resourceType;
|
|
412
498
|
if (!resourceTypes?.length)
|
|
413
499
|
return true;
|
|
414
|
-
return resourceType ? resourceTypes.
|
|
500
|
+
return resourceType ? resourceTypes.some((candidate) => (typeof candidate === "string" ? candidate : candidate.id) === resourceType) : false;
|
|
415
501
|
};
|
|
416
502
|
export {
|
|
417
503
|
worktreeEvents,
|
|
418
504
|
workspaceSlots,
|
|
419
505
|
workspaceEvents,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
506
|
+
workbenchSlots,
|
|
507
|
+
workbenchResourceKinds,
|
|
508
|
+
workbenchResourceKindDefinitions,
|
|
509
|
+
workbenchPanels,
|
|
510
|
+
workbenchPanelDefinitions,
|
|
511
|
+
workbenchPages,
|
|
512
|
+
workbenchPageDefinitions,
|
|
513
|
+
workbenchModes,
|
|
514
|
+
workbenchModeDefinitions,
|
|
428
515
|
unwrapCommandOutcome,
|
|
429
516
|
sessionSlots,
|
|
430
517
|
sessionEvents,
|
|
518
|
+
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
519
|
+
resourceKey,
|
|
520
|
+
qualifyRef,
|
|
431
521
|
projectSlots,
|
|
432
522
|
projectEvents,
|
|
433
523
|
params,
|
|
434
524
|
packageAsset,
|
|
435
525
|
matchesResourceWhen,
|
|
526
|
+
localContributionIdPattern,
|
|
527
|
+
localContributionIdGrammar,
|
|
436
528
|
l10n,
|
|
529
|
+
isValidLocalContributionId,
|
|
437
530
|
isLocalizedString,
|
|
438
531
|
gitEvents,
|
|
439
|
-
|
|
440
|
-
getWorkbenchModeLayoutTargetPanel,
|
|
532
|
+
extensionPanelRegions,
|
|
441
533
|
eventRef,
|
|
442
534
|
dockedWorkbenchRegions,
|
|
535
|
+
defineWorkspaceType,
|
|
536
|
+
defineViewMenu,
|
|
537
|
+
defineView,
|
|
538
|
+
defineTheme,
|
|
539
|
+
defineTemplateType,
|
|
540
|
+
defineTemplate,
|
|
541
|
+
defineStatuses,
|
|
542
|
+
defineStatusBarItem,
|
|
543
|
+
defineSlot,
|
|
544
|
+
defineSkill,
|
|
545
|
+
defineSettingsSection,
|
|
546
|
+
defineSettingsPanel,
|
|
547
|
+
defineSchedule,
|
|
548
|
+
defineResourceKind,
|
|
549
|
+
defineResourceHierarchyProvider,
|
|
550
|
+
definePlacement,
|
|
551
|
+
definePage,
|
|
552
|
+
defineNavigationTree,
|
|
553
|
+
defineNavigationItem,
|
|
554
|
+
defineMode,
|
|
443
555
|
defineMiddleware,
|
|
556
|
+
defineKeybinding,
|
|
444
557
|
defineHook,
|
|
558
|
+
defineHarness,
|
|
559
|
+
defineFileIconTheme,
|
|
445
560
|
defineExtensionView,
|
|
446
561
|
defineExtension,
|
|
562
|
+
defineConnection,
|
|
563
|
+
defineCommandPaletteResource,
|
|
447
564
|
defineCommand,
|
|
565
|
+
defineArtifactMount,
|
|
566
|
+
defineActivityItem,
|
|
448
567
|
createWebviewClient,
|
|
449
568
|
createTerminalSessionBridge,
|
|
450
569
|
commandRef,
|
|
451
570
|
commandEvent,
|
|
571
|
+
artifactsRead,
|
|
572
|
+
artifactMountId,
|
|
573
|
+
WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
452
574
|
WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
453
575
|
WEBVIEW_HOST_CAPABILITIES,
|
|
454
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 { }
|