feat(self-inspect): add @devframes/self-inspect package#1
Open
antfubot wants to merge 5 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the self-inspect plugin from vite-devtools to the devframe monorepo as a first-party
@devframes/self-inspectpackage.What this adds
Node-side — A
selfInspect()factory returns aDevframeDefinitionthat, when mounted viamountDevframe(), registers six RPC functions for inspecting hub state at runtime:self-inspect:get-docksself-inspect:get-rpc-functionsself-inspect:get-client-scriptsself-inspect:get-shared-state-keysself-inspect:get-auth-tokensself-inspect:revoke-auth-tokenClient-side — A Vite + Preact SPA with five inspection tabs: RPC Functions, Docks, Client Scripts, Shared State, Auth Tokens. Connects via
connectDevframe()and is served fromdist/client/at the mount path.Usage
Changes
packages/self-inspect/— new package (@devframes/self-inspect)alias.ts/tsconfig.base.json— workspace path alias for the packageturbo.json— build task with correct dependency chainvitest.config.ts— registers the package as a vitest projecttests/__snapshots__/— API snapshot for the new packagePorting notes
The
get-devtools-pluginsfunction from the original (which lists Vite plugins by inspectingviteConfig.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.