@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
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { v as ResolvedWorkspaceModuleOptions, w as VercelBlobWorkspaceStoreOptions } from "./types-
|
|
2
|
-
|
|
1
|
+
import { v as ResolvedWorkspaceModuleOptions, w as VercelBlobWorkspaceStoreOptions } from "./types-DeK9GIxy.js";
|
|
3
2
|
//#region src/hosted-vercel-blob.d.ts
|
|
4
|
-
interface HostedVercelBlobWorkspaceRuntimeOptions {
|
|
3
|
+
export interface HostedVercelBlobWorkspaceRuntimeOptions {
|
|
5
4
|
assets?: boolean | string[];
|
|
6
5
|
env?: Record<string, string | undefined>;
|
|
7
6
|
root?: string;
|
|
@@ -9,7 +8,7 @@ interface HostedVercelBlobWorkspaceRuntimeOptions {
|
|
|
9
8
|
provider: "vercel-blob";
|
|
10
9
|
};
|
|
11
10
|
}
|
|
12
|
-
declare function installHostedVercelBlobWorkspaceRuntime(): void;
|
|
13
|
-
declare function configureHostedVercelBlobWorkspaceRuntime(options?: HostedVercelBlobWorkspaceRuntimeOptions): ResolvedWorkspaceModuleOptions;
|
|
11
|
+
export declare function installHostedVercelBlobWorkspaceRuntime(): void;
|
|
12
|
+
export declare function configureHostedVercelBlobWorkspaceRuntime(options?: HostedVercelBlobWorkspaceRuntimeOptions): ResolvedWorkspaceModuleOptions;
|
|
14
13
|
//#endregion
|
|
15
|
-
export {
|
|
14
|
+
export type { VercelBlobWorkspaceStoreOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as installHostedVercelBlobWorkspaceRuntime, t as configureHostedVercelBlobWorkspaceRuntime } from "./hosted-vercel-blob-
|
|
1
|
+
import { n as installHostedVercelBlobWorkspaceRuntime, t as configureHostedVercelBlobWorkspaceRuntime } from "./hosted-vercel-blob-DKntsHaf.js";
|
|
2
2
|
export { configureHostedVercelBlobWorkspaceRuntime, installHostedVercelBlobWorkspaceRuntime };
|
package/dist/hosted.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions, w as VercelBlobWorkspaceStoreOptions } from "./types-DeK9GIxy.js";
|
|
3
2
|
//#region src/hosted.d.ts
|
|
4
|
-
type HostedWorkspaceRuntimeStoreOptions = Partial<CloudflareArtifactsWorkspaceStoreOptions> | (Partial<GitHubWorkspaceStoreOptions> & {
|
|
3
|
+
export type HostedWorkspaceRuntimeStoreOptions = Partial<CloudflareArtifactsWorkspaceStoreOptions> | (Partial<GitHubWorkspaceStoreOptions> & {
|
|
5
4
|
provider: "github";
|
|
6
5
|
}) | (Partial<VercelBlobWorkspaceStoreOptions> & {
|
|
7
6
|
provider: "vercel-blob";
|
|
8
7
|
});
|
|
9
|
-
interface HostedWorkspaceRuntimeOptions {
|
|
8
|
+
export interface HostedWorkspaceRuntimeOptions {
|
|
10
9
|
assets?: boolean | string[];
|
|
11
10
|
env?: Record<string, string | undefined>;
|
|
12
11
|
root?: string;
|
|
13
12
|
store?: HostedWorkspaceRuntimeStoreOptions;
|
|
14
13
|
}
|
|
15
|
-
declare function installHostedWorkspaceRuntime(): void;
|
|
16
|
-
declare function configureHostedWorkspaceRuntime(options?: HostedWorkspaceRuntimeOptions): ResolvedWorkspaceModuleOptions;
|
|
14
|
+
export declare function installHostedWorkspaceRuntime(): void;
|
|
15
|
+
export declare function configureHostedWorkspaceRuntime(options?: HostedWorkspaceRuntimeOptions): ResolvedWorkspaceModuleOptions;
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export type { CloudflareArtifactsWorkspaceStoreOptions, GitHubWorkspaceStoreOptions, VercelBlobWorkspaceStoreOptions };
|
package/dist/hosted.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as installHostedWorkspaceRuntime, t as configureHostedWorkspaceRuntime } from "./hosted-
|
|
1
|
+
import { n as installHostedWorkspaceRuntime, t as configureHostedWorkspaceRuntime } from "./hosted-acMA5XyL.js";
|
|
2
2
|
export { configureHostedWorkspaceRuntime, installHostedWorkspaceRuntime };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { a as WorkspaceReadOperations, c as WorkspaceToolOptions, d as WorkspaceWriteToolMap, f as createWorkspaceTools, i as WorkspacePathResult, l as WorkspaceTools, n as ShellEnabled, o as WorkspaceShellResult, r as WorkspaceMoveResult, s as WorkspaceToolOperations, t as EnabledReadCapability, u as WorkspaceWriteOperations } from "./ai-
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { $ as WorkspaceHistoryFilesCommitOptions, $t as WorkspaceSourceMount, A as WorkspaceCacheOptions, An as WorkspaceWriteHook, At as WorkspaceRevision, B as WorkspaceFetchSourceInput, Bt as WorkspaceSessionHostFileEntry, C as SourceContextWorkspaceFiles, Cn as WorkspaceStoreOptions, Ct as WorkspaceNameMap, D as WorkspaceAssets, Dn as WorkspaceSyncSnapshotOptions, Dt as WorkspacePullRequest, E as WorkspaceAssetPath, En as WorkspaceSyncResultDetails, Et as WorkspacePrepareSessionProgressEvent, F as WorkspaceDefinition, Fn as WorkspaceWriteValidatorResult, Ft as WorkspaceSearchHit, G as WorkspaceGlobSourceInput, Gt as WorkspaceSource, H as WorkspaceFile, Ht as WorkspaceSessionOptions, I as WorkspaceDefinitionInput, In as WriteFileOptions, It as WorkspaceSearchQuery, J as WorkspaceHistoryCommitBase, Jt as WorkspaceSourceInput, K as WorkspaceHistoryChanges, Kt as WorkspaceSourceBindingInput, L as WorkspaceDiff, Lt as WorkspaceSelectedScope, M as WorkspaceContent, Mn as WorkspaceWriteMode, Mt as WorkspaceRule, N as WorkspaceContentStream, Nn as WorkspaceWriteOperation, Nt as WorkspaceRules, O as WorkspaceAssetsRegistry, On as WorkspaceValidateMode, Ot as WorkspaceRebaseOptions, P as WorkspaceCustomSourceInput, Pn as WorkspaceWriteValidator, Pt as WorkspaceScopeName, Q as WorkspaceHistoryFileInput, Qt as WorkspaceSourceMaterializationStatus, R as WorkspaceDiffEntry, Rt as WorkspaceSession, S as SourceContext, Sn as WorkspaceStoreHistoryCommitOptions, St as WorkspaceName, T as Workspace, Tn as WorkspaceSyncOptions, Tt as WorkspacePlugin, U as WorkspaceFileSourceInput, Ut as WorkspaceSessionWriteFileOptions, V as WorkspaceFetchSourceRequestOptions, Vt as WorkspaceSessionHostFiles, W as WorkspaceGitHubSourceInput, Wt as WorkspaceSnapshot, X as WorkspaceHistoryExtensions, Xt as WorkspaceSourceMaterializationCounts, Y as WorkspaceHistoryCommitOptions, Yt as WorkspaceSourceItem, Z as WorkspaceHistoryFile, Zt as WorkspaceSourceMaterializationPathResult, _ as ReadFileResult, _n as WorkspaceSourceSyncResult, _t as WorkspaceMergeConflict, a as GitHubWorkspaceOption, an as WorkspaceSourceRequestMethod, at as WorkspaceHookContext, b as RmOptions, bn as WorkspaceStore, bt as WorkspaceMergeResolution, c as GlobOptions, cn as WorkspaceSourceResolutionContextValueReader, ct as WorkspaceInstructionBindingValue, d as LocalWorkspaceStoreOptions, dn as WorkspaceSourceResolver, dt as WorkspaceMaterializeMode, en as WorkspaceSourceMountOptions, et as WorkspaceHistoryListOptions, f as Logger, fn as WorkspaceSourceSelection, ft as WorkspaceMaterializeSourcesOptions, g as ReadFileOptions, gn as WorkspaceSourceSyncPolicy, gt as WorkspaceMergeCommit, h as MkdirOptions, hn as WorkspaceSourceSyncPathResult, ht as WorkspaceMcpResourcesSourceInput, i as ExecResult, in as WorkspaceSourceRequestExecutor, it as WorkspaceHistoryRefOptions, j as WorkspaceCapabilities, jn as WorkspaceWriteInput, jt as WorkspaceRevisionView, k as WorkspaceAutoCommitPlan, kn as WorkspaceWriteErrorHook, kt as WorkspaceRetainedHistory, l as ListOptions, ln as WorkspaceSourceResolutionInvocation, lt as WorkspaceLoader, m as MemoryWorkspaceStoreOptions, mn as WorkspaceSourceSyncCounts, mt as WorkspaceMaterializeSourcesResult, n as DiffOptions, nn as WorkspaceSourceRequestExecutionInput, nt as WorkspaceHistoryReader, o as GitHubWorkspaceRefs, on as WorkspaceSourceResolutionContext, ot as WorkspaceHooks, p as MaybePromise, pn as WorkspaceSourceSyncConfig, pt as WorkspaceMaterializeSourcesProgressEvent, q as WorkspaceHistoryChangesCommitOptions, qt as WorkspaceSourceDefinition, r as ExecOptions, rn as WorkspaceSourceRequestExecutionResult, rt as WorkspaceHistoryRef, s as GitHubWorkspaceStoreOptions, sn as WorkspaceSourceResolutionContextMap, st as WorkspaceInstructionBinding, t as CloudflareArtifactsWorkspaceStoreOptions, tn as WorkspaceSourceRequestDescriptor, tt as WorkspaceHistoryListResult, u as LoaderContext, un as WorkspaceSourceResolutionResult, ut as WorkspaceLoaderSource, v as ResolvedWorkspaceModuleOptions, vn as WorkspaceSourceSyncStatus, vt as WorkspaceMergeConflictContext, w as VercelBlobWorkspaceStoreOptions, wn as WorkspaceStreamFile, wt as WorkspaceOpenPullRequestOptions, x as SnapshotOptions, xn as WorkspaceStoreHistory, xt as WorkspaceModuleOptions, y as ResolvedWorkspaceRule, yn as WorkspaceStat, yt as WorkspaceMergeOptions, z as WorkspaceEntry, zt as WorkspaceSessionHost } from "./types-DeK9GIxy.js";
|
|
2
|
+
import { a as WorkspaceReadOperations, c as WorkspaceToolOptions, d as WorkspaceWriteToolMap, f as createWorkspaceTools, i as WorkspacePathResult, l as WorkspaceTools, n as ShellEnabled, o as WorkspaceShellResult, r as WorkspaceMoveResult, s as WorkspaceToolOperations, t as EnabledReadCapability, u as WorkspaceWriteOperations } from "./ai-BW2ZhizI.js";
|
|
3
|
+
import { t as createWorkspace } from "./workspace-BWJQBK1u.js";
|
|
4
|
+
import { _ as useWorkspace, a as ReadonlyWorkspaceFs, c as WorkspaceFacadeToolOptions, d as WorkspaceReadTools, f as WorkspaceWriteToolSet, g as WritableWorkspaceFs, h as WritableWorkspaceFacadeToolOptions, i as ReadonlyWorkspaceFacade, l as WorkspaceHistory, m as WritableWorkspaceFacade, n as HistoryCheckpoint, o as UseWorkspaceOptions, p as WorkspaceWriteTools, r as HistoryCheckpointOptions, s as WorkspaceFacade, t as History, u as WorkspaceReadToolSet } from "./use-DhwhbAVV.js";
|
|
5
|
+
import { n as normalizeSafeWorkspacePath } from "./path-zHxQUbqa.js";
|
|
6
|
+
import { r as resolveRegisteredWorkspaceDefinition } from "./registry-Cg1TJVVZ.js";
|
|
7
|
+
import { t as invalidateWorkspaceStore } from "./state-B8zbLi5t.js";
|
|
8
|
+
import { t as registerWorkspacePlugin } from "./plugins-DqQ8b4T5.js";
|
|
7
9
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
8
|
-
import { sourceIgnores } from "@vite-hub/source";
|
|
10
|
+
import { ArrayCollectionOptions, ArrayCollectionQuery, ArrayCollectionQueryInput, ProviderCollectionSource, sourceIgnores } from "@vite-hub/source";
|
|
9
11
|
import { FileSourceOptions as FileSourceOptions$1 } from "@vite-hub/source/file";
|
|
10
12
|
import { GitHubSourceOptions as GitHubSourceOptions$1 } from "@vite-hub/source/github";
|
|
11
13
|
import { GlobSourceOptions as GlobSourceOptions$1 } from "@vite-hub/source/glob";
|
|
12
14
|
import { McpResourceContent, McpResourceDescriptor, McpResourcesClient, McpResourcesClientConfig, McpResourcesRequestOptions, McpResourcesServer, McpResourcesSourceOptions as McpResourcesSourceOptions$1 } from "@vite-hub/source/mcp";
|
|
13
|
-
|
|
15
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
14
16
|
//#region src/core/define.d.ts
|
|
15
|
-
declare function defineWorkspace(definition: WorkspaceDefinitionInput): WorkspaceDefinitionInput;
|
|
17
|
+
export declare function defineWorkspace(definition: WorkspaceDefinitionInput): WorkspaceDefinitionInput;
|
|
16
18
|
//#endregion
|
|
17
19
|
//#region src/sources/runtime-options.d.ts
|
|
18
20
|
type ExactOptions$1<TInput, TShape> = TInput & Record<Exclude<keyof TInput, keyof TShape>, never>;
|
|
@@ -26,14 +28,14 @@ type CustomWorkspaceSourceFile = Omit<WorkspaceSourceItem, "content" | "contentS
|
|
|
26
28
|
type CustomWorkspaceSourceFiles = WorkspaceSourceRuntimeOptions & Pick<WorkspaceSource, "probeKeys"> & {
|
|
27
29
|
files: readonly CustomWorkspaceSourceFile[];
|
|
28
30
|
};
|
|
29
|
-
declare function custom<const TSource extends CustomWorkspaceSourceFiles>(source: ExactOptions$1<TSource, CustomWorkspaceSourceFiles>): WorkspaceSource;
|
|
30
|
-
declare function custom<const TSource extends WorkspaceSource>(source: ExactOptions$1<TSource, WorkspaceSource>): WorkspaceSource;
|
|
31
|
+
export declare function custom<const TSource extends CustomWorkspaceSourceFiles>(source: ExactOptions$1<TSource, CustomWorkspaceSourceFiles>): WorkspaceSource;
|
|
32
|
+
export declare function custom<const TSource extends WorkspaceSource>(source: ExactOptions$1<TSource, WorkspaceSource>): WorkspaceSource;
|
|
31
33
|
//#endregion
|
|
32
34
|
//#region src/sources/file.d.ts
|
|
33
35
|
type FileWorkspaceSourceRuntimeOptions = WorkspaceSourceRuntimeOptions & Pick<WorkspaceSource, "probeKeys">;
|
|
34
36
|
type FileSourceOptions<TKey extends string = string> = FileSourceOptions$1<TKey> & FileWorkspaceSourceRuntimeOptions;
|
|
35
|
-
declare function file<const TKey extends string>(input: TKey): WorkspaceSource;
|
|
36
|
-
declare function file<const TKey extends string = string, const TOptions extends FileSourceOptions<TKey> = FileSourceOptions<TKey>>(input: ExactOptions$1<TOptions, FileSourceOptions<TKey>>): WorkspaceSource;
|
|
37
|
+
export declare function file<const TKey extends string>(input: TKey): WorkspaceSource;
|
|
38
|
+
export declare function file<const TKey extends string = string, const TOptions extends FileSourceOptions<TKey> = FileSourceOptions<TKey>>(input: ExactOptions$1<TOptions, FileSourceOptions<TKey>>): WorkspaceSource;
|
|
37
39
|
//#endregion
|
|
38
40
|
//#region src/sources/fetch.d.ts
|
|
39
41
|
type FetchSourceMethod = "GET" | "HEAD" | "POST";
|
|
@@ -104,9 +106,9 @@ interface FetchSourceOptions<TResponse = unknown, TOutput = TResponse> extends S
|
|
|
104
106
|
}
|
|
105
107
|
type FetchSourceResolver<TResponse = unknown, TOutput = TResponse> = (context: WorkspaceSourceResolutionContext) => MaybePromise<FetchSourceOptions<TResponse, TOutput> | false | null | undefined>;
|
|
106
108
|
type FetchSourceInput<TResponse = unknown, TOutput = TResponse> = FetchSourceOptions<TResponse, TOutput> | FetchSourceResolver<TResponse, TOutput>;
|
|
107
|
-
declare function fetch<TResponse = unknown, TOutput = TResponse>(options: ExactOptions<FetchSourceOptions<TResponse, TOutput>, FetchSourceOptions<TResponse, TOutput>>): WorkspaceSource;
|
|
108
|
-
declare function fetch<const TOptions extends FetchSourceOptions<any, any>>(options: ExactOptions<TOptions, FetchSourceOptions<any, any>>): WorkspaceSource;
|
|
109
|
-
declare function fetch<TResponse = unknown, TOutput = TResponse>(resolve: FetchSourceResolver<TResponse, TOutput>): WorkspaceSource;
|
|
109
|
+
export declare function fetch<TResponse = unknown, TOutput = TResponse>(options: ExactOptions<FetchSourceOptions<TResponse, TOutput>, FetchSourceOptions<TResponse, TOutput>>): WorkspaceSource;
|
|
110
|
+
export declare function fetch<const TOptions extends FetchSourceOptions<any, any>>(options: ExactOptions<TOptions, FetchSourceOptions<any, any>>): WorkspaceSource;
|
|
111
|
+
export declare function fetch<TResponse = unknown, TOutput = TResponse>(resolve: FetchSourceResolver<TResponse, TOutput>): WorkspaceSource;
|
|
110
112
|
//#endregion
|
|
111
113
|
//#region src/sources/github.d.ts
|
|
112
114
|
type GitHubAuth = NonNullable<GitHubSourceOptions$1["auth"]>;
|
|
@@ -118,25 +120,51 @@ interface GitHubSourceOptions extends Omit<GitHubSourceOptions$1, "auth" | "igno
|
|
|
118
120
|
}
|
|
119
121
|
type GitHubSourceResolver = (context: WorkspaceSourceResolutionContext) => MaybePromise<GitHubResolvedSourceOptions | false | null | undefined>;
|
|
120
122
|
type GitHubSourceInput = GitHubSourceOptions | GitHubSourceResolver;
|
|
121
|
-
declare function github<const TOptions extends GitHubSourceOptions>(options: ExactOptions$1<TOptions, GitHubSourceOptions>): WorkspaceSource;
|
|
122
|
-
declare function github(resolve: GitHubSourceResolver): WorkspaceSource;
|
|
123
|
+
export declare function github<const TOptions extends GitHubSourceOptions>(options: ExactOptions$1<TOptions, GitHubSourceOptions>): WorkspaceSource;
|
|
124
|
+
export declare function github(resolve: GitHubSourceResolver): WorkspaceSource;
|
|
123
125
|
//#endregion
|
|
124
126
|
//#region src/sources/glob.d.ts
|
|
125
127
|
type GlobSourceOptions = GlobSourceOptions$1 & WorkspaceSourceRuntimeOptions;
|
|
126
|
-
declare function glob<const TOptions extends GlobSourceOptions>(options: ExactOptions$1<TOptions, GlobSourceOptions>): WorkspaceSource;
|
|
128
|
+
export declare function glob<const TOptions extends GlobSourceOptions>(options: ExactOptions$1<TOptions, GlobSourceOptions>): WorkspaceSource;
|
|
127
129
|
//#endregion
|
|
128
130
|
//#region src/sources/markdown.d.ts
|
|
129
|
-
declare function markdown(options: FileSourceOptions): WorkspaceSource;
|
|
131
|
+
export declare function markdown(options: FileSourceOptions): WorkspaceSource;
|
|
130
132
|
//#endregion
|
|
131
133
|
//#region src/sources/mcp-resources.d.ts
|
|
132
134
|
interface McpResourcesSourceOptions<TKey extends string = string> extends Omit<McpResourcesSourceOptions$1<TKey>, "cache">, WorkspaceSourceRuntimeOptions {}
|
|
133
|
-
declare function mcpResources<const TKey extends string = string, const TOptions extends McpResourcesSourceOptions<TKey> = McpResourcesSourceOptions<TKey>>(options: ExactOptions$1<TOptions, McpResourcesSourceOptions<TKey>>): WorkspaceSource;
|
|
135
|
+
export declare function mcpResources<const TKey extends string = string, const TOptions extends McpResourcesSourceOptions<TKey> = McpResourcesSourceOptions<TKey>>(options: ExactOptions$1<TOptions, McpResourcesSourceOptions<TKey>>): WorkspaceSource;
|
|
134
136
|
declare namespace index_d_exports {
|
|
135
137
|
export { FetchSourceInput, FetchSourceOptions, FetchSourceRequest, FetchSourceRequestOptions, FetchSourceResolver, FileSourceOptions, GitHubSourceInput, GitHubSourceOptions, GitHubSourceResolver, GlobSourceOptions, McpResourceContent, McpResourceDescriptor, McpResourcesClient, McpResourcesClientConfig, McpResourcesRequestOptions, McpResourcesServer, McpResourcesSourceOptions, custom, fetch, file, github, glob, markdown, mcpResources };
|
|
136
138
|
}
|
|
137
139
|
//#endregion
|
|
140
|
+
//#region src/collection.d.ts
|
|
141
|
+
type WorkspaceFacade$1<Name extends WorkspaceName> = ReadonlyWorkspaceFacade<Name> | WritableWorkspaceFacade<Name>;
|
|
142
|
+
interface WorkspaceFileCollectionOptions<Name extends WorkspaceName = WorkspaceName, TFilter extends string = string> extends ArrayCollectionOptions<TFilter> {
|
|
143
|
+
/** Workspace-relative path of a JSON file that contains one array. */
|
|
144
|
+
path: string;
|
|
145
|
+
/** Workspace name, an open Workspace, or a function that opens one per request. */
|
|
146
|
+
workspace: Name | WorkspaceFacade$1<Name> | (() => WorkspaceFacade$1<Name> | Promise<WorkspaceFacade$1<Name>>);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A Collection source over a JSON array stored in a Workspace file.
|
|
150
|
+
*
|
|
151
|
+
* Every request reads the file and queries it in memory with `array()`. The file's Workspace digest binds cursors,
|
|
152
|
+
* so a write to the file makes older cursors stale. Pass `schema` to validate and type the items.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* export const articles = defineCollection({
|
|
156
|
+
* source: workspaceFile({ workspace: 'catalog', path: 'data/articles.json', filters: ['category'], search: ['title'] }),
|
|
157
|
+
* })
|
|
158
|
+
*/
|
|
159
|
+
export declare function workspaceFile<TSchema extends StandardSchemaV1, Name extends WorkspaceName = WorkspaceName, const TFilter extends string = never>(options: WorkspaceFileCollectionOptions<Name, TFilter> & {
|
|
160
|
+
schema: TSchema;
|
|
161
|
+
}): ProviderCollectionSource<StandardSchemaV1.InferOutput<TSchema>, ArrayCollectionQuery<TFilter>, ArrayCollectionQueryInput<TFilter>>;
|
|
162
|
+
export declare function workspaceFile<Name extends WorkspaceName = WorkspaceName, const TFilter extends string = never>(options: WorkspaceFileCollectionOptions<Name, TFilter> & {
|
|
163
|
+
schema?: undefined;
|
|
164
|
+
}): ProviderCollectionSource<Record<string, unknown>, ArrayCollectionQuery<TFilter>, ArrayCollectionQueryInput<TFilter>>;
|
|
165
|
+
//#endregion
|
|
138
166
|
//#region src/core/rules.d.ts
|
|
139
|
-
declare function resolveWorkspaceAutoCommit(definition: WorkspaceDefinition, diff: WorkspaceDiff): WorkspaceAutoCommitPlan | undefined;
|
|
167
|
+
export declare function resolveWorkspaceAutoCommit(definition: WorkspaceDefinition, diff: WorkspaceDiff): WorkspaceAutoCommitPlan | undefined;
|
|
140
168
|
//#endregion
|
|
141
169
|
//#region src/core/glob-pattern.d.ts
|
|
142
170
|
interface WorkspaceGlobPatternLimits {
|
|
@@ -144,25 +172,18 @@ interface WorkspaceGlobPatternLimits {
|
|
|
144
172
|
maxComplexity: number;
|
|
145
173
|
maxPatterns: number;
|
|
146
174
|
}
|
|
147
|
-
declare const modelWorkspaceGlobPatternLimits: Readonly<WorkspaceGlobPatternLimits>;
|
|
148
|
-
declare function assertModelWorkspaceGlobPattern(pattern: string | readonly string[], limits?: Readonly<WorkspaceGlobPatternLimits>): void;
|
|
175
|
+
export declare const modelWorkspaceGlobPatternLimits: Readonly<WorkspaceGlobPatternLimits>;
|
|
176
|
+
export declare function assertModelWorkspaceGlobPattern(pattern: string | readonly string[], limits?: Readonly<WorkspaceGlobPatternLimits>): void;
|
|
149
177
|
//#endregion
|
|
150
178
|
//#region src/core/errors.d.ts
|
|
151
|
-
type WorkspaceErrorCode = "
|
|
152
|
-
declare function isWorkspaceConflict(value: unknown): boolean;
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/core/path.d.ts
|
|
155
|
-
interface SafeWorkspacePathOptions {
|
|
156
|
-
allowEmpty?: boolean;
|
|
157
|
-
allowReserved?: boolean;
|
|
158
|
-
pattern?: boolean;
|
|
159
|
-
}
|
|
160
|
-
declare function normalizeSafeWorkspacePath(path?: string, options?: SafeWorkspacePathOptions): string;
|
|
179
|
+
type WorkspaceErrorCode = "WORKSPACE_CONFLICT" | "WORKSPACE_FAILED" | "WORKSPACE_NOT_FOUND" | "WORKSPACE_PATH_INVALID";
|
|
180
|
+
export declare function isWorkspaceConflict(value: unknown): boolean;
|
|
161
181
|
//#endregion
|
|
162
182
|
//#region src/storage/target.d.ts
|
|
163
183
|
interface WorkspaceStoreTarget {
|
|
164
184
|
provider: string;
|
|
185
|
+
containsPath?(ancestor: string, path: string): Promise<boolean>;
|
|
165
186
|
}
|
|
166
|
-
declare function resolveWorkspaceStoreTarget(source: unknown): Promise<WorkspaceStoreTarget | undefined>;
|
|
187
|
+
export declare function resolveWorkspaceStoreTarget(source: unknown): Promise<WorkspaceStoreTarget | undefined>;
|
|
167
188
|
//#endregion
|
|
168
|
-
export { type CloudflareArtifactsWorkspaceStoreOptions, type DiffOptions, type EnabledReadCapability, type ExecOptions, type ExecResult, type FetchSourceInput, type FetchSourceOptions, type FetchSourceRequest, type FetchSourceRequestOptions, type FetchSourceResolver, type FileSourceOptions, type GitHubSourceInput, type GitHubSourceOptions, type GitHubSourceResolver, type GitHubWorkspaceOption, type GitHubWorkspaceStoreOptions, type GlobOptions, type GlobSourceOptions, type History, type HistoryCheckpoint, type HistoryCheckpointOptions, type ListOptions, type LoaderContext, type LocalWorkspaceStoreOptions, type Logger, type MaybePromise, type McpResourceContent, type McpResourceDescriptor, type McpResourcesClient, type McpResourcesClientConfig, type McpResourcesRequestOptions, type McpResourcesServer, type McpResourcesSourceOptions, type MemoryWorkspaceStoreOptions, type MkdirOptions, type
|
|
189
|
+
export { type CloudflareArtifactsWorkspaceStoreOptions, type DiffOptions, type EnabledReadCapability, type ExecOptions, type ExecResult, type FetchSourceInput, type FetchSourceOptions, type FetchSourceRequest, type FetchSourceRequestOptions, type FetchSourceResolver, type FileSourceOptions, type GitHubSourceInput, type GitHubSourceOptions, type GitHubSourceResolver, type GitHubWorkspaceOption, type GitHubWorkspaceRefs, type GitHubWorkspaceStoreOptions, type GlobOptions, type GlobSourceOptions, type History, type HistoryCheckpoint, type HistoryCheckpointOptions, type ListOptions, type LoaderContext, type LocalWorkspaceStoreOptions, type Logger, type MaybePromise, type McpResourceContent, type McpResourceDescriptor, type McpResourcesClient, type McpResourcesClientConfig, type McpResourcesRequestOptions, type McpResourcesServer, type McpResourcesSourceOptions, type MemoryWorkspaceStoreOptions, type MkdirOptions, type ReadFileOptions, type ReadFileResult, type ReadonlyWorkspaceFacade, type ReadonlyWorkspaceFs, type ResolvedWorkspaceModuleOptions, type ResolvedWorkspaceRule, type RmOptions, type ShellEnabled, type SnapshotOptions, type SourceContext, type SourceContextWorkspaceFiles, type UseWorkspaceOptions, type VercelBlobWorkspaceStoreOptions, type Workspace, type WorkspaceAssetPath, type WorkspaceAssets, type WorkspaceAssetsRegistry, type WorkspaceAutoCommitPlan, type WorkspaceCacheOptions, type WorkspaceCapabilities, type WorkspaceContent, type WorkspaceContentStream, type WorkspaceCustomSourceInput, type WorkspaceDefinition, type WorkspaceDefinitionInput, type WorkspaceDiff, type WorkspaceDiffEntry, type WorkspaceEntry, type WorkspaceErrorCode, type WorkspaceFacade, type WorkspaceFacadeToolOptions, type WorkspaceFetchSourceInput, type WorkspaceFetchSourceRequestOptions, type WorkspaceFile, type WorkspaceFileCollectionOptions, type WorkspaceFileSourceInput, type WorkspaceGitHubSourceInput, type WorkspaceGlobPatternLimits, type WorkspaceGlobSourceInput, type WorkspaceHistory, type WorkspaceHistoryChanges, type WorkspaceHistoryChangesCommitOptions, type WorkspaceHistoryCommitBase, type WorkspaceHistoryCommitOptions, type WorkspaceHistoryExtensions, type WorkspaceHistoryFile, type WorkspaceHistoryFileInput, type WorkspaceHistoryFilesCommitOptions, type WorkspaceHistoryListOptions, type WorkspaceHistoryListResult, type WorkspaceHistoryReader, type WorkspaceHistoryRef, type WorkspaceHistoryRefOptions, type WorkspaceHookContext, type WorkspaceHooks, type WorkspaceInstructionBinding, type WorkspaceInstructionBindingValue, type WorkspaceLoader, type WorkspaceLoaderSource, type WorkspaceMaterializeMode, type WorkspaceMaterializeSourcesOptions, type WorkspaceMaterializeSourcesProgressEvent, type WorkspaceMaterializeSourcesResult, type WorkspaceMcpResourcesSourceInput, type WorkspaceMergeCommit, type WorkspaceMergeConflict, type WorkspaceMergeConflictContext, type WorkspaceMergeOptions, type WorkspaceMergeResolution, type WorkspaceModuleOptions, type WorkspaceMoveResult, type WorkspaceName, type WorkspaceNameMap, type WorkspaceOpenPullRequestOptions, type WorkspacePathResult, type WorkspacePlugin, type WorkspacePrepareSessionProgressEvent, type WorkspacePullRequest, type WorkspaceReadOperations, type WorkspaceReadToolSet, type WorkspaceReadTools, type WorkspaceRebaseOptions, type WorkspaceRetainedHistory, type WorkspaceRevision, type WorkspaceRevisionView, type WorkspaceRule, type WorkspaceRules, type WorkspaceScopeName, type WorkspaceSearchHit, type WorkspaceSearchQuery, type WorkspaceSelectedScope, type WorkspaceSession, type WorkspaceSessionHost, type WorkspaceSessionHostFileEntry, type WorkspaceSessionHostFiles, type WorkspaceSessionOptions, type WorkspaceSessionWriteFileOptions, type WorkspaceShellResult, type WorkspaceSnapshot, type WorkspaceSource, type WorkspaceSourceBindingInput, type WorkspaceSourceDefinition, type WorkspaceSourceInput, type WorkspaceSourceItem, type WorkspaceSourceMaterializationCounts, type WorkspaceSourceMaterializationPathResult, type WorkspaceSourceMaterializationStatus, type WorkspaceSourceMount, type WorkspaceSourceMountOptions, type WorkspaceSourceRequestDescriptor, type WorkspaceSourceRequestExecutionInput, type WorkspaceSourceRequestExecutionResult, type WorkspaceSourceRequestExecutor, type WorkspaceSourceRequestMethod, type WorkspaceSourceResolutionContext, type WorkspaceSourceResolutionContextMap, type WorkspaceSourceResolutionContextValueReader, type WorkspaceSourceResolutionInvocation, type WorkspaceSourceResolutionResult, type WorkspaceSourceResolver, type WorkspaceSourceSelection, type WorkspaceSourceSyncConfig, type WorkspaceSourceSyncCounts, type WorkspaceSourceSyncPathResult, type WorkspaceSourceSyncPolicy, type WorkspaceSourceSyncResult, type WorkspaceSourceSyncStatus, type WorkspaceStat, type WorkspaceStore, type WorkspaceStoreHistory, type WorkspaceStoreHistoryCommitOptions, type WorkspaceStoreOptions, type WorkspaceStoreTarget, type WorkspaceStreamFile, type WorkspaceSyncOptions, type WorkspaceSyncResultDetails, type WorkspaceSyncSnapshotOptions, type WorkspaceToolOperations, type WorkspaceToolOptions, type WorkspaceTools, type WorkspaceValidateMode, type WorkspaceWriteErrorHook, type WorkspaceWriteHook, type WorkspaceWriteInput, type WorkspaceWriteMode, type WorkspaceWriteOperation, type WorkspaceWriteOperations, type WorkspaceWriteToolMap, type WorkspaceWriteToolSet, type WorkspaceWriteTools, type WorkspaceWriteValidator, type WorkspaceWriteValidatorResult, type WritableWorkspaceFacade, type WritableWorkspaceFacadeToolOptions, type WritableWorkspaceFs, type WriteFileOptions, createWorkspace, createWorkspaceTools, invalidateWorkspaceStore, normalizeSafeWorkspacePath, registerWorkspacePlugin, resolveRegisteredWorkspaceDefinition, index_d_exports as source, sourceIgnores, useWorkspace };
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { n as __exportAll } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { t as createWorkspaceTools } from "./ai-BqCC8BpY.js";
|
|
4
|
-
import { d as registerMcpResourcesSourceLoader, p as fetch, u as prepareWorkspaceSource, v as markLiveWorkspaceSource } from "./config-Bc3c4Su1.js";
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
+
import { r as isWorkspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
5
3
|
import { n as resolveWorkspaceStoreTarget } from "./target-D4Bqb1eH.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import { t as
|
|
4
|
+
import { t as createWorkspaceTools } from "./ai-BZyLwULx.js";
|
|
5
|
+
import { d as withWorkspaceRuntimeOptions, m as fetch, u as ownSourceOption } from "./config-B7dmzDX3.js";
|
|
6
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-DY5GP47p.js";
|
|
7
|
+
import { g as registerWorkspacePlugin, h as resolveWorkspaceAutoCommit } from "./utils-Blrh4N2n.js";
|
|
8
|
+
import { t as createWorkspace } from "./workspace-6pxkOuxr.js";
|
|
9
|
+
import { t as file } from "./file-C0_aPWSS.js";
|
|
10
|
+
import { t as github } from "./github-CPxHtFB7.js";
|
|
11
|
+
import { t as glob } from "./glob--XcLlcml.js";
|
|
12
|
+
import { t as mcpResources } from "./mcp-resources-BREFCmtn.js";
|
|
13
|
+
import { r as resolveRegisteredWorkspaceDefinition } from "./registry-Bp-8UUfG.js";
|
|
14
|
+
import { t as useWorkspace } from "./use-BQj7nSz6.js";
|
|
13
15
|
import { invalidateWorkspaceStore } from "./runtime/state.js";
|
|
14
|
-
import {
|
|
16
|
+
import { hasRuntimeType } from "@vite-hub/runtime/internal/runtime-type";
|
|
17
|
+
import { array, sourceIgnores } from "@vite-hub/source";
|
|
15
18
|
import { lookup } from "mrmime";
|
|
16
19
|
import { markdown as markdown$1 } from "@vite-hub/source/markdown";
|
|
17
|
-
import { mcpResources as mcpResources$1 } from "@vite-hub/source/mcp";
|
|
18
20
|
//#region src/core/define.ts
|
|
19
|
-
const workspaceDefinitionKeys = new Set([
|
|
21
|
+
const workspaceDefinitionKeys = /* @__PURE__ */ new Set([
|
|
20
22
|
"bindings",
|
|
21
23
|
"commit",
|
|
22
24
|
"hooks",
|
|
23
25
|
"loaders",
|
|
24
26
|
"plugins",
|
|
25
|
-
"publish",
|
|
26
27
|
"rootDir",
|
|
27
28
|
"rules",
|
|
28
29
|
"sourceRootDir",
|
|
@@ -32,18 +33,18 @@ const workspaceDefinitionKeys = new Set([
|
|
|
32
33
|
function assertWorkspaceDefinitionKeys(definition) {
|
|
33
34
|
const unsupported = Object.keys(definition).filter((key) => !workspaceDefinitionKeys.has(key));
|
|
34
35
|
if (!unsupported.length) return;
|
|
35
|
-
throw
|
|
36
|
+
throw workspaceErrorDiagnostics.WORKSPACE_R0015({ message: `[vitehub] defineWorkspace does not support option${unsupported.length === 1 ? "" : "s"}: ${unsupported.join(", ")}.` });
|
|
36
37
|
}
|
|
37
38
|
function defineWorkspace(definition) {
|
|
38
|
-
if (!definition || typeof definition !== "object") throw
|
|
39
|
-
if ("name" in definition) throw
|
|
39
|
+
if (!definition || typeof definition !== "object") throw workspaceErrorDiagnostics.WORKSPACE_R0016({ message: "[vitehub] defineWorkspace requires a workspace definition." });
|
|
40
|
+
if ("name" in definition) throw workspaceErrorDiagnostics.WORKSPACE_R0017({ message: "[vitehub] Workspace names are inferred from definition filenames." });
|
|
40
41
|
assertWorkspaceDefinitionKeys(definition);
|
|
41
42
|
return definition;
|
|
42
43
|
}
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region src/sources/custom.ts
|
|
45
46
|
function custom(source) {
|
|
46
|
-
if (!("files"
|
|
47
|
+
if (!Object.hasOwn(source, "files") || !Array.isArray(source.files)) return source;
|
|
47
48
|
const { files: inputFiles, ...options } = source;
|
|
48
49
|
const files = inputFiles.map((file) => ({
|
|
49
50
|
...file,
|
|
@@ -70,43 +71,15 @@ function custom(source) {
|
|
|
70
71
|
//#endregion
|
|
71
72
|
//#region src/sources/markdown.ts
|
|
72
73
|
function markdown(options) {
|
|
73
|
-
const
|
|
74
|
+
const workspacePath = Object.hasOwn(options, "workspacePath") && options.workspacePath ? options.workspacePath : Object.hasOwn(options, "path") && options.path ? options.path : "";
|
|
75
|
+
const key = normalizeSafeWorkspacePath(workspacePath);
|
|
76
|
+
const source = markdown$1(options);
|
|
74
77
|
return {
|
|
75
|
-
...withWorkspaceRuntimeOptions(
|
|
76
|
-
probeKeys: options
|
|
78
|
+
...withWorkspaceRuntimeOptions(source, options),
|
|
79
|
+
probeKeys: ownSourceOption(options, "probeKeys") || [key]
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
82
|
//#endregion
|
|
80
|
-
//#region src/sources/mcp-resources.ts
|
|
81
|
-
function mcpResources(options) {
|
|
82
|
-
const livePaths = {};
|
|
83
|
-
const baseSource = mcpResources$1({
|
|
84
|
-
...options,
|
|
85
|
-
cache: options.cache
|
|
86
|
-
});
|
|
87
|
-
return markLiveWorkspaceSource(withWorkspaceRuntimeOptions({
|
|
88
|
-
...baseSource,
|
|
89
|
-
async prepare(ctx) {
|
|
90
|
-
await prepareWorkspaceSource(baseSource, ctx);
|
|
91
|
-
resetLivePaths(livePaths, resolveMountPath(options.mount, ctx), await baseSource.getKeys(ctx));
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
...options,
|
|
95
|
-
materialize: options.materialize || (options.sync ? "none" : "lazy")
|
|
96
|
-
}), livePaths);
|
|
97
|
-
}
|
|
98
|
-
registerMcpResourcesSourceLoader((input) => mcpResources(input));
|
|
99
|
-
function resolveMountPath(mount, ctx) {
|
|
100
|
-
return normalizeSafeWorkspacePath((typeof mount === "string" ? mount : mount?.path) ?? ctx.mountPath ?? ctx.source ?? "", { allowEmpty: true });
|
|
101
|
-
}
|
|
102
|
-
function resetLivePaths(paths, mountPath, keys) {
|
|
103
|
-
for (const path of Object.keys(paths)) delete paths[path];
|
|
104
|
-
for (const key of keys) {
|
|
105
|
-
const path = normalizeSafeWorkspacePath(`${mountPath}/${key}`.replace(/\/+/g, "/"), { allowEmpty: false });
|
|
106
|
-
paths[path] = key;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
83
|
//#region src/sources/index.ts
|
|
111
84
|
var sources_exports = /* @__PURE__ */ __exportAll({
|
|
112
85
|
custom: () => custom,
|
|
@@ -117,6 +90,33 @@ var sources_exports = /* @__PURE__ */ __exportAll({
|
|
|
117
90
|
markdown: () => markdown,
|
|
118
91
|
mcpResources: () => mcpResources
|
|
119
92
|
});
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/collection.ts
|
|
95
|
+
async function openWorkspace(input) {
|
|
96
|
+
if (hasRuntimeType(input, "function")) return await input();
|
|
97
|
+
if (hasRuntimeType(input, "string")) return useWorkspace(input);
|
|
98
|
+
return input;
|
|
99
|
+
}
|
|
100
|
+
function workspaceFile(options) {
|
|
101
|
+
const { path, schema, workspace: input, ...query } = options;
|
|
102
|
+
const load = async ({ signal }) => {
|
|
103
|
+
const workspace = await openWorkspace(input);
|
|
104
|
+
const stat = await workspace.fs.stat(path);
|
|
105
|
+
if (stat.type !== "file") throw workspaceErrorDiagnostics.WORKSPACE_R0010({ path });
|
|
106
|
+
const raw = await workspace.fs.readFile(path, { encoding: "utf8" });
|
|
107
|
+
signal?.throwIfAborted();
|
|
108
|
+
const items = JSON.parse(raw);
|
|
109
|
+
if (!Array.isArray(items)) throw workspaceErrorDiagnostics.WORKSPACE_R0011({ path });
|
|
110
|
+
return {
|
|
111
|
+
digest: stat.digest || void 0,
|
|
112
|
+
items
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
return schema ? array(load, {
|
|
116
|
+
...query,
|
|
117
|
+
schema
|
|
118
|
+
}) : array(load, query);
|
|
119
|
+
}
|
|
120
120
|
const modelWorkspaceGlobPatternLimits = Object.freeze({
|
|
121
121
|
maxBytes: 2048,
|
|
122
122
|
maxComplexity: 1024,
|
|
@@ -221,19 +221,19 @@ function patternComplexity(pattern, limit) {
|
|
|
221
221
|
}
|
|
222
222
|
function assertModelWorkspaceGlobPattern(pattern, limits = modelWorkspaceGlobPatternLimits) {
|
|
223
223
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
224
|
-
if (patterns.length > limits.maxPatterns) throw
|
|
224
|
+
if (patterns.length > limits.maxPatterns) throw workspaceErrorDiagnostics.WORKSPACE_R0018({ message: `[vitehub] Workspace glob accepts at most ${limits.maxPatterns} model-facing patterns.` });
|
|
225
225
|
let bytes = 0;
|
|
226
226
|
for (const item of patterns) {
|
|
227
227
|
bytes = boundedAdd(bytes, boundedUtf8Bytes(item, limits.maxBytes), limits.maxBytes);
|
|
228
228
|
if (bytes > limits.maxBytes) break;
|
|
229
229
|
}
|
|
230
|
-
if (bytes > limits.maxBytes) throw
|
|
230
|
+
if (bytes > limits.maxBytes) throw workspaceErrorDiagnostics.WORKSPACE_R0019({ message: `[vitehub] Workspace glob pattern input exceeds the model-facing limit of ${limits.maxBytes} bytes.` });
|
|
231
231
|
let complexity = 0;
|
|
232
232
|
for (const item of patterns) {
|
|
233
233
|
const normalized = item.replace(/\\/g, "/");
|
|
234
234
|
complexity = boundedAdd(complexity, patternComplexity(normalized, limits.maxComplexity), limits.maxComplexity);
|
|
235
|
-
if (complexity > limits.maxComplexity) throw
|
|
235
|
+
if (complexity > limits.maxComplexity) throw workspaceErrorDiagnostics.WORKSPACE_R0020({ message: `[vitehub] Workspace glob pattern complexity exceeds the model-facing limit of ${limits.maxComplexity} expansions.` });
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
//#endregion
|
|
239
|
-
export { assertModelWorkspaceGlobPattern, createWorkspace, createWorkspaceTools, custom, defineWorkspace, fetch, file, github, glob, invalidateWorkspaceStore, isWorkspaceConflict, markdown, mcpResources, modelWorkspaceGlobPatternLimits, normalizeSafeWorkspacePath, resolveRegisteredWorkspaceDefinition, resolveWorkspaceAutoCommit, resolveWorkspaceStoreTarget, sources_exports as source, sourceIgnores, useWorkspace };
|
|
239
|
+
export { assertModelWorkspaceGlobPattern, createWorkspace, createWorkspaceTools, custom, defineWorkspace, fetch, file, github, glob, invalidateWorkspaceStore, isWorkspaceConflict, markdown, mcpResources, modelWorkspaceGlobPatternLimits, normalizeSafeWorkspacePath, registerWorkspacePlugin, resolveRegisteredWorkspaceDefinition, resolveWorkspaceAutoCommit, resolveWorkspaceStoreTarget, sources_exports as source, sourceIgnores, useWorkspace, workspaceFile };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
2
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3
|
+
function normalizeWindowsPath(input = "") {
|
|
4
|
+
if (!input) return input;
|
|
5
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
8
|
+
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
9
|
+
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
10
|
+
function cwd() {
|
|
11
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
12
|
+
return "/";
|
|
13
|
+
}
|
|
14
|
+
const resolve = function(...arguments_) {
|
|
15
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
16
|
+
let resolvedPath = "";
|
|
17
|
+
let resolvedAbsolute = false;
|
|
18
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
19
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
20
|
+
if (!path || path.length === 0) continue;
|
|
21
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
22
|
+
resolvedAbsolute = isAbsolute(path);
|
|
23
|
+
}
|
|
24
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
25
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
26
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
27
|
+
};
|
|
28
|
+
function normalizeString(path, allowAboveRoot) {
|
|
29
|
+
let res = "";
|
|
30
|
+
let lastSegmentLength = 0;
|
|
31
|
+
let lastSlash = -1;
|
|
32
|
+
let dots = 0;
|
|
33
|
+
let char = null;
|
|
34
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
35
|
+
if (index < path.length) char = path[index];
|
|
36
|
+
else if (char === "/") break;
|
|
37
|
+
else char = "/";
|
|
38
|
+
if (char === "/") {
|
|
39
|
+
if (lastSlash === index - 1 || dots === 1);
|
|
40
|
+
else if (dots === 2) {
|
|
41
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
42
|
+
if (res.length > 2) {
|
|
43
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
44
|
+
if (lastSlashIndex === -1) {
|
|
45
|
+
res = "";
|
|
46
|
+
lastSegmentLength = 0;
|
|
47
|
+
} else {
|
|
48
|
+
res = res.slice(0, lastSlashIndex);
|
|
49
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
50
|
+
}
|
|
51
|
+
lastSlash = index;
|
|
52
|
+
dots = 0;
|
|
53
|
+
continue;
|
|
54
|
+
} else if (res.length > 0) {
|
|
55
|
+
res = "";
|
|
56
|
+
lastSegmentLength = 0;
|
|
57
|
+
lastSlash = index;
|
|
58
|
+
dots = 0;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (allowAboveRoot) {
|
|
63
|
+
res += res.length > 0 ? "/.." : "..";
|
|
64
|
+
lastSegmentLength = 2;
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
68
|
+
else res = path.slice(lastSlash + 1, index);
|
|
69
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
70
|
+
}
|
|
71
|
+
lastSlash = index;
|
|
72
|
+
dots = 0;
|
|
73
|
+
} else if (char === "." && dots !== -1) ++dots;
|
|
74
|
+
else dots = -1;
|
|
75
|
+
}
|
|
76
|
+
return res;
|
|
77
|
+
}
|
|
78
|
+
const isAbsolute = function(p) {
|
|
79
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
80
|
+
};
|
|
81
|
+
const relative = function(from, to) {
|
|
82
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
83
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
84
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
|
|
85
|
+
const _fromCopy = [..._from];
|
|
86
|
+
for (const segment of _fromCopy) {
|
|
87
|
+
if (_to[0] !== segment) break;
|
|
88
|
+
_from.shift();
|
|
89
|
+
_to.shift();
|
|
90
|
+
}
|
|
91
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
92
|
+
};
|
|
93
|
+
const dirname = function(p) {
|
|
94
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
95
|
+
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
96
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region ../internal/src/inspect.ts
|
|
100
|
+
function relativeDefinitionFile(projectRoot, file) {
|
|
101
|
+
return relative(projectRoot, file).replaceAll("\\", "/");
|
|
102
|
+
}
|
|
103
|
+
const redactedInspectionValue = "[redacted]";
|
|
104
|
+
const secretKeyPattern = /secret|token|passw(?:or)?d|credential|api[-_\s]?key|private[-_\s]?key|authorization|cookie|signature|dsn|connection[-_\s]?string/i;
|
|
105
|
+
const secretValuePattern = /^(?:[a-z][a-z0-9+.-]*:\/\/[^/\s?#]*@|bearer\s)/i;
|
|
106
|
+
/** Whether an inspection field names a credential, regardless of its value. */
|
|
107
|
+
function isSecretInspectionKey(key) {
|
|
108
|
+
return secretKeyPattern.test(key);
|
|
109
|
+
}
|
|
110
|
+
const embeddedUrlCredentialPattern = /\b([a-z][a-z0-9+.-]*:\/\/)[^/\s?#]*@/gi;
|
|
111
|
+
const embeddedCookiePattern = /\b([\w-]*cookie[\w-]*["']?\s*[:=]\s*)(?:"(?:\\[^\r\n]|[^"\\\r\n])*"(?:\s*;\s*[\w.-]+\s*=[^;\r\n]*)*|'(?:\\[^\r\n]|[^'\\\r\n])*'(?:\s*;\s*[\w.-]+\s*=[^;\r\n]*)*|[^\r\n]+?(?=\s*(?:;\s*[^;=\r\n/]+\s*(?:\r?\n|$)|&|\r?\n|$)))/gi;
|
|
112
|
+
const embeddedBearerPattern = /\bbearer\s+[^\s,;]+/gi;
|
|
113
|
+
const embeddedAuthorizationPattern = new RegExp(String.raw`\b([\w-]*authorization[\w-]*["']?\s*[:=]\s*)(?!\[redacted\](?=$|[\s,;}&]))(?:"(?:\\[^\r\n]|[^"\\\r\n])*"|'(?:\\[^\r\n]|[^'\\\r\n])*'|[^\r\n]+?(?=\s*(?:[,;])?\s*(?:${secretKeyPattern.source})[\w-]*\s*[:=]|\s+rejected\b|$))`, "gi");
|
|
114
|
+
const embeddedSecretAssignmentPattern = new RegExp(String.raw`\b([\w-]*(?:${secretKeyPattern.source})[\w-]*["']?\s*[:=]\s*)(?!\[redacted\](?=$|[\s,;}&]))(?:"(?:\\[^\r\n]|[^"\\\r\n])*"|'(?:\\[^\r\n]|[^'\\\r\n])*'|[^\s,;&#&]+)`, "gi");
|
|
115
|
+
/**
|
|
116
|
+
* Removes credentials inside free text, for example an error message. URL credentials, bearer tokens, and
|
|
117
|
+
* `name=value` pairs with a secret name are replaced with `[redacted]`.
|
|
118
|
+
*/
|
|
119
|
+
function redactInspectionText(value) {
|
|
120
|
+
return value.replace(embeddedUrlCredentialPattern, `$1${redactedInspectionValue}@`).replace(embeddedAuthorizationPattern, `$1${redactedInspectionValue}`).replace(embeddedCookiePattern, `$1${redactedInspectionValue}`).replace(embeddedBearerPattern, `Bearer ${redactedInspectionValue}`).replace(embeddedSecretAssignmentPattern, `$1${redactedInspectionValue}`);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Removes values that can carry credentials before inspection output leaves the process.
|
|
124
|
+
* Keys that name secrets, plaintext Worker `vars`, and URLs with embedded credentials are redacted.
|
|
125
|
+
*/
|
|
126
|
+
function redactInspectionValue(value, key) {
|
|
127
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
128
|
+
let remaining = 1e3;
|
|
129
|
+
function visit(entry, entryKey, depth = 0) {
|
|
130
|
+
if (entryKey && isSecretInspectionKey(entryKey)) return redactedInspectionValue;
|
|
131
|
+
if (--remaining < 0 || depth > 10) return "[truncated]";
|
|
132
|
+
if (typeof entry === "string") {
|
|
133
|
+
const text = entry.slice(0, 1e4);
|
|
134
|
+
return secretValuePattern.test(text) ? redactedInspectionValue : redactInspectionText(text);
|
|
135
|
+
}
|
|
136
|
+
if (typeof entry === "bigint") return entry.toString();
|
|
137
|
+
if (typeof entry === "number") return Number.isFinite(entry) ? entry : String(entry);
|
|
138
|
+
if (entry === null || typeof entry === "boolean") return entry;
|
|
139
|
+
if (typeof entry !== "object") return entry === void 0 ? null : "[unsupported]";
|
|
140
|
+
if (seen.has(entry)) return "[circular]";
|
|
141
|
+
seen.add(entry);
|
|
142
|
+
try {
|
|
143
|
+
let dateTime;
|
|
144
|
+
try {
|
|
145
|
+
dateTime = Date.prototype.getTime.call(entry);
|
|
146
|
+
} catch {}
|
|
147
|
+
if (dateTime !== void 0) return Number.isNaN(dateTime) ? "Invalid Date" : Date.prototype.toISOString.call(entry);
|
|
148
|
+
if (Array.isArray(entry)) return entry.slice(0, 100).map((item) => visit(item, void 0, depth + 1));
|
|
149
|
+
let setValues;
|
|
150
|
+
try {
|
|
151
|
+
setValues = [...Set.prototype.values.call(entry)];
|
|
152
|
+
} catch {}
|
|
153
|
+
if (setValues) return setValues.slice(0, 100).map((item) => visit(item, void 0, depth + 1));
|
|
154
|
+
let mapEntries;
|
|
155
|
+
try {
|
|
156
|
+
mapEntries = [...Map.prototype.entries.call(entry)];
|
|
157
|
+
} catch {}
|
|
158
|
+
const entries = mapEntries ? mapEntries.map(([name, item]) => [String(name), item]) : Object.entries(entry);
|
|
159
|
+
return Object.fromEntries(entries.slice(0, 100).map(([name, item]) => [name, name === "vars" && item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.keys(item).slice(0, 100).map((variable) => [variable, redactedInspectionValue])) : visit(item, name, depth + 1)]));
|
|
160
|
+
} finally {
|
|
161
|
+
seen.delete(entry);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return visit(value, key);
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
export { isAbsolute as a, dirname as i, redactInspectionValue as n, relative as o, relativeDefinitionFile as r, resolve as s, redactInspectionText as t };
|