@nylorun/core 0.30.0-beta → 0.32.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,57 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.32.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - d48b6ef: The A2A endpoint serves the Nylorun A2A profile v2 (Host feature `a2a-profile-v2`, Engine R1).
8
+
9
+ - **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).
10
+ - **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`.
11
+ - **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.
12
+ - **Progress, telemetry, effects.** `plan.updated` events become `progress/v1`; the terminal status carries `telemetry/v1` (totals and trace id); an uncertain effect `effects/v1`.
13
+ - **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`.
14
+ - **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`).
15
+ - ProtoJSON's original field names (`task_id`) are accepted in A2A params.
16
+
17
+ - d48b6ef: An agent manifest names the model its agent runs on (Host feature `agent-model`).
18
+
19
+ - **`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.
20
+ - **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.
21
+ - `agentModelChoice` and `AgentModelSchema` in `@nylorun/core/contracts`.
22
+ - 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.
23
+
24
+ - d48b6ef: An agent keeps a durable plan (A2A profile v2, `progress/v1`; A2A-E10).
25
+
26
+ - **`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.
27
+ - **`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.
28
+ - **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.
29
+ - The agent folder compiler takes `loop.plan` (true or false) and suggests it for a close typo.
30
+
31
+ - d48b6ef: An agent asks for an app to be connected (A2A profile v2, `interactions/v1` kind `connection`).
32
+
33
+ - **`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.
34
+ - 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>`.
35
+ - The agent folder compiler takes `loop.connections` (true or false).
36
+
37
+ - d48b6ef: The Runtime keeps a turn index and serves it as a change feed (Host feature `turns`, A2A-E1 to E3).
38
+
39
+ - **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.
40
+ - **`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.
41
+ - **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.
42
+ - **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.
43
+ - `@nylorun/core` adds `TurnSummarySchema`, `TurnChangesPageSchema` and `TURN_STATUSES`.
44
+
45
+ ## 0.31.0-beta
46
+
47
+ ### Minor Changes
48
+
49
+ - 2f3fc06: A skill file can be uploaded from a stream, so a client never holds a large one in memory (ADR-93).
50
+
51
+ - **`SkillFileSource.stream()`**, optional: each call opens a new stream of the file's bytes. When a source has it, `client.files.ensure` (and so `agentManifests.save`) sends the stream instead of `read()`'s bytes.
52
+ - **`client.files.uploadStream(stream, { sha256 })`** sends one file half-duplex, up to the Tenant's skill limit (2 GiB by default). The Runtime already streams the body to its hash.
53
+ - **A stream is never sent twice by the transport.** After an expired token or a protocol check, `ensure` opens a new stream and sends it once more.
54
+
3
55
  ## 0.30.0-beta
4
56
 
5
57
  ### Minor Changes
@@ -208,12 +208,33 @@ export type ProtocolFeature = (typeof PROTOCOL_FEATURES)[number];
208
208
  * Application Default Credentials, when the Host's operator lends them (`NYLORUN_MODEL_HOST_IDENTITY`).
209
209
  * `credential-provider`: egress-gate can hand a pod Agent's requests to an outside credential
210
210
  * provider the Host's operator names (`NYLORUN_CREDENTIAL_PROVIDER_URL`), which adds the Agent
211
- * owner's keys: the hosts it lists pass the allowlist on 443, and each segment's sandbox sees the
212
- * variables it names as `nylorun_managed`. No route changes.
211
+ * owner's keys: the hosts it lists (exact, or `*.suffix`) pass the allowlist on 443, and each
212
+ * segment's sandbox sees the variables it names, as `nylorun_managed`, a stand-in it names or a
213
+ * plain value. No route changes.
213
214
  */
214
- 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",
215
223
  /** Opt-in artifact metadata pages (`GET /v1/artifacts?limit=…`). */
216
- "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"];
217
238
  export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
218
239
  export interface ProtocolRange {
219
240
  min: number;
@@ -210,8 +210,9 @@ export const PROTOCOL_FEATURES = [
210
210
  * Application Default Credentials, when the Host's operator lends them (`NYLORUN_MODEL_HOST_IDENTITY`).
211
211
  * `credential-provider`: egress-gate can hand a pod Agent's requests to an outside credential
212
212
  * provider the Host's operator names (`NYLORUN_CREDENTIAL_PROVIDER_URL`), which adds the Agent
213
- * owner's keys: the hosts it lists pass the allowlist on 443, and each segment's sandbox sees the
214
- * variables it names as `nylorun_managed`. No route changes.
213
+ * owner's keys: the hosts it lists (exact, or `*.suffix`) pass the allowlist on 443, and each
214
+ * segment's sandbox sees the variables it names, as `nylorun_managed`, a stand-in it names or a
215
+ * plain value. No route changes.
215
216
  */
216
217
  export const OPTIONAL_HOST_FEATURES = [
217
218
  "tenant-fixture-model",
@@ -219,6 +220,13 @@ export const OPTIONAL_HOST_FEATURES = [
219
220
  "subject-headers",
220
221
  "ag-ui-endpoint",
221
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",
222
230
  "sandbox-pods",
223
231
  "trusted-issuers",
224
232
  "session-reads",
@@ -236,6 +244,19 @@ export const OPTIONAL_HOST_FEATURES = [
236
244
  "session-model",
237
245
  "model-host-identity",
238
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",
239
260
  ];
240
261
  /**
241
262
  * What this Host serves: protocol 16, 17 and 18. Protocol 16 replaced agent definitions and
@@ -1167,6 +1167,21 @@ export declare const HarnessMemorySchema: z.ZodObject<{
1167
1167
  }>>;
1168
1168
  instructions: z.ZodOptional<z.ZodString>;
1169
1169
  }, z.core.$strict>;
1170
+ /**
1171
+ * `harness.model` (Host feature `agent-model`): the model the agent runs on, `<provider>/<model>`
1172
+ * (the provider's id, then its model's id, which may itself hold `/`). A session opened on a
1173
+ * version that names one starts with it as its own model (`Session.model`), when the provider is
1174
+ * connected and lists the model; otherwise the Tenant's model applies. A later
1175
+ * `PUT /v1/sessions/{id}/model` still chooses another.
1176
+ */
1177
+ export declare const AGENT_MODEL_PATTERN: RegExp;
1178
+ export declare const AGENT_MODEL_MAX_CHARS = 200;
1179
+ export declare const AgentModelSchema: z.ZodString;
1180
+ /** `harness.model` as a session's model choice: the provider before the first `/`, the model after. */
1181
+ export declare function agentModelChoice(value: string): {
1182
+ provider: string;
1183
+ model: string;
1184
+ } | undefined;
1170
1185
  /** What runs inside the loop of an agent: the `harness` section of agent manifest v8. */
1171
1186
  export declare const AgentHarnessSectionSchema: z.ZodType<AgentHarnessSection>;
1172
1187
  /** A flow's `harness` section (`kind: "workflow"`). */
@@ -1781,6 +1796,7 @@ export declare const HarnessManifestFileSchema: z.ZodObject<{
1781
1796
  }>>;
1782
1797
  instructions: z.ZodOptional<z.ZodString>;
1783
1798
  }, z.core.$strict>>;
1799
+ model: z.ZodOptional<z.ZodString>;
1784
1800
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1785
1801
  requires: z.ZodOptional<z.ZodObject<{
1786
1802
  sandbox: z.ZodOptional<z.ZodEnum<{
@@ -1989,6 +2005,7 @@ export declare const AgentManifestFileSchema: z.ZodObject<{
1989
2005
  }>>;
1990
2006
  instructions: z.ZodOptional<z.ZodString>;
1991
2007
  }, z.core.$strict>>;
2008
+ model: z.ZodOptional<z.ZodString>;
1992
2009
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1993
2010
  requires: z.ZodOptional<z.ZodObject<{
1994
2011
  sandbox: z.ZodOptional<z.ZodEnum<{
@@ -4460,6 +4477,47 @@ export declare const WakeBookedPayloadSchema: z.ZodObject<{
4460
4477
  export declare const WakeCancelledPayloadSchema: z.ZodObject<{
4461
4478
  effectId: z.ZodString;
4462
4479
  }, z.core.$loose>;
4480
+ /** The states of a plan step (`plan.updated`). */
4481
+ export declare const PLAN_STEP_STATES: readonly ["pending", "active", "done", "blocked", "skipped"];
4482
+ export type PlanStepState = (typeof PLAN_STEP_STATES)[number];
4483
+ /** The most steps one plan holds, and the most characters (UTF-16 units) of a label and a note. */
4484
+ export declare const PLAN_LIMITS: Readonly<{
4485
+ steps: 20;
4486
+ labelChars: 120;
4487
+ noteChars: 280;
4488
+ }>;
4489
+ /** One step of an agent's plan: a short label, its state, and an optional note. */
4490
+ export declare const PlanStepSchema: z.ZodObject<{
4491
+ label: z.ZodString;
4492
+ state: z.ZodEnum<{
4493
+ active: "active";
4494
+ blocked: "blocked";
4495
+ done: "done";
4496
+ pending: "pending";
4497
+ skipped: "skipped";
4498
+ }>;
4499
+ note: z.ZodOptional<z.ZodString>;
4500
+ }, z.core.$loose>;
4501
+ export type PlanStep = z.infer<typeof PlanStepSchema>;
4502
+ /**
4503
+ * `plan.updated`: the agent's whole plan, as its last `update_plan` call left it (our engine's
4504
+ * built-in tool, which a version opts into with `harness.loop.plan`), never a diff. Our harness
4505
+ * claims it. Labels and notes are the agent's short text, never tool arguments or results; the A2A
4506
+ * server serves the latest under `progress/v1`.
4507
+ */
4508
+ export declare const PlanUpdatedPayloadSchema: z.ZodObject<{
4509
+ steps: z.ZodArray<z.ZodObject<{
4510
+ label: z.ZodString;
4511
+ state: z.ZodEnum<{
4512
+ active: "active";
4513
+ blocked: "blocked";
4514
+ done: "done";
4515
+ pending: "pending";
4516
+ skipped: "skipped";
4517
+ }>;
4518
+ note: z.ZodOptional<z.ZodString>;
4519
+ }, z.core.$loose>>;
4520
+ }, z.core.$loose>;
4463
4521
  /** `queue.taken` (protocol 17): the turn that started with the queued messages, in order. */
4464
4522
  export declare const QueueTakenPayloadSchema: z.ZodObject<{
4465
4523
  turnId: z.ZodString;
@@ -5392,6 +5450,23 @@ export declare const EVENT_CATALOG: {
5392
5450
  readonly source: "loop";
5393
5451
  readonly version: 1;
5394
5452
  };
5453
+ readonly "plan.updated": {
5454
+ readonly payload: z.ZodObject<{
5455
+ steps: z.ZodArray<z.ZodObject<{
5456
+ label: z.ZodString;
5457
+ state: z.ZodEnum<{
5458
+ active: "active";
5459
+ blocked: "blocked";
5460
+ done: "done";
5461
+ pending: "pending";
5462
+ skipped: "skipped";
5463
+ }>;
5464
+ note: z.ZodOptional<z.ZodString>;
5465
+ }, z.core.$loose>>;
5466
+ }, z.core.$loose>;
5467
+ readonly source: "loop";
5468
+ readonly version: 1;
5469
+ };
5395
5470
  readonly "environment.state": {
5396
5471
  readonly payload: z.ZodObject<{
5397
5472
  state: z.ZodEnum<{
@@ -5605,7 +5680,7 @@ type EventSchemaOf<T extends EventType> = z.ZodObject<typeof eventEnvelope & {
5605
5680
  /** One schema per event type, keyed by type (the OpenAPI components). */
5606
5681
  export declare const EVENT_SCHEMAS: { [T in EventType]: EventSchemaOf<T>; };
5607
5682
  /** 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">;
5683
+ 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
5684
  export type SessionEvent = {
5610
5685
  [T in EventType]: z.infer<EventSchemaOf<T>>;
5611
5686
  }[EventType];
@@ -5620,7 +5695,7 @@ export type SessionEventOf<T extends EventType> = Extract<SessionEvent, {
5620
5695
  */
5621
5696
  export declare function parseSessionEvent(value: unknown): SessionEvent | LiveEvent;
5622
5697
  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">>;
5698
+ 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
5699
  cursor: z.ZodNullable<z.ZodString>;
5625
5700
  }, z.core.$strip>;
5626
5701
  export type SessionItemsResponse = {
@@ -7899,7 +7974,7 @@ export declare const SessionManifestViewSchema: z.ZodObject<{
7899
7974
  }, z.core.$strict>;
7900
7975
  export type SessionManifestView = z.infer<typeof SessionManifestViewSchema>;
7901
7976
  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">>;
7977
+ 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
7978
  cursor: z.ZodNullable<z.ZodString>;
7904
7979
  tail: z.ZodBoolean;
7905
7980
  }, z.core.$strip>;
@@ -8056,6 +8131,85 @@ export declare const ModelCallExportPageSchema: z.ZodObject<{
8056
8131
  asOf: z.ZodString;
8057
8132
  }, z.core.$strict>;
8058
8133
  export type ModelCallExportPage = z.infer<typeof ModelCallExportPageSchema>;
8134
+ /**
8135
+ * A turn's status in the turn index (Host feature `turns`): `running` from its first
8136
+ * `command.message` and again after an answer, `paused` while it waits for a person, then one of
8137
+ * the three ends.
8138
+ */
8139
+ export declare const TURN_STATUSES: readonly ["running", "paused", "completed", "failed", "cancelled"];
8140
+ export declare const TurnStatusSchema: z.ZodEnum<{
8141
+ cancelled: "cancelled";
8142
+ completed: "completed";
8143
+ failed: "failed";
8144
+ paused: "paused";
8145
+ running: "running";
8146
+ }>;
8147
+ export type TurnStatus = z.infer<typeof TurnStatusSchema>;
8148
+ /**
8149
+ * One turn as the turn index keeps it (Host feature `turns`), written in the transaction of the
8150
+ * event that changed it, so it agrees with the session's log. `totals` are the turn's end facts
8151
+ * (null until it ends, or for a turn that ended before the Runtime recorded them); `a2a` names the
8152
+ * A2A context and task when the session is an A2A context.
8153
+ */
8154
+ export declare const TurnSummarySchema: z.ZodObject<{
8155
+ turnId: z.ZodString;
8156
+ sessionId: z.ZodString;
8157
+ agentId: z.ZodString;
8158
+ status: z.ZodEnum<{
8159
+ cancelled: "cancelled";
8160
+ completed: "completed";
8161
+ failed: "failed";
8162
+ paused: "paused";
8163
+ running: "running";
8164
+ }>;
8165
+ startedAt: z.ZodString;
8166
+ endedAt: z.ZodNullable<z.ZodString>;
8167
+ changedAt: z.ZodString;
8168
+ totals: z.ZodNullable<z.ZodObject<{
8169
+ steps: z.ZodNumber;
8170
+ tokens: z.ZodNumber;
8171
+ costUsd: z.ZodNumber;
8172
+ }, z.core.$strict>>;
8173
+ a2a: z.ZodNullable<z.ZodObject<{
8174
+ contextId: z.ZodString;
8175
+ taskId: z.ZodString;
8176
+ }, z.core.$strict>>;
8177
+ }, z.core.$strict>;
8178
+ export type TurnSummary = z.infer<typeof TurnSummarySchema>;
8179
+ /**
8180
+ * A page of the turn change feed (`GET /v1/turns`), in the order the turns changed: a turn
8181
+ * appears again each time it changes. Pass `cursor` as `changedAfter` to read on; it is returned
8182
+ * even when `turns` is empty. `hasMore`: another page is ready now.
8183
+ */
8184
+ export declare const TurnChangesPageSchema: z.ZodObject<{
8185
+ turns: z.ZodArray<z.ZodObject<{
8186
+ turnId: z.ZodString;
8187
+ sessionId: z.ZodString;
8188
+ agentId: z.ZodString;
8189
+ status: z.ZodEnum<{
8190
+ cancelled: "cancelled";
8191
+ completed: "completed";
8192
+ failed: "failed";
8193
+ paused: "paused";
8194
+ running: "running";
8195
+ }>;
8196
+ startedAt: z.ZodString;
8197
+ endedAt: z.ZodNullable<z.ZodString>;
8198
+ changedAt: z.ZodString;
8199
+ totals: z.ZodNullable<z.ZodObject<{
8200
+ steps: z.ZodNumber;
8201
+ tokens: z.ZodNumber;
8202
+ costUsd: z.ZodNumber;
8203
+ }, z.core.$strict>>;
8204
+ a2a: z.ZodNullable<z.ZodObject<{
8205
+ contextId: z.ZodString;
8206
+ taskId: z.ZodString;
8207
+ }, z.core.$strict>>;
8208
+ }, z.core.$strict>>;
8209
+ cursor: z.ZodString;
8210
+ hasMore: z.ZodBoolean;
8211
+ }, z.core.$strict>;
8212
+ export type TurnChangesPage = z.infer<typeof TurnChangesPageSchema>;
8059
8213
  /**
8060
8214
  * One tool call of a session, read from the effect journal: what ran, with what input,
8061
8215
  * how many sends, and how it ended. `invoking` while it runs. `uncertain` only for a call
package/dist/contracts.js CHANGED
@@ -1618,6 +1618,28 @@ export const HarnessMemorySchema = z.strictObject({
1618
1618
  });
1619
1619
  const harnessMemoryField = HarnessMemorySchema.optional()
1620
1620
  .meta({ description: "The Agent's memory: Markdown files under /memories it keeps across sessions" });
1621
+ /**
1622
+ * `harness.model` (Host feature `agent-model`): the model the agent runs on, `<provider>/<model>`
1623
+ * (the provider's id, then its model's id, which may itself hold `/`). A session opened on a
1624
+ * version that names one starts with it as its own model (`Session.model`), when the provider is
1625
+ * connected and lists the model; otherwise the Tenant's model applies. A later
1626
+ * `PUT /v1/sessions/{id}/model` still chooses another.
1627
+ */
1628
+ export const AGENT_MODEL_PATTERN = /^[A-Za-z0-9._-]+\/\S+$/;
1629
+ export const AGENT_MODEL_MAX_CHARS = 200;
1630
+ export const AgentModelSchema = z
1631
+ .string()
1632
+ .max(AGENT_MODEL_MAX_CHARS)
1633
+ .regex(AGENT_MODEL_PATTERN, "model is <provider>/<model>, such as anthropic/claude-sonnet-4-5")
1634
+ .meta({ description: "The model the agent runs on: <provider>/<model>, such as anthropic/claude-sonnet-4-5" });
1635
+ /** `harness.model` as a session's model choice: the provider before the first `/`, the model after. */
1636
+ export function agentModelChoice(value) {
1637
+ if (value.length > AGENT_MODEL_MAX_CHARS || !AGENT_MODEL_PATTERN.test(value))
1638
+ return undefined;
1639
+ const slash = value.indexOf("/");
1640
+ return { provider: value.slice(0, slash), model: value.slice(slash + 1) };
1641
+ }
1642
+ const harnessModelField = AgentModelSchema.optional();
1621
1643
  /** Fields the harness section refuses with where they went. */
1622
1644
  const REMOVED_HARNESS_FIELDS = Object.freeze({
1623
1645
  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 +1660,7 @@ const agentHarnessObject = z
1638
1660
  outputSchema: definitionJson.optional(),
1639
1661
  loop: harnessLoopField,
1640
1662
  memory: harnessMemoryField,
1663
+ model: harnessModelField,
1641
1664
  functions: z.unknown().optional().meta({ description: "Reserved: Functions are not available yet" }),
1642
1665
  }, { error: removedFieldError(REMOVED_HARNESS_FIELDS) })
1643
1666
  .superRefine((harness, ctx) => {
@@ -1960,6 +1983,7 @@ export const HarnessManifestFileSchema = z
1960
1983
  outputSchema: definitionJson.optional(),
1961
1984
  loop: harnessLoopField,
1962
1985
  memory: harnessMemoryField,
1986
+ model: harnessModelField,
1963
1987
  /** MCP server or HTTP tool name → the `runtime.secrets` slot it authenticates with. */
1964
1988
  credentials: z.record(z.string().min(1), z.string().min(1)).optional(),
1965
1989
  /** What this harness needs of any runtime it is combined with; checked by the composer only. */
@@ -3093,6 +3117,27 @@ export const WakeBookedPayloadSchema = z
3093
3117
  .object({ at: z.string(), note: z.string(), effectId: z.string(), replaced: z.boolean() })
3094
3118
  .passthrough();
3095
3119
  export const WakeCancelledPayloadSchema = z.object({ effectId: z.string() }).passthrough();
3120
+ /** The states of a plan step (`plan.updated`). */
3121
+ export const PLAN_STEP_STATES = ["pending", "active", "done", "blocked", "skipped"];
3122
+ /** The most steps one plan holds, and the most characters (UTF-16 units) of a label and a note. */
3123
+ export const PLAN_LIMITS = Object.freeze({ steps: 20, labelChars: 120, noteChars: 280 });
3124
+ /** One step of an agent's plan: a short label, its state, and an optional note. */
3125
+ export const PlanStepSchema = z
3126
+ .object({
3127
+ label: z.string().min(1).max(PLAN_LIMITS.labelChars),
3128
+ state: z.enum(PLAN_STEP_STATES),
3129
+ note: z.string().max(PLAN_LIMITS.noteChars).optional(),
3130
+ })
3131
+ .passthrough();
3132
+ /**
3133
+ * `plan.updated`: the agent's whole plan, as its last `update_plan` call left it (our engine's
3134
+ * built-in tool, which a version opts into with `harness.loop.plan`), never a diff. Our harness
3135
+ * claims it. Labels and notes are the agent's short text, never tool arguments or results; the A2A
3136
+ * server serves the latest under `progress/v1`.
3137
+ */
3138
+ export const PlanUpdatedPayloadSchema = z
3139
+ .object({ steps: z.array(PlanStepSchema).max(PLAN_LIMITS.steps) })
3140
+ .passthrough();
3096
3141
  /** `queue.taken` (protocol 17): the turn that started with the queued messages, in order. */
3097
3142
  export const QueueTakenPayloadSchema = z
3098
3143
  .object({ turnId: z.string(), queuedMessageIds: z.array(z.string()).min(1) })
@@ -3413,6 +3458,7 @@ export const EVENT_CATALOG = {
3413
3458
  "delegation.started": { payload: DelegationPayloadSchema, source: "loop", version: 1 },
3414
3459
  "delegation.completed": { payload: DelegationPayloadSchema, source: "loop", version: 1 },
3415
3460
  "mcp.discovered": { payload: McpDiscoveredPayloadSchema, source: "loop", version: 1 },
3461
+ "plan.updated": { payload: PlanUpdatedPayloadSchema, source: "loop", version: 1 },
3416
3462
  "environment.state": { payload: EnvironmentStatePayloadSchema, source: "loop", version: 1 },
3417
3463
  "environment.exec": { payload: EnvironmentExecPayloadSchema, source: "loop", version: 1 },
3418
3464
  "agent.attached": { payload: AgentAttachedPayloadSchema, source: "api", version: 1 },
@@ -4871,6 +4917,48 @@ export const ModelCallExportPageSchema = z
4871
4917
  asOf: z.string(),
4872
4918
  })
4873
4919
  .strict();
4920
+ /**
4921
+ * A turn's status in the turn index (Host feature `turns`): `running` from its first
4922
+ * `command.message` and again after an answer, `paused` while it waits for a person, then one of
4923
+ * the three ends.
4924
+ */
4925
+ export const TURN_STATUSES = ["running", "paused", "completed", "failed", "cancelled"];
4926
+ export const TurnStatusSchema = z.enum(TURN_STATUSES);
4927
+ /**
4928
+ * One turn as the turn index keeps it (Host feature `turns`), written in the transaction of the
4929
+ * event that changed it, so it agrees with the session's log. `totals` are the turn's end facts
4930
+ * (null until it ends, or for a turn that ended before the Runtime recorded them); `a2a` names the
4931
+ * A2A context and task when the session is an A2A context.
4932
+ */
4933
+ export const TurnSummarySchema = z
4934
+ .object({
4935
+ turnId: z.string(),
4936
+ sessionId: z.string(),
4937
+ agentId: z.string(),
4938
+ status: TurnStatusSchema,
4939
+ startedAt: z.string(),
4940
+ endedAt: z.string().nullable(),
4941
+ /** When its status last changed (the event's time). */
4942
+ changedAt: z.string(),
4943
+ totals: z
4944
+ .object({
4945
+ steps: z.number().int().nonnegative(),
4946
+ tokens: z.number().int().nonnegative(),
4947
+ costUsd: z.number().nonnegative(),
4948
+ })
4949
+ .strict()
4950
+ .nullable(),
4951
+ a2a: z.object({ contextId: z.string(), taskId: z.string() }).strict().nullable(),
4952
+ })
4953
+ .strict();
4954
+ /**
4955
+ * A page of the turn change feed (`GET /v1/turns`), in the order the turns changed: a turn
4956
+ * appears again each time it changes. Pass `cursor` as `changedAfter` to read on; it is returned
4957
+ * even when `turns` is empty. `hasMore`: another page is ready now.
4958
+ */
4959
+ export const TurnChangesPageSchema = z
4960
+ .object({ turns: z.array(TurnSummarySchema), cursor: z.string(), hasMore: z.boolean() })
4961
+ .strict();
4874
4962
  /**
4875
4963
  * One tool call of a session, read from the effect journal: what ran, with what input,
4876
4964
  * 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.
@@ -9,6 +9,12 @@ import type { ToolDefinition } from "./tool.js";
9
9
  export interface SkillFileSource {
10
10
  readonly size: number;
11
11
  read(): Promise<Uint8Array>;
12
+ /**
13
+ * The bytes as a stream, for a file too large to hold in memory (an org's skill of a gigabyte,
14
+ * ADR-93). When present, the client's upload sends it instead of `read()`'s bytes. Each call
15
+ * opens a new stream.
16
+ */
17
+ stream?(): ReadableStream<Uint8Array>;
12
18
  }
13
19
  /**
14
20
  * @internal What one builder call, skills folder or plugin adds to an agent. The manifest holds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.30.0-beta",
3
+ "version": "0.32.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",