@vite-hub/workspace 0.0.3 → 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/LICENSE +201 -0
- package/README.md +236 -58
- package/dist/{ai-nmHdzjCM.d.ts → ai-BW2ZhizI.d.ts} +22 -7
- package/dist/{ai-Ce3PtWFW.js → ai-BZyLwULx.js} +147 -66
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +1 -1
- package/dist/{asset-registry-CaG9b7tf.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-3I1BnsdO.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-QRV55OCx.js → files-C7Px8uaC.js} +21 -10
- package/dist/forgejo-BN8ItCfl-Bbn4vhDd.js +2278 -0
- package/dist/{github-CfA5vpJ5.js → github-CPxHtFB7.js} +36 -34
- 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-CFnrTXTK.js +1086 -0
- package/dist/{hosted-C1-tTTTf.js → hosted-acMA5XyL.js} +216 -43
- 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 +76 -64
- package/dist/index.js +162 -457
- 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 +10 -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-CNI6wKIU.js → path-CNAwN7pw.js} +34 -35
- 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-Bp-8UUfG.js +129 -0
- package/dist/{registry-BIQVCBWI.d.ts → registry-Cg1TJVVZ.d.ts} +3 -4
- package/dist/{request-execution-u9mgUXKX.js → request-execution-Dk9rY-Yh.js} +24 -20
- package/dist/rolldown-runtime-B4iAMlE-.js +35 -0
- package/dist/runtime/assets.d.ts +3 -5
- package/dist/runtime/assets.js +9 -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 +4 -4
- package/dist/runtime/state.js +10 -7
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +84 -15
- package/dist/runtime.js +561 -108
- package/dist/{search-C4REyHj9.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 -355
- package/dist/shared-DalXdP0i.js +2158 -0
- package/dist/source-metadata.d.ts +7 -1
- package/dist/source-metadata.js +34 -2
- package/dist/{state-TTqa3x3Y.d.ts → state-B8zbLi5t.d.ts} +14 -13
- package/dist/store-CXgmu-uw.js +1729 -0
- package/dist/{sync-DiuDmSGk.js → sync-CN6ec-5M.js} +62 -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-CO62GglH.js +61 -0
- package/dist/{types-60Yn149G.d.ts → types-DeK9GIxy.d.ts} +348 -49
- package/dist/{use-CsV3oIxH.js → use-BQj7nSz6.js} +200 -45
- package/dist/{use-CUFSnFCS.d.ts → use-DhwhbAVV.d.ts} +34 -12
- 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 -50
- package/dist/vite.js +2 -2
- package/dist/webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js +1565 -0
- package/dist/workspace-6pxkOuxr.js +1286 -0
- package/dist/workspace-BWJQBK1u.d.ts +7 -0
- package/package.json +90 -59
- package/dist/chunk-8H4AJuhK.js +0 -14
- 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-CDoyls2X.js +0 -30
- package/dist/config-CZLO0m9h.js +0 -7811
- package/dist/file-CHfsZpso.js +0 -23
- package/dist/glob-D0vD_wRY.js +0 -17
- package/dist/host-CAnbugpI.js +0 -370
- package/dist/hosted-vercel-blob-CWBILDVo.js +0 -257
- package/dist/lifecycle-BYoa9hVb.js +0 -176
- package/dist/provider-C3_elpEh.js +0 -599
- package/dist/publish.d.ts +0 -35
- package/dist/publish.js +0 -112
- package/dist/registry-CqyDTW9Y.js +0 -74
- package/dist/runtime-options-BsPSv5O7.js +0 -13
- package/dist/shared-jfogBrd5.js +0 -273
- package/dist/store-Bs1SLh55.js +0 -414
- package/dist/vite-tbfDxtlu.js +0 -2191
- package/dist/workspace-66SKyiec.d.ts +0 -6
- package/dist/workspace-C4k92Ow8.js +0 -1460
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Source, SourceContext, SourceRevision } from "@vite-hub/source";
|
|
3
|
+
import { FileSourceOptions } from "@vite-hub/source/file";
|
|
4
|
+
import { GitHubSourceOptions } from "@vite-hub/source/github";
|
|
5
|
+
import { GlobSourceOptions } from "@vite-hub/source/glob";
|
|
6
|
+
import { McpResourcesSourceOptions } from "@vite-hub/source/mcp";
|
|
4
7
|
//#region src/core/types.d.ts
|
|
5
8
|
type WorkspaceContent = string | Uint8Array;
|
|
6
9
|
type WorkspaceContentStream = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
@@ -11,13 +14,19 @@ type ReadFileResult<TOptions extends ReadFileOptions | undefined = undefined> =
|
|
|
11
14
|
encoding: "binary";
|
|
12
15
|
} ? Uint8Array : string;
|
|
13
16
|
interface WriteFileOptions {
|
|
17
|
+
ifDigest?: string | null;
|
|
14
18
|
mediaType?: string;
|
|
19
|
+
/** JSON-safe file attributes. Undefined properties, cycles, class instances, and non-finite numbers are rejected before provider dispatch. */
|
|
15
20
|
metadata?: Record<string, unknown>;
|
|
21
|
+
preservePath?: boolean;
|
|
16
22
|
}
|
|
23
|
+
type WorkspaceSessionWriteFileOptions = Omit<WriteFileOptions, "ifDigest" | "preservePath">;
|
|
17
24
|
interface ListOptions {
|
|
25
|
+
exclude?: string[];
|
|
18
26
|
recursive?: boolean;
|
|
19
27
|
}
|
|
20
28
|
interface GlobOptions {
|
|
29
|
+
/** Workspace-relative directory to match patterns within. Result paths remain relative to the Workspace root. */
|
|
21
30
|
cwd?: string;
|
|
22
31
|
}
|
|
23
32
|
interface WorkspaceSearchQuery {
|
|
@@ -40,6 +49,8 @@ interface MkdirOptions {
|
|
|
40
49
|
interface RmOptions {
|
|
41
50
|
recursive?: boolean;
|
|
42
51
|
force?: boolean;
|
|
52
|
+
/** Remove only when the current file digest matches. */
|
|
53
|
+
ifDigest?: string | null;
|
|
43
54
|
}
|
|
44
55
|
type WorkspaceWriteOperation = "writeFile" | "mkdir" | "rm";
|
|
45
56
|
type WorkspaceWriteMode = boolean | "create" | "update" | "delete";
|
|
@@ -47,6 +58,8 @@ interface WorkspaceWriteInput {
|
|
|
47
58
|
workspace: string;
|
|
48
59
|
operation: WorkspaceWriteOperation;
|
|
49
60
|
path: string;
|
|
61
|
+
/** The history ref of a history commit, such as `draft`. Undefined for writes to the working tree. */
|
|
62
|
+
ref?: string;
|
|
50
63
|
content?: WorkspaceContent;
|
|
51
64
|
mediaType?: string;
|
|
52
65
|
metadata?: Record<string, unknown>;
|
|
@@ -88,9 +101,6 @@ interface WorkspacePlugin {
|
|
|
88
101
|
interface SnapshotOptions {
|
|
89
102
|
name?: string;
|
|
90
103
|
}
|
|
91
|
-
interface WorkspacePublishOptions {
|
|
92
|
-
name?: string;
|
|
93
|
-
}
|
|
94
104
|
interface DiffOptions {
|
|
95
105
|
from?: WorkspaceSnapshot;
|
|
96
106
|
}
|
|
@@ -101,38 +111,64 @@ interface WorkspaceSyncSnapshotOptions extends SnapshotOptions {
|
|
|
101
111
|
}
|
|
102
112
|
interface WorkspaceSyncOptions {
|
|
103
113
|
details?: WorkspaceSyncResultDetails;
|
|
104
|
-
publish?: boolean;
|
|
105
114
|
publishPartial?: boolean;
|
|
106
115
|
snapshot?: boolean | WorkspaceSyncSnapshotOptions;
|
|
107
116
|
sources: WorkspaceSourceSelection;
|
|
108
117
|
}
|
|
109
118
|
interface WorkspaceSessionOptions {
|
|
119
|
+
abortSignal?: AbortSignal;
|
|
110
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;
|
|
111
127
|
host?: WorkspaceSessionHost;
|
|
128
|
+
materializeSources?: false;
|
|
129
|
+
onProgress?: (event: WorkspacePrepareSessionProgressEvent) => void | Promise<void>;
|
|
112
130
|
paths?: readonly string[];
|
|
113
131
|
target?: string;
|
|
132
|
+
writeBack?: false | {
|
|
133
|
+
exclude?: readonly string[];
|
|
134
|
+
};
|
|
114
135
|
}
|
|
115
136
|
interface WorkspaceSessionHostFileEntry {
|
|
137
|
+
executable?: boolean;
|
|
116
138
|
path: string;
|
|
117
139
|
size?: number;
|
|
118
140
|
type: "directory" | "file" | "symlink";
|
|
119
141
|
}
|
|
120
142
|
interface WorkspaceSessionHostFiles {
|
|
121
|
-
exists(path: string
|
|
143
|
+
exists(path: string, options?: {
|
|
144
|
+
signal?: AbortSignal;
|
|
145
|
+
}): Promise<boolean>;
|
|
122
146
|
list(path: string, options?: {
|
|
147
|
+
exclude?: readonly string[];
|
|
123
148
|
recursive?: boolean;
|
|
149
|
+
signal?: AbortSignal;
|
|
124
150
|
}): Promise<readonly WorkspaceSessionHostFileEntry[]>;
|
|
125
151
|
mkdir(path: string, options?: {
|
|
126
152
|
recursive?: boolean;
|
|
153
|
+
signal?: AbortSignal;
|
|
127
154
|
}): Promise<void>;
|
|
128
|
-
read(path: string
|
|
155
|
+
read(path: string, options?: {
|
|
156
|
+
signal?: AbortSignal;
|
|
157
|
+
}): Promise<Uint8Array | null>;
|
|
129
158
|
remove(path: string, options?: {
|
|
130
159
|
recursive?: boolean;
|
|
160
|
+
signal?: AbortSignal;
|
|
161
|
+
}): Promise<void>;
|
|
162
|
+
write(path: string, content: Uint8Array, options?: {
|
|
163
|
+
signal?: AbortSignal;
|
|
131
164
|
}): Promise<void>;
|
|
132
|
-
write(path: string, content: Uint8Array): Promise<void>;
|
|
133
165
|
}
|
|
134
166
|
interface WorkspaceSessionHost {
|
|
135
167
|
readonly executionAuthority: ExecutionAuthority;
|
|
168
|
+
readonly inspectionConcurrency?: number;
|
|
169
|
+
/** Maximum independent workspace files copied into this host concurrently. Defaults to 1. */
|
|
170
|
+
readonly materializationConcurrency?: number;
|
|
171
|
+
detachAbortSignal?(): void;
|
|
136
172
|
files: WorkspaceSessionHostFiles;
|
|
137
173
|
exec(command: string, args?: readonly string[], options?: {
|
|
138
174
|
cwd?: string;
|
|
@@ -161,21 +197,26 @@ interface ExecResult {
|
|
|
161
197
|
interface WorkspaceSession {
|
|
162
198
|
readonly executionAuthority: ExecutionAuthority;
|
|
163
199
|
readFile<TOptions extends ReadFileOptions | undefined = undefined>(path: string, options?: TOptions): Promise<ReadFileResult<TOptions>>;
|
|
164
|
-
writeFile(path: string, content: WorkspaceContent, options?:
|
|
200
|
+
writeFile(path: string, content: WorkspaceContent, options?: WorkspaceSessionWriteFileOptions): Promise<void>;
|
|
165
201
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
166
202
|
rm(path: string, options?: RmOptions): Promise<void>;
|
|
167
203
|
list(path?: string, options?: ListOptions): Promise<WorkspaceEntry[]>;
|
|
168
204
|
glob(pattern: string | string[], options?: GlobOptions): Promise<WorkspaceEntry[]>;
|
|
169
205
|
search(query: WorkspaceSearchQuery): Promise<WorkspaceSearchHit[]>;
|
|
170
|
-
diff(
|
|
206
|
+
diff(options?: {
|
|
207
|
+
abortSignal?: AbortSignal;
|
|
208
|
+
}): Promise<WorkspaceDiff>;
|
|
171
209
|
commit(options?: {
|
|
210
|
+
abortSignal?: AbortSignal;
|
|
172
211
|
message?: string;
|
|
173
212
|
}): Promise<void>;
|
|
174
213
|
exec(command: string, args?: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
175
214
|
tools?: {
|
|
176
215
|
aiSdk?(): Promise<Record<string, unknown>>;
|
|
177
216
|
};
|
|
178
|
-
close(
|
|
217
|
+
close(options?: {
|
|
218
|
+
abortSignal?: AbortSignal;
|
|
219
|
+
}): Promise<void>;
|
|
179
220
|
}
|
|
180
221
|
declare global {
|
|
181
222
|
interface ViteHubWorkspaceNameMap {}
|
|
@@ -202,12 +243,14 @@ interface WorkspaceFile {
|
|
|
202
243
|
path: string;
|
|
203
244
|
content: WorkspaceContent;
|
|
204
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. */
|
|
205
247
|
metadata?: Record<string, unknown>;
|
|
206
248
|
}
|
|
207
249
|
interface WorkspaceStreamFile {
|
|
208
250
|
path: string;
|
|
209
251
|
content: WorkspaceContentStream;
|
|
210
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. */
|
|
211
254
|
metadata?: Record<string, unknown>;
|
|
212
255
|
}
|
|
213
256
|
interface WorkspaceEntry {
|
|
@@ -220,6 +263,8 @@ interface WorkspaceEntry {
|
|
|
220
263
|
digest?: string;
|
|
221
264
|
}
|
|
222
265
|
interface WorkspaceStat extends WorkspaceEntry {
|
|
266
|
+
/** Opaque stored-file version. Must change on modification or recreation, even when bytes are unchanged. */
|
|
267
|
+
revision?: string;
|
|
223
268
|
type: "file" | "directory";
|
|
224
269
|
}
|
|
225
270
|
interface WorkspaceSnapshot {
|
|
@@ -233,6 +278,205 @@ interface WorkspaceSnapshot {
|
|
|
233
278
|
size?: number;
|
|
234
279
|
}>;
|
|
235
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
|
+
}
|
|
236
480
|
interface WorkspaceDiffEntry {
|
|
237
481
|
path: string;
|
|
238
482
|
type: "added" | "modified" | "removed";
|
|
@@ -248,32 +492,37 @@ interface WorkspaceAutoCommitPlan {
|
|
|
248
492
|
message: string;
|
|
249
493
|
paths: string[];
|
|
250
494
|
}
|
|
495
|
+
interface WorkspaceRebaseOptions {
|
|
496
|
+
takeRemote?: string[];
|
|
497
|
+
}
|
|
251
498
|
interface WorkspaceStore {
|
|
499
|
+
history?: WorkspaceStoreHistory;
|
|
252
500
|
readFile(path: string): Promise<WorkspaceFile | undefined>;
|
|
253
501
|
writeFile(path: string, file: WorkspaceFile): Promise<void>;
|
|
254
|
-
|
|
502
|
+
writeFileConditional?(path: string, file: WorkspaceFile, ifDigest: string | null): Promise<void>;
|
|
503
|
+
writeFileStream?(path: string, file: WorkspaceStreamFile): Promise<WorkspaceStat & {
|
|
504
|
+
digest: string;
|
|
505
|
+
}>;
|
|
255
506
|
list(prefix?: string, options?: ListOptions): Promise<WorkspaceEntry[]>;
|
|
256
507
|
glob(pattern: string | string[], options?: GlobOptions): Promise<WorkspaceEntry[]>;
|
|
257
508
|
stat(path: string): Promise<WorkspaceStat | undefined>;
|
|
258
509
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
259
510
|
rm(path: string, options?: RmOptions): Promise<void>;
|
|
511
|
+
removeEmptyDirectory?(path: string): Promise<void>;
|
|
260
512
|
snapshot(options?: SnapshotOptions): Promise<WorkspaceSnapshot>;
|
|
513
|
+
rebase?(options?: WorkspaceRebaseOptions): Promise<void>;
|
|
261
514
|
diff(options?: DiffOptions): Promise<WorkspaceDiff>;
|
|
262
515
|
getMeta?(key: string): Promise<unknown>;
|
|
263
|
-
setMeta?(key: string, value: unknown): Promise<void>;
|
|
516
|
+
setMeta?(key: string, value: unknown, capability?: symbol): Promise<void>;
|
|
264
517
|
}
|
|
265
518
|
interface SourceContextWorkspaceFiles {
|
|
266
519
|
readFile<TOptions extends ReadFileOptions | undefined = undefined>(path: string, options?: TOptions): Promise<ReadFileResult<TOptions>>;
|
|
267
520
|
stat(path: string): Promise<WorkspaceStat | undefined>;
|
|
268
521
|
exists(path: string): Promise<boolean>;
|
|
269
522
|
}
|
|
270
|
-
interface SourceContext {
|
|
271
|
-
abortSignal?: AbortSignal;
|
|
523
|
+
interface SourceContext$1 extends SourceContext {
|
|
272
524
|
mountPath?: string;
|
|
273
|
-
rootDir: string;
|
|
274
525
|
selectedWorkspaceScope?: WorkspaceSelectedScope;
|
|
275
|
-
source?: string;
|
|
276
|
-
sourceRootDir?: string;
|
|
277
526
|
workspace: string;
|
|
278
527
|
workspaceFiles?: SourceContextWorkspaceFiles;
|
|
279
528
|
}
|
|
@@ -281,7 +530,7 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
281
530
|
interface WorkspaceSourceResolutionContextValueReader<TContextMap extends object = WorkspaceSourceResolutionContextMap> {
|
|
282
531
|
entries(): IterableIterator<[string, unknown]>;
|
|
283
532
|
get<K extends Extract<keyof TContextMap, string>>(id: K): TContextMap[K] | undefined;
|
|
284
|
-
get
|
|
533
|
+
get(id: string): unknown;
|
|
285
534
|
has(id: string): boolean;
|
|
286
535
|
toJSON?(): Record<string, unknown>;
|
|
287
536
|
}
|
|
@@ -313,7 +562,7 @@ type WorkspaceSourceResolutionContext<TContextMap extends object = WorkspaceSour
|
|
|
313
562
|
};
|
|
314
563
|
type WorkspaceSourceResolutionResult = WorkspaceSource | false | null | undefined;
|
|
315
564
|
type WorkspaceSourceResolver<TContextMap extends object = WorkspaceSourceResolutionContextMap, TScopeName extends string = WorkspaceScopeName> = (context: WorkspaceSourceResolutionContext<TContextMap, TScopeName>) => MaybePromise<WorkspaceSourceResolutionResult>;
|
|
316
|
-
type WorkspaceMaterializeMode = "build" | "lazy" | "none";
|
|
565
|
+
type WorkspaceMaterializeMode = "build" | "startup" | "lazy" | "none";
|
|
317
566
|
type WorkspaceValidateMode = false | "request";
|
|
318
567
|
interface WorkspaceCacheOptions {
|
|
319
568
|
maxAge?: number;
|
|
@@ -360,6 +609,8 @@ interface WorkspaceSourceRequestDescriptor {
|
|
|
360
609
|
}
|
|
361
610
|
interface WorkspaceSourceRequestExecutionInput {
|
|
362
611
|
body?: unknown;
|
|
612
|
+
/** Abort a controlled request when its owning Shell invocation ends. */
|
|
613
|
+
signal?: AbortSignal;
|
|
363
614
|
method: WorkspaceSourceRequestMethod;
|
|
364
615
|
url: string;
|
|
365
616
|
}
|
|
@@ -369,8 +620,10 @@ interface WorkspaceSourceRequestExecutionResult {
|
|
|
369
620
|
metadata?: Record<string, unknown>;
|
|
370
621
|
status?: number;
|
|
371
622
|
}
|
|
372
|
-
type WorkspaceSourceRequestExecutor = (input: WorkspaceSourceRequestExecutionInput, context: SourceContext) => MaybePromise<WorkspaceSourceRequestExecutionResult>;
|
|
623
|
+
type WorkspaceSourceRequestExecutor = (input: WorkspaceSourceRequestExecutionInput, context: SourceContext$1) => MaybePromise<WorkspaceSourceRequestExecutionResult>;
|
|
373
624
|
interface WorkspaceSource {
|
|
625
|
+
/** Stable provider name used for inspection and diagnostics. */
|
|
626
|
+
name?: string;
|
|
374
627
|
mount?: WorkspaceSourceMount;
|
|
375
628
|
materialize?: WorkspaceMaterializeMode;
|
|
376
629
|
cache?: false | WorkspaceCacheOptions;
|
|
@@ -379,13 +632,12 @@ interface WorkspaceSource {
|
|
|
379
632
|
probeKeys?: string[];
|
|
380
633
|
fingerprint?: unknown;
|
|
381
634
|
resolve?: WorkspaceSourceResolver;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
watch?: unknown[];
|
|
635
|
+
resolveRevision?(ctx: SourceContext$1): Promise<SourceRevision | undefined>;
|
|
636
|
+
prepare?(ctx: SourceContext$1): Promise<void>;
|
|
637
|
+
getKeys(ctx: SourceContext$1): Promise<string[]>;
|
|
638
|
+
getItem(key: string, ctx: SourceContext$1): Promise<WorkspaceSourceItem>;
|
|
639
|
+
getItems?(ctx: SourceContext$1): Promise<WorkspaceSourceItem[]>;
|
|
640
|
+
getMeta?(key: string, ctx: SourceContext$1): Promise<Record<string, unknown> | undefined>;
|
|
389
641
|
}
|
|
390
642
|
interface WorkspaceSourceSyncPolicy {
|
|
391
643
|
concurrency?: "skip" | "queue";
|
|
@@ -402,11 +654,13 @@ type WorkspaceFileSourceInput<TKey extends string = string> = TKey | (FileSource
|
|
|
402
654
|
interface WorkspaceFetchSourceRequestOptions {
|
|
403
655
|
body?: unknown;
|
|
404
656
|
headers?: Record<string, string>;
|
|
657
|
+
maxResponseBytes?: number;
|
|
405
658
|
method?: "GET" | "HEAD" | "POST";
|
|
406
659
|
query?: Record<string, unknown>;
|
|
407
660
|
timeout?: number;
|
|
408
661
|
}
|
|
409
662
|
interface WorkspaceFetchSourceInput<TResponse = unknown, TOutput = TResponse> extends WorkspaceSourceBindingOptions {
|
|
663
|
+
maxResponseBytes?: number;
|
|
410
664
|
method?: "GET" | "HEAD" | "POST";
|
|
411
665
|
path?: string;
|
|
412
666
|
request?: WorkspaceFetchSourceRequestOptions | (() => WorkspaceFetchSourceRequestOptions | Promise<WorkspaceFetchSourceRequestOptions>);
|
|
@@ -416,13 +670,16 @@ interface WorkspaceFetchSourceInput<TResponse = unknown, TOutput = TResponse> ex
|
|
|
416
670
|
url: string | URL;
|
|
417
671
|
}
|
|
418
672
|
type WorkspaceGlobSourceInput = GlobSourceOptions & WorkspaceSourceBindingOptions;
|
|
419
|
-
type WorkspaceGitHubSourceInput = GitHubSourceOptions &
|
|
673
|
+
type WorkspaceGitHubSourceInput = Omit<GitHubSourceOptions, "ignore"> & {
|
|
674
|
+
ignore?: false | string | readonly string[];
|
|
675
|
+
} & WorkspaceSourceBindingOptions;
|
|
420
676
|
type WorkspaceMcpResourcesSourceInput<TKey extends string = string> = Omit<McpResourcesSourceOptions<TKey>, "cache"> & WorkspaceSourceBindingOptions;
|
|
421
677
|
type WorkspaceSourceInput = WorkspaceSourceBindingInput | WorkspaceCustomSourceInput | WorkspaceFileSourceInput | WorkspaceFetchSourceInput | WorkspaceGlobSourceInput | WorkspaceGitHubSourceInput | WorkspaceMcpResourcesSourceInput;
|
|
422
678
|
interface WorkspaceLoaderSource extends WorkspaceSource {
|
|
423
679
|
key: string;
|
|
424
680
|
}
|
|
425
681
|
interface LoaderContext {
|
|
682
|
+
abortSignal?: AbortSignal;
|
|
426
683
|
workspace: string;
|
|
427
684
|
rootDir: string;
|
|
428
685
|
sourceRootDir?: string;
|
|
@@ -442,18 +699,6 @@ interface WorkspaceLoader {
|
|
|
442
699
|
schema?: unknown;
|
|
443
700
|
load(ctx: LoaderContext): Promise<void>;
|
|
444
701
|
}
|
|
445
|
-
interface PublishContext {
|
|
446
|
-
durable: boolean;
|
|
447
|
-
workspace: WorkspaceDefinition;
|
|
448
|
-
store: WorkspaceStore;
|
|
449
|
-
rootDir: string;
|
|
450
|
-
snapshot?: WorkspaceSnapshot;
|
|
451
|
-
}
|
|
452
|
-
interface WorkspacePublisher {
|
|
453
|
-
name: string;
|
|
454
|
-
clientSafe?: boolean;
|
|
455
|
-
publish(ctx: PublishContext): Promise<void>;
|
|
456
|
-
}
|
|
457
702
|
interface Logger {
|
|
458
703
|
debug(...args: unknown[]): void;
|
|
459
704
|
info(...args: unknown[]): void;
|
|
@@ -461,6 +706,17 @@ interface Logger {
|
|
|
461
706
|
error(...args: unknown[]): void;
|
|
462
707
|
}
|
|
463
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";
|
|
464
720
|
provider?: "local";
|
|
465
721
|
root?: string;
|
|
466
722
|
}
|
|
@@ -478,15 +734,34 @@ interface CloudflareArtifactsWorkspaceStoreOptions {
|
|
|
478
734
|
interface VercelBlobWorkspaceStoreOptions {
|
|
479
735
|
provider: "vercel-blob";
|
|
480
736
|
token?: string;
|
|
737
|
+
/**
|
|
738
|
+
* A namespace under `_vitehub/workspaces/`. For example, `handbook`
|
|
739
|
+
* stores Workspace files under `_vitehub/workspaces/handbook/`.
|
|
740
|
+
*/
|
|
481
741
|
prefix?: string;
|
|
482
742
|
access?: "private" | "public";
|
|
483
743
|
}
|
|
484
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
|
+
}
|
|
485
753
|
interface GitHubWorkspaceStoreOptions {
|
|
486
754
|
provider: "github";
|
|
487
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;
|
|
488
762
|
repo?: GitHubWorkspaceOption;
|
|
489
763
|
repository?: GitHubWorkspaceOption;
|
|
764
|
+
/** The folder of the Workspace in the repository. An empty string is the repository root. Defaults to `.vitehub/workspaces/<workspace>`. */
|
|
490
765
|
root?: GitHubWorkspaceOption;
|
|
491
766
|
token?: GitHubWorkspaceOption;
|
|
492
767
|
}
|
|
@@ -500,7 +775,6 @@ interface WorkspaceDefinition {
|
|
|
500
775
|
bindings?: Record<string, WorkspaceInstructionBinding>;
|
|
501
776
|
sources?: Record<string, WorkspaceSourceInput>;
|
|
502
777
|
loaders?: WorkspaceLoader[];
|
|
503
|
-
publish?: WorkspacePublisher[];
|
|
504
778
|
plugins?: WorkspacePlugin[];
|
|
505
779
|
rules?: WorkspaceRules;
|
|
506
780
|
hooks?: WorkspaceHooks;
|
|
@@ -519,14 +793,20 @@ interface ResolvedWorkspaceModuleOptions {
|
|
|
519
793
|
assets?: boolean | string[];
|
|
520
794
|
store: Exclude<WorkspaceStoreOptions, WorkspaceStore>;
|
|
521
795
|
}
|
|
796
|
+
interface WorkspaceCapabilities {
|
|
797
|
+
conditionalWrites: boolean;
|
|
798
|
+
retainedHistory?: boolean;
|
|
799
|
+
}
|
|
522
800
|
interface Workspace {
|
|
523
801
|
name: string;
|
|
802
|
+
history: WorkspaceRetainedHistory;
|
|
803
|
+
capabilities?(): Promise<WorkspaceCapabilities>;
|
|
524
804
|
sync(options: WorkspaceSyncOptions): Promise<WorkspaceSourceSyncResult>;
|
|
525
805
|
materializeSources?(options?: WorkspaceMaterializeSourcesOptions): Promise<WorkspaceMaterializeSourcesResult>;
|
|
526
806
|
getMeta?(key: string): Promise<unknown>;
|
|
527
|
-
setMeta?(key: string, value: unknown): Promise<void>;
|
|
807
|
+
setMeta?(key: string, value: unknown, capability?: symbol): Promise<void>;
|
|
528
808
|
readFile<TOptions extends ReadFileOptions | undefined = undefined>(path: string, options?: TOptions): Promise<ReadFileResult<TOptions>>;
|
|
529
|
-
writeFile(path: string, content: WorkspaceContent, options?: WriteFileOptions): Promise<
|
|
809
|
+
writeFile(path: string, content: WorkspaceContent, options?: WriteFileOptions): Promise<string>;
|
|
530
810
|
list(path?: string, options?: ListOptions): Promise<WorkspaceEntry[]>;
|
|
531
811
|
glob(pattern: string | string[], options?: GlobOptions): Promise<WorkspaceEntry[]>;
|
|
532
812
|
search(query: WorkspaceSearchQuery): Promise<WorkspaceSearchHit[]>;
|
|
@@ -534,8 +814,8 @@ interface Workspace {
|
|
|
534
814
|
exists(path: string): Promise<boolean>;
|
|
535
815
|
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
536
816
|
rm(path: string, options?: RmOptions): Promise<void>;
|
|
537
|
-
publish(options?: WorkspacePublishOptions): Promise<void>;
|
|
538
817
|
snapshot(options?: SnapshotOptions): Promise<WorkspaceSnapshot>;
|
|
818
|
+
rebase(options?: WorkspaceRebaseOptions): Promise<void>;
|
|
539
819
|
diff(options?: DiffOptions): Promise<WorkspaceDiff>;
|
|
540
820
|
startSession(options?: WorkspaceSessionOptions): Promise<WorkspaceSession>;
|
|
541
821
|
}
|
|
@@ -560,34 +840,53 @@ interface WorkspaceSourceSyncStatus {
|
|
|
560
840
|
}
|
|
561
841
|
interface WorkspaceSourceSyncResult {
|
|
562
842
|
durationMs: number;
|
|
563
|
-
published: boolean;
|
|
564
843
|
snapshot?: WorkspaceSnapshot;
|
|
565
844
|
sources: WorkspaceSourceSyncStatus[];
|
|
566
845
|
status: "error" | "partial" | "ready" | "skipped";
|
|
567
846
|
}
|
|
568
847
|
interface WorkspaceSourceMaterializationStatus {
|
|
848
|
+
cacheStatus?: "bypassed" | "disabled" | "hit" | "miss";
|
|
849
|
+
counts?: WorkspaceSourceMaterializationCounts;
|
|
850
|
+
durationMs?: number;
|
|
569
851
|
source: string;
|
|
570
852
|
mountPath: string;
|
|
853
|
+
paths?: WorkspaceSourceMaterializationPathResult[];
|
|
854
|
+
provider?: string;
|
|
571
855
|
status: "lazy" | "updating" | "ready" | "error";
|
|
572
|
-
|
|
856
|
+
revision?: SourceRevision;
|
|
573
857
|
materializedAt?: string;
|
|
574
858
|
files?: number;
|
|
575
859
|
bytes?: number;
|
|
576
860
|
error?: string;
|
|
577
861
|
}
|
|
862
|
+
interface WorkspaceSourceMaterializationCounts {
|
|
863
|
+
added: number;
|
|
864
|
+
removed: number;
|
|
865
|
+
unchanged: number;
|
|
866
|
+
updated: number;
|
|
867
|
+
}
|
|
868
|
+
interface WorkspaceSourceMaterializationPathResult {
|
|
869
|
+
path: string;
|
|
870
|
+
status: "added" | "removed" | "unchanged" | "updated";
|
|
871
|
+
}
|
|
578
872
|
interface WorkspaceMaterializeSourcesProgressEvent {
|
|
579
873
|
bytes?: number;
|
|
874
|
+
cacheStatus?: WorkspaceSourceMaterializationStatus["cacheStatus"];
|
|
875
|
+
counts?: WorkspaceSourceMaterializationCounts;
|
|
580
876
|
directories?: number;
|
|
581
877
|
durationMs?: number;
|
|
582
878
|
error?: string;
|
|
583
879
|
files?: number;
|
|
584
880
|
mountPath: string;
|
|
585
881
|
path: string;
|
|
882
|
+
provider?: string;
|
|
883
|
+
revision?: SourceRevision;
|
|
586
884
|
source: string;
|
|
587
885
|
status: "started" | "updating" | "completed" | "failed";
|
|
588
886
|
}
|
|
589
887
|
interface WorkspaceMaterializeSourcesOptions {
|
|
590
888
|
abortSignal?: AbortSignal;
|
|
889
|
+
details?: "paths";
|
|
591
890
|
onProgress?: (event: WorkspaceMaterializeSourcesProgressEvent) => void | Promise<void>;
|
|
592
891
|
sources?: string[];
|
|
593
892
|
path?: string;
|
|
@@ -609,4 +908,4 @@ interface WorkspaceMaterializeSourcesResult {
|
|
|
609
908
|
sources: WorkspaceSourceMaterializationStatus[];
|
|
610
909
|
}
|
|
611
910
|
//#endregion
|
|
612
|
-
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 };
|