@nylorun/runtime 0.14.0-beta → 0.15.0-beta

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 (198) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +75 -33
  3. package/dist/adapters/execution/restate.js +2 -2
  4. package/dist/adapters/replication/pgoutput.d.ts +5 -0
  5. package/dist/adapters/replication/pgoutput.js +4 -3
  6. package/dist/admin-openapi.json +184 -685
  7. package/dist/api/components.d.ts +308 -68
  8. package/dist/api/components.js +4 -5
  9. package/dist/api/gate/keys.d.ts +14 -0
  10. package/dist/api/gate/keys.js +59 -0
  11. package/dist/api/gate/routes.d.ts +34 -0
  12. package/dist/api/gate/routes.js +235 -0
  13. package/dist/api/http/define.js +0 -8
  14. package/dist/api/http/routes/access.js +25 -18
  15. package/dist/api/http/routes/tenant.d.ts +2 -1
  16. package/dist/api/http/routes/tenant.js +77 -5
  17. package/dist/api/http/routes/vaults.js +2 -2
  18. package/dist/api/openapi.js +4 -5
  19. package/dist/gates/contract.d.ts +51 -0
  20. package/dist/gates/contract.js +37 -0
  21. package/dist/gates/handler.d.ts +21 -0
  22. package/dist/gates/handler.js +55 -0
  23. package/dist/gates/http-client.d.ts +12 -0
  24. package/dist/gates/http-client.js +160 -0
  25. package/dist/gates/in-process.d.ts +32 -0
  26. package/dist/gates/in-process.js +42 -0
  27. package/dist/gates/inflight.d.ts +39 -0
  28. package/dist/gates/inflight.js +70 -0
  29. package/dist/gates/mcp-handler.d.ts +35 -0
  30. package/dist/gates/mcp-handler.js +142 -0
  31. package/dist/gates/meter.d.ts +24 -0
  32. package/dist/gates/meter.js +165 -0
  33. package/dist/gates/model-gate.d.ts +45 -0
  34. package/dist/gates/model-gate.js +1 -0
  35. package/dist/gates/tenant-vaults.d.ts +64 -0
  36. package/dist/gates/tenant-vaults.js +94 -0
  37. package/dist/gates/tool-calls.d.ts +51 -0
  38. package/dist/gates/tool-calls.js +64 -0
  39. package/dist/gates/tool-client.d.ts +12 -0
  40. package/dist/gates/tool-client.js +201 -0
  41. package/dist/gates/tool-contract.d.ts +116 -0
  42. package/dist/gates/tool-contract.js +64 -0
  43. package/dist/gates/tool-gate.d.ts +45 -0
  44. package/dist/gates/tool-gate.js +10 -0
  45. package/dist/host/admin-api.d.ts +7 -6
  46. package/dist/host/admin-api.js +9 -113
  47. package/dist/host/app.d.ts +1 -1
  48. package/dist/host/app.js +20 -24
  49. package/dist/host/config-for.d.ts +1 -1
  50. package/dist/host/config-for.js +2 -2
  51. package/dist/host/create-host.d.ts +5 -5
  52. package/dist/host/create-host.js +5 -15
  53. package/dist/host/execution.d.ts +20 -18
  54. package/dist/host/execution.js +2 -2
  55. package/dist/host/gates.d.ts +58 -0
  56. package/dist/host/gates.js +127 -0
  57. package/dist/host/http.d.ts +6 -1
  58. package/dist/host/http.js +17 -0
  59. package/dist/host/index.d.ts +1 -1
  60. package/dist/host/main.js +151 -71
  61. package/dist/host/stack-config.d.ts +71 -19
  62. package/dist/host/stack-config.js +192 -18
  63. package/dist/infra/database.d.ts +2 -2
  64. package/dist/infra/execution.d.ts +5 -5
  65. package/dist/infra/execution.js +8 -6
  66. package/dist/infra/index.d.ts +1 -1
  67. package/dist/infra/workers.d.ts +17 -17
  68. package/dist/infra/workers.js +9 -9
  69. package/dist/keys/client.d.ts +9 -0
  70. package/dist/keys/client.js +70 -0
  71. package/dist/keys/contract.d.ts +24 -0
  72. package/dist/keys/contract.js +12 -0
  73. package/dist/keys/keys.d.ts +41 -0
  74. package/dist/keys/keys.js +50 -0
  75. package/dist/mcp/connect.d.ts +43 -3
  76. package/dist/mcp/connect.js +12 -5
  77. package/dist/mcp/pool.d.ts +21 -3
  78. package/dist/mcp/pool.js +15 -2
  79. package/dist/openapi.json +887 -694
  80. package/dist/record/append.d.ts +51 -0
  81. package/dist/record/append.js +20 -0
  82. package/dist/{store/event.js → record/envelope.js} +1 -1
  83. package/dist/record/index.d.ts +11 -0
  84. package/dist/record/index.js +11 -0
  85. package/dist/store/postgres/connect.d.ts +15 -12
  86. package/dist/store/postgres/connect.js +24 -12
  87. package/dist/store/postgres/db.d.ts +16 -0
  88. package/dist/store/postgres/db.js +28 -0
  89. package/dist/store/postgres/drizzle/0000_foundation.sql +22 -0
  90. package/dist/store/postgres/drizzle/0001_baseline.sql +255 -0
  91. package/dist/store/postgres/drizzle/0002_stream_relay.sql +4 -0
  92. package/dist/store/postgres/drizzle/0003_tool_crossings.sql +9 -0
  93. package/dist/store/postgres/drizzle/meta/_journal.json +34 -0
  94. package/dist/store/postgres/migrate.d.ts +68 -0
  95. package/dist/store/postgres/migrate.js +183 -0
  96. package/dist/store/postgres/record-writer.d.ts +4 -0
  97. package/dist/store/postgres/record-writer.js +34 -0
  98. package/dist/store/postgres/record.d.ts +2 -8
  99. package/dist/store/postgres/record.js +50 -54
  100. package/dist/store/postgres/schema.d.ts +3096 -0
  101. package/dist/store/postgres/schema.js +363 -0
  102. package/dist/store/postgres/store.d.ts +2 -4
  103. package/dist/store/postgres/store.js +481 -567
  104. package/dist/store/postgres/tenant.d.ts +56 -0
  105. package/dist/store/postgres/tenant.js +154 -0
  106. package/dist/store/types.d.ts +43 -87
  107. package/dist/store/types.js +0 -1
  108. package/dist/streams/control.d.ts +1 -1
  109. package/dist/streams/control.js +6 -2
  110. package/dist/streams/relay/types.d.ts +2 -1
  111. package/dist/streams/relay/types.js +2 -1
  112. package/dist/streams/types.d.ts +5 -0
  113. package/dist/tenant/advance.d.ts +7 -2
  114. package/dist/tenant/advance.js +95 -16
  115. package/dist/tenant/cause.d.ts +25 -0
  116. package/dist/tenant/cause.js +45 -0
  117. package/dist/tenant/commands.js +4 -2
  118. package/dist/tenant/context.d.ts +26 -3
  119. package/dist/tenant/delivery-token.js +17 -18
  120. package/dist/tenant/delivery.d.ts +1 -1
  121. package/dist/tenant/delivery.js +18 -13
  122. package/dist/tenant/effects.d.ts +15 -1
  123. package/dist/tenant/effects.js +93 -17
  124. package/dist/tenant/ephemeral.d.ts +16 -7
  125. package/dist/tenant/ephemeral.js +45 -111
  126. package/dist/tenant/history.d.ts +64 -0
  127. package/dist/tenant/history.js +120 -0
  128. package/dist/tenant/model-setting.d.ts +2 -2
  129. package/dist/tenant/module.d.ts +14 -28
  130. package/dist/tenant/module.js +131 -271
  131. package/dist/tenant/paths.d.ts +11 -16
  132. package/dist/tenant/paths.js +24 -68
  133. package/dist/tenant/pool.d.ts +1 -1
  134. package/dist/tenant/pool.js +1 -1
  135. package/dist/tenant/principals.d.ts +23 -11
  136. package/dist/tenant/principals.js +61 -49
  137. package/dist/tenant/runtime.d.ts +19 -1
  138. package/dist/tenant/runtime.js +40 -26
  139. package/dist/tenant/scheduler.d.ts +4 -2
  140. package/dist/tenant/scheduler.js +4 -4
  141. package/dist/tenant/session-streams.d.ts +2 -0
  142. package/dist/tenant/session-streams.js +8 -3
  143. package/dist/tenant/status.d.ts +3 -0
  144. package/dist/tenant/status.js +1 -1
  145. package/dist/tenant/store-pg.d.ts +9 -6
  146. package/dist/tenant/store-pg.js +60 -125
  147. package/dist/tenant/streams.d.ts +9 -25
  148. package/dist/tenant/streams.js +7 -22
  149. package/dist/tenant/tokens.js +16 -14
  150. package/dist/tenant/types.d.ts +41 -92
  151. package/dist/tenant/types.js +4 -15
  152. package/dist/tenant/worker.js +4 -4
  153. package/dist/vault/host-model.d.ts +31 -0
  154. package/dist/vault/host-model.js +57 -0
  155. package/dist/vault/service.d.ts +26 -15
  156. package/dist/vault/service.js +70 -109
  157. package/dist/version.d.ts +1 -1
  158. package/dist/version.js +1 -1
  159. package/package.json +9 -5
  160. package/dist/store/memory.d.ts +0 -69
  161. package/dist/store/memory.js +0 -810
  162. package/dist/store/postgres/migrations/001_initial.d.ts +0 -27
  163. package/dist/store/postgres/migrations/001_initial.js +0 -196
  164. package/dist/store/postgres/migrations/002_session_owner.d.ts +0 -6
  165. package/dist/store/postgres/migrations/002_session_owner.js +0 -13
  166. package/dist/store/postgres/migrations/003_subject_tokens.d.ts +0 -8
  167. package/dist/store/postgres/migrations/003_subject_tokens.js +0 -42
  168. package/dist/store/postgres/migrations/004_publishable_keys.d.ts +0 -6
  169. package/dist/store/postgres/migrations/004_publishable_keys.js +0 -18
  170. package/dist/store/postgres/migrations/005_action_endpoints.d.ts +0 -6
  171. package/dist/store/postgres/migrations/005_action_endpoints.js +0 -32
  172. package/dist/store/postgres/migrations/006_drop_executors.d.ts +0 -11
  173. package/dist/store/postgres/migrations/006_drop_executors.js +0 -32
  174. package/dist/store/postgres/migrations/007_event_time.d.ts +0 -7
  175. package/dist/store/postgres/migrations/007_event_time.js +0 -14
  176. package/dist/store/postgres/migrations/008_durable_streams.d.ts +0 -13
  177. package/dist/store/postgres/migrations/008_durable_streams.js +0 -35
  178. package/dist/store/postgres/migrations/index.d.ts +0 -53
  179. package/dist/store/postgres/migrations/index.js +0 -96
  180. package/dist/store/postgres/migrations/shared/index.d.ts +0 -31
  181. package/dist/store/postgres/migrations/shared/index.js +0 -92
  182. package/dist/store/postgres/names.d.ts +0 -11
  183. package/dist/store/postgres/names.js +0 -42
  184. package/dist/store/postgres/tenants.d.ts +0 -90
  185. package/dist/store/postgres/tenants.js +0 -228
  186. package/dist/streams/relay/memory.d.ts +0 -69
  187. package/dist/streams/relay/memory.js +0 -176
  188. package/dist/tenant/envelope.d.ts +0 -7
  189. package/dist/tenant/envelope.js +0 -22
  190. package/dist/tenant/quarantine-error.d.ts +0 -6
  191. package/dist/tenant/quarantine-error.js +0 -9
  192. package/dist/tenant/quarantine.d.ts +0 -27
  193. package/dist/tenant/quarantine.js +0 -72
  194. package/dist/tenant/store-memory.d.ts +0 -16
  195. package/dist/tenant/store-memory.js +0 -111
  196. /package/dist/{store → record}/cursor.d.ts +0 -0
  197. /package/dist/{store → record}/cursor.js +0 -0
  198. /package/dist/{store/event.d.ts → record/envelope.d.ts} +0 -0
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The keys seam (blueprint §14, F4.2): everything that needs the vault key. Vault writes that
3
+ * touch a secret (creating and rotating a credential, setting and selecting the host model;
4
+ * rotation and selection decrypt the old secret first) and all token signing (subject and
5
+ * delivery tokens, signing-key rotation) run here, whole, so the process that calls them never
6
+ * holds the key or a private signing key.
7
+ *
8
+ * Two implementations: `inProcessKeys` (embedding, the ephemeral Runtime, tests, and the gates
9
+ * service itself, which serves the HTTP routes with it), and `httpKeys` (`client.ts`), the
10
+ * runtime container's client of the `keys` service in the gateway.
11
+ */
12
+ import { SignJWT } from "jose";
13
+ import { signingKeyView } from "../tenant/signing-keys.js";
14
+ /** The operations, by the name the HTTP route carries. */
15
+ export const KEYS_OPERATIONS = [
16
+ "createCredential",
17
+ "rotateCredential",
18
+ "putHostModel",
19
+ "selectHostModel",
20
+ "sign",
21
+ "rotateSigningKeys",
22
+ "ensureSigningKeys",
23
+ ];
24
+ export function inProcessKeys(options) {
25
+ const { store, vault, signingKeys, kek } = options;
26
+ return {
27
+ createCredential: (vaultId, body) => vault.createCredential(vaultId, body),
28
+ rotateCredential: (vaultId, id, body) => vault.rotateCredential(vaultId, id, body),
29
+ putHostModel: (body) => vault.putHostModel(body),
30
+ selectHostModel: (body) => vault.selectHostModel(body),
31
+ async sign(request) {
32
+ const key = kek();
33
+ const row = await store.tx((t) => signingKeys.ensure(t, key));
34
+ const signer = await signingKeys.privateKey(row, key);
35
+ const token = await new SignJWT({ ...request.claims })
36
+ .setProtectedHeader({ alg: "ES256", typ: request.typ, kid: signer.id })
37
+ .sign(signer.key);
38
+ return { token, keyId: signer.id };
39
+ },
40
+ async rotateSigningKeys(request) {
41
+ const key = kek();
42
+ const rows = await store.tx((t) => signingKeys.rotate(t, key, request.maxTtlSeconds, request.force));
43
+ return rows.map(signingKeyView);
44
+ },
45
+ async ensureSigningKeys() {
46
+ const key = kek();
47
+ await store.tx((t) => signingKeys.ensure(t, key));
48
+ },
49
+ };
50
+ }
@@ -2,10 +2,49 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
2
  import type { McpServerManifest } from "@nylorun/core/define";
3
3
  import type { AuthorizeResult } from "../vault/service.js";
4
4
  import { type McpDiagnostic, type McpToolRecord } from "./snapshot.js";
5
+ /** Options of one MCP request. */
6
+ export interface McpRequestOptions {
7
+ readonly signal?: AbortSignal;
8
+ }
9
+ /** Options of one tool call. */
10
+ export interface McpCallOptions extends McpRequestOptions {
11
+ /**
12
+ * The call's effect id. A gate runs a keyed call once and keeps its outcome, so a re-send
13
+ * after a takeover joins it (F4.1). An in-process connection ignores it.
14
+ */
15
+ readonly key?: string;
16
+ }
17
+ /** A page of `tools/list`, as the MCP SDK returns it. */
18
+ export interface McpToolPage {
19
+ readonly tools: readonly {
20
+ readonly name: string;
21
+ readonly description?: string;
22
+ readonly inputSchema?: unknown;
23
+ readonly outputSchema?: unknown;
24
+ }[];
25
+ readonly nextCursor?: string;
26
+ }
27
+ /**
28
+ * What the pool needs of an MCP client: the SDK `Client` over a transport of this process
29
+ * (`sdkClient`), or a client of the gates service that holds the real connection
30
+ * (`gates/tool-client.ts`).
31
+ */
32
+ export interface McpClient {
33
+ listTools(params?: {
34
+ cursor?: string;
35
+ }, options?: McpRequestOptions): Promise<McpToolPage>;
36
+ /** The raw `CallToolResult`; `callMcpTool` reads it. */
37
+ callTool(params: {
38
+ name: string;
39
+ arguments: Record<string, unknown>;
40
+ }, options?: McpCallOptions): Promise<Record<string, unknown>>;
41
+ }
5
42
  export interface LiveConnection {
6
- readonly client: Client;
43
+ readonly client: McpClient;
7
44
  close(): Promise<void>;
8
45
  }
46
+ /** An SDK `Client` as an `McpClient`. */
47
+ export declare function sdkClient(client: Client): McpClient;
9
48
  export declare function openMcpServer(input: {
10
49
  server: McpServerManifest;
11
50
  authorize?: (url: string) => Promise<AuthorizeResult>;
@@ -13,15 +52,16 @@ export declare function openMcpServer(input: {
13
52
  pluginData: string;
14
53
  childEnv?: Readonly<Record<string, string>>;
15
54
  }): Promise<LiveConnection>;
16
- export declare function listMcpTools(client: Client, input: {
55
+ export declare function listMcpTools(client: McpClient, input: {
17
56
  capabilityId: string;
18
57
  serverName: string;
19
58
  taken: Set<string>;
59
+ signal?: AbortSignal;
20
60
  }): Promise<{
21
61
  tools: McpToolRecord[];
22
62
  omitted: string[];
23
63
  }>;
24
- export declare function callMcpTool(client: Client, serverToolName: string, args: unknown): Promise<{
64
+ export declare function callMcpTool(client: McpClient, serverToolName: string, args: unknown, options?: McpCallOptions): Promise<{
25
65
  kind: "completed";
26
66
  output: unknown;
27
67
  } | {
@@ -5,6 +5,13 @@ import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/
5
5
  import { schemaFromJSON } from "@nylorun/core/define";
6
6
  import { modelToolName, } from "./snapshot.js";
7
7
  import { prepareStdioLaunch } from "./stdio.js";
8
+ /** An SDK `Client` as an `McpClient`. */
9
+ export function sdkClient(client) {
10
+ return {
11
+ listTools: (params, options) => client.listTools(params, options?.signal ? { signal: options.signal } : undefined),
12
+ callTool: (params, options) => client.callTool(params, undefined, options?.signal ? { signal: options.signal } : undefined),
13
+ };
14
+ }
8
15
  export async function openMcpServer(input) {
9
16
  if (input.server.type === "stdio") {
10
17
  const launch = prepareStdioLaunch(input.server, {
@@ -23,7 +30,7 @@ export async function openMcpServer(input) {
23
30
  transport.stderr?.on("data", () => { });
24
31
  const client = createClient();
25
32
  await client.connect(transport);
26
- return { client, close: () => client.close() };
33
+ return { client: sdkClient(client), close: () => client.close() };
27
34
  }
28
35
  const authorize = input.authorize;
29
36
  if (!authorize)
@@ -42,14 +49,14 @@ export async function openMcpServer(input) {
42
49
  : new StreamableHTTPClientTransport(url, { fetch: fetchImpl });
43
50
  const client = createClient();
44
51
  await client.connect(transport);
45
- return { client, close: () => client.close() };
52
+ return { client: sdkClient(client), close: () => client.close() };
46
53
  }
47
54
  export async function listMcpTools(client, input) {
48
55
  const tools = [];
49
56
  const omitted = [];
50
57
  let cursor;
51
58
  for (let page = 0; page < 100; page += 1) {
52
- const listed = await client.listTools(cursor ? { cursor } : undefined);
59
+ const listed = await client.listTools(cursor ? { cursor } : undefined, input.signal ? { signal: input.signal } : undefined);
53
60
  for (const tool of listed.tools) {
54
61
  if (typeof tool.name !== "string" || tool.name.length === 0)
55
62
  continue;
@@ -81,13 +88,13 @@ export async function listMcpTools(client, input) {
81
88
  }
82
89
  return { tools, omitted };
83
90
  }
84
- export async function callMcpTool(client, serverToolName, args) {
91
+ export async function callMcpTool(client, serverToolName, args, options = {}) {
85
92
  const result = await client.callTool({
86
93
  name: serverToolName,
87
94
  arguments: args && typeof args === "object" && !Array.isArray(args)
88
95
  ? args
89
96
  : {},
90
- });
97
+ }, options);
91
98
  if ("isError" in result && result.isError) {
92
99
  return {
93
100
  kind: "failed",
@@ -1,6 +1,6 @@
1
1
  import type { AgentManifest, McpServerManifest } from "@nylorun/core/define";
2
2
  import type { AuthorizeResult } from "../vault/service.js";
3
- import { callMcpTool, openMcpServer } from "./connect.js";
3
+ import { callMcpTool, openMcpServer, type LiveConnection } from "./connect.js";
4
4
  import { type McpDiagnostic, type McpSnapshot, type McpToolRecord } from "./snapshot.js";
5
5
  /** A connection unused this long is closed by the sweep; the next call opens it again. */
6
6
  export declare const DEFAULT_MCP_IDLE_MS: number;
@@ -25,6 +25,13 @@ export declare class McpPool {
25
25
  readonly now?: () => number;
26
26
  /** Tests replace how a declared server is opened. */
27
27
  readonly open?: typeof openMcpServer;
28
+ /**
29
+ * Opens a remote (`streamable-http` or `sse`) server somewhere else: the gates service
30
+ * holds the connection and its credential, and the loop never sees either (F4.1).
31
+ * Absent: remote servers are opened in this process, with `authorize`. Stdio servers
32
+ * always run here.
33
+ */
34
+ readonly openRemote?: (server: McpServerRef) => Promise<LiveConnection>;
28
35
  });
29
36
  discover(input: {
30
37
  sessionId: string;
@@ -52,6 +59,9 @@ export declare class McpPool {
52
59
  args: unknown;
53
60
  manifest: AgentManifest;
54
61
  pluginRoots: Readonly<Record<string, string>>;
62
+ /** The effect id: a gate runs the call once under it (F4.1). */
63
+ effectId?: string;
64
+ signal?: AbortSignal;
55
65
  }): Promise<Awaited<ReturnType<typeof callMcpTool>>>;
56
66
  /**
57
67
  * Closes connections unused for the idle timeout (the Tenant sweep). A session that calls
@@ -64,7 +74,15 @@ export declare class McpPool {
64
74
  private liveKey;
65
75
  private connectDeclared;
66
76
  }
67
- interface DeclaredServer {
77
+ /** One declared MCP server of a session: what a gate needs to find it in the pinned manifest. */
78
+ export interface McpServerRef {
79
+ readonly sessionId: string;
80
+ /** The agent used as a tool that declares the server; absent for the session's root agent. */
81
+ readonly agentId?: string;
82
+ readonly capabilityId: string;
83
+ readonly serverName: string;
84
+ }
85
+ export interface DeclaredServer {
68
86
  /** Absent for the session's root agent. */
69
87
  readonly agentId?: string;
70
88
  /** The manifest of the agent that declares the server. */
@@ -74,4 +92,4 @@ interface DeclaredServer {
74
92
  }
75
93
  /** Servers of the root agent, then of each agent it uses as a tool. */
76
94
  export declare function serversOf(manifest: AgentManifest): DeclaredServer[];
77
- export {};
95
+ export declare function findServer(manifest: AgentManifest, agentId: string | undefined, capabilityId: string, serverName: string): DeclaredServer | undefined;
package/dist/mcp/pool.js CHANGED
@@ -37,6 +37,7 @@ export class McpPool {
37
37
  capabilityId: declared.capabilityId,
38
38
  serverName: declared.server.name,
39
39
  taken: taken.get(declared.agentId),
40
+ ...(input.signal ? { signal: input.signal } : {}),
40
41
  });
41
42
  tools.push(...listed.tools.map((tool) => owned(declared, tool)));
42
43
  diagnostics.push({
@@ -118,7 +119,10 @@ export class McpPool {
118
119
  }
119
120
  live.active += 1;
120
121
  try {
121
- return await callMcpTool(live.connection.client, input.serverToolName, input.args);
122
+ return await callMcpTool(live.connection.client, input.serverToolName, input.args, {
123
+ ...(input.effectId === undefined ? {} : { key: input.effectId }),
124
+ ...(input.signal ? { signal: input.signal } : {}),
125
+ });
122
126
  }
123
127
  finally {
124
128
  live.active -= 1;
@@ -169,6 +173,15 @@ export class McpPool {
169
173
  }
170
174
  async connectDeclared(input, declared) {
171
175
  try {
176
+ if (declared.server.type !== "stdio" && this.options.openRemote) {
177
+ const connection = await this.options.openRemote({
178
+ sessionId: input.sessionId,
179
+ ...ownerOf(declared),
180
+ capabilityId: declared.capabilityId,
181
+ serverName: declared.server.name,
182
+ });
183
+ return { ok: true, connection };
184
+ }
172
185
  const connection = await this.open({
173
186
  server: declared.server,
174
187
  pluginRoot: input.pluginRoots[pluginKey(declared)],
@@ -209,7 +222,7 @@ export function serversOf(manifest) {
209
222
  add(child.manifest, child.manifest.id);
210
223
  return servers;
211
224
  }
212
- function findServer(manifest, agentId, capabilityId, serverName) {
225
+ export function findServer(manifest, agentId, capabilityId, serverName) {
213
226
  return serversOf(manifest).find((item) => item.agentId === agentId &&
214
227
  item.capabilityId === capabilityId &&
215
228
  item.server.name === serverName);