@nylorun/core 0.25.0-beta → 0.26.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.
- package/CHANGELOG.md +8 -0
- package/dist/compatibility.d.ts +4 -1
- package/dist/compatibility.js +4 -0
- package/dist/contracts.d.ts +129 -6
- package/dist/contracts.js +77 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @nylorun/core
|
|
2
2
|
|
|
3
|
+
## 0.26.0-beta
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fce0c9b: Headers for a custom model endpoint (#493). A custom endpoint's `settings` (`PUT /v1/tenant/model`) take `headers`, sent on every call, and `callHeaders`, whose values the Runtime resolves per call from the calling Agent: one of its labels (`{ from: "agent.label", key: "org" }`), its id (`agent.id`) or the session's owner when it is a person (`session.owner`). A source with no value sends no header. A Runtime that serves several orgs' Agents can then send each call's org (`x-nylorun-org` from the `org` label), so a model gateway attributes and budgets it while the call is made, in process and through the gates service alike. They are settings, read back by `GET /v1/tenant/model`: neither map may set `authorization`, a hop-by-hop or transport header, or `Nylorun-*`, and a name appears once across both. Studio keeps them when it saves the model.
|
|
8
|
+
- ab7c08a: A gateway's tool prefix (#494, Host feature `gateway-credentials`). A `bearer` or `headers` credential with `via`, written to an Agent's vault, may add `toolPrefix`: what the gateway at `via` puts before each tool name it lists, such as LiteLLM's `github-`. The Runtime lists the server's tools without it, so tool names (`github__create_issue`), a manifest's `tools` settings and tool policy rules name the server's own tools whether or not a gateway is in between, and calls each tool by the name the gateway listed. A listed tool that lacks the prefix keeps its name, and the server's `mcp.discovered` message names it. `toolPrefix` needs `via`, and secret views carry it. It is the installation's routing, never a manifest's: a manifest's secret slot cannot name it, and a slot's value write (`{ headers, toolPrefix }`) adds it. A fork keeps it while the new slot keeps `via`. No protocol change.
|
|
9
|
+
- 4a563e7: The workload token (#496). A Runtime given `NYLORUN_WORKLOAD_TOKEN_FILE`, a token a platform rotates through a file, reads it at each use and keeps nothing, so a rotation applies to the next request with no restart; a missing, unreadable or empty file fails the request, naming the variable, and nothing is sent without it. A custom model with `auth: { type: "workload" }` sends it as the endpoint's bearer. A new credential type, `workload` (`{ url, via, identity?, toolPrefix? }`, no value), sends `Authorization: Bearer <token>` to its `via` only, and only when `via`'s origin is in `NYLORUN_WORKLOAD_TOKEN_ORIGINS`, since an Agent's writer chooses `via`. A gateway's `401` is `credential_rejected` with `gateway`, its origin. The token stays in the process that makes the call: never in a sandbox, the model, an event or a log. Studio shows the credential and the model's auth.
|
|
10
|
+
|
|
3
11
|
## 0.25.0-beta
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -194,10 +194,13 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
|
|
|
194
194
|
* `traces`: `GET /v1/sessions/{id}/turns/{turnId}/trace` answers a turn's spans as OTLP JSON,
|
|
195
195
|
* the spans the Runtime posts to an OTLP collector when one is configured; a command or an AG-UI
|
|
196
196
|
* or A2A request sent with a `traceparent` joins the caller's trace.
|
|
197
|
+
* `gateway-credentials`: a `bearer` or `headers` credential with `via`, written to an Agent's vault,
|
|
198
|
+
* may name the gateway's tool prefix (`toolPrefix`), which the Runtime takes off the tools it lists
|
|
199
|
+
* and puts back on each call.
|
|
197
200
|
*/
|
|
198
201
|
export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "transcript-events", "subject-headers", "ag-ui-endpoint", "a2a-endpoint", "sandbox-pods", "trusted-issuers", "session-reads", "calls-export", "credential-coverage", "tool-calls", "environment-setup", "environment-disk-versions", "tool-policy", "traces",
|
|
199
202
|
/** Opt-in artifact metadata pages (`GET /v1/artifacts?limit=…`). */
|
|
200
|
-
"artifact-reads"];
|
|
203
|
+
"artifact-reads", "gateway-credentials"];
|
|
201
204
|
export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
|
|
202
205
|
export interface ProtocolRange {
|
|
203
206
|
min: number;
|
package/dist/compatibility.js
CHANGED
|
@@ -196,6 +196,9 @@ export const PROTOCOL_FEATURES = [
|
|
|
196
196
|
* `traces`: `GET /v1/sessions/{id}/turns/{turnId}/trace` answers a turn's spans as OTLP JSON,
|
|
197
197
|
* the spans the Runtime posts to an OTLP collector when one is configured; a command or an AG-UI
|
|
198
198
|
* or A2A request sent with a `traceparent` joins the caller's trace.
|
|
199
|
+
* `gateway-credentials`: a `bearer` or `headers` credential with `via`, written to an Agent's vault,
|
|
200
|
+
* may name the gateway's tool prefix (`toolPrefix`), which the Runtime takes off the tools it lists
|
|
201
|
+
* and puts back on each call.
|
|
199
202
|
*/
|
|
200
203
|
export const OPTIONAL_HOST_FEATURES = [
|
|
201
204
|
"tenant-fixture-model",
|
|
@@ -215,6 +218,7 @@ export const OPTIONAL_HOST_FEATURES = [
|
|
|
215
218
|
"traces",
|
|
216
219
|
/** Opt-in artifact metadata pages (`GET /v1/artifacts?limit=…`). */
|
|
217
220
|
"artifact-reads",
|
|
221
|
+
"gateway-credentials",
|
|
218
222
|
];
|
|
219
223
|
/**
|
|
220
224
|
* What this Host serves: protocol 16, 17 and 18. Protocol 16 replaced agent definitions and
|
package/dist/contracts.d.ts
CHANGED
|
@@ -946,6 +946,14 @@ export declare const CredentialIdentitySchema: z.ZodObject<{
|
|
|
946
946
|
header: z.ZodString;
|
|
947
947
|
}, z.core.$strict>;
|
|
948
948
|
export type CredentialIdentity = z.infer<typeof CredentialIdentitySchema>;
|
|
949
|
+
/**
|
|
950
|
+
* `toolPrefix`: what the gateway at `via` puts before each tool name it lists, such as
|
|
951
|
+
* LiteLLM's `github-` (Host feature `gateway-credentials`). The Runtime lists the server's tools
|
|
952
|
+
* without it, so tool names, a manifest's `tools` settings and tool policy rules name the server's
|
|
953
|
+
* own tools, and calls a tool by the name the gateway listed. Only with `via`, and only on an
|
|
954
|
+
* Agent's secret: how a gateway names tools is the installation's routing, never a manifest's.
|
|
955
|
+
*/
|
|
956
|
+
export declare const CredentialToolPrefixSchema: z.ZodString;
|
|
949
957
|
export declare const RESERVED_ENVIRONMENT_NAMES: ReadonlySet<string>;
|
|
950
958
|
export declare function isReservedEnvironmentName(name: string): boolean;
|
|
951
959
|
/**
|
|
@@ -1010,6 +1018,7 @@ export declare const PutAgentSecretRequestSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
1010
1018
|
type: z.ZodLiteral<"bearer">;
|
|
1011
1019
|
url: z.ZodString;
|
|
1012
1020
|
value: z.ZodString;
|
|
1021
|
+
toolPrefix: z.ZodOptional<z.ZodString>;
|
|
1013
1022
|
}, z.core.$strict>, z.ZodObject<{
|
|
1014
1023
|
via: z.ZodOptional<z.ZodString>;
|
|
1015
1024
|
identity: z.ZodOptional<z.ZodObject<{
|
|
@@ -1019,16 +1028,28 @@ export declare const PutAgentSecretRequestSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
1019
1028
|
type: z.ZodLiteral<"headers">;
|
|
1020
1029
|
url: z.ZodString;
|
|
1021
1030
|
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1031
|
+
toolPrefix: z.ZodOptional<z.ZodString>;
|
|
1032
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1033
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
1034
|
+
type: z.ZodLiteral<"workload">;
|
|
1035
|
+
url: z.ZodString;
|
|
1036
|
+
via: z.ZodString;
|
|
1037
|
+
identity: z.ZodOptional<z.ZodObject<{
|
|
1038
|
+
header: z.ZodString;
|
|
1039
|
+
}, z.core.$strict>>;
|
|
1040
|
+
toolPrefix: z.ZodOptional<z.ZodString>;
|
|
1022
1041
|
}, z.core.$strict>], "type">;
|
|
1023
1042
|
export type PutAgentSecretRequest = z.infer<typeof PutAgentSecretRequestSchema>;
|
|
1024
1043
|
/**
|
|
1025
1044
|
* A secret write on an Environment whose manifest declares the secret's slot: only the
|
|
1026
|
-
* value, `value` (or `headers` for a `headers` slot). Its type and binding come from the slot
|
|
1045
|
+
* value, `value` (or `headers` for a `headers` slot). Its type and binding come from the slot,
|
|
1046
|
+
* except the gateway's `toolPrefix`, which this installation's write may add to a slot with `via`.
|
|
1027
1047
|
*/
|
|
1028
1048
|
export declare const PutAgentSecretValueRequestSchema: z.ZodObject<{
|
|
1029
1049
|
requestId: z.ZodOptional<z.ZodString>;
|
|
1030
1050
|
value: z.ZodOptional<z.ZodString>;
|
|
1031
1051
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1052
|
+
toolPrefix: z.ZodOptional<z.ZodString>;
|
|
1032
1053
|
}, z.core.$strict>;
|
|
1033
1054
|
export type PutAgentSecretValueRequest = z.infer<typeof PutAgentSecretValueRequestSchema>;
|
|
1034
1055
|
/** Whether `name` may name a secret of `type` (`PUT .../secrets/{name}`); a message when not. */
|
|
@@ -2972,11 +2993,28 @@ export declare const CUSTOM_MODEL_SETTING_DEFAULTS: Readonly<{
|
|
|
2972
2993
|
contextWindow: 32768;
|
|
2973
2994
|
maxTokens: 8192;
|
|
2974
2995
|
}>;
|
|
2996
|
+
/**
|
|
2997
|
+
* Where a custom endpoint's per-call header takes its value from the call (#493): one of the
|
|
2998
|
+
* calling Agent's labels (`key`, such as `org`), the Agent's id, or the session's owner when it
|
|
2999
|
+
* is a person. A call whose source has no value sends no header.
|
|
3000
|
+
*/
|
|
3001
|
+
export declare const ModelCallHeaderSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3002
|
+
from: z.ZodLiteral<"agent.label">;
|
|
3003
|
+
key: z.ZodString;
|
|
3004
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3005
|
+
from: z.ZodLiteral<"agent.id">;
|
|
3006
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3007
|
+
from: z.ZodLiteral<"session.owner">;
|
|
3008
|
+
}, z.core.$strict>], "from">;
|
|
3009
|
+
export type ModelCallHeaderSource = z.infer<typeof ModelCallHeaderSourceSchema>;
|
|
2975
3010
|
/**
|
|
2976
3011
|
* What the Runtime cannot learn from a custom OpenAI-compatible endpoint (Model Calls §7):
|
|
2977
3012
|
* its context window and output limit (default `CUSTOM_MODEL_SETTING_DEFAULTS`), whether it
|
|
2978
3013
|
* reasons, what it reads (`inputs`; default text only) and pi-ai `compat` settings
|
|
2979
|
-
* (`thinkingFormat`, `thinkingTokenBudgetField`, `chatTemplateKwargs`, …).
|
|
3014
|
+
* (`thinkingFormat`, `thinkingTokenBudgetField`, `chatTemplateKwargs`, …). `headers` are sent on
|
|
3015
|
+
* every call and `callHeaders` resolved per call from the calling Agent, for a gateway that
|
|
3016
|
+
* attributes or budgets each call (#493): they are settings, never secrets, and read back as such,
|
|
3017
|
+
* so neither may set `authorization`.
|
|
2980
3018
|
*/
|
|
2981
3019
|
export declare const CustomModelSettingsSchema: z.ZodObject<{
|
|
2982
3020
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2991,8 +3029,24 @@ export declare const CustomModelSettingsSchema: z.ZodObject<{
|
|
|
2991
3029
|
video: "video";
|
|
2992
3030
|
}>>>;
|
|
2993
3031
|
compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3032
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3033
|
+
callHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3034
|
+
from: z.ZodLiteral<"agent.label">;
|
|
3035
|
+
key: z.ZodString;
|
|
3036
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3037
|
+
from: z.ZodLiteral<"agent.id">;
|
|
3038
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3039
|
+
from: z.ZodLiteral<"session.owner">;
|
|
3040
|
+
}, z.core.$strict>], "from">>>;
|
|
2994
3041
|
}, z.core.$strict>;
|
|
2995
3042
|
export type CustomModelSettings = z.infer<typeof CustomModelSettingsSchema>;
|
|
3043
|
+
/**
|
|
3044
|
+
* How the Runtime authenticates to the model: a stored key, a stored OAuth grant, or (a custom
|
|
3045
|
+
* endpoint only) the Runtime's workload token, read from `NYLORUN_WORKLOAD_TOKEN_FILE` on every
|
|
3046
|
+
* call and never stored (#496).
|
|
3047
|
+
*/
|
|
3048
|
+
export declare const HOST_MODEL_AUTH_TYPES: readonly ["api_key", "oauth", "workload"];
|
|
3049
|
+
export type HostModelAuthType = (typeof HOST_MODEL_AUTH_TYPES)[number];
|
|
2996
3050
|
export declare const PutHostModelRequestSchema: z.ZodObject<{
|
|
2997
3051
|
requestId: z.ZodString;
|
|
2998
3052
|
idempotencyKey: z.ZodString;
|
|
@@ -3012,6 +3066,15 @@ export declare const PutHostModelRequestSchema: z.ZodObject<{
|
|
|
3012
3066
|
video: "video";
|
|
3013
3067
|
}>>>;
|
|
3014
3068
|
compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3069
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3070
|
+
callHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3071
|
+
from: z.ZodLiteral<"agent.label">;
|
|
3072
|
+
key: z.ZodString;
|
|
3073
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3074
|
+
from: z.ZodLiteral<"agent.id">;
|
|
3075
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3076
|
+
from: z.ZodLiteral<"session.owner">;
|
|
3077
|
+
}, z.core.$strict>], "from">>>;
|
|
3015
3078
|
}, z.core.$strict>>;
|
|
3016
3079
|
auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3017
3080
|
type: z.ZodLiteral<"api_key">;
|
|
@@ -3022,7 +3085,9 @@ export declare const PutHostModelRequestSchema: z.ZodObject<{
|
|
|
3022
3085
|
refresh: z.ZodString;
|
|
3023
3086
|
access: z.ZodString;
|
|
3024
3087
|
expires: z.ZodNumber;
|
|
3025
|
-
}, z.core.$loose
|
|
3088
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
3089
|
+
type: z.ZodLiteral<"workload">;
|
|
3090
|
+
}, z.core.$strict>], "type">;
|
|
3026
3091
|
}, z.core.$strict>;
|
|
3027
3092
|
export type PutHostModelRequest = z.infer<typeof PutHostModelRequestSchema>;
|
|
3028
3093
|
export type HostModelView = {
|
|
@@ -3031,7 +3096,7 @@ export type HostModelView = {
|
|
|
3031
3096
|
readonly configured: true;
|
|
3032
3097
|
readonly provider: string;
|
|
3033
3098
|
readonly model: string;
|
|
3034
|
-
readonly authType:
|
|
3099
|
+
readonly authType: HostModelAuthType;
|
|
3035
3100
|
readonly baseUrl?: string;
|
|
3036
3101
|
readonly settings?: CustomModelSettings;
|
|
3037
3102
|
};
|
|
@@ -3044,7 +3109,7 @@ export declare const SelectHostModelRequestSchema: z.ZodObject<{
|
|
|
3044
3109
|
}, z.core.$strict>;
|
|
3045
3110
|
export type SelectHostModelRequest = z.infer<typeof SelectHostModelRequestSchema>;
|
|
3046
3111
|
export type HostModelProviderInfo = z.infer<typeof HostModelProviderInfoSchema>;
|
|
3047
|
-
export declare const ENVIRONMENT_SECRET_TYPES: readonly ["bearer", "headers", "environment_secret", "environment_variable"];
|
|
3112
|
+
export declare const ENVIRONMENT_SECRET_TYPES: readonly ["bearer", "headers", "workload", "environment_secret", "environment_variable"];
|
|
3048
3113
|
/**
|
|
3049
3114
|
* One credential of an Environment's vault, never its value: what it is bound to (the server
|
|
3050
3115
|
* `url` for `bearer` and `headers`; the hosts and header for `environment_secret`).
|
|
@@ -3056,6 +3121,7 @@ export declare const AgentSecretViewSchema: z.ZodObject<{
|
|
|
3056
3121
|
environment_secret: "environment_secret";
|
|
3057
3122
|
environment_variable: "environment_variable";
|
|
3058
3123
|
headers: "headers";
|
|
3124
|
+
workload: "workload";
|
|
3059
3125
|
}>;
|
|
3060
3126
|
binding: z.ZodObject<{
|
|
3061
3127
|
url: z.ZodOptional<z.ZodString>;
|
|
@@ -3067,6 +3133,7 @@ export declare const AgentSecretViewSchema: z.ZodObject<{
|
|
|
3067
3133
|
}, z.core.$strict>;
|
|
3068
3134
|
headerNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3069
3135
|
via: z.ZodOptional<z.ZodString>;
|
|
3136
|
+
toolPrefix: z.ZodOptional<z.ZodString>;
|
|
3070
3137
|
identity: z.ZodOptional<z.ZodObject<{
|
|
3071
3138
|
header: z.ZodString;
|
|
3072
3139
|
}, z.core.$strict>>;
|
|
@@ -3082,6 +3149,7 @@ export declare const ListAgentSecretsResponseSchema: z.ZodObject<{
|
|
|
3082
3149
|
environment_secret: "environment_secret";
|
|
3083
3150
|
environment_variable: "environment_variable";
|
|
3084
3151
|
headers: "headers";
|
|
3152
|
+
workload: "workload";
|
|
3085
3153
|
}>;
|
|
3086
3154
|
binding: z.ZodObject<{
|
|
3087
3155
|
url: z.ZodOptional<z.ZodString>;
|
|
@@ -3093,6 +3161,7 @@ export declare const ListAgentSecretsResponseSchema: z.ZodObject<{
|
|
|
3093
3161
|
}, z.core.$strict>;
|
|
3094
3162
|
headerNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3095
3163
|
via: z.ZodOptional<z.ZodString>;
|
|
3164
|
+
toolPrefix: z.ZodOptional<z.ZodString>;
|
|
3096
3165
|
identity: z.ZodOptional<z.ZodObject<{
|
|
3097
3166
|
header: z.ZodString;
|
|
3098
3167
|
}, z.core.$strict>>;
|
|
@@ -3940,6 +4009,7 @@ export declare const ToolCompletedPayloadSchema: z.ZodObject<{
|
|
|
3940
4009
|
code: z.ZodString;
|
|
3941
4010
|
message: z.ZodString;
|
|
3942
4011
|
server: z.ZodOptional<z.ZodString>;
|
|
4012
|
+
gateway: z.ZodOptional<z.ZodString>;
|
|
3943
4013
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
3944
4014
|
}, z.core.$loose>>;
|
|
3945
4015
|
redacted: z.ZodOptional<z.ZodNumber>;
|
|
@@ -4182,6 +4252,7 @@ declare const TRANSCRIPT_PAYLOADS: {
|
|
|
4182
4252
|
code: z.ZodString;
|
|
4183
4253
|
message: z.ZodString;
|
|
4184
4254
|
server: z.ZodOptional<z.ZodString>;
|
|
4255
|
+
gateway: z.ZodOptional<z.ZodString>;
|
|
4185
4256
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
4186
4257
|
}, z.core.$loose>>;
|
|
4187
4258
|
redacted: z.ZodOptional<z.ZodNumber>;
|
|
@@ -4899,6 +4970,7 @@ export declare const EVENT_CATALOG: {
|
|
|
4899
4970
|
code: z.ZodString;
|
|
4900
4971
|
message: z.ZodString;
|
|
4901
4972
|
server: z.ZodOptional<z.ZodString>;
|
|
4973
|
+
gateway: z.ZodOptional<z.ZodString>;
|
|
4902
4974
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
4903
4975
|
}, z.core.$loose>>;
|
|
4904
4976
|
redacted: z.ZodOptional<z.ZodNumber>;
|
|
@@ -5402,6 +5474,7 @@ export declare const HostModelViewSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
5402
5474
|
authType: z.ZodEnum<{
|
|
5403
5475
|
api_key: "api_key";
|
|
5404
5476
|
oauth: "oauth";
|
|
5477
|
+
workload: "workload";
|
|
5405
5478
|
}>;
|
|
5406
5479
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
5407
5480
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -5417,6 +5490,15 @@ export declare const HostModelViewSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
5417
5490
|
video: "video";
|
|
5418
5491
|
}>>>;
|
|
5419
5492
|
compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5493
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
5494
|
+
callHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5495
|
+
from: z.ZodLiteral<"agent.label">;
|
|
5496
|
+
key: z.ZodString;
|
|
5497
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5498
|
+
from: z.ZodLiteral<"agent.id">;
|
|
5499
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5500
|
+
from: z.ZodLiteral<"session.owner">;
|
|
5501
|
+
}, z.core.$strict>], "from">>>;
|
|
5420
5502
|
}, z.core.$strict>>;
|
|
5421
5503
|
}, z.core.$strict>]>;
|
|
5422
5504
|
export declare const TenantStatusSchema: z.ZodObject<{
|
|
@@ -5443,6 +5525,7 @@ export declare const TenantStatusSchema: z.ZodObject<{
|
|
|
5443
5525
|
authType: z.ZodEnum<{
|
|
5444
5526
|
api_key: "api_key";
|
|
5445
5527
|
oauth: "oauth";
|
|
5528
|
+
workload: "workload";
|
|
5446
5529
|
}>;
|
|
5447
5530
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
5448
5531
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -5458,6 +5541,15 @@ export declare const TenantStatusSchema: z.ZodObject<{
|
|
|
5458
5541
|
video: "video";
|
|
5459
5542
|
}>>>;
|
|
5460
5543
|
compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5544
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
5545
|
+
callHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5546
|
+
from: z.ZodLiteral<"agent.label">;
|
|
5547
|
+
key: z.ZodString;
|
|
5548
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5549
|
+
from: z.ZodLiteral<"agent.id">;
|
|
5550
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5551
|
+
from: z.ZodLiteral<"session.owner">;
|
|
5552
|
+
}, z.core.$strict>], "from">>>;
|
|
5461
5553
|
}, z.core.$strict>>;
|
|
5462
5554
|
}, z.core.$strict>]>;
|
|
5463
5555
|
agents: z.ZodArray<z.ZodObject<{
|
|
@@ -5562,6 +5654,15 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
|
|
|
5562
5654
|
video: "video";
|
|
5563
5655
|
}>>>;
|
|
5564
5656
|
compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5657
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
5658
|
+
callHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5659
|
+
from: z.ZodLiteral<"agent.label">;
|
|
5660
|
+
key: z.ZodString;
|
|
5661
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5662
|
+
from: z.ZodLiteral<"agent.id">;
|
|
5663
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5664
|
+
from: z.ZodLiteral<"session.owner">;
|
|
5665
|
+
}, z.core.$strict>], "from">>>;
|
|
5565
5666
|
}, z.core.$strict>>;
|
|
5566
5667
|
auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5567
5668
|
type: z.ZodLiteral<"api_key">;
|
|
@@ -5572,7 +5673,9 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
|
|
|
5572
5673
|
refresh: z.ZodString;
|
|
5573
5674
|
access: z.ZodString;
|
|
5574
5675
|
expires: z.ZodNumber;
|
|
5575
|
-
}, z.core.$loose
|
|
5676
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
5677
|
+
type: z.ZodLiteral<"workload">;
|
|
5678
|
+
}, z.core.$strict>], "type">;
|
|
5576
5679
|
}, z.core.$strict>>;
|
|
5577
5680
|
fixtureModel: z.ZodOptional<z.ZodLiteral<true>>;
|
|
5578
5681
|
}, z.core.$strict>;
|
|
@@ -6069,6 +6172,7 @@ export declare const HostModelProviderInfoSchema: z.ZodObject<{
|
|
|
6069
6172
|
authType: z.ZodEnum<{
|
|
6070
6173
|
api_key: "api_key";
|
|
6071
6174
|
oauth: "oauth";
|
|
6175
|
+
workload: "workload";
|
|
6072
6176
|
}>;
|
|
6073
6177
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
6074
6178
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -6084,6 +6188,15 @@ export declare const HostModelProviderInfoSchema: z.ZodObject<{
|
|
|
6084
6188
|
video: "video";
|
|
6085
6189
|
}>>>;
|
|
6086
6190
|
compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6191
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6192
|
+
callHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6193
|
+
from: z.ZodLiteral<"agent.label">;
|
|
6194
|
+
key: z.ZodString;
|
|
6195
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6196
|
+
from: z.ZodLiteral<"agent.id">;
|
|
6197
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6198
|
+
from: z.ZodLiteral<"session.owner">;
|
|
6199
|
+
}, z.core.$strict>], "from">>>;
|
|
6087
6200
|
}, z.core.$strict>>;
|
|
6088
6201
|
inputs: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
6089
6202
|
audio: "audio";
|
|
@@ -6137,6 +6250,7 @@ export declare const ListProvidersResponseSchema: z.ZodObject<{
|
|
|
6137
6250
|
authType: z.ZodEnum<{
|
|
6138
6251
|
api_key: "api_key";
|
|
6139
6252
|
oauth: "oauth";
|
|
6253
|
+
workload: "workload";
|
|
6140
6254
|
}>;
|
|
6141
6255
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
6142
6256
|
settings: z.ZodOptional<z.ZodObject<{
|
|
@@ -6152,6 +6266,15 @@ export declare const ListProvidersResponseSchema: z.ZodObject<{
|
|
|
6152
6266
|
video: "video";
|
|
6153
6267
|
}>>>;
|
|
6154
6268
|
compat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6269
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6270
|
+
callHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6271
|
+
from: z.ZodLiteral<"agent.label">;
|
|
6272
|
+
key: z.ZodString;
|
|
6273
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6274
|
+
from: z.ZodLiteral<"agent.id">;
|
|
6275
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6276
|
+
from: z.ZodLiteral<"session.owner">;
|
|
6277
|
+
}, z.core.$strict>], "from">>>;
|
|
6155
6278
|
}, z.core.$strict>>;
|
|
6156
6279
|
inputs: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
6157
6280
|
audio: "audio";
|
package/dist/contracts.js
CHANGED
|
@@ -1320,11 +1320,29 @@ export const CredentialViaSchema = z.string().superRefine((value, ctx) => {
|
|
|
1320
1320
|
* owner (the reserved `installation`) sends none.
|
|
1321
1321
|
*/
|
|
1322
1322
|
export const CredentialIdentitySchema = z.object({ header: CredentialHeaderNameSchema }).strict();
|
|
1323
|
+
/**
|
|
1324
|
+
* `toolPrefix`: what the gateway at `via` puts before each tool name it lists, such as
|
|
1325
|
+
* LiteLLM's `github-` (Host feature `gateway-credentials`). The Runtime lists the server's tools
|
|
1326
|
+
* without it, so tool names, a manifest's `tools` settings and tool policy rules name the server's
|
|
1327
|
+
* own tools, and calls a tool by the name the gateway listed. Only with `via`, and only on an
|
|
1328
|
+
* Agent's secret: how a gateway names tools is the installation's routing, never a manifest's.
|
|
1329
|
+
*/
|
|
1330
|
+
export const CredentialToolPrefixSchema = z
|
|
1331
|
+
.string()
|
|
1332
|
+
.min(1)
|
|
1333
|
+
.max(64)
|
|
1334
|
+
.regex(/^[\x21-\x7e]+$/, "A tool prefix is printable ASCII with no spaces");
|
|
1323
1335
|
/** Where a credential's requests go, and whom they name. Neither is secret. */
|
|
1324
1336
|
const credentialRouting = {
|
|
1325
1337
|
via: CredentialViaSchema.optional(),
|
|
1326
1338
|
identity: CredentialIdentitySchema.optional(),
|
|
1327
1339
|
};
|
|
1340
|
+
/** A `toolPrefix` names how a gateway lists tools, so it needs the gateway's `via`. */
|
|
1341
|
+
const prefixNeedsVia = (routing) => routing.toolPrefix === undefined || routing.via !== undefined;
|
|
1342
|
+
const PREFIX_NEEDS_VIA = {
|
|
1343
|
+
message: "toolPrefix needs via: it is how the gateway there names tools",
|
|
1344
|
+
path: ["toolPrefix"],
|
|
1345
|
+
};
|
|
1328
1346
|
/** On rotate: absent keeps the current value, `null` removes it. */
|
|
1329
1347
|
const credentialRoutingChange = {
|
|
1330
1348
|
via: CredentialViaSchema.nullable().optional(),
|
|
@@ -1448,8 +1466,10 @@ export const PutAgentSecretRequestSchema = z.discriminatedUnion("type", [
|
|
|
1448
1466
|
url: z.string().min(1),
|
|
1449
1467
|
value: z.string().min(1),
|
|
1450
1468
|
...credentialRouting,
|
|
1469
|
+
toolPrefix: CredentialToolPrefixSchema.optional(),
|
|
1451
1470
|
})
|
|
1452
|
-
.strict()
|
|
1471
|
+
.strict()
|
|
1472
|
+
.refine(prefixNeedsVia, PREFIX_NEEDS_VIA),
|
|
1453
1473
|
z
|
|
1454
1474
|
.object({
|
|
1455
1475
|
requestId: RequestIdSchema.optional(),
|
|
@@ -1457,18 +1477,38 @@ export const PutAgentSecretRequestSchema = z.discriminatedUnion("type", [
|
|
|
1457
1477
|
url: z.string().min(1),
|
|
1458
1478
|
headers: CredentialHeadersSchema,
|
|
1459
1479
|
...credentialRouting,
|
|
1480
|
+
toolPrefix: CredentialToolPrefixSchema.optional(),
|
|
1481
|
+
})
|
|
1482
|
+
.strict()
|
|
1483
|
+
.refine(prefixNeedsVia, PREFIX_NEEDS_VIA),
|
|
1484
|
+
/**
|
|
1485
|
+
* The Runtime's workload token as the bearer (#496): no value is stored. Each request reads
|
|
1486
|
+
* `NYLORUN_WORKLOAD_TOKEN_FILE` and sends `Authorization: Bearer <token>` to `via` only, a
|
|
1487
|
+
* gateway whose origin the operator lists in `NYLORUN_WORKLOAD_TOKEN_ORIGINS`.
|
|
1488
|
+
*/
|
|
1489
|
+
z
|
|
1490
|
+
.object({
|
|
1491
|
+
requestId: RequestIdSchema.optional(),
|
|
1492
|
+
type: z.literal("workload"),
|
|
1493
|
+
url: z.string().min(1),
|
|
1494
|
+
via: CredentialViaSchema,
|
|
1495
|
+
identity: CredentialIdentitySchema.optional(),
|
|
1496
|
+
toolPrefix: CredentialToolPrefixSchema.optional(),
|
|
1460
1497
|
})
|
|
1461
1498
|
.strict(),
|
|
1462
1499
|
]);
|
|
1463
1500
|
/**
|
|
1464
1501
|
* A secret write on an Environment whose manifest declares the secret's slot: only the
|
|
1465
|
-
* value, `value` (or `headers` for a `headers` slot). Its type and binding come from the slot
|
|
1502
|
+
* value, `value` (or `headers` for a `headers` slot). Its type and binding come from the slot,
|
|
1503
|
+
* except the gateway's `toolPrefix`, which this installation's write may add to a slot with `via`.
|
|
1466
1504
|
*/
|
|
1467
1505
|
export const PutAgentSecretValueRequestSchema = z
|
|
1468
1506
|
.object({
|
|
1469
1507
|
requestId: RequestIdSchema.optional(),
|
|
1470
1508
|
value: z.string().min(1).optional(),
|
|
1471
1509
|
headers: CredentialHeadersSchema.optional(),
|
|
1510
|
+
/** A `bearer` or `headers` slot with `via`: how the gateway there prefixes tool names. */
|
|
1511
|
+
toolPrefix: CredentialToolPrefixSchema.optional(),
|
|
1472
1512
|
})
|
|
1473
1513
|
.strict()
|
|
1474
1514
|
.refine((body) => (body.value === undefined) !== (body.headers === undefined), {
|
|
@@ -2165,11 +2205,24 @@ export const ModelInputSchema = z.enum(MODEL_INPUTS);
|
|
|
2165
2205
|
* failed call.
|
|
2166
2206
|
*/
|
|
2167
2207
|
export const CUSTOM_MODEL_SETTING_DEFAULTS = Object.freeze({ contextWindow: 32_768, maxTokens: 8_192 });
|
|
2208
|
+
/**
|
|
2209
|
+
* Where a custom endpoint's per-call header takes its value from the call (#493): one of the
|
|
2210
|
+
* calling Agent's labels (`key`, such as `org`), the Agent's id, or the session's owner when it
|
|
2211
|
+
* is a person. A call whose source has no value sends no header.
|
|
2212
|
+
*/
|
|
2213
|
+
export const ModelCallHeaderSourceSchema = z.discriminatedUnion("from", [
|
|
2214
|
+
z.object({ from: z.literal("agent.label"), key: z.string().min(1) }).strict(),
|
|
2215
|
+
z.object({ from: z.literal("agent.id") }).strict(),
|
|
2216
|
+
z.object({ from: z.literal("session.owner") }).strict(),
|
|
2217
|
+
]);
|
|
2168
2218
|
/**
|
|
2169
2219
|
* What the Runtime cannot learn from a custom OpenAI-compatible endpoint (Model Calls §7):
|
|
2170
2220
|
* its context window and output limit (default `CUSTOM_MODEL_SETTING_DEFAULTS`), whether it
|
|
2171
2221
|
* reasons, what it reads (`inputs`; default text only) and pi-ai `compat` settings
|
|
2172
|
-
* (`thinkingFormat`, `thinkingTokenBudgetField`, `chatTemplateKwargs`, …).
|
|
2222
|
+
* (`thinkingFormat`, `thinkingTokenBudgetField`, `chatTemplateKwargs`, …). `headers` are sent on
|
|
2223
|
+
* every call and `callHeaders` resolved per call from the calling Agent, for a gateway that
|
|
2224
|
+
* attributes or budgets each call (#493): they are settings, never secrets, and read back as such,
|
|
2225
|
+
* so neither may set `authorization`.
|
|
2173
2226
|
*/
|
|
2174
2227
|
export const CustomModelSettingsSchema = z
|
|
2175
2228
|
.object({
|
|
@@ -2178,8 +2231,16 @@ export const CustomModelSettingsSchema = z
|
|
|
2178
2231
|
reasoning: z.boolean().optional(),
|
|
2179
2232
|
inputs: z.array(ModelInputSchema).optional(),
|
|
2180
2233
|
compat: z.record(z.string(), z.unknown()).optional(),
|
|
2234
|
+
headers: z.record(CredentialHeaderNameSchema, CredentialHeaderValueSchema).optional(),
|
|
2235
|
+
callHeaders: z.record(CredentialHeaderNameSchema, ModelCallHeaderSourceSchema).optional(),
|
|
2181
2236
|
})
|
|
2182
2237
|
.strict();
|
|
2238
|
+
/**
|
|
2239
|
+
* How the Runtime authenticates to the model: a stored key, a stored OAuth grant, or (a custom
|
|
2240
|
+
* endpoint only) the Runtime's workload token, read from `NYLORUN_WORKLOAD_TOKEN_FILE` on every
|
|
2241
|
+
* call and never stored (#496).
|
|
2242
|
+
*/
|
|
2243
|
+
export const HOST_MODEL_AUTH_TYPES = ["api_key", "oauth", "workload"];
|
|
2183
2244
|
export const PutHostModelRequestSchema = z
|
|
2184
2245
|
.object({
|
|
2185
2246
|
...vaultWriteBase,
|
|
@@ -2203,6 +2264,7 @@ export const PutHostModelRequestSchema = z
|
|
|
2203
2264
|
expires: z.number(),
|
|
2204
2265
|
})
|
|
2205
2266
|
.passthrough(),
|
|
2267
|
+
z.object({ type: z.literal("workload") }).strict(),
|
|
2206
2268
|
]),
|
|
2207
2269
|
})
|
|
2208
2270
|
.strict();
|
|
@@ -2217,6 +2279,7 @@ export const SelectHostModelRequestSchema = z
|
|
|
2217
2279
|
export const ENVIRONMENT_SECRET_TYPES = [
|
|
2218
2280
|
"bearer",
|
|
2219
2281
|
"headers",
|
|
2282
|
+
"workload",
|
|
2220
2283
|
"environment_secret",
|
|
2221
2284
|
"environment_variable",
|
|
2222
2285
|
];
|
|
@@ -2238,6 +2301,8 @@ export const AgentSecretViewSchema = z
|
|
|
2238
2301
|
/** A `headers` credential's header names (lower case), never their values. */
|
|
2239
2302
|
headerNames: z.array(z.string()).optional(),
|
|
2240
2303
|
via: z.string().optional(),
|
|
2304
|
+
/** How the gateway at `via` prefixes tool names (Host feature `gateway-credentials`). */
|
|
2305
|
+
toolPrefix: z.string().optional(),
|
|
2241
2306
|
identity: CredentialIdentitySchema.optional(),
|
|
2242
2307
|
createdAt: z.string(),
|
|
2243
2308
|
rotatedAt: z.string().optional(),
|
|
@@ -2795,9 +2860,15 @@ export const ToolCompletedPayloadSchema = z
|
|
|
2795
2860
|
message: z.string(),
|
|
2796
2861
|
/**
|
|
2797
2862
|
* With `credential_rejected`: the MCP server, or the HTTP tool's `credential`,
|
|
2798
|
-
* whose server answered `401
|
|
2863
|
+
* whose server answered `401` (or, through a credential's `via`, whose gateway
|
|
2864
|
+
* reported that the server behind it did): the integration refused the credential.
|
|
2799
2865
|
*/
|
|
2800
2866
|
server: z.string().optional(),
|
|
2867
|
+
/**
|
|
2868
|
+
* With `credential_rejected` of the Runtime's workload token: the origin of the gateway
|
|
2869
|
+
* that refused it (#496), an expired or unrotated token.
|
|
2870
|
+
*/
|
|
2871
|
+
gateway: z.string().optional(),
|
|
2801
2872
|
/** An MCP tool error: true when calling again may work, as for `mcp.unreachable`. */
|
|
2802
2873
|
retryable: z.boolean().optional(),
|
|
2803
2874
|
})
|
|
@@ -3448,7 +3519,7 @@ export const HostModelViewSchema = z.union([
|
|
|
3448
3519
|
configured: z.literal(true),
|
|
3449
3520
|
provider: z.string(),
|
|
3450
3521
|
model: z.string(),
|
|
3451
|
-
authType: z.enum(
|
|
3522
|
+
authType: z.enum(HOST_MODEL_AUTH_TYPES),
|
|
3452
3523
|
baseUrl: z.string().optional(),
|
|
3453
3524
|
settings: CustomModelSettingsSchema.optional(),
|
|
3454
3525
|
})
|
|
@@ -3855,7 +3926,7 @@ export const HostModelProviderInfoSchema = z
|
|
|
3855
3926
|
id: z.string(),
|
|
3856
3927
|
name: z.string(),
|
|
3857
3928
|
model: z.string(),
|
|
3858
|
-
authType: z.enum(
|
|
3929
|
+
authType: z.enum(HOST_MODEL_AUTH_TYPES),
|
|
3859
3930
|
baseUrl: z.string().optional(),
|
|
3860
3931
|
settings: CustomModelSettingsSchema.optional(),
|
|
3861
3932
|
/** What the provider's selected model reads (protocol 12); absent for a model unknown here. */
|