@spotpatch/vite 1.8.0 → 1.10.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 +115 -43
- package/dist/cli.js +90 -25
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +117 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +123 -9
- package/dist/index.js.map +1 -1
- package/dist/runtime-client.js +34 -34
- package/dist/runtime-data-flow-panel.js +26 -0
- package/dist/runtime-data-flow-prelude.js +1 -0
- package/dist/runtime-external-handoff-panel.js +28 -0
- package/dist/runtime-react-adapter.js +1 -1
- package/package.json +8 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { SpotPatchOptions } from '@spotpatch/dev-server';
|
|
3
|
-
export { DEFAULT_OPTIONS, ResolvedSpotPatchOptions, SimpleAiOptions, SpotPatchAiOptions, SpotPatchOptions, resolveOptions } from '@spotpatch/dev-server';
|
|
3
|
+
export { DEFAULT_OPTIONS, ResolvedSpotPatchOptions, SimpleAiOptions, SpotPatchAiOptions, SpotPatchDataFlowOptions, SpotPatchOptions, resolveOptions } from '@spotpatch/dev-server';
|
|
4
4
|
export { AgentApplyMode, AgentCheckDefinition, AgentLimits, AiExecutionOptions, AiModelProfile, AiOptions, AiProviderAuthentication, AiProviderProtocol, ContextBudget, DEFAULT_AGENT_LIMITS, OpenAICompatibleProviderOptions, SpotPatchEditorPreference } from '@spotpatch/shared';
|
|
5
5
|
|
|
6
6
|
type ViteSpotPatchOptions = SpotPatchOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
import { SpotPatchOptions } from '@spotpatch/dev-server';
|
|
3
|
-
export { DEFAULT_OPTIONS, ResolvedSpotPatchOptions, SimpleAiOptions, SpotPatchAiOptions, SpotPatchOptions, resolveOptions } from '@spotpatch/dev-server';
|
|
3
|
+
export { DEFAULT_OPTIONS, ResolvedSpotPatchOptions, SimpleAiOptions, SpotPatchAiOptions, SpotPatchDataFlowOptions, SpotPatchOptions, resolveOptions } from '@spotpatch/dev-server';
|
|
4
4
|
export { AgentApplyMode, AgentCheckDefinition, AgentLimits, AiExecutionOptions, AiModelProfile, AiOptions, AiProviderAuthentication, AiProviderProtocol, ContextBudget, DEFAULT_AGENT_LIMITS, OpenAICompatibleProviderOptions, SpotPatchEditorPreference } from '@spotpatch/shared';
|
|
5
5
|
|
|
6
6
|
type ViteSpotPatchOptions = SpotPatchOptions;
|
package/dist/index.js
CHANGED
|
@@ -14,12 +14,15 @@ import { loadEnv } from "vite";
|
|
|
14
14
|
import { createRequire } from "module";
|
|
15
15
|
import { readFileSync } from "fs";
|
|
16
16
|
import path from "path";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
createRuntimeAiConfig,
|
|
19
|
+
createRuntimeDataFlowConfig
|
|
20
|
+
} from "@spotpatch/dev-server";
|
|
18
21
|
|
|
19
22
|
// package.json
|
|
20
23
|
var package_default = {
|
|
21
24
|
name: "@spotpatch/vite",
|
|
22
|
-
version: "1.
|
|
25
|
+
version: "1.10.0",
|
|
23
26
|
description: "Vite development plugin for SpotPatch.",
|
|
24
27
|
license: "MIT",
|
|
25
28
|
repository: {
|
|
@@ -65,11 +68,12 @@ var package_default = {
|
|
|
65
68
|
}
|
|
66
69
|
},
|
|
67
70
|
scripts: {
|
|
68
|
-
build: "tsup src/index.ts --format esm,cjs --dts --sourcemap --clean && tsup --config tsup.cli.config.ts && tsup --config tsup.runtime-client.config.ts && tsup --config tsup.runtime-react-adapter.config.ts",
|
|
71
|
+
build: "tsup src/index.ts --format esm,cjs --dts --sourcemap --clean && tsup --config tsup.cli.config.ts && tsup --config tsup.runtime-client.config.ts && tsup --config tsup.runtime-react-adapter.config.ts && tsup --config tsup.runtime-data-flow-prelude.config.ts && tsup --config tsup.runtime-data-flow-panel.config.ts && tsup --config tsup.runtime-external-handoff-panel.config.ts",
|
|
69
72
|
clean: `node --input-type=module -e "import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })"`,
|
|
70
73
|
typecheck: "tsc --noEmit -p tsconfig.json"
|
|
71
74
|
},
|
|
72
75
|
dependencies: {
|
|
76
|
+
"@spotpatch/bridge": "workspace:^",
|
|
73
77
|
"@spotpatch/compiler": "workspace:^",
|
|
74
78
|
"@spotpatch/dev-server": "workspace:^",
|
|
75
79
|
"@spotpatch/react-adapter": "workspace:^",
|
|
@@ -141,6 +145,18 @@ var SPOTPATCH_CLIENT_MODULE_ID = "virtual:spotpatch/client";
|
|
|
141
145
|
var RESOLVED_SPOTPATCH_CLIENT_MODULE_ID = `\0${SPOTPATCH_CLIENT_MODULE_ID}`;
|
|
142
146
|
var SPOTPATCH_REACT_ADAPTER_MODULE_ID = "virtual:spotpatch/react-adapter";
|
|
143
147
|
var RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID = `\0${SPOTPATCH_REACT_ADAPTER_MODULE_ID}`;
|
|
148
|
+
var SPOTPATCH_DATA_FLOW_MODULE_ID = "virtual:spotpatch/data-flow-runtime";
|
|
149
|
+
var RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID = `\0${SPOTPATCH_DATA_FLOW_MODULE_ID}`;
|
|
150
|
+
var SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID = "virtual:spotpatch/data-flow-panel";
|
|
151
|
+
var RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID = `\0${SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID}`;
|
|
152
|
+
var SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID = "virtual:spotpatch/external-handoff-panel";
|
|
153
|
+
var RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID = `\0${SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID}`;
|
|
154
|
+
function createDataFlowPreludeModule(input, bundle) {
|
|
155
|
+
return [
|
|
156
|
+
`const __SPOTPATCH_DATA_FLOW_CONFIG__ = ${JSON.stringify(input.context.getOptions().dataFlow)};`,
|
|
157
|
+
bundle
|
|
158
|
+
].join("\n");
|
|
159
|
+
}
|
|
144
160
|
function readRuntimeBundle(root, fileName) {
|
|
145
161
|
const resolveFromProject = createRequire(path.join(root, "package.json"));
|
|
146
162
|
const packageEntry = resolveFromProject.resolve("@spotpatch/vite");
|
|
@@ -164,8 +180,10 @@ function createClientModule(input, clientBundle, viteVersion) {
|
|
|
164
180
|
const runtimeConfig = {
|
|
165
181
|
ai: createRuntimeAiConfig(options.ai),
|
|
166
182
|
budget: options.budget,
|
|
183
|
+
dataFlow: createRuntimeDataFlowConfig(options.dataFlow),
|
|
167
184
|
debug: options.debug,
|
|
168
185
|
editor: options.editor,
|
|
186
|
+
externalAgent: options.externalAgent,
|
|
169
187
|
framework: "vite",
|
|
170
188
|
frameworkVersion: viteVersion,
|
|
171
189
|
locale: options.locale,
|
|
@@ -177,6 +195,8 @@ function createClientModule(input, clientBundle, viteVersion) {
|
|
|
177
195
|
spotPatchVersion: package_default.version
|
|
178
196
|
};
|
|
179
197
|
return [
|
|
198
|
+
...options.dataFlow.enabled ? [`import ${JSON.stringify(SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID)};`] : [],
|
|
199
|
+
...options.externalAgent.enabled ? [`import ${JSON.stringify(SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID)};`] : [],
|
|
180
200
|
`const __SPOTPATCH_BRAND_MARK_CONTENT__ = ${JSON.stringify(BRAND_MARK_CONTENT)};`,
|
|
181
201
|
`const __SPOTPATCH_RUNTIME_CONFIG__ = ${JSON.stringify(runtimeConfig)};`,
|
|
182
202
|
clientBundle
|
|
@@ -185,6 +205,9 @@ function createClientModule(input, clientBundle, viteVersion) {
|
|
|
185
205
|
function createRuntimeInjectionPlugin(input) {
|
|
186
206
|
let root = process.cwd();
|
|
187
207
|
let clientBundle = input.clientBundle;
|
|
208
|
+
let dataFlowPreludeBundle = input.dataFlowPreludeBundle;
|
|
209
|
+
let dataFlowPanelBundle = input.dataFlowPanelBundle;
|
|
210
|
+
let externalHandoffPanelBundle = input.externalHandoffPanelBundle;
|
|
188
211
|
let viteVersion = VITE_VERSION;
|
|
189
212
|
return {
|
|
190
213
|
name: "spotpatch:runtime-injection",
|
|
@@ -201,6 +224,15 @@ function createRuntimeInjectionPlugin(input) {
|
|
|
201
224
|
if (id === "@spotpatch/react-adapter" && importer === RESOLVED_SPOTPATCH_CLIENT_MODULE_ID) {
|
|
202
225
|
return RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID;
|
|
203
226
|
}
|
|
227
|
+
if (id === SPOTPATCH_DATA_FLOW_MODULE_ID) {
|
|
228
|
+
return RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID;
|
|
229
|
+
}
|
|
230
|
+
if (id === SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID) {
|
|
231
|
+
return RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID;
|
|
232
|
+
}
|
|
233
|
+
if (id === SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID) {
|
|
234
|
+
return RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID;
|
|
235
|
+
}
|
|
204
236
|
return null;
|
|
205
237
|
},
|
|
206
238
|
load(id) {
|
|
@@ -211,18 +243,51 @@ function createRuntimeInjectionPlugin(input) {
|
|
|
211
243
|
if (id === RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID) {
|
|
212
244
|
return input.reactAdapterBundle ?? readRuntimeBundle(root, "runtime-react-adapter.js");
|
|
213
245
|
}
|
|
246
|
+
if (id === RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID) {
|
|
247
|
+
if (!input.context.getOptions().dataFlow.enabled) return null;
|
|
248
|
+
dataFlowPreludeBundle ??= readRuntimeBundle(
|
|
249
|
+
root,
|
|
250
|
+
"runtime-data-flow-prelude.js"
|
|
251
|
+
);
|
|
252
|
+
return createDataFlowPreludeModule(input, dataFlowPreludeBundle);
|
|
253
|
+
}
|
|
254
|
+
if (id === RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID) {
|
|
255
|
+
if (!input.context.getOptions().dataFlow.enabled) return null;
|
|
256
|
+
dataFlowPanelBundle ??= readRuntimeBundle(root, "runtime-data-flow-panel.js");
|
|
257
|
+
return dataFlowPanelBundle;
|
|
258
|
+
}
|
|
259
|
+
if (id === RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID) {
|
|
260
|
+
if (!input.context.getOptions().externalAgent.enabled) return null;
|
|
261
|
+
externalHandoffPanelBundle ??= readRuntimeBundle(
|
|
262
|
+
root,
|
|
263
|
+
"runtime-external-handoff-panel.js"
|
|
264
|
+
);
|
|
265
|
+
return externalHandoffPanelBundle;
|
|
266
|
+
}
|
|
214
267
|
return null;
|
|
215
268
|
},
|
|
216
269
|
transformIndexHtml() {
|
|
270
|
+
const client = {
|
|
271
|
+
tag: "script",
|
|
272
|
+
attrs: {
|
|
273
|
+
type: "module",
|
|
274
|
+
src: `/@id/${SPOTPATCH_CLIENT_MODULE_ID}`
|
|
275
|
+
},
|
|
276
|
+
injectTo: "head"
|
|
277
|
+
};
|
|
278
|
+
if (!input.context.getOptions().dataFlow.enabled) {
|
|
279
|
+
return [client];
|
|
280
|
+
}
|
|
217
281
|
return [
|
|
218
282
|
{
|
|
219
283
|
tag: "script",
|
|
220
284
|
attrs: {
|
|
221
285
|
type: "module",
|
|
222
|
-
src: `/@id/${
|
|
286
|
+
src: `/@id/${SPOTPATCH_DATA_FLOW_MODULE_ID}`
|
|
223
287
|
},
|
|
224
|
-
injectTo: "head"
|
|
225
|
-
}
|
|
288
|
+
injectTo: "head-prepend"
|
|
289
|
+
},
|
|
290
|
+
client
|
|
226
291
|
];
|
|
227
292
|
}
|
|
228
293
|
};
|
|
@@ -232,13 +297,17 @@ function createRuntimeInjectionPlugin(input) {
|
|
|
232
297
|
import path2 from "path";
|
|
233
298
|
import {
|
|
234
299
|
createAgentJobManager,
|
|
300
|
+
createExternalHandoffService,
|
|
235
301
|
createSpotPatchMiddleware
|
|
236
302
|
} from "@spotpatch/dev-server";
|
|
237
303
|
function createServerPlugin(input) {
|
|
238
304
|
let agentManager;
|
|
305
|
+
let externalHandoffService;
|
|
239
306
|
let config;
|
|
240
307
|
const closeResources = async () => {
|
|
241
308
|
input.registry.clear();
|
|
309
|
+
await externalHandoffService?.close();
|
|
310
|
+
externalHandoffService = void 0;
|
|
242
311
|
await agentManager?.close();
|
|
243
312
|
agentManager = void 0;
|
|
244
313
|
};
|
|
@@ -249,7 +318,7 @@ function createServerPlugin(input) {
|
|
|
249
318
|
configResolved(resolvedConfig) {
|
|
250
319
|
config = resolvedConfig;
|
|
251
320
|
},
|
|
252
|
-
configureServer(server) {
|
|
321
|
+
async configureServer(server) {
|
|
253
322
|
if (config === void 0) {
|
|
254
323
|
throw new Error("SpotPatch server initialized before Vite config resolution.");
|
|
255
324
|
}
|
|
@@ -260,9 +329,24 @@ function createServerPlugin(input) {
|
|
|
260
329
|
environment: input.context.getCredentialEnvironment(),
|
|
261
330
|
root
|
|
262
331
|
});
|
|
332
|
+
externalHandoffService = options.externalAgent.enabled ? createExternalHandoffService({
|
|
333
|
+
framework: "vite",
|
|
334
|
+
root,
|
|
335
|
+
sessionId: input.session.id
|
|
336
|
+
}) : void 0;
|
|
337
|
+
if (externalHandoffService !== void 0) {
|
|
338
|
+
try {
|
|
339
|
+
await externalHandoffService.start();
|
|
340
|
+
} catch {
|
|
341
|
+
config.logger.warn(
|
|
342
|
+
"[spotpatch:vite] External Agent handoff is unavailable; core tools remain active."
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
263
346
|
server.middlewares.use(
|
|
264
347
|
createSpotPatchMiddleware({
|
|
265
348
|
...agentManager === void 0 ? {} : { agentManager },
|
|
349
|
+
...externalHandoffService === void 0 ? {} : { externalHandoffService },
|
|
266
350
|
options,
|
|
267
351
|
registry: input.registry,
|
|
268
352
|
root,
|
|
@@ -290,7 +374,7 @@ import { injectSourceMarkers } from "@spotpatch/compiler";
|
|
|
290
374
|
|
|
291
375
|
// src/transform/transform-filter.ts
|
|
292
376
|
import path3 from "path";
|
|
293
|
-
import { createSourceFilter } from "@spotpatch/compiler";
|
|
377
|
+
import { createDataFlowSourceFilter, createSourceFilter } from "@spotpatch/compiler";
|
|
294
378
|
import { isInsideRoot } from "@spotpatch/compiler";
|
|
295
379
|
function stripViteQuery(id) {
|
|
296
380
|
const queryIndex = id.indexOf("?");
|
|
@@ -298,13 +382,18 @@ function stripViteQuery(id) {
|
|
|
298
382
|
}
|
|
299
383
|
function createTransformFilter(root, options) {
|
|
300
384
|
const sourceFilter = createSourceFilter(root, options);
|
|
385
|
+
const dataFlowFilter = createDataFlowSourceFilter(root, {
|
|
386
|
+
include: options.include,
|
|
387
|
+
exclude: options.exclude
|
|
388
|
+
});
|
|
301
389
|
return Object.freeze({
|
|
302
390
|
shouldTransform(id, code) {
|
|
303
391
|
if (id.startsWith("\0") || id.includes("virtual:spotpatch") || id.includes("/packages/vite/") || id.includes("\\packages\\vite\\")) {
|
|
304
392
|
return false;
|
|
305
393
|
}
|
|
306
394
|
const cleanId = stripViteQuery(id);
|
|
307
|
-
|
|
395
|
+
const absolutePath = path3.resolve(cleanId);
|
|
396
|
+
return sourceFilter.shouldTransform(absolutePath, code) || options.dataFlow.enabled && dataFlowFilter.shouldTransform(absolutePath, code);
|
|
308
397
|
}
|
|
309
398
|
});
|
|
310
399
|
}
|
|
@@ -323,6 +412,7 @@ function createTransformPlugin(input) {
|
|
|
323
412
|
let filter = createTransformFilter(root, input.context.getOptions());
|
|
324
413
|
let logger;
|
|
325
414
|
const warnedFiles = /* @__PURE__ */ new Set();
|
|
415
|
+
const warnedDataFlowDiagnostics = /* @__PURE__ */ new Set();
|
|
326
416
|
const cache = /* @__PURE__ */ new Map();
|
|
327
417
|
return {
|
|
328
418
|
name: "spotpatch:transform",
|
|
@@ -353,12 +443,36 @@ function createTransformPlugin(input) {
|
|
|
353
443
|
absolutePath: cleanId,
|
|
354
444
|
root,
|
|
355
445
|
fileId: input.registry.register(cleanId),
|
|
446
|
+
...options.dataFlow.enabled ? { dataFlow: { helperModule: SPOTPATCH_DATA_FLOW_MODULE_ID } } : {},
|
|
356
447
|
onWarning(warning) {
|
|
357
448
|
logger?.warn(
|
|
358
449
|
`[spotpatch:transform] Existing source marker at ${getDisplayPath(root, id)}:${String(warning.line)}:${String(warning.column)}; preserving application value.`
|
|
359
450
|
);
|
|
360
451
|
}
|
|
361
452
|
});
|
|
453
|
+
if (result?.dataFlow !== void 0) {
|
|
454
|
+
input.registry.registerDataFlowComponents(
|
|
455
|
+
cleanId,
|
|
456
|
+
result.dataFlow.sourceVersion,
|
|
457
|
+
result.dataFlow.anchors.flatMap(
|
|
458
|
+
(anchor) => anchor.kind === "component" ? [
|
|
459
|
+
{
|
|
460
|
+
componentSourceId: anchor.id,
|
|
461
|
+
line: anchor.line,
|
|
462
|
+
column: anchor.column
|
|
463
|
+
}
|
|
464
|
+
] : []
|
|
465
|
+
)
|
|
466
|
+
);
|
|
467
|
+
for (const diagnostic of result.dataFlow.diagnostics) {
|
|
468
|
+
const warningKey = `${cleanId}:${diagnostic.code}:${String(diagnostic.line)}:${String(diagnostic.column)}`;
|
|
469
|
+
if (warnedDataFlowDiagnostics.has(warningKey)) continue;
|
|
470
|
+
warnedDataFlowDiagnostics.add(warningKey);
|
|
471
|
+
logger?.warn(
|
|
472
|
+
`[spotpatch:data-flow] ${diagnostic.code} at ${getDisplayPath(root, id)}:${String(diagnostic.line)}:${String(diagnostic.column)}; keeping this adapter evidence partial.`
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
362
476
|
const output = result === void 0 ? null : Object.freeze({
|
|
363
477
|
code: result.code,
|
|
364
478
|
map: result.map.toString()
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin.ts","../src/runtime/runtime-injection-plugin.ts","../package.json","../../runtime/src/ui/brand-mark-content.ts","../src/server/server-plugin.ts","../src/transform/transform-plugin.ts","../src/transform/transform-filter.ts","../src/options.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport {\n createSession,\n createSourceRegistry,\n resolveCredentialEnvironment,\n resolveEnvironmentAiConfiguration,\n resolveOptions,\n resolveProjectOptions,\n} from \"@spotpatch/dev-server\";\nimport { loadEnv, type ConfigEnv, type Plugin, type UserConfig } from \"vite\";\n\nimport type { ViteSpotPatchOptions } from \"./options.js\";\nimport type { SpotPatchPluginContext } from \"./plugin-context.js\";\nimport { createRuntimeInjectionPlugin } from \"./runtime/runtime-injection-plugin.js\";\nimport { createServerPlugin } from \"./server/server-plugin.js\";\nimport { createTransformPlugin } from \"./transform/transform-plugin.js\";\n\nexport function spotPatch(userOptions: ViteSpotPatchOptions = {}): Plugin[] {\n let options = resolveOptions(userOptions);\n let credentialEnvironment: Readonly<Record<string, string | undefined>> =\n Object.freeze({});\n\n if (!options.enabled) {\n return [];\n }\n\n const registry = createSourceRegistry();\n const session = createSession();\n const context = Object.freeze({\n getCredentialEnvironment: () => credentialEnvironment,\n getOptions: () => options,\n } satisfies SpotPatchPluginContext);\n const configure = async (\n config: UserConfig,\n environment: ConfigEnv,\n ): Promise<void> => {\n const root = path.resolve(process.cwd(), config.root ?? \".\");\n const loadedEnvironment =\n config.envDir === false\n ? process.env\n : loadEnv(environment.mode, path.resolve(root, config.envDir ?? \".\"), \"\");\n const environmentAi =\n userOptions.ai === undefined\n ? resolveEnvironmentAiConfiguration(loadedEnvironment).ai\n : false;\n\n options = await resolveProjectOptions({\n appRoot: root,\n environmentAi,\n options: userOptions,\n });\n\n credentialEnvironment = resolveCredentialEnvironment(options, loadedEnvironment);\n };\n\n return [\n createTransformPlugin({ configure, context, registry }),\n createRuntimeInjectionPlugin({ context, session }),\n createServerPlugin({ context, registry, session }),\n ];\n}\n","import { createRequire } from \"node:module\";\nimport { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { createRuntimeAiConfig, type SpotPatchSession } from \"@spotpatch/dev-server\";\nimport packageMetadata from \"../../package.json\" with { type: \"json\" };\nimport { version as VITE_VERSION, type Plugin } from \"vite\";\n\nimport type { SpotPatchPluginContext } from \"../plugin-context.js\";\nimport { BRAND_MARK_CONTENT } from \"./brand-mark-content.js\";\n\nexport const SPOTPATCH_CLIENT_MODULE_ID = \"virtual:spotpatch/client\";\nexport const RESOLVED_SPOTPATCH_CLIENT_MODULE_ID = `\\0${SPOTPATCH_CLIENT_MODULE_ID}`;\nexport const SPOTPATCH_REACT_ADAPTER_MODULE_ID = \"virtual:spotpatch/react-adapter\";\nexport const RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID = `\\0${SPOTPATCH_REACT_ADAPTER_MODULE_ID}`;\n\ninterface RuntimeInjectionPluginInput {\n readonly clientBundle?: string;\n readonly context: SpotPatchPluginContext;\n readonly reactAdapterBundle?: string;\n readonly session: SpotPatchSession;\n}\n\nfunction readRuntimeBundle(root: string, fileName: string): string {\n const resolveFromProject = createRequire(path.join(root, \"package.json\"));\n const packageEntry = resolveFromProject.resolve(\"@spotpatch/vite\");\n const bundlePath = path.join(path.dirname(packageEntry), fileName);\n return readFileSync(bundlePath, \"utf8\");\n}\n\nfunction readConsumerViteVersion(root: string): string {\n try {\n const resolveFromProject = createRequire(path.join(root, \"package.json\"));\n const manifestPath = resolveFromProject.resolve(\"vite/package.json\");\n const manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as unknown;\n\n if (\n typeof manifest === \"object\" &&\n manifest !== null &&\n \"version\" in manifest &&\n typeof manifest.version === \"string\"\n ) {\n return manifest.version;\n }\n } catch {\n // Vite itself remains the safe fallback if package metadata is not exported.\n }\n\n return VITE_VERSION;\n}\n\nfunction createClientModule(\n input: RuntimeInjectionPluginInput,\n clientBundle: string,\n viteVersion: string,\n): string {\n const options = input.context.getOptions();\n const runtimeConfig = {\n ai: createRuntimeAiConfig(options.ai),\n budget: options.budget,\n debug: options.debug,\n editor: options.editor,\n framework: \"vite\" as const,\n frameworkVersion: viteVersion,\n locale: options.locale,\n maxTargets: options.maxTargets,\n redact: options.redact,\n sessionId: input.session.id,\n sessionToken: input.session.token,\n shortcut: options.shortcut,\n spotPatchVersion: packageMetadata.version,\n };\n\n return [\n `const __SPOTPATCH_BRAND_MARK_CONTENT__ = ${JSON.stringify(BRAND_MARK_CONTENT)};`,\n `const __SPOTPATCH_RUNTIME_CONFIG__ = ${JSON.stringify(runtimeConfig)};`,\n clientBundle,\n ].join(\"\\n\");\n}\n\nexport function createRuntimeInjectionPlugin(\n input: RuntimeInjectionPluginInput,\n): Plugin {\n let root = process.cwd();\n let clientBundle = input.clientBundle;\n let viteVersion = VITE_VERSION;\n\n return {\n name: \"spotpatch:runtime-injection\",\n apply: \"serve\",\n enforce: \"pre\",\n\n configResolved(config) {\n root = path.resolve(config.root);\n viteVersion = readConsumerViteVersion(root);\n },\n\n resolveId(id, importer) {\n if (id === SPOTPATCH_CLIENT_MODULE_ID) {\n return RESOLVED_SPOTPATCH_CLIENT_MODULE_ID;\n }\n\n if (\n id === \"@spotpatch/react-adapter\" &&\n importer === RESOLVED_SPOTPATCH_CLIENT_MODULE_ID\n ) {\n return RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID;\n }\n\n return null;\n },\n\n load(id) {\n if (id === RESOLVED_SPOTPATCH_CLIENT_MODULE_ID) {\n clientBundle ??= readRuntimeBundle(root, \"runtime-client.js\");\n return createClientModule(input, clientBundle, viteVersion);\n }\n\n if (id === RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID) {\n return (\n input.reactAdapterBundle ??\n readRuntimeBundle(root, \"runtime-react-adapter.js\")\n );\n }\n\n return null;\n },\n\n transformIndexHtml() {\n return [\n {\n tag: \"script\",\n attrs: {\n type: \"module\",\n src: `/@id/${SPOTPATCH_CLIENT_MODULE_ID}`,\n },\n injectTo: \"head\",\n },\n ];\n },\n };\n}\n","{\n \"name\": \"@spotpatch/vite\",\n \"version\": \"1.8.0\",\n \"description\": \"Vite development plugin for SpotPatch.\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/huanglvjing/spotpatch.git\",\n \"directory\": \"packages/vite\"\n },\n \"homepage\": \"https://github.com/huanglvjing/spotpatch#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/huanglvjing/spotpatch/issues\"\n },\n \"keywords\": [\n \"spotpatch\",\n \"vite\",\n \"react\",\n \"developer-tools\",\n \"ai-agent\"\n ],\n \"type\": \"module\",\n \"sideEffects\": false,\n \"engines\": {\n \"node\": \">=20.19.0\"\n },\n \"files\": [\n \"dist\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"spotpatch-vite\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsup src/index.ts --format esm,cjs --dts --sourcemap --clean && tsup --config tsup.cli.config.ts && tsup --config tsup.runtime-client.config.ts && tsup --config tsup.runtime-react-adapter.config.ts\",\n \"clean\": \"node --input-type=module -e \\\"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\\\"\",\n \"typecheck\": \"tsc --noEmit -p tsconfig.json\"\n },\n \"dependencies\": {\n \"@spotpatch/compiler\": \"workspace:^\",\n \"@spotpatch/dev-server\": \"workspace:^\",\n \"@spotpatch/react-adapter\": \"workspace:^\",\n \"@spotpatch/runtime\": \"workspace:^\",\n \"@spotpatch/shared\": \"workspace:^\",\n \"magic-string\": \"1.1.0\",\n \"oxc-parser\": \"0.143.0\"\n },\n \"peerDependencies\": {\n \"vite\": \"^5.0.0 || ^6.0.0 || ^7.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","/**\n * Canonical SpotPatch mark from docs/assets/spotpatch-logo-mark.svg.\n *\n * The Vite development injector consumes this trusted asset separately from\n * the core browser bundle so the Runtime gzip budget remains enforceable.\n */\nexport const BRAND_MARK_CONTENT = `\n <defs>\n <linearGradient id=\"locator-gradient\" x1=\"76\" y1=\"92\" x2=\"436\" y2=\"374\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stop-color=\"#B61CFF\" />\n <stop offset=\"0.38\" stop-color=\"#6D35FF\" />\n <stop offset=\"0.72\" stop-color=\"#168EFF\" />\n <stop offset=\"1\" stop-color=\"#00D9E9\" />\n </linearGradient>\n <linearGradient id=\"left-code-gradient\" x1=\"165\" y1=\"166\" x2=\"236\" y2=\"258\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#A51EFF\" />\n <stop offset=\"1\" stop-color=\"#653BFF\" />\n </linearGradient>\n <linearGradient id=\"right-code-gradient\" x1=\"276\" y1=\"166\" x2=\"347\" y2=\"258\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#158DFF\" />\n <stop offset=\"1\" stop-color=\"#00D8E9\" />\n </linearGradient>\n <linearGradient id=\"bolt-gradient\" x1=\"270\" y1=\"111\" x2=\"252\" y2=\"365\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#6840FF\" />\n <stop offset=\"0.48\" stop-color=\"#257BFF\" />\n <stop offset=\"1\" stop-color=\"#00CBEF\" />\n </linearGradient>\n </defs>\n <path\n fill=\"url(#locator-gradient)\"\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M256 52C345.47 52 418 124.53 418 214C418 267.55 391.98 316.24 354.04 348.02L256 468L157.96 348.02C120.02 316.24 94 267.55 94 214C94 124.53 166.53 52 256 52ZM256 88C186.41 88 130 144.41 130 214C130 258.2 152.76 297.08 187.2 319.57L256 403.8L324.8 319.57C359.24 297.08 382 258.2 382 214C382 144.41 325.59 88 256 88Z\"\n />\n <rect x=\"238\" y=\"20\" width=\"36\" height=\"84\" rx=\"4\" fill=\"url(#locator-gradient)\" />\n <rect x=\"62\" y=\"196\" width=\"84\" height=\"36\" rx=\"4\" fill=\"url(#locator-gradient)\" />\n <rect x=\"366\" y=\"196\" width=\"84\" height=\"36\" rx=\"4\" fill=\"url(#locator-gradient)\" />\n <path\n d=\"M213.5 160L158 211.5L213.5 263L238 236.5L211 211.5L238 186.5L213.5 160Z\"\n fill=\"url(#left-code-gradient)\"\n />\n <path\n d=\"M298.5 160L354 211.5L298.5 263L274 236.5L301 211.5L274 186.5L298.5 160Z\"\n fill=\"url(#right-code-gradient)\"\n />\n <path\n d=\"M283 108L232 212L266 253L238 369L302 237L267 198L283 108Z\"\n fill=\"url(#bolt-gradient)\"\n />\n`;\n","import path from \"node:path\";\n\nimport {\n createAgentJobManager,\n createSpotPatchMiddleware,\n type AgentJobManager,\n type SourceRegistry,\n type SpotPatchSession,\n} from \"@spotpatch/dev-server\";\nimport type { Plugin, ResolvedConfig } from \"vite\";\n\nimport type { SpotPatchPluginContext } from \"../plugin-context.js\";\n\ninterface ServerPluginInput {\n readonly context: SpotPatchPluginContext;\n readonly registry: SourceRegistry;\n readonly session: SpotPatchSession;\n}\n\nexport function createServerPlugin(input: ServerPluginInput): Plugin {\n let agentManager: AgentJobManager | undefined;\n let config: ResolvedConfig | undefined;\n\n const closeResources = async (): Promise<void> => {\n input.registry.clear();\n await agentManager?.close();\n agentManager = undefined;\n };\n\n return {\n name: \"spotpatch:server\",\n apply: \"serve\",\n enforce: \"pre\",\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n\n configureServer(server) {\n if (config === undefined) {\n throw new Error(\"SpotPatch server initialized before Vite config resolution.\");\n }\n\n const root = path.resolve(config.root);\n const options = input.context.getOptions();\n agentManager =\n options.ai === false\n ? undefined\n : createAgentJobManager({\n ai: options.ai,\n environment: input.context.getCredentialEnvironment(),\n root,\n });\n\n server.middlewares.use(\n createSpotPatchMiddleware({\n ...(agentManager === undefined ? {} : { agentManager }),\n options,\n registry: input.registry,\n root,\n session: input.session,\n logger: config.logger,\n }),\n );\n\n server.httpServer?.once(\"close\", () => {\n void closeResources();\n });\n\n config.logger.info(\n `[spotpatch:vite] Ready. Toggle picker with ${options.shortcut}.`,\n );\n },\n\n async closeBundle() {\n await closeResources();\n },\n };\n}\n","import { createHash } from \"node:crypto\";\nimport path from \"node:path\";\n\nimport type { ConfigEnv, Plugin, ResolvedConfig, UserConfig } from \"vite\";\nimport { injectSourceMarkers } from \"@spotpatch/compiler\";\nimport type { SourceRegistry } from \"@spotpatch/dev-server\";\n\nimport type { SpotPatchPluginContext } from \"../plugin-context.js\";\nimport { createTransformFilter, stripViteQuery } from \"./transform-filter.js\";\n\ninterface TransformPluginInput {\n readonly configure?: (\n config: UserConfig,\n environment: ConfigEnv,\n ) => void | Promise<void>;\n readonly context: SpotPatchPluginContext;\n readonly registry: SourceRegistry;\n}\n\ninterface ViteTransformOutput {\n readonly code: string;\n readonly map: string;\n}\n\nfunction createCacheKey(id: string, code: string): string {\n const hash = createHash(\"sha256\").update(code).digest(\"base64url\");\n return `${id}\\0${hash}`;\n}\n\nfunction getDisplayPath(root: string, id: string): string {\n const relative = path.relative(root, stripViteQuery(id));\n return relative.split(path.sep).join(\"/\");\n}\n\nexport function createTransformPlugin(input: TransformPluginInput): Plugin {\n let root = process.cwd();\n let filter = createTransformFilter(root, input.context.getOptions());\n let logger: ResolvedConfig[\"logger\"] | undefined;\n const warnedFiles = new Set<string>();\n const cache = new Map<string, ViteTransformOutput | null>();\n\n return {\n name: \"spotpatch:transform\",\n apply: \"serve\",\n enforce: \"pre\",\n\n async config(config, environment) {\n await input.configure?.(config, environment);\n },\n\n configResolved(config) {\n root = path.resolve(config.root);\n filter = createTransformFilter(root, input.context.getOptions());\n logger = config.logger;\n },\n\n transform(code, id) {\n if (!filter.shouldTransform(id, code)) {\n return null;\n }\n\n const cleanId = path.resolve(stripViteQuery(id));\n const cacheKey = createCacheKey(cleanId, code);\n\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey) ?? null;\n }\n\n const startedAt = performance.now();\n const options = input.context.getOptions();\n\n try {\n const result = injectSourceMarkers({\n code,\n absolutePath: cleanId,\n root,\n fileId: input.registry.register(cleanId),\n onWarning(warning) {\n logger?.warn(\n `[spotpatch:transform] Existing source marker at ${getDisplayPath(root, id)}:${String(warning.line)}:${String(warning.column)}; preserving application value.`,\n );\n },\n });\n\n const output =\n result === undefined\n ? null\n : Object.freeze({\n code: result.code,\n map: result.map.toString(),\n });\n cache.set(cacheKey, output);\n\n if (options.debug) {\n const elapsed = performance.now() - startedAt;\n logger?.info(\n `[spotpatch:transform] ${getDisplayPath(root, id)} ${elapsed.toFixed(2)}ms`,\n );\n }\n\n return output;\n } catch (error: unknown) {\n if (!warnedFiles.has(cleanId)) {\n warnedFiles.add(cleanId);\n const detail =\n options.debug && error instanceof Error ? `: ${error.message}` : \"\";\n logger?.warn(\n `[spotpatch:transform] Failed to transform ${getDisplayPath(root, id)}; using original module${detail}`,\n );\n }\n\n return null;\n }\n },\n };\n}\n","import path from \"node:path\";\n\nimport { createSourceFilter } from \"@spotpatch/compiler\";\nimport type { ResolvedSpotPatchOptions } from \"@spotpatch/dev-server\";\n\nexport function stripViteQuery(id: string): string {\n const queryIndex = id.indexOf(\"?\");\n return queryIndex === -1 ? id : id.slice(0, queryIndex);\n}\n\nexport { isInsideRoot } from \"@spotpatch/compiler\";\n\nexport interface TransformFilter {\n shouldTransform(id: string, code: string): boolean;\n}\n\nexport function createTransformFilter(\n root: string,\n options: ResolvedSpotPatchOptions,\n): TransformFilter {\n const sourceFilter = createSourceFilter(root, options);\n\n return Object.freeze({\n shouldTransform(id: string, code: string): boolean {\n if (\n id.startsWith(\"\\0\") ||\n id.includes(\"virtual:spotpatch\") ||\n id.includes(\"/packages/vite/\") ||\n id.includes(\"\\\\packages\\\\vite\\\\\")\n ) {\n return false;\n }\n\n const cleanId = stripViteQuery(id);\n return sourceFilter.shouldTransform(path.resolve(cleanId), code);\n },\n });\n}\n","export {\n createRuntimeAiConfig,\n DEFAULT_EXCLUDE,\n DEFAULT_OPTIONS,\n resolveOptions,\n} from \"@spotpatch/dev-server\";\nexport type {\n FilterEntry,\n ResolvedSpotPatchOptions,\n SimpleAiOptions,\n SpotPatchAiOptions,\n SpotPatchOptions,\n} from \"@spotpatch/dev-server\";\n\nexport type ViteSpotPatchOptions = SharedSpotPatchOptions;\nimport type { SpotPatchOptions as SharedSpotPatchOptions } from \"@spotpatch/dev-server\";\n","export { spotPatch } from \"./plugin.js\";\nexport {\n DEFAULT_OPTIONS,\n resolveOptions,\n type ResolvedSpotPatchOptions,\n type SimpleAiOptions,\n type SpotPatchAiOptions,\n type SpotPatchOptions,\n type ViteSpotPatchOptions,\n} from \"./options.js\";\nexport {\n DEFAULT_AGENT_LIMITS,\n type AgentApplyMode,\n type AgentCheckDefinition,\n type AgentLimits,\n type AiExecutionOptions,\n type AiModelProfile,\n type AiOptions,\n type AiProviderAuthentication,\n type AiProviderProtocol,\n type ContextBudget,\n type OpenAICompatibleProviderOptions,\n type SpotPatchEditorPreference,\n} from \"@spotpatch/shared\";\n"],"mappings":";AAAA,OAAOA,WAAU;AAEjB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAA6D;;;ACVtE,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,OAAO,UAAU;AAEjB,SAAS,6BAAoD;;;ACJ7D;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,YAAc;AAAA,IACZ,MAAQ;A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WAAO,CAAC;AAAA,EACV;AAEA,QAAM,WAAW,qBAAqB;AACtC,QAAM,UAAU,cAAc;AAC9B,QAAM,UAAU,OAAO,OAAO;AAAA,IAC5B,0BAA0B,MAAM;AAAA,IAChC,YAAY,MAAM;AAAA,EACpB,CAAkC;AAClC,QAAM,YAAY,OAChB,QACA,gBACkB;AAClB,UAAM,OAAOC,MAAK,QAAQ,QAAQ,IAAI,GAAG,OAAO,QAAQ,GAAG;AAC3D,UAAM,oBACJ,OAAO,WAAW,QACd,QAAQ,MACR,QAAQ,YAAY,MAAMA,MAAK,QAAQ,MAAM,OAAO,UAAU,GAAG,GAAG,EAAE;AAC5E,UAAM,gBACJ,YAAY,OAAO,SACf,kCAAkC,iBAAiB,EAAE,KACrD;AAEN,cAAU,MAAM,sBAAsB;AAAA,MACpC,SAAS;AAAA,MACT;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAED,4BAAwB,6BAA6B,SAAS,iBAAiB;AAAA,EACjF;AAEA,SAAO;AAAA,IACL,sBAAsB,EAAE,WAAW,SAAS,SAAS,CAAC;AAAA,IACtD,6BAA6B,EAAE,SAAS,QAAQ,CAAC;AAAA,IACjD,mBAAmB,EAAE,SAAS,UAAU,QAAQ,CAAC;AAAA,EACnD;AACF;;;AO7DA;AAAA,EACE,yBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAAC;AAAA,OACK;;;ACKP;AAAA,EACE;AAAA,OAYK;","names":["path","path","path","path","path","path","createRuntimeAiConfig","resolveOptions"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts","../src/runtime/runtime-injection-plugin.ts","../package.json","../../runtime/src/ui/brand-mark-content.ts","../src/server/server-plugin.ts","../src/transform/transform-plugin.ts","../src/transform/transform-filter.ts","../src/options.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport {\n createSession,\n createSourceRegistry,\n resolveCredentialEnvironment,\n resolveEnvironmentAiConfiguration,\n resolveOptions,\n resolveProjectOptions,\n} from \"@spotpatch/dev-server\";\nimport { loadEnv, type ConfigEnv, type Plugin, type UserConfig } from \"vite\";\n\nimport type { ViteSpotPatchOptions } from \"./options.js\";\nimport type { SpotPatchPluginContext } from \"./plugin-context.js\";\nimport { createRuntimeInjectionPlugin } from \"./runtime/runtime-injection-plugin.js\";\nimport { createServerPlugin } from \"./server/server-plugin.js\";\nimport { createTransformPlugin } from \"./transform/transform-plugin.js\";\n\nexport function spotPatch(userOptions: ViteSpotPatchOptions = {}): Plugin[] {\n let options = resolveOptions(userOptions);\n let credentialEnvironment: Readonly<Record<string, string | undefined>> =\n Object.freeze({});\n\n if (!options.enabled) {\n return [];\n }\n\n const registry = createSourceRegistry();\n const session = createSession();\n const context = Object.freeze({\n getCredentialEnvironment: () => credentialEnvironment,\n getOptions: () => options,\n } satisfies SpotPatchPluginContext);\n const configure = async (\n config: UserConfig,\n environment: ConfigEnv,\n ): Promise<void> => {\n const root = path.resolve(process.cwd(), config.root ?? \".\");\n const loadedEnvironment =\n config.envDir === false\n ? process.env\n : loadEnv(environment.mode, path.resolve(root, config.envDir ?? \".\"), \"\");\n const environmentAi =\n userOptions.ai === undefined\n ? resolveEnvironmentAiConfiguration(loadedEnvironment).ai\n : false;\n\n options = await resolveProjectOptions({\n appRoot: root,\n environmentAi,\n options: userOptions,\n });\n\n credentialEnvironment = resolveCredentialEnvironment(options, loadedEnvironment);\n };\n\n return [\n createTransformPlugin({ configure, context, registry }),\n createRuntimeInjectionPlugin({ context, session }),\n createServerPlugin({ context, registry, session }),\n ];\n}\n","import { createRequire } from \"node:module\";\nimport { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport {\n createRuntimeAiConfig,\n createRuntimeDataFlowConfig,\n type SpotPatchSession,\n} from \"@spotpatch/dev-server\";\nimport packageMetadata from \"../../package.json\" with { type: \"json\" };\nimport { version as VITE_VERSION, type Plugin } from \"vite\";\n\nimport type { SpotPatchPluginContext } from \"../plugin-context.js\";\nimport { BRAND_MARK_CONTENT } from \"./brand-mark-content.js\";\n\nexport const SPOTPATCH_CLIENT_MODULE_ID = \"virtual:spotpatch/client\";\nexport const RESOLVED_SPOTPATCH_CLIENT_MODULE_ID = `\\0${SPOTPATCH_CLIENT_MODULE_ID}`;\nexport const SPOTPATCH_REACT_ADAPTER_MODULE_ID = \"virtual:spotpatch/react-adapter\";\nexport const RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID = `\\0${SPOTPATCH_REACT_ADAPTER_MODULE_ID}`;\nexport const SPOTPATCH_DATA_FLOW_MODULE_ID = \"virtual:spotpatch/data-flow-runtime\";\nexport const RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID = `\\0${SPOTPATCH_DATA_FLOW_MODULE_ID}`;\nexport const SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID = \"virtual:spotpatch/data-flow-panel\";\nexport const RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID = `\\0${SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID}`;\nexport const SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID =\n \"virtual:spotpatch/external-handoff-panel\";\nexport const RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID = `\\0${SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID}`;\n\ninterface RuntimeInjectionPluginInput {\n readonly clientBundle?: string;\n readonly context: SpotPatchPluginContext;\n readonly dataFlowPreludeBundle?: string;\n readonly dataFlowPanelBundle?: string;\n readonly externalHandoffPanelBundle?: string;\n readonly reactAdapterBundle?: string;\n readonly session: SpotPatchSession;\n}\n\nfunction createDataFlowPreludeModule(\n input: RuntimeInjectionPluginInput,\n bundle: string,\n): string {\n return [\n `const __SPOTPATCH_DATA_FLOW_CONFIG__ = ${JSON.stringify(input.context.getOptions().dataFlow)};`,\n bundle,\n ].join(\"\\n\");\n}\n\nfunction readRuntimeBundle(root: string, fileName: string): string {\n const resolveFromProject = createRequire(path.join(root, \"package.json\"));\n const packageEntry = resolveFromProject.resolve(\"@spotpatch/vite\");\n const bundlePath = path.join(path.dirname(packageEntry), fileName);\n return readFileSync(bundlePath, \"utf8\");\n}\n\nfunction readConsumerViteVersion(root: string): string {\n try {\n const resolveFromProject = createRequire(path.join(root, \"package.json\"));\n const manifestPath = resolveFromProject.resolve(\"vite/package.json\");\n const manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as unknown;\n\n if (\n typeof manifest === \"object\" &&\n manifest !== null &&\n \"version\" in manifest &&\n typeof manifest.version === \"string\"\n ) {\n return manifest.version;\n }\n } catch {\n // Vite itself remains the safe fallback if package metadata is not exported.\n }\n\n return VITE_VERSION;\n}\n\nfunction createClientModule(\n input: RuntimeInjectionPluginInput,\n clientBundle: string,\n viteVersion: string,\n): string {\n const options = input.context.getOptions();\n const runtimeConfig = {\n ai: createRuntimeAiConfig(options.ai),\n budget: options.budget,\n dataFlow: createRuntimeDataFlowConfig(options.dataFlow),\n debug: options.debug,\n editor: options.editor,\n externalAgent: options.externalAgent,\n framework: \"vite\" as const,\n frameworkVersion: viteVersion,\n locale: options.locale,\n maxTargets: options.maxTargets,\n redact: options.redact,\n sessionId: input.session.id,\n sessionToken: input.session.token,\n shortcut: options.shortcut,\n spotPatchVersion: packageMetadata.version,\n };\n\n return [\n ...(options.dataFlow.enabled\n ? [`import ${JSON.stringify(SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID)};`]\n : []),\n ...(options.externalAgent.enabled\n ? [`import ${JSON.stringify(SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID)};`]\n : []),\n `const __SPOTPATCH_BRAND_MARK_CONTENT__ = ${JSON.stringify(BRAND_MARK_CONTENT)};`,\n `const __SPOTPATCH_RUNTIME_CONFIG__ = ${JSON.stringify(runtimeConfig)};`,\n clientBundle,\n ].join(\"\\n\");\n}\n\nexport function createRuntimeInjectionPlugin(\n input: RuntimeInjectionPluginInput,\n): Plugin {\n let root = process.cwd();\n let clientBundle = input.clientBundle;\n let dataFlowPreludeBundle = input.dataFlowPreludeBundle;\n let dataFlowPanelBundle = input.dataFlowPanelBundle;\n let externalHandoffPanelBundle = input.externalHandoffPanelBundle;\n let viteVersion = VITE_VERSION;\n\n return {\n name: \"spotpatch:runtime-injection\",\n apply: \"serve\",\n enforce: \"pre\",\n\n configResolved(config) {\n root = path.resolve(config.root);\n viteVersion = readConsumerViteVersion(root);\n },\n\n resolveId(id, importer) {\n if (id === SPOTPATCH_CLIENT_MODULE_ID) {\n return RESOLVED_SPOTPATCH_CLIENT_MODULE_ID;\n }\n\n if (\n id === \"@spotpatch/react-adapter\" &&\n importer === RESOLVED_SPOTPATCH_CLIENT_MODULE_ID\n ) {\n return RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID;\n }\n\n if (id === SPOTPATCH_DATA_FLOW_MODULE_ID) {\n return RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID;\n }\n\n if (id === SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID) {\n return RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID;\n }\n\n if (id === SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID) {\n return RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID;\n }\n\n return null;\n },\n\n load(id) {\n if (id === RESOLVED_SPOTPATCH_CLIENT_MODULE_ID) {\n clientBundle ??= readRuntimeBundle(root, \"runtime-client.js\");\n return createClientModule(input, clientBundle, viteVersion);\n }\n\n if (id === RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID) {\n return (\n input.reactAdapterBundle ??\n readRuntimeBundle(root, \"runtime-react-adapter.js\")\n );\n }\n\n if (id === RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID) {\n if (!input.context.getOptions().dataFlow.enabled) return null;\n dataFlowPreludeBundle ??= readRuntimeBundle(\n root,\n \"runtime-data-flow-prelude.js\",\n );\n return createDataFlowPreludeModule(input, dataFlowPreludeBundle);\n }\n\n if (id === RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID) {\n if (!input.context.getOptions().dataFlow.enabled) return null;\n dataFlowPanelBundle ??= readRuntimeBundle(root, \"runtime-data-flow-panel.js\");\n return dataFlowPanelBundle;\n }\n\n if (id === RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID) {\n if (!input.context.getOptions().externalAgent.enabled) return null;\n externalHandoffPanelBundle ??= readRuntimeBundle(\n root,\n \"runtime-external-handoff-panel.js\",\n );\n return externalHandoffPanelBundle;\n }\n\n return null;\n },\n\n transformIndexHtml() {\n const client = {\n tag: \"script\",\n attrs: {\n type: \"module\",\n src: `/@id/${SPOTPATCH_CLIENT_MODULE_ID}`,\n },\n injectTo: \"head\" as const,\n };\n if (!input.context.getOptions().dataFlow.enabled) {\n return [client];\n }\n\n return [\n {\n tag: \"script\",\n attrs: {\n type: \"module\",\n src: `/@id/${SPOTPATCH_DATA_FLOW_MODULE_ID}`,\n },\n injectTo: \"head-prepend\" as const,\n },\n client,\n ];\n },\n };\n}\n","{\n \"name\": \"@spotpatch/vite\",\n \"version\": \"1.10.0\",\n \"description\": \"Vite development plugin for SpotPatch.\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/huanglvjing/spotpatch.git\",\n \"directory\": \"packages/vite\"\n },\n \"homepage\": \"https://github.com/huanglvjing/spotpatch#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/huanglvjing/spotpatch/issues\"\n },\n \"keywords\": [\n \"spotpatch\",\n \"vite\",\n \"react\",\n \"developer-tools\",\n \"ai-agent\"\n ],\n \"type\": \"module\",\n \"sideEffects\": false,\n \"engines\": {\n \"node\": \">=20.19.0\"\n },\n \"files\": [\n \"dist\"\n ],\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"spotpatch-vite\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n }\n },\n \"scripts\": {\n \"build\": \"tsup src/index.ts --format esm,cjs --dts --sourcemap --clean && tsup --config tsup.cli.config.ts && tsup --config tsup.runtime-client.config.ts && tsup --config tsup.runtime-react-adapter.config.ts && tsup --config tsup.runtime-data-flow-prelude.config.ts && tsup --config tsup.runtime-data-flow-panel.config.ts && tsup --config tsup.runtime-external-handoff-panel.config.ts\",\n \"clean\": \"node --input-type=module -e \\\"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\\\"\",\n \"typecheck\": \"tsc --noEmit -p tsconfig.json\"\n },\n \"dependencies\": {\n \"@spotpatch/bridge\": \"workspace:^\",\n \"@spotpatch/compiler\": \"workspace:^\",\n \"@spotpatch/dev-server\": \"workspace:^\",\n \"@spotpatch/react-adapter\": \"workspace:^\",\n \"@spotpatch/runtime\": \"workspace:^\",\n \"@spotpatch/shared\": \"workspace:^\",\n \"magic-string\": \"1.1.0\",\n \"oxc-parser\": \"0.143.0\"\n },\n \"peerDependencies\": {\n \"vite\": \"^5.0.0 || ^6.0.0 || ^7.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","/**\n * Canonical SpotPatch mark from docs/assets/spotpatch-logo-mark.svg.\n *\n * The Vite development injector consumes this trusted asset separately from\n * the core browser bundle so the Runtime gzip budget remains enforceable.\n */\nexport const BRAND_MARK_CONTENT = `\n <defs>\n <linearGradient id=\"locator-gradient\" x1=\"76\" y1=\"92\" x2=\"436\" y2=\"374\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stop-color=\"#B61CFF\" />\n <stop offset=\"0.38\" stop-color=\"#6D35FF\" />\n <stop offset=\"0.72\" stop-color=\"#168EFF\" />\n <stop offset=\"1\" stop-color=\"#00D9E9\" />\n </linearGradient>\n <linearGradient id=\"left-code-gradient\" x1=\"165\" y1=\"166\" x2=\"236\" y2=\"258\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#A51EFF\" />\n <stop offset=\"1\" stop-color=\"#653BFF\" />\n </linearGradient>\n <linearGradient id=\"right-code-gradient\" x1=\"276\" y1=\"166\" x2=\"347\" y2=\"258\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#158DFF\" />\n <stop offset=\"1\" stop-color=\"#00D8E9\" />\n </linearGradient>\n <linearGradient id=\"bolt-gradient\" x1=\"270\" y1=\"111\" x2=\"252\" y2=\"365\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#6840FF\" />\n <stop offset=\"0.48\" stop-color=\"#257BFF\" />\n <stop offset=\"1\" stop-color=\"#00CBEF\" />\n </linearGradient>\n </defs>\n <path\n fill=\"url(#locator-gradient)\"\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M256 52C345.47 52 418 124.53 418 214C418 267.55 391.98 316.24 354.04 348.02L256 468L157.96 348.02C120.02 316.24 94 267.55 94 214C94 124.53 166.53 52 256 52ZM256 88C186.41 88 130 144.41 130 214C130 258.2 152.76 297.08 187.2 319.57L256 403.8L324.8 319.57C359.24 297.08 382 258.2 382 214C382 144.41 325.59 88 256 88Z\"\n />\n <rect x=\"238\" y=\"20\" width=\"36\" height=\"84\" rx=\"4\" fill=\"url(#locator-gradient)\" />\n <rect x=\"62\" y=\"196\" width=\"84\" height=\"36\" rx=\"4\" fill=\"url(#locator-gradient)\" />\n <rect x=\"366\" y=\"196\" width=\"84\" height=\"36\" rx=\"4\" fill=\"url(#locator-gradient)\" />\n <path\n d=\"M213.5 160L158 211.5L213.5 263L238 236.5L211 211.5L238 186.5L213.5 160Z\"\n fill=\"url(#left-code-gradient)\"\n />\n <path\n d=\"M298.5 160L354 211.5L298.5 263L274 236.5L301 211.5L274 186.5L298.5 160Z\"\n fill=\"url(#right-code-gradient)\"\n />\n <path\n d=\"M283 108L232 212L266 253L238 369L302 237L267 198L283 108Z\"\n fill=\"url(#bolt-gradient)\"\n />\n`;\n","import path from \"node:path\";\n\nimport {\n createAgentJobManager,\n createExternalHandoffService,\n createSpotPatchMiddleware,\n type AgentJobManager,\n type ExternalHandoffService,\n type SourceRegistry,\n type SpotPatchSession,\n} from \"@spotpatch/dev-server\";\nimport type { Plugin, ResolvedConfig } from \"vite\";\n\nimport type { SpotPatchPluginContext } from \"../plugin-context.js\";\n\ninterface ServerPluginInput {\n readonly context: SpotPatchPluginContext;\n readonly registry: SourceRegistry;\n readonly session: SpotPatchSession;\n}\n\nexport function createServerPlugin(input: ServerPluginInput): Plugin {\n let agentManager: AgentJobManager | undefined;\n let externalHandoffService: ExternalHandoffService | undefined;\n let config: ResolvedConfig | undefined;\n\n const closeResources = async (): Promise<void> => {\n input.registry.clear();\n await externalHandoffService?.close();\n externalHandoffService = undefined;\n await agentManager?.close();\n agentManager = undefined;\n };\n\n return {\n name: \"spotpatch:server\",\n apply: \"serve\",\n enforce: \"pre\",\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n\n async configureServer(server) {\n if (config === undefined) {\n throw new Error(\"SpotPatch server initialized before Vite config resolution.\");\n }\n\n const root = path.resolve(config.root);\n const options = input.context.getOptions();\n agentManager =\n options.ai === false\n ? undefined\n : createAgentJobManager({\n ai: options.ai,\n environment: input.context.getCredentialEnvironment(),\n root,\n });\n externalHandoffService = options.externalAgent.enabled\n ? createExternalHandoffService({\n framework: \"vite\",\n root,\n sessionId: input.session.id,\n })\n : undefined;\n\n if (externalHandoffService !== undefined) {\n try {\n await externalHandoffService.start();\n } catch {\n config.logger.warn(\n \"[spotpatch:vite] External Agent handoff is unavailable; core tools remain active.\",\n );\n }\n }\n\n server.middlewares.use(\n createSpotPatchMiddleware({\n ...(agentManager === undefined ? {} : { agentManager }),\n ...(externalHandoffService === undefined ? {} : { externalHandoffService }),\n options,\n registry: input.registry,\n root,\n session: input.session,\n logger: config.logger,\n }),\n );\n\n server.httpServer?.once(\"close\", () => {\n void closeResources();\n });\n\n config.logger.info(\n `[spotpatch:vite] Ready. Toggle picker with ${options.shortcut}.`,\n );\n },\n\n async closeBundle() {\n await closeResources();\n },\n };\n}\n","import { createHash } from \"node:crypto\";\nimport path from \"node:path\";\n\nimport type { ConfigEnv, Plugin, ResolvedConfig, UserConfig } from \"vite\";\nimport { injectSourceMarkers } from \"@spotpatch/compiler\";\nimport type { SourceRegistry } from \"@spotpatch/dev-server\";\n\nimport type { SpotPatchPluginContext } from \"../plugin-context.js\";\nimport { SPOTPATCH_DATA_FLOW_MODULE_ID } from \"../runtime/runtime-injection-plugin.js\";\nimport { createTransformFilter, stripViteQuery } from \"./transform-filter.js\";\n\ninterface TransformPluginInput {\n readonly configure?: (\n config: UserConfig,\n environment: ConfigEnv,\n ) => void | Promise<void>;\n readonly context: SpotPatchPluginContext;\n readonly registry: SourceRegistry;\n}\n\ninterface ViteTransformOutput {\n readonly code: string;\n readonly map: string;\n}\n\nfunction createCacheKey(id: string, code: string): string {\n const hash = createHash(\"sha256\").update(code).digest(\"base64url\");\n return `${id}\\0${hash}`;\n}\n\nfunction getDisplayPath(root: string, id: string): string {\n const relative = path.relative(root, stripViteQuery(id));\n return relative.split(path.sep).join(\"/\");\n}\n\nexport function createTransformPlugin(input: TransformPluginInput): Plugin {\n let root = process.cwd();\n let filter = createTransformFilter(root, input.context.getOptions());\n let logger: ResolvedConfig[\"logger\"] | undefined;\n const warnedFiles = new Set<string>();\n const warnedDataFlowDiagnostics = new Set<string>();\n const cache = new Map<string, ViteTransformOutput | null>();\n\n return {\n name: \"spotpatch:transform\",\n apply: \"serve\",\n enforce: \"pre\",\n\n async config(config, environment) {\n await input.configure?.(config, environment);\n },\n\n configResolved(config) {\n root = path.resolve(config.root);\n filter = createTransformFilter(root, input.context.getOptions());\n logger = config.logger;\n },\n\n transform(code, id) {\n if (!filter.shouldTransform(id, code)) {\n return null;\n }\n\n const cleanId = path.resolve(stripViteQuery(id));\n const cacheKey = createCacheKey(cleanId, code);\n\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey) ?? null;\n }\n\n const startedAt = performance.now();\n const options = input.context.getOptions();\n\n try {\n const result = injectSourceMarkers({\n code,\n absolutePath: cleanId,\n root,\n fileId: input.registry.register(cleanId),\n ...(options.dataFlow.enabled\n ? { dataFlow: { helperModule: SPOTPATCH_DATA_FLOW_MODULE_ID } }\n : {}),\n onWarning(warning) {\n logger?.warn(\n `[spotpatch:transform] Existing source marker at ${getDisplayPath(root, id)}:${String(warning.line)}:${String(warning.column)}; preserving application value.`,\n );\n },\n });\n\n if (result?.dataFlow !== undefined) {\n input.registry.registerDataFlowComponents(\n cleanId,\n result.dataFlow.sourceVersion,\n result.dataFlow.anchors.flatMap((anchor) =>\n anchor.kind === \"component\"\n ? [\n {\n componentSourceId: anchor.id,\n line: anchor.line,\n column: anchor.column,\n },\n ]\n : [],\n ),\n );\n for (const diagnostic of result.dataFlow.diagnostics) {\n const warningKey = `${cleanId}:${diagnostic.code}:${String(diagnostic.line)}:${String(diagnostic.column)}`;\n if (warnedDataFlowDiagnostics.has(warningKey)) continue;\n warnedDataFlowDiagnostics.add(warningKey);\n logger?.warn(\n `[spotpatch:data-flow] ${diagnostic.code} at ${getDisplayPath(root, id)}:${String(diagnostic.line)}:${String(diagnostic.column)}; keeping this adapter evidence partial.`,\n );\n }\n }\n\n const output =\n result === undefined\n ? null\n : Object.freeze({\n code: result.code,\n map: result.map.toString(),\n });\n cache.set(cacheKey, output);\n\n if (options.debug) {\n const elapsed = performance.now() - startedAt;\n logger?.info(\n `[spotpatch:transform] ${getDisplayPath(root, id)} ${elapsed.toFixed(2)}ms`,\n );\n }\n\n return output;\n } catch (error: unknown) {\n if (!warnedFiles.has(cleanId)) {\n warnedFiles.add(cleanId);\n const detail =\n options.debug && error instanceof Error ? `: ${error.message}` : \"\";\n logger?.warn(\n `[spotpatch:transform] Failed to transform ${getDisplayPath(root, id)}; using original module${detail}`,\n );\n }\n\n return null;\n }\n },\n };\n}\n","import path from \"node:path\";\n\nimport { createDataFlowSourceFilter, createSourceFilter } from \"@spotpatch/compiler\";\nimport type { ResolvedSpotPatchOptions } from \"@spotpatch/dev-server\";\n\nexport function stripViteQuery(id: string): string {\n const queryIndex = id.indexOf(\"?\");\n return queryIndex === -1 ? id : id.slice(0, queryIndex);\n}\n\nexport { isInsideRoot } from \"@spotpatch/compiler\";\n\nexport interface TransformFilter {\n shouldTransform(id: string, code: string): boolean;\n}\n\nexport function createTransformFilter(\n root: string,\n options: ResolvedSpotPatchOptions,\n): TransformFilter {\n const sourceFilter = createSourceFilter(root, options);\n const dataFlowFilter = createDataFlowSourceFilter(root, {\n include: options.include,\n exclude: options.exclude,\n });\n\n return Object.freeze({\n shouldTransform(id: string, code: string): boolean {\n if (\n id.startsWith(\"\\0\") ||\n id.includes(\"virtual:spotpatch\") ||\n id.includes(\"/packages/vite/\") ||\n id.includes(\"\\\\packages\\\\vite\\\\\")\n ) {\n return false;\n }\n\n const cleanId = stripViteQuery(id);\n const absolutePath = path.resolve(cleanId);\n return (\n sourceFilter.shouldTransform(absolutePath, code) ||\n (options.dataFlow.enabled && dataFlowFilter.shouldTransform(absolutePath, code))\n );\n },\n });\n}\n","export {\n createRuntimeAiConfig,\n DEFAULT_EXCLUDE,\n DEFAULT_OPTIONS,\n resolveOptions,\n} from \"@spotpatch/dev-server\";\nexport type {\n FilterEntry,\n ResolvedSpotPatchOptions,\n SimpleAiOptions,\n SpotPatchAiOptions,\n SpotPatchDataFlowOptions,\n SpotPatchOptions,\n} from \"@spotpatch/dev-server\";\n\nexport type ViteSpotPatchOptions = SharedSpotPatchOptions;\nimport type { SpotPatchOptions as SharedSpotPatchOptions } from \"@spotpatch/dev-server\";\n","export { spotPatch } from \"./plugin.js\";\nexport {\n DEFAULT_OPTIONS,\n resolveOptions,\n type ResolvedSpotPatchOptions,\n type SimpleAiOptions,\n type SpotPatchAiOptions,\n type SpotPatchDataFlowOptions,\n type SpotPatchOptions,\n type ViteSpotPatchOptions,\n} from \"./options.js\";\nexport {\n DEFAULT_AGENT_LIMITS,\n type AgentApplyMode,\n type AgentCheckDefinition,\n type AgentLimits,\n type AiExecutionOptions,\n type AiModelProfile,\n type AiOptions,\n type AiProviderAuthentication,\n type AiProviderProtocol,\n type ContextBudget,\n type OpenAICompatibleProviderOptions,\n type SpotPatchEditorPreference,\n} from \"@spotpatch/shared\";\n"],"mappings":";AAAA,OAAOA,WAAU;AAEjB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAA6D;;;ACVtE,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,OAAO,UAAU;AAEjB;AAAA,EACE;AAAA,EACA;AAAA,OAEK;;;ACRP;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,OAAS;AAAA,IACP;AAAA,EACF;AAAA,EACA,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,OAAS;AAAA,EACT,KAAO;AAAA,IACL,kBAAkB;AAAA,EACpB;AAAA,EACA,SAAW;AAAA,IACT,KAAK;AAAA,MACH,QAAU;AAAA,QACR,OAAS;AAAA,QACT,SAAW;AAAA,MACb;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,SAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IAC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