@nylorun/runtime 0.29.0-beta → 0.31.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 (49) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/api/components.d.ts +240 -2
  3. package/dist/api/components.js +3 -1
  4. package/dist/api/http/routes/agent-manifests.d.ts +2 -1
  5. package/dist/api/http/routes/agent-manifests.js +62 -10
  6. package/dist/api/openapi.js +2 -0
  7. package/dist/gates/egress-credentials.js +2 -13
  8. package/dist/gates/handler.js +2 -1
  9. package/dist/gates/in-process.d.ts +9 -0
  10. package/dist/gates/in-process.js +21 -0
  11. package/dist/host/http.js +3 -1
  12. package/dist/host/main.js +2 -0
  13. package/dist/host/stack-config.d.ts +10 -0
  14. package/dist/host/stack-config.js +36 -0
  15. package/dist/management-openapi.json +361 -5
  16. package/dist/mcp/connect.d.ts +34 -5
  17. package/dist/mcp/connect.js +75 -14
  18. package/dist/mcp/gateway-outcomes.d.ts +14 -0
  19. package/dist/mcp/gateway-outcomes.js +46 -0
  20. package/dist/mcp/pool.js +5 -0
  21. package/dist/model/call-headers.d.ts +15 -0
  22. package/dist/model/call-headers.js +9 -0
  23. package/dist/model/models.d.ts +7 -0
  24. package/dist/model/models.js +3 -0
  25. package/dist/model/pi-model.d.ts +6 -0
  26. package/dist/model/pi-model.js +29 -3
  27. package/dist/openapi.json +654 -30
  28. package/dist/store/postgres/drizzle/0038_t6_agent_manifest_source.sql +1 -0
  29. package/dist/store/postgres/drizzle/meta/_journal.json +7 -0
  30. package/dist/store/postgres/schema.d.ts +21 -2
  31. package/dist/store/postgres/schema.js +7 -1
  32. package/dist/store/postgres/store.js +1 -0
  33. package/dist/store/types.d.ts +14 -0
  34. package/dist/tenant/agent-manifests.d.ts +18 -25
  35. package/dist/tenant/agent-manifests.js +136 -4
  36. package/dist/tenant/agents.js +7 -3
  37. package/dist/tenant/transcript.d.ts +8 -0
  38. package/dist/tenant/transcript.js +2 -0
  39. package/dist/vault/headers.d.ts +8 -0
  40. package/dist/vault/headers.js +25 -0
  41. package/dist/vault/host-model.js +8 -5
  42. package/dist/vault/service.d.ts +12 -5
  43. package/dist/vault/service.js +43 -6
  44. package/dist/vault/sources.js +22 -1
  45. package/dist/vault/workload-token.d.ts +16 -0
  46. package/dist/vault/workload-token.js +58 -0
  47. package/dist/version.d.ts +1 -1
  48. package/dist/version.js +1 -1
  49. package/package.json +3 -3
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.2.0",
3
3
  "info": {
4
4
  "title": "Nylorun Management API",
5
- "version": "0.29.0-beta",
5
+ "version": "0.31.0-beta",
6
6
  "x-nylorun-protocol": {
7
7
  "min": 16,
8
8
  "max": 18,
@@ -32,7 +32,9 @@
32
32
  "environment-disk-versions",
33
33
  "tool-policy",
34
34
  "traces",
35
- "artifact-reads"
35
+ "artifact-reads",
36
+ "gateway-credentials",
37
+ "agent-folders"
36
38
  ]
37
39
  },
38
40
  "description": "For operators: the Tenant's models, vaults, signing keys, settings and application keys, at `/v1/tenant/*` on the Tenant's URL, through `@nylorun/admin`. Every operation takes a management key, acting as itself: never for a subject and never from a browser. Management keys are issued only on the Tenant's machine (`nylorun tenant keys put <id> --management`) or from `NYLORUN_MANAGEMENT_KEY_FILE`."
@@ -121,6 +123,7 @@
121
123
  "manifest_not_found",
122
124
  "manifest_in_use",
123
125
  "manifest_changed",
126
+ "folder_invalid",
124
127
  "internal_error"
125
128
  ]
126
129
  },
@@ -423,7 +426,8 @@
423
426
  "type": "string",
424
427
  "enum": [
425
428
  "api_key",
426
- "oauth"
429
+ "oauth",
430
+ "workload"
427
431
  ]
428
432
  },
429
433
  "baseUrl": {
@@ -460,6 +464,70 @@
460
464
  "compat": {
461
465
  "type": "object",
462
466
  "additionalProperties": {}
467
+ },
468
+ "headers": {
469
+ "type": "object",
470
+ "additionalProperties": {
471
+ "type": "string",
472
+ "minLength": 1
473
+ }
474
+ },
475
+ "callHeaders": {
476
+ "type": "object",
477
+ "additionalProperties": {
478
+ "oneOf": [
479
+ {
480
+ "type": "object",
481
+ "properties": {
482
+ "from": {
483
+ "type": "string",
484
+ "enum": [
485
+ "agent.label"
486
+ ]
487
+ },
488
+ "key": {
489
+ "type": "string",
490
+ "minLength": 1
491
+ }
492
+ },
493
+ "required": [
494
+ "from",
495
+ "key"
496
+ ],
497
+ "additionalProperties": false
498
+ },
499
+ {
500
+ "type": "object",
501
+ "properties": {
502
+ "from": {
503
+ "type": "string",
504
+ "enum": [
505
+ "agent.id"
506
+ ]
507
+ }
508
+ },
509
+ "required": [
510
+ "from"
511
+ ],
512
+ "additionalProperties": false
513
+ },
514
+ {
515
+ "type": "object",
516
+ "properties": {
517
+ "from": {
518
+ "type": "string",
519
+ "enum": [
520
+ "session.owner"
521
+ ]
522
+ }
523
+ },
524
+ "required": [
525
+ "from"
526
+ ],
527
+ "additionalProperties": false
528
+ }
529
+ ]
530
+ }
463
531
  }
464
532
  },
465
533
  "additionalProperties": false
@@ -930,6 +998,70 @@
930
998
  "compat": {
931
999
  "type": "object",
932
1000
  "additionalProperties": {}
1001
+ },
1002
+ "headers": {
1003
+ "type": "object",
1004
+ "additionalProperties": {
1005
+ "type": "string",
1006
+ "minLength": 1
1007
+ }
1008
+ },
1009
+ "callHeaders": {
1010
+ "type": "object",
1011
+ "additionalProperties": {
1012
+ "oneOf": [
1013
+ {
1014
+ "type": "object",
1015
+ "properties": {
1016
+ "from": {
1017
+ "type": "string",
1018
+ "enum": [
1019
+ "agent.label"
1020
+ ]
1021
+ },
1022
+ "key": {
1023
+ "type": "string",
1024
+ "minLength": 1
1025
+ }
1026
+ },
1027
+ "required": [
1028
+ "from",
1029
+ "key"
1030
+ ],
1031
+ "additionalProperties": false
1032
+ },
1033
+ {
1034
+ "type": "object",
1035
+ "properties": {
1036
+ "from": {
1037
+ "type": "string",
1038
+ "enum": [
1039
+ "agent.id"
1040
+ ]
1041
+ }
1042
+ },
1043
+ "required": [
1044
+ "from"
1045
+ ],
1046
+ "additionalProperties": false
1047
+ },
1048
+ {
1049
+ "type": "object",
1050
+ "properties": {
1051
+ "from": {
1052
+ "type": "string",
1053
+ "enum": [
1054
+ "session.owner"
1055
+ ]
1056
+ }
1057
+ },
1058
+ "required": [
1059
+ "from"
1060
+ ],
1061
+ "additionalProperties": false
1062
+ }
1063
+ ]
1064
+ }
933
1065
  }
934
1066
  },
935
1067
  "additionalProperties": false
@@ -990,6 +1122,21 @@
990
1122
  "expires"
991
1123
  ],
992
1124
  "additionalProperties": {}
1125
+ },
1126
+ {
1127
+ "type": "object",
1128
+ "properties": {
1129
+ "type": {
1130
+ "type": "string",
1131
+ "enum": [
1132
+ "workload"
1133
+ ]
1134
+ }
1135
+ },
1136
+ "required": [
1137
+ "type"
1138
+ ],
1139
+ "additionalProperties": false
993
1140
  }
994
1141
  ]
995
1142
  }
@@ -2505,7 +2652,8 @@
2505
2652
  "type": "string",
2506
2653
  "enum": [
2507
2654
  "api_key",
2508
- "oauth"
2655
+ "oauth",
2656
+ "workload"
2509
2657
  ]
2510
2658
  },
2511
2659
  "baseUrl": {
@@ -2542,6 +2690,70 @@
2542
2690
  "compat": {
2543
2691
  "type": "object",
2544
2692
  "additionalProperties": {}
2693
+ },
2694
+ "headers": {
2695
+ "type": "object",
2696
+ "additionalProperties": {
2697
+ "type": "string",
2698
+ "minLength": 1
2699
+ }
2700
+ },
2701
+ "callHeaders": {
2702
+ "type": "object",
2703
+ "additionalProperties": {
2704
+ "oneOf": [
2705
+ {
2706
+ "type": "object",
2707
+ "properties": {
2708
+ "from": {
2709
+ "type": "string",
2710
+ "enum": [
2711
+ "agent.label"
2712
+ ]
2713
+ },
2714
+ "key": {
2715
+ "type": "string",
2716
+ "minLength": 1
2717
+ }
2718
+ },
2719
+ "required": [
2720
+ "from",
2721
+ "key"
2722
+ ],
2723
+ "additionalProperties": false
2724
+ },
2725
+ {
2726
+ "type": "object",
2727
+ "properties": {
2728
+ "from": {
2729
+ "type": "string",
2730
+ "enum": [
2731
+ "agent.id"
2732
+ ]
2733
+ }
2734
+ },
2735
+ "required": [
2736
+ "from"
2737
+ ],
2738
+ "additionalProperties": false
2739
+ },
2740
+ {
2741
+ "type": "object",
2742
+ "properties": {
2743
+ "from": {
2744
+ "type": "string",
2745
+ "enum": [
2746
+ "session.owner"
2747
+ ]
2748
+ }
2749
+ },
2750
+ "required": [
2751
+ "from"
2752
+ ],
2753
+ "additionalProperties": false
2754
+ }
2755
+ ]
2756
+ }
2545
2757
  }
2546
2758
  },
2547
2759
  "additionalProperties": false
@@ -2620,7 +2832,8 @@
2620
2832
  "type": "string",
2621
2833
  "enum": [
2622
2834
  "api_key",
2623
- "oauth"
2835
+ "oauth",
2836
+ "workload"
2624
2837
  ]
2625
2838
  },
2626
2839
  "baseUrl": {
@@ -2657,6 +2870,70 @@
2657
2870
  "compat": {
2658
2871
  "type": "object",
2659
2872
  "additionalProperties": {}
2873
+ },
2874
+ "headers": {
2875
+ "type": "object",
2876
+ "additionalProperties": {
2877
+ "type": "string",
2878
+ "minLength": 1
2879
+ }
2880
+ },
2881
+ "callHeaders": {
2882
+ "type": "object",
2883
+ "additionalProperties": {
2884
+ "oneOf": [
2885
+ {
2886
+ "type": "object",
2887
+ "properties": {
2888
+ "from": {
2889
+ "type": "string",
2890
+ "enum": [
2891
+ "agent.label"
2892
+ ]
2893
+ },
2894
+ "key": {
2895
+ "type": "string",
2896
+ "minLength": 1
2897
+ }
2898
+ },
2899
+ "required": [
2900
+ "from",
2901
+ "key"
2902
+ ],
2903
+ "additionalProperties": false
2904
+ },
2905
+ {
2906
+ "type": "object",
2907
+ "properties": {
2908
+ "from": {
2909
+ "type": "string",
2910
+ "enum": [
2911
+ "agent.id"
2912
+ ]
2913
+ }
2914
+ },
2915
+ "required": [
2916
+ "from"
2917
+ ],
2918
+ "additionalProperties": false
2919
+ },
2920
+ {
2921
+ "type": "object",
2922
+ "properties": {
2923
+ "from": {
2924
+ "type": "string",
2925
+ "enum": [
2926
+ "session.owner"
2927
+ ]
2928
+ }
2929
+ },
2930
+ "required": [
2931
+ "from"
2932
+ ],
2933
+ "additionalProperties": false
2934
+ }
2935
+ ]
2936
+ }
2660
2937
  }
2661
2938
  },
2662
2939
  "additionalProperties": false
@@ -2727,6 +3004,70 @@
2727
3004
  "compat": {
2728
3005
  "type": "object",
2729
3006
  "additionalProperties": {}
3007
+ },
3008
+ "headers": {
3009
+ "type": "object",
3010
+ "additionalProperties": {
3011
+ "type": "string",
3012
+ "minLength": 1
3013
+ }
3014
+ },
3015
+ "callHeaders": {
3016
+ "type": "object",
3017
+ "additionalProperties": {
3018
+ "oneOf": [
3019
+ {
3020
+ "type": "object",
3021
+ "properties": {
3022
+ "from": {
3023
+ "type": "string",
3024
+ "enum": [
3025
+ "agent.label"
3026
+ ]
3027
+ },
3028
+ "key": {
3029
+ "type": "string",
3030
+ "minLength": 1
3031
+ }
3032
+ },
3033
+ "required": [
3034
+ "from",
3035
+ "key"
3036
+ ],
3037
+ "additionalProperties": false
3038
+ },
3039
+ {
3040
+ "type": "object",
3041
+ "properties": {
3042
+ "from": {
3043
+ "type": "string",
3044
+ "enum": [
3045
+ "agent.id"
3046
+ ]
3047
+ }
3048
+ },
3049
+ "required": [
3050
+ "from"
3051
+ ],
3052
+ "additionalProperties": false
3053
+ },
3054
+ {
3055
+ "type": "object",
3056
+ "properties": {
3057
+ "from": {
3058
+ "type": "string",
3059
+ "enum": [
3060
+ "session.owner"
3061
+ ]
3062
+ }
3063
+ },
3064
+ "required": [
3065
+ "from"
3066
+ ],
3067
+ "additionalProperties": false
3068
+ }
3069
+ ]
3070
+ }
2730
3071
  }
2731
3072
  },
2732
3073
  "additionalProperties": false
@@ -2787,6 +3128,21 @@
2787
3128
  "expires"
2788
3129
  ],
2789
3130
  "additionalProperties": {}
3131
+ },
3132
+ {
3133
+ "type": "object",
3134
+ "properties": {
3135
+ "type": {
3136
+ "type": "string",
3137
+ "enum": [
3138
+ "workload"
3139
+ ]
3140
+ }
3141
+ },
3142
+ "required": [
3143
+ "type"
3144
+ ],
3145
+ "additionalProperties": false
2790
3146
  }
2791
3147
  ]
2792
3148
  }
@@ -42,6 +42,8 @@ export interface McpToolPage {
42
42
  readonly annotations?: Readonly<Record<string, unknown>>;
43
43
  }[];
44
44
  readonly nextCursor?: string;
45
+ /** What the server, or a gateway in front of it, says besides the tools (MCP `_meta`). */
46
+ readonly _meta?: Readonly<Record<string, unknown>>;
45
47
  }
46
48
  /**
47
49
  * A `tools/call` answer: the raw `CallToolResult`, with each credential value sent for the call
@@ -90,6 +92,8 @@ export type McpToolFailure = {
90
92
  readonly retryable?: boolean;
91
93
  /** With `credential_rejected`: the server. */
92
94
  readonly server?: string;
95
+ /** With `credential_rejected` of the workload token: the gateway that refused it (#496). */
96
+ readonly gateway?: string;
93
97
  /** How many credential values the message had in it, replaced (R2b C8). */
94
98
  readonly redacted?: number;
95
99
  };
@@ -103,7 +107,8 @@ export type McpToolOutcome = {
103
107
  * How a tool call failed at the transport or the server (R2b C7), as the gate answers it:
104
108
  * - `mcp.unreachable`: never sent (address policy, DNS, refused connection, TLS, a connection
105
109
  * that could not be opened). Calling again may work.
106
- * - `credential_rejected`: the server answered `401` (C1).
110
+ * - `credential_rejected`: the server answered `401` (C1), or the gateway of a credential's `via`
111
+ * reported that the server behind it did (#495).
107
112
  * - `mcp.forbidden`: the server answered `403`.
108
113
  * - `mcp.error`: the server answered a JSON-RPC error; the message has its code.
109
114
  * - `mcp.status`: the server answered another HTTP error status, without a JSON-RPC error.
@@ -121,6 +126,8 @@ export interface McpCallFailure {
121
126
  readonly retryable: boolean;
122
127
  /** With `credential_rejected`: the server. */
123
128
  readonly server?: string;
129
+ /** With `credential_rejected` of the workload token: the gateway that refused it (#496). */
130
+ readonly gateway?: string;
124
131
  /** How many credential values the message had in it, replaced (R2b C8). */
125
132
  readonly redacted?: number;
126
133
  }
@@ -136,7 +143,8 @@ export declare class McpCallFailed extends Error {
136
143
  }
137
144
  /**
138
145
  * A request the server answered `401` (R2b C1): it rejected the vault's credential, or wanted one
139
- * and got none. Never retried, since nothing the gate holds changes between tries (Q4). A tool
146
+ * and got none. Through a credential's `via`, also a gateway's answer reporting that the server
147
+ * behind it did (`gateway-outcomes.ts`, #495). Never retried, since nothing the gate holds changes between tries (Q4). A tool
140
148
  * call that meets it fails with `credential_rejected` for the model to see; at discovery it is the
141
149
  * server's `failed` diagnostic.
142
150
  */
@@ -149,6 +157,8 @@ export declare class CredentialRejected extends McpCallFailed {
149
157
  * (RFC 9728 `resource_metadata`): a tool preview reads it (R2b C12). Never shown to the model.
150
158
  */
151
159
  readonly challenge?: string | undefined;
160
+ /** The gateway at `via` that refused the Runtime's workload token (#496): an expired or unrotated token. */
161
+ readonly gateway?: string | undefined;
152
162
  constructor(server: string,
153
163
  /** Whether a credential of the session's Agent was sent. */
154
164
  sent: boolean,
@@ -156,7 +166,9 @@ export declare class CredentialRejected extends McpCallFailed {
156
166
  * The answer's `WWW-Authenticate`, which may name the server's protected-resource metadata
157
167
  * (RFC 9728 `resource_metadata`): a tool preview reads it (R2b C12). Never shown to the model.
158
168
  */
159
- challenge?: string | undefined);
169
+ challenge?: string | undefined,
170
+ /** The gateway at `via` that refused the Runtime's workload token (#496): an expired or unrotated token. */
171
+ gateway?: string | undefined);
160
172
  }
161
173
  /**
162
174
  * A request its connection can no longer make, refused before it reached a tool: the server
@@ -180,12 +192,27 @@ export declare function unreachable(server: string, error: unknown, chars?: numb
180
192
  * so a server that reads it can run the call once.
181
193
  */
182
194
  export declare const IDEMPOTENCY_META_KEY = "nylorun/idempotency-key";
195
+ /** How a connection reaches its server through a gateway: the credential's routing. */
196
+ export interface GatewayRouting {
197
+ /** Where the server's requests go (the credential's `via`). */
198
+ readonly via: string;
199
+ /** What the gateway puts before each tool name it lists (the credential's `toolPrefix`, #494). */
200
+ readonly toolPrefix?: string;
201
+ }
202
+ /**
203
+ * Where a `tools/list` page names the tools a gateway listed without the credential's
204
+ * `toolPrefix` (#494): kept under their listed names, for discovery's diagnostic.
205
+ */
206
+ export declare const UNPREFIXED_TOOLS_META_KEY = "nylorun/unprefixed-tools";
183
207
  /**
184
208
  * An SDK `Client` as an `McpClient`. Its answers and failures carry no credential value sent
185
209
  * with them (R2b C8), and a failed call is an `McpCallFailed` (C7). A keyed call sends its key in
186
- * `_meta` (R5.5).
210
+ * `_meta` (R5.5). Through a `gateway`, an answer that reports the server refused the credential
211
+ * is `CredentialRejected`, as a `401` is (#495), and a gateway's `toolPrefix` is taken off the
212
+ * tools it lists and put back on the calls (#494): everything after this client names the
213
+ * server's own tools.
187
214
  */
188
- export declare function sdkClient(client: Client, serverName: string, errorChars: number): McpClient;
215
+ export declare function sdkClient(client: Client, serverName: string, errorChars: number, gateway?: GatewayRouting): McpClient;
189
216
  export declare function openMcpServer(input: {
190
217
  server: McpServerManifest;
191
218
  authorize: (url: string) => Promise<AuthorizeResult>;
@@ -225,6 +252,8 @@ export declare function listMcpTools(client: McpClient, input: {
225
252
  omitted: string[];
226
253
  disabled: number;
227
254
  unknownTools: string[];
255
+ /** The tools a gateway listed without the credential's `toolPrefix`, as it named them (#494). */
256
+ unprefixed: string[];
228
257
  }>;
229
258
  /**
230
259
  * One tool call and what it came to. Rejects with `McpConnectionStale` when the connection must