Open

The @devframes/service-open wire service: open files in an editor or reveal them in the OS explorer over RPC, with workspace-root path containment and editor gating.

Open files in an editor or reveal them in the OS explorer, shared over RPC by every devframe on the host. Replaces per-devframe registration of the (deprecated) devframe/recipes/common-rpc-functions recipe with one install, feature-detectable from RPC clients, adding workspace-root path containment on top of editor gating.

Package: @devframes/service-open · Scope: devframes:service:open

Installing

defineDevframe({
  importMetaUrl: import.meta.url,
  services: [
    { package: '@devframes/service-open', options: { editor: 'code' } },
  ],
})

A hub installs a shared instance with initHub({ services: [createOpenService(options)] }).

Options

OpenServiceOptions — later installer wins on editor; roots union-merged.

OptionTypeDescription
editorKnownEditorPreferred editor command (one of KNOWN_EDITORS). Auto-detected via LAUNCH_EDITOR and common defaults when omitted.
rootsstring[]Extra directories files may be opened from, on top of the context's workspaceRoot (e.g. a managed storage dir outside the workspace).

RPC functions

Registered under devframes:service:open:*, both actions. Paths may be absolute or relative to the workspaceRoot; the service refuses paths outside the workspace root plus the configured roots (DS_OPEN_0002), and gates editor to the KNOWN_EDITORS picklist so the surface can't spawn an arbitrary command.

FunctionArgsPurpose
open-in-editor{ path, line?, column?, editor? }Open a file, optionally at a line/column, in the user's editor.
open-in-finder{ path }Reveal a path in the OS file explorer.

Node API

ctx.services.get('@devframes/service-open') returns the in-process OpenServiceApi (no RPC hop server-side): openInEditor(input) and openInFinder({ path }).

On the RPC client

const rpc = await connectDevframe()

if (rpc.services.has('@devframes/service-open')) {
  const open = rpc.services.get('@devframes/service-open')!
  await open.rpc.call('open-in-editor', { path: 'src/main.ts', line: 42, column: 7 })
  await open.rpc.call('open-in-finder', { path: 'public' })
}

Source

services/open