@nylorun/core 0.20.0-beta → 0.22.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +2 -2
  3. package/dist/compatibility.d.ts +88 -13
  4. package/dist/compatibility.js +88 -13
  5. package/dist/contracts.d.ts +1328 -110
  6. package/dist/contracts.js +563 -163
  7. package/dist/define.d.ts +15 -13
  8. package/dist/define.js +11 -8
  9. package/dist/definition/approval.js +12 -14
  10. package/dist/definition/assemble.d.ts +6 -10
  11. package/dist/definition/assemble.js +48 -105
  12. package/dist/definition/bind-agent.d.ts +3 -4
  13. package/dist/definition/bind-agent.js +12 -30
  14. package/dist/definition/binding.d.ts +2 -2
  15. package/dist/definition/bound.d.ts +10 -10
  16. package/dist/definition/builder.d.ts +16 -20
  17. package/dist/definition/builder.js +29 -81
  18. package/dist/definition/code-tools.d.ts +3 -3
  19. package/dist/definition/code-tools.js +6 -21
  20. package/dist/definition/declaration.d.ts +4 -7
  21. package/dist/definition/declaration.js +29 -99
  22. package/dist/definition/{tools-capability.d.ts → deferred-tools.d.ts} +3 -13
  23. package/dist/definition/{tools-capability.js → deferred-tools.js} +2 -18
  24. package/dist/definition/delegate.d.ts +2 -4
  25. package/dist/definition/delegate.js +8 -10
  26. package/dist/definition/from.d.ts +7 -4
  27. package/dist/definition/from.js +72 -117
  28. package/dist/definition/helpers.d.ts +0 -7
  29. package/dist/definition/helpers.js +0 -5
  30. package/dist/definition/http-tool.d.ts +49 -5
  31. package/dist/definition/http-tool.js +167 -5
  32. package/dist/definition/implementations.d.ts +6 -8
  33. package/dist/definition/manifest.d.ts +11 -5
  34. package/dist/definition/manifest.js +26 -26
  35. package/dist/definition/mcp.d.ts +1 -52
  36. package/dist/definition/mcp.js +0 -52
  37. package/dist/definition/media-reference.d.ts +23 -0
  38. package/dist/definition/media-reference.js +26 -0
  39. package/dist/definition/removed.d.ts +3 -10
  40. package/dist/definition/removed.js +10 -17
  41. package/dist/definition/runtime-manifest.d.ts +30 -0
  42. package/dist/definition/runtime-manifest.js +132 -0
  43. package/dist/definition/sandbox-tools.d.ts +1 -1
  44. package/dist/definition/sandbox-tools.js +1 -1
  45. package/dist/definition/skill-tools.d.ts +13 -7
  46. package/dist/definition/skill-tools.js +23 -10
  47. package/dist/definition/trace.d.ts +18 -0
  48. package/dist/definition/trace.js +42 -0
  49. package/dist/definition/variant.d.ts +5 -4
  50. package/dist/definition/variant.js +18 -51
  51. package/dist/definition/workflow/runnable.js +1 -1
  52. package/dist/errors.d.ts +1 -1
  53. package/dist/harness-api/entries.d.ts +1 -0
  54. package/dist/harness-api/entries.js +1 -0
  55. package/dist/harness-api/gates.d.ts +1 -6
  56. package/dist/harness-api/gates.js +1 -3
  57. package/dist/harness-api/harness-api.schema.json +11 -92
  58. package/dist/harness-api/index.d.ts +2 -2
  59. package/dist/harness-api/index.js +2 -2
  60. package/dist/harness-api/mcp.d.ts +0 -4
  61. package/dist/harness-api/mcp.js +0 -2
  62. package/dist/harness-api/messages.d.ts +1 -3
  63. package/dist/harness-api/messages.js +1 -3
  64. package/dist/harness-api/schema.d.ts +5 -17
  65. package/dist/harness-api/schema.js +9 -6
  66. package/dist/index.d.ts +1 -1
  67. package/dist/manifest-schemas.d.ts +6 -0
  68. package/dist/manifest-schemas.js +46 -0
  69. package/dist/schemas/agent-manifest.schema.json +905 -0
  70. package/dist/schemas/environment-manifest.schema.json +349 -0
  71. package/dist/types/agent.d.ts +1 -1
  72. package/dist/types/manifest.d.ts +47 -24
  73. package/dist/types/model.d.ts +2 -2
  74. package/dist/types/observe.d.ts +5 -18
  75. package/dist/types/part.d.ts +25 -0
  76. package/dist/types/tool.d.ts +1 -1
  77. package/dist/types/transcript.d.ts +5 -0
  78. package/dist/utils/definition-files.d.ts +11 -6
  79. package/dist/utils/definition-files.js +19 -9
  80. package/dist/utils/runtime-tools.d.ts +19 -0
  81. package/dist/utils/runtime-tools.js +30 -0
  82. package/dist/utils/sandbox.d.ts +1 -1
  83. package/dist/utils/sandbox.js +1 -1
  84. package/package.json +9 -3
  85. package/dist/definition/capability.d.ts +0 -43
  86. package/dist/definition/capability.js +0 -82
  87. package/dist/definition/sandbox-capability.d.ts +0 -44
  88. package/dist/definition/sandbox-capability.js +0 -139
  89. package/dist/types/middleware.d.ts +0 -94
  90. /package/dist/types/{middleware.js → part.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,103 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.22.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - a0cf8b2: **HTTP tools take `GET` and `DELETE`, and URL path parameters.**
8
+
9
+ - `method` is `GET`, `POST` (default), `PUT`, `PATCH` or `DELETE`. `POST`, `PUT` and `PATCH` send the input as the JSON body, as before. `GET` and `DELETE` send no body: the input becomes the query string, after any query string written in the URL. An array repeats its name (`tag=a&tag=b`) and a `null` is left out.
10
+ - The URL's path may name input fields as `{field}`, as in `https://api.example.com/orders/{orderId}`. Each value is percent-encoded into the path and is not sent again in the body or query string. A value that is empty, `.` or `..`, or not a string, number or boolean is refused before the call is sent (`tool.invalid-input`).
11
+ - `http()` and the manifest contract check a tool against its input schema. Each `{field}` must be a required scalar property. For `GET` and `DELETE`, a property must not be an object and must not repeat a query parameter the URL already sets.
12
+ - An HTTP verifier still takes only `POST`, `PUT` or `PATCH` and a URL without `{field}` parameters, because it is sent `{ input, output, iteration }` as a body. A credential with `via` cannot serve a tool with `{field}` parameters (`http.credential`).
13
+ - core exports `httpToolRequest`, which maps a call's input to the request, and `httpPathParameters`. The Runtime's outbound `post()` is now `send()`, which can send a request without a body.
14
+
15
+ ### Patch Changes
16
+
17
+ - 620072d: **Docs and schemas match what the CLI and the Runtime do.**
18
+
19
+ - `@nylorun/core`: the environment manifest's JSON Schema (`@nylorun/core/schemas/environment-manifest.json`) takes the CLI's `{ path, from }` `files` entry, so an editor no longer flags a manifest that `nylorun environments manifests save` accepts. The Runtime's own schema is unchanged: the CLI turns the folder into `{ path, files }` before saving. `manifest_changed` says to save without `If-Match` (`--if-match`, `ifMatch`); no command takes `--force`.
20
+ - Tool names, skill names and MCP server names are each unique within their kind, as the builder and the Runtime check; a tool, a skill and a server may share a name. The docs said they were unique across kinds.
21
+ - `harness_mismatch` is described as what it is since protocol 14: an Environment's harness is fixed for its life (fork onto a manifest version to run another), and a session's turn is refused when its Environment id was deleted and made again with another harness, or an Environment changed in place before protocol 14 applies that change.
22
+ - `@nylorun/agents`: the README names `nylorun environments list | delete`, not `nylorun local sandbox ls | rm`.
23
+ - MIGRATION.md no longer offers a tool's `approval`, removed in protocol 11, as a replacement for step middleware.
24
+
25
+ ## 0.21.0-beta
26
+
27
+ ### Minor Changes
28
+
29
+ - 3a32a57: **Files by hash and images by digest (Q6, Q14).** An Environment's `files` entry may name files by content hash, and a pod Environment runs its image by digest once a pod ran it.
30
+
31
+ - **Files by hash.** `{ path, files: { "<relative path>": "sha256:<hex>" } }` copies each definition file the Tenant holds (`PUT /v1/files/sha256:<hex>`, at most 10 MiB each, at most 1000 per entry) under `path`, before `setup`. A file the Tenant does not hold is refused when the manifest is saved or the Environment made. The engine reads them as a folder through `host/files/{index}`. `@nylorun/agents`: `environmentFiles(path, contents)` hashes them, and `manifests.save(manifest, { files })` and `plan()` upload those the Runtime lacks.
32
+ - **Images by digest.** The sandboxes service reports the workload container's `imageID`; the first time a pod is ready the Runtime records it (`pod.imageDigest` in the view) and every later apply runs that digest, so a stop, relaunch or reset never pulls another image under the same tag. A fork pulls afresh. Migration 0027.
33
+ - **Studio** lists files by hash on the Environment page.
34
+
35
+ - af90d1e: **Forks: how an Environment gets a new manifest version (Q15, Q17).** `POST /v1/environments/{id}/fork` makes a new Environment `id` from a manifest version (default the source's manifest at its latest), its disk started from a version of the source's (`disk`: `latest`, the default, snapshots first; a version; or `empty`) and the secrets the new manifest declares copied inside the Runtime (`secrets: "none"` copies none): each value is unsealed and sealed again under the new vault, with the slot's binding. The source keeps what it runs, its disk and its sessions, and gets `environment.forked`; the new Environment's view has `forkedFrom`. `dryRun: true` answers the plan: the disk, the secrets copied and left behind, required slots still missing, the changes and the sessions that stay. Migration 0026.
36
+
37
+ - **Setup on a forked disk.** A pod fork onto other setup runs the new version's setup on the copied disk before its first turn: the engine connects first (the join answer's `afterSeed`), core writes the disk version through it, then the engine runs the setup, and turns wait until it reports it done. A fork onto the same setup, a restore and a lost-volume recovery skip it, as before.
38
+ - `@nylorun/core`: `ForkEnvironmentRequestSchema`, `EnvironmentForkPlanSchema`, `ForkEnvironmentResponseSchema`, `EnvironmentView.forkedFrom`, the `environment.forked` event and `forkedFrom` on `environment.created`.
39
+ - `@nylorun/agents`: `client.environments.fork(id, { id, manifest?, disk?, secrets?, labels?, ownerUserId? })` and `planFork()`.
40
+
41
+ - 104f24f: **Environment manifests, and Environments that never change (protocol 14, D63 to D65).** An Environment's definition can now be saved like an agent: a named, versioned environment manifest, written as a JSON file with a published schema and checked with a plan before it is saved. An Environment is made from one version and keeps it for life; a save changes no Environment. The Runtime speaks protocol 14 only; sessions, Environments and vaults carry over. See MIGRATION.md.
42
+
43
+ - **Environment manifests.** `PUT /v1/environment-manifests/{name}` saves the next version, or answers the latest `unchanged`; `If-Match: <version>` refuses a save over a newer one (`412 manifest_changed`), and `?dryRun=true` answers the plan (changes, errors, warnings, the Environments behind) and saves nothing. Each version records `savedBy`. `GET` (latest), `GET /v1/environment-manifests`, `.../versions`, `.../versions/{n}` and `DELETE` (refused while an Environment names it, `409 manifest_in_use`). Migration 0025.
44
+ - **Pinned Environments.** `PUT /v1/environments/{id}` takes `manifest: "name"` (the latest at creation) or `"name@n"`. On an existing Environment only `labels` and `ownerUserId` may change; fields that match are accepted, and anything else is `409 environment_immutable` with `details.fields`. The view's `recipe` is now `manifest`, with `manifestName`, `manifestVersion`, `manifestHash` and `slots`; `version` and `appliedVersion` no longer move. `environment.created` names the manifest.
45
+ - **Secret slots.** A manifest's (or inline) `secrets` declares each secret's name, type, binding, `required` and `description`, never a value. On such an Environment a secret write sends only `{ value }` (or `{ headers }`), the binding comes from the slot, and an undeclared name is `409 secret_not_in_manifest`.
46
+ - **`requires`.** Agent manifest v7 takes `requires: { sandbox?: "none" | "any" | "pod", secrets? }` (`.requires()` in `@nylorun/core/define`), checked when a session opens (`409 environment_unsuitable`, `details.missing`). Turn variants keep it.
47
+ - **Dry runs.** `PUT /v1/agents/{id}?dryRun=true` checks a definition and saves nothing (`dryRun: true` in the answer).
48
+ - `@nylorun/core`: `PROTOCOL_VERSION` 14, `HOST_PROTOCOL` `{ min: 14, max: 14 }`, required feature `environment-manifests`; `EnvironmentManifestSchema`, `EnvironmentSecretSlotSchema`, `parseEnvironmentManifestRef` and the view, plan and save schemas; JSON Schemas at `@nylorun/core/schemas/environment-manifest.json` and `@nylorun/core/schemas/agent-manifest.json` (`$id` `https://docs.nylorun.com/schemas/environment-manifest/v1.json` and `.../agent-manifest/v7.json`).
49
+ - `@nylorun/agents`: `client.environments.manifests` (`save`, `plan`, `get`, `list`, `versions`, `delete`), `environmentManifest()`, `EnvironmentInput` (was `EnvironmentRecipeInput`), value-only `secrets.put`, and `saveAgent(agent, { dryRun })`.
50
+ - **Studio** edits only an Environment's labels and owner guard, shows the manifest it was made from, and its setup and files are read-only.
51
+ - `nylorun environments put` help says what it runs never changes.
52
+
53
+ - c96b9a8: **An agent manifest is flat: manifest v7, a `runtime` block the Runtime writes, and tools known by name (protocol 13, Harness API 3).** A manifest listed capabilities, each with its own instructions, tools, skills and servers, and the Runtime added its own as more capabilities. Now the agent's parts sit at the top level, a plugin's skills and servers say which plugin brought them, and what the Runtime adds to a session's agent is one `runtime` block. A fresh start: the Runtime speaks protocol 13 only, so save your agents again; sessions from protocol 12 do not carry over. See MIGRATION.md.
54
+
55
+ - **Manifest v7.** `{ manifestSchemaVersion: 7, id, name?, description?, metadata?, outputSchema?, instructions?, tools?, skills?, mcpServers?, runtime? }`. Versions 3 to 6 and a `capabilities` field are refused with a message to rebuild. `SkillManifest.plugin` and `McpServerManifest.plugin` are `{ name, version? }`, set by `.plugin(dir)` from `plugin.json`.
56
+ - **The `runtime` block.** `{ sandbox?, tools?, instructions? }`, written only by the Runtime when a session pins the agent: the sandbox spec and tools, `save_artifact`, `read_artifact`, `load_skill` and `read_skill_resource`, the skill catalog and the notes that go with them. A definition or a turn variant that sets it is refused. `runtimeManifestFor` in `@nylorun/core/define` replaces `sandboxCapabilityManifest`, `artifactsCapabilityManifest` and `toolsCapabilityManifest`. `.skills()` and `.plugin()` no longer add the skill tools or the catalog.
57
+ - **Names.** An agent's tool may not take a Runtime tool's name (`RUNTIME_TOOL_NAMES`) or contain `__`, and names are unique across tools, skills and servers.
58
+ - **Turn variants** may remove tools, tighten MCP servers and change instructions, name, description and metadata. Skills are fixed, and a variant never sets `runtime` or changes `outputSchema`.
59
+ - **Tools by name.** `capabilityId` is gone from `tool.completed`, `mcp.discovered`, tool call rows, `EffectIntent`, gate requests, checkpoints and `SessionToolRef`. An HTTP tool's `server` is its URL's host. `Implementations` is `{ tools }`, keyed by tool name (`Agent.from(json, { tools })`), `AgentBinding.declarations` is `parts`, and observe events say `partId`.
60
+ - **Harness API 3.** `hello.capabilities` is `features`, and the `harness` pseudo-capability is gone: a native tool is known by its name, and one whose name is taken fails the turn at its start. `createHarness({ features })` in `@nylorun/harness`. `examples/harness-minimal` speaks it.
61
+ - **Studio.** The Agent tab shows instructions, tools (HTTP and agent badges), skills and MCP servers, each skill and server with its plugin's badge and a filter by plugin, and a session's Runtime section: its sandbox, tools and instructions.
62
+ - `@nylorun/core`: `PROTOCOL_VERSION` 13, `HOST_PROTOCOL` `{ min: 13, max: 13 }`, required feature `flat-manifest`, `HARNESS_API_VERSION` 3; `PluginLabel`, `RuntimeManifest`, `RUNTIME_TOOL_NAMES`, `isRuntimeToolName`, `runtimeToolOf`, `isSkillTool`, `SKILLS_USAGE` and `formatSkillCatalog` in `/define`.
63
+ - `@nylorun/agents`, `@nylorun/admin`, `@nylorun/studio` and `nylorun` send protocol 13.
64
+
65
+ - 94bf329: **Each model says what it reads, a file it does not read is refused before a turn starts, and a file is an artifact the model reads again after its turn (protocol 12).** A message could name any file, and a model that could not read it failed the turn at its model call; every later turn sent the file's bytes again. Now the Runtime knows what the Tenant's model reads, checks a message's files when it is accepted, and sends a file's bytes only in the turn that brought it. Protocol 12 only adds to 11: the Runtime serves both.
66
+
67
+ - **Model inputs.** A model reads `text`, and `image`, `pdf`, `office`, `audio` or `video` when its catalog says so or the operator adds it where its API carries it natively (images everywhere; PDFs on the Anthropic, OpenAI, Azure and Google APIs; Office documents on the OpenAI Responses APIs; audio and video on Google's APIs and OpenAI-compatible completions). `GET /v1/tenant/models` gives each model `inputs` and `addableInputs`, `GET /v1/tenant/providers` each provider's `inputs`, and **`PUT /v1/tenant/models/inputs`** (the Management API; `admin.models.setInputs({ provider, model, inputs })`) sets the added ones, kept in the Tenant setting `model.inputs`. The Model Gate gives the provider adapter a model with an added image, so it is sent.
68
+ - **A custom endpoint reads text only by default.** It used to be sent images. Set `settings.inputs` on `PUT /v1/tenant/model` (`image`, `pdf`, `audio`, `video`) for what yours reads; `office` is refused there. See MIGRATION.md.
69
+ - **The accept check.** A message naming a file of a type the Tenant's model does not read is `422 attachment_unsupported`, with `details.parts` (`artifactId`, `name`, `mediaType`, `reason`), and no turn starts. Only the type is checked, never the size. Without a model in the vault nothing is refused.
70
+ - **Files as artifacts.** After its turn a file is a reference line, `[Uploaded artifact "name" · <artifactId> v<n> · read_artifact to view]` (a tool's: `[Tool <name> returned artifact …]`). Our harness sends the turn's own files once more, as media, in one user message after the conversation, so a message reads the same in every later call. At the gate, an image the model reads is an image, a text file a `<file>` block, and any other file, or one that cannot be read, a note: no file fails a call. PDFs, Office documents, audio and video are notes until the gate sends them natively.
71
+ - **`read_artifact` for every agent.** Every agent's session has it (an agent that declares its own keeps it), so every agent session pins its definition with it added. It takes a `version`, reads the Tenant-wide artifacts the session's messages named, and shows any file the Tenant's model reads; one it does not read fails `artifact.unsupported`.
72
+ - **Compaction** keeps the summarized part's reference lines (`files` on the compaction entry), and counts the turn's files by type and size in its token estimate.
73
+ - `@nylorun/core`: `PROTOCOL_VERSION` 12, required feature `model-inputs`, `HOST_PROTOCOL` `{ min: 11, max: 12 }`, error code `attachment_unsupported`; `MODEL_INPUTS`, `ModelInputSchema`, `PutModelInputsRequestSchema`, `ModelInputsViewSchema`, `CustomModelSettings.inputs`; `mediaReferenceLine` and `mediaReferenceOf` in `/define`; `TranscriptCompactionEntry.files`.
74
+ - `@nylorun/agents`, `@nylorun/studio` and `nylorun` send protocol 12.
75
+
76
+ - b5ea2b5: **An agent is its manifest: step middleware and capability bundles are removed from authoring.** The Runtime already refused middleware; now the local engine runs none either, and an agent is built only from the builder's own methods. No protocol change. See MIGRATION.md.
77
+
78
+ - **Removed:** `.use()`, `.capability()`, `capability()`, `CapabilityBuilder`, `middleware()`, `model()`, `StepMiddleware`, `StepRequest`, `StepResponse`, and `Implementations[id].middleware`. To reuse tools and instructions, write a function that adds them; a bundle you publish is an Agent Plugin.
79
+ - **`@nylorun/agents`:** the standalone `skills()`, `plugin()` and `mcp()` factories are removed; use `.skills(dir)`, `.plugin(dir)` and `.mcp(servers)`. `.skills()` takes no options: the part takes the folder's name.
80
+ - **`@nylorun/harness`:** each step offers the definition's tools and instructions in order. The `middleware.entered`, `middleware.completed` and `middleware.lease-violation` observe events are gone, and a model request carries no `model` directive or runtime context items.
81
+
82
+ - aff9bb8: **Sessions on one Environment run their sandbox commands at the same time, and each version of a skill has its own folder (D66).** The SandboxManager ran every call on a workspace one at a time, whichever session sent it, so parallel turns would still have queued at every command. Now each session's calls run in the order it sends them and different sessions' calls overlap; opening, stopping and removing a workspace run alone, after the calls running.
83
+
84
+ - **Skill folders.** A skill's files are mounted at `/skills/<name>@<hash>/` (`skillFolderOf` in `@nylorun/core/define`, the hash from its canonical file map), written once and never replaced, so agents with different versions of one skill share an Environment. An agent used as a tool gets its own version too. The instructions, `load_skill`'s `sandboxPath` and skill attribution on `tool.completed` follow the folder.
85
+
86
+ - f44c018: **Sessions on one Environment run their turns at the same time, and egress is recorded on the Environment (protocol 14, D66, D67).** A second session's turn on an Environment was refused with `409 environment_busy` until the first ended. Now any session on it may start a turn while others run; one turn per session stays. Which sessions work on one disk, and when, is the app's call. See MIGRATION.md, "Parallel turns, and egress on the Environment".
87
+
88
+ - **Turns.** `checkEnvironmentTurn` no longer refuses a turn because another session's turn runs, and the flow-tree exception is gone. `environment_busy` still answers stop, reset, snapshot and restore while any turn runs, and a turn while a disk copy runs.
89
+ - **Egress.** Every connection through egress-gate, allowed or refused, is `environment.egress` on the Environment's stream, with `runningTurns: [{ sessionId, turnId }]`, the turns running when it opened (at most 16). `egress.connection` leaves the session event catalog, and turn traces carry no `CONNECT` span.
90
+ - **Reading it.** `GET /v1/environments/{id}/events` takes `types` (comma-separated), `since` and `until` (ISO times); `client.environments.events(id, { types, since, until })` in `@nylorun/agents`, and `nylorun environments events <id> --types --since --until`.
91
+ - `@nylorun/core`: `EgressRunningTurnSchema`, `EgressRunningTurn`; `EgressConnectionPayloadSchema` gains `runningTurns`.
92
+
93
+ - c8e640b: **A tool call is traced from the log alone to its skill or MCP server and the plugin that brought it.** No protocol change beyond 13. See MIGRATION.md.
94
+
95
+ - **`tool.completed`** gains `skill` and `plugin` (`{ name, version? }`), and tool call rows (`GET /v1/sessions/{id}/calls/tool`, `session.toolCalls()`) gain `skill` and `plugin`, `null` when there is none. An MCP call gets its server's plugin. `load_skill` and `read_skill_resource` get the skill they name, and a sandbox tool whose input names `/skills/<name>/` gets that skill; both get the skill's plugin.
96
+ - **`kind: "harness"`** (`TOOL_CALL_KINDS`): a tool the turn's harness declared in `hello.features.tools`. Such a call said `platform` before.
97
+ - **`mcp.discovered`** names each server's `plugin`.
98
+ - `@nylorun/core`: `skillOfToolCall`, `pluginOf` and `ToolCallTrace` in `/define`.
99
+ - **Studio** shows each tool call's kind, server or skill, and a plugin badge, in the chat and the event details and summaries, and the plugin of each server `mcp.discovered` lists.
100
+
3
101
  ## 0.20.0-beta
4
102
 
5
103
  ### Minor Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Shared portable agent definitions and runtime protocol contracts. No engine,
4
4
  HTTP client, Node host or SDK dependencies.
5
5
 
6
- - `/define`: `Agent`, `tool`, capabilities, schemas and explicit local bindings.
6
+ - `/define`: `Agent`, `tool`, the manifest and its `runtime` block (`runtimeManifestFor`), schemas and explicit local bindings.
7
7
  - `/contracts`: runtime request, event, action and response schemas.
8
8
  - `/compatibility`: protocol/definition versions and canonical manifest hashing.
9
9
  - `/transport`: what every Runtime client does on the wire: the `/health`
@@ -13,7 +13,7 @@ HTTP client, Node host or SDK dependencies.
13
13
  Nylorun home, a local Tenant's Host root, the Project root, and the Project
14
14
  link and credentials, validated with `ProjectLinkFileSchema` and
15
15
  `ProjectCredentialsFileSchema`. Every reader of the link uses it (the SDK,
16
- `@nylorun/admin`, `nylorun` and `nylo`): the Project is the nearest directory
16
+ `@nylorun/admin` and `nylorun`): the Project is the nearest directory
17
17
  with `.nylorun/`, from the working directory upwards, never the home
18
18
  directory or above it; a broken file throws `ProjectFileError`.
19
19
  - Root: shared contracts and types; no authoring or execution entry points.
@@ -1,13 +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.
3
28
  * Protocol 11: Environments (R2d, D55, D56), a fresh start. `/v1/environments/{id}` replaces
4
29
  * `/v1/sandboxes`: an Environment is one sandbox (kind `virtual`, `pod` or `none`) with a recipe
5
30
  * that can change and one vault, written on the Runtime API
6
31
  * (`PUT /v1/environments/{id}/secrets/{name}`). Sessions name an `environment` or nothing; the
7
32
  * session fields `sandbox`, `vaultIds` and `credentialSelections`, the Tenant's default sandbox,
8
33
  * user and installation vaults and `/v1/tenant/vaults` are gone. Error codes, event types, the
9
- * scope (`environments:write`) and identity-file grants (`environments`) say Environment. The
10
- * Host accepts protocol 11 only: an older client is answered `426`.
34
+ * scope (`environments:write`) and identity-file grants (`environments`) say Environment. An
35
+ * older client is answered `426`.
11
36
  * Protocol 10: MCP credential custody leaves OSS (D49). The vault credential type `oauth`, the
12
37
  * MCP OAuth connect (`/v1/tenant/vaults/{vaultId}/oauth/start`, `/v1/oauth/callback`) and the
13
38
  * credential resolver are gone: a session's MCP servers and HTTP tools reach their credentials
@@ -30,7 +55,7 @@ export { hashManifest } from "./utils/hash.js";
30
55
  * it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
31
56
  * that remains; a client that requires `action-endpoints` is refused by the feature check.
32
57
  */
33
- export declare const PROTOCOL_VERSION = 11;
58
+ export declare const PROTOCOL_VERSION = 14;
34
59
  /** What a client of this protocol requires of a Host. */
35
60
  export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts",
36
61
  /**
@@ -51,7 +76,25 @@ export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts
51
76
  * carry Environment grants checked at every turn start, and `environments:write` lets a
52
77
  * subject create, change and delete the Environments it is granted.
53
78
  */
54
- "environments"];
79
+ "environments",
80
+ /**
81
+ * Protocol 12: the model catalog and provider list say which inputs each model reads, and a
82
+ * message naming a file the Tenant's model does not read is refused with
83
+ * `422 attachment_unsupported`.
84
+ */
85
+ "model-inputs",
86
+ /**
87
+ * Protocol 13: agent manifest v7 has no capabilities (its instructions, tools, skills and
88
+ * MCP servers are top-level), a session's pinned manifest carries the Runtime's `runtime`
89
+ * block, and tool calls, MCP servers and HTTP calls are named without capability ids.
90
+ */
91
+ "flat-manifest",
92
+ /**
93
+ * Protocol 14: environment manifests (`/v1/environment-manifests/{name}`), Environments made
94
+ * from one version and never changed after creation, secret slots, and an agent manifest's
95
+ * `requires`, checked when a session opens.
96
+ */
97
+ "environment-manifests"];
55
98
  export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
56
99
  /**
57
100
  * Host features no client requires: a client that uses one checks the Host's `/health`
@@ -65,10 +108,10 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
65
108
  * `POST /v1/a2a/agents/:agent` answers A2A 1.0 JSON-RPC for a subject, and
66
109
  * `GET /v1/a2a/agents/:agent/card` returns the agent's card without its interfaces.
67
110
  * `sandbox-pods`: Environments of kind `pod` run as agent-sandbox pods on the Tenant's cluster
68
- * (`nylorun sandbox enable`), with `POST /v1/environments/{id}/stop` and `/reset`, lifecycle
111
+ * (`nylorun local sandbox enable`), with `POST /v1/environments/{id}/stop` and `/reset`, lifecycle
69
112
  * events (`environment.running`, `.suspended`, `.relaunched`, `.lost`, `.reset`, `.failed`) and
70
113
  * the Tenant's `placement`.
71
- * `trusted-issuers`: the Tenant API accepts JWTs from the issuers of the Host's identity file
114
+ * `trusted-issuers`: the Runtime API accepts JWTs from the issuers of the Host's identity file
72
115
  * (`NYLORUN_IDENTITY_FILE`) as bearers, from servers and from browsers alike, with the
73
116
  * issuer's subject, scopes (and the issuer-only `studio`), agents and Environment grants; `GET
74
117
  * /v1/me` reports who any credential is.
@@ -101,9 +144,9 @@ export interface ProtocolRange {
101
144
  features: readonly string[];
102
145
  }
103
146
  /**
104
- * What this Host serves: protocol 11 only (R2d Q3). Protocol 11 removed routes and session fields
105
- * older clients send, so an older client is answered `426` naming the protocol it needs rather
106
- * than a `404` or a `400` on a removed field.
147
+ * What this Host serves: protocol 14. Protocol 14 changed what `PUT /v1/environments/{id}`
148
+ * does to an existing Environment and the shape of its view, so an older client is answered
149
+ * `426` naming the protocol it needs rather than a `409` it cannot read.
107
150
  */
108
151
  export declare const HOST_PROTOCOL: ProtocolRange;
109
152
  export declare const DEFINITION_SCHEMA_VERSION = 2;
@@ -143,7 +186,7 @@ export declare const ERROR_CODES: readonly ["not_found",
143
186
  "subject_required",
144
187
  /** A token caller's Environment grants do not reach the Environment. */
145
188
  "environment_not_granted",
146
- /** Another session's turn holds the Environment: turns are serial per Environment. */
189
+ /** Disk work (snapshot, restore, stop, reset) while a turn runs, or a turn while a disk copy runs. */
147
190
  "environment_busy",
148
191
  /** The Environment is gone, or its kind cannot run on this Runtime. */
149
192
  "environment_unavailable",
@@ -157,8 +200,9 @@ export declare const ERROR_CODES: readonly ["not_found",
157
200
  */
158
201
  "environment_owner_mismatch",
159
202
  /**
160
- * The session's Environment now runs another harness than the one the session pinned when it
161
- * opened (track R4): open a new session to run on it.
203
+ * The session's Environment runs another harness than the one the session pinned when it
204
+ * opened (track R4): its id was deleted and made again with another harness, or an
205
+ * Environment changed in place before protocol 14 applied that change. Open a new session.
162
206
  */
163
207
  "harness_mismatch",
164
208
  /**
@@ -193,7 +237,38 @@ export declare const ERROR_CODES: readonly ["not_found",
193
237
  * `environment_secret` credentials would be bound to one host, or two `bearer` or `headers`
194
238
  * credentials to one URL.
195
239
  */
196
- "credential_conflict", "internal_error"];
240
+ "credential_conflict",
241
+ /**
242
+ * A message names a file the Tenant's model does not read (protocol 12): `422` at accept, and
243
+ * no turn starts. `details.parts` lists each refused file's `artifactId`, `name`, `mediaType`
244
+ * and `reason`.
245
+ */
246
+ "attachment_unsupported",
247
+ /**
248
+ * A `PUT /v1/environments/{id}` asked an existing Environment to run something else
249
+ * (protocol 14, D63): only its labels and owner guard may change. Fork it into a new
250
+ * Environment (`POST /v1/environments/{id}/fork`). `details.fields` names what differed.
251
+ */
252
+ "environment_immutable",
253
+ /**
254
+ * A secret write named a secret the Environment's manifest does not declare (D64): `409`.
255
+ * Add the slot to the manifest and make or fork an Environment from the new version.
256
+ */
257
+ "secret_not_in_manifest",
258
+ /**
259
+ * A session's agent requires what its Environment lacks (D65): `409` when the session opens.
260
+ * `details.missing` lists each gap (`sandbox`, `pod`, or `secret:<name>`).
261
+ */
262
+ "environment_unsuitable",
263
+ /** No environment manifest has this name, or no version with this number. */
264
+ "manifest_not_found",
265
+ /** An environment manifest some Environment was made from cannot be deleted: `409`. */
266
+ "manifest_in_use",
267
+ /**
268
+ * `If-Match` named a version that is no longer the latest (D63): `412`. Read the manifest
269
+ * again, or save without `If-Match` (the CLI's `--if-match`, the SDK's `ifMatch`).
270
+ */
271
+ "manifest_changed", "internal_error"];
197
272
  export type ErrorCode = (typeof ERROR_CODES)[number];
198
273
  export declare const TENANT_ID_PATTERN: RegExp;
199
274
  export declare const PRINCIPAL_ID_PATTERN: RegExp;
@@ -1,13 +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.
3
28
  * Protocol 11: Environments (R2d, D55, D56), a fresh start. `/v1/environments/{id}` replaces
4
29
  * `/v1/sandboxes`: an Environment is one sandbox (kind `virtual`, `pod` or `none`) with a recipe
5
30
  * that can change and one vault, written on the Runtime API
6
31
  * (`PUT /v1/environments/{id}/secrets/{name}`). Sessions name an `environment` or nothing; the
7
32
  * session fields `sandbox`, `vaultIds` and `credentialSelections`, the Tenant's default sandbox,
8
33
  * user and installation vaults and `/v1/tenant/vaults` are gone. Error codes, event types, the
9
- * scope (`environments:write`) and identity-file grants (`environments`) say Environment. The
10
- * Host accepts protocol 11 only: an older client is answered `426`.
34
+ * scope (`environments:write`) and identity-file grants (`environments`) say Environment. An
35
+ * older client is answered `426`.
11
36
  * Protocol 10: MCP credential custody leaves OSS (D49). The vault credential type `oauth`, the
12
37
  * MCP OAuth connect (`/v1/tenant/vaults/{vaultId}/oauth/start`, `/v1/oauth/callback`) and the
13
38
  * credential resolver are gone: a session's MCP servers and HTTP tools reach their credentials
@@ -30,7 +55,7 @@ export { hashManifest } from "./utils/hash.js";
30
55
  * it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
31
56
  * that remains; a client that requires `action-endpoints` is refused by the feature check.
32
57
  */
33
- export const PROTOCOL_VERSION = 11;
58
+ export const PROTOCOL_VERSION = 14;
34
59
  /** What a client of this protocol requires of a Host. */
35
60
  export const PROTOCOL_FEATURES = [
36
61
  "studio-principal",
@@ -54,6 +79,24 @@ export const PROTOCOL_FEATURES = [
54
79
  * subject create, change and delete the Environments it is granted.
55
80
  */
56
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",
57
100
  ];
58
101
  /**
59
102
  * Host features no client requires: a client that uses one checks the Host's `/health`
@@ -67,10 +110,10 @@ export const PROTOCOL_FEATURES = [
67
110
  * `POST /v1/a2a/agents/:agent` answers A2A 1.0 JSON-RPC for a subject, and
68
111
  * `GET /v1/a2a/agents/:agent/card` returns the agent's card without its interfaces.
69
112
  * `sandbox-pods`: Environments of kind `pod` run as agent-sandbox pods on the Tenant's cluster
70
- * (`nylorun sandbox enable`), with `POST /v1/environments/{id}/stop` and `/reset`, lifecycle
113
+ * (`nylorun local sandbox enable`), with `POST /v1/environments/{id}/stop` and `/reset`, lifecycle
71
114
  * events (`environment.running`, `.suspended`, `.relaunched`, `.lost`, `.reset`, `.failed`) and
72
115
  * the Tenant's `placement`.
73
- * `trusted-issuers`: the Tenant API accepts JWTs from the issuers of the Host's identity file
116
+ * `trusted-issuers`: the Runtime API accepts JWTs from the issuers of the Host's identity file
74
117
  * (`NYLORUN_IDENTITY_FILE`) as bearers, from servers and from browsers alike, with the
75
118
  * issuer's subject, scopes (and the issuer-only `studio`), agents and Environment grants; `GET
76
119
  * /v1/me` reports who any credential is.
@@ -113,13 +156,13 @@ export const OPTIONAL_HOST_FEATURES = [
113
156
  "artifact-reads",
114
157
  ];
115
158
  /**
116
- * What this Host serves: protocol 11 only (R2d Q3). Protocol 11 removed routes and session fields
117
- * older clients send, so an older client is answered `426` naming the protocol it needs rather
118
- * than a `404` or a `400` on a removed field.
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.
119
162
  */
120
163
  export const HOST_PROTOCOL = {
121
- min: 11,
122
- max: 11,
164
+ min: 14,
165
+ max: 14,
123
166
  features: [...PROTOCOL_FEATURES, ...OPTIONAL_HOST_FEATURES],
124
167
  };
125
168
  export const DEFINITION_SCHEMA_VERSION = 2;
@@ -170,7 +213,7 @@ export const ERROR_CODES = [
170
213
  "subject_required",
171
214
  /** A token caller's Environment grants do not reach the Environment. */
172
215
  "environment_not_granted",
173
- /** Another session's turn holds the Environment: turns are serial per Environment. */
216
+ /** Disk work (snapshot, restore, stop, reset) while a turn runs, or a turn while a disk copy runs. */
174
217
  "environment_busy",
175
218
  /** The Environment is gone, or its kind cannot run on this Runtime. */
176
219
  "environment_unavailable",
@@ -184,8 +227,9 @@ export const ERROR_CODES = [
184
227
  */
185
228
  "environment_owner_mismatch",
186
229
  /**
187
- * The session's Environment now runs another harness than the one the session pinned when it
188
- * opened (track R4): open a new session to run on it.
230
+ * The session's Environment runs another harness than the one the session pinned when it
231
+ * opened (track R4): its id was deleted and made again with another harness, or an
232
+ * Environment changed in place before protocol 14 applied that change. Open a new session.
189
233
  */
190
234
  "harness_mismatch",
191
235
  /**
@@ -221,6 +265,37 @@ export const ERROR_CODES = [
221
265
  * credentials to one URL.
222
266
  */
223
267
  "credential_conflict",
268
+ /**
269
+ * A message names a file the Tenant's model does not read (protocol 12): `422` at accept, and
270
+ * no turn starts. `details.parts` lists each refused file's `artifactId`, `name`, `mediaType`
271
+ * and `reason`.
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.
278
+ */
279
+ "environment_immutable",
280
+ /**
281
+ * A secret write named a secret the Environment's manifest does not declare (D64): `409`.
282
+ * Add the slot to the manifest and make or fork an Environment from the new version.
283
+ */
284
+ "secret_not_in_manifest",
285
+ /**
286
+ * A session's agent requires what its Environment lacks (D65): `409` when the session opens.
287
+ * `details.missing` lists each gap (`sandbox`, `pod`, or `secret:<name>`).
288
+ */
289
+ "environment_unsuitable",
290
+ /** No environment manifest has this name, or no version with this number. */
291
+ "manifest_not_found",
292
+ /** An environment manifest some Environment was made from cannot be deleted: `409`. */
293
+ "manifest_in_use",
294
+ /**
295
+ * `If-Match` named a version that is no longer the latest (D63): `412`. Read the manifest
296
+ * again, or save without `If-Match` (the CLI's `--if-match`, the SDK's `ifMatch`).
297
+ */
298
+ "manifest_changed",
224
299
  "internal_error",
225
300
  ];
226
301
  /** Crockford Base32 alphabet (lowercase); excludes i, l, o, u. */