@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,196 @@
|
|
|
1
1
|
# @nylorun/core
|
|
2
2
|
|
|
3
|
+
## 0.21.0-beta
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
- **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.
|
|
10
|
+
- **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.
|
|
11
|
+
- **Studio** lists files by hash on the Environment page.
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
15
|
+
- **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.
|
|
16
|
+
- `@nylorun/core`: `ForkEnvironmentRequestSchema`, `EnvironmentForkPlanSchema`, `ForkEnvironmentResponseSchema`, `EnvironmentView.forkedFrom`, the `environment.forked` event and `forkedFrom` on `environment.created`.
|
|
17
|
+
- `@nylorun/agents`: `client.environments.fork(id, { id, manifest?, disk?, secrets?, labels?, ownerUserId? })` and `planFork()`.
|
|
18
|
+
|
|
19
|
+
- 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.
|
|
20
|
+
|
|
21
|
+
- **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.
|
|
22
|
+
- **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.
|
|
23
|
+
- **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`.
|
|
24
|
+
- **`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.
|
|
25
|
+
- **Dry runs.** `PUT /v1/agents/{id}?dryRun=true` checks a definition and saves nothing (`dryRun: true` in the answer).
|
|
26
|
+
- `@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`).
|
|
27
|
+
- `@nylorun/agents`: `client.environments.manifests` (`save`, `plan`, `get`, `list`, `versions`, `delete`), `environmentManifest()`, `EnvironmentInput` (was `EnvironmentRecipeInput`), value-only `secrets.put`, and `saveAgent(agent, { dryRun })`.
|
|
28
|
+
- **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.
|
|
29
|
+
- `nylorun environments put` help says what it runs never changes.
|
|
30
|
+
|
|
31
|
+
- 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.
|
|
32
|
+
|
|
33
|
+
- **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`.
|
|
34
|
+
- **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.
|
|
35
|
+
- **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.
|
|
36
|
+
- **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`.
|
|
37
|
+
- **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`.
|
|
38
|
+
- **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.
|
|
39
|
+
- **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.
|
|
40
|
+
- `@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`.
|
|
41
|
+
- `@nylorun/agents`, `@nylorun/admin`, `@nylorun/studio` and `nylorun` send protocol 13.
|
|
42
|
+
|
|
43
|
+
- 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.
|
|
44
|
+
|
|
45
|
+
- **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.
|
|
46
|
+
- **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.
|
|
47
|
+
- **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.
|
|
48
|
+
- **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.
|
|
49
|
+
- **`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`.
|
|
50
|
+
- **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.
|
|
51
|
+
- `@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`.
|
|
52
|
+
- `@nylorun/agents`, `@nylorun/studio` and `nylorun` send protocol 12.
|
|
53
|
+
|
|
54
|
+
- 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.
|
|
55
|
+
|
|
56
|
+
- **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.
|
|
57
|
+
- **`@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.
|
|
58
|
+
- **`@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.
|
|
59
|
+
|
|
60
|
+
- 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.
|
|
61
|
+
|
|
62
|
+
- **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.
|
|
63
|
+
|
|
64
|
+
- 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".
|
|
65
|
+
|
|
66
|
+
- **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.
|
|
67
|
+
- **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.
|
|
68
|
+
- **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`.
|
|
69
|
+
- `@nylorun/core`: `EgressRunningTurnSchema`, `EgressRunningTurn`; `EgressConnectionPayloadSchema` gains `runningTurns`.
|
|
70
|
+
|
|
71
|
+
- 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.
|
|
72
|
+
|
|
73
|
+
- **`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.
|
|
74
|
+
- **`kind: "harness"`** (`TOOL_CALL_KINDS`): a tool the turn's harness declared in `hello.features.tools`. Such a call said `platform` before.
|
|
75
|
+
- **`mcp.discovered`** names each server's `plugin`.
|
|
76
|
+
- `@nylorun/core`: `skillOfToolCall`, `pluginOf` and `ToolCallTrace` in `/define`.
|
|
77
|
+
- **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.
|
|
78
|
+
|
|
79
|
+
## 0.20.0-beta
|
|
80
|
+
|
|
81
|
+
### Minor Changes
|
|
82
|
+
|
|
83
|
+
- e917bd6: **Bring your own harness: harness ids, harness-owned state, and who wrote each event (R4.1, R4.2, R4.4, R4.9).**
|
|
84
|
+
|
|
85
|
+
- **Harness ids and routing.** An Environment's `harness` takes any harness id (`^[a-z][a-z0-9-]{1,62}$`). It is no longer only `nylorun`.
|
|
86
|
+
- **The pin.** A session pins its harness when it opens: its Environment's harness, else `nylorun`. A flow always runs `nylorun`. `GET /v1/sessions/{id}` returns the pin as `harness`.
|
|
87
|
+
- **Routing.** Only a connection whose `hello.name` is that id takes the session's runs.
|
|
88
|
+
- **Our harness's name.** It now says `nylorun` in `hello`. A harness that says `@nylorun/harness` is refused with a message naming the new id, so an older harness image needs this Runtime's.
|
|
89
|
+
- **Placement.** It is keyed by the real harness id, and `"*": {hosts: []}` refuses any harness the map does not name.
|
|
90
|
+
- **Drift.** A turn on an Environment that now runs another harness is `409 harness_mismatch`; open a new session. For a pod Environment, a changed `harness` applies at the pod's next wake, like its image.
|
|
91
|
+
- **Per-harness tokens.** `nylorun-operate harness token put <id>` makes a custom harness container's own Harness API credential, bound to its id; `list` and `rm` manage them. `NYLORUN_HARNESS_TOKEN` stays ours, bound to `nylorun`.
|
|
92
|
+
- **A custom harness as a pod's image.** A pod Environment whose harness is not ours runs its `image` as the harness: the image's own entrypoint (`entrypoint: "image"` to the sandboxes service), with nothing copied in. It needs `image`.
|
|
93
|
+
- **Harness-owned state.** Core stores a harness's turn state as sent and never reads it. Our engine now aligns its state with the turn's manifest itself.
|
|
94
|
+
- **Limits for a custom harness.** Its state is at most 256 KiB, or its turn fails. It cannot pause for approvals in Harness API 2.
|
|
95
|
+
- **Native tools.** It may declare the tools it runs itself in `hello` (`capabilities.tools`). Their calls (capability `harness`) are journaled like built-ins, and the log records a real `tool.completed` instead of `tool.unavailable`.
|
|
96
|
+
- **Who wrote each event.** The writer sets an event's `source` and `evidence`; the event's type no longer decides them. Events written before this release still say `loop` or `api`.
|
|
97
|
+
- **`client`**: a command, with a new `principal` taken from its credential.
|
|
98
|
+
- **`harness`**: what a harness reported, with its harness id and `runId`. Evidence `claimed`.
|
|
99
|
+
- **`core`**: core's own logic. Evidence `observed`.
|
|
100
|
+
- **`effectId` on model calls.** `GET /v1/sessions/{id}/calls/model` returns each call's `effectId`, so a metered call joins the effect journal.
|
|
101
|
+
- **The published contract grows.** It adds `HarnessCheckpointSchema` (the checkpoint fields a harness reads), `NativeToolSchema`, the harness id helpers, `HARNESS_TOOLS_CAPABILITY`, `MAX_HARNESS_STATE_BYTES`, and the gate error codes `key_required` and `effect_not_journaled`. It also documents the effect context keys, the model request hash rule and how a turn's status maps to its output method.
|
|
102
|
+
|
|
103
|
+
- 5165451: **A pod's disk can start prepared, and every Environment's disk has versions (R2d steps 2 and 3).** Before, a new pod volume was empty and a disk could only be kept or reset. Now:
|
|
104
|
+
|
|
105
|
+
- **Setup and input files** (pods, Host feature `environment-setup`): `PUT /v1/environments/{id}` takes `files` (versions of Tenant-wide artifacts, copied in: a file at its `path`, a folder under it) and `setup` (commands run in order with `/bin/sh -c`, `cwd` default `/workspace`, `timeout` default 10m and at most 30m, at most 16 of each). They run once per new disk, after the pod's engine joins and before its first turn, with the Environment's variables, secrets (as the sentinel) and egress. A failed command fails the pod (`observed: failed`, reason `setup: command N …`, an `environment.failed` event with the exit code and the end of the output) and the turn waiting for it; the next turn start runs the setup again. A virtual Environment refuses both with a `400`.
|
|
106
|
+
- **Disk versions** (Host feature `environment-disk-versions`): `POST /v1/environments/{id}/snapshot` keeps a version of the disk between turns (`/workspace`, and a pod's `/harness` but the engine's own files) as a version of a folder artifact the Environment owns, with modes, modification times, links and empty directories (folder manifest `nylorun.folder.v2`); each file's bytes are stored once, and an unchanged disk makes no version. `POST .../restore` puts a version back: a virtual Environment at once, a pod on a new volume seeded before its next turn (`disk.operation` in the view meanwhile; turns wait). `PUT` with `from: { environment, version }` creates an Environment from another's version. `GET .../versions` and `DELETE .../versions/{n}` list and delete them; their trees, files, diffs and zips read through `/v1/artifacts`. A lost pod volume with a version is recovered from the latest one instead of refusing turns until a reset. Snapshot and restore during a turn are `409 environment_busy`. `EnvironmentView.disk` gives the latest version and the copy in progress. Migration `0021_disk_versions`.
|
|
107
|
+
- `@nylorun/agents`: `client.environments.snapshot`, `restore`, `versions` and `deleteVersion`; `put` takes `setup`, `files` and `from`.
|
|
108
|
+
|
|
109
|
+
- 35e29b7: **Environments replace sandboxes and vaults (protocol 11). This is a fresh start: upgrading deletes your sandboxes, their disks and every vault except the model's, and closes every open session (its history stays readable).** List what you have before upgrading; see "Environments replace sandboxes and vaults" in MIGRATION.md.
|
|
110
|
+
|
|
111
|
+
An Environment is where sessions run: one sandbox (kind `virtual`, `pod` or `none`) with a recipe that can change, and one vault of secrets for its shell, MCP servers and HTTP tools. The app decides who uses which Environment; the Runtime keeps it by id and holds its lifecycle.
|
|
112
|
+
|
|
113
|
+
- `@nylorun/core`: protocol 11 (the Host accepts 11 only; older clients get `426`), required feature `environments`. `PutEnvironmentRequestSchema`, `EnvironmentViewSchema` (`recipe`, `version`, `appliedVersion`, `ownerUserId`, `lastUsedAt`), `PutEnvironmentSecretRequestSchema`, `EnvironmentSecretViewSchema`, `ENVIRONMENT_EVENT_TYPES`, `TenantEnvironmentsConfigSchema`, `environmentGranted`. `PutSessionRequest.environment` replaces `sandbox`, `vaultIds` and `credentialSelections`; `SessionView.environment` replaces the session's sandbox and vault fields. Error codes `environment_busy`, `environment_unavailable`, `environment_lost`, `environment_not_granted`, `environment_owner_mismatch` and `session_closed` (the `sandbox_*` codes and `sandbox_expired` are gone); session events `environment.state`, `environment.exec` and `environment.attached`; scope `environments:write`. Credential coverage takes `environmentId` and answers `covered` or `missing`; the MCP preview takes `environmentId`. The vault Management schemas are removed.
|
|
114
|
+
- `@nylorun/runtime`: `/v1/environments/{id}` replaces `/v1/sandboxes/{id}`: `PUT` creates, finds or changes one (`kind` and `storage` fixed; a recipe change bumps `version`; a pod gets a new image or resources at its next start from stopped, a new allowlist within seconds), with list by label, events (`nylorun.environment-event/1`), stop, reset and delete. Each Environment owns one vault: `PUT|GET|DELETE /v1/environments/{id}/secrets/{name}` on the Runtime API, write-only, with a second credential for a host or URL refused at the write (`409 credential_conflict`). An optional owner guard (`ownerUserId`) is checked when a session opens and at every turn start. `lifecycle.deleteAfter` deletes an Environment unused that long; TTL and `onExpiry` are gone. Kind `none` holds secrets for MCP-only agents. `/v1/tenant/vaults`, user and installation vaults, the Tenant's default sandbox, inline sandboxes and `{ session }` sharing are removed. The Tenant setting is `environments.config` (`limits.environments`). Identity files grant `environments:` (an old `sandboxes:` key, or `sandboxes:write`, stops the Runtime with a message naming the new key). Migration `0020_environments`.
|
|
115
|
+
- `@nylorun/harness`: the Harness API claims `environment.state` and `environment.exec`, and its workspace fields name `environmentId`.
|
|
116
|
+
- `@nylorun/agents`: `client.environments` (`put`, `get`, `list`, `page`, `stop`, `reset`, `delete`, `events`, `secrets.put|list|get|delete`, `forSession`) replaces `client.sandboxes`; `createSession({ environment })`; `sessions.page({ environmentId })` filters by Environment. The AG-UI handler's session options take `environment`.
|
|
117
|
+
- `@nylorun/admin`: `admin.coverage({ agentId, environmentId })` replaces `admin.vaults`; `admin.mcp.preview({ url, environmentId })`.
|
|
118
|
+
- `@nylorun/studio`: Environments replace Sandboxes, with a create form, stop, reset, delete and their secrets; the Credentials forms write an Environment's secrets; New session picks an Environment and shows its coverage.
|
|
119
|
+
- `nylorun`: `nylorun sandbox ls|rm` list and delete Environments; `nylorun mcp inspect --environment <id>` replaces `--vault`; `nylo reset --environments` replaces `--sandboxes`; `nylo doctor sandbox` reports the Environment limits.
|
|
120
|
+
|
|
121
|
+
- e917bd6: **The Harness API is a published contract (R4.5).** Everything a harness sends or reads now has a schema in `@nylorun/core/harness-api`, and the Runtime validates with those same schemas:
|
|
122
|
+
- the transport and the pod join (`HARNESS_API_PATH`, `HARNESS_API_HEADER`, `HOST_JOIN_PATH`, `HostJoinRequestSchema`, `HostJoinAnswerSchema`);
|
|
123
|
+
- the Model and Tool Gate bodies (`ModelCallBodySchema`, `ToolCallBodySchema`, `HttpCallBodySchema`, the MCP bodies, `GATE_ERROR_CODES`);
|
|
124
|
+
- the MCP snapshot (`McpSnapshotSchema`);
|
|
125
|
+
- transcript entries (`TranscriptEntrySchema`);
|
|
126
|
+
- the effect id rule (`effectIdOf`, `isEffectIdOf`).
|
|
127
|
+
|
|
128
|
+
The build also writes them as one JSON Schema document, `@nylorun/core/harness-api/schema.json`, for harnesses written in other languages.
|
|
129
|
+
|
|
130
|
+
Other changes:
|
|
131
|
+
- `TurnStart` gains an optional `trace` (W3C `traceparent`) for the turn's trace context. Nothing fills it yet.
|
|
132
|
+
- Core refuses a `hello` whose `api` is not `2`.
|
|
133
|
+
- **The fixture model answers at the Model Gate (R4.3).** With a Tenant's `fixtureModel` seeded, the gate answers model calls itself and meters each one, like any model: a `model_usage` row with provider `fixture` and cost 0, readable at `GET /v1/sessions/{id}/calls/model`. Our harness no longer answers it locally.
|
|
134
|
+
- The fixture model also answers scripted markers: `fixture:text`, `fixture:tool <name> <json>`, `fixture:budget` and `fixture:slow <seconds>`.
|
|
135
|
+
- **The sandboxes service can run a harness image (R4.4, Go).** `PUT /v1/pods/{name}` accepts `entrypoint: "image"`: the workload image's own `ENTRYPOINT` and `CMD` run, with no engine copied in and no `harnessImage`. The default, `entrypoint: "engine"`, is unchanged. The Runtime starts sending it with the harness pin in a later change.
|
|
136
|
+
|
|
137
|
+
- 3013501: **Tool calls are delivered at least once, and every one is on the record (R5 step 1).** A gateway restart used to park the sessions it interrupted as `uncertain` until someone cancelled them, a harness could call tools with no record, and nothing listed a session's tool calls. Now every tool call ends in the log with its outcome, a crash sends it again with the same key, and the gateway runs only calls the effect journal recorded.
|
|
138
|
+
|
|
139
|
+
- **Every outcome in the log.** Each tool call ends in one `tool.completed` with `status` (`completed`: the tool answered; `failed`: the Runtime ended it, `tool.disabled`, `tool.unavailable` or `tool.interrupted`; `cancelled`), `kind` (`mcp`, `http`, `sandbox`, `platform`), `server`, `attempts` and `durationMs`. Refused and cancelled calls are in the log for the first time.
|
|
140
|
+
- **`GET /v1/sessions/{id}/calls/tool`** pages a session's tool calls from the effect journal, in the order they were first sent: tool, input, status, sends, error and timing. Same credentials and paging as `/calls/model`; `@nylorun/agents` adds `session.toolCalls()`. Host feature `tool-calls`.
|
|
141
|
+
- **At least once, with the same key.** An MCP or HTTP tool call that a crash, a shutdown or a lost gateway hop interrupted is sent again with its effect id as the key, up to 3 sends; then it fails to the model as `tool.interrupted` ("may have run") and the session continues. A gateway that restarts mid call runs the call again under its key instead of answering `uncertain`. HTTP tools get the key as `Idempotency-Key`, as before; MCP servers now get it in `_meta["nylorun/idempotency-key"]` on `tools/call`. A tool that honors the key acts once; `attempts` above 1 marks where one may have acted twice.
|
|
142
|
+
- **Sandbox commands are never run twice.** A sandbox or core-served call a crash interrupted has no key to dedupe on, so it fails to the model as `tool.interrupted` at once, and the model decides whether to run it again.
|
|
143
|
+
- **No tool call parks a session.** The `uncertain` state for tool calls, its cancel-only exit and R2b's read-only/idempotent `mcp.lost` exception are gone: a lost MCP answer is `mcp.lost` to the model for every tool. Model calls keep their own rules.
|
|
144
|
+
- **The gateway runs only journaled calls.** Under a run token, `/nylorun/v1/tool-calls` and `/nylorun/v1/http-calls` need the call's effect id as `Idempotency-Key` (`400 key_required`), and the effect journal must hold it running, for the run's turn, the same tool and the same input (`409 effect_not_journaled`). A harness that skips the journal gets nothing run.
|
|
145
|
+
- `@nylorun/harness`: `HarnessExecutors.resends(effect, error, run)` says a gate hop lost a call's answer; the harness then asks core again with the same intent and sends the call again.
|
|
146
|
+
- **Approval** stays in the manifest and our harness still asks for it. Only the Runtime's own harness asks: one built from the Harness API can skip it until tool policy moves to the gateway (R5 step 2).
|
|
147
|
+
|
|
148
|
+
- 6061a3a: **Tool approvals are the Tenant's tool policy (R5 step 2).** An agent's manifest used to say which tool calls wait for a person, and only the Runtime's own harness asked; a harness built from the Harness API could skip it. Now the operator sets one tool policy for every agent and every harness, and the Runtime enforces it before anything is sent.
|
|
149
|
+
|
|
150
|
+
- **`GET`/`PUT /v1/tenant/tool-policy`** (the Management API; `admin.toolPolicy.get()`/`.put({ rules })`): rules `{ effect: "allow" | "ask" | "deny", tool?, server?, kind?, agent?, when?, reason? }`. A rule matches a call when every selector it sets matches (`tool` and `server` take `*` globs; `when` tests input fields by dotted path with `equals`, `in`, `gt`, `gte`, `lt`, `lte` or `matches`). The strictest matching rule decides; a call no rule matches runs.
|
|
151
|
+
- **Enforced for every harness.** Core decides an MCP or HTTP tool call as it journals it. `deny` fails it to the model as `tool.denied`, unsent. `ask` holds the call (`held` at `/calls/tool`) and pauses the turn with one `approval` interaction per held call (`turn.paused`, with the tool, its input and the reason). `approve` sends that exact call, or fails it as `tool.denied`. The Tool Gate runs only calls the journal holds running, so a held or refused call cannot run. Nothing holds a process while it waits: an approval survives a restart. A flow's HTTP stages are decided the same way.
|
|
152
|
+
- **`approval` leaves the manifest.** `PUT /v1/agents/:id` and `saveAgent()` refuse a definition that sets `approval` on an HTTP tool, an MCP server or an MCP tool's settings; `http({ approval })` and `.mcp({ … approval })` throw; a turn manifest can no longer add one. The engine never asks for an HTTP or MCP tool's approval itself. A session pinned to a manifest saved with `approval: "always"` keeps it, as an ask.
|
|
153
|
+
- `@nylorun/studio`: a paused session shows an approval card for each held call, with its tool, why it is held and its input, and **Approve** / **Deny**.
|
|
154
|
+
- Migration: move each `approval: "always"` to an `ask` rule (see MIGRATION.md).
|
|
155
|
+
|
|
156
|
+
- 7d496e4: **Every connection a pod Environment makes to the internet is on the record (R7, egress events).** egress-gate used to keep only log lines, so a session's log could not say which hosts its turn reached or what the gate refused. Now each connection through egress-gate is one event, written by the gate itself.
|
|
157
|
+
|
|
158
|
+
- **`egress.connection`** in the session log of the turn that held the Environment when the connection opened, with that turn's id even if the turn has ended by the time it closes. Source `egress-gate`, evidence `observed`.
|
|
159
|
+
- **`environment.egress`**, the same payload, on the Environment's own stream (`GET /v1/environments/{id}/events`) for traffic while no turn holds the Environment.
|
|
160
|
+
- **The payload:** `environmentId`, `host`, `port`, `outcome` (`allowed` or `refused`), `reason` and `status` for a refusal, `mode` (`tunnel` or `credential`), `credentialBound`, `bytesUp` and `bytesDown`, `startedAt` (the gate's clock at CONNECT) and `durationMs`. A host a shell credential is bound to adds `requests` and the `credentialIds` the gate set. It never carries a header value, a URL path or a body.
|
|
161
|
+
- **One event per connection:** written when it closes, or at once when the gate refuses it (a host not in `network.allowedHosts`, a port other than 443 or 80, a private address, too many tunnels, a name that does not resolve). A refusal before the Environment is known (no token, an expired or stale one) stays a log line only.
|
|
162
|
+
- **Never in the way:** a write happens after the connection closes or is answered, and a failed write is logged as `egress_record_failed` without touching the tunnel. The gateway's `egress_refused` and `egress_terminated` log lines stay.
|
|
163
|
+
|
|
164
|
+
- 81c783e: **Every row that ends a call or a turn carries its own timing (R7.1).** The session log said what happened but not how long it took: a model call's outcome had no time at all, a tool call's only core's window, a flow's HTTP stage had no outcome row, and a turn's end had neither its duration nor its cost. Now each one is a span on its own, ready for the traces that follow, with no protocol change.
|
|
165
|
+
|
|
166
|
+
- **Model calls.** `message.assistant`, `model.failed` and `context.compacted` carry the call's `effectId` and `durationMs` (from the intent to the outcome). When the Model Gate metered the call they also carry the gate's own `gate: { startedAt, endedAt }`, `firstTokenMs` (to the provider's first stream event) and `meteredUsage` (`inputTokens`, `outputTokens`, `totalTokens`, and `cachedTokens` and `costUsd` when not zero), beside the `usage` the harness reported. The usage ledger keeps the gate's times (migration 0022: `model_usage.started_at`, `ended_at`, `first_token_ms`).
|
|
167
|
+
- **One row per model call.** A step that said nothing (no text, no tool calls, as a structured answer) now writes `message.assistant` with `text: ""`, and each partial summary of a long compaction writes `context.compacted` with `partial: true`. The AG-UI and A2A histories skip both; `isEmptyAssistantMessage` in `@nylorun/core/contracts` tells your own UI which steps said nothing.
|
|
168
|
+
- **Tool calls.** `tool.completed` carries the call's `effectId`, the Tool Gate's own `gate: { startedAt, endedAt }` for an MCP or HTTP call it ran (absent for sandbox and core-served tools), and `policy: { decision: "ask" | "deny", reason, approvedBy? }` when the Tenant's tool policy held or refused the call.
|
|
169
|
+
- **Flow HTTP stages.** A new event type, `node.completed` (`path`, `kind`, `key`, `iterations`, `effectId`, `status`, `durationMs`, `gate`), ends each HTTP stage and HTTP verifier that `node.started` began, and a tool stage the Runtime refused to run. Clients ignore event types they do not know.
|
|
170
|
+
- **Turns.** `turn.completed`, `turn.failed` and `turn.cancelled` carry `durationMs` (from the turn's start to its end, waits for a person included), `pausedMs` (how much of that it waited paused), `agentId` and `totals: { steps, tokens, costUsd }`, the same totals `GET /v1/tenant/usage?scope=turn` returns. A turn started before this release has no `durationMs`.
|
|
171
|
+
|
|
172
|
+
- 7800358: **Each turn is one OpenTelemetry trace, projected from the session log (R7).** An operator could not see what a turn did or where its time went without grepping container logs. Now every turn is a trace with a span for each model call, tool call and egress tunnel, exported over OTLP to any collector, readable per turn from the Runtime, and joined to the trace of the app that started it. No protocol change.
|
|
173
|
+
|
|
174
|
+
- **Traces from the log.** A turn's end is its root span, `invoke_agent <agent>`; each model call is a `chat <model>` span, each tool call and flow HTTP stage an `execute_tool <tool>` span, each egress-gate tunnel a `CONNECT <host>` span, and each pause and answer a marker. A model or gate tool span is the gate's own start and end; usage and cost are the gate's (`nylorun.usage.mismatch` when the harness reported other numbers). Attribute names follow the OTel GenAI conventions at one pinned commit, recorded as `nylorun.semconv.genai` on the resource. Ids are derived from the log under a key the Tenant keeps (setting `trace.key`), so every export and read of a turn gives the same ids.
|
|
175
|
+
- **OTLP export, off until you set an endpoint.** With `OTEL_EXPORTER_OTLP_ENDPOINT` (or `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`) the Runtime posts OTLP/HTTP JSON from a replication slot of its own, `nylorun_trace_export`, in batches of up to 512 spans or every 2 s; `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_SERVICE_NAME` and `OTEL_RESOURCE_ATTRIBUTES` work as usual. No turn waits for it. A collector that is down costs only its spans: after three retries a batch is dropped and logged as `trace_export_dropped`, and the slot moves on, so Postgres keeps no WAL for it. `nylorun start` passes these variables to the runtime container.
|
|
176
|
+
- **References by default.** Spans point at log events (`nylorun.event.cursor`) and carry no content unless you opt in per kind with `NYLORUN_TRACE_CONTENT` (`user`, `outputs`, `tool-results`, `errors`), or all of them with `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`, each cut at 8 KiB. A span never carries a credential value, a prompt, a person's id, an identity header or an idempotency key.
|
|
177
|
+
- **`GET /v1/sessions/{id}/turns/{turnId}/trace`** answers a turn's spans as OTLP JSON, the same spans the exporter posts: look at a turn without a collector, or post it to one to backfill. Application keys, as the `/calls` reads. Host feature `traces`; `@nylorun/agents` adds `session.trace(turnId)`, and `@nylorun/core/contracts` `TurnTraceSchema`.
|
|
178
|
+
- **Trace context in and out.** A `traceparent` (and `tracestate`) on `POST /v1/sessions/{id}/commands`, an AG-UI run or an A2A message puts the turn in the caller's trace; `command.message` records it as `trace`. The turn hands its context on: to the harness in `TurnStart.trace`, to HTTP tools as `traceparent` beside `Idempotency-Key`, to MCP servers as `traceparent` on the call's requests, and to sandbox commands as `TRACEPARENT`.
|
|
179
|
+
- **Harness API** (additive): the `effect.intent` answer `execute` may carry the tool call's `traceparent`. `@nylorun/harness`: `HarnessExecutors.tool` takes it as a fourth argument (`ToolCallContext`).
|
|
180
|
+
|
|
181
|
+
### Patch Changes
|
|
182
|
+
|
|
183
|
+
- 17a97e9: **An artifact names the Environment whose disk it holds.** `ArtifactView` (and so `ArtifactListItem` in artifact pages) gains optional `environmentId`: set on the folder artifact that holds an Environment's disk versions (R2d step 3), absent on a session's or the Tenant's own artifacts. Before, such an artifact read as a Tenant-owned one with no way to tell whose disk it was.
|
|
184
|
+
- b6214d9: Add opt-in artifact metadata pagination to `GET /v1/artifacts?limit=…`, shared
|
|
185
|
+
`ArtifactListItem`/`ArtifactPage` contracts and SDK `artifacts.page()` (default 50,
|
|
186
|
+
maximum 200). Hosts advertise `artifact-reads`. Pages order by creation time and
|
|
187
|
+
ID descending, filter by session, kind and labels, bind cursors to the Tenant and
|
|
188
|
+
filters, and reapply ownership and agent grants on each read. Legacy unpaged
|
|
189
|
+
responses remain unchanged. A Drizzle migration adds the creation-order index;
|
|
190
|
+
pages reuse the existing bounded read-only pool. Studio and every other Runtime
|
|
191
|
+
client can consume this public API without database access.
|
|
192
|
+
- a0cbca1: **Clearer wording when a definition runs your code.** The refusal for a code tool or a flow's tool stage, the `hooks were removed` error and `nylo endpoints` now say that the Runtime runs agents from their manifests alone, instead of that it runs no code of yours during a session. Only the message text changed; anything matching the old wording (for example `runs no code of yours during a session`) needs the new text.
|
|
193
|
+
|
|
3
194
|
## 0.19.0-beta
|
|
4
195
|
|
|
5
196
|
### 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`,
|
|
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
|
|
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.
|
package/dist/compatibility.d.ts
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 declare const PROTOCOL_VERSION =
|
|
58
|
+
export declare const PROTOCOL_VERSION = 14;
|
|
26
59
|
/** What a client of this protocol requires of a Host. */
|
|
27
60
|
export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts",
|
|
28
61
|
/**
|
|
@@ -36,7 +69,32 @@ export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts
|
|
|
36
69
|
* (`credential_required`, `credential_invalid`), and the Runtime serves its protected resource
|
|
37
70
|
* metadata at `/.well-known/oauth-protected-resource` when it has trusted issuers.
|
|
38
71
|
*/
|
|
39
|
-
"resource-server"
|
|
72
|
+
"resource-server",
|
|
73
|
+
/**
|
|
74
|
+
* Protocol 11: Environments (`/v1/environments/{id}`, kinds `virtual`, `pod` and `none`), each
|
|
75
|
+
* with one vault written on the Runtime API; sessions name an `environment`; token callers
|
|
76
|
+
* carry Environment grants checked at every turn start, and `environments:write` lets a
|
|
77
|
+
* subject create, change and delete the Environments it is granted.
|
|
78
|
+
*/
|
|
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"];
|
|
40
98
|
export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
|
|
41
99
|
/**
|
|
42
100
|
* Host features no client requires: a client that uses one checks the Host's `/health`
|
|
@@ -49,20 +107,36 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
|
|
|
49
107
|
* by subject headers. `a2a-endpoint`:
|
|
50
108
|
* `POST /v1/a2a/agents/:agent` answers A2A 1.0 JSON-RPC for a subject, and
|
|
51
109
|
* `GET /v1/a2a/agents/:agent/card` returns the agent's card without its interfaces.
|
|
52
|
-
* `
|
|
53
|
-
* with `
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* `sandbox-pods`: kind `pod` runs as an agent-sandbox pod on the Tenant's cluster (`nylorun
|
|
57
|
-
* sandbox enable`), with `POST /v1/sandboxes/{id}/stop` and `/reset`, a TTL
|
|
58
|
-
* (`lifecycle.ttl`), lifecycle events (`sandbox.running`, `.suspended`, `.expired`,
|
|
59
|
-
* `.relaunched`, `.lost`, `.reset`, `.failed`) and the Tenant's `placement`.
|
|
110
|
+
* `sandbox-pods`: Environments of kind `pod` run as agent-sandbox pods on the Tenant's cluster
|
|
111
|
+
* (`nylorun local sandbox enable`), with `POST /v1/environments/{id}/stop` and `/reset`, lifecycle
|
|
112
|
+
* events (`environment.running`, `.suspended`, `.relaunched`, `.lost`, `.reset`, `.failed`) and
|
|
113
|
+
* the Tenant's `placement`.
|
|
60
114
|
* `trusted-issuers`: the Tenant API accepts JWTs from the issuers of the Host's identity file
|
|
61
115
|
* (`NYLORUN_IDENTITY_FILE`) as bearers, from servers and from browsers alike, with the
|
|
62
|
-
* issuer's subject, scopes (and the issuer-only `studio`), agents and
|
|
116
|
+
* issuer's subject, scopes (and the issuer-only `studio`), agents and Environment grants; `GET
|
|
63
117
|
* /v1/me` reports who any credential is.
|
|
118
|
+
* `environment-setup`: a pod Environment's recipe takes `setup` commands and input `files`, run
|
|
119
|
+
* and copied when its disk is made or reset, before any turn.
|
|
120
|
+
* `environment-disk-versions`: an Environment's disk has versions: `POST
|
|
121
|
+
* /v1/environments/{id}/snapshot` and `/restore`, `GET .../versions`, `DELETE .../versions/{n}`,
|
|
122
|
+
* and `from` on a `PUT` that creates one; a pod whose volume is lost starts again from the latest.
|
|
123
|
+
* `credential-coverage`: `POST /v1/tenant/credential-coverage` (the Management API) says which
|
|
124
|
+
* credential of an Environment's vault each of a saved agent's MCP servers and HTTP tools would
|
|
125
|
+
* get in a session that names that Environment.
|
|
126
|
+
* `tool-calls` (R5): `GET /v1/sessions/{id}/calls/tool` pages a session's tool calls from the
|
|
127
|
+
* effect journal, every `tool.completed` says how its call ended (`status`, `kind`, `server`,
|
|
128
|
+
* `attempts`, `durationMs`), and tool calls are delivered at least once with their effect id as
|
|
129
|
+
* the key (`Idempotency-Key` for HTTP tools, `_meta["nylorun/idempotency-key"]` for MCP tools).
|
|
130
|
+
* `tool-policy` (R5 step 2): `GET`/`PUT /v1/tenant/tool-policy` (the Management API) sets which
|
|
131
|
+
* MCP and HTTP tool calls run, wait for a person (`ask`: the turn pauses until `approve`) or are
|
|
132
|
+
* refused (`deny`: `tool.denied`), for every harness; a manifest that sets `approval` is refused.
|
|
133
|
+
* `traces` (R7): `GET /v1/sessions/{id}/turns/{turnId}/trace` answers a turn's spans as OTLP JSON,
|
|
134
|
+
* the spans the Runtime posts to an OTLP collector when one is configured; a command or an AG-UI
|
|
135
|
+
* or A2A request sent with a `traceparent` joins the caller's trace.
|
|
64
136
|
*/
|
|
65
|
-
export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "transcript-events", "subject-headers", "ag-ui-endpoint", "a2a-endpoint", "
|
|
137
|
+
export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "transcript-events", "subject-headers", "ag-ui-endpoint", "a2a-endpoint", "sandbox-pods", "trusted-issuers", "session-reads", "calls-export", "credential-coverage", "tool-calls", "environment-setup", "environment-disk-versions", "tool-policy", "traces",
|
|
138
|
+
/** Opt-in artifact metadata pages (`GET /v1/artifacts?limit=…`). */
|
|
139
|
+
"artifact-reads"];
|
|
66
140
|
export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
|
|
67
141
|
export interface ProtocolRange {
|
|
68
142
|
min: number;
|
|
@@ -70,11 +144,9 @@ export interface ProtocolRange {
|
|
|
70
144
|
features: readonly string[];
|
|
71
145
|
}
|
|
72
146
|
/**
|
|
73
|
-
* What this Host serves
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* API itself is gone (protocol 8): `/v1/admin/*` is no route. `artifacts` (protocol 6 and
|
|
77
|
-
* 7, required by their clients): file artifacts, capability links and message `parts`.
|
|
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.
|
|
78
150
|
*/
|
|
79
151
|
export declare const HOST_PROTOCOL: ProtocolRange;
|
|
80
152
|
export declare const DEFINITION_SCHEMA_VERSION = 2;
|
|
@@ -112,18 +184,31 @@ export declare const ERROR_CODES: readonly ["not_found",
|
|
|
112
184
|
"invalid_request",
|
|
113
185
|
/** A route that acts for a person was called without one (`Nylorun-Subject`). */
|
|
114
186
|
"subject_required",
|
|
115
|
-
/** A token caller's
|
|
116
|
-
"
|
|
117
|
-
/**
|
|
118
|
-
"
|
|
119
|
-
/** The
|
|
120
|
-
"
|
|
121
|
-
/** The Tenant's placement keeps this session's harness off the host its
|
|
187
|
+
/** A token caller's Environment grants do not reach the Environment. */
|
|
188
|
+
"environment_not_granted",
|
|
189
|
+
/** Disk work (snapshot, restore, stop, reset) while a turn runs, or a turn while a disk copy runs. */
|
|
190
|
+
"environment_busy",
|
|
191
|
+
/** The Environment is gone, or its kind cannot run on this Runtime. */
|
|
192
|
+
"environment_unavailable",
|
|
193
|
+
/** The Tenant's placement keeps this session's harness off the host its Environment needs. */
|
|
122
194
|
"placement_refused",
|
|
123
|
-
/** A pod
|
|
124
|
-
"
|
|
125
|
-
/**
|
|
126
|
-
|
|
195
|
+
/** A pod Environment's volume or node is gone: only `POST /v1/environments/{id}/reset` brings it back. */
|
|
196
|
+
"environment_lost",
|
|
197
|
+
/**
|
|
198
|
+
* The Environment names an owner (`ownerUserId`) other than the session's owner: `403` to an
|
|
199
|
+
* application key; a caller acting for a person gets the opaque `404`.
|
|
200
|
+
*/
|
|
201
|
+
"environment_owner_mismatch",
|
|
202
|
+
/**
|
|
203
|
+
* The session's Environment now runs another harness than the one the session pinned when it
|
|
204
|
+
* opened (track R4): open a new session to run on it.
|
|
205
|
+
*/
|
|
206
|
+
"harness_mismatch",
|
|
207
|
+
/**
|
|
208
|
+
* The session is closed: it was opened before protocol 11 (its history stays readable), so
|
|
209
|
+
* open a new session that names an Environment.
|
|
210
|
+
*/
|
|
211
|
+
"session_closed",
|
|
127
212
|
/**
|
|
128
213
|
* A trusted issuer's token names a key the Runtime has not seen, and the issuer's JWKS cannot
|
|
129
214
|
* be fetched now (Host feature `trusted-issuers`): retry later. Keys already fetched keep working.
|
|
@@ -147,11 +232,42 @@ export declare const ERROR_CODES: readonly ["not_found",
|
|
|
147
232
|
*/
|
|
148
233
|
"mcp_preview_failed",
|
|
149
234
|
/**
|
|
150
|
-
*
|
|
151
|
-
* `environment_secret`
|
|
152
|
-
*
|
|
235
|
+
* An Environment's credentials would be ambiguous (R2c, D56): `409` at the secret write. Two
|
|
236
|
+
* `environment_secret` credentials would be bound to one host, or two `bearer` or `headers`
|
|
237
|
+
* credentials to one URL.
|
|
238
|
+
*/
|
|
239
|
+
"credential_conflict",
|
|
240
|
+
/**
|
|
241
|
+
* A message names a file the Tenant's model does not read (protocol 12): `422` at accept, and
|
|
242
|
+
* no turn starts. `details.parts` lists each refused file's `artifactId`, `name`, `mediaType`
|
|
243
|
+
* and `reason`.
|
|
244
|
+
*/
|
|
245
|
+
"attachment_unsupported",
|
|
246
|
+
/**
|
|
247
|
+
* A `PUT /v1/environments/{id}` asked an existing Environment to run something else
|
|
248
|
+
* (protocol 14, D63): only its labels and owner guard may change. Fork it into a new
|
|
249
|
+
* Environment (`POST /v1/environments/{id}/fork`). `details.fields` names what differed.
|
|
250
|
+
*/
|
|
251
|
+
"environment_immutable",
|
|
252
|
+
/**
|
|
253
|
+
* A secret write named a secret the Environment's manifest does not declare (D64): `409`.
|
|
254
|
+
* Add the slot to the manifest and make or fork an Environment from the new version.
|
|
255
|
+
*/
|
|
256
|
+
"secret_not_in_manifest",
|
|
257
|
+
/**
|
|
258
|
+
* A session's agent requires what its Environment lacks (D65): `409` when the session opens.
|
|
259
|
+
* `details.missing` lists each gap (`sandbox`, `pod`, or `secret:<name>`).
|
|
260
|
+
*/
|
|
261
|
+
"environment_unsuitable",
|
|
262
|
+
/** No environment manifest has this name, or no version with this number. */
|
|
263
|
+
"manifest_not_found",
|
|
264
|
+
/** An environment manifest some Environment was made from cannot be deleted: `409`. */
|
|
265
|
+
"manifest_in_use",
|
|
266
|
+
/**
|
|
267
|
+
* `If-Match` named a version that is no longer the latest (D63): `412`. Read the manifest
|
|
268
|
+
* again, or save with `--force` (no `If-Match`).
|
|
153
269
|
*/
|
|
154
|
-
"
|
|
270
|
+
"manifest_changed", "internal_error"];
|
|
155
271
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
156
272
|
export declare const TENANT_ID_PATTERN: RegExp;
|
|
157
273
|
export declare const PRINCIPAL_ID_PATTERN: RegExp;
|