@nylorun/core 0.28.0-beta → 0.29.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.29.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 95f98f1: A model can use the Host's own identity (ADR-71, Host feature `model-host-identity`). `PUT /v1/tenant/model` takes `auth: { type: "host_identity", project, location }` for `google-vertex`. It keeps no secret, and the model gate calls Agent Platform with the Host's Google Application Default Credentials: on Google Cloud, the attached service account from the metadata server. It's off unless the operator lists the provider in `NYLORUN_MODEL_HOST_IDENTITY` on the process that runs the gates, which `nylorun start` passes from its shell to the `gateway` container. Every Tenant on that Host may use it. `nylorun tenant models set --provider google-vertex --model <id> --host-identity --project <id> --location <location>` sets it with no key.
8
+ - d99b3ac: A session can have its own model (optional Host feature `session-model`). `PUT /v1/sessions/{id}/model` chooses one of a connected provider's models for that session's turns, `DELETE` clears it, and `GET` answers the model the next turn uses (`source: "session"` or `"tenant"`). The Tenant's model and every other session's stay as they are. The Model Gate calls the session's model on its provider's credential (a refreshed OAuth credential is written back to that provider), `turn.start.model` describes it, and the usage ledger records it. A choice names a connected provider and a model its catalog lists, is set by the application only (a trusted issuer's token can read it, not change it), and is refused while a turn runs or waits (`409 session_busy`); while its provider is disconnected the session uses the Tenant's model. The SDK adds `session.model()`, `setModel({ provider, model })` and `clearModel()`.
9
+
10
+ Studio's model picker under the message box now sets the model of that session only, instead of the Tenant's: "Tenant model" clears the session's choice, the picker is locked while a turn runs, it groups models by provider, and its search keeps what is typed. A Runtime without `session-model` shows no picker.
11
+
3
12
  ## 0.28.0-beta
4
13
 
5
14
  ### Minor Changes
@@ -200,10 +200,16 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
200
200
  * `agent-folders`: `PUT /v1/agent-manifests/{name}` also takes an agent folder by hash
201
201
  * (`application/vnd.nylorun.folder+json`), compiles it with `@nylorun/core/folder` and keeps it
202
202
  * as the version's source, read at `GET .../versions/{v}/source` and `.../source/files/{path}`.
203
+ * `session-model`: `GET`, `PUT` and `DELETE /v1/sessions/{id}/model` read, choose and clear a
204
+ * session's own model, one of a connected provider's, which its turns use in place of the
205
+ * Tenant's; the Tenant's model does not change.
206
+ * `model-host-identity`: `PUT /v1/tenant/model` takes `auth: { type: "host_identity", project,
207
+ * location }` for `google-vertex`: the model gate calls Agent Platform with the Host's Google
208
+ * Application Default Credentials, when the Host's operator lends them (`NYLORUN_MODEL_HOST_IDENTITY`).
203
209
  */
204
210
  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",
205
211
  /** Opt-in artifact metadata pages (`GET /v1/artifacts?limit=…`). */
206
- "artifact-reads", "gateway-credentials", "agent-folders"];
212
+ "artifact-reads", "gateway-credentials", "agent-folders", "session-model", "model-host-identity"];
207
213
  export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
208
214
  export interface ProtocolRange {
209
215
  min: number;
@@ -202,6 +202,12 @@ export const PROTOCOL_FEATURES = [
202
202
  * `agent-folders`: `PUT /v1/agent-manifests/{name}` also takes an agent folder by hash
203
203
  * (`application/vnd.nylorun.folder+json`), compiles it with `@nylorun/core/folder` and keeps it
204
204
  * as the version's source, read at `GET .../versions/{v}/source` and `.../source/files/{path}`.
205
+ * `session-model`: `GET`, `PUT` and `DELETE /v1/sessions/{id}/model` read, choose and clear a
206
+ * session's own model, one of a connected provider's, which its turns use in place of the
207
+ * Tenant's; the Tenant's model does not change.
208
+ * `model-host-identity`: `PUT /v1/tenant/model` takes `auth: { type: "host_identity", project,
209
+ * location }` for `google-vertex`: the model gate calls Agent Platform with the Host's Google
210
+ * Application Default Credentials, when the Host's operator lends them (`NYLORUN_MODEL_HOST_IDENTITY`).
205
211
  */
206
212
  export const OPTIONAL_HOST_FEATURES = [
207
213
  "tenant-fixture-model",
@@ -223,6 +229,8 @@ export const OPTIONAL_HOST_FEATURES = [
223
229
  "artifact-reads",
224
230
  "gateway-credentials",
225
231
  "agent-folders",
232
+ "session-model",
233
+ "model-host-identity",
226
234
  ];
227
235
  /**
228
236
  * What this Host serves: protocol 16, 17 and 18. Protocol 16 replaced agent definitions and
@@ -3392,11 +3392,13 @@ export declare const CustomModelSettingsSchema: z.ZodObject<{
3392
3392
  }, z.core.$strict>;
3393
3393
  export type CustomModelSettings = z.infer<typeof CustomModelSettingsSchema>;
3394
3394
  /**
3395
- * How the Runtime authenticates to the model: a stored key, a stored OAuth grant, or (a custom
3395
+ * How the Runtime authenticates to the model: a stored key, a stored OAuth grant, (a custom
3396
3396
  * endpoint only) the Runtime's workload token, read from `NYLORUN_WORKLOAD_TOKEN_FILE` on every
3397
- * call and never stored (#496).
3397
+ * call and never stored (#496), or (`google-vertex` only, Host feature `model-host-identity`) the
3398
+ * Host's own identity: Google's Application Default Credentials, found at each call and never
3399
+ * stored, on a Host whose operator lends it with `NYLORUN_MODEL_HOST_IDENTITY` (ADR-71).
3398
3400
  */
3399
- export declare const HOST_MODEL_AUTH_TYPES: readonly ["api_key", "oauth", "workload"];
3401
+ export declare const HOST_MODEL_AUTH_TYPES: readonly ["api_key", "oauth", "workload", "host_identity"];
3400
3402
  export type HostModelAuthType = (typeof HOST_MODEL_AUTH_TYPES)[number];
3401
3403
  export declare const PutHostModelRequestSchema: z.ZodObject<{
3402
3404
  requestId: z.ZodString;
@@ -3438,6 +3440,10 @@ export declare const PutHostModelRequestSchema: z.ZodObject<{
3438
3440
  expires: z.ZodNumber;
3439
3441
  }, z.core.$loose>, z.ZodObject<{
3440
3442
  type: z.ZodLiteral<"workload">;
3443
+ }, z.core.$strict>, z.ZodObject<{
3444
+ type: z.ZodLiteral<"host_identity">;
3445
+ project: z.ZodString;
3446
+ location: z.ZodString;
3441
3447
  }, z.core.$strict>], "type">;
3442
3448
  }, z.core.$strict>;
3443
3449
  export type PutHostModelRequest = z.infer<typeof PutHostModelRequestSchema>;
@@ -5825,6 +5831,7 @@ export declare const HostModelViewSchema: z.ZodUnion<readonly [z.ZodObject<{
5825
5831
  model: z.ZodString;
5826
5832
  authType: z.ZodEnum<{
5827
5833
  api_key: "api_key";
5834
+ host_identity: "host_identity";
5828
5835
  oauth: "oauth";
5829
5836
  workload: "workload";
5830
5837
  }>;
@@ -5853,6 +5860,48 @@ export declare const HostModelViewSchema: z.ZodUnion<readonly [z.ZodObject<{
5853
5860
  }, z.core.$strict>], "from">>>;
5854
5861
  }, z.core.$strict>>;
5855
5862
  }, z.core.$strict>]>;
5863
+ /**
5864
+ * A session's own model (Host feature `session-model`): one of a connected provider's models,
5865
+ * used by the session's turns in place of the Tenant's model. Choosing one changes nothing else:
5866
+ * not the Tenant's model, nor another session's.
5867
+ */
5868
+ export declare const SessionModelChoiceSchema: z.ZodObject<{
5869
+ provider: z.ZodString;
5870
+ model: z.ZodString;
5871
+ }, z.core.$strict>;
5872
+ export type SessionModelChoice = z.infer<typeof SessionModelChoiceSchema>;
5873
+ /** `PUT /v1/sessions/{id}/model`: the model the session's next turns use. */
5874
+ export declare const PutSessionModelRequestSchema: z.ZodObject<{
5875
+ provider: z.ZodString;
5876
+ model: z.ZodString;
5877
+ }, z.core.$strict>;
5878
+ export type PutSessionModelRequest = z.infer<typeof PutSessionModelRequestSchema>;
5879
+ /**
5880
+ * The model a session's next turn uses: its own (`source: "session"`) while its provider is
5881
+ * connected, else the Tenant's (`source: "tenant"`). `choice` is what the session chose, kept
5882
+ * while its provider is disconnected.
5883
+ */
5884
+ export declare const SessionModelViewSchema: z.ZodUnion<readonly [z.ZodObject<{
5885
+ configured: z.ZodLiteral<false>;
5886
+ choice: z.ZodOptional<z.ZodObject<{
5887
+ provider: z.ZodString;
5888
+ model: z.ZodString;
5889
+ }, z.core.$strict>>;
5890
+ }, z.core.$strict>, z.ZodObject<{
5891
+ configured: z.ZodLiteral<true>;
5892
+ source: z.ZodEnum<{
5893
+ session: "session";
5894
+ tenant: "tenant";
5895
+ }>;
5896
+ provider: z.ZodString;
5897
+ model: z.ZodString;
5898
+ baseUrl: z.ZodOptional<z.ZodString>;
5899
+ choice: z.ZodOptional<z.ZodObject<{
5900
+ provider: z.ZodString;
5901
+ model: z.ZodString;
5902
+ }, z.core.$strict>>;
5903
+ }, z.core.$strict>]>;
5904
+ export type SessionModelView = z.infer<typeof SessionModelViewSchema>;
5856
5905
  export declare const TenantStatusSchema: z.ZodObject<{
5857
5906
  tenant: z.ZodObject<{
5858
5907
  id: z.ZodString;
@@ -5876,6 +5925,7 @@ export declare const TenantStatusSchema: z.ZodObject<{
5876
5925
  model: z.ZodString;
5877
5926
  authType: z.ZodEnum<{
5878
5927
  api_key: "api_key";
5928
+ host_identity: "host_identity";
5879
5929
  oauth: "oauth";
5880
5930
  workload: "workload";
5881
5931
  }>;
@@ -6027,6 +6077,10 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
6027
6077
  expires: z.ZodNumber;
6028
6078
  }, z.core.$loose>, z.ZodObject<{
6029
6079
  type: z.ZodLiteral<"workload">;
6080
+ }, z.core.$strict>, z.ZodObject<{
6081
+ type: z.ZodLiteral<"host_identity">;
6082
+ project: z.ZodString;
6083
+ location: z.ZodString;
6030
6084
  }, z.core.$strict>], "type">;
6031
6085
  }, z.core.$strict>>;
6032
6086
  fixtureModel: z.ZodOptional<z.ZodLiteral<true>>;
@@ -6523,6 +6577,7 @@ export declare const HostModelProviderInfoSchema: z.ZodObject<{
6523
6577
  model: z.ZodString;
6524
6578
  authType: z.ZodEnum<{
6525
6579
  api_key: "api_key";
6580
+ host_identity: "host_identity";
6526
6581
  oauth: "oauth";
6527
6582
  workload: "workload";
6528
6583
  }>;
@@ -6601,6 +6656,7 @@ export declare const ListProvidersResponseSchema: z.ZodObject<{
6601
6656
  model: z.ZodString;
6602
6657
  authType: z.ZodEnum<{
6603
6658
  api_key: "api_key";
6659
+ host_identity: "host_identity";
6604
6660
  oauth: "oauth";
6605
6661
  workload: "workload";
6606
6662
  }>;
package/dist/contracts.js CHANGED
@@ -2362,11 +2362,13 @@ export const CustomModelSettingsSchema = z
2362
2362
  })
2363
2363
  .strict();
2364
2364
  /**
2365
- * How the Runtime authenticates to the model: a stored key, a stored OAuth grant, or (a custom
2365
+ * How the Runtime authenticates to the model: a stored key, a stored OAuth grant, (a custom
2366
2366
  * endpoint only) the Runtime's workload token, read from `NYLORUN_WORKLOAD_TOKEN_FILE` on every
2367
- * call and never stored (#496).
2367
+ * call and never stored (#496), or (`google-vertex` only, Host feature `model-host-identity`) the
2368
+ * Host's own identity: Google's Application Default Credentials, found at each call and never
2369
+ * stored, on a Host whose operator lends it with `NYLORUN_MODEL_HOST_IDENTITY` (ADR-71).
2368
2370
  */
2369
- export const HOST_MODEL_AUTH_TYPES = ["api_key", "oauth", "workload"];
2371
+ export const HOST_MODEL_AUTH_TYPES = ["api_key", "oauth", "workload", "host_identity"];
2370
2372
  export const PutHostModelRequestSchema = z
2371
2373
  .object({
2372
2374
  ...vaultWriteBase,
@@ -2391,6 +2393,15 @@ export const PutHostModelRequestSchema = z
2391
2393
  })
2392
2394
  .passthrough(),
2393
2395
  z.object({ type: z.literal("workload") }).strict(),
2396
+ z
2397
+ .object({
2398
+ type: z.literal("host_identity"),
2399
+ /** The Google Cloud project the calls go to and bill. */
2400
+ project: z.string().regex(/^[a-z][a-z0-9-]{4,28}[a-z0-9]$/, "a Google Cloud project id"),
2401
+ /** Where they run: a region such as `us-central1`, or `global`. */
2402
+ location: z.string().regex(/^[a-z][a-z0-9-]*$/, "a Google Cloud location"),
2403
+ })
2404
+ .strict(),
2394
2405
  ]),
2395
2406
  })
2396
2407
  .strict();
@@ -3651,6 +3662,42 @@ export const HostModelViewSchema = z.union([
3651
3662
  })
3652
3663
  .strict(),
3653
3664
  ]);
3665
+ /**
3666
+ * A session's own model (Host feature `session-model`): one of a connected provider's models,
3667
+ * used by the session's turns in place of the Tenant's model. Choosing one changes nothing else:
3668
+ * not the Tenant's model, nor another session's.
3669
+ */
3670
+ export const SessionModelChoiceSchema = z
3671
+ .object({
3672
+ provider: z.string().min(1),
3673
+ model: z.string().min(1),
3674
+ })
3675
+ .strict();
3676
+ /** `PUT /v1/sessions/{id}/model`: the model the session's next turns use. */
3677
+ export const PutSessionModelRequestSchema = SessionModelChoiceSchema;
3678
+ /**
3679
+ * The model a session's next turn uses: its own (`source: "session"`) while its provider is
3680
+ * connected, else the Tenant's (`source: "tenant"`). `choice` is what the session chose, kept
3681
+ * while its provider is disconnected.
3682
+ */
3683
+ export const SessionModelViewSchema = z.union([
3684
+ z
3685
+ .object({
3686
+ configured: z.literal(false),
3687
+ choice: SessionModelChoiceSchema.optional(),
3688
+ })
3689
+ .strict(),
3690
+ z
3691
+ .object({
3692
+ configured: z.literal(true),
3693
+ source: z.enum(["session", "tenant"]),
3694
+ provider: z.string(),
3695
+ model: z.string(),
3696
+ baseUrl: z.string().optional(),
3697
+ choice: SessionModelChoiceSchema.optional(),
3698
+ })
3699
+ .strict(),
3700
+ ]);
3654
3701
  export const TenantStatusSchema = z
3655
3702
  .object({
3656
3703
  tenant: TenantEnvelopeSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.28.0-beta",
3
+ "version": "0.29.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",