@nylorun/core 0.12.0-beta → 0.13.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 +45 -0
- package/dist/compatibility.d.ts +47 -37
- package/dist/compatibility.js +48 -52
- package/dist/contracts.d.ts +132 -228
- package/dist/contracts.js +147 -190
- package/package.json +1 -1
package/dist/contracts.js
CHANGED
|
@@ -555,14 +555,14 @@ export function isSandboxId(value) {
|
|
|
555
555
|
value.length <= SANDBOX_ID_MAX_LENGTH &&
|
|
556
556
|
SANDBOX_ID_PATTERN.test(value));
|
|
557
557
|
}
|
|
558
|
-
/**
|
|
558
|
+
/** A sandbox grant: an exact sandbox id, or a prefix ending in `/*` (`team-a/*`). */
|
|
559
559
|
export function isSandboxGrant(value) {
|
|
560
560
|
if (typeof value !== "string")
|
|
561
561
|
return false;
|
|
562
562
|
return value.endsWith("/*") ? isSandboxId(value.slice(0, -2)) : isSandboxId(value);
|
|
563
563
|
}
|
|
564
564
|
/**
|
|
565
|
-
* Whether `grants` (a
|
|
565
|
+
* Whether `grants` (a token caller's sandbox grants) reach sandbox `id`: an exact entry, or a prefix
|
|
566
566
|
* entry `p/*` for any id below `p/`. No grants reach no sandbox.
|
|
567
567
|
*/
|
|
568
568
|
export function sandboxGranted(grants, id) {
|
|
@@ -864,14 +864,33 @@ const oauthRefreshSchema = z
|
|
|
864
864
|
tokenEndpointAuth: tokenEndpointAuthSchema,
|
|
865
865
|
})
|
|
866
866
|
.strict();
|
|
867
|
+
/** The owner of every installation vault (`scope: "installation"`); a reserved subject. */
|
|
868
|
+
export const INSTALLATION_OWNER = "installation";
|
|
867
869
|
export const CreateVaultRequestSchema = z
|
|
868
870
|
.object({
|
|
869
871
|
...vaultWriteBase,
|
|
870
872
|
name: z.string().min(1),
|
|
871
|
-
|
|
873
|
+
/**
|
|
874
|
+
* `user` (the default): one person's vault, owned by `ownerUserId`. `installation`: the
|
|
875
|
+
* installation's own vault, owned by `installation`, which any session may attach;
|
|
876
|
+
* application keys only.
|
|
877
|
+
*/
|
|
878
|
+
scope: z.enum(["user", "installation"]).optional(),
|
|
879
|
+
/** Required for a `user` vault; absent (or `installation`) for an installation vault. */
|
|
880
|
+
ownerUserId: z.string().min(1).optional(),
|
|
872
881
|
metadata: z.record(z.string(), z.string()).optional(),
|
|
873
882
|
})
|
|
874
|
-
.strict()
|
|
883
|
+
.strict()
|
|
884
|
+
.superRefine((value, ctx) => {
|
|
885
|
+
if ((value.scope ?? "user") === "user") {
|
|
886
|
+
if (value.ownerUserId === undefined)
|
|
887
|
+
ctx.addIssue({ code: "custom", path: ["ownerUserId"], message: "ownerUserId is required for a user vault" });
|
|
888
|
+
else if (value.ownerUserId === INSTALLATION_OWNER)
|
|
889
|
+
ctx.addIssue({ code: "custom", path: ["ownerUserId"], message: "installation is reserved for installation vaults" });
|
|
890
|
+
}
|
|
891
|
+
else if (value.ownerUserId !== undefined && value.ownerUserId !== INSTALLATION_OWNER)
|
|
892
|
+
ctx.addIssue({ code: "custom", path: ["ownerUserId"], message: "An installation vault is owned by installation" });
|
|
893
|
+
});
|
|
875
894
|
export const CreateCredentialRequestSchema = z
|
|
876
895
|
.object({
|
|
877
896
|
...vaultWriteBase,
|
|
@@ -1855,6 +1874,31 @@ export const AdminStatusSchema = z
|
|
|
1855
1874
|
.optional(),
|
|
1856
1875
|
})
|
|
1857
1876
|
.strict();
|
|
1877
|
+
/**
|
|
1878
|
+
* An operator key (Host feature `operator-keys`): a revocable application key of the Tenant,
|
|
1879
|
+
* named by its id (`APPLICATION_KEY_ID_PATTERN`). The Runtime keeps only its hash.
|
|
1880
|
+
*/
|
|
1881
|
+
export const OperatorKeySchema = z
|
|
1882
|
+
.object({
|
|
1883
|
+
id: z.string().min(1),
|
|
1884
|
+
role: z.string().min(1),
|
|
1885
|
+
/** When the current key was issued: created, or last rotated. */
|
|
1886
|
+
createdAt: z.string().min(1),
|
|
1887
|
+
})
|
|
1888
|
+
.strict();
|
|
1889
|
+
/** `GET /v1/admin/keys`: every key of the Tenant (Studio's and derived ones too), by id. */
|
|
1890
|
+
export const ListOperatorKeysResponseSchema = z
|
|
1891
|
+
.object({ keys: z.array(OperatorKeySchema) })
|
|
1892
|
+
.strict();
|
|
1893
|
+
/** `PUT /v1/admin/keys/{id}`: the new key, shown this once; `rotated` when it replaced one. */
|
|
1894
|
+
export const PutOperatorKeyResponseSchema = OperatorKeySchema.extend({
|
|
1895
|
+
key: z.string().regex(/^[0-9a-f]{64}$/),
|
|
1896
|
+
rotated: z.boolean(),
|
|
1897
|
+
}).strict();
|
|
1898
|
+
/** `DELETE /v1/admin/keys/{id}`: the key no longer authenticates. */
|
|
1899
|
+
export const DeleteOperatorKeyResponseSchema = z
|
|
1900
|
+
.object({ id: z.string().min(1), deleted: z.literal(true) })
|
|
1901
|
+
.strict();
|
|
1858
1902
|
/**
|
|
1859
1903
|
* `.nylorun/link.json`: the installation a Project uses. Format 3 names the local `tenant`
|
|
1860
1904
|
* that `nylorun start` created or attached; `tenantId` is information only, since nothing in a
|
|
@@ -2016,22 +2060,30 @@ export const ResetTenantRequestSchema = z
|
|
|
2016
2060
|
.strict();
|
|
2017
2061
|
/**
|
|
2018
2062
|
* Acting for a subject (Host feature `subject-headers`): what an application principal may
|
|
2019
|
-
* narrow a request to. `sessions:own`
|
|
2020
|
-
*
|
|
2021
|
-
*
|
|
2063
|
+
* narrow a request to. `sessions:own` reaches only the subject's own sessions; the others reach
|
|
2064
|
+
* Tenant-wide resources. `sandboxes:write` creates and deletes sandboxes (Host feature
|
|
2065
|
+
* `sandboxes`); a token caller's reach only the ids its sandbox grants name. Vaults are the
|
|
2066
|
+
* installation's, managed by application keys acting for no one (protocol 7).
|
|
2022
2067
|
*/
|
|
2023
2068
|
export const SUBJECT_SCOPES = [
|
|
2024
2069
|
"agents:read",
|
|
2025
2070
|
"agents:write",
|
|
2026
2071
|
"sessions:own",
|
|
2027
|
-
"vaults:own",
|
|
2028
2072
|
"tenant:settings",
|
|
2029
2073
|
"sandboxes:write",
|
|
2030
2074
|
];
|
|
2075
|
+
/**
|
|
2076
|
+
* Scopes protocol 7 retired: `Nylorun-Scopes` may still name them (protocol 6 clients do), and
|
|
2077
|
+
* they grant nothing.
|
|
2078
|
+
*/
|
|
2079
|
+
const RETIRED_SUBJECT_SCOPES = ["vaults:own"];
|
|
2031
2080
|
/** 1–200 visible ASCII characters; spaces only inside. */
|
|
2032
2081
|
const SUBJECT_PATTERN = /^[\x21-\x7e](?:[\x20-\x7e]{0,198}[\x21-\x7e])?$/;
|
|
2033
|
-
/**
|
|
2034
|
-
|
|
2082
|
+
/**
|
|
2083
|
+
* Owner ids the Runtime uses itself: the host model's vault is owned by `host`, installation
|
|
2084
|
+
* vaults by `installation`.
|
|
2085
|
+
*/
|
|
2086
|
+
const RESERVED_SUBJECTS = new Set(["host", INSTALLATION_OWNER]);
|
|
2035
2087
|
/** A valid subject: 1–200 visible ASCII characters, not reserved by the Runtime. */
|
|
2036
2088
|
export function isSubject(value) {
|
|
2037
2089
|
return (typeof value === "string" &&
|
|
@@ -2050,12 +2102,13 @@ export function parseSubjectHeaders(subject, scopes) {
|
|
|
2050
2102
|
};
|
|
2051
2103
|
if (RESERVED_SUBJECTS.has(subject))
|
|
2052
2104
|
return { ok: false, message: `Subject ${subject} is reserved` };
|
|
2053
|
-
const
|
|
2054
|
-
if (
|
|
2105
|
+
const named = (scopes ?? "").split(" ").filter(Boolean);
|
|
2106
|
+
if (named.length === 0)
|
|
2055
2107
|
return {
|
|
2056
2108
|
ok: false,
|
|
2057
2109
|
message: "Nylorun-Scopes is required with Nylorun-Subject",
|
|
2058
2110
|
};
|
|
2111
|
+
const names = named.filter((name) => !RETIRED_SUBJECT_SCOPES.includes(name));
|
|
2059
2112
|
const unknown = names.filter((name) => !SUBJECT_SCOPES.includes(name));
|
|
2060
2113
|
if (unknown.length > 0)
|
|
2061
2114
|
return { ok: false, message: `Unknown scope ${unknown.join(", ")}` };
|
|
@@ -2065,127 +2118,35 @@ export function parseSubjectHeaders(subject, scopes) {
|
|
|
2065
2118
|
scopes: new Set(names),
|
|
2066
2119
|
};
|
|
2067
2120
|
}
|
|
2068
|
-
// ---
|
|
2069
|
-
/**
|
|
2121
|
+
// --- token callers (Host feature `trusted-issuers`) ------------------------------------------
|
|
2122
|
+
/**
|
|
2123
|
+
* Scopes a token caller (a trusted issuer's token) may carry: never `agents:write` or
|
|
2124
|
+
* `tenant:settings`.
|
|
2125
|
+
*/
|
|
2070
2126
|
export const TOKEN_SCOPES = [
|
|
2071
2127
|
"agents:read",
|
|
2072
2128
|
"sessions:own",
|
|
2073
|
-
"vaults:own",
|
|
2074
2129
|
"sandboxes:write",
|
|
2075
2130
|
];
|
|
2076
|
-
/** The most
|
|
2131
|
+
/** The most sandbox grants one token caller carries. */
|
|
2077
2132
|
export const TOKEN_SANDBOX_GRANTS_MAX = 16;
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2133
|
+
/**
|
|
2134
|
+
* The longest a token the Runtime signs itself lives, in seconds (delivery tokens, capability
|
|
2135
|
+
* links): rotating signing keys revokes the previous key once the longest token it may have
|
|
2136
|
+
* signed has expired.
|
|
2137
|
+
*/
|
|
2138
|
+
export const TOKEN_TTL_MAX_SECONDS = 900;
|
|
2139
|
+
/**
|
|
2140
|
+
* The `iss` of every token a Tenant's Runtime signs itself: delivery tokens, capability links,
|
|
2141
|
+
* run, host and egress tokens.
|
|
2142
|
+
*/
|
|
2143
|
+
export function tenantTokenIssuer(tenantId) {
|
|
2085
2144
|
return `urn:nylorun:tenant:${tenantId}`;
|
|
2086
2145
|
}
|
|
2087
|
-
/** Token lifetimes, in seconds. */
|
|
2088
|
-
export const TOKEN_TTL_MIN_SECONDS = 60;
|
|
2089
|
-
export const TOKEN_TTL_MAX_SECONDS = 900;
|
|
2090
|
-
export const TOKEN_TTL_DEFAULT_SECONDS = 600;
|
|
2091
|
-
/** A role's name in the access policy; `anon` is reserved for publishable keys. */
|
|
2092
|
-
export const ROLE_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,31}$/;
|
|
2093
2146
|
const AgentAllowlistSchema = z.union([
|
|
2094
2147
|
z.literal("*"),
|
|
2095
2148
|
z.array(z.string().min(1)),
|
|
2096
2149
|
]);
|
|
2097
|
-
export const RoleLimitsSchema = z
|
|
2098
|
-
.object({
|
|
2099
|
-
turnsPerHour: z.number().int().min(1).max(100_000).optional(),
|
|
2100
|
-
concurrentTurns: z.number().int().min(1).max(1000).optional(),
|
|
2101
|
-
})
|
|
2102
|
-
.strict();
|
|
2103
|
-
export const AccessRoleSchema = z
|
|
2104
|
-
.object({
|
|
2105
|
-
scopes: z.array(TokenScopeSchema).min(1),
|
|
2106
|
-
agents: AgentAllowlistSchema,
|
|
2107
|
-
limits: RoleLimitsSchema.optional(),
|
|
2108
|
-
})
|
|
2109
|
-
.strict();
|
|
2110
|
-
/**
|
|
2111
|
-
* The Tenant's access policy: what each role may do with a subject token, what a publishable
|
|
2112
|
-
* key grants alone (`anon`), and how long tokens live. Without roles nothing can be minted.
|
|
2113
|
-
*/
|
|
2114
|
-
export const AccessPolicySchema = z
|
|
2115
|
-
.object({
|
|
2116
|
-
version: z.literal(1),
|
|
2117
|
-
roles: z
|
|
2118
|
-
.record(z.string(), AccessRoleSchema)
|
|
2119
|
-
.superRefine((roles, issue) => {
|
|
2120
|
-
for (const name of Object.keys(roles))
|
|
2121
|
-
if (!ROLE_NAME_PATTERN.test(name) || name === "anon")
|
|
2122
|
-
issue.addIssue({
|
|
2123
|
-
code: "custom",
|
|
2124
|
-
message: `Role name ${name} is invalid or reserved`,
|
|
2125
|
-
path: [name],
|
|
2126
|
-
});
|
|
2127
|
-
}),
|
|
2128
|
-
anon: z
|
|
2129
|
-
.object({
|
|
2130
|
-
scopes: z.array(z.literal("agents:read")),
|
|
2131
|
-
agents: AgentAllowlistSchema,
|
|
2132
|
-
})
|
|
2133
|
-
.strict(),
|
|
2134
|
-
tokens: z
|
|
2135
|
-
.object({
|
|
2136
|
-
maxTtlSeconds: z
|
|
2137
|
-
.number()
|
|
2138
|
-
.int()
|
|
2139
|
-
.min(TOKEN_TTL_MIN_SECONDS)
|
|
2140
|
-
.max(TOKEN_TTL_MAX_SECONDS),
|
|
2141
|
-
})
|
|
2142
|
-
.strict(),
|
|
2143
|
-
})
|
|
2144
|
-
.strict();
|
|
2145
|
-
/** The policy of a Tenant that never set one: no roles, nothing for `anon`. */
|
|
2146
|
-
export const DEFAULT_ACCESS_POLICY = Object.freeze({
|
|
2147
|
-
version: 1,
|
|
2148
|
-
roles: {},
|
|
2149
|
-
anon: { scopes: [], agents: [] },
|
|
2150
|
-
tokens: { maxTtlSeconds: TOKEN_TTL_DEFAULT_SECONDS },
|
|
2151
|
-
});
|
|
2152
|
-
export const PutAccessPolicyRequestSchema = z
|
|
2153
|
-
.object({ requestId: RequestIdSchema, policy: AccessPolicySchema })
|
|
2154
|
-
.strict();
|
|
2155
|
-
export const CreateTokenRequestSchema = z
|
|
2156
|
-
.object({
|
|
2157
|
-
requestId: RequestIdSchema,
|
|
2158
|
-
subject: z.string().refine(isSubject, "subject must be 1-200 visible ASCII characters and not reserved"),
|
|
2159
|
-
role: z.string().regex(ROLE_NAME_PATTERN),
|
|
2160
|
-
scopes: z.array(TokenScopeSchema).min(1).optional(),
|
|
2161
|
-
agents: z.array(z.string().min(1)).optional(),
|
|
2162
|
-
/**
|
|
2163
|
-
* The sandboxes the token reaches (its `sbx` claim): exact ids, or prefixes ending in `/*`.
|
|
2164
|
-
* Absent or empty: none (Host feature `sandboxes`).
|
|
2165
|
-
*/
|
|
2166
|
-
sandboxes: z.array(SandboxGrantSchema).max(TOKEN_SANDBOX_GRANTS_MAX).optional(),
|
|
2167
|
-
ttlSeconds: z
|
|
2168
|
-
.number()
|
|
2169
|
-
.int()
|
|
2170
|
-
.min(TOKEN_TTL_MIN_SECONDS)
|
|
2171
|
-
.max(TOKEN_TTL_MAX_SECONDS)
|
|
2172
|
-
.optional(),
|
|
2173
|
-
})
|
|
2174
|
-
.strict();
|
|
2175
|
-
export const CreateTokenResponseSchema = z
|
|
2176
|
-
.object({
|
|
2177
|
-
token: z.string().min(1),
|
|
2178
|
-
/** ISO time the token stops being accepted. */
|
|
2179
|
-
expiresAt: z.string().min(1),
|
|
2180
|
-
subject: z.string(),
|
|
2181
|
-
role: z.string(),
|
|
2182
|
-
scopes: z.array(TokenScopeSchema),
|
|
2183
|
-
agents: AgentAllowlistSchema,
|
|
2184
|
-
/** The token's `sbx` grants, when it has any. */
|
|
2185
|
-
sandboxes: z.array(z.string()).optional(),
|
|
2186
|
-
keyId: z.string(),
|
|
2187
|
-
})
|
|
2188
|
-
.strict();
|
|
2189
2150
|
export const SIGNING_KEY_STATES = ["standby", "current", "previous", "revoked"];
|
|
2190
2151
|
/** A public JSON Web Key as the JWKS publishes it. */
|
|
2191
2152
|
export const PublicJwkSchema = z
|
|
@@ -2221,18 +2182,47 @@ export const RotateSigningKeysRequestSchema = z
|
|
|
2221
2182
|
export const RevokeSigningKeyRequestSchema = z
|
|
2222
2183
|
.object({ requestId: RequestIdSchema })
|
|
2223
2184
|
.strict();
|
|
2224
|
-
|
|
2185
|
+
// --- trusted issuers (Host feature `trusted-issuers`) --------------------------------------
|
|
2186
|
+
/**
|
|
2187
|
+
* Scopes a trusted issuer's tokens may carry (`allowedScopes` in the identity file): the
|
|
2188
|
+
* token scopes, and `studio`, an operator scope no Runtime route requires (Studio
|
|
2189
|
+
* admits a person who holds it, Tenant-wide).
|
|
2190
|
+
*/
|
|
2191
|
+
export const ISSUER_SCOPES = [...TOKEN_SCOPES, "studio"];
|
|
2192
|
+
/** Every scope a caller can hold: the subject scopes, and an issuer token's `studio`. */
|
|
2193
|
+
export const CALLER_SCOPES = [...SUBJECT_SCOPES, "studio"];
|
|
2194
|
+
/**
|
|
2195
|
+
* `GET /v1/me`: who the Runtime takes the caller to be, for any credential.
|
|
2196
|
+
*
|
|
2197
|
+
* - `via` is how the caller authenticated: `application:<principalId>` (an application key,
|
|
2198
|
+
* acting as itself), `subject` (an application key acting for `Nylorun-Subject`) or
|
|
2199
|
+
* `issuer:<name>` (a token from the identity file's issuer `name`).
|
|
2200
|
+
* - `subject` is the person the request acts for; absent for an application key alone.
|
|
2201
|
+
* - `scopes`: what the caller holds. An application key alone holds every subject scope.
|
|
2202
|
+
* - `agents`: the agents it may reach, `*` for all.
|
|
2203
|
+
* - `sandboxes`: the sandbox grants of a token caller (empty reaches none); absent for an
|
|
2204
|
+
* application key, alone or acting for a subject, which no grant limits.
|
|
2205
|
+
*/
|
|
2206
|
+
export const MeResponseSchema = z
|
|
2225
2207
|
.object({
|
|
2226
|
-
|
|
2227
|
-
|
|
2208
|
+
subject: z
|
|
2209
|
+
.string()
|
|
2210
|
+
.optional()
|
|
2211
|
+
.meta({ description: "The person the request acts for; absent for an application key alone" }),
|
|
2212
|
+
scopes: z.array(z.enum(CALLER_SCOPES)),
|
|
2213
|
+
agents: AgentAllowlistSchema,
|
|
2214
|
+
sandboxes: z
|
|
2215
|
+
.array(z.string())
|
|
2216
|
+
.optional()
|
|
2217
|
+
.meta({
|
|
2218
|
+
description: "A token caller's sandbox grants (empty reaches none); absent when no grant limits the caller",
|
|
2219
|
+
}),
|
|
2220
|
+
via: z.string().meta({
|
|
2221
|
+
description: "How the caller authenticated: `application:<principalId>`, `subject` or `issuer:<name>`",
|
|
2222
|
+
}),
|
|
2228
2223
|
})
|
|
2229
2224
|
.strict();
|
|
2230
|
-
|
|
2231
|
-
.object({ subject: z.string(), epoch: z.number().int().nonnegative() })
|
|
2232
|
-
.strict();
|
|
2233
|
-
// --- publishable keys (Host feature `browser-access`) --------------------------------------
|
|
2234
|
-
/** Loopback origins with any port, for development: `http://localhost:*`, `http://127.0.0.1:*`. */
|
|
2235
|
-
export const LOOPBACK_ORIGIN_WILDCARDS = ["http://localhost:*", "http://127.0.0.1:*"];
|
|
2225
|
+
// --- origins ---------------------------------------------------------------------------------
|
|
2236
2226
|
/** True for a serialized web origin: `scheme://host[:port]`, lowercase, no path. */
|
|
2237
2227
|
export function isSerializedOrigin(value) {
|
|
2238
2228
|
let url;
|
|
@@ -2247,50 +2237,6 @@ export function isSerializedOrigin(value) {
|
|
|
2247
2237
|
// Host names only: no wildcards or other characters URL parsing lets through.
|
|
2248
2238
|
/^(?:[a-z0-9-]+(?:\.[a-z0-9-]+)*|\[[0-9a-f:.]+\])$/.test(url.hostname));
|
|
2249
2239
|
}
|
|
2250
|
-
/** An origin allowlist entry: an exact origin or a loopback wildcard. */
|
|
2251
|
-
export const OriginEntrySchema = z
|
|
2252
|
-
.string()
|
|
2253
|
-
.refine((value) => LOOPBACK_ORIGIN_WILDCARDS.includes(value) ||
|
|
2254
|
-
isSerializedOrigin(value), "must be an origin such as https://app.example.com, or http://localhost:*");
|
|
2255
|
-
/** True when `origin` (a request's `Origin`) is allowed by `origins`. */
|
|
2256
|
-
export function originAllowed(origins, origin) {
|
|
2257
|
-
if (!isSerializedOrigin(origin))
|
|
2258
|
-
return false;
|
|
2259
|
-
for (const entry of origins) {
|
|
2260
|
-
if (entry === origin)
|
|
2261
|
-
return true;
|
|
2262
|
-
if (entry.endsWith(":*")) {
|
|
2263
|
-
const prefix = entry.slice(0, -1);
|
|
2264
|
-
if (origin.startsWith(prefix) && /^\d{1,5}$/.test(origin.slice(prefix.length)))
|
|
2265
|
-
return true;
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
return false;
|
|
2269
|
-
}
|
|
2270
|
-
export const PublishableKeySchema = z
|
|
2271
|
-
.object({
|
|
2272
|
-
id: z.string(),
|
|
2273
|
-
name: z.string(),
|
|
2274
|
-
key: z.string(),
|
|
2275
|
-
origins: z.array(z.string()),
|
|
2276
|
-
createdAt: z.string(),
|
|
2277
|
-
revokedAt: z.string().nullable(),
|
|
2278
|
-
})
|
|
2279
|
-
.strict();
|
|
2280
|
-
export const CreatePublishableKeyRequestSchema = z
|
|
2281
|
-
.object({
|
|
2282
|
-
requestId: RequestIdSchema,
|
|
2283
|
-
name: z.string().min(1).max(100),
|
|
2284
|
-
/** `[]` allows native apps only (no `Origin`). */
|
|
2285
|
-
origins: z.array(OriginEntrySchema).max(100),
|
|
2286
|
-
})
|
|
2287
|
-
.strict();
|
|
2288
|
-
export const UpdatePublishableKeyRequestSchema = z
|
|
2289
|
-
.object({
|
|
2290
|
-
requestId: RequestIdSchema,
|
|
2291
|
-
origins: z.array(OriginEntrySchema).max(100),
|
|
2292
|
-
})
|
|
2293
|
-
.strict();
|
|
2294
2240
|
// Successful answers of the Tenant and Admin APIs that had no schema of their own. With the
|
|
2295
2241
|
// request schemas above they describe every body the Runtime sends (its OpenAPI document).
|
|
2296
2242
|
/** `GET /v1/agents` with an application key: every definition, manifest included. */
|
|
@@ -2305,7 +2251,7 @@ export const AgentDefinitionViewSchema = z
|
|
|
2305
2251
|
export const ListAgentsResponseSchema = z
|
|
2306
2252
|
.object({ agents: z.array(AgentDefinitionViewSchema) })
|
|
2307
2253
|
.strict();
|
|
2308
|
-
/** `GET /v1/agents` with a
|
|
2254
|
+
/** `GET /v1/agents` with a token caller's credential: the allowed agents' names only. */
|
|
2309
2255
|
export const PublicAgentSchema = z
|
|
2310
2256
|
.object({
|
|
2311
2257
|
agentId: z.string(),
|
|
@@ -2559,18 +2505,34 @@ export const ListVaultsResponseSchema = z.object({ vaults: z.array(VaultInfoSche
|
|
|
2559
2505
|
export const ListCredentialsResponseSchema = z
|
|
2560
2506
|
.object({ credentials: z.array(CredentialInfoSchema) })
|
|
2561
2507
|
.strict();
|
|
2508
|
+
/**
|
|
2509
|
+
* `POST /v1/vaults/{vaultId}/oauth/start` (F9 C2): sign the installation in to the remote MCP
|
|
2510
|
+
* server at `url`, declared as `server`, and store its OAuth credential in the installation vault.
|
|
2511
|
+
* `clientId` names a client registered with the authorization server; without one the Runtime
|
|
2512
|
+
* registers itself (RFC 7591) when the server allows it.
|
|
2513
|
+
*/
|
|
2514
|
+
export const StartOAuthRequestSchema = z
|
|
2515
|
+
.object({
|
|
2516
|
+
url: z.string().min(1).max(2048),
|
|
2517
|
+
server: z.string().min(1).max(128),
|
|
2518
|
+
clientId: z.string().min(1).max(512).optional(),
|
|
2519
|
+
})
|
|
2520
|
+
.strict();
|
|
2521
|
+
/** Where to send the browser, and until when the sign-in can finish. */
|
|
2522
|
+
export const StartOAuthResponseSchema = z
|
|
2523
|
+
.object({ authorizeUrl: z.string(), expiresAt: z.string() })
|
|
2524
|
+
.strict();
|
|
2562
2525
|
/** A deleted vault or credential. */
|
|
2563
2526
|
export const DeletedResponseSchema = z.object({ id: z.string() }).strict();
|
|
2564
|
-
export const AccessPolicyResponseSchema = z.object({ policy: AccessPolicySchema }).strict();
|
|
2565
|
-
export const ListPublishableKeysResponseSchema = z
|
|
2566
|
-
.object({ keys: z.array(PublishableKeySchema) })
|
|
2567
|
-
.strict();
|
|
2568
2527
|
export const HostShutdownResponseSchema = z
|
|
2569
2528
|
.object({ status: z.literal("shutting_down") })
|
|
2570
2529
|
.strict();
|
|
2571
|
-
/**
|
|
2530
|
+
/**
|
|
2531
|
+
* The last frame of a session stream the Runtime ends: `event: nylorun.closed`, when the
|
|
2532
|
+
* token caller's token expires.
|
|
2533
|
+
*/
|
|
2572
2534
|
export const StreamClosedFrameSchema = z
|
|
2573
|
-
.object({ reason: z.enum(["token_expired"
|
|
2535
|
+
.object({ reason: z.enum(["token_expired"]) })
|
|
2574
2536
|
.strict();
|
|
2575
2537
|
/**
|
|
2576
2538
|
* The `code` of an AG-UI `RUN_ERROR` the Runtime sends: a rejection's code, or `session_busy`
|
|
@@ -2584,10 +2546,7 @@ export const AgUiRunErrorCodeSchema = z.enum([
|
|
|
2584
2546
|
// --- Action endpoints: the Runtime delivers Actions over HTTP ------------------------------
|
|
2585
2547
|
/** The JWT `typ` of a delivery token (RFC 8725 explicit typing). */
|
|
2586
2548
|
export const DELIVERY_TOKEN_TYPE = "nylorun-delivery+jwt";
|
|
2587
|
-
/**
|
|
2588
|
-
* A delivery token lives no longer than a subject token: rotating signing keys revokes the
|
|
2589
|
-
* previous key once the longest token it may have signed has expired.
|
|
2590
|
-
*/
|
|
2549
|
+
/** A delivery token lives no longer than any token the Runtime signs (`TOKEN_TTL_MAX_SECONDS`). */
|
|
2591
2550
|
export const DELIVERY_TOKEN_MAX_TTL_SECONDS = TOKEN_TTL_MAX_SECONDS;
|
|
2592
2551
|
/** Inline delivery timeouts, in milliseconds. The maximum keeps a token within its lifetime. */
|
|
2593
2552
|
export const ENDPOINT_TIMEOUT_DEFAULT_MS = 60_000;
|
|
@@ -2788,7 +2747,8 @@ export const StudioEmbedMessageSchema = z.discriminatedUnion("kind", [
|
|
|
2788
2747
|
embed("token.expiring", { expiresAt: z.string().nullable() }),
|
|
2789
2748
|
embed("route.changed", { route: z.string() }),
|
|
2790
2749
|
embed("open.external", { url: EXTERNAL_URL }),
|
|
2791
|
-
|
|
2750
|
+
/** Asks the embedding app to open this session in its own UI. */
|
|
2751
|
+
embed("open.session", { sessionId: z.string().min(1) }),
|
|
2792
2752
|
embed("error", { code: z.string().min(1), message: z.string() }),
|
|
2793
2753
|
]);
|
|
2794
2754
|
/** Schemes that never name an embedder. */
|
|
@@ -2828,10 +2788,7 @@ export function parseFrameAncestors(value) {
|
|
|
2828
2788
|
// --- File artifacts (protocol 6, blueprint D35, F8.1) ----------------------------------------
|
|
2829
2789
|
/** The JWT `typ` of a capability link's token (RFC 8725 explicit typing). */
|
|
2830
2790
|
export const ARTIFACT_LINK_TOKEN_TYPE = "nylorun-artifact+jwt";
|
|
2831
|
-
/**
|
|
2832
|
-
* A capability link lives no longer than a subject token: rotating signing keys revokes the
|
|
2833
|
-
* previous key once the longest token it may have signed has expired.
|
|
2834
|
-
*/
|
|
2791
|
+
/** A capability link lives no longer than any token the Runtime signs (`TOKEN_TTL_MAX_SECONDS`). */
|
|
2835
2792
|
export const ARTIFACT_LINK_MAX_TTL_SECONDS = TOKEN_TTL_MAX_SECONDS;
|
|
2836
2793
|
export const ARTIFACT_LINK_DEFAULT_TTL_SECONDS = 300;
|
|
2837
2794
|
/** A Tenant's limits when it sets none: 100 MiB per file, 10 GiB in all. */
|