devframe 0.7.16 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/devframe.mjs +8 -0
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +4 -4
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +1 -1
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +45 -3
- package/dist/adapters/mcp.mjs +2 -2
- package/dist/agent-tool-name-C3b5vEwJ.mjs +34 -0
- package/dist/{cac-CPaOy3LD.mjs → cac-B-R_tDGJ.mjs} +18 -13
- package/dist/cli/main.d.mts +11 -0
- package/dist/cli/main.mjs +283 -0
- package/dist/client/index.d.mts +4 -4
- package/dist/client/index.mjs +88 -4
- package/dist/{context-CzqPrJSz.d.mts → context-7BbaIUSI.d.mts} +1 -1
- package/dist/{context-DY72brRI.mjs → context-C9Cgm1hP.mjs} +1 -1
- package/dist/{dev-BCeaQuGE.mjs → dev-D4M7Veo7.mjs} +22 -11
- package/dist/{devframe-Ckhf3kFw.d.mts → devframe-Dsjn_Xtq.d.mts} +68 -15
- package/dist/diagnostics-B5-qHeqD.mjs +94 -0
- package/dist/{diagnostics-BXwBQmoN.mjs → diagnostics-hwjXp_UV.mjs} +8 -0
- package/dist/{dump-Cz7yVvsB.mjs → dump-CgZShDRB.mjs} +82 -6
- package/dist/{build-server-C7vTKjiQ.mjs → fetch-BZyK4v6W.mjs} +225 -51
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +2 -2
- package/dist/{host-h3-CgOetlNE.mjs → host-h3-Kz7t5Xab.mjs} +83 -28
- package/dist/http-BghOqfTD.mjs +38 -0
- package/dist/{index-8dndvIxR.d.mts → index-CeBbry0R.d.mts} +2 -2
- package/dist/{index-DgsLFhZg.d.mts → index-Dbw1p5ch.d.mts} +27 -3
- package/dist/{index-YDSJgsyG.d.mts → index-vAX6bYuc.d.mts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/instance-registry-D6fxYu36.mjs +190 -0
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +1 -1
- package/dist/node/index.d.mts +104 -6
- package/dist/node/index.mjs +5 -4
- package/dist/recipes/common-rpc-functions.d.mts +33 -33
- package/dist/recipes/common-rpc-functions.mjs +6 -6
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +13 -13
- package/dist/rpc/dump.d.mts +1 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -4
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +1 -1
- package/dist/{serialization-DpLXCy13.mjs → serialization-C8Mnw9hK.mjs} +1 -1
- package/dist/{server-DykHCza_.mjs → server-CcAPxuoT.mjs} +2 -2
- package/dist/{server-B0wiP_Oi.d.mts → server-VLQJouOO.d.mts} +2 -2
- package/dist/simple-schema-BDzLeJDk.d.mts +102 -0
- package/dist/simple-schema-DQPZrAaZ.mjs +154 -0
- package/dist/{storage-gEnj9ASQ.mjs → storage-Dzoc3NVC.mjs} +2 -66
- package/dist/{transports-BmDVn4SF.mjs → transports-vhizgqXM.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/{types-CrzNxXKq.d.mts → types-CnJSgRVa.d.mts} +33 -19
- package/dist/utils/agent-tool-name.d.mts +27 -0
- package/dist/utils/agent-tool-name.mjs +34 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/simple-schema.d.mts +2 -0
- package/dist/utils/simple-schema.mjs +154 -0
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/{ws-client-DSXiI2h7.d.mts → ws-client-B6Tnr0ic.d.mts} +1 -1
- package/dist/{ws-server-9-wn7MNQ.d.mts → ws-server-D_Vjtums.d.mts} +1 -1
- package/package.json +18 -7
- package/skills/devframe/SKILL.md +1 -1
- package/dist/http-_pPbryTQ.mjs +0 -114
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as RpcFunctionType, S as RpcFunctionSetupResult, T as RpcReturnSchema, _ as RpcFunctionDefinition, i as RpcArgsSchema, v as RpcFunctionDefinitionAny, w as RpcFunctionsCollector } from "./types-
|
|
2
|
-
import { a as getDefinitionsWithDumps$1, c as StaticRpcDumpManifest$1, d as StaticRpcDumpManifestValue$1, f as StaticRpcDumpSerialization$1, i as dumpFunctions$1, l as StaticRpcDumpManifestQueryEntry$1, n as serializeDumpError$1, o as StaticRpcDumpCollection$1, p as collectStaticRpcDump$1, r as createClientFromDump$1, s as StaticRpcDumpFile$1, t as reviveDumpError$1, u as StaticRpcDumpManifestStaticEntry$1 } from "./index-
|
|
1
|
+
import { C as RpcFunctionType, S as RpcFunctionSetupResult, T as RpcReturnSchema, _ as RpcFunctionDefinition, i as RpcArgsSchema, v as RpcFunctionDefinitionAny, w as RpcFunctionsCollector } from "./types-CnJSgRVa.mjs";
|
|
2
|
+
import { a as getDefinitionsWithDumps$1, c as StaticRpcDumpManifest$1, d as StaticRpcDumpManifestValue$1, f as StaticRpcDumpSerialization$1, i as dumpFunctions$1, l as StaticRpcDumpManifestQueryEntry$1, n as serializeDumpError$1, o as StaticRpcDumpCollection$1, p as collectStaticRpcDump$1, r as createClientFromDump$1, s as StaticRpcDumpFile$1, t as reviveDumpError$1, u as StaticRpcDumpManifestStaticEntry$1 } from "./index-vAX6bYuc.mjs";
|
|
3
3
|
//#region src/rpc/cache.d.ts
|
|
4
4
|
interface RpcCacheOptions {
|
|
5
5
|
functions: string[];
|
|
@@ -94,6 +94,30 @@ declare const STRUCTURED_CLONE_PREFIX = "s:";
|
|
|
94
94
|
*/
|
|
95
95
|
declare function strictJsonStringify(value: unknown, fnName?: string): string;
|
|
96
96
|
//#endregion
|
|
97
|
+
//#region src/rpc/validate-io.d.ts
|
|
98
|
+
/**
|
|
99
|
+
* Validate positional arguments against their declared schemas. Only
|
|
100
|
+
* indices with a schema are checked; extra arguments pass through
|
|
101
|
+
* untouched. Throws `DF0038` on the first failing argument.
|
|
102
|
+
*
|
|
103
|
+
* Validation guards the payload without rewriting it: the original values
|
|
104
|
+
* are handed to the handler unchanged, so a schema that describes a subset
|
|
105
|
+
* of an object never silently strips the sender's extra fields (and any
|
|
106
|
+
* declared transforms stay a purely type-level concern).
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
declare function validateRpcArgs(name: string, argsSchema: RpcArgsSchema | undefined, args: readonly unknown[]): Promise<unknown[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Validate a handler's resolved return value against its declared schema.
|
|
113
|
+
* Throws `DF0039` when the value fails the schema, otherwise returns the
|
|
114
|
+
* original value unchanged (guard-only, never rewriting the payload — see
|
|
115
|
+
* {@link validateRpcArgs}). Passes through when no return schema is set.
|
|
116
|
+
*
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
declare function validateRpcReturn(name: string, returnSchema: RpcReturnSchema | undefined, value: unknown): Promise<unknown>;
|
|
120
|
+
//#endregion
|
|
97
121
|
//#region src/rpc/validation.d.ts
|
|
98
122
|
/**
|
|
99
123
|
* Validates RPC function definitions.
|
|
@@ -137,4 +161,4 @@ type StaticRpcDumpManifestValue = StaticRpcDumpManifestValue$1;
|
|
|
137
161
|
/** @deprecated Import from `devframe/rpc/dump` instead. */
|
|
138
162
|
type StaticRpcDumpSerialization = StaticRpcDumpSerialization$1;
|
|
139
163
|
//#endregion
|
|
140
|
-
export {
|
|
164
|
+
export { defineRpcFunction as C, RpcCacheOptions as E, createDefineWrapperWithContext as S, RpcCacheManager as T, validateRpcReturn as _, StaticRpcDumpManifestStaticEntry as a, getRpcHandler as b, collectStaticRpcDump as c, getDefinitionsWithDumps as d, reviveDumpError as f, validateRpcArgs as g, validateDefinitions as h, StaticRpcDumpManifestQueryEntry as i, createClientFromDump as l, validateDefinition as m, StaticRpcDumpFile as n, StaticRpcDumpManifestValue as o, serializeDumpError as p, StaticRpcDumpManifest as r, StaticRpcDumpSerialization as s, StaticRpcDumpCollection as t, dumpFunctions as u, STRUCTURED_CLONE_PREFIX as v, RpcFunctionsCollectorBase as w, getRpcResolvedSetupResult as x, strictJsonStringify as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as RpcDumpStore, l as RpcDumpClientOptions, m as RpcDumpRecordError, n as BirpcReturn, o as RpcDefinitionsToFunctions, u as RpcDumpCollectionOptions, v as RpcFunctionDefinitionAny } from "./types-
|
|
1
|
+
import { h as RpcDumpStore, l as RpcDumpClientOptions, m as RpcDumpRecordError, n as BirpcReturn, o as RpcDefinitionsToFunctions, u as RpcDumpCollectionOptions, v as RpcFunctionDefinitionAny } from "./types-CnJSgRVa.mjs";
|
|
2
2
|
//#region src/rpc/dump/static.d.ts
|
|
3
3
|
type StaticRpcDumpSerialization = 'json' | 'structured-clone';
|
|
4
4
|
interface StaticRpcDumpManifestStaticEntry {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as DevframeRpcServerFunctions, A as DevframeSettingsStore, At as
|
|
2
|
-
import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-
|
|
3
|
-
import "./index-
|
|
4
|
-
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-
|
|
1
|
+
import { $ as DevframeRpcServerFunctions, A as DevframeSettingsStore, At as DevframeAgentHostEvents, B as DevframeDefineDiagnosticsOptions, C as DevframeServicesHost, Ct as AgentResourceContent, D as DevframeScopedStreamingHost, Dt as AgentToolProvider, E as DevframeScopedNodeRpc, Et as AgentToolInput, F as ScopedSharedStates, G as RpcBroadcastOptions, H as DevframeDiagnosticsHost, I as SettingsForNamespace, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost, M as ScopedClientFunctions, Mt as EventUnsubscribe, N as ScopedRpcFn, Nt as EventsMap, O as DevframeSettings, Ot as AgentToolProviderHandle, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, V as DevframeDiagnosticsDefinition, W as DevframeNodeRpcSession, X as RpcStreamingChannelOptions, Y as RpcStreamingChannel, Z as RpcStreamingHost, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentHandle, c as DevframeSetupInfo, d as McpRouteOptions, et as DevframeRpcSharedStates, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, jt as EventEmitter, k as DevframeSettingsRegistry, kt as DevframeAgentHost, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateGetOptions, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest, y as DevframeCapabilities, z as DevframeStorageScope } from "./devframe-Dsjn_Xtq.mjs";
|
|
2
|
+
import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-CnJSgRVa.mjs";
|
|
3
|
+
import "./index-Dbw1p5ch.mjs";
|
|
4
|
+
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-D_Vjtums.mjs";
|
|
5
5
|
//#region src/define.d.ts
|
|
6
6
|
declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type ConnectionMeta, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeBrowserContext, type DevframeCapabilities, type DevframeCliOptions, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRuntime, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeServiceId, type DevframeServiceOf, type DevframeServicesHost, type DevframeServicesRegistry, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSpaOptions, type DevframeStorageScope, type DevframeViewHost, type DevframeWsOptions, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpRouteOptions, type PartialWithoutId, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedRpcFn, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, type defineDevframe, defineRpcFunction };
|
|
8
|
+
export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type AgentToolProvider, type AgentToolProviderHandle, type ConnectionMeta, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeBrowserContext, type DevframeCapabilities, type DevframeCliOptions, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRuntime, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeServiceId, type DevframeServiceOf, type DevframeServicesHost, type DevframeServicesRegistry, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSpaOptions, type DevframeStorageScope, type DevframeViewHost, type DevframeWsOptions, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpRouteOptions, type PartialWithoutId, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedRpcFn, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, type defineDevframe, defineRpcFunction };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { t as diagnostics } from "./diagnostics-B5-qHeqD.mjs";
|
|
2
|
+
import { mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "pathe";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
//#region src/node/instance-registry.ts
|
|
7
|
+
/** Environment variable overriding the registry directory (tests, CI). */
|
|
8
|
+
const DEVFRAME_INSTANCES_DIR_ENV = "DEVFRAME_INSTANCES_DIR";
|
|
9
|
+
/** Environment variable disabling instance registration entirely. */
|
|
10
|
+
const DEVFRAME_DISABLE_INSTANCE_REGISTRY_ENV = "DEVFRAME_DISABLE_INSTANCE_REGISTRY";
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the registry directory: `~/.devframe/instances/` by default —
|
|
13
|
+
* the framework's own global dir, deliberately outside the per-app
|
|
14
|
+
* `~/.<appName>/devframe/` storage convention since the registry spans apps —
|
|
15
|
+
* overridable via `DEVFRAME_INSTANCES_DIR`.
|
|
16
|
+
*/
|
|
17
|
+
function resolveInstancesDir(override) {
|
|
18
|
+
return override ?? process.env[DEVFRAME_INSTANCES_DIR_ENV] ?? join(homedir(), ".devframe", "instances");
|
|
19
|
+
}
|
|
20
|
+
function isRegistryDisabled() {
|
|
21
|
+
const value = process.env[DEVFRAME_DISABLE_INSTANCE_REGISTRY_ENV];
|
|
22
|
+
return value === "1" || value === "true";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Record a running devframe instance in the global instance registry so
|
|
26
|
+
* discovery tooling (`devframe connect`, editor integrations) can find it
|
|
27
|
+
* without port guessing.
|
|
28
|
+
*
|
|
29
|
+
* `createDevServer` registers automatically; custom hosts that serve a
|
|
30
|
+
* devframe in-process (e.g. `@devframes/next`'s host inside a Next dev
|
|
31
|
+
* server) call this explicitly with the origin they are reachable at.
|
|
32
|
+
*
|
|
33
|
+
* The record is written atomically to `<dir>/<pid>-<port>.json` and removed
|
|
34
|
+
* by {@link DevframeInstanceRegistration.unregister}. Records surviving a
|
|
35
|
+
* crash are pruned by readers whose liveness probe fails. Registration never
|
|
36
|
+
* throws — a write failure degrades to a coded warning (`DF0045`), since a
|
|
37
|
+
* dev server must not die over discovery metadata.
|
|
38
|
+
*
|
|
39
|
+
* @experimental
|
|
40
|
+
*/
|
|
41
|
+
function registerDevframeInstance(record, options = {}) {
|
|
42
|
+
const dir = resolveInstancesDir(options.instancesDir);
|
|
43
|
+
const file = join(dir, `${record.pid}-${record.port}.json`);
|
|
44
|
+
if (!isRegistryDisabled()) try {
|
|
45
|
+
mkdirSync(dir, { recursive: true });
|
|
46
|
+
const tmp = join(dir, `.${record.pid}-${record.port}.${Date.now()}.tmp`);
|
|
47
|
+
writeFileSync(tmp, `${JSON.stringify(record, null, 2)}\n`);
|
|
48
|
+
renameSync(tmp, file);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
diagnostics.DF0045({
|
|
51
|
+
file,
|
|
52
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
53
|
+
cause: error
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
file,
|
|
58
|
+
unregister: () => {
|
|
59
|
+
try {
|
|
60
|
+
rmSync(file, { force: true });
|
|
61
|
+
} catch (error) {
|
|
62
|
+
diagnostics.DF0045({
|
|
63
|
+
file,
|
|
64
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
65
|
+
cause: error
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Read every record in the registry directory, dropping unparseable files.
|
|
73
|
+
* Liveness is the caller's concern — see {@link probeDevframeInstance}.
|
|
74
|
+
*
|
|
75
|
+
* @experimental
|
|
76
|
+
*/
|
|
77
|
+
function readDevframeInstances(options = {}) {
|
|
78
|
+
const dir = resolveInstancesDir(options.instancesDir);
|
|
79
|
+
let files;
|
|
80
|
+
try {
|
|
81
|
+
files = readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
82
|
+
} catch {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
const records = [];
|
|
86
|
+
for (const file of files) try {
|
|
87
|
+
const parsed = JSON.parse(readFileSync(join(dir, file), "utf8"));
|
|
88
|
+
if (typeof parsed?.origin === "string" && typeof parsed?.pid === "number") records.push(parsed);
|
|
89
|
+
} catch {}
|
|
90
|
+
return records;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Dialable-origin candidates for a recorded origin. A `localhost` bind is
|
|
94
|
+
* ambiguous — the server may listen on `127.0.0.1`, `::1`, or both, and
|
|
95
|
+
* HTTP clients differ in which family they try — so probe the explicit
|
|
96
|
+
* addresses too and adopt whichever answers.
|
|
97
|
+
*/
|
|
98
|
+
function originCandidates(origin) {
|
|
99
|
+
try {
|
|
100
|
+
const url = new URL(origin);
|
|
101
|
+
if (url.hostname !== "localhost") return [origin];
|
|
102
|
+
const port = url.port ? `:${url.port}` : "";
|
|
103
|
+
return [
|
|
104
|
+
origin,
|
|
105
|
+
`${url.protocol}//127.0.0.1${port}`,
|
|
106
|
+
`${url.protocol}//[::1]${port}`
|
|
107
|
+
];
|
|
108
|
+
} catch {
|
|
109
|
+
return [origin];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Probe `<origin><basePath>__connection.json`, trying each dialable
|
|
114
|
+
* candidate for the origin (see {@link originCandidates}). The single
|
|
115
|
+
* probe primitive behind both registry liveness checks and the
|
|
116
|
+
* connector's explicit `--port` probes.
|
|
117
|
+
*
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
async function probeDevframeOrigin(origin, basePath, timeoutMs) {
|
|
121
|
+
const base = basePath.endsWith("/") ? basePath : `${basePath}/`;
|
|
122
|
+
for (const candidate of originCandidates(origin)) try {
|
|
123
|
+
const response = await fetch(`${candidate}${base}__connection.json`, { signal: AbortSignal.timeout(timeoutMs ?? 1e3) });
|
|
124
|
+
if (!response.ok) continue;
|
|
125
|
+
return {
|
|
126
|
+
origin: candidate,
|
|
127
|
+
meta: await response.json().catch(() => ({}))
|
|
128
|
+
};
|
|
129
|
+
} catch {}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Probe a record's `__connection.json` to check the instance is alive.
|
|
134
|
+
* Returns the **dialable origin** that answered (for `localhost` records
|
|
135
|
+
* this may be an explicit `127.0.0.1` / `[::1]` origin), or `null` when
|
|
136
|
+
* unreachable.
|
|
137
|
+
*/
|
|
138
|
+
async function probeDevframeInstance(record, options = {}) {
|
|
139
|
+
return (await probeDevframeOrigin(record.origin, record.basePath, options.timeoutMs))?.origin ?? null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Read the registry and split records into live and dead by probing each
|
|
143
|
+
* one's `__connection.json`, deleting dead records (prune-on-read). Live
|
|
144
|
+
* records carry the dialable origin the probe confirmed (a `localhost`
|
|
145
|
+
* record may come back as `127.0.0.1` / `[::1]`).
|
|
146
|
+
*
|
|
147
|
+
* A liveness probe only proves *something* answers on the record's port, so
|
|
148
|
+
* records left behind by killed processes shadow the server currently bound
|
|
149
|
+
* there: per `(port, basePath)` only the newest record survives, older
|
|
150
|
+
* ghosts are pruned with the dead.
|
|
151
|
+
*
|
|
152
|
+
* @experimental
|
|
153
|
+
*/
|
|
154
|
+
async function listLiveDevframeInstances(options = {}) {
|
|
155
|
+
const dir = resolveInstancesDir(options.instancesDir);
|
|
156
|
+
const records = readDevframeInstances({ instancesDir: dir });
|
|
157
|
+
const pruned = [];
|
|
158
|
+
const prune = (record) => {
|
|
159
|
+
pruned.push(record);
|
|
160
|
+
try {
|
|
161
|
+
rmSync(join(dir, `${record.pid}-${record.port}.json`), { force: true });
|
|
162
|
+
} catch {}
|
|
163
|
+
};
|
|
164
|
+
const newest = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const record of records) {
|
|
166
|
+
const key = `${record.port}|${record.basePath}`;
|
|
167
|
+
const existing = newest.get(key);
|
|
168
|
+
if (!existing) newest.set(key, record);
|
|
169
|
+
else if (record.startedAt > existing.startedAt) {
|
|
170
|
+
prune(existing);
|
|
171
|
+
newest.set(key, record);
|
|
172
|
+
} else prune(record);
|
|
173
|
+
}
|
|
174
|
+
const live = [];
|
|
175
|
+
await Promise.all([...newest.values()].map(async (record) => {
|
|
176
|
+
const origin = await probeDevframeInstance(record, options);
|
|
177
|
+
if (origin) live.push(origin === record.origin ? record : {
|
|
178
|
+
...record,
|
|
179
|
+
origin
|
|
180
|
+
});
|
|
181
|
+
else prune(record);
|
|
182
|
+
}));
|
|
183
|
+
live.sort((a, b) => a.startedAt - b.startedAt);
|
|
184
|
+
return {
|
|
185
|
+
live,
|
|
186
|
+
pruned
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { probeDevframeOrigin as n, registerDevframeInstance as r, listLiveDevframeInstances as t };
|
package/dist/node/auth.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { p as DevframeAuthHandler } from "../devframe-
|
|
2
|
-
import { a as verifyAuthToken, i as refreshTempAuthCode, n as exchangeTempAuthCode, o as revokeActiveConnectionsForToken, r as getTempAuthCode, s as revokeAuthToken, t as buildOtpAuthUrl } from "../index-
|
|
1
|
+
import { p as DevframeAuthHandler } from "../devframe-Dsjn_Xtq.mjs";
|
|
2
|
+
import { a as verifyAuthToken, i as refreshTempAuthCode, n as exchangeTempAuthCode, o as revokeActiveConnectionsForToken, r as getTempAuthCode, s as revokeAuthToken, t as buildOtpAuthUrl } from "../index-CeBbry0R.mjs";
|
|
3
3
|
export { DevframeAuthHandler, buildOtpAuthUrl, exchangeTempAuthCode, getTempAuthCode, refreshTempAuthCode, revokeActiveConnectionsForToken, revokeAuthToken, verifyAuthToken };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-
|
|
1
|
+
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-Dsjn_Xtq.mjs";
|
|
2
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-7BbaIUSI.mjs";
|
|
3
3
|
//#region src/adapters/_shared.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the mount base path for a devframe's SPA. Hosted adapters
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as internalContextMap, t as getInternalContext } from "../context-
|
|
1
|
+
import { n as internalContextMap, t as getInternalContext } from "../context-C9Cgm1hP.mjs";
|
|
2
2
|
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
3
3
|
export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,8 +1,38 @@
|
|
|
1
|
-
import { C as DevframeServicesHost, Ct as AgentResourceContent, Dt as
|
|
2
|
-
import { v as RpcFunctionDefinitionAny } from "../types-
|
|
3
|
-
import "../index-
|
|
4
|
-
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-
|
|
1
|
+
import { At as DevframeAgentHostEvents, C as DevframeServicesHost, Ct as AgentResourceContent, Dt as AgentToolProvider, Et as AgentToolInput, H as DevframeDiagnosticsHost$1, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost$1, O as DevframeSettings, Ot as AgentToolProviderHandle, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, Z as RpcStreamingHost, b as DevframeNodeContext, bt as AgentHandle, ht as SharedState, jt as EventEmitter, kt as DevframeAgentHost$1, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest } from "../devframe-Dsjn_Xtq.mjs";
|
|
2
|
+
import { v as RpcFunctionDefinitionAny } from "../types-CnJSgRVa.mjs";
|
|
3
|
+
import "../index-Dbw1p5ch.mjs";
|
|
4
|
+
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-VLQJouOO.mjs";
|
|
5
5
|
import { BirpcGroup } from "birpc";
|
|
6
|
+
//#region src/node/agent-args.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* How {@link coerceAgentPositionalArgs} treats an args object that carries
|
|
9
|
+
* neither declared schemas nor `arg0`/`arg1`/… keys:
|
|
10
|
+
*
|
|
11
|
+
* - `'wrap'` — pass the object itself as the single positional argument.
|
|
12
|
+
* RPC-backed tools use this: an untyped RPC may take one raw object.
|
|
13
|
+
* - `'drop'` — call with zero arguments. Command-backed tools use this:
|
|
14
|
+
* a handler's positional parameters come solely from its declared
|
|
15
|
+
* `agent.args` schemas, so undeclared payload is ignored.
|
|
16
|
+
*/
|
|
17
|
+
type AgentArgsFallback = 'wrap' | 'drop';
|
|
18
|
+
/**
|
|
19
|
+
* Map the args payload an agent surface receives (MCP sends an object
|
|
20
|
+
* keyed `arg0`/`arg1`/…, matching the schema the adapter advertises) onto
|
|
21
|
+
* a handler's positional parameters. Shared by the agent host's RPC
|
|
22
|
+
* bridge and the hub's command-derived tools so the coercion cannot
|
|
23
|
+
* drift between them.
|
|
24
|
+
*
|
|
25
|
+
* - an array passes through as-is
|
|
26
|
+
* - `null`/`undefined` become a zero-argument call
|
|
27
|
+
* - with declared schemas, each schema reads its own `argN` key, in order
|
|
28
|
+
* - without schemas, `arg0`/`arg1`/… keys are collected when present
|
|
29
|
+
* - an empty object becomes a zero-argument call
|
|
30
|
+
* - anything else follows the {@link AgentArgsFallback}
|
|
31
|
+
*
|
|
32
|
+
* @experimental
|
|
33
|
+
*/
|
|
34
|
+
declare function coerceAgentPositionalArgs(args: unknown, schemas: readonly unknown[] | undefined, fallback?: AgentArgsFallback): unknown[];
|
|
35
|
+
//#endregion
|
|
6
36
|
//#region src/node/context.d.ts
|
|
7
37
|
interface CreateHostContextOptions {
|
|
8
38
|
cwd: string;
|
|
@@ -40,10 +70,12 @@ declare class DevframeAgentHost implements DevframeAgentHost$1 {
|
|
|
40
70
|
readonly events: EventEmitter<DevframeAgentHostEvents>;
|
|
41
71
|
private readonly tools;
|
|
42
72
|
private readonly resources;
|
|
73
|
+
private readonly providers;
|
|
43
74
|
private _rpcUnsubscribe;
|
|
44
75
|
constructor(context: DevframeNodeContext);
|
|
45
76
|
registerTool(input: AgentToolInput): AgentHandle;
|
|
46
77
|
unregisterTool(id: string): boolean;
|
|
78
|
+
registerToolProvider(provider: AgentToolProvider): AgentToolProviderHandle;
|
|
47
79
|
registerResource(input: AgentResourceInput): AgentHandle;
|
|
48
80
|
unregisterResource(id: string): boolean;
|
|
49
81
|
list(): AgentManifest;
|
|
@@ -55,9 +87,10 @@ declare class DevframeAgentHost implements DevframeAgentHost$1 {
|
|
|
55
87
|
_dispose(): void;
|
|
56
88
|
private _validateToolId;
|
|
57
89
|
private _projectTool;
|
|
90
|
+
/** Query every registered provider, projecting inputs to serializable tools. */
|
|
91
|
+
private _collectProviderTools;
|
|
58
92
|
private _collectRpcTools;
|
|
59
93
|
private _findRpcDefinition;
|
|
60
|
-
private _coercePositionalArgs;
|
|
61
94
|
}
|
|
62
95
|
//#endregion
|
|
63
96
|
//#region src/node/host-diagnostics.d.ts
|
|
@@ -135,6 +168,71 @@ declare class DevframeViewHost implements DevframeViewHost$1 {
|
|
|
135
168
|
hostStatic(baseUrl: string, distDir: string): void;
|
|
136
169
|
}
|
|
137
170
|
//#endregion
|
|
171
|
+
//#region src/node/instance-registry.d.ts
|
|
172
|
+
/**
|
|
173
|
+
* One running devframe instance, as recorded in the instance registry.
|
|
174
|
+
* Records are self-describing JSON — additive fields are safe.
|
|
175
|
+
*
|
|
176
|
+
* @experimental The agent-native surface is experimental and may change
|
|
177
|
+
* without a major version bump until it stabilizes.
|
|
178
|
+
*/
|
|
179
|
+
interface DevframeInstanceRecord {
|
|
180
|
+
/** Process id of the dev server. */
|
|
181
|
+
pid: number;
|
|
182
|
+
/** Listening port. */
|
|
183
|
+
port: number;
|
|
184
|
+
/** Dialable HTTP origin, e.g. `http://127.0.0.1:9876`. */
|
|
185
|
+
origin: string;
|
|
186
|
+
/** Base path the devframe is mounted at (trailing slash). */
|
|
187
|
+
basePath: string;
|
|
188
|
+
/** Definition id. */
|
|
189
|
+
id: string;
|
|
190
|
+
/** Definition display name. */
|
|
191
|
+
name?: string;
|
|
192
|
+
/** Working directory the instance was started from. */
|
|
193
|
+
rootDir: string;
|
|
194
|
+
/**
|
|
195
|
+
* Absolute URL path of the MCP Streamable-HTTP endpoint on `origin`, or
|
|
196
|
+
* `null` when the instance runs without an MCP route.
|
|
197
|
+
*/
|
|
198
|
+
mcp: {
|
|
199
|
+
path: string;
|
|
200
|
+
} | null;
|
|
201
|
+
/** Epoch-ms timestamp of registration. */
|
|
202
|
+
startedAt: number;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Handle returned by {@link registerDevframeInstance}.
|
|
206
|
+
*
|
|
207
|
+
* @experimental
|
|
208
|
+
*/
|
|
209
|
+
interface DevframeInstanceRegistration {
|
|
210
|
+
/** The registry file backing this registration. */
|
|
211
|
+
readonly file: string;
|
|
212
|
+
/** Remove the record (idempotent). Call on server close. */
|
|
213
|
+
unregister: () => void;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Record a running devframe instance in the global instance registry so
|
|
217
|
+
* discovery tooling (`devframe connect`, editor integrations) can find it
|
|
218
|
+
* without port guessing.
|
|
219
|
+
*
|
|
220
|
+
* `createDevServer` registers automatically; custom hosts that serve a
|
|
221
|
+
* devframe in-process (e.g. `@devframes/next`'s host inside a Next dev
|
|
222
|
+
* server) call this explicitly with the origin they are reachable at.
|
|
223
|
+
*
|
|
224
|
+
* The record is written atomically to `<dir>/<pid>-<port>.json` and removed
|
|
225
|
+
* by {@link DevframeInstanceRegistration.unregister}. Records surviving a
|
|
226
|
+
* crash are pruned by readers whose liveness probe fails. Registration never
|
|
227
|
+
* throws — a write failure degrades to a coded warning (`DF0045`), since a
|
|
228
|
+
* dev server must not die over discovery metadata.
|
|
229
|
+
*
|
|
230
|
+
* @experimental
|
|
231
|
+
*/
|
|
232
|
+
declare function registerDevframeInstance(record: DevframeInstanceRecord, options?: {
|
|
233
|
+
instancesDir?: string;
|
|
234
|
+
}): DevframeInstanceRegistration;
|
|
235
|
+
//#endregion
|
|
138
236
|
//#region src/node/rpc-shared-state.d.ts
|
|
139
237
|
declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost): RpcSharedStateHost;
|
|
140
238
|
//#endregion
|
|
@@ -180,4 +278,4 @@ declare function toDialableHost(host: string): string;
|
|
|
180
278
|
declare function formatHostForUrl(host: string): string;
|
|
181
279
|
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
182
280
|
//#endregion
|
|
183
|
-
export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, type RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
|
281
|
+
export { AgentArgsFallback, CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, type DevframeInstanceRecord, type DevframeInstanceRegistration, DevframeServicesHostImpl, DevframeViewHost, type RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, coerceAgentPositionalArgs, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, registerDevframeInstance, startHttpAndWs, toDialableHost };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { a as DevframeViewHost, c as createRpcSharedStateServerHost, d as coerceAgentPositionalArgs, i as createNodeSettings, l as DevframeDiagnosticsHost, n as createHostContext, o as DevframeServicesHostImpl, r as createScopedNodeContext, s as createRpcStreamingServerHost, t as createH3DevframeHost, u as DevframeAgentHost } from "../host-h3-Kz7t5Xab.mjs";
|
|
2
|
+
import { t as createStorage } from "../storage-Dzoc3NVC.mjs";
|
|
3
|
+
import { r as registerDevframeInstance } from "../instance-registry-D6fxYu36.mjs";
|
|
4
|
+
import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-CcAPxuoT.mjs";
|
|
5
|
+
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, coerceAgentPositionalArgs, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, registerDevframeInstance, startHttpAndWs, toDialableHost };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../devframe-
|
|
2
|
-
import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-
|
|
3
|
-
import "../index-
|
|
4
|
-
import
|
|
1
|
+
import "../devframe-Dsjn_Xtq.mjs";
|
|
2
|
+
import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-CnJSgRVa.mjs";
|
|
3
|
+
import "../index-Dbw1p5ch.mjs";
|
|
4
|
+
import { t as SimpleSchema } from "../simple-schema-BDzLeJDk.mjs";
|
|
5
5
|
//#region src/recipes/common-rpc-functions.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Editor commands that `launch-editor` (the library behind
|
|
@@ -11,7 +11,7 @@ import * as v from "valibot";
|
|
|
11
11
|
* arbitrary command.
|
|
12
12
|
*/
|
|
13
13
|
type KnownEditor = 'atom' | 'subl' | 'sublime' | 'sublime_text' | 'wstorm' | 'charm' | 'zed' | 'notepad++' | 'vim' | 'mvim' | 'joe' | 'gvim' | 'emacs' | 'emacsclient' | 'rmate' | 'mate' | 'code' | 'code-insiders' | 'codium' | 'vscodium' | 'trae' | 'antigravity' | 'cursor' | 'appcode' | 'clion' | 'idea' | 'phpstorm' | 'pycharm' | 'rubymine' | 'webstorm' | 'goland' | 'rider';
|
|
14
|
-
/** Runtime list of every {@link KnownEditor}
|
|
14
|
+
/** Runtime list of every {@link KnownEditor}. */
|
|
15
15
|
declare const KNOWN_EDITORS: KnownEditor[];
|
|
16
16
|
/**
|
|
17
17
|
* Prebuilt RPC action that opens a file in the user's configured editor.
|
|
@@ -38,16 +38,16 @@ declare const openInEditor: {
|
|
|
38
38
|
name: "devframe:open-in-editor";
|
|
39
39
|
type?: "action" | undefined;
|
|
40
40
|
cacheable?: boolean;
|
|
41
|
-
args: readonly [
|
|
42
|
-
returns:
|
|
41
|
+
args: readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>];
|
|
42
|
+
returns: SimpleSchema<void, void>;
|
|
43
43
|
jsonSerializable?: boolean;
|
|
44
44
|
agent?: RpcFunctionAgentOptions;
|
|
45
|
-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void
|
|
46
|
-
handler?: ((args_0: string, args_1: KnownEditor | undefined) => void) | undefined;
|
|
47
|
-
dump?: RpcDump<[string, KnownEditor | undefined], void
|
|
45
|
+
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>) | undefined;
|
|
46
|
+
handler?: ((args_0: string, args_1: KnownEditor | undefined) => Thenable<void>) | undefined;
|
|
47
|
+
dump?: RpcDump<[string, KnownEditor | undefined], Thenable<void>, undefined> | undefined;
|
|
48
48
|
snapshot?: boolean;
|
|
49
|
-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void
|
|
50
|
-
__promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void
|
|
49
|
+
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>> | undefined;
|
|
50
|
+
__promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>> | undefined;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Prebuilt RPC action that reveals a path in the OS file explorer.
|
|
@@ -64,16 +64,16 @@ declare const openInFinder: {
|
|
|
64
64
|
name: "devframe:open-in-finder";
|
|
65
65
|
type?: "action" | undefined;
|
|
66
66
|
cacheable?: boolean;
|
|
67
|
-
args: readonly [
|
|
68
|
-
returns:
|
|
67
|
+
args: readonly [SimpleSchema<string, string>];
|
|
68
|
+
returns: SimpleSchema<void, void>;
|
|
69
69
|
jsonSerializable?: boolean;
|
|
70
70
|
agent?: RpcFunctionAgentOptions;
|
|
71
|
-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], void
|
|
72
|
-
handler?: ((args_0: string) => void) | undefined;
|
|
73
|
-
dump?: RpcDump<[string], void
|
|
71
|
+
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>) | undefined;
|
|
72
|
+
handler?: ((args_0: string) => Thenable<void>) | undefined;
|
|
73
|
+
dump?: RpcDump<[string], Thenable<void>, undefined> | undefined;
|
|
74
74
|
snapshot?: boolean;
|
|
75
|
-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], void
|
|
76
|
-
__promise?: Thenable<RpcFunctionSetupResult<[string], void
|
|
75
|
+
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>> | undefined;
|
|
76
|
+
__promise?: Thenable<RpcFunctionSetupResult<[string], Thenable<void>>> | undefined;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* Convenience array bundling both helpers so callers can register them
|
|
@@ -89,30 +89,30 @@ declare const commonRpcFunctions: readonly [{
|
|
|
89
89
|
name: "devframe:open-in-editor";
|
|
90
90
|
type?: "action" | undefined;
|
|
91
91
|
cacheable?: boolean;
|
|
92
|
-
args: readonly [
|
|
93
|
-
returns:
|
|
92
|
+
args: readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>];
|
|
93
|
+
returns: SimpleSchema<void, void>;
|
|
94
94
|
jsonSerializable?: boolean;
|
|
95
95
|
agent?: RpcFunctionAgentOptions;
|
|
96
|
-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void
|
|
97
|
-
handler?: ((args_0: string, args_1: KnownEditor | undefined) => void) | undefined;
|
|
98
|
-
dump?: RpcDump<[string, KnownEditor | undefined], void
|
|
96
|
+
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>) | undefined;
|
|
97
|
+
handler?: ((args_0: string, args_1: KnownEditor | undefined) => Thenable<void>) | undefined;
|
|
98
|
+
dump?: RpcDump<[string, KnownEditor | undefined], Thenable<void>, undefined> | undefined;
|
|
99
99
|
snapshot?: boolean;
|
|
100
|
-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void
|
|
101
|
-
__promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void
|
|
100
|
+
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>>> | undefined;
|
|
101
|
+
__promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], Thenable<void>>> | undefined;
|
|
102
102
|
}, {
|
|
103
103
|
name: "devframe:open-in-finder";
|
|
104
104
|
type?: "action" | undefined;
|
|
105
105
|
cacheable?: boolean;
|
|
106
|
-
args: readonly [
|
|
107
|
-
returns:
|
|
106
|
+
args: readonly [SimpleSchema<string, string>];
|
|
107
|
+
returns: SimpleSchema<void, void>;
|
|
108
108
|
jsonSerializable?: boolean;
|
|
109
109
|
agent?: RpcFunctionAgentOptions;
|
|
110
|
-
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], void
|
|
111
|
-
handler?: ((args_0: string) => void) | undefined;
|
|
112
|
-
dump?: RpcDump<[string], void
|
|
110
|
+
setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>) | undefined;
|
|
111
|
+
handler?: ((args_0: string) => Thenable<void>) | undefined;
|
|
112
|
+
dump?: RpcDump<[string], Thenable<void>, undefined> | undefined;
|
|
113
113
|
snapshot?: boolean;
|
|
114
|
-
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], void
|
|
115
|
-
__promise?: Thenable<RpcFunctionSetupResult<[string], void
|
|
114
|
+
__cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>> | undefined;
|
|
115
|
+
__promise?: Thenable<RpcFunctionSetupResult<[string], Thenable<void>>> | undefined;
|
|
116
116
|
}];
|
|
117
117
|
//#endregion
|
|
118
118
|
export { KNOWN_EDITORS, KnownEditor, commonRpcFunctions, openInEditor, openInFinder };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
|
|
2
|
-
import
|
|
2
|
+
import { t as s } from "../simple-schema-DQPZrAaZ.mjs";
|
|
3
3
|
//#region src/recipes/common-rpc-functions.ts
|
|
4
|
-
/** Runtime list of every {@link KnownEditor}
|
|
4
|
+
/** Runtime list of every {@link KnownEditor}. */
|
|
5
5
|
const KNOWN_EDITORS = [
|
|
6
6
|
"atom",
|
|
7
7
|
"subl",
|
|
@@ -61,8 +61,8 @@ const openInEditor = defineRpcFunction({
|
|
|
61
61
|
name: "devframe:open-in-editor",
|
|
62
62
|
type: "action",
|
|
63
63
|
jsonSerializable: true,
|
|
64
|
-
args: [
|
|
65
|
-
returns:
|
|
64
|
+
args: [s.string(), s.optional(s.picklist(KNOWN_EDITORS))],
|
|
65
|
+
returns: s.void(),
|
|
66
66
|
async handler(filename, editor) {
|
|
67
67
|
const { launchEditor } = await import("../utils/launch-editor.mjs");
|
|
68
68
|
launchEditor(filename, editor);
|
|
@@ -83,8 +83,8 @@ const openInFinder = defineRpcFunction({
|
|
|
83
83
|
name: "devframe:open-in-finder",
|
|
84
84
|
type: "action",
|
|
85
85
|
jsonSerializable: true,
|
|
86
|
-
args: [
|
|
87
|
-
returns:
|
|
86
|
+
args: [s.string()],
|
|
87
|
+
returns: s.void(),
|
|
88
88
|
async handler(path) {
|
|
89
89
|
const { open } = await import("../utils/open.mjs");
|
|
90
90
|
await open(path);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-Dsjn_Xtq.mjs";
|
|
2
|
+
import "../index-CeBbry0R.mjs";
|
|
3
3
|
//#region src/recipes/interactive-auth.d.ts
|
|
4
4
|
interface CreateInteractiveAuthOptions {
|
|
5
5
|
/**
|