@vite-hub/workspace 0.0.4 → 0.1.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 +225 -58
- package/dist/{ai-CjxvGqM0.d.ts → ai-BW2ZhizI.d.ts} +22 -7
- package/dist/{ai-BqCC8BpY.js → ai-BZyLwULx.js} +147 -66
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +1 -1
- package/dist/{asset-registry-8QI3ML3K.js → asset-registry-DfBV5kmw.js} +3 -2
- package/dist/association-Cm0dUTDU-CDDhJnIh-Cv3bWnVb.js +19 -0
- package/dist/blob-database.d.ts +521 -0
- package/dist/blob-database.js +601 -0
- package/dist/cloudflare.d.ts +5 -6
- package/dist/cloudflare.js +1 -1
- package/dist/config-B7dmzDX3.js +1112 -0
- package/dist/{config-DE9xlaIw.d.ts → config-DLKdaFWN.d.ts} +1 -2
- package/dist/error-diagnostics-A_8Kp-48.js +116 -0
- package/dist/error-diagnostics-DY5GP47p.js +96 -0
- package/dist/events-7EBoeIPd-A2RUkJi5-BxrICQ17.js +354 -0
- package/dist/events-CRaLy7U3-3PNNp5WZ-Gv9nd0cH.js +214 -0
- package/dist/events-CeChclTf-CX-gD8oy-4aL2j6V-.js +527 -0
- package/dist/feed-DsC7Vws1-M_de2nSK-tKc0Pwo8.js +248 -0
- package/dist/feed-Dyf730Ys-D0HgBba6-BUnCa5gS.js +179 -0
- package/dist/file-C0_aPWSS.js +26 -0
- package/dist/file-metadata-CxDy-E2H.js +58 -0
- package/dist/{files-Q6xZjDHA.js → files-C7Px8uaC.js} +3 -3
- package/dist/forgejo-BN8ItCfl-Bbn4vhDd.js +2278 -0
- package/dist/{github-DHnjxQIX.js → github-CPxHtFB7.js} +16 -23
- package/dist/github-DtncTfmv-Du2S8lGF.js +4159 -0
- package/dist/gitlab-BoDm8-BC-xzZsW9eW.js +2530 -0
- package/dist/glob--XcLlcml.js +22 -0
- package/dist/glob--kNYDbfU.js +30 -0
- package/dist/graphql-DG5aJBT3-DceyFYdM-C4saqX37.js +489 -0
- package/dist/{host-DJH8cuoU.js → host-CFnrTXTK.js} +97 -41
- package/dist/{hosted-RPeJOCFz.js → hosted-acMA5XyL.js} +102 -19
- package/dist/hosted-vercel-blob-DKntsHaf.js +12603 -0
- package/dist/hosted-vercel-blob.d.ts +5 -6
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +6 -7
- package/dist/hosted.js +1 -1
- package/dist/index.d.ts +57 -36
- package/dist/index.js +56 -56
- package/dist/inspect-BoObD2cJ.js +167 -0
- package/dist/internal/path.d.ts +2 -0
- package/dist/internal/path.js +2 -0
- package/dist/lifecycle-BwZ7c9hb.js +596 -0
- package/dist/loader.d.ts +5 -6
- package/dist/loader.js +3 -2
- package/dist/mcp-resources-BREFCmtn.js +39 -0
- package/dist/memory-BbwOqDXl.js +248 -0
- package/dist/metadata-target-DZEZQGHA.js +1588 -0
- package/dist/mountx.d.ts +4 -6
- package/dist/mountx.js +10 -8
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +1 -1
- package/dist/nuxt.d.ts +13 -12
- package/dist/nuxt.js +4 -8
- package/dist/operations-BcpWr41m.js +159 -0
- package/dist/operations-CGqY1XeG.js +965 -0
- package/dist/operations-DnOwKsJT.d.ts +136 -0
- package/dist/operations.d.ts +53 -0
- package/dist/operations.js +2 -0
- package/dist/path-CNAwN7pw.js +114 -0
- package/dist/path-DrSIenjj.js +59 -0
- package/dist/path-zHxQUbqa.d.ts +9 -0
- package/dist/plugins-DqQ8b4T5.d.ts +10 -0
- package/dist/provider-kXjfli9u.js +1457 -0
- package/dist/providers/github/store.d.ts +3 -5
- package/dist/providers/github/store.js +1 -1
- package/dist/{registry-D3yzt8HQ.js → registry-Bp-8UUfG.js} +9 -7
- package/dist/{registry-Uj6IVxes.d.ts → registry-Cg1TJVVZ.d.ts} +1 -2
- package/dist/{request-execution-B-dSFlGB.js → request-execution-Dk9rY-Yh.js} +19 -19
- package/dist/{chunk-2rV9d50f.js → rolldown-runtime-B4iAMlE-.js} +2 -2
- package/dist/runtime/assets.d.ts +3 -5
- package/dist/runtime/assets.js +7 -6
- package/dist/runtime/empty-assets-registry.d.ts +1 -2
- package/dist/runtime/empty-registry.d.ts +1 -2
- package/dist/runtime/state.d.ts +3 -3
- package/dist/runtime/state.js +6 -6
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +51 -17
- package/dist/runtime.js +320 -60
- package/dist/{search-BpiCF2Tw.js → search-CrTmXj5h.js} +10 -9
- package/dist/server-BNQ-Nbjj.js +290 -0
- package/dist/server.d.ts +22 -34
- package/dist/server.js +2 -328
- package/dist/shared-DalXdP0i.js +2158 -0
- package/dist/source-metadata.d.ts +6 -7
- package/dist/source-metadata.js +7 -7
- package/dist/{state-tYcRWEh2.d.ts → state-B8zbLi5t.d.ts} +3 -3
- package/dist/store-CXgmu-uw.js +1729 -0
- package/dist/{sync-DnTQwt8r.js → sync-CN6ec-5M.js} +61 -41
- package/dist/templates-Bn8a-pd2-D9DhJEVD-CBfXNRzz.js +125 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{token-CVzURBxC.js → token-CO62GglH.js} +3 -3
- package/dist/{types-CYuwjJ4V.d.ts → types-DeK9GIxy.d.ts} +256 -24
- package/dist/{use-BTNDR5Rd.js → use-BQj7nSz6.js} +82 -41
- package/dist/{use-BiHzt0xA.d.ts → use-DhwhbAVV.d.ts} +16 -11
- package/dist/utils-Blrh4N2n.js +545 -0
- package/dist/vite-BEvgU2GY.js +20909 -0
- package/dist/vite-CcZmMQ7S.d.ts +476 -0
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +2 -2
- package/dist/webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js +1565 -0
- package/dist/{workspace-Dq08Yn72.js → workspace-6pxkOuxr.js} +361 -230
- package/dist/{workspace-Xddf4G1B.d.ts → workspace-BWJQBK1u.d.ts} +4 -3
- package/package.json +89 -55
- package/dist/collections/client.d.ts +0 -39
- package/dist/collections/client.js +0 -137
- package/dist/collections.d.ts +0 -59
- package/dist/collections.js +0 -159
- package/dist/config-Bc3c4Su1.js +0 -7904
- package/dist/config-CHLLWklZ.js +0 -36
- package/dist/file-Bc1X7pco.js +0 -23
- package/dist/glob-CEZKeZFC.js +0 -18
- package/dist/hosted-vercel-blob-d6C8ND5j.js +0 -23580
- package/dist/lifecycle-LrL3sA4n.js +0 -316
- package/dist/metadata-target-B0tOmVW7.js +0 -717
- package/dist/path-Cp59koVz.js +0 -139
- package/dist/provider-B1yLjCJJ.js +0 -746
- package/dist/publish.d.ts +0 -35
- package/dist/publish.js +0 -112
- package/dist/runtime-options-BsPSv5O7.js +0 -13
- package/dist/runtime-type-iEE6BjQJ.js +0 -34
- package/dist/shared-DTR1Hhma.js +0 -331
- package/dist/store-Dt_Jyys3.js +0 -608
- package/dist/vite-BptCrpv2.js +0 -4526
- package/dist/vite-CtA9guIM.d.ts +0 -66
|
@@ -4,7 +4,6 @@ import { FileSourceOptions } from "@vite-hub/source/file";
|
|
|
4
4
|
import { GitHubSourceOptions } from "@vite-hub/source/github";
|
|
5
5
|
import { GlobSourceOptions } from "@vite-hub/source/glob";
|
|
6
6
|
import { McpResourcesSourceOptions } from "@vite-hub/source/mcp";
|
|
7
|
-
|
|
8
7
|
//#region src/core/types.d.ts
|
|
9
8
|
type WorkspaceContent = string | Uint8Array;
|
|
10
9
|
type WorkspaceContentStream = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
@@ -17,6 +16,7 @@ type ReadFileResult<TOptions extends ReadFileOptions | undefined = undefined> =
|
|
|
17
16
|
interface WriteFileOptions {
|
|
18
17
|
ifDigest?: string | null;
|
|
19
18
|
mediaType?: string;
|
|
19
|
+
/** JSON-safe file attributes. Undefined properties, cycles, class instances, and non-finite numbers are rejected before provider dispatch. */
|
|
20
20
|
metadata?: Record<string, unknown>;
|
|
21
21
|
preservePath?: boolean;
|
|
22
22
|
}
|
|
@@ -26,6 +26,7 @@ interface ListOptions {
|
|
|
26
26
|
recursive?: boolean;
|
|
27
27
|
}
|
|
28
28
|
interface GlobOptions {
|
|
29
|
+
/** Workspace-relative directory to match patterns within. Result paths remain relative to the Workspace root. */
|
|
29
30
|
cwd?: string;
|
|
30
31
|
}
|
|
31
32
|
interface WorkspaceSearchQuery {
|
|
@@ -48,6 +49,8 @@ interface MkdirOptions {
|
|
|
48
49
|
interface RmOptions {
|
|
49
50
|
recursive?: boolean;
|
|
50
51
|
force?: boolean;
|
|
52
|
+
/** Remove only when the current file digest matches. */
|
|
53
|
+
ifDigest?: string | null;
|
|
51
54
|
}
|
|
52
55
|
type WorkspaceWriteOperation = "writeFile" | "mkdir" | "rm";
|
|
53
56
|
type WorkspaceWriteMode = boolean | "create" | "update" | "delete";
|
|
@@ -55,6 +58,8 @@ interface WorkspaceWriteInput {
|
|
|
55
58
|
workspace: string;
|
|
56
59
|
operation: WorkspaceWriteOperation;
|
|
57
60
|
path: string;
|
|
61
|
+
/** The history ref of a history commit, such as `draft`. Undefined for writes to the working tree. */
|
|
62
|
+
ref?: string;
|
|
58
63
|
content?: WorkspaceContent;
|
|
59
64
|
mediaType?: string;
|
|
60
65
|
metadata?: Record<string, unknown>;
|
|
@@ -96,9 +101,6 @@ interface WorkspacePlugin {
|
|
|
96
101
|
interface SnapshotOptions {
|
|
97
102
|
name?: string;
|
|
98
103
|
}
|
|
99
|
-
interface WorkspacePublishOptions {
|
|
100
|
-
name?: string;
|
|
101
|
-
}
|
|
102
104
|
interface DiffOptions {
|
|
103
105
|
from?: WorkspaceSnapshot;
|
|
104
106
|
}
|
|
@@ -109,7 +111,6 @@ interface WorkspaceSyncSnapshotOptions extends SnapshotOptions {
|
|
|
109
111
|
}
|
|
110
112
|
interface WorkspaceSyncOptions {
|
|
111
113
|
details?: WorkspaceSyncResultDetails;
|
|
112
|
-
publish?: boolean;
|
|
113
114
|
publishPartial?: boolean;
|
|
114
115
|
snapshot?: boolean | WorkspaceSyncSnapshotOptions;
|
|
115
116
|
sources: WorkspaceSourceSelection;
|
|
@@ -117,6 +118,12 @@ interface WorkspaceSyncOptions {
|
|
|
117
118
|
interface WorkspaceSessionOptions {
|
|
118
119
|
abortSignal?: AbortSignal;
|
|
119
120
|
attach?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Set when the caller owns `target` and deletes it after `close()`.
|
|
123
|
+
* A hosted Session then leaves the target as it is on close and on failed setup.
|
|
124
|
+
* It does not restore the Workspace tree or excluded paths there. Commits are unchanged.
|
|
125
|
+
*/
|
|
126
|
+
disposableTarget?: boolean;
|
|
120
127
|
host?: WorkspaceSessionHost;
|
|
121
128
|
materializeSources?: false;
|
|
122
129
|
onProgress?: (event: WorkspacePrepareSessionProgressEvent) => void | Promise<void>;
|
|
@@ -159,6 +166,8 @@ interface WorkspaceSessionHostFiles {
|
|
|
159
166
|
interface WorkspaceSessionHost {
|
|
160
167
|
readonly executionAuthority: ExecutionAuthority;
|
|
161
168
|
readonly inspectionConcurrency?: number;
|
|
169
|
+
/** Maximum independent workspace files copied into this host concurrently. Defaults to 1. */
|
|
170
|
+
readonly materializationConcurrency?: number;
|
|
162
171
|
detachAbortSignal?(): void;
|
|
163
172
|
files: WorkspaceSessionHostFiles;
|
|
164
173
|
exec(command: string, args?: readonly string[], options?: {
|
|
@@ -234,12 +243,14 @@ interface WorkspaceFile {
|
|
|
234
243
|
path: string;
|
|
235
244
|
content: WorkspaceContent;
|
|
236
245
|
mediaType?: string;
|
|
246
|
+
/** JSON-safe file attributes: plain objects, dense arrays, strings, booleans, null, and finite numbers except negative zero. `source` is reserved for a string Source name. */
|
|
237
247
|
metadata?: Record<string, unknown>;
|
|
238
248
|
}
|
|
239
249
|
interface WorkspaceStreamFile {
|
|
240
250
|
path: string;
|
|
241
251
|
content: WorkspaceContentStream;
|
|
242
252
|
mediaType?: string;
|
|
253
|
+
/** JSON-safe file attributes: plain objects, dense arrays, strings, booleans, null, and finite numbers except negative zero. `source` is reserved for a string Source name. */
|
|
243
254
|
metadata?: Record<string, unknown>;
|
|
244
255
|
}
|
|
245
256
|
interface WorkspaceEntry {
|
|
@@ -252,6 +263,8 @@ interface WorkspaceEntry {
|
|
|
252
263
|
digest?: string;
|
|
253
264
|
}
|
|
254
265
|
interface WorkspaceStat extends WorkspaceEntry {
|
|
266
|
+
/** Opaque stored-file version. Must change on modification or recreation, even when bytes are unchanged. */
|
|
267
|
+
revision?: string;
|
|
255
268
|
type: "file" | "directory";
|
|
256
269
|
}
|
|
257
270
|
interface WorkspaceSnapshot {
|
|
@@ -265,6 +278,205 @@ interface WorkspaceSnapshot {
|
|
|
265
278
|
size?: number;
|
|
266
279
|
}>;
|
|
267
280
|
}
|
|
281
|
+
interface WorkspaceRevision {
|
|
282
|
+
id: string;
|
|
283
|
+
/** The history ref this revision was committed to. */
|
|
284
|
+
ref: string;
|
|
285
|
+
parentId: string | null;
|
|
286
|
+
createdAt: string;
|
|
287
|
+
message?: string;
|
|
288
|
+
metadata?: Record<string, unknown>;
|
|
289
|
+
files: number;
|
|
290
|
+
bytes: number;
|
|
291
|
+
}
|
|
292
|
+
interface WorkspaceHistoryRefOptions {
|
|
293
|
+
/** Named history line inside the Workspace. Defaults to `main`. */
|
|
294
|
+
ref?: string;
|
|
295
|
+
}
|
|
296
|
+
/** File content with optional stored attributes. Plain content infers the media type from the path. */
|
|
297
|
+
interface WorkspaceHistoryFileInput {
|
|
298
|
+
content: WorkspaceContent;
|
|
299
|
+
mediaType?: string;
|
|
300
|
+
metadata?: Record<string, unknown>;
|
|
301
|
+
}
|
|
302
|
+
type WorkspaceHistoryFile = WorkspaceContent | WorkspaceHistoryFileInput;
|
|
303
|
+
interface WorkspaceHistoryChanges {
|
|
304
|
+
/** Files to add or replace on top of the ref head. */
|
|
305
|
+
put?: Record<string, WorkspaceHistoryFile>;
|
|
306
|
+
/** Files to remove from the ref head. Each path must exist in the head. */
|
|
307
|
+
delete?: string[];
|
|
308
|
+
}
|
|
309
|
+
interface WorkspaceHistoryCommitBase extends WorkspaceHistoryRefOptions {
|
|
310
|
+
/** The expected head of `ref`. Use null for the first revision on the ref. */
|
|
311
|
+
ifHead: string | null;
|
|
312
|
+
/** Expected heads of other refs that must remain unchanged for the commit. */
|
|
313
|
+
ifHeads?: Record<string, string | null>;
|
|
314
|
+
/**
|
|
315
|
+
* With `ifHead: null`, start the new ref from this revision instead of from the ref that `history.forksFrom(ref)`
|
|
316
|
+
* names. Only Stores with `forksFrom` accept it. The caller has read the files of that revision.
|
|
317
|
+
*/
|
|
318
|
+
startFrom?: string;
|
|
319
|
+
message?: string;
|
|
320
|
+
metadata?: Record<string, unknown>;
|
|
321
|
+
}
|
|
322
|
+
interface WorkspaceHistoryFilesCommitOptions extends WorkspaceHistoryCommitBase {
|
|
323
|
+
/** The complete desired file set. Omitted paths are deleted. */
|
|
324
|
+
files: Record<string, WorkspaceHistoryFile>;
|
|
325
|
+
changes?: never;
|
|
326
|
+
}
|
|
327
|
+
interface WorkspaceHistoryChangesCommitOptions extends WorkspaceHistoryCommitBase {
|
|
328
|
+
/** A patch applied to the ref head. Unlisted paths keep their content. */
|
|
329
|
+
changes: WorkspaceHistoryChanges;
|
|
330
|
+
files?: never;
|
|
331
|
+
}
|
|
332
|
+
type WorkspaceHistoryCommitOptions = WorkspaceHistoryFilesCommitOptions | WorkspaceHistoryChangesCommitOptions;
|
|
333
|
+
/** Store commits receive normalized files after rules, validators, hooks, and Source grants pass. */
|
|
334
|
+
type WorkspaceStoreHistoryCommitOptions = WorkspaceHistoryCommitBase & ({
|
|
335
|
+
files: Record<string, WorkspaceFile>;
|
|
336
|
+
changes?: never;
|
|
337
|
+
} | {
|
|
338
|
+
changes: {
|
|
339
|
+
put?: Record<string, WorkspaceFile>;
|
|
340
|
+
delete?: string[];
|
|
341
|
+
};
|
|
342
|
+
files?: never;
|
|
343
|
+
});
|
|
344
|
+
interface WorkspaceHistoryListOptions extends WorkspaceHistoryRefOptions {
|
|
345
|
+
cursor?: string;
|
|
346
|
+
limit?: number;
|
|
347
|
+
/** Return revisions whose file manifest changed at this file or folder path. */
|
|
348
|
+
path?: string;
|
|
349
|
+
}
|
|
350
|
+
interface WorkspaceHistoryListResult {
|
|
351
|
+
revisions: WorkspaceRevision[];
|
|
352
|
+
cursor?: string;
|
|
353
|
+
}
|
|
354
|
+
interface WorkspaceHistoryRef {
|
|
355
|
+
name: string;
|
|
356
|
+
head: WorkspaceRevision;
|
|
357
|
+
}
|
|
358
|
+
interface WorkspaceRevisionView {
|
|
359
|
+
readonly revision: WorkspaceRevision;
|
|
360
|
+
/** File digests, when provided, are the digests of the retained bytes: SHA-256, or the Git blob sha for the GitHub Store. Compute one with `history.digest`. */
|
|
361
|
+
list(path?: string, options?: ListOptions): Promise<WorkspaceEntry[]>;
|
|
362
|
+
stat(path: string): Promise<WorkspaceStat>;
|
|
363
|
+
readFile<TOptions extends ReadFileOptions | undefined = undefined>(path: string, options?: TOptions): Promise<ReadFileResult<TOptions>>;
|
|
364
|
+
}
|
|
365
|
+
/** An open pull request on a forge, for a Store whose refs are branches. */
|
|
366
|
+
interface WorkspacePullRequest {
|
|
367
|
+
number: number;
|
|
368
|
+
url: string;
|
|
369
|
+
title: string;
|
|
370
|
+
/** The ref of the branch that the pull request merges. */
|
|
371
|
+
head: string;
|
|
372
|
+
/** The ref that it merges into. */
|
|
373
|
+
base: string;
|
|
374
|
+
/** Common ancestor of the head and base, for comparing all changes in the pull request. */
|
|
375
|
+
mergeBase?: string;
|
|
376
|
+
}
|
|
377
|
+
interface WorkspaceOpenPullRequestOptions {
|
|
378
|
+
/** The ref to merge. */
|
|
379
|
+
head: string;
|
|
380
|
+
/** The ref to merge into. */
|
|
381
|
+
base: string;
|
|
382
|
+
title: string;
|
|
383
|
+
body?: string;
|
|
384
|
+
draft?: boolean;
|
|
385
|
+
/** Delete the head ref after GitHub definitively rejects the pull request. Unknown outcomes keep it for recovery. */
|
|
386
|
+
deleteHeadOnFailure?: boolean;
|
|
387
|
+
/** Exclude overlapping open PRs across Store instances. Ambiguous requests retain their reservations until reconciled. */
|
|
388
|
+
reservation?: {
|
|
389
|
+
headPrefix: string;
|
|
390
|
+
paths: string[];
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/** A file that both refs changed in different ways. Digests are the Store's (`history.digest`); null means deleted. */
|
|
394
|
+
interface WorkspaceMergeConflict {
|
|
395
|
+
/** The Workspace path. */
|
|
396
|
+
path: string;
|
|
397
|
+
/** The digest on the ref that receives the merge. */
|
|
398
|
+
ours: string | null;
|
|
399
|
+
/** The digest on the ref that is merged in. */
|
|
400
|
+
theirs: string | null;
|
|
401
|
+
/** The digest at the merge base of both refs. Null when the file did not exist there. */
|
|
402
|
+
base: string | null;
|
|
403
|
+
}
|
|
404
|
+
/** What `onConflict` can use while it resolves conflicts. */
|
|
405
|
+
interface WorkspaceMergeConflictContext {
|
|
406
|
+
/** Reads the bytes of a digest that a conflict names. */
|
|
407
|
+
read(digest: string): Promise<Uint8Array>;
|
|
408
|
+
}
|
|
409
|
+
/** What `onConflict` decided. */
|
|
410
|
+
interface WorkspaceMergeResolution {
|
|
411
|
+
/** Metadata for the merge commit. It is added to `metadata`. */
|
|
412
|
+
metadata?: Record<string, unknown>;
|
|
413
|
+
/**
|
|
414
|
+
* Merged text of conflicting files, by Workspace path. The merge commit writes it instead of the receiving ref's
|
|
415
|
+
* version. A path that is not one of the conflicts throws.
|
|
416
|
+
*/
|
|
417
|
+
files?: Record<string, string>;
|
|
418
|
+
}
|
|
419
|
+
interface WorkspaceMergeOptions {
|
|
420
|
+
/**
|
|
421
|
+
* Called when the Store's own merge conflicts. With it, the Store merges everything else and calls this with the
|
|
422
|
+
* files that both refs changed. Each file keeps the receiving ref's version unless the resolution gives its merged
|
|
423
|
+
* text. Without it, a conflict throws `WORKSPACE_CONFLICT`.
|
|
424
|
+
*/
|
|
425
|
+
onConflict?(conflicts: WorkspaceMergeConflict[], context: WorkspaceMergeConflictContext): WorkspaceMergeResolution | Promise<WorkspaceMergeResolution>;
|
|
426
|
+
/** The ref to bring in. */
|
|
427
|
+
from: string;
|
|
428
|
+
/** The ref that receives the merge. */
|
|
429
|
+
into: string;
|
|
430
|
+
/** The message of the merge commit. */
|
|
431
|
+
message?: string;
|
|
432
|
+
/** Revision metadata, kept like the metadata of a commit. */
|
|
433
|
+
metadata?: Record<string, unknown>;
|
|
434
|
+
}
|
|
435
|
+
interface WorkspaceHistoryReader {
|
|
436
|
+
/**
|
|
437
|
+
* The open pull requests whose head ref starts with `headPrefix`, newest first, for a Store that has them. The GitHub
|
|
438
|
+
* Store finds the branches with that prefix first, so it requires `headPrefix`.
|
|
439
|
+
*/
|
|
440
|
+
pullRequests?(options?: {
|
|
441
|
+
headPrefix?: string;
|
|
442
|
+
}): Promise<WorkspacePullRequest[]>;
|
|
443
|
+
/**
|
|
444
|
+
* The digest of file bytes, as `WorkspaceEntry.digest` reports it for this Store: SHA-256 by default, the Git blob sha
|
|
445
|
+
* for the GitHub Store. Compare digests only with this function.
|
|
446
|
+
*/
|
|
447
|
+
digest?(bytes: Uint8Array): Promise<string>;
|
|
448
|
+
/**
|
|
449
|
+
* The ref that a missing `ref` starts from when a commit creates it with `ifHead: null`, or undefined when the ref
|
|
450
|
+
* starts empty. The GitHub Store starts `draft` from the head of `published`.
|
|
451
|
+
*/
|
|
452
|
+
forksFrom?(ref: string): Promise<string | undefined>;
|
|
453
|
+
head(options?: WorkspaceHistoryRefOptions): Promise<WorkspaceRevision | null>;
|
|
454
|
+
list(options?: WorkspaceHistoryListOptions): Promise<WorkspaceHistoryListResult>;
|
|
455
|
+
/** Refs that have at least one revision, sorted by name. */
|
|
456
|
+
refs(): Promise<WorkspaceHistoryRef[]>;
|
|
457
|
+
open(id: string): Promise<WorkspaceRevisionView>;
|
|
458
|
+
/** Unique uncompressed file bytes retained across committed revisions on every ref. */
|
|
459
|
+
usage(): Promise<{
|
|
460
|
+
bytes: number;
|
|
461
|
+
objects: number;
|
|
462
|
+
}>;
|
|
463
|
+
}
|
|
464
|
+
/** Writes that only some Stores have. A Store without them leaves the members out. */
|
|
465
|
+
interface WorkspaceHistoryExtensions {
|
|
466
|
+
/** Merge `from` into `into` with a merge commit. Returns null when `into` already has everything in `from`. A merge that conflicts throws `WORKSPACE_CONFLICT`. */
|
|
467
|
+
merge?(options: WorkspaceMergeOptions): Promise<WorkspaceRevision | null>;
|
|
468
|
+
/** Open a pull request from one ref into another. */
|
|
469
|
+
openPullRequest?(options: WorkspaceOpenPullRequestOptions): Promise<WorkspacePullRequest>;
|
|
470
|
+
}
|
|
471
|
+
interface WorkspaceRetainedHistory extends WorkspaceHistoryReader, WorkspaceHistoryExtensions {
|
|
472
|
+
commit(options: WorkspaceHistoryCommitOptions): Promise<WorkspaceRevision>;
|
|
473
|
+
}
|
|
474
|
+
/** Run the Workspace commit policy on a prepared merge before the Store advances its destination ref. */
|
|
475
|
+
type WorkspaceMergeCommit = (options: WorkspaceStoreHistoryCommitOptions, apply: (checked: WorkspaceStoreHistoryCommitOptions) => Promise<WorkspaceRevision>) => Promise<WorkspaceRevision>;
|
|
476
|
+
interface WorkspaceStoreHistory extends WorkspaceHistoryReader, Omit<WorkspaceHistoryExtensions, "merge"> {
|
|
477
|
+
merge?(options: WorkspaceMergeOptions, commit?: WorkspaceMergeCommit): Promise<WorkspaceRevision | null>;
|
|
478
|
+
commit(options: WorkspaceStoreHistoryCommitOptions): Promise<WorkspaceRevision>;
|
|
479
|
+
}
|
|
268
480
|
interface WorkspaceDiffEntry {
|
|
269
481
|
path: string;
|
|
270
482
|
type: "added" | "modified" | "removed";
|
|
@@ -284,6 +496,7 @@ interface WorkspaceRebaseOptions {
|
|
|
284
496
|
takeRemote?: string[];
|
|
285
497
|
}
|
|
286
498
|
interface WorkspaceStore {
|
|
499
|
+
history?: WorkspaceStoreHistory;
|
|
287
500
|
readFile(path: string): Promise<WorkspaceFile | undefined>;
|
|
288
501
|
writeFile(path: string, file: WorkspaceFile): Promise<void>;
|
|
289
502
|
writeFileConditional?(path: string, file: WorkspaceFile, ifDigest: string | null): Promise<void>;
|
|
@@ -295,11 +508,12 @@ interface WorkspaceStore {
|
|
|
295
508
|
stat(path: string): Promise<WorkspaceStat | undefined>;
|
|
296
509
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
297
510
|
rm(path: string, options?: RmOptions): Promise<void>;
|
|
511
|
+
removeEmptyDirectory?(path: string): Promise<void>;
|
|
298
512
|
snapshot(options?: SnapshotOptions): Promise<WorkspaceSnapshot>;
|
|
299
513
|
rebase?(options?: WorkspaceRebaseOptions): Promise<void>;
|
|
300
514
|
diff(options?: DiffOptions): Promise<WorkspaceDiff>;
|
|
301
515
|
getMeta?(key: string): Promise<unknown>;
|
|
302
|
-
setMeta?(key: string, value: unknown): Promise<void>;
|
|
516
|
+
setMeta?(key: string, value: unknown, capability?: symbol): Promise<void>;
|
|
303
517
|
}
|
|
304
518
|
interface SourceContextWorkspaceFiles {
|
|
305
519
|
readFile<TOptions extends ReadFileOptions | undefined = undefined>(path: string, options?: TOptions): Promise<ReadFileResult<TOptions>>;
|
|
@@ -395,6 +609,8 @@ interface WorkspaceSourceRequestDescriptor {
|
|
|
395
609
|
}
|
|
396
610
|
interface WorkspaceSourceRequestExecutionInput {
|
|
397
611
|
body?: unknown;
|
|
612
|
+
/** Abort a controlled request when its owning Shell invocation ends. */
|
|
613
|
+
signal?: AbortSignal;
|
|
398
614
|
method: WorkspaceSourceRequestMethod;
|
|
399
615
|
url: string;
|
|
400
616
|
}
|
|
@@ -483,19 +699,6 @@ interface WorkspaceLoader {
|
|
|
483
699
|
schema?: unknown;
|
|
484
700
|
load(ctx: LoaderContext): Promise<void>;
|
|
485
701
|
}
|
|
486
|
-
interface PublishContext {
|
|
487
|
-
abortSignal?: AbortSignal;
|
|
488
|
-
durable: boolean;
|
|
489
|
-
workspace: WorkspaceDefinition;
|
|
490
|
-
store: WorkspaceStore;
|
|
491
|
-
rootDir: string;
|
|
492
|
-
snapshot?: WorkspaceSnapshot;
|
|
493
|
-
}
|
|
494
|
-
interface WorkspacePublisher {
|
|
495
|
-
name: string;
|
|
496
|
-
clientSafe?: boolean;
|
|
497
|
-
publish(ctx: PublishContext): Promise<void>;
|
|
498
|
-
}
|
|
499
702
|
interface Logger {
|
|
500
703
|
debug(...args: unknown[]): void;
|
|
501
704
|
info(...args: unknown[]): void;
|
|
@@ -503,6 +706,17 @@ interface Logger {
|
|
|
503
706
|
error(...args: unknown[]): void;
|
|
504
707
|
}
|
|
505
708
|
interface LocalWorkspaceStoreOptions {
|
|
709
|
+
/**
|
|
710
|
+
* `"git"` hides `.git` and paths that Git ignores, such as dependencies and build output, from
|
|
711
|
+
* listings, snapshots, and diffs. The root must be a Git checkout.
|
|
712
|
+
*/
|
|
713
|
+
ignore?: "git";
|
|
714
|
+
/**
|
|
715
|
+
* Path lock scope. `"filesystem"` (default) coordinates every process that shares the root
|
|
716
|
+
* through lock directories under `.vitehub/locks`. `"process"` keeps the same per-path read and
|
|
717
|
+
* write locks in memory. Use it only when one process owns the root.
|
|
718
|
+
*/
|
|
719
|
+
locks?: "filesystem" | "process";
|
|
506
720
|
provider?: "local";
|
|
507
721
|
root?: string;
|
|
508
722
|
}
|
|
@@ -520,15 +734,34 @@ interface CloudflareArtifactsWorkspaceStoreOptions {
|
|
|
520
734
|
interface VercelBlobWorkspaceStoreOptions {
|
|
521
735
|
provider: "vercel-blob";
|
|
522
736
|
token?: string;
|
|
737
|
+
/**
|
|
738
|
+
* A namespace under `_vitehub/workspaces/`. For example, `handbook`
|
|
739
|
+
* stores Workspace files under `_vitehub/workspaces/handbook/`.
|
|
740
|
+
*/
|
|
523
741
|
prefix?: string;
|
|
524
742
|
access?: "private" | "public";
|
|
525
743
|
}
|
|
526
744
|
type GitHubWorkspaceOption = string | (() => string | undefined);
|
|
745
|
+
/**
|
|
746
|
+
* Branch names for the history refs `published` and `draft`. A history call on `published` reads or writes
|
|
747
|
+
* `refs.published`, and revisions on that branch report the ref `published`. A ref without an alias is its own branch name.
|
|
748
|
+
*/
|
|
749
|
+
interface GitHubWorkspaceRefs {
|
|
750
|
+
published?: string;
|
|
751
|
+
draft?: string;
|
|
752
|
+
}
|
|
527
753
|
interface GitHubWorkspaceStoreOptions {
|
|
528
754
|
provider: "github";
|
|
529
755
|
branch?: GitHubWorkspaceOption;
|
|
756
|
+
/**
|
|
757
|
+
* An opaque value that the store target carries for consumers that keep their own rows next to the Workspace, such as a
|
|
758
|
+
* Drizzle Database. The store does not use it.
|
|
759
|
+
*/
|
|
760
|
+
database?: unknown;
|
|
761
|
+
refs?: GitHubWorkspaceRefs;
|
|
530
762
|
repo?: GitHubWorkspaceOption;
|
|
531
763
|
repository?: GitHubWorkspaceOption;
|
|
764
|
+
/** The folder of the Workspace in the repository. An empty string is the repository root. Defaults to `.vitehub/workspaces/<workspace>`. */
|
|
532
765
|
root?: GitHubWorkspaceOption;
|
|
533
766
|
token?: GitHubWorkspaceOption;
|
|
534
767
|
}
|
|
@@ -542,7 +775,6 @@ interface WorkspaceDefinition {
|
|
|
542
775
|
bindings?: Record<string, WorkspaceInstructionBinding>;
|
|
543
776
|
sources?: Record<string, WorkspaceSourceInput>;
|
|
544
777
|
loaders?: WorkspaceLoader[];
|
|
545
|
-
publish?: WorkspacePublisher[];
|
|
546
778
|
plugins?: WorkspacePlugin[];
|
|
547
779
|
rules?: WorkspaceRules;
|
|
548
780
|
hooks?: WorkspaceHooks;
|
|
@@ -563,14 +795,16 @@ interface ResolvedWorkspaceModuleOptions {
|
|
|
563
795
|
}
|
|
564
796
|
interface WorkspaceCapabilities {
|
|
565
797
|
conditionalWrites: boolean;
|
|
798
|
+
retainedHistory?: boolean;
|
|
566
799
|
}
|
|
567
800
|
interface Workspace {
|
|
568
801
|
name: string;
|
|
802
|
+
history: WorkspaceRetainedHistory;
|
|
569
803
|
capabilities?(): Promise<WorkspaceCapabilities>;
|
|
570
804
|
sync(options: WorkspaceSyncOptions): Promise<WorkspaceSourceSyncResult>;
|
|
571
805
|
materializeSources?(options?: WorkspaceMaterializeSourcesOptions): Promise<WorkspaceMaterializeSourcesResult>;
|
|
572
806
|
getMeta?(key: string): Promise<unknown>;
|
|
573
|
-
setMeta?(key: string, value: unknown): Promise<void>;
|
|
807
|
+
setMeta?(key: string, value: unknown, capability?: symbol): Promise<void>;
|
|
574
808
|
readFile<TOptions extends ReadFileOptions | undefined = undefined>(path: string, options?: TOptions): Promise<ReadFileResult<TOptions>>;
|
|
575
809
|
writeFile(path: string, content: WorkspaceContent, options?: WriteFileOptions): Promise<string>;
|
|
576
810
|
list(path?: string, options?: ListOptions): Promise<WorkspaceEntry[]>;
|
|
@@ -580,7 +814,6 @@ interface Workspace {
|
|
|
580
814
|
exists(path: string): Promise<boolean>;
|
|
581
815
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
582
816
|
rm(path: string, options?: RmOptions): Promise<void>;
|
|
583
|
-
publish(options?: WorkspacePublishOptions): Promise<void>;
|
|
584
817
|
snapshot(options?: SnapshotOptions): Promise<WorkspaceSnapshot>;
|
|
585
818
|
rebase(options?: WorkspaceRebaseOptions): Promise<void>;
|
|
586
819
|
diff(options?: DiffOptions): Promise<WorkspaceDiff>;
|
|
@@ -607,7 +840,6 @@ interface WorkspaceSourceSyncStatus {
|
|
|
607
840
|
}
|
|
608
841
|
interface WorkspaceSourceSyncResult {
|
|
609
842
|
durationMs: number;
|
|
610
|
-
published: boolean;
|
|
611
843
|
snapshot?: WorkspaceSnapshot;
|
|
612
844
|
sources: WorkspaceSourceSyncStatus[];
|
|
613
845
|
status: "error" | "partial" | "ready" | "skipped";
|
|
@@ -676,4 +908,4 @@ interface WorkspaceMaterializeSourcesResult {
|
|
|
676
908
|
sources: WorkspaceSourceMaterializationStatus[];
|
|
677
909
|
}
|
|
678
910
|
//#endregion
|
|
679
|
-
export {
|
|
911
|
+
export { WorkspaceHistoryFilesCommitOptions as $, WorkspaceSourceMount as $t, WorkspaceCacheOptions as A, WorkspaceWriteHook as An, WorkspaceRevision as At, WorkspaceFetchSourceInput as B, WorkspaceSessionHostFileEntry as Bt, SourceContextWorkspaceFiles as C, WorkspaceStoreOptions as Cn, WorkspaceNameMap as Ct, WorkspaceAssets as D, WorkspaceSyncSnapshotOptions as Dn, WorkspacePullRequest as Dt, WorkspaceAssetPath as E, WorkspaceSyncResultDetails as En, WorkspacePrepareSessionProgressEvent as Et, WorkspaceDefinition as F, WorkspaceWriteValidatorResult as Fn, WorkspaceSearchHit as Ft, WorkspaceGlobSourceInput as G, WorkspaceSource as Gt, WorkspaceFile as H, WorkspaceSessionOptions as Ht, WorkspaceDefinitionInput as I, WriteFileOptions as In, WorkspaceSearchQuery as It, WorkspaceHistoryCommitBase as J, WorkspaceSourceInput as Jt, WorkspaceHistoryChanges as K, WorkspaceSourceBindingInput as Kt, WorkspaceDiff as L, WorkspaceSelectedScope as Lt, WorkspaceContent as M, WorkspaceWriteMode as Mn, WorkspaceRule as Mt, WorkspaceContentStream as N, WorkspaceWriteOperation as Nn, WorkspaceRules as Nt, WorkspaceAssetsRegistry as O, WorkspaceValidateMode as On, WorkspaceRebaseOptions as Ot, WorkspaceCustomSourceInput as P, WorkspaceWriteValidator as Pn, WorkspaceScopeName as Pt, WorkspaceHistoryFileInput as Q, WorkspaceSourceMaterializationStatus as Qt, WorkspaceDiffEntry as R, WorkspaceSession as Rt, SourceContext$1 as S, WorkspaceStoreHistoryCommitOptions as Sn, WorkspaceName as St, Workspace as T, WorkspaceSyncOptions as Tn, WorkspacePlugin as Tt, WorkspaceFileSourceInput as U, WorkspaceSessionWriteFileOptions as Ut, WorkspaceFetchSourceRequestOptions as V, WorkspaceSessionHostFiles as Vt, WorkspaceGitHubSourceInput as W, WorkspaceSnapshot as Wt, WorkspaceHistoryExtensions as X, WorkspaceSourceMaterializationCounts as Xt, WorkspaceHistoryCommitOptions as Y, WorkspaceSourceItem as Yt, WorkspaceHistoryFile as Z, WorkspaceSourceMaterializationPathResult as Zt, ReadFileResult as _, WorkspaceSourceSyncResult as _n, WorkspaceMergeConflict as _t, GitHubWorkspaceOption as a, WorkspaceSourceRequestMethod as an, WorkspaceHookContext as at, RmOptions as b, WorkspaceStore as bn, WorkspaceMergeResolution as bt, GlobOptions as c, WorkspaceSourceResolutionContextValueReader as cn, WorkspaceInstructionBindingValue as ct, LocalWorkspaceStoreOptions as d, WorkspaceSourceResolver as dn, WorkspaceMaterializeMode as dt, WorkspaceSourceMountOptions as en, WorkspaceHistoryListOptions as et, Logger as f, WorkspaceSourceSelection as fn, WorkspaceMaterializeSourcesOptions as ft, ReadFileOptions as g, WorkspaceSourceSyncPolicy as gn, WorkspaceMergeCommit as gt, MkdirOptions as h, WorkspaceSourceSyncPathResult as hn, WorkspaceMcpResourcesSourceInput as ht, ExecResult as i, WorkspaceSourceRequestExecutor as in, WorkspaceHistoryRefOptions as it, WorkspaceCapabilities as j, WorkspaceWriteInput as jn, WorkspaceRevisionView as jt, WorkspaceAutoCommitPlan as k, WorkspaceWriteErrorHook as kn, WorkspaceRetainedHistory as kt, ListOptions as l, WorkspaceSourceResolutionInvocation as ln, WorkspaceLoader as lt, MemoryWorkspaceStoreOptions as m, WorkspaceSourceSyncCounts as mn, WorkspaceMaterializeSourcesResult as mt, DiffOptions as n, WorkspaceSourceRequestExecutionInput as nn, WorkspaceHistoryReader as nt, GitHubWorkspaceRefs as o, WorkspaceSourceResolutionContext as on, WorkspaceHooks as ot, MaybePromise as p, WorkspaceSourceSyncConfig as pn, WorkspaceMaterializeSourcesProgressEvent as pt, WorkspaceHistoryChangesCommitOptions as q, WorkspaceSourceDefinition as qt, ExecOptions as r, WorkspaceSourceRequestExecutionResult as rn, WorkspaceHistoryRef as rt, GitHubWorkspaceStoreOptions as s, WorkspaceSourceResolutionContextMap as sn, WorkspaceInstructionBinding as st, CloudflareArtifactsWorkspaceStoreOptions as t, WorkspaceSourceRequestDescriptor as tn, WorkspaceHistoryListResult as tt, LoaderContext as u, WorkspaceSourceResolutionResult as un, WorkspaceLoaderSource as ut, ResolvedWorkspaceModuleOptions as v, WorkspaceSourceSyncStatus as vn, WorkspaceMergeConflictContext as vt, VercelBlobWorkspaceStoreOptions as w, WorkspaceStreamFile as wn, WorkspaceOpenPullRequestOptions as wt, SnapshotOptions as x, WorkspaceStoreHistory as xn, WorkspaceModuleOptions as xt, ResolvedWorkspaceRule as y, WorkspaceStat as yn, WorkspaceMergeOptions as yt, WorkspaceEntry as z, WorkspaceSessionHost as zt };
|