@nylorun/core 0.23.0-beta → 0.25.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 +37 -0
- package/dist/compatibility.d.ts +127 -59
- package/dist/compatibility.js +128 -60
- package/dist/contracts.d.ts +2413 -893
- package/dist/contracts.js +1144 -491
- package/dist/define.d.ts +1 -0
- package/dist/define.js +1 -0
- package/dist/definition/approval.d.ts +1 -1
- package/dist/definition/bound.d.ts +2 -0
- package/dist/definition/builder.d.ts +2 -2
- package/dist/definition/builder.js +1 -1
- package/dist/definition/code-tools.d.ts +1 -1
- package/dist/definition/declaration.js +3 -0
- package/dist/definition/delegate.d.ts +1 -1
- package/dist/definition/delegate.js +1 -1
- package/dist/definition/from.d.ts +2 -2
- package/dist/definition/from.js +1 -1
- package/dist/definition/http-tool.d.ts +3 -3
- package/dist/definition/mcp.d.ts +4 -4
- package/dist/definition/mcp.js +3 -3
- package/dist/definition/removed.d.ts +7 -0
- package/dist/definition/removed.js +21 -1
- package/dist/definition/sections.d.ts +64 -0
- package/dist/definition/sections.js +227 -0
- package/dist/definition/variant.d.ts +1 -1
- package/dist/definition/variant.js +4 -4
- package/dist/harness-api/entries.d.ts +1 -1
- package/dist/harness-api/entries.js +1 -1
- package/dist/harness-api/gates.d.ts +1 -1
- package/dist/harness-api/gates.js +1 -1
- package/dist/harness-api/harness-api.schema.json +182 -6
- package/dist/harness-api/index.d.ts +3 -3
- package/dist/harness-api/index.js +3 -3
- package/dist/harness-api/json-schema.d.ts +1 -1
- package/dist/harness-api/json-schema.js +3 -3
- package/dist/harness-api/mcp.js +1 -1
- package/dist/harness-api/messages.d.ts +10 -8
- package/dist/harness-api/messages.js +1 -1
- package/dist/harness-api/schema.d.ts +82 -13
- package/dist/harness-api/schema.js +63 -19
- package/dist/harness-api/transcript.d.ts +1 -1
- package/dist/harness-api/transport.d.ts +1 -1
- package/dist/harness-api/transport.js +1 -1
- package/dist/manifest-schemas.d.ts +9 -5
- package/dist/manifest-schemas.js +24 -27
- package/dist/schemas/agent-manifest.schema.json +1534 -250
- package/dist/schemas/harness-manifest.schema.json +1273 -0
- package/dist/schemas/{environment-manifest.schema.json → runtime-manifest.schema.json} +109 -68
- package/dist/types/manifest.d.ts +87 -15
- package/dist/types/manifest.js +4 -0
- package/dist/types/model.d.ts +5 -0
- package/dist/types/observe.d.ts +1 -1
- package/dist/types/part.d.ts +5 -0
- package/dist/types/tool.d.ts +4 -4
- package/dist/utils/definition-files.d.ts +3 -2
- package/dist/utils/definition-files.js +4 -3
- package/dist/utils/file-systems.d.ts +1 -1
- package/dist/utils/file-systems.js +1 -1
- package/dist/utils/harness-id.d.ts +1 -1
- package/dist/utils/harness-id.js +1 -1
- package/dist/utils/memory.d.ts +64 -0
- package/dist/utils/memory.js +139 -0
- package/dist/utils/runtime-limits.d.ts +55 -4
- package/dist/utils/runtime-limits.js +106 -3
- package/dist/utils/runtime-tools.d.ts +3 -3
- package/dist/utils/runtime-tools.js +3 -3
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @nylorun/core
|
|
2
2
|
|
|
3
|
+
## 0.25.0-beta
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- eeb6294: Session usage as one ledger (protocol 18). The usage ledger keeps each model call's cost by token kind (uncached input, cache read, cache write, output) at the prices the adapter applied (migration 0037). For a protocol 18 client, `GET /v1/sessions/{id}/calls/model` returns each call's `startedAt`, `endedAt` and `usage.costSplit` (null for a call recorded before), and `GET /v1/sessions/{id}/usage` adds `costSplit` with `splitCalls`, and the calls' durations added up as `modelTimeMs` with `timedCalls`. A protocol 16 or 17 client reads usage as before. Studio's Usage tab is rebuilt on them: a Session card with one tokens bar and a ledger of tokens and cost by kind adding up to a total row, then the model calls grouped by turn with the same columns (cached, uncached, output, total, time, cost), and a row menu whose View event opens the call's event in the Events tab.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ed08ba8: `agentManifests.save({ agent, runtime, memory })` turns on a built agent's memory (`harness.memory`, `{ access?, instructions? }`), and a skill folder's `SKILL.md` may list the secret slots its scripts read in its frontmatter (`secrets: [GH_TOKEN]`): `.skills()`, `.plugin()` and `composeManifest` make them the skill's `secrets` in the harness section, which the Runtime checks against `runtime.secrets` at save. A `secrets` that is not a list of environment variable names skips the skill with a warning.
|
|
12
|
+
- ed08ba8: A flow's HTTP stage or HTTP verifier, and an HTTP tool of an agent the harness section embeds (a flow's `agents`, or an agent used as a tool), now has its `credential` checked when the manifest is saved, as an agent's own HTTP tool has: it must name a `bearer` or `headers` slot of `runtime.secrets` bound to its URL, or the save is `422 manifest_inconsistent` naming it (`harness.root stage "refund" http.credential "checks" is not a secret slot in runtime.secrets`). Before, such a manifest saved and each call failed at run time with `http.credential`.
|
|
13
|
+
- ed08ba8: Public text names no internal roadmap codes: the OpenAPI documents' descriptions, the type comments of `@nylorun/core`, `@nylorun/agents` and `@nylorun/admin`, and the CLI's help, README and generated compose file. A Runtime test fails when either OpenAPI document names one.
|
|
14
|
+
- ed08ba8: The tool policy's documentation matches how rules match: `tool` is the tool's identity (an MCP tool's own name on its `server`, or an HTTP tool's declared name), never the model-facing `server__tool`, which is refused; `agent` is the agent manifest's name, or the id of an agent used as a tool or of a flow's agent. `PUT /v1/tenant/tool-policy` describes each selector, and `GET` documents its `409` for a stored rule it cannot apply.
|
|
15
|
+
|
|
16
|
+
## 0.24.0-beta
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 218b078: Agent manifest v8, the schema of protocol 16 (track T2), ahead of the Runtime that saves it: `AgentManifestV8Schema`, with a `harness` section (what runs inside the loop: the harness id, instructions, tools, skills with the secret slots they read, MCP servers with the slot they authenticate with, plugins, `loop`) or a flow's, and a `runtime` section (environment manifest v1's fields; `kind` required, `harness` moved to `harness.id`, `triggers` reserved). The authoring files `nylorun apply` will read have their own schemas: `AgentManifestFileSchema`, `HarnessManifestFileSchema` and `RuntimeManifestFileSchema`, published as `@nylorun/core/schemas/agent-manifest-v8.json`, `harness-manifest.json` and `runtime-manifest.json`.
|
|
21
|
+
|
|
22
|
+
`sectionGaps(manifest)` (from `@nylorun/core/define`) checks the two sections against each other, as the Runtime will when a manifest is saved: a custom harness needs a pod with an image; every credential the harness names is a declared slot of the right type (an MCP server's or HTTP tool's a `bearer` or `headers` slot bound to its URL, a skill's `secrets` an `environment_secret` or `environment_variable` slot); and the runtime's kind gives the loop the sandbox it needs (`sandboxNeedOf`). `loopManifestOf` and `harnessSectionOf` convert between a version's harness section and the loop manifest the engine runs. Nothing calls them yet.
|
|
23
|
+
|
|
24
|
+
- 22c61ce: Protocol 16, Agents from one manifest (track T2), a fresh start. An agent manifest (v8) is one versioned document at `/v1/agent-manifests/{name}` with a `harness` section (what runs inside the loop, including the harness's id) and a `runtime` section (what an environment manifest said). The Runtime checks the two against each other when it is saved (`422 manifest_inconsistent` with `details.gaps`), in place of `requires` at session open. Agent definitions and environment manifests are gone.
|
|
25
|
+
|
|
26
|
+
Environments are Agents: `/v1/agents/{id}` and its sub-routes, made from a saved manifest only (`manifest: "name"` tracks it, `"name@n"` pins a version; either resolves once, into `resolvedVersion`), with a derived `state` (`working`, `sleeping`, `input_required`, `failing`, `paused`) and `attention`. Every session runs on one Agent (`PUT /v1/sessions/{id} { agent, ownerUserId }`) and pins its manifest version. No session is special (D71). Error codes, events (`agent.*`), scopes (`agents:write`, `agent-manifests:write`) and identity-file grants (`agents`) say Agent; model budget scope `agent` is `manifest`. Harness API 5: `turn.start.agent` replaces `turn.start.environment`, with `definition` and `loop`. Migration 0032 closes older sessions (`protocol_16`) and drops Environments with their disks and vaults.
|
|
27
|
+
|
|
28
|
+
The SDK has `client.agentManifests`, `client.agents` and `composeManifest(dir)` for three-file authoring; the CLI has `nylorun apply`, `nylorun agent-manifests`, `nylorun agents` and `nylorun migrate v8`; Studio has an Agents screen, an Agent page and an Agent manifests screen. See MIGRATION.md.
|
|
29
|
+
|
|
30
|
+
- 1ded443: Track T3, Agents that evolve: an Agent moves between versions of its manifest in place, with its id, disk, vault and sessions. `PUT /v1/agents/{id}` with another version moves it (`?dryRun=true` answers the plan, `AgentMovePlan`), and saving a manifest moves every Agent that tracks it. A harness-only change applies at once; a runtime change a pod applies only when it starts (image, resources, network, setup, files) leaves the Agent outdated (`targetVersion`, `waitingFor: "start"`) until its pod's next start, on the same volume; a version that adds a required secret waits for its value (`waitingFor: "secrets"`, state `input_required`). Its manifest's name, kind, harness and storage are fixed: `409 agent_fixed_field` replaces `409 agent_upgrade_unavailable`. Only secrets that fill a slot of the running version are used; others stay in the vault, dormant. New events `agent.outdated` and `agent.version_changed`, `GET /v1/agents?outdated=true`, and the save plan's `moves` and `agents_move` warning. Migration 0033 adds the Agent's target and failed versions and its start check.
|
|
31
|
+
- 76dcd11: Track T3, the next start and its check: a pod Agent's start on a new version is checked until the new pod's harness joins (`startCheck` on the Agent). A failed setup, a failed pod, or a start slower than the Host's `tenant.upgradeStartMs` (10 minutes) takes the Agent back to the version it ran, its definition and not its disk, records `agent.start_failed`, and names the version `failedVersion` (state `failing`), which a tracking Agent does not move to again. A new version's setup runs on the same volume when its commands or files changed (`setupHash` in the setup plan and the volume's marker). While a pod waits to start on a new version it idles at most `tenant.upgradeIdleMs` (1 minute). `POST /v1/agents/{id}/restart` applies a pending version now; `retry: true` tries the failed version again.
|
|
32
|
+
- bf942ed: Our engine offers the `memory` tool (track T5, D72). An agent whose version sets `harness.memory` gets one `memory` tool with Anthropic's memory tool schema (`view`, `create`, `str_replace`, `insert`, `delete`, `rename`; `view` only for a `read_only` agent and an agent used as a tool), our memory rules followed by the agent's `instructions`, and its memory index pinned after the instructions as user-role context: kept for the session so the prompt prefix stays cacheable (`ExecutionState.pinned`), and re-pinned after a compaction. Each command's parameters are checked before a call is sent (`checkMemoryCall` in `@nylorun/core/contracts`, which the Runtime also uses), and a call named `memory.<command>` or `memory/<command>` runs as `memory` with that command (`memoryAliasOf`). `ModelRequest.pinned` carries the pinned text; `memoryTool` and `memoryIndexBlock` are exported for your own harness.
|
|
33
|
+
- 4fa160d: Agent memory, storage and API (track T5, D72). An agent manifest's `harness.memory` (`access`: `read_write` or `read_only`; `instructions`, at most 4,096 characters) turns on the Agent's memory: Markdown files under `/memories` it keeps across sessions, wakes and upgrades. The Runtime keeps them in Postgres (`memories`, `memory_versions`, migration 0036) with a version per change and who made it. `GET /v1/agents/{id}/memories` lists them (`pathPrefix`), `GET`, `PUT` (whole content, with an optional `contentSha256` precondition: `409 memory_conflict`) and `DELETE /v1/agents/{id}/memories/{path}` read, write and delete one (or a folder), and `GET /v1/agents/{id}/memory_versions` and `.../memory_versions/{versionId}` page the versions. A fork copies the memories (the fork plan adds `memories`); a delete removes them. `@nylorun/core` adds `memoryPathOf`, `memoryDescriptionOf` and the memory contracts; new Runtime limits `memoryBytes` (100 KiB) and `memoriesPerAgent` (10,000); new error code `memory_conflict`. The SDK adds `client.agents.memories`; the CLI adds `nylorun agents memories ls|cat|put|rm|versions`. The model's `memory` tool arrives in the next steps of T5.
|
|
34
|
+
- 9fed948: The `memory` tool's calls (track T5, D72). A new effect target, `{kind: "runtime", operation: "memory"}` (additive on Harness API 5), carries Anthropic's memory tool input (`command`: `view`, `create`, `str_replace`, `insert`, `delete`, `rename`, and its parameters); core serves it in the intent's own transaction, so a replayed turn applies a write once. A malformed call fails with text for the model and changes nothing; a write from a `read_only` agent or a sub-agent is `memory.forbidden`. Each write is a memory version naming the turn's manifest version, session, turn and the trigger run that started the turn, with a new session event `memory.updated` and Agent event `agent.memory_updated`. `turn.start.memory` (`TurnMemorySchema`) carries the Agent's memory access, instructions and the index a harness pins, newest first, within the new Runtime limits `memoryIndexLines` (200) and `memoryIndexBytes` (25 KiB).
|
|
35
|
+
- ffeb3bb: `schedule_wake` (track T4, D77). An agent manifest's `runtime.selfWake: true` offers the agent `schedule_wake`: `{in | at, note}` books its session's next turn, replacing the booking before, and `{cancel: true}` removes it. The Runtime serves the call in its own transaction (a new effect target, `{kind: "runtime", operation: "schedule_wake"}`, additive on Harness API 5; `turn.start.agent.selfWake` tells a harness to offer it), so a replayed turn books once. The booking fires as a trigger run of kind `wake`, its note the turn's message with `cause.kind: "self"`. New session events `wake.booked` and `wake.cancelled`, tool call kind `runtime`, and Runtime limits `wakeMaxAheadMs` and `wakeNoteChars`.
|
|
36
|
+
- 9e60e40: Protocol 17, a queue per session (track T4, D76). A message sent while the session's turn runs or waits is queued (`{status: "queued", queuedMessageId, position}`, `message.queued`) and starts the next turn when this one ends, with every queued message, each its own user message (`queue.taken`); a cancel ends the turn, not the queue. `delivery: "reject"` keeps the refusal, now `409 session_busy`, and a protocol 16 client's messages default to it, so the Host serves protocol 16 and 17. The queue holds at most the Runtime limit `sessionQueuedMessages` (`429 queue_full`), and session reads count `queuedMessages`. Our engine takes `{kind: "messages", messages}` as a turn's input. The SDK's `input` and `inputParts` take `delivery`, and the CLI's `sessions send` takes `--reject-if-busy`. See MIGRATION.md.
|
|
37
|
+
- f85483d: Triggers (track T4, D74). An agent manifest's `runtime.triggers` declares `schedule` (cron with an IANA `timezone`) and `at` triggers, each with the session its runs go to (a session id, opened on the first run, or `new` for a session per run) and its prompt. They start active with a new Agent, fire on a durable timer per trigger with Postgres as the truth (one late fire after downtime, never a backfill, a fixed jitter per trigger), and each fire is a run (`started`, `queued`, `skipped` or `failed`, with a reason) at `GET /v1/agents/{id}/runs`. A schedule adds at most one queued message to a busy session. `GET /v1/agents/{id}/triggers` and `POST .../triggers/{triggerId}/pause`, `/resume` and `/run` (with an `Idempotency-Key`); Agent reads add `nextWakeAt`, and the Agent's stream adds `agent.run`, `agent.trigger_paused` and `agent.trigger_resumed`. New Runtime limits: `triggersPerAgent`, `triggerMinIntervalMs` and `triggerRunRetentionMs` (with floors), `triggerRunsPerHour`, `triggerJitterPercent`, `triggerJitterMaxMs`, `triggerPromptChars`; Host tuning `triggers.lateGraceMs` and `triggers.intervalCheckFires`. The SDK's `client.agents` adds `triggers`, `pauseTrigger`, `resumeTrigger`, `runTrigger` and `runs`; the CLI adds `nylorun agents triggers` and `nylorun agents runs`.
|
|
38
|
+
- ae54de7: Webhook triggers (track T4, D75). A `webhook: "standard-webhooks"` trigger has an endpoint, `POST /v1/webhooks/{endpointId}`, an anonymous, unversioned route that takes any body up to the new Runtime limit `webhookBodyBytes` and verifies Standard Webhooks (`webhook-id`, `webhook-timestamp` within the Host's `triggers.webhookToleranceMs`, `webhook-signature`) in the keys service, which alone opens the trigger's sealed secret; anything else is `401` and writes nothing. A delivery runs the trigger once per `webhook-id` (`202 {runId, status}`); a paused trigger answers a signed one `409 trigger_paused`. `POST /v1/agents/{id}/triggers/{triggerId}/secret` makes or replaces the `whsec_` secret, shown once (`agent.trigger_secret_rotated`); trigger reads show `webhookUrl` and `secretSet`. The payload reaches the model under the trigger's prompt in a labelled `<trigger-payload>` block. The SDK adds `agents.rotateWebhookSecret`, and the CLI `nylorun agents triggers new-secret`.
|
|
39
|
+
|
|
3
40
|
## 0.23.0-beta
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
export { hashManifest } from "./utils/hash.js";
|
|
2
2
|
/**
|
|
3
|
+
* Protocol 18: session usage by token kind. A model call read (`/v1/sessions/{id}/calls/model`,
|
|
4
|
+
* `/v1/tenant/calls/model`) carries the gate's timing (`startedAt`, `endedAt`) and its cost by
|
|
5
|
+
* token kind (`usage.costSplit`), and a session's usage (`/v1/sessions/{id}/usage`) adds
|
|
6
|
+
* `costSplit`, `splitCalls`, `modelTimeMs` and `timedCalls`. The Host serves protocol 16, 17 and 18:
|
|
7
|
+
* an older client, whose SDK parses these reads strictly, gets them without the new fields.
|
|
8
|
+
* Protocol 17: a queue per session. A message sent while the session's turn runs,
|
|
9
|
+
* or while it waits on an approval, an answer or an uncertain call, is queued
|
|
10
|
+
* (`{status: "queued", queuedMessageId, position}`, `message.queued`) instead of refused, unless
|
|
11
|
+
* it asks `delivery: "reject"`; the refusal now has a code, `409 session_busy`. When the turn ends
|
|
12
|
+
* (completed, failed or cancelled), every queued message starts one turn, in order, each its own
|
|
13
|
+
* user message (`queue.taken`); our engine's turn input for more than one is
|
|
14
|
+
* `{kind: "messages", messages}` (Harness API 5, additive). Past the Runtime limit
|
|
15
|
+
* `sessionQueuedMessages` a message is `429 queue_full`. Session reads count `queuedMessages`. The
|
|
16
|
+
* Host serves protocol 16 and 17: a message from a protocol 16 client is `reject` unless it says
|
|
17
|
+
* otherwise, so its sessions answer `409` as before.
|
|
18
|
+
* Protocol 16: Agents from one manifest, a fresh start. An agent manifest (v8) is one
|
|
19
|
+
* versioned document at `/v1/agent-manifests/{name}` with a `harness` section (what runs inside
|
|
20
|
+
* the loop, including the harness's id) and a `runtime` section (what an environment manifest
|
|
21
|
+
* said); the Runtime checks the two against each other when it is saved
|
|
22
|
+
* (`422 manifest_inconsistent`), so `requires` and `409 environment_unsuitable` are gone, and so
|
|
23
|
+
* are agent definitions (`PUT /v1/agents/:id` with a v7 manifest) and environment manifests.
|
|
24
|
+
* Environments are Agents: `/v1/agents/{id}` (with `.../events`, `stop`, `reset`, `snapshot`,
|
|
25
|
+
* `restore`, `versions`, `fork` and `secrets`) is made from a saved manifest only, records it as
|
|
26
|
+
* tracking (`name`) or pinned (`name@n`) into `resolvedVersion`, the version it runs. An Agent
|
|
27
|
+
* evolves: a `PUT` naming another version of its manifest moves it (`dryRun`
|
|
28
|
+
* answers the plan), a save moves every Agent that tracks the manifest, and each turn takes the
|
|
29
|
+
* version its Agent runs when it starts; a runtime change waits for a pod's next start, and its
|
|
30
|
+
* kind, harness and storage are fixed (`409 agent_fixed_field`). Reads add `state`
|
|
31
|
+
* (`working`, `sleeping`, `input_required`, `failing`, `paused`) and `attention`, and the
|
|
32
|
+
* compute's state moves to `compute.state`. Every session belongs to one Agent:
|
|
33
|
+
* `PUT /v1/sessions/{id}` takes `{ agent, ownerUserId, info }` and pins the manifest version its
|
|
34
|
+
* Agent runs; no session is special. Error codes, event types (`agent.*`), the scopes
|
|
35
|
+
* (`agents:write`, `agent-manifests:write`) and identity-file grants (`agents`) say Agent. Model
|
|
36
|
+
* budget scope `agent` is `manifest`. Harness API 5: `turn.start.agent` replaces
|
|
37
|
+
* `turn.start.environment`. Sessions opened before protocol 16 are closed (`protocol_16`) and
|
|
38
|
+
* stay readable; Environments, their disks and vaults are gone. The Host serves protocol 16 only.
|
|
3
39
|
* Protocol 15: the harness boundary, a fresh start. Model-facing work belongs to the harness. Our
|
|
4
40
|
* engine's `read_artifact` and `save_artifact` run in our harness, over the Harness API's new
|
|
5
41
|
* artifact seam (`artifact.read`, `artifact.write`; Harness API 4), so a session's pinned
|
|
@@ -16,7 +52,7 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
16
52
|
* key on (a policy rule with `__` in its `tool` refuses every call). The record refuses an
|
|
17
53
|
* outcome past `limits.recordEntryBytes`. Sessions pinned before protocol 15 must be recreated.
|
|
18
54
|
* The Host serves protocol 15 only.
|
|
19
|
-
* Protocol 14: environment manifests
|
|
55
|
+
* Protocol 14: environment manifests. `/v1/environment-manifests/{name}` holds
|
|
20
56
|
* named, versioned definitions of a kind of Environment, saved like agents (with `If-Match` and
|
|
21
57
|
* `?dryRun=true`), and `PUT /v1/environments/{id}` takes `manifest: "name"` or `"name@n"`. An
|
|
22
58
|
* Environment never changes what it runs after creation: a `PUT` on an existing one may change
|
|
@@ -24,10 +60,10 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
24
60
|
* `manifest`. A manifest's `secrets` declares slots: a write sends only the value, and a name it
|
|
25
61
|
* does not declare is `409 secret_not_in_manifest`. An agent manifest's `requires` is checked
|
|
26
62
|
* when a session opens (`409 environment_unsuitable`). Sessions on one Environment run their
|
|
27
|
-
* turns in parallel
|
|
63
|
+
* turns in parallel, so a turn start is no longer `environment_busy` because another
|
|
28
64
|
* session's turn runs, and every egress connection is an `environment.egress` event on the
|
|
29
65
|
* Environment's stream naming the turns that were running; `egress.connection` is gone from
|
|
30
|
-
* session logs and traces
|
|
66
|
+
* session logs and traces. The Host serves protocol 14 only.
|
|
31
67
|
* Protocol 13: the flat agent manifest (v7), a fresh start. A manifest has no capabilities: its
|
|
32
68
|
* instructions, tools, skills and MCP servers are top-level, and a skill or server from an Agent
|
|
33
69
|
* Plugin carries a `plugin` label. A session's pinned manifest carries the Runtime's `runtime`
|
|
@@ -41,7 +77,7 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
41
77
|
* accept (`422 attachment_unsupported`), with no turn. After its turn a file is a reference line
|
|
42
78
|
* the model reads again with `read_artifact`, which every agent now has. The Host accepts
|
|
43
79
|
* protocol 11 and 12: the change is additive.
|
|
44
|
-
* Protocol 11: Environments
|
|
80
|
+
* Protocol 11: Environments, a fresh start. `/v1/environments/{id}` replaces
|
|
45
81
|
* `/v1/sandboxes`: an Environment is one sandbox (kind `virtual`, `pod` or `none`) with a recipe
|
|
46
82
|
* that can change and one vault, written on the Runtime API
|
|
47
83
|
* (`PUT /v1/environments/{id}/secrets/{name}`). Sessions name an `environment` or nothing; the
|
|
@@ -49,7 +85,7 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
49
85
|
* user and installation vaults and `/v1/tenant/vaults` are gone. Error codes, event types, the
|
|
50
86
|
* scope (`environments:write`) and identity-file grants (`environments`) say Environment. An
|
|
51
87
|
* older client is answered `426`.
|
|
52
|
-
* Protocol 10: MCP credential custody leaves OSS
|
|
88
|
+
* Protocol 10: MCP credential custody leaves OSS. The vault credential type `oauth`, the
|
|
53
89
|
* MCP OAuth connect (`/v1/tenant/vaults/{vaultId}/oauth/start`, `/v1/oauth/callback`) and the
|
|
54
90
|
* credential resolver are gone: a session's MCP servers and HTTP tools reach their credentials
|
|
55
91
|
* through its attached vaults only.
|
|
@@ -58,12 +94,12 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
58
94
|
* `WWW-Authenticate: Bearer` challenge instead of the opaque 404, a token missing a scope gets
|
|
59
95
|
* `error="insufficient_scope"`, and `GET /.well-known/oauth-protected-resource` names the trusted
|
|
60
96
|
* issuers. Identity files lose `maxLifetime`: the issuer sets its tokens' lifetimes.
|
|
61
|
-
* Protocol 8: the Runtime and Management APIs (`key_role_mismatch`), and manifest-only agents
|
|
62
|
-
*
|
|
97
|
+
* Protocol 8: the Runtime and Management APIs (`key_role_mismatch`), and manifest-only agents:
|
|
98
|
+
* manifest v5 and workflow manifest v3, no hooks or flow functions, remote MCP
|
|
63
99
|
* only, and no Action endpoints (`/v1/endpoints` and `/v1/actions/*` answer 404, delivery
|
|
64
100
|
* tokens are gone): an agent's tools are HTTP tools, remote MCP servers, agents and the
|
|
65
101
|
* Runtime's built-ins.
|
|
66
|
-
* Protocol 7: open-source auth
|
|
102
|
+
* Protocol 7: open-source auth. Subject tokens (`POST /v1/tokens`), the access policy,
|
|
67
103
|
* revocations, browser keys (`Nylorun-Key`), the Runtime's own CORS and derived principals are gone; their
|
|
68
104
|
* routes answer 404. Browsers and apps present a trusted issuer's token, servers an operator key.
|
|
69
105
|
* Protocol 6: file artifacts (`/v1/artifacts/**`, Runtime-signed capability links) and user
|
|
@@ -71,7 +107,7 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
71
107
|
* it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
|
|
72
108
|
* that remains; a client that requires `action-endpoints` is refused by the feature check.
|
|
73
109
|
*/
|
|
74
|
-
export declare const PROTOCOL_VERSION =
|
|
110
|
+
export declare const PROTOCOL_VERSION = 18;
|
|
75
111
|
/** What a client of this protocol requires of a Host. */
|
|
76
112
|
export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts",
|
|
77
113
|
/**
|
|
@@ -86,13 +122,6 @@ export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts
|
|
|
86
122
|
* metadata at `/.well-known/oauth-protected-resource` when it has trusted issuers.
|
|
87
123
|
*/
|
|
88
124
|
"resource-server",
|
|
89
|
-
/**
|
|
90
|
-
* Protocol 11: Environments (`/v1/environments/{id}`, kinds `virtual`, `pod` and `none`), each
|
|
91
|
-
* with one vault written on the Runtime API; sessions name an `environment`; token callers
|
|
92
|
-
* carry Environment grants checked at every turn start, and `environments:write` lets a
|
|
93
|
-
* subject create, change and delete the Environments it is granted.
|
|
94
|
-
*/
|
|
95
|
-
"environments",
|
|
96
125
|
/** Protocol 12: the model catalog and provider list say which inputs each model reads. */
|
|
97
126
|
"model-inputs",
|
|
98
127
|
/**
|
|
@@ -101,19 +130,32 @@ export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts
|
|
|
101
130
|
* block, and tool calls, MCP servers and HTTP calls are named without capability ids.
|
|
102
131
|
*/
|
|
103
132
|
"flat-manifest",
|
|
104
|
-
/**
|
|
105
|
-
* Protocol 14: environment manifests (`/v1/environment-manifests/{name}`), Environments made
|
|
106
|
-
* from one version and never changed after creation, secret slots, and an agent manifest's
|
|
107
|
-
* `requires`, checked when a session opens.
|
|
108
|
-
*/
|
|
109
|
-
"environment-manifests",
|
|
110
133
|
/**
|
|
111
134
|
* Protocol 15: the harness boundary. `read_artifact` and `save_artifact` are our harness's
|
|
112
135
|
* tools, not the Runtime's: a session's pinned `runtime` block no longer carries them, and an
|
|
113
136
|
* author tool may take their names. MCP tools are named by the harness and identified by
|
|
114
137
|
* `{server, tool}`: tool policy rules and approvals name them so.
|
|
115
138
|
*/
|
|
116
|
-
"harness-boundary"
|
|
139
|
+
"harness-boundary",
|
|
140
|
+
/**
|
|
141
|
+
* Protocol 16: agent manifests (`/v1/agent-manifests/{name}`, v8, with a harness and a runtime
|
|
142
|
+
* section checked against each other at save) and Agents (`/v1/agents/{id}`, kinds `virtual`,
|
|
143
|
+
* `pod` and `none`, each with one vault), made from one manifest version, with a derived
|
|
144
|
+
* `state`; every session runs on an Agent; token callers carry Agent grants checked at every
|
|
145
|
+
* turn start, and `agents:write` lets a subject create, change and delete the Agents it is
|
|
146
|
+
* granted.
|
|
147
|
+
*/
|
|
148
|
+
"agents",
|
|
149
|
+
/**
|
|
150
|
+
* Protocol 17: a queue per session. A message to a busy session is queued unless it asks
|
|
151
|
+
* `delivery: "reject"`, and the busy refusal is `409 session_busy`.
|
|
152
|
+
*/
|
|
153
|
+
"session-queue",
|
|
154
|
+
/**
|
|
155
|
+
* Protocol 18: model call reads carry their timing and their cost by token kind, and a
|
|
156
|
+
* session's usage the cost by kind and the model time.
|
|
157
|
+
*/
|
|
158
|
+
"usage-by-kind"];
|
|
117
159
|
export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
|
|
118
160
|
/**
|
|
119
161
|
* Host features no client requires: a client that uses one checks the Host's `/health`
|
|
@@ -142,14 +184,14 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
|
|
|
142
184
|
* `credential-coverage`: `POST /v1/tenant/credential-coverage` (the Management API) says which
|
|
143
185
|
* credential of an Environment's vault each of a saved agent's MCP servers and HTTP tools would
|
|
144
186
|
* get in a session that names that Environment.
|
|
145
|
-
* `tool-calls
|
|
187
|
+
* `tool-calls`: `GET /v1/sessions/{id}/calls/tool` pages a session's tool calls from the
|
|
146
188
|
* effect journal, every `tool.completed` says how its call ended (`status`, `kind`, `server`,
|
|
147
189
|
* `attempts`, `durationMs`), and tool calls are delivered at least once with their effect id as
|
|
148
190
|
* the key (`Idempotency-Key` for HTTP tools, `_meta["nylorun/idempotency-key"]` for MCP tools).
|
|
149
|
-
* `tool-policy
|
|
191
|
+
* `tool-policy`: `GET`/`PUT /v1/tenant/tool-policy` (the Management API) sets which
|
|
150
192
|
* MCP and HTTP tool calls run, wait for a person (`ask`: the turn pauses until `approve`) or are
|
|
151
193
|
* refused (`deny`: `tool.denied`), for every harness; a manifest that sets `approval` is refused.
|
|
152
|
-
* `traces
|
|
194
|
+
* `traces`: `GET /v1/sessions/{id}/turns/{turnId}/trace` answers a turn's spans as OTLP JSON,
|
|
153
195
|
* the spans the Runtime posts to an OTLP collector when one is configured; a command or an AG-UI
|
|
154
196
|
* or A2A request sent with a `traceparent` joins the caller's trace.
|
|
155
197
|
*/
|
|
@@ -163,9 +205,11 @@ export interface ProtocolRange {
|
|
|
163
205
|
features: readonly string[];
|
|
164
206
|
}
|
|
165
207
|
/**
|
|
166
|
-
* What this Host serves: protocol
|
|
167
|
-
*
|
|
168
|
-
* protocol it needs rather than
|
|
208
|
+
* What this Host serves: protocol 16, 17 and 18. Protocol 16 replaced agent definitions and
|
|
209
|
+
* Environments with agent manifests and Agents, so an older client is answered `426` naming the
|
|
210
|
+
* protocol it needs rather than routes it cannot use. Protocol 17 is additive: a protocol 16
|
|
211
|
+
* client's messages default to `delivery: "reject"`. Protocol 18 is additive: a protocol 16 or 17
|
|
212
|
+
* client's usage reads leave out the fields it added.
|
|
169
213
|
*/
|
|
170
214
|
export declare const HOST_PROTOCOL: ProtocolRange;
|
|
171
215
|
export declare const DEFINITION_SCHEMA_VERSION = 2;
|
|
@@ -203,25 +247,48 @@ export declare const ERROR_CODES: readonly ["not_found",
|
|
|
203
247
|
"invalid_request",
|
|
204
248
|
/** A route that acts for a person was called without one (`Nylorun-Subject`). */
|
|
205
249
|
"subject_required",
|
|
206
|
-
/** A token caller's
|
|
207
|
-
"
|
|
250
|
+
/** A token caller's Agent grants do not reach the Agent. */
|
|
251
|
+
"agent_not_granted",
|
|
252
|
+
/**
|
|
253
|
+
* A message to a session whose turn runs, or that waits on an approval, an answer or an
|
|
254
|
+
* uncertain call, sent with `delivery: "reject"` (protocol 17): `409`. Without it the message is
|
|
255
|
+
* queued.
|
|
256
|
+
*/
|
|
257
|
+
"session_busy",
|
|
258
|
+
/**
|
|
259
|
+
* The session already holds the Runtime limit `sessionQueuedMessages` queued messages
|
|
260
|
+
* (protocol 17): `429`. They start a turn when the running one ends.
|
|
261
|
+
*/
|
|
262
|
+
"queue_full",
|
|
263
|
+
/**
|
|
264
|
+
* `POST /v1/agents/{id}/triggers/{triggerId}/resume` on an `at` trigger whose time has passed:
|
|
265
|
+
* `409`. Save a manifest version with a new time.
|
|
266
|
+
*/
|
|
267
|
+
"trigger_expired",
|
|
268
|
+
/** A signed delivery to a paused webhook trigger: `409`; nothing runs. */
|
|
269
|
+
"trigger_paused",
|
|
270
|
+
/**
|
|
271
|
+
* A memory write whose `content_sha256` precondition no longer holds, or a path a folder or
|
|
272
|
+
* another memory already holds: `409`. Read the memory again and write on top.
|
|
273
|
+
*/
|
|
274
|
+
"memory_conflict",
|
|
208
275
|
/** Disk work (snapshot, restore, stop, reset) while a turn runs, or a turn while a disk copy runs. */
|
|
209
|
-
"
|
|
210
|
-
/** The
|
|
211
|
-
"
|
|
212
|
-
/** The Tenant's placement keeps this session's harness off the host its
|
|
276
|
+
"agent_busy",
|
|
277
|
+
/** The Agent is gone, or its kind cannot run on this Runtime. */
|
|
278
|
+
"agent_unavailable",
|
|
279
|
+
/** The Tenant's placement keeps this session's harness off the host its Agent needs. */
|
|
213
280
|
"placement_refused",
|
|
214
|
-
/** A pod
|
|
215
|
-
"
|
|
281
|
+
/** A pod Agent's volume or node is gone: only `POST /v1/agents/{id}/reset` brings it back. */
|
|
282
|
+
"agent_lost",
|
|
216
283
|
/**
|
|
217
|
-
* The
|
|
284
|
+
* The Agent names an owner (`owner`) other than the session's owner: `403` to an
|
|
218
285
|
* application key; a caller acting for a person gets the opaque `404`.
|
|
219
286
|
*/
|
|
220
|
-
"
|
|
287
|
+
"agent_owner_mismatch",
|
|
221
288
|
/**
|
|
222
|
-
* The session's
|
|
223
|
-
*
|
|
224
|
-
*
|
|
289
|
+
* The session's Agent runs another harness than the one the session pinned when it opened: an
|
|
290
|
+
* Agent's harness is fixed for its life, so its id was deleted and made again from a manifest
|
|
291
|
+
* with another harness. Open a new session.
|
|
225
292
|
*/
|
|
226
293
|
"harness_mismatch",
|
|
227
294
|
/**
|
|
@@ -235,50 +302,51 @@ export declare const ERROR_CODES: readonly ["not_found",
|
|
|
235
302
|
*/
|
|
236
303
|
"issuer_unavailable",
|
|
237
304
|
/**
|
|
238
|
-
* A definition names definition files the Runtime does not hold
|
|
305
|
+
* A definition names definition files the Runtime does not hold: upload each
|
|
239
306
|
* with `PUT /v1/files/sha256:<hex>` first. `details.missing` lists their hashes.
|
|
240
307
|
*/
|
|
241
308
|
"definition_files_missing",
|
|
242
309
|
/**
|
|
243
310
|
* Not an HTTP answer: the code of a tool error the model sees when an MCP server or HTTP tool
|
|
244
|
-
* answered `401
|
|
311
|
+
* answered `401`. The vault's credential (or none) was rejected; the call is not retried.
|
|
245
312
|
*/
|
|
246
313
|
"credential_rejected",
|
|
247
314
|
/**
|
|
248
|
-
* `POST /v1/tenant/mcp/preview` could not list the server's tools
|
|
315
|
+
* `POST /v1/tenant/mcp/preview` could not list the server's tools: `502`, with
|
|
249
316
|
* `details.failure` the code a tool call would have failed with (`mcp.unreachable` for an
|
|
250
317
|
* address the Host refuses, a connection that failed or a server silent past 15 s;
|
|
251
318
|
* `mcp.forbidden`, `mcp.status`, `mcp.error`).
|
|
252
319
|
*/
|
|
253
320
|
"mcp_preview_failed",
|
|
254
321
|
/**
|
|
255
|
-
* An Environment's credentials would be ambiguous
|
|
322
|
+
* An Environment's credentials would be ambiguous: `409` at the secret write. Two
|
|
256
323
|
* `environment_secret` credentials would be bound to one host, or two `bearer` or `headers`
|
|
257
324
|
* credentials to one URL.
|
|
258
325
|
*/
|
|
259
326
|
"credential_conflict",
|
|
260
327
|
/**
|
|
261
|
-
* A `PUT /v1/
|
|
262
|
-
*
|
|
263
|
-
*
|
|
328
|
+
* A move of an existing Agent (`PUT /v1/agents/{id}`) would change what is fixed for
|
|
329
|
+
* its life: its manifest's name, its kind, its harness or its storage. `409`, with each in
|
|
330
|
+
* `details.fields`. Fork it into a new Agent (`POST /v1/agents/{id}/fork`) instead.
|
|
264
331
|
*/
|
|
265
|
-
"
|
|
332
|
+
"agent_fixed_field",
|
|
266
333
|
/**
|
|
267
|
-
* A secret write named a secret the
|
|
268
|
-
*
|
|
334
|
+
* A secret write named a secret the Agent's manifest does not declare: `409`. Add the
|
|
335
|
+
* slot to the manifest's runtime section and move the Agent to the new version.
|
|
269
336
|
*/
|
|
270
337
|
"secret_not_in_manifest",
|
|
271
338
|
/**
|
|
272
|
-
*
|
|
273
|
-
* `details.
|
|
339
|
+
* An agent manifest whose harness and runtime sections do not fit each other (protocol 16):
|
|
340
|
+
* `422` when it is saved. `details.gaps` names each gap: a custom harness off a pod, a
|
|
341
|
+
* credential that is no declared slot of the right type, a sandbox the runtime does not give.
|
|
274
342
|
*/
|
|
275
|
-
"
|
|
276
|
-
/** No
|
|
343
|
+
"manifest_inconsistent",
|
|
344
|
+
/** No agent manifest has this name, or no version with this number. */
|
|
277
345
|
"manifest_not_found",
|
|
278
|
-
/** An
|
|
346
|
+
/** An agent manifest some Agent was made from cannot be deleted: `409`. */
|
|
279
347
|
"manifest_in_use",
|
|
280
348
|
/**
|
|
281
|
-
* `If-Match` named a version that is no longer the latest
|
|
349
|
+
* `If-Match` named a version that is no longer the latest: `412`. Read the manifest
|
|
282
350
|
* again, or save without `If-Match` (the CLI's `--if-match`, the SDK's `ifMatch`).
|
|
283
351
|
*/
|
|
284
352
|
"manifest_changed", "internal_error"];
|
|
@@ -292,7 +360,7 @@ export declare const ARTIFACT_ID_PATTERN: RegExp;
|
|
|
292
360
|
/**
|
|
293
361
|
* An application key's id: an operator key's name, which names its client (e.g. `backend`).
|
|
294
362
|
* `studio` is reserved for the key Studio derives from the admin key.
|
|
295
|
-
* An identifier's grammar is the protocol's
|
|
363
|
+
* An identifier's grammar is the protocol's: it crosses the Runtime API, tokens and grants
|
|
296
364
|
* and means the same in every installation, so its length is a constant of protocol 15, not a
|
|
297
365
|
* setting.
|
|
298
366
|
*/
|