Skip to content

Commit f2068d8

Browse files
authored
refactor(devframe)!: split auth and rename internal under devframe/node (#332)
BREAKING CHANGE: auth helpers (`getTempAuthToken`, `refreshTempAuthToken`, `consumeTempAuthToken`, `getPendingAuth`, `setPendingAuth`, `abortPendingAuth`, `PendingAuthRequest`, `revokeAuthToken`, `revokeActiveConnectionsForToken`) no longer re-export from `devframe/node` — import from `devframe/node/auth`. The `devframe/internal` sub-export is renamed to `devframe/node/internal`, which also now hosts the relocated `context-internal.ts`. End users were never meant to depend on this subpath; first-party adapters update accordingly.
1 parent 3e991b1 commit f2068d8

26 files changed

Lines changed: 93 additions & 71 deletions

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ flowchart TD
4545

4646
`devframe/packages/devframe` is the lowest-level package in this monorepo and is positioned to be extracted into its own repo. It MUST NOT import from `vite`, `@vitejs/*`, or any hub-only concept (docks, terminals, messages, commands) — not as a `dependencies` entry, not as an inlined dep, not as a source import. `packages/kit` and above build on top of devframe; never the reverse. If a feature requires multi-integration awareness, it goes in kit.
4747

48-
`devframe/internal` is a marked-internal subpath that exposes a small set of helpers (`getInternalContext`, `resolveBasePath`) for first-party adapters that need to reach into devframe's private machinery — kit's relocated `DocksHost` uses it for remote-dock token allocation. End users should not import it.
48+
`devframe/node/internal` is a marked-internal subpath that exposes a small set of helpers (`getInternalContext`, `resolveBasePath`) for first-party adapters that need to reach into devframe's private machinery — kit's relocated `DocksHost` uses it for remote-dock token allocation. End users should not import it.
4949

5050
## Architecture
5151

alias.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ export const alias = {
1313
'devframe/rpc/server': df('devframe/src/rpc/server.ts'),
1414
'devframe/rpc': df('devframe/src/rpc'),
1515
'devframe/types': df('devframe/src/types/index.ts'),
16+
'devframe/node/auth': df('devframe/src/node/auth/index.ts'),
17+
'devframe/node/internal': df('devframe/src/node/internal/index.ts'),
1618
'devframe/node': df('devframe/src/node/index.ts'),
1719
'devframe/constants': df('devframe/src/constants.ts'),
18-
'devframe/internal': df('devframe/src/internal/index.ts'),
1920
'devframe/utils/colors': df('devframe/src/utils/colors.ts'),
2021
'devframe/utils/events': df('devframe/src/utils/events.ts'),
2122
'devframe/utils/hash': df('devframe/src/utils/hash.ts'),

devframe/packages/devframe/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
"./adapters/vite": "./dist/adapters/vite.mjs",
2929
"./client": "./dist/client/index.mjs",
3030
"./constants": "./dist/constants.mjs",
31-
"./internal": "./dist/internal/index.mjs",
3231
"./node": "./dist/node/index.mjs",
32+
"./node/auth": "./dist/node/auth.mjs",
33+
"./node/internal": "./dist/node/internal.mjs",
3334
"./recipes/open-helpers": "./dist/recipes/open-helpers.mjs",
3435
"./rpc": "./dist/rpc/index.mjs",
3536
"./rpc/client": "./dist/rpc/client.mjs",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './revoke'
2+
export * from './state'

devframe/packages/devframe/src/node/auth-revoke.ts renamed to devframe/packages/devframe/src/node/auth/revoke.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { DevToolsNodeContext } from 'devframe/types'
22
import type { SharedState } from 'devframe/utils/shared-state'
3-
import type { InternalAnonymousAuthStorage } from './context-internal'
4-
import type { RpcFunctionsHost } from './host-functions'
3+
import type { RpcFunctionsHost } from '../host-functions'
4+
import type { InternalAnonymousAuthStorage } from '../internal/context'
55

66
/**
77
* Flip `isTrusted` to false on any live WS clients connected with `token`

devframe/packages/devframe/src/node/auth-state.ts renamed to devframe/packages/devframe/src/node/auth/state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { DevToolsNodeRpcSession } from 'devframe/types'
22
import type { SharedState } from 'devframe/utils/shared-state'
3-
import type { InternalAnonymousAuthStorage } from './context-internal'
3+
import type { InternalAnonymousAuthStorage } from '../internal/context'
44
import { humanId } from 'devframe/utils/human-id'
55

66
export interface PendingAuthRequest {

devframe/packages/devframe/src/node/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// Node-side public API for consumers that wire up their own runtime.
2-
export * from './auth-revoke'
3-
export * from './auth-state'
42
export * from './context'
5-
export * from './context-internal'
63
export * from './host-agent'
74
export * from './host-diagnostics'
85
export * from './host-functions'

devframe/packages/devframe/src/node/context-internal.ts renamed to devframe/packages/devframe/src/node/internal/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { DevToolsNodeContext } from 'devframe/types'
22
import type { SharedState } from 'devframe/utils/shared-state'
33
import { humanId } from 'devframe/utils/human-id'
44
import { join } from 'pathe'
5-
import { revokeActiveConnectionsForToken, revokeAuthToken } from './auth-revoke'
6-
import { createStorage } from './storage'
5+
import { revokeActiveConnectionsForToken, revokeAuthToken } from '../auth/revoke'
6+
import { createStorage } from '../storage'
77

88
export interface InternalAnonymousAuthStorage {
99
trusted: Record<string, {

devframe/packages/devframe/src/internal/index.ts renamed to devframe/packages/devframe/src/node/internal/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
export {
1313
normalizeBasePath,
1414
resolveBasePath,
15-
} from '../adapters/_shared'
15+
} from '../../adapters/_shared'
1616

1717
export {
1818
getInternalContext,
1919
internalContextMap,
20-
} from '../node/context-internal'
20+
} from './context'
2121

2222
export type {
2323
DevToolsInternalContext,
2424
InternalAnonymousAuthStorage,
2525
RemoteTokenRecord,
26-
} from '../node/context-internal'
26+
} from './context'

devframe/packages/devframe/tsdown.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ export default defineConfig({
1010
'rpc/transports/ws-server': 'src/rpc/transports/ws-server.ts',
1111
'types/index': 'src/types/index.ts',
1212
'node/index': 'src/node/index.ts',
13+
'node/auth': 'src/node/auth/index.ts',
14+
'node/internal': 'src/node/internal/index.ts',
1315
'constants': 'src/constants.ts',
14-
'internal/index': 'src/internal/index.ts',
1516
'utils/colors': 'src/utils/colors.ts',
1617
'utils/events': 'src/utils/events.ts',
1718
'utils/hash': 'src/utils/hash.ts',

0 commit comments

Comments
 (0)