Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ minimumReleaseAgeExclude:
- vitest@4.1.7
- '@tanstack/virtual-core@3.15.0'
- '@tanstack/vue-virtual@3.13.25'
- devframe@0.4.1
- devframe@0.5.2
- portless@0.13.1
shellEmulator: true

Expand Down Expand Up @@ -41,7 +41,7 @@ catalog:
bumpp: ^11.1.0
cac: ^7.0.0
colorjs.io: ^0.6.1
devframe: ^0.4.1
devframe: ^0.5.2
dotenv: ^17.4.2
eslint: ^10.4.0
floating-vue: ^5.2.2
Expand Down
4 changes: 2 additions & 2 deletions src/devframe/hub-mode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DevToolsNodeContext } from 'devframe'
import type { DevframeNodeContext } from 'devframe'
import type { ProjectContext, ProjectRegistry } from './project-context'
import type { HubInfo } from './rpc/types'
import { resolve } from 'pathe'
Expand Down Expand Up @@ -34,7 +34,7 @@ export interface HubModeHandle {
}

export async function setupHubMode(
devframeCtx: DevToolsNodeContext,
devframeCtx: DevframeNodeContext,
options: HubModeOptions,
): Promise<HubModeHandle> {
const launchCwd = resolve(options.cwd)
Expand Down
4 changes: 2 additions & 2 deletions src/devframe/project-factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DevToolsNodeContext } from 'devframe'
import type { DevframeNodeContext } from 'devframe'
import type { GhfsResolvedConfig } from '../types'
import type { RepositoryProvider } from '../types/provider'
import type { ProjectBroadcast, ProjectContext } from './project-context'
Expand Down Expand Up @@ -26,7 +26,7 @@ export interface BuildProjectOptions {
onRequestToken?: () => Promise<string>
/** Poller tick — default 60s. Hub passes a slower tick. */
pollerIntervalMs?: number
devframeCtx: DevToolsNodeContext
devframeCtx: DevframeNodeContext
}

export async function buildProjectContext(options: BuildProjectOptions): Promise<ProjectContext> {
Expand Down
4 changes: 2 additions & 2 deletions src/devframe/rpc/hub-context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DevToolsNodeContext } from 'devframe'
import type { DevframeNodeContext } from 'devframe'
import type { ProjectContext } from '../project-context'
import type { HubInfo } from './types'

Expand All @@ -8,7 +8,7 @@ import type { HubInfo } from './types'
* context with `setHubContext`.
*/
export interface HubRpcContext {
devframeCtx: DevToolsNodeContext
devframeCtx: DevframeNodeContext
homeDir?: string
launchCwd: string
roots: Set<string>
Expand Down
4 changes: 2 additions & 2 deletions src/devframe/rpc/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DevToolsNodeContext } from 'devframe'
import type { DevframeNodeContext } from 'devframe'
import { addQueueOp } from './add-queue-op'
import { capabilities } from './capabilities'
import { checkRemote } from './check-remote'
Expand Down Expand Up @@ -82,7 +82,7 @@ export const rpcFunctions = [
setRepoTemplates,
] as const

export function registerGhfsRpc(ctx: DevToolsNodeContext): void {
export function registerGhfsRpc(ctx: DevframeNodeContext): void {
for (const fn of rpcFunctions)
ctx.rpc.register(fn as any)
}
2 changes: 1 addition & 1 deletion src/devframe/rpc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export interface CardsSharedState {
}

declare module 'devframe/types' {
interface DevToolsRpcSharedStates {
interface DevframeRpcSharedStates {
'ghfs:cards-pile': CardsSharedState
}
}
20 changes: 10 additions & 10 deletions src/devframe/rpc/utils.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import type { DevToolsNodeContext } from 'devframe'
import type { DevframeNodeContext } from 'devframe'
import type { UiState } from '../../server/types'
import type { ProjectRegistry } from '../project-context'
import type { HubRpcContext } from './hub-context'
import { diagnostics } from '../../logger'

const registryMap = new WeakMap<DevToolsNodeContext, ProjectRegistry>()
const hubMap = new WeakMap<DevToolsNodeContext, HubRpcContext>()
const uiStateSavedMap = new WeakMap<DevToolsNodeContext, (state: UiState, projectId: string) => void>()
const registryMap = new WeakMap<DevframeNodeContext, ProjectRegistry>()
const hubMap = new WeakMap<DevframeNodeContext, HubRpcContext>()
const uiStateSavedMap = new WeakMap<DevframeNodeContext, (state: UiState, projectId: string) => void>()

export function getProjectRegistry(ctx: DevToolsNodeContext): ProjectRegistry {
export function getProjectRegistry(ctx: DevframeNodeContext): ProjectRegistry {
const reg = registryMap.get(ctx)
if (!reg)
throw diagnostics.GHFS0206({ detail: 'Project registry not initialized for this devframe context.' })
return reg
}

export function setProjectRegistry(ctx: DevToolsNodeContext, registry: ProjectRegistry): void {
export function setProjectRegistry(ctx: DevframeNodeContext, registry: ProjectRegistry): void {
registryMap.set(ctx, registry)
}

export function getHubContext(ctx: DevToolsNodeContext): HubRpcContext {
export function getHubContext(ctx: DevframeNodeContext): HubRpcContext {
const hub = hubMap.get(ctx)
if (!hub)
throw diagnostics.GHFS0206({ detail: 'Hub context not initialized for this devframe context.' })
return hub
}

export function setHubContext(ctx: DevToolsNodeContext, hub: HubRpcContext): void {
export function setHubContext(ctx: DevframeNodeContext, hub: HubRpcContext): void {
hubMap.set(ctx, hub)
}

export function getUiStateSavedCallback(ctx: DevToolsNodeContext): ((state: UiState, projectId: string) => void) | undefined {
export function getUiStateSavedCallback(ctx: DevframeNodeContext): ((state: UiState, projectId: string) => void) | undefined {
return uiStateSavedMap.get(ctx)
}

export function setUiStateSavedCallback(ctx: DevToolsNodeContext, cb: (state: UiState, projectId: string) => void): void {
export function setUiStateSavedCallback(ctx: DevframeNodeContext, cb: (state: UiState, projectId: string) => void): void {
uiStateSavedMap.set(ctx, cb)
}
4 changes: 2 additions & 2 deletions src/devframe/ui-mode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DevToolsNodeContext } from 'devframe'
import type { DevframeNodeContext } from 'devframe'
import type { GhfsResolvedConfig } from '../types'
import type { ProjectRegistry } from './project-context'
import { createAutoSyncTimer } from '../hub/auto-sync'
Expand Down Expand Up @@ -26,7 +26,7 @@ export interface UiModeHandle {
}

export async function setupUiMode(
devframeCtx: DevToolsNodeContext,
devframeCtx: DevframeNodeContext,
options: UiModeOptions,
): Promise<UiModeHandle> {
const project = await buildProjectContext({
Expand Down
10 changes: 5 additions & 5 deletions ui/composables/useRpc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GhfsCapabilities, GhfsClientFunctions, GhfsServerFunctions } from '#ghfs/rpc-types'
import type { SyncStage } from '#ghfs/sync-contracts'
import type { DevToolsRpcClient } from 'devframe/client'
import type { DevframeRpcClient } from 'devframe/client'
import { connectDevframe } from 'devframe/client'
import { useAppState } from './useAppState'
import type { ProgressCurrentItem } from './useAppState'
Expand Down Expand Up @@ -54,15 +54,15 @@ export interface GhfsRpc {
}

let rpcShim: GhfsRpc | null = null
let clientPromise: Promise<DevToolsRpcClient> | null = null
let clientPromise: Promise<DevframeRpcClient> | null = null

function ensureClient(): Promise<DevToolsRpcClient> {
function ensureClient(): Promise<DevframeRpcClient> {
if (clientPromise)
return clientPromise
// Fetch our own `/__connection.json` and pass the result explicitly.
//
// Why not let devframe fetch it via `baseURL`? Because
// `connectDevframe()` first checks `window.__VITE_DEVTOOLS_CONNECTION_META__`,
// `connectDevframe()` first checks `window.__DEVFRAME_CONNECTION_META__`,
// and the newer Vite/Nuxt DevTools sets that global to point at the
// Nuxt dev server's own WS — which lands devframe on the wrong port
// (the SPA port, not the paired ghfs server's port). Passing
Expand Down Expand Up @@ -123,7 +123,7 @@ export function useRpc(): GhfsRpc {
* Access the full devframe client — needed for `rpc.sharedState`,
* `rpc.streaming`, etc. Resolves once the connection handshake completes.
*/
export function useRpcClient(): Promise<DevToolsRpcClient> {
export function useRpcClient(): Promise<DevframeRpcClient> {
if (typeof window === 'undefined')
return Promise.reject(new Error('devframe RPC not available (SSR)'))
return ensureClient()
Expand Down
Loading