Skip to content

feat(self-inspect): add @devframes/self-inspect package#1

Open
antfubot wants to merge 5 commits into
mainfrom
feat/self-inspect-plugin
Open

feat(self-inspect): add @devframes/self-inspect package#1
antfubot wants to merge 5 commits into
mainfrom
feat/self-inspect-plugin

Conversation

@antfubot

Copy link
Copy Markdown
Owner

Summary

Ports the self-inspect plugin from vite-devtools to the devframe monorepo as a first-party @devframes/self-inspect package.

What this adds

Node-side — A selfInspect() factory returns a DevframeDefinition that, when mounted via mountDevframe(), registers six RPC functions for inspecting hub state at runtime:

RPC function What it returns
self-inspect:get-docks All registered dock entries with metadata
self-inspect:get-rpc-functions All registered RPC functions with type/schema/dump info
self-inspect:get-client-scripts Client scripts attached to action/custom-render/iframe docks
self-inspect:get-shared-state-keys All shared-state keys
self-inspect:get-auth-tokens Trusted auth token records
self-inspect:revoke-auth-token Revoke a trusted auth token

Client-side — A Vite + Preact SPA with five inspection tabs: RPC Functions, Docks, Client Scripts, Shared State, Auth Tokens. Connects via connectDevframe() and is served from dist/client/ at the mount path.

Usage

import { mountDevframe } from '@devframes/hub/node'
import { selfInspect } from '@devframes/self-inspect'

// In hub setup:
await mountDevframe(ctx, selfInspect(), { dock: { category: 'advanced' } })

Changes

  • packages/self-inspect/ — new package (@devframes/self-inspect)
  • alias.ts / tsconfig.base.json — workspace path alias for the package
  • turbo.json — build task with correct dependency chain
  • vitest.config.ts — registers the package as a vitest project
  • tests/__snapshots__/ — API snapshot for the new package

Porting notes

The get-devtools-plugins function from the original (which lists Vite plugins by inspecting viteConfig.plugins) was intentionally omitted: it is Vite-specific and does not apply to the framework-neutral devframe context.

This PR was created with the help of an agent.

antfubot and others added 5 commits June 10, 2026 14:44
Port the self-inspect plugin from vite-devtools to the devframe
monorepo as a first-party package.

The package exports a selfInspect() DevframeDefinition that, when
mounted via mountDevframe(), registers six RPC functions for
inspecting the hub at runtime:

- self-inspect:get-docks — list registered dock entries
- self-inspect:get-rpc-functions — list registered RPC functions
  with metadata (type, args, dump, etc.)
- self-inspect:get-client-scripts — list client scripts attached to
  docks (actions, custom renderers, iframe clientScripts)
- self-inspect:get-shared-state-keys — list shared-state keys
- self-inspect:get-auth-tokens — list trusted auth tokens
- self-inspect:revoke-auth-token — revoke a trusted auth token

A pre-built Preact SPA provides a tabbed inspection UI for each
category. The SPA connects via connectDevframe() and is served from
dist/client/ at the definition's mount path.

All RPC functions use defineHubRpcFunction from @devframes/hub and
are typed against DevframeHubContext. Module augmentation extends
DevframeRpcServerFunctions with all six function signatures.

Co-authored-by: opencode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants