@oddsquad/vite-plugin-lit 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +2 -0
  3. package/bin.mjs +20 -0
  4. package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-DXAVFObe.js → browser-agent-rpc-BXhoSh1z-F2EfZsFX.js} +3 -3
  5. package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-DXAVFObe.js.map → browser-agent-rpc-BXhoSh1z-F2EfZsFX.js.map} +1 -1
  6. package/dist/client/assets/{index-DVr5EnyB.js → index-B2HYO7lk.js} +25 -18
  7. package/dist/client/assets/index-B2HYO7lk.js.map +1 -0
  8. package/dist/client/index.html +1 -1
  9. package/lib/confine.d.ts +22 -0
  10. package/lib/confine.d.ts.map +1 -0
  11. package/lib/confine.js +39 -0
  12. package/lib/confine.js.map +1 -0
  13. package/lib/devframe/definition.d.ts +10 -2
  14. package/lib/devframe/definition.d.ts.map +1 -1
  15. package/lib/devframe/definition.js +31 -9
  16. package/lib/devframe/definition.js.map +1 -1
  17. package/lib/devframe/protocol.d.ts +7 -3
  18. package/lib/devframe/protocol.d.ts.map +1 -1
  19. package/lib/devframe/protocol.js.map +1 -1
  20. package/lib/devframe/vite.d.ts.map +1 -1
  21. package/lib/devframe/vite.js +3 -0
  22. package/lib/devframe/vite.js.map +1 -1
  23. package/lib/http.d.ts +5 -0
  24. package/lib/http.d.ts.map +1 -1
  25. package/lib/http.js +5 -0
  26. package/lib/http.js.map +1 -1
  27. package/lib/plugins/open-in-editor.d.ts.map +1 -1
  28. package/lib/plugins/open-in-editor.js +11 -19
  29. package/lib/plugins/open-in-editor.js.map +1 -1
  30. package/lib/snapshot.d.ts +2 -1
  31. package/lib/snapshot.d.ts.map +1 -1
  32. package/lib/snapshot.js +17 -1
  33. package/lib/snapshot.js.map +1 -1
  34. package/lib/source-meta.d.ts.map +1 -1
  35. package/lib/source-meta.js +40 -1
  36. package/lib/source-meta.js.map +1 -1
  37. package/package.json +6 -6
  38. package/dist/client/assets/index-DVr5EnyB.js.map +0 -1
@@ -32,7 +32,7 @@
32
32
  `prefers-color-scheme` @media owns it, following the host/OS; an explicit
33
33
  light/dark pins a `.color-scheme-*` class on :root.
34
34
  -->
35
- <script type="module" crossorigin src="./assets/index-DVr5EnyB.js"></script>
35
+ <script type="module" crossorigin src="./assets/index-B2HYO7lk.js"></script>
36
36
  </head>
37
37
  <body>
38
38
  <lit-devtools-panel></lit-devtools-panel>
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /** Why {@link confineToRoots} refused a path. */
7
+ export type ConfineFailure = 'outside' | 'missing';
8
+ /**
9
+ * Resolve `file` against the first of `roots` and accept it only if it lands
10
+ * at or beneath one of them and exists. Every caller hands the result to
11
+ * `launch-editor`, which spawns the developer's editor on it, so this is the
12
+ * boundary that keeps a request from opening arbitrary files (absolute paths,
13
+ * `../` traversal, a sibling directory that merely shares a root's prefix, a
14
+ * symlink out of the tree).
15
+ * Without roots nothing is allowed.
16
+ */
17
+ export declare const confineToRoots: (roots: readonly string[], file: string) => {
18
+ path: string;
19
+ } | {
20
+ failure: ConfineFailure;
21
+ };
22
+ //# sourceMappingURL=confine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confine.d.ts","sourceRoot":"","sources":["../src/lib/confine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,UAClB,SAAS,MAAM,EAAE,QAClB,MAAM,KACX;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,OAAO,EAAE,cAAc,CAAA;CAmB3C,CAAC"}
package/lib/confine.js ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ import {existsSync, realpathSync} from 'node:fs';
7
+ import {resolve as resolvePath, sep} from 'node:path';
8
+ /**
9
+ * Resolve `file` against the first of `roots` and accept it only if it lands
10
+ * at or beneath one of them and exists. Every caller hands the result to
11
+ * `launch-editor`, which spawns the developer's editor on it, so this is the
12
+ * boundary that keeps a request from opening arbitrary files (absolute paths,
13
+ * `../` traversal, a sibling directory that merely shares a root's prefix, a
14
+ * symlink out of the tree).
15
+ * Without roots nothing is allowed.
16
+ */
17
+ export const confineToRoots = (roots, file) => {
18
+ const resolvedRoots = roots.map((root) => resolvePath(root));
19
+ const primary = resolvedRoots[0];
20
+ if (primary === undefined) return {failure: 'outside'};
21
+ const path = resolvePath(primary, file);
22
+ if (!within(resolvedRoots, path)) return {failure: 'outside'};
23
+ if (!existsSync(path)) return {failure: 'missing'};
24
+ // Checked again on the real paths, so a symlink beneath a root can't point
25
+ // the editor outside every root. The caller still gets the path as asked:
26
+ // that's the one the developer recognises.
27
+ const realRoots = resolvedRoots.flatMap((root) => {
28
+ try {
29
+ return [realpathSync(root)];
30
+ } catch {
31
+ return [];
32
+ }
33
+ });
34
+ if (!within(realRoots, realpathSync(path))) return {failure: 'outside'};
35
+ return {path};
36
+ };
37
+ const within = (roots, path) =>
38
+ roots.some((root) => path === root || path.startsWith(root + sep));
39
+ //# sourceMappingURL=confine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confine.js","sourceRoot":"","sources":["../src/lib/confine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AACjD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAE,GAAG,EAAC,MAAM,WAAW,CAAC;AAKtD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,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right 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {existsSync, realpathSync} from 'node:fs';\nimport {resolve as resolvePath, sep} from 'node:path';\n\n/** Why {@link confineToRoots} refused a path. */\nexport type ConfineFailure = 'outside' | 'missing';\n\n/**\n * Resolve `file` against the first of `roots` and accept it only if it lands\n * at or beneath one of them and exists. Every caller hands the result to\n * `launch-editor`, which spawns the developer's editor on it, so this is the\n * boundary that keeps a request from opening arbitrary files (absolute paths,\n * `../` traversal, a sibling directory that merely shares a root's prefix, a\n * symlink out of the tree).\n * Without roots nothing is allowed.\n */\nexport const confineToRoots = (\n roots: readonly string[],\n file: string\n): {path: string} | {failure: ConfineFailure} => {\n const resolvedRoots = roots.map((root) => resolvePath(root));\n const primary = resolvedRoots[0];\n if (primary === undefined) return {failure: 'outside'};\n const path = resolvePath(primary, file);\n if (!within(resolvedRoots, path)) return {failure: 'outside'};\n if (!existsSync(path)) return {failure: 'missing'};\n // Checked again on the real paths, so a symlink beneath a root can't point\n // the editor outside every root. The caller still gets the path as asked:\n // that's the one the developer recognises.\n const realRoots = resolvedRoots.flatMap((root) => {\n try {\n return [realpathSync(root)];\n } catch {\n return [];\n }\n });\n if (!within(realRoots, realpathSync(path))) return {failure: 'outside'};\n return {path};\n};\n\nconst within = (roots: readonly string[], path: string): boolean =>\n roots.some((root) => path === root || path.startsWith(root + sep));\n"]}
@@ -22,10 +22,18 @@ export interface CreateLitDevframeOptions {
22
22
  /**
23
23
  * Absolute directory the injected `ElementSource.file` paths are relative
24
24
  * to (the Vite root). Read per call, since a host only knows it once its
25
- * dev server is up. Without it `open-source` can only open paths that are
26
- * already absolute.
25
+ * dev server is up. Also the first root `open-source` confines opens to;
26
+ * without it, relative paths resolve against the working directory.
27
27
  */
28
28
  sourceRoot?: () => string | undefined;
29
+ /**
30
+ * Further directories `open-source` may open files beneath, beyond
31
+ * `sourceRoot` (the Vite host passes `server.fs.allow`, where sibling
32
+ * packages of a monorepo live). Read per call. A path outside every root
33
+ * is refused; with neither this nor `sourceRoot`, the process's working
34
+ * directory is the only root.
35
+ */
36
+ allowedRoots?: () => readonly string[];
29
37
  /**
30
38
  * The editor key the developer named in config or env
31
39
  * (`sourceOverlay.editor`), or `undefined` when they never did. Read per
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/lib/devframe/definition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,KAAK,EAAC,kBAAkB,EAAsB,MAAM,UAAU,CAAC;AAWtE,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AA6CjC,OAAO,EAAmB,KAAK,cAAc,EAAC,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,wBAAwB;IACvC,kFAAkF;IAClF,MAAM,EAAE,cAAc,CAAC;IACvB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACtC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC5C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,wBAAwB,GAChC,kBAAkB,CA+jBpB"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/lib/devframe/definition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,KAAK,EAAC,kBAAkB,EAAsB,MAAM,UAAU,CAAC;AAWtE,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AA6CjC,OAAO,EAAmB,KAAK,cAAc,EAAC,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,wBAAwB;IACvC,kFAAkF;IAClF,MAAM,EAAE,cAAc,CAAC;IACvB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACtC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;IACvC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC5C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,wBAAwB,GAChC,kBAAkB,CAqlBpB"}
@@ -55,8 +55,15 @@ import {createNullSource} from './source.js';
55
55
  * server, a static build, or an MCP server.
56
56
  */
57
57
  export function createLitDevframe(options) {
58
- const {source, version, features, replay, sourceRoot, configuredEditor} =
59
- options;
58
+ const {
59
+ source,
60
+ version,
61
+ features,
62
+ replay,
63
+ sourceRoot,
64
+ allowedRoots,
65
+ configuredEditor,
66
+ } = options;
60
67
  return defineDevframe({
61
68
  id: LIT_DEVFRAME_ID,
62
69
  name: 'Lit',
@@ -534,12 +541,15 @@ export function createLitDevframe(options) {
534
541
  handler: async (args) => {
535
542
  const service = ctx.services.get('@devframes/service-open');
536
543
  if (service === undefined) return {opened: false};
537
- const {isAbsolute, resolve} = await import('node:path');
538
- const root = sourceRoot?.();
539
- const path =
540
- root !== undefined && !isAbsolute(args.file)
541
- ? resolve(root, args.file)
542
- : args.file;
544
+ // Confined like `/__lit-open-in-editor`: whatever can reach this
545
+ // RPC could otherwise have the editor open any file on disk.
546
+ const {confineToRoots} = await import('../confine.js');
547
+ const confined = confineToRoots(
548
+ [sourceRoot?.() ?? process.cwd(), ...(allowedRoots?.() ?? [])],
549
+ args.file
550
+ );
551
+ if ('failure' in confined) return {opened: false};
552
+ const {path} = confined;
543
553
  const override = await my.settings.global.get('override');
544
554
  await service.openInEditor({
545
555
  path,
@@ -563,6 +573,18 @@ export function createLitDevframe(options) {
563
573
  // loading in contexts with no filesystem, and the build adapter
564
574
  // it pulls in reaches straight for `node:fs`.
565
575
  const {buildSnapshot} = await import('../snapshot.js');
576
+ // `outDir` comes from the client and the build deletes it before
577
+ // writing, so it has to land strictly beneath the working
578
+ // directory -- never the directory itself, and never elsewhere
579
+ // on disk.
580
+ const {resolve, sep} = await import('node:path');
581
+ const cwd = process.cwd();
582
+ const outDir = resolve(cwd, args.outDir ?? 'lit-devtools-snapshot');
583
+ if (!outDir.startsWith(cwd + sep)) {
584
+ throw new Error(
585
+ `[lit-devtools] export-snapshot: outDir must be inside ${cwd}`
586
+ );
587
+ }
566
588
  return buildSnapshot(
567
589
  {
568
590
  capturedAt: new Date().toISOString(),
@@ -574,7 +596,7 @@ export function createLitDevframe(options) {
574
596
  hmrIncompatibilities: [...hmrIncompatibilities],
575
597
  },
576
598
  {
577
- outDir: args.outDir ?? 'lit-devtools-snapshot',
599
+ outDir,
578
600
  features: features ? features() : null,
579
601
  clientAssets: options.clientAssets,
580
602
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/lib/devframe/definition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAY3D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,yBAAyB,EAAC,MAAM,oCAAoC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 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The framework-neutral Lit devframe: RPC functions, shared state, and the\n * timeline stream. Talks to the page runtime only through the injected\n * {@link TimelineSource} port, so it runs unchanged under `createDevServer()`,\n * `createBuild()`, or an MCP server with no Vite in the loop. `vite.ts` wires\n * the real page-runtime bridge and mounts this via `createPluginFromDevframe`.\n *\n * @see plans/devframe-foundation.md\n */\n\nimport {defineDevframe, defineRpcFunction} from 'devframe';\n// Type-only: brings in the service's `declare module 'devframe'`\n// augmentation so `ctx.services.get()` types its API. Nothing is\n// imported at runtime, and the service is consumed, never installed\n// here -- a Vite hub already has it (see `panel/open-in-editor.ts`).\nimport type {} from '@devframes/service-open';\nimport type {DevframeDefinition, DevframeNodeContext} from 'devframe';\nimport type {\n InspectorCommand,\n InspectorDetails,\n InspectorTreeNode,\n} from '../../types/inspector.js';\nimport {TIMELINE_LAYERS} from '../../types/timeline.js';\nimport {MAX_HMR_INCOMPATIBILITIES} from '../../types/hmr-incompatibility.js';\nimport type {HmrIncompatibilityEvent} from '../../types/hmr-incompatibility.js';\nimport {LIT_LOGO_ICON} from './icon.js';\nimport {PANEL_DIST_DIR} from './paths.js';\nimport type {\n FeatureSettings,\n SettingsOverride,\n TimelineEvent,\n} from '../../types/timeline.js';\nimport {\n DEFAULT_SESSION_STATE,\n LAYER_FLAGS,\n LIT_DEVFRAME_ID,\n RECENT_EVENTS_BUFFER_SIZE,\n RPC_COMPONENT_DETAILS,\n RPC_GET_META,\n RPC_HMR_INCOMPATIBILITIES,\n RPC_HMR_INCOMPATIBLE,\n RPC_INSPECT,\n RPC_INSPECTOR_MESSAGE,\n RPC_LIST_COMPONENTS,\n RPC_RECENT_EVENTS,\n RPC_TIMELINE_HISTORY,\n RPC_SET_RECORDING,\n RPC_EXPORT_SNAPSHOT,\n RPC_OPEN_SOURCE,\n RPC_SET_SETTINGS_OVERRIDE,\n RPC_TOGGLE_LAYER,\n RPC_UPDATE_SUMMARY,\n SESSION_STATE_KEY,\n TIMELINE_STREAM_ID,\n TIMELINE_STREAM_NAME,\n type ComponentDetailsArgs,\n type LitGetMetaResult,\n type RecentEventsArgs,\n type RecentEventsResult,\n type SessionState,\n type ExportSnapshotArgs,\n type ExportSnapshotResult,\n type OpenSourceArgs,\n type OpenSourceResult,\n type SetRecordingArgs,\n type ToggleLayerArgs,\n type UpdateSummaryArgs,\n type UpdateSummaryResult,\n} from './protocol.js';\nimport {\n attributeInput,\n rollup,\n toSpans,\n toUpdateCycles,\n} from '../timeline/derive.js';\nimport {resolveLaunchEditor} from './launch-editor.js';\nimport {createNullSource, type TimelineSource} from './source.js';\nimport type {SessionSnapshot} from '../../types/snapshot.js';\n\nexport interface CreateLitDevframeOptions {\n /** Page-runtime bridge. Use {@link createNullSource} when no page is attached. */\n source: TimelineSource;\n /** Plugin version, surfaced by `get-meta` and the devframe's own `version`. */\n version: string;\n /** Resolved feature settings, surfaced by `get-meta`. */\n features?: () => FeatureSettings | null;\n /**\n * Directory holding the built panel SPA. Defaults to the package's own\n * `dist/client`; the dev-time panel build points it elsewhere.\n */\n clientAssets?: string;\n /**\n * Absolute directory the injected `ElementSource.file` paths are relative\n * to (the Vite root). Read per call, since a host only knows it once its\n * dev server is up. Without it `open-source` can only open paths that are\n * already absolute.\n */\n sourceRoot?: () => string | undefined;\n /**\n * The editor key the developer named in config or env\n * (`sourceOverlay.editor`), or `undefined` when they never did. Read per\n * call. `open-source` maps it, or the panel's override of it, to a\n * `launch-editor` command; without either the editor is auto-detected.\n */\n configuredEditor?: () => string | undefined;\n /**\n * Boot from a recorded session instead of a live one. Set only by the\n * static-snapshot build (see `lib/snapshot.ts`): the caches below start\n * populated, so the frozen panel has a timeline and a component tree to\n * render with no page and no dev server behind it.\n */\n replay?: SessionSnapshot;\n}\n\n/**\n * Builds the Lit devframe definition. Framework-neutral: everything here\n * runs the same whether the host is Vite (`vite.ts`), a standalone dev\n * server, a static build, or an MCP server.\n */\nexport function createLitDevframe(\n options: CreateLitDevframeOptions\n): DevframeDefinition {\n const {source, version, features, replay, sourceRoot, configuredEditor} =\n options;\n\n return defineDevframe({\n id: LIT_DEVFRAME_ID,\n name: 'Lit',\n description: 'Timeline recorder and component inspector for Lit apps.',\n version,\n packageName: '@oddsquad/vite-plugin-lit',\n homepage: 'https://oddcelot.github.io/vite-plugin-lit/',\n importMetaUrl: import.meta.url,\n icon: LIT_LOGO_ICON,\n dock: {category: 'framework'},\n clientAssets: options.clientAssets ?? PANEL_DIST_DIR,\n\n // `component-details` takes an id, so `snapshot: true` (which bakes the\n // no-argument call) cannot express it. Bake one record per component the\n // session actually opened -- the only ids that have details to freeze.\n rpc: replay\n ? {\n snapshot: [\n {\n method: `${LIT_DEVFRAME_ID}:${RPC_COMPONENT_DETAILS}`,\n inputs: replay.details.map((d) => [{id: d.id}]),\n },\n ],\n }\n : undefined,\n\n async setup(ctx: DevframeNodeContext) {\n const my = ctx.scope(LIT_DEVFRAME_ID);\n\n // Bind the per-user settings store before any panel can connect.\n // Both sides build it lazily on first access, but only this one backs\n // it with a JSON file -- a client that asks first gets a plain\n // in-memory shared state instead, so the panel's preferences would\n // round-trip happily and then vanish on restart. The panel is the only\n // thing that reads or writes these (see `panel/devtools-settings.ts`);\n // this call exists purely to make them durable.\n await my.settings.global.all();\n\n const session = await my.rpc.sharedState<SessionState>(\n SESSION_STATE_KEY,\n {\n initialValue: replay\n ? {\n ...DEFAULT_SESSION_STATE,\n // Recorded events carry layer ids; without the custom layers\n // that produced them the frozen panel would show a filter it\n // cannot name.\n customLayers: replay.customLayers,\n }\n : DEFAULT_SESSION_STATE,\n }\n );\n\n // Latest inspector snapshot, cached so a panel that (re)connects after\n // the runtime already answered can read it without round-tripping to\n // the page again. Pre-filled when replaying: there is no page to ask.\n let cachedRoots: InspectorTreeNode[] = replay ? [...replay.roots] : [];\n const cachedDetails = new Map<number, InspectorDetails>(\n replay?.details.map((d) => [d.id, d])\n );\n\n // Bounded history for the `recent-events` agent query and the panel's\n // `timeline-history` seed. A plain array, not devframe's internal\n // per-stream replay buffer, which devframe marks `@internal` (see\n // plans/roadmap/02-agent-timeline-access.md).\n const recentEvents: TimelineEvent[] = replay ? [...replay.events] : [];\n\n // Event ids: `${epoch}-${seq}`. The epoch is the session start, so a\n // restarted dev server can never reissue an id an older snapshot holds;\n // the seq is monotonic across Clear. Stamped here, once, because this is\n // the only place every consumer (stream, `recent-events`, export) shares.\n // A replayed session never reaches `pushEvents`, so its ids are kept.\n const eventEpoch = Date.now().toString(36);\n let eventSeq = 0;\n\n // Recent HMR-incompatibility notices, capped the same way\n // `runtime/timeline/transport.ts` caps its pending queue — a long\n // session with many failing edits must not grow this forever.\n const hmrIncompatibilities: HmrIncompatibilityEvent[] = replay\n ? [...replay.hmrIncompatibilities]\n : [];\n\n // Terminal echo for an audience that only sees dev-server stdout (an\n // agent, or a CI log) and not the browser console or the panel.\n // Fire-and-log only — the cache above is the read-back store.\n const hmrDiagnostics = ctx.diagnostics.defineDiagnostics({\n docsBase:\n 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/',\n codes: {\n LIT_HMR_ACCESSOR: {\n why: (p: {tagName: string}) =>\n `<${p.tagName}> can't be hot-patched: standard accessor decorators`,\n docs: 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/#cannot-be-patched-in-place',\n },\n LIT_HMR_PATCH_FAILED: {\n why: (p: {tagName: string; detail: string}) =>\n `<${p.tagName}> can't be hot-patched: ${p.detail}`,\n docs: 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/#cannot-be-patched-in-place',\n },\n LIT_HMR_ATTRS_CHANGED: {\n why: (p: {tagName: string}) =>\n `<${p.tagName}> changed observedAttributes; reload recommended`,\n docs: 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/#cannot-be-patched-in-place',\n },\n },\n });\n ctx.diagnostics.register(hmrDiagnostics);\n\n // Streaming/source wiring only makes sense for a live session: a\n // static build or MCP run has no page attached (its `source` is a\n // `createNullSource()`), and `ctx.mode` is 'build' there.\n if (ctx.mode === 'dev') {\n // No `replayWindow`: a subscriber would be replayed the whole buffer\n // in separate chunks, including batches from before the last\n // recording started (a different clock) and ones the panel's Clear\n // dropped, and the node has no way to forget them. A connecting panel\n // is seeded from `timeline-history` instead, which is `recentEvents`,\n // cleared on the same edges.\n const channel =\n my.rpc.streaming.create<TimelineEvent[]>(TIMELINE_STREAM_NAME);\n // Started eagerly, not on the first event: `streaming:subscribe` is\n // fire-and-forget on the wire, and a subscribe naming a stream id\n // that does not exist yet is dropped with a DF0030 diagnostic rather\n // than queued. The panel subscribes as soon as it connects, which is\n // normally long before the first event, so the stream has to be\n // there waiting. `??` covers a re-start if the transport aborted it\n // after the last subscriber left.\n channel.start({id: TIMELINE_STREAM_ID});\n const ensureStream = () =>\n channel.get(TIMELINE_STREAM_ID) ??\n channel.start({id: TIMELINE_STREAM_ID});\n\n source.attach({\n pushEvents(incoming) {\n if (incoming.length === 0) return;\n const events = incoming.map((event) => ({\n ...event,\n id: event.id ?? `${eventEpoch}-${eventSeq++}`,\n }));\n ensureStream().write(events);\n recentEvents.push(...events);\n if (recentEvents.length > RECENT_EVENTS_BUFFER_SIZE) {\n recentEvents.splice(\n 0,\n recentEvents.length - RECENT_EVENTS_BUFFER_SIZE\n );\n }\n },\n addLayer(layer) {\n session.mutate((state) => {\n if (\n !state.customLayers.some((existing) => existing.id === layer.id)\n ) {\n state.customLayers.push(layer);\n }\n });\n },\n inspectorMessage(message) {\n if (message.type === 'tree') {\n cachedRoots = message.roots;\n } else if (message.type === 'details') {\n cachedDetails.set(message.details.id, message.details);\n } else if (message.type === 'gone') {\n cachedDetails.delete(message.id);\n }\n void ctx.rpc.broadcast({\n method: `${LIT_DEVFRAME_ID}:${RPC_INSPECTOR_MESSAGE}`,\n args: [message],\n // A page can be open with no panel docked; the runtime keeps\n // answering either way, so a broadcast with no listener is\n // normal rather than a missing-function error.\n optional: true,\n });\n },\n runtimeReady() {\n // A new page means a new timeline clock: the runtime re-zeroes on\n // the rising edge below, so events kept from the previous document\n // would sit in the same buffer on a different time origin and make\n // `recent-events`' `sinceMs` window meaningless. They also describe\n // a page that no longer exists.\n recentEvents.length = 0;\n\n // Replay current state to a runtime that just booted from its\n // defaults. Unconditional: `setRecording(false)` on a fresh page\n // is a no-op.\n const {layers} = session.value();\n source.setLayers(layers);\n source.setRecording(layers.recordingState);\n },\n hmrIncompatible(event) {\n hmrIncompatibilities.push(event);\n if (hmrIncompatibilities.length > MAX_HMR_INCOMPATIBILITIES) {\n hmrIncompatibilities.splice(\n 0,\n hmrIncompatibilities.length - MAX_HMR_INCOMPATIBILITIES\n );\n }\n void ctx.rpc.broadcast({\n method: `${LIT_DEVFRAME_ID}:${RPC_HMR_INCOMPATIBLE}`,\n args: [event],\n optional: true,\n });\n\n // Informational terminal echo, never a thrown error.\n if (event.reason.code === 'accessor-decorators') {\n hmrDiagnostics.LIT_HMR_ACCESSOR({tagName: event.tagName});\n } else if (event.reason.code === 'patch-failed') {\n hmrDiagnostics.LIT_HMR_PATCH_FAILED({\n tagName: event.tagName,\n detail: event.reason.detail,\n });\n } else {\n hmrDiagnostics.LIT_HMR_ATTRS_CHANGED({tagName: event.tagName});\n }\n },\n });\n\n // Single push point for recording/layer changes: fires for the\n // `set-recording` / `toggle-layer` actions below and for a panel\n // mutating shared state directly through devframe's generic\n // shared-state RPC. Immer only emits when the state reference\n // changes, so a no-op mutate sends nothing.\n //\n // Clearing on the rising edge belongs here rather than in\n // `set-recording` for the same reason: the runtime re-zeroes its\n // timeline clock when recording turns on (`runtime/timeline/clock.ts`),\n // so events kept from the previous recording sit in the buffer on a\n // larger time origin than everything captured after them. A `sinceMs`\n // window reads them as the future, and pairing a start with its end\n // across the seam yields a negative duration. Same rationale as\n // `runtimeReady()` above, one level finer: a new clock, not a new page.\n let wasRecording = session.value().layers.recordingState;\n session.on('updated', (state) => {\n const {recordingState} = state.layers;\n if (recordingState && !wasRecording) {\n recentEvents.length = 0;\n }\n wasRecording = recordingState;\n source.setRecording(recordingState);\n source.setLayers(state.layers);\n });\n }\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_GET_META,\n type: 'query',\n jsonSerializable: true,\n snapshot: true,\n agent: {\n description:\n 'Get the plugin version, active timeline layers, and resolved feature settings. Call once at the start of a session to learn what timeline layers exist before asking about events.',\n },\n handler: async (): Promise<LitGetMetaResult> => ({\n version,\n // `.value()` returns a deep-readonly snapshot; copy so callers\n // get a plain, mutable `TimelineLayer[]`.\n layers: [...TIMELINE_LAYERS, ...session.value().customLayers],\n features: features ? features() : null,\n stream: {\n channel: `${LIT_DEVFRAME_ID}:${TIMELINE_STREAM_NAME}`,\n id: TIMELINE_STREAM_ID,\n },\n }),\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_LIST_COMPONENTS,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and\n // by export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n 'List the live Lit component tree of the inspected page. Call this before asking about a specific element to find its id.',\n },\n handler: async (): Promise<InspectorTreeNode[]> => cachedRoots,\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_HMR_INCOMPATIBILITIES,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and\n // by export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n \"List recent components the Lit plugin could not hot-patch in place, and why. Call this after an unexplained full-page reload during development, or when a component's state resets unexpectedly on edit.\",\n },\n handler: async (): Promise<HmrIncompatibilityEvent[]> =>\n hmrIncompatibilities,\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_COMPONENT_DETAILS,\n type: 'query',\n jsonSerializable: true,\n agent: {\n description:\n 'Get reactive properties, attributes, and internal state for one component by id. Call list-components first to find the id.',\n },\n handler: async (\n args: ComponentDetailsArgs\n ): Promise<InspectorDetails | null> =>\n cachedDetails.get(args.id) ?? null,\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_RECENT_EVENTS,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and\n // by export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n 'Get recent timeline events (lifecycle, render, mouse, keyboard) to diagnose why a component re-rendered or updated. Call list-components first to find an element’s id, then filter by elementId to see just its events. Check the `recording` field in the response — if false, no events are being captured; ask the developer to enable Recording in the Timeline tab before retrying.',\n },\n // `args` is genuinely absent when an agent calls the tool with no\n // filters — the most common call — so it must default, not just be\n // typed optional.\n handler: async (\n args: RecentEventsArgs = {}\n ): Promise<RecentEventsResult> => {\n const recording = session.value().layers.recordingState;\n let filtered = recentEvents;\n if (args.layerId !== undefined) {\n filtered = filtered.filter((e) => e.layerId === args.layerId);\n }\n if (args.elementId !== undefined) {\n filtered = filtered.filter(\n (e) => e.meta?.elementId === args.elementId\n );\n }\n // Measured against the newest event in the whole buffer, not the\n // newest *matching* one: an element that last rendered 10s ago\n // must come back empty for `sinceMs: 1000`, not report its own\n // stale events as if they were recent.\n if (args.sinceMs !== undefined && recentEvents.length > 0) {\n const newest = recentEvents[recentEvents.length - 1]!.time;\n const cutoff = newest - args.sinceMs;\n filtered = filtered.filter((e) => e.time >= cutoff);\n }\n // A frozen session's panel reads the baked no-argument call, so\n // the agent-friendly 50/200 window would silently cut an export to\n // its last 25 spans -- and a link to anything older would miss.\n const limit = replay\n ? Math.min(\n args.limit ?? RECENT_EVENTS_BUFFER_SIZE,\n RECENT_EVENTS_BUFFER_SIZE\n )\n : Math.min(args.limit ?? 50, 200);\n const events = filtered.slice(-limit);\n return {\n recording,\n events,\n bufferSize: recentEvents.length,\n truncated: events.length < filtered.length,\n };\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_TIMELINE_HISTORY,\n type: 'query',\n jsonSerializable: true,\n // Not agent-exposed (agents have `recent-events`) and not baked\n // into a snapshot (a frozen panel reads `recent-events`, which\n // answers a replayed session with its whole buffer). This is the\n // live panel's seed: the stream carries nothing from before a\n // panel subscribed, so a reloaded panel asks for it here.\n handler: async (): Promise<TimelineEvent[]> => [...recentEvents],\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_UPDATE_SUMMARY,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and by\n // export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n 'Explain component updates: which components re-rendered, how often, how long they took, and which reactive properties changed to cause each update. Prefer this over lit:recent-events for \"why did this re-render\" and \"what is re-rendering too much\" — it answers from the same recording without the caller having to pair start/end events itself. Filter to one component with tagName. Check the `recording` field — if false, no events are being captured; call lit:set-recording first.',\n },\n // `args` is genuinely absent when an agent calls the tool with no\n // filters — the most common call — so it must default.\n handler: async (\n args: UpdateSummaryArgs = {}\n ): Promise<UpdateSummaryResult> => {\n const recording = session.value().layers.recordingState;\n let events: readonly TimelineEvent[] = recentEvents;\n // Same window semantics as `recent-events`: measured against the\n // newest event in the whole buffer, not the newest match.\n if (args.sinceMs !== undefined && recentEvents.length > 0) {\n const cutoff =\n recentEvents[recentEvents.length - 1]!.time - args.sinceMs;\n events = recentEvents.filter((e) => e.time >= cutoff);\n }\n let cycles = attributeInput(\n toUpdateCycles(toSpans(events)),\n events\n );\n if (args.tagName !== undefined) {\n cycles = cycles.filter((c) => c.tagName === args.tagName);\n }\n // Totals cover the whole window; only the per-cycle list is\n // capped, so a limit never silently understates a hot component.\n const components = rollup(cycles);\n const limit = Math.min(args.limit ?? 50, 200);\n const limited = cycles.slice(-limit);\n return {\n recording,\n components,\n cycles: limited,\n bufferSize: recentEvents.length,\n truncated: limited.length < cycles.length,\n };\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_INSPECT,\n type: 'action',\n jsonSerializable: true,\n handler: async (command: InspectorCommand): Promise<void> => {\n // \"Pick\" starts the overlay's inspect picker, which the host\n // toggles in the page rather than answering from the runtime.\n if (command.type === 'pick') {\n source.toggleOverlay();\n return;\n }\n source.sendInspector(command);\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_SET_RECORDING,\n type: 'action',\n jsonSerializable: true,\n // The one agent-exposed mutation. `recent-events` is a dead end\n // when recording is off, so an agent that can read the timeline\n // but never start it just hands the question back to the human.\n // Deliberately still the *only* one: the picker and layer toggles\n // stay panel-only.\n agent: {\n description:\n 'Start or stop timeline recording. This is a shared toggle: turning it on also affects the DevTools panel if a developer has it open. Call this if lit:recent-events reports `recording: false`.',\n },\n handler: async (args: SetRecordingArgs): Promise<void> => {\n session.mutate((state) => {\n state.layers.recordingState = args.recording;\n });\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_TOGGLE_LAYER,\n type: 'action',\n jsonSerializable: true,\n handler: async (args: ToggleLayerArgs): Promise<void> => {\n const flag = LAYER_FLAGS[args.layerId];\n // Custom layers have no capture flag to toggle — app code owns\n // whether it emits at all.\n if (!flag) return;\n session.mutate((state) => {\n state.layers[flag] = args.enabled;\n });\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_SET_SETTINGS_OVERRIDE,\n type: 'action',\n jsonSerializable: true,\n handler: async (override: SettingsOverride): Promise<void> => {\n source.setSettingsOverride(override);\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_OPEN_SOURCE,\n type: 'action',\n jsonSerializable: true,\n // Resolving here rather than in the panel is the whole point of\n // the hop: `file` is relative to the Vite root, while the open\n // service resolves relative paths against the host's\n // `workspaceRoot` -- in a monorepo (or any setup where the served\n // app isn't the workspace) those are different directories, and\n // `launchEditor` silently does nothing for a path that doesn't\n // exist. Not agent-exposed: it spawns a GUI process.\n handler: async (args: OpenSourceArgs): Promise<OpenSourceResult> => {\n const service = ctx.services.get('@devframes/service-open');\n if (service === undefined) return {opened: false};\n const {isAbsolute, resolve} = await import('node:path');\n const root = sourceRoot?.();\n const path =\n root !== undefined && !isAbsolute(args.file)\n ? resolve(root, args.file)\n : args.file;\n const override = await my.settings.global.get('override');\n await service.openInEditor({\n path,\n line: args.line,\n editor: resolveLaunchEditor(configuredEditor?.(), override),\n });\n return {opened: true};\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_EXPORT_SNAPSHOT,\n type: 'action',\n jsonSerializable: true,\n // Not agent-exposed. It writes a directory to the developer's disk,\n // which is not something a coding agent should be able to do behind\n // their back -- same reasoning as the other mutating actions.\n handler: async (\n args: ExportSnapshotArgs\n ): Promise<ExportSnapshotResult> => {\n // Imported here, not at module scope: this file has to keep\n // loading in contexts with no filesystem, and the build adapter\n // it pulls in reaches straight for `node:fs`.\n const {buildSnapshot} = await import('../snapshot.js');\n return buildSnapshot(\n {\n capturedAt: new Date().toISOString(),\n version,\n customLayers: [...session.value().customLayers],\n roots: cachedRoots,\n details: [...cachedDetails.values()],\n events: [...recentEvents],\n hmrIncompatibilities: [...hmrIncompatibilities],\n },\n {\n outDir: args.outDir ?? 'lit-devtools-snapshot',\n features: features ? features() : null,\n clientAssets: options.clientAssets,\n }\n );\n },\n })\n );\n },\n });\n}\n\nexport default createLitDevframe({\n source: createNullSource(),\n version: '0.0.0',\n});\n"]}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/lib/devframe/definition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAY3D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,yBAAyB,EAAC,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AACxC,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAM1C,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACn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AAO,CAAC,YAAY;qBACnC,CACF,CAAC;gBACJ,CAAC;aACF,CAAC,CACH,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,eAAe,iBAAiB,CAAC;IAC/B,MAAM,EAAE,gBAAgB,EAAE;IAC1B,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The framework-neutral Lit devframe: RPC functions, shared state, and the\n * timeline stream. Talks to the page runtime only through the injected\n * {@link TimelineSource} port, so it runs unchanged under `createDevServer()`,\n * `createBuild()`, or an MCP server with no Vite in the loop. `vite.ts` wires\n * the real page-runtime bridge and mounts this via `createPluginFromDevframe`.\n *\n * @see plans/devframe-foundation.md\n */\n\nimport {defineDevframe, defineRpcFunction} from 'devframe';\n// Type-only: brings in the service's `declare module 'devframe'`\n// augmentation so `ctx.services.get()` types its API. Nothing is\n// imported at runtime, and the service is consumed, never installed\n// here -- a Vite hub already has it (see `panel/open-in-editor.ts`).\nimport type {} from '@devframes/service-open';\nimport type {DevframeDefinition, DevframeNodeContext} from 'devframe';\nimport type {\n InspectorCommand,\n InspectorDetails,\n InspectorTreeNode,\n} from '../../types/inspector.js';\nimport {TIMELINE_LAYERS} from '../../types/timeline.js';\nimport {MAX_HMR_INCOMPATIBILITIES} from '../../types/hmr-incompatibility.js';\nimport type {HmrIncompatibilityEvent} from '../../types/hmr-incompatibility.js';\nimport {LIT_LOGO_ICON} from './icon.js';\nimport {PANEL_DIST_DIR} from './paths.js';\nimport type {\n FeatureSettings,\n SettingsOverride,\n TimelineEvent,\n} from '../../types/timeline.js';\nimport {\n DEFAULT_SESSION_STATE,\n LAYER_FLAGS,\n LIT_DEVFRAME_ID,\n RECENT_EVENTS_BUFFER_SIZE,\n RPC_COMPONENT_DETAILS,\n RPC_GET_META,\n RPC_HMR_INCOMPATIBILITIES,\n RPC_HMR_INCOMPATIBLE,\n RPC_INSPECT,\n RPC_INSPECTOR_MESSAGE,\n RPC_LIST_COMPONENTS,\n RPC_RECENT_EVENTS,\n RPC_TIMELINE_HISTORY,\n RPC_SET_RECORDING,\n RPC_EXPORT_SNAPSHOT,\n RPC_OPEN_SOURCE,\n RPC_SET_SETTINGS_OVERRIDE,\n RPC_TOGGLE_LAYER,\n RPC_UPDATE_SUMMARY,\n SESSION_STATE_KEY,\n TIMELINE_STREAM_ID,\n TIMELINE_STREAM_NAME,\n type ComponentDetailsArgs,\n type LitGetMetaResult,\n type RecentEventsArgs,\n type RecentEventsResult,\n type SessionState,\n type ExportSnapshotArgs,\n type ExportSnapshotResult,\n type OpenSourceArgs,\n type OpenSourceResult,\n type SetRecordingArgs,\n type ToggleLayerArgs,\n type UpdateSummaryArgs,\n type UpdateSummaryResult,\n} from './protocol.js';\nimport {\n attributeInput,\n rollup,\n toSpans,\n toUpdateCycles,\n} from '../timeline/derive.js';\nimport {resolveLaunchEditor} from './launch-editor.js';\nimport {createNullSource, type TimelineSource} from './source.js';\nimport type {SessionSnapshot} from '../../types/snapshot.js';\n\nexport interface CreateLitDevframeOptions {\n /** Page-runtime bridge. Use {@link createNullSource} when no page is attached. */\n source: TimelineSource;\n /** Plugin version, surfaced by `get-meta` and the devframe's own `version`. */\n version: string;\n /** Resolved feature settings, surfaced by `get-meta`. */\n features?: () => FeatureSettings | null;\n /**\n * Directory holding the built panel SPA. Defaults to the package's own\n * `dist/client`; the dev-time panel build points it elsewhere.\n */\n clientAssets?: string;\n /**\n * Absolute directory the injected `ElementSource.file` paths are relative\n * to (the Vite root). Read per call, since a host only knows it once its\n * dev server is up. Also the first root `open-source` confines opens to;\n * without it, relative paths resolve against the working directory.\n */\n sourceRoot?: () => string | undefined;\n /**\n * Further directories `open-source` may open files beneath, beyond\n * `sourceRoot` (the Vite host passes `server.fs.allow`, where sibling\n * packages of a monorepo live). Read per call. A path outside every root\n * is refused; with neither this nor `sourceRoot`, the process's working\n * directory is the only root.\n */\n allowedRoots?: () => readonly string[];\n /**\n * The editor key the developer named in config or env\n * (`sourceOverlay.editor`), or `undefined` when they never did. Read per\n * call. `open-source` maps it, or the panel's override of it, to a\n * `launch-editor` command; without either the editor is auto-detected.\n */\n configuredEditor?: () => string | undefined;\n /**\n * Boot from a recorded session instead of a live one. Set only by the\n * static-snapshot build (see `lib/snapshot.ts`): the caches below start\n * populated, so the frozen panel has a timeline and a component tree to\n * render with no page and no dev server behind it.\n */\n replay?: SessionSnapshot;\n}\n\n/**\n * Builds the Lit devframe definition. Framework-neutral: everything here\n * runs the same whether the host is Vite (`vite.ts`), a standalone dev\n * server, a static build, or an MCP server.\n */\nexport function createLitDevframe(\n options: CreateLitDevframeOptions\n): DevframeDefinition {\n const {\n source,\n version,\n features,\n replay,\n sourceRoot,\n allowedRoots,\n configuredEditor,\n } = options;\n\n return defineDevframe({\n id: LIT_DEVFRAME_ID,\n name: 'Lit',\n description: 'Timeline recorder and component inspector for Lit apps.',\n version,\n packageName: '@oddsquad/vite-plugin-lit',\n homepage: 'https://oddcelot.github.io/vite-plugin-lit/',\n importMetaUrl: import.meta.url,\n icon: LIT_LOGO_ICON,\n dock: {category: 'framework'},\n clientAssets: options.clientAssets ?? PANEL_DIST_DIR,\n\n // `component-details` takes an id, so `snapshot: true` (which bakes the\n // no-argument call) cannot express it. Bake one record per component the\n // session actually opened -- the only ids that have details to freeze.\n rpc: replay\n ? {\n snapshot: [\n {\n method: `${LIT_DEVFRAME_ID}:${RPC_COMPONENT_DETAILS}`,\n inputs: replay.details.map((d) => [{id: d.id}]),\n },\n ],\n }\n : undefined,\n\n async setup(ctx: DevframeNodeContext) {\n const my = ctx.scope(LIT_DEVFRAME_ID);\n\n // Bind the per-user settings store before any panel can connect.\n // Both sides build it lazily on first access, but only this one backs\n // it with a JSON file -- a client that asks first gets a plain\n // in-memory shared state instead, so the panel's preferences would\n // round-trip happily and then vanish on restart. The panel is the only\n // thing that reads or writes these (see `panel/devtools-settings.ts`);\n // this call exists purely to make them durable.\n await my.settings.global.all();\n\n const session = await my.rpc.sharedState<SessionState>(\n SESSION_STATE_KEY,\n {\n initialValue: replay\n ? {\n ...DEFAULT_SESSION_STATE,\n // Recorded events carry layer ids; without the custom layers\n // that produced them the frozen panel would show a filter it\n // cannot name.\n customLayers: replay.customLayers,\n }\n : DEFAULT_SESSION_STATE,\n }\n );\n\n // Latest inspector snapshot, cached so a panel that (re)connects after\n // the runtime already answered can read it without round-tripping to\n // the page again. Pre-filled when replaying: there is no page to ask.\n let cachedRoots: InspectorTreeNode[] = replay ? [...replay.roots] : [];\n const cachedDetails = new Map<number, InspectorDetails>(\n replay?.details.map((d) => [d.id, d])\n );\n\n // Bounded history for the `recent-events` agent query and the panel's\n // `timeline-history` seed. A plain array, not devframe's internal\n // per-stream replay buffer, which devframe marks `@internal` (see\n // plans/roadmap/02-agent-timeline-access.md).\n const recentEvents: TimelineEvent[] = replay ? [...replay.events] : [];\n\n // Event ids: `${epoch}-${seq}`. The epoch is the session start, so a\n // restarted dev server can never reissue an id an older snapshot holds;\n // the seq is monotonic across Clear. Stamped here, once, because this is\n // the only place every consumer (stream, `recent-events`, export) shares.\n // A replayed session never reaches `pushEvents`, so its ids are kept.\n const eventEpoch = Date.now().toString(36);\n let eventSeq = 0;\n\n // Recent HMR-incompatibility notices, capped the same way\n // `runtime/timeline/transport.ts` caps its pending queue — a long\n // session with many failing edits must not grow this forever.\n const hmrIncompatibilities: HmrIncompatibilityEvent[] = replay\n ? [...replay.hmrIncompatibilities]\n : [];\n\n // Terminal echo for an audience that only sees dev-server stdout (an\n // agent, or a CI log) and not the browser console or the panel.\n // Fire-and-log only — the cache above is the read-back store.\n const hmrDiagnostics = ctx.diagnostics.defineDiagnostics({\n docsBase:\n 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/',\n codes: {\n LIT_HMR_ACCESSOR: {\n why: (p: {tagName: string}) =>\n `<${p.tagName}> can't be hot-patched: standard accessor decorators`,\n docs: 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/#cannot-be-patched-in-place',\n },\n LIT_HMR_PATCH_FAILED: {\n why: (p: {tagName: string; detail: string}) =>\n `<${p.tagName}> can't be hot-patched: ${p.detail}`,\n docs: 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/#cannot-be-patched-in-place',\n },\n LIT_HMR_ATTRS_CHANGED: {\n why: (p: {tagName: string}) =>\n `<${p.tagName}> changed observedAttributes; reload recommended`,\n docs: 'https://oddcelot.github.io/vite-plugin-lit/reference/limitations/#cannot-be-patched-in-place',\n },\n },\n });\n ctx.diagnostics.register(hmrDiagnostics);\n\n // Streaming/source wiring only makes sense for a live session: a\n // static build or MCP run has no page attached (its `source` is a\n // `createNullSource()`), and `ctx.mode` is 'build' there.\n if (ctx.mode === 'dev') {\n // No `replayWindow`: a subscriber would be replayed the whole buffer\n // in separate chunks, including batches from before the last\n // recording started (a different clock) and ones the panel's Clear\n // dropped, and the node has no way to forget them. A connecting panel\n // is seeded from `timeline-history` instead, which is `recentEvents`,\n // cleared on the same edges.\n const channel =\n my.rpc.streaming.create<TimelineEvent[]>(TIMELINE_STREAM_NAME);\n // Started eagerly, not on the first event: `streaming:subscribe` is\n // fire-and-forget on the wire, and a subscribe naming a stream id\n // that does not exist yet is dropped with a DF0030 diagnostic rather\n // than queued. The panel subscribes as soon as it connects, which is\n // normally long before the first event, so the stream has to be\n // there waiting. `??` covers a re-start if the transport aborted it\n // after the last subscriber left.\n channel.start({id: TIMELINE_STREAM_ID});\n const ensureStream = () =>\n channel.get(TIMELINE_STREAM_ID) ??\n channel.start({id: TIMELINE_STREAM_ID});\n\n source.attach({\n pushEvents(incoming) {\n if (incoming.length === 0) return;\n const events = incoming.map((event) => ({\n ...event,\n id: event.id ?? `${eventEpoch}-${eventSeq++}`,\n }));\n ensureStream().write(events);\n recentEvents.push(...events);\n if (recentEvents.length > RECENT_EVENTS_BUFFER_SIZE) {\n recentEvents.splice(\n 0,\n recentEvents.length - RECENT_EVENTS_BUFFER_SIZE\n );\n }\n },\n addLayer(layer) {\n session.mutate((state) => {\n if (\n !state.customLayers.some((existing) => existing.id === layer.id)\n ) {\n state.customLayers.push(layer);\n }\n });\n },\n inspectorMessage(message) {\n if (message.type === 'tree') {\n cachedRoots = message.roots;\n } else if (message.type === 'details') {\n cachedDetails.set(message.details.id, message.details);\n } else if (message.type === 'gone') {\n cachedDetails.delete(message.id);\n }\n void ctx.rpc.broadcast({\n method: `${LIT_DEVFRAME_ID}:${RPC_INSPECTOR_MESSAGE}`,\n args: [message],\n // A page can be open with no panel docked; the runtime keeps\n // answering either way, so a broadcast with no listener is\n // normal rather than a missing-function error.\n optional: true,\n });\n },\n runtimeReady() {\n // A new page means a new timeline clock: the runtime re-zeroes on\n // the rising edge below, so events kept from the previous document\n // would sit in the same buffer on a different time origin and make\n // `recent-events`' `sinceMs` window meaningless. They also describe\n // a page that no longer exists.\n recentEvents.length = 0;\n\n // Replay current state to a runtime that just booted from its\n // defaults. Unconditional: `setRecording(false)` on a fresh page\n // is a no-op.\n const {layers} = session.value();\n source.setLayers(layers);\n source.setRecording(layers.recordingState);\n },\n hmrIncompatible(event) {\n hmrIncompatibilities.push(event);\n if (hmrIncompatibilities.length > MAX_HMR_INCOMPATIBILITIES) {\n hmrIncompatibilities.splice(\n 0,\n hmrIncompatibilities.length - MAX_HMR_INCOMPATIBILITIES\n );\n }\n void ctx.rpc.broadcast({\n method: `${LIT_DEVFRAME_ID}:${RPC_HMR_INCOMPATIBLE}`,\n args: [event],\n optional: true,\n });\n\n // Informational terminal echo, never a thrown error.\n if (event.reason.code === 'accessor-decorators') {\n hmrDiagnostics.LIT_HMR_ACCESSOR({tagName: event.tagName});\n } else if (event.reason.code === 'patch-failed') {\n hmrDiagnostics.LIT_HMR_PATCH_FAILED({\n tagName: event.tagName,\n detail: event.reason.detail,\n });\n } else {\n hmrDiagnostics.LIT_HMR_ATTRS_CHANGED({tagName: event.tagName});\n }\n },\n });\n\n // Single push point for recording/layer changes: fires for the\n // `set-recording` / `toggle-layer` actions below and for a panel\n // mutating shared state directly through devframe's generic\n // shared-state RPC. Immer only emits when the state reference\n // changes, so a no-op mutate sends nothing.\n //\n // Clearing on the rising edge belongs here rather than in\n // `set-recording` for the same reason: the runtime re-zeroes its\n // timeline clock when recording turns on (`runtime/timeline/clock.ts`),\n // so events kept from the previous recording sit in the buffer on a\n // larger time origin than everything captured after them. A `sinceMs`\n // window reads them as the future, and pairing a start with its end\n // across the seam yields a negative duration. Same rationale as\n // `runtimeReady()` above, one level finer: a new clock, not a new page.\n let wasRecording = session.value().layers.recordingState;\n session.on('updated', (state) => {\n const {recordingState} = state.layers;\n if (recordingState && !wasRecording) {\n recentEvents.length = 0;\n }\n wasRecording = recordingState;\n source.setRecording(recordingState);\n source.setLayers(state.layers);\n });\n }\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_GET_META,\n type: 'query',\n jsonSerializable: true,\n snapshot: true,\n agent: {\n description:\n 'Get the plugin version, active timeline layers, and resolved feature settings. Call once at the start of a session to learn what timeline layers exist before asking about events.',\n },\n handler: async (): Promise<LitGetMetaResult> => ({\n version,\n // `.value()` returns a deep-readonly snapshot; copy so callers\n // get a plain, mutable `TimelineLayer[]`.\n layers: [...TIMELINE_LAYERS, ...session.value().customLayers],\n features: features ? features() : null,\n stream: {\n channel: `${LIT_DEVFRAME_ID}:${TIMELINE_STREAM_NAME}`,\n id: TIMELINE_STREAM_ID,\n },\n }),\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_LIST_COMPONENTS,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and\n // by export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n 'List the live Lit component tree of the inspected page. Call this before asking about a specific element to find its id.',\n },\n handler: async (): Promise<InspectorTreeNode[]> => cachedRoots,\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_HMR_INCOMPATIBILITIES,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and\n // by export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n \"List recent components the Lit plugin could not hot-patch in place, and why. Call this after an unexplained full-page reload during development, or when a component's state resets unexpectedly on edit.\",\n },\n handler: async (): Promise<HmrIncompatibilityEvent[]> =>\n hmrIncompatibilities,\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_COMPONENT_DETAILS,\n type: 'query',\n jsonSerializable: true,\n agent: {\n description:\n 'Get reactive properties, attributes, and internal state for one component by id. Call list-components first to find the id.',\n },\n handler: async (\n args: ComponentDetailsArgs\n ): Promise<InspectorDetails | null> =>\n cachedDetails.get(args.id) ?? null,\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_RECENT_EVENTS,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and\n // by export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n 'Get recent timeline events (lifecycle, render, mouse, keyboard) to diagnose why a component re-rendered or updated. Call list-components first to find an element’s id, then filter by elementId to see just its events. Check the `recording` field in the response — if false, no events are being captured; ask the developer to enable Recording in the Timeline tab before retrying.',\n },\n // `args` is genuinely absent when an agent calls the tool with no\n // filters — the most common call — so it must default, not just be\n // typed optional.\n handler: async (\n args: RecentEventsArgs = {}\n ): Promise<RecentEventsResult> => {\n const recording = session.value().layers.recordingState;\n let filtered = recentEvents;\n if (args.layerId !== undefined) {\n filtered = filtered.filter((e) => e.layerId === args.layerId);\n }\n if (args.elementId !== undefined) {\n filtered = filtered.filter(\n (e) => e.meta?.elementId === args.elementId\n );\n }\n // Measured against the newest event in the whole buffer, not the\n // newest *matching* one: an element that last rendered 10s ago\n // must come back empty for `sinceMs: 1000`, not report its own\n // stale events as if they were recent.\n if (args.sinceMs !== undefined && recentEvents.length > 0) {\n const newest = recentEvents[recentEvents.length - 1]!.time;\n const cutoff = newest - args.sinceMs;\n filtered = filtered.filter((e) => e.time >= cutoff);\n }\n // A frozen session's panel reads the baked no-argument call, so\n // the agent-friendly 50/200 window would silently cut an export to\n // its last 25 spans -- and a link to anything older would miss.\n const limit = replay\n ? Math.min(\n args.limit ?? RECENT_EVENTS_BUFFER_SIZE,\n RECENT_EVENTS_BUFFER_SIZE\n )\n : Math.min(args.limit ?? 50, 200);\n const events = filtered.slice(-limit);\n return {\n recording,\n events,\n bufferSize: recentEvents.length,\n truncated: events.length < filtered.length,\n };\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_TIMELINE_HISTORY,\n type: 'query',\n jsonSerializable: true,\n // Not agent-exposed (agents have `recent-events`) and not baked\n // into a snapshot (a frozen panel reads `recent-events`, which\n // answers a replayed session with its whole buffer). This is the\n // live panel's seed: the stream carries nothing from before a\n // panel subscribed, so a reloaded panel asks for it here.\n handler: async (): Promise<TimelineEvent[]> => [...recentEvents],\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_UPDATE_SUMMARY,\n type: 'query',\n jsonSerializable: true,\n // Baked into a static snapshot: takes no required arguments, and by\n // export time its answer is exactly what the session recorded.\n snapshot: true,\n agent: {\n description:\n 'Explain component updates: which components re-rendered, how often, how long they took, and which reactive properties changed to cause each update. Prefer this over lit:recent-events for \"why did this re-render\" and \"what is re-rendering too much\" — it answers from the same recording without the caller having to pair start/end events itself. Filter to one component with tagName. Check the `recording` field — if false, no events are being captured; call lit:set-recording first.',\n },\n // `args` is genuinely absent when an agent calls the tool with no\n // filters — the most common call — so it must default.\n handler: async (\n args: UpdateSummaryArgs = {}\n ): Promise<UpdateSummaryResult> => {\n const recording = session.value().layers.recordingState;\n let events: readonly TimelineEvent[] = recentEvents;\n // Same window semantics as `recent-events`: measured against the\n // newest event in the whole buffer, not the newest match.\n if (args.sinceMs !== undefined && recentEvents.length > 0) {\n const cutoff =\n recentEvents[recentEvents.length - 1]!.time - args.sinceMs;\n events = recentEvents.filter((e) => e.time >= cutoff);\n }\n let cycles = attributeInput(\n toUpdateCycles(toSpans(events)),\n events\n );\n if (args.tagName !== undefined) {\n cycles = cycles.filter((c) => c.tagName === args.tagName);\n }\n // Totals cover the whole window; only the per-cycle list is\n // capped, so a limit never silently understates a hot component.\n const components = rollup(cycles);\n const limit = Math.min(args.limit ?? 50, 200);\n const limited = cycles.slice(-limit);\n return {\n recording,\n components,\n cycles: limited,\n bufferSize: recentEvents.length,\n truncated: limited.length < cycles.length,\n };\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_INSPECT,\n type: 'action',\n jsonSerializable: true,\n handler: async (command: InspectorCommand): Promise<void> => {\n // \"Pick\" starts the overlay's inspect picker, which the host\n // toggles in the page rather than answering from the runtime.\n if (command.type === 'pick') {\n source.toggleOverlay();\n return;\n }\n source.sendInspector(command);\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_SET_RECORDING,\n type: 'action',\n jsonSerializable: true,\n // The one agent-exposed mutation. `recent-events` is a dead end\n // when recording is off, so an agent that can read the timeline\n // but never start it just hands the question back to the human.\n // Deliberately still the *only* one: the picker and layer toggles\n // stay panel-only.\n agent: {\n description:\n 'Start or stop timeline recording. This is a shared toggle: turning it on also affects the DevTools panel if a developer has it open. Call this if lit:recent-events reports `recording: false`.',\n },\n handler: async (args: SetRecordingArgs): Promise<void> => {\n session.mutate((state) => {\n state.layers.recordingState = args.recording;\n });\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_TOGGLE_LAYER,\n type: 'action',\n jsonSerializable: true,\n handler: async (args: ToggleLayerArgs): Promise<void> => {\n const flag = LAYER_FLAGS[args.layerId];\n // Custom layers have no capture flag to toggle — app code owns\n // whether it emits at all.\n if (!flag) return;\n session.mutate((state) => {\n state.layers[flag] = args.enabled;\n });\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_SET_SETTINGS_OVERRIDE,\n type: 'action',\n jsonSerializable: true,\n handler: async (override: SettingsOverride): Promise<void> => {\n source.setSettingsOverride(override);\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_OPEN_SOURCE,\n type: 'action',\n jsonSerializable: true,\n // Resolving here rather than in the panel is the whole point of\n // the hop: `file` is relative to the Vite root, while the open\n // service resolves relative paths against the host's\n // `workspaceRoot` -- in a monorepo (or any setup where the served\n // app isn't the workspace) those are different directories, and\n // `launchEditor` silently does nothing for a path that doesn't\n // exist. Not agent-exposed: it spawns a GUI process.\n handler: async (args: OpenSourceArgs): Promise<OpenSourceResult> => {\n const service = ctx.services.get('@devframes/service-open');\n if (service === undefined) return {opened: false};\n // Confined like `/__lit-open-in-editor`: whatever can reach this\n // RPC could otherwise have the editor open any file on disk.\n const {confineToRoots} = await import('../confine.js');\n const confined = confineToRoots(\n [sourceRoot?.() ?? process.cwd(), ...(allowedRoots?.() ?? [])],\n args.file\n );\n if ('failure' in confined) return {opened: false};\n const {path} = confined;\n const override = await my.settings.global.get('override');\n await service.openInEditor({\n path,\n line: args.line,\n editor: resolveLaunchEditor(configuredEditor?.(), override),\n });\n return {opened: true};\n },\n })\n );\n\n my.rpc.register(\n defineRpcFunction({\n name: RPC_EXPORT_SNAPSHOT,\n type: 'action',\n jsonSerializable: true,\n // Not agent-exposed. It writes a directory to the developer's disk,\n // which is not something a coding agent should be able to do behind\n // their back -- same reasoning as the other mutating actions.\n handler: async (\n args: ExportSnapshotArgs\n ): Promise<ExportSnapshotResult> => {\n // Imported here, not at module scope: this file has to keep\n // loading in contexts with no filesystem, and the build adapter\n // it pulls in reaches straight for `node:fs`.\n const {buildSnapshot} = await import('../snapshot.js');\n // `outDir` comes from the client and the build deletes it before\n // writing, so it has to land strictly beneath the working\n // directory -- never the directory itself, and never elsewhere\n // on disk.\n const {resolve, sep} = await import('node:path');\n const cwd = process.cwd();\n const outDir = resolve(cwd, args.outDir ?? 'lit-devtools-snapshot');\n if (!outDir.startsWith(cwd + sep)) {\n throw new Error(\n `[lit-devtools] export-snapshot: outDir must be inside ${cwd}`\n );\n }\n return buildSnapshot(\n {\n capturedAt: new Date().toISOString(),\n version,\n customLayers: [...session.value().customLayers],\n roots: cachedRoots,\n details: [...cachedDetails.values()],\n events: [...recentEvents],\n hmrIncompatibilities: [...hmrIncompatibilities],\n },\n {\n outDir,\n features: features ? features() : null,\n clientAssets: options.clientAssets,\n }\n );\n },\n })\n );\n },\n });\n}\n\nexport default createLitDevframe({\n source: createNullSource(),\n version: '0.0.0',\n});\n"]}
@@ -65,7 +65,9 @@ export interface OpenSourceArgs {
65
65
  export interface OpenSourceResult {
66
66
  /**
67
67
  * False when no open service is installed on the host, which is the
68
- * panel's cue to fall back to `/__lit-open-in-editor`.
68
+ * panel's cue to fall back to `/__lit-open-in-editor`. Also false when the
69
+ * file is missing or outside the allowed roots; the endpoint refuses those
70
+ * paths too.
69
71
  */
70
72
  opened: boolean;
71
73
  }
@@ -74,8 +76,10 @@ export declare const RPC_EXPORT_SNAPSHOT = "export-snapshot";
74
76
  /** Arguments for {@link RPC_EXPORT_SNAPSHOT}. */
75
77
  export interface ExportSnapshotArgs {
76
78
  /**
77
- * Where to write. Relative paths resolve against the dev server's cwd.
78
- * Defaults to `lit-devtools-snapshot`.
79
+ * Where to write. Relative paths resolve against the dev server's cwd,
80
+ * and the result has to stay beneath it. Defaults to
81
+ * `lit-devtools-snapshot`. An existing directory is only replaced when it
82
+ * holds an earlier snapshot.
79
83
  */
80
84
  outDir?: string;
81
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/lib/devframe/protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,oCAAoC,CAAC;AAChF,OAAO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;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAkB/C,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,MAAM,EAAE,oBAAoB;IAC5B,YAAY,EAAE,EAAE;CACjB,CAAC;AAiFF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB;IACE,eAAe,EAAE,qBAAqB;IACtC,YAAY,EAAE,kBAAkB;IAChC,oBAAoB,EAAE,yBAAyB;IAC/C,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;CACjC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Shared wire contract between the Lit devframe's node-side definition\n * ({@link ../definition.ts}) and its panel: shared-state / streaming /\n * RPC-function names, their payload shapes, and the `devframe` registry\n * augmentations that type them end to end.\n *\n * @see plans/devframe-foundation.md\n */\n\nimport {DEFAULT_LAYERS_STATE} from '../../types/timeline.js';\nimport type {\n FeatureSettings,\n OverrideBaselines,\n SettingsOverride,\n TimelineEvent,\n TimelineLayer,\n TimelineLayersState,\n} from '../../types/timeline.js';\nimport type {\n InspectorCommand,\n InspectorDetails,\n InspectorMessage,\n InspectorTreeNode,\n} from '../../types/inspector.js';\nimport type {HmrIncompatibilityEvent} from '../../types/hmr-incompatibility.js';\nimport type {ComponentRollup, UpdateCycle} from '../timeline/derive.js';\n\n/** The devframe's scope id. RPC names become `lit:*`, MCP wire names `lit_*`. */\nexport const LIT_DEVFRAME_ID = 'lit';\n\n/** Shared-state key holding the {@link SessionState} snapshot. */\nexport const SESSION_STATE_KEY = 'session';\n\n/** Streaming channel name the timeline event batches are pushed on. */\nexport const TIMELINE_STREAM_NAME = 'timeline';\n\n/**\n * Id of the one long-lived timeline stream. Fixed rather than discovered:\n * there is exactly one page feed per dev session, so the panel can subscribe\n * without a round trip to look the id up. The node side re-`start()`s this id\n * if the transport dropped the stream after the last subscriber left.\n */\nexport const TIMELINE_STREAM_ID = 'live';\n\n/**\n * Cap on the node-side recent-events ring buffer. It is also the history a\n * (re)connecting panel is seeded with (see {@link RPC_TIMELINE_HISTORY}).\n */\nexport const RECENT_EVENTS_BUFFER_SIZE = 512;\n\n/** Bare (unscoped) name of the `get-meta` query. */\nexport const RPC_GET_META = 'get-meta';\n\n/** Bare name of the `list-components` query. */\nexport const RPC_LIST_COMPONENTS = 'list-components';\n\n/** Bare name of the `component-details` query. */\nexport const RPC_COMPONENT_DETAILS = 'component-details';\n\n/** Bare name of the `recent-events` query. */\nexport const RPC_RECENT_EVENTS = 'recent-events';\n\n/**\n * Bare name of the `timeline-history` query: the node's whole recent-events\n * buffer, oldest first, as `TimelineEvent[]`. What a live panel seeds itself\n * with on connect, since the stream only carries events from then on. Not\n * `recent-events`, whose live answer is filtered and capped for agents.\n */\nexport const RPC_TIMELINE_HISTORY = 'timeline-history';\n\n/** Bare name of the `update-summary` query. */\nexport const RPC_UPDATE_SUMMARY = 'update-summary';\n\n/** Bare name of the `inspect` action. */\nexport const RPC_INSPECT = 'inspect';\n\n/** Bare name of the `set-recording` action. */\nexport const RPC_SET_RECORDING = 'set-recording';\n\n/** Bare name of the `toggle-layer` action. */\nexport const RPC_TOGGLE_LAYER = 'toggle-layer';\n\n/** Bare name of the `set-settings-override` action. */\nexport const RPC_SET_SETTINGS_OVERRIDE = 'set-settings-override';\n\n/** Bare name of the `open-source` action. */\nexport const RPC_OPEN_SOURCE = 'open-source';\n\n/** Arguments for {@link RPC_OPEN_SOURCE}. */\nexport interface OpenSourceArgs {\n /**\n * The path as the panel has it: what the transform injected, so relative\n * to the Vite root (or absolute, when the file lives outside it).\n */\n file: string;\n line?: number;\n}\n\n/** What {@link RPC_OPEN_SOURCE} reports back. */\nexport interface OpenSourceResult {\n /**\n * False when no open service is installed on the host, which is the\n * panel's cue to fall back to `/__lit-open-in-editor`.\n */\n opened: boolean;\n}\n\n/** Freeze the current session into a static panel directory. */\nexport const RPC_EXPORT_SNAPSHOT = 'export-snapshot';\n\n/** Arguments for {@link RPC_EXPORT_SNAPSHOT}. */\nexport interface ExportSnapshotArgs {\n /**\n * Where to write. Relative paths resolve against the dev server's cwd.\n * Defaults to `lit-devtools-snapshot`.\n */\n outDir?: string;\n}\n\n/** What {@link RPC_EXPORT_SNAPSHOT} reports back, for the panel to display. */\nexport interface ExportSnapshotResult {\n outDir: string;\n events: number;\n components: number;\n details: number;\n}\n\n/** Bare name of the `inspector-message` client (node → panel) event. */\nexport const RPC_INSPECTOR_MESSAGE = 'inspector-message';\n\n/** Bare name of the `hmr-incompatibilities` query. */\nexport const RPC_HMR_INCOMPATIBILITIES = 'hmr-incompatibilities';\n\n/** Bare name of the `hmr-incompatible` client (node → panel) event. */\nexport const RPC_HMR_INCOMPATIBLE = 'hmr-incompatible';\n\n/**\n * Bare name of the page-to-server event. A page runtime that is not on a Vite\n * dev server's HMR socket sends every channel message it would have sent over\n * `import.meta.hot` as `page-send(channel, data)`.\n */\nexport const RPC_PAGE_SEND = 'page-send';\n\n/**\n * Bare name of the server-to-page client event, the reverse direction of\n * {@link RPC_PAGE_SEND}: `page-receive(channel, data)`. Broadcast to every\n * connected client and marked optional, since the panel does not register it.\n */\nexport const RPC_PAGE_RECEIVE = 'page-receive';\n\n/**\n * Recording/layers snapshot shared between every surface (panel, page\n * runtime, MCP). Survives reconnect; mutated either by the `set-recording` /\n * `toggle-layer` actions below or directly by a panel through the generic\n * shared-state RPC devframe provides.\n *\n * `layers.recordingState` is the single authority for \"is recording\" — the\n * runtime's own layer state carries it, so a separate flag here would be a\n * second copy to keep in sync.\n */\nexport interface SessionState {\n layers: TimelineLayersState;\n /** Layers announced at runtime by app code through `addTimelineLayer()`. */\n customLayers: TimelineLayer[];\n}\n\nexport const DEFAULT_SESSION_STATE: SessionState = {\n layers: DEFAULT_LAYERS_STATE,\n customLayers: [],\n};\n\n/** Result of the `get-meta` query. */\nexport interface LitGetMetaResult {\n version: string;\n /** Built-in layers followed by any runtime-announced custom ones. */\n layers: TimelineLayer[];\n features: FeatureSettings | null;\n /** Channel and id to pass to `rpc.streaming.subscribe()`. */\n stream: {channel: string; id: string};\n}\n\n/** Argument of the `component-details` query. */\nexport interface ComponentDetailsArgs {\n id: number;\n}\n\n/** Argument of the `recent-events` query. */\nexport interface RecentEventsArgs {\n layerId?: string;\n elementId?: number;\n /**\n * Only events from the last `sinceMs` milliseconds, measured against\n * the newest event currently in the buffer — not wall-clock time.\n * `TimelineEvent.time` is \"ms since recording started\" in the page\n * (see `runtime/timeline/clock.ts`), which has no fixed relationship\n * to this process's clock.\n */\n sinceMs?: number;\n /** Default 50, hard ceiling 200 regardless of what's requested. */\n limit?: number;\n}\n\n/** Result of the `recent-events` query. */\nexport interface RecentEventsResult {\n /** Whether the timeline is currently recording. */\n recording: boolean;\n /** Most recent events matching the filters, oldest first. */\n events: TimelineEvent[];\n /** Total events currently held in the ring buffer, before filtering. */\n bufferSize: number;\n /** True if filtering matched more events than were returned. */\n truncated: boolean;\n}\n\n/** Argument of the `update-summary` query. */\nexport interface UpdateSummaryArgs {\n /** Restrict to one component, by tag name. */\n tagName?: string;\n /** Same window semantics as {@link RecentEventsArgs.sinceMs}. */\n sinceMs?: number;\n /** Cycles returned (the component totals always cover the whole window).\n * Default 50, hard ceiling 200. */\n limit?: number;\n}\n\n/** Result of the `update-summary` query. */\nexport interface UpdateSummaryResult {\n /** Whether the timeline is currently recording. */\n recording: boolean;\n /** Per-component totals over the window, slowest first. */\n components: ComponentRollup[];\n /** The most recent update cycles in the window, oldest first. */\n cycles: UpdateCycle[];\n /** Total events currently held in the ring buffer, before derivation. */\n bufferSize: number;\n /** True if more cycles were derived than were returned. */\n truncated: boolean;\n}\n\n/** Argument of the `set-recording` action. */\nexport interface SetRecordingArgs {\n recording: boolean;\n}\n\n/** Argument of the `toggle-layer` action. */\nexport interface ToggleLayerArgs {\n layerId: string;\n enabled: boolean;\n}\n\n/**\n * Maps a {@link TimelineLayer.id} to the {@link TimelineLayersState} flag\n * that gates it. Custom layers have no flag and are always on.\n */\nexport const LAYER_FLAGS: Readonly<Record<string, keyof TimelineLayersState>> =\n {\n 'lit-lifecycle': 'litLifecycleEnabled',\n 'lit-render': 'litRenderEnabled',\n 'lit-render-verbose': 'litRenderVerboseEnabled',\n mouse: 'mouseEventEnabled',\n keyboard: 'keyboardEventEnabled',\n };\n\n// Hand-typed rather than derived through `RpcDefinitionsToFunctionsWithNamespace`\n// (also exported by `devframe/rpc`): the definitions themselves live in\n// definition.ts next to their handlers, and hand-typing here avoids a\n// value-level dependency from this shared-contract module back onto it.\ndeclare module 'devframe' {\n interface DevframeRpcServerFunctions {\n 'lit:get-meta': () => Promise<LitGetMetaResult>;\n 'lit:list-components': () => Promise<InspectorTreeNode[]>;\n 'lit:component-details': (\n args: ComponentDetailsArgs\n ) => Promise<InspectorDetails | null>;\n 'lit:recent-events': (\n args?: RecentEventsArgs\n ) => Promise<RecentEventsResult>;\n 'lit:timeline-history': () => Promise<TimelineEvent[]>;\n 'lit:update-summary': (\n args?: UpdateSummaryArgs\n ) => Promise<UpdateSummaryResult>;\n 'lit:inspect': (command: InspectorCommand) => Promise<void>;\n 'lit:set-recording': (args: SetRecordingArgs) => Promise<void>;\n 'lit:toggle-layer': (args: ToggleLayerArgs) => Promise<void>;\n 'lit:set-settings-override': (override: SettingsOverride) => Promise<void>;\n 'lit:open-source': (args: OpenSourceArgs) => Promise<OpenSourceResult>;\n 'lit:export-snapshot': (\n args: ExportSnapshotArgs\n ) => Promise<ExportSnapshotResult>;\n 'lit:hmr-incompatibilities': () => Promise<HmrIncompatibilityEvent[]>;\n 'lit:page-send': (channel: string, data?: unknown) => void;\n }\n\n interface DevframeRpcClientFunctions {\n 'lit:inspector-message': (message: InspectorMessage) => void;\n 'lit:hmr-incompatible': (event: HmrIncompatibilityEvent) => void;\n 'lit:page-receive': (channel: string, data?: unknown) => void;\n }\n\n interface DevframeSettingsRegistry {\n lit: {\n /** Panel chrome preference. Mirrors `COLOR_SCHEME_LS_KEY`. */\n appearance?: 'auto' | 'dark' | 'light';\n /**\n * The Settings tab's live overrides, stored as one blob the way the\n * panel already treats them. Mirrors `SETTINGS_OVERRIDE_LS_KEY`, which\n * stays: the page runtime reads it synchronously at module-init time,\n * long before any client exists, and every settings-store read is\n * async by design.\n */\n override?: SettingsOverride;\n /**\n * The config value each overridden key was set against. A sibling of\n * `override` so the runtime never sees it. Mirrors\n * `OVERRIDE_BASELINES_LS_KEY`.\n */\n overrideBaselines?: OverrideBaselines;\n };\n }\n}\n"]}
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/lib/devframe/protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAkB7D,iFAAiF;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAE3C,uEAAuE;AACvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,oDAAoD;AACpD,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEvC,gDAAgD;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAEzD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAEnD,yCAAyC;AACzC,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AAErC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEjD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE/C,uDAAuD;AACvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEjE,6CAA6C;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAuB7C,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAqBrD,wEAAwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAEzD,sDAAsD;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEjE,uEAAuE;AACvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAkB/C,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,MAAM,EAAE,oBAAoB;IAC5B,YAAY,EAAE,EAAE;CACjB,CAAC;AAiFF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB;IACE,eAAe,EAAE,qBAAqB;IACtC,YAAY,EAAE,kBAAkB;IAChC,oBAAoB,EAAE,yBAAyB;IAC/C,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;CACjC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Shared wire contract between the Lit devframe's node-side definition\n * ({@link ../definition.ts}) and its panel: shared-state / streaming /\n * RPC-function names, their payload shapes, and the `devframe` registry\n * augmentations that type them end to end.\n *\n * @see plans/devframe-foundation.md\n */\n\nimport {DEFAULT_LAYERS_STATE} from '../../types/timeline.js';\nimport type {\n FeatureSettings,\n OverrideBaselines,\n SettingsOverride,\n TimelineEvent,\n TimelineLayer,\n TimelineLayersState,\n} from '../../types/timeline.js';\nimport type {\n InspectorCommand,\n InspectorDetails,\n InspectorMessage,\n InspectorTreeNode,\n} from '../../types/inspector.js';\nimport type {HmrIncompatibilityEvent} from '../../types/hmr-incompatibility.js';\nimport type {ComponentRollup, UpdateCycle} from '../timeline/derive.js';\n\n/** The devframe's scope id. RPC names become `lit:*`, MCP wire names `lit_*`. */\nexport const LIT_DEVFRAME_ID = 'lit';\n\n/** Shared-state key holding the {@link SessionState} snapshot. */\nexport const SESSION_STATE_KEY = 'session';\n\n/** Streaming channel name the timeline event batches are pushed on. */\nexport const TIMELINE_STREAM_NAME = 'timeline';\n\n/**\n * Id of the one long-lived timeline stream. Fixed rather than discovered:\n * there is exactly one page feed per dev session, so the panel can subscribe\n * without a round trip to look the id up. The node side re-`start()`s this id\n * if the transport dropped the stream after the last subscriber left.\n */\nexport const TIMELINE_STREAM_ID = 'live';\n\n/**\n * Cap on the node-side recent-events ring buffer. It is also the history a\n * (re)connecting panel is seeded with (see {@link RPC_TIMELINE_HISTORY}).\n */\nexport const RECENT_EVENTS_BUFFER_SIZE = 512;\n\n/** Bare (unscoped) name of the `get-meta` query. */\nexport const RPC_GET_META = 'get-meta';\n\n/** Bare name of the `list-components` query. */\nexport const RPC_LIST_COMPONENTS = 'list-components';\n\n/** Bare name of the `component-details` query. */\nexport const RPC_COMPONENT_DETAILS = 'component-details';\n\n/** Bare name of the `recent-events` query. */\nexport const RPC_RECENT_EVENTS = 'recent-events';\n\n/**\n * Bare name of the `timeline-history` query: the node's whole recent-events\n * buffer, oldest first, as `TimelineEvent[]`. What a live panel seeds itself\n * with on connect, since the stream only carries events from then on. Not\n * `recent-events`, whose live answer is filtered and capped for agents.\n */\nexport const RPC_TIMELINE_HISTORY = 'timeline-history';\n\n/** Bare name of the `update-summary` query. */\nexport const RPC_UPDATE_SUMMARY = 'update-summary';\n\n/** Bare name of the `inspect` action. */\nexport const RPC_INSPECT = 'inspect';\n\n/** Bare name of the `set-recording` action. */\nexport const RPC_SET_RECORDING = 'set-recording';\n\n/** Bare name of the `toggle-layer` action. */\nexport const RPC_TOGGLE_LAYER = 'toggle-layer';\n\n/** Bare name of the `set-settings-override` action. */\nexport const RPC_SET_SETTINGS_OVERRIDE = 'set-settings-override';\n\n/** Bare name of the `open-source` action. */\nexport const RPC_OPEN_SOURCE = 'open-source';\n\n/** Arguments for {@link RPC_OPEN_SOURCE}. */\nexport interface OpenSourceArgs {\n /**\n * The path as the panel has it: what the transform injected, so relative\n * to the Vite root (or absolute, when the file lives outside it).\n */\n file: string;\n line?: number;\n}\n\n/** What {@link RPC_OPEN_SOURCE} reports back. */\nexport interface OpenSourceResult {\n /**\n * False when no open service is installed on the host, which is the\n * panel's cue to fall back to `/__lit-open-in-editor`. Also false when the\n * file is missing or outside the allowed roots; the endpoint refuses those\n * paths too.\n */\n opened: boolean;\n}\n\n/** Freeze the current session into a static panel directory. */\nexport const RPC_EXPORT_SNAPSHOT = 'export-snapshot';\n\n/** Arguments for {@link RPC_EXPORT_SNAPSHOT}. */\nexport interface ExportSnapshotArgs {\n /**\n * Where to write. Relative paths resolve against the dev server's cwd,\n * and the result has to stay beneath it. Defaults to\n * `lit-devtools-snapshot`. An existing directory is only replaced when it\n * holds an earlier snapshot.\n */\n outDir?: string;\n}\n\n/** What {@link RPC_EXPORT_SNAPSHOT} reports back, for the panel to display. */\nexport interface ExportSnapshotResult {\n outDir: string;\n events: number;\n components: number;\n details: number;\n}\n\n/** Bare name of the `inspector-message` client (node → panel) event. */\nexport const RPC_INSPECTOR_MESSAGE = 'inspector-message';\n\n/** Bare name of the `hmr-incompatibilities` query. */\nexport const RPC_HMR_INCOMPATIBILITIES = 'hmr-incompatibilities';\n\n/** Bare name of the `hmr-incompatible` client (node → panel) event. */\nexport const RPC_HMR_INCOMPATIBLE = 'hmr-incompatible';\n\n/**\n * Bare name of the page-to-server event. A page runtime that is not on a Vite\n * dev server's HMR socket sends every channel message it would have sent over\n * `import.meta.hot` as `page-send(channel, data)`.\n */\nexport const RPC_PAGE_SEND = 'page-send';\n\n/**\n * Bare name of the server-to-page client event, the reverse direction of\n * {@link RPC_PAGE_SEND}: `page-receive(channel, data)`. Broadcast to every\n * connected client and marked optional, since the panel does not register it.\n */\nexport const RPC_PAGE_RECEIVE = 'page-receive';\n\n/**\n * Recording/layers snapshot shared between every surface (panel, page\n * runtime, MCP). Survives reconnect; mutated either by the `set-recording` /\n * `toggle-layer` actions below or directly by a panel through the generic\n * shared-state RPC devframe provides.\n *\n * `layers.recordingState` is the single authority for \"is recording\" — the\n * runtime's own layer state carries it, so a separate flag here would be a\n * second copy to keep in sync.\n */\nexport interface SessionState {\n layers: TimelineLayersState;\n /** Layers announced at runtime by app code through `addTimelineLayer()`. */\n customLayers: TimelineLayer[];\n}\n\nexport const DEFAULT_SESSION_STATE: SessionState = {\n layers: DEFAULT_LAYERS_STATE,\n customLayers: [],\n};\n\n/** Result of the `get-meta` query. */\nexport interface LitGetMetaResult {\n version: string;\n /** Built-in layers followed by any runtime-announced custom ones. */\n layers: TimelineLayer[];\n features: FeatureSettings | null;\n /** Channel and id to pass to `rpc.streaming.subscribe()`. */\n stream: {channel: string; id: string};\n}\n\n/** Argument of the `component-details` query. */\nexport interface ComponentDetailsArgs {\n id: number;\n}\n\n/** Argument of the `recent-events` query. */\nexport interface RecentEventsArgs {\n layerId?: string;\n elementId?: number;\n /**\n * Only events from the last `sinceMs` milliseconds, measured against\n * the newest event currently in the buffer — not wall-clock time.\n * `TimelineEvent.time` is \"ms since recording started\" in the page\n * (see `runtime/timeline/clock.ts`), which has no fixed relationship\n * to this process's clock.\n */\n sinceMs?: number;\n /** Default 50, hard ceiling 200 regardless of what's requested. */\n limit?: number;\n}\n\n/** Result of the `recent-events` query. */\nexport interface RecentEventsResult {\n /** Whether the timeline is currently recording. */\n recording: boolean;\n /** Most recent events matching the filters, oldest first. */\n events: TimelineEvent[];\n /** Total events currently held in the ring buffer, before filtering. */\n bufferSize: number;\n /** True if filtering matched more events than were returned. */\n truncated: boolean;\n}\n\n/** Argument of the `update-summary` query. */\nexport interface UpdateSummaryArgs {\n /** Restrict to one component, by tag name. */\n tagName?: string;\n /** Same window semantics as {@link RecentEventsArgs.sinceMs}. */\n sinceMs?: number;\n /** Cycles returned (the component totals always cover the whole window).\n * Default 50, hard ceiling 200. */\n limit?: number;\n}\n\n/** Result of the `update-summary` query. */\nexport interface UpdateSummaryResult {\n /** Whether the timeline is currently recording. */\n recording: boolean;\n /** Per-component totals over the window, slowest first. */\n components: ComponentRollup[];\n /** The most recent update cycles in the window, oldest first. */\n cycles: UpdateCycle[];\n /** Total events currently held in the ring buffer, before derivation. */\n bufferSize: number;\n /** True if more cycles were derived than were returned. */\n truncated: boolean;\n}\n\n/** Argument of the `set-recording` action. */\nexport interface SetRecordingArgs {\n recording: boolean;\n}\n\n/** Argument of the `toggle-layer` action. */\nexport interface ToggleLayerArgs {\n layerId: string;\n enabled: boolean;\n}\n\n/**\n * Maps a {@link TimelineLayer.id} to the {@link TimelineLayersState} flag\n * that gates it. Custom layers have no flag and are always on.\n */\nexport const LAYER_FLAGS: Readonly<Record<string, keyof TimelineLayersState>> =\n {\n 'lit-lifecycle': 'litLifecycleEnabled',\n 'lit-render': 'litRenderEnabled',\n 'lit-render-verbose': 'litRenderVerboseEnabled',\n mouse: 'mouseEventEnabled',\n keyboard: 'keyboardEventEnabled',\n };\n\n// Hand-typed rather than derived through `RpcDefinitionsToFunctionsWithNamespace`\n// (also exported by `devframe/rpc`): the definitions themselves live in\n// definition.ts next to their handlers, and hand-typing here avoids a\n// value-level dependency from this shared-contract module back onto it.\ndeclare module 'devframe' {\n interface DevframeRpcServerFunctions {\n 'lit:get-meta': () => Promise<LitGetMetaResult>;\n 'lit:list-components': () => Promise<InspectorTreeNode[]>;\n 'lit:component-details': (\n args: ComponentDetailsArgs\n ) => Promise<InspectorDetails | null>;\n 'lit:recent-events': (\n args?: RecentEventsArgs\n ) => Promise<RecentEventsResult>;\n 'lit:timeline-history': () => Promise<TimelineEvent[]>;\n 'lit:update-summary': (\n args?: UpdateSummaryArgs\n ) => Promise<UpdateSummaryResult>;\n 'lit:inspect': (command: InspectorCommand) => Promise<void>;\n 'lit:set-recording': (args: SetRecordingArgs) => Promise<void>;\n 'lit:toggle-layer': (args: ToggleLayerArgs) => Promise<void>;\n 'lit:set-settings-override': (override: SettingsOverride) => Promise<void>;\n 'lit:open-source': (args: OpenSourceArgs) => Promise<OpenSourceResult>;\n 'lit:export-snapshot': (\n args: ExportSnapshotArgs\n ) => Promise<ExportSnapshotResult>;\n 'lit:hmr-incompatibilities': () => Promise<HmrIncompatibilityEvent[]>;\n 'lit:page-send': (channel: string, data?: unknown) => void;\n }\n\n interface DevframeRpcClientFunctions {\n 'lit:inspector-message': (message: InspectorMessage) => void;\n 'lit:hmr-incompatible': (event: HmrIncompatibilityEvent) => void;\n 'lit:page-receive': (channel: string, data?: unknown) => void;\n }\n\n interface DevframeSettingsRegistry {\n lit: {\n /** Panel chrome preference. Mirrors `COLOR_SCHEME_LS_KEY`. */\n appearance?: 'auto' | 'dark' | 'light';\n /**\n * The Settings tab's live overrides, stored as one blob the way the\n * panel already treats them. Mirrors `SETTINGS_OVERRIDE_LS_KEY`, which\n * stays: the page runtime reads it synchronously at module-init time,\n * long before any client exists, and every settings-store read is\n * async by design.\n */\n override?: SettingsOverride;\n /**\n * The config value each overridden key was set against. A sibling of\n * `override` so the runtime never sees it. Mirrors\n * `OVERRIDE_BASELINES_LS_KEY`.\n */\n overrideBaselines?: OverrideBaselines;\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/lib/devframe/v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, which is after the
232
232
  // definition is built -- hence the getter.
233
233
  let viteRoot;
234
+ let fsAllow = [];
234
235
  const definition = createLitDevframe({
235
236
  source,
236
237
  version: options.version,
@@ -238,6 +239,7 @@ export function createLitDevframePlugin(options) {
238
239
  configuredEditor: options.configuredEditor,
239
240
  clientAssets: options.clientAssets,
240
241
  sourceRoot: () => viteRoot,
242
+ allowedRoots: () => fsAllow,
241
243
  });
242
244
  return {
243
245
  name: `devframe:${LIT_DEVFRAME_ID}`,
@@ -252,6 +254,7 @@ export function createLitDevframePlugin(options) {
252
254
  // available on the context by now.
253
255
  if (ctx.viteServer) source.bind(ctx.viteServer, ctx);
254
256
  viteRoot = ctx.viteServer?.config.root;
257
+ fsAllow = ctx.viteServer?.config.server.fs?.allow ?? [];
255
258
  await ctx.install(definition);
256
259
  // The overlay picker as a palette command with a managed shortcut.
257
260
  // Only meaningful when the source overlay is enabled, since that is