@spotpatch/vite 1.11.0 → 1.13.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 CHANGED
@@ -122,25 +122,24 @@ Enable the development-only UI explicitly:
122
122
  spotPatch({ externalAgent: true });
123
123
  ```
124
124
 
125
- Run setup and active commands from the exact canonical project root that owns the running Vite development session. Setup is a dry run without `--write`:
125
+ Managed Codex is owned by the ordinary Vite development server. Choose **Codex · managed**, click **Connect Codex**, and confirm the first project grant in the same `pnpm dev` terminal; no second connector command is part of the normal path. If compatibility or a required safety preflight fails, the UI remains on the Inbox fallback.
126
+
127
+ Run Claude attached and Inbox setup commands from the exact canonical project root that owns the running Vite development session. Setup is a dry run without `--write`:
126
128
 
127
129
  ```bash
128
130
  pnpm exec spotpatch-vite bridge setup --client claude --scope project --mode active --write
129
131
  MCP_PROTOCOL_NEGOTIATION=legacy claude --dangerously-load-development-channels server:spotpatch
130
132
 
131
- pnpm exec spotpatch-vite connect codex --allow-workspace-write
132
-
133
133
  pnpm exec spotpatch-vite bridge setup --client cursor --scope project --write
134
134
  ```
135
135
 
136
- The active command forms support an explicit session when `bridge sessions --json` reports multiple sessions for that exact root:
136
+ The attached command supports an explicit session when `bridge sessions --json` reports multiple sessions for that exact root:
137
137
 
138
138
  ```text
139
139
  spotpatch-vite bridge channel claude [--session <opaque-id>]
140
- spotpatch-vite connect codex --allow-workspace-write [--session <opaque-id>]
141
140
  ```
142
141
 
143
- The Claude legacy environment belongs on the Claude host process. Claude Channels are a Research Preview, work only while the Channel-enabled session is running, and provide no completion acknowledgement; completion depends on Claude calling the SpotPatch result tool. Codex active mode is zero-setup: the Connector injects the project-local SpotPatch MCP entry into its App Server thread and does not create or modify `.codex/config.toml`. Codex can still load other MCP servers already enabled by the user's normal Codex configuration. The Connector accepts exactly `codex-cli 0.149.0`. `bridge setup --client codex ...` remains available only for optional Inbox use; Cursor and all generic MCP hosts remain Inbox-only.
142
+ The Claude legacy environment belongs on the Claude host process. Claude Channels are a Research Preview, work only while the Channel-enabled session is running, and provide no completion acknowledgement; completion depends on Claude calling the SpotPatch result tool. The older `spotpatch-vite connect codex --allow-workspace-write [--session <opaque-id>]` command remains only as an advanced migration/diagnostic fallback. Codex stable versions from `0.149.0` onward are capability-checked against the schema generated by that exact CLI before the live protocol and security preflight; SpotPatch does not manage the Codex installation. Its attached direct-write behavior is not equivalent to managed isolation or validation. `bridge setup --client codex ...` remains available only for optional Inbox use; Cursor and all generic MCP hosts remain Inbox-only.
144
143
 
145
144
  This path is `local-validation`, not stable support. Automated fake-host and two-handoff tests exist, and a consecutive two-revision Codex flow has been manually validated on the recorded macOS/Next.js/Codex 0.149.0 environment. Real Claude Code consecutive delivery, repeatable real-host automation, and Windows process-tree cleanup remain `not-tested`; Cursor remains Inbox-only. See the [external Agent design and exact status](https://github.com/huanglvjing/spotpatch/blob/main/docs/%E6%8A%80%E6%9C%AF%E6%96%B9%E6%A1%88/%E5%A4%96%E9%83%A8Agent%E8%BF%9E%E6%8E%A5/00-%E7%B4%A2%E5%BC%95%E4%B8%8E%E5%86%B3%E7%AD%96%E6%91%98%E8%A6%81.md).
146
145
 
@@ -320,25 +319,24 @@ spotPatch({
320
319
  spotPatch({ externalAgent: true });
321
320
  ```
322
321
 
323
- 必须在当前 Vite dev Session 所属的精确 canonical 项目根执行 setup 和主动命令。setup 不带 `--write` 时只是 dry-run:
322
+ Codex managed 正常路径由普通 Vite 开发服务托管。在页面选择 **Codex · managed** 并点击 **连接 Codex**,首次项目授权在同一个 `pnpm dev` 终端确认;正常路径不需要第二条 Connector 命令。兼容性或必需安全预检不通过时,UI 保持 Inbox 降级,不会削弱权限配置。
323
+
324
+ Claude attached 与 Inbox setup 命令必须在当前 Vite dev Session 所属的精确 canonical 项目根执行。setup 不带 `--write` 时只是 dry-run:
324
325
 
325
326
  ```bash
326
327
  pnpm exec spotpatch-vite bridge setup --client claude --scope project --mode active --write
327
328
  MCP_PROTOCOL_NEGOTIATION=legacy claude --dangerously-load-development-channels server:spotpatch
328
329
 
329
- pnpm exec spotpatch-vite connect codex --allow-workspace-write
330
-
331
330
  pnpm exec spotpatch-vite bridge setup --client cursor --scope project --write
332
331
  ```
333
332
 
334
- 若 `bridge sessions --json` 报告该精确项目根有多个 Session,主动子命令支持显式选择:
333
+ 若 `bridge sessions --json` 报告该精确项目根有多个 Session,attached 子命令支持显式选择:
335
334
 
336
335
  ```text
337
336
  spotpatch-vite bridge channel claude [--session <opaque-id>]
338
- spotpatch-vite connect codex --allow-workspace-write [--session <opaque-id>]
339
337
  ```
340
338
 
341
- Claude legacy 环境变量必须设置在 Claude 宿主进程。Claude Channels 仍是 Research Preview,只在已启用 Channel 的会话运行时工作,且没有 completion ACK;完成状态依赖 Claude 调用 SpotPatch 结果 tool。Codex 主动模式为零配置:Connector 只把当前项目的 SpotPatch MCP 配置注入它拥有的 App Server thread,不创建也不修改 `.codex/config.toml`;Codex 仍可能按用户既有配置启动其他已启用 MCP server。Connector 当前只接受 `codex-cli 0.149.0`。`bridge setup --client codex ...` 仅保留为可选 Inbox 配置;Cursor 和所有普通 MCP 宿主仍为 Inbox-only。
339
+ Claude legacy 环境变量必须设置在 Claude 宿主进程。Claude Channels 仍是 Research Preview,只在已启用 Channel 的会话运行时工作,且没有 completion ACK;完成状态依赖 Claude 调用 SpotPatch 结果 tool。旧 `spotpatch-vite connect codex --allow-workspace-write [--session <opaque-id>]` 只保留为高级迁移/诊断回退。Codex 从稳定版 `0.149.0` 起,先用当前 CLI 生成的 Schema 校验固定协议子集,再执行真实协议与安全 preflight;SpotPatch 不管理 Codex 的安装或升级。attached 直接写入行为不等同于 managed 隔离与验证。`bridge setup --client codex ...` 仅保留为可选 Inbox 配置;Cursor 和所有普通 MCP 宿主仍为 Inbox-only。
342
340
 
343
341
  该链路当前只是 `local-validation`,不是稳定支持。仓库有假宿主和连续两 Handoff 自动化测试,并已在记录的 macOS/Next.js/Codex 0.149.0 环境人工验证连续两个 revision。真实 Claude Code 连续投递、可重复真实宿主自动化和 Windows 进程树清理仍为 `not-tested`;Cursor 保持 Inbox-only。准确边界见[外部 Agent 方案与实现状态](https://github.com/huanglvjing/spotpatch/blob/main/docs/%E6%8A%80%E6%9C%AF%E6%96%B9%E6%A1%88/%E5%A4%96%E9%83%A8Agent%E8%BF%9E%E6%8E%A5/00-%E7%B4%A2%E5%BC%95%E4%B8%8E%E5%86%B3%E7%AD%96%E6%91%98%E8%A6%81.md)。
344
342
 
package/dist/index.cjs CHANGED
@@ -43,15 +43,15 @@ var import_dev_server3 = require("@spotpatch/dev-server");
43
43
  var import_vite2 = require("vite");
44
44
 
45
45
  // src/runtime/runtime-injection-plugin.ts
46
- var import_node_module = require("module");
47
46
  var import_node_fs = require("fs");
47
+ var import_node_module = require("module");
48
48
  var import_node_path = __toESM(require("path"), 1);
49
49
  var import_dev_server = require("@spotpatch/dev-server");
50
50
 
51
51
  // package.json
52
52
  var package_default = {
53
53
  name: "@spotpatch/vite",
54
- version: "1.11.0",
54
+ version: "1.13.0",
55
55
  description: "Vite development plugin for SpotPatch.",
56
56
  license: "MIT",
57
57
  repository: {
@@ -97,8 +97,9 @@ var package_default = {
97
97
  }
98
98
  },
99
99
  scripts: {
100
- 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",
100
+ build: "pnpm clean && tsup --config tsup.config.ts",
101
101
  clean: `node --input-type=module -e "import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })"`,
102
+ dev: "tsup --config tsup.config.ts --watch src --watch tsup.config.ts --watch ../runtime/dist/index.js --watch ../react-adapter/dist/index.js --watch ../shared/dist/index.js",
102
103
  typecheck: "tsc --noEmit -p tsconfig.json"
103
104
  },
104
105
  dependencies: {
@@ -180,17 +181,68 @@ var SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID = "virtual:spotpatch/data-flow-panel";
180
181
  var RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID = `\0${SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID}`;
181
182
  var SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID = "virtual:spotpatch/external-handoff-panel";
182
183
  var RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID = `\0${SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID}`;
184
+ var SPOTPATCH_MOTION_MODULE_ID = "virtual:spotpatch/motion";
185
+ var RESOLVED_SPOTPATCH_MOTION_MODULE_ID = `\0${SPOTPATCH_MOTION_MODULE_ID}`;
186
+ var RUNTIME_BUNDLE_NAMES = [
187
+ "client",
188
+ "dataFlowPanel",
189
+ "dataFlowPrelude",
190
+ "externalHandoffPanel",
191
+ "motion",
192
+ "reactAdapter"
193
+ ];
194
+ var RUNTIME_BUNDLE_DEFINITIONS = Object.freeze({
195
+ client: {
196
+ enabled: () => true,
197
+ fileName: "runtime-client.js",
198
+ publicId: SPOTPATCH_CLIENT_MODULE_ID,
199
+ resolvedId: RESOLVED_SPOTPATCH_CLIENT_MODULE_ID
200
+ },
201
+ dataFlowPanel: {
202
+ enabled: (options) => options.dataFlow.enabled,
203
+ fileName: "runtime-data-flow-panel.js",
204
+ publicId: SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID,
205
+ resolvedId: RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID
206
+ },
207
+ dataFlowPrelude: {
208
+ enabled: (options) => options.dataFlow.enabled,
209
+ fileName: "runtime-data-flow-prelude.js",
210
+ publicId: SPOTPATCH_DATA_FLOW_MODULE_ID,
211
+ resolvedId: RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID
212
+ },
213
+ externalHandoffPanel: {
214
+ enabled: (options) => options.externalAgent.enabled,
215
+ fileName: "runtime-external-handoff-panel.js",
216
+ publicId: SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID,
217
+ resolvedId: RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID
218
+ },
219
+ motion: {
220
+ enabled: () => true,
221
+ fileName: "runtime-motion.js",
222
+ publicId: SPOTPATCH_MOTION_MODULE_ID,
223
+ resolvedId: RESOLVED_SPOTPATCH_MOTION_MODULE_ID
224
+ },
225
+ reactAdapter: {
226
+ enabled: () => true,
227
+ fileName: "runtime-react-adapter.js",
228
+ importer: RESOLVED_SPOTPATCH_CLIENT_MODULE_ID,
229
+ publicId: "@spotpatch/react-adapter",
230
+ resolvedId: RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID
231
+ }
232
+ });
233
+ function createBundleState(injected) {
234
+ return injected === void 0 ? {} : { injected };
235
+ }
183
236
  function createDataFlowPreludeModule(input, bundle) {
184
237
  return [
185
238
  `const __SPOTPATCH_DATA_FLOW_CONFIG__ = ${JSON.stringify(input.context.getOptions().dataFlow)};`,
186
239
  bundle
187
240
  ].join("\n");
188
241
  }
189
- function readRuntimeBundle(root, fileName) {
242
+ function resolveRuntimeBundlePath(root, fileName) {
190
243
  const resolveFromProject = (0, import_node_module.createRequire)(import_node_path.default.join(root, "package.json"));
191
244
  const packageEntry = resolveFromProject.resolve("@spotpatch/vite");
192
- const bundlePath = import_node_path.default.join(import_node_path.default.dirname(packageEntry), fileName);
193
- return (0, import_node_fs.readFileSync)(bundlePath, "utf8");
245
+ return import_node_path.default.join(import_node_path.default.dirname(packageEntry), fileName);
194
246
  }
195
247
  function readConsumerViteVersion(root) {
196
248
  try {
@@ -224,6 +276,7 @@ function createClientModule(input, clientBundle, viteVersion) {
224
276
  spotPatchVersion: package_default.version
225
277
  };
226
278
  return [
279
+ `import ${JSON.stringify(SPOTPATCH_MOTION_MODULE_ID)};`,
227
280
  ...options.dataFlow.enabled ? [`import ${JSON.stringify(SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID)};`] : [],
228
281
  ...options.externalAgent.enabled ? [`import ${JSON.stringify(SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID)};`] : [],
229
282
  `const __SPOTPATCH_BRAND_MARK_CONTENT__ = ${JSON.stringify(BRAND_MARK_CONTENT)};`,
@@ -233,11 +286,76 @@ function createClientModule(input, clientBundle, viteVersion) {
233
286
  }
234
287
  function createRuntimeInjectionPlugin(input) {
235
288
  let root = process.cwd();
236
- let clientBundle = input.clientBundle;
237
- let dataFlowPreludeBundle = input.dataFlowPreludeBundle;
238
- let dataFlowPanelBundle = input.dataFlowPanelBundle;
239
- let externalHandoffPanelBundle = input.externalHandoffPanelBundle;
240
289
  let viteVersion = import_vite.version;
290
+ let disposeWatcher;
291
+ const bundleStates = {
292
+ client: createBundleState(input.clientBundle),
293
+ dataFlowPanel: createBundleState(input.dataFlowPanelBundle),
294
+ dataFlowPrelude: createBundleState(input.dataFlowPreludeBundle),
295
+ externalHandoffPanel: createBundleState(input.externalHandoffPanelBundle),
296
+ motion: createBundleState(input.motionBundle),
297
+ reactAdapter: createBundleState(input.reactAdapterBundle)
298
+ };
299
+ function getBundlePath(name) {
300
+ const state = bundleStates[name];
301
+ state.path ??= import_node_path.default.resolve(
302
+ input.bundlePaths?.[name] ?? resolveRuntimeBundlePath(root, RUNTIME_BUNDLE_DEFINITIONS[name].fileName)
303
+ );
304
+ return state.path;
305
+ }
306
+ function loadBundle(name) {
307
+ const state = bundleStates[name];
308
+ if (state.injected !== void 0) return state.injected;
309
+ state.cached ??= (0, import_node_fs.readFileSync)(getBundlePath(name), "utf8");
310
+ return state.cached;
311
+ }
312
+ function stopWatching() {
313
+ disposeWatcher?.();
314
+ }
315
+ function watchRuntimeBundles(server) {
316
+ stopWatching();
317
+ const options = input.context.getOptions();
318
+ const bundleNameByPath = /* @__PURE__ */ new Map();
319
+ for (const name of RUNTIME_BUNDLE_NAMES) {
320
+ if (RUNTIME_BUNDLE_DEFINITIONS[name].enabled(options) && bundleStates[name].injected === void 0) {
321
+ bundleNameByPath.set(getBundlePath(name), name);
322
+ }
323
+ }
324
+ const bundlePaths = [...bundleNameByPath.keys()];
325
+ if (bundlePaths.length === 0) return;
326
+ let reloadHandle;
327
+ const scheduleReload = () => {
328
+ reloadHandle ??= setImmediate(() => {
329
+ reloadHandle = void 0;
330
+ server.ws.send({ type: "full-reload", path: "*" });
331
+ });
332
+ };
333
+ const handleChange = (changedPath) => {
334
+ const name = bundleNameByPath.get(import_node_path.default.resolve(changedPath));
335
+ if (name === void 0) return;
336
+ delete bundleStates[name].cached;
337
+ const module2 = server.moduleGraph.getModuleById(
338
+ RUNTIME_BUNDLE_DEFINITIONS[name].resolvedId
339
+ );
340
+ if (module2 !== void 0) {
341
+ server.moduleGraph.invalidateModule(module2);
342
+ }
343
+ scheduleReload();
344
+ };
345
+ const dispose = () => {
346
+ if (reloadHandle !== void 0) {
347
+ clearImmediate(reloadHandle);
348
+ reloadHandle = void 0;
349
+ }
350
+ server.watcher.off("change", handleChange);
351
+ server.httpServer?.off("close", dispose);
352
+ if (disposeWatcher === dispose) disposeWatcher = void 0;
353
+ };
354
+ server.watcher.add(bundlePaths);
355
+ server.watcher.on("change", handleChange);
356
+ server.httpServer?.once("close", dispose);
357
+ disposeWatcher = dispose;
358
+ }
241
359
  return {
242
360
  name: "spotpatch:runtime-injection",
243
361
  apply: "serve",
@@ -246,52 +364,31 @@ function createRuntimeInjectionPlugin(input) {
246
364
  root = import_node_path.default.resolve(config.root);
247
365
  viteVersion = readConsumerViteVersion(root);
248
366
  },
367
+ configureServer(server) {
368
+ watchRuntimeBundles(server);
369
+ },
249
370
  resolveId(id, importer) {
250
- if (id === SPOTPATCH_CLIENT_MODULE_ID) {
251
- return RESOLVED_SPOTPATCH_CLIENT_MODULE_ID;
252
- }
253
- if (id === "@spotpatch/react-adapter" && importer === RESOLVED_SPOTPATCH_CLIENT_MODULE_ID) {
254
- return RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID;
255
- }
256
- if (id === SPOTPATCH_DATA_FLOW_MODULE_ID) {
257
- return RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID;
258
- }
259
- if (id === SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID) {
260
- return RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID;
261
- }
262
- if (id === SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID) {
263
- return RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID;
371
+ for (const name of RUNTIME_BUNDLE_NAMES) {
372
+ const definition = RUNTIME_BUNDLE_DEFINITIONS[name];
373
+ if (id === definition.publicId && (definition.importer === void 0 || importer === definition.importer)) {
374
+ return definition.resolvedId;
375
+ }
264
376
  }
265
377
  return null;
266
378
  },
267
379
  load(id) {
268
- if (id === RESOLVED_SPOTPATCH_CLIENT_MODULE_ID) {
269
- clientBundle ??= readRuntimeBundle(root, "runtime-client.js");
270
- return createClientModule(input, clientBundle, viteVersion);
271
- }
272
- if (id === RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID) {
273
- return input.reactAdapterBundle ?? readRuntimeBundle(root, "runtime-react-adapter.js");
274
- }
275
- if (id === RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID) {
276
- if (!input.context.getOptions().dataFlow.enabled) return null;
277
- dataFlowPreludeBundle ??= readRuntimeBundle(
278
- root,
279
- "runtime-data-flow-prelude.js"
280
- );
281
- return createDataFlowPreludeModule(input, dataFlowPreludeBundle);
282
- }
283
- if (id === RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID) {
284
- if (!input.context.getOptions().dataFlow.enabled) return null;
285
- dataFlowPanelBundle ??= readRuntimeBundle(root, "runtime-data-flow-panel.js");
286
- return dataFlowPanelBundle;
287
- }
288
- if (id === RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID) {
289
- if (!input.context.getOptions().externalAgent.enabled) return null;
290
- externalHandoffPanelBundle ??= readRuntimeBundle(
291
- root,
292
- "runtime-external-handoff-panel.js"
293
- );
294
- return externalHandoffPanelBundle;
380
+ for (const name of RUNTIME_BUNDLE_NAMES) {
381
+ const definition = RUNTIME_BUNDLE_DEFINITIONS[name];
382
+ if (id !== definition.resolvedId) continue;
383
+ if (!definition.enabled(input.context.getOptions())) return null;
384
+ const bundle = loadBundle(name);
385
+ if (name === "client") {
386
+ return createClientModule(input, bundle, viteVersion);
387
+ }
388
+ if (name === "dataFlowPrelude") {
389
+ return createDataFlowPreludeModule(input, bundle);
390
+ }
391
+ return bundle;
295
392
  }
296
393
  return null;
297
394
  },
@@ -318,6 +415,9 @@ function createRuntimeInjectionPlugin(input) {
318
415
  },
319
416
  client
320
417
  ];
418
+ },
419
+ closeBundle() {
420
+ stopWatching();
321
421
  }
322
422
  };
323
423
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../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"],"sourcesContent":["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","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.11.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 resolveManagedExecutionValidation,\n type AgentJobManager,\n type ExternalHandoffService,\n type SourceRegistry,\n type SpotPatchSession,\n type SpotPatchMiddleware,\n} from \"@spotpatch/dev-server\";\nimport {\n createExternalAgentSupervisor,\n type ExternalAgentSupervisor,\n} from \"@spotpatch/bridge\";\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 externalAgentSupervisor: ExternalAgentSupervisor | undefined;\n let middleware: SpotPatchMiddleware | undefined;\n let config: ResolvedConfig | undefined;\n\n const closeResources = async (): Promise<void> => {\n input.registry.clear();\n middleware?.dispose();\n middleware = undefined;\n await externalAgentSupervisor?.dispose();\n externalAgentSupervisor = undefined;\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 if (externalHandoffService.capability().brokerReady) {\n try {\n const validation = await resolveManagedExecutionValidation({\n ai: options.ai,\n appRoot: root,\n });\n externalAgentSupervisor = await createExternalAgentSupervisor({\n bridgeAdapter: \"vite\",\n checks: validation.checks,\n limits: validation.limits,\n root,\n sessionId: input.session.id,\n projectLabel: path.basename(root),\n });\n } catch {\n config.logger.warn(\n \"[spotpatch:vite] Managed Agent control is unavailable; Inbox remains active.\",\n );\n }\n }\n }\n\n middleware = createSpotPatchMiddleware({\n ...(agentManager === undefined ? {} : { agentManager }),\n ...(externalAgentSupervisor === undefined\n ? {}\n : { externalAgentControl: externalAgentSupervisor }),\n ...(externalHandoffService === undefined ? {} : { externalHandoffService }),\n options,\n registry: input.registry,\n root,\n session: input.session,\n logger: config.logger,\n });\n server.middlewares.use(middleware);\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,oBAAiB;AAEjB,IAAAC,qBAOO;AACP,IAAAC,eAAsE;;;ACVtE,yBAA8B;AAC9B,qBAA6B;AAC7B,uBAAiB;AAEjB,wBAIO;;;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;AA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0CAAsB;AAAA,MACpC,SAAS;AAAA,MACT;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAED,gCAAwB,iDAA6B,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,IAAAC,qBAKO;;;ARMP,oBAaO;","names":["import_node_path","import_dev_server","import_vite","path","VITE_VERSION","import_node_path","import_dev_server","path","import_node_path","import_compiler","import_node_path","import_compiler","path","path","path","import_dev_server"]}
1
+ {"version":3,"sources":["../src/index.ts","../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"],"sourcesContent":["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","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 { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\nimport {\n createRuntimeAiConfig,\n createRuntimeDataFlowConfig,\n type ResolvedSpotPatchOptions,\n type SpotPatchSession,\n} from \"@spotpatch/dev-server\";\nimport packageMetadata from \"../../package.json\" with { type: \"json\" };\nimport { version as VITE_VERSION, type Plugin, type ViteDevServer } 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}`;\nexport const SPOTPATCH_MOTION_MODULE_ID = \"virtual:spotpatch/motion\";\nexport const RESOLVED_SPOTPATCH_MOTION_MODULE_ID = `\\0${SPOTPATCH_MOTION_MODULE_ID}`;\n\nconst RUNTIME_BUNDLE_NAMES = [\n \"client\",\n \"dataFlowPanel\",\n \"dataFlowPrelude\",\n \"externalHandoffPanel\",\n \"motion\",\n \"reactAdapter\",\n] as const;\n\ntype RuntimeBundleName = (typeof RUNTIME_BUNDLE_NAMES)[number];\n\ninterface RuntimeBundleDefinition {\n readonly enabled: (options: ResolvedSpotPatchOptions) => boolean;\n readonly fileName: string;\n readonly importer?: string;\n readonly publicId: string;\n readonly resolvedId: string;\n}\n\ninterface RuntimeBundleState {\n cached?: string;\n readonly injected?: string;\n path?: string;\n}\n\nconst RUNTIME_BUNDLE_DEFINITIONS: Readonly<\n Record<RuntimeBundleName, RuntimeBundleDefinition>\n> = Object.freeze({\n client: {\n enabled: () => true,\n fileName: \"runtime-client.js\",\n publicId: SPOTPATCH_CLIENT_MODULE_ID,\n resolvedId: RESOLVED_SPOTPATCH_CLIENT_MODULE_ID,\n },\n dataFlowPanel: {\n enabled: (options) => options.dataFlow.enabled,\n fileName: \"runtime-data-flow-panel.js\",\n publicId: SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID,\n resolvedId: RESOLVED_SPOTPATCH_DATA_FLOW_PANEL_MODULE_ID,\n },\n dataFlowPrelude: {\n enabled: (options) => options.dataFlow.enabled,\n fileName: \"runtime-data-flow-prelude.js\",\n publicId: SPOTPATCH_DATA_FLOW_MODULE_ID,\n resolvedId: RESOLVED_SPOTPATCH_DATA_FLOW_MODULE_ID,\n },\n externalHandoffPanel: {\n enabled: (options) => options.externalAgent.enabled,\n fileName: \"runtime-external-handoff-panel.js\",\n publicId: SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID,\n resolvedId: RESOLVED_SPOTPATCH_EXTERNAL_HANDOFF_PANEL_MODULE_ID,\n },\n motion: {\n enabled: () => true,\n fileName: \"runtime-motion.js\",\n publicId: SPOTPATCH_MOTION_MODULE_ID,\n resolvedId: RESOLVED_SPOTPATCH_MOTION_MODULE_ID,\n },\n reactAdapter: {\n enabled: () => true,\n fileName: \"runtime-react-adapter.js\",\n importer: RESOLVED_SPOTPATCH_CLIENT_MODULE_ID,\n publicId: \"@spotpatch/react-adapter\",\n resolvedId: RESOLVED_SPOTPATCH_REACT_ADAPTER_MODULE_ID,\n },\n});\n\ninterface RuntimeInjectionPluginInput {\n readonly bundlePaths?: Partial<Readonly<Record<RuntimeBundleName, string>>>;\n readonly clientBundle?: string;\n readonly context: SpotPatchPluginContext;\n readonly dataFlowPreludeBundle?: string;\n readonly dataFlowPanelBundle?: string;\n readonly externalHandoffPanelBundle?: string;\n readonly motionBundle?: string;\n readonly reactAdapterBundle?: string;\n readonly session: SpotPatchSession;\n}\n\nfunction createBundleState(injected: string | undefined): RuntimeBundleState {\n return injected === undefined ? {} : { injected };\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 resolveRuntimeBundlePath(root: string, fileName: string): string {\n const resolveFromProject = createRequire(path.join(root, \"package.json\"));\n const packageEntry = resolveFromProject.resolve(\"@spotpatch/vite\");\n return path.join(path.dirname(packageEntry), fileName);\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 `import ${JSON.stringify(SPOTPATCH_MOTION_MODULE_ID)};`,\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 viteVersion = VITE_VERSION;\n let disposeWatcher: (() => void) | undefined;\n const bundleStates: Record<RuntimeBundleName, RuntimeBundleState> = {\n client: createBundleState(input.clientBundle),\n dataFlowPanel: createBundleState(input.dataFlowPanelBundle),\n dataFlowPrelude: createBundleState(input.dataFlowPreludeBundle),\n externalHandoffPanel: createBundleState(input.externalHandoffPanelBundle),\n motion: createBundleState(input.motionBundle),\n reactAdapter: createBundleState(input.reactAdapterBundle),\n };\n\n function getBundlePath(name: RuntimeBundleName): string {\n const state = bundleStates[name];\n state.path ??= path.resolve(\n input.bundlePaths?.[name] ??\n resolveRuntimeBundlePath(root, RUNTIME_BUNDLE_DEFINITIONS[name].fileName),\n );\n return state.path;\n }\n\n function loadBundle(name: RuntimeBundleName): string {\n const state = bundleStates[name];\n if (state.injected !== undefined) return state.injected;\n state.cached ??= readFileSync(getBundlePath(name), \"utf8\");\n return state.cached;\n }\n\n function stopWatching(): void {\n disposeWatcher?.();\n }\n\n function watchRuntimeBundles(server: ViteDevServer): void {\n stopWatching();\n const options = input.context.getOptions();\n const bundleNameByPath = new Map<string, RuntimeBundleName>();\n\n for (const name of RUNTIME_BUNDLE_NAMES) {\n if (\n RUNTIME_BUNDLE_DEFINITIONS[name].enabled(options) &&\n bundleStates[name].injected === undefined\n ) {\n bundleNameByPath.set(getBundlePath(name), name);\n }\n }\n\n const bundlePaths = [...bundleNameByPath.keys()];\n if (bundlePaths.length === 0) return;\n\n let reloadHandle: NodeJS.Immediate | undefined;\n const scheduleReload = (): void => {\n reloadHandle ??= setImmediate(() => {\n reloadHandle = undefined;\n server.ws.send({ type: \"full-reload\", path: \"*\" });\n });\n };\n\n const handleChange = (changedPath: string): void => {\n const name = bundleNameByPath.get(path.resolve(changedPath));\n if (name === undefined) return;\n\n delete bundleStates[name].cached;\n const module = server.moduleGraph.getModuleById(\n RUNTIME_BUNDLE_DEFINITIONS[name].resolvedId,\n );\n if (module !== undefined) {\n server.moduleGraph.invalidateModule(module);\n }\n scheduleReload();\n };\n const dispose = (): void => {\n if (reloadHandle !== undefined) {\n clearImmediate(reloadHandle);\n reloadHandle = undefined;\n }\n server.watcher.off(\"change\", handleChange);\n server.httpServer?.off(\"close\", dispose);\n if (disposeWatcher === dispose) disposeWatcher = undefined;\n };\n\n server.watcher.add(bundlePaths);\n server.watcher.on(\"change\", handleChange);\n server.httpServer?.once(\"close\", dispose);\n disposeWatcher = dispose;\n }\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 configureServer(server) {\n watchRuntimeBundles(server);\n },\n\n resolveId(id, importer) {\n for (const name of RUNTIME_BUNDLE_NAMES) {\n const definition = RUNTIME_BUNDLE_DEFINITIONS[name];\n if (\n id === definition.publicId &&\n (definition.importer === undefined || importer === definition.importer)\n ) {\n return definition.resolvedId;\n }\n }\n return null;\n },\n\n load(id) {\n for (const name of RUNTIME_BUNDLE_NAMES) {\n const definition = RUNTIME_BUNDLE_DEFINITIONS[name];\n if (id !== definition.resolvedId) continue;\n if (!definition.enabled(input.context.getOptions())) return null;\n\n const bundle = loadBundle(name);\n if (name === \"client\") {\n return createClientModule(input, bundle, viteVersion);\n }\n if (name === \"dataFlowPrelude\") {\n return createDataFlowPreludeModule(input, bundle);\n }\n return bundle;\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 closeBundle() {\n stopWatching();\n },\n };\n}\n","{\n \"name\": \"@spotpatch/vite\",\n \"version\": \"1.13.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\": \"pnpm clean && tsup --config tsup.config.ts\",\n \"clean\": \"node --input-type=module -e \\\"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\\\"\",\n \"dev\": \"tsup --config tsup.config.ts --watch src --watch tsup.config.ts --watch ../runtime/dist/index.js --watch ../react-adapter/dist/index.js --watch ../shared/dist/index.js\",\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 resolveManagedExecutionValidation,\n type AgentJobManager,\n type ExternalHandoffService,\n type SourceRegistry,\n type SpotPatchSession,\n type SpotPatchMiddleware,\n} from \"@spotpatch/dev-server\";\nimport {\n createExternalAgentSupervisor,\n type ExternalAgentSupervisor,\n} from \"@spotpatch/bridge\";\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 externalAgentSupervisor: ExternalAgentSupervisor | undefined;\n let middleware: SpotPatchMiddleware | undefined;\n let config: ResolvedConfig | undefined;\n\n const closeResources = async (): Promise<void> => {\n input.registry.clear();\n middleware?.dispose();\n middleware = undefined;\n await externalAgentSupervisor?.dispose();\n externalAgentSupervisor = undefined;\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 if (externalHandoffService.capability().brokerReady) {\n try {\n const validation = await resolveManagedExecutionValidation({\n ai: options.ai,\n appRoot: root,\n });\n externalAgentSupervisor = await createExternalAgentSupervisor({\n bridgeAdapter: \"vite\",\n checks: validation.checks,\n limits: validation.limits,\n root,\n sessionId: input.session.id,\n projectLabel: path.basename(root),\n });\n } catch {\n config.logger.warn(\n \"[spotpatch:vite] Managed Agent control is unavailable; Inbox remains active.\",\n );\n }\n }\n }\n\n middleware = createSpotPatchMiddleware({\n ...(agentManager === undefined ? {} : { agentManager }),\n ...(externalAgentSupervisor === undefined\n ? {}\n : { externalAgentControl: externalAgentSupervisor }),\n ...(externalHandoffService === undefined ? {} : { externalHandoffService }),\n options,\n registry: input.registry,\n root,\n session: input.session,\n logger: config.logger,\n });\n server.middlewares.use(middleware);\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\";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AM,OAAO,KAAK;AACnE,kBAAQ;AAAA,YACN,6CAA6C,eAAe,MAAM,EAAE,CAAC,0BAA0B,MAAM;AAAA,UACvG;AAAA,QACF;AAEA,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;;;ALhIO,SAAS,UAAU,cAAoC,CAAC,GAAa;AAC1E,MAAI,cAAU,mCAAe,WAAW;AACxC,MAAI,wBACF,OAAO,OAAO,CAAC,CAAC;AAElB,MAAI,CAAC,QAAQ,SAAS;AACpB,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,eAAW,yCAAqB;AACtC,QAAM,cAAU,kCAAc;AAC9B,QAAM,UAAU,OAAO,OAAO;AAAA,IAC5B,0BAA0B,MAAM;AAAA,IAChC,YAAY,MAAM;AAAA,EACpB,CAAkC;AAClC,QAAM,YAAY,OAChB,QACA,gBACkB;AAClB,UAAM,OAAO,kBAAAC,QAAK,QAAQ,QAAQ,IAAI,GAAG,OAAO,QAAQ,GAAG;AAC3D,UAAM,oBACJ,OAAO,WAAW,QACd,QAAQ,UACR,sBAAQ,YAAY,MAAM,kBAAAA,QAAK,QAAQ,MAAM,OAAO,UAAU,GAAG,GAAG,EAAE;AAC5E,UAAM,gBACJ,YAAY,OAAO,aACf,sDAAkC,iBAAiB,EAAE,KACrD;AAEN,cAAU,UAAM,0CAAsB;AAAA,MACpC,SAAS;AAAA,MACT;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAED,gCAAwB,iDAA6B,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,IAAAC,qBAKO;;;ARMP,oBAaO;","names":["import_node_path","import_dev_server","import_vite","path","VITE_VERSION","module","import_node_path","import_dev_server","path","import_node_path","import_compiler","import_node_path","import_compiler","path","path","path","import_dev_server"]}