@oddsquad/vite-plugin-lit 0.3.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 +118 -0
- package/README.md +26 -11
- package/bin.mjs +16 -12
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js → browser-agent-rpc-BXhoSh1z-CRHFLjFo.js} +2 -2
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js.map → browser-agent-rpc-BXhoSh1z-CRHFLjFo.js.map} +1 -1
- package/dist/client/assets/flow-DK8vmxvN.js +745 -0
- package/dist/client/assets/flow-DK8vmxvN.js.map +1 -0
- package/dist/client/assets/{index-CFrVgNfS.js → index-Gn4Hk_9s.js} +2749 -793
- 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 +22 -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 -8
- package/lib/devframe/vite.js.map +1 -1
- package/lib/options.d.ts +136 -0
- package/lib/options.d.ts.map +1 -0
- package/lib/options.js +175 -0
- package/lib/options.js.map +1 -0
- 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 +6 -148
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +22 -477
- package/lib/plugin.js.map +1 -1
- package/lib/plugins/css-literals.d.ts +15 -0
- package/lib/plugins/css-literals.d.ts.map +1 -0
- package/lib/plugins/css-literals.js +154 -0
- package/lib/plugins/css-literals.js.map +1 -0
- package/lib/plugins/css-queries.d.ts +20 -0
- package/lib/plugins/css-queries.d.ts.map +1 -0
- package/lib/plugins/css-queries.js +139 -0
- package/lib/plugins/css-queries.js.map +1 -0
- package/lib/plugins/open-in-editor.d.ts +16 -0
- package/lib/plugins/open-in-editor.d.ts.map +1 -0
- package/lib/plugins/open-in-editor.js +96 -0
- package/lib/plugins/open-in-editor.js.map +1 -0
- package/lib/plugins/shared.d.ts +13 -0
- package/lib/plugins/shared.d.ts.map +1 -0
- package/lib/plugins/shared.js +23 -0
- package/lib/plugins/shared.js.map +1 -0
- package/lib/plugins/timeline-virtual.d.ts +19 -0
- package/lib/plugins/timeline-virtual.d.ts.map +1 -0
- package/lib/plugins/timeline-virtual.js +53 -0
- package/lib/plugins/timeline-virtual.js.map +1 -0
- package/lib/runtime/css.d.ts.map +1 -1
- package/lib/runtime/css.js +9 -2
- package/lib/runtime/css.js.map +1 -1
- package/lib/runtime/indicator.js.map +1 -1
- package/lib/runtime/inspector/install.js +65 -13
- 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 +30 -7
- package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
- package/lib/runtime/timeline/install.js +25 -9
- package/lib/runtime/timeline/install.js.map +1 -1
- package/lib/runtime/timeline/public-api.d.ts +2 -2
- package/lib/runtime/timeline/public-api.d.ts.map +1 -1
- package/lib/runtime/timeline/public-api.js +13 -5
- package/lib/runtime/timeline/public-api.js.map +1 -1
- package/lib/runtime/timeline/render.d.ts +15 -6
- package/lib/runtime/timeline/render.d.ts.map +1 -1
- package/lib/runtime/timeline/render.js +150 -11
- package/lib/runtime/timeline/render.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 +9 -1
- package/types/timeline.d.ts +50 -1
- package/types/timeline.d.ts.map +1 -1
- package/types/timeline.js +4 -0
- package/types/timeline.js.map +1 -1
- package/dist/client/assets/index-CFrVgNfS.js.map +0 -1
- package/lib/timeline-plugin.d.ts +0 -72
- package/lib/timeline-plugin.d.ts.map +0 -1
- package/lib/timeline-plugin.js +0 -359
- package/lib/timeline-plugin.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,124 @@
|
|
|
3
3
|
Notable changes per release. Versions before 0.3.0 predate this file; see the
|
|
4
4
|
git history for those.
|
|
5
5
|
|
|
6
|
+
## 0.5.0 — 2026-09-29
|
|
7
|
+
|
|
8
|
+
The timeline gets a second view: Tracks, one lane per layer on a shared time
|
|
9
|
+
axis. The Settings tab now says where each value came from and flags overrides
|
|
10
|
+
the config has since moved past. Timeline events can be linked to, a reloaded
|
|
11
|
+
panel keeps what was recorded, and both the panel and the in-page overlay open
|
|
12
|
+
source links in the editor you picked.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Tracks view for the timeline.** A List | Tracks switch in the Timeline
|
|
17
|
+
toolbar draws the recording as one horizontal lane per layer on a shared time
|
|
18
|
+
axis, so concurrency, gaps and rhythm are visible: which layers fire
|
|
19
|
+
together, how a click lines up with the update it caused. Overlapping spans
|
|
20
|
+
stack, so an update tick reads as `performUpdate` with its phases beneath it,
|
|
21
|
+
and marks never get narrower than 2px. Wheel zooms around the pointer, drag
|
|
22
|
+
pans, double-click fits the whole recording, and a fitted view follows the
|
|
23
|
+
live edge while recording. A chip strip picks which lanes to draw; it is a
|
|
24
|
+
view filter, not the capture toggle. Both views share one selection and one
|
|
25
|
+
detail pane.
|
|
26
|
+
- **Where each setting came from.** Settings rows read like "Zed (env)",
|
|
27
|
+
"VS Code (default)" or "Cursor (option)". An overridden row names the
|
|
28
|
+
baseline it replaced and has its own reset. An unknown
|
|
29
|
+
`LIT_PLUGIN_SOURCE_OVERLAY_EDITOR` value now logs a warning and falls back to
|
|
30
|
+
the default.
|
|
31
|
+
- **A hint when the config moved under an override.** An override remembers
|
|
32
|
+
the value it was made against. If that config value has since changed, the
|
|
33
|
+
row says "Config changed since you overrode this: was X, now Y", with Reset
|
|
34
|
+
(let the new config apply) and Keep (hide the hint, keep the override).
|
|
35
|
+
- **Links to timeline events.** Selecting a row puts `#event=<id>` in the
|
|
36
|
+
hash; opening that link selects the span and scrolls it into view, in a live
|
|
37
|
+
session or an exported snapshot. An id the buffer no longer holds opens the
|
|
38
|
+
Timeline with nothing selected.
|
|
39
|
+
- **Temporal values in the inspector** preview as their kind plus ISO form,
|
|
40
|
+
e.g. `Temporal.PlainDate(2026-09-29)`, instead of an empty object. This works
|
|
41
|
+
with native Temporal and with polyfills.
|
|
42
|
+
- **The standalone `lit-devtools dev` server can be fed from a live page.** A
|
|
43
|
+
page calls `connectToDevServer()` (from `@oddsquad/vite-plugin-lit/connect.js`)
|
|
44
|
+
to send its tree, inspector and timeline traffic to the server's panel over
|
|
45
|
+
devframe RPC. `lit-devtools dev --no-auth` skips the one-time code. Pages not
|
|
46
|
+
served by Vite, and cross-origin pages, are not covered yet.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- **The timeline's element and regex filters apply to Tracks too**, so
|
|
51
|
+
switching views mid-investigation no longer brings back everything you
|
|
52
|
+
filtered out. A filter that hides the selected mark keeps its detail pane
|
|
53
|
+
open, as the List always did.
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- **A reloaded live panel keeps the recorded events.** Reloading or first
|
|
58
|
+
opening the panel mid-session used to show "No events recorded." while the
|
|
59
|
+
dev server still held them, and a cold `#event=` link could not resolve. The
|
|
60
|
+
panel now fills itself from the server's buffer when it connects, without
|
|
61
|
+
duplicates, and events you cleared stay cleared across a reload.
|
|
62
|
+
- **Source links open in the editor you chose.** The editor picked through
|
|
63
|
+
`sourceOverlay.editor`, `LIT_PLUGIN_SOURCE_OVERLAY_EDITOR` or the Settings
|
|
64
|
+
tab only shaped the overlay's URL scheme; clicks from the panel and the
|
|
65
|
+
in-page overlay let launch-editor guess, so picking Cursor could open VS
|
|
66
|
+
Code. Both now pass the chosen editor (`vscode`, `cursor`, `zed`, `idea`).
|
|
67
|
+
Windsurf, custom editors and projects that never named one still
|
|
68
|
+
auto-detect.
|
|
69
|
+
- **Exported snapshots contain the whole event buffer**, not the last 50
|
|
70
|
+
events, so every row in an export can be linked to.
|
|
71
|
+
- **A linked timeline row scrolls into view on a cold open** instead of
|
|
72
|
+
leaving the list pinned to its newest row.
|
|
73
|
+
- **The panel has a favicon**, so opening it in its own tab no longer logs a
|
|
74
|
+
404 for `/favicon.ico`.
|
|
75
|
+
|
|
76
|
+
## 0.4.0 — 2026-09-29
|
|
77
|
+
|
|
78
|
+
A maintenance release. The timeline panel stays fast with a full buffer, the
|
|
79
|
+
live inspector stops walking the whole page, and several failures that used to
|
|
80
|
+
pass silently now say so. Releases are published from CI now.
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
|
|
84
|
+
- **Verbose render layer.** lit-html's per-part debug events (template
|
|
85
|
+
instantiation, `set part`, each binding commit) go to a new "Lit Render
|
|
86
|
+
(verbose)" layer. It is off by default, because it fires once per binding on
|
|
87
|
+
every render. Values are summarized as strings (`string:"…"`, `node:<li>`,
|
|
88
|
+
`template`, `function:onClick`) and never passed through.
|
|
89
|
+
- **Releases from a version tag.** Pushing a `v*` tag runs the CI gate, checks
|
|
90
|
+
the tag against `package.json` and `CHANGELOG.md`, publishes to npm over
|
|
91
|
+
trusted publishing (OIDC), and creates the GitHub Release from the changelog
|
|
92
|
+
section. Prereleases go to the `next` dist-tag.
|
|
93
|
+
|
|
94
|
+
### Changed
|
|
95
|
+
|
|
96
|
+
- **The timeline list renders only the visible rows**, through
|
|
97
|
+
`@lit-labs/virtualizer`. A 2500-event recording keeps about 75 rows in the
|
|
98
|
+
DOM instead of one per event. Filtering reruns only when the events or
|
|
99
|
+
filters change.
|
|
100
|
+
- **Live inspector mode no longer re-walks the page on every mutation.**
|
|
101
|
+
Batches with no custom element or shadow root in them are dropped, and
|
|
102
|
+
relevant batches walk only the subtrees they added.
|
|
103
|
+
- **The docs site was rewritten** in plain language, with a tutorial, task-sized
|
|
104
|
+
DevTools guides, a troubleshooting page, screenshots in both themes, and the
|
|
105
|
+
Lit Design System's colours and type.
|
|
106
|
+
|
|
107
|
+
### Fixed
|
|
108
|
+
|
|
109
|
+
- The source overlay's default hotkey is Ctrl+Shift+S, as documented. The
|
|
110
|
+
runtime used to fall back to `e`, which also collided with the DevTools pick
|
|
111
|
+
command.
|
|
112
|
+
- The source overlay removes its HMR listeners when it disconnects. Moving the
|
|
113
|
+
element used to register the toggle twice, so the Vite DevTools overlay
|
|
114
|
+
command did nothing, and a removed overlay kept reacting.
|
|
115
|
+
- `urlSheet()` and `?css-sheet` warn when a stylesheet fails to load, and treat
|
|
116
|
+
non-ok responses as failures. A 404 used to hand Vite's fallback page to the
|
|
117
|
+
sheet as CSS, with a clean console. The sheet keeps its last good CSS.
|
|
118
|
+
- An unknown `LIT_PLUGIN_HMR_ON_INCOMPATIBLE` value logs a warning and falls
|
|
119
|
+
back to the default, instead of quietly acting as `reload`.
|
|
120
|
+
- The Lightning CSS pass over `css` literals finds them by parsing the module,
|
|
121
|
+
so `css`-tagged text inside a string, a comment, or another template literal
|
|
122
|
+
is no longer rewritten.
|
|
123
|
+
|
|
6
124
|
## 0.3.0 — 2026-09-17
|
|
7
125
|
|
|
8
126
|
The DevTools half of the plugin was rebuilt on
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ This plugin fixes that with two cooperating mechanisms:
|
|
|
26
26
|
re-executed module patches the originally-registered class in place, then
|
|
27
27
|
restores reactive property values through the new accessors.
|
|
28
28
|
|
|
29
|
-
[How it works →](https://oddcelot.github.io/vite-plugin-lit/
|
|
29
|
+
[How it works →](https://oddcelot.github.io/vite-plugin-lit/concepts/how-hmr-works/)
|
|
30
30
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
@@ -51,7 +51,7 @@ CSS literal processing apply in both dev and build.
|
|
|
51
51
|
- **[Stylesheets at scale](https://oddcelot.github.io/vite-plugin-lit/guides/stylesheets/)**
|
|
52
52
|
— one shared `CSSStyleSheet` for thousands of shadow roots, hot-swapped
|
|
53
53
|
without re-rendering, from a bare `?css-sheet` import.
|
|
54
|
-
- **[DevTools timeline](https://oddcelot.github.io/vite-plugin-lit/guides/devtools
|
|
54
|
+
- **[DevTools timeline](https://oddcelot.github.io/vite-plugin-lit/guides/devtools/)**
|
|
55
55
|
— a layered event recorder and live component inspector inside Vite DevTools.
|
|
56
56
|
- **[Source overlay](https://oddcelot.github.io/vite-plugin-lit/guides/source-overlay/)**
|
|
57
57
|
— click any element in the page to open its source in your editor.
|
|
@@ -65,15 +65,18 @@ Reference:
|
|
|
65
65
|
[environment variables](https://oddcelot.github.io/vite-plugin-lit/reference/environment-variables/) ·
|
|
66
66
|
[import queries](https://oddcelot.github.io/vite-plugin-lit/reference/import-queries/) ·
|
|
67
67
|
[runtime API](https://oddcelot.github.io/vite-plugin-lit/reference/runtime-api/) ·
|
|
68
|
+
[CLI](https://oddcelot.github.io/vite-plugin-lit/reference/cli/) ·
|
|
68
69
|
[limitations](https://oddcelot.github.io/vite-plugin-lit/reference/limitations/) ·
|
|
69
|
-
[
|
|
70
|
+
[compatibility](https://oddcelot.github.io/vite-plugin-lit/reference/compatibility/) ·
|
|
71
|
+
[benchmarks](https://oddcelot.github.io/vite-plugin-lit/reference/benchmarks/) ·
|
|
72
|
+
[troubleshooting](https://oddcelot.github.io/vite-plugin-lit/guides/troubleshooting/)
|
|
70
73
|
|
|
71
74
|
## Coding agents (MCP)
|
|
72
75
|
|
|
73
76
|
The DevTools panel's data is also exposed as MCP tools — `lit_list-components`,
|
|
74
|
-
`lit_component-details`, `
|
|
75
|
-
`lit_hmr-incompatibilities`, `lit_set-recording` — so an agent
|
|
76
|
-
live component tree and timeline instead of guessing from source.
|
|
77
|
+
`lit_component-details`, `lit_update-summary`, `lit_recent-events`,
|
|
78
|
+
`lit_get-meta`, `lit_hmr-incompatibilities`, `lit_set-recording` — so an agent
|
|
79
|
+
can read the live component tree and timeline instead of guessing from source.
|
|
77
80
|
|
|
78
81
|
These answer only while a Vite dev server with DevTools is **running**. There
|
|
79
82
|
is no stored data and nothing to go stale: with the server down an agent gets
|
|
@@ -115,11 +118,22 @@ The two differ in how the server is found, not in what it can do:
|
|
|
115
118
|
discovery at all. Reach for it if registry discovery is unavailable — the
|
|
116
119
|
plugin logs a warning saying so at startup, naming the reason.
|
|
117
120
|
|
|
118
|
-
The CLI also has `lit-devtools dev`, a standalone devframe server
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
The CLI also has `lit-devtools dev`, a standalone devframe server. Started on
|
|
122
|
+
its own it shows an empty panel, because it has no page of its own. A page
|
|
123
|
+
served by a Vite dev server that loads this plugin's runtime can point itself
|
|
124
|
+
at it and feed it the live component tree, inspector and timeline:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import {connectToDevServer} from '@oddsquad/vite-plugin-lit/connect.js';
|
|
128
|
+
|
|
129
|
+
await connectToDevServer('http://localhost:5180/');
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The server asks for its one-time code unless you start it with `--no-auth`. What
|
|
133
|
+
this does not do yet: put the runtime into a page that is not on a Vite dev
|
|
134
|
+
server, and set up the cross-origin access and authentication a page on another
|
|
135
|
+
origin needs. The dev server's `__connection.json` sends no CORS headers today,
|
|
136
|
+
so from a different origin the connection is blocked by the browser.
|
|
123
137
|
|
|
124
138
|
## Playground
|
|
125
139
|
|
|
@@ -135,6 +149,7 @@ pnpm dev # builds the plugin, then serves http://localhost:5179
|
|
|
135
149
|
## Development
|
|
136
150
|
|
|
137
151
|
Requires Node 26 and pnpm 12 (`corepack enable` picks up the pinned version).
|
|
152
|
+
The published package itself runs on Node 20 or newer.
|
|
138
153
|
|
|
139
154
|
```sh
|
|
140
155
|
pnpm install # workspace: root package + playground + docs
|
package/bin.mjs
CHANGED
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
import process from 'node:process';
|
|
34
|
-
import {
|
|
35
|
-
import {createNullSource} from './lib/devframe/source.js';
|
|
34
|
+
import {createStandaloneLitDevframe} from './lib/devframe/rpc-source.js';
|
|
36
35
|
import {PACKAGE_VERSION} from './lib/devframe/paths.js';
|
|
37
36
|
|
|
38
37
|
/**
|
|
@@ -62,25 +61,30 @@ const main = async () => {
|
|
|
62
61
|
const cli = cac('lit-devtools');
|
|
63
62
|
|
|
64
63
|
cli
|
|
65
|
-
.command(
|
|
64
|
+
.command(
|
|
65
|
+
'dev',
|
|
66
|
+
'Start a standalone devframe dev server that pages connect to'
|
|
67
|
+
)
|
|
66
68
|
.option('--port <port>', 'Port to listen on', {default: DEFAULT_DEV_PORT})
|
|
67
69
|
.option('--host <host>', 'Host to bind to', {default: 'localhost'})
|
|
68
70
|
.option('--open', 'Open the browser on start')
|
|
71
|
+
.option(
|
|
72
|
+
'--no-auth',
|
|
73
|
+
'Skip the one-time-code gate, so a page can connect without a token'
|
|
74
|
+
)
|
|
69
75
|
.action(async (flags) => {
|
|
70
76
|
const {createDevServer} = await import('devframe/adapters/dev');
|
|
71
|
-
// A standalone server has no Vite
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
77
|
+
// A standalone server has no Vite, so it has no page of its own: the
|
|
78
|
+
// panel stays empty until a page dials in with `connectToDevServer()`
|
|
79
|
+
// (see `lib/runtime/rpc-transport.ts`), which carries the runtime's
|
|
80
|
+
// usual channels over devframe RPC. Injecting the runtime into a page
|
|
81
|
+
// that is not on a Vite dev server is not something this command does.
|
|
75
82
|
await createDevServer(
|
|
76
|
-
|
|
77
|
-
source: createNullSource(),
|
|
78
|
-
version: PACKAGE_VERSION,
|
|
79
|
-
}),
|
|
83
|
+
createStandaloneLitDevframe({version: PACKAGE_VERSION}),
|
|
80
84
|
{
|
|
81
85
|
host: flags.host,
|
|
82
86
|
port: Number(flags.port),
|
|
83
|
-
flags: {open: Boolean(flags.open)},
|
|
87
|
+
flags: {open: Boolean(flags.open), auth: flags.auth},
|
|
84
88
|
}
|
|
85
89
|
);
|
|
86
90
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as onBrowserAgentToolsChanged, r as nanoid, t as listBrowserAgentTools } from "./index-
|
|
1
|
+
import { n as onBrowserAgentToolsChanged, r as nanoid, t as listBrowserAgentTools } from "./index-Gn4Hk_9s.js";
|
|
2
2
|
//#region node_modules/.pnpm/devframe@1.0.0_@devframes+agentic@1.0.0_cac@7.0.0_srvx@1.0.5/node_modules/devframe/dist/browser-agent-rpc-BXhoSh1z.mjs
|
|
3
3
|
var CLIENT_ID_STORAGE_KEY = "devframe:client-id";
|
|
4
4
|
var memoryClientId;
|
|
@@ -66,4 +66,4 @@ function setupBrowserAgentRpcBridge(rpc) {
|
|
|
66
66
|
//#endregion
|
|
67
67
|
export { setupBrowserAgentRpcBridge };
|
|
68
68
|
|
|
69
|
-
//# sourceMappingURL=browser-agent-rpc-BXhoSh1z-
|
|
69
|
+
//# sourceMappingURL=browser-agent-rpc-BXhoSh1z-CRHFLjFo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-agent-rpc-BXhoSh1z-
|
|
1
|
+
{"version":3,"file":"browser-agent-rpc-BXhoSh1z-CRHFLjFo.js","names":[],"sources":["../../../node_modules/.pnpm/devframe@1.0.0_@devframes+agentic@1.0.0_cac@7.0.0_srvx@1.0.5/node_modules/devframe/dist/browser-agent-rpc-BXhoSh1z.mjs"],"sourcesContent":["import { nanoid } from \"./utils/nanoid.mjs\";\nimport { n as onBrowserAgentToolsChanged, t as listBrowserAgentTools } from \"./browser-agent-Pu-FLk6I.mjs\";\n//#region src/client/client-id.ts\nconst CLIENT_ID_STORAGE_KEY = \"devframe:client-id\";\nlet memoryClientId;\n/**\n* This browser tab's stable client id: one nanoid per tab, persisted in\n* `sessionStorage` so it survives page reloads and RPC reconnects. The node\n* side uses it to tell connected tabs apart across reconnects (see #394).\n*\n* Tab duplication copies `sessionStorage`, so two tabs can briefly share an id\n* until per-tab disambiguation lands with the wider tab-metadata work.\n*/\nfunction resolveClientId(win = globalThis.window) {\n\ttry {\n\t\tconst storage = win?.sessionStorage;\n\t\tif (storage) {\n\t\t\tlet id = storage.getItem(CLIENT_ID_STORAGE_KEY);\n\t\t\tif (!id) {\n\t\t\t\tid = nanoid();\n\t\t\t\tstorage.setItem(CLIENT_ID_STORAGE_KEY, id);\n\t\t\t}\n\t\t\treturn id;\n\t\t}\n\t} catch {}\n\tmemoryClientId ??= nanoid();\n\treturn memoryClientId;\n}\n//#endregion\n//#region src/client/browser-agent-rpc.ts\n/** Mirror this document's browser-agent registry over its existing RPC connection. */\nfunction setupBrowserAgentRpcBridge(rpc) {\n\trpc.client.register({\n\t\tname: \"devframe:agent:invoke-client-tool\",\n\t\ttype: \"action\",\n\t\tjsonSerializable: true,\n\t\thandler: async (id, args) => {\n\t\t\tconst tool = listBrowserAgentTools().find((tool) => tool.id === id);\n\t\t\tif (!tool) throw new Error(`[devframe/agent] browser tool \"${id}\" not found`);\n\t\t\treturn await tool.invoke(args);\n\t\t}\n\t});\n\tlet queued = false;\n\tlet disposed = false;\n\tlet lastSyncedCount = 0;\n\tconst sync = () => {\n\t\tif (queued || disposed) return;\n\t\tqueued = true;\n\t\tqueueMicrotask(async () => {\n\t\t\tqueued = false;\n\t\t\tif (disposed) return;\n\t\t\tconst manifests = listBrowserAgentTools().map(({ invoke: _, ...manifest }) => manifest);\n\t\t\tif (manifests.length === 0 && lastSyncedCount === 0) return;\n\t\t\tlastSyncedCount = manifests.length;\n\t\t\tawait rpc.callOptional(\"devframe:agent:sync-client-tools\", resolveClientId(), manifests).catch(() => {});\n\t\t});\n\t};\n\tconst stopTools = onBrowserAgentToolsChanged(sync);\n\tconst stopConnection = rpc.events.on(\"connection:status\", (status) => {\n\t\tif (status === \"connected\") sync();\n\t});\n\tsync();\n\treturn () => {\n\t\tdisposed = true;\n\t\tstopTools();\n\t\tstopConnection();\n\t};\n}\n//#endregion\nexport { setupBrowserAgentRpcBridge };\n"],"x_google_ignoreList":[0],"mappings":";;AAGA,IAAM,wBAAwB;AAC9B,IAAI;;;;;;;;;AASJ,SAAS,gBAAgB,MAAM,WAAW,QAAQ;CACjD,IAAI;EACH,MAAM,UAAU,KAAK;EACrB,IAAI,SAAS;GACZ,IAAI,KAAK,QAAQ,QAAQ,qBAAqB;GAC9C,IAAI,CAAC,IAAI;IACR,KAAK,OAAO;IACZ,QAAQ,QAAQ,uBAAuB,EAAE;GAC1C;GACA,OAAO;EACR;CACD,QAAQ,CAAC;CACT,mBAAmB,OAAO;CAC1B,OAAO;AACR;;AAIA,SAAS,2BAA2B,KAAK;CACxC,IAAI,OAAO,SAAS;EACnB,MAAM;EACN,MAAM;EACN,kBAAkB;EAClB,SAAS,OAAO,IAAI,SAAS;GAC5B,MAAM,OAAO,sBAAsB,CAAC,CAAC,MAAM,SAAS,KAAK,OAAO,EAAE;GAClE,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,kCAAkC,GAAG,YAAY;GAC5E,OAAO,MAAM,KAAK,OAAO,IAAI;EAC9B;CACD,CAAC;CACD,IAAI,SAAS;CACb,IAAI,WAAW;CACf,IAAI,kBAAkB;CACtB,MAAM,aAAa;EAClB,IAAI,UAAU,UAAU;EACxB,SAAS;EACT,eAAe,YAAY;GAC1B,SAAS;GACT,IAAI,UAAU;GACd,MAAM,YAAY,sBAAsB,CAAC,CAAC,KAAK,EAAE,QAAQ,GAAG,GAAG,eAAe,QAAQ;GACtF,IAAI,UAAU,WAAW,KAAK,oBAAoB,GAAG;GACrD,kBAAkB,UAAU;GAC5B,MAAM,IAAI,aAAa,oCAAoC,gBAAgB,GAAG,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;EACxG,CAAC;CACF;CACA,MAAM,YAAY,2BAA2B,IAAI;CACjD,MAAM,iBAAiB,IAAI,OAAO,GAAG,sBAAsB,WAAW;EACrE,IAAI,WAAW,aAAa,KAAK;CAClC,CAAC;CACD,KAAK;CACL,aAAa;EACZ,WAAW;EACX,UAAU;EACV,eAAe;CAChB;AACD"}
|