@nylorun/core 0.12.0-beta → 0.15.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 +159 -0
- package/dist/compatibility.d.ts +84 -50
- package/dist/compatibility.js +84 -67
- package/dist/contracts.d.ts +462 -1196
- package/dist/contracts.js +403 -681
- package/dist/define.d.ts +13 -10
- package/dist/define.js +7 -4
- package/dist/definition/assemble.d.ts +0 -3
- package/dist/definition/assemble.js +13 -19
- package/dist/definition/bind-agent.js +0 -2
- package/dist/definition/bind-tool.js +0 -1
- package/dist/definition/bound.d.ts +3 -10
- package/dist/definition/builder.d.ts +19 -55
- package/dist/definition/builder.js +19 -130
- package/dist/definition/capability.d.ts +3 -15
- package/dist/definition/capability.js +3 -25
- package/dist/definition/code-tools.d.ts +22 -0
- package/dist/definition/code-tools.js +46 -0
- package/dist/definition/declaration.d.ts +0 -3
- package/dist/definition/declaration.js +8 -11
- package/dist/definition/delegate.d.ts +7 -7
- package/dist/definition/flow/compile.d.ts +4 -5
- package/dist/definition/flow/compile.js +120 -72
- package/dist/definition/flow/from.d.ts +2 -2
- package/dist/definition/flow/from.js +14 -33
- package/dist/definition/flow/index.d.ts +2 -2
- package/dist/definition/flow/index.js +2 -2
- package/dist/definition/flow/paths.d.ts +32 -17
- package/dist/definition/flow/paths.js +35 -14
- package/dist/definition/flow/spec.d.ts +6 -9
- package/dist/definition/flow/spec.js +49 -31
- package/dist/definition/flow/types.d.ts +40 -116
- package/dist/definition/from.js +36 -41
- package/dist/definition/helpers.d.ts +1 -1
- package/dist/definition/helpers.js +1 -1
- package/dist/definition/http-tool.d.ts +66 -0
- package/dist/definition/http-tool.js +131 -0
- package/dist/definition/implementations.d.ts +0 -3
- package/dist/definition/manifest.js +5 -4
- package/dist/definition/mcp.d.ts +4 -2
- package/dist/definition/mcp.js +14 -18
- package/dist/definition/removed.d.ts +10 -0
- package/dist/definition/removed.js +26 -0
- package/dist/definition/sandbox-capability.d.ts +2 -0
- package/dist/definition/sandbox-capability.js +11 -1
- package/dist/definition/schema.js +0 -3
- package/dist/definition/skill-tools.d.ts +16 -2
- package/dist/definition/skill-tools.js +38 -31
- package/dist/definition/variant.d.ts +1 -1
- package/dist/definition/variant.js +3 -14
- package/dist/definition/workflow/diagnostics.d.ts +1 -7
- package/dist/definition/workflow/diagnostics.js +1 -24
- package/dist/definition/workflow/index.d.ts +3 -17
- package/dist/definition/workflow/index.js +2 -9
- package/dist/definition/workflow/runnable.d.ts +2 -34
- package/dist/definition/workflow/runnable.js +8 -142
- package/dist/definition/workflow/types.d.ts +1 -10
- package/dist/harness-api/messages.d.ts +24 -27
- package/dist/harness-api/messages.js +1 -1
- package/dist/harness-api/schema.d.ts +0 -16
- package/dist/harness-api/schema.js +5 -12
- package/dist/index.d.ts +1 -1
- package/dist/types/manifest.d.ts +41 -14
- package/dist/types/middleware.d.ts +11 -16
- package/dist/types/observe.d.ts +0 -6
- package/dist/types/tool.d.ts +0 -6
- package/dist/types/workflow.d.ts +54 -110
- package/dist/utils/definition-files.d.ts +31 -0
- package/dist/utils/definition-files.js +84 -0
- package/package.json +1 -1
- package/dist/definition/hooks.d.ts +0 -19
- package/dist/definition/hooks.js +0 -67
- package/dist/definition/workflow/build.d.ts +0 -28
- package/dist/definition/workflow/build.js +0 -40
- package/dist/definition/workflow/chain.d.ts +0 -49
- package/dist/definition/workflow/chain.js +0 -40
- package/dist/definition/workflow/loop.d.ts +0 -54
- package/dist/definition/workflow/loop.js +0 -100
- package/dist/definition/workflow/map.d.ts +0 -17
- package/dist/definition/workflow/map.js +0 -45
- package/dist/definition/workflow/parallel.d.ts +0 -19
- package/dist/definition/workflow/parallel.js +0 -36
- package/dist/definition/workflow/patch.d.ts +0 -11
- package/dist/definition/workflow/patch.js +0 -45
- package/dist/definition/workflow/slot.d.ts +0 -23
- package/dist/definition/workflow/slot.js +0 -16
- package/dist/definition/workflow/switch.d.ts +0 -26
- package/dist/definition/workflow/switch.js +0 -64
- package/dist/types/dynamics.d.ts +0 -101
- package/dist/types/dynamics.js +0 -1
package/dist/compatibility.js
CHANGED
|
@@ -1,70 +1,77 @@
|
|
|
1
1
|
export { hashManifest } from "./utils/hash.js";
|
|
2
2
|
/**
|
|
3
|
+
* Protocol 8: the Runtime and Management APIs (`key_role_mismatch`), and manifest-only agents
|
|
4
|
+
* (track R2): manifest v5 and workflow manifest v3, no hooks or flow functions, remote MCP
|
|
5
|
+
* only, and no Action endpoints (`/v1/endpoints` and `/v1/actions/*` answer 404, delivery
|
|
6
|
+
* tokens are gone): an agent's tools are HTTP tools, remote MCP servers, agents and the
|
|
7
|
+
* Runtime's built-ins.
|
|
8
|
+
* Protocol 7: open-source auth (F9 I3). Subject tokens (`POST /v1/tokens`), the access policy,
|
|
9
|
+
* revocations, browser keys (`Nylorun-Key`), the Runtime's own CORS and derived principals are gone; their
|
|
10
|
+
* routes answer 404. Browsers and apps present a trusted issuer's token, servers an operator key.
|
|
3
11
|
* Protocol 6: file artifacts (`/v1/artifacts/**`, Runtime-signed capability links) and user
|
|
4
|
-
* messages with `parts
|
|
5
|
-
*
|
|
6
|
-
*
|
|
12
|
+
* messages with `parts`. Protocol 5: a Host serves one Tenant, and nothing in a request selects
|
|
13
|
+
* it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
|
|
14
|
+
* that remains; a client that requires `action-endpoints` is refused by the feature check.
|
|
7
15
|
*/
|
|
8
|
-
export const PROTOCOL_VERSION =
|
|
16
|
+
export const PROTOCOL_VERSION = 8;
|
|
9
17
|
/** What a client of this protocol requires of a Host. */
|
|
10
18
|
export const PROTOCOL_FEATURES = [
|
|
11
|
-
"admin-status",
|
|
12
19
|
"studio-principal",
|
|
13
|
-
"action-endpoints",
|
|
14
20
|
"artifacts",
|
|
21
|
+
/**
|
|
22
|
+
* Protocol 8: the Management API (`/v1/tenant/*`) takes management keys only, and the
|
|
23
|
+
* Runtime API application keys only (`key_role_mismatch`); vaults and signing keys are under
|
|
24
|
+
* `/v1/tenant`.
|
|
25
|
+
*/
|
|
26
|
+
"management-api",
|
|
15
27
|
];
|
|
16
28
|
/**
|
|
17
29
|
* Host features no client requires: a client that uses one checks the Host's `/health`
|
|
18
30
|
* for it first. `tenant-fixture-model`: `PUT /v1/tenant/config/seed` accepts
|
|
19
31
|
* `fixtureModel: true` (the Tenant's model calls use the Runtime's fixture model).
|
|
20
|
-
* `transcript-events`: the log carries `message.assistant` and `tool.completed
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* enforces the scopes and the subject's ownership of sessions and vaults.
|
|
26
|
-
* `subject-tokens`: `POST /v1/tokens` mints ES256 subject tokens for the roles of the Tenant's
|
|
27
|
-
* access policy, and the Tenant API accepts them as bearers (`/v1/access/**` manages the
|
|
28
|
-
* policy, signing keys and revocations). `browser-access`: publishable keys
|
|
29
|
-
* (`Nylorun-Key`, `/v1/access/publishable-keys`) name the Tenant and an origin allowlist, and
|
|
30
|
-
* browser requests from listed origins reach the Tenant routes with CORS. `ag-ui-endpoint`:
|
|
31
|
-
* the Runtime serves AG-UI at `/v1/ag-ui/agents/:agent` for a person named by a subject token
|
|
32
|
-
* or by subject headers. `a2a-endpoint`:
|
|
32
|
+
* `transcript-events`: the log carries `message.assistant` and `tool.completed`.
|
|
33
|
+
* `subject-headers`: an application principal may act for a subject with `Nylorun-Subject` and `Nylorun-Scopes`, and the Runtime
|
|
34
|
+
* enforces the scopes and the subject's ownership of sessions. `ag-ui-endpoint`: the Runtime
|
|
35
|
+
* serves AG-UI at `/v1/ag-ui/agents/:agent` for a person named by a trusted issuer's token or
|
|
36
|
+
* by subject headers. `a2a-endpoint`:
|
|
33
37
|
* `POST /v1/a2a/agents/:agent` answers A2A 1.0 JSON-RPC for a subject, and
|
|
34
38
|
* `GET /v1/a2a/agents/:agent/card` returns the agent's card without its interfaces.
|
|
35
|
-
* `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* with `sandbox: { id }`, subject tokens carry `sbx` grants checked at every turn start, and
|
|
40
|
-
* `sandboxes:write` lets a subject create and delete the sandboxes it is granted.
|
|
39
|
+
* `sandboxes`: sandboxes are a resource (`PUT`/`GET`/`DELETE /v1/sandboxes/{id}`, kind `virtual`), a session attaches to one
|
|
40
|
+
* with `sandbox: { id }`, a token caller (a trusted issuer's token) carries sandbox grants
|
|
41
|
+
* checked at every turn start, and `sandboxes:write` lets a subject create and delete the
|
|
42
|
+
* sandboxes it is granted.
|
|
41
43
|
* `sandbox-pods`: kind `pod` runs as an agent-sandbox pod on the Tenant's cluster (`nylorun
|
|
42
44
|
* sandbox enable`), with `POST /v1/sandboxes/{id}/stop` and `/reset`, a TTL
|
|
43
45
|
* (`lifecycle.ttl`), lifecycle events (`sandbox.running`, `.suspended`, `.expired`,
|
|
44
46
|
* `.relaunched`, `.lost`, `.reset`, `.failed`) and the Tenant's `placement`.
|
|
47
|
+
* `trusted-issuers`: the Tenant API accepts JWTs from the issuers of the Host's identity file
|
|
48
|
+
* (`NYLORUN_IDENTITY_FILE`) as bearers, from servers and from browsers alike, with the
|
|
49
|
+
* issuer's subject, scopes (and the issuer-only `studio`), agents and sandbox grants; `GET
|
|
50
|
+
* /v1/me` reports who any credential is.
|
|
45
51
|
*/
|
|
46
52
|
export const OPTIONAL_HOST_FEATURES = [
|
|
47
53
|
"tenant-fixture-model",
|
|
48
54
|
"transcript-events",
|
|
49
|
-
"derived-principals",
|
|
50
55
|
"subject-headers",
|
|
51
|
-
"subject-tokens",
|
|
52
|
-
"browser-access",
|
|
53
56
|
"ag-ui-endpoint",
|
|
54
57
|
"a2a-endpoint",
|
|
55
|
-
"action-endpoints",
|
|
56
58
|
"sandboxes",
|
|
57
59
|
"sandbox-pods",
|
|
60
|
+
"trusted-issuers",
|
|
61
|
+
"session-reads",
|
|
62
|
+
"calls-export",
|
|
58
63
|
];
|
|
59
64
|
/**
|
|
60
|
-
* What this Host serves. `runtime-tenants` (protocol 4 clients require it)
|
|
61
|
-
*
|
|
62
|
-
*
|
|
65
|
+
* What this Host serves. `runtime-tenants` (protocol 4 clients require it) and `admin-status`
|
|
66
|
+
* (protocol 5 to 7 clients require it) are still advertised for the compatibility window, so
|
|
67
|
+
* 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
|
|
69
|
+
* 7, required by their clients): file artifacts, capability links and message `parts`.
|
|
63
70
|
*/
|
|
64
71
|
export const HOST_PROTOCOL = {
|
|
65
72
|
min: 4,
|
|
66
|
-
max:
|
|
67
|
-
features: ["runtime-tenants", ...PROTOCOL_FEATURES, ...OPTIONAL_HOST_FEATURES],
|
|
73
|
+
max: 8,
|
|
74
|
+
features: ["runtime-tenants", "admin-status", ...PROTOCOL_FEATURES, ...OPTIONAL_HOST_FEATURES],
|
|
68
75
|
};
|
|
69
76
|
export const DEFINITION_SCHEMA_VERSION = 2;
|
|
70
77
|
/**
|
|
@@ -77,12 +84,10 @@ export const PROTOCOL_HEADER = "Nylorun-Protocol";
|
|
|
77
84
|
export const SUBJECT_HEADER = "Nylorun-Subject";
|
|
78
85
|
/** The space-separated scopes of that subject; required with `Nylorun-Subject`. */
|
|
79
86
|
export const SCOPES_HEADER = "Nylorun-Scopes";
|
|
80
|
-
/**
|
|
81
|
-
export const
|
|
82
|
-
|
|
83
|
-
export const
|
|
84
|
-
/** Set to `1` on an Action endpoint's response whose body is a tagged `ActionOutcome`. */
|
|
85
|
-
export const OUTCOME_HEADER = "Nylorun-Outcome";
|
|
87
|
+
/** The session, turn and agent of a call the Runtime makes to an HTTP tool's URL. */
|
|
88
|
+
export const SESSION_ID_HEADER = "Nylorun-Session-Id";
|
|
89
|
+
export const TURN_ID_HEADER = "Nylorun-Turn-Id";
|
|
90
|
+
export const AGENT_ID_HEADER = "Nylorun-Agent-Id";
|
|
86
91
|
export const ERROR_CODES = [
|
|
87
92
|
"not_found",
|
|
88
93
|
"protocol_unsupported",
|
|
@@ -93,6 +98,11 @@ export const ERROR_CODES = [
|
|
|
93
98
|
"incompatible_host",
|
|
94
99
|
"subject_invalid",
|
|
95
100
|
"scope_required",
|
|
101
|
+
/**
|
|
102
|
+
* A known key on the other API (protocol 8): an application key on the Management API
|
|
103
|
+
* (`/v1/tenant/*`), or a management key on the Runtime API. The message names the key's API.
|
|
104
|
+
*/
|
|
105
|
+
"key_role_mismatch",
|
|
96
106
|
"token_expired",
|
|
97
107
|
"limit_exceeded",
|
|
98
108
|
/** A request the Runtime refuses for a reason the message gives. */
|
|
@@ -101,7 +111,7 @@ export const ERROR_CODES = [
|
|
|
101
111
|
"invalid_request",
|
|
102
112
|
/** A route that acts for a person was called without one (`Nylorun-Subject`). */
|
|
103
113
|
"subject_required",
|
|
104
|
-
/** A
|
|
114
|
+
/** A token caller's sandbox grants do not reach the sandbox (Host feature `sandboxes`). */
|
|
105
115
|
"sandbox_not_granted",
|
|
106
116
|
/** Another session's turn holds the sandbox: turns are serial per sandbox. */
|
|
107
117
|
"sandbox_busy",
|
|
@@ -113,28 +123,48 @@ export const ERROR_CODES = [
|
|
|
113
123
|
"sandbox_lost",
|
|
114
124
|
/** A pod sandbox passed its TTL: a `PUT` with a longer `lifecycle.ttl` revives it. */
|
|
115
125
|
"sandbox_expired",
|
|
126
|
+
/**
|
|
127
|
+
* A trusted issuer's token names a key the Runtime has not seen, and the issuer's JWKS cannot
|
|
128
|
+
* be fetched now (Host feature `trusted-issuers`): retry later. Keys already fetched keep working.
|
|
129
|
+
*/
|
|
130
|
+
"issuer_unavailable",
|
|
131
|
+
/**
|
|
132
|
+
* An MCP OAuth connect found no way to identify this installation to the authorization server:
|
|
133
|
+
* it offers no dynamic client registration and no client id was given (F9 C2).
|
|
134
|
+
*/
|
|
135
|
+
"oauth_client_required",
|
|
136
|
+
/** An OAuth callback's `state` is unknown, already used or expired: start the connect again. */
|
|
137
|
+
"oauth_state_invalid",
|
|
138
|
+
/** The authorization server (or its discovery) failed or refused an MCP OAuth connect step. */
|
|
139
|
+
"oauth_failed",
|
|
140
|
+
/**
|
|
141
|
+
* A definition names definition files the Runtime does not hold (track R2 M4): upload each
|
|
142
|
+
* with `PUT /v1/files/sha256:<hex>` first. `details.missing` lists their hashes.
|
|
143
|
+
*/
|
|
144
|
+
"definition_files_missing",
|
|
116
145
|
"internal_error",
|
|
117
146
|
];
|
|
118
147
|
/** Crockford Base32 alphabet (lowercase); excludes i, l, o, u. */
|
|
119
148
|
const CROCKFORD = "0123456789abcdefghjkmnpqrstvwxyz";
|
|
120
149
|
export const TENANT_ID_PATTERN = /^tn_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
121
150
|
export const PRINCIPAL_ID_PATTERN = /^pr_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
122
|
-
/** A Tenant signing key's id, the `kid` of the
|
|
151
|
+
/** A Tenant signing key's id, the `kid` of the tokens it signs (capability links, run tokens). */
|
|
123
152
|
export const SIGNING_KEY_ID_PATTERN = /^sk_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
124
|
-
/** A publishable key's id (not the key). */
|
|
125
|
-
export const PUBLISHABLE_KEY_ID_PATTERN = /^pk_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
126
153
|
/** A file artifact's id (protocol 6). */
|
|
127
154
|
export const ARTIFACT_ID_PATTERN = /^af_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
128
|
-
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
155
|
+
/**
|
|
156
|
+
* An application key's id: an operator key's name, which names its client (e.g. `backend`).
|
|
157
|
+
* `studio` is reserved for the key Studio derives from the admin key.
|
|
158
|
+
*/
|
|
159
|
+
export const APPLICATION_KEY_ID_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
|
|
160
|
+
/**
|
|
161
|
+
* What a key reaches (protocol 8). `application`: the Runtime API, for the whole Tenant or for
|
|
162
|
+
* one subject. `management`: the Management API (`/v1/tenant/*`), as itself only. `studio`: the
|
|
163
|
+
* key Studio derives from the admin key, which reaches both.
|
|
164
|
+
*/
|
|
165
|
+
export const KEY_ROLES = ["application", "management", "studio"];
|
|
166
|
+
/** The management key a Host registers from `NYLORUN_MANAGEMENT_KEY_FILE` at start. */
|
|
167
|
+
export const BOOTSTRAP_KEY_ID = "bootstrap";
|
|
138
168
|
export function isTenantId(value) {
|
|
139
169
|
return typeof value === "string" && TENANT_ID_PATTERN.test(value);
|
|
140
170
|
}
|
|
@@ -200,10 +230,6 @@ export function newPrincipalId(now) {
|
|
|
200
230
|
export function newSigningKeyId(now) {
|
|
201
231
|
return newPrefixedId("sk_", now);
|
|
202
232
|
}
|
|
203
|
-
/** Publishable key id: `pk_` + lowercase Crockford ULID. */
|
|
204
|
-
export function newPublishableKeyId(now) {
|
|
205
|
-
return newPrefixedId("pk_", now);
|
|
206
|
-
}
|
|
207
233
|
/** Artifact id: `af_` + lowercase Crockford ULID. */
|
|
208
234
|
export function newArtifactId(now) {
|
|
209
235
|
return newPrefixedId("af_", now);
|
|
@@ -211,15 +237,6 @@ export function newArtifactId(now) {
|
|
|
211
237
|
export function isArtifactId(value) {
|
|
212
238
|
return typeof value === "string" && ARTIFACT_ID_PATTERN.test(value);
|
|
213
239
|
}
|
|
214
|
-
/** A new publishable key for `tenantId`: 160 random bits after the Tenant id. */
|
|
215
|
-
export function newPublishableKey(tenantId) {
|
|
216
|
-
if (!isTenantId(tenantId))
|
|
217
|
-
throw new Error(`Invalid Tenant id ${tenantId}`);
|
|
218
|
-
let random = "";
|
|
219
|
-
while (random.length < 32)
|
|
220
|
-
random += encodeRandom();
|
|
221
|
-
return `nr_pub_${tenantId}_${random.slice(0, 32)}`;
|
|
222
|
-
}
|
|
223
240
|
function parseSemVer(version) {
|
|
224
241
|
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(version);
|
|
225
242
|
if (!match)
|