@vue/devtools-kit 9.0.0-beta.1 → 9.0.0-rc.2

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.
@@ -1,4 +1,3 @@
1
- import { CreatePageScriptChannelOptions, PageScriptChannel } from "devframe/in-page-channel";
2
1
  //#region src/runtime/budget.d.ts
3
2
  interface RuntimeBudget {
4
3
  components: {
@@ -140,6 +139,9 @@ type EncodedValue = {
140
139
  handle: ValueHandle;
141
140
  };
142
141
  interface ValueCodecOptions {
142
+ /** Offset within the root collection; nested previews always start at zero. */
143
+ entryOffset?: number;
144
+ entryKeys?: string[];
143
145
  maxDepth?: number;
144
146
  maxEntries?: number;
145
147
  maxStringLength?: number;
@@ -148,8 +150,31 @@ interface ValueCodecOptions {
148
150
  handleScope?: string;
149
151
  }
150
152
  declare function encodeValue(value: unknown, options?: ValueCodecOptions): EncodedValue;
153
+ declare function safeOwnEnumerableStringKeys(value: object): string[];
151
154
  declare function formatPreviewKey(value: unknown): string;
152
155
  //#endregion
156
+ //#region src/plugin/settings.d.ts
157
+ interface PluginSettingsChange {
158
+ key: string;
159
+ value: unknown;
160
+ oldValue: unknown;
161
+ settings: Record<string, unknown>;
162
+ }
163
+ /**
164
+ * Setting values for one plugin id. Adapters that register the same id for several apps
165
+ * share one instance, so a change reaches every app's `setPluginSettings` handlers.
166
+ */
167
+ declare class PluginSettings {
168
+ private readonly descriptor;
169
+ private values;
170
+ private readonly listeners;
171
+ constructor(descriptor: PluginDescriptor);
172
+ get(): Record<string, unknown>;
173
+ sync(): void;
174
+ subscribe(listener: (change: PluginSettingsChange) => Promise<void>): () => void;
175
+ update(key: string, value: unknown): Promise<void>;
176
+ }
177
+ //#endregion
153
178
  //#region src/plugin/api.d.ts
154
179
  interface PluginDescriptor {
155
180
  id: PluginId;
@@ -321,7 +346,7 @@ interface PluginApiAdapter {
321
346
  clearHooks(): void;
322
347
  callHook<K extends keyof DevToolsPluginAPIHooks>(key: K, payload: Parameters<DevToolsPluginAPIHooks[K]>[0]): Promise<void>;
323
348
  }
324
- declare function createPluginApiAdapter(descriptor: PluginDescriptor, runtime: DevtoolsRuntime, resolvePluginSettings?: (pluginId: string) => Record<string, unknown> | undefined): PluginApiAdapter;
349
+ declare function createPluginApiAdapter(descriptor: PluginDescriptor, runtime: DevtoolsRuntime, resolvePluginSettings?: (pluginId: string) => Record<string, unknown> | undefined, settings?: PluginSettings): PluginApiAdapter;
325
350
  declare function reportPluginError(pluginId: PluginId, context: string, error: unknown): void;
326
351
  //#endregion
327
352
  //#region src/protocol/messages.d.ts
@@ -371,7 +396,20 @@ interface ComponentTreeSnapshotMessage {
371
396
  version?: number;
372
397
  nodes: ComponentTreeNodeSnapshot[];
373
398
  }
399
+ interface StatePageOptions {
400
+ page?: number;
401
+ pageSize?: number;
402
+ snapshotId?: string;
403
+ }
404
+ interface StatePagination {
405
+ total: number;
406
+ pageSize: number;
407
+ current: number;
408
+ next: number | null;
409
+ }
374
410
  interface ComponentStateSnapshotMessage {
411
+ snapshotId?: string;
412
+ pagination?: StatePagination;
375
413
  componentId: ComponentId;
376
414
  version: number;
377
415
  sections: ComponentStateSection[];
@@ -412,6 +450,8 @@ interface ReactivityGraphSnapshot {
412
450
  relationships: ReactivityRelationship[];
413
451
  }
414
452
  interface ExpandedValueMessage {
453
+ snapshotId?: string;
454
+ pagination?: StatePagination;
415
455
  handle: string;
416
456
  path: string[];
417
457
  value: EncodedValue;
@@ -480,6 +520,16 @@ interface RouterSnapshotMessage {
480
520
  currentRoute?: RouterRouteSnapshot;
481
521
  routes: RouterRouteRecordSnapshot[];
482
522
  }
523
+ /** A missing path is distinct from a present null or undefined value. */
524
+ type StateValueMessage = {
525
+ found: false;
526
+ } | {
527
+ found: true;
528
+ value: EncodedValue;
529
+ editable: boolean;
530
+ snapshotId?: string;
531
+ pagination?: StatePagination;
532
+ };
483
533
  //#endregion
484
534
  //#region src/protocol/patches.d.ts
485
535
  type ComponentTreePatch = {
@@ -740,6 +790,7 @@ declare class RuntimeRegistry {
740
790
  toAppSnapshot(record: AppRecord): AppSnapshot;
741
791
  toComponentSnapshot(record: ComponentRecord): ComponentSnapshot;
742
792
  }
793
+ declare function readComponentName(instance: object): string;
743
794
  //#endregion
744
795
  //#region src/runtime/inspectors.d.ts
745
796
  interface RuntimeInspectorAction {
@@ -817,6 +868,8 @@ interface StateEdit {
817
868
  value?: unknown;
818
869
  remove?: boolean;
819
870
  newKey?: string;
871
+ /** Reject the edit unless the path exists and is editable, as reported by the stateValue query. */
872
+ requireEditable?: boolean;
820
873
  }
821
874
  /** Built-in request contracts. Extend these interfaces to type additional registered methods. */
822
875
  interface RuntimeQueryMap {
@@ -845,6 +898,12 @@ interface RuntimeQueryMap {
845
898
  } | undefined;
846
899
  result: ComponentTreeSnapshotMessage;
847
900
  };
901
+ 'components:search': {
902
+ payload: {
903
+ filter: string;
904
+ };
905
+ result: ComponentTreeSnapshotMessage;
906
+ };
848
907
  'components:treeChildren': {
849
908
  payload: {
850
909
  componentId: string;
@@ -856,9 +915,27 @@ interface RuntimeQueryMap {
856
915
  payload: {
857
916
  componentId: string;
858
917
  maxEntries?: number;
859
- };
918
+ maxPreviewEntries?: number;
919
+ } & StatePageOptions;
860
920
  result: ComponentStateSnapshotMessage | undefined;
861
921
  };
922
+ 'components:stateValue': {
923
+ payload: {
924
+ componentId: string;
925
+ sectionId: string;
926
+ path: string[];
927
+ } & StatePageOptions;
928
+ result: StateValueMessage;
929
+ };
930
+ 'inspectors:stateValue': {
931
+ payload: {
932
+ inspectorId: string;
933
+ nodeId: string;
934
+ sectionId: string;
935
+ path: string[];
936
+ } & StatePageOptions;
937
+ result: StateValueMessage;
938
+ };
862
939
  'components:inspect': {
863
940
  payload: undefined;
864
941
  result: ComponentInspectionResultMessage | undefined;
@@ -896,7 +973,7 @@ interface RuntimeQueryMap {
896
973
  payload: {
897
974
  inspectorId: string;
898
975
  nodeId: string;
899
- };
976
+ } & StatePageOptions;
900
977
  result: ComponentStateSnapshotMessage | undefined;
901
978
  };
902
979
  'router:snapshot': {
@@ -918,8 +995,10 @@ interface RuntimeQueryMap {
918
995
  handle: string;
919
996
  path?: string[];
920
997
  maxEntries?: number;
921
- };
922
- result: ExpandedValueMessage | undefined;
998
+ } & StatePageOptions;
999
+ result: ExpandedValueMessage | {
1000
+ found: false;
1001
+ } | undefined;
923
1002
  };
924
1003
  'values:storeAsGlobal': {
925
1004
  payload: {
@@ -1071,6 +1150,7 @@ declare class ComponentTreeStore {
1071
1150
  constructor(registry: RuntimeRegistry, budget: RuntimeBudget['components']);
1072
1151
  syncApp(app: AppRecord): ComponentTreePatchBatch | undefined;
1073
1152
  apply(event: RuntimeEvent, record?: ComponentRecord): ComponentTreePatchBatch | undefined;
1153
+ search(appId: AppId | undefined, needle: string, limit?: number): ComponentTreeSnapshot;
1074
1154
  snapshot(appId?: AppId): ComponentTreeSnapshot;
1075
1155
  expand(appId: AppId, componentId: ComponentId): ComponentTreePatchBatch | undefined;
1076
1156
  readChildrenPage(appId: AppId, componentId: ComponentId, cursor: string | undefined, maxMessageBytes: number): ComponentTreePageMessage;
@@ -1132,6 +1212,7 @@ interface LegacyComponentStateEntry {
1132
1212
  declare class ComponentStateCollector {
1133
1213
  private readonly registry;
1134
1214
  private readonly budget;
1215
+ private pages;
1135
1216
  private handles;
1136
1217
  private handleScopes;
1137
1218
  private versions;
@@ -1148,21 +1229,34 @@ declare class ComponentStateCollector {
1148
1229
  beginStateScope(scope: string): string;
1149
1230
  invalidate(componentId: ComponentId): number;
1150
1231
  hasSnapshot(componentId: ComponentId): boolean;
1151
- snapshot(componentId: ComponentId, maxEntries?: number): ComponentStateSnapshotMessage | undefined;
1152
- expand(handle: string, path?: string[], maxEntries?: number): ExpandedValueMessage | undefined;
1232
+ snapshot(componentId: ComponentId, maxEntries?: number, maxPreviewEntries?: number): ComponentStateSnapshotMessage | undefined;
1233
+ statePage(target: string, options: StatePageOptions, componentId: string, legacy?: LegacyComponentStateEntry[], initial?: ComponentStateSnapshotMessage): ComponentStateSnapshotMessage;
1234
+ expandPage(target: string, options: StatePageOptions, handle: string, path?: string[]): ExpandedValueMessage | {
1235
+ found: false;
1236
+ } | undefined;
1237
+ private valuePage;
1238
+ expand(handle: string, path?: string[], maxEntries?: number): ExpandedValueMessage | {
1239
+ found: false;
1240
+ } | undefined;
1153
1241
  getHandleValue(handle: string): object | undefined;
1154
1242
  resolveEntryValue(componentId: ComponentId, sectionId: string, path: string[]): {
1155
1243
  found: boolean;
1156
1244
  value?: unknown;
1157
1245
  };
1246
+ readStateValue(componentId: ComponentId, sectionId: string, path: string[], options?: StatePageOptions): StateValueMessage;
1247
+ readStatePath(source: object, path: string[], scope: string, editable: boolean, options?: StatePageOptions, target?: string): StateValueMessage;
1158
1248
  /** `triggerRef` the live computed for this state path. */
1159
1249
  recompute(componentId: ComponentId, sectionId: string, path: string[]): boolean;
1160
1250
  edit(componentId: ComponentId, sectionId: string, path: string[], value: unknown, newKey?: string): boolean;
1161
1251
  delete(componentId: ComponentId, sectionId: string, path: string[]): boolean;
1162
1252
  add(componentId: ComponentId, sectionId: string, path: string[], value: unknown): boolean;
1163
- appendLegacyEntries(snapshot: ComponentStateSnapshotMessage, entries: LegacyComponentStateEntry[]): void;
1253
+ appendLegacyEntries(snapshot: ComponentStateSnapshotMessage, entries: LegacyComponentStateEntry[], limits?: {
1254
+ maxEntries?: number;
1255
+ maxPreviewEntries?: number;
1256
+ }): void;
1164
1257
  executeCustomAction(handle: string, actionIndex: number): Promise<boolean>;
1165
1258
  clear(): void;
1259
+ private encodePluginStateEntry;
1166
1260
  private encodeStateValue;
1167
1261
  private collectSection;
1168
1262
  private collectReactivityGraph;
@@ -1399,6 +1493,447 @@ interface ConnectDevtoolsClientOptions {
1399
1493
  declare function connectDevtoolsClient(options?: ConnectDevtoolsClientOptions): DevtoolsRpcClient;
1400
1494
  declare function getDefaultDevtoolsClientHosts(options?: ConnectDevtoolsClientOptions): DevtoolsClientHost[];
1401
1495
  //#endregion
1496
+ //#region ../../node_modules/.pnpm/devframe@1.1.0_@devframes+agentic@1.1.0_cac@7.0.0_srvx@1.0.4/node_modules/devframe/dist/index-CeEtxDmK.d.mts
1497
+ //#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
1498
+ /** The Standard Typed interface. This is a base type extended by other specs. */
1499
+ interface StandardTypedV1<Input = unknown, Output = Input> {
1500
+ /** The Standard properties. */
1501
+ readonly "~standard": StandardTypedV1.Props<Input, Output>;
1502
+ }
1503
+ declare namespace StandardTypedV1 {
1504
+ /** The Standard Typed properties interface. */
1505
+ interface Props<Input = unknown, Output = Input> {
1506
+ /** The version number of the standard. */
1507
+ readonly version: 1;
1508
+ /** The vendor name of the schema library. */
1509
+ readonly vendor: string;
1510
+ /** Inferred types associated with the schema. */
1511
+ readonly types?: Types<Input, Output> | undefined;
1512
+ }
1513
+ /** The Standard Typed types interface. */
1514
+ interface Types<Input = unknown, Output = Input> {
1515
+ /** The input type of the schema. */
1516
+ readonly input: Input;
1517
+ /** The output type of the schema. */
1518
+ readonly output: Output;
1519
+ }
1520
+ /** Infers the input type of a Standard Typed. */
1521
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
1522
+ /** Infers the output type of a Standard Typed. */
1523
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
1524
+ }
1525
+ /** The Standard Schema interface. */
1526
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
1527
+ /** The Standard Schema properties. */
1528
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
1529
+ }
1530
+ declare namespace StandardSchemaV1 {
1531
+ /** The Standard Schema properties interface. */
1532
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
1533
+ /** Validates unknown input values. */
1534
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
1535
+ }
1536
+ /** The result interface of the validate function. */
1537
+ type Result<Output> = SuccessResult<Output> | FailureResult;
1538
+ /** The result interface if validation succeeds. */
1539
+ interface SuccessResult<Output> {
1540
+ /** The typed output value. */
1541
+ readonly value: Output;
1542
+ /** A falsy value for `issues` indicates success. */
1543
+ readonly issues?: undefined;
1544
+ }
1545
+ interface Options {
1546
+ /** Explicit support for additional vendor-specific parameters, if needed. */
1547
+ readonly libraryOptions?: Record<string, unknown> | undefined;
1548
+ }
1549
+ /** The result interface if validation fails. */
1550
+ interface FailureResult {
1551
+ /** The issues of failed validation. */
1552
+ readonly issues: ReadonlyArray<Issue>;
1553
+ }
1554
+ /** The issue interface of the failure output. */
1555
+ interface Issue {
1556
+ /** The error message of the issue. */
1557
+ readonly message: string;
1558
+ /** The path of the issue, if any. */
1559
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
1560
+ }
1561
+ /** The path segment interface of the issue. */
1562
+ interface PathSegment {
1563
+ /** The key representing a path segment. */
1564
+ readonly key: PropertyKey;
1565
+ }
1566
+ /** The Standard types interface. */
1567
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
1568
+ /** Infers the input type of a Standard. */
1569
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
1570
+ /** Infers the output type of a Standard. */
1571
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
1572
+ }
1573
+ //#endregion
1574
+ //#region ../../node_modules/.pnpm/devframe@1.1.0_@devframes+agentic@1.1.0_cac@7.0.0_srvx@1.0.4/node_modules/devframe/dist/types-BmDbfHCx.d.mts
1575
+ //#endregion
1576
+ //#region src/rpc/types.d.ts
1577
+ type Thenable<T> = T | Promise<T>;
1578
+ /**
1579
+ * Agent exposure settings for an RPC function. When this field is set,
1580
+ * the function is surfaced to agents (e.g. via the devframe MCP adapter)
1581
+ * as a callable tool. Functions without an `agent` field are not exposed;
1582
+ * default-deny.
1583
+ */
1584
+ interface RpcFunctionAgentOptions {
1585
+ /**
1586
+ * Human-readable description shown to the agent. Required, since agents
1587
+ * rely on this to decide when to invoke the tool. Keep it to ~1–3
1588
+ * sentences explaining what the tool does and when to use it.
1589
+ */
1590
+ description: string;
1591
+ /**
1592
+ * Optional human-friendly display title. Maps to the MCP tool `title`
1593
+ * annotation. Falls back to the RPC function `name` when omitted.
1594
+ */
1595
+ title?: string;
1596
+ /**
1597
+ * Safety classification. Drives MCP annotations (`readOnlyHint`,
1598
+ * `destructiveHint`) downstream.
1599
+ * - `'read'`: no side effects; safe to call freely.
1600
+ * - `'action'`: mutates state but not destructive.
1601
+ * - `'destructive'`: may perform destructive updates.
1602
+ *
1603
+ * When omitted it is inferred from the function `type`:
1604
+ * - `'static'` / `'query'` → `'read'`
1605
+ * - `'action'` / `'event'` → `'action'`
1606
+ */
1607
+ safety?: 'read' | 'action' | 'destructive';
1608
+ /** Free-form tags for grouping or filtering. */
1609
+ tags?: readonly string[];
1610
+ /**
1611
+ * Optional example invocations shown to agents. Returned verbatim in
1612
+ * the agent manifest.
1613
+ */
1614
+ examples?: readonly {
1615
+ args: unknown[];
1616
+ description?: string;
1617
+ }[];
1618
+ }
1619
+ /**
1620
+ * Positional argument schemas for an RPC function. Each entry is any
1621
+ * [Standard Schema](https://standardschema.dev)-compliant validator
1622
+ * (valibot, zod, arktype, …); the entry at index `i` validates argument
1623
+ * `i` at call time and drives that argument's inferred type.
1624
+ */
1625
+ type RpcArgsSchema = readonly StandardSchemaV1[];
1626
+ /**
1627
+ * Return-value schema for an RPC function. Any
1628
+ * [Standard Schema](https://standardschema.dev)-compliant validator; it
1629
+ * validates the handler's resolved return value and drives its inferred
1630
+ * type.
1631
+ */
1632
+ type RpcReturnSchema = StandardSchemaV1;
1633
+ //#endregion
1634
+ //#region ../../node_modules/.pnpm/devframe@1.1.0_@devframes+agentic@1.1.0_cac@7.0.0_srvx@1.0.4/node_modules/devframe/dist/context--tVkJw3W.d.mts
1635
+ //#region src/types/events.d.ts
1636
+ interface EventsMap {
1637
+ [event: string]: any;
1638
+ }
1639
+ interface EventUnsubscribe {
1640
+ (): void;
1641
+ }
1642
+ interface EventEmitter<Events extends EventsMap> {
1643
+ /**
1644
+ * Calls each of the listeners registered for a given event.
1645
+ *
1646
+ * ```js
1647
+ * ee.emit('tick', tickType, tickDuration)
1648
+ * ```
1649
+ *
1650
+ * @param event The event name.
1651
+ * @param args The arguments for listeners.
1652
+ */
1653
+ emit: <K extends keyof Events>(event: K, ...args: Parameters<Events[K]>) => void;
1654
+ /**
1655
+ * Calls the listeners for a given event once and then removes the listener.
1656
+ *
1657
+ * @param event The event name.
1658
+ * @param args The arguments for listeners.
1659
+ */
1660
+ emitOnce: <K extends keyof Events>(event: K, ...args: Parameters<Events[K]>) => void;
1661
+ /**
1662
+ * Event names in keys and arrays with listeners in values.
1663
+ *
1664
+ * @internal
1665
+ */
1666
+ _listeners: Partial<{ [E in keyof Events]: Events[E][]; }>;
1667
+ /**
1668
+ * Add a listener for a given event.
1669
+ *
1670
+ * ```js
1671
+ * const unbind = ee.on('tick', (tickType, tickDuration) => {
1672
+ * count += 1
1673
+ * })
1674
+ *
1675
+ * disable () {
1676
+ * unbind()
1677
+ * }
1678
+ * ```
1679
+ *
1680
+ * @param event The event name.
1681
+ * @param cb The listener function.
1682
+ * @returns Unbind listener from event.
1683
+ */
1684
+ on: <K extends keyof Events>(event: K, cb: Events[K]) => EventUnsubscribe;
1685
+ /**
1686
+ * Add a listener for a given event once.
1687
+ *
1688
+ * ```js
1689
+ * const unbind = ee.once('tick', (tickType, tickDuration) => {
1690
+ * count += 1
1691
+ * })
1692
+ *
1693
+ * disable () {
1694
+ * unbind()
1695
+ * }
1696
+ * ```
1697
+ *
1698
+ * @param event The event name.
1699
+ * @param cb The listener function.
1700
+ * @returns Unbind listener from event.
1701
+ */
1702
+ once: <K extends keyof Events>(event: K, cb: Events[K]) => EventUnsubscribe;
1703
+ }
1704
+ //#endregion
1705
+ //#region src/utils/shared-state.d.ts
1706
+ type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
1707
+ type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
1708
+ type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
1709
+ type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
1710
+ type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
1711
+ type ImmutableObject<T> = { readonly [K in keyof T]: Immutable<T[K]>; };
1712
+ /**
1713
+ * Serializable patch describing a single mutation to a `SharedState`.
1714
+ * Structurally compatible with JSON-Patch and is safe to send over RPC.
1715
+ */
1716
+ interface SharedStatePatch {
1717
+ op: 'add' | 'remove' | 'replace';
1718
+ path: readonly (string | number)[];
1719
+ value?: unknown;
1720
+ }
1721
+ /**
1722
+ * State host that is immutable by default with explicit mutate.
1723
+ */
1724
+ interface SharedState<T> {
1725
+ /**
1726
+ * Get the current state. Immutable.
1727
+ */
1728
+ value: () => Immutable<T>;
1729
+ /**
1730
+ * Subscribe to state changes.
1731
+ */
1732
+ on: EventEmitter<SharedStateEvents<T>>['on'];
1733
+ /**
1734
+ * Mutate the state.
1735
+ */
1736
+ mutate: (fn: (state: T) => void, syncId?: string) => void;
1737
+ /**
1738
+ * Apply patches to the state.
1739
+ */
1740
+ patch: (patches: SharedStatePatch[], syncId?: string) => void;
1741
+ /**
1742
+ * Sync IDs that have been applied to the state.
1743
+ */
1744
+ syncIds: Set<string>;
1745
+ }
1746
+ interface SharedStateEvents<T> {
1747
+ updated: (fullState: T, patches: SharedStatePatch[] | undefined, syncId: string) => void;
1748
+ }
1749
+ //#endregion
1750
+ //#region ../../node_modules/.pnpm/devframe@1.1.0_@devframes+agentic@1.1.0_cac@7.0.0_srvx@1.0.4/node_modules/devframe/dist/in-page-channel/index.d.mts
1751
+ //#region src/in-page-channel/types.d.ts
1752
+ /**
1753
+ * The shared contract of one in-page channel, declared once (usually in a
1754
+ * `shared/protocol.ts` both sides import) and passed to both endpoints as a
1755
+ * type parameter. Purely a type; the only runtime companion is the
1756
+ * channel-name constant declared next to it.
1757
+ */
1758
+ interface InPageChannelProtocol {
1759
+ functions?: {
1760
+ /** Functions implemented by the page script. */
1761
+ pageScript?: Record<string, (...args: any[]) => any>;
1762
+ /** Functions implemented by panels. */
1763
+ panel?: Record<string, (...args: any[]) => any>;
1764
+ };
1765
+ events?: {
1766
+ /** Events emitted by panels and received by the page script. */
1767
+ pageScript?: Record<string, (...args: any[]) => void>;
1768
+ /** Events emitted by the page script and received by panels. */
1769
+ panel?: Record<string, (...args: any[]) => void>;
1770
+ };
1771
+ /**
1772
+ * Shared-state slots. The page script is the authority: it owns the
1773
+ * canonical value; panels are seeded on connect and converge through
1774
+ * syncId-deduplicated patches.
1775
+ */
1776
+ sharedStates?: Record<string, object>;
1777
+ }
1778
+ type SideFunctions<S> = S extends Record<string, (...args: any[]) => any> ? S : Record<string, never>;
1779
+ type SideDeclarations<P extends InPageChannelProtocol, Kind extends 'functions' | 'events', Side extends 'pageScript' | 'panel'> = Kind extends keyof P ? Side extends keyof NonNullable<P[Kind]> ? SideFunctions<NonNullable<NonNullable<P[Kind]>[Side]>> : Record<string, never> : Record<string, never>;
1780
+ type PageScriptFunctions<P extends InPageChannelProtocol> = SideDeclarations<P, 'functions', 'pageScript'>;
1781
+ type PanelFunctions<P extends InPageChannelProtocol> = SideDeclarations<P, 'functions', 'panel'>;
1782
+ type SharedStates<P extends InPageChannelProtocol> = P['sharedStates'] extends Record<string, object> ? P['sharedStates'] : Record<string, never>;
1783
+ type FnArgs<F> = F extends ((...args: infer A) => any) ? A : never;
1784
+ type FnReturn<F> = F extends ((...args: any[]) => infer R) ? Awaited<R> : never;
1785
+ type PageScriptEvents<P extends InPageChannelProtocol> = SideDeclarations<P, 'events', 'pageScript'>;
1786
+ type PanelEvents<P extends InPageChannelProtocol> = SideDeclarations<P, 'events', 'panel'>;
1787
+ /**
1788
+ * Converts a protocol function to its accepted endpoint handler.
1789
+ *
1790
+ * @internal
1791
+ */
1792
+ type ProtocolHandler<F> = F extends ((...args: any[]) => any) ? (...args: FnArgs<F>) => Thenable<FnReturn<F>> : never;
1793
+ /**
1794
+ * Function metadata with its handler constrained by a protocol function.
1795
+ *
1796
+ * @internal
1797
+ */
1798
+ interface InPageDefinitionOptionBase {
1799
+ /** Optional Standard Schema array validating the arguments. */
1800
+ args?: RpcArgsSchema;
1801
+ /** Optional Standard Schema validating the resolved return value. */
1802
+ returns?: RpcReturnSchema;
1803
+ jsonSerializable?: boolean;
1804
+ }
1805
+ interface InPageFunctionOptionBase extends InPageDefinitionOptionBase {
1806
+ /** Expose this function through DevFrame's browser-to-node agent bridge. */
1807
+ agent?: RpcFunctionAgentOptions;
1808
+ }
1809
+ interface InPageEventFunctionOption<F> extends InPageDefinitionOptionBase {
1810
+ type?: 'event';
1811
+ handler?: ProtocolHandler<F>;
1812
+ }
1813
+ type InPageEventOption<F> = [F] extends [never] ? never : InPageEventFunctionOption<F>;
1814
+ interface InPageQueryFunctionOption<F> extends InPageFunctionOptionBase {
1815
+ type?: 'query';
1816
+ handler: ProtocolHandler<F>;
1817
+ }
1818
+ interface InPageActionFunctionOption<F> extends InPageFunctionOptionBase {
1819
+ type: 'action';
1820
+ handler: ProtocolHandler<F>;
1821
+ }
1822
+ type InPageFunctionOption<F> = InPageQueryFunctionOption<F> | InPageActionFunctionOption<F>;
1823
+ /**
1824
+ * Functions implemented by {@link createPageScriptChannel}.
1825
+ *
1826
+ * @internal
1827
+ */
1828
+ type CreatePageScriptChannelOptionsFunctions<P extends InPageChannelProtocol> = { [NAME in keyof PageScriptFunctions<P> & string]: InPageFunctionOption<PageScriptFunctions<P>[NAME]>; };
1829
+ /**
1830
+ * Options shared by both in-page channel endpoints.
1831
+ *
1832
+ * @internal
1833
+ */
1834
+ interface InPageChannelCommonOptions {
1835
+ /**
1836
+ * Channel name, namespaced with the devframe id by convention
1837
+ * (e.g. `devframes:plugin:a11y`). Both endpoints must use the same name.
1838
+ */
1839
+ name: string;
1840
+ /**
1841
+ * Origins accepted during the handshake (and used as `targetOrigin` when
1842
+ * posting handshake messages). The in-page channel is same-origin by
1843
+ * definition, so this defaults to `[location.origin]`.
1844
+ */
1845
+ allowedOrigins?: string[];
1846
+ /**
1847
+ * Timeout for request/response calls, in milliseconds; `-1` disables.
1848
+ * Rejections are `InPageChannelError`s (code `timeout`) carrying the
1849
+ * endpoint status, so a hanging call explains itself.
1850
+ * @default 15000
1851
+ */
1852
+ callTimeoutMs?: number;
1853
+ /**
1854
+ * Liveness heartbeat guarding against silently dead ports. Defaults to a
1855
+ * 5s ping / 12s silence window; pass `false` to disable, on both
1856
+ * endpoints together.
1857
+ */
1858
+ heartbeat?: {
1859
+ intervalMs?: number;
1860
+ timeoutMs?: number;
1861
+ } | false;
1862
+ /**
1863
+ * Applied to each outgoing argument and handler result before posting;
1864
+ * the place to unwrap framework reactivity (Vue `toRaw`, Solid `unwrap`)
1865
+ * into plain structured-cloneable values.
1866
+ */
1867
+ serialize?: (value: unknown) => unknown;
1868
+ /** Applied to each incoming argument and call result. */
1869
+ deserialize?: (value: unknown) => unknown;
1870
+ }
1871
+ /** Options for {@link createPageScriptChannel}. */
1872
+ interface CreatePageScriptChannelOptions<Protocol extends InPageChannelProtocol = InPageChannelProtocol> extends InPageChannelCommonOptions {
1873
+ /** Every page-script function declaration, with a required handler. */
1874
+ functions: CreatePageScriptChannelOptionsFunctions<Protocol>;
1875
+ /** Optional metadata or handlers for incoming events. Listeners may instead subscribe through `channel.on()`. */
1876
+ events?: { [NAME in keyof PageScriptEvents<Protocol> & string]?: InPageEventOption<PageScriptEvents<Protocol>[NAME]>; };
1877
+ /**
1878
+ * Window whose `message` events carry panel hellos. Defaults to the
1879
+ * global `window`; pass `false` to skip the handshake listener entirely
1880
+ * (bring-your-own ports via `addPanelPort` only).
1881
+ */
1882
+ window?: Window | false;
1883
+ }
1884
+ /**
1885
+ * The channel shared-state accessor, mirroring `rpc.sharedState`, with the
1886
+ * page script playing the server's role as rendezvous and authority. The
1887
+ * page script's first `get` of a key must provide `initialValue`; a panel's
1888
+ * `get` without one resolves once the authority's first replay arrives.
1889
+ */
1890
+ interface InPageSharedStateHost<P extends InPageChannelProtocol> {
1891
+ get: <K extends keyof SharedStates<P> & string>(key: K, options?: {
1892
+ initialValue?: SharedStates<P>[K];
1893
+ }) => Promise<SharedState<SharedStates<P>[K]>>;
1894
+ }
1895
+ /** Emitter events of a page-script endpoint. */
1896
+ interface PageScriptChannelEvents<P extends InPageChannelProtocol> {
1897
+ 'panel:connected': (panel: PanelPeer<P>) => void;
1898
+ 'panel:disconnected': (panel: PanelPeer<P>) => void;
1899
+ }
1900
+ /** One connected panel, as seen from the page script. */
1901
+ interface PanelPeer<P extends InPageChannelProtocol> {
1902
+ /** Unique id of the panel endpoint (stable across its lifetime, not reloads). */
1903
+ readonly id: string;
1904
+ /** Call one panel's function and await the result. */
1905
+ call: <K extends keyof PanelFunctions<P> & string>(name: K, ...args: FnArgs<PanelFunctions<P>[K]>) => Promise<FnReturn<PanelFunctions<P>[K]>>;
1906
+ /** Disconnect this panel. */
1907
+ close: () => void;
1908
+ }
1909
+ /**
1910
+ * The page-script endpoint of an in-page channel: answers panel handshakes,
1911
+ * holds one dedicated port per connected panel, fans events out to all of
1912
+ * them, and is the authority for the channel's shared states.
1913
+ */
1914
+ interface PageScriptChannel<P extends InPageChannelProtocol> {
1915
+ readonly name: string;
1916
+ /**
1917
+ * This page context's instance id (persisted per tab in sessionStorage),
1918
+ * carried in every handshake so panels can pin to one instance when the
1919
+ * same app is open in several tabs.
1920
+ */
1921
+ readonly instanceId: string;
1922
+ /** Currently connected panels. */
1923
+ readonly panels: readonly PanelPeer<P>[];
1924
+ readonly events: Pick<EventEmitter<PageScriptChannelEvents<P>>, 'on' | 'once'>;
1925
+ /** Fan an event out to every connected panel. */
1926
+ emit: <K extends keyof PanelEvents<P> & string>(name: K, ...args: FnArgs<PanelEvents<P>[K]>) => void;
1927
+ /** Subscribe to an event emitted by a panel. Returns an unsubscribe function. */
1928
+ on: <K extends keyof PageScriptEvents<P> & string>(name: K, listener: (...args: FnArgs<PageScriptEvents<P>[K]>) => void) => () => void;
1929
+ /** Page-script-authoritative shared states, replayed to joining panels. */
1930
+ readonly sharedState: InPageSharedStateHost<P>;
1931
+ /** Adopt a pre-established port as a panel peer (bring-your-own transport). */
1932
+ addPanelPort: (port: MessagePort) => PanelPeer<P>;
1933
+ /** Tear the endpoint down: disconnect every panel, stop answering hellos. */
1934
+ close: () => void;
1935
+ }
1936
+ //#endregion
1402
1937
  //#region src/rpc/server.d.ts
1403
1938
  interface DevtoolsRpcServer {
1404
1939
  attachInPage(options: Pick<CreatePageScriptChannelOptions<DevtoolsInPageProtocol>, 'name' | 'window' | 'allowedOrigins'>): {
@@ -1427,4 +1962,4 @@ declare function connectDevtoolsIframeClient(options?: ConnectDevtoolsIframeClie
1427
1962
  declare function createIframeDevtoolsClientHost(options?: ConnectDevtoolsIframeClientOptions): DevtoolsClientHost;
1428
1963
  declare function isIframeDevtoolsClientHostAvailable(options?: Pick<ConnectDevtoolsIframeClientOptions, 'window' | 'targetWindow'>): boolean;
1429
1964
  //#endregion
1430
- export { DEVTOOLS_RPC_COMMAND as $, ValueHandleRegistryOptions as $n, VueTypeMap as $t, connectDevtoolsExtensionClient as A, MutableEditStatePayload as An, AppRecord as At, DevtoolsRpcChannel as B, TimelineEventOptions as Bn, InspectorId as Bt, DevtoolsExtensionFrameController as C, RouterSnapshotMessage as Cn, RuntimePerformanceMonitor as Ct, DevtoolsExtensionPortDescriptor as D, DevToolsPluginAPIHooks as Dn, RuntimeInspectorInfo as Dt, DevtoolsExtensionFramesChangedMessage as E, DevToolsPluginAPI as En, RuntimeInspectorAction as Et, isExtensionDevtoolsClientHostAvailable as F, PluginDescriptor as Fn, RuntimeRegistry as Ft, DevtoolsRpcClientFunctions as G, EncodedValue as Gn, RuntimeCommandResult as Gt, createMessagePortDevtoolsRpcChannel as H, VisitComponentTreePayload as Hn, MaybePromise as Ht, parseDevtoolsExtensionPortName as I, PluginSettingOption as In, WalkedComponentChild as It, DevtoolsRpcServerFunctions as J, encodeValue as Jn, RuntimeEvent as Jt, DevtoolsRpcEvent as K, ValueCodecOptions as Kn, RuntimeDomainEvent as Kt, CreateDevtoolsRpcClientOptions as L, PluginSettingsItem as Ln, AppId as Lt, createDevtoolsExtensionPortName as M, MutableInspectorTreePayload as Mn, ComponentRecord as Mt, createExtensionDevtoolsClientHost as N, PLUGIN_API_CAPABILITIES as Nn, ComponentSnapshot as Nt, DevtoolsExtensionPortRole as O, InspectComponentPayload as On, RuntimeInspectorRecord as Ot, isDevtoolsExtensionFrameControlMessage as P, PluginApiAdapter as Pn, RefreshComponentTreeOptions as Pt, DEVTOOLS_IFRAME_RPC_SOURCE as Q, ValueHandleRegistry as Qn, RuntimeQuery as Qt, DevtoolsRpcClient as R, PluginSetupFunction as Rn, AppRef as Rt, DevtoolsExtensionFrameControlMessage as S, RouterRouteSnapshot as Sn, RuntimeRequests as St, DevtoolsExtensionFrameSelectMessage as T, CustomInspectorOptions as Tn, createRuntimePerformanceMonitor as Tt, DevtoolsInPageProtocol as U, createPluginApiAdapter as Un, PluginId as Ut, DevtoolsRpcChannelHandle as V, TimelineLayerOptions as Vn, InstanceRef as Vt, DevtoolsRpcChannelKind as W, reportPluginError as Wn, RuntimeCommand as Wt, DEFAULT_DEVTOOLS_RPC_CHANNEL_ID as X, ValueHandle as Xn, RuntimeEventHandler as Xt, toDevtoolsRpcEvent as Y, formatPreviewKey as Yn, RuntimeEventBase as Yt, DEVTOOLS_IFRAME_RPC_CONNECT as Z, ValueHandleEntry as Zn, RuntimeEventType as Zt, DEVTOOLS_EXTENSION_FRAME_CONTROL_SOURCE as _, ReactivityGraphNode as _n, ComponentTreeStore as _t, isIframeDevtoolsClientHostAvailable as a, ComponentStateSnapshotMessage as an, DevtoolsRuntime as at, DevtoolsExtensionFrameActivatedMessage as b, ReactivityRelationship as bn, RuntimeQueryMap as bt, createDevtoolsRpcServer as c, ComponentTreePageMessage as cn, createDevtoolsRuntime as ct, connectDevtoolsClient as d, DevtoolsCapabilitiesMessage as dn, RuntimeScheduler as dt, ComponentTreePatch as en, RuntimeBudget as er, DEVTOOLS_RPC_EVENT as et, getDefaultDevtoolsClientHosts as f, ExpandedValueMessage as fn, createRuntimeScheduler as ft, ConnectDevtoolsExtensionClientOptions as g, PluginsSnapshotMessage as gn, ComponentTreeSnapshot as gt, ChromeRuntimePort as h, PluginSnapshot as hn, ComponentTreePatchBatch as ht, createIframeDevtoolsClientHost as i, ComponentStateSection as in, CreateDevtoolsRuntimeOptions as it, createChromeRuntimePortDevtoolsRpcChannel as j, MutableInspectorStatePayload as jn, ComponentDomOrderCache as jt, DevtoolsExtensionRpcClient as k, InspectTimelineEventPayload as kn, RuntimeInspectorStore as kt, ConnectDevtoolsClientOptions as l, ComponentTreeSnapshotMessage as ln, ComponentStateCollector as lt, ChromeExtensionEvent as m, InspectorsListMessage as mn, createRuntimeEventLog as mt, StartIframeDevtoolsRpcHostOptions as n, AppsSnapshotMessage as nn, defaultRuntimeBudget as nr, ComponentInspectorDockController as nt, startIframeDevtoolsRpcHost as o, ComponentTreeNodeSnapshot as on, RuntimeCommandHandler as ot, ChromeExtensionApi as p, InspectorTreeSnapshotMessage as pn, RuntimeEventLog as pt, DevtoolsRpcEventHandler as q, ValueEntry as qn, RuntimeDomainEventType as qt, connectDevtoolsIframeClient as r, ComponentInspectionResultMessage as rn, resolveRuntimeBudget as rr, ComponentInspectorDockRestore as rt, DevtoolsRpcServer as s, ComponentTreeNodeTag as sn, RuntimeQueryHandler as st, ConnectDevtoolsIframeClientOptions as t, AppSnapshot as tn, RuntimeBudgetInput as tr, DEVTOOLS_RPC_QUERY as tt, DevtoolsClientHost as u, CustomInspectorTreeNode as un, LegacyComponentStateEntry as ut, DEVTOOLS_EXTENSION_PORT_SOURCE as v, ReactivityGraphNodeType as vn, RuntimeCommandMap as vt, DevtoolsExtensionFrameDescriptor as w, StateEntry as wn, RuntimePerformanceSnapshot as wt, DevtoolsExtensionFrameActivationReason as x, RouterRouteRecordSnapshot as xn, RuntimeQueryRequest as xt, DEVTOOLS_EXTENSION_PORT_VERSION as y, ReactivityGraphSnapshot as yn, RuntimeCommandRequest as yt, createDevtoolsRpcClient as z, SetPluginSettingsPayload as zn, ComponentId as zt };
1965
+ export { DEVTOOLS_RPC_COMMAND as $, formatPreviewKey as $n, RuntimeQuery as $t, connectDevtoolsExtensionClient as A, DevToolsPluginAPI as An, AppRecord as At, DevtoolsRpcChannel as B, PluginSettingOption as Bn, ComponentId as Bt, DevtoolsExtensionFrameController as C, RouterRouteSnapshot as Cn, RuntimePerformanceMonitor as Ct, DevtoolsExtensionPortDescriptor as D, StatePagination as Dn, RuntimeInspectorInfo as Dt, DevtoolsExtensionFramesChangedMessage as E, StatePageOptions as En, RuntimeInspectorAction as Et, isExtensionDevtoolsClientHostAvailable as F, MutableInspectorStatePayload as Fn, RuntimeRegistry as Ft, DevtoolsRpcClientFunctions as G, TimelineLayerOptions as Gn, RuntimeCommand as Gt, createMessagePortDevtoolsRpcChannel as H, PluginSetupFunction as Hn, InstanceRef as Ht, parseDevtoolsExtensionPortName as I, MutableInspectorTreePayload as In, WalkedComponentChild as It, DevtoolsRpcServerFunctions as J, reportPluginError as Jn, RuntimeDomainEventType as Jt, DevtoolsRpcEvent as K, VisitComponentTreePayload as Kn, RuntimeCommandResult as Kt, CreateDevtoolsRpcClientOptions as L, PLUGIN_API_CAPABILITIES as Ln, readComponentName as Lt, createDevtoolsExtensionPortName as M, InspectComponentPayload as Mn, ComponentRecord as Mt, createExtensionDevtoolsClientHost as N, InspectTimelineEventPayload as Nn, ComponentSnapshot as Nt, DevtoolsExtensionPortRole as O, StateValueMessage as On, RuntimeInspectorRecord as Ot, isDevtoolsExtensionFrameControlMessage as P, MutableEditStatePayload as Pn, RefreshComponentTreeOptions as Pt, DEVTOOLS_IFRAME_RPC_SOURCE as Q, encodeValue as Qn, RuntimeEventType as Qt, DevtoolsRpcClient as R, PluginApiAdapter as Rn, AppId as Rt, DevtoolsExtensionFrameControlMessage as S, RouterRouteRecordSnapshot as Sn, RuntimeRequests as St, DevtoolsExtensionFrameSelectMessage as T, StateEntry as Tn, createRuntimePerformanceMonitor as Tt, DevtoolsInPageProtocol as U, SetPluginSettingsPayload as Un, MaybePromise as Ut, DevtoolsRpcChannelHandle as V, PluginSettingsItem as Vn, InspectorId as Vt, DevtoolsRpcChannelKind as W, TimelineEventOptions as Wn, PluginId as Wt, DEFAULT_DEVTOOLS_RPC_CHANNEL_ID as X, ValueCodecOptions as Xn, RuntimeEventBase as Xt, toDevtoolsRpcEvent as Y, EncodedValue as Yn, RuntimeEvent as Yt, DEVTOOLS_IFRAME_RPC_CONNECT as Z, ValueEntry as Zn, RuntimeEventHandler as Zt, DEVTOOLS_EXTENSION_FRAME_CONTROL_SOURCE as _, PluginsSnapshotMessage as _n, ComponentTreeStore as _t, isIframeDevtoolsClientHostAvailable as a, ComponentStateSection as an, RuntimeBudget as ar, DevtoolsRuntime as at, DevtoolsExtensionFrameActivatedMessage as b, ReactivityGraphSnapshot as bn, RuntimeQueryMap as bt, createDevtoolsRpcServer as c, ComponentTreeNodeTag as cn, resolveRuntimeBudget as cr, createDevtoolsRuntime as ct, connectDevtoolsClient as d, CustomInspectorTreeNode as dn, RuntimeScheduler as dt, VueTypeMap as en, safeOwnEnumerableStringKeys as er, DEVTOOLS_RPC_EVENT as et, getDefaultDevtoolsClientHosts as f, DevtoolsCapabilitiesMessage as fn, createRuntimeScheduler as ft, ConnectDevtoolsExtensionClientOptions as g, PluginSnapshot as gn, ComponentTreeSnapshot as gt, ChromeRuntimePort as h, InspectorsListMessage as hn, ComponentTreePatchBatch as ht, createIframeDevtoolsClientHost as i, ComponentInspectionResultMessage as in, ValueHandleRegistryOptions as ir, CreateDevtoolsRuntimeOptions as it, createChromeRuntimePortDevtoolsRpcChannel as j, DevToolsPluginAPIHooks as jn, ComponentDomOrderCache as jt, DevtoolsExtensionRpcClient as k, CustomInspectorOptions as kn, RuntimeInspectorStore as kt, ConnectDevtoolsClientOptions as l, ComponentTreePageMessage as ln, ComponentStateCollector as lt, ChromeExtensionEvent as m, InspectorTreeSnapshotMessage as mn, createRuntimeEventLog as mt, StartIframeDevtoolsRpcHostOptions as n, AppSnapshot as nn, ValueHandleEntry as nr, ComponentInspectorDockController as nt, startIframeDevtoolsRpcHost as o, ComponentStateSnapshotMessage as on, RuntimeBudgetInput as or, RuntimeCommandHandler as ot, ChromeExtensionApi as p, ExpandedValueMessage as pn, RuntimeEventLog as pt, DevtoolsRpcEventHandler as q, createPluginApiAdapter as qn, RuntimeDomainEvent as qt, connectDevtoolsIframeClient as r, AppsSnapshotMessage as rn, ValueHandleRegistry as rr, ComponentInspectorDockRestore as rt, DevtoolsRpcServer as s, ComponentTreeNodeSnapshot as sn, defaultRuntimeBudget as sr, RuntimeQueryHandler as st, ConnectDevtoolsIframeClientOptions as t, ComponentTreePatch as tn, ValueHandle as tr, DEVTOOLS_RPC_QUERY as tt, DevtoolsClientHost as u, ComponentTreeSnapshotMessage as un, LegacyComponentStateEntry as ut, DEVTOOLS_EXTENSION_PORT_SOURCE as v, ReactivityGraphNode as vn, RuntimeCommandMap as vt, DevtoolsExtensionFrameDescriptor as w, RouterSnapshotMessage as wn, RuntimePerformanceSnapshot as wt, DevtoolsExtensionFrameActivationReason as x, ReactivityRelationship as xn, RuntimeQueryRequest as xt, DEVTOOLS_EXTENSION_PORT_VERSION as y, ReactivityGraphNodeType as yn, RuntimeCommandRequest as yt, createDevtoolsRpcClient as z, PluginDescriptor as zn, AppRef as zt };