@nylorun/core 0.22.0-beta → 0.23.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +1 -1
  3. package/dist/compatibility.d.ts +32 -16
  4. package/dist/compatibility.js +33 -17
  5. package/dist/contracts.d.ts +531 -88
  6. package/dist/contracts.js +297 -199
  7. package/dist/define.d.ts +8 -12
  8. package/dist/define.js +7 -11
  9. package/dist/definition/assemble.d.ts +1 -3
  10. package/dist/definition/assemble.js +4 -8
  11. package/dist/definition/bound.d.ts +1 -1
  12. package/dist/definition/delegate.d.ts +5 -0
  13. package/dist/definition/delegate.js +6 -1
  14. package/dist/definition/from.d.ts +4 -2
  15. package/dist/definition/from.js +11 -29
  16. package/dist/definition/http-tool.d.ts +5 -3
  17. package/dist/definition/http-tool.js +8 -5
  18. package/dist/definition/manifest.d.ts +7 -6
  19. package/dist/definition/manifest.js +7 -6
  20. package/dist/definition/mcp.d.ts +1 -1
  21. package/dist/definition/media-reference.d.ts +2 -11
  22. package/dist/definition/media-reference.js +0 -12
  23. package/dist/definition/model-failure.js +1 -0
  24. package/dist/definition/removed.js +1 -0
  25. package/dist/definition/trace.d.ts +0 -7
  26. package/dist/definition/trace.js +0 -34
  27. package/dist/definition/variant.d.ts +1 -1
  28. package/dist/definition/variant.js +1 -3
  29. package/dist/harness-api/artifacts.d.ts +84 -0
  30. package/dist/harness-api/artifacts.js +128 -0
  31. package/dist/harness-api/gates.d.ts +0 -4
  32. package/dist/harness-api/gates.js +0 -4
  33. package/dist/harness-api/harness-api.schema.json +2422 -924
  34. package/dist/harness-api/index.d.ts +9 -6
  35. package/dist/harness-api/index.js +9 -6
  36. package/dist/harness-api/json-schema.js +5 -2
  37. package/dist/harness-api/mcp.d.ts +77 -30
  38. package/dist/harness-api/mcp.js +42 -25
  39. package/dist/harness-api/messages.d.ts +45 -17
  40. package/dist/harness-api/messages.js +20 -5
  41. package/dist/harness-api/schema.d.ts +538 -198
  42. package/dist/harness-api/schema.js +298 -59
  43. package/dist/harness-api/transcript.d.ts +8 -10
  44. package/dist/harness-api/transcript.js +27 -11
  45. package/dist/harness-api/transport.d.ts +7 -1
  46. package/dist/harness-api/transport.js +10 -7
  47. package/dist/schemas/agent-manifest.schema.json +5 -146
  48. package/dist/schemas/environment-manifest.schema.json +56 -16
  49. package/dist/types/manifest.d.ts +3 -13
  50. package/dist/types/model.d.ts +10 -5
  51. package/dist/utils/definition-files.d.ts +20 -6
  52. package/dist/utils/definition-files.js +31 -17
  53. package/dist/utils/file-systems.d.ts +20 -0
  54. package/dist/utils/file-systems.js +20 -0
  55. package/dist/utils/harness-id.d.ts +4 -1
  56. package/dist/utils/harness-id.js +4 -1
  57. package/dist/utils/media-types.d.ts +30 -0
  58. package/dist/utils/media-types.js +128 -0
  59. package/dist/utils/runtime-limits.d.ts +229 -0
  60. package/dist/utils/runtime-limits.js +482 -0
  61. package/dist/utils/runtime-tools.d.ts +8 -16
  62. package/dist/utils/runtime-tools.js +8 -27
  63. package/dist/utils/sandbox.d.ts +4 -1
  64. package/dist/utils/sandbox.js +4 -1
  65. package/package.json +1 -1
  66. package/dist/definition/deferred-tools.d.ts +0 -27
  67. package/dist/definition/deferred-tools.js +0 -82
  68. package/dist/definition/runtime-manifest.d.ts +0 -30
  69. package/dist/definition/runtime-manifest.js +0 -132
  70. package/dist/definition/sandbox-tools.d.ts +0 -5
  71. package/dist/definition/sandbox-tools.js +0 -109
  72. package/dist/definition/skill-tools.d.ts +0 -23
  73. package/dist/definition/skill-tools.js +0 -76
package/CHANGELOG.md CHANGED
@@ -1,5 +1,107 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.23.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 0a2fbc5: **Artifacts reach the harness through the Harness API; `read_artifact` and `save_artifact` run in the harness (protocol 15, Harness API 4).** The first step of the harness boundary: model-facing work belongs to the harness, and the Runtime offers primitives and holds limits and access. A fresh start for agent sessions: the Runtime speaks protocol 15 only. See MIGRATION.md.
8
+
9
+ - **The artifact seam.** A harness reads and writes the artifacts of the run it holds: `artifact.read {artifactId, version?, offset?, length?}` answers the version's metadata (`ArtifactMetaSchema`) and its bytes from `offset`, at most `turn.start.limits.chunkBytes`; `artifact.write` (`begin`, `chunk`, `commit`, `abort`) makes a file artifact of the session or a new version of one of its own, streamed with backpressure into the Object store and committed in Postgres within the Tenant's and the Environment's artifact limits. The scope is always the run's session: its own artifacts, and the Tenant-wide ones its messages named; anything else is the new error code `not_found`, alike. A write's `key` makes it idempotent within the session (`artifact_versions.write_key`, migration 0028), and its `effectId` links the artifact to a tool call of the turn, whose call id `artifact.created` carries. An upload the run leaves open commits nothing. Client helpers: `readArtifact`, `openArtifactWrite`, `writeArtifactBytes`, `toBase64` and `fromBase64` in `@nylorun/core/harness-api`.
10
+ - **Our harness runs the artifact tools.** `read_artifact` (every agent) and `save_artifact` (with a sandbox) are our engine's tools, defined in `@nylorun/harness` (`artifactToolsFor`, `runArtifactTool`) and run over the seam and the run's sandbox files (`HarnessExecutors.files`, `SandboxManager.writeBytes`); their calls are kind `harness`. `save_artifact` keys its write by its effect id. `read_artifact` takes `path` with a sandbox, which copies the whole artifact into it, and hands a file of any other type to the model as a file of the result (the Model Gate writes the note for one the model does not read; `artifact.unsupported` is gone). Its page is harness configuration, `createHarness({ artifactPageBytes })` (32 KiB by default), and now always ends on a whole character. `runDurable` takes `engineTools`; `apiHost` takes the engine's configuration.
11
+ - **The Runtime pins no artifact tools.** `runtimeManifestFor` has no `save` or `read`; `RUNTIME_TOOL_NAMES` no longer holds the two names, so an author tool may take one (our harness then refuses the turn). A session without a sandbox or skills pins its definition unchanged. Core no longer runs either tool (`tenant/artifact-tool.ts` is gone). Migration 0029 closes every agent session that pinned them (`closedReason: "protocol_15"`, `409 session_closed`); workflow sessions carry over.
12
+ - **Media types are core's.** `contentTypeFor`, `essence`, `normalizeContentType`, `isText`, `isModelImage`, `modelInputOf`, `inputLabel`, `extensionFor`, `unreadableReason`, `MODEL_IMAGE_TYPES` and `DEFAULT_CONTENT_TYPE` are exported from `@nylorun/core/contracts`, for the Runtime and harnesses alike.
13
+ - `PROTOCOL_VERSION` 15 with required feature `harness-boundary`; `HARNESS_API_VERSION` 4. The SDKs and the CLI send protocol 15.
14
+
15
+ - ebe7348: **The harness decides how files reach the model; the Model Gate only fetches and translates (protocol 15).** The second step of the harness boundary, still protocol 15 and Harness API 4. See MIGRATION.md.
16
+
17
+ - **Any file may be sent.** A message naming a file the model does not read is accepted: `422 attachment_unsupported` and its error code are gone, and AG-UI and A2A accept such files too. Files are still held to the artifact size limits at upload.
18
+ - **`turn.start.model`** is the model descriptor (`ModelDescriptorSchema`): the provider, id, inputs, context window and output limit of the model the turn's calls use, absent for flows and without a model. One resolution (`model/descriptor.ts`) serves it, the catalog's inputs and the gate.
19
+ - **Our engine shows each file.** An image or document the model reads goes as its artifact reference, a text file is read over the artifact seam and inlined as a `<file>` block, and anything else (past `modelFileBytes`, a kind the model does not read) is a note it writes. `fileView`, `representFiles`, `fileBlock`, `fileNote` and `mediaReferenceLine` (moved from `@nylorun/core/define`) are exported from `@nylorun/harness`. A budget from the descriptor bounds the prompt before the first answer, and compaction counts files as the model gets them.
20
+ - **The Model Gate refuses instead of writing notes.** A text file as a media part, or a kind the model or its API does not read, fails the call with the new model failure code `unsupported_input`; a reference it cannot fetch fails `invalid_request`. Nothing is sent, and neither is retried.
21
+ - **Structured answers are the engine's.** `ModelCall.outputSchema` is removed: our engine writes the JSON instruction and parses the answer (fenced, with control characters repaired; `parseJsonWithRepair` ported from pi-ai). `message.assistant` for a structured answer now carries its JSON text.
22
+ - **`read_artifact`** refuses a file the turn's model does not read (`artifact.unsupported`, with the reason).
23
+ - `unreadableReason` is removed; `isOffice` joins the media type helpers in `@nylorun/core/contracts`.
24
+ - Studio's file picker accepts every file, and the refusal chips are gone.
25
+
26
+ - ff6470e: **The harness writes the model's instructions and defines the sandbox and skill tools; no `runtime` block (protocol 15).** The third step of the harness boundary, still protocol 15 and Harness API 4. See MIGRATION.md.
27
+
28
+ - **No `runtime` block.** The Runtime no longer pins model-facing text or tools on a session's manifest: a session pins its definition as registered (`manifestHash` equals `definitionHash`) and keeps its sandbox spec on the session. The manifest schema refuses `runtime` with what replaces it (`REMOVED_MANIFEST_FIELDS`). `runtimeManifestFor`, `runtimeToolOf`, `RuntimeManifest`, `RUNTIME_TOOL_NAMES`, `isRuntimeToolName`, `createSandboxTools`, `SANDBOX_INSTRUCTIONS`, the skill tool names, `isSkillTool`, `SKILLS_USAGE`, `formatSkillCatalog` and `skillOfToolCall` leave `@nylorun/core/define`; `RUNTIME_PART_ID` is `SESSION_PART_ID` (`"session"`), and `agentFrom` takes `sessionInstructions`. `@nylorun/agents` no longer re-exports the skill catalog helpers. Migration 0030 closes the agent sessions that still pinned a `runtime` block (`closedReason: "protocol_15"`).
29
+ - **`turn.start` states facts.** `environment` (`TurnEnvironmentSchema`: `{id, kind, sandbox?: {workspace}}`) and `routing.sandbox.spec` (the pinned spec) join the agent's `skills`.
30
+ - **Our engine words them.** `@nylorun/harness` writes the skill catalog, the sandbox note and the skills' folder note, and defines the six sandbox tools, `load_skill` and `read_skill_resource`, in the order and bytes the `runtime` block had, so the prompt's prefix is unchanged (`engineToolsFor`, `sandboxTools`, `sandboxInstructions`, `skillCatalogText`, `skillFolderNote`, `skillTools`, all exported for a harness of your own). The skill tools run in the harness over `definition.file` (`runSkillTool`), and core no longer runs them (`tenant/skill-tool.ts` is gone). The sandbox tools' limits are harness configuration (`createHarness({ sandboxTools })`, `harnessExecutors({ sandboxTools })`, `DEFAULT_SANDBOX_TOOL_LIMITS`), as is the most a skill read takes into the context (`createHarness({ skillReadBytes })`, 10 MiB by default), held to the run's `limits.recordEntryBytes`.
31
+ - **Effects name their target.** A tool effect carries `target: {kind: "mcp" | "http" | "sandbox" | "harness" | "platform"}` (`EffectTargetSchema`) and may carry `skill`; the record routes by the kind, never by the tool's name, and a call without a target or one the session lacks is `tool.unavailable`. `hello.features.tools` and `NativeToolSchema` are removed, no tool name is reserved, and the record keeps the skill the intent names when the agent has it. A skill tool's `tool.completed` is `kind: "harness"` (it was `platform`).
32
+ - **Studio** drops the manifest panel's Runtime section: it shows the sandbox tools when the session's Environment has a sandbox.
33
+
34
+ - f443475: **The harness builds the MCP tool list and shapes tool results; tools are identified by server and tool (protocol 15).** The fourth step of the harness boundary, still protocol 15 and Harness API 4. See MIGRATION.md.
35
+
36
+ - **Tools have an identity.** An MCP tool call's target is `{kind: "mcp", server, tool}` (the server's own name for the tool) and an HTTP tool call's `{kind: "http", tool}` (its declared name); `platform` is gone. `toolName` is the model's name, for display. The record checks an MCP call against the session's discovery (`tool.unknown`) and the turn's tool settings (`tool.disabled`), and `tool.completed`, tool-call rows (`tool`), approvals (`Approve server / tool?`, `interaction.tool`) and traces (`nylorun.tool.identity`) carry the identity. The Tool Gate matches a call to its journaled target.
37
+ - **Tool policy keys on identity.** A rule's `tool` is the tool's identity, never the model's name. A rule whose `tool` has `__` in it is refused at `PUT /v1/tenant/tool-policy`; a stored one makes the policy unreadable, so every call is denied (and `GET` answers `409`) until the policy names the tool by `server` and `tool`.
38
+ - **`turn.start.mcp` states facts.** The session pins what its servers listed, raw (`McpSnapshot` v2: servers, scrubbed instructions, tools as named); each turn gets `mcp` (`McpFactsSchema`: every tool with `enabled` and the manifest's `deferred` hint) in place of `sessionTools` and `routing.mcpSnapshot`, and `session.mcp` answers `{mcp}`. `mcp.discovered` has no `renamed` or `deferred`. Migration 0031 closes the sessions that pinned the former snapshot (`closedReason: "protocol_15"`).
39
+ - **Our engine names, defers and searches.** `@nylorun/harness` names MCP tools (`mcpToolName`, `mcpToolNames`, within the 64-character provider ceiling), defers them by the manifest's setting or the model's window and pins that layout in its state (`mcpToolSet`, `McpLayout`), and runs `tool_search` (BM25) itself; core's `tool_search`, `deferredToolsTools`, `TOOL_SEARCH_TOOL` and `TOOL_CALL_TOOL` leave `@nylorun/core/define`, and `runDurable` takes `mcp` instead of `sessionTools`.
40
+ - **Our engine shapes tool results.** Core no longer stores large or binary tool results: the record refuses an outcome past `limits.recordEntryBytes` (`limit_exceeded`). Our engine spills them with `artifact.write`, keyed by the call and its bytes (`spillKey`), with a preview, an image as a file for a model that reads images, and one budget per step (`shapeToolOutcome`, `StepBudget`, exported for a harness of your own). The Tool Gate still scrubs credentials and refuses answers past `limits.toolAnswerBytes`.
41
+ - **Harness configuration.** `createHarness({ mcpTools, toolResults })` sets the deferral share, characters per token, fallback window, the note's instruction length, `tool_search`'s limits, the inline cap, preview head and tail, step budget, stub, small size and entry envelope (`DEFAULT_MCP_TOOL_CONFIG`, `DEFAULT_TOOL_RESULT_CONFIG`).
42
+ - **The MCP preview** names tools as Nylorun's engine would (`modelName`, `renamed`) and shows a server's instructions uncut.
43
+ - **Studio** shows an MCP tool as `server / tool` in tool and approval cards, with the model's name, and links the artifacts a tool's result was stored in.
44
+ - **`examples/harness-minimal`** spills a large `bash` output with `artifact.write` and keeps a preview; its README shows how a harness of your own offers MCP tools.
45
+
46
+ - cf425c6: **The harness mounts skills and saves outputs; the in-process harness uses the gates; compaction is a transcript edit (protocol 15).** The fifth step of the harness boundary, still protocol 15 and Harness API 4. See MIGRATION.md.
47
+
48
+ - **Skill folders are our engine's.** Before each sandbox call our engine mounts each skill version of the turn's tree at `/skills/<name>@<hash>/` with `executors.files.mount`, reading the bytes over `definition.file`; the SandboxManager only writes them (`mountFolder`), once per open sandbox (`present` after). `SandboxManager.mountSkills`, its `definitionFile` port and `SandboxSessionRef.manifest` are gone, and the operator sandbox route mounts nothing.
49
+ - **The outputs folder is our engine's (Q5).** At a completed turn's end in a sandbox our engine saves `/workspace/outputs` as the session's `outputs` folder before `turn.completed`, over the new folder mode of `artifact.write` (`kind: "folder"`, `file`, chunks named by hash, `unchanged`, `refused`). Core takes every byte, checks each file's hash before content is stored under it, dedupes, and keeps the content epoch and quotas. Versions say `source: "engine"`; `artifact.export.skipped` and `artifact.export.failed` are harness claims. Core's export (`artifacts/export.ts`, the `WorkspaceReader`, `workspace.read` listing and bytes calls) is removed.
50
+ - **No limit literals.** The new Runtime limit `folderEntries` (10,000; a count, its ceiling from the manifest's one string) replaces `EXPORT_MAX_FILES`, and `createHarness({ outputs: { dir, maxBytes } })` (`/workspace/outputs`, 1 GiB) replaces `EXPORT_MAX_BYTES`. `RUNTIME_LIMIT_CEILINGS` entries are `{value, unit, why}`.
51
+ - **In-process parity.** Every model call goes through the Model Gate: a scripted model is served by `providerModelGate`, metered like any. The MCP pool opens every server through the Tool Gate (`openRemote` is required; the in-process gate's `openMcp` finds the server in the session's pinned manifest and authorizes it with the vault). `ModelRoute` is `{tenantId, modelGate}`; `TenantContext.modelProvider`, `useVaultModel` and `workspaces` are gone.
52
+ - **Compaction is a transcript edit (Q4).** Summary calls say `purpose: "summary"` (no `message.assistant`), and the segment's edit that replaced the history says `kind: "compaction"` with its facts and summary calls (`CompactionFactsSchema`, `transcriptUpdates(..., compaction)`). Core checks the calls and writes one `context.compacted`, which loses `partial`.
53
+
54
+ - 23774c4: **The last hard-coded limits are configuration (harness boundary B15c).** Still protocol 15 and Harness API 4. Every default is the value before. See MIGRATION.md, and DEPLOYMENT.md's Runtime limits and Host tuning.
55
+
56
+ - **21 more Runtime limits** (`GET`/`PUT /v1/tenant/limits`): a message's parts (`messageParts`), page sizes (`pageItems`, `exportPageItems`, `environmentEventItems`; a page asked larger holds that many), labels (`artifactLabels`, `labelKeyChars`, `labelValueChars`), a manifest's setup command, descriptions and secret hosts (`setupCommandChars`, `manifestDescriptionChars`, `secretDescriptionChars`, `secretHosts`), a failed pod's reason (`setupReasonChars`, `setupCommandExcerptChars`), secret values (`secretValueChars`), the tool policy and budgets (`toolRules`, `toolRuleFieldChars`, `toolRuleTextChars`, `modelBudgets`) and flows (`flowConcurrency`, `flowMapItems`, `flowLoopIterations`, replacing the `NYLORUN_FLOW_*` variables no Host read). Request schemas lose these maxima; the Runtime checks the Tenant's.
57
+ - **More Host tuning** (`NYLORUN_TUNING`): token lifetimes and clock tolerance (`keys.*`), the advance deadline and grace (`execution.*`), `nylorun-operate`'s waits, the credential store's lock, sweep arming, Postgres batches and the replication pool, a basin repair's log cadence, egress sockets, the engine poll and sandbox memory floor, MCP listing pages and diagnostics, sandbox helper commands, the scrub threshold, exec event and local stream sizes; and in the engine, `flowValueChars` and `toolResults.minPreviewBytes`.
58
+ - **The CLI's own waits are `NYLORUN_CLI_TUNING`**: `nylorun start`'s waits and polls, the Compose healthchecks and WAL cap, and `nylorun local sandbox`'s waits.
59
+ - **Studio follows the Runtime's limits**: no upload cap of its own, the Tenant's `requestBodyBytes` read for a write it parses past the default (`@nylorun/agents` exports `RUNTIME_LIMIT_DEFAULTS`), no CPU cap in its form.
60
+ - **Kept, each justified where it is defined**: Linux's `MAX_ARG_STRLEN` (a setup command's ceiling) and `PATH_MAX` (a link target), a model-facing tool name's 64 characters, RFC 6838's media type length, Postgres's 65,535 bind parameters, a tmpfs page, and identifier grammars (the protocol's).
61
+
62
+ - b1e815d: **Runtime limits are a Tenant setting, and harnesses get them in `turn.start.limits`.**
63
+
64
+ - What one record entry, model call, model file, tool answer, custom harness state and Harness API chunk may hold is the new Management API setting `GET`/`PUT /v1/tenant/limits` (`{ limits: { recordEntryBytes, modelCallBytes, modelFileBytes, toolAnswerBytes, harnessStateBytes, chunkBytes } }`), also `admin.settings.limits` and `nylorun tenant settings limits [get | put <file|->]`.
65
+ - The defaults are today's sizes (`RUNTIME_LIMIT_DEFAULTS`): 960 KiB, 32 MiB, 8 MiB, 8 MiB, 256 KiB and 16 MiB. A limit left out of a `PUT` takes its default.
66
+ - Each limit has a ceiling a dependency sets (`RUNTIME_LIMIT_CEILINGS`): S2's 1 MiB record less 64 KiB for the event's envelope, the 64 MiB Harness API frame, the longest JavaScript string. A limit above its ceiling is `400`, naming the ceiling.
67
+ - Each is read from the Tenant's database where it is checked; nothing keeps it.
68
+ - **The record holds every write to `recordEntryBytes`.** An event whose payload, or an effect outcome whose value, is larger, whoever wrote it, is refused with `limit_exceeded`: `413` (`details.limit: "recordEntryBytes"`) to an API client, the new Harness API error code `limit_exceeded` to a harness. A harness's claimed event past it is refused rather than dropped. Before, such an event reached a record S2 could not take.
69
+ - **The gates read the setting.** The Model Gate refuses a body past `modelCallBytes` and a file past `modelFileBytes`; the Tool Gate keeps no MCP or HTTP answer past `toolAnswerBytes` (`mcp.too-large`, `http.too-large`) and reads no tool body past it. A custom harness's state past `harnessStateBytes` fails its turn with `limit_exceeded` (it was `invalid`), and a `definition.file` range longer than `chunkBytes` is `limit_exceeded`. Core's step budget for tool results is unchanged (256 KiB), or half `recordEntryBytes` when that is less.
70
+ - **`turn.start` carries `limits`** (`RuntimeLimitsSchema`), the limits in force when the segment started. Harness API 3 and protocol 14 are unchanged, but `TurnStartSchema` is strict: a harness built against an older `@nylorun/core` refuses a `turn.start` with `limits`, so upgrade a custom harness with the Runtime. Our harness asks for skill files `limits.chunkBytes` at a time, and holds MCP answers on its own connections to `limits.toolAnswerBytes`. `createHarness` takes `onStart(grant, start)`.
71
+ - **Removed exports:** `MAX_MODEL_CALL_BYTES`, `MAX_TOOL_BODY_BYTES`, `MAX_HARNESS_STATE_BYTES` and `DEFINITION_FILE_CHUNK_BYTES` from `@nylorun/core`. Added: `RuntimeLimitsSchema`, `RUNTIME_LIMIT_DEFAULTS`, `RUNTIME_LIMIT_CEILINGS`, `runtimeLimitsOf`, `runtimeLimitIssues`, `limitExceededMessage`, `S2_RECORD_MAX_BYTES`, `RECORD_ENVELOPE_RESERVE_BYTES`, `JS_STRING_MAX_LENGTH` and the `TenantLimits*` schemas.
72
+
73
+ - f2e9b0a: **Skill and artifact limits are set per Tenant and per Environment manifest; a skill holds up to 2 GiB by default, with no limit per file or on the number of files.**
74
+
75
+ - The 10 MiB limit per skill file and the 500-file limit are gone. A skill's files may hold up to the Tenant's skill limit together: 2 GiB by default (`SKILL_TOTAL_BYTES_DEFAULT`). A file at two paths counts twice, since a sandbox holds both copies. `SKILL_FILES_MAX` and `DEFINITION_FILE_MAX_BYTES` are no longer exported.
76
+ - The Tenant's skill limit is the new Management API setting `GET`/`PUT /v1/tenant/skills` (`{ limits: { totalBytes } }`), also available as `admin.settings.skills` and `nylorun tenant settings skills [get | put <file|->]`.
77
+ - `PUT /v1/files/sha256:<hex>` takes a file up to that limit.
78
+ - `PUT /v1/agents/{id}` refuses a skill over it, an agent used as a tool included: `413 limit_exceeded`, with `details.skills` listing each skill and its size.
79
+ - An environment manifest, or the inline fields of `PUT /v1/environments/{id}`, may set `limits`: `artifacts.fileBytes`, `artifacts.totalBytes` and `skills.totalBytes`. Like the manifest's other fields, they are fixed for the Environment's life.
80
+ - Each limit must be at most the Tenant's. A higher one is refused with `400` when the Environment is made or the manifest is saved.
81
+ - A limit left out is the Tenant's at the time it is checked. A Tenant that lowers a limit lowers it for every Environment.
82
+ - The Environment view's new `limits` field gives the limits in force.
83
+ - An Environment's artifacts are its sessions' artifacts and its disk versions. Uploads, `save_artifact`, turn-end exports and disk snapshots hold them to the Environment's per-file limit and to its own total, as well as to the Tenant's total. A turn-end export past the Environment's total is skipped with the new reason `environment_total`, and a disk snapshot past it is `413` with `details.limit: "environment_total"`.
84
+ - A session opens on an Environment only when its agent's skills fit the Environment's skill limit; otherwise it is `409 environment_unsuitable`, with `details.skills`.
85
+ - `PUT /v1/files` streams the body to the Object store instead of holding it in memory. Only bytes that match the named hash reach the file's key. Environment files named by hash are held to the same per-file maximum.
86
+ - `@nylorun/agents`: loading a skills folder no longer checks a size, since the limit is the Tenant's; the Runtime refuses an oversized skill. The `skills.file-too-large` and `skills.too-many-files` errors are gone. Files are hashed and read a chunk at a time.
87
+ - Sandboxes get skill files as a stream. A harness fetches them from core 16 MiB at a time: `definition.file` takes optional `offset` and `length` (at most the Runtime limit `chunkBytes`).
88
+ - `load_skill` and `read_skill_resource` read files of up to 10 MiB into the model's context. A larger file fails with `skill.resource_too_large`, and the error names the file's path in the sandbox when there is one.
89
+
90
+ - 6772612: **The remaining request, upload, token and sandbox limits are Tenant settings (harness boundary B15).** Still protocol 15 and Harness API 4. See MIGRATION.md and DEPLOYMENT.md's Runtime limits.
91
+
92
+ - **27 more Runtime limits** in `GET`/`PUT /v1/tenant/limits`, each with today's value as its default and a ceiling from a dependency (a JavaScript string or timer, a request read as one string, a Harness API frame, a JavaScript number): request bodies and inline files (`requestBodyBytes`, `inlineFileBytes`), `a2aWaitMs`, `errorExcerptChars`, `traceContentBytes`, an Environment's labels, setup and input files (`environmentLabels`, `environmentSetupCommands`, `environmentFiles`, `environmentFilesPerEntry`, `environmentSecretSlots`, `setupCommandMs`, `setupOutputChars`), disk versions (`diskVersionEntries`, `diskVersionBytes`, `diskLeaseMs`, `diskPodWaitMs`; an Environment's manifest may lower the first two with `limits.disk`), model calls (`modelRequestMs`, `modelIdleMs`, `modelAttempts`, `modelRetryDelayMs`, `modelProviderRetries`, `modelRetryDelayMaxMs`, read by the gates for each call) and tools (`toolAttempts`, `httpToolTimeoutMs`, `mcpPreviewMs`, `mcpMetadataBytes`, and the new `mcpSnapshotBytes`: what a session pins of its MCP servers' tools and instructions, past which a server is left out with a diagnostic).
93
+ - **Schema maxima are checked against the Tenant's limits**: an Environment's labels, setup commands, input files, files per entry, secret slots and setup timeout, and an HTTP tool's `timeoutMs` (at deploy and at each call). `limits.environments` and `lifecycle.stopGrace` lose their arbitrary caps; an identity file's issuer takes any number of grants and `jwksFetch` settings.
94
+ - **`turn.start.limits` carries only a harness's limits** (`HarnessLimitsSchema`, `harnessLimitsOf`), and a harness drops one it does not know. `transcriptUpdates` takes `recordEntryBytes` and fills each event up to it; `CHUNK_BYTES` is gone.
95
+ - **Constants a dependency or a standard fixes stay, named for it**: a token is read up to Node's `http.maxHeaderSize`; artifact names and folder paths keep `FILE_NAME_MAX` (255) and `FILE_PATH_MAX` (1,024); a skill file's path is what `FILE_PATH_MAX` leaves under its mount folder; `tracestate` keeps W3C's 512.
96
+ - **Removed**: `ENVIRONMENT_LABELS_MAX`, `ENVIRONMENT_SETUP_MAX`, `ENVIRONMENT_SETUP_TIMEOUT_MAX_MS` (now `ENVIRONMENT_SETUP_TIMEOUT_DEFAULT`), `ENVIRONMENT_FILES_MAX`, `ENVIRONMENT_SECRET_SLOTS_MAX`, `TOKEN_ENVIRONMENT_GRANTS_MAX`, `HTTP_TOOL_MAX_TIMEOUT_MS`, `READ_ARTIFACT_MAX_BYTES` and `CHUNK_BYTES` from `@nylorun/core`; the image checks (`decodeImageBase64`, `validateImageBytes`, `IMAGE_MEDIA_TYPES`, `MAX_IMAGE_BYTES`), the Tenant configuration's `modelCall` and `TrustedIssuersOptions`' `refetchMs`/`maxAgeMs` from `@nylorun/runtime`. Studio's Environment form no longer caps setup commands and input files at 16: the Runtime checks the Tenant's limit.
97
+
98
+ ### Patch Changes
99
+
100
+ - 2459430: **An `environment_secret` reads `nylorun_managed` in the sandbox instead of `nylorun-managed`, so CLIs that check a token's format send their requests.**
101
+
102
+ - The Vercel CLI refuses a `VERCEL_TOKEN` with any character outside letters, digits and `_` (`Must not contain: "-"`) and exits before egress-gate can set the header. `ENVIRONMENT_SECRET_SENTINEL` is now `nylorun_managed`.
103
+ - egress-gate never compares the value: it replaces the credential's header whatever the CLI sent, so nothing else changes. A script that checks for the literal `nylorun-managed` should check for `nylorun_managed`.
104
+
3
105
  ## 0.22.0-beta
4
106
 
5
107
  ### 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`, the manifest and its `runtime` block (`runtimeManifestFor`), schemas and explicit local bindings.
6
+ - `/define`: `Agent`, `tool`, the manifest, 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`
@@ -1,5 +1,21 @@
1
1
  export { hashManifest } from "./utils/hash.js";
2
2
  /**
3
+ * Protocol 15: the harness boundary, a fresh start. Model-facing work belongs to the harness. Our
4
+ * engine's `read_artifact` and `save_artifact` run in our harness, over the Harness API's new
5
+ * artifact seam (`artifact.read`, `artifact.write`; Harness API 4), so a session's pinned
6
+ * `runtime` block no longer carries them, and those names are no longer reserved: an author tool
7
+ * may take one, though our harness then refuses the turn. A `tool.completed` of either says kind
8
+ * `harness`. Files reach the model by the harness's decision: a message may name any file
9
+ * within the artifact size limits (no more `422 attachment_unsupported`), `turn.start.model`
10
+ * describes the model the turn uses (what it reads, its window), and the Model Gate only fetches
11
+ * the artifacts a call names and translates the call, refusing a part the provider cannot take
12
+ * (`unsupported_input`). A `ModelCall` has no `outputSchema`: a harness writes its own JSON
13
+ * instruction and parses the answer. The harness names a session's MCP tools, defers them and
14
+ * shapes tool results: `turn.start.mcp` states what the servers listed, raw, and every MCP tool
15
+ * call names its identity (`target: {kind: "mcp", server, tool}`), which tool policy and approval
16
+ * key on (a policy rule with `__` in its `tool` refuses every call). The record refuses an
17
+ * outcome past `limits.recordEntryBytes`. Sessions pinned before protocol 15 must be recreated.
18
+ * The Host serves protocol 15 only.
3
19
  * Protocol 14: environment manifests (D63 to D65). `/v1/environment-manifests/{name}` holds
4
20
  * named, versioned definitions of a kind of Environment, saved like agents (with `If-Match` and
5
21
  * `?dryRun=true`), and `PUT /v1/environments/{id}` takes `manifest: "name"` or `"name@n"`. An
@@ -55,7 +71,7 @@ export { hashManifest } from "./utils/hash.js";
55
71
  * it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
56
72
  * that remains; a client that requires `action-endpoints` is refused by the feature check.
57
73
  */
58
- export declare const PROTOCOL_VERSION = 14;
74
+ export declare const PROTOCOL_VERSION = 15;
59
75
  /** What a client of this protocol requires of a Host. */
60
76
  export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts",
61
77
  /**
@@ -77,11 +93,7 @@ export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts
77
93
  * subject create, change and delete the Environments it is granted.
78
94
  */
79
95
  "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
- */
96
+ /** Protocol 12: the model catalog and provider list say which inputs each model reads. */
85
97
  "model-inputs",
86
98
  /**
87
99
  * Protocol 13: agent manifest v7 has no capabilities (its instructions, tools, skills and
@@ -94,7 +106,14 @@ export declare const PROTOCOL_FEATURES: readonly ["studio-principal", "artifacts
94
106
  * from one version and never changed after creation, secret slots, and an agent manifest's
95
107
  * `requires`, checked when a session opens.
96
108
  */
97
- "environment-manifests"];
109
+ "environment-manifests",
110
+ /**
111
+ * Protocol 15: the harness boundary. `read_artifact` and `save_artifact` are our harness's
112
+ * tools, not the Runtime's: a session's pinned `runtime` block no longer carries them, and an
113
+ * author tool may take their names. MCP tools are named by the harness and identified by
114
+ * `{server, tool}`: tool policy rules and approvals name them so.
115
+ */
116
+ "harness-boundary"];
98
117
  export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
99
118
  /**
100
119
  * Host features no client requires: a client that uses one checks the Host's `/health`
@@ -144,9 +163,9 @@ export interface ProtocolRange {
144
163
  features: readonly string[];
145
164
  }
146
165
  /**
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.
166
+ * What this Host serves: protocol 15. Protocol 15 changed what a session's pinned manifest
167
+ * carries and which tool names are reserved, so an older client is answered `426` naming the
168
+ * protocol it needs rather than a turn it cannot read.
150
169
  */
151
170
  export declare const HOST_PROTOCOL: ProtocolRange;
152
171
  export declare const DEFINITION_SCHEMA_VERSION = 2;
@@ -238,12 +257,6 @@ export declare const ERROR_CODES: readonly ["not_found",
238
257
  * credentials to one URL.
239
258
  */
240
259
  "credential_conflict",
241
- /**
242
- * A message names a file the Tenant's model does not read (protocol 12): `422` at accept, and
243
- * no turn starts. `details.parts` lists each refused file's `artifactId`, `name`, `mediaType`
244
- * and `reason`.
245
- */
246
- "attachment_unsupported",
247
260
  /**
248
261
  * A `PUT /v1/environments/{id}` asked an existing Environment to run something else
249
262
  * (protocol 14, D63): only its labels and owner guard may change. Fork it into a new
@@ -279,6 +292,9 @@ export declare const ARTIFACT_ID_PATTERN: RegExp;
279
292
  /**
280
293
  * An application key's id: an operator key's name, which names its client (e.g. `backend`).
281
294
  * `studio` is reserved for the key Studio derives from the admin key.
295
+ * An identifier's grammar is the protocol's (B15): it crosses the Runtime API, tokens and grants
296
+ * and means the same in every installation, so its length is a constant of protocol 15, not a
297
+ * setting.
282
298
  */
283
299
  export declare const APPLICATION_KEY_ID_PATTERN: RegExp;
284
300
  /**
@@ -1,5 +1,21 @@
1
1
  export { hashManifest } from "./utils/hash.js";
2
2
  /**
3
+ * Protocol 15: the harness boundary, a fresh start. Model-facing work belongs to the harness. Our
4
+ * engine's `read_artifact` and `save_artifact` run in our harness, over the Harness API's new
5
+ * artifact seam (`artifact.read`, `artifact.write`; Harness API 4), so a session's pinned
6
+ * `runtime` block no longer carries them, and those names are no longer reserved: an author tool
7
+ * may take one, though our harness then refuses the turn. A `tool.completed` of either says kind
8
+ * `harness`. Files reach the model by the harness's decision: a message may name any file
9
+ * within the artifact size limits (no more `422 attachment_unsupported`), `turn.start.model`
10
+ * describes the model the turn uses (what it reads, its window), and the Model Gate only fetches
11
+ * the artifacts a call names and translates the call, refusing a part the provider cannot take
12
+ * (`unsupported_input`). A `ModelCall` has no `outputSchema`: a harness writes its own JSON
13
+ * instruction and parses the answer. The harness names a session's MCP tools, defers them and
14
+ * shapes tool results: `turn.start.mcp` states what the servers listed, raw, and every MCP tool
15
+ * call names its identity (`target: {kind: "mcp", server, tool}`), which tool policy and approval
16
+ * key on (a policy rule with `__` in its `tool` refuses every call). The record refuses an
17
+ * outcome past `limits.recordEntryBytes`. Sessions pinned before protocol 15 must be recreated.
18
+ * The Host serves protocol 15 only.
3
19
  * Protocol 14: environment manifests (D63 to D65). `/v1/environment-manifests/{name}` holds
4
20
  * named, versioned definitions of a kind of Environment, saved like agents (with `If-Match` and
5
21
  * `?dryRun=true`), and `PUT /v1/environments/{id}` takes `manifest: "name"` or `"name@n"`. An
@@ -55,7 +71,7 @@ export { hashManifest } from "./utils/hash.js";
55
71
  * it. The Host still accepts protocol 4 (and `Nylorun-Tenant`), 5 and 6 clients on every route
56
72
  * that remains; a client that requires `action-endpoints` is refused by the feature check.
57
73
  */
58
- export const PROTOCOL_VERSION = 14;
74
+ export const PROTOCOL_VERSION = 15;
59
75
  /** What a client of this protocol requires of a Host. */
60
76
  export const PROTOCOL_FEATURES = [
61
77
  "studio-principal",
@@ -79,11 +95,7 @@ export const PROTOCOL_FEATURES = [
79
95
  * subject create, change and delete the Environments it is granted.
80
96
  */
81
97
  "environments",
82
- /**
83
- * Protocol 12: the model catalog and provider list say which inputs each model reads, and a
84
- * message naming a file the Tenant's model does not read is refused with
85
- * `422 attachment_unsupported`.
86
- */
98
+ /** Protocol 12: the model catalog and provider list say which inputs each model reads. */
87
99
  "model-inputs",
88
100
  /**
89
101
  * Protocol 13: agent manifest v7 has no capabilities (its instructions, tools, skills and
@@ -97,6 +109,13 @@ export const PROTOCOL_FEATURES = [
97
109
  * `requires`, checked when a session opens.
98
110
  */
99
111
  "environment-manifests",
112
+ /**
113
+ * Protocol 15: the harness boundary. `read_artifact` and `save_artifact` are our harness's
114
+ * tools, not the Runtime's: a session's pinned `runtime` block no longer carries them, and an
115
+ * author tool may take their names. MCP tools are named by the harness and identified by
116
+ * `{server, tool}`: tool policy rules and approvals name them so.
117
+ */
118
+ "harness-boundary",
100
119
  ];
101
120
  /**
102
121
  * Host features no client requires: a client that uses one checks the Host's `/health`
@@ -156,13 +175,13 @@ export const OPTIONAL_HOST_FEATURES = [
156
175
  "artifact-reads",
157
176
  ];
158
177
  /**
159
- * What this Host serves: protocol 14. Protocol 14 changed what `PUT /v1/environments/{id}`
160
- * does to an existing Environment and the shape of its view, so an older client is answered
161
- * `426` naming the protocol it needs rather than a `409` it cannot read.
178
+ * What this Host serves: protocol 15. Protocol 15 changed what a session's pinned manifest
179
+ * carries and which tool names are reserved, so an older client is answered `426` naming the
180
+ * protocol it needs rather than a turn it cannot read.
162
181
  */
163
182
  export const HOST_PROTOCOL = {
164
- min: 14,
165
- max: 14,
183
+ min: 15,
184
+ max: 15,
166
185
  features: [...PROTOCOL_FEATURES, ...OPTIONAL_HOST_FEATURES],
167
186
  };
168
187
  export const DEFINITION_SCHEMA_VERSION = 2;
@@ -265,12 +284,6 @@ export const ERROR_CODES = [
265
284
  * credentials to one URL.
266
285
  */
267
286
  "credential_conflict",
268
- /**
269
- * A message names a file the Tenant's model does not read (protocol 12): `422` at accept, and
270
- * no turn starts. `details.parts` lists each refused file's `artifactId`, `name`, `mediaType`
271
- * and `reason`.
272
- */
273
- "attachment_unsupported",
274
287
  /**
275
288
  * A `PUT /v1/environments/{id}` asked an existing Environment to run something else
276
289
  * (protocol 14, D63): only its labels and owner guard may change. Fork it into a new
@@ -309,6 +322,9 @@ export const ARTIFACT_ID_PATTERN = /^af_[0-9a-hjkmnp-tv-z]{26}$/;
309
322
  /**
310
323
  * An application key's id: an operator key's name, which names its client (e.g. `backend`).
311
324
  * `studio` is reserved for the key Studio derives from the admin key.
325
+ * An identifier's grammar is the protocol's (B15): it crosses the Runtime API, tokens and grants
326
+ * and means the same in every installation, so its length is a constant of protocol 15, not a
327
+ * setting.
312
328
  */
313
329
  export const APPLICATION_KEY_ID_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
314
330
  /**