@pstdio/sdk 0.22.1 → 0.24.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 +26 -0
- package/dist/api/index.js +3 -0
- package/dist/api.d.ts +19 -0
- package/dist/client/index.js +15 -10
- package/dist/client.d.ts +13 -0
- package/dist/data/index.js +115 -0
- package/dist/data.d.ts +47 -0
- package/dist/extensions/index.js +202 -2
- package/dist/extensions.d.ts +88 -1
- package/dist/hooks.d.ts +13 -0
- package/dist/resources/index.js +3 -0
- package/dist/resources.d.ts +4 -0
- package/dist/testing/index.js +222 -0
- package/dist/testing.d.ts +910 -0
- package/package.json +9 -1
package/dist/extensions/index.js
CHANGED
|
@@ -215,7 +215,7 @@ var WEBVIEW_HOST_CAPABILITIES = [
|
|
|
215
215
|
...ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
216
216
|
];
|
|
217
217
|
// package.json
|
|
218
|
-
var version = "0.
|
|
218
|
+
var version = "0.24.0";
|
|
219
219
|
|
|
220
220
|
// src/version.ts
|
|
221
221
|
var SDK_VERSION = version;
|
|
@@ -345,6 +345,180 @@ var defineExtensionView = (definition) => ({
|
|
|
345
345
|
return typeof cleanup === "function" ? cleanup : () => {};
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
|
+
// src/extensions/event-reference.ts
|
|
349
|
+
var resolveEventReferenceId = (ref, ownerExtensionId) => {
|
|
350
|
+
if (typeof ref === "string")
|
|
351
|
+
return ref;
|
|
352
|
+
const extensionId = ref.extensionId ?? ownerExtensionId;
|
|
353
|
+
if (!extensionId || extensionId === "pstdio")
|
|
354
|
+
return ref.id;
|
|
355
|
+
const lifecycle = /^(command\.(?:requested|started|completed|rejected|failed):)(.+)$/.exec(ref.id);
|
|
356
|
+
if (lifecycle)
|
|
357
|
+
return `${lifecycle[1]}${extensionId}.command.${lifecycle[2]}`;
|
|
358
|
+
return `${extensionId}.event.${ref.id}`;
|
|
359
|
+
};
|
|
360
|
+
// src/extensions/page-resource-codec.ts
|
|
361
|
+
var fromUri = (uri) => {
|
|
362
|
+
try {
|
|
363
|
+
const parsed = new URL(uri);
|
|
364
|
+
if (parsed.protocol !== "pstdio:" || parsed.hostname !== "extension-resource")
|
|
365
|
+
return;
|
|
366
|
+
const [type, id, ...rest] = parsed.pathname.slice(1).split("/");
|
|
367
|
+
if (!type || !id || rest.length > 0)
|
|
368
|
+
return;
|
|
369
|
+
const extensionId = parsed.searchParams.get("extensionId");
|
|
370
|
+
const projectId = parsed.searchParams.get("projectId");
|
|
371
|
+
return {
|
|
372
|
+
type: decodeURIComponent(type),
|
|
373
|
+
id: decodeURIComponent(id),
|
|
374
|
+
...extensionId ? { extensionId } : {},
|
|
375
|
+
...projectId ? { projectId } : {}
|
|
376
|
+
};
|
|
377
|
+
} catch {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
var defaultPageResourceCodec = {
|
|
382
|
+
normalize: (resource) => ({ ...resource }),
|
|
383
|
+
toUri: (resource) => {
|
|
384
|
+
const uri = `pstdio://extension-resource/${encodeURIComponent(resource.type)}/${encodeURIComponent(resource.id)}`;
|
|
385
|
+
const query = new URLSearchParams;
|
|
386
|
+
if (resource.extensionId)
|
|
387
|
+
query.set("extensionId", resource.extensionId);
|
|
388
|
+
if (resource.projectId)
|
|
389
|
+
query.set("projectId", resource.projectId);
|
|
390
|
+
return query.size ? `${uri}?${query}` : uri;
|
|
391
|
+
},
|
|
392
|
+
fromUri
|
|
393
|
+
};
|
|
394
|
+
// src/extensions/page-url.ts
|
|
395
|
+
var hostExtensionId = "pstdio";
|
|
396
|
+
var pageRefKey = (ref) => `${ref.extensionId ?? ""}:page:${ref.id}`;
|
|
397
|
+
var pageForRef = (pages, ref) => pages.find((page) => pageRefKey(page.ref) === pageRefKey(ref));
|
|
398
|
+
var encodePath = (path) => path.split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/");
|
|
399
|
+
var routePath = (projectId, page) => {
|
|
400
|
+
const project = `/projects/${encodeURIComponent(projectId)}`;
|
|
401
|
+
const path = encodePath(page.path);
|
|
402
|
+
if (page.ref.extensionId === hostExtensionId)
|
|
403
|
+
return path ? `${project}/${path}` : project;
|
|
404
|
+
if (!page.ref.extensionId)
|
|
405
|
+
throw new Error(`Page "${page.id}" has no extension id`);
|
|
406
|
+
return `${project}/extensions/${encodeURIComponent(page.ref.extensionId)}/${path}`;
|
|
407
|
+
};
|
|
408
|
+
var normalizedSection = (value) => {
|
|
409
|
+
if (!value || typeof value !== "object" || !Array.isArray(value.anchors))
|
|
410
|
+
return;
|
|
411
|
+
const anchors = value.anchors;
|
|
412
|
+
if (anchors.some((anchor) => !anchor || typeof anchor !== "object" || typeof anchor.id !== "string" || typeof anchor.heading !== "string" || anchor.occurrence !== undefined && (!Number.isInteger(anchor.occurrence) || Number(anchor.occurrence) < 0))) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
return {
|
|
416
|
+
anchors: anchors.map((anchor) => {
|
|
417
|
+
const value2 = anchor;
|
|
418
|
+
return {
|
|
419
|
+
id: value2.id,
|
|
420
|
+
heading: value2.heading,
|
|
421
|
+
...value2.occurrence !== undefined ? { occurrence: value2.occurrence } : {}
|
|
422
|
+
};
|
|
423
|
+
})
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
var serializeSection = (section) => {
|
|
427
|
+
const normalized = normalizedSection(section);
|
|
428
|
+
if (!normalized)
|
|
429
|
+
throw new Error("Page location has an invalid section");
|
|
430
|
+
return JSON.stringify(normalized);
|
|
431
|
+
};
|
|
432
|
+
var parseSection = (value) => {
|
|
433
|
+
try {
|
|
434
|
+
return normalizedSection(JSON.parse(value));
|
|
435
|
+
} catch {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
var serializeWorkbenchPageUrl = (input) => {
|
|
440
|
+
const page = pageForRef(input.pages, input.location.page);
|
|
441
|
+
if (!page)
|
|
442
|
+
throw new Error(`Unknown page ref: ${pageRefKey(input.location.page)}`);
|
|
443
|
+
const query = new URLSearchParams;
|
|
444
|
+
if (input.location.resource) {
|
|
445
|
+
query.set("resource", input.resources.toUri(input.resources.normalize(input.location.resource)));
|
|
446
|
+
}
|
|
447
|
+
if (input.location.section)
|
|
448
|
+
query.set("section", serializeSection(input.location.section));
|
|
449
|
+
const encoded = query.toString();
|
|
450
|
+
const path = routePath(input.projectId, page);
|
|
451
|
+
return encoded ? `${path}?${encoded}` : path;
|
|
452
|
+
};
|
|
453
|
+
var decodedSegments = (pathname) => {
|
|
454
|
+
try {
|
|
455
|
+
return pathname.split("/").filter(Boolean).map((segment) => decodeURIComponent(segment));
|
|
456
|
+
} catch {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
var isWorkbenchProjectUrl = (urlValue, projectId) => {
|
|
461
|
+
try {
|
|
462
|
+
const url = new URL(urlValue, "http://workbench.local");
|
|
463
|
+
const segments = decodedSegments(url.pathname);
|
|
464
|
+
return Boolean(segments && segments[0] === "projects" && segments[1] === projectId);
|
|
465
|
+
} catch {
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
var pageForRoute = (pages, extensionId, path) => pages.find((page) => page.ref.extensionId === extensionId && page.path === path);
|
|
470
|
+
var parseResource = (uri, resources) => {
|
|
471
|
+
try {
|
|
472
|
+
const resource = resources.fromUri(uri);
|
|
473
|
+
return resource ? resources.normalize(resource) : undefined;
|
|
474
|
+
} catch {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
var parseWorkbenchPageUrl = (input) => {
|
|
479
|
+
let url;
|
|
480
|
+
try {
|
|
481
|
+
url = new URL(input.url, "http://workbench.local");
|
|
482
|
+
} catch {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const segments = decodedSegments(url.pathname);
|
|
486
|
+
if (!segments || segments[0] !== "projects" || segments[1] !== input.projectId)
|
|
487
|
+
return;
|
|
488
|
+
const route = segments.slice(2);
|
|
489
|
+
const extensionRoute = route[0] === "extensions";
|
|
490
|
+
const extensionId = extensionRoute ? route[1] : hostExtensionId;
|
|
491
|
+
const path = (extensionRoute ? route.slice(2) : route).join("/");
|
|
492
|
+
if (!extensionId || extensionRoute && !path)
|
|
493
|
+
return;
|
|
494
|
+
const page = pageForRoute(input.pages, extensionId, path);
|
|
495
|
+
if (!page)
|
|
496
|
+
return;
|
|
497
|
+
const resourceValue = url.searchParams.get("resource");
|
|
498
|
+
const resource = resourceValue ? parseResource(resourceValue, input.resources) : undefined;
|
|
499
|
+
if (resourceValue && !resource)
|
|
500
|
+
return;
|
|
501
|
+
const sectionValue = url.searchParams.get("section");
|
|
502
|
+
const section = sectionValue ? parseSection(sectionValue) : undefined;
|
|
503
|
+
if (sectionValue && !section)
|
|
504
|
+
return;
|
|
505
|
+
return {
|
|
506
|
+
pageId: page.id,
|
|
507
|
+
...resource ? { resource } : {},
|
|
508
|
+
...section ? { section } : {}
|
|
509
|
+
};
|
|
510
|
+
};
|
|
511
|
+
var serializePageUrl = (input) => serializeWorkbenchPageUrl({
|
|
512
|
+
projectId: input.projectId,
|
|
513
|
+
location: { page: input.page.ref, resource: input.resource },
|
|
514
|
+
pages: [input.page],
|
|
515
|
+
resources: defaultPageResourceCodec
|
|
516
|
+
});
|
|
517
|
+
var parsePageUrl = (input) => {
|
|
518
|
+
if (!input.url.startsWith("/") || input.url.startsWith("//"))
|
|
519
|
+
return;
|
|
520
|
+
return parseWorkbenchPageUrl({ ...input, resources: defaultPageResourceCodec });
|
|
521
|
+
};
|
|
348
522
|
// src/extensions/params.ts
|
|
349
523
|
var params = {
|
|
350
524
|
text: (options) => ({ type: "text", ...options }),
|
|
@@ -459,6 +633,19 @@ var createTerminalSessionBridge = (host) => ({
|
|
|
459
633
|
// src/extensions/webview-capabilities.ts
|
|
460
634
|
var artifactMountId = (mount) => typeof mount === "string" ? mount : mount.id;
|
|
461
635
|
var artifactsRead = (mount) => `artifacts.read:${artifactMountId(mount)}`;
|
|
636
|
+
// src/extensions/webview-events.ts
|
|
637
|
+
var EXTENSION_EVENTS_SCOPE = "extension.events";
|
|
638
|
+
var createWebviewEventsClient = (host, extensionId) => ({
|
|
639
|
+
subscribe(event, listener) {
|
|
640
|
+
const id = resolveEventReferenceId(event, extensionId);
|
|
641
|
+
return host.onEvent(EXTENSION_EVENTS_SCOPE, (payload) => {
|
|
642
|
+
const notification = payload;
|
|
643
|
+
if (notification.type === "reset" || notification.type === "changed" && notification.id === id)
|
|
644
|
+
listener();
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
|
|
462
649
|
// src/extensions/webview-client.ts
|
|
463
650
|
var createWebviewClient = (host, options) => {
|
|
464
651
|
const extensionId = options?.extensionId ?? host.extensionId;
|
|
@@ -495,7 +682,8 @@ var createWebviewClient = (host, options) => {
|
|
|
495
682
|
readText: (mount, path) => host.call("artifacts.read", { op: "readText", mount: artifactMountId(mount), path }),
|
|
496
683
|
imageUrl: (mount, path) => host.call("artifacts.read", { op: "imageUrl", mount: artifactMountId(mount), path })
|
|
497
684
|
};
|
|
498
|
-
|
|
685
|
+
const events = createWebviewEventsClient(host, extensionId);
|
|
686
|
+
return { artifacts, commands, events, settings };
|
|
499
687
|
};
|
|
500
688
|
// src/extensions/when.ts
|
|
501
689
|
var matchesResourceWhen = (when, resourceType) => {
|
|
@@ -504,6 +692,9 @@ var matchesResourceWhen = (when, resourceType) => {
|
|
|
504
692
|
return true;
|
|
505
693
|
return resourceType ? resourceTypes.some((candidate) => (typeof candidate === "string" ? candidate : candidate.id) === resourceType) : false;
|
|
506
694
|
};
|
|
695
|
+
|
|
696
|
+
// src/extensions/index.ts
|
|
697
|
+
var projectPrefix = () => ({ $prefix: "project" });
|
|
507
698
|
export {
|
|
508
699
|
worktreeEvents,
|
|
509
700
|
workspaceSlots,
|
|
@@ -520,17 +711,24 @@ export {
|
|
|
520
711
|
unwrapCommandOutcome,
|
|
521
712
|
sessionSlots,
|
|
522
713
|
sessionEvents,
|
|
714
|
+
serializeWorkbenchPageUrl,
|
|
715
|
+
serializePageUrl,
|
|
523
716
|
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
524
717
|
resourceKey,
|
|
718
|
+
resolveEventReferenceId,
|
|
525
719
|
qualifyRef,
|
|
526
720
|
projectSlots,
|
|
721
|
+
projectPrefix,
|
|
527
722
|
projectEvents,
|
|
723
|
+
parseWorkbenchPageUrl,
|
|
724
|
+
parsePageUrl,
|
|
528
725
|
params,
|
|
529
726
|
packageAsset,
|
|
530
727
|
matchesResourceWhen,
|
|
531
728
|
localContributionIdPattern,
|
|
532
729
|
localContributionIdGrammar,
|
|
533
730
|
l10n,
|
|
731
|
+
isWorkbenchProjectUrl,
|
|
534
732
|
isValidLocalContributionId,
|
|
535
733
|
isLocalizedString,
|
|
536
734
|
gitEvents,
|
|
@@ -569,6 +767,7 @@ export {
|
|
|
569
767
|
defineCommand,
|
|
570
768
|
defineArtifactMount,
|
|
571
769
|
defineActivityItem,
|
|
770
|
+
defaultPageResourceCodec,
|
|
572
771
|
createWebviewClient,
|
|
573
772
|
createTerminalSessionBridge,
|
|
574
773
|
commandRef,
|
|
@@ -580,6 +779,7 @@ export {
|
|
|
580
779
|
WEBVIEW_HOST_CAPABILITIES,
|
|
581
780
|
WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
582
781
|
SDK_VERSION,
|
|
782
|
+
EXTENSION_EVENTS_SCOPE,
|
|
583
783
|
EXTENSION_API_VERSION,
|
|
584
784
|
ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
585
785
|
};
|
package/dist/extensions.d.ts
CHANGED
|
@@ -680,6 +680,9 @@ export declare interface DateControl extends BaseControl {
|
|
|
680
680
|
max?: string;
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
+
/** Resource URI conversion belongs to route and persistence adapters. */
|
|
684
|
+
export declare const defaultPageResourceCodec: PageResourceCodec;
|
|
685
|
+
|
|
683
686
|
export declare const defineActivityItem: <Definition extends Omit<ActivityItemContribution, "ref">>(definition: Definition) => Definition & ContributionDefinition<"activity-item">;
|
|
684
687
|
|
|
685
688
|
export declare const defineArtifactMount: <Definition extends Omit<ArtifactMountContribution, "ref">>(definition: Definition) => Definition & ContributionDefinition<"artifact-mount">;
|
|
@@ -815,7 +818,7 @@ export declare interface EventRef<TPayload extends Struct = Struct> {
|
|
|
815
818
|
/** Build a typed event reference from separate ownership and local identity. */
|
|
816
819
|
export declare const eventRef: <TPayload extends Struct = Struct>(input: ExternalRefInput) => EventRef<TPayload>;
|
|
817
820
|
|
|
818
|
-
declare type ExactOptions<Definition, Contract> = unknown extends Contract ? Definition : [Contract] extends [Definition] ? Definition : Contract extends unknown ? Definition extends Contract ? Contract extends EventRef ? Definition : Definition extends (...args: never[]) => unknown ? Definition : Definition extends readonly unknown[] ? Contract extends readonly (infer Item)[] ? {
|
|
821
|
+
declare type ExactOptions<Definition, Contract> = unknown extends Contract ? Definition : [Contract] extends [Definition] ? Definition : Contract extends unknown ? Definition extends Contract ? Contract extends EventRef | CommandRef ? Definition : Definition extends (...args: never[]) => unknown ? Definition : Definition extends readonly unknown[] ? Contract extends readonly (infer Item)[] ? {
|
|
819
822
|
[Index in keyof Definition]: ExactOptions<Definition[Index], Item>;
|
|
820
823
|
} : never : Definition extends object ? {
|
|
821
824
|
[Key in keyof Definition]: Key extends keyof Contract ? ExactOptions<Definition[Key], Contract[Key]> : never;
|
|
@@ -824,6 +827,8 @@ declare type ExactOptions<Definition, Contract> = unknown extends Contract ? Def
|
|
|
824
827
|
/** Current host extension API version. `engines.pstdio` in package.json is a semver range checked against this. */
|
|
825
828
|
export declare const EXTENSION_API_VERSION = "1.0.0-alpha.10";
|
|
826
829
|
|
|
830
|
+
export declare const EXTENSION_EVENTS_SCOPE = "extension.events";
|
|
831
|
+
|
|
827
832
|
export declare interface ExtensionActivityApi {
|
|
828
833
|
record(input: {
|
|
829
834
|
message: string;
|
|
@@ -927,6 +932,7 @@ export declare interface ExtensionContextBase<TSettings extends Record<string, u
|
|
|
927
932
|
repo?: RepoContext;
|
|
928
933
|
source?: CommandSource;
|
|
929
934
|
storage: ExtensionStorageApi;
|
|
935
|
+
resources: ExtensionResourcesApi;
|
|
930
936
|
artifacts: ExtensionArtifactApi;
|
|
931
937
|
/** Working tree of the invocation's repo, scoped to its root. Absent for non-repo (event/hook) invocations. */
|
|
932
938
|
repoFiles?: ArtifactMount;
|
|
@@ -1057,6 +1063,15 @@ export declare interface ExtensionReposApi {
|
|
|
1057
1063
|
}): Promise<string>;
|
|
1058
1064
|
}
|
|
1059
1065
|
|
|
1066
|
+
export declare interface ExtensionResourcesApi {
|
|
1067
|
+
allocate(input: {
|
|
1068
|
+
kind: string;
|
|
1069
|
+
}): Promise<{
|
|
1070
|
+
id: string;
|
|
1071
|
+
shorthand: string;
|
|
1072
|
+
}>;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1060
1075
|
export declare interface ExtensionSessionResource {
|
|
1061
1076
|
type: "session";
|
|
1062
1077
|
id: string;
|
|
@@ -1475,6 +1490,8 @@ export declare const isLocalizedString: (value: unknown) => value is LocalizedSt
|
|
|
1475
1490
|
|
|
1476
1491
|
export declare const isValidLocalContributionId: (id: string) => boolean;
|
|
1477
1492
|
|
|
1493
|
+
export declare const isWorkbenchProjectUrl: (urlValue: string, projectId: string) => boolean;
|
|
1494
|
+
|
|
1478
1495
|
export declare type JsonObject = {
|
|
1479
1496
|
[key: string]: JsonValue;
|
|
1480
1497
|
};
|
|
@@ -2033,6 +2050,12 @@ declare type PagePanelRefs<Slots extends readonly PageSlot[]> = {
|
|
|
2033
2050
|
|
|
2034
2051
|
export declare type PageRef = ContributionRef<"page">;
|
|
2035
2052
|
|
|
2053
|
+
declare interface PageResourceCodec {
|
|
2054
|
+
normalize(resource: ResourceRef): ResourceRef;
|
|
2055
|
+
toUri(resource: ResourceRef): string;
|
|
2056
|
+
fromUri(uri: string): ResourceRef | undefined;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2036
2059
|
/** A page-owned panel. Main presentation and routed context belong to the page. */
|
|
2037
2060
|
export declare interface PageSlot extends PlacementPresentation {
|
|
2038
2061
|
readonly id: string;
|
|
@@ -2054,6 +2077,12 @@ export declare type PageSlotRegion = ExtensionPanelRegion;
|
|
|
2054
2077
|
|
|
2055
2078
|
export declare type PageSlotRole = "primary" | "auxiliary";
|
|
2056
2079
|
|
|
2080
|
+
export declare interface PageUrlDefinition {
|
|
2081
|
+
id: string;
|
|
2082
|
+
ref: PageRef;
|
|
2083
|
+
path: string;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2057
2086
|
export declare type PanelRef = PlacementRef | PageSlotRef;
|
|
2058
2087
|
|
|
2059
2088
|
declare type ParamBase<TValue, TRequired extends boolean | undefined = boolean | undefined> = {
|
|
@@ -2139,6 +2168,26 @@ export declare type ParamType = "text" | "longtext" | "markdown" | "number" | "b
|
|
|
2139
2168
|
|
|
2140
2169
|
export declare type ParamValue<TDescriptor extends ParamDescriptor> = TDescriptor extends ParamDescriptor<infer V> ? V : never;
|
|
2141
2170
|
|
|
2171
|
+
export declare interface ParsedWorkbenchPageUrl {
|
|
2172
|
+
pageId: string;
|
|
2173
|
+
resource?: ResourceRef;
|
|
2174
|
+
section?: FileRendererSectionTarget;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
/** Resolve a dashboard URL against the caller's declared pages and project. */
|
|
2178
|
+
export declare const parsePageUrl: (input: {
|
|
2179
|
+
url: string;
|
|
2180
|
+
projectId: string;
|
|
2181
|
+
pages: readonly PageUrlDefinition[];
|
|
2182
|
+
}) => ParsedWorkbenchPageUrl | undefined;
|
|
2183
|
+
|
|
2184
|
+
export declare const parseWorkbenchPageUrl: (input: {
|
|
2185
|
+
url: string;
|
|
2186
|
+
projectId: string;
|
|
2187
|
+
pages: readonly PageUrlDefinition[];
|
|
2188
|
+
resources: PageResourceCodec;
|
|
2189
|
+
}) => ParsedWorkbenchPageUrl | undefined;
|
|
2190
|
+
|
|
2142
2191
|
export declare type PatchPart = {
|
|
2143
2192
|
type: "patch";
|
|
2144
2193
|
hash?: string;
|
|
@@ -2251,6 +2300,10 @@ export declare const projectEvents: {
|
|
|
2251
2300
|
}>;
|
|
2252
2301
|
};
|
|
2253
2302
|
|
|
2303
|
+
export declare const projectPrefix: () => {
|
|
2304
|
+
$prefix: "project";
|
|
2305
|
+
};
|
|
2306
|
+
|
|
2254
2307
|
export declare const projectSlots: {
|
|
2255
2308
|
sidenav: SlotRef<object, "panel">;
|
|
2256
2309
|
headerPrimary: SlotRef<object, "menu">;
|
|
@@ -2400,6 +2453,9 @@ declare type RequiredParamKeys<TSchema extends ParamObjectSchema> = {
|
|
|
2400
2453
|
} ? K : never;
|
|
2401
2454
|
}[keyof TSchema];
|
|
2402
2455
|
|
|
2456
|
+
/** Resolve an event ref using the same ownership rules as commands and hooks. */
|
|
2457
|
+
export declare const resolveEventReferenceId: (ref: RendererEventReference, ownerExtensionId?: string) => string;
|
|
2458
|
+
|
|
2403
2459
|
export declare interface ResourceAnchor extends ResourceRef {
|
|
2404
2460
|
role?: ResourceRole;
|
|
2405
2461
|
}
|
|
@@ -2440,6 +2496,9 @@ export declare function resourceKey(resource: ResourceRef): string;
|
|
|
2440
2496
|
export declare function resourceKey(resource: ResourceRef | undefined): string | undefined;
|
|
2441
2497
|
|
|
2442
2498
|
export declare interface ResourceKindDefinition extends ContributionDefinition<"resource-kind"> {
|
|
2499
|
+
readonly prefix?: string | {
|
|
2500
|
+
readonly $prefix: "project";
|
|
2501
|
+
};
|
|
2443
2502
|
readonly label?: Localizable<string>;
|
|
2444
2503
|
readonly icon?: string;
|
|
2445
2504
|
readonly menuSlots?: readonly ResourceMenuSlotDefinition[];
|
|
@@ -2482,6 +2541,7 @@ export declare type ResourceParam<TRequired extends boolean | undefined = boolea
|
|
|
2482
2541
|
export declare interface ResourceRef {
|
|
2483
2542
|
type: string;
|
|
2484
2543
|
id: string;
|
|
2544
|
+
shorthand?: string;
|
|
2485
2545
|
projectId?: string;
|
|
2486
2546
|
label?: string;
|
|
2487
2547
|
icon?: string;
|
|
@@ -2583,6 +2643,20 @@ export declare interface SerializedError {
|
|
|
2583
2643
|
cause?: JsonValue;
|
|
2584
2644
|
}
|
|
2585
2645
|
|
|
2646
|
+
/** Serialize a project page using the same resource encoding as the dashboard. */
|
|
2647
|
+
export declare const serializePageUrl: (input: {
|
|
2648
|
+
projectId: string;
|
|
2649
|
+
page: PageUrlDefinition;
|
|
2650
|
+
resource?: ResourceRef;
|
|
2651
|
+
}) => string;
|
|
2652
|
+
|
|
2653
|
+
export declare const serializeWorkbenchPageUrl: (input: {
|
|
2654
|
+
projectId: string;
|
|
2655
|
+
location: PageLocation;
|
|
2656
|
+
pages: readonly PageUrlDefinition[];
|
|
2657
|
+
resources: PageResourceCodec;
|
|
2658
|
+
}) => string;
|
|
2659
|
+
|
|
2586
2660
|
declare type SessionAttachmentRef = z.infer<typeof sessionAttachmentRefSchema>;
|
|
2587
2661
|
|
|
2588
2662
|
declare const sessionAttachmentRefSchema: z.ZodObject<{
|
|
@@ -3221,6 +3295,7 @@ export declare type WebviewCapabilityDeclaration = WebviewDeclarableCapability |
|
|
|
3221
3295
|
export declare type WebviewClient<TCommands, TSettings = undefined> = {
|
|
3222
3296
|
artifacts: WebviewArtifactsClient;
|
|
3223
3297
|
commands: WebviewCommandsClient<TCommands>;
|
|
3298
|
+
events: WebviewEventsClient;
|
|
3224
3299
|
settings: WebviewSettingsClient<ClientSettingsMap<TSettings>>;
|
|
3225
3300
|
};
|
|
3226
3301
|
|
|
@@ -3249,6 +3324,18 @@ export declare interface WebviewContribution {
|
|
|
3249
3324
|
|
|
3250
3325
|
export declare type WebviewDeclarableCapability = (typeof WEBVIEW_DECLARABLE_CAPABILITIES)[number];
|
|
3251
3326
|
|
|
3327
|
+
export declare interface WebviewEventsClient {
|
|
3328
|
+
/** Refetch on a matching event or host sync reconnect. Returns the unsubscribe function. */
|
|
3329
|
+
subscribe(event: RendererEventReference, listener: () => void): () => void;
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
export declare type WebviewExtensionEvent = {
|
|
3333
|
+
type: "changed";
|
|
3334
|
+
id: string;
|
|
3335
|
+
} | {
|
|
3336
|
+
type: "reset";
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3252
3339
|
export declare interface WebviewExtensionSettingKeyParams {
|
|
3253
3340
|
key: string;
|
|
3254
3341
|
}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -155,6 +155,7 @@ declare const commandExecuteRequestSchema: z.ZodObject<{
|
|
|
155
155
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
156
156
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
157
157
|
resource: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
158
159
|
type: z.ZodString;
|
|
159
160
|
id: z.ZodString;
|
|
160
161
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -182,6 +183,7 @@ declare const commandExecuteRequestSchema: z.ZodObject<{
|
|
|
182
183
|
mode: z.ZodOptional<z.ZodString>;
|
|
183
184
|
projectId: z.ZodOptional<z.ZodString>;
|
|
184
185
|
resource: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
185
187
|
type: z.ZodString;
|
|
186
188
|
id: z.ZodString;
|
|
187
189
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -324,6 +326,7 @@ declare const createAutomationRunInputSchema: z.ZodObject<{
|
|
|
324
326
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
325
327
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
326
328
|
resource: z.ZodOptional<z.ZodObject<{
|
|
329
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
327
330
|
type: z.ZodString;
|
|
328
331
|
id: z.ZodString;
|
|
329
332
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -367,6 +370,7 @@ declare const createSessionInputSchema: z.ZodObject<{
|
|
|
367
370
|
agent: z.ZodOptional<z.ZodString>;
|
|
368
371
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
369
372
|
anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
373
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
370
374
|
type: z.ZodString;
|
|
371
375
|
id: z.ZodString;
|
|
372
376
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -526,6 +530,7 @@ declare const followUpResponseSchema: z.ZodObject<{
|
|
|
526
530
|
cwd: z.ZodNullable<z.ZodString>;
|
|
527
531
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
528
532
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
533
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
529
534
|
type: z.ZodString;
|
|
530
535
|
id: z.ZodString;
|
|
531
536
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1213,6 +1218,7 @@ declare const resolveSessionIdResponseSchema: z.ZodObject<{
|
|
|
1213
1218
|
declare interface ResourceRef {
|
|
1214
1219
|
type: string;
|
|
1215
1220
|
id: string;
|
|
1221
|
+
shorthand?: string;
|
|
1216
1222
|
projectId?: string;
|
|
1217
1223
|
label?: string;
|
|
1218
1224
|
icon?: string;
|
|
@@ -1291,6 +1297,7 @@ declare const sessionConversationResponseSchema: z.ZodObject<{
|
|
|
1291
1297
|
cwd: z.ZodNullable<z.ZodString>;
|
|
1292
1298
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
1293
1299
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1300
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1294
1301
|
type: z.ZodString;
|
|
1295
1302
|
id: z.ZodString;
|
|
1296
1303
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1342,6 +1349,7 @@ declare const sessionSchema: z.ZodObject<{
|
|
|
1342
1349
|
cwd: z.ZodNullable<z.ZodString>;
|
|
1343
1350
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
1344
1351
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1352
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1345
1353
|
type: z.ZodString;
|
|
1346
1354
|
id: z.ZodString;
|
|
1347
1355
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1374,6 +1382,7 @@ declare type SettingsClient = {
|
|
|
1374
1382
|
};
|
|
1375
1383
|
|
|
1376
1384
|
declare const settingsSchema: z.ZodObject<{
|
|
1385
|
+
notifications_enabled: z.ZodBoolean;
|
|
1377
1386
|
max_concurrent_sessions: z.ZodNullable<z.ZodNumber>;
|
|
1378
1387
|
}, z.core.$strip>;
|
|
1379
1388
|
|
|
@@ -1465,6 +1474,7 @@ declare type SseEvent = {
|
|
|
1465
1474
|
};
|
|
1466
1475
|
|
|
1467
1476
|
declare type StartSyncInput = SyncWriterProvider & {
|
|
1477
|
+
/** Called after the initial snapshot, or when a cursor-based connection resumes. */
|
|
1468
1478
|
onConnected?: () => void;
|
|
1469
1479
|
onDisconnected?: () => void;
|
|
1470
1480
|
onConnectionLost?: () => void;
|
|
@@ -1508,6 +1518,7 @@ declare interface UpdateNotificationInput {
|
|
|
1508
1518
|
declare type UpdateSettingsInput = z.infer<typeof updateSettingsInputSchema>;
|
|
1509
1519
|
|
|
1510
1520
|
declare const updateSettingsInputSchema: z.ZodObject<{
|
|
1521
|
+
notifications_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1511
1522
|
max_concurrent_sessions: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1512
1523
|
}, z.core.$strict>;
|
|
1513
1524
|
|
|
@@ -1673,6 +1684,7 @@ declare const workspaceListItemSchema: z.ZodObject<{
|
|
|
1673
1684
|
workspace_shorthand: z.ZodString;
|
|
1674
1685
|
startup_log_file_id: z.ZodNullable<z.ZodString>;
|
|
1675
1686
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1687
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1676
1688
|
type: z.ZodString;
|
|
1677
1689
|
id: z.ZodString;
|
|
1678
1690
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1725,6 +1737,7 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
1725
1737
|
workspace_shorthand: z.ZodString;
|
|
1726
1738
|
startup_log_file_id: z.ZodNullable<z.ZodString>;
|
|
1727
1739
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1740
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1728
1741
|
type: z.ZodString;
|
|
1729
1742
|
id: z.ZodString;
|
|
1730
1743
|
projectId: z.ZodOptional<z.ZodString>;
|
package/dist/resources/index.js
CHANGED
|
@@ -13909,6 +13909,7 @@ var listExtensionConnectionsResponseSchema = exports_external.object({
|
|
|
13909
13909
|
|
|
13910
13910
|
// ../pstdio-api-contracts/src/extensions/execute.ts
|
|
13911
13911
|
var extensionResourceRefSchema = exports_external.object({
|
|
13912
|
+
shorthand: exports_external.string().optional(),
|
|
13912
13913
|
type: exports_external.string(),
|
|
13913
13914
|
id: exports_external.string(),
|
|
13914
13915
|
projectId: exports_external.string().optional(),
|
|
@@ -15458,9 +15459,11 @@ var resolveSessionIdResponseSchema = exports_external.object({
|
|
|
15458
15459
|
});
|
|
15459
15460
|
// ../pstdio-api-contracts/src/settings.ts
|
|
15460
15461
|
var settingsSchema = exports_external.object({
|
|
15462
|
+
notifications_enabled: exports_external.boolean(),
|
|
15461
15463
|
max_concurrent_sessions: exports_external.number().int().min(1).nullable()
|
|
15462
15464
|
});
|
|
15463
15465
|
var updateSettingsInputSchema = exports_external.object({
|
|
15466
|
+
notifications_enabled: exports_external.boolean().optional(),
|
|
15464
15467
|
max_concurrent_sessions: exports_external.number().int().min(1).nullable().optional()
|
|
15465
15468
|
}).strict().refine((value) => Object.keys(value).length > 0, { message: "Expected at least one setting" });
|
|
15466
15469
|
// ../pstdio-api-contracts/src/skills.ts
|
package/dist/resources.d.ts
CHANGED
|
@@ -186,6 +186,7 @@ declare const sessionSchema: z.ZodObject<{
|
|
|
186
186
|
cwd: z.ZodNullable<z.ZodString>;
|
|
187
187
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
188
188
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
189
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
189
190
|
type: z.ZodString;
|
|
190
191
|
id: z.ZodString;
|
|
191
192
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -213,6 +214,7 @@ declare const sessionStatusSchema: z.ZodEnum<{
|
|
|
213
214
|
export declare type Settings = z.infer<typeof settingsSchema>;
|
|
214
215
|
|
|
215
216
|
declare const settingsSchema: z.ZodObject<{
|
|
217
|
+
notifications_enabled: z.ZodBoolean;
|
|
216
218
|
max_concurrent_sessions: z.ZodNullable<z.ZodNumber>;
|
|
217
219
|
}, z.core.$strip>;
|
|
218
220
|
|
|
@@ -354,6 +356,7 @@ declare const workspaceListItemSchema: z.ZodObject<{
|
|
|
354
356
|
workspace_shorthand: z.ZodString;
|
|
355
357
|
startup_log_file_id: z.ZodNullable<z.ZodString>;
|
|
356
358
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
359
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
357
360
|
type: z.ZodString;
|
|
358
361
|
id: z.ZodString;
|
|
359
362
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -406,6 +409,7 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
406
409
|
workspace_shorthand: z.ZodString;
|
|
407
410
|
startup_log_file_id: z.ZodNullable<z.ZodString>;
|
|
408
411
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
412
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
409
413
|
type: z.ZodString;
|
|
410
414
|
id: z.ZodString;
|
|
411
415
|
projectId: z.ZodOptional<z.ZodString>;
|