@pstdio/sdk 0.24.0 → 0.25.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.js +1694 -10276
- package/dist/api.d.ts +1 -0
- package/dist/client/index.js +6 -21
- package/dist/client.d.ts +1 -0
- package/dist/data/index.js +9 -24
- package/dist/data.d.ts +2 -0
- package/dist/extensions/index.js +187 -108
- package/dist/extensions/react/index.js +2 -17
- package/dist/extensions.d.ts +22 -2
- package/dist/hooks.d.ts +1 -0
- package/dist/prompts/index.js +0 -15
- package/dist/resources/index.js +1694 -10276
- package/dist/testing/index.js +17 -20
- package/dist/testing.d.ts +11 -0
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -180,6 +180,7 @@ declare const commandExecuteResponseSchema: z.ZodObject<{
|
|
|
180
180
|
rejected: "rejected";
|
|
181
181
|
}>;
|
|
182
182
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
183
|
+
navigationRequests: z.ZodOptional<z.ZodArray<z.ZodType<NavigationTarget, unknown, z.core.$ZodTypeInternals<NavigationTarget, unknown>>>>;
|
|
183
184
|
code: z.ZodOptional<z.ZodString>;
|
|
184
185
|
reason: z.ZodOptional<z.ZodString>;
|
|
185
186
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
package/dist/client/index.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
// src/client/agents.ts
|
|
17
2
|
var createAgentClient = (request) => ({
|
|
18
3
|
info: (params) => request(params?.project ? `/v1/agents/info?project=${encodeURIComponent(params.project)}` : "/v1/agents/info"),
|
|
@@ -270,7 +255,7 @@ var readSseStream = async (body, onEvent, options = {}) => {
|
|
|
270
255
|
const decoder = new TextDecoder;
|
|
271
256
|
let buffer = "";
|
|
272
257
|
const abort = () => {
|
|
273
|
-
reader.cancel();
|
|
258
|
+
reader.cancel().catch(() => {});
|
|
274
259
|
};
|
|
275
260
|
options.signal?.addEventListener("abort", abort, { once: true });
|
|
276
261
|
try {
|
|
@@ -634,10 +619,10 @@ var createClient = (options = {}) => {
|
|
|
634
619
|
};
|
|
635
620
|
};
|
|
636
621
|
export {
|
|
637
|
-
|
|
638
|
-
createRuntimeClient,
|
|
639
|
-
createRequest,
|
|
640
|
-
createClient,
|
|
622
|
+
PstdioApiError,
|
|
641
623
|
applySyncEvent,
|
|
642
|
-
|
|
624
|
+
createClient,
|
|
625
|
+
createRequest,
|
|
626
|
+
createRuntimeClient,
|
|
627
|
+
parseSyncDeleteEvent
|
|
643
628
|
};
|
package/dist/client.d.ts
CHANGED
|
@@ -244,6 +244,7 @@ declare const commandExecuteResponseSchema: z.ZodObject<{
|
|
|
244
244
|
rejected: "rejected";
|
|
245
245
|
}>;
|
|
246
246
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
247
|
+
navigationRequests: z.ZodOptional<z.ZodArray<z.ZodType<NavigationTarget, unknown, z.core.$ZodTypeInternals<NavigationTarget, unknown>>>>;
|
|
247
248
|
code: z.ZodOptional<z.ZodString>;
|
|
248
249
|
reason: z.ZodOptional<z.ZodString>;
|
|
249
250
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
package/dist/data/index.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
// src/data/draft-layout.ts
|
|
17
2
|
var assertSafePathSegment = (value) => {
|
|
18
3
|
if (!value || value === "." || value === ".." || /[/\\\0]/.test(value))
|
|
@@ -102,14 +87,14 @@ var resolveByIdOrName = (items, value, nameOf, label) => {
|
|
|
102
87
|
throw new Error(`Unknown ${label} "${value}"`);
|
|
103
88
|
};
|
|
104
89
|
export {
|
|
105
|
-
|
|
106
|
-
stripFrontmatter,
|
|
107
|
-
sameName,
|
|
108
|
-
resolveByIdOrName,
|
|
109
|
-
requireRepoFiles,
|
|
110
|
-
quoteYamlScalar,
|
|
111
|
-
findClosingFrontmatterDelimiter,
|
|
112
|
-
createDraftLayout,
|
|
90
|
+
applyFrontmatter,
|
|
113
91
|
assertSafePathSegment,
|
|
114
|
-
|
|
92
|
+
createDraftLayout,
|
|
93
|
+
findClosingFrontmatterDelimiter,
|
|
94
|
+
quoteYamlScalar,
|
|
95
|
+
requireRepoFiles,
|
|
96
|
+
resolveByIdOrName,
|
|
97
|
+
sameName,
|
|
98
|
+
stripFrontmatter,
|
|
99
|
+
unquoteYamlScalar
|
|
115
100
|
};
|
package/dist/data.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ declare interface ArtifactMount {
|
|
|
10
10
|
exists(path: string): Promise<boolean>;
|
|
11
11
|
readText(path: string): Promise<string>;
|
|
12
12
|
writeText(path: string, value: string): Promise<void>;
|
|
13
|
+
/** Replace existing text. Fails if missing and never recreates a concurrently deleted file. */
|
|
14
|
+
updateText(path: string, value: string): Promise<void>;
|
|
13
15
|
readBytes(path: string): Promise<Uint8Array>;
|
|
14
16
|
writeBytes(path: string, value: Uint8Array): Promise<void>;
|
|
15
17
|
list(pattern?: string): Promise<ArtifactFile[]>;
|
package/dist/extensions/index.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
// ../pstdio-api-contracts/src/extension-kernel/types/composition.ts
|
|
17
2
|
var dockedWorkbenchRegions = ["sidenav", "main", "secondary", "side"];
|
|
18
3
|
var extensionPanelRegions = ["main", "secondary", "side"];
|
|
@@ -178,6 +163,98 @@ var l10n = (key, defaultValue) => ({
|
|
|
178
163
|
...defaultValue === undefined ? {} : { default: defaultValue }
|
|
179
164
|
});
|
|
180
165
|
var isLocalizedString = (value) => typeof value === "object" && value !== null && ("$l10n" in value) && typeof value.$l10n === "string";
|
|
166
|
+
// ../pstdio-api-contracts/src/extension-kernel/navigation-href.ts
|
|
167
|
+
var isNavigationHref = (href) => {
|
|
168
|
+
if (typeof href !== "string")
|
|
169
|
+
return false;
|
|
170
|
+
try {
|
|
171
|
+
const { protocol } = new URL(href);
|
|
172
|
+
return protocol === "https:" || protocol === "http:";
|
|
173
|
+
} catch {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// ../pstdio-api-contracts/src/extension-kernel/navigation.ts
|
|
179
|
+
var isRecord = (value) => Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
180
|
+
var isContributionRef = (value, kind) => isRecord(value) && value.kind === kind && typeof value.id === "string";
|
|
181
|
+
var isResource = (value) => isRecord(value) && typeof value.type === "string" && typeof value.id === "string";
|
|
182
|
+
var isOpenIntent = (value) => value === undefined || value === "preview" || value === "pin";
|
|
183
|
+
var isPageTarget = (value, ancestors = new Set) => {
|
|
184
|
+
if (!isRecord(value) || value.kind !== "page" || !isContributionRef(value.page, "page"))
|
|
185
|
+
return false;
|
|
186
|
+
if (ancestors.has(value))
|
|
187
|
+
return false;
|
|
188
|
+
if (value.resource !== undefined && !isResource(value.resource))
|
|
189
|
+
return false;
|
|
190
|
+
if (value.section !== undefined && !isRecord(value.section))
|
|
191
|
+
return false;
|
|
192
|
+
if (!isOpenIntent(value.open))
|
|
193
|
+
return false;
|
|
194
|
+
if (value.parent === undefined)
|
|
195
|
+
return true;
|
|
196
|
+
const next = new Set(ancestors);
|
|
197
|
+
next.add(value);
|
|
198
|
+
return isPageTarget(value.parent, next);
|
|
199
|
+
};
|
|
200
|
+
var isPanelTarget = (value) => {
|
|
201
|
+
if (!isRecord(value) || value.kind !== "panel" || !isRecord(value.panel))
|
|
202
|
+
return false;
|
|
203
|
+
const panel = value.panel;
|
|
204
|
+
const validPanel = isContributionRef(panel, "placement") || panel.kind === "page-slot" && isContributionRef(panel.page, "page") && typeof panel.id === "string";
|
|
205
|
+
return validPanel && (value.resource === undefined || isResource(value.resource)) && isOpenIntent(value.open);
|
|
206
|
+
};
|
|
207
|
+
var isItemTarget = (value) => {
|
|
208
|
+
if (!isRecord(value))
|
|
209
|
+
return false;
|
|
210
|
+
if (value.kind === "page")
|
|
211
|
+
return isPageTarget(value);
|
|
212
|
+
if (value.kind === "panel")
|
|
213
|
+
return isPanelTarget(value);
|
|
214
|
+
if (value.kind === "href")
|
|
215
|
+
return isNavigationHref(value.href);
|
|
216
|
+
return value.kind === "command" && isRecord(value.target) && isContributionRef(value.target.command, "command") && (value.target.params === undefined || isRecord(value.target.params));
|
|
217
|
+
};
|
|
218
|
+
var isNavigationTarget = (value) => {
|
|
219
|
+
if (isItemTarget(value))
|
|
220
|
+
return true;
|
|
221
|
+
if (!isRecord(value) || value.kind !== "compound" || !Array.isArray(value.targets) || value.targets.length === 0) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return value.targets.every((target) => isPageTarget(target) || isPanelTarget(target));
|
|
225
|
+
};
|
|
226
|
+
var withExtensionOwner = (ref, extensionId) => ref.extensionId !== undefined || extensionId === undefined ? ref : { ...ref, extensionId };
|
|
227
|
+
var toPageTarget = (target, extensionId, projectId) => ({
|
|
228
|
+
...target,
|
|
229
|
+
page: withExtensionOwner(target.page, extensionId),
|
|
230
|
+
...target.resource ? { resource: qualifyResource(target.resource, extensionId, projectId) } : {},
|
|
231
|
+
...target.parent ? { parent: toPageTarget(target.parent, extensionId, projectId) } : {}
|
|
232
|
+
});
|
|
233
|
+
var qualifyResource = (resource, extensionId, projectId) => ({
|
|
234
|
+
...resource,
|
|
235
|
+
extensionId: resource.extensionId ?? extensionId,
|
|
236
|
+
projectId: resource.projectId ?? projectId
|
|
237
|
+
});
|
|
238
|
+
var qualifyNavigationTarget = (target, extensionId, projectId) => {
|
|
239
|
+
if (!isNavigationTarget(target))
|
|
240
|
+
throw new Error("Invalid navigation target.");
|
|
241
|
+
if (target.kind === "page")
|
|
242
|
+
return toPageTarget(target, extensionId, projectId);
|
|
243
|
+
if (target.kind === "panel")
|
|
244
|
+
return {
|
|
245
|
+
...target,
|
|
246
|
+
panel: target.panel.kind === "page-slot" ? { ...target.panel, page: withExtensionOwner(target.panel.page, extensionId) } : withExtensionOwner(target.panel, extensionId),
|
|
247
|
+
...target.resource ? { resource: qualifyResource(target.resource, extensionId, projectId) } : {}
|
|
248
|
+
};
|
|
249
|
+
if (target.kind === "command")
|
|
250
|
+
return { ...target, target: { ...target.target, command: withExtensionOwner(target.target.command, extensionId) } };
|
|
251
|
+
if (target.kind === "href")
|
|
252
|
+
return target;
|
|
253
|
+
return {
|
|
254
|
+
...target,
|
|
255
|
+
targets: target.targets.map((item) => qualifyNavigationTarget(item, extensionId, projectId))
|
|
256
|
+
};
|
|
257
|
+
};
|
|
181
258
|
// ../pstdio-api-contracts/src/extension-kernel/package-asset.ts
|
|
182
259
|
var packageAsset = (path, baseUrl) => ({
|
|
183
260
|
kind: "package-asset",
|
|
@@ -215,7 +292,7 @@ var WEBVIEW_HOST_CAPABILITIES = [
|
|
|
215
292
|
...ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
216
293
|
];
|
|
217
294
|
// package.json
|
|
218
|
-
var version = "0.
|
|
295
|
+
var version = "0.25.0";
|
|
219
296
|
|
|
220
297
|
// src/version.ts
|
|
221
298
|
var SDK_VERSION = version;
|
|
@@ -414,11 +491,11 @@ var normalizedSection = (value) => {
|
|
|
414
491
|
}
|
|
415
492
|
return {
|
|
416
493
|
anchors: anchors.map((anchor) => {
|
|
417
|
-
const
|
|
494
|
+
const value = anchor;
|
|
418
495
|
return {
|
|
419
|
-
id:
|
|
420
|
-
heading:
|
|
421
|
-
...
|
|
496
|
+
id: value.id,
|
|
497
|
+
heading: value.heading,
|
|
498
|
+
...value.occurrence !== undefined ? { occurrence: value.occurrence } : {}
|
|
422
499
|
};
|
|
423
500
|
})
|
|
424
501
|
};
|
|
@@ -652,10 +729,10 @@ var createWebviewClient = (host, options) => {
|
|
|
652
729
|
if (!extensionId) {
|
|
653
730
|
throw new Error("The host bridge did not provide an extension id. Pass { extensionId } to createWebviewClient.");
|
|
654
731
|
}
|
|
655
|
-
const runCommand = async (commandKey,
|
|
732
|
+
const runCommand = async (commandKey, params) => {
|
|
656
733
|
const response = await host.call("commands.execute", {
|
|
657
734
|
commandId: `${extensionId}.command.${commandKey}`,
|
|
658
|
-
params
|
|
735
|
+
params
|
|
659
736
|
});
|
|
660
737
|
return unwrapCommandOutcome(response);
|
|
661
738
|
};
|
|
@@ -663,7 +740,7 @@ var createWebviewClient = (host, options) => {
|
|
|
663
740
|
get: (_target, commandKey) => {
|
|
664
741
|
if (typeof commandKey !== "string")
|
|
665
742
|
return;
|
|
666
|
-
return (
|
|
743
|
+
return (params) => runCommand(commandKey, params);
|
|
667
744
|
}
|
|
668
745
|
});
|
|
669
746
|
const settings = {
|
|
@@ -696,90 +773,92 @@ var matchesResourceWhen = (when, resourceType) => {
|
|
|
696
773
|
// src/extensions/index.ts
|
|
697
774
|
var projectPrefix = () => ({ $prefix: "project" });
|
|
698
775
|
export {
|
|
699
|
-
|
|
700
|
-
workspaceSlots,
|
|
701
|
-
workspaceEvents,
|
|
702
|
-
workbenchSlots,
|
|
703
|
-
workbenchResourceKinds,
|
|
704
|
-
workbenchResourceKindDefinitions,
|
|
705
|
-
workbenchPanels,
|
|
706
|
-
workbenchPanelDefinitions,
|
|
707
|
-
workbenchPages,
|
|
708
|
-
workbenchPageDefinitions,
|
|
709
|
-
workbenchModes,
|
|
710
|
-
workbenchModeDefinitions,
|
|
711
|
-
unwrapCommandOutcome,
|
|
712
|
-
sessionSlots,
|
|
713
|
-
sessionEvents,
|
|
714
|
-
serializeWorkbenchPageUrl,
|
|
715
|
-
serializePageUrl,
|
|
716
|
-
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
717
|
-
resourceKey,
|
|
718
|
-
resolveEventReferenceId,
|
|
719
|
-
qualifyRef,
|
|
720
|
-
projectSlots,
|
|
721
|
-
projectPrefix,
|
|
722
|
-
projectEvents,
|
|
723
|
-
parseWorkbenchPageUrl,
|
|
724
|
-
parsePageUrl,
|
|
725
|
-
params,
|
|
726
|
-
packageAsset,
|
|
727
|
-
matchesResourceWhen,
|
|
728
|
-
localContributionIdPattern,
|
|
729
|
-
localContributionIdGrammar,
|
|
730
|
-
l10n,
|
|
731
|
-
isWorkbenchProjectUrl,
|
|
732
|
-
isValidLocalContributionId,
|
|
733
|
-
isLocalizedString,
|
|
734
|
-
gitEvents,
|
|
735
|
-
extensionPanelRegions,
|
|
736
|
-
eventRef,
|
|
737
|
-
dockedWorkbenchRegions,
|
|
738
|
-
defineWorkspaceType,
|
|
739
|
-
defineViewMenu,
|
|
740
|
-
defineView,
|
|
741
|
-
defineTheme,
|
|
742
|
-
defineTemplateType,
|
|
743
|
-
defineTemplate,
|
|
744
|
-
defineStatuses,
|
|
745
|
-
defineStatusBarItem,
|
|
746
|
-
defineSlot,
|
|
747
|
-
defineSkill,
|
|
748
|
-
defineSettingsSection,
|
|
749
|
-
defineSettingsPanel,
|
|
750
|
-
defineSchedule,
|
|
751
|
-
defineResourceKind,
|
|
752
|
-
defineResourceHierarchyProvider,
|
|
753
|
-
definePlacement,
|
|
754
|
-
definePage,
|
|
755
|
-
defineNavigationTree,
|
|
756
|
-
defineNavigationItem,
|
|
757
|
-
defineMode,
|
|
758
|
-
defineMiddleware,
|
|
759
|
-
defineKeybinding,
|
|
760
|
-
defineHook,
|
|
761
|
-
defineHarness,
|
|
762
|
-
defineFileIconTheme,
|
|
763
|
-
defineExtensionView,
|
|
764
|
-
defineExtension,
|
|
765
|
-
defineConnection,
|
|
766
|
-
defineCommandPaletteResource,
|
|
767
|
-
defineCommand,
|
|
768
|
-
defineArtifactMount,
|
|
769
|
-
defineActivityItem,
|
|
770
|
-
defaultPageResourceCodec,
|
|
771
|
-
createWebviewClient,
|
|
772
|
-
createTerminalSessionBridge,
|
|
773
|
-
commandRef,
|
|
774
|
-
commandEvent,
|
|
775
|
-
artifactsRead,
|
|
776
|
-
artifactMountId,
|
|
777
|
-
WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
778
|
-
WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
779
|
-
WEBVIEW_HOST_CAPABILITIES,
|
|
780
|
-
WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
781
|
-
SDK_VERSION,
|
|
782
|
-
EXTENSION_EVENTS_SCOPE,
|
|
776
|
+
ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES,
|
|
783
777
|
EXTENSION_API_VERSION,
|
|
784
|
-
|
|
778
|
+
EXTENSION_EVENTS_SCOPE,
|
|
779
|
+
SDK_VERSION,
|
|
780
|
+
WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
781
|
+
WEBVIEW_HOST_CAPABILITIES,
|
|
782
|
+
WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
783
|
+
WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
784
|
+
artifactMountId,
|
|
785
|
+
artifactsRead,
|
|
786
|
+
commandEvent,
|
|
787
|
+
commandRef,
|
|
788
|
+
createTerminalSessionBridge,
|
|
789
|
+
createWebviewClient,
|
|
790
|
+
defaultPageResourceCodec,
|
|
791
|
+
defineActivityItem,
|
|
792
|
+
defineArtifactMount,
|
|
793
|
+
defineCommand,
|
|
794
|
+
defineCommandPaletteResource,
|
|
795
|
+
defineConnection,
|
|
796
|
+
defineExtension,
|
|
797
|
+
defineExtensionView,
|
|
798
|
+
defineFileIconTheme,
|
|
799
|
+
defineHarness,
|
|
800
|
+
defineHook,
|
|
801
|
+
defineKeybinding,
|
|
802
|
+
defineMiddleware,
|
|
803
|
+
defineMode,
|
|
804
|
+
defineNavigationItem,
|
|
805
|
+
defineNavigationTree,
|
|
806
|
+
definePage,
|
|
807
|
+
definePlacement,
|
|
808
|
+
defineResourceHierarchyProvider,
|
|
809
|
+
defineResourceKind,
|
|
810
|
+
defineSchedule,
|
|
811
|
+
defineSettingsPanel,
|
|
812
|
+
defineSettingsSection,
|
|
813
|
+
defineSkill,
|
|
814
|
+
defineSlot,
|
|
815
|
+
defineStatusBarItem,
|
|
816
|
+
defineStatuses,
|
|
817
|
+
defineTemplate,
|
|
818
|
+
defineTemplateType,
|
|
819
|
+
defineTheme,
|
|
820
|
+
defineView,
|
|
821
|
+
defineViewMenu,
|
|
822
|
+
defineWorkspaceType,
|
|
823
|
+
dockedWorkbenchRegions,
|
|
824
|
+
eventRef,
|
|
825
|
+
extensionPanelRegions,
|
|
826
|
+
gitEvents,
|
|
827
|
+
isLocalizedString,
|
|
828
|
+
isNavigationTarget,
|
|
829
|
+
isValidLocalContributionId,
|
|
830
|
+
isWorkbenchProjectUrl,
|
|
831
|
+
l10n,
|
|
832
|
+
localContributionIdGrammar,
|
|
833
|
+
localContributionIdPattern,
|
|
834
|
+
matchesResourceWhen,
|
|
835
|
+
packageAsset,
|
|
836
|
+
params,
|
|
837
|
+
parsePageUrl,
|
|
838
|
+
parseWorkbenchPageUrl,
|
|
839
|
+
projectEvents,
|
|
840
|
+
projectPrefix,
|
|
841
|
+
projectSlots,
|
|
842
|
+
qualifyNavigationTarget,
|
|
843
|
+
qualifyRef,
|
|
844
|
+
resolveEventReferenceId,
|
|
845
|
+
resourceKey,
|
|
846
|
+
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
847
|
+
serializePageUrl,
|
|
848
|
+
serializeWorkbenchPageUrl,
|
|
849
|
+
sessionEvents,
|
|
850
|
+
sessionSlots,
|
|
851
|
+
unwrapCommandOutcome,
|
|
852
|
+
workbenchModeDefinitions,
|
|
853
|
+
workbenchModes,
|
|
854
|
+
workbenchPageDefinitions,
|
|
855
|
+
workbenchPages,
|
|
856
|
+
workbenchPanelDefinitions,
|
|
857
|
+
workbenchPanels,
|
|
858
|
+
workbenchResourceKindDefinitions,
|
|
859
|
+
workbenchResourceKinds,
|
|
860
|
+
workbenchSlots,
|
|
861
|
+
workspaceEvents,
|
|
862
|
+
workspaceSlots,
|
|
863
|
+
worktreeEvents
|
|
785
864
|
};
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
// src/extensions/react/index.ts
|
|
17
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
18
3
|
var useCommandQuery = (input) => {
|
|
@@ -34,6 +19,6 @@ var useCommandMutation = (input) => {
|
|
|
34
19
|
});
|
|
35
20
|
};
|
|
36
21
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
useCommandMutation,
|
|
23
|
+
useCommandQuery
|
|
39
24
|
};
|
package/dist/extensions.d.ts
CHANGED
|
@@ -99,6 +99,8 @@ export declare interface ArtifactMount {
|
|
|
99
99
|
exists(path: string): Promise<boolean>;
|
|
100
100
|
readText(path: string): Promise<string>;
|
|
101
101
|
writeText(path: string, value: string): Promise<void>;
|
|
102
|
+
/** Replace existing text. Fails if missing and never recreates a concurrently deleted file. */
|
|
103
|
+
updateText(path: string, value: string): Promise<void>;
|
|
102
104
|
readBytes(path: string): Promise<Uint8Array>;
|
|
103
105
|
writeBytes(path: string, value: Uint8Array): Promise<void>;
|
|
104
106
|
list(pattern?: string): Promise<ArtifactFile[]>;
|
|
@@ -303,6 +305,7 @@ export declare type CommandOutcome<TResult = unknown> = {
|
|
|
303
305
|
ok: true;
|
|
304
306
|
status: "success";
|
|
305
307
|
value: TResult;
|
|
308
|
+
navigationRequests?: NavigationTarget[];
|
|
306
309
|
notices?: CommandNotice[];
|
|
307
310
|
diagnostics?: CommandDiagnostic[];
|
|
308
311
|
} | {
|
|
@@ -652,7 +655,7 @@ export declare interface DataTableRendererRowAction<TParams extends Struct = Str
|
|
|
652
655
|
|
|
653
656
|
export declare type DataTableRendererRowActivationHandler = RendererCallback<{
|
|
654
657
|
row: DataTableRendererRow;
|
|
655
|
-
},
|
|
658
|
+
}, void | NavigationTarget>;
|
|
656
659
|
|
|
657
660
|
export declare interface DataTableRendererSelectionAction<TParams extends Struct = Struct> {
|
|
658
661
|
id: string;
|
|
@@ -933,6 +936,10 @@ export declare interface ExtensionContextBase<TSettings extends Record<string, u
|
|
|
933
936
|
source?: CommandSource;
|
|
934
937
|
storage: ExtensionStorageApi;
|
|
935
938
|
resources: ExtensionResourcesApi;
|
|
939
|
+
/** Records navigation for the invoking UI; headless execution opens nothing. */
|
|
940
|
+
navigation: {
|
|
941
|
+
open(target: NavigationTarget): void;
|
|
942
|
+
};
|
|
936
943
|
artifacts: ExtensionArtifactApi;
|
|
937
944
|
/** Working tree of the invocation's repo, scoped to its root. Absent for non-repo (event/hook) invocations. */
|
|
938
945
|
repoFiles?: ArtifactMount;
|
|
@@ -1064,6 +1071,8 @@ export declare interface ExtensionReposApi {
|
|
|
1064
1071
|
}
|
|
1065
1072
|
|
|
1066
1073
|
export declare interface ExtensionResourcesApi {
|
|
1074
|
+
/** Publish a committed removal to clients displaying this project resource. */
|
|
1075
|
+
removed(resource: ResourceRef): Promise<void>;
|
|
1067
1076
|
allocate(input: {
|
|
1068
1077
|
kind: string;
|
|
1069
1078
|
}): Promise<{
|
|
@@ -1173,6 +1182,8 @@ export declare interface ExtensionStorageCollectionApi<TItem = unknown> {
|
|
|
1173
1182
|
get(id: string): Promise<TItem | undefined>;
|
|
1174
1183
|
list(): Promise<TItem[]>;
|
|
1175
1184
|
put(id: string, value: TItem): Promise<void>;
|
|
1185
|
+
/** Replace an existing item atomically. Throws if the item was deleted. */
|
|
1186
|
+
update(id: string, value: TItem): Promise<void>;
|
|
1176
1187
|
createIfAbsent(id: string, value: TItem): Promise<boolean>;
|
|
1177
1188
|
deleteIfValue(id: string, value: TItem): Promise<boolean>;
|
|
1178
1189
|
create(value: TItem): Promise<TItem & {
|
|
@@ -1488,6 +1499,8 @@ export declare interface HookDefinition<TPayload extends Struct = Struct> extend
|
|
|
1488
1499
|
|
|
1489
1500
|
export declare const isLocalizedString: (value: unknown) => value is LocalizedString;
|
|
1490
1501
|
|
|
1502
|
+
export declare const isNavigationTarget: (value: unknown) => value is NavigationTarget;
|
|
1503
|
+
|
|
1491
1504
|
export declare const isValidLocalContributionId: (id: string) => boolean;
|
|
1492
1505
|
|
|
1493
1506
|
export declare const isWorkbenchProjectUrl: (urlValue: string, projectId: string) => boolean;
|
|
@@ -1646,7 +1659,7 @@ export declare interface KanbanRendererRowAction<TParams extends Struct = Struct
|
|
|
1646
1659
|
|
|
1647
1660
|
export declare type KanbanRendererRowActivationHandler = RendererCallback<{
|
|
1648
1661
|
row: KanbanRendererRow;
|
|
1649
|
-
},
|
|
1662
|
+
}, void | NavigationTarget>;
|
|
1650
1663
|
|
|
1651
1664
|
export declare interface KanbanRendererSavedView {
|
|
1652
1665
|
id: string;
|
|
@@ -2332,6 +2345,8 @@ export declare type QualifiedRef<Ref extends QualifiableRef> = Ref extends PageS
|
|
|
2332
2345
|
readonly extensionId: string;
|
|
2333
2346
|
};
|
|
2334
2347
|
|
|
2348
|
+
export declare const qualifyNavigationTarget: (target: NavigationTarget, extensionId: string, projectId?: string) => NavigationTarget;
|
|
2349
|
+
|
|
2335
2350
|
/** Publish a provider-owned reference without changing the local contribution definition. */
|
|
2336
2351
|
export declare function qualifyRef<Ref extends QualifiableRef>(owner: string, ref: Ref): QualifiedRef<Ref>;
|
|
2337
2352
|
|
|
@@ -2552,6 +2567,11 @@ export declare interface ResourceRef {
|
|
|
2552
2567
|
/** A reference the host can open (e.g. another resource tab). */
|
|
2553
2568
|
export declare type ResourceRefValue = ResourceRef;
|
|
2554
2569
|
|
|
2570
|
+
export declare interface ResourceRemovedEvent {
|
|
2571
|
+
id: string;
|
|
2572
|
+
resource: ResourceRef;
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2555
2575
|
export declare type ResourceRole = "primary" | "context" | "source" | "result";
|
|
2556
2576
|
|
|
2557
2577
|
/** A reattach error is permanent unless the provider explicitly marks it retryable. */
|
package/dist/hooks.d.ts
CHANGED
|
@@ -242,6 +242,7 @@ declare const commandExecuteResponseSchema: z.ZodObject<{
|
|
|
242
242
|
rejected: "rejected";
|
|
243
243
|
}>;
|
|
244
244
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
245
|
+
navigationRequests: z.ZodOptional<z.ZodArray<z.ZodType<NavigationTarget, unknown, z.core.$ZodTypeInternals<NavigationTarget, unknown>>>>;
|
|
245
246
|
code: z.ZodOptional<z.ZodString>;
|
|
246
247
|
reason: z.ZodOptional<z.ZodString>;
|
|
247
248
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
package/dist/prompts/index.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __returnValue = (v) => v;
|
|
3
|
-
function __exportSetter(name, newValue) {
|
|
4
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
-
}
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
set: __exportSetter.bind(all, name)
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
// src/prompts/render-prompt.ts
|
|
17
2
|
import Mustache from "mustache";
|
|
18
3
|
var renderPrompt = (template, data) => Mustache.render(template, data);
|