devframe 0.9.3 → 0.9.5

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.
Files changed (56) hide show
  1. package/dist/{_shared-BPovvJW8.d.mts → _shared-CsBsnhuO.d.mts} +1 -1
  2. package/dist/adapters/build.d.mts +5 -4
  3. package/dist/adapters/build.mjs +4 -3
  4. package/dist/adapters/cac.d.mts +1 -1
  5. package/dist/adapters/cac.mjs +1 -1
  6. package/dist/adapters/dev.d.mts +11 -10
  7. package/dist/adapters/dev.mjs +1 -1
  8. package/dist/adapters/embedded.d.mts +1 -1
  9. package/dist/adapters/initiate.d.mts +8 -7
  10. package/dist/adapters/initiate.mjs +1 -1
  11. package/dist/adapters/mcp.d.mts +1 -1
  12. package/dist/adapters/mcp.mjs +1 -1
  13. package/dist/client/index.d.mts +1 -1
  14. package/dist/client/index.mjs +1 -1
  15. package/dist/constants.d.mts +1 -1
  16. package/dist/constants.mjs +1 -1
  17. package/dist/{context-CQW0lSw8.mjs → context-Bc5S40Qt.mjs} +2 -2
  18. package/dist/{context-BUJGvlje.mjs → context-Cx9V9Grq.mjs} +1 -1
  19. package/dist/{context-CO7eZHJy.d.mts → context-DO0Qu1O8.d.mts} +1 -1
  20. package/dist/{context-_i51nYOs.d.mts → context-c0OlSc12.d.mts} +20 -8
  21. package/dist/{dev-lpIvwagf.mjs → dev-BRQA42Lh.mjs} +6 -5
  22. package/dist/{events-DKfSmoTj.mjs → events-DzolaBEs.mjs} +1 -1
  23. package/dist/{host-agent-B84av916.mjs → host-agent-DbPWo0Bl.mjs} +1 -1
  24. package/dist/{http-BKiqHcXX.mjs → http-D7wWuy7-.mjs} +2 -2
  25. package/dist/{index-CEvd-YXD.d.mts → index-B_DPNIT4.d.mts} +2 -2
  26. package/dist/index.d.mts +11 -3
  27. package/dist/index.mjs +11 -1
  28. package/dist/{instance-shell-BHvBIGP4.d.mts → instance-shell-CPuYY8pw.d.mts} +2 -2
  29. package/dist/{instance-shell-B-uevnK-.mjs → instance-shell-fB5PyVtR.mjs} +1 -1
  30. package/dist/internal/index.d.mts +5 -5
  31. package/dist/internal/index.mjs +2 -2
  32. package/dist/node/auth.d.mts +2 -2
  33. package/dist/node/auth.mjs +1 -1
  34. package/dist/node/hub-internals.d.mts +2 -2
  35. package/dist/node/hub-internals.mjs +1 -1
  36. package/dist/node/index.d.mts +1 -1
  37. package/dist/node/index.mjs +1 -1
  38. package/dist/recipes/common-rpc-functions.d.mts +1 -1
  39. package/dist/recipes/interactive-auth.d.mts +2 -2
  40. package/dist/recipes/interactive-auth.mjs +1 -1
  41. package/dist/{remote-assets-Bg4gCUZ_.d.mts → remote-assets-B13_vRkJ.d.mts} +1 -1
  42. package/dist/{revoke-3Q6aDKWk.mjs → revoke-PihtvVil.mjs} +1 -1
  43. package/dist/rpc/transports/ws-bun.d.mts +1 -1
  44. package/dist/rpc/transports/ws-deno.d.mts +1 -1
  45. package/dist/{rpc-core-CDZoGYiD.d.mts → rpc-core-Oyz-cJBC.d.mts} +2 -2
  46. package/dist/types/index.d.mts +2 -2
  47. package/dist/utils/events.d.mts +1 -1
  48. package/dist/utils/remote-assets.d.mts +1 -1
  49. package/dist/utils/serve-static.d.mts +1 -1
  50. package/dist/utils/serve-static.mjs +1 -1
  51. package/dist/utils/shared-state.d.mts +1 -1
  52. package/dist/utils/streaming-channel.d.mts +1 -1
  53. package/package.json +1 -1
  54. package/skills/devframe/SKILL.md +314 -293
  55. package/skills/devframe/templates/counter-devframe.ts +8 -3
  56. package/skills/devframe/templates/hub.ts +50 -0
@@ -1,6 +1,8 @@
1
- // Smallest possible devframe. The dock entry is auto-derived from
2
- // `id` / `name` / `icon` when this definition is mounted into Vite
3
- // DevTools via `createPluginFromDevframe(devframe)`.
1
+ // Smallest possible devframe. The same definition serves anywhere:
2
+ // - standard handler: initDevframe(counter, { base: '/__counter/' }).handler
3
+ // - standalone CLI: createCac(counter).parse()
4
+ // - composed in a hub: initHub({ devframes: [counter], ... })
5
+ // A host derives its dock entry from `id` / `name` / `icon` automatically.
4
6
  import { defineDevframe, defineRpcFunction } from 'devframe'
5
7
  // Recommended: source version/packageName/homepage/description from your
6
8
  // package.json so the published metadata stays in sync. The import-attribute
@@ -14,6 +16,9 @@ export default defineDevframe({
14
16
  name: 'Counter',
15
17
  version: pkg.version,
16
18
  packageName: pkg.name,
19
+ // Always pass import.meta.url — the base the host resolves the tool's own
20
+ // companion packages (assets, services) against.
21
+ importMetaUrl: import.meta.url,
17
22
  homepage: pkg.homepage,
18
23
  description: pkg.description,
19
24
  icon: 'ph:counter-duotone',
@@ -0,0 +1,50 @@
1
+ // Compose many devframes into one devtools host behind a single standard
2
+ // handler. Every mounted devframe runs against ONE shared hub context:
3
+ // a merged RPC registry (frames can call each other), one shared-state
4
+ // store, one WebSocket transport, and one auth gate.
5
+ //
6
+ // `hub.handler` is a Web-Standard `(request: Request) => Promise<Response>`;
7
+ // mount it on a catch-all route (Hono, Nitro, Next, SvelteKit, ...) exactly
8
+ // like an `initDevframe` instance. `hub.nodeMiddleware` is the Connect-style
9
+ // form for Vite/Rsbuild. See docs/content/2.adapters/1.initiate.md for the mount snippets
10
+ // and the WebSocket-binding precedence (`ws.port` / `server` / `ws.sidecar` /
11
+ // host-attached `hub.attach(server)`).
12
+ import { createUi } from '@devframes/hub-ui'
13
+ import { DEVFRAMES_HUB_BASE, initHub } from '@devframes/hub/initiate'
14
+
15
+ // A plugin's default export is its `create<X>Devframe` factory — call it to
16
+ // get an instance (optionally with options). Swap these for your own.
17
+ import createInspectDevframe from '@devframes/plugin-inspect'
18
+ import createTerminalsDevframe from '@devframes/plugin-terminals'
19
+
20
+ export const hub = initHub({
21
+ // Required — the conventional `/__devframes/`. The instance echoes the
22
+ // normalized value back as `hub.base`; reference that, not the literal.
23
+ base: DEVFRAMES_HUB_BASE,
24
+
25
+ devframes: [
26
+ createInspectDevframe(),
27
+ createTerminalsDevframe(),
28
+ ],
29
+
30
+ // The reference viewer + a floating dock injected via one
31
+ // `<script type="module" src="/__devframes/embedded.js">` tag.
32
+ // Pass `ui: false` for a headless hub you drive with your own UI over the
33
+ // shared-state protocol (see @devframes/hub/client).
34
+ ui: createUi(),
35
+
36
+ // Runs against the shared hub context — register cross-tool commands,
37
+ // docks, message handlers here.
38
+ configure(ctx) {
39
+ ctx.commands.register({
40
+ id: 'app:hello',
41
+ title: 'Hello',
42
+ handler: () => 'hi',
43
+ })
44
+ },
45
+ })
46
+
47
+ // hub.handler — the whole devtools ecosystem as Request -> Response
48
+ // hub.nodeMiddleware — Connect-style middleware
49
+ // hub.attach(server) — hand the hub a node server's upgrade events
50
+ // hub.close() — tear the transport down