devframe 1.2.3 → 1.2.5

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.
Files changed (61) hide show
  1. package/dist/{_shared-B2PZsp-J.mjs → _shared-DlRoV7v3.mjs} +1 -0
  2. package/dist/{_shared-DjkowZKP.d.mts → _shared-NSl4p_om.d.mts} +4 -2
  3. package/dist/adapters/build.d.mts +1 -1
  4. package/dist/adapters/build.mjs +3 -3
  5. package/dist/adapters/cac.d.mts +1 -1
  6. package/dist/adapters/cac.mjs +2 -2
  7. package/dist/adapters/dev.d.mts +3 -3
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +2 -2
  11. package/dist/adapters/initiate.mjs +1 -1
  12. package/dist/adapters/mcp.d.mts +2 -2
  13. package/dist/{agentic-B8y_r5tQ.d.mts → agentic-D61fXLzA.d.mts} +1 -1
  14. package/dist/client/index.d.mts +2 -1
  15. package/dist/client/index.mjs +60 -11
  16. package/dist/constants.d.mts +1 -0
  17. package/dist/constants.mjs +1 -1
  18. package/dist/{context-BqpgC5tq.mjs → context-BKw9KkCR.mjs} +110 -83
  19. package/dist/{context-CNX8VDIJ.d.mts → context-Bgvuxv1C.d.mts} +1 -1
  20. package/dist/{context-CHpyLX8W.mjs → context-CNq7GLeT.mjs} +2 -2
  21. package/dist/{context-BvaYawdU.d.mts → context-DhycZ2lx.d.mts} +14 -0
  22. package/dist/{dev-CInztvNK.mjs → dev-BViAfnlw.mjs} +4 -4
  23. package/dist/{events-BV4Dj59a.mjs → events-0wDwalmL.mjs} +1 -0
  24. package/dist/handler-DmaAfpGq.mjs +110 -0
  25. package/dist/{host-agent-mIbQ6Qi5.mjs → host-agent-CJu735ch.mjs} +1 -1
  26. package/dist/in-page-channel/index.d.mts +1 -1
  27. package/dist/in-page-channel/index.mjs +1 -1
  28. package/dist/{index-LtvVaxSc.d.mts → index-DFPsvDGu.d.mts} +2 -2
  29. package/dist/index.d.mts +1 -1
  30. package/dist/{instance-shell-C3VrwJRS.mjs → instance-shell-DmyVIJzj.mjs} +5 -5
  31. package/dist/{instance-shell-CM2nruNe.d.mts → instance-shell-fl3ir6RC.d.mts} +2 -2
  32. package/dist/{interactive-auth-BCa_iamv.mjs → interactive-auth-FFOGnYIC.mjs} +1 -1
  33. package/dist/internal/index.d.mts +5 -5
  34. package/dist/internal/index.mjs +5 -5
  35. package/dist/node/auth.d.mts +2 -2
  36. package/dist/node/auth.mjs +1 -1
  37. package/dist/node/hub-internals.d.mts +2 -2
  38. package/dist/node/hub-internals.mjs +2 -2
  39. package/dist/node/index.d.mts +1 -1
  40. package/dist/node/index.mjs +2 -2
  41. package/dist/recipes/interactive-auth.d.mts +2 -2
  42. package/dist/recipes/interactive-auth.mjs +1 -1
  43. package/dist/{revoke-cqztiCX4.mjs → revoke-CeQUo6KI.mjs} +1 -1
  44. package/dist/rpc/dump.mjs +1 -1
  45. package/dist/rpc/index.mjs +2 -1
  46. package/dist/rpc/transports/ws-bun.d.mts +1 -1
  47. package/dist/rpc/transports/ws-deno.d.mts +1 -1
  48. package/dist/{rpc-core-CZ72-_vD.d.mts → rpc-core-BcThIWzY.d.mts} +2 -2
  49. package/dist/{rpc-core-BXyMjbKG.mjs → rpc-core-CXgALhUi.mjs} +13 -9
  50. package/dist/{tool-input-BAQXvvqL.mjs → tool-input-CES3Pc4y.mjs} +1 -0
  51. package/dist/types/index.d.mts +1 -1
  52. package/dist/utils/events.d.mts +1 -1
  53. package/dist/utils/open.mjs +1 -1
  54. package/dist/utils/serve-static.mjs +1 -1
  55. package/dist/utils/shared-state.d.mts +1 -1
  56. package/dist/utils/streaming-channel.d.mts +1 -1
  57. package/dist/{validation-BzxTTYaV.mjs → validation-CMfDAti3.mjs} +1 -109
  58. package/dist/{write-BWIO0h0Z.mjs → write-DK7rBUN3.mjs} +2 -1
  59. package/package.json +3 -3
  60. package/dist/{instance-registry-C-nC0By7.mjs → instance-registry-DFrZdU4B.mjs} +1 -1
  61. package/dist/{storage-CHD1IkqU.mjs → storage-DPoitS2X.mjs} +1 -1
@@ -52,6 +52,7 @@ const DEVFRAME_EVENTS = {
52
52
  */
53
53
  broadcast: {
54
54
  authRevoked: "devframe:auth:revoked",
55
+ cacheInvalidate: "devframe:rpc:cache:invalidate",
55
56
  clientStateUpdated: "devframe:rpc:client-state:updated",
56
57
  clientStatePatch: "devframe:rpc:client-state:patch",
57
58
  streamingChunk: "devframe:streaming:chunk",
@@ -0,0 +1,110 @@
1
+ import { r as diagnostics } from "./serialization-BhuOoL80.mjs";
2
+ //#region src/rpc/validate-io.ts
3
+ /**
4
+ * Run a single [Standard Schema](https://standardschema.dev) validator,
5
+ * awaiting the result when the validator is asynchronous.
6
+ */
7
+ async function runStandardSchema(schema, value) {
8
+ const result = schema["~standard"].validate(value);
9
+ return result instanceof Promise ? await result : result;
10
+ }
11
+ /**
12
+ * Render Standard Schema issues into a single human-readable line for a
13
+ * diagnostic message, prefixing each with its dotted path when present.
14
+ */
15
+ function formatIssues(issues) {
16
+ return issues.map((issue) => {
17
+ const path = issue.path?.map((segment) => typeof segment === "object" ? segment.key : segment).join(".");
18
+ return path ? `${path}: ${issue.message}` : issue.message;
19
+ }).join("; ");
20
+ }
21
+ /**
22
+ * Validate positional arguments against their declared schemas. Only
23
+ * indices with a schema are checked; extra arguments pass through
24
+ * untouched. Throws `DF0038` on the first failing argument.
25
+ *
26
+ * Validation guards the payload without rewriting it: the original values
27
+ * are handed to the handler unchanged, so a schema that describes a subset
28
+ * of an object never silently strips the sender's extra fields (and any
29
+ * declared transforms stay a purely type-level concern).
30
+ *
31
+ * @internal
32
+ */
33
+ async function validateRpcArgs(name, argsSchema, args) {
34
+ const original = args.slice();
35
+ if (!argsSchema || argsSchema.length === 0) return original;
36
+ for (let index = 0; index < argsSchema.length; index++) {
37
+ const schema = argsSchema[index];
38
+ if (!schema) continue;
39
+ const result = await runStandardSchema(schema, args[index]);
40
+ if (result.issues) throw diagnostics.DF0043({
41
+ name,
42
+ index,
43
+ issues: formatIssues(result.issues)
44
+ });
45
+ }
46
+ return original;
47
+ }
48
+ /**
49
+ * Validate a handler's resolved return value against its declared schema.
50
+ * Throws `DF0039` when the value fails the schema, otherwise returns the
51
+ * original value unchanged (guard-only, never rewriting the payload; see
52
+ * {@link validateRpcArgs}). Passes through when no return schema is set.
53
+ *
54
+ * @internal
55
+ */
56
+ async function validateRpcReturn(name, returnSchema, value) {
57
+ if (!returnSchema) return value;
58
+ const result = await runStandardSchema(returnSchema, value);
59
+ if (result.issues) throw diagnostics.DF0044({
60
+ name,
61
+ issues: formatIssues(result.issues)
62
+ });
63
+ return value;
64
+ }
65
+ //#endregion
66
+ //#region src/rpc/handler.ts
67
+ async function getRpcResolvedSetupResult(definition, context) {
68
+ if (!definition.setup) return {};
69
+ if (typeof context === "object" && context !== null) {
70
+ definition.__cache ??= /* @__PURE__ */ new WeakMap();
71
+ const cache = definition.__cache;
72
+ let promise = cache.get(context);
73
+ if (!promise) {
74
+ promise = Promise.resolve(definition.setup(context));
75
+ promise.catch(() => {
76
+ if (cache.get(context) === promise) cache.delete(context);
77
+ });
78
+ cache.set(context, promise);
79
+ }
80
+ return await promise;
81
+ }
82
+ if (!definition.__promise) {
83
+ const promise = Promise.resolve(definition.setup(context));
84
+ promise.catch(() => {
85
+ if (definition.__promise === promise) definition.__promise = void 0;
86
+ });
87
+ definition.__promise = promise;
88
+ }
89
+ return await definition.__promise;
90
+ }
91
+ async function getRpcHandler(definition, context) {
92
+ let handler = definition.handler;
93
+ if (!handler) {
94
+ const result = await getRpcResolvedSetupResult(definition, context);
95
+ if (!result.handler) throw diagnostics.DF0024({ name: definition.name });
96
+ handler = result.handler;
97
+ }
98
+ const argsSchema = definition.args;
99
+ const returnSchema = definition.returns;
100
+ if (!argsSchema && !returnSchema) return handler;
101
+ const inner = handler;
102
+ const validating = async (...args) => {
103
+ const validatedArgs = await validateRpcArgs(definition.name, argsSchema, args);
104
+ const output = await inner(...validatedArgs);
105
+ return await validateRpcReturn(definition.name, returnSchema, output);
106
+ };
107
+ return validating;
108
+ }
109
+ //#endregion
110
+ export { validateRpcReturn as i, getRpcResolvedSetupResult as n, validateRpcArgs as r, getRpcHandler as t };
@@ -1,4 +1,4 @@
1
- import { t as DEVFRAME_EVENTS } from "./events-BV4Dj59a.mjs";
1
+ import { t as DEVFRAME_EVENTS } from "./events-0wDwalmL.mjs";
2
2
  import { t as diagnostics } from "./diagnostics-Cx4_VjlG.mjs";
3
3
  //#region src/utils/events.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { D as InferArgsType, E as Thenable, O as InferReturnType, T as RpcReturnSchema, m as RpcFunctionAgentOptions, n as RpcArgsSchema } from "../types-BmDbfHCx.mjs";
2
- import { Kt as EventEmitter, k as SharedState } from "../context-BvaYawdU.mjs";
2
+ import { Kt as EventEmitter, k as SharedState } from "../context-DhycZ2lx.mjs";
3
3
  //#region src/in-page-channel/types.d.ts
4
4
  /**
5
5
  * The shared contract of one in-page channel, declared once (usually in a
@@ -1,4 +1,4 @@
1
- import { a as defineDiagnostics, i as createBirpc, n as argsToJsonSchema, o as DEVFRAME_EVENTS, r as resolveAgentSafety, t as toolInputToRpcArgs } from "../tool-input-BAQXvvqL.mjs";
1
+ import { a as defineDiagnostics, i as createBirpc, n as argsToJsonSchema, o as DEVFRAME_EVENTS, r as resolveAgentSafety, t as toolInputToRpcArgs } from "../tool-input-CES3Pc4y.mjs";
2
2
  import { createEventEmitter } from "../utils/events.mjs";
3
3
  import { t as createSharedState } from "../shared-state-Cow3u-_m.mjs";
4
4
  import { nanoid } from "../utils/nanoid.mjs";
@@ -1,5 +1,5 @@
1
- import { k as SharedState, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-BvaYawdU.mjs";
2
- import { n as InternalAnonymousAuthStorage } from "./context-CNX8VDIJ.mjs";
1
+ import { k as SharedState, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-DhycZ2lx.mjs";
2
+ import { n as InternalAnonymousAuthStorage } from "./context-Bgvuxv1C.mjs";
3
3
  //#region src/node/auth/revoke.d.ts
4
4
  /**
5
5
  * Flip `isTrusted` to false on any live WS clients connected with `token`
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { C as RpcFunctionType, T as RpcReturnSchema, h as RpcFunctionDefinition, m as RpcFunctionAgentOptions, n as RpcArgsSchema } from "./types-BmDbfHCx.mjs";
2
- import { $ as DevframeServiceDefinition, B as DevframeDefinition, Bt as AgentTool, Ct as DevframeRpcClientFunctions, Dt as DevframeStorageScope, Et as DevframeHost, F as CreateMcpServerOptions, Ft as AgentHandle, G as DevframeSetupInfo, Gt as DevframeAgentHostEvents, H as DevframeDockDefaults, Ht as AgentToolProvider, I as McpConnectionInfo, It as AgentManifest, J as DevframeSseOptions, Jt as EventsMap, K as DevframeSnapshotRpcEntry, Kt as EventEmitter, L as McpFetchHandler, Lt as AgentResource, Ot as DevframeDiagnosticsHost, P as CreateMcpFetchHandlerOptions, Q as McpSetting, R as McpServerHandle, Rt as AgentResourceContent, St as DevframeViewHost, Tt as DevframeRpcSharedStates, U as DevframeDuplicationStrategy, Ut as AgentToolProviderHandle, V as DevframeDeploymentKind, Vt as AgentToolInput, W as DevframeRpcOptions, Wt as DevframeAgentHost, X as McpAuthorization, Y as DevframeWsOptions, Z as McpRouteOptions, _t as ScopedClientFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeServiceScopeOf, bt as ScopedSharedStates, c as RpcBroadcastOptions, ct as DevframeServicesScopeRegistry, d as RpcSharedStateHost, dt as DevframeScopedNodeRpc, et as DevframeServiceDescriptor, f as RpcStreamingChannel, ft as DevframeScopedStreamingHost, gt as ScopedBroadcastOptions, ht as DevframeSettingsStore, i as DevframeCapabilities, it as DevframeServiceOf, kt as DevframeDiagnosticsLogger, l as RpcFunctionsHost, lt as DevframeServicesState, m as RpcStreamingHost, mt as DevframeSettingsRegistry, n as ConnectionMetaSse, nt as DevframeServiceInput, o as DevframeNodeContext, ot as DevframeServicesHost, p as RpcStreamingChannelOptions, pt as DevframeSettings, q as DevframeSnapshotRpcInputs, qt as EventUnsubscribe, r as ConnectionMetaWebsocket, rt as DevframeServiceMeta, s as DevframeNodeRpcSession, st as DevframeServicesRegistry, t as ConnectionMeta, tt as DevframeServiceId, u as RpcSharedStateGetOptions, ut as DevframeScopedNodeContext, vt as ScopedRpcFn, wt as DevframeRpcServerFunctions, xt as SettingsForNamespace, yt as ScopedServerFunctions, z as DevframeCliOptions, zt as AgentResourceInput } from "./context-BvaYawdU.mjs";
2
+ import { $ as DevframeServiceDefinition, B as DevframeDefinition, Bt as AgentTool, Ct as DevframeRpcClientFunctions, Dt as DevframeStorageScope, Et as DevframeHost, F as CreateMcpServerOptions, Ft as AgentHandle, G as DevframeSetupInfo, Gt as DevframeAgentHostEvents, H as DevframeDockDefaults, Ht as AgentToolProvider, I as McpConnectionInfo, It as AgentManifest, J as DevframeSseOptions, Jt as EventsMap, K as DevframeSnapshotRpcEntry, Kt as EventEmitter, L as McpFetchHandler, Lt as AgentResource, Ot as DevframeDiagnosticsHost, P as CreateMcpFetchHandlerOptions, Q as McpSetting, R as McpServerHandle, Rt as AgentResourceContent, St as DevframeViewHost, Tt as DevframeRpcSharedStates, U as DevframeDuplicationStrategy, Ut as AgentToolProviderHandle, V as DevframeDeploymentKind, Vt as AgentToolInput, W as DevframeRpcOptions, Wt as DevframeAgentHost, X as McpAuthorization, Y as DevframeWsOptions, Z as McpRouteOptions, _t as ScopedClientFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeServiceScopeOf, bt as ScopedSharedStates, c as RpcBroadcastOptions, ct as DevframeServicesScopeRegistry, d as RpcSharedStateHost, dt as DevframeScopedNodeRpc, et as DevframeServiceDescriptor, f as RpcStreamingChannel, ft as DevframeScopedStreamingHost, gt as ScopedBroadcastOptions, ht as DevframeSettingsStore, i as DevframeCapabilities, it as DevframeServiceOf, kt as DevframeDiagnosticsLogger, l as RpcFunctionsHost, lt as DevframeServicesState, m as RpcStreamingHost, mt as DevframeSettingsRegistry, n as ConnectionMetaSse, nt as DevframeServiceInput, o as DevframeNodeContext, ot as DevframeServicesHost, p as RpcStreamingChannelOptions, pt as DevframeSettings, q as DevframeSnapshotRpcInputs, qt as EventUnsubscribe, r as ConnectionMetaWebsocket, rt as DevframeServiceMeta, s as DevframeNodeRpcSession, st as DevframeServicesRegistry, t as ConnectionMeta, tt as DevframeServiceId, u as RpcSharedStateGetOptions, ut as DevframeScopedNodeContext, vt as ScopedRpcFn, wt as DevframeRpcServerFunctions, xt as SettingsForNamespace, yt as ScopedServerFunctions, z as DevframeCliOptions, zt as AgentResourceInput } from "./context-DhycZ2lx.mjs";
3
3
  import { a as DevframeWsPeer, i as DevframeRpcTransportKind, n as DevframeRpcConnection, r as DevframeRpcConnectionRequest, t as DevframeNodeRpcSessionMeta } from "./session-r6PDixP6.mjs";
4
4
  import { a as RemoteAssetsStore, i as RemoteAssetsProviderCustom, n as RemoteAssetsErrorMessage, o as StaticAssetsSource, r as RemoteAssetsProvider, t as RemoteAssets } from "./remote-assets-eBvSKZMS.mjs";
5
5
  import { i as DevframeDefineDiagnosticsOptions } from "./nostics-DWvukRwa.mjs";
@@ -1,9 +1,9 @@
1
1
  import "./constants.mjs";
2
2
  import { r as validateOriginCandidate } from "./origin-DZit9g29.mjs";
3
3
  import { t as diagnostics } from "./diagnostics-Cx4_VjlG.mjs";
4
- import { c as joinURL, d as withoutLeadingSlash, f as withoutTrailingSlash, u as withLeadingSlash } from "./_shared-B2PZsp-J.mjs";
5
- import { t as getInternalContext } from "./context-CHpyLX8W.mjs";
6
- import { n as createInteractiveAuth } from "./interactive-auth-BCa_iamv.mjs";
4
+ import { c as joinURL, d as withoutLeadingSlash, f as withoutTrailingSlash, u as withLeadingSlash } from "./_shared-DlRoV7v3.mjs";
5
+ import { t as getInternalContext } from "./context-CNq7GLeT.mjs";
6
+ import { n as createInteractiveAuth } from "./interactive-auth-FFOGnYIC.mjs";
7
7
  import { createServer } from "node:http";
8
8
  import process from "node:process";
9
9
  import { isIP } from "node:net";
@@ -321,7 +321,7 @@ function createInstanceShell(options) {
321
321
  const origin = currentOrigin();
322
322
  if (!cfg || registerPromise || !origin || !meta) return;
323
323
  const resolvedMeta = meta;
324
- registerPromise = import("./instance-registry-C-nC0By7.mjs").then((n) => n.t).then(({ registerDevframeInstance }) => {
324
+ registerPromise = import("./instance-registry-DFrZdU4B.mjs").then((n) => n.t).then(({ registerDevframeInstance }) => {
325
325
  let port = 0;
326
326
  try {
327
327
  const url = new URL(origin);
@@ -397,7 +397,7 @@ function createInstanceShell(options) {
397
397
  let resolvedAuth = false;
398
398
  let corePromise;
399
399
  function ensureCore() {
400
- corePromise ??= import("./rpc-core-BXyMjbKG.mjs").then((n) => n.n).then(({ createContextRpcServer }) => createContextRpcServer({
400
+ corePromise ??= import("./rpc-core-CXgALhUi.mjs").then((n) => n.n).then(({ createContextRpcServer }) => createContextRpcServer({
401
401
  context: ctx,
402
402
  auth: resolvedAuth,
403
403
  onPeerConnect: options.onPeerConnect,
@@ -1,8 +1,8 @@
1
1
  import { n as BirpcGroup } from "./index-Bia1vKjL.mjs";
2
- import { At as DevframeAuthHandler, Ct as DevframeRpcClientFunctions, J as DevframeSseOptions, Y as DevframeWsOptions, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta, wt as DevframeRpcServerFunctions } from "./context-BvaYawdU.mjs";
2
+ import { At as DevframeAuthHandler, Ct as DevframeRpcClientFunctions, J as DevframeSseOptions, Y as DevframeWsOptions, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta, wt as DevframeRpcServerFunctions } from "./context-DhycZ2lx.mjs";
3
3
  import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "./session-r6PDixP6.mjs";
4
4
  import { n as WsOriginRegistry } from "./ws-server-y2R76aSW.mjs";
5
- import "./index-LtvVaxSc.mjs";
5
+ import "./index-DFPsvDGu.mjs";
6
6
  import { H3 } from "h3";
7
7
  import { NodeAdapter } from "crossws/adapters/node";
8
8
  import { Buffer } from "node:buffer";
@@ -2,7 +2,7 @@ import { s as colors } from "./nostics-D0PvLZsn.mjs";
2
2
  import { n as defineRpcFunction } from "./define-BLWPsH6y.mjs";
3
3
  import { isAnonymousRpcMethod } from "./constants.mjs";
4
4
  import { a as getTempAuthCodeInfo, n as describeUA, o as refreshTempAuthCode, r as exchangeTempAuthCode, s as verifyAuthToken, t as buildOtpAuthUrl } from "./state-W4wI6X5X.mjs";
5
- import { t as getInternalContext } from "./context-CHpyLX8W.mjs";
5
+ import { t as getInternalContext } from "./context-CNq7GLeT.mjs";
6
6
  //#region src/utils/simple-schema.ts
7
7
  function ok(value) {
8
8
  return { value };
@@ -1,11 +1,11 @@
1
1
  import { t as StandardSchemaV1 } from "../index-CeEtxDmK.mjs";
2
2
  import { g as RpcFunctionDefinitionAny } from "../types-BmDbfHCx.mjs";
3
- import { Bt as AgentTool, Et as DevframeHost, Ft as AgentHandle, Gt as DevframeAgentHostEvents, Ht as AgentToolProvider, It as AgentManifest, Kt as EventEmitter, Lt as AgentResource, Rt as AgentResourceContent, Ut as AgentToolProviderHandle, Vt as AgentToolInput, Wt as DevframeAgentHost$1, o as DevframeNodeContext, zt as AgentResourceInput } from "../context-BvaYawdU.mjs";
3
+ import { Bt as AgentTool, Et as DevframeHost, Ft as AgentHandle, Gt as DevframeAgentHostEvents, Ht as AgentToolProvider, It as AgentManifest, Kt as EventEmitter, Lt as AgentResource, Rt as AgentResourceContent, Ut as AgentToolProviderHandle, Vt as AgentToolInput, Wt as DevframeAgentHost$1, o as DevframeNodeContext, zt as AgentResourceInput } from "../context-DhycZ2lx.mjs";
4
4
  import { a as RemoteAssetsStore } from "../remote-assets-eBvSKZMS.mjs";
5
- import { a as InstanceShellInit, c as StartedServer, d as samePath, f as DevframeInstanceRecord, g as registerDevframeInstance, h as probeDevframeOrigin, i as InstanceShellApi, l as createInstanceShell, m as listLiveDevframeInstances, n as InstanceRegisterConfig, o as InstanceShellInternals, p as DevframeInstanceRegistration, r as InstanceShell, s as InstanceWsTier, t as CreateInstanceShellOptions, u as resolveInstanceRegister } from "../instance-shell-CM2nruNe.mjs";
6
- import { i as importAgenticMcp, n as MountMcpHttpOptions, r as MountedMcpHttp, t as AgenticMcpModule } from "../agentic-B8y_r5tQ.mjs";
7
- import { a as resolveBasePath, i as normalizeBasePath, n as ResolvedMcpConfig, r as loadAutoMcpAdapter, s as resolveMcpConfig } from "../_shared-DjkowZKP.mjs";
8
- import { n as CreateContextRpcServerOptions, r as createContextRpcServer, t as ContextRpcServer } from "../rpc-core-CZ72-_vD.mjs";
5
+ import { a as InstanceShellInit, c as StartedServer, d as samePath, f as DevframeInstanceRecord, g as registerDevframeInstance, h as probeDevframeOrigin, i as InstanceShellApi, l as createInstanceShell, m as listLiveDevframeInstances, n as InstanceRegisterConfig, o as InstanceShellInternals, p as DevframeInstanceRegistration, r as InstanceShell, s as InstanceWsTier, t as CreateInstanceShellOptions, u as resolveInstanceRegister } from "../instance-shell-fl3ir6RC.mjs";
6
+ import { i as importAgenticMcp, n as MountMcpHttpOptions, r as MountedMcpHttp, t as AgenticMcpModule } from "../agentic-D61fXLzA.mjs";
7
+ import { a as resolveBasePath, i as normalizeBasePath, n as ResolvedMcpConfig, r as loadAutoMcpAdapter, s as resolveMcpConfig } from "../_shared-NSl4p_om.mjs";
8
+ import { n as CreateContextRpcServerOptions, r as createContextRpcServer, t as ContextRpcServer } from "../rpc-core-BcThIWzY.mjs";
9
9
  //#region src/agent/stringify.d.ts
10
10
  /**
11
11
  * JSON-coercing serializer for MCP text payloads.
@@ -1,13 +1,13 @@
1
1
  import { t as Diagnostic } from "../nostics-D0PvLZsn.mjs";
2
2
  import { n as peekRpcWireFrame, t as createRpcWireCodec } from "../wire-codec-B1W3zH3L.mjs";
3
3
  import { t as diagnostics } from "../diagnostics-Cx4_VjlG.mjs";
4
- import { n as toolInputToCommandArgs, t as DevframeAgentHost } from "../host-agent-mIbQ6Qi5.mjs";
5
- import { a as resolveMcpConfig, n as normalizeBasePath, r as resolveBasePath, s as importAgenticMcp, t as loadAutoMcpAdapter } from "../_shared-B2PZsp-J.mjs";
4
+ import { n as toolInputToCommandArgs, t as DevframeAgentHost } from "../host-agent-CJu735ch.mjs";
5
+ import { a as resolveMcpConfig, n as normalizeBasePath, r as resolveBasePath, s as importAgenticMcp, t as loadAutoMcpAdapter } from "../_shared-DlRoV7v3.mjs";
6
6
  import { t as importRuntimeModule } from "../import-runtime-module-BzlEQ9PI.mjs";
7
7
  import { t as createH3DevframeHost } from "../host-h3-BROI6SQ4.mjs";
8
- import { i as registerDevframeInstance, n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-C-nC0By7.mjs";
9
- import { i as normalizeHttpServerUrl, n as resolveInstanceRegister, r as samePath, t as createInstanceShell } from "../instance-shell-C3VrwJRS.mjs";
10
- import { t as createContextRpcServer } from "../rpc-core-BXyMjbKG.mjs";
8
+ import { i as registerDevframeInstance, n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-DFrZdU4B.mjs";
9
+ import { i as normalizeHttpServerUrl, n as resolveInstanceRegister, r as samePath, t as createInstanceShell } from "../instance-shell-DmyVIJzj.mjs";
10
+ import { t as createContextRpcServer } from "../rpc-core-CXgALhUi.mjs";
11
11
  //#region src/agent/stringify.ts
12
12
  /**
13
13
  * JSON-coercing serializer for MCP text payloads.
@@ -1,3 +1,3 @@
1
- import { At as DevframeAuthHandler } from "../context-BvaYawdU.mjs";
2
- import { a as getTempAuthCodeInfo, c as revokeActiveConnectionsForToken, i as getTempAuthCode, l as revokeAuthToken, n as describeUA, o as refreshTempAuthCode, r as exchangeTempAuthCode, s as verifyAuthToken, t as buildOtpAuthUrl } from "../index-LtvVaxSc.mjs";
1
+ import { At as DevframeAuthHandler } from "../context-DhycZ2lx.mjs";
2
+ import { a as getTempAuthCodeInfo, c as revokeActiveConnectionsForToken, i as getTempAuthCode, l as revokeAuthToken, n as describeUA, o as refreshTempAuthCode, r as exchangeTempAuthCode, s as verifyAuthToken, t as buildOtpAuthUrl } from "../index-DFPsvDGu.mjs";
3
3
  export { DevframeAuthHandler, buildOtpAuthUrl, describeUA, exchangeTempAuthCode, getTempAuthCode, getTempAuthCodeInfo, refreshTempAuthCode, revokeActiveConnectionsForToken, revokeAuthToken, verifyAuthToken };
@@ -1,3 +1,3 @@
1
- import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-cqztiCX4.mjs";
1
+ import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-CeQUo6KI.mjs";
2
2
  import { a as getTempAuthCodeInfo, i as getTempAuthCode, n as describeUA, o as refreshTempAuthCode, r as exchangeTempAuthCode, s as verifyAuthToken, t as buildOtpAuthUrl } from "../state-W4wI6X5X.mjs";
3
3
  export { buildOtpAuthUrl, describeUA, exchangeTempAuthCode, getTempAuthCode, getTempAuthCodeInfo, refreshTempAuthCode, revokeActiveConnectionsForToken, revokeAuthToken, verifyAuthToken };
@@ -1,3 +1,3 @@
1
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-CNX8VDIJ.mjs";
2
- import { a as resolveBasePath, i as normalizeBasePath } from "../_shared-DjkowZKP.mjs";
1
+ import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-Bgvuxv1C.mjs";
2
+ import { a as resolveBasePath, i as normalizeBasePath } from "../_shared-NSl4p_om.mjs";
3
3
  export { type DevframeInternalContext, type InternalAnonymousAuthStorage, type RemoteTokenRecord, getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -1,3 +1,3 @@
1
- import { n as normalizeBasePath, r as resolveBasePath } from "../_shared-B2PZsp-J.mjs";
2
- import { n as internalContextMap, t as getInternalContext } from "../context-CHpyLX8W.mjs";
1
+ import { n as normalizeBasePath, r as resolveBasePath } from "../_shared-DlRoV7v3.mjs";
2
+ import { n as internalContextMap, t as getInternalContext } from "../context-CNq7GLeT.mjs";
3
3
  export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -1,5 +1,5 @@
1
1
  import { g as RpcFunctionDefinitionAny } from "../types-BmDbfHCx.mjs";
2
- import { Et as DevframeHost, k as SharedState, l as RpcFunctionsHost, o as DevframeNodeContext } from "../context-BvaYawdU.mjs";
2
+ import { Et as DevframeHost, k as SharedState, l as RpcFunctionsHost, o as DevframeNodeContext } from "../context-DhycZ2lx.mjs";
3
3
  //#region src/node/context.d.ts
4
4
  export interface CreateHostContextOptions {
5
5
  cwd: string;
@@ -1,3 +1,3 @@
1
- import { t as createHostContext } from "../context-BqpgC5tq.mjs";
2
- import { t as createStorage } from "../storage-CHD1IkqU.mjs";
1
+ import { t as createHostContext } from "../context-BKw9KkCR.mjs";
2
+ import { t as createStorage } from "../storage-DPoitS2X.mjs";
3
3
  export { createHostContext, createStorage };
@@ -1,5 +1,5 @@
1
- import { At as DevframeAuthHandler, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "../context-BvaYawdU.mjs";
2
- import "../index-LtvVaxSc.mjs";
1
+ import { At as DevframeAuthHandler, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "../context-DhycZ2lx.mjs";
2
+ import "../index-DFPsvDGu.mjs";
3
3
  import { ColorFn } from "../utils/colors.mjs";
4
4
  //#region src/recipes/interactive-auth.d.ts
5
5
  export interface CreateInteractiveAuthOptions {
@@ -1,2 +1,2 @@
1
- import { n as createInteractiveAuth, t as createAuthBanner } from "../interactive-auth-BCa_iamv.mjs";
1
+ import { n as createInteractiveAuth, t as createAuthBanner } from "../interactive-auth-FFOGnYIC.mjs";
2
2
  export { createAuthBanner, createInteractiveAuth };
@@ -1,4 +1,4 @@
1
- import { t as DEVFRAME_EVENTS } from "./events-BV4Dj59a.mjs";
1
+ import { t as DEVFRAME_EVENTS } from "./events-0wDwalmL.mjs";
2
2
  //#region src/node/auth/revoke.ts
3
3
  /**
4
4
  * Flip `isTrusted` to false on any live WS clients connected with `token`
package/dist/rpc/dump.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as getDefinitionsWithDumps, i as dumpFunctions, n as collectStaticRpcDump, o as reviveDumpError, r as createClientFromDump, s as serializeDumpError, t as writeStaticRpcDump } from "../write-BWIO0h0Z.mjs";
1
+ import { a as getDefinitionsWithDumps, i as dumpFunctions, n as collectStaticRpcDump, o as reviveDumpError, r as createClientFromDump, s as serializeDumpError, t as writeStaticRpcDump } from "../write-DK7rBUN3.mjs";
2
2
  export { collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError, writeStaticRpcDump };
@@ -1,5 +1,6 @@
1
- import { a as validateRpcArgs, c as hash, i as getRpcResolvedSetupResult, n as validateDefinitions, o as validateRpcReturn, r as getRpcHandler, s as ensureAgentJsonSerializable, t as validateDefinition } from "../validation-BzxTTYaV.mjs";
1
+ import { i as hash, n as validateDefinitions, r as ensureAgentJsonSerializable, t as validateDefinition } from "../validation-CMfDAti3.mjs";
2
2
  import { n as strictJsonStringify, r as diagnostics, t as STRUCTURED_CLONE_PREFIX } from "../serialization-BhuOoL80.mjs";
3
+ import { i as validateRpcReturn, n as getRpcResolvedSetupResult, r as validateRpcArgs, t as getRpcHandler } from "../handler-DmaAfpGq.mjs";
3
4
  import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-BLWPsH6y.mjs";
4
5
  //#region src/rpc/cache.ts
5
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { n as WsOriginRegistry } from "../../ws-server-y2R76aSW.mjs";
2
- import { t as ContextRpcServer } from "../../rpc-core-CZ72-_vD.mjs";
2
+ import { t as ContextRpcServer } from "../../rpc-core-BcThIWzY.mjs";
3
3
  //#region src/rpc/transports/ws-bun.d.ts
4
4
  export interface AttachBunWsTransportOptions {
5
5
  /** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
@@ -1,5 +1,5 @@
1
1
  import { n as WsOriginRegistry } from "../../ws-server-y2R76aSW.mjs";
2
- import { t as ContextRpcServer } from "../../rpc-core-CZ72-_vD.mjs";
2
+ import { t as ContextRpcServer } from "../../rpc-core-BcThIWzY.mjs";
3
3
  //#region src/rpc/transports/ws-deno.d.ts
4
4
  export interface AttachDenoWsTransportOptions {
5
5
  /** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
@@ -1,8 +1,8 @@
1
1
  import { n as BirpcGroup, o as EventOptions } from "./index-Bia1vKjL.mjs";
2
- import { At as DevframeAuthHandler, Ct as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession, wt as DevframeRpcServerFunctions } from "./context-BvaYawdU.mjs";
2
+ import { At as DevframeAuthHandler, Ct as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession, wt as DevframeRpcServerFunctions } from "./context-DhycZ2lx.mjs";
3
3
  import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "./session-r6PDixP6.mjs";
4
4
  import "./ws-server-y2R76aSW.mjs";
5
- import "./index-LtvVaxSc.mjs";
5
+ import "./index-DFPsvDGu.mjs";
6
6
  //#region src/node/rpc-core.d.ts
7
7
  interface CreateContextRpcServerOptions {
8
8
  context: DevframeNodeContext;
@@ -1,4 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.mjs";
2
+ import { n as getRpcResolvedSetupResult, t as getRpcHandler } from "./handler-DmaAfpGq.mjs";
2
3
  import { createRpcServer } from "./rpc/server.mjs";
3
4
  import { t as diagnostics } from "./diagnostics-Cx4_VjlG.mjs";
4
5
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -25,7 +26,7 @@ function createContextRpcServer(options) {
25
26
  if (authHandler) {
26
27
  for (const fn of authHandler.rpcFunctions) if (!rpcHost.definitions.has(fn.name)) rpcHost.register(fn);
27
28
  }
28
- const rpcGroup = createRpcServer(rpcHost.functions, { rpcOptions: {
29
+ const rpcGroup = createRpcServer({}, { rpcOptions: {
29
30
  /**
30
31
  * Forwarded as-is so a host with its own structured diagnostics
31
32
  * keeps seeing RPC failures.
@@ -40,21 +41,24 @@ function createContextRpcServer(options) {
40
41
  * the call before it ever reaches the handler. Mirrors
41
42
  * `packages/core/src/node/ws.ts`'s resolver.
42
43
  */
43
- resolver(name, fn) {
44
+ resolver(name) {
44
45
  const rpc = this;
45
- if (!fn) return void 0;
46
+ const definition = rpcHost.definitions.get(name);
47
+ if (!definition) return void 0;
46
48
  return async function(...args) {
47
49
  const meta = rpc.$meta;
48
50
  if (effectiveAuthorize && !effectiveAuthorize(name, {
49
51
  meta,
50
52
  rpc
51
53
  })) throw diagnostics.DF0036({ name });
52
- return await asyncStorage.run({
53
- rpc,
54
- meta
55
- }, async () => {
56
- return (await fn).apply(this, args);
57
- });
54
+ const inner = definition.handler ?? (await getRpcResolvedSetupResult(definition, context)).handler;
55
+ return (await getRpcHandler(inner ? {
56
+ ...definition,
57
+ handler: (...handlerArgs) => asyncStorage.run({
58
+ rpc,
59
+ meta
60
+ }, () => inner.apply(this, handlerArgs))
61
+ } : definition, context))(...args);
58
62
  };
59
63
  }
60
64
  } });
@@ -55,6 +55,7 @@ const DEVFRAME_EVENTS = {
55
55
  */
56
56
  broadcast: {
57
57
  authRevoked: "devframe:auth:revoked",
58
+ cacheInvalidate: "devframe:rpc:cache:invalidate",
58
59
  clientStateUpdated: "devframe:rpc:client-state:updated",
59
60
  clientStatePatch: "devframe:rpc:client-state:patch",
60
61
  streamingChunk: "devframe:streaming:chunk",
@@ -1,5 +1,5 @@
1
1
  import { m as RpcFunctionAgentOptions } from "../types-BmDbfHCx.mjs";
2
- import { $ as DevframeServiceDefinition, B as DevframeDefinition, Bt as AgentTool, Ct as DevframeRpcClientFunctions, Dt as DevframeStorageScope, Et as DevframeHost, F as CreateMcpServerOptions, Ft as AgentHandle, G as DevframeSetupInfo, Gt as DevframeAgentHostEvents, H as DevframeDockDefaults, Ht as AgentToolProvider, I as McpConnectionInfo, It as AgentManifest, J as DevframeSseOptions, Jt as EventsMap, K as DevframeSnapshotRpcEntry, Kt as EventEmitter, L as McpFetchHandler, Lt as AgentResource, Ot as DevframeDiagnosticsHost, P as CreateMcpFetchHandlerOptions, Q as McpSetting, R as McpServerHandle, Rt as AgentResourceContent, St as DevframeViewHost, Tt as DevframeRpcSharedStates, U as DevframeDuplicationStrategy, Ut as AgentToolProviderHandle, V as DevframeDeploymentKind, Vt as AgentToolInput, W as DevframeRpcOptions, Wt as DevframeAgentHost, X as McpAuthorization, Y as DevframeWsOptions, Z as McpRouteOptions, _t as ScopedClientFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeServiceScopeOf, bt as ScopedSharedStates, c as RpcBroadcastOptions, ct as DevframeServicesScopeRegistry, d as RpcSharedStateHost, dt as DevframeScopedNodeRpc, et as DevframeServiceDescriptor, f as RpcStreamingChannel, ft as DevframeScopedStreamingHost, gt as ScopedBroadcastOptions, ht as DevframeSettingsStore, i as DevframeCapabilities, it as DevframeServiceOf, kt as DevframeDiagnosticsLogger, l as RpcFunctionsHost, lt as DevframeServicesState, m as RpcStreamingHost, mt as DevframeSettingsRegistry, n as ConnectionMetaSse, nt as DevframeServiceInput, o as DevframeNodeContext, ot as DevframeServicesHost, p as RpcStreamingChannelOptions, pt as DevframeSettings, q as DevframeSnapshotRpcInputs, qt as EventUnsubscribe, r as ConnectionMetaWebsocket, rt as DevframeServiceMeta, s as DevframeNodeRpcSession, st as DevframeServicesRegistry, t as ConnectionMeta, tt as DevframeServiceId, u as RpcSharedStateGetOptions, ut as DevframeScopedNodeContext, vt as ScopedRpcFn, wt as DevframeRpcServerFunctions, xt as SettingsForNamespace, yt as ScopedServerFunctions, z as DevframeCliOptions, zt as AgentResourceInput } from "../context-BvaYawdU.mjs";
2
+ import { $ as DevframeServiceDefinition, B as DevframeDefinition, Bt as AgentTool, Ct as DevframeRpcClientFunctions, Dt as DevframeStorageScope, Et as DevframeHost, F as CreateMcpServerOptions, Ft as AgentHandle, G as DevframeSetupInfo, Gt as DevframeAgentHostEvents, H as DevframeDockDefaults, Ht as AgentToolProvider, I as McpConnectionInfo, It as AgentManifest, J as DevframeSseOptions, Jt as EventsMap, K as DevframeSnapshotRpcEntry, Kt as EventEmitter, L as McpFetchHandler, Lt as AgentResource, Ot as DevframeDiagnosticsHost, P as CreateMcpFetchHandlerOptions, Q as McpSetting, R as McpServerHandle, Rt as AgentResourceContent, St as DevframeViewHost, Tt as DevframeRpcSharedStates, U as DevframeDuplicationStrategy, Ut as AgentToolProviderHandle, V as DevframeDeploymentKind, Vt as AgentToolInput, W as DevframeRpcOptions, Wt as DevframeAgentHost, X as McpAuthorization, Y as DevframeWsOptions, Z as McpRouteOptions, _t as ScopedClientFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeServiceScopeOf, bt as ScopedSharedStates, c as RpcBroadcastOptions, ct as DevframeServicesScopeRegistry, d as RpcSharedStateHost, dt as DevframeScopedNodeRpc, et as DevframeServiceDescriptor, f as RpcStreamingChannel, ft as DevframeScopedStreamingHost, gt as ScopedBroadcastOptions, ht as DevframeSettingsStore, i as DevframeCapabilities, it as DevframeServiceOf, kt as DevframeDiagnosticsLogger, l as RpcFunctionsHost, lt as DevframeServicesState, m as RpcStreamingHost, mt as DevframeSettingsRegistry, n as ConnectionMetaSse, nt as DevframeServiceInput, o as DevframeNodeContext, ot as DevframeServicesHost, p as RpcStreamingChannelOptions, pt as DevframeSettings, q as DevframeSnapshotRpcInputs, qt as EventUnsubscribe, r as ConnectionMetaWebsocket, rt as DevframeServiceMeta, s as DevframeNodeRpcSession, st as DevframeServicesRegistry, t as ConnectionMeta, tt as DevframeServiceId, u as RpcSharedStateGetOptions, ut as DevframeScopedNodeContext, vt as ScopedRpcFn, wt as DevframeRpcServerFunctions, xt as SettingsForNamespace, yt as ScopedServerFunctions, z as DevframeCliOptions, zt as AgentResourceInput } from "../context-DhycZ2lx.mjs";
3
3
  import { a as DevframeWsPeer, i as DevframeRpcTransportKind, n as DevframeRpcConnection, r as DevframeRpcConnectionRequest, t as DevframeNodeRpcSessionMeta } from "../session-r6PDixP6.mjs";
4
4
  import { a as RemoteAssetsStore, i as RemoteAssetsProviderCustom, n as RemoteAssetsErrorMessage, o as StaticAssetsSource, r as RemoteAssetsProvider, t as RemoteAssets } from "../remote-assets-eBvSKZMS.mjs";
5
5
  import { i as DevframeDefineDiagnosticsOptions } from "../nostics-DWvukRwa.mjs";
@@ -1,4 +1,4 @@
1
- import { Jt as EventsMap, Kt as EventEmitter } from "../context-BvaYawdU.mjs";
1
+ import { Jt as EventsMap, Kt as EventEmitter } from "../context-DhycZ2lx.mjs";
2
2
  //#region src/utils/events.d.ts
3
3
  /**
4
4
  * Create event emitter.
@@ -1,5 +1,5 @@
1
- import process from "node:process";
2
1
  import fs from "node:fs";
2
+ import process from "node:process";
3
3
  import { spawn } from "node:child_process";
4
4
  //#region src/utils/open.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { t as DEVFRAME_EVENTS } from "../events-BV4Dj59a.mjs";
1
+ import { t as DEVFRAME_EVENTS } from "../events-0wDwalmL.mjs";
2
2
  import { t as lookup } from "../mrmime-40h5OOIp.mjs";
3
3
  import { realpath, stat } from "node:fs/promises";
4
4
  import { extname, join, normalize, resolve, sep } from "pathe";
@@ -1,2 +1,2 @@
1
- import { A as SharedStateEvents, D as ImmutableObject, E as ImmutableMap, M as SharedStatePatch, N as createSharedState, O as ImmutableSet, T as ImmutableArray, j as SharedStateOptions, k as SharedState, w as Immutable } from "../context-BvaYawdU.mjs";
1
+ import { A as SharedStateEvents, D as ImmutableObject, E as ImmutableMap, M as SharedStatePatch, N as createSharedState, O as ImmutableSet, T as ImmutableArray, j as SharedStateOptions, k as SharedState, w as Immutable } from "../context-DhycZ2lx.mjs";
2
2
  export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
@@ -1,2 +1,2 @@
1
- import { C as createStreamSink, S as createStreamReader, _ as CreateStreamSinkOptions, b as StreamSink, g as CreateStreamReaderOptions, h as BufferedChunk, v as StreamErrorPayload, x as StreamSinkEvents, y as StreamReader } from "../context-BvaYawdU.mjs";
1
+ import { C as createStreamSink, S as createStreamReader, _ as CreateStreamSinkOptions, b as StreamSink, g as CreateStreamReaderOptions, h as BufferedChunk, v as StreamErrorPayload, x as StreamSinkEvents, y as StreamReader } from "../context-DhycZ2lx.mjs";
2
2
  export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
@@ -184,114 +184,6 @@ function ensureAgentJsonSerializable(fnDef) {
184
184
  if (fnDef.agent && !fnDef.jsonSerializable) fnDef.jsonSerializable = true;
185
185
  }
186
186
  //#endregion
187
- //#region src/rpc/validate-io.ts
188
- /**
189
- * Run a single [Standard Schema](https://standardschema.dev) validator,
190
- * awaiting the result when the validator is asynchronous.
191
- */
192
- async function runStandardSchema(schema, value) {
193
- const result = schema["~standard"].validate(value);
194
- return result instanceof Promise ? await result : result;
195
- }
196
- /**
197
- * Render Standard Schema issues into a single human-readable line for a
198
- * diagnostic message, prefixing each with its dotted path when present.
199
- */
200
- function formatIssues(issues) {
201
- return issues.map((issue) => {
202
- const path = issue.path?.map((segment) => typeof segment === "object" ? segment.key : segment).join(".");
203
- return path ? `${path}: ${issue.message}` : issue.message;
204
- }).join("; ");
205
- }
206
- /**
207
- * Validate positional arguments against their declared schemas. Only
208
- * indices with a schema are checked; extra arguments pass through
209
- * untouched. Throws `DF0038` on the first failing argument.
210
- *
211
- * Validation guards the payload without rewriting it: the original values
212
- * are handed to the handler unchanged, so a schema that describes a subset
213
- * of an object never silently strips the sender's extra fields (and any
214
- * declared transforms stay a purely type-level concern).
215
- *
216
- * @internal
217
- */
218
- async function validateRpcArgs(name, argsSchema, args) {
219
- const original = args.slice();
220
- if (!argsSchema || argsSchema.length === 0) return original;
221
- for (let index = 0; index < argsSchema.length; index++) {
222
- const schema = argsSchema[index];
223
- if (!schema) continue;
224
- const result = await runStandardSchema(schema, args[index]);
225
- if (result.issues) throw diagnostics.DF0043({
226
- name,
227
- index,
228
- issues: formatIssues(result.issues)
229
- });
230
- }
231
- return original;
232
- }
233
- /**
234
- * Validate a handler's resolved return value against its declared schema.
235
- * Throws `DF0039` when the value fails the schema, otherwise returns the
236
- * original value unchanged (guard-only, never rewriting the payload; see
237
- * {@link validateRpcArgs}). Passes through when no return schema is set.
238
- *
239
- * @internal
240
- */
241
- async function validateRpcReturn(name, returnSchema, value) {
242
- if (!returnSchema) return value;
243
- const result = await runStandardSchema(returnSchema, value);
244
- if (result.issues) throw diagnostics.DF0044({
245
- name,
246
- issues: formatIssues(result.issues)
247
- });
248
- return value;
249
- }
250
- //#endregion
251
- //#region src/rpc/handler.ts
252
- async function getRpcResolvedSetupResult(definition, context) {
253
- if (!definition.setup) return {};
254
- if (typeof context === "object" && context !== null) {
255
- definition.__cache ??= /* @__PURE__ */ new WeakMap();
256
- const cache = definition.__cache;
257
- let promise = cache.get(context);
258
- if (!promise) {
259
- promise = Promise.resolve(definition.setup(context));
260
- promise.catch(() => {
261
- if (cache.get(context) === promise) cache.delete(context);
262
- });
263
- cache.set(context, promise);
264
- }
265
- return await promise;
266
- }
267
- if (!definition.__promise) {
268
- const promise = Promise.resolve(definition.setup(context));
269
- promise.catch(() => {
270
- if (definition.__promise === promise) definition.__promise = void 0;
271
- });
272
- definition.__promise = promise;
273
- }
274
- return await definition.__promise;
275
- }
276
- async function getRpcHandler(definition, context) {
277
- let handler = definition.handler;
278
- if (!handler) {
279
- const result = await getRpcResolvedSetupResult(definition, context);
280
- if (!result.handler) throw diagnostics.DF0024({ name: definition.name });
281
- handler = result.handler;
282
- }
283
- const argsSchema = definition.args;
284
- const returnSchema = definition.returns;
285
- if (!argsSchema && !returnSchema) return handler;
286
- const inner = handler;
287
- const validating = async (...args) => {
288
- const validatedArgs = await validateRpcArgs(definition.name, argsSchema, args);
289
- const output = await inner(...validatedArgs);
290
- return await validateRpcReturn(definition.name, returnSchema, output);
291
- };
292
- return validating;
293
- }
294
- //#endregion
295
187
  //#region src/rpc/validation.ts
296
188
  /**
297
189
  * Validates RPC function definitions.
@@ -321,4 +213,4 @@ function validateDefinition(definition) {
321
213
  validateDefinitions([definition]);
322
214
  }
323
215
  //#endregion
324
- export { validateRpcArgs as a, hash as c, getRpcResolvedSetupResult as i, validateDefinitions as n, validateRpcReturn as o, getRpcHandler as r, ensureAgentJsonSerializable as s, validateDefinition as t };
216
+ export { hash as i, validateDefinitions as n, ensureAgentJsonSerializable as r, validateDefinition as t };
@@ -1,5 +1,6 @@
1
- import { c as hash, n as validateDefinitions, r as getRpcHandler, s as ensureAgentJsonSerializable } from "./validation-BzxTTYaV.mjs";
1
+ import { i as hash, n as validateDefinitions, r as ensureAgentJsonSerializable } from "./validation-CMfDAti3.mjs";
2
2
  import { n as strictJsonStringify, r as diagnostics } from "./serialization-BhuOoL80.mjs";
3
+ import { t as getRpcHandler } from "./handler-DmaAfpGq.mjs";
3
4
  import { DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME } from "./constants.mjs";
4
5
  import { n as structuredCloneStringify } from "./structured-clone-CbAV5rFI.mjs";
5
6
  import fs from "node:fs/promises";