@nylorun/core 0.19.0-beta → 0.21.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 +191 -0
- package/README.md +2 -2
- package/dist/compatibility.d.ts +148 -32
- package/dist/compatibility.js +154 -33
- package/dist/contracts.d.ts +2714 -495
- package/dist/contracts.js +1395 -493
- package/dist/define.d.ts +15 -12
- package/dist/define.js +11 -7
- package/dist/definition/approval.d.ts +16 -0
- package/dist/definition/approval.js +33 -0
- package/dist/definition/assemble.d.ts +6 -10
- package/dist/definition/assemble.js +48 -105
- package/dist/definition/bind-agent.d.ts +3 -4
- package/dist/definition/bind-agent.js +12 -30
- package/dist/definition/binding.d.ts +2 -2
- package/dist/definition/bound.d.ts +10 -10
- package/dist/definition/builder.d.ts +16 -20
- package/dist/definition/builder.js +29 -81
- package/dist/definition/code-tools.d.ts +4 -4
- package/dist/definition/code-tools.js +7 -22
- package/dist/definition/declaration.d.ts +4 -7
- package/dist/definition/declaration.js +29 -99
- package/dist/definition/{tools-capability.d.ts → deferred-tools.d.ts} +3 -13
- package/dist/definition/{tools-capability.js → deferred-tools.js} +2 -18
- package/dist/definition/delegate.d.ts +2 -4
- package/dist/definition/delegate.js +8 -10
- package/dist/definition/flow/compile.js +0 -2
- package/dist/definition/from.d.ts +7 -4
- package/dist/definition/from.js +72 -117
- package/dist/definition/helpers.d.ts +0 -7
- package/dist/definition/helpers.js +0 -5
- package/dist/definition/http-tool.d.ts +7 -4
- package/dist/definition/http-tool.js +6 -10
- package/dist/definition/implementations.d.ts +6 -8
- package/dist/definition/manifest.d.ts +11 -5
- package/dist/definition/manifest.js +27 -26
- package/dist/definition/mcp.d.ts +1 -52
- package/dist/definition/mcp.js +11 -60
- package/dist/definition/media-reference.d.ts +23 -0
- package/dist/definition/media-reference.js +26 -0
- package/dist/definition/removed.d.ts +3 -10
- package/dist/definition/removed.js +10 -17
- package/dist/definition/runtime-manifest.d.ts +30 -0
- package/dist/definition/runtime-manifest.js +132 -0
- package/dist/definition/sandbox-tools.d.ts +1 -1
- package/dist/definition/sandbox-tools.js +1 -1
- package/dist/definition/skill-tools.d.ts +13 -7
- package/dist/definition/skill-tools.js +23 -10
- package/dist/definition/trace.d.ts +18 -0
- package/dist/definition/trace.js +42 -0
- package/dist/definition/variant.d.ts +5 -4
- package/dist/definition/variant.js +23 -55
- package/dist/definition/workflow/runnable.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/harness-api/entries.d.ts +242 -0
- package/dist/harness-api/entries.js +118 -0
- package/dist/harness-api/gates.d.ts +167 -0
- package/dist/harness-api/gates.js +117 -0
- package/dist/harness-api/harness-api.schema.json +4975 -0
- package/dist/harness-api/index.d.ts +19 -3
- package/dist/harness-api/index.js +16 -3
- package/dist/harness-api/json-schema.d.ts +12 -0
- package/dist/harness-api/json-schema.js +61 -0
- package/dist/harness-api/mcp.d.ts +57 -0
- package/dist/harness-api/mcp.js +39 -0
- package/dist/harness-api/messages.d.ts +11 -5
- package/dist/harness-api/messages.js +5 -3
- package/dist/harness-api/schema.d.ts +346 -36
- package/dist/harness-api/schema.js +143 -22
- package/dist/harness-api/transport.d.ts +55 -0
- package/dist/harness-api/transport.js +61 -0
- package/dist/index.d.ts +1 -1
- package/dist/manifest-schemas.d.ts +6 -0
- package/dist/manifest-schemas.js +34 -0
- package/dist/schemas/agent-manifest.schema.json +897 -0
- package/dist/schemas/environment-manifest.schema.json +329 -0
- package/dist/types/agent.d.ts +1 -1
- package/dist/types/manifest.d.ts +48 -28
- package/dist/types/model.d.ts +2 -2
- package/dist/types/observe.d.ts +8 -20
- package/dist/types/part.d.ts +25 -0
- package/dist/types/tool.d.ts +1 -1
- package/dist/types/transcript.d.ts +5 -0
- package/dist/utils/definition-files.d.ts +11 -6
- package/dist/utils/definition-files.js +19 -9
- package/dist/utils/harness-id.d.ts +9 -0
- package/dist/utils/harness-id.js +11 -0
- package/dist/utils/runtime-tools.d.ts +19 -0
- package/dist/utils/runtime-tools.js +30 -0
- package/dist/utils/sandbox.d.ts +1 -1
- package/dist/utils/sandbox.js +1 -1
- package/package.json +11 -4
- package/dist/definition/capability.d.ts +0 -43
- package/dist/definition/capability.js +0 -82
- package/dist/definition/sandbox-capability.d.ts +0 -44
- package/dist/definition/sandbox-capability.js +0 -139
- package/dist/types/middleware.d.ts +0 -94
- /package/dist/types/{middleware.js → part.js} +0 -0
package/dist/compatibility.js
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
export { hashManifest } from "./utils/hash.js";
|
|
2
2
|
/**
|
|
3
|
+
* Protocol 14: environment manifests (D63 to D65). `/v1/environment-manifests/{name}` holds
|
|
4
|
+
* named, versioned definitions of a kind of Environment, saved like agents (with `If-Match` and
|
|
5
|
+
* `?dryRun=true`), and `PUT /v1/environments/{id}` takes `manifest: "name"` or `"name@n"`. An
|
|
6
|
+
* Environment never changes what it runs after creation: a `PUT` on an existing one may change
|
|
7
|
+
* only its labels and owner guard (`409 environment_immutable`), and its view's `recipe` is now
|
|
8
|
+
* `manifest`. A manifest's `secrets` declares slots: a write sends only the value, and a name it
|
|
9
|
+
* does not declare is `409 secret_not_in_manifest`. An agent manifest's `requires` is checked
|
|
10
|
+
* when a session opens (`409 environment_unsuitable`). Sessions on one Environment run their
|
|
11
|
+
* turns in parallel (D66), so a turn start is no longer `environment_busy` because another
|
|
12
|
+
* session's turn runs, and every egress connection is an `environment.egress` event on the
|
|
13
|
+
* Environment's stream naming the turns that were running; `egress.connection` is gone from
|
|
14
|
+
* session logs and traces (D67). The Host serves protocol 14 only.
|
|
15
|
+
* Protocol 13: the flat agent manifest (v7), a fresh start. A manifest has no capabilities: its
|
|
16
|
+
* instructions, tools, skills and MCP servers are top-level, and a skill or server from an Agent
|
|
17
|
+
* Plugin carries a `plugin` label. A session's pinned manifest carries the Runtime's `runtime`
|
|
18
|
+
* block (the sandbox and its tools, the artifact and skill tools). Tool calls, MCP servers and
|
|
19
|
+
* HTTP calls are named without capability ids, here and on the Harness API (version 3). The Host
|
|
20
|
+
* serves protocol 13 only.
|
|
21
|
+
* Protocol 12: model inputs and files as artifacts. What the Tenant's model reads (`text`,
|
|
22
|
+
* `image`, `pdf`, `office`, `audio`, `video`) is its catalog's input list plus the operator's
|
|
23
|
+
* additions (`PUT /v1/tenant/models/inputs`, a custom endpoint's `settings.inputs`); the catalog
|
|
24
|
+
* and the provider list say it. A message naming a file the model does not read is refused at
|
|
25
|
+
* accept (`422 attachment_unsupported`), with no turn. After its turn a file is a reference line
|
|
26
|
+
* the model reads again with `read_artifact`, which every agent now has. The Host accepts
|
|
27
|
+
* protocol 11 and 12: the change is additive.
|
|
28
|
+
* Protocol 11: Environments (R2d, D55, D56), a fresh start. `/v1/environments/{id}` replaces
|
|
29
|
+
* `/v1/sandboxes`: an Environment is one sandbox (kind `virtual`, `pod` or `none`) with a recipe
|
|
30
|
+
* that can change and one vault, written on the Runtime API
|
|
31
|
+
* (`PUT /v1/environments/{id}/secrets/{name}`). Sessions name an `environment` or nothing; the
|
|
32
|
+
* session fields `sandbox`, `vaultIds` and `credentialSelections`, the Tenant's default sandbox,
|
|
33
|
+
* user and installation vaults and `/v1/tenant/vaults` are gone. Error codes, event types, the
|
|
34
|
+
* scope (`environments:write`) and identity-file grants (`environments`) say Environment. An
|
|
35
|
+
* older client is answered `426`.
|
|
3
36
|
* Protocol 10: MCP credential custody leaves OSS (D49). The vault credential type `oauth`, the
|
|
4
37
|
* MCP OAuth connect (`/v1/tenant/vaults/{vaultId}/oauth/start`, `/v1/oauth/callback`) and the
|
|
5
38
|
* credential resolver are gone: a session's MCP servers and HTTP tools reach their credentials
|
|
@@ -22,7 +55,7 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
22
55
|
* it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
|
|
23
56
|
* that remains; a client that requires `action-endpoints` is refused by the feature check.
|
|
24
57
|
*/
|
|
25
|
-
export const PROTOCOL_VERSION =
|
|
58
|
+
export const PROTOCOL_VERSION = 14;
|
|
26
59
|
/** What a client of this protocol requires of a Host. */
|
|
27
60
|
export const PROTOCOL_FEATURES = [
|
|
28
61
|
"studio-principal",
|
|
@@ -39,6 +72,31 @@ export const PROTOCOL_FEATURES = [
|
|
|
39
72
|
* metadata at `/.well-known/oauth-protected-resource` when it has trusted issuers.
|
|
40
73
|
*/
|
|
41
74
|
"resource-server",
|
|
75
|
+
/**
|
|
76
|
+
* Protocol 11: Environments (`/v1/environments/{id}`, kinds `virtual`, `pod` and `none`), each
|
|
77
|
+
* with one vault written on the Runtime API; sessions name an `environment`; token callers
|
|
78
|
+
* carry Environment grants checked at every turn start, and `environments:write` lets a
|
|
79
|
+
* subject create, change and delete the Environments it is granted.
|
|
80
|
+
*/
|
|
81
|
+
"environments",
|
|
82
|
+
/**
|
|
83
|
+
* Protocol 12: the model catalog and provider list say which inputs each model reads, and a
|
|
84
|
+
* message naming a file the Tenant's model does not read is refused with
|
|
85
|
+
* `422 attachment_unsupported`.
|
|
86
|
+
*/
|
|
87
|
+
"model-inputs",
|
|
88
|
+
/**
|
|
89
|
+
* Protocol 13: agent manifest v7 has no capabilities (its instructions, tools, skills and
|
|
90
|
+
* MCP servers are top-level), a session's pinned manifest carries the Runtime's `runtime`
|
|
91
|
+
* block, and tool calls, MCP servers and HTTP calls are named without capability ids.
|
|
92
|
+
*/
|
|
93
|
+
"flat-manifest",
|
|
94
|
+
/**
|
|
95
|
+
* Protocol 14: environment manifests (`/v1/environment-manifests/{name}`), Environments made
|
|
96
|
+
* from one version and never changed after creation, secret slots, and an agent manifest's
|
|
97
|
+
* `requires`, checked when a session opens.
|
|
98
|
+
*/
|
|
99
|
+
"environment-manifests",
|
|
42
100
|
];
|
|
43
101
|
/**
|
|
44
102
|
* Host features no client requires: a client that uses one checks the Host's `/health`
|
|
@@ -51,18 +109,32 @@ export const PROTOCOL_FEATURES = [
|
|
|
51
109
|
* by subject headers. `a2a-endpoint`:
|
|
52
110
|
* `POST /v1/a2a/agents/:agent` answers A2A 1.0 JSON-RPC for a subject, and
|
|
53
111
|
* `GET /v1/a2a/agents/:agent/card` returns the agent's card without its interfaces.
|
|
54
|
-
* `
|
|
55
|
-
* with `
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* `sandbox-pods`: kind `pod` runs as an agent-sandbox pod on the Tenant's cluster (`nylorun
|
|
59
|
-
* sandbox enable`), with `POST /v1/sandboxes/{id}/stop` and `/reset`, a TTL
|
|
60
|
-
* (`lifecycle.ttl`), lifecycle events (`sandbox.running`, `.suspended`, `.expired`,
|
|
61
|
-
* `.relaunched`, `.lost`, `.reset`, `.failed`) and the Tenant's `placement`.
|
|
112
|
+
* `sandbox-pods`: Environments of kind `pod` run as agent-sandbox pods on the Tenant's cluster
|
|
113
|
+
* (`nylorun local sandbox enable`), with `POST /v1/environments/{id}/stop` and `/reset`, lifecycle
|
|
114
|
+
* events (`environment.running`, `.suspended`, `.relaunched`, `.lost`, `.reset`, `.failed`) and
|
|
115
|
+
* the Tenant's `placement`.
|
|
62
116
|
* `trusted-issuers`: the Tenant API accepts JWTs from the issuers of the Host's identity file
|
|
63
117
|
* (`NYLORUN_IDENTITY_FILE`) as bearers, from servers and from browsers alike, with the
|
|
64
|
-
* issuer's subject, scopes (and the issuer-only `studio`), agents and
|
|
118
|
+
* issuer's subject, scopes (and the issuer-only `studio`), agents and Environment grants; `GET
|
|
65
119
|
* /v1/me` reports who any credential is.
|
|
120
|
+
* `environment-setup`: a pod Environment's recipe takes `setup` commands and input `files`, run
|
|
121
|
+
* and copied when its disk is made or reset, before any turn.
|
|
122
|
+
* `environment-disk-versions`: an Environment's disk has versions: `POST
|
|
123
|
+
* /v1/environments/{id}/snapshot` and `/restore`, `GET .../versions`, `DELETE .../versions/{n}`,
|
|
124
|
+
* and `from` on a `PUT` that creates one; a pod whose volume is lost starts again from the latest.
|
|
125
|
+
* `credential-coverage`: `POST /v1/tenant/credential-coverage` (the Management API) says which
|
|
126
|
+
* credential of an Environment's vault each of a saved agent's MCP servers and HTTP tools would
|
|
127
|
+
* get in a session that names that Environment.
|
|
128
|
+
* `tool-calls` (R5): `GET /v1/sessions/{id}/calls/tool` pages a session's tool calls from the
|
|
129
|
+
* effect journal, every `tool.completed` says how its call ended (`status`, `kind`, `server`,
|
|
130
|
+
* `attempts`, `durationMs`), and tool calls are delivered at least once with their effect id as
|
|
131
|
+
* the key (`Idempotency-Key` for HTTP tools, `_meta["nylorun/idempotency-key"]` for MCP tools).
|
|
132
|
+
* `tool-policy` (R5 step 2): `GET`/`PUT /v1/tenant/tool-policy` (the Management API) sets which
|
|
133
|
+
* MCP and HTTP tool calls run, wait for a person (`ask`: the turn pauses until `approve`) or are
|
|
134
|
+
* refused (`deny`: `tool.denied`), for every harness; a manifest that sets `approval` is refused.
|
|
135
|
+
* `traces` (R7): `GET /v1/sessions/{id}/turns/{turnId}/trace` answers a turn's spans as OTLP JSON,
|
|
136
|
+
* the spans the Runtime posts to an OTLP collector when one is configured; a command or an AG-UI
|
|
137
|
+
* or A2A request sent with a `traceparent` joins the caller's trace.
|
|
66
138
|
*/
|
|
67
139
|
export const OPTIONAL_HOST_FEATURES = [
|
|
68
140
|
"tenant-fixture-model",
|
|
@@ -70,23 +142,28 @@ export const OPTIONAL_HOST_FEATURES = [
|
|
|
70
142
|
"subject-headers",
|
|
71
143
|
"ag-ui-endpoint",
|
|
72
144
|
"a2a-endpoint",
|
|
73
|
-
"sandboxes",
|
|
74
145
|
"sandbox-pods",
|
|
75
146
|
"trusted-issuers",
|
|
76
147
|
"session-reads",
|
|
77
148
|
"calls-export",
|
|
149
|
+
"credential-coverage",
|
|
150
|
+
"tool-calls",
|
|
151
|
+
"environment-setup",
|
|
152
|
+
"environment-disk-versions",
|
|
153
|
+
"tool-policy",
|
|
154
|
+
"traces",
|
|
155
|
+
/** Opt-in artifact metadata pages (`GET /v1/artifacts?limit=…`). */
|
|
156
|
+
"artifact-reads",
|
|
78
157
|
];
|
|
79
158
|
/**
|
|
80
|
-
* What this Host serves
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* API itself is gone (protocol 8): `/v1/admin/*` is no route. `artifacts` (protocol 6 and
|
|
84
|
-
* 7, required by their clients): file artifacts, capability links and message `parts`.
|
|
159
|
+
* What this Host serves: protocol 14. Protocol 14 changed what `PUT /v1/environments/{id}`
|
|
160
|
+
* does to an existing Environment and the shape of its view, so an older client is answered
|
|
161
|
+
* `426` naming the protocol it needs rather than a `409` it cannot read.
|
|
85
162
|
*/
|
|
86
163
|
export const HOST_PROTOCOL = {
|
|
87
|
-
min:
|
|
88
|
-
max:
|
|
89
|
-
features: [
|
|
164
|
+
min: 14,
|
|
165
|
+
max: 14,
|
|
166
|
+
features: [...PROTOCOL_FEATURES, ...OPTIONAL_HOST_FEATURES],
|
|
90
167
|
};
|
|
91
168
|
export const DEFINITION_SCHEMA_VERSION = 2;
|
|
92
169
|
/**
|
|
@@ -134,18 +211,31 @@ export const ERROR_CODES = [
|
|
|
134
211
|
"invalid_request",
|
|
135
212
|
/** A route that acts for a person was called without one (`Nylorun-Subject`). */
|
|
136
213
|
"subject_required",
|
|
137
|
-
/** A token caller's
|
|
138
|
-
"
|
|
139
|
-
/**
|
|
140
|
-
"
|
|
141
|
-
/** The
|
|
142
|
-
"
|
|
143
|
-
/** The Tenant's placement keeps this session's harness off the host its
|
|
214
|
+
/** A token caller's Environment grants do not reach the Environment. */
|
|
215
|
+
"environment_not_granted",
|
|
216
|
+
/** Disk work (snapshot, restore, stop, reset) while a turn runs, or a turn while a disk copy runs. */
|
|
217
|
+
"environment_busy",
|
|
218
|
+
/** The Environment is gone, or its kind cannot run on this Runtime. */
|
|
219
|
+
"environment_unavailable",
|
|
220
|
+
/** The Tenant's placement keeps this session's harness off the host its Environment needs. */
|
|
144
221
|
"placement_refused",
|
|
145
|
-
/** A pod
|
|
146
|
-
"
|
|
147
|
-
/**
|
|
148
|
-
|
|
222
|
+
/** A pod Environment's volume or node is gone: only `POST /v1/environments/{id}/reset` brings it back. */
|
|
223
|
+
"environment_lost",
|
|
224
|
+
/**
|
|
225
|
+
* The Environment names an owner (`ownerUserId`) other than the session's owner: `403` to an
|
|
226
|
+
* application key; a caller acting for a person gets the opaque `404`.
|
|
227
|
+
*/
|
|
228
|
+
"environment_owner_mismatch",
|
|
229
|
+
/**
|
|
230
|
+
* The session's Environment now runs another harness than the one the session pinned when it
|
|
231
|
+
* opened (track R4): open a new session to run on it.
|
|
232
|
+
*/
|
|
233
|
+
"harness_mismatch",
|
|
234
|
+
/**
|
|
235
|
+
* The session is closed: it was opened before protocol 11 (its history stays readable), so
|
|
236
|
+
* open a new session that names an Environment.
|
|
237
|
+
*/
|
|
238
|
+
"session_closed",
|
|
149
239
|
/**
|
|
150
240
|
* A trusted issuer's token names a key the Runtime has not seen, and the issuer's JWKS cannot
|
|
151
241
|
* be fetched now (Host feature `trusted-issuers`): retry later. Keys already fetched keep working.
|
|
@@ -169,11 +259,42 @@ export const ERROR_CODES = [
|
|
|
169
259
|
*/
|
|
170
260
|
"mcp_preview_failed",
|
|
171
261
|
/**
|
|
172
|
-
*
|
|
173
|
-
* `environment_secret`
|
|
174
|
-
*
|
|
262
|
+
* An Environment's credentials would be ambiguous (R2c, D56): `409` at the secret write. Two
|
|
263
|
+
* `environment_secret` credentials would be bound to one host, or two `bearer` or `headers`
|
|
264
|
+
* credentials to one URL.
|
|
175
265
|
*/
|
|
176
266
|
"credential_conflict",
|
|
267
|
+
/**
|
|
268
|
+
* A message names a file the Tenant's model does not read (protocol 12): `422` at accept, and
|
|
269
|
+
* no turn starts. `details.parts` lists each refused file's `artifactId`, `name`, `mediaType`
|
|
270
|
+
* and `reason`.
|
|
271
|
+
*/
|
|
272
|
+
"attachment_unsupported",
|
|
273
|
+
/**
|
|
274
|
+
* A `PUT /v1/environments/{id}` asked an existing Environment to run something else
|
|
275
|
+
* (protocol 14, D63): only its labels and owner guard may change. Fork it into a new
|
|
276
|
+
* Environment (`POST /v1/environments/{id}/fork`). `details.fields` names what differed.
|
|
277
|
+
*/
|
|
278
|
+
"environment_immutable",
|
|
279
|
+
/**
|
|
280
|
+
* A secret write named a secret the Environment's manifest does not declare (D64): `409`.
|
|
281
|
+
* Add the slot to the manifest and make or fork an Environment from the new version.
|
|
282
|
+
*/
|
|
283
|
+
"secret_not_in_manifest",
|
|
284
|
+
/**
|
|
285
|
+
* A session's agent requires what its Environment lacks (D65): `409` when the session opens.
|
|
286
|
+
* `details.missing` lists each gap (`sandbox`, `pod`, or `secret:<name>`).
|
|
287
|
+
*/
|
|
288
|
+
"environment_unsuitable",
|
|
289
|
+
/** No environment manifest has this name, or no version with this number. */
|
|
290
|
+
"manifest_not_found",
|
|
291
|
+
/** An environment manifest some Environment was made from cannot be deleted: `409`. */
|
|
292
|
+
"manifest_in_use",
|
|
293
|
+
/**
|
|
294
|
+
* `If-Match` named a version that is no longer the latest (D63): `412`. Read the manifest
|
|
295
|
+
* again, or save with `--force` (no `If-Match`).
|
|
296
|
+
*/
|
|
297
|
+
"manifest_changed",
|
|
177
298
|
"internal_error",
|
|
178
299
|
];
|
|
179
300
|
/** Crockford Base32 alphabet (lowercase); excludes i, l, o, u. */
|