Open
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.
| Option | Type | Description |
|---|---|---|
editor | KnownEditor | Preferred editor command (one of KNOWN_EDITORS). Auto-detected via LAUNCH_EDITOR and common defaults when omitted. |
roots | string[] | 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.
| Function | Args | Purpose |
|---|---|---|
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
Built-in wire services (@devframes/service-*): one node-side capability installed once per host and consumed by every devframe and RPC client, without re-implementing or re-bundling it.
Git
The @devframes/service-git wire service: typed read/write git operations over RPC on one repository, shared by every devframe on the host.