@oddsquad/vite-plugin-lit 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/README.md +16 -5
- package/bin.mjs +16 -12
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-CdtPhBL-.js → browser-agent-rpc-BXhoSh1z-CRHFLjFo.js} +2 -2
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-CdtPhBL-.js.map → browser-agent-rpc-BXhoSh1z-CRHFLjFo.js.map} +1 -1
- package/dist/client/assets/{index-DVe6M4HV.js → index-Gn4Hk_9s.js} +1840 -758
- package/dist/client/assets/index-Gn4Hk_9s.js.map +1 -0
- package/dist/client/index.html +11 -1
- package/lib/devframe/definition.d.ts +7 -0
- package/lib/devframe/definition.d.ts.map +1 -1
- package/lib/devframe/definition.js +56 -11
- package/lib/devframe/definition.js.map +1 -1
- package/lib/devframe/launch-editor.d.ts +20 -0
- package/lib/devframe/launch-editor.d.ts.map +1 -0
- package/lib/devframe/launch-editor.js +40 -0
- package/lib/devframe/launch-editor.js.map +1 -0
- package/lib/devframe/protocol.d.ts +31 -4
- package/lib/devframe/protocol.d.ts.map +1 -1
- package/lib/devframe/protocol.js +21 -3
- package/lib/devframe/protocol.js.map +1 -1
- package/lib/devframe/rpc-source.d.ts +44 -0
- package/lib/devframe/rpc-source.d.ts.map +1 -0
- package/lib/devframe/rpc-source.js +150 -0
- package/lib/devframe/rpc-source.js.map +1 -0
- package/lib/devframe/source.d.ts +12 -0
- package/lib/devframe/source.d.ts.map +1 -1
- package/lib/devframe/source.js +12 -0
- package/lib/devframe/source.js.map +1 -1
- package/lib/devframe/vite.d.ts +2 -0
- package/lib/devframe/vite.d.ts.map +1 -1
- package/lib/devframe/vite.js +3 -9
- package/lib/devframe/vite.js.map +1 -1
- package/lib/options.d.ts +6 -1
- package/lib/options.d.ts.map +1 -1
- package/lib/options.js +65 -18
- package/lib/options.js.map +1 -1
- package/lib/override-baselines.d.ts +17 -0
- package/lib/override-baselines.d.ts.map +1 -0
- package/lib/override-baselines.js +25 -0
- package/lib/override-baselines.js.map +1 -0
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +8 -0
- package/lib/plugin.js.map +1 -1
- package/lib/plugins/open-in-editor.d.ts.map +1 -1
- package/lib/plugins/open-in-editor.js +6 -1
- package/lib/plugins/open-in-editor.js.map +1 -1
- package/lib/runtime/indicator.js.map +1 -1
- package/lib/runtime/inspector/install.js +4 -2
- package/lib/runtime/inspector/install.js.map +1 -1
- package/lib/runtime/inspector/serialize.d.ts.map +1 -1
- package/lib/runtime/inspector/serialize.js +20 -0
- package/lib/runtime/inspector/serialize.js.map +1 -1
- package/lib/runtime/overrides.d.ts +4 -10
- package/lib/runtime/overrides.d.ts.map +1 -1
- package/lib/runtime/overrides.js +5 -3
- package/lib/runtime/overrides.js.map +1 -1
- package/lib/runtime/page-channel.d.ts +52 -0
- package/lib/runtime/page-channel.d.ts.map +1 -0
- package/lib/runtime/page-channel.js +67 -0
- package/lib/runtime/page-channel.js.map +1 -0
- package/lib/runtime/patch.d.ts.map +1 -1
- package/lib/runtime/patch.js +2 -1
- package/lib/runtime/patch.js.map +1 -1
- package/lib/runtime/rpc-transport.d.ts +46 -0
- package/lib/runtime/rpc-transport.d.ts.map +1 -0
- package/lib/runtime/rpc-transport.js +82 -0
- package/lib/runtime/rpc-transport.js.map +1 -0
- package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -1
- package/lib/runtime/source-overlay/overlay-element.js +13 -3
- package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
- package/lib/runtime/timeline/install.js +15 -4
- package/lib/runtime/timeline/install.js.map +1 -1
- package/lib/runtime/timeline/public-api.d.ts.map +1 -1
- package/lib/runtime/timeline/public-api.js +11 -3
- package/lib/runtime/timeline/public-api.js.map +1 -1
- package/lib/runtime/timeline/transport.d.ts +6 -9
- package/lib/runtime/timeline/transport.d.ts.map +1 -1
- package/lib/runtime/timeline/transport.js.map +1 -1
- package/lib/timeline/filter.d.ts +38 -0
- package/lib/timeline/filter.d.ts.map +1 -0
- package/lib/timeline/filter.js +44 -0
- package/lib/timeline/filter.js.map +1 -0
- package/lib/timeline/tracks.d.ts +113 -0
- package/lib/timeline/tracks.d.ts.map +1 -0
- package/lib/timeline/tracks.js +168 -0
- package/lib/timeline/tracks.js.map +1 -0
- package/package.json +6 -1
- package/types/timeline.d.ts +38 -0
- package/types/timeline.d.ts.map +1 -1
- package/types/timeline.js +2 -0
- package/types/timeline.js.map +1 -1
- package/dist/client/assets/index-DVe6M4HV.js.map +0 -1
package/dist/client/index.html
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<!--
|
|
7
|
+
Inline so a top-level visit never asks for /favicon.ico (the dock embeds
|
|
8
|
+
the panel in an iframe, which never does). The Lit flame, as in
|
|
9
|
+
docs/src/assets/lit-flame.svg.
|
|
10
|
+
-->
|
|
11
|
+
<link
|
|
12
|
+
rel="icon"
|
|
13
|
+
type="image/svg+xml"
|
|
14
|
+
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 200'><path fill='%2300e8ff' d='M40 120l20-60l90 90l-30 50l-40-40h-20'/><path fill='%23283198' d='M80 160v-80l40-40v80M0 160l40 40l20-40l-20-40h-20'/><path fill='%23324fff' d='M40 120v-80l40-40v80M120 200v-80l40-40v80M0 160v-80l40 40'/><path fill='%2300ffff' d='M40 200v-80l40 40'/></svg>"
|
|
15
|
+
/>
|
|
6
16
|
<title>Lit DevTools</title>
|
|
7
17
|
<style>
|
|
8
18
|
* {
|
|
@@ -22,7 +32,7 @@
|
|
|
22
32
|
`prefers-color-scheme` @media owns it, following the host/OS; an explicit
|
|
23
33
|
light/dark pins a `.color-scheme-*` class on :root.
|
|
24
34
|
-->
|
|
25
|
-
<script type="module" crossorigin src="./assets/index-
|
|
35
|
+
<script type="module" crossorigin src="./assets/index-Gn4Hk_9s.js"></script>
|
|
26
36
|
</head>
|
|
27
37
|
<body>
|
|
28
38
|
<lit-devtools-panel></lit-devtools-panel>
|
|
@@ -26,6 +26,13 @@ export interface CreateLitDevframeOptions {
|
|
|
26
26
|
* already absolute.
|
|
27
27
|
*/
|
|
28
28
|
sourceRoot?: () => string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The editor key the developer named in config or env
|
|
31
|
+
* (`sourceOverlay.editor`), or `undefined` when they never did. Read per
|
|
32
|
+
* call. `open-source` maps it, or the panel's override of it, to a
|
|
33
|
+
* `launch-editor` command; without either the editor is auto-detected.
|
|
34
|
+
*/
|
|
35
|
+
configuredEditor?: () => string | undefined;
|
|
29
36
|
/**
|
|
30
37
|
* Boot from a recorded session instead of a live one. Set only by the
|
|
31
38
|
* static-snapshot build (see `lib/snapshot.ts`): the caches below start
|
|
@@ -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;
|
|
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"}
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
RPC_INSPECTOR_MESSAGE,
|
|
31
31
|
RPC_LIST_COMPONENTS,
|
|
32
32
|
RPC_RECENT_EVENTS,
|
|
33
|
+
RPC_TIMELINE_HISTORY,
|
|
33
34
|
RPC_SET_RECORDING,
|
|
34
35
|
RPC_EXPORT_SNAPSHOT,
|
|
35
36
|
RPC_OPEN_SOURCE,
|
|
@@ -46,6 +47,7 @@ import {
|
|
|
46
47
|
toSpans,
|
|
47
48
|
toUpdateCycles,
|
|
48
49
|
} from '../timeline/derive.js';
|
|
50
|
+
import {resolveLaunchEditor} from './launch-editor.js';
|
|
49
51
|
import {createNullSource} from './source.js';
|
|
50
52
|
/**
|
|
51
53
|
* Builds the Lit devframe definition. Framework-neutral: everything here
|
|
@@ -53,7 +55,8 @@ import {createNullSource} from './source.js';
|
|
|
53
55
|
* server, a static build, or an MCP server.
|
|
54
56
|
*/
|
|
55
57
|
export function createLitDevframe(options) {
|
|
56
|
-
const {source, version, features, replay, sourceRoot} =
|
|
58
|
+
const {source, version, features, replay, sourceRoot, configuredEditor} =
|
|
59
|
+
options;
|
|
57
60
|
return defineDevframe({
|
|
58
61
|
id: LIT_DEVFRAME_ID,
|
|
59
62
|
name: 'Lit',
|
|
@@ -104,10 +107,18 @@ export function createLitDevframe(options) {
|
|
|
104
107
|
// the page again. Pre-filled when replaying: there is no page to ask.
|
|
105
108
|
let cachedRoots = replay ? [...replay.roots] : [];
|
|
106
109
|
const cachedDetails = new Map(replay?.details.map((d) => [d.id, d]));
|
|
107
|
-
// Bounded history for the `recent-events` agent query
|
|
108
|
-
//
|
|
109
|
-
// marks `@internal` (see
|
|
110
|
+
// Bounded history for the `recent-events` agent query and the panel's
|
|
111
|
+
// `timeline-history` seed. A plain array, not devframe's internal
|
|
112
|
+
// per-stream replay buffer, which devframe marks `@internal` (see
|
|
113
|
+
// plans/roadmap/02-agent-timeline-access.md).
|
|
110
114
|
const recentEvents = replay ? [...replay.events] : [];
|
|
115
|
+
// Event ids: `${epoch}-${seq}`. The epoch is the session start, so a
|
|
116
|
+
// restarted dev server can never reissue an id an older snapshot holds;
|
|
117
|
+
// the seq is monotonic across Clear. Stamped here, once, because this is
|
|
118
|
+
// the only place every consumer (stream, `recent-events`, export) shares.
|
|
119
|
+
// A replayed session never reaches `pushEvents`, so its ids are kept.
|
|
120
|
+
const eventEpoch = Date.now().toString(36);
|
|
121
|
+
let eventSeq = 0;
|
|
111
122
|
// Recent HMR-incompatibility notices, capped the same way
|
|
112
123
|
// `runtime/timeline/transport.ts` caps its pending queue — a long
|
|
113
124
|
// session with many failing edits must not grow this forever.
|
|
@@ -142,9 +153,13 @@ export function createLitDevframe(options) {
|
|
|
142
153
|
// static build or MCP run has no page attached (its `source` is a
|
|
143
154
|
// `createNullSource()`), and `ctx.mode` is 'build' there.
|
|
144
155
|
if (ctx.mode === 'dev') {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
156
|
+
// No `replayWindow`: a subscriber would be replayed the whole buffer
|
|
157
|
+
// in separate chunks, including batches from before the last
|
|
158
|
+
// recording started (a different clock) and ones the panel's Clear
|
|
159
|
+
// dropped, and the node has no way to forget them. A connecting panel
|
|
160
|
+
// is seeded from `timeline-history` instead, which is `recentEvents`,
|
|
161
|
+
// cleared on the same edges.
|
|
162
|
+
const channel = my.rpc.streaming.create(TIMELINE_STREAM_NAME);
|
|
148
163
|
// Started eagerly, not on the first event: `streaming:subscribe` is
|
|
149
164
|
// fire-and-forget on the wire, and a subscribe naming a stream id
|
|
150
165
|
// that does not exist yet is dropped with a DF0030 diagnostic rather
|
|
@@ -157,8 +172,12 @@ export function createLitDevframe(options) {
|
|
|
157
172
|
channel.get(TIMELINE_STREAM_ID) ??
|
|
158
173
|
channel.start({id: TIMELINE_STREAM_ID});
|
|
159
174
|
source.attach({
|
|
160
|
-
pushEvents(
|
|
161
|
-
if (
|
|
175
|
+
pushEvents(incoming) {
|
|
176
|
+
if (incoming.length === 0) return;
|
|
177
|
+
const events = incoming.map((event) => ({
|
|
178
|
+
...event,
|
|
179
|
+
id: event.id ?? `${eventEpoch}-${eventSeq++}`,
|
|
180
|
+
}));
|
|
162
181
|
ensureStream().write(events);
|
|
163
182
|
recentEvents.push(...events);
|
|
164
183
|
if (recentEvents.length > RECENT_EVENTS_BUFFER_SIZE) {
|
|
@@ -359,7 +378,15 @@ export function createLitDevframe(options) {
|
|
|
359
378
|
const cutoff = newest - args.sinceMs;
|
|
360
379
|
filtered = filtered.filter((e) => e.time >= cutoff);
|
|
361
380
|
}
|
|
362
|
-
|
|
381
|
+
// A frozen session's panel reads the baked no-argument call, so
|
|
382
|
+
// the agent-friendly 50/200 window would silently cut an export to
|
|
383
|
+
// its last 25 spans -- and a link to anything older would miss.
|
|
384
|
+
const limit = replay
|
|
385
|
+
? Math.min(
|
|
386
|
+
args.limit ?? RECENT_EVENTS_BUFFER_SIZE,
|
|
387
|
+
RECENT_EVENTS_BUFFER_SIZE
|
|
388
|
+
)
|
|
389
|
+
: Math.min(args.limit ?? 50, 200);
|
|
363
390
|
const events = filtered.slice(-limit);
|
|
364
391
|
return {
|
|
365
392
|
recording,
|
|
@@ -370,6 +397,19 @@ export function createLitDevframe(options) {
|
|
|
370
397
|
},
|
|
371
398
|
})
|
|
372
399
|
);
|
|
400
|
+
my.rpc.register(
|
|
401
|
+
defineRpcFunction({
|
|
402
|
+
name: RPC_TIMELINE_HISTORY,
|
|
403
|
+
type: 'query',
|
|
404
|
+
jsonSerializable: true,
|
|
405
|
+
// Not agent-exposed (agents have `recent-events`) and not baked
|
|
406
|
+
// into a snapshot (a frozen panel reads `recent-events`, which
|
|
407
|
+
// answers a replayed session with its whole buffer). This is the
|
|
408
|
+
// live panel's seed: the stream carries nothing from before a
|
|
409
|
+
// panel subscribed, so a reloaded panel asks for it here.
|
|
410
|
+
handler: async () => [...recentEvents],
|
|
411
|
+
})
|
|
412
|
+
);
|
|
373
413
|
my.rpc.register(
|
|
374
414
|
defineRpcFunction({
|
|
375
415
|
name: RPC_UPDATE_SUMMARY,
|
|
@@ -500,7 +540,12 @@ export function createLitDevframe(options) {
|
|
|
500
540
|
root !== undefined && !isAbsolute(args.file)
|
|
501
541
|
? resolve(root, args.file)
|
|
502
542
|
: args.file;
|
|
503
|
-
await
|
|
543
|
+
const override = await my.settings.global.get('override');
|
|
544
|
+
await service.openInEditor({
|
|
545
|
+
path,
|
|
546
|
+
line: args.line,
|
|
547
|
+
editor: resolveLaunchEditor(configuredEditor?.(), override),
|
|
548
|
+
});
|
|
504
549
|
return {opened: true};
|
|
505
550
|
},
|
|
506
551
|
})
|
|
@@ -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,CAAC;AAE7E,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AACxC,OAAO,EAAC,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IAAI,EAAC,CAAC;gBACxB,CAAC;aACF,CAAC,CACH,CAAC;YAEF,EAAE,CAAC,GAAG,CAAC,QAAQ,CACb,iBAAiB,CAAC;gBAChB,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,QAAQ;gBACd,gBAAgB,EAAE,IAAI;gBACtB,oEAAoE;gBACpE,oEAAoE;gBACpE,8DAA8D;gBAC9D,OAAO,EAAE,KAAK,EACZ,IAAwB,EACO,EAAE;oBACjC,4DAA4D;oBAC5D,gEAAgE;oBAChE,8CAA8C;oBAC9C,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;oBACvD,OAAO,aAAa,CAClB;wBACE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBACpC,OAAO;wBACP,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC;wBAC/C,KAAK,EAAE,WAAW;wBAClB,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC;wBACpC,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC;wBACzB,oBAAoB,EAAE,CAAC,GAAG,oBAAoB,CAAC;qBAChD,EACD;wBACE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,uBAAuB;wBAC9C,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI;wBACtC,YAAY,EAAE,OAAO,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_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 {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 * 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} = 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. A plain array,\n // not devframe's internal per-stream replay buffer, which devframe\n // marks `@internal` (see plans/roadmap/02-agent-timeline-access.md).\n const recentEvents: TimelineEvent[] = replay ? [...replay.events] : [];\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 const channel = my.rpc.streaming.create<TimelineEvent[]>(\n TIMELINE_STREAM_NAME,\n {replayWindow: 512}\n );\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(events) {\n if (events.length === 0) return;\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 const limit = 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_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 await service.openInEditor({path, line: args.line});\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,EAC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BAAgB,EAAE,IAAI;gBACtB,oEAAoE;gBACpE,oEAAoE;gBACpE,8DAA8D;gBAC9D,OAAO,EAAE,KAAK,EACZ,IAAwB,EACO,EAAE;oBACjC,4DAA4D;oBAC5D,gEAAgE;oBAChE,8CAA8C;oBAC9C,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;oBACvD,OAAO,aAAa,CAClB;wBACE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBACpC,OAAO;wBACP,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC;wBAC/C,KAAK,EAAE,WAAW;wBAClB,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC;wBACpC,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC;wBACzB,oBAAoB,EAAE,CAAC,GAAG,oBAAoB,CAAC;qBAChD,EACD;wBACE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,uBAAuB;wBAC9C,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI;wBACtC,YAAY,EAAE,OAAO,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. 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"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
import type { KnownEditor } from 'devframe/utils/launch-editor';
|
|
7
|
+
import type { SettingsOverride } from '../../types/timeline.js';
|
|
8
|
+
/** The `launch-editor` command for an overlay editor key, if it has one. */
|
|
9
|
+
export declare const toLaunchEditor: (key: string | undefined) => KnownEditor | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The editor server-side open-in-editor should use: the panel override if the
|
|
12
|
+
* developer set one, else the editor named in config or env, else nothing.
|
|
13
|
+
*
|
|
14
|
+
* `configured` must be `undefined` when the developer never named an editor.
|
|
15
|
+
* The Settings tab reports `vscode` for that case (the overlay's URL-scheme
|
|
16
|
+
* default), but forcing `code` here would trade auto-detection for a guess
|
|
17
|
+
* on every project that never chose.
|
|
18
|
+
*/
|
|
19
|
+
export declare const resolveLaunchEditor: (configured: string | undefined, override: SettingsOverride | undefined) => KnownEditor | undefined;
|
|
20
|
+
//# sourceMappingURL=launch-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-editor.d.ts","sourceRoot":"","sources":["../../src/lib/devframe/launch-editor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAqB9D,4EAA4E;AAC5E,eAAO,MAAM,cAAc,QACpB,MAAM,GAAG,SAAS,KACtB,WAAW,GAAG,SAGF,CAAC;AAEhB;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,eAClB,MAAM,GAAG,SAAS,YACpB,gBAAgB,GAAG,SAAS,KACrC,WAAW,GAAG,SAC4C,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The source overlay's editor keys, mapped to the command `launch-editor`
|
|
8
|
+
* knows them by. The two vocabularies overlap by accident of naming (`zed`,
|
|
9
|
+
* `cursor`, `idea`) except for VS Code, whose overlay key is `vscode` but
|
|
10
|
+
* whose command is `code`.
|
|
11
|
+
*
|
|
12
|
+
* `windsurf` is missing on purpose: `@devframes/service-open` only accepts
|
|
13
|
+
* `launch-editor`'s own picklist, and passing anything else would either be
|
|
14
|
+
* rejected or spawn a command nobody vetted. It, custom `{name, url}`
|
|
15
|
+
* editors and unknown keys all resolve to `undefined`, which leaves
|
|
16
|
+
* `launch-editor` to auto-detect as it always did.
|
|
17
|
+
*/
|
|
18
|
+
const LAUNCH_EDITORS = {
|
|
19
|
+
vscode: 'code',
|
|
20
|
+
cursor: 'cursor',
|
|
21
|
+
zed: 'zed',
|
|
22
|
+
idea: 'idea',
|
|
23
|
+
};
|
|
24
|
+
/** The `launch-editor` command for an overlay editor key, if it has one. */
|
|
25
|
+
export const toLaunchEditor = (key) =>
|
|
26
|
+
key !== undefined && Object.hasOwn(LAUNCH_EDITORS, key)
|
|
27
|
+
? LAUNCH_EDITORS[key]
|
|
28
|
+
: undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The editor server-side open-in-editor should use: the panel override if the
|
|
31
|
+
* developer set one, else the editor named in config or env, else nothing.
|
|
32
|
+
*
|
|
33
|
+
* `configured` must be `undefined` when the developer never named an editor.
|
|
34
|
+
* The Settings tab reports `vscode` for that case (the overlay's URL-scheme
|
|
35
|
+
* default), but forcing `code` here would trade auto-detection for a guess
|
|
36
|
+
* on every project that never chose.
|
|
37
|
+
*/
|
|
38
|
+
export const resolveLaunchEditor = (configured, override) =>
|
|
39
|
+
toLaunchEditor(override?.sourceOverlayEditor ?? configured);
|
|
40
|
+
//# sourceMappingURL=launch-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-editor.js","sourceRoot":"","sources":["../../src/lib/devframe/launch-editor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;;;;GAWG;AACH,MAAM,cAAc,GAAgC;IAClD,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,GAAuB,EACE,EAAE,CAC3B,GAAG,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC;IACrD,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC;IACrB,CAAC,CAAC,SAAS,CAAC;AAEhB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,UAA8B,EAC9B,QAAsC,EACb,EAAE,CAC3B,cAAc,CAAC,QAAQ,EAAE,mBAAmB,IAAI,UAAU,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport type {KnownEditor} from 'devframe/utils/launch-editor';\nimport type {SettingsOverride} from '../../types/timeline.js';\n\n/**\n * The source overlay's editor keys, mapped to the command `launch-editor`\n * knows them by. The two vocabularies overlap by accident of naming (`zed`,\n * `cursor`, `idea`) except for VS Code, whose overlay key is `vscode` but\n * whose command is `code`.\n *\n * `windsurf` is missing on purpose: `@devframes/service-open` only accepts\n * `launch-editor`'s own picklist, and passing anything else would either be\n * rejected or spawn a command nobody vetted. It, custom `{name, url}`\n * editors and unknown keys all resolve to `undefined`, which leaves\n * `launch-editor` to auto-detect as it always did.\n */\nconst LAUNCH_EDITORS: Record<string, KnownEditor> = {\n vscode: 'code',\n cursor: 'cursor',\n zed: 'zed',\n idea: 'idea',\n};\n\n/** The `launch-editor` command for an overlay editor key, if it has one. */\nexport const toLaunchEditor = (\n key: string | undefined\n): KnownEditor | undefined =>\n key !== undefined && Object.hasOwn(LAUNCH_EDITORS, key)\n ? LAUNCH_EDITORS[key]\n : undefined;\n\n/**\n * The editor server-side open-in-editor should use: the panel override if the\n * developer set one, else the editor named in config or env, else nothing.\n *\n * `configured` must be `undefined` when the developer never named an editor.\n * The Settings tab reports `vscode` for that case (the overlay's URL-scheme\n * default), but forcing `code` here would trade auto-detection for a guess\n * on every project that never chose.\n */\nexport const resolveLaunchEditor = (\n configured: string | undefined,\n override: SettingsOverride | undefined\n): KnownEditor | undefined =>\n toLaunchEditor(override?.sourceOverlayEditor ?? configured);\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
import type { FeatureSettings, SettingsOverride, TimelineEvent, TimelineLayer, TimelineLayersState } from '../../types/timeline.js';
|
|
6
|
+
import type { FeatureSettings, OverrideBaselines, SettingsOverride, TimelineEvent, TimelineLayer, TimelineLayersState } from '../../types/timeline.js';
|
|
7
7
|
import type { InspectorCommand, InspectorDetails, InspectorMessage, InspectorTreeNode } from '../../types/inspector.js';
|
|
8
8
|
import type { HmrIncompatibilityEvent } from '../../types/hmr-incompatibility.js';
|
|
9
9
|
import type { ComponentRollup, UpdateCycle } from '../timeline/derive.js';
|
|
@@ -21,9 +21,8 @@ export declare const TIMELINE_STREAM_NAME = "timeline";
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const TIMELINE_STREAM_ID = "live";
|
|
23
23
|
/**
|
|
24
|
-
* Cap on the node-side recent-events ring buffer
|
|
25
|
-
*
|
|
26
|
-
* comparable history.
|
|
24
|
+
* Cap on the node-side recent-events ring buffer. It is also the history a
|
|
25
|
+
* (re)connecting panel is seeded with (see {@link RPC_TIMELINE_HISTORY}).
|
|
27
26
|
*/
|
|
28
27
|
export declare const RECENT_EVENTS_BUFFER_SIZE = 512;
|
|
29
28
|
/** Bare (unscoped) name of the `get-meta` query. */
|
|
@@ -34,6 +33,13 @@ export declare const RPC_LIST_COMPONENTS = "list-components";
|
|
|
34
33
|
export declare const RPC_COMPONENT_DETAILS = "component-details";
|
|
35
34
|
/** Bare name of the `recent-events` query. */
|
|
36
35
|
export declare const RPC_RECENT_EVENTS = "recent-events";
|
|
36
|
+
/**
|
|
37
|
+
* Bare name of the `timeline-history` query: the node's whole recent-events
|
|
38
|
+
* buffer, oldest first, as `TimelineEvent[]`. What a live panel seeds itself
|
|
39
|
+
* with on connect, since the stream only carries events from then on. Not
|
|
40
|
+
* `recent-events`, whose live answer is filtered and capped for agents.
|
|
41
|
+
*/
|
|
42
|
+
export declare const RPC_TIMELINE_HISTORY = "timeline-history";
|
|
37
43
|
/** Bare name of the `update-summary` query. */
|
|
38
44
|
export declare const RPC_UPDATE_SUMMARY = "update-summary";
|
|
39
45
|
/** Bare name of the `inspect` action. */
|
|
@@ -86,6 +92,18 @@ export declare const RPC_INSPECTOR_MESSAGE = "inspector-message";
|
|
|
86
92
|
export declare const RPC_HMR_INCOMPATIBILITIES = "hmr-incompatibilities";
|
|
87
93
|
/** Bare name of the `hmr-incompatible` client (node → panel) event. */
|
|
88
94
|
export declare const RPC_HMR_INCOMPATIBLE = "hmr-incompatible";
|
|
95
|
+
/**
|
|
96
|
+
* Bare name of the page-to-server event. A page runtime that is not on a Vite
|
|
97
|
+
* dev server's HMR socket sends every channel message it would have sent over
|
|
98
|
+
* `import.meta.hot` as `page-send(channel, data)`.
|
|
99
|
+
*/
|
|
100
|
+
export declare const RPC_PAGE_SEND = "page-send";
|
|
101
|
+
/**
|
|
102
|
+
* Bare name of the server-to-page client event, the reverse direction of
|
|
103
|
+
* {@link RPC_PAGE_SEND}: `page-receive(channel, data)`. Broadcast to every
|
|
104
|
+
* connected client and marked optional, since the panel does not register it.
|
|
105
|
+
*/
|
|
106
|
+
export declare const RPC_PAGE_RECEIVE = "page-receive";
|
|
89
107
|
/**
|
|
90
108
|
* Recording/layers snapshot shared between every surface (panel, page
|
|
91
109
|
* runtime, MCP). Survives reconnect; mutated either by the `set-recording` /
|
|
@@ -187,6 +205,7 @@ declare module 'devframe' {
|
|
|
187
205
|
'lit:list-components': () => Promise<InspectorTreeNode[]>;
|
|
188
206
|
'lit:component-details': (args: ComponentDetailsArgs) => Promise<InspectorDetails | null>;
|
|
189
207
|
'lit:recent-events': (args?: RecentEventsArgs) => Promise<RecentEventsResult>;
|
|
208
|
+
'lit:timeline-history': () => Promise<TimelineEvent[]>;
|
|
190
209
|
'lit:update-summary': (args?: UpdateSummaryArgs) => Promise<UpdateSummaryResult>;
|
|
191
210
|
'lit:inspect': (command: InspectorCommand) => Promise<void>;
|
|
192
211
|
'lit:set-recording': (args: SetRecordingArgs) => Promise<void>;
|
|
@@ -195,10 +214,12 @@ declare module 'devframe' {
|
|
|
195
214
|
'lit:open-source': (args: OpenSourceArgs) => Promise<OpenSourceResult>;
|
|
196
215
|
'lit:export-snapshot': (args: ExportSnapshotArgs) => Promise<ExportSnapshotResult>;
|
|
197
216
|
'lit:hmr-incompatibilities': () => Promise<HmrIncompatibilityEvent[]>;
|
|
217
|
+
'lit:page-send': (channel: string, data?: unknown) => void;
|
|
198
218
|
}
|
|
199
219
|
interface DevframeRpcClientFunctions {
|
|
200
220
|
'lit:inspector-message': (message: InspectorMessage) => void;
|
|
201
221
|
'lit:hmr-incompatible': (event: HmrIncompatibilityEvent) => void;
|
|
222
|
+
'lit:page-receive': (channel: string, data?: unknown) => void;
|
|
202
223
|
}
|
|
203
224
|
interface DevframeSettingsRegistry {
|
|
204
225
|
lit: {
|
|
@@ -212,6 +233,12 @@ declare module 'devframe' {
|
|
|
212
233
|
* async by design.
|
|
213
234
|
*/
|
|
214
235
|
override?: SettingsOverride;
|
|
236
|
+
/**
|
|
237
|
+
* The config value each overridden key was set against. A sibling of
|
|
238
|
+
* `override` so the runtime never sees it. Mirrors
|
|
239
|
+
* `OVERRIDE_BASELINES_LS_KEY`.
|
|
240
|
+
*/
|
|
241
|
+
overrideBaselines?: OverrideBaselines;
|
|
215
242
|
};
|
|
216
243
|
}
|
|
217
244
|
}
|
|
@@ -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,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,KAAK,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAExE,iFAAiF;AACjF,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C;;;;;GAKG;AACH,eA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B,KACrB,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACnC,2BAA2B,EAAE,MAAM,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;QACtE,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;KAC5D;IAED,UAAU,0BAA0B;QAClC,uBAAuB,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;QAC7D,sBAAsB,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;QACjE,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;KAC/D;IAED,UAAU,wBAAwB;QAChC,GAAG,EAAE;YACH,8DAA8D;YAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;YACvC;;;;;;eAMG;YACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;YAC5B;;;;eAIG;YACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;SACvC,CAAC;KACH;CACF"}
|
package/lib/devframe/protocol.js
CHANGED
|
@@ -26,9 +26,8 @@ export const TIMELINE_STREAM_NAME = 'timeline';
|
|
|
26
26
|
*/
|
|
27
27
|
export const TIMELINE_STREAM_ID = 'live';
|
|
28
28
|
/**
|
|
29
|
-
* Cap on the node-side recent-events ring buffer
|
|
30
|
-
*
|
|
31
|
-
* comparable history.
|
|
29
|
+
* Cap on the node-side recent-events ring buffer. It is also the history a
|
|
30
|
+
* (re)connecting panel is seeded with (see {@link RPC_TIMELINE_HISTORY}).
|
|
32
31
|
*/
|
|
33
32
|
export const RECENT_EVENTS_BUFFER_SIZE = 512;
|
|
34
33
|
/** Bare (unscoped) name of the `get-meta` query. */
|
|
@@ -39,6 +38,13 @@ export const RPC_LIST_COMPONENTS = 'list-components';
|
|
|
39
38
|
export const RPC_COMPONENT_DETAILS = 'component-details';
|
|
40
39
|
/** Bare name of the `recent-events` query. */
|
|
41
40
|
export const RPC_RECENT_EVENTS = 'recent-events';
|
|
41
|
+
/**
|
|
42
|
+
* Bare name of the `timeline-history` query: the node's whole recent-events
|
|
43
|
+
* buffer, oldest first, as `TimelineEvent[]`. What a live panel seeds itself
|
|
44
|
+
* with on connect, since the stream only carries events from then on. Not
|
|
45
|
+
* `recent-events`, whose live answer is filtered and capped for agents.
|
|
46
|
+
*/
|
|
47
|
+
export const RPC_TIMELINE_HISTORY = 'timeline-history';
|
|
42
48
|
/** Bare name of the `update-summary` query. */
|
|
43
49
|
export const RPC_UPDATE_SUMMARY = 'update-summary';
|
|
44
50
|
/** Bare name of the `inspect` action. */
|
|
@@ -59,6 +65,18 @@ export const RPC_INSPECTOR_MESSAGE = 'inspector-message';
|
|
|
59
65
|
export const RPC_HMR_INCOMPATIBILITIES = 'hmr-incompatibilities';
|
|
60
66
|
/** Bare name of the `hmr-incompatible` client (node → panel) event. */
|
|
61
67
|
export const RPC_HMR_INCOMPATIBLE = 'hmr-incompatible';
|
|
68
|
+
/**
|
|
69
|
+
* Bare name of the page-to-server event. A page runtime that is not on a Vite
|
|
70
|
+
* dev server's HMR socket sends every channel message it would have sent over
|
|
71
|
+
* `import.meta.hot` as `page-send(channel, data)`.
|
|
72
|
+
*/
|
|
73
|
+
export const RPC_PAGE_SEND = 'page-send';
|
|
74
|
+
/**
|
|
75
|
+
* Bare name of the server-to-page client event, the reverse direction of
|
|
76
|
+
* {@link RPC_PAGE_SEND}: `page-receive(channel, data)`. Broadcast to every
|
|
77
|
+
* connected client and marked optional, since the panel does not register it.
|
|
78
|
+
*/
|
|
79
|
+
export const RPC_PAGE_RECEIVE = 'page-receive';
|
|
62
80
|
export const DEFAULT_SESSION_STATE = {
|
|
63
81
|
layers: DEFAULT_LAYERS_STATE,
|
|
64
82
|
customLayers: [],
|