You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(devframe)!: keep utils/hash; move hub-only internals to devframe/internal
- Restore `devframe/utils/hash` — kept as a public utility (maintainer request).
- Add a new `devframe/internal` entry point for the low-level primitives shared
only between `devframe` and `@devframes/hub`, and relocate `createContextRpcServer`,
`DevframeAgentHost`, and `coerceAgentPositionalArgs` there from `devframe/node`.
`devframe/internal` is an explicitly-unstable cross-package surface; the hub
imports these three from it. This keeps the public `devframe/node` barrel to
the genuinely-public server-assembly API.
Updates the migration guide, SKILL/utilities docs, knip entry list, plan, and
regenerates the tsnapi snapshots.
Co-authored-by: opencode <noreply@opencode.ai>
`devframe/types` still resolves as the type-only subpath — useful for `declare module 'devframe/types'` augmentations — but `devframe` is the canonical import for both values and types.
116
116
117
-
## `devframe/utils/{hash,promise,scope}` are removed
117
+
## `devframe/utils/{promise,scope}` are removed
118
118
119
-
Three utility subpaths with no integration consumers are removed:
119
+
Two utility subpaths with no integration consumers are removed:
120
120
121
121
| Removed | Replacement |
122
122
|---------|-------------|
123
123
|`import { promiseWithResolver } from 'devframe/utils/promise'`|`Promise.withResolvers()` (native) |
124
-
|`import { hash } from 'devframe/utils/hash'`| Any structural-hash library (e.g. `ohash`) |
125
124
|`import { isQualifiedName, qualifyName } from 'devframe/utils/scope'`| Inline the check (`name.includes(':')`) |
126
125
127
-
The other `devframe/utils/*` helpers — `colors`, `open`, `launch-editor`, `nanoid`, `crypto-token`, `structured-clone`, `events`, `shared-state`, `streaming-channel`, `when`, `simple-schema`, `serve-static`, `agent-tool-name` — are unchanged.
126
+
The other `devframe/utils/*` helpers — `colors`, `open`, `launch-editor`, `hash`, `nanoid`, `crypto-token`, `structured-clone`, `events`, `shared-state`, `streaming-channel`, `when`, `simple-schema`, `serve-static`, `agent-tool-name` — are unchanged.
128
127
129
128
## `devframe/node` is slimmed to the server-assembly surface
130
129
131
-
`devframe/node` keeps the API that hosts wiring up their own runtime actually use — `createHostContext`, `createH3DevframeHost`, `startHttpAndWs`, `createContextRpcServer`, `createStorage`, `registerDevframeInstance` / `listLiveDevframeInstances`, `DevframeAgentHost`, `coerceAgentPositionalArgs`, `isObject`, `normalizeHttpServerUrl`, and the `RpcFunctionsHost` / instance-record types.
130
+
`devframe/node` keeps the API that hosts wiring up their own runtime actually use — `createHostContext`, `createH3DevframeHost`, `startHttpAndWs`, `createStorage`, `registerDevframeInstance` / `listLiveDevframeInstances`, `isObject`, `normalizeHttpServerUrl`, and the `RpcFunctionsHost` / instance-record types.
132
131
133
132
The internal host implementations and low-level factories are no longer exported:
134
133
@@ -139,7 +138,17 @@ The internal host implementations and low-level factories are no longer exported
139
138
|`createScopedNodeContext`, `createNodeSettings`| Internal to context assembly. |
A host that binds its own transport composes from `createContextRpcServer` (`devframe/node`) plus `devframe/rpc/server`, `devframe/rpc/transports/*`, and `devframe/node/hub-internals` — the path `@devframes/hub`'s `initHub` and `@vitejs/devtools` both take.
141
+
## Cross-package internals move to `devframe/internal`
142
+
143
+
The low-level primitives that only exist for the `devframe` ↔ `@devframes/hub` boundary now live at the new `devframe/internal` entry point, which is explicitly **unstable** (it can change in any minor release). They were previously on `devframe/node`:
A host that binds its own transport composes from `createContextRpcServer` (`devframe/internal`) plus `devframe/rpc/server`, `devframe/rpc/transports/*`, and `devframe/node/hub-internals` — the path `@devframes/hub`'s `initHub` takes. Application code should prefer the adapters and `devframe/node`.
143
152
144
153
## `@devframes/hub` category order lives only on `/constants`
Copy file name to clipboardExpand all lines: docs/helpers/utilities.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ outline: deep
4
4
5
5
# Utilities
6
6
7
-
Devframe ships a set of small, stable helpers under the `devframe/utils/*` subpaths. They cover the most common ancillary tasks a devtool needs — colorising terminal output, opening files in an editor, generating IDs and tokens — without forcing every author to pick (and install) their own library.
7
+
Devframe ships a set of small, stable helpers under the `devframe/utils/*` subpaths. They cover the most common ancillary tasks a devtool needs — colorising terminal output, hashing arbitrary values, opening files in an editor — without forcing every author to pick (and install) their own library.
8
8
9
9
Each helper is bundled inside devframe. Importing from `devframe/utils/*` is enough — there's no separate `npm install` for these dependencies.
The auto-detection reads the `LAUNCH_EDITOR` environment variable and falls back to common defaults. Most devframes consume this through the prebuilt `openInEditor` recipe — see [Common RPC Functions](./common-rpc-functions).
50
50
51
+
### `devframe/utils/hash`
52
+
53
+
Stable, deterministic hash of any structured-cloneable value. Useful for cache keys and dedup.
54
+
55
+
```ts
56
+
import { hash } from'devframe/utils/hash'
57
+
58
+
const key =hash({ functionName, args })
59
+
```
60
+
51
61
### `devframe/utils/structured-clone`
52
62
53
63
JSON-safe serialization for the structured-clone algorithm — round-trips `Map`, `Set`, `Date`, `BigInt`, cycles, and class instances. Used internally by the RPC wire format; exposed for tools that need the same encoding.
@@ -127,6 +137,6 @@ Statically-validated when-clause expressions for conditional UI visibility. The
127
137
The utilities are exposed as **stable wrappers over their underlying libraries** rather than bare re-exports. Two consequences:
128
138
129
139
-**One install.** Consumers do not list these libraries in their own `package.json`. Bundling them inside devframe means version drift across devtools is impossible.
130
-
-**Swappable internals.** The wrapper signatures are deliberately narrower than upstream. Devframe can change the implementation (`ansis` → `picocolors`, …) without a breaking change to dependent devtools.
140
+
-**Swappable internals.** The wrapper signatures are deliberately narrower than upstream. Devframe can change the implementation (`ansis` → `picocolors`, `ohash` → `crypto.subtle.digest`, …) without a breaking change to dependent devtools.
131
141
132
142
When you need a feature outside the wrapper's minimal surface, prefer extending the wrapper inside devframe over bypassing it.
0 commit comments