Skip to content

Commit 62765c2

Browse files
antfuclaude
andauthored
refactor(devframe): rename devtoolskit:internal: prefix to devframe: (#309)
Aligns devframe-owned identifiers (streaming, shared-state, auth, terminals/messages events, dock/commands/user-settings shared state keys) with the existing `devframe:` convention already used by newer code (e.g. `devframe:open-in-editor`, `devframe:agent:list-tools`). Core-owned RPC function names (`terminals:read`, `messages:add`, etc.) are intentionally unchanged. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2bbdcc1 commit 62765c2

23 files changed

Lines changed: 83 additions & 83 deletions

File tree

devframe/docs/guide/terminals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ ctx.terminals.events.on('terminal:session:updated', (session) => {
104104
})
105105
```
106106

107-
Output chunks aren't delivered as host events anymore — terminals now use the [streaming](./streaming) channel `devtoolskit:internal:terminals` keyed by session id. From the browser:
107+
Output chunks aren't delivered as host events anymore — terminals now use the [streaming](./streaming) channel `devframe:terminals` keyed by session id. From the browser:
108108

109109
```ts
110110
const reader = rpc.streaming.subscribe<string>(
111-
'devtoolskit:internal:terminals',
111+
'devframe:terminals',
112112
sessionId,
113113
)
114114
for await (const chunk of reader) writeToTerminal(chunk)

devframe/packages/devframe/src/client/rpc-shared-state.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function createRpcSharedStateClientHost(rpc: DevToolsRpcClient): RpcShare
1919
}
2020

2121
rpc.client.register({
22-
name: 'devtoolskit:internal:rpc:client-state:updated',
22+
name: 'devframe:rpc:client-state:updated',
2323
type: 'event',
2424
handler: (key: string, fullState: any, syncId: string) => {
2525
const state = sharedState.get(key)
@@ -30,7 +30,7 @@ export function createRpcSharedStateClientHost(rpc: DevToolsRpcClient): RpcShare
3030
})
3131

3232
rpc.client.register({
33-
name: 'devtoolskit:internal:rpc:client-state:patch',
33+
name: 'devframe:rpc:client-state:patch',
3434
type: 'event',
3535
handler: (key: string, patches: SharedStatePatch[], syncId: string) => {
3636
const state = sharedState.get(key)
@@ -46,10 +46,10 @@ export function createRpcSharedStateClientHost(rpc: DevToolsRpcClient): RpcShare
4646
if (isStaticBackend)
4747
return
4848
if (patches) {
49-
rpc.callEvent('devtoolskit:internal:rpc:server-state:patch', key, patches, syncId)
49+
rpc.callEvent('devframe:rpc:server-state:patch', key, patches, syncId)
5050
}
5151
else {
52-
rpc.callEvent('devtoolskit:internal:rpc:server-state:set', key, fullState, syncId)
52+
rpc.callEvent('devframe:rpc:server-state:set', key, fullState, syncId)
5353
}
5454
}))
5555

@@ -83,13 +83,13 @@ export function createRpcSharedStateClientHost(rpc: DevToolsRpcClient): RpcShare
8383

8484
async function initSharedState() {
8585
if (!isStaticBackend) {
86-
rpc.callEvent('devtoolskit:internal:rpc:server-state:subscribe', key)
86+
rpc.callEvent('devframe:rpc:server-state:subscribe', key)
8787
}
8888
if (options?.initialValue !== undefined) {
8989
sharedState.set(key, state)
9090
for (const fn of keyAddedListeners)
9191
fn(key)
92-
rpc.call('devtoolskit:internal:rpc:server-state:get', key)
92+
rpc.call('devframe:rpc:server-state:get', key)
9393
.then((serverState) => {
9494
if (serverState !== undefined)
9595
state.mutate(() => mergeWithInitialValue(key, serverState))
@@ -101,7 +101,7 @@ export function createRpcSharedStateClientHost(rpc: DevToolsRpcClient): RpcShare
101101
return state
102102
}
103103
else {
104-
const serverValue = await rpc.call('devtoolskit:internal:rpc:server-state:get', key) as T
104+
const serverValue = await rpc.call('devframe:rpc:server-state:get', key) as T
105105
state.mutate(() => mergeWithInitialValue(key, serverValue))
106106
sharedState.set(key, state)
107107
for (const fn of keyAddedListeners)

devframe/packages/devframe/src/client/rpc-streaming.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
4646
const uploads = new Map<string, StreamSink<any>>()
4747

4848
rpc.client.register({
49-
name: 'devtoolskit:internal:streaming:chunk',
49+
name: 'devframe:streaming:chunk',
5050
type: 'event',
5151
handler(channel: string, id: string, seq: number, chunk: any) {
5252
const reader = readers.get(streamKey(channel, id))
@@ -55,7 +55,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
5555
})
5656

5757
rpc.client.register({
58-
name: 'devtoolskit:internal:streaming:end',
58+
name: 'devframe:streaming:end',
5959
type: 'event',
6060
handler(channel: string, id: string, error?: StreamErrorPayload) {
6161
const key = streamKey(channel, id)
@@ -68,7 +68,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
6868
})
6969

7070
rpc.client.register({
71-
name: 'devtoolskit:internal:streaming:upload-cancel',
71+
name: 'devframe:streaming:upload-cancel',
7272
type: 'event',
7373
handler(channel: string, id: string) {
7474
const key = streamKey(channel, id)
@@ -99,7 +99,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
9999
const channel = key.slice(0, sepIdx)
100100
const id = key.slice(sepIdx + 1)
101101
rpc.callEvent(
102-
'devtoolskit:internal:streaming:subscribe',
102+
'devframe:streaming:subscribe',
103103
channel,
104104
id,
105105
{ afterSeq: reader.lastSeenSeq },
@@ -127,7 +127,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
127127
)
128128
},
129129
onCancel() {
130-
rpc.callEvent('devtoolskit:internal:streaming:cancel', channel, id)
130+
rpc.callEvent('devframe:streaming:cancel', channel, id)
131131
readers.delete(key)
132132
},
133133
})
@@ -137,7 +137,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
137137
// Subscribe immediately if already trusted; otherwise wait for trust.
138138
// Mirrors `client/rpc-shared-state.ts` behavior.
139139
if (rpc.isTrusted) {
140-
rpc.callEvent('devtoolskit:internal:streaming:subscribe', channel, id, {
140+
rpc.callEvent('devframe:streaming:subscribe', channel, id, {
141141
afterSeq: 0,
142142
})
143143
}
@@ -146,7 +146,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
146146
if (trusted) {
147147
off()
148148
if (readers.has(key) && !reader.cancelled && !reader.done) {
149-
rpc.callEvent('devtoolskit:internal:streaming:subscribe', channel, id, {
149+
rpc.callEvent('devframe:streaming:subscribe', channel, id, {
150150
afterSeq: reader.lastSeenSeq,
151151
})
152152
}
@@ -167,7 +167,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
167167

168168
sink.events.on('chunk', (seq, chunk) => {
169169
rpc.callEvent(
170-
'devtoolskit:internal:streaming:upload-chunk',
170+
'devframe:streaming:upload-chunk',
171171
channel,
172172
id,
173173
seq,
@@ -176,7 +176,7 @@ export function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreami
176176
})
177177
sink.events.on('end', (error) => {
178178
rpc.callEvent(
179-
'devtoolskit:internal:streaming:upload-end',
179+
'devframe:streaming:upload-end',
180180
channel,
181181
id,
182182
error,

devframe/packages/devframe/src/client/rpc-ws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function createWsRpcClientMode(
6262

6363
// Handle server-initiated auth revocation
6464
clientRpc.register({
65-
name: 'devtoolskit:internal:auth:revoked',
65+
name: 'devframe:auth:revoked',
6666
type: 'event',
6767
handler: () => {
6868
isTrusted = false

devframe/packages/devframe/src/node/__tests__/host-functions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ describe('rpcFunctionsHost', () => {
133133
it('should not throw in build mode', async () => {
134134
const host = new RpcFunctionsHost({ mode: 'build' } as DevToolsNodeContext)
135135
await expect(host.broadcast({
136-
method: 'devtoolskit:internal:terminals:updated',
136+
method: 'devframe:terminals:updated',
137137
args: [],
138138
})).resolves.toBeUndefined()
139139
})
140140

141141
it('should not throw in dev mode when rpc group is not yet set', async () => {
142142
const host = new RpcFunctionsHost({ mode: 'dev' } as DevToolsNodeContext)
143143
await expect(host.broadcast({
144-
method: 'devtoolskit:internal:terminals:updated',
144+
method: 'devframe:terminals:updated',
145145
args: [],
146146
})).resolves.toBeUndefined()
147147
})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function revokeActiveConnectionsForToken(
3030
return
3131

3232
await rpcHost.broadcast({
33-
method: 'devtoolskit:internal:auth:revoked',
33+
method: 'devframe:auth:revoked',
3434
args: [],
3535
filter: client => affectedSessionIds.has(client.$meta.id),
3636
})

devframe/packages/devframe/src/node/context.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export async function createHostContext(options: CreateHostContextOptions): Prom
9090

9191
let jrCounter = 0
9292
context.createJsonRenderer = (initialSpec: JsonRenderSpec): JsonRenderer => {
93-
const stateKey = `devtoolskit:internal:json-render:${jrCounter++}`
93+
const stateKey = `devframe:json-render:${jrCounter++}`
9494
const statePromise = rpcHost.sharedState.get(stateKey as any, {
9595
initialValue: initialSpec as any,
9696
})
@@ -123,23 +123,23 @@ export async function createHostContext(options: CreateHostContextOptions): Prom
123123

124124
await docksHost.init()
125125

126-
const docksSharedState = await rpcHost.sharedState.get('devtoolskit:internal:docks', { initialValue: [] })
126+
const docksSharedState = await rpcHost.sharedState.get('devframe:docks', { initialValue: [] })
127127

128128
docksHost.events.on('dock:entry:updated', debounce(() => {
129129
docksSharedState.mutate(() => context.docks.values())
130130
}, mode === 'build' ? 0 : 10))
131131

132132
terminalsHost.events.on('terminal:session:updated', debounce(() => {
133133
rpcHost.broadcast({
134-
method: 'devtoolskit:internal:terminals:updated',
134+
method: 'devframe:terminals:updated',
135135
args: [],
136136
})
137137
docksSharedState.mutate(() => context.docks.values())
138138
}, mode === 'build' ? 0 : 10))
139139

140140
const debouncedMessagesUpdate = debounce(() => {
141141
rpcHost.broadcast({
142-
method: 'devtoolskit:internal:messages:updated',
142+
method: 'devframe:messages:updated',
143143
args: [],
144144
})
145145
docksSharedState.mutate(() => context.docks.values())
@@ -150,7 +150,7 @@ export async function createHostContext(options: CreateHostContextOptions): Prom
150150
messagesHost.events.on('message:removed', () => debouncedMessagesUpdate())
151151
messagesHost.events.on('message:cleared', () => debouncedMessagesUpdate())
152152

153-
const commandsSharedState = await rpcHost.sharedState.get('devtoolskit:internal:commands', { initialValue: [] })
153+
const commandsSharedState = await rpcHost.sharedState.get('devframe:commands', { initialValue: [] })
154154
const debouncedCommandsSync = debounce(() => {
155155
commandsSharedState.mutate(() => commandsHost.list())
156156
}, mode === 'build' ? 0 : 10)

devframe/packages/devframe/src/node/host-docks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class DevToolsDockHost implements DevToolsDockHostType {
6565
}
6666

6767
async init() {
68-
this.userSettings = await this.context.rpc.sharedState.get('devtoolskit:internal:user-settings', {
68+
this.userSettings = await this.context.rpc.sharedState.get('devframe:user-settings', {
6969
sharedState: createStorage({
7070
filepath: join(this.context.workspaceRoot, 'node_modules/.vite/devtools/settings.json'),
7171
initialValue: DEFAULT_STATE_USER_SETTINGS(),

devframe/packages/devframe/src/node/host-terminals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { logger } from './diagnostics'
99
* standalone client (`packages/core/src/client/webcomponents/state/terminals.ts`)
1010
* can subscribe by a stable, well-known name.
1111
*/
12-
const TERMINAL_STREAM_CHANNEL = 'devtoolskit:internal:terminals' as const
12+
const TERMINAL_STREAM_CHANNEL = 'devframe:terminals' as const
1313
const TERMINAL_REPLAY_WINDOW = 1000
1414

1515
export class DevToolsTerminalHost implements DevToolsTerminalHostType {
@@ -92,7 +92,7 @@ export class DevToolsTerminalHost implements DevToolsTerminalHostType {
9292
const channel = this.getStreamingChannel()
9393
// The streaming channel reuses `session.id` as the stream id so clients
9494
// can subscribe immediately after seeing the session in
95-
// `devtoolskit:internal:terminals:list`.
95+
// `devframe:terminals:list`.
9696
const sink = channel?.start({ id: session.id })
9797

9898
const writer = new WritableStream<string>({

devframe/packages/devframe/src/node/rpc-shared-state.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ export function createRpcSharedStateServerHost(
2121
if (patches) {
2222
debug('patch', { key, syncId })
2323
rpc.broadcast({
24-
method: 'devtoolskit:internal:rpc:client-state:patch',
24+
method: 'devframe:rpc:client-state:patch',
2525
args: [key, patches, syncId],
2626
filter: client => client.$meta.subscribedStates.has(key),
2727
})
2828
}
2929
else {
3030
debug('updated', { key, syncId })
3131
rpc.broadcast({
32-
method: 'devtoolskit:internal:rpc:client-state:updated',
32+
method: 'devframe:rpc:client-state:updated',
3333
args: [key, fullState, syncId],
3434
filter: client => client.$meta.subscribedStates.has(key),
3535
})
@@ -80,7 +80,7 @@ export function createRpcSharedStateServerHost(
8080
// server built on `RpcFunctionsHost` (devframe standalone or kit /
8181
// core) gets the full sync protocol out of the box.
8282
rpc.register({
83-
name: 'devtoolskit:internal:rpc:server-state:subscribe',
83+
name: 'devframe:rpc:server-state:subscribe',
8484
type: 'event',
8585
handler(key: string) {
8686
const session = rpc.getCurrentRpcSession()
@@ -92,7 +92,7 @@ export function createRpcSharedStateServerHost(
9292
})
9393

9494
rpc.register({
95-
name: 'devtoolskit:internal:rpc:server-state:get',
95+
name: 'devframe:rpc:server-state:get',
9696
type: 'query',
9797
handler: async (key: string) => {
9898
if (!sharedState.has(key))
@@ -108,7 +108,7 @@ export function createRpcSharedStateServerHost(
108108
})
109109

110110
rpc.register({
111-
name: 'devtoolskit:internal:rpc:server-state:set',
111+
name: 'devframe:rpc:server-state:set',
112112
type: 'query',
113113
handler: async (key: string, value: any, syncId: string) => {
114114
const state = await host.get(key as keyof DevToolsRpcSharedStates, {
@@ -119,7 +119,7 @@ export function createRpcSharedStateServerHost(
119119
})
120120

121121
rpc.register({
122-
name: 'devtoolskit:internal:rpc:server-state:patch',
122+
name: 'devframe:rpc:server-state:patch',
123123
type: 'query',
124124
handler: async (key: string, patches: SharedStatePatch[], syncId: string) => {
125125
if (!sharedState.has(key))

0 commit comments

Comments
 (0)