@nylorun/core 0.15.0-beta → 0.16.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,22 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.16.0-beta
4
+
5
+ ### Major Changes
6
+
7
+ - cf5eb9c: **Protocol 9: the Runtime API is an OAuth 2.1 resource server for your identity provider's tokens.** Nylorun is still never the authorization server. Upgrade every package together; MIGRATION.md has the details.
8
+
9
+ - **Breaking (`@nylorun/runtime`): a refused credential is `401`, not the opaque `404`.** No `Authorization` is `401 credential_required`; an unknown key, or a token no trusted issuer signed or that fails a check, is `401 credential_invalid`. Each carries `WWW-Authenticate: Bearer` (OAuth 2.1 §5.3), naming the protected resource metadata (`resource_metadata`) on the Runtime API when the Runtime has trusted issuers; the Management API's challenge is a bare `Bearer`. `token_expired` and `issuer_unavailable` gain the challenge too. Another Tenant named, a Tenant that could not open and an unsigned capability link stay the opaque `404`.
10
+ - **Breaking (`@nylorun/runtime`): a request with neither `Nylorun-Protocol` nor `Authorization`** on an API route gets that route's `401` challenge instead of `426`, so a generic OAuth client learns where to sign in.
11
+ - `@nylorun/runtime`: a token without a route's scope still gets `403 scope_required`, now with `WWW-Authenticate: Bearer error="insufficient_scope", scope="…"`. The `Bearer` scheme is matched in any case (RFC 9110).
12
+ - `@nylorun/runtime`: `GET /.well-known/oauth-protected-resource` (RFC 9728) serves the resource (`NYLORUN_PUBLIC_URL`, else the request's origin), the identity file's issuers in order and their scopes, with no key or protocol; `404` without an identity file.
13
+ - **Breaking (`@nylorun/runtime`): the identity file drops `maxLifetime`.** The issuer sets its tokens' lifetimes; `exp` is required, `iat` no longer is. A key the file does not define, `maxLifetime` included, is ignored and logged (`identity_file_key_ignored`) instead of stopping the boot. `subject` defaults to `{sub}`, `scopes` to `{ claim: scope }` and `allowedScopes` to every token scope but `studio`.
14
+ - `@nylorun/core`: `PROTOCOL_VERSION` is 9 and `HOST_PROTOCOL` 4–9, with the required feature `resource-server`; `ERROR_CODES` adds `credential_required` and `credential_invalid`. `@nylorun/agents`, `@nylorun/admin` and `@nylorun/cli` send protocol 9.
15
+
16
+ ### Patch Changes
17
+
18
+ - 2ed5fe0: The event source `sandboxd` is now `sandboxes`, the name the sandbox lifecycle service took on 3 Oct, matching core, loop, gates, keys, egress and harness. Nothing emits it yet, so no stored event changes; the OpenAPI document's `EventSourceKind` enum shows the new name, and `--service sandboxes` is the blueprint service this release refuses as not yet shipped.
19
+
3
20
  ## 0.15.0-beta
4
21
 
5
22
  ### Major Changes
@@ -1,5 +1,10 @@
1
1
  export { hashManifest } from "./utils/hash.js";
2
2
  /**
3
+ * Protocol 9: the Runtime API is an OAuth 2.1 resource server (RFC 6750, RFC 9728). A missing
4
+ * or unknown credential is `401 credential_required` or `credential_invalid` with a
5
+ * `WWW-Authenticate: Bearer` challenge instead of the opaque 404, a token missing a scope gets
6
+ * `error="insufficient_scope"`, and `GET /.well-known/oauth-protected-resource` names the trusted
7
+ * issuers. Identity files lose `maxLifetime`: the issuer sets its tokens' lifetimes.
3
8
  * Protocol 8: the Runtime and Management APIs (`key_role_mismatch`), and manifest-only agents
4
9
  * (track R2): manifest v5 and workflow manifest v3, no hooks or flow functions, remote MCP
5
10
  * only, and no Action endpoints (`/v1/endpoints` and `/v1/actions/*` answer 404, delivery
@@ -13,7 +18,7 @@ export { hashManifest } from "./utils/hash.js";
13
18
  * it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
14
19
  * that remains; a client that requires `action-endpoints` is refused by the feature check.
15
20
  */
16
- export declare const PROTOCOL_VERSION = 8;
21
+ export declare const PROTOCOL_VERSION = 9;
17
22
  /** What a client of this protocol requires of a Host. */
18
23
  export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts",
19
24
  /**
@@ -21,7 +26,13 @@ export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts
21
26
  * Runtime API application keys only (`key_role_mismatch`); vaults and signing keys are under
22
27
  * `/v1/tenant`.
23
28
  */
24
- "management-api"];
29
+ "management-api",
30
+ /**
31
+ * Protocol 9: credential failures are `401` with a `WWW-Authenticate: Bearer` challenge
32
+ * (`credential_required`, `credential_invalid`), and the Runtime serves its protected resource
33
+ * metadata at `/.well-known/oauth-protected-resource` when it has trusted issuers.
34
+ */
35
+ "resource-server"];
25
36
  export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
26
37
  /**
27
38
  * Host features no client requires: a client that uses one checks the Host's `/health`
@@ -58,7 +69,7 @@ export interface ProtocolRange {
58
69
  * What this Host serves. `runtime-tenants` (protocol 4 clients require it) and `admin-status`
59
70
  * (protocol 5 to 7 clients require it) are still advertised for the compatibility window, so
60
71
  * those clients keep reaching the Runtime API; protocol 8 clients require neither. The Admin
61
- * API itself is gone (protocol 8): `/v1/admin/*` is the opaque 404. `artifacts` (protocol 6 and
72
+ * API itself is gone (protocol 8): `/v1/admin/*` is no route. `artifacts` (protocol 6 and
62
73
  * 7, required by their clients): file artifacts, capability links and message `parts`.
63
74
  */
64
75
  export declare const HOST_PROTOCOL: ProtocolRange;
@@ -77,7 +88,15 @@ export declare const SCOPES_HEADER = "Nylorun-Scopes";
77
88
  export declare const SESSION_ID_HEADER = "Nylorun-Session-Id";
78
89
  export declare const TURN_ID_HEADER = "Nylorun-Turn-Id";
79
90
  export declare const AGENT_ID_HEADER = "Nylorun-Agent-Id";
80
- export declare const ERROR_CODES: readonly ["not_found", "protocol_unsupported", "host_rejected", "origin_rejected", "unsupported_media_type", "connection_missing", "incompatible_host", "subject_invalid", "scope_required",
91
+ export declare const ERROR_CODES: readonly ["not_found",
92
+ /** No credential on a route that needs one (protocol 9): `401` with a `Bearer` challenge. */
93
+ "credential_required",
94
+ /**
95
+ * A key the Tenant does not know, or a token no trusted issuer signed or that fails its checks
96
+ * (protocol 9): `401` with `WWW-Authenticate: Bearer error="invalid_token"`. The reason is
97
+ * logged, never sent.
98
+ */
99
+ "credential_invalid", "protocol_unsupported", "host_rejected", "origin_rejected", "unsupported_media_type", "connection_missing", "incompatible_host", "subject_invalid", "scope_required",
81
100
  /**
82
101
  * A known key on the other API (protocol 8): an application key on the Management API
83
102
  * (`/v1/tenant/*`), or a management key on the Runtime API. The message names the key's API.
@@ -1,5 +1,10 @@
1
1
  export { hashManifest } from "./utils/hash.js";
2
2
  /**
3
+ * Protocol 9: the Runtime API is an OAuth 2.1 resource server (RFC 6750, RFC 9728). A missing
4
+ * or unknown credential is `401 credential_required` or `credential_invalid` with a
5
+ * `WWW-Authenticate: Bearer` challenge instead of the opaque 404, a token missing a scope gets
6
+ * `error="insufficient_scope"`, and `GET /.well-known/oauth-protected-resource` names the trusted
7
+ * issuers. Identity files lose `maxLifetime`: the issuer sets its tokens' lifetimes.
3
8
  * Protocol 8: the Runtime and Management APIs (`key_role_mismatch`), and manifest-only agents
4
9
  * (track R2): manifest v5 and workflow manifest v3, no hooks or flow functions, remote MCP
5
10
  * only, and no Action endpoints (`/v1/endpoints` and `/v1/actions/*` answer 404, delivery
@@ -13,7 +18,7 @@ export { hashManifest } from "./utils/hash.js";
13
18
  * it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
14
19
  * that remains; a client that requires `action-endpoints` is refused by the feature check.
15
20
  */
16
- export const PROTOCOL_VERSION = 8;
21
+ export const PROTOCOL_VERSION = 9;
17
22
  /** What a client of this protocol requires of a Host. */
18
23
  export const PROTOCOL_FEATURES = [
19
24
  "studio-principal",
@@ -24,6 +29,12 @@ export const PROTOCOL_FEATURES = [
24
29
  * `/v1/tenant`.
25
30
  */
26
31
  "management-api",
32
+ /**
33
+ * Protocol 9: credential failures are `401` with a `WWW-Authenticate: Bearer` challenge
34
+ * (`credential_required`, `credential_invalid`), and the Runtime serves its protected resource
35
+ * metadata at `/.well-known/oauth-protected-resource` when it has trusted issuers.
36
+ */
37
+ "resource-server",
27
38
  ];
28
39
  /**
29
40
  * Host features no client requires: a client that uses one checks the Host's `/health`
@@ -65,12 +76,12 @@ export const OPTIONAL_HOST_FEATURES = [
65
76
  * What this Host serves. `runtime-tenants` (protocol 4 clients require it) and `admin-status`
66
77
  * (protocol 5 to 7 clients require it) are still advertised for the compatibility window, so
67
78
  * those clients keep reaching the Runtime API; protocol 8 clients require neither. The Admin
68
- * API itself is gone (protocol 8): `/v1/admin/*` is the opaque 404. `artifacts` (protocol 6 and
79
+ * API itself is gone (protocol 8): `/v1/admin/*` is no route. `artifacts` (protocol 6 and
69
80
  * 7, required by their clients): file artifacts, capability links and message `parts`.
70
81
  */
71
82
  export const HOST_PROTOCOL = {
72
83
  min: 4,
73
- max: 8,
84
+ max: 9,
74
85
  features: ["runtime-tenants", "admin-status", ...PROTOCOL_FEATURES, ...OPTIONAL_HOST_FEATURES],
75
86
  };
76
87
  export const DEFINITION_SCHEMA_VERSION = 2;
@@ -90,6 +101,14 @@ export const TURN_ID_HEADER = "Nylorun-Turn-Id";
90
101
  export const AGENT_ID_HEADER = "Nylorun-Agent-Id";
91
102
  export const ERROR_CODES = [
92
103
  "not_found",
104
+ /** No credential on a route that needs one (protocol 9): `401` with a `Bearer` challenge. */
105
+ "credential_required",
106
+ /**
107
+ * A key the Tenant does not know, or a token no trusted issuer signed or that fails its checks
108
+ * (protocol 9): `401` with `WWW-Authenticate: Bearer error="invalid_token"`. The reason is
109
+ * logged, never sent.
110
+ */
111
+ "credential_invalid",
93
112
  "protocol_unsupported",
94
113
  "host_rejected",
95
114
  "origin_rejected",
@@ -748,7 +748,7 @@ export declare const EventSourceKindSchema: z.ZodEnum<{
748
748
  loop: "loop";
749
749
  "model-gate": "model-gate";
750
750
  operator: "operator";
751
- sandboxd: "sandboxd";
751
+ sandboxes: "sandboxes";
752
752
  supervisor: "supervisor";
753
753
  "tool-gate": "tool-gate";
754
754
  }>;
@@ -799,7 +799,7 @@ declare const eventEnvelope: {
799
799
  loop: "loop";
800
800
  "model-gate": "model-gate";
801
801
  operator: "operator";
802
- sandboxd: "sandboxd";
802
+ sandboxes: "sandboxes";
803
803
  supervisor: "supervisor";
804
804
  "tool-gate": "tool-gate";
805
805
  }>;
@@ -857,7 +857,7 @@ export declare const LiveEventSchema: z.ZodObject<{
857
857
  loop: "loop";
858
858
  "model-gate": "model-gate";
859
859
  operator: "operator";
860
- sandboxd: "sandboxd";
860
+ sandboxes: "sandboxes";
861
861
  supervisor: "supervisor";
862
862
  "tool-gate": "tool-gate";
863
863
  }>;
@@ -900,6 +900,8 @@ export declare const RejectedResponseSchema: z.ZodObject<{
900
900
  status: z.ZodLiteral<"rejected">;
901
901
  code: z.ZodEnum<{
902
902
  connection_missing: "connection_missing";
903
+ credential_invalid: "credential_invalid";
904
+ credential_required: "credential_required";
903
905
  definition_files_missing: "definition_files_missing";
904
906
  host_rejected: "host_rejected";
905
907
  incompatible_host: "incompatible_host";
@@ -2836,6 +2838,8 @@ export type StreamClosedFrame = z.infer<typeof StreamClosedFrameSchema>;
2836
2838
  */
2837
2839
  export declare const AgUiRunErrorCodeSchema: z.ZodEnum<{
2838
2840
  connection_missing: "connection_missing";
2841
+ credential_invalid: "credential_invalid";
2842
+ credential_required: "credential_required";
2839
2843
  definition_files_missing: "definition_files_missing";
2840
2844
  host_rejected: "host_rejected";
2841
2845
  incompatible_host: "incompatible_host";
package/dist/contracts.js CHANGED
@@ -1049,7 +1049,7 @@ export const EventSourceKindSchema = z.enum([
1049
1049
  "model-gate",
1050
1050
  "tool-gate",
1051
1051
  "egress-gate",
1052
- "sandboxd",
1052
+ "sandboxes",
1053
1053
  "edge",
1054
1054
  "init",
1055
1055
  "controller",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.15.0-beta",
3
+ "version": "0.16.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",