@pstdio/sdk 0.45.0-nightly.20261021030241 → 0.45.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.d.ts +3 -7
- package/dist/client/index.js +68 -6
- package/dist/client.d.ts +3 -2
- package/dist/data.d.ts +1 -7
- package/dist/extensions/index.js +200 -3
- package/dist/extensions-react.d.ts +1 -3
- package/dist/extensions.d.ts +2 -2
- package/dist/hooks.d.ts +3 -11
- package/dist/{index-D82SEWma.d.ts → index-DBkZvGh1.d.ts} +135 -81
- package/dist/{index-LeVI9OKi.d.ts → index-j28tAAxd.d.ts} +569 -260
- package/dist/prompts.d.ts +0 -2
- package/dist/resources.d.ts +1 -1
- package/dist/sessions-BWTUYUnW.d.ts +2 -0
- package/dist/skills-BWTUYUnW.d.ts +2 -0
- package/dist/testing/index.js +161 -16
- package/dist/testing.d.ts +20 -13
- package/package.json +1 -1
- package/dist/sessions-BdE2Wzo4.d.ts +0 -2
- package/dist/skills-BdE2Wzo4.d.ts +0 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { $ as ListExtensionConnectionsResponse, $
|
|
2
|
-
import "./sessions-
|
|
3
|
-
import "./skills-
|
|
4
|
-
//#region src/api/resource-compat.d.ts
|
|
1
|
+
import { $ as ListExtensionConnectionsResponse, $f as SteerQueuedFollowUpInput, $s as UpdateSkillInput, A as UpdateExtensionSettingRequest, Bs as BoardViews, C as UpdateProjectInput, Ct as CreateAutomationRunInput, D as ExtensionSettingValueRecord, Dc as ResourceRef, Df as ApprovalInput, Dt as ListAutomationTokensResponse, E as ExtensionSettingDefinitionRecord, Et as ListAutomationRunEventsResponse, F as InstallExtensionRequest, Ff as SessionAttachment, Fs as BoardField, G as UpgradeProjectExtensionResponse, Gp as TerminalSessionAdapter, H as ListProjectExtensionsResponse, Hp as TerminalBridge, I as InstallExtensionResponse, Is as BoardSummary, J as CommandExecuteResponse, Jf as CombineQueuedFollowUpsInput, Kf as SessionQueuedMessagesResponse, Kp as TerminalSessionError, L as InstalledExtensionSource, Lf as SessionAttachmentRef, Ls as BoardView, M as ExtensionCommandPaletteResourceRecord, Mf as ResolveSessionIdInput, N as WorkbenchExtensionCommandPaletteResourceRecord, Nf as ResolveSessionIdResponse, O as ExtensionSettingsPanelRecord, Of as CreateSessionInput, P as ExtensionDiagnosticsResponse, Q as ExtensionConnectionRecord, Qf as QueuedSteeringResult, R as AddLocalExtensionFolderResponse, Rf as SessionConversationResponse, Rs as BoardViewCreate, St as AutomationTokenRecord, Tt as IssueAutomationTokenResponse, U as MarketplaceExtension, V as InstallMarketplaceExtensionResponse, W as ProjectExtensionInstance, Wp as TerminalHostEvent, Xf as QueuedFollowUpRequest, Xp as TerminalSessionRequest, Y as CommandExecutionResult, Yf as PendingQueuedFollowUpsResponse, Yp as TerminalSessionOperation, Z as ConfigureExtensionConnectionInput, Zf as QueuedFollowUpUpdateResponse, Zp as TerminalSessionResult, _ as CreateProjectInput, a as RemoveWorktreeResponse$1, ac as NotificationActorType$1, at as ExtensionMenuContribution, bt as AutomationRunEvent, c as WorkspaceFileContent$1, cc as NotificationOrigin$1, ct as viewFilterValueKind, d as WorkspaceProviderDescriptor, dt as WorkbenchExtensionHarnessRecord, ec as CreateNotificationInput$1, ep as UpdateQueuedFollowUpInput, et as ExtensionDiagnostic, f as WriteWorkspaceFileInput$1, fc as UpdateNotificationInput$1, ft as WorkbenchExtensionMetadata, h as sessionAttachmentMimeTypesByExtension, i as ListWorkspaceFilesInput$1, ic as NotificationAction$1, it as ExtensionCommandRecord, j as ExtensionKeybindingRecord, k as ListExtensionSettingsResponse, kf as FollowUpInput, l as WorkspaceFileEntry$1, lc as NotificationPriority$1, lt as ListExtensionAppearanceResponse, m as UpdateSettingsInput, mt as WorkbenchExtensionViewRecord, nc as ListNotificationsResponse$1, nt as LocalizableString, o as RenameWorkspaceInput$1, ot as WorkbenchExtensionAutomationRecord, p as Settings, pt as WorkbenchExtensionViewBody, q as CommandExecuteRequest, qp as TerminalSessionExit, rc as Notification$1, rt as ExtensionCommandPaletteContribution, sc as NotificationKind$1, st as findViewFilterProblem, t as CreateWorkspaceInput$1, tc as ListNotificationsQuery$1, tt as ExtensionRecord, u as WorkspaceFilesResponse$1, uc as NotificationStatus$1, ut as ListExtensionCommandsResponse, vt as AutomationRun, w as LinkIcon, wt as IssueAutomationTokenInput, xt as AutomationRunStatus, yt as AutomationRunError, zf as SessionConversationSources, zs as BoardViewUpdate } from "./index-j28tAAxd.js";
|
|
2
|
+
import "./sessions-BWTUYUnW.js";
|
|
3
|
+
import "./skills-BWTUYUnW.js";
|
|
5
4
|
/** @deprecated Import `CreateNotificationInput` from `@pstdio/sdk/resources`. */
|
|
6
5
|
type CreateNotificationInput = CreateNotificationInput$1;
|
|
7
6
|
/** @deprecated Import `ListNotificationsQuery` from `@pstdio/sdk/resources`. */
|
|
@@ -24,8 +23,6 @@ type NotificationPriority = NotificationPriority$1;
|
|
|
24
23
|
type NotificationStatus = NotificationStatus$1;
|
|
25
24
|
/** @deprecated Import `UpdateNotificationInput` from `@pstdio/sdk/resources`. */
|
|
26
25
|
type UpdateNotificationInput = UpdateNotificationInput$1;
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/api/workspaces.d.ts
|
|
29
26
|
/** @deprecated Use ExtensionWorkspaceCreateInput with projectId first. */
|
|
30
27
|
type CreateWorkspaceInput = CreateWorkspaceInput$1;
|
|
31
28
|
type RemoveWorktreeResponse = RemoveWorktreeResponse$1;
|
|
@@ -35,6 +32,5 @@ type WorkspaceFileContent = WorkspaceFileContent$1;
|
|
|
35
32
|
type WorkspaceFileEntry = WorkspaceFileEntry$1;
|
|
36
33
|
type WorkspaceFilesResponse = WorkspaceFilesResponse$1;
|
|
37
34
|
type WriteWorkspaceFileInput = WriteWorkspaceFileInput$1;
|
|
38
|
-
//#endregion
|
|
39
35
|
export { type AddLocalExtensionFolderResponse, type ApprovalInput, type AutomationRun, type AutomationRunError, type AutomationRunEvent, type AutomationRunStatus, type AutomationTokenRecord, type BoardField, type BoardSummary, type BoardView, type BoardViewCreate, type BoardViewUpdate, type BoardViews, type CombineQueuedFollowUpsInput, type CommandExecuteRequest, type CommandExecuteResponse, type CommandExecutionResult, type ConfigureExtensionConnectionInput, type CreateAutomationRunInput, type CreateNotificationInput, type CreateProjectInput, type CreateSessionInput, type CreateWorkspaceInput, type ExtensionCommandPaletteContribution, type ExtensionCommandPaletteResourceRecord, type ExtensionCommandRecord, type ExtensionConnectionRecord, type ExtensionDiagnostic, type ExtensionDiagnosticsResponse, type ExtensionKeybindingRecord, type ExtensionMenuContribution, type ExtensionRecord, type ExtensionSettingDefinitionRecord, type ExtensionSettingValueRecord, type ExtensionSettingsPanelRecord, type FollowUpInput, type InstallExtensionRequest, type InstallExtensionResponse, type InstallMarketplaceExtensionResponse, type InstalledExtensionSource, type IssueAutomationTokenInput, type IssueAutomationTokenResponse, type LinkIcon, type ListAutomationRunEventsResponse, type ListAutomationTokensResponse, type ListExtensionAppearanceResponse, type ListExtensionCommandsResponse, type ListExtensionConnectionsResponse, type ListExtensionSettingsResponse, type ListNotificationsQuery, type ListNotificationsResponse, type ListProjectExtensionsResponse, type ListWorkspaceFilesInput, type LocalizableString, type MarketplaceExtension, type Notification, type NotificationAction, type NotificationActorType, type NotificationKind, type NotificationOrigin, type NotificationPriority, type NotificationStatus, type PendingQueuedFollowUpsResponse, type ProjectExtensionInstance, type QueuedFollowUpRequest, type QueuedFollowUpUpdateResponse, type QueuedSteeringResult, type RemoveWorktreeResponse, type RenameWorkspaceInput, type ResolveSessionIdInput, type ResolveSessionIdResponse, type ResourceRef, type SessionAttachment, type SessionAttachmentRef, type SessionConversationResponse, type SessionConversationSources, type SessionQueuedMessagesResponse, type Settings, type SteerQueuedFollowUpInput, type TerminalBridge, type TerminalHostEvent, type TerminalSessionAdapter, type TerminalSessionError, type TerminalSessionExit, type TerminalSessionOperation, type TerminalSessionRequest, type TerminalSessionResult, type UpdateExtensionSettingRequest, type UpdateNotificationInput, type UpdateProjectInput, type UpdateQueuedFollowUpInput, type UpdateSettingsInput, type UpdateSkillInput, type UpgradeProjectExtensionResponse, type WorkbenchExtensionAutomationRecord, type WorkbenchExtensionCommandPaletteResourceRecord, type WorkbenchExtensionHarnessRecord, type WorkbenchExtensionMetadata, type WorkbenchExtensionViewBody, type WorkbenchExtensionViewRecord, type WorkspaceFileContent, type WorkspaceFileEntry, type WorkspaceFilesResponse, type WorkspaceProviderDescriptor, type WriteWorkspaceFileInput, findViewFilterProblem, sessionAttachmentMimeTypesByExtension, viewFilterValueKind };
|
|
40
36
|
export {};
|
package/dist/client/index.js
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
var createAccountClient = (request) => {
|
|
3
3
|
const device = (id) => `/v1/account/devices/${encodeURIComponent(id)}`;
|
|
4
4
|
const project = (id) => `/v1/account/projects/${encodeURIComponent(id)}`;
|
|
5
|
+
const login = (id) => `/v1/account/login/${encodeURIComponent(id)}`;
|
|
5
6
|
return {
|
|
6
7
|
login: (managerOrigin) => request("/v1/account/login", { method: "POST", body: { managerOrigin } }),
|
|
7
|
-
loginStatus: (id) => request(
|
|
8
|
+
loginStatus: (id) => request(login(id)),
|
|
9
|
+
cancelLogin: (id) => request(login(id), { method: "DELETE" }),
|
|
10
|
+
projectSyncStatus: (projectId) => request(`${project(projectId)}/sync`),
|
|
8
11
|
status: () => request("/v1/account"),
|
|
9
12
|
logout: () => request("/v1/account/logout", { method: "POST" }),
|
|
10
13
|
devices: () => request("/v1/account/devices"),
|
|
@@ -1199,6 +1202,31 @@ var createRuntimeClient = (request) => ({
|
|
|
1199
1202
|
createBrowserLogin: () => request("/runtime/browser-login", { method: "POST" })
|
|
1200
1203
|
});
|
|
1201
1204
|
|
|
1205
|
+
// src/client/session-stream-errors.ts
|
|
1206
|
+
var isSessionStreamRejection = (error) => error instanceof PstdioApiError && error.status >= 400 && error.status < 500 && error.status !== 408 && error.status !== 429;
|
|
1207
|
+
|
|
1208
|
+
// src/client/session-stream-removal.ts
|
|
1209
|
+
var removeSessionStreamSubscription = async (request, path, signal) => {
|
|
1210
|
+
while (!signal.aborted) {
|
|
1211
|
+
try {
|
|
1212
|
+
await request(path, { method: "DELETE", signal });
|
|
1213
|
+
return;
|
|
1214
|
+
} catch (error) {
|
|
1215
|
+
if (signal.aborted || error instanceof PstdioApiError && error.status === 404)
|
|
1216
|
+
return;
|
|
1217
|
+
await new Promise((resolve) => {
|
|
1218
|
+
const finish = () => {
|
|
1219
|
+
clearTimeout(timer);
|
|
1220
|
+
signal.removeEventListener("abort", finish);
|
|
1221
|
+
resolve();
|
|
1222
|
+
};
|
|
1223
|
+
const timer = setTimeout(finish, 1000);
|
|
1224
|
+
signal.addEventListener("abort", finish, { once: true });
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1202
1230
|
// src/client/sse.ts
|
|
1203
1231
|
var parseSseEvent = (part) => {
|
|
1204
1232
|
let event = "message";
|
|
@@ -1262,7 +1290,12 @@ var createSessionStreamTransport = (request, clientOptions) => {
|
|
|
1262
1290
|
}).then(() => {}, (error) => {
|
|
1263
1291
|
if (subscriptions.get(id) !== subscription)
|
|
1264
1292
|
return;
|
|
1265
|
-
|
|
1293
|
+
if (isSessionStreamRejection(error) && error.code === "SESSION_STREAM_NOT_FOUND") {
|
|
1294
|
+
if (connection)
|
|
1295
|
+
fail(connection, new Error("Session stream no longer exists", { cause: error }));
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
release(id, !isSessionStreamRejection(error));
|
|
1266
1299
|
subscription.onError(error);
|
|
1267
1300
|
});
|
|
1268
1301
|
};
|
|
@@ -1279,7 +1312,8 @@ var createSessionStreamTransport = (request, clientOptions) => {
|
|
|
1279
1312
|
if (!notifyServer || !started)
|
|
1280
1313
|
return;
|
|
1281
1314
|
const path = `/v1/session-stream/${connection.id}/subscriptions/${id}`;
|
|
1282
|
-
|
|
1315
|
+
const { signal } = connection.controller;
|
|
1316
|
+
started.then(() => removeSessionStreamSubscription(request, path, signal));
|
|
1283
1317
|
};
|
|
1284
1318
|
const dispatch = (current, event, payload) => {
|
|
1285
1319
|
if (connection !== current)
|
|
@@ -1306,9 +1340,10 @@ var createSessionStreamTransport = (request, clientOptions) => {
|
|
|
1306
1340
|
if (connection !== current)
|
|
1307
1341
|
return;
|
|
1308
1342
|
connection = undefined;
|
|
1343
|
+
current.controller.abort();
|
|
1309
1344
|
const failed = [...subscriptions.values()];
|
|
1310
1345
|
subscriptions.clear();
|
|
1311
|
-
const failure = new Error(error instanceof Error ? error.message : String(error), { cause: error });
|
|
1346
|
+
const failure = error instanceof PstdioApiError ? error : new Error(error instanceof Error ? error.message : String(error), { cause: error });
|
|
1312
1347
|
for (const subscription of failed)
|
|
1313
1348
|
subscription.onError(failure);
|
|
1314
1349
|
};
|
|
@@ -1318,8 +1353,10 @@ var createSessionStreamTransport = (request, clientOptions) => {
|
|
|
1318
1353
|
connection = current;
|
|
1319
1354
|
const read = async () => {
|
|
1320
1355
|
const response = await resolveFetch(clientOptions)(resolveClientUrl(resolveBaseUrl(clientOptions), "/v1/session-stream"), { headers: Object.fromEntries(createRequestHeaders(clientOptions).entries()), signal });
|
|
1321
|
-
if (!response.ok
|
|
1322
|
-
throw
|
|
1356
|
+
if (!response.ok)
|
|
1357
|
+
throw await responseError(response);
|
|
1358
|
+
if (!response.body)
|
|
1359
|
+
throw new Error("Session stream response has no body");
|
|
1323
1360
|
await readSseStream(response.body, ({ event, data }) => dispatch(current, event, JSON.parse(data)), { signal });
|
|
1324
1361
|
throw new Error("Session stream closed");
|
|
1325
1362
|
};
|
|
@@ -1396,6 +1433,30 @@ var createSessionQueryClient = (request) => {
|
|
|
1396
1433
|
return { query, iterate };
|
|
1397
1434
|
};
|
|
1398
1435
|
|
|
1436
|
+
// src/client/session-resource-retention.ts
|
|
1437
|
+
var retainSessionResources = (streams, sessionId) => {
|
|
1438
|
+
let closed = false;
|
|
1439
|
+
let connection;
|
|
1440
|
+
let retry;
|
|
1441
|
+
const connect = () => {
|
|
1442
|
+
connection = streams.subscribe({ retain_session_id: sessionId }, {
|
|
1443
|
+
onEvent: () => {},
|
|
1444
|
+
onError: (error) => {
|
|
1445
|
+
if (!closed && !isSessionStreamRejection(error))
|
|
1446
|
+
retry = setTimeout(connect, 1000);
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
};
|
|
1450
|
+
connect();
|
|
1451
|
+
return {
|
|
1452
|
+
close: () => {
|
|
1453
|
+
closed = true;
|
|
1454
|
+
clearTimeout(retry);
|
|
1455
|
+
connection?.close();
|
|
1456
|
+
}
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1399
1460
|
// src/client/sessions.ts
|
|
1400
1461
|
var buildSessionsQuery = (projectId, input = {}) => {
|
|
1401
1462
|
const params = new URLSearchParams({ projectId });
|
|
@@ -1443,6 +1504,7 @@ var dispatchSessionStreamEvent = (event, data, handlers) => {
|
|
|
1443
1504
|
var createSessionClient = (request, clientOptions, streams = createSessionStreamTransport(request, clientOptions)) => {
|
|
1444
1505
|
return {
|
|
1445
1506
|
...createSessionQueryClient(request),
|
|
1507
|
+
retainResources: (sessionId) => retainSessionResources(streams, sessionId),
|
|
1446
1508
|
getDraftHarnessCommands: (input, signal) => request("/v1/sessions/harness-command-state", { method: "POST", body: input, signal }),
|
|
1447
1509
|
listActivity: (sessionId, input = {}) => {
|
|
1448
1510
|
const params = new URLSearchParams;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { cp as DeviceLogin, ip as AccountDevice, np as ProjectSyncState, rp as ProjectSyncStatus, sp as AccountStatus } from "./index-j28tAAxd.js";
|
|
2
|
+
import { A as ExtensionClient, B as PstdioApiError, C as ResourceAnchorsClient, D as DirectoryEntry, E as LinkIconsClient, F as AssetUploadInput, H as RequestFn, I as AssetsClient, L as AgentClient, M as BoardViewsClient, N as AutomationClient, O as FilesystemClient, P as AssetClientOwner, R as AccountClient, S as createRuntimeClient, T as NotificationsClient, U as RequestOptions, V as PstdioConnectionError, W as createRequest, _ as SessionClient, a as WorkspaceClient, b as SseEvent, c as SyncConnection, d as SyncWriterProvider, f as applySyncEvent, g as ListSessionsInput, h as SettingsClient, i as createClient, j as CommandStreamClientEvent, k as FilesystemDrive, l as SyncRow, m as SkillClient, n as AssetTransfer, o as StartSyncInput, p as parseSyncDeleteEvent, r as PstdioClient, s as SyncClient, t as AssetReference, u as SyncWriter, v as SessionStreamConnection, w as ProjectClient, x as RuntimeClient, y as SessionStreamHandlers, z as ClientOptions } from "./index-DBkZvGh1.js";
|
|
3
|
+
export { type AccountClient, type AccountDevice, type AccountStatus, type AgentClient, type AssetClientOwner, type AssetReference, type AssetTransfer, type AssetUploadInput, type AssetsClient, type AutomationClient, type BoardViewsClient, type ClientOptions, type CommandStreamClientEvent, type DeviceLogin, type DirectoryEntry, type ExtensionClient, type FilesystemClient, type FilesystemDrive, type LinkIconsClient, type ListSessionsInput, type NotificationsClient, type ProjectClient, type ProjectSyncState, type ProjectSyncStatus, PstdioApiError, type PstdioClient, PstdioConnectionError, type RequestFn, type RequestOptions, type ResourceAnchorsClient, type RuntimeClient, type SessionClient, type SessionStreamConnection, type SessionStreamHandlers, type SettingsClient, type SkillClient, type SseEvent, type StartSyncInput, type SyncClient, type SyncConnection, type SyncRow, type SyncWriter, type SyncWriterProvider, type WorkspaceClient, applySyncEvent, createClient, createRequest, createRuntimeClient, parseSyncDeleteEvent };
|
|
3
4
|
export {};
|
package/dist/data.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/data/draft-layout.d.ts
|
|
1
|
+
import { ba as ArtifactMount } from "./index-j28tAAxd.js";
|
|
3
2
|
export declare const assertSafePathSegment: (value: string) => void;
|
|
4
3
|
/** @deprecated Use the named file handle from the extension file API (PRD 0009). Removed in 0.45 after Planner and Reports adopt that API. */
|
|
5
4
|
export declare const requireRepoFiles: (projectFiles: ArtifactMount | undefined) => ArtifactMount;
|
|
@@ -8,8 +7,6 @@ export declare const createDraftLayout: (root: string, document: string) => {
|
|
|
8
7
|
markdown: (name: string, suffix?: string) => string;
|
|
9
8
|
files: (name: string, suffix?: string) => string;
|
|
10
9
|
};
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/data/frontmatter.d.ts
|
|
13
10
|
export declare const quoteYamlScalar: (value: string) => string;
|
|
14
11
|
export declare const findClosingFrontmatterDelimiter: (content: string) => {
|
|
15
12
|
end: number;
|
|
@@ -18,11 +15,8 @@ export declare const findClosingFrontmatterDelimiter: (content: string) => {
|
|
|
18
15
|
export declare const stripFrontmatter: (content: string) => string;
|
|
19
16
|
export declare const applyFrontmatter: (frontmatter: string, content: string) => string;
|
|
20
17
|
export declare const unquoteYamlScalar: (value: string) => string;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/data/resolve.d.ts
|
|
23
18
|
export declare const sameName: (a: string, b: string) => boolean;
|
|
24
19
|
export declare const resolveByIdOrName: <TItem extends {
|
|
25
20
|
id: string;
|
|
26
21
|
}>(items: TItem[], value: string, nameOf: (item: TItem) => string, label: string) => string;
|
|
27
|
-
//#endregion
|
|
28
22
|
export {};
|
package/dist/extensions/index.js
CHANGED
|
@@ -352,6 +352,58 @@ var resolveDataTableFieldKind = (values, column = {}) => {
|
|
|
352
352
|
const comparable = values.map((value) => resolveDataTableComparableValue(value, column.renderer)).filter((value) => value !== null && value !== undefined);
|
|
353
353
|
return comparable.length > 0 && comparable.every((value) => typeof value === "number") ? "number" : "string";
|
|
354
354
|
};
|
|
355
|
+
// ../pstdio-api-contracts/src/extension-kernel/editing-state.ts
|
|
356
|
+
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
357
|
+
var diffEditingState = (before, after, path = []) => {
|
|
358
|
+
const changes = [];
|
|
359
|
+
if (Object.keys(before).some((key) => !Object.hasOwn(after, key)))
|
|
360
|
+
return [{ path, value: after }];
|
|
361
|
+
for (const [key, value] of Object.entries(after)) {
|
|
362
|
+
const previous = before[key];
|
|
363
|
+
if (JSON.stringify(previous) === JSON.stringify(value))
|
|
364
|
+
continue;
|
|
365
|
+
const nextPath = [...path, key];
|
|
366
|
+
if (previous !== undefined && record(previous) && record(value))
|
|
367
|
+
changes.push(...diffEditingState(previous, value, nextPath));
|
|
368
|
+
else
|
|
369
|
+
changes.push({ path: nextPath, value });
|
|
370
|
+
}
|
|
371
|
+
return changes;
|
|
372
|
+
};
|
|
373
|
+
var applyEditingChanges = (state, changes) => {
|
|
374
|
+
let next = structuredClone(state);
|
|
375
|
+
for (const change of changes) {
|
|
376
|
+
if (change.path.some((key) => ["__proto__", "constructor", "prototype"].includes(key)))
|
|
377
|
+
throw new Error("Invalid editing path");
|
|
378
|
+
if (change.path.length === 0) {
|
|
379
|
+
if (!record(change.value))
|
|
380
|
+
throw new Error("The editing state root must be an object");
|
|
381
|
+
next = structuredClone(change.value);
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
let target = next;
|
|
385
|
+
for (const key of change.path.slice(0, -1)) {
|
|
386
|
+
if (target[key] === undefined)
|
|
387
|
+
target[key] = {};
|
|
388
|
+
if (!record(target[key]))
|
|
389
|
+
throw new Error("Editing paths must traverse objects");
|
|
390
|
+
target = target[key];
|
|
391
|
+
}
|
|
392
|
+
target[change.path.at(-1)] = structuredClone(change.value);
|
|
393
|
+
}
|
|
394
|
+
return next;
|
|
395
|
+
};
|
|
396
|
+
var rebaseEditingChanges = (state, drafts) => {
|
|
397
|
+
let value = state;
|
|
398
|
+
const applicable = new Map;
|
|
399
|
+
for (const [key, changes] of drafts) {
|
|
400
|
+
try {
|
|
401
|
+
value = applyEditingChanges(value, changes);
|
|
402
|
+
applicable.set(key, changes);
|
|
403
|
+
} catch {}
|
|
404
|
+
}
|
|
405
|
+
return { value, drafts: applicable };
|
|
406
|
+
};
|
|
355
407
|
// ../pstdio-api-contracts/src/extension-kernel/event-reference.ts
|
|
356
408
|
var resolveEventReferenceId = (ref, ownerExtensionId) => {
|
|
357
409
|
if (typeof ref === "string")
|
|
@@ -407,6 +459,9 @@ var workspaceSlots = {
|
|
|
407
459
|
var projectEvents = {
|
|
408
460
|
opened: hostEventRef("project.opened")
|
|
409
461
|
};
|
|
462
|
+
var accountEvents = {
|
|
463
|
+
projectSyncChanged: hostEventRef("account.project-sync.changed")
|
|
464
|
+
};
|
|
410
465
|
var viewDataEvents = {
|
|
411
466
|
boardViewsChanged: hostEventRef("view.board-views.changed"),
|
|
412
467
|
resourceAnchorsChanged: hostEventRef("view.resource-anchors.changed"),
|
|
@@ -422,6 +477,9 @@ var sessionEvents = {
|
|
|
422
477
|
failed: hostEventRef("session.failed"),
|
|
423
478
|
completed: hostEventRef("session.completed")
|
|
424
479
|
};
|
|
480
|
+
var resourceEvents = {
|
|
481
|
+
renumbered: hostEventRef("resource.renumbered")
|
|
482
|
+
};
|
|
425
483
|
var workspaceEvents = {
|
|
426
484
|
created: hostEventRef("workspace.created"),
|
|
427
485
|
provision: hostEventRef("workspace.provision"),
|
|
@@ -937,6 +995,7 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
|
937
995
|
"clipboard.write",
|
|
938
996
|
"commands.execute",
|
|
939
997
|
"commands.stream",
|
|
998
|
+
"editing.session",
|
|
940
999
|
"harnesses.read",
|
|
941
1000
|
"resources.actions",
|
|
942
1001
|
"navigation.open",
|
|
@@ -955,7 +1014,9 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
|
955
1014
|
"terminal.session",
|
|
956
1015
|
"files.upload",
|
|
957
1016
|
"files.list",
|
|
958
|
-
"files.delete"
|
|
1017
|
+
"files.delete",
|
|
1018
|
+
"account.read",
|
|
1019
|
+
"account.manage"
|
|
959
1020
|
];
|
|
960
1021
|
var WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES = ["artifacts.read"];
|
|
961
1022
|
var ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES = ["host.dispatchKeyboardEvent"];
|
|
@@ -967,7 +1028,7 @@ var WEBVIEW_HOST_CAPABILITIES = [
|
|
|
967
1028
|
var EXTENSION_EVENTS_SCOPE = "extension.events";
|
|
968
1029
|
var artifactMountId = (mount) => typeof mount === "string" ? mount : mount.id;
|
|
969
1030
|
// package.json
|
|
970
|
-
var version = "0.45.0
|
|
1031
|
+
var version = "0.45.0";
|
|
971
1032
|
|
|
972
1033
|
// src/version.ts
|
|
973
1034
|
var SDK_VERSION = version;
|
|
@@ -1268,6 +1329,135 @@ var createTerminalSessionBridge = (host) => ({
|
|
|
1268
1329
|
// src/extensions/webview-capabilities.ts
|
|
1269
1330
|
var artifactMountId2 = artifactMountId;
|
|
1270
1331
|
var artifactsRead = (mount) => `artifacts.read:${artifactMountId2(mount)}`;
|
|
1332
|
+
// src/extensions/webview-account-client.ts
|
|
1333
|
+
var createWebviewAccountClient = (host) => ({
|
|
1334
|
+
status: () => host.call("account.read", { op: "status" }),
|
|
1335
|
+
loginStatus: (id) => host.call("account.read", { op: "loginStatus", id }),
|
|
1336
|
+
devices: () => host.call("account.read", { op: "devices" }),
|
|
1337
|
+
projectSyncStatus: (projectId) => host.call("account.read", { op: "projectSyncStatus", ...projectId ? { projectId } : {} }),
|
|
1338
|
+
login: (managerOrigin) => host.call("account.manage", { op: "login", managerOrigin }),
|
|
1339
|
+
cancelLogin: (id) => host.call("account.manage", { op: "cancelLogin", id }),
|
|
1340
|
+
logout: () => host.call("account.manage", { op: "logout" }),
|
|
1341
|
+
renameDevice: (id, name) => host.call("account.manage", { op: "renameDevice", id, name }),
|
|
1342
|
+
removeDevice: (id) => host.call("account.manage", { op: "removeDevice", id }),
|
|
1343
|
+
syncProject: (projectId) => host.call("account.manage", { op: "syncProject", ...projectId ? { projectId } : {} }),
|
|
1344
|
+
stopProjectSync: (projectId) => host.call("account.manage", { op: "stopProjectSync", ...projectId ? { projectId } : {} })
|
|
1345
|
+
});
|
|
1346
|
+
|
|
1347
|
+
// src/extensions/webview-editing.ts
|
|
1348
|
+
var createWebviewEditingClient = (host) => ({
|
|
1349
|
+
async open(options) {
|
|
1350
|
+
const sessionId = crypto.randomUUID();
|
|
1351
|
+
const listeners = new Set;
|
|
1352
|
+
const pending = new Map;
|
|
1353
|
+
let sequence = 0;
|
|
1354
|
+
let active = true;
|
|
1355
|
+
let base = {
|
|
1356
|
+
value: options.initial,
|
|
1357
|
+
version: -1,
|
|
1358
|
+
revision: 0,
|
|
1359
|
+
savedRevision: 0
|
|
1360
|
+
};
|
|
1361
|
+
let current = base;
|
|
1362
|
+
const publish = () => {
|
|
1363
|
+
current = {
|
|
1364
|
+
...base,
|
|
1365
|
+
value: rebaseEditingChanges(base.value, pending).value
|
|
1366
|
+
};
|
|
1367
|
+
for (const listener of listeners)
|
|
1368
|
+
listener();
|
|
1369
|
+
};
|
|
1370
|
+
const acknowledge = (sequence) => {
|
|
1371
|
+
if (sequence === undefined)
|
|
1372
|
+
return;
|
|
1373
|
+
for (const key of pending.keys())
|
|
1374
|
+
if (key <= sequence)
|
|
1375
|
+
pending.delete(key);
|
|
1376
|
+
};
|
|
1377
|
+
const accept = (next, appliedSequence) => {
|
|
1378
|
+
if (!active)
|
|
1379
|
+
return;
|
|
1380
|
+
const size = pending.size;
|
|
1381
|
+
acknowledge(appliedSequence);
|
|
1382
|
+
if (next.version >= base.version)
|
|
1383
|
+
base = next;
|
|
1384
|
+
else if (size === pending.size)
|
|
1385
|
+
return;
|
|
1386
|
+
publish();
|
|
1387
|
+
};
|
|
1388
|
+
const unsubscribe = host.onEvent("editing.session", (payload) => {
|
|
1389
|
+
const event = payload;
|
|
1390
|
+
if (event.sessionId === sessionId)
|
|
1391
|
+
accept(event.snapshot, event.appliedSequence);
|
|
1392
|
+
});
|
|
1393
|
+
const request = async (input) => {
|
|
1394
|
+
if (!active)
|
|
1395
|
+
throw new Error("editing_session_closed");
|
|
1396
|
+
const result = await host.call("editing.session", input);
|
|
1397
|
+
if (result)
|
|
1398
|
+
accept(result);
|
|
1399
|
+
return result;
|
|
1400
|
+
};
|
|
1401
|
+
const edit = async (operation, changes) => {
|
|
1402
|
+
if (!active)
|
|
1403
|
+
throw new Error("editing_session_closed");
|
|
1404
|
+
applyEditingChanges(current.value, changes);
|
|
1405
|
+
const next = ++sequence;
|
|
1406
|
+
pending.set(next, structuredClone(changes));
|
|
1407
|
+
publish();
|
|
1408
|
+
try {
|
|
1409
|
+
await request({ operation, sessionId, sequence: next, changes });
|
|
1410
|
+
} catch (error) {
|
|
1411
|
+
if (pending.delete(next))
|
|
1412
|
+
publish();
|
|
1413
|
+
throw error;
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
try {
|
|
1417
|
+
await request({ operation: "open", sessionId, ...options, initial: options.initial });
|
|
1418
|
+
} catch (error) {
|
|
1419
|
+
active = false;
|
|
1420
|
+
unsubscribe();
|
|
1421
|
+
throw error;
|
|
1422
|
+
}
|
|
1423
|
+
return {
|
|
1424
|
+
id: sessionId,
|
|
1425
|
+
getSnapshot: () => current,
|
|
1426
|
+
subscribe(listener) {
|
|
1427
|
+
listeners.add(listener);
|
|
1428
|
+
return () => {
|
|
1429
|
+
listeners.delete(listener);
|
|
1430
|
+
};
|
|
1431
|
+
},
|
|
1432
|
+
commit: (changes = []) => edit("commit", changes),
|
|
1433
|
+
preview: (changes) => edit("preview", changes),
|
|
1434
|
+
async cancel() {
|
|
1435
|
+
await request({ operation: "cancel", sessionId });
|
|
1436
|
+
},
|
|
1437
|
+
async save() {
|
|
1438
|
+
await request({ operation: "save", sessionId });
|
|
1439
|
+
},
|
|
1440
|
+
async refresh(read) {
|
|
1441
|
+
while (active) {
|
|
1442
|
+
await request({ operation: "save", sessionId });
|
|
1443
|
+
const expectedVersion = base.version;
|
|
1444
|
+
const value = await read();
|
|
1445
|
+
if (!active || await request({ operation: "refresh", sessionId, value, expectedVersion }))
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
async close() {
|
|
1450
|
+
if (!active)
|
|
1451
|
+
return;
|
|
1452
|
+
active = false;
|
|
1453
|
+
unsubscribe();
|
|
1454
|
+
listeners.clear();
|
|
1455
|
+
await host.call("editing.session", { operation: "close", sessionId });
|
|
1456
|
+
}
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
|
|
1271
1461
|
// src/extensions/webview-events.ts
|
|
1272
1462
|
var EXTENSION_EVENTS_SCOPE2 = EXTENSION_EVENTS_SCOPE;
|
|
1273
1463
|
var createWebviewEventsClient = (host, extensionId) => ({
|
|
@@ -1504,13 +1694,15 @@ var createWebviewClient = (host, options) => {
|
|
|
1504
1694
|
};
|
|
1505
1695
|
return {
|
|
1506
1696
|
...hostClient,
|
|
1697
|
+
editing: createWebviewEditingClient(host),
|
|
1507
1698
|
files: createWebviewFilesClient(host),
|
|
1508
1699
|
page: createWebviewPageClient(host),
|
|
1509
1700
|
artifacts,
|
|
1510
1701
|
commands,
|
|
1511
1702
|
streams,
|
|
1512
1703
|
events,
|
|
1513
|
-
settings
|
|
1704
|
+
settings,
|
|
1705
|
+
account: createWebviewAccountClient(host)
|
|
1514
1706
|
};
|
|
1515
1707
|
};
|
|
1516
1708
|
// src/extensions/when.ts
|
|
@@ -1551,6 +1743,8 @@ export {
|
|
|
1551
1743
|
WEBVIEW_HOST_CAPABILITIES2 as WEBVIEW_HOST_CAPABILITIES,
|
|
1552
1744
|
WEBVIEW_HOST_CAPABILITY_VERSION2 as WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
1553
1745
|
WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES2 as WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
1746
|
+
accountEvents,
|
|
1747
|
+
applyEditingChanges,
|
|
1554
1748
|
artifactChanged,
|
|
1555
1749
|
artifactMountId2 as artifactMountId,
|
|
1556
1750
|
artifactsRead,
|
|
@@ -1592,6 +1786,7 @@ export {
|
|
|
1592
1786
|
defineView,
|
|
1593
1787
|
defineViewMenu,
|
|
1594
1788
|
defineWorkspaceType,
|
|
1789
|
+
diffEditingState,
|
|
1595
1790
|
dockedWorkbenchRegions,
|
|
1596
1791
|
eventRef,
|
|
1597
1792
|
extensionPanelRegions,
|
|
@@ -1622,11 +1817,13 @@ export {
|
|
|
1622
1817
|
projectSlots,
|
|
1623
1818
|
qualifyNavigationTarget2 as qualifyNavigationTarget,
|
|
1624
1819
|
qualifyRef,
|
|
1820
|
+
rebaseEditingChanges,
|
|
1625
1821
|
reconcileMessageHistory,
|
|
1626
1822
|
resolveDataTableComparableValue2 as resolveDataTableComparableValue,
|
|
1627
1823
|
resolveDataTableFieldKind2 as resolveDataTableFieldKind,
|
|
1628
1824
|
resolveEventReferenceId2 as resolveEventReferenceId,
|
|
1629
1825
|
resolvePageParams2 as resolvePageParams,
|
|
1826
|
+
resourceEvents,
|
|
1630
1827
|
resourceKey,
|
|
1631
1828
|
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
1632
1829
|
serializePageUrl2 as serializePageUrl,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hn as WebviewEventsClient, mp as RendererEventReference } from "./index-j28tAAxd.js";
|
|
2
2
|
import { QueryKey, UseQueryResult } from "@tanstack/react-query";
|
|
3
|
-
//#region src/extensions/react/index.d.ts
|
|
4
3
|
interface CommandQueryInput<TResult> {
|
|
5
4
|
queryKey: QueryKey;
|
|
6
5
|
command: () => Promise<TResult>;
|
|
@@ -22,5 +21,4 @@ interface CommandMutationInput<TParams, TResult> {
|
|
|
22
21
|
}
|
|
23
22
|
/** Writes server state via a typed client command and refreshes affected queries on success. */
|
|
24
23
|
export declare const useCommandMutation: <TParams, TResult>(input: CommandMutationInput<TParams, TResult>) => import("@tanstack/react-query").UseMutationResult<TResult, Error, TParams, unknown>;
|
|
25
|
-
//#endregion
|
|
26
24
|
export {};
|