@nylorun/core 0.31.0-beta → 0.33.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 CHANGED
@@ -1,5 +1,59 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.33.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 63a6217: An image can carry the Runtime's engine (ADR-99). A pod of an image the Tenant lists in
8
+ `engine.images` (`PUT /v1/tenant/sandbox`) runs the engine under `/opt/nylorun` with nothing copied
9
+ in: the sandboxes service's new `entrypoint: "builtin"`, without the `nylo-copy` init container and
10
+ the `/nylo` volume. Such an engine reports its Runtime version at join (header
11
+ `nylorun-image-engine`), the Agent's record keeps it beside its pinned image digest, and a pod runs
12
+ it only while it is the Runtime's own version; otherwise the engine is copied in as for any image.
13
+ New column `agents.engine_image` (migration 0042).
14
+
15
+ ## 0.32.0-beta
16
+
17
+ ### Minor Changes
18
+
19
+ - d48b6ef: The A2A endpoint serves the Nylorun A2A profile v2 (Host feature `a2a-profile-v2`, Engine R1).
20
+
21
+ - **Push notifications.** The four push config methods and `configuration.taskPushNotificationConfig` in `SendMessage`. Each task update is POSTed as one A2A `StreamResponse`, at least once, with `X-A2A-Notification-Token` and Standard Webhooks signatures (`webhook-id`, `webhook-timestamp`, `webhook-signature`) made with the new Runtime config `a2a.push.secret` (`NYLORUN_A2A_PUSH_SECRET`, `whsec_…`). Private hosts must be listed in `a2a.push.allowHosts` (`NYLORUN_A2A_PUSH_ALLOW_HOSTS`, `host:port` or `host:*`). Failed pushes are retried with backoff for 24 hours (Host tuning `a2a.pushRetry`, `a2a.pushMaxAgeMs`), then dropped. Configs and pushes live in two new tables (migration 0039).
22
+ - **Queued follow-ups.** A message to a busy context is queued and answered with the task that takes it (`TASK_STATE_SUBMITTED`); `metadata.delivery: "reject"` keeps `UnsupportedOperationError` with reason `CONTEXT_BUSY`.
23
+ - **Interactions.** Approvals and connection asks are `AUTH_REQUIRED`, questions `INPUT_REQUIRED`, shown under `interactions/v1`; an answer on the same task (`{ interactionId, approved }` or `{ interactionId, value }`) maps to `approve` or `respond`, with the caller as `approvedBy`. Text never approves.
24
+ - **Progress, telemetry, effects.** `plan.updated` events become `progress/v1`; the terminal status carries `telemetry/v1` (totals and trace id); an uncertain effect `effects/v1`.
25
+ - **Files.** `url` parts are fetched and stored like `raw` ones; the files a task writes are artifacts whose `url` points at the new `GET /v1/a2a/files/{artifactId}/versions/{version}`, served only to the same subject, with `files/v1`.
26
+ - **Extensions and card.** `A2A-Extensions` activates the five extensions and is echoed; data of the others is left out. The card lists the Runtime's JSON-RPC interface (A2A 1.0), `streaming: false`, `pushNotifications`, and the five extensions (`required: false`).
27
+ - ProtoJSON's original field names (`task_id`) are accepted in A2A params.
28
+
29
+ - d48b6ef: An agent manifest names the model its agent runs on (Host feature `agent-model`).
30
+
31
+ - **`harness.model`**: `<provider>/<model>`, such as `anthropic/claude-sonnet-4-5` (the provider's id, a `/`, then the model's id, which may hold a `/`; at most 200 characters). In an agent folder it is `model:` in `AGENT.md`'s frontmatter; the compiler refuses any other shape (`value_invalid`) and a `model` in an agent under `agents/`, which runs on the root agent's. `harness.manifest.json` takes it too, and the composer keeps it.
32
+ - **A new session starts on it.** A session opened on a version that names a model gets it as its own model (`GET /v1/sessions/{id}/model` answers `source: "session"`), as `PUT /v1/sessions/{id}/model` would choose it, when the provider is connected and its catalog lists the model. Otherwise the session has none and the Tenant's model applies; nothing fails. Sessions opened by the A2A server and by triggers get it too. An explicit choice still replaces it, and an open session keeps its model across versions.
33
+ - `agentModelChoice` and `AgentModelSchema` in `@nylorun/core/contracts`.
34
+ - The JSON Schema documents that gained the field are published at new ids: `agent-manifest/v8.1.json`, `harness-manifest/v1.1.json` and `agent-folder/v1/agent-md.1.json`; the old ids are retired. `manifestSchemaVersion` stays 8.
35
+
36
+ - d48b6ef: An agent keeps a durable plan (A2A profile v2, `progress/v1`; A2A-E10).
37
+
38
+ - **`plan.updated`**, a new durable session event: `{ steps: [{ label, state, note? }] }`, the agent's whole plan each time, never a diff. `state` is `pending`, `active`, `done`, `blocked` or `skipped`; at most 20 steps, labels of at most 120 and notes of at most 280 characters (`PLAN_LIMITS`, `PLAN_STEP_STATES`, `PlanUpdatedPayloadSchema` in `@nylorun/core/contracts`). The Runtime records and serves it like any public event, with the harness as its writer (evidence `claimed`), and the OpenAPI document lists it.
39
+ - **`update_plan`**, a built-in tool of our engine, off by default. A version opts in with `harness.loop.plan: true` (in an agent folder, `loop: { plan: true }` in `AGENT.md`'s frontmatter); the session's root agent then gets the tool, unless it declares its own tool of that name. A call takes `{ steps: [...] }`, cuts long labels and notes (ending in `…`) and steps past 20 rather than refusing them, claims one `plan.updated` and answers `Plan updated`. A malformed plan is a failed result the model sees.
40
+ - **Harness API**: `plan.updated` is a claim a harness may make (`HARNESS_CLAIMS`), additive within v5. The JSON Schema document is now published as `https://docs.nylorun.com/schemas/harness-api/v5.1.json`; `v5.json` is retired.
41
+ - The agent folder compiler takes `loop.plan` (true or false) and suggests it for a close typo.
42
+
43
+ - d48b6ef: An agent asks for an app to be connected (A2A profile v2, `interactions/v1` kind `connection`).
44
+
45
+ - **`request_connection`**, a built-in tool of our engine, off by default. A version opts in with `harness.loop.connections: true` (in an agent folder, `loop: { connections: true }` in `AGENT.md`); the session's root agent then gets the tool, unless it declares its own tool of that name.
46
+ - A call takes `{ app, reason }` (app cut at 80 characters, reason at 280, never refused for length) and pauses the turn on an interaction: kind `response`, prompt `Connect <app>: <reason>`, `metadata: { kind: "connection", app, reason }`, which the session's `waits` carry. Answered with `respond`, `true` or `{ connected: true }` gives the model `Connected: <app>`; any other value `Not connected: <app>`.
47
+ - The agent folder compiler takes `loop.connections` (true or false).
48
+
49
+ - d48b6ef: The Runtime keeps a turn index and serves it as a change feed (Host feature `turns`, A2A-E1 to E3).
50
+
51
+ - **The turn index.** Every turn has a row: its session, Agent, status (`running`, `paused`, `completed`, `failed`, `cancelled`), start, end, last change, totals and, for an A2A context, its context and task id. It is written in the same transaction as the event that changes the turn, so it always agrees with the session's log. Migration `0041_turn_index_backfill` indexes the turns already recorded when the Runtime first starts on this version.
52
+ - **`GET /v1/turns`** pages the turns in the order they changed: pass the page's `cursor` as `changedAfter` to read on (a turn comes again each time it changes, and the cursor comes back even when nothing changed), `limit` up to 500 (default 100). `sessionId` reads one session's turns, oldest first. An application key reads the whole Tenant; acting for a person, only their sessions' turns. A client that missed pushes catches up with one call per interval.
53
+ - **A2A `ListTasks`** is served: the caller's tasks with the Agent, latest status change first, filtered by `contextId`, `status` and `statusTimestampAfter`, paged with `pageSize` (up to 100, default 50) and `pageToken`, with `totalSize`; each task as `GetTask` answers it (interaction, `progress/v1` and `telemetry/v1` metadata), with history only for `historyLength` and artifacts only for `includeArtifacts`. A paused task is `AUTH_REQUIRED` for an approval or a connection and `INPUT_REQUIRED` for a question, and the `status` filter agrees. `GetTask`, `CancelTask`, replies and push configs find a task (a queued message's id too, once a turn took it) through the index and read only that turn's events.
54
+ - **A2A contexts are listable.** The session of a context now carries `info.a2a` (`contextId` and the subject); a context opened by an earlier version gets it with its next message. Its session id is still the one-way hash of the subject, Agent and context.
55
+ - `@nylorun/core` adds `TurnSummarySchema`, `TurnChangesPageSchema` and `TURN_STATUSES`.
56
+
3
57
  ## 0.31.0-beta
4
58
 
5
59
  ### Minor Changes
@@ -212,9 +212,29 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
212
212
  * segment's sandbox sees the variables it names, as `nylorun_managed`, a stand-in it names or a
213
213
  * plain value. No route changes.
214
214
  */
215
- 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",
215
+ export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "transcript-events", "subject-headers", "ag-ui-endpoint", "a2a-endpoint",
216
+ /**
217
+ * The Nylorun A2A profile v2 on `a2a-endpoint`: queued follow-ups, push notification configs
218
+ * (signed with Standard Webhooks), `url` file parts in and out (`GET /v1/a2a/files/…`), and
219
+ * the five extensions activated with `A2A-Extensions` (interactions, effects, progress,
220
+ * telemetry, files); the card lists the Runtime's JSON-RPC interface.
221
+ */
222
+ "a2a-profile-v2", "sandbox-pods", "trusted-issuers", "session-reads", "calls-export", "credential-coverage", "tool-calls", "environment-setup", "environment-disk-versions", "tool-policy", "traces",
216
223
  /** Opt-in artifact metadata pages (`GET /v1/artifacts?limit=…`). */
217
- "artifact-reads", "gateway-credentials", "agent-folders", "session-model", "model-host-identity", "credential-provider"];
224
+ "artifact-reads", "gateway-credentials", "agent-folders", "session-model", "model-host-identity", "credential-provider",
225
+ /**
226
+ * The turn index: `GET /v1/turns` pages the turns a caller may see in the order they changed
227
+ * (`changedAfter`, the cursor it returned), or one session's (`sessionId`), each with its
228
+ * status, times, totals and A2A context and task; an application key sees the whole Tenant, a
229
+ * subject its own sessions'. The A2A endpoint answers `ListTasks` from it.
230
+ */
231
+ "turns",
232
+ /**
233
+ * An agent manifest's `harness.model` (`model: <provider>/<model>` in `AGENT.md`): a session
234
+ * opened on a version that names one starts with it as its own model (`session-model`), when
235
+ * its provider is connected and lists it; otherwise the Tenant's model applies.
236
+ */
237
+ "agent-model"];
218
238
  export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
219
239
  export interface ProtocolRange {
220
240
  min: number;
@@ -220,6 +220,13 @@ export const OPTIONAL_HOST_FEATURES = [
220
220
  "subject-headers",
221
221
  "ag-ui-endpoint",
222
222
  "a2a-endpoint",
223
+ /**
224
+ * The Nylorun A2A profile v2 on `a2a-endpoint`: queued follow-ups, push notification configs
225
+ * (signed with Standard Webhooks), `url` file parts in and out (`GET /v1/a2a/files/…`), and
226
+ * the five extensions activated with `A2A-Extensions` (interactions, effects, progress,
227
+ * telemetry, files); the card lists the Runtime's JSON-RPC interface.
228
+ */
229
+ "a2a-profile-v2",
223
230
  "sandbox-pods",
224
231
  "trusted-issuers",
225
232
  "session-reads",
@@ -237,6 +244,19 @@ export const OPTIONAL_HOST_FEATURES = [
237
244
  "session-model",
238
245
  "model-host-identity",
239
246
  "credential-provider",
247
+ /**
248
+ * The turn index: `GET /v1/turns` pages the turns a caller may see in the order they changed
249
+ * (`changedAfter`, the cursor it returned), or one session's (`sessionId`), each with its
250
+ * status, times, totals and A2A context and task; an application key sees the whole Tenant, a
251
+ * subject its own sessions'. The A2A endpoint answers `ListTasks` from it.
252
+ */
253
+ "turns",
254
+ /**
255
+ * An agent manifest's `harness.model` (`model: <provider>/<model>` in `AGENT.md`): a session
256
+ * opened on a version that names one starts with it as its own model (`session-model`), when
257
+ * its provider is connected and lists it; otherwise the Tenant's model applies.
258
+ */
259
+ "agent-model",
240
260
  ];
241
261
  /**
242
262
  * What this Host serves: protocol 16, 17 and 18. Protocol 16 replaced agent definitions and
@@ -919,6 +919,9 @@ export declare const TenantEnvironmentsConfigSchema: z.ZodObject<{
919
919
  lifecycle: z.ZodOptional<z.ZodObject<{
920
920
  stopGrace: z.ZodOptional<z.ZodString>;
921
921
  }, z.core.$strict>>;
922
+ engine: z.ZodOptional<z.ZodObject<{
923
+ images: z.ZodOptional<z.ZodArray<z.ZodString>>;
924
+ }, z.core.$strict>>;
922
925
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
923
926
  hosts: z.ZodArray<z.ZodEnum<{
924
927
  "harness-container": "harness-container";
@@ -945,6 +948,9 @@ export declare const PutTenantEnvironmentsRequestSchema: z.ZodObject<{
945
948
  lifecycle: z.ZodOptional<z.ZodObject<{
946
949
  stopGrace: z.ZodOptional<z.ZodString>;
947
950
  }, z.core.$strict>>;
951
+ engine: z.ZodOptional<z.ZodObject<{
952
+ images: z.ZodOptional<z.ZodArray<z.ZodString>>;
953
+ }, z.core.$strict>>;
948
954
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
949
955
  hosts: z.ZodArray<z.ZodEnum<{
950
956
  "harness-container": "harness-container";
@@ -1167,6 +1173,21 @@ export declare const HarnessMemorySchema: z.ZodObject<{
1167
1173
  }>>;
1168
1174
  instructions: z.ZodOptional<z.ZodString>;
1169
1175
  }, z.core.$strict>;
1176
+ /**
1177
+ * `harness.model` (Host feature `agent-model`): the model the agent runs on, `<provider>/<model>`
1178
+ * (the provider's id, then its model's id, which may itself hold `/`). A session opened on a
1179
+ * version that names one starts with it as its own model (`Session.model`), when the provider is
1180
+ * connected and lists the model; otherwise the Tenant's model applies. A later
1181
+ * `PUT /v1/sessions/{id}/model` still chooses another.
1182
+ */
1183
+ export declare const AGENT_MODEL_PATTERN: RegExp;
1184
+ export declare const AGENT_MODEL_MAX_CHARS = 200;
1185
+ export declare const AgentModelSchema: z.ZodString;
1186
+ /** `harness.model` as a session's model choice: the provider before the first `/`, the model after. */
1187
+ export declare function agentModelChoice(value: string): {
1188
+ provider: string;
1189
+ model: string;
1190
+ } | undefined;
1170
1191
  /** What runs inside the loop of an agent: the `harness` section of agent manifest v8. */
1171
1192
  export declare const AgentHarnessSectionSchema: z.ZodType<AgentHarnessSection>;
1172
1193
  /** A flow's `harness` section (`kind: "workflow"`). */
@@ -1781,6 +1802,7 @@ export declare const HarnessManifestFileSchema: z.ZodObject<{
1781
1802
  }>>;
1782
1803
  instructions: z.ZodOptional<z.ZodString>;
1783
1804
  }, z.core.$strict>>;
1805
+ model: z.ZodOptional<z.ZodString>;
1784
1806
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1785
1807
  requires: z.ZodOptional<z.ZodObject<{
1786
1808
  sandbox: z.ZodOptional<z.ZodEnum<{
@@ -1989,6 +2011,7 @@ export declare const AgentManifestFileSchema: z.ZodObject<{
1989
2011
  }>>;
1990
2012
  instructions: z.ZodOptional<z.ZodString>;
1991
2013
  }, z.core.$strict>>;
2014
+ model: z.ZodOptional<z.ZodString>;
1992
2015
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1993
2016
  requires: z.ZodOptional<z.ZodObject<{
1994
2017
  sandbox: z.ZodOptional<z.ZodEnum<{
@@ -4460,6 +4483,47 @@ export declare const WakeBookedPayloadSchema: z.ZodObject<{
4460
4483
  export declare const WakeCancelledPayloadSchema: z.ZodObject<{
4461
4484
  effectId: z.ZodString;
4462
4485
  }, z.core.$loose>;
4486
+ /** The states of a plan step (`plan.updated`). */
4487
+ export declare const PLAN_STEP_STATES: readonly ["pending", "active", "done", "blocked", "skipped"];
4488
+ export type PlanStepState = (typeof PLAN_STEP_STATES)[number];
4489
+ /** The most steps one plan holds, and the most characters (UTF-16 units) of a label and a note. */
4490
+ export declare const PLAN_LIMITS: Readonly<{
4491
+ steps: 20;
4492
+ labelChars: 120;
4493
+ noteChars: 280;
4494
+ }>;
4495
+ /** One step of an agent's plan: a short label, its state, and an optional note. */
4496
+ export declare const PlanStepSchema: z.ZodObject<{
4497
+ label: z.ZodString;
4498
+ state: z.ZodEnum<{
4499
+ active: "active";
4500
+ blocked: "blocked";
4501
+ done: "done";
4502
+ pending: "pending";
4503
+ skipped: "skipped";
4504
+ }>;
4505
+ note: z.ZodOptional<z.ZodString>;
4506
+ }, z.core.$loose>;
4507
+ export type PlanStep = z.infer<typeof PlanStepSchema>;
4508
+ /**
4509
+ * `plan.updated`: the agent's whole plan, as its last `update_plan` call left it (our engine's
4510
+ * built-in tool, which a version opts into with `harness.loop.plan`), never a diff. Our harness
4511
+ * claims it. Labels and notes are the agent's short text, never tool arguments or results; the A2A
4512
+ * server serves the latest under `progress/v1`.
4513
+ */
4514
+ export declare const PlanUpdatedPayloadSchema: z.ZodObject<{
4515
+ steps: z.ZodArray<z.ZodObject<{
4516
+ label: z.ZodString;
4517
+ state: z.ZodEnum<{
4518
+ active: "active";
4519
+ blocked: "blocked";
4520
+ done: "done";
4521
+ pending: "pending";
4522
+ skipped: "skipped";
4523
+ }>;
4524
+ note: z.ZodOptional<z.ZodString>;
4525
+ }, z.core.$loose>>;
4526
+ }, z.core.$loose>;
4463
4527
  /** `queue.taken` (protocol 17): the turn that started with the queued messages, in order. */
4464
4528
  export declare const QueueTakenPayloadSchema: z.ZodObject<{
4465
4529
  turnId: z.ZodString;
@@ -5392,6 +5456,23 @@ export declare const EVENT_CATALOG: {
5392
5456
  readonly source: "loop";
5393
5457
  readonly version: 1;
5394
5458
  };
5459
+ readonly "plan.updated": {
5460
+ readonly payload: z.ZodObject<{
5461
+ steps: z.ZodArray<z.ZodObject<{
5462
+ label: z.ZodString;
5463
+ state: z.ZodEnum<{
5464
+ active: "active";
5465
+ blocked: "blocked";
5466
+ done: "done";
5467
+ pending: "pending";
5468
+ skipped: "skipped";
5469
+ }>;
5470
+ note: z.ZodOptional<z.ZodString>;
5471
+ }, z.core.$loose>>;
5472
+ }, z.core.$loose>;
5473
+ readonly source: "loop";
5474
+ readonly version: 1;
5475
+ };
5395
5476
  readonly "environment.state": {
5396
5477
  readonly payload: z.ZodObject<{
5397
5478
  state: z.ZodEnum<{
@@ -5605,7 +5686,7 @@ type EventSchemaOf<T extends EventType> = z.ZodObject<typeof eventEnvelope & {
5605
5686
  /** One schema per event type, keyed by type (the OpenAPI components). */
5606
5687
  export declare const EVENT_SCHEMAS: { [T in EventType]: EventSchemaOf<T>; };
5607
5688
  /** A session event of a known type, discriminated on `type`. */
5608
- export declare const SessionEventSchema: z.ZodDiscriminatedUnion<[EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">, ...EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">[]], "type">;
5689
+ export declare const SessionEventSchema: z.ZodDiscriminatedUnion<[EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "plan.updated" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">, ...EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "plan.updated" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">[]], "type">;
5609
5690
  export type SessionEvent = {
5610
5691
  [T in EventType]: z.infer<EventSchemaOf<T>>;
5611
5692
  }[EventType];
@@ -5620,7 +5701,7 @@ export type SessionEventOf<T extends EventType> = Extract<SessionEvent, {
5620
5701
  */
5621
5702
  export declare function parseSessionEvent(value: unknown): SessionEvent | LiveEvent;
5622
5703
  export declare const SessionItemsResponseSchema: z.ZodObject<{
5623
- items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">, ...EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">[]], "type">>;
5704
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "plan.updated" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">, ...EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "plan.updated" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">[]], "type">>;
5624
5705
  cursor: z.ZodNullable<z.ZodString>;
5625
5706
  }, z.core.$strip>;
5626
5707
  export type SessionItemsResponse = {
@@ -6031,6 +6112,9 @@ export declare const SeedTenantConfigRequestSchema: z.ZodObject<{
6031
6112
  lifecycle: z.ZodOptional<z.ZodObject<{
6032
6113
  stopGrace: z.ZodOptional<z.ZodString>;
6033
6114
  }, z.core.$strict>>;
6115
+ engine: z.ZodOptional<z.ZodObject<{
6116
+ images: z.ZodOptional<z.ZodArray<z.ZodString>>;
6117
+ }, z.core.$strict>>;
6034
6118
  placement: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
6035
6119
  hosts: z.ZodArray<z.ZodEnum<{
6036
6120
  "harness-container": "harness-container";
@@ -7899,7 +7983,7 @@ export declare const SessionManifestViewSchema: z.ZodObject<{
7899
7983
  }, z.core.$strict>;
7900
7984
  export type SessionManifestView = z.infer<typeof SessionManifestViewSchema>;
7901
7985
  export declare const HistoryPageSchema: z.ZodObject<{
7902
- items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">, ...EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">[]], "type">>;
7986
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "plan.updated" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">, ...EventSchemaOf<"agent.attached" | "artifact.created" | "artifact.deleted" | "artifact.export.failed" | "artifact.export.skipped" | "artifact.version.created" | "command.approve" | "command.message" | "command.respond" | "context.compacted" | "delegation.completed" | "delegation.started" | "effect.uncertain" | "environment.exec" | "environment.state" | "loop.iteration" | "loop.verified" | "mcp.discovered" | "memory.updated" | "message.assistant" | "message.queued" | "model.failed" | "node.agent" | "node.completed" | "node.started" | "plan.updated" | "queue.taken" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "wake.booked" | "wake.cancelled">[]], "type">>;
7903
7987
  cursor: z.ZodNullable<z.ZodString>;
7904
7988
  tail: z.ZodBoolean;
7905
7989
  }, z.core.$strip>;
@@ -8056,6 +8140,85 @@ export declare const ModelCallExportPageSchema: z.ZodObject<{
8056
8140
  asOf: z.ZodString;
8057
8141
  }, z.core.$strict>;
8058
8142
  export type ModelCallExportPage = z.infer<typeof ModelCallExportPageSchema>;
8143
+ /**
8144
+ * A turn's status in the turn index (Host feature `turns`): `running` from its first
8145
+ * `command.message` and again after an answer, `paused` while it waits for a person, then one of
8146
+ * the three ends.
8147
+ */
8148
+ export declare const TURN_STATUSES: readonly ["running", "paused", "completed", "failed", "cancelled"];
8149
+ export declare const TurnStatusSchema: z.ZodEnum<{
8150
+ cancelled: "cancelled";
8151
+ completed: "completed";
8152
+ failed: "failed";
8153
+ paused: "paused";
8154
+ running: "running";
8155
+ }>;
8156
+ export type TurnStatus = z.infer<typeof TurnStatusSchema>;
8157
+ /**
8158
+ * One turn as the turn index keeps it (Host feature `turns`), written in the transaction of the
8159
+ * event that changed it, so it agrees with the session's log. `totals` are the turn's end facts
8160
+ * (null until it ends, or for a turn that ended before the Runtime recorded them); `a2a` names the
8161
+ * A2A context and task when the session is an A2A context.
8162
+ */
8163
+ export declare const TurnSummarySchema: z.ZodObject<{
8164
+ turnId: z.ZodString;
8165
+ sessionId: z.ZodString;
8166
+ agentId: z.ZodString;
8167
+ status: z.ZodEnum<{
8168
+ cancelled: "cancelled";
8169
+ completed: "completed";
8170
+ failed: "failed";
8171
+ paused: "paused";
8172
+ running: "running";
8173
+ }>;
8174
+ startedAt: z.ZodString;
8175
+ endedAt: z.ZodNullable<z.ZodString>;
8176
+ changedAt: z.ZodString;
8177
+ totals: z.ZodNullable<z.ZodObject<{
8178
+ steps: z.ZodNumber;
8179
+ tokens: z.ZodNumber;
8180
+ costUsd: z.ZodNumber;
8181
+ }, z.core.$strict>>;
8182
+ a2a: z.ZodNullable<z.ZodObject<{
8183
+ contextId: z.ZodString;
8184
+ taskId: z.ZodString;
8185
+ }, z.core.$strict>>;
8186
+ }, z.core.$strict>;
8187
+ export type TurnSummary = z.infer<typeof TurnSummarySchema>;
8188
+ /**
8189
+ * A page of the turn change feed (`GET /v1/turns`), in the order the turns changed: a turn
8190
+ * appears again each time it changes. Pass `cursor` as `changedAfter` to read on; it is returned
8191
+ * even when `turns` is empty. `hasMore`: another page is ready now.
8192
+ */
8193
+ export declare const TurnChangesPageSchema: z.ZodObject<{
8194
+ turns: z.ZodArray<z.ZodObject<{
8195
+ turnId: z.ZodString;
8196
+ sessionId: z.ZodString;
8197
+ agentId: z.ZodString;
8198
+ status: z.ZodEnum<{
8199
+ cancelled: "cancelled";
8200
+ completed: "completed";
8201
+ failed: "failed";
8202
+ paused: "paused";
8203
+ running: "running";
8204
+ }>;
8205
+ startedAt: z.ZodString;
8206
+ endedAt: z.ZodNullable<z.ZodString>;
8207
+ changedAt: z.ZodString;
8208
+ totals: z.ZodNullable<z.ZodObject<{
8209
+ steps: z.ZodNumber;
8210
+ tokens: z.ZodNumber;
8211
+ costUsd: z.ZodNumber;
8212
+ }, z.core.$strict>>;
8213
+ a2a: z.ZodNullable<z.ZodObject<{
8214
+ contextId: z.ZodString;
8215
+ taskId: z.ZodString;
8216
+ }, z.core.$strict>>;
8217
+ }, z.core.$strict>>;
8218
+ cursor: z.ZodString;
8219
+ hasMore: z.ZodBoolean;
8220
+ }, z.core.$strict>;
8221
+ export type TurnChangesPage = z.infer<typeof TurnChangesPageSchema>;
8059
8222
  /**
8060
8223
  * One tool call of a session, read from the effect journal: what ran, with what input,
8061
8224
  * how many sends, and how it ended. `invoking` while it runs. `uncertain` only for a call
package/dist/contracts.js CHANGED
@@ -1257,6 +1257,21 @@ export const TenantEnvironmentsConfigSchema = z
1257
1257
  })
1258
1258
  .strict()
1259
1259
  .optional(),
1260
+ /**
1261
+ * Pods: images that carry this Runtime's engine under `/opt/nylorun` (ADR-99), by repository
1262
+ * (`ghcr.io/nylorun/bot-worker`). A pod of a listed image runs that engine with nothing copied
1263
+ * in, while the engine is the Runtime's own version; otherwise the engine is copied in, as for
1264
+ * any other image.
1265
+ */
1266
+ engine: z
1267
+ .object({
1268
+ images: z
1269
+ .array(z.string().min(1).max(256).regex(/^[a-z0-9]([a-z0-9._:/-]*[a-z0-9])?$/, "an image repository, without a tag or digest"))
1270
+ .max(32)
1271
+ .optional(),
1272
+ })
1273
+ .strict()
1274
+ .optional(),
1260
1275
  /**
1261
1276
  * Where each harness may run, by harness id (`nylorun`, or `*` for the rest):
1262
1277
  * `harness-container` (the Runtime's harness) and `sandbox` (the engine in a pod).
@@ -1618,6 +1633,28 @@ export const HarnessMemorySchema = z.strictObject({
1618
1633
  });
1619
1634
  const harnessMemoryField = HarnessMemorySchema.optional()
1620
1635
  .meta({ description: "The Agent's memory: Markdown files under /memories it keeps across sessions" });
1636
+ /**
1637
+ * `harness.model` (Host feature `agent-model`): the model the agent runs on, `<provider>/<model>`
1638
+ * (the provider's id, then its model's id, which may itself hold `/`). A session opened on a
1639
+ * version that names one starts with it as its own model (`Session.model`), when the provider is
1640
+ * connected and lists the model; otherwise the Tenant's model applies. A later
1641
+ * `PUT /v1/sessions/{id}/model` still chooses another.
1642
+ */
1643
+ export const AGENT_MODEL_PATTERN = /^[A-Za-z0-9._-]+\/\S+$/;
1644
+ export const AGENT_MODEL_MAX_CHARS = 200;
1645
+ export const AgentModelSchema = z
1646
+ .string()
1647
+ .max(AGENT_MODEL_MAX_CHARS)
1648
+ .regex(AGENT_MODEL_PATTERN, "model is <provider>/<model>, such as anthropic/claude-sonnet-4-5")
1649
+ .meta({ description: "The model the agent runs on: <provider>/<model>, such as anthropic/claude-sonnet-4-5" });
1650
+ /** `harness.model` as a session's model choice: the provider before the first `/`, the model after. */
1651
+ export function agentModelChoice(value) {
1652
+ if (value.length > AGENT_MODEL_MAX_CHARS || !AGENT_MODEL_PATTERN.test(value))
1653
+ return undefined;
1654
+ const slash = value.indexOf("/");
1655
+ return { provider: value.slice(0, slash), model: value.slice(slash + 1) };
1656
+ }
1657
+ const harnessModelField = AgentModelSchema.optional();
1621
1658
  /** Fields the harness section refuses with where they went. */
1622
1659
  const REMOVED_HARNESS_FIELDS = Object.freeze({
1623
1660
  requires: "harness.requires left the API in agent manifest v8: the Runtime checks the harness against the runtime section when the manifest is saved. Keep requires in harness.manifest.json, where the CLI checks it",
@@ -1638,6 +1675,7 @@ const agentHarnessObject = z
1638
1675
  outputSchema: definitionJson.optional(),
1639
1676
  loop: harnessLoopField,
1640
1677
  memory: harnessMemoryField,
1678
+ model: harnessModelField,
1641
1679
  functions: z.unknown().optional().meta({ description: "Reserved: Functions are not available yet" }),
1642
1680
  }, { error: removedFieldError(REMOVED_HARNESS_FIELDS) })
1643
1681
  .superRefine((harness, ctx) => {
@@ -1960,6 +1998,7 @@ export const HarnessManifestFileSchema = z
1960
1998
  outputSchema: definitionJson.optional(),
1961
1999
  loop: harnessLoopField,
1962
2000
  memory: harnessMemoryField,
2001
+ model: harnessModelField,
1963
2002
  /** MCP server or HTTP tool name → the `runtime.secrets` slot it authenticates with. */
1964
2003
  credentials: z.record(z.string().min(1), z.string().min(1)).optional(),
1965
2004
  /** What this harness needs of any runtime it is combined with; checked by the composer only. */
@@ -3093,6 +3132,27 @@ export const WakeBookedPayloadSchema = z
3093
3132
  .object({ at: z.string(), note: z.string(), effectId: z.string(), replaced: z.boolean() })
3094
3133
  .passthrough();
3095
3134
  export const WakeCancelledPayloadSchema = z.object({ effectId: z.string() }).passthrough();
3135
+ /** The states of a plan step (`plan.updated`). */
3136
+ export const PLAN_STEP_STATES = ["pending", "active", "done", "blocked", "skipped"];
3137
+ /** The most steps one plan holds, and the most characters (UTF-16 units) of a label and a note. */
3138
+ export const PLAN_LIMITS = Object.freeze({ steps: 20, labelChars: 120, noteChars: 280 });
3139
+ /** One step of an agent's plan: a short label, its state, and an optional note. */
3140
+ export const PlanStepSchema = z
3141
+ .object({
3142
+ label: z.string().min(1).max(PLAN_LIMITS.labelChars),
3143
+ state: z.enum(PLAN_STEP_STATES),
3144
+ note: z.string().max(PLAN_LIMITS.noteChars).optional(),
3145
+ })
3146
+ .passthrough();
3147
+ /**
3148
+ * `plan.updated`: the agent's whole plan, as its last `update_plan` call left it (our engine's
3149
+ * built-in tool, which a version opts into with `harness.loop.plan`), never a diff. Our harness
3150
+ * claims it. Labels and notes are the agent's short text, never tool arguments or results; the A2A
3151
+ * server serves the latest under `progress/v1`.
3152
+ */
3153
+ export const PlanUpdatedPayloadSchema = z
3154
+ .object({ steps: z.array(PlanStepSchema).max(PLAN_LIMITS.steps) })
3155
+ .passthrough();
3096
3156
  /** `queue.taken` (protocol 17): the turn that started with the queued messages, in order. */
3097
3157
  export const QueueTakenPayloadSchema = z
3098
3158
  .object({ turnId: z.string(), queuedMessageIds: z.array(z.string()).min(1) })
@@ -3413,6 +3473,7 @@ export const EVENT_CATALOG = {
3413
3473
  "delegation.started": { payload: DelegationPayloadSchema, source: "loop", version: 1 },
3414
3474
  "delegation.completed": { payload: DelegationPayloadSchema, source: "loop", version: 1 },
3415
3475
  "mcp.discovered": { payload: McpDiscoveredPayloadSchema, source: "loop", version: 1 },
3476
+ "plan.updated": { payload: PlanUpdatedPayloadSchema, source: "loop", version: 1 },
3416
3477
  "environment.state": { payload: EnvironmentStatePayloadSchema, source: "loop", version: 1 },
3417
3478
  "environment.exec": { payload: EnvironmentExecPayloadSchema, source: "loop", version: 1 },
3418
3479
  "agent.attached": { payload: AgentAttachedPayloadSchema, source: "api", version: 1 },
@@ -4871,6 +4932,48 @@ export const ModelCallExportPageSchema = z
4871
4932
  asOf: z.string(),
4872
4933
  })
4873
4934
  .strict();
4935
+ /**
4936
+ * A turn's status in the turn index (Host feature `turns`): `running` from its first
4937
+ * `command.message` and again after an answer, `paused` while it waits for a person, then one of
4938
+ * the three ends.
4939
+ */
4940
+ export const TURN_STATUSES = ["running", "paused", "completed", "failed", "cancelled"];
4941
+ export const TurnStatusSchema = z.enum(TURN_STATUSES);
4942
+ /**
4943
+ * One turn as the turn index keeps it (Host feature `turns`), written in the transaction of the
4944
+ * event that changed it, so it agrees with the session's log. `totals` are the turn's end facts
4945
+ * (null until it ends, or for a turn that ended before the Runtime recorded them); `a2a` names the
4946
+ * A2A context and task when the session is an A2A context.
4947
+ */
4948
+ export const TurnSummarySchema = z
4949
+ .object({
4950
+ turnId: z.string(),
4951
+ sessionId: z.string(),
4952
+ agentId: z.string(),
4953
+ status: TurnStatusSchema,
4954
+ startedAt: z.string(),
4955
+ endedAt: z.string().nullable(),
4956
+ /** When its status last changed (the event's time). */
4957
+ changedAt: z.string(),
4958
+ totals: z
4959
+ .object({
4960
+ steps: z.number().int().nonnegative(),
4961
+ tokens: z.number().int().nonnegative(),
4962
+ costUsd: z.number().nonnegative(),
4963
+ })
4964
+ .strict()
4965
+ .nullable(),
4966
+ a2a: z.object({ contextId: z.string(), taskId: z.string() }).strict().nullable(),
4967
+ })
4968
+ .strict();
4969
+ /**
4970
+ * A page of the turn change feed (`GET /v1/turns`), in the order the turns changed: a turn
4971
+ * appears again each time it changes. Pass `cursor` as `changedAfter` to read on; it is returned
4972
+ * even when `turns` is empty. `hasMore`: another page is ready now.
4973
+ */
4974
+ export const TurnChangesPageSchema = z
4975
+ .object({ turns: z.array(TurnSummarySchema), cursor: z.string(), hasMore: z.boolean() })
4976
+ .strict();
4874
4977
  /**
4875
4978
  * One tool call of a session, read from the effect journal: what ran, with what input,
4876
4979
  * how many sends, and how it ended. `invoking` while it runs. `uncertain` only for a call
@@ -70,7 +70,7 @@ export declare const SCHEMA_URLS: {
70
70
  readonly mcp: readonly ["https://docs.nylorun.com/schemas/agent-folder/v1/mcp.json", "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json"];
71
71
  readonly flow: readonly ["https://docs.nylorun.com/schemas/agent-folder/v1/flow.json"];
72
72
  };
73
- export declare const AGENT_KEYS: readonly ["name", "description", "format", "harness", "inputSchema", "outputSchema", "mcpServers", "skills", "memory", "loop", "metadata"];
73
+ export declare const AGENT_KEYS: readonly ["name", "description", "format", "harness", "inputSchema", "outputSchema", "mcpServers", "skills", "memory", "loop", "model", "metadata"];
74
74
  export declare const TRIGGER_KEYS: readonly ["schedule", "timezone", "at", "webhook", "session"];
75
75
  export declare const MCP_KEYS: readonly ["$schema", "mcpServers"];
76
76
  export declare const SERVER_KEYS: readonly ["type", "url", "headers"];
@@ -1,4 +1,4 @@
1
- import { AGENT_MANIFEST_V8_SCHEMA_VERSION, AgentManifestV8Schema, ENVIRONMENT_NAME_PATTERN, HarnessIdSchema, RuntimeSectionSchema, TOOL_SECRET_NAME_PATTERN, TriggerSchema, isAgentManifestName, } from "../contracts.js";
1
+ import { AGENT_MANIFEST_V8_SCHEMA_VERSION, AGENT_MODEL_MAX_CHARS, AgentManifestV8Schema, ENVIRONMENT_NAME_PATTERN, HarnessIdSchema, RuntimeSectionSchema, TOOL_SECRET_NAME_PATTERN, TriggerSchema, agentModelChoice, isAgentManifestName, } from "../contracts.js";
2
2
  import { cronScheduleIssue, isTimeZone, timeZoneNames } from "../definition/cron.js";
3
3
  import { DELEGATE_NAME_PATTERN } from "../definition/delegate.js";
4
4
  import { sectionGapsAt } from "../definition/sections.js";
@@ -41,7 +41,7 @@ export const SCHEMA_URLS = {
41
41
  flow: [`${FOLDER_SCHEMAS}flow.json`],
42
42
  };
43
43
  const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
44
- export const AGENT_KEYS = ["name", "description", "format", "harness", "inputSchema", "outputSchema", "mcpServers", "skills", "memory", "loop", "metadata"];
44
+ export const AGENT_KEYS = ["name", "description", "format", "harness", "inputSchema", "outputSchema", "mcpServers", "skills", "memory", "loop", "model", "metadata"];
45
45
  const SKILL_KEYS = ["name", "description", "license", "compatibility", "metadata", "allowed-tools"];
46
46
  export const TRIGGER_KEYS = ["schedule", "timezone", "at", "webhook", "session"];
47
47
  export const MCP_KEYS = ["$schema", "mcpServers"];
@@ -50,8 +50,12 @@ export const SERVER_SETTING_KEYS = ["deferred", "tools"];
50
50
  /** What `AGENT.md` may also set for a plugin's server, which cannot know the agent's slot names. */
51
51
  export const PLUGIN_SERVER_SETTING_KEYS = [...SERVER_SETTING_KEYS, "credential"];
52
52
  export const TOOL_KEYS = ["description", "inputSchema", "outputSchema", "http"];
53
- /** The loop settings our harness reads from `loop`: none yet. A custom harness reads its own. */
54
- const NYLORUN_LOOP_KEYS = [];
53
+ /**
54
+ * The loop settings our harness reads from `loop`: `plan` (`true` offers the agent `update_plan`)
55
+ * and `connections` (`true` offers it `request_connection`). A custom harness reads its own.
56
+ */
57
+ const NYLORUN_LOOP_KEYS = ["plan", "connections"];
58
+ const LOOP_TOOLS = { plan: "update_plan", connections: "request_connection" };
55
59
  /** The runtime fields only a sandbox has, and the ones only a pod has. */
56
60
  const SANDBOX_FIELDS = ["image", "resources", "storage", "network", "setup", "files"];
57
61
  const POD_FIELDS = ["image", "storage", "setup", "files"];
@@ -473,10 +477,21 @@ export function compileAgentFolder(input, scope) {
473
477
  // so another key does nothing there: likely a typo, or meant for a custom harness.
474
478
  if (isObject(front.loop) && (front.harness === undefined || front.harness === DEFAULT_HARNESS))
475
479
  for (const key of Object.keys(front.loop))
476
- if (!NYLORUN_LOOP_KEYS.includes(key)) {
480
+ if (key in LOOP_TOOLS) {
481
+ if (typeof front.loop[key] !== "boolean")
482
+ error("value_invalid", `loop.${key} is true or false: true offers the agent ${LOOP_TOOLS[key]}`, AGENT_FILE, ["loop", key]);
483
+ }
484
+ else if (!NYLORUN_LOOP_KEYS.includes(key)) {
477
485
  const close = suggestion(key, NYLORUN_LOOP_KEYS);
478
486
  warn("loop_key", `Unknown loop setting '${key}'.${close ? ` Did you mean '${close}'?` : ""} loop holds the harness's own settings, and the ${DEFAULT_HARNESS} harness reads ${NYLORUN_LOOP_KEYS.length === 0 ? "none yet" : NYLORUN_LOOP_KEYS.join(", ")}, so it is ignored`, AGENT_FILE, ["loop", key], { key: true });
479
487
  }
488
+ // The model the agent runs on (Host feature `agent-model`): `<provider>/<model>`.
489
+ if (front.model !== undefined) {
490
+ if (typeof front.model === "string" && agentModelChoice(front.model.trim()) !== undefined)
491
+ harness.model = front.model.trim();
492
+ else
493
+ error("value_invalid", `model is <provider>/<model>, such as anthropic/claude-sonnet-4-5: the provider's id (letters, digits, '.', '_' or '-'), a '/', then the model's id, at most ${AGENT_MODEL_MAX_CHARS} characters and no spaces${typeof front.model === "string" ? `, not ${JSON.stringify(front.model)}` : ""}`, AGENT_FILE, ["model"]);
494
+ }
480
495
  if (front.metadata !== undefined) {
481
496
  if (isObject(front.metadata))
482
497
  metadata = front.metadata;
@@ -487,7 +502,7 @@ export function compileAgentFolder(input, scope) {
487
502
  if (body !== "")
488
503
  instructions.push(body);
489
504
  origins.push([["harness", "instructions"], { file: AGENT_FILE, path: [] }]);
490
- for (const key of ["memory", "loop", "outputSchema"])
505
+ for (const key of ["memory", "loop", "model", "outputSchema"])
491
506
  origins.push([["harness", key], { file: AGENT_FILE, path: [key] }]);
492
507
  origins.push([["harness", "id"], { file: AGENT_FILE, path: ["harness"] }]);
493
508
  }
@@ -6,9 +6,9 @@
6
6
  *
7
7
  * Each manifest field goes where the compiler reads it:
8
8
  *
9
- * - `name`, `description`, `metadata`, `harness.id`, `memory`, `loop`, and this agent's server and
10
- * skill settings: `AGENT.md` frontmatter. `harness.outputSchema`: `output.schema.json`, named by
11
- * `outputSchema`.
9
+ * - `name`, `description`, `metadata`, `harness.id`, `memory`, `loop`, `model`, and this agent's
10
+ * server and skill settings: `AGENT.md` frontmatter. `harness.outputSchema`:
11
+ * `output.schema.json`, named by `outputSchema`.
12
12
  * - `harness.instructions`: the first as `AGENT.md`'s body, each other as
13
13
  * `instructions/NN-<slug>.md`, zero-padded so path order and natural order agree.
14
14
  * - HTTP tools: `tools/<name>.json`, their schemas inline.
@@ -264,6 +264,8 @@ function writeAgent(writer, place, identity, harness) {
264
264
  note("harness.skills is an empty map: it is left out.");
265
265
  if (harness.memory !== undefined)
266
266
  front.memory = harness.memory;
267
+ if (harness.model !== undefined)
268
+ front.model = harness.model;
267
269
  if (harness.loop !== undefined) {
268
270
  if (isObject(harness.loop))
269
271
  front.loop = harness.loop;
@@ -191,6 +191,7 @@ function nestedChecks(ctx) {
191
191
  harness: `${what} runs in the harness of the agent that holds it: set harness in the root's AGENT.md`,
192
192
  memory: `memory is the root agent's: ${what} keeps none of its own`,
193
193
  loop: `loop settings are the root agent's: ${what} has none of its own`,
194
+ model: `model is the root agent's: ${what} runs in the root agent's session, on its model`,
194
195
  };
195
196
  for (const [key, message] of Object.entries(keys))
196
197
  if (ctx.front[key] !== undefined)
@@ -311,7 +312,7 @@ function composeFlow(ctx) {
311
312
  refuse(kind === "skill" ? `A flow has no skills of its own: move ${top}/ to the agent that uses it` : `A flow takes no plugins: vendor ${top}/ in the agent that uses it`, `${top}/`);
312
313
  }
313
314
  }
314
- for (const key of ["mcpServers", "skills", "memory"])
315
+ for (const key of ["mcpServers", "skills", "memory", "model"])
315
316
  if (front[key] !== undefined)
316
317
  refuse(`${key} is an agent's: set it in the AGENT.md of the agent under agents/ that needs it`, AGENT_FILE, [key]);
317
318
  const inputSchema = front.inputSchema === undefined ? undefined : ctx.schemaAt(AGENT_FILE, ["inputSchema"], front.inputSchema);
@@ -18,7 +18,7 @@
18
18
  * the folder, a cron, a time zone, which server or skill a name means.
19
19
  */
20
20
  import { z } from "zod";
21
- import { AGENT_MANIFEST_NAME_PATTERN, ENVIRONMENT_NAME_PATTERN, HarnessIdSchema, HarnessMemorySchema, HttpToolTargetSchema, McpToolSettingsSchema, RuntimeSectionSchema, TOOL_SECRET_NAME_PATTERN, TriggerSchema, } from "../contracts.js";
21
+ import { AGENT_MANIFEST_NAME_PATTERN, ENVIRONMENT_NAME_PATTERN, HarnessIdSchema, AgentModelSchema, HarnessMemorySchema, HttpToolTargetSchema, McpToolSettingsSchema, RuntimeSectionSchema, TOOL_SECRET_NAME_PATTERN, TriggerSchema, } from "../contracts.js";
22
22
  import { DELEGATE_NAME_PATTERN } from "../definition/delegate.js";
23
23
  import { AGENT_KEYS, FOLDER_SCHEMAS, MCP_KEYS, PLUGIN_SERVER_SETTING_KEYS, SERVER_KEYS, TOOL_KEYS, TRIGGER_KEYS, } from "./compile.js";
24
24
  import { LOOP_KEYS, MAP_KEYS, NODE_KINDS, SWITCH_KEYS, VERIFY_KEYS } from "./flow.js";
@@ -47,11 +47,18 @@ function fromZod(schema, defs, description) {
47
47
  }
48
48
  return description ? { ...definition, description } : definition;
49
49
  }
50
+ /**
51
+ * A kind's revision within format 1, when its document gained an optional key (a published `$id`
52
+ * names one document for good): `AGENT.md` took `model` (Host feature `agent-model`), published
53
+ * as `agent-md.1.json`.
54
+ */
55
+ const REVISIONS = { "agent-md": 1 };
50
56
  /** One document: its `$id` from its kind, then the body, then the `$defs` its parts named. */
51
57
  function document(kind, title, description, body, defs) {
58
+ const revision = REVISIONS[kind];
52
59
  return {
53
60
  $schema: DIALECT,
54
- $id: `${FOLDER_SCHEMAS}${kind}.json`,
61
+ $id: `${FOLDER_SCHEMAS}${kind}${revision === undefined ? "" : `.${revision}`}.json`,
55
62
  title,
56
63
  description,
57
64
  ...body,
@@ -101,7 +108,11 @@ function agentMd() {
101
108
  additionalProperties: false,
102
109
  }, "This agent's settings for each skill of skills/ or a plugin, by its name"),
103
110
  memory: fromZod(HarnessMemorySchema, defs, "The Agent's memory: Markdown files under /memories it keeps across sessions"),
104
- loop: { type: "object", description: "The harness's own settings, passed to it each turn; the nylorun harness reads none yet" },
111
+ loop: {
112
+ type: "object",
113
+ description: "The harness's own settings, passed to it each turn; the nylorun harness reads plan (true offers the agent update_plan) and connections (true offers it request_connection)",
114
+ },
115
+ model: fromZod(AgentModelSchema, defs, "The model the agent runs on: <provider>/<model>, such as anthropic/claude-sonnet-4-5"),
105
116
  metadata: { type: "object", description: "The manifest's metadata, as it is" },
106
117
  };
107
118
  return document("agent-md", "Nylorun agent folder: AGENT.md frontmatter", "The frontmatter of an agent folder's AGENT.md; the body below it is the instructions", { type: "object", properties, required: ["name", "description"], additionalProperties: false }, defs);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/harness-api/v5.json",
3
+ "$id": "https://docs.nylorun.com/schemas/harness-api/v5.1.json",
4
4
  "title": "Nylorun Harness API 5",
5
5
  "$defs": {
6
6
  "ArtifactMeta": {
@@ -4301,7 +4301,8 @@
4301
4301
  "environment.state",
4302
4302
  "environment.exec",
4303
4303
  "artifact.export.skipped",
4304
- "artifact.export.failed"
4304
+ "artifact.export.failed",
4305
+ "plan.updated"
4305
4306
  ]
4306
4307
  },
4307
4308
  "payload": {},
@@ -48,6 +48,12 @@ export function harnessApiSchemas() {
48
48
  out[`${method}.params`] = params;
49
49
  return out;
50
50
  }
51
+ /**
52
+ * The revision of v5's document: the claims a harness may make grew within v5 (`plan.updated`,
53
+ * additive: core accepts more, and a v5 harness that claims none of it is unchanged), and a
54
+ * published `$id` names one document for good.
55
+ */
56
+ const SCHEMA_REVISION = 1;
51
57
  /** The JSON Schema document of the Harness API (draft 2020-12). */
52
58
  export function harnessApiJsonSchema() {
53
59
  const $defs = {};
@@ -57,7 +63,7 @@ export function harnessApiJsonSchema() {
57
63
  }
58
64
  return {
59
65
  $schema: "https://json-schema.org/draft/2020-12/schema",
60
- $id: `https://docs.nylorun.com/schemas/harness-api/v${HARNESS_API_VERSION}.json`,
66
+ $id: `https://docs.nylorun.com/schemas/harness-api/v${HARNESS_API_VERSION}.${SCHEMA_REVISION}.json`,
61
67
  title: `Nylorun Harness API ${HARNESS_API_VERSION}`,
62
68
  $defs,
63
69
  };
@@ -21,9 +21,10 @@ export type ReleaseReason = z.infer<typeof ReleaseReasonSchema>;
21
21
  * Events a harness may claim: for a run it holds, or for a workspace request core sent it. A
22
22
  * `environment.state` claim carries the workspace's compute record, which core keeps. Our engine
23
23
  * claims `artifact.export.skipped` and `artifact.export.failed` when the turn-end save of its
24
- * outputs folder stores nothing (protocol 15).
24
+ * outputs folder stores nothing (protocol 15), and `plan.updated` when the agent calls its
25
+ * built-in `update_plan` tool (additive within v5).
25
26
  */
26
- export declare const HARNESS_CLAIMS: readonly ["environment.state", "environment.exec", "artifact.export.skipped", "artifact.export.failed"];
27
+ export declare const HARNESS_CLAIMS: readonly ["environment.state", "environment.exec", "artifact.export.skipped", "artifact.export.failed", "plan.updated"];
27
28
  export type HarnessClaim = (typeof HARNESS_CLAIMS)[number];
28
29
  export declare const HARNESS_ERROR_CODES: readonly ["run_not_held", "turn_cancelled", "ownership_lost", "effect_drift", "invalid", "unavailable", "internal",
29
30
  /**
@@ -5,13 +5,15 @@ export const ABORT_REASONS = ["cancel", "shutdown", "deadline", "ownership.lost"
5
5
  * Events a harness may claim: for a run it holds, or for a workspace request core sent it. A
6
6
  * `environment.state` claim carries the workspace's compute record, which core keeps. Our engine
7
7
  * claims `artifact.export.skipped` and `artifact.export.failed` when the turn-end save of its
8
- * outputs folder stores nothing (protocol 15).
8
+ * outputs folder stores nothing (protocol 15), and `plan.updated` when the agent calls its
9
+ * built-in `update_plan` tool (additive within v5).
9
10
  */
10
11
  export const HARNESS_CLAIMS = [
11
12
  "environment.state",
12
13
  "environment.exec",
13
14
  "artifact.export.skipped",
14
15
  "artifact.export.failed",
16
+ "plan.updated",
15
17
  ];
16
18
  export const HARNESS_ERROR_CODES = [
17
19
  "run_not_held",
@@ -907,6 +907,7 @@ export declare const harnessRequests: {
907
907
  "artifact.export.skipped": "artifact.export.skipped";
908
908
  "environment.exec": "environment.exec";
909
909
  "environment.state": "environment.state";
910
+ "plan.updated": "plan.updated";
910
911
  }>;
911
912
  payload: z.ZodUnknown;
912
913
  record: z.ZodOptional<z.ZodObject<{
@@ -358,7 +358,10 @@ export const TurnStartSchema = z
358
358
  definition: z.object({ name: z.string(), version: z.number().int().positive() }).strict().optional(),
359
359
  /**
360
360
  * The harness section's `loop` (protocol 16): the harness's own settings, which the Runtime
361
- * passes on without reading. Ours reads none yet.
361
+ * passes on without reading. Ours reads `plan`: `true` offers the root agent the built-in
362
+ * `update_plan` tool, whose calls it claims as `plan.updated`; and `connections`: `true` offers
363
+ * it `request_connection`, whose calls wait on an interaction with `metadata.kind:
364
+ * "connection"`.
362
365
  */
363
366
  loop: document.optional(),
364
367
  /** The Agent's memory, when the version its session runs sets `harness.memory`. Absent for a flow. */
@@ -11,6 +11,13 @@
11
11
  */
12
12
  import { z } from "zod";
13
13
  import { AGENT_MANIFEST_V8_SCHEMA_VERSION, AgentManifestFileSchema, HARNESS_MANIFEST_FILE_SCHEMA_VERSION, HarnessManifestFileSchema, RUNTIME_MANIFEST_FILE_SCHEMA_VERSION, RuntimeManifestFileSchema, } from "./contracts.js";
14
+ /**
15
+ * The revision of a document whose version kept its number while it gained an optional field (a
16
+ * published `$id` names one document for good): agent manifest v8 and the harness file v1 took
17
+ * `harness.model` (Host feature `agent-model`), published as `v8.1` and `v1.1`.
18
+ */
19
+ const AGENT_MANIFEST_REVISION = 1;
20
+ const HARNESS_MANIFEST_FILE_REVISION = 1;
14
21
  function document(schema, id, title) {
15
22
  const { $schema: _, ...definition } = z.toJSONSchema(schema, { io: "input", unrepresentable: "any" });
16
23
  const properties = (definition.properties ?? {});
@@ -31,11 +38,11 @@ function document(schema, id, title) {
31
38
  * What the API receives has both sections written out (`AgentManifestV8Schema`).
32
39
  */
33
40
  export function agentManifestJsonSchema() {
34
- return document(AgentManifestFileSchema, `agent-manifest/v${AGENT_MANIFEST_V8_SCHEMA_VERSION}`, `Nylorun agent manifest ${AGENT_MANIFEST_V8_SCHEMA_VERSION}`);
41
+ return document(AgentManifestFileSchema, `agent-manifest/v${AGENT_MANIFEST_V8_SCHEMA_VERSION}.${AGENT_MANIFEST_REVISION}`, `Nylorun agent manifest ${AGENT_MANIFEST_V8_SCHEMA_VERSION}`);
35
42
  }
36
43
  /** `harness.manifest.json`'s JSON Schema document: the harness section as an authoring file. */
37
44
  export function harnessManifestJsonSchema() {
38
- return document(HarnessManifestFileSchema, `harness-manifest/v${HARNESS_MANIFEST_FILE_SCHEMA_VERSION}`, `Nylorun harness manifest ${HARNESS_MANIFEST_FILE_SCHEMA_VERSION}`);
45
+ return document(HarnessManifestFileSchema, `harness-manifest/v${HARNESS_MANIFEST_FILE_SCHEMA_VERSION}.${HARNESS_MANIFEST_FILE_REVISION}`, `Nylorun harness manifest ${HARNESS_MANIFEST_FILE_SCHEMA_VERSION}`);
39
46
  }
40
47
  /** `runtime.manifest.json`'s JSON Schema document: the runtime section as an authoring file. */
41
48
  export function runtimeManifestJsonSchema() {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/agent-folder/v1/agent-md.json",
3
+ "$id": "https://docs.nylorun.com/schemas/agent-folder/v1/agent-md.1.json",
4
4
  "title": "Nylorun agent folder: AGENT.md frontmatter",
5
5
  "description": "The frontmatter of an agent folder's AGENT.md; the body below it is the instructions",
6
6
  "type": "object",
@@ -82,7 +82,13 @@
82
82
  },
83
83
  "loop": {
84
84
  "type": "object",
85
- "description": "The harness's own settings, passed to it each turn; the nylorun harness reads none yet"
85
+ "description": "The harness's own settings, passed to it each turn; the nylorun harness reads plan (true offers the agent update_plan) and connections (true offers it request_connection)"
86
+ },
87
+ "model": {
88
+ "type": "string",
89
+ "maxLength": 200,
90
+ "pattern": "^[A-Za-z0-9._-]+\\/\\S+$",
91
+ "description": "The model the agent runs on: <provider>/<model>, such as anthropic/claude-sonnet-4-5"
86
92
  },
87
93
  "metadata": {
88
94
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/agent-manifest/v8.json",
3
+ "$id": "https://docs.nylorun.com/schemas/agent-manifest/v8.1.json",
4
4
  "title": "Nylorun agent manifest 8",
5
5
  "type": "object",
6
6
  "properties": {
@@ -281,6 +281,12 @@
281
281
  },
282
282
  "additionalProperties": false
283
283
  },
284
+ "model": {
285
+ "type": "string",
286
+ "maxLength": 200,
287
+ "pattern": "^[A-Za-z0-9._-]+\\/\\S+$",
288
+ "description": "The model the agent runs on: <provider>/<model>, such as anthropic/claude-sonnet-4-5"
289
+ },
284
290
  "credentials": {
285
291
  "type": "object",
286
292
  "propertyNames": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://docs.nylorun.com/schemas/harness-manifest/v1.json",
3
+ "$id": "https://docs.nylorun.com/schemas/harness-manifest/v1.1.json",
4
4
  "title": "Nylorun harness manifest 1",
5
5
  "type": "object",
6
6
  "properties": {
@@ -250,6 +250,12 @@
250
250
  },
251
251
  "additionalProperties": false
252
252
  },
253
+ "model": {
254
+ "type": "string",
255
+ "maxLength": 200,
256
+ "pattern": "^[A-Za-z0-9._-]+\\/\\S+$",
257
+ "description": "The model the agent runs on: <provider>/<model>, such as anthropic/claude-sonnet-4-5"
258
+ },
253
259
  "credentials": {
254
260
  "type": "object",
255
261
  "propertyNames": {
@@ -203,6 +203,11 @@ export interface AgentHarnessSection {
203
203
  readonly loop?: JsonObject;
204
204
  /** Turns on the Agent's memory: Markdown files it keeps across sessions. */
205
205
  readonly memory?: AgentMemorySettings;
206
+ /**
207
+ * The model the agent runs on, `<provider>/<model>`: a new session's own model when the provider
208
+ * is connected and lists it (Host feature `agent-model`).
209
+ */
210
+ readonly model?: string;
206
211
  }
207
212
  /**
208
213
  * `harness.memory`: the Agent's memory, the same in every turn whoever starts it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.31.0-beta",
3
+ "version": "0.33.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",