@vite-hub/workspace 0.0.1 → 0.0.2

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.
Files changed (94) hide show
  1. package/README.md +190 -17
  2. package/dist/{ai-Bk3LLnit.js → ai-Cztw4eLk.js} +149 -29
  3. package/dist/ai-hFdsvDHC.d.ts +162 -0
  4. package/dist/ai.d.ts +2 -85
  5. package/dist/ai.js +1 -1
  6. package/dist/artifacts-store-BAV9jZpd.js +555 -0
  7. package/dist/asset-registry-CaG9b7tf.js +19 -0
  8. package/dist/cli.d.ts +31 -0
  9. package/dist/cli.js +303 -0
  10. package/dist/cloudflare-env-CKxUs2fa.js +20 -0
  11. package/dist/cloudflare.d.ts +16 -0
  12. package/dist/cloudflare.js +3 -0
  13. package/dist/collections/client.d.ts +39 -0
  14. package/dist/collections/client.js +137 -0
  15. package/dist/collections.d.ts +59 -0
  16. package/dist/collections.js +159 -0
  17. package/dist/config--r5unwPc.js +7811 -0
  18. package/dist/config-Ca5DM8fF.d.ts +28 -0
  19. package/dist/config-DCQ6y30R.js +30 -0
  20. package/dist/file-B2q9NE18.js +24 -0
  21. package/dist/{files-DbsIjBya.js → files-xy0le-_U.js} +6 -5
  22. package/dist/github-lIO6-2sH.js +194 -0
  23. package/dist/glob-DeH0dzZX.js +23 -0
  24. package/dist/host-I-_vDs05.js +370 -0
  25. package/dist/hosted-vercel-blob.d.ts +15 -0
  26. package/dist/hosted-vercel-blob.js +26 -0
  27. package/dist/hosted.d.ts +18 -0
  28. package/dist/hosted.js +30 -0
  29. package/dist/index.d.ts +137 -102
  30. package/dist/index.js +479 -594
  31. package/dist/lifecycle-Lhk3dAMt.js +176 -0
  32. package/dist/loader.d.ts +1 -1
  33. package/dist/loader.js +1 -1
  34. package/dist/nitro.d.ts +2 -31
  35. package/dist/nitro.js +2 -2
  36. package/dist/nuxt.d.ts +26 -0
  37. package/dist/nuxt.js +36 -0
  38. package/dist/path-CNI6wKIU.js +115 -0
  39. package/dist/{provider-BZuKAV4e.js → provider-CeQciesl.js} +142 -37
  40. package/dist/providers/cloudflare/artifacts-store.d.ts +1 -1
  41. package/dist/providers/cloudflare/artifacts-store.js +1 -383
  42. package/dist/providers/github/store.d.ts +6 -0
  43. package/dist/providers/github/store.js +362 -0
  44. package/dist/providers/vercel/blob-store.d.ts +1 -1
  45. package/dist/providers/vercel/blob-store.js +77 -18
  46. package/dist/publish.d.ts +3 -2
  47. package/dist/publish.js +48 -142
  48. package/dist/registry-C7DMdBXN.js +74 -0
  49. package/dist/{registry-D4Qzq26I.d.ts → registry-CoC9JxVt.d.ts} +3 -2
  50. package/dist/request-execution-C8qRcReq.js +80 -0
  51. package/dist/runtime/assets.d.ts +2 -1
  52. package/dist/runtime/assets.js +5 -5
  53. package/dist/runtime/empty-assets-registry.d.ts +1 -1
  54. package/dist/runtime/empty-registry.d.ts +1 -1
  55. package/dist/runtime/state.d.ts +4 -21
  56. package/dist/runtime/state.js +7 -4
  57. package/dist/runtime/workspace.d.ts +2 -0
  58. package/dist/runtime/workspace.js +2 -0
  59. package/dist/runtime.d.ts +38 -0
  60. package/dist/runtime.js +643 -0
  61. package/dist/{search-DtaEyjpO.js → search-C4REyHj9.js} +2 -2
  62. package/dist/server.d.ts +65 -0
  63. package/dist/server.js +355 -0
  64. package/dist/shared-BRycRSbo.js +255 -0
  65. package/dist/source-metadata.d.ts +2 -0
  66. package/dist/source-metadata.js +2 -0
  67. package/dist/state-DSAHEsq6.d.ts +25 -0
  68. package/dist/sync-DO42ypji.js +269 -0
  69. package/dist/target-D4Bqb1eH.js +11 -0
  70. package/dist/test.d.ts +1 -1
  71. package/dist/test.js +1 -1
  72. package/dist/types-DHkae7Cb.d.ts +628 -0
  73. package/dist/use-D16tf8Ph.d.ts +86 -0
  74. package/dist/use-d_PlAdOu.js +353 -0
  75. package/dist/{utils-BtAm_K5P.js → utils-BPdaCyI6.js} +7 -3
  76. package/dist/vite-NWC9mFjI.js +1882 -0
  77. package/dist/vite.d.ts +33 -5
  78. package/dist/vite.js +2 -131
  79. package/dist/workspace-f2DBLmPZ.d.ts +6 -0
  80. package/dist/workspace-n4wBmdaM.js +1476 -0
  81. package/package.json +158 -62
  82. package/dist/asset-registry-CMuQbyvl.js +0 -14
  83. package/dist/cloudflare-env-DL94Uvpz.js +0 -12
  84. package/dist/config-CvS-7sre.js +0 -49
  85. package/dist/errors-BUL8SoFS.js +0 -21
  86. package/dist/lifecycle-uD82JeGh.js +0 -92
  87. package/dist/module-8LZUMEXC.js +0 -922
  88. package/dist/path-BVv9OXhg.js +0 -63
  89. package/dist/registry-Cnr0NoKv.js +0 -932
  90. package/dist/runtime/nitro-plugin.d.ts +0 -6
  91. package/dist/runtime/nitro-plugin.js +0 -14
  92. package/dist/sandbox-DtGXCWRq.js +0 -198
  93. package/dist/types-CwNcWTdt.d.ts +0 -378
  94. /package/dist/{chunk-DrSxFLj_.js → chunk-8H4AJuhK.js} +0 -0
@@ -0,0 +1,162 @@
1
+ import { D as WorkspaceAssets, T as Workspace, et as WorkspaceMaterializeSourcesResult } from "./types-DHkae7Cb.js";
2
+ import { Tool, ToolSet } from "ai";
3
+
4
+ //#region src/ai.d.ts
5
+ type ShellObservationEvent = "command_finished" | "command_timed_out" | "policy_denied" | "session_disposed";
6
+ interface ShellRuntimeExecOptions {
7
+ cwd?: string;
8
+ env?: Record<string, string>;
9
+ onStderr?: (chunk: string) => void;
10
+ onStdout?: (chunk: string) => void;
11
+ stdin?: string;
12
+ timeout?: number;
13
+ workspacePaths?: string[];
14
+ }
15
+ interface ShellObservation {
16
+ command?: string;
17
+ cwd?: string;
18
+ durationMs?: number;
19
+ event: ShellObservationEvent;
20
+ exitCode: number | null;
21
+ maxOutputLength?: number;
22
+ outputTruncated?: boolean;
23
+ stderr: string;
24
+ stdout: string;
25
+ timedOut?: boolean;
26
+ workspaceGuardrail?: {
27
+ kind: "broad_search" | "missing_path" | "no_match" | "timeout";
28
+ path?: string;
29
+ };
30
+ }
31
+ interface ShellAnalyzeOptions {
32
+ maxInputBytes?: number;
33
+ timeoutMs?: number;
34
+ }
35
+ interface ShellAnalyzeResult {
36
+ commands?: string[];
37
+ error?: string;
38
+ hasCommandSubstitution?: boolean;
39
+ hasHeredocs?: boolean;
40
+ hasPipelines?: boolean;
41
+ hasRedirects?: boolean;
42
+ ok: boolean;
43
+ parser: "sh-syntax";
44
+ }
45
+ interface ShellProcess {
46
+ id: string;
47
+ command: string;
48
+ cwd?: string;
49
+ stop(): Promise<ShellObservation>;
50
+ }
51
+ interface ShellBoundary {
52
+ cwd: boolean;
53
+ env: boolean;
54
+ filesystem: {
55
+ mountPoint?: string;
56
+ writable: boolean;
57
+ };
58
+ network: boolean | "unknown";
59
+ processes: {
60
+ background: boolean;
61
+ interactive: boolean;
62
+ };
63
+ streaming: boolean;
64
+ timeout: {
65
+ enforcedBy: "provider" | "runtime" | "unsupported";
66
+ supported: boolean;
67
+ };
68
+ }
69
+ interface ShellExecutionProvider {
70
+ analyze?: (command: string, options?: ShellAnalyzeOptions) => Promise<ShellAnalyzeResult>;
71
+ boundary: ShellBoundary;
72
+ exec(command: string, options?: ShellRuntimeExecOptions): Promise<ShellObservation>;
73
+ startProcess?: (command: string, options?: ShellRuntimeExecOptions) => Promise<ShellProcess>;
74
+ }
75
+ interface ShellSessionPolicy {
76
+ maxOutputLength?: number;
77
+ maxShellCalls?: number;
78
+ timeout?: number;
79
+ }
80
+ type WorkspaceShellResult = ShellObservation;
81
+ interface WorkspacePathResult {
82
+ path: string;
83
+ }
84
+ interface WorkspaceMoveResult {
85
+ from: string;
86
+ to: string;
87
+ }
88
+ interface WorkspaceReadOperations {
89
+ list?: boolean;
90
+ materialize?: boolean;
91
+ read?: boolean;
92
+ search?: boolean;
93
+ }
94
+ interface WorkspaceWriteOperations {
95
+ appendFile?: boolean;
96
+ copyPath?: boolean;
97
+ deletePath?: boolean;
98
+ makeDir?: boolean;
99
+ movePath?: boolean;
100
+ writeFile?: boolean;
101
+ }
102
+ type WorkspaceToolOperations = WorkspaceReadOperations & {
103
+ write?: true | WorkspaceWriteOperations;
104
+ };
105
+ interface WorkspaceToolOptions<Operations extends WorkspaceToolOperations | undefined = undefined> extends Pick<ShellSessionPolicy, "maxOutputLength" | "maxShellCalls" | "timeout"> {
106
+ broadSearchPaths?: string[];
107
+ cwd?: string;
108
+ executionProvider?: ShellExecutionProvider | (() => MaybePromise<ShellExecutionProvider | undefined>);
109
+ operations?: Operations;
110
+ }
111
+ type EnabledReadCapability<Operations, Key extends keyof WorkspaceReadOperations> = Operations extends Record<Key, infer Value> ? Value extends false ? false : true : true;
112
+ type ShellEnabled<Operations> = true extends EnabledReadCapability<Operations, "list"> | EnabledReadCapability<Operations, "read"> | EnabledReadCapability<Operations, "search"> ? true : false;
113
+ type ResolvedWriteOperations<Operations> = Operations extends {
114
+ write: infer Write;
115
+ } ? Write : false;
116
+ type WorkspaceWriteToolMap = {
117
+ appendFile: Tool<{
118
+ content: string;
119
+ path: string;
120
+ }, WorkspacePathResult>;
121
+ copyPath: Tool<{
122
+ from: string;
123
+ overwrite?: boolean;
124
+ to: string;
125
+ }, WorkspaceMoveResult>;
126
+ deletePath: Tool<{
127
+ force?: boolean;
128
+ path: string;
129
+ recursive?: boolean;
130
+ }, WorkspacePathResult>;
131
+ makeDir: Tool<{
132
+ path: string;
133
+ recursive?: boolean;
134
+ }, WorkspacePathResult>;
135
+ movePath: Tool<{
136
+ from: string;
137
+ overwrite?: boolean;
138
+ to: string;
139
+ }, WorkspaceMoveResult>;
140
+ writeFile: Tool<{
141
+ content: string;
142
+ mediaType?: string;
143
+ path: string;
144
+ }, WorkspacePathResult>;
145
+ };
146
+ type EnabledWriteTools<Selection> = Selection extends true ? WorkspaceWriteToolMap : Selection extends WorkspaceWriteOperations ? { [Key in keyof WorkspaceWriteToolMap as Key extends keyof Selection ? Selection[Key] extends true ? Key : never : never]: WorkspaceWriteToolMap[Key] } : {};
147
+ type WorkspaceTools<Operations = undefined> = ((ShellEnabled<Operations> extends true ? {
148
+ shell: Tool<{
149
+ command: string;
150
+ }, WorkspaceShellResult>;
151
+ } : {}) & EnabledWriteTools<ResolvedWriteOperations<Operations>> & (Operations extends {
152
+ materialize: true;
153
+ } ? {
154
+ materialize_sources: Tool<{
155
+ path?: string;
156
+ sources?: string[];
157
+ }, WorkspaceMaterializeSourcesResult>;
158
+ } : {})) & ToolSet;
159
+ type MaybePromise<T> = T | Promise<T>;
160
+ declare function createWorkspaceTools<Operations extends WorkspaceToolOperations | undefined = undefined>(input: Workspace | WorkspaceAssets, options?: WorkspaceToolOptions<Operations>): WorkspaceTools<Operations>;
161
+ //#endregion
162
+ export { WorkspaceReadOperations as a, WorkspaceToolOptions as c, WorkspaceWriteToolMap as d, createWorkspaceTools as f, WorkspacePathResult as i, WorkspaceTools as l, ShellEnabled as n, WorkspaceShellResult as o, WorkspaceMoveResult as r, WorkspaceToolOperations as s, EnabledReadCapability as t, WorkspaceWriteOperations as u };
package/dist/ai.d.ts CHANGED
@@ -1,86 +1,3 @@
1
- import { B as WorkspaceMaterializeSourcesResult, C as WorkspaceAssets, x as Workspace } from "./types-CwNcWTdt.js";
2
- import { ShellObservation, ShellSessionPolicy } from "@vite-hub/shell";
3
- import { Tool, ToolSet } from "ai";
4
-
5
- //#region src/ai.d.ts
6
- type WorkspaceShellResult = ShellObservation;
7
- interface WorkspacePathResult {
8
- path: string;
9
- }
10
- interface WorkspaceMoveResult {
11
- from: string;
12
- to: string;
13
- }
14
- interface WorkspaceReadOperations {
15
- list?: boolean;
16
- materialize?: boolean;
17
- read?: boolean;
18
- search?: boolean;
19
- }
20
- interface WorkspaceWriteOperations {
21
- appendFile?: boolean;
22
- copyPath?: boolean;
23
- deletePath?: boolean;
24
- makeDir?: boolean;
25
- movePath?: boolean;
26
- writeFile?: boolean;
27
- }
28
- type WorkspaceToolOperations = WorkspaceReadOperations & {
29
- write?: true | WorkspaceWriteOperations;
30
- };
31
- interface WorkspaceToolOptions<Operations extends WorkspaceToolOperations | undefined = undefined> extends Pick<ShellSessionPolicy, "maxOutputLength" | "maxShellCalls" | "timeout"> {
32
- broadSearchPaths?: string[];
33
- cwd?: string;
34
- operations?: Operations;
35
- }
36
- type EnabledReadCapability<Operations, Key extends keyof WorkspaceReadOperations> = Operations extends Record<Key, infer Value> ? Value extends false ? false : true : true;
37
- type ShellEnabled<Operations> = true extends EnabledReadCapability<Operations, "list"> | EnabledReadCapability<Operations, "read"> | EnabledReadCapability<Operations, "search"> ? true : false;
38
- type ResolvedWriteOperations<Operations> = Operations extends {
39
- write: infer Write;
40
- } ? Write : false;
41
- type WorkspaceWriteToolMap = {
42
- appendFile: Tool<{
43
- content: string;
44
- path: string;
45
- }, WorkspacePathResult>;
46
- copyPath: Tool<{
47
- from: string;
48
- overwrite?: boolean;
49
- to: string;
50
- }, WorkspaceMoveResult>;
51
- deletePath: Tool<{
52
- force?: boolean;
53
- path: string;
54
- recursive?: boolean;
55
- }, WorkspacePathResult>;
56
- makeDir: Tool<{
57
- path: string;
58
- recursive?: boolean;
59
- }, WorkspacePathResult>;
60
- movePath: Tool<{
61
- from: string;
62
- overwrite?: boolean;
63
- to: string;
64
- }, WorkspaceMoveResult>;
65
- writeFile: Tool<{
66
- content: string;
67
- mediaType?: string;
68
- path: string;
69
- }, WorkspacePathResult>;
70
- };
71
- type EnabledWriteTools<Selection> = Selection extends true ? WorkspaceWriteToolMap : Selection extends WorkspaceWriteOperations ? { [Key in keyof WorkspaceWriteToolMap as Key extends keyof Selection ? Selection[Key] extends true ? Key : never : never]: WorkspaceWriteToolMap[Key] } : {};
72
- type WorkspaceTools<Operations = undefined> = ((ShellEnabled<Operations> extends true ? {
73
- shell: Tool<{
74
- command: string;
75
- }, WorkspaceShellResult>;
76
- } : {}) & EnabledWriteTools<ResolvedWriteOperations<Operations>> & (Operations extends {
77
- materialize: true;
78
- } ? {
79
- materialize_sources: Tool<{
80
- path?: string;
81
- sources?: string[];
82
- }, WorkspaceMaterializeSourcesResult>;
83
- } : {})) & ToolSet;
84
- declare function createWorkspaceTools<Operations extends WorkspaceToolOperations | undefined = undefined>(input: Workspace | WorkspaceAssets, options?: WorkspaceToolOptions<Operations>): WorkspaceTools<Operations>;
85
- //#endregion
1
+ import { et as WorkspaceMaterializeSourcesResult } from "./types-DHkae7Cb.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-hFdsvDHC.js";
86
3
  export { EnabledReadCapability, ShellEnabled, type WorkspaceMaterializeSourcesResult, WorkspaceMoveResult, WorkspacePathResult, WorkspaceReadOperations, WorkspaceShellResult, WorkspaceToolOperations, WorkspaceToolOptions, WorkspaceTools, WorkspaceWriteOperations, WorkspaceWriteToolMap, createWorkspaceTools };
package/dist/ai.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as createWorkspaceTools } from "./ai-Bk3LLnit.js";
1
+ import { t as createWorkspaceTools } from "./ai-Cztw4eLk.js";
2
2
  export { createWorkspaceTools };