@pstdio/sdk 0.23.0 → 0.24.1
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 +1524 -10199
- package/dist/api.d.ts +19 -0
- package/dist/client/index.js +6 -21
- package/dist/client.d.ts +12 -0
- package/dist/data/index.js +100 -0
- package/dist/data.d.ts +47 -0
- package/dist/extensions/index.js +96 -107
- package/dist/extensions/react/index.js +2 -17
- package/dist/extensions.d.ts +18 -0
- package/dist/hooks.d.ts +12 -0
- package/dist/prompts/index.js +0 -15
- package/dist/resources/index.js +1524 -10199
- package/dist/resources.d.ts +4 -0
- package/dist/testing/index.js +207 -0
- package/dist/testing.d.ts +910 -0
- package/package.json +9 -1
package/dist/api.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ declare const commandExecuteRequestSchema: z.ZodObject<{
|
|
|
93
93
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
94
94
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
95
95
|
resource: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
96
97
|
type: z.ZodString;
|
|
97
98
|
id: z.ZodString;
|
|
98
99
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -120,6 +121,7 @@ declare const commandExecuteRequestSchema: z.ZodObject<{
|
|
|
120
121
|
mode: z.ZodOptional<z.ZodString>;
|
|
121
122
|
projectId: z.ZodOptional<z.ZodString>;
|
|
122
123
|
resource: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
123
125
|
type: z.ZodString;
|
|
124
126
|
id: z.ZodString;
|
|
125
127
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -247,6 +249,7 @@ declare const createAutomationRunInputSchema: z.ZodObject<{
|
|
|
247
249
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
248
250
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
249
251
|
resource: z.ZodOptional<z.ZodObject<{
|
|
252
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
250
253
|
type: z.ZodString;
|
|
251
254
|
id: z.ZodString;
|
|
252
255
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -290,6 +293,7 @@ declare const createSessionInputSchema: z.ZodObject<{
|
|
|
290
293
|
agent: z.ZodOptional<z.ZodString>;
|
|
291
294
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
292
295
|
anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
296
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
293
297
|
type: z.ZodString;
|
|
294
298
|
id: z.ZodString;
|
|
295
299
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -448,6 +452,7 @@ declare const extensionKeybindingRecordSchema: z.ZodObject<{
|
|
|
448
452
|
id: z.ZodString;
|
|
449
453
|
}, z.core.$strip>]>;
|
|
450
454
|
resource: z.ZodOptional<z.ZodObject<{
|
|
455
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
451
456
|
type: z.ZodString;
|
|
452
457
|
id: z.ZodString;
|
|
453
458
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -491,6 +496,7 @@ declare const extensionKeybindingRecordSchema: z.ZodObject<{
|
|
|
491
496
|
id: z.ZodString;
|
|
492
497
|
}, z.core.$strip>]>;
|
|
493
498
|
resource: z.ZodOptional<z.ZodObject<{
|
|
499
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
494
500
|
type: z.ZodString;
|
|
495
501
|
id: z.ZodString;
|
|
496
502
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -597,6 +603,7 @@ declare const extensionRecordSchema: z.ZodObject<{
|
|
|
597
603
|
}, z.core.$strip>;
|
|
598
604
|
|
|
599
605
|
declare const extensionResourceRefSchema: z.ZodObject<{
|
|
606
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
600
607
|
type: z.ZodString;
|
|
601
608
|
id: z.ZodString;
|
|
602
609
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1318,6 +1325,7 @@ declare const resolveSessionIdResponseSchema: z.ZodObject<{
|
|
|
1318
1325
|
export declare interface ResourceRef {
|
|
1319
1326
|
type: string;
|
|
1320
1327
|
id: string;
|
|
1328
|
+
shorthand?: string;
|
|
1321
1329
|
projectId?: string;
|
|
1322
1330
|
label?: string;
|
|
1323
1331
|
icon?: string;
|
|
@@ -1423,6 +1431,7 @@ declare const sessionConversationResponseSchema: z.ZodObject<{
|
|
|
1423
1431
|
cwd: z.ZodNullable<z.ZodString>;
|
|
1424
1432
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
1425
1433
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1434
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1426
1435
|
type: z.ZodString;
|
|
1427
1436
|
id: z.ZodString;
|
|
1428
1437
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1440,6 +1449,7 @@ declare const sessionConversationResponseSchema: z.ZodObject<{
|
|
|
1440
1449
|
export declare type Settings = z.infer<typeof settingsSchema>;
|
|
1441
1450
|
|
|
1442
1451
|
declare const settingsSchema: z.ZodObject<{
|
|
1452
|
+
notifications_enabled: z.ZodBoolean;
|
|
1443
1453
|
max_concurrent_sessions: z.ZodNullable<z.ZodNumber>;
|
|
1444
1454
|
}, z.core.$strip>;
|
|
1445
1455
|
|
|
@@ -1513,6 +1523,7 @@ export declare interface UpdateNotificationInput {
|
|
|
1513
1523
|
export declare type UpdateSettingsInput = z.infer<typeof updateSettingsInputSchema>;
|
|
1514
1524
|
|
|
1515
1525
|
declare const updateSettingsInputSchema: z.ZodObject<{
|
|
1526
|
+
notifications_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1516
1527
|
max_concurrent_sessions: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1517
1528
|
}, z.core.$strict>;
|
|
1518
1529
|
|
|
@@ -1855,6 +1866,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
1855
1866
|
id: z.ZodString;
|
|
1856
1867
|
}, z.core.$strip>]>;
|
|
1857
1868
|
resource: z.ZodOptional<z.ZodObject<{
|
|
1869
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1858
1870
|
type: z.ZodString;
|
|
1859
1871
|
id: z.ZodString;
|
|
1860
1872
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1898,6 +1910,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
1898
1910
|
id: z.ZodString;
|
|
1899
1911
|
}, z.core.$strip>]>;
|
|
1900
1912
|
resource: z.ZodOptional<z.ZodObject<{
|
|
1913
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1901
1914
|
type: z.ZodString;
|
|
1902
1915
|
id: z.ZodString;
|
|
1903
1916
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -2369,6 +2382,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
2369
2382
|
id: z.ZodString;
|
|
2370
2383
|
}, z.core.$strip>]>;
|
|
2371
2384
|
resource: z.ZodOptional<z.ZodObject<{
|
|
2385
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
2372
2386
|
type: z.ZodString;
|
|
2373
2387
|
id: z.ZodString;
|
|
2374
2388
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -2412,6 +2426,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
2412
2426
|
id: z.ZodString;
|
|
2413
2427
|
}, z.core.$strip>]>;
|
|
2414
2428
|
resource: z.ZodOptional<z.ZodObject<{
|
|
2429
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
2415
2430
|
type: z.ZodString;
|
|
2416
2431
|
id: z.ZodString;
|
|
2417
2432
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -2550,6 +2565,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
2550
2565
|
id: z.ZodString;
|
|
2551
2566
|
}, z.core.$strip>]>;
|
|
2552
2567
|
resource: z.ZodOptional<z.ZodObject<{
|
|
2568
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
2553
2569
|
type: z.ZodString;
|
|
2554
2570
|
id: z.ZodString;
|
|
2555
2571
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -2593,6 +2609,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
2593
2609
|
id: z.ZodString;
|
|
2594
2610
|
}, z.core.$strip>]>;
|
|
2595
2611
|
resource: z.ZodOptional<z.ZodObject<{
|
|
2612
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
2596
2613
|
type: z.ZodString;
|
|
2597
2614
|
id: z.ZodString;
|
|
2598
2615
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -2783,6 +2800,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
2783
2800
|
id: z.ZodString;
|
|
2784
2801
|
}, z.core.$strip>]>;
|
|
2785
2802
|
resource: z.ZodOptional<z.ZodObject<{
|
|
2803
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
2786
2804
|
type: z.ZodString;
|
|
2787
2805
|
id: z.ZodString;
|
|
2788
2806
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -2826,6 +2844,7 @@ declare const workbenchExtensionMetadataSchema: z.ZodObject<{
|
|
|
2826
2844
|
id: z.ZodString;
|
|
2827
2845
|
}, z.core.$strip>]>;
|
|
2828
2846
|
resource: z.ZodOptional<z.ZodObject<{
|
|
2847
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
2829
2848
|
type: z.ZodString;
|
|
2830
2849
|
id: z.ZodString;
|
|
2831
2850
|
projectId: z.ZodOptional<z.ZodString>;
|
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
|
@@ -157,6 +157,7 @@ declare const commandExecuteRequestSchema: z.ZodObject<{
|
|
|
157
157
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
158
158
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
159
159
|
resource: z.ZodOptional<z.ZodObject<{
|
|
160
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
160
161
|
type: z.ZodString;
|
|
161
162
|
id: z.ZodString;
|
|
162
163
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -184,6 +185,7 @@ declare const commandExecuteRequestSchema: z.ZodObject<{
|
|
|
184
185
|
mode: z.ZodOptional<z.ZodString>;
|
|
185
186
|
projectId: z.ZodOptional<z.ZodString>;
|
|
186
187
|
resource: z.ZodOptional<z.ZodObject<{
|
|
188
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
187
189
|
type: z.ZodString;
|
|
188
190
|
id: z.ZodString;
|
|
189
191
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -311,6 +313,7 @@ declare const createAutomationRunInputSchema: z.ZodObject<{
|
|
|
311
313
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
312
314
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
313
315
|
resource: z.ZodOptional<z.ZodObject<{
|
|
316
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
314
317
|
type: z.ZodString;
|
|
315
318
|
id: z.ZodString;
|
|
316
319
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -360,6 +363,7 @@ declare const createSessionInputSchema: z.ZodObject<{
|
|
|
360
363
|
agent: z.ZodOptional<z.ZodString>;
|
|
361
364
|
workspace_id: z.ZodOptional<z.ZodString>;
|
|
362
365
|
anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
366
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
363
367
|
type: z.ZodString;
|
|
364
368
|
id: z.ZodString;
|
|
365
369
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -519,6 +523,7 @@ declare const followUpResponseSchema: z.ZodObject<{
|
|
|
519
523
|
cwd: z.ZodNullable<z.ZodString>;
|
|
520
524
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
521
525
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
526
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
522
527
|
type: z.ZodString;
|
|
523
528
|
id: z.ZodString;
|
|
524
529
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1193,6 +1198,7 @@ declare const resolveSessionIdResponseSchema: z.ZodObject<{
|
|
|
1193
1198
|
declare interface ResourceRef {
|
|
1194
1199
|
type: string;
|
|
1195
1200
|
id: string;
|
|
1201
|
+
shorthand?: string;
|
|
1196
1202
|
projectId?: string;
|
|
1197
1203
|
label?: string;
|
|
1198
1204
|
icon?: string;
|
|
@@ -1271,6 +1277,7 @@ declare const sessionConversationResponseSchema: z.ZodObject<{
|
|
|
1271
1277
|
cwd: z.ZodNullable<z.ZodString>;
|
|
1272
1278
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
1273
1279
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1280
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1274
1281
|
type: z.ZodString;
|
|
1275
1282
|
id: z.ZodString;
|
|
1276
1283
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1309,6 +1316,7 @@ declare const sessionSchema: z.ZodObject<{
|
|
|
1309
1316
|
cwd: z.ZodNullable<z.ZodString>;
|
|
1310
1317
|
params_json: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
1311
1318
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1319
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1312
1320
|
type: z.ZodString;
|
|
1313
1321
|
id: z.ZodString;
|
|
1314
1322
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1341,6 +1349,7 @@ export declare type SettingsClient = {
|
|
|
1341
1349
|
};
|
|
1342
1350
|
|
|
1343
1351
|
declare const settingsSchema: z.ZodObject<{
|
|
1352
|
+
notifications_enabled: z.ZodBoolean;
|
|
1344
1353
|
max_concurrent_sessions: z.ZodNullable<z.ZodNumber>;
|
|
1345
1354
|
}, z.core.$strip>;
|
|
1346
1355
|
|
|
@@ -1476,6 +1485,7 @@ declare interface UpdateNotificationInput {
|
|
|
1476
1485
|
declare type UpdateSettingsInput = z.infer<typeof updateSettingsInputSchema>;
|
|
1477
1486
|
|
|
1478
1487
|
declare const updateSettingsInputSchema: z.ZodObject<{
|
|
1488
|
+
notifications_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1479
1489
|
max_concurrent_sessions: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1480
1490
|
}, z.core.$strict>;
|
|
1481
1491
|
|
|
@@ -1641,6 +1651,7 @@ declare const workspaceListItemSchema: z.ZodObject<{
|
|
|
1641
1651
|
workspace_shorthand: z.ZodString;
|
|
1642
1652
|
startup_log_file_id: z.ZodNullable<z.ZodString>;
|
|
1643
1653
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1654
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1644
1655
|
type: z.ZodString;
|
|
1645
1656
|
id: z.ZodString;
|
|
1646
1657
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -1693,6 +1704,7 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
1693
1704
|
workspace_shorthand: z.ZodString;
|
|
1694
1705
|
startup_log_file_id: z.ZodNullable<z.ZodString>;
|
|
1695
1706
|
anchors_json: z.ZodArray<z.ZodObject<{
|
|
1707
|
+
shorthand: z.ZodOptional<z.ZodString>;
|
|
1696
1708
|
type: z.ZodString;
|
|
1697
1709
|
id: z.ZodString;
|
|
1698
1710
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/data/draft-layout.ts
|
|
2
|
+
var assertSafePathSegment = (value) => {
|
|
3
|
+
if (!value || value === "." || value === ".." || /[/\\\0]/.test(value))
|
|
4
|
+
throw new Error(`Unsafe path segment: ${value}`);
|
|
5
|
+
};
|
|
6
|
+
var requireRepoFiles = (repoFiles) => {
|
|
7
|
+
if (!repoFiles)
|
|
8
|
+
throw new Error("This command must be run inside a project repository.");
|
|
9
|
+
return repoFiles;
|
|
10
|
+
};
|
|
11
|
+
var createDraftLayout = (root, document) => {
|
|
12
|
+
const directory = (name) => {
|
|
13
|
+
assertSafePathSegment(name);
|
|
14
|
+
return `${root}/${name}`;
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
directory,
|
|
18
|
+
markdown: (name, suffix = "") => `${directory(name)}/${document}${suffix}.md`,
|
|
19
|
+
files: (name, suffix = "") => `${directory(name)}/files${suffix}`
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
// src/data/frontmatter.ts
|
|
23
|
+
var escapeYamlScalar = (value) => value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n");
|
|
24
|
+
var quoteYamlScalar = (value) => `"${escapeYamlScalar(value)}"`;
|
|
25
|
+
var findClosingFrontmatterDelimiter = (content) => {
|
|
26
|
+
const match = /\n---[ \t]*(?:\r?\n|$)/.exec(content.slice(3));
|
|
27
|
+
if (!match)
|
|
28
|
+
return null;
|
|
29
|
+
const start = 3 + match.index + 1;
|
|
30
|
+
const end = 3 + match.index + match[0].length;
|
|
31
|
+
return { end, start };
|
|
32
|
+
};
|
|
33
|
+
var stripFrontmatter = (content) => {
|
|
34
|
+
if (!content.startsWith("---"))
|
|
35
|
+
return content;
|
|
36
|
+
const delimiter = findClosingFrontmatterDelimiter(content);
|
|
37
|
+
if (!delimiter)
|
|
38
|
+
return content;
|
|
39
|
+
return content.slice(delimiter.end);
|
|
40
|
+
};
|
|
41
|
+
var applyFrontmatter = (frontmatter, content) => {
|
|
42
|
+
const body = stripFrontmatter(content).replace(/^\n+/, "");
|
|
43
|
+
if (!body)
|
|
44
|
+
return frontmatter;
|
|
45
|
+
return `${frontmatter}
|
|
46
|
+
|
|
47
|
+
${body}`;
|
|
48
|
+
};
|
|
49
|
+
var unescapeYamlScalar = (value) => {
|
|
50
|
+
let result = "";
|
|
51
|
+
for (let index = 0;index < value.length; index++) {
|
|
52
|
+
const current = value[index];
|
|
53
|
+
const next = value[index + 1];
|
|
54
|
+
if (current !== "\\" || next === undefined) {
|
|
55
|
+
result += current;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (next === "n")
|
|
59
|
+
result += `
|
|
60
|
+
`;
|
|
61
|
+
else if (next === '"')
|
|
62
|
+
result += '"';
|
|
63
|
+
else if (next === "\\")
|
|
64
|
+
result += "\\";
|
|
65
|
+
else
|
|
66
|
+
result += `${current}${next}`;
|
|
67
|
+
index++;
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
71
|
+
var unquoteYamlScalar = (value) => {
|
|
72
|
+
const quoted = value.match(/^(["'])(.*)\1$/);
|
|
73
|
+
return quoted ? unescapeYamlScalar(quoted[2] ?? "") : value;
|
|
74
|
+
};
|
|
75
|
+
// src/data/resolve.ts
|
|
76
|
+
var sameName = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
77
|
+
var resolveByIdOrName = (items, value, nameOf, label) => {
|
|
78
|
+
const byId = items.find((item) => item.id === value);
|
|
79
|
+
if (byId)
|
|
80
|
+
return byId.id;
|
|
81
|
+
const byName = items.filter((item) => sameName(nameOf(item), value));
|
|
82
|
+
if (byName.length > 1)
|
|
83
|
+
throw new Error(`Ambiguous ${label} "${value}"`);
|
|
84
|
+
const [match] = byName;
|
|
85
|
+
if (match)
|
|
86
|
+
return match.id;
|
|
87
|
+
throw new Error(`Unknown ${label} "${value}"`);
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
90
|
+
applyFrontmatter,
|
|
91
|
+
assertSafePathSegment,
|
|
92
|
+
createDraftLayout,
|
|
93
|
+
findClosingFrontmatterDelimiter,
|
|
94
|
+
quoteYamlScalar,
|
|
95
|
+
requireRepoFiles,
|
|
96
|
+
resolveByIdOrName,
|
|
97
|
+
sameName,
|
|
98
|
+
stripFrontmatter,
|
|
99
|
+
unquoteYamlScalar
|
|
100
|
+
};
|
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const applyFrontmatter: (frontmatter: string, content: string) => string;
|
|
2
|
+
|
|
3
|
+
declare interface ArtifactFile {
|
|
4
|
+
path: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
updatedAt?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare interface ArtifactMount {
|
|
10
|
+
exists(path: string): Promise<boolean>;
|
|
11
|
+
readText(path: string): Promise<string>;
|
|
12
|
+
writeText(path: string, value: string): Promise<void>;
|
|
13
|
+
readBytes(path: string): Promise<Uint8Array>;
|
|
14
|
+
writeBytes(path: string, value: Uint8Array): Promise<void>;
|
|
15
|
+
list(pattern?: string): Promise<ArtifactFile[]>;
|
|
16
|
+
listDirs(path?: string): Promise<string[]>;
|
|
17
|
+
delete(path: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare const assertSafePathSegment: (value: string) => void;
|
|
21
|
+
|
|
22
|
+
export declare const createDraftLayout: (root: string, document: string) => {
|
|
23
|
+
directory: (name: string) => string;
|
|
24
|
+
markdown: (name: string, suffix?: string) => string;
|
|
25
|
+
files: (name: string, suffix?: string) => string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export declare const findClosingFrontmatterDelimiter: (content: string) => {
|
|
29
|
+
end: number;
|
|
30
|
+
start: number;
|
|
31
|
+
} | null;
|
|
32
|
+
|
|
33
|
+
export declare const quoteYamlScalar: (value: string) => string;
|
|
34
|
+
|
|
35
|
+
export declare const requireRepoFiles: (repoFiles: ArtifactMount | undefined) => ArtifactMount;
|
|
36
|
+
|
|
37
|
+
export declare const resolveByIdOrName: <TItem extends {
|
|
38
|
+
id: string;
|
|
39
|
+
}>(items: TItem[], value: string, nameOf: (item: TItem) => string, label: string) => string;
|
|
40
|
+
|
|
41
|
+
export declare const sameName: (a: string, b: string) => boolean;
|
|
42
|
+
|
|
43
|
+
export declare const stripFrontmatter: (content: string) => string;
|
|
44
|
+
|
|
45
|
+
export declare const unquoteYamlScalar: (value: string) => string;
|
|
46
|
+
|
|
47
|
+
export { }
|
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"];
|
|
@@ -215,7 +200,7 @@ var WEBVIEW_HOST_CAPABILITIES = [
|
|
|
215
200
|
...ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
|
|
216
201
|
];
|
|
217
202
|
// package.json
|
|
218
|
-
var version = "0.
|
|
203
|
+
var version = "0.24.1";
|
|
219
204
|
|
|
220
205
|
// src/version.ts
|
|
221
206
|
var SDK_VERSION = version;
|
|
@@ -414,11 +399,11 @@ var normalizedSection = (value) => {
|
|
|
414
399
|
}
|
|
415
400
|
return {
|
|
416
401
|
anchors: anchors.map((anchor) => {
|
|
417
|
-
const
|
|
402
|
+
const value = anchor;
|
|
418
403
|
return {
|
|
419
|
-
id:
|
|
420
|
-
heading:
|
|
421
|
-
...
|
|
404
|
+
id: value.id,
|
|
405
|
+
heading: value.heading,
|
|
406
|
+
...value.occurrence !== undefined ? { occurrence: value.occurrence } : {}
|
|
422
407
|
};
|
|
423
408
|
})
|
|
424
409
|
};
|
|
@@ -652,10 +637,10 @@ var createWebviewClient = (host, options) => {
|
|
|
652
637
|
if (!extensionId) {
|
|
653
638
|
throw new Error("The host bridge did not provide an extension id. Pass { extensionId } to createWebviewClient.");
|
|
654
639
|
}
|
|
655
|
-
const runCommand = async (commandKey,
|
|
640
|
+
const runCommand = async (commandKey, params) => {
|
|
656
641
|
const response = await host.call("commands.execute", {
|
|
657
642
|
commandId: `${extensionId}.command.${commandKey}`,
|
|
658
|
-
params
|
|
643
|
+
params
|
|
659
644
|
});
|
|
660
645
|
return unwrapCommandOutcome(response);
|
|
661
646
|
};
|
|
@@ -663,7 +648,7 @@ var createWebviewClient = (host, options) => {
|
|
|
663
648
|
get: (_target, commandKey) => {
|
|
664
649
|
if (typeof commandKey !== "string")
|
|
665
650
|
return;
|
|
666
|
-
return (
|
|
651
|
+
return (params) => runCommand(commandKey, params);
|
|
667
652
|
}
|
|
668
653
|
});
|
|
669
654
|
const settings = {
|
|
@@ -692,90 +677,94 @@ var matchesResourceWhen = (when, resourceType) => {
|
|
|
692
677
|
return true;
|
|
693
678
|
return resourceType ? resourceTypes.some((candidate) => (typeof candidate === "string" ? candidate : candidate.id) === resourceType) : false;
|
|
694
679
|
};
|
|
680
|
+
|
|
681
|
+
// src/extensions/index.ts
|
|
682
|
+
var projectPrefix = () => ({ $prefix: "project" });
|
|
695
683
|
export {
|
|
696
|
-
|
|
697
|
-
workspaceSlots,
|
|
698
|
-
workspaceEvents,
|
|
699
|
-
workbenchSlots,
|
|
700
|
-
workbenchResourceKinds,
|
|
701
|
-
workbenchResourceKindDefinitions,
|
|
702
|
-
workbenchPanels,
|
|
703
|
-
workbenchPanelDefinitions,
|
|
704
|
-
workbenchPages,
|
|
705
|
-
workbenchPageDefinitions,
|
|
706
|
-
workbenchModes,
|
|
707
|
-
workbenchModeDefinitions,
|
|
708
|
-
unwrapCommandOutcome,
|
|
709
|
-
sessionSlots,
|
|
710
|
-
sessionEvents,
|
|
711
|
-
serializeWorkbenchPageUrl,
|
|
712
|
-
serializePageUrl,
|
|
713
|
-
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
714
|
-
resourceKey,
|
|
715
|
-
resolveEventReferenceId,
|
|
716
|
-
qualifyRef,
|
|
717
|
-
projectSlots,
|
|
718
|
-
projectEvents,
|
|
719
|
-
parseWorkbenchPageUrl,
|
|
720
|
-
parsePageUrl,
|
|
721
|
-
params,
|
|
722
|
-
packageAsset,
|
|
723
|
-
matchesResourceWhen,
|
|
724
|
-
localContributionIdPattern,
|
|
725
|
-
localContributionIdGrammar,
|
|
726
|
-
l10n,
|
|
727
|
-
isWorkbenchProjectUrl,
|
|
728
|
-
isValidLocalContributionId,
|
|
729
|
-
isLocalizedString,
|
|
730
|
-
gitEvents,
|
|
731
|
-
extensionPanelRegions,
|
|
732
|
-
eventRef,
|
|
733
|
-
dockedWorkbenchRegions,
|
|
734
|
-
defineWorkspaceType,
|
|
735
|
-
defineViewMenu,
|
|
736
|
-
defineView,
|
|
737
|
-
defineTheme,
|
|
738
|
-
defineTemplateType,
|
|
739
|
-
defineTemplate,
|
|
740
|
-
defineStatuses,
|
|
741
|
-
defineStatusBarItem,
|
|
742
|
-
defineSlot,
|
|
743
|
-
defineSkill,
|
|
744
|
-
defineSettingsSection,
|
|
745
|
-
defineSettingsPanel,
|
|
746
|
-
defineSchedule,
|
|
747
|
-
defineResourceKind,
|
|
748
|
-
defineResourceHierarchyProvider,
|
|
749
|
-
definePlacement,
|
|
750
|
-
definePage,
|
|
751
|
-
defineNavigationTree,
|
|
752
|
-
defineNavigationItem,
|
|
753
|
-
defineMode,
|
|
754
|
-
defineMiddleware,
|
|
755
|
-
defineKeybinding,
|
|
756
|
-
defineHook,
|
|
757
|
-
defineHarness,
|
|
758
|
-
defineFileIconTheme,
|
|
759
|
-
defineExtensionView,
|
|
760
|
-
defineExtension,
|
|
761
|
-
defineConnection,
|
|
762
|
-
defineCommandPaletteResource,
|
|
763
|
-
defineCommand,
|
|
764
|
-
defineArtifactMount,
|
|
765
|
-
defineActivityItem,
|
|
766
|
-
defaultPageResourceCodec,
|
|
767
|
-
createWebviewClient,
|
|
768
|
-
createTerminalSessionBridge,
|
|
769
|
-
commandRef,
|
|
770
|
-
commandEvent,
|
|
771
|
-
artifactsRead,
|
|
772
|
-
artifactMountId,
|
|
773
|
-
WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
774
|
-
WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
775
|
-
WEBVIEW_HOST_CAPABILITIES,
|
|
776
|
-
WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
777
|
-
SDK_VERSION,
|
|
778
|
-
EXTENSION_EVENTS_SCOPE,
|
|
684
|
+
ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES,
|
|
779
685
|
EXTENSION_API_VERSION,
|
|
780
|
-
|
|
686
|
+
EXTENSION_EVENTS_SCOPE,
|
|
687
|
+
SDK_VERSION,
|
|
688
|
+
WEBVIEW_DECLARABLE_CAPABILITIES,
|
|
689
|
+
WEBVIEW_HOST_CAPABILITIES,
|
|
690
|
+
WEBVIEW_HOST_CAPABILITY_VERSION,
|
|
691
|
+
WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES,
|
|
692
|
+
artifactMountId,
|
|
693
|
+
artifactsRead,
|
|
694
|
+
commandEvent,
|
|
695
|
+
commandRef,
|
|
696
|
+
createTerminalSessionBridge,
|
|
697
|
+
createWebviewClient,
|
|
698
|
+
defaultPageResourceCodec,
|
|
699
|
+
defineActivityItem,
|
|
700
|
+
defineArtifactMount,
|
|
701
|
+
defineCommand,
|
|
702
|
+
defineCommandPaletteResource,
|
|
703
|
+
defineConnection,
|
|
704
|
+
defineExtension,
|
|
705
|
+
defineExtensionView,
|
|
706
|
+
defineFileIconTheme,
|
|
707
|
+
defineHarness,
|
|
708
|
+
defineHook,
|
|
709
|
+
defineKeybinding,
|
|
710
|
+
defineMiddleware,
|
|
711
|
+
defineMode,
|
|
712
|
+
defineNavigationItem,
|
|
713
|
+
defineNavigationTree,
|
|
714
|
+
definePage,
|
|
715
|
+
definePlacement,
|
|
716
|
+
defineResourceHierarchyProvider,
|
|
717
|
+
defineResourceKind,
|
|
718
|
+
defineSchedule,
|
|
719
|
+
defineSettingsPanel,
|
|
720
|
+
defineSettingsSection,
|
|
721
|
+
defineSkill,
|
|
722
|
+
defineSlot,
|
|
723
|
+
defineStatusBarItem,
|
|
724
|
+
defineStatuses,
|
|
725
|
+
defineTemplate,
|
|
726
|
+
defineTemplateType,
|
|
727
|
+
defineTheme,
|
|
728
|
+
defineView,
|
|
729
|
+
defineViewMenu,
|
|
730
|
+
defineWorkspaceType,
|
|
731
|
+
dockedWorkbenchRegions,
|
|
732
|
+
eventRef,
|
|
733
|
+
extensionPanelRegions,
|
|
734
|
+
gitEvents,
|
|
735
|
+
isLocalizedString,
|
|
736
|
+
isValidLocalContributionId,
|
|
737
|
+
isWorkbenchProjectUrl,
|
|
738
|
+
l10n,
|
|
739
|
+
localContributionIdGrammar,
|
|
740
|
+
localContributionIdPattern,
|
|
741
|
+
matchesResourceWhen,
|
|
742
|
+
packageAsset,
|
|
743
|
+
params,
|
|
744
|
+
parsePageUrl,
|
|
745
|
+
parseWorkbenchPageUrl,
|
|
746
|
+
projectEvents,
|
|
747
|
+
projectPrefix,
|
|
748
|
+
projectSlots,
|
|
749
|
+
qualifyRef,
|
|
750
|
+
resolveEventReferenceId,
|
|
751
|
+
resourceKey,
|
|
752
|
+
resourceMenuSlotRef2 as resourceMenuSlotRef,
|
|
753
|
+
serializePageUrl,
|
|
754
|
+
serializeWorkbenchPageUrl,
|
|
755
|
+
sessionEvents,
|
|
756
|
+
sessionSlots,
|
|
757
|
+
unwrapCommandOutcome,
|
|
758
|
+
workbenchModeDefinitions,
|
|
759
|
+
workbenchModes,
|
|
760
|
+
workbenchPageDefinitions,
|
|
761
|
+
workbenchPages,
|
|
762
|
+
workbenchPanelDefinitions,
|
|
763
|
+
workbenchPanels,
|
|
764
|
+
workbenchResourceKindDefinitions,
|
|
765
|
+
workbenchResourceKinds,
|
|
766
|
+
workbenchSlots,
|
|
767
|
+
workspaceEvents,
|
|
768
|
+
workspaceSlots,
|
|
769
|
+
worktreeEvents
|
|
781
770
|
};
|
|
@@ -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
|
};
|