@nylorun/core 0.22.0-beta → 0.24.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 +126 -0
- package/README.md +1 -1
- package/dist/compatibility.d.ts +120 -47
- package/dist/compatibility.js +122 -49
- package/dist/contracts.d.ts +2824 -907
- package/dist/contracts.js +1286 -585
- package/dist/define.d.ts +9 -12
- package/dist/define.js +8 -11
- package/dist/definition/assemble.d.ts +1 -3
- package/dist/definition/assemble.js +4 -8
- package/dist/definition/bound.d.ts +1 -1
- package/dist/definition/delegate.d.ts +5 -0
- package/dist/definition/delegate.js +6 -1
- package/dist/definition/from.d.ts +4 -2
- package/dist/definition/from.js +11 -29
- package/dist/definition/http-tool.d.ts +5 -3
- package/dist/definition/http-tool.js +8 -5
- package/dist/definition/manifest.d.ts +7 -6
- package/dist/definition/manifest.js +7 -6
- package/dist/definition/mcp.d.ts +1 -1
- package/dist/definition/media-reference.d.ts +2 -11
- package/dist/definition/media-reference.js +0 -12
- package/dist/definition/model-failure.js +1 -0
- package/dist/definition/removed.d.ts +7 -0
- package/dist/definition/removed.js +21 -0
- package/dist/definition/sections.d.ts +63 -0
- package/dist/definition/sections.js +204 -0
- package/dist/definition/trace.d.ts +0 -7
- package/dist/definition/trace.js +0 -34
- package/dist/definition/variant.d.ts +1 -1
- package/dist/definition/variant.js +1 -3
- package/dist/harness-api/artifacts.d.ts +84 -0
- package/dist/harness-api/artifacts.js +128 -0
- package/dist/harness-api/gates.d.ts +0 -4
- package/dist/harness-api/gates.js +0 -4
- package/dist/harness-api/harness-api.schema.json +2798 -1124
- package/dist/harness-api/index.d.ts +9 -6
- package/dist/harness-api/index.js +9 -6
- package/dist/harness-api/json-schema.js +5 -2
- package/dist/harness-api/mcp.d.ts +77 -30
- package/dist/harness-api/mcp.js +42 -25
- package/dist/harness-api/messages.d.ts +47 -17
- package/dist/harness-api/messages.js +20 -5
- package/dist/harness-api/schema.d.ts +609 -200
- package/dist/harness-api/schema.js +345 -62
- package/dist/harness-api/transcript.d.ts +8 -10
- package/dist/harness-api/transcript.js +27 -11
- package/dist/harness-api/transport.d.ts +7 -1
- package/dist/harness-api/transport.js +10 -7
- package/dist/manifest-schemas.d.ts +9 -5
- package/dist/manifest-schemas.js +23 -27
- package/dist/schemas/agent-manifest.schema.json +1508 -365
- package/dist/schemas/harness-manifest.schema.json +1273 -0
- package/dist/schemas/{environment-manifest.schema.json → runtime-manifest.schema.json} +165 -84
- package/dist/types/manifest.d.ts +72 -14
- package/dist/types/manifest.js +4 -0
- package/dist/types/model.d.ts +15 -5
- package/dist/utils/definition-files.d.ts +20 -6
- package/dist/utils/definition-files.js +31 -17
- package/dist/utils/file-systems.d.ts +20 -0
- package/dist/utils/file-systems.js +20 -0
- package/dist/utils/harness-id.d.ts +4 -1
- package/dist/utils/harness-id.js +4 -1
- package/dist/utils/media-types.d.ts +30 -0
- package/dist/utils/media-types.js +128 -0
- package/dist/utils/memory.d.ts +64 -0
- package/dist/utils/memory.js +139 -0
- package/dist/utils/runtime-limits.d.ts +280 -0
- package/dist/utils/runtime-limits.js +585 -0
- package/dist/utils/runtime-tools.d.ts +8 -16
- package/dist/utils/runtime-tools.js +8 -27
- package/dist/utils/sandbox.d.ts +4 -1
- package/dist/utils/sandbox.js +4 -1
- package/package.json +6 -5
- package/dist/definition/deferred-tools.d.ts +0 -27
- package/dist/definition/deferred-tools.js +0 -82
- package/dist/definition/runtime-manifest.d.ts +0 -30
- package/dist/definition/runtime-manifest.js +0 -132
- package/dist/definition/sandbox-tools.d.ts +0 -5
- package/dist/definition/sandbox-tools.js +0 -109
- package/dist/definition/skill-tools.d.ts +0 -23
- package/dist/definition/skill-tools.js +0 -76
package/dist/compatibility.js
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
export { hashManifest } from "./utils/hash.js";
|
|
2
2
|
/**
|
|
3
|
+
* Protocol 17: a queue per session (track T4, D76). A message sent while the session's turn runs,
|
|
4
|
+
* or while it waits on an approval, an answer or an uncertain call, is queued
|
|
5
|
+
* (`{status: "queued", queuedMessageId, position}`, `message.queued`) instead of refused, unless
|
|
6
|
+
* it asks `delivery: "reject"`; the refusal now has a code, `409 session_busy`. When the turn ends
|
|
7
|
+
* (completed, failed or cancelled), every queued message starts one turn, in order, each its own
|
|
8
|
+
* user message (`queue.taken`); our engine's turn input for more than one is
|
|
9
|
+
* `{kind: "messages", messages}` (Harness API 5, additive). Past the Runtime limit
|
|
10
|
+
* `sessionQueuedMessages` a message is `429 queue_full`. Session reads count `queuedMessages`. The
|
|
11
|
+
* Host serves protocol 16 and 17: a message from a protocol 16 client is `reject` unless it says
|
|
12
|
+
* otherwise, so its sessions answer `409` as before.
|
|
13
|
+
* Protocol 16: Agents from one manifest (track T2), a fresh start. An agent manifest (v8) is one
|
|
14
|
+
* versioned document at `/v1/agent-manifests/{name}` with a `harness` section (what runs inside
|
|
15
|
+
* the loop, including the harness's id) and a `runtime` section (what an environment manifest
|
|
16
|
+
* said); the Runtime checks the two against each other when it is saved
|
|
17
|
+
* (`422 manifest_inconsistent`), so `requires` and `409 environment_unsuitable` are gone, and so
|
|
18
|
+
* are agent definitions (`PUT /v1/agents/:id` with a v7 manifest) and environment manifests.
|
|
19
|
+
* Environments are Agents: `/v1/agents/{id}` (with `.../events`, `stop`, `reset`, `snapshot`,
|
|
20
|
+
* `restore`, `versions`, `fork` and `secrets`) is made from a saved manifest only, records it as
|
|
21
|
+
* tracking (`name`) or pinned (`name@n`) into `resolvedVersion`, the version it runs. An Agent
|
|
22
|
+
* evolves (track T3, D73): a `PUT` naming another version of its manifest moves it (`dryRun`
|
|
23
|
+
* answers the plan), a save moves every Agent that tracks the manifest, and each turn takes the
|
|
24
|
+
* version its Agent runs when it starts; a runtime change waits for a pod's next start, and its
|
|
25
|
+
* kind, harness and storage are fixed (`409 agent_fixed_field`). Reads add `state`
|
|
26
|
+
* (`working`, `sleeping`, `input_required`, `failing`, `paused`) and `attention`, and the
|
|
27
|
+
* compute's state moves to `compute.state`. Every session belongs to one Agent:
|
|
28
|
+
* `PUT /v1/sessions/{id}` takes `{ agent, ownerUserId, info }` and pins the manifest version its
|
|
29
|
+
* Agent runs; no session is special (D71). Error codes, event types (`agent.*`), the scopes
|
|
30
|
+
* (`agents:write`, `agent-manifests:write`) and identity-file grants (`agents`) say Agent. Model
|
|
31
|
+
* budget scope `agent` is `manifest`. Harness API 5: `turn.start.agent` replaces
|
|
32
|
+
* `turn.start.environment`. Sessions opened before protocol 16 are closed (`protocol_16`) and
|
|
33
|
+
* stay readable; Environments, their disks and vaults are gone. The Host serves protocol 16 only.
|
|
34
|
+
* Protocol 15: the harness boundary, a fresh start. Model-facing work belongs to the harness. Our
|
|
35
|
+
* engine's `read_artifact` and `save_artifact` run in our harness, over the Harness API's new
|
|
36
|
+
* artifact seam (`artifact.read`, `artifact.write`; Harness API 4), so a session's pinned
|
|
37
|
+
* `runtime` block no longer carries them, and those names are no longer reserved: an author tool
|
|
38
|
+
* may take one, though our harness then refuses the turn. A `tool.completed` of either says kind
|
|
39
|
+
* `harness`. Files reach the model by the harness's decision: a message may name any file
|
|
40
|
+
* within the artifact size limits (no more `422 attachment_unsupported`), `turn.start.model`
|
|
41
|
+
* describes the model the turn uses (what it reads, its window), and the Model Gate only fetches
|
|
42
|
+
* the artifacts a call names and translates the call, refusing a part the provider cannot take
|
|
43
|
+
* (`unsupported_input`). A `ModelCall` has no `outputSchema`: a harness writes its own JSON
|
|
44
|
+
* instruction and parses the answer. The harness names a session's MCP tools, defers them and
|
|
45
|
+
* shapes tool results: `turn.start.mcp` states what the servers listed, raw, and every MCP tool
|
|
46
|
+
* call names its identity (`target: {kind: "mcp", server, tool}`), which tool policy and approval
|
|
47
|
+
* key on (a policy rule with `__` in its `tool` refuses every call). The record refuses an
|
|
48
|
+
* outcome past `limits.recordEntryBytes`. Sessions pinned before protocol 15 must be recreated.
|
|
49
|
+
* The Host serves protocol 15 only.
|
|
3
50
|
* Protocol 14: environment manifests (D63 to D65). `/v1/environment-manifests/{name}` holds
|
|
4
51
|
* named, versioned definitions of a kind of Environment, saved like agents (with `If-Match` and
|
|
5
52
|
* `?dryRun=true`), and `PUT /v1/environments/{id}` takes `manifest: "name"` or `"name@n"`. An
|
|
@@ -55,7 +102,7 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
55
102
|
* it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
|
|
56
103
|
* that remains; a client that requires `action-endpoints` is refused by the feature check.
|
|
57
104
|
*/
|
|
58
|
-
export const PROTOCOL_VERSION =
|
|
105
|
+
export const PROTOCOL_VERSION = 17;
|
|
59
106
|
/** What a client of this protocol requires of a Host. */
|
|
60
107
|
export const PROTOCOL_FEATURES = [
|
|
61
108
|
"studio-principal",
|
|
@@ -72,18 +119,7 @@ export const PROTOCOL_FEATURES = [
|
|
|
72
119
|
* metadata at `/.well-known/oauth-protected-resource` when it has trusted issuers.
|
|
73
120
|
*/
|
|
74
121
|
"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
|
-
*/
|
|
122
|
+
/** Protocol 12: the model catalog and provider list say which inputs each model reads. */
|
|
87
123
|
"model-inputs",
|
|
88
124
|
/**
|
|
89
125
|
* Protocol 13: agent manifest v7 has no capabilities (its instructions, tools, skills and
|
|
@@ -92,11 +128,26 @@ export const PROTOCOL_FEATURES = [
|
|
|
92
128
|
*/
|
|
93
129
|
"flat-manifest",
|
|
94
130
|
/**
|
|
95
|
-
* Protocol
|
|
96
|
-
*
|
|
97
|
-
*
|
|
131
|
+
* Protocol 15: the harness boundary. `read_artifact` and `save_artifact` are our harness's
|
|
132
|
+
* tools, not the Runtime's: a session's pinned `runtime` block no longer carries them, and an
|
|
133
|
+
* author tool may take their names. MCP tools are named by the harness and identified by
|
|
134
|
+
* `{server, tool}`: tool policy rules and approvals name them so.
|
|
98
135
|
*/
|
|
99
|
-
"
|
|
136
|
+
"harness-boundary",
|
|
137
|
+
/**
|
|
138
|
+
* Protocol 16: agent manifests (`/v1/agent-manifests/{name}`, v8, with a harness and a runtime
|
|
139
|
+
* section checked against each other at save) and Agents (`/v1/agents/{id}`, kinds `virtual`,
|
|
140
|
+
* `pod` and `none`, each with one vault), made from one manifest version, with a derived
|
|
141
|
+
* `state`; every session runs on an Agent; token callers carry Agent grants checked at every
|
|
142
|
+
* turn start, and `agents:write` lets a subject create, change and delete the Agents it is
|
|
143
|
+
* granted.
|
|
144
|
+
*/
|
|
145
|
+
"agents",
|
|
146
|
+
/**
|
|
147
|
+
* Protocol 17: a queue per session (D76). A message to a busy session is queued unless it asks
|
|
148
|
+
* `delivery: "reject"`, and the busy refusal is `409 session_busy`.
|
|
149
|
+
*/
|
|
150
|
+
"session-queue",
|
|
100
151
|
];
|
|
101
152
|
/**
|
|
102
153
|
* Host features no client requires: a client that uses one checks the Host's `/health`
|
|
@@ -156,13 +207,14 @@ export const OPTIONAL_HOST_FEATURES = [
|
|
|
156
207
|
"artifact-reads",
|
|
157
208
|
];
|
|
158
209
|
/**
|
|
159
|
-
* What this Host serves: protocol
|
|
160
|
-
*
|
|
161
|
-
*
|
|
210
|
+
* What this Host serves: protocol 16 and 17. Protocol 16 replaced agent definitions and
|
|
211
|
+
* Environments with agent manifests and Agents, so an older client is answered `426` naming the
|
|
212
|
+
* protocol it needs rather than routes it cannot use. Protocol 17 is additive: a protocol 16
|
|
213
|
+
* client's messages default to `delivery: "reject"`.
|
|
162
214
|
*/
|
|
163
215
|
export const HOST_PROTOCOL = {
|
|
164
|
-
min:
|
|
165
|
-
max:
|
|
216
|
+
min: 16,
|
|
217
|
+
max: 17,
|
|
166
218
|
features: [...PROTOCOL_FEATURES, ...OPTIONAL_HOST_FEATURES],
|
|
167
219
|
};
|
|
168
220
|
export const DEFINITION_SCHEMA_VERSION = 2;
|
|
@@ -211,21 +263,44 @@ export const ERROR_CODES = [
|
|
|
211
263
|
"invalid_request",
|
|
212
264
|
/** A route that acts for a person was called without one (`Nylorun-Subject`). */
|
|
213
265
|
"subject_required",
|
|
214
|
-
/** A token caller's
|
|
215
|
-
"
|
|
266
|
+
/** A token caller's Agent grants do not reach the Agent. */
|
|
267
|
+
"agent_not_granted",
|
|
268
|
+
/**
|
|
269
|
+
* A message to a session whose turn runs, or that waits on an approval, an answer or an
|
|
270
|
+
* uncertain call, sent with `delivery: "reject"` (protocol 17): `409`. Without it the message is
|
|
271
|
+
* queued.
|
|
272
|
+
*/
|
|
273
|
+
"session_busy",
|
|
274
|
+
/**
|
|
275
|
+
* The session already holds the Runtime limit `sessionQueuedMessages` queued messages
|
|
276
|
+
* (protocol 17): `429`. They start a turn when the running one ends.
|
|
277
|
+
*/
|
|
278
|
+
"queue_full",
|
|
279
|
+
/**
|
|
280
|
+
* `POST /v1/agents/{id}/triggers/{triggerId}/resume` on an `at` trigger whose time has passed
|
|
281
|
+
* (track T4): `409`. Save a manifest version with a new time.
|
|
282
|
+
*/
|
|
283
|
+
"trigger_expired",
|
|
284
|
+
/** A signed delivery to a paused webhook trigger (D75): `409`; nothing runs. */
|
|
285
|
+
"trigger_paused",
|
|
286
|
+
/**
|
|
287
|
+
* A memory write whose `content_sha256` precondition no longer holds, or a path a folder or
|
|
288
|
+
* another memory already holds (track T5, D72): `409`. Read the memory again and write on top.
|
|
289
|
+
*/
|
|
290
|
+
"memory_conflict",
|
|
216
291
|
/** Disk work (snapshot, restore, stop, reset) while a turn runs, or a turn while a disk copy runs. */
|
|
217
|
-
"
|
|
218
|
-
/** The
|
|
219
|
-
"
|
|
220
|
-
/** The Tenant's placement keeps this session's harness off the host its
|
|
292
|
+
"agent_busy",
|
|
293
|
+
/** The Agent is gone, or its kind cannot run on this Runtime. */
|
|
294
|
+
"agent_unavailable",
|
|
295
|
+
/** The Tenant's placement keeps this session's harness off the host its Agent needs. */
|
|
221
296
|
"placement_refused",
|
|
222
|
-
/** A pod
|
|
223
|
-
"
|
|
297
|
+
/** A pod Agent's volume or node is gone: only `POST /v1/agents/{id}/reset` brings it back. */
|
|
298
|
+
"agent_lost",
|
|
224
299
|
/**
|
|
225
|
-
* The
|
|
300
|
+
* The Agent names an owner (`owner`) other than the session's owner: `403` to an
|
|
226
301
|
* application key; a caller acting for a person gets the opaque `404`.
|
|
227
302
|
*/
|
|
228
|
-
"
|
|
303
|
+
"agent_owner_mismatch",
|
|
229
304
|
/**
|
|
230
305
|
* The session's Environment runs another harness than the one the session pinned when it
|
|
231
306
|
* opened (track R4): its id was deleted and made again with another harness, or an
|
|
@@ -266,30 +341,25 @@ export const ERROR_CODES = [
|
|
|
266
341
|
*/
|
|
267
342
|
"credential_conflict",
|
|
268
343
|
/**
|
|
269
|
-
* A
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*/
|
|
273
|
-
"attachment_unsupported",
|
|
274
|
-
/**
|
|
275
|
-
* A `PUT /v1/environments/{id}` asked an existing Environment to run something else
|
|
276
|
-
* (protocol 14, D63): only its labels and owner guard may change. Fork it into a new
|
|
277
|
-
* Environment (`POST /v1/environments/{id}/fork`). `details.fields` names what differed.
|
|
344
|
+
* A move of an existing Agent (`PUT /v1/agents/{id}`, track T3) would change what is fixed for
|
|
345
|
+
* its life: its manifest's name, its kind, its harness or its storage (D73). `409`, with each in
|
|
346
|
+
* `details.fields`. Fork it into a new Agent (`POST /v1/agents/{id}/fork`) instead.
|
|
278
347
|
*/
|
|
279
|
-
"
|
|
348
|
+
"agent_fixed_field",
|
|
280
349
|
/**
|
|
281
|
-
* A secret write named a secret the
|
|
282
|
-
*
|
|
350
|
+
* A secret write named a secret the Agent's manifest does not declare (D64): `409`. Add the
|
|
351
|
+
* slot to the manifest's runtime section and move the Agent to the new version.
|
|
283
352
|
*/
|
|
284
353
|
"secret_not_in_manifest",
|
|
285
354
|
/**
|
|
286
|
-
*
|
|
287
|
-
* `details.
|
|
355
|
+
* An agent manifest whose harness and runtime sections do not fit each other (protocol 16):
|
|
356
|
+
* `422` when it is saved. `details.gaps` names each gap: a custom harness off a pod, a
|
|
357
|
+
* credential that is no declared slot of the right type, a sandbox the runtime does not give.
|
|
288
358
|
*/
|
|
289
|
-
"
|
|
290
|
-
/** No
|
|
359
|
+
"manifest_inconsistent",
|
|
360
|
+
/** No agent manifest has this name, or no version with this number. */
|
|
291
361
|
"manifest_not_found",
|
|
292
|
-
/** An
|
|
362
|
+
/** An agent manifest some Agent was made from cannot be deleted: `409`. */
|
|
293
363
|
"manifest_in_use",
|
|
294
364
|
/**
|
|
295
365
|
* `If-Match` named a version that is no longer the latest (D63): `412`. Read the manifest
|
|
@@ -309,6 +379,9 @@ export const ARTIFACT_ID_PATTERN = /^af_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
|
309
379
|
/**
|
|
310
380
|
* An application key's id: an operator key's name, which names its client (e.g. `backend`).
|
|
311
381
|
* `studio` is reserved for the key Studio derives from the admin key.
|
|
382
|
+
* An identifier's grammar is the protocol's (B15): it crosses the Runtime API, tokens and grants
|
|
383
|
+
* and means the same in every installation, so its length is a constant of protocol 15, not a
|
|
384
|
+
* setting.
|
|
312
385
|
*/
|
|
313
386
|
export const APPLICATION_KEY_ID_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
|
|
314
387
|
/**
|