@nylorun/core 0.36.0-beta → 0.38.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,38 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.38.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 1d3a5c5: Queued messages no longer wait for good (Host feature `queue-recovery`). When a turn ends and its
8
+ Agent refuses to start the next one for the session's queued messages (its disk being copied, its
9
+ pod lost, the Agent deleted), the messages wait with the session's `queueStalled`, and the Tenant
10
+ sweep tries the start again (Host tuning `sweep.queueRetryMs`, 30 seconds), as does the end of the
11
+ Agent's disk copy. A message that has waited longer than the new Runtime limit `queuedStartMs`
12
+ (15 minutes) is removed with the new event `queue.failed` (`queue.start_expired`, with the
13
+ refusal's code as `reason`); a refusal no retry changes (a turn request the version no longer
14
+ resolves, another harness) fails the messages at once (`queue.start_refused`), and the messages
15
+ behind them are tried next. Before, nothing started such a queue until another message arrived.
16
+
17
+ On the A2A endpoint (profile v2), a queued task that fails is `TASK_STATE_FAILED` with a status
18
+ message saying why, in `GetTask`, its pushes and a blocking `SendMessage`. `CancelTask` on a queued
19
+ task now takes it out of the queue, whether a task runs in its context or not, and answers
20
+ `TASK_STATE_CANCELED` (the new event `queue.cancelled`), pushed; before, it was
21
+ `TaskNotCancelableError`.
22
+
23
+ ## 0.37.0-beta
24
+
25
+ ### Minor Changes
26
+
27
+ - c649f33: A message can steer a running turn (D85). `delivery: "steer"` on a `message` command, behind the
28
+ optional Host feature `steer`: to a busy agent session it waits in the session queue marked
29
+ `steer`, and our engine takes it into the running turn before its next step, after the tool
30
+ results, through a new effect kind, `inputs`, which core answers in the transaction that journals
31
+ it (Harness API 5, `harness-api/v5.4.json`). Each taken message's `command.message` is written
32
+ under the running turn, then `queue.taken` with the `step`. The queued answer and
33
+ `message.queued` say which delivery applied; a workflow session queues. A steer the turn doesn't
34
+ take starts the next turn like any queued message, and D76's defaults never choose steer.
35
+
3
36
  ## 0.36.0-beta
4
37
 
5
38
  ### Minor Changes
@@ -258,7 +258,24 @@ export declare const OPTIONAL_HOST_FEATURES: readonly ["tenant-fixture-model", "
258
258
  * a tool rule of `kind: "runtime"` decides the operations the Runtime serves; the manifest's
259
259
  * `runtime.limits.triggers`; and `GET /v1/runs/stream`, the Tenant's runs as server-sent events.
260
260
  */
261
- "agent-triggers"];
261
+ "agent-triggers",
262
+ /**
263
+ * A message's `delivery: "steer"` (D85): to a busy agent session it waits in the session queue
264
+ * marked `steer`, and our engine takes it into the running turn before its next step (the
265
+ * `inputs` effect, Harness API 5.4). The answer and `message.queued` say which delivery applied;
266
+ * a steer the turn doesn't take starts the next turn, as a queued message does.
267
+ */
268
+ "steer",
269
+ /**
270
+ * Queued messages never wait for good: when the Agent refuses their turn's start (its disk being
271
+ * copied, its pod lost, the Agent deleted) the start is tried again, at every Tenant sweep and
272
+ * when a disk copy ends, and past the Runtime limit `queuedStartMs` they fail (`queue.failed`);
273
+ * a start no retry can make (a turn request the version no longer resolves, another harness)
274
+ * fails at once. The A2A endpoint's `CancelTask` removes a queued task from its context's
275
+ * queue (`queue.cancelled`), and a failed or cancelled queued task answers, and pushes,
276
+ * `FAILED` or `CANCELED`.
277
+ */
278
+ "queue-recovery"];
262
279
  export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
263
280
  export interface ProtocolRange {
264
281
  min: number;
@@ -281,6 +281,23 @@ export const OPTIONAL_HOST_FEATURES = [
281
281
  * `runtime.limits.triggers`; and `GET /v1/runs/stream`, the Tenant's runs as server-sent events.
282
282
  */
283
283
  "agent-triggers",
284
+ /**
285
+ * A message's `delivery: "steer"` (D85): to a busy agent session it waits in the session queue
286
+ * marked `steer`, and our engine takes it into the running turn before its next step (the
287
+ * `inputs` effect, Harness API 5.4). The answer and `message.queued` say which delivery applied;
288
+ * a steer the turn doesn't take starts the next turn, as a queued message does.
289
+ */
290
+ "steer",
291
+ /**
292
+ * Queued messages never wait for good: when the Agent refuses their turn's start (its disk being
293
+ * copied, its pod lost, the Agent deleted) the start is tried again, at every Tenant sweep and
294
+ * when a disk copy ends, and past the Runtime limit `queuedStartMs` they fail (`queue.failed`);
295
+ * a start no retry can make (a turn request the version no longer resolves, another harness)
296
+ * fails at once. The A2A endpoint's `CancelTask` removes a queued task from its context's
297
+ * queue (`queue.cancelled`), and a failed or cancelled queued task answers, and pushes,
298
+ * `FAILED` or `CANCELED`.
299
+ */
300
+ "queue-recovery",
284
301
  ];
285
302
  /**
286
303
  * What this Host serves: protocol 16, 17 and 18. Protocol 16 replaced agent definitions and
@@ -4201,11 +4201,14 @@ export type CredentialCoverage = z.infer<typeof CredentialCoverageSchema>;
4201
4201
  /**
4202
4202
  * What a message to a busy session does (protocol 17): `queue` waits for the running turn to
4203
4203
  * end and starts the next one; `reject` is refused with `409 session_busy`. A protocol 17 client's
4204
- * default is `queue`, a protocol 16 client's `reject`.
4204
+ * default is `queue`, a protocol 16 client's `reject`. `steer` (Host feature `steer`, D85) joins
4205
+ * the running turn before its next step, when our engine runs it; a workflow session queues it,
4206
+ * and one the turn doesn't take starts the next turn like a queued message.
4205
4207
  */
4206
4208
  export declare const MessageDeliverySchema: z.ZodEnum<{
4207
4209
  queue: "queue";
4208
4210
  reject: "reject";
4211
+ steer: "steer";
4209
4212
  }>;
4210
4213
  export type MessageDelivery = z.infer<typeof MessageDeliverySchema>;
4211
4214
  /**
@@ -4245,6 +4248,7 @@ export declare const MessageEventBodySchema: z.ZodUnion<readonly [z.ZodObject<{
4245
4248
  delivery: z.ZodOptional<z.ZodEnum<{
4246
4249
  queue: "queue";
4247
4250
  reject: "reject";
4251
+ steer: "steer";
4248
4252
  }>>;
4249
4253
  content: z.ZodString;
4250
4254
  }, z.core.$strict>, z.ZodObject<{
@@ -4256,6 +4260,7 @@ export declare const MessageEventBodySchema: z.ZodUnion<readonly [z.ZodObject<{
4256
4260
  delivery: z.ZodOptional<z.ZodEnum<{
4257
4261
  queue: "queue";
4258
4262
  reject: "reject";
4263
+ steer: "steer";
4259
4264
  }>>;
4260
4265
  data: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
4261
4266
  }, z.core.$strict>, z.ZodObject<{
@@ -4267,6 +4272,7 @@ export declare const MessageEventBodySchema: z.ZodUnion<readonly [z.ZodObject<{
4267
4272
  delivery: z.ZodOptional<z.ZodEnum<{
4268
4273
  queue: "queue";
4269
4274
  reject: "reject";
4275
+ steer: "steer";
4270
4276
  }>>;
4271
4277
  parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4272
4278
  type: z.ZodLiteral<"text">;
@@ -4292,6 +4298,7 @@ export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<reado
4292
4298
  delivery: z.ZodOptional<z.ZodEnum<{
4293
4299
  queue: "queue";
4294
4300
  reject: "reject";
4301
+ steer: "steer";
4295
4302
  }>>;
4296
4303
  content: z.ZodString;
4297
4304
  }, z.core.$strict>, z.ZodObject<{
@@ -4303,6 +4310,7 @@ export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<reado
4303
4310
  delivery: z.ZodOptional<z.ZodEnum<{
4304
4311
  queue: "queue";
4305
4312
  reject: "reject";
4313
+ steer: "steer";
4306
4314
  }>>;
4307
4315
  data: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
4308
4316
  }, z.core.$strict>, z.ZodObject<{
@@ -4314,6 +4322,7 @@ export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<reado
4314
4322
  delivery: z.ZodOptional<z.ZodEnum<{
4315
4323
  queue: "queue";
4316
4324
  reject: "reject";
4325
+ steer: "steer";
4317
4326
  }>>;
4318
4327
  parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4319
4328
  type: z.ZodLiteral<"text">;
@@ -4350,6 +4359,7 @@ export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<rea
4350
4359
  delivery: z.ZodOptional<z.ZodEnum<{
4351
4360
  queue: "queue";
4352
4361
  reject: "reject";
4362
+ steer: "steer";
4353
4363
  }>>;
4354
4364
  content: z.ZodString;
4355
4365
  }, z.core.$strict>, z.ZodObject<{
@@ -4361,6 +4371,7 @@ export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<rea
4361
4371
  delivery: z.ZodOptional<z.ZodEnum<{
4362
4372
  queue: "queue";
4363
4373
  reject: "reject";
4374
+ steer: "steer";
4364
4375
  }>>;
4365
4376
  data: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
4366
4377
  }, z.core.$strict>, z.ZodObject<{
@@ -4372,6 +4383,7 @@ export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<rea
4372
4383
  delivery: z.ZodOptional<z.ZodEnum<{
4373
4384
  queue: "queue";
4374
4385
  reject: "reject";
4386
+ steer: "steer";
4375
4387
  }>>;
4376
4388
  parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4377
4389
  type: z.ZodLiteral<"text">;
@@ -4631,12 +4643,18 @@ export declare const AcceptedResponseSchema: z.ZodObject<{
4631
4643
  export type AcceptedResponse = z.infer<typeof AcceptedResponseSchema>;
4632
4644
  /**
4633
4645
  * A message the session queued because a turn runs or waits (protocol 17): it starts the next
4634
- * turn when this one ends. `position` counts from 1, the first to go.
4646
+ * turn when this one ends. `position` counts from 1, the first to go. `delivery` is what applied
4647
+ * (D85): `steer` when the running turn takes it before a step, `queue` otherwise; a Host without
4648
+ * the feature `steer` leaves it out.
4635
4649
  */
4636
4650
  export declare const QueuedResponseSchema: z.ZodObject<{
4637
4651
  status: z.ZodLiteral<"queued">;
4638
4652
  queuedMessageId: z.ZodString;
4639
4653
  position: z.ZodNumber;
4654
+ delivery: z.ZodOptional<z.ZodEnum<{
4655
+ queue: "queue";
4656
+ steer: "steer";
4657
+ }>>;
4640
4658
  cursor: z.ZodNullable<z.ZodString>;
4641
4659
  requestId: z.ZodString;
4642
4660
  }, z.core.$strip>;
@@ -4651,6 +4669,10 @@ export declare const CommandResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
4651
4669
  status: z.ZodLiteral<"queued">;
4652
4670
  queuedMessageId: z.ZodString;
4653
4671
  position: z.ZodNumber;
4672
+ delivery: z.ZodOptional<z.ZodEnum<{
4673
+ queue: "queue";
4674
+ steer: "steer";
4675
+ }>>;
4654
4676
  cursor: z.ZodNullable<z.ZodString>;
4655
4677
  requestId: z.ZodString;
4656
4678
  }, z.core.$strip>]>;
@@ -4994,12 +5016,16 @@ export declare const TurnCancelledPayloadSchema: z.ZodObject<{
4994
5016
  /**
4995
5017
  * `message.queued` (protocol 17): a message arrived while the session's turn ran or waited, and
4996
5018
  * waits in its queue. `position` counts from 1; the message's `command.message` is written when
4997
- * a turn takes it.
5019
+ * a turn takes it. `delivery` (D85) says whether the running turn may take it before a step.
4998
5020
  */
4999
5021
  export declare const MessageQueuedPayloadSchema: z.ZodObject<{
5000
5022
  queuedMessageId: z.ZodString;
5001
5023
  position: z.ZodNumber;
5002
5024
  requestId: z.ZodString;
5025
+ delivery: z.ZodOptional<z.ZodEnum<{
5026
+ queue: "queue";
5027
+ steer: "steer";
5028
+ }>>;
5003
5029
  }, z.core.$loose>;
5004
5030
  /**
5005
5031
  * `wake.booked`: the session's agent booked its next turn with `schedule_wake`,
@@ -5055,10 +5081,33 @@ export declare const PlanUpdatedPayloadSchema: z.ZodObject<{
5055
5081
  note: z.ZodOptional<z.ZodString>;
5056
5082
  }, z.core.$loose>>;
5057
5083
  }, z.core.$loose>;
5058
- /** `queue.taken` (protocol 17): the turn that started with the queued messages, in order. */
5084
+ /**
5085
+ * `queue.taken` (protocol 17): the turn that started with the queued messages, in order. With
5086
+ * `step` (D85), the running turn took steered messages before that step instead.
5087
+ */
5059
5088
  export declare const QueueTakenPayloadSchema: z.ZodObject<{
5060
5089
  turnId: z.ZodString;
5061
5090
  queuedMessageIds: z.ZodArray<z.ZodString>;
5091
+ step: z.ZodOptional<z.ZodNumber>;
5092
+ }, z.core.$loose>;
5093
+ /**
5094
+ * `queue.failed` (Host feature `queue-recovery`): queued messages no turn will take. The Agent
5095
+ * refused their turn's start for longer than the Runtime limit `queuedStartMs`, or in a way no
5096
+ * retry changes; `error.code` says which (`queue.start_expired`, `queue.start_refused`) and
5097
+ * `error.reason` is the refusal's own code. `queue.cancelled`: a client removed them (A2A
5098
+ * `CancelTask`). Neither has a turn.
5099
+ */
5100
+ export declare const QueueFailedPayloadSchema: z.ZodObject<{
5101
+ queuedMessageIds: z.ZodArray<z.ZodString>;
5102
+ error: z.ZodObject<{
5103
+ code: z.ZodString;
5104
+ message: z.ZodString;
5105
+ reason: z.ZodOptional<z.ZodString>;
5106
+ }, z.core.$loose>;
5107
+ }, z.core.$loose>;
5108
+ export declare const QueueCancelledPayloadSchema: z.ZodObject<{
5109
+ queuedMessageIds: z.ZodArray<z.ZodString>;
5110
+ reason: z.ZodOptional<z.ZodString>;
5062
5111
  }, z.core.$loose>;
5063
5112
  /** Lifecycle of an agent used as a tool. `agent.delegationId` is the parent call's invocation. */
5064
5113
  export declare const DelegationPayloadSchema: z.ZodObject<{
@@ -5313,6 +5362,7 @@ export declare const CommandMessagePayloadSchema: z.ZodObject<{
5313
5362
  delivery: z.ZodOptional<z.ZodEnum<{
5314
5363
  queue: "queue";
5315
5364
  reject: "reject";
5365
+ steer: "steer";
5316
5366
  }>>;
5317
5367
  queuedMessageId: z.ZodOptional<z.ZodString>;
5318
5368
  cause: z.ZodOptional<z.ZodObject<{
@@ -5731,6 +5781,7 @@ export declare const EVENT_CATALOG: {
5731
5781
  delivery: z.ZodOptional<z.ZodEnum<{
5732
5782
  queue: "queue";
5733
5783
  reject: "reject";
5784
+ steer: "steer";
5734
5785
  }>>;
5735
5786
  queuedMessageId: z.ZodOptional<z.ZodString>;
5736
5787
  cause: z.ZodOptional<z.ZodObject<{
@@ -5918,6 +5969,10 @@ export declare const EVENT_CATALOG: {
5918
5969
  queuedMessageId: z.ZodString;
5919
5970
  position: z.ZodNumber;
5920
5971
  requestId: z.ZodString;
5972
+ delivery: z.ZodOptional<z.ZodEnum<{
5973
+ queue: "queue";
5974
+ steer: "steer";
5975
+ }>>;
5921
5976
  }, z.core.$loose>;
5922
5977
  readonly source: "api";
5923
5978
  readonly version: 1;
@@ -5926,6 +5981,27 @@ export declare const EVENT_CATALOG: {
5926
5981
  readonly payload: z.ZodObject<{
5927
5982
  turnId: z.ZodString;
5928
5983
  queuedMessageIds: z.ZodArray<z.ZodString>;
5984
+ step: z.ZodOptional<z.ZodNumber>;
5985
+ }, z.core.$loose>;
5986
+ readonly source: "api";
5987
+ readonly version: 1;
5988
+ };
5989
+ readonly "queue.failed": {
5990
+ readonly payload: z.ZodObject<{
5991
+ queuedMessageIds: z.ZodArray<z.ZodString>;
5992
+ error: z.ZodObject<{
5993
+ code: z.ZodString;
5994
+ message: z.ZodString;
5995
+ reason: z.ZodOptional<z.ZodString>;
5996
+ }, z.core.$loose>;
5997
+ }, z.core.$loose>;
5998
+ readonly source: "api";
5999
+ readonly version: 1;
6000
+ };
6001
+ readonly "queue.cancelled": {
6002
+ readonly payload: z.ZodObject<{
6003
+ queuedMessageIds: z.ZodArray<z.ZodString>;
6004
+ reason: z.ZodOptional<z.ZodString>;
5929
6005
  }, z.core.$loose>;
5930
6006
  readonly source: "api";
5931
6007
  readonly version: 1;
@@ -6417,7 +6493,7 @@ type EventSchemaOf<T extends EventType> = z.ZodObject<typeof eventEnvelope & {
6417
6493
  /** One schema per event type, keyed by type (the OpenAPI components). */
6418
6494
  export declare const EVENT_SCHEMAS: { [T in EventType]: EventSchemaOf<T>; };
6419
6495
  /** A session event of a known type, discriminated on `type`. */
6420
- 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" | "engine.diagnostic" | "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" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "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" | "engine.diagnostic" | "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" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "wake.booked" | "wake.cancelled">[]], "type">;
6496
+ 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" | "engine.diagnostic" | "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.cancelled" | "queue.failed" | "queue.taken" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "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" | "engine.diagnostic" | "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.cancelled" | "queue.failed" | "queue.taken" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "wake.booked" | "wake.cancelled">[]], "type">;
6421
6497
  export type SessionEvent = {
6422
6498
  [T in EventType]: z.infer<EventSchemaOf<T>>;
6423
6499
  }[EventType];
@@ -6432,7 +6508,7 @@ export type SessionEventOf<T extends EventType> = Extract<SessionEvent, {
6432
6508
  */
6433
6509
  export declare function parseSessionEvent(value: unknown): SessionEvent | LiveEvent;
6434
6510
  export declare const SessionItemsResponseSchema: z.ZodObject<{
6435
- 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" | "engine.diagnostic" | "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" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "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" | "engine.diagnostic" | "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" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "wake.booked" | "wake.cancelled">[]], "type">>;
6511
+ 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" | "engine.diagnostic" | "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.cancelled" | "queue.failed" | "queue.taken" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "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" | "engine.diagnostic" | "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.cancelled" | "queue.failed" | "queue.taken" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "wake.booked" | "wake.cancelled">[]], "type">>;
6436
6512
  cursor: z.ZodNullable<z.ZodString>;
6437
6513
  }, z.core.$strip>;
6438
6514
  export type SessionItemsResponse = {
@@ -8523,6 +8599,7 @@ export declare const TenantLimitsConfigSchema: z.ZodObject<{
8523
8599
  memoryIndexLines: z.ZodOptional<z.ZodNumber>;
8524
8600
  memoryIndexBytes: z.ZodOptional<z.ZodNumber>;
8525
8601
  sessionQueuedMessages: z.ZodOptional<z.ZodNumber>;
8602
+ queuedStartMs: z.ZodOptional<z.ZodNumber>;
8526
8603
  flowConcurrency: z.ZodOptional<z.ZodNumber>;
8527
8604
  flowMapItems: z.ZodOptional<z.ZodNumber>;
8528
8605
  flowLoopIterations: z.ZodOptional<z.ZodNumber>;
@@ -8602,6 +8679,7 @@ export declare const PutTenantLimitsRequestSchema: z.ZodObject<{
8602
8679
  memoryIndexLines: z.ZodOptional<z.ZodNumber>;
8603
8680
  memoryIndexBytes: z.ZodOptional<z.ZodNumber>;
8604
8681
  sessionQueuedMessages: z.ZodOptional<z.ZodNumber>;
8682
+ queuedStartMs: z.ZodOptional<z.ZodNumber>;
8605
8683
  flowConcurrency: z.ZodOptional<z.ZodNumber>;
8606
8684
  flowMapItems: z.ZodOptional<z.ZodNumber>;
8607
8685
  flowLoopIterations: z.ZodOptional<z.ZodNumber>;
@@ -8682,6 +8760,7 @@ export declare const TenantLimitsViewSchema: z.ZodObject<{
8682
8760
  memoryIndexLines: z.ZodNumber;
8683
8761
  memoryIndexBytes: z.ZodNumber;
8684
8762
  sessionQueuedMessages: z.ZodNumber;
8763
+ queuedStartMs: z.ZodNumber;
8685
8764
  flowConcurrency: z.ZodNumber;
8686
8765
  flowMapItems: z.ZodNumber;
8687
8766
  flowLoopIterations: z.ZodNumber;
@@ -8749,7 +8828,7 @@ export declare const SessionManifestViewSchema: z.ZodObject<{
8749
8828
  }, z.core.$strict>;
8750
8829
  export type SessionManifestView = z.infer<typeof SessionManifestViewSchema>;
8751
8830
  export declare const HistoryPageSchema: z.ZodObject<{
8752
- 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" | "engine.diagnostic" | "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" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "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" | "engine.diagnostic" | "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" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "wake.booked" | "wake.cancelled">[]], "type">>;
8831
+ 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" | "engine.diagnostic" | "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.cancelled" | "queue.failed" | "queue.taken" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "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" | "engine.diagnostic" | "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.cancelled" | "queue.failed" | "queue.taken" | "session.model" | "tool.completed" | "transcript.updated" | "turn.cancelled" | "turn.completed" | "turn.failed" | "turn.paused" | "turn.version_kept" | "wake.booked" | "wake.cancelled">[]], "type">>;
8753
8832
  cursor: z.ZodNullable<z.ZodString>;
8754
8833
  tail: z.ZodBoolean;
8755
8834
  }, z.core.$strip>;
package/dist/contracts.js CHANGED
@@ -2889,9 +2889,11 @@ const commandBase = {
2889
2889
  /**
2890
2890
  * What a message to a busy session does (protocol 17): `queue` waits for the running turn to
2891
2891
  * end and starts the next one; `reject` is refused with `409 session_busy`. A protocol 17 client's
2892
- * default is `queue`, a protocol 16 client's `reject`.
2892
+ * default is `queue`, a protocol 16 client's `reject`. `steer` (Host feature `steer`, D85) joins
2893
+ * the running turn before its next step, when our engine runs it; a workflow session queues it,
2894
+ * and one the turn doesn't take starts the next turn like a queued message.
2893
2895
  */
2894
- export const MessageDeliverySchema = z.enum(["queue", "reject"]);
2896
+ export const MessageDeliverySchema = z.enum(["queue", "reject", "steer"]);
2895
2897
  /**
2896
2898
  * A message's `removeTools` (Host feature `remove-tools`): the tools its turn may not use, by
2897
2899
  * name. In the root agent and each agent it uses as a tool, a name removes the declared tool of
@@ -3092,12 +3094,15 @@ export const AcceptedResponseSchema = z.object({
3092
3094
  });
3093
3095
  /**
3094
3096
  * A message the session queued because a turn runs or waits (protocol 17): it starts the next
3095
- * turn when this one ends. `position` counts from 1, the first to go.
3097
+ * turn when this one ends. `position` counts from 1, the first to go. `delivery` is what applied
3098
+ * (D85): `steer` when the running turn takes it before a step, `queue` otherwise; a Host without
3099
+ * the feature `steer` leaves it out.
3096
3100
  */
3097
3101
  export const QueuedResponseSchema = z.object({
3098
3102
  status: z.literal("queued"),
3099
3103
  queuedMessageId: z.string(),
3100
3104
  position: z.number().int().positive(),
3105
+ delivery: z.enum(["queue", "steer"]).optional(),
3101
3106
  cursor: z.string().nullable(),
3102
3107
  requestId: z.string(),
3103
3108
  });
@@ -3384,10 +3389,15 @@ export const TurnCancelledPayloadSchema = z
3384
3389
  /**
3385
3390
  * `message.queued` (protocol 17): a message arrived while the session's turn ran or waited, and
3386
3391
  * waits in its queue. `position` counts from 1; the message's `command.message` is written when
3387
- * a turn takes it.
3392
+ * a turn takes it. `delivery` (D85) says whether the running turn may take it before a step.
3388
3393
  */
3389
3394
  export const MessageQueuedPayloadSchema = z
3390
- .object({ queuedMessageId: z.string(), position: z.number().int().positive(), requestId: z.string() })
3395
+ .object({
3396
+ queuedMessageId: z.string(),
3397
+ position: z.number().int().positive(),
3398
+ requestId: z.string(),
3399
+ delivery: z.enum(["queue", "steer"]).optional(),
3400
+ })
3391
3401
  .passthrough();
3392
3402
  /**
3393
3403
  * `wake.booked`: the session's agent booked its next turn with `schedule_wake`,
@@ -3418,9 +3428,34 @@ export const PlanStepSchema = z
3418
3428
  export const PlanUpdatedPayloadSchema = z
3419
3429
  .object({ steps: z.array(PlanStepSchema).max(PLAN_LIMITS.steps) })
3420
3430
  .passthrough();
3421
- /** `queue.taken` (protocol 17): the turn that started with the queued messages, in order. */
3431
+ /**
3432
+ * `queue.taken` (protocol 17): the turn that started with the queued messages, in order. With
3433
+ * `step` (D85), the running turn took steered messages before that step instead.
3434
+ */
3422
3435
  export const QueueTakenPayloadSchema = z
3423
- .object({ turnId: z.string(), queuedMessageIds: z.array(z.string()).min(1) })
3436
+ .object({
3437
+ turnId: z.string(),
3438
+ queuedMessageIds: z.array(z.string()).min(1),
3439
+ step: z.number().int().positive().optional(),
3440
+ })
3441
+ .passthrough();
3442
+ /**
3443
+ * `queue.failed` (Host feature `queue-recovery`): queued messages no turn will take. The Agent
3444
+ * refused their turn's start for longer than the Runtime limit `queuedStartMs`, or in a way no
3445
+ * retry changes; `error.code` says which (`queue.start_expired`, `queue.start_refused`) and
3446
+ * `error.reason` is the refusal's own code. `queue.cancelled`: a client removed them (A2A
3447
+ * `CancelTask`). Neither has a turn.
3448
+ */
3449
+ export const QueueFailedPayloadSchema = z
3450
+ .object({
3451
+ queuedMessageIds: z.array(z.string()).min(1),
3452
+ error: z
3453
+ .object({ code: z.string(), message: z.string(), reason: z.string().optional() })
3454
+ .passthrough(),
3455
+ })
3456
+ .passthrough();
3457
+ export const QueueCancelledPayloadSchema = z
3458
+ .object({ queuedMessageIds: z.array(z.string()).min(1), reason: z.string().optional() })
3424
3459
  .passthrough();
3425
3460
  /** Lifecycle of an agent used as a tool. `agent.delegationId` is the parent call's invocation. */
3426
3461
  export const DelegationPayloadSchema = z
@@ -3801,6 +3836,8 @@ export const EVENT_CATALOG = {
3801
3836
  "session.model": { payload: SessionModelPayloadSchema, source: "api", version: 1 },
3802
3837
  "message.queued": { payload: MessageQueuedPayloadSchema, source: "api", version: 1 },
3803
3838
  "queue.taken": { payload: QueueTakenPayloadSchema, source: "api", version: 1 },
3839
+ "queue.failed": { payload: QueueFailedPayloadSchema, source: "api", version: 1 },
3840
+ "queue.cancelled": { payload: QueueCancelledPayloadSchema, source: "api", version: 1 },
3804
3841
  "wake.booked": { payload: WakeBookedPayloadSchema, source: "api", version: 1 },
3805
3842
  "wake.cancelled": { payload: WakeCancelledPayloadSchema, source: "api", version: 1 },
3806
3843
  "memory.updated": { payload: MemoryUpdatedPayloadSchema, source: "api", version: 1 },
@@ -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.3.json",
3
+ "$id": "https://docs.nylorun.com/schemas/harness-api/v5.4.json",
4
4
  "title": "Nylorun Harness API 5",
5
5
  "$defs": {
6
6
  "ArtifactMeta": {
@@ -86,7 +86,8 @@
86
86
  "model",
87
87
  "tool",
88
88
  "delegation",
89
- "agent"
89
+ "agent",
90
+ "inputs"
90
91
  ]
91
92
  },
92
93
  "agent": {
@@ -3921,7 +3922,8 @@
3921
3922
  "model",
3922
3923
  "tool",
3923
3924
  "delegation",
3924
- "agent"
3925
+ "agent",
3926
+ "inputs"
3925
3927
  ]
3926
3928
  },
3927
3929
  "agent": {
@@ -55,9 +55,11 @@ export function harnessApiSchemas() {
55
55
  * `turn.start.memory.index` absent for a version that pins none (ADR-100), and
56
56
  * `turn.start.memory.refresh` (an optional field a v5 harness may ignore, keeping the index it
57
57
  * pinned). Revision 3: `turn.start.agent.triggers` and the `runtime` operation `triggers` (D83),
58
- * which a v5 harness that offers no `triggers` tool never sees.
58
+ * which a v5 harness that offers no `triggers` tool never sees. Revision 4: the effect kind `inputs`
59
+ (D85): the messages steered into the running turn, which core answers at once and a v5 harness
60
+ that never asks for it never sees.
59
61
  */
60
- const SCHEMA_REVISION = 3;
62
+ const SCHEMA_REVISION = 4;
61
63
  /** The JSON Schema document of the Harness API (draft 2020-12). */
62
64
  export function harnessApiJsonSchema() {
63
65
  const $defs = {};
@@ -131,6 +131,11 @@ export declare const EffectTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
131
131
  * A model effect that writes a compaction's summary says so (`purpose: "summary"`): it is no
132
132
  * assistant message, and the compaction edit that follows names it (`CompactionFactsSchema`).
133
133
  *
134
+ * An `inputs` effect (D85, revision 4) asks core for the messages steered into the running turn
135
+ * (`delivery: "steer"`), before a step: core takes them in the transaction that journals the
136
+ * effect and answers `{value: {events}}` at once, the messages' input events in order (none when
137
+ * nothing waits). The journal keeps the answer, so a replay takes the same messages at that step.
138
+ *
134
139
  * An agent's tool effect names its `target` (what runs it: for an MCP or HTTP tool, its
135
140
  * identity) beside the name the model used (`toolName`, for display), and may name the `skill` it
136
141
  * ran (a skill tool's skill, or a sandbox call in a skill's folder): the record keeps the skill,
@@ -154,6 +159,7 @@ export declare const EffectIntentSchema: z.ZodObject<{
154
159
  kind: z.ZodEnum<{
155
160
  agent: "agent";
156
161
  delegation: "delegation";
162
+ inputs: "inputs";
157
163
  model: "model";
158
164
  tool: "tool";
159
165
  }>;
@@ -823,6 +829,7 @@ export declare const harnessRequests: {
823
829
  kind: z.ZodEnum<{
824
830
  agent: "agent";
825
831
  delegation: "delegation";
832
+ inputs: "inputs";
826
833
  model: "model";
827
834
  tool: "tool";
828
835
  }>;
@@ -101,6 +101,11 @@ export const EffectTargetSchema = z.discriminatedUnion("kind", [
101
101
  * A model effect that writes a compaction's summary says so (`purpose: "summary"`): it is no
102
102
  * assistant message, and the compaction edit that follows names it (`CompactionFactsSchema`).
103
103
  *
104
+ * An `inputs` effect (D85, revision 4) asks core for the messages steered into the running turn
105
+ * (`delivery: "steer"`), before a step: core takes them in the transaction that journals the
106
+ * effect and answers `{value: {events}}` at once, the messages' input events in order (none when
107
+ * nothing waits). The journal keeps the answer, so a replay takes the same messages at that step.
108
+ *
104
109
  * An agent's tool effect names its `target` (what runs it: for an MCP or HTTP tool, its
105
110
  * identity) beside the name the model used (`toolName`, for display), and may name the `skill` it
106
111
  * ran (a skill tool's skill, or a sandbox call in a skill's folder): the record keeps the skill,
@@ -122,7 +127,7 @@ export const EffectIntentSchema = z
122
127
  turnId: id,
123
128
  agentId: id,
124
129
  manifestHash: z.string(),
125
- kind: z.enum(["model", "tool", "delegation", "agent"]),
130
+ kind: z.enum(["model", "tool", "delegation", "agent", "inputs"]),
126
131
  agent: z.object({ id: z.string(), path: z.string(), delegationId: z.string().optional() }).strict().optional(),
127
132
  toolName: z.string().optional(),
128
133
  target: EffectTargetSchema.optional(),
@@ -132,6 +132,9 @@ export declare const LINUX_ARG_MAX_BYTES: number;
132
132
  * Sessions:
133
133
  * - `sessionQueuedMessages`: the most messages one session's queue holds while its turn runs or
134
134
  * waits (protocol 17); one more is `429 queue_full`.
135
+ * - `queuedStartMs`: how long queued messages wait for their Agent once no turn holds them and the
136
+ * Agent refused their turn's start (its disk being copied, its pod lost, the Agent deleted); the
137
+ * start is tried again meanwhile, and after it they fail (`queue.failed`).
135
138
  *
136
139
  * Flows (`workflows.md` §13):
137
140
  * - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
@@ -211,6 +214,7 @@ export declare const RuntimeLimitsSchema: z.ZodObject<{
211
214
  memoryIndexLines: z.ZodNumber;
212
215
  memoryIndexBytes: z.ZodNumber;
213
216
  sessionQueuedMessages: z.ZodNumber;
217
+ queuedStartMs: z.ZodNumber;
214
218
  flowConcurrency: z.ZodNumber;
215
219
  flowMapItems: z.ZodNumber;
216
220
  flowLoopIterations: z.ZodNumber;
@@ -175,6 +175,9 @@ const harnessLimits = {
175
175
  * Sessions:
176
176
  * - `sessionQueuedMessages`: the most messages one session's queue holds while its turn runs or
177
177
  * waits (protocol 17); one more is `429 queue_full`.
178
+ * - `queuedStartMs`: how long queued messages wait for their Agent once no turn holds them and the
179
+ * Agent refused their turn's start (its disk being copied, its pod lost, the Agent deleted); the
180
+ * start is tried again meanwhile, and after it they fail (`queue.failed`).
178
181
  *
179
182
  * Flows (`workflows.md` §13):
180
183
  * - `flowConcurrency`: the most effects one flow turn runs at once; the rest wait their turn.
@@ -249,6 +252,7 @@ export const RuntimeLimitsSchema = z
249
252
  memoryIndexLines: z.number().int().positive(),
250
253
  memoryIndexBytes: z.number().int().positive(),
251
254
  sessionQueuedMessages: z.number().int().positive(),
255
+ queuedStartMs: z.number().int().positive(),
252
256
  flowConcurrency: z.number().int().positive(),
253
257
  flowMapItems: z.number().int().positive(),
254
258
  flowLoopIterations: z.number().int().positive(),
@@ -454,6 +458,7 @@ export const RUNTIME_LIMIT_CEILINGS = {
454
458
  why: `the payload goes into one record entry, which holds at most ${recordEntryCeiling} bytes`,
455
459
  },
456
460
  sessionQueuedMessages: counted("entries", "queued messages are counted"),
461
+ queuedStartMs: counted("milliseconds", "the deadline is reckoned from the clock"),
457
462
  flowConcurrency: counted("effects", "running effects are counted"),
458
463
  flowMapItems: counted("entries", "items are counted"),
459
464
  flowLoopIterations: counted("iterations", "iterations are counted"),
@@ -539,6 +544,7 @@ export const RUNTIME_LIMIT_DEFAULTS = Object.freeze({
539
544
  memoryIndexLines: 200,
540
545
  memoryIndexBytes: 25 * 1024,
541
546
  sessionQueuedMessages: 100,
547
+ queuedStartMs: 15 * 60_000,
542
548
  flowConcurrency: 8,
543
549
  flowMapItems: 1_000,
544
550
  flowLoopIterations: 100,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/core",
3
- "version": "0.36.0-beta",
3
+ "version": "0.38.0-beta",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Shared agent definitions and wire contracts",