@nylorun/core 0.35.0-beta → 0.37.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/compatibility.d.ts +8 -1
  3. package/dist/compatibility.js +7 -0
  4. package/dist/contracts.d.ts +82 -4
  5. package/dist/contracts.js +42 -9
  6. package/dist/definition/variant.js +8 -1
  7. package/dist/engine/explain.js +22 -5
  8. package/dist/engine/index.d.ts +1 -0
  9. package/dist/engine/index.js +1 -0
  10. package/dist/engine/preview.d.ts +1 -0
  11. package/dist/engine/preview.js +2 -1
  12. package/dist/engine/projection.d.ts +3 -1
  13. package/dist/engine/projection.js +97 -2
  14. package/dist/engine/tools.d.ts +22 -0
  15. package/dist/engine/tools.js +36 -0
  16. package/dist/folder/compile.d.ts +2 -2
  17. package/dist/folder/compile.js +79 -12
  18. package/dist/folder/engine.d.ts +9 -0
  19. package/dist/folder/engine.js +1 -1
  20. package/dist/folder/index.d.ts +2 -0
  21. package/dist/folder/index.js +2 -0
  22. package/dist/folder/migrate-v3.d.ts +20 -0
  23. package/dist/folder/migrate-v3.js +124 -0
  24. package/dist/folder/schemas.js +12 -4
  25. package/dist/folder/v3.d.ts +66 -0
  26. package/dist/folder/v3.js +139 -0
  27. package/dist/harness-api/harness-api.schema.json +5 -3
  28. package/dist/harness-api/json-schema.js +4 -2
  29. package/dist/harness-api/schema.d.ts +7 -0
  30. package/dist/harness-api/schema.js +6 -1
  31. package/dist/manifest-schemas.js +4 -3
  32. package/dist/plugins/bundle.generated.d.ts +120 -0
  33. package/dist/plugins/bundle.generated.js +143 -0
  34. package/dist/plugins/index.d.ts +65 -0
  35. package/dist/plugins/index.js +62 -0
  36. package/dist/schemas/agent-folder/agent-md.schema.json +20 -3
  37. package/dist/schemas/agent-manifest.schema.json +45 -1
  38. package/dist/schemas/harness-manifest.schema.json +45 -1
  39. package/dist/types/manifest.d.ts +12 -0
  40. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.37.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - c649f33: A message can steer a running turn (D85). `delivery: "steer"` on a `message` command, behind the
8
+ optional Host feature `steer`: to a busy agent session it waits in the session queue marked
9
+ `steer`, and our engine takes it into the running turn before its next step, after the tool
10
+ results, through a new effect kind, `inputs`, which core answers in the transaction that journals
11
+ it (Harness API 5, `harness-api/v5.4.json`). Each taken message's `command.message` is written
12
+ under the running turn, then `queue.taken` with the `step`. The queued answer and
13
+ `message.queued` say which delivery applied; a workflow session queues. A steer the turn doesn't
14
+ take starts the next turn like any queued message, and D76's defaults never choose steer.
15
+
16
+ ## 0.36.0-beta
17
+
18
+ ### Minor Changes
19
+
20
+ - 2afa44d: The Runtime's primitives as its own Agent Plugins (ADR-106, D84). An `agent-folder/3` folder lists them under `plugins:` (`nylorun-memory`, `nylorun-triggers`, `nylorun-plan`, `nylorun-interactions`, `nylorun-artifacts`, `nylorun-sandbox`, which needs a computer), with no versions, and turns one of their tools off with `mcpServers.nylorun.tools.<tool>.enabled: false`. The compiler reads them as the `agent-folder/2` declarations they stand for (`memory`, `loop`, `engine.sandbox`, `engine.artifacts`, `engine.triggers`, which v3 refuses) and records them in `harness.engine.plugins`, each with its tools and the hash of its files. The engine presents their tools as the reserved server `nylorun`: the model reads `nylorun__memory` and the declared plugins' words as one text, with their skills (`memory`, `triggers`) in the catalog, served from the bundle; every effect keeps its target and `toolName`, so the record, tool policy (`kind: "runtime"` rules) and dispatch are unchanged. New: `ask` (`nylorun-interactions`, `harness.loop.ask`), a question that pauses the turn as an A2A `question`; `removeTools` takes `nylorun__<tool>`; `triggers` answers carry `now`; under `nylorun-triggers`, an agent-made trigger's run starts with a `[trigger <id> · <title> · nobody is watching]` line, and a turn a trigger started may set a one-off follow-up (`in` or `at`, `session: "this"`); the sandbox's instructions name the hosts `runtime.json` allows. `nylorun migrate folder <dir> --to 3` writes the plugins that keep an agent's tools and features, and `nylorun check --explain` names the plugin behind each. The JSON Schemas are republished as `agent-manifest/v8.4`, `harness-manifest/v1.4` and `agent-folder/v1/agent-md.4`.
21
+
3
22
  ## 0.35.0-beta
4
23
 
5
24
  ### Minor Changes
@@ -258,7 +258,14 @@ 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"];
262
269
  export type OptionalHostFeature = (typeof OPTIONAL_HOST_FEATURES)[number];
263
270
  export interface ProtocolRange {
264
271
  min: number;
@@ -281,6 +281,13 @@ 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",
284
291
  ];
285
292
  /**
286
293
  * What this Host serves: protocol 16, 17 and 18. Protocol 16 replaced agent definitions and
@@ -96,6 +96,19 @@ export declare const HarnessEngineSchema: z.ZodObject<{
96
96
  sha256: z.ZodString;
97
97
  source: z.ZodOptional<z.ZodString>;
98
98
  }, z.core.$strict>>>;
99
+ plugins: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
+ name: z.ZodEnum<{
101
+ "nylorun-artifacts": "nylorun-artifacts";
102
+ "nylorun-interactions": "nylorun-interactions";
103
+ "nylorun-memory": "nylorun-memory";
104
+ "nylorun-plan": "nylorun-plan";
105
+ "nylorun-sandbox": "nylorun-sandbox";
106
+ "nylorun-triggers": "nylorun-triggers";
107
+ }>;
108
+ tools: z.ZodArray<z.ZodString>;
109
+ sha256: z.ZodString;
110
+ hosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
+ }, z.core.$strict>>>;
99
112
  }, z.core.$strict>;
100
113
  /**
101
114
  * An agent's manifest (manifest v7). Its output is checked against `AgentManifest` here and below
@@ -1489,6 +1502,7 @@ export declare const TriggerToolOutputSchema: z.ZodUnion<readonly [z.ZodObject<{
1489
1502
  }>;
1490
1503
  nextRunAt: z.ZodNullable<z.ZodString>;
1491
1504
  session: z.ZodString;
1505
+ now: z.ZodOptional<z.ZodString>;
1492
1506
  }, z.core.$strict>, z.ZodObject<{
1493
1507
  triggers: z.ZodArray<z.ZodObject<{
1494
1508
  id: z.ZodString;
@@ -1505,6 +1519,7 @@ export declare const TriggerToolOutputSchema: z.ZodUnion<readonly [z.ZodObject<{
1505
1519
  nextRunAt: z.ZodNullable<z.ZodString>;
1506
1520
  prompt: z.ZodString;
1507
1521
  }, z.core.$strict>>;
1522
+ now: z.ZodOptional<z.ZodString>;
1508
1523
  }, z.core.$strict>, z.ZodObject<{
1509
1524
  id: z.ZodString;
1510
1525
  deleted: z.ZodLiteral<true>;
@@ -2166,6 +2181,19 @@ export declare const HarnessManifestFileSchema: z.ZodObject<{
2166
2181
  sha256: z.ZodString;
2167
2182
  source: z.ZodOptional<z.ZodString>;
2168
2183
  }, z.core.$strict>>>;
2184
+ plugins: z.ZodOptional<z.ZodArray<z.ZodObject<{
2185
+ name: z.ZodEnum<{
2186
+ "nylorun-artifacts": "nylorun-artifacts";
2187
+ "nylorun-interactions": "nylorun-interactions";
2188
+ "nylorun-memory": "nylorun-memory";
2189
+ "nylorun-plan": "nylorun-plan";
2190
+ "nylorun-sandbox": "nylorun-sandbox";
2191
+ "nylorun-triggers": "nylorun-triggers";
2192
+ }>;
2193
+ tools: z.ZodArray<z.ZodString>;
2194
+ sha256: z.ZodString;
2195
+ hosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
2196
+ }, z.core.$strict>>>;
2169
2197
  }, z.core.$strict>>;
2170
2198
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2171
2199
  requires: z.ZodOptional<z.ZodObject<{
@@ -2433,6 +2461,19 @@ export declare const AgentManifestFileSchema: z.ZodObject<{
2433
2461
  sha256: z.ZodString;
2434
2462
  source: z.ZodOptional<z.ZodString>;
2435
2463
  }, z.core.$strict>>>;
2464
+ plugins: z.ZodOptional<z.ZodArray<z.ZodObject<{
2465
+ name: z.ZodEnum<{
2466
+ "nylorun-artifacts": "nylorun-artifacts";
2467
+ "nylorun-interactions": "nylorun-interactions";
2468
+ "nylorun-memory": "nylorun-memory";
2469
+ "nylorun-plan": "nylorun-plan";
2470
+ "nylorun-sandbox": "nylorun-sandbox";
2471
+ "nylorun-triggers": "nylorun-triggers";
2472
+ }>;
2473
+ tools: z.ZodArray<z.ZodString>;
2474
+ sha256: z.ZodString;
2475
+ hosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
2476
+ }, z.core.$strict>>>;
2436
2477
  }, z.core.$strict>>;
2437
2478
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2438
2479
  requires: z.ZodOptional<z.ZodObject<{
@@ -4160,11 +4201,14 @@ export type CredentialCoverage = z.infer<typeof CredentialCoverageSchema>;
4160
4201
  /**
4161
4202
  * What a message to a busy session does (protocol 17): `queue` waits for the running turn to
4162
4203
  * end and starts the next one; `reject` is refused with `409 session_busy`. A protocol 17 client's
4163
- * 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.
4164
4207
  */
4165
4208
  export declare const MessageDeliverySchema: z.ZodEnum<{
4166
4209
  queue: "queue";
4167
4210
  reject: "reject";
4211
+ steer: "steer";
4168
4212
  }>;
4169
4213
  export type MessageDelivery = z.infer<typeof MessageDeliverySchema>;
4170
4214
  /**
@@ -4204,6 +4248,7 @@ export declare const MessageEventBodySchema: z.ZodUnion<readonly [z.ZodObject<{
4204
4248
  delivery: z.ZodOptional<z.ZodEnum<{
4205
4249
  queue: "queue";
4206
4250
  reject: "reject";
4251
+ steer: "steer";
4207
4252
  }>>;
4208
4253
  content: z.ZodString;
4209
4254
  }, z.core.$strict>, z.ZodObject<{
@@ -4215,6 +4260,7 @@ export declare const MessageEventBodySchema: z.ZodUnion<readonly [z.ZodObject<{
4215
4260
  delivery: z.ZodOptional<z.ZodEnum<{
4216
4261
  queue: "queue";
4217
4262
  reject: "reject";
4263
+ steer: "steer";
4218
4264
  }>>;
4219
4265
  data: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
4220
4266
  }, z.core.$strict>, z.ZodObject<{
@@ -4226,6 +4272,7 @@ export declare const MessageEventBodySchema: z.ZodUnion<readonly [z.ZodObject<{
4226
4272
  delivery: z.ZodOptional<z.ZodEnum<{
4227
4273
  queue: "queue";
4228
4274
  reject: "reject";
4275
+ steer: "steer";
4229
4276
  }>>;
4230
4277
  parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4231
4278
  type: z.ZodLiteral<"text">;
@@ -4251,6 +4298,7 @@ export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<reado
4251
4298
  delivery: z.ZodOptional<z.ZodEnum<{
4252
4299
  queue: "queue";
4253
4300
  reject: "reject";
4301
+ steer: "steer";
4254
4302
  }>>;
4255
4303
  content: z.ZodString;
4256
4304
  }, z.core.$strict>, z.ZodObject<{
@@ -4262,6 +4310,7 @@ export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<reado
4262
4310
  delivery: z.ZodOptional<z.ZodEnum<{
4263
4311
  queue: "queue";
4264
4312
  reject: "reject";
4313
+ steer: "steer";
4265
4314
  }>>;
4266
4315
  data: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
4267
4316
  }, z.core.$strict>, z.ZodObject<{
@@ -4273,6 +4322,7 @@ export declare const SessionCommandSchema: z.ZodUnion<readonly [z.ZodUnion<reado
4273
4322
  delivery: z.ZodOptional<z.ZodEnum<{
4274
4323
  queue: "queue";
4275
4324
  reject: "reject";
4325
+ steer: "steer";
4276
4326
  }>>;
4277
4327
  parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4278
4328
  type: z.ZodLiteral<"text">;
@@ -4309,6 +4359,7 @@ export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<rea
4309
4359
  delivery: z.ZodOptional<z.ZodEnum<{
4310
4360
  queue: "queue";
4311
4361
  reject: "reject";
4362
+ steer: "steer";
4312
4363
  }>>;
4313
4364
  content: z.ZodString;
4314
4365
  }, z.core.$strict>, z.ZodObject<{
@@ -4320,6 +4371,7 @@ export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<rea
4320
4371
  delivery: z.ZodOptional<z.ZodEnum<{
4321
4372
  queue: "queue";
4322
4373
  reject: "reject";
4374
+ steer: "steer";
4323
4375
  }>>;
4324
4376
  data: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
4325
4377
  }, z.core.$strict>, z.ZodObject<{
@@ -4331,6 +4383,7 @@ export declare const SessionEventBodySchema: z.ZodUnion<readonly [z.ZodUnion<rea
4331
4383
  delivery: z.ZodOptional<z.ZodEnum<{
4332
4384
  queue: "queue";
4333
4385
  reject: "reject";
4386
+ steer: "steer";
4334
4387
  }>>;
4335
4388
  parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4336
4389
  type: z.ZodLiteral<"text">;
@@ -4590,12 +4643,18 @@ export declare const AcceptedResponseSchema: z.ZodObject<{
4590
4643
  export type AcceptedResponse = z.infer<typeof AcceptedResponseSchema>;
4591
4644
  /**
4592
4645
  * A message the session queued because a turn runs or waits (protocol 17): it starts the next
4593
- * 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.
4594
4649
  */
4595
4650
  export declare const QueuedResponseSchema: z.ZodObject<{
4596
4651
  status: z.ZodLiteral<"queued">;
4597
4652
  queuedMessageId: z.ZodString;
4598
4653
  position: z.ZodNumber;
4654
+ delivery: z.ZodOptional<z.ZodEnum<{
4655
+ queue: "queue";
4656
+ steer: "steer";
4657
+ }>>;
4599
4658
  cursor: z.ZodNullable<z.ZodString>;
4600
4659
  requestId: z.ZodString;
4601
4660
  }, z.core.$strip>;
@@ -4610,6 +4669,10 @@ export declare const CommandResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
4610
4669
  status: z.ZodLiteral<"queued">;
4611
4670
  queuedMessageId: z.ZodString;
4612
4671
  position: z.ZodNumber;
4672
+ delivery: z.ZodOptional<z.ZodEnum<{
4673
+ queue: "queue";
4674
+ steer: "steer";
4675
+ }>>;
4613
4676
  cursor: z.ZodNullable<z.ZodString>;
4614
4677
  requestId: z.ZodString;
4615
4678
  }, z.core.$strip>]>;
@@ -4953,12 +5016,16 @@ export declare const TurnCancelledPayloadSchema: z.ZodObject<{
4953
5016
  /**
4954
5017
  * `message.queued` (protocol 17): a message arrived while the session's turn ran or waited, and
4955
5018
  * waits in its queue. `position` counts from 1; the message's `command.message` is written when
4956
- * a turn takes it.
5019
+ * a turn takes it. `delivery` (D85) says whether the running turn may take it before a step.
4957
5020
  */
4958
5021
  export declare const MessageQueuedPayloadSchema: z.ZodObject<{
4959
5022
  queuedMessageId: z.ZodString;
4960
5023
  position: z.ZodNumber;
4961
5024
  requestId: z.ZodString;
5025
+ delivery: z.ZodOptional<z.ZodEnum<{
5026
+ queue: "queue";
5027
+ steer: "steer";
5028
+ }>>;
4962
5029
  }, z.core.$loose>;
4963
5030
  /**
4964
5031
  * `wake.booked`: the session's agent booked its next turn with `schedule_wake`,
@@ -5014,10 +5081,14 @@ export declare const PlanUpdatedPayloadSchema: z.ZodObject<{
5014
5081
  note: z.ZodOptional<z.ZodString>;
5015
5082
  }, z.core.$loose>>;
5016
5083
  }, z.core.$loose>;
5017
- /** `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
+ */
5018
5088
  export declare const QueueTakenPayloadSchema: z.ZodObject<{
5019
5089
  turnId: z.ZodString;
5020
5090
  queuedMessageIds: z.ZodArray<z.ZodString>;
5091
+ step: z.ZodOptional<z.ZodNumber>;
5021
5092
  }, z.core.$loose>;
5022
5093
  /** Lifecycle of an agent used as a tool. `agent.delegationId` is the parent call's invocation. */
5023
5094
  export declare const DelegationPayloadSchema: z.ZodObject<{
@@ -5272,6 +5343,7 @@ export declare const CommandMessagePayloadSchema: z.ZodObject<{
5272
5343
  delivery: z.ZodOptional<z.ZodEnum<{
5273
5344
  queue: "queue";
5274
5345
  reject: "reject";
5346
+ steer: "steer";
5275
5347
  }>>;
5276
5348
  queuedMessageId: z.ZodOptional<z.ZodString>;
5277
5349
  cause: z.ZodOptional<z.ZodObject<{
@@ -5690,6 +5762,7 @@ export declare const EVENT_CATALOG: {
5690
5762
  delivery: z.ZodOptional<z.ZodEnum<{
5691
5763
  queue: "queue";
5692
5764
  reject: "reject";
5765
+ steer: "steer";
5693
5766
  }>>;
5694
5767
  queuedMessageId: z.ZodOptional<z.ZodString>;
5695
5768
  cause: z.ZodOptional<z.ZodObject<{
@@ -5877,6 +5950,10 @@ export declare const EVENT_CATALOG: {
5877
5950
  queuedMessageId: z.ZodString;
5878
5951
  position: z.ZodNumber;
5879
5952
  requestId: z.ZodString;
5953
+ delivery: z.ZodOptional<z.ZodEnum<{
5954
+ queue: "queue";
5955
+ steer: "steer";
5956
+ }>>;
5880
5957
  }, z.core.$loose>;
5881
5958
  readonly source: "api";
5882
5959
  readonly version: 1;
@@ -5885,6 +5962,7 @@ export declare const EVENT_CATALOG: {
5885
5962
  readonly payload: z.ZodObject<{
5886
5963
  turnId: z.ZodString;
5887
5964
  queuedMessageIds: z.ZodArray<z.ZodString>;
5965
+ step: z.ZodOptional<z.ZodNumber>;
5888
5966
  }, z.core.$loose>;
5889
5967
  readonly source: "api";
5890
5968
  readonly version: 1;
package/dist/contracts.js CHANGED
@@ -269,6 +269,15 @@ export const HarnessEngineSchema = z
269
269
  .optional()
270
270
  .meta({ description: "A block's wording replaced, by block name" }),
271
271
  blocks: z.array(engineBlockRefSchema).optional().meta({ description: "The engine text blocks the agent gets, with their hashes" }),
272
+ plugins: z
273
+ .array(z.strictObject({
274
+ name: z.enum(["nylorun-memory", "nylorun-triggers", "nylorun-plan", "nylorun-interactions", "nylorun-artifacts", "nylorun-sandbox"]),
275
+ tools: z.array(z.string().min(1)),
276
+ sha256: z.string().regex(/^sha256:[0-9a-f]{64}$/),
277
+ hosts: z.array(z.string().min(1)).optional(),
278
+ }))
279
+ .optional()
280
+ .meta({ description: "The Runtime's plugins the agent declares (agent-folder/3, ADR-106): each with the tools left on and the hash of its files" }),
272
281
  })
273
282
  .meta({ id: "HarnessEngine" });
274
283
  const harnessEngineField = HarnessEngineSchema.optional();
@@ -2013,8 +2022,15 @@ export const TriggerToolItemSchema = z
2013
2022
  });
2014
2023
  /** What a `triggers` call answers: the trigger made, the list, or the one deleted. */
2015
2024
  export const TriggerToolOutputSchema = z.union([
2016
- z.strictObject({ id: z.string(), status: z.enum(TRIGGER_STATUSES), nextRunAt: z.string().nullable(), session: z.string() }),
2017
- z.strictObject({ triggers: z.array(TriggerToolItemSchema) }),
2025
+ z.strictObject({
2026
+ id: z.string(),
2027
+ status: z.enum(TRIGGER_STATUSES),
2028
+ nextRunAt: z.string().nullable(),
2029
+ session: z.string(),
2030
+ /** The Runtime's clock when it answered, so the model knows the time (ADR-106). */
2031
+ now: z.string().optional(),
2032
+ }),
2033
+ z.strictObject({ triggers: z.array(TriggerToolItemSchema), now: z.string().optional() }),
2018
2034
  z.strictObject({ id: z.string(), deleted: z.literal(true) }),
2019
2035
  ]);
2020
2036
  /**
@@ -2873,9 +2889,11 @@ const commandBase = {
2873
2889
  /**
2874
2890
  * What a message to a busy session does (protocol 17): `queue` waits for the running turn to
2875
2891
  * end and starts the next one; `reject` is refused with `409 session_busy`. A protocol 17 client's
2876
- * 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.
2877
2895
  */
2878
- export const MessageDeliverySchema = z.enum(["queue", "reject"]);
2896
+ export const MessageDeliverySchema = z.enum(["queue", "reject", "steer"]);
2879
2897
  /**
2880
2898
  * A message's `removeTools` (Host feature `remove-tools`): the tools its turn may not use, by
2881
2899
  * name. In the root agent and each agent it uses as a tool, a name removes the declared tool of
@@ -3076,12 +3094,15 @@ export const AcceptedResponseSchema = z.object({
3076
3094
  });
3077
3095
  /**
3078
3096
  * A message the session queued because a turn runs or waits (protocol 17): it starts the next
3079
- * 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.
3080
3100
  */
3081
3101
  export const QueuedResponseSchema = z.object({
3082
3102
  status: z.literal("queued"),
3083
3103
  queuedMessageId: z.string(),
3084
3104
  position: z.number().int().positive(),
3105
+ delivery: z.enum(["queue", "steer"]).optional(),
3085
3106
  cursor: z.string().nullable(),
3086
3107
  requestId: z.string(),
3087
3108
  });
@@ -3368,10 +3389,15 @@ export const TurnCancelledPayloadSchema = z
3368
3389
  /**
3369
3390
  * `message.queued` (protocol 17): a message arrived while the session's turn ran or waited, and
3370
3391
  * waits in its queue. `position` counts from 1; the message's `command.message` is written when
3371
- * a turn takes it.
3392
+ * a turn takes it. `delivery` (D85) says whether the running turn may take it before a step.
3372
3393
  */
3373
3394
  export const MessageQueuedPayloadSchema = z
3374
- .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
+ })
3375
3401
  .passthrough();
3376
3402
  /**
3377
3403
  * `wake.booked`: the session's agent booked its next turn with `schedule_wake`,
@@ -3402,9 +3428,16 @@ export const PlanStepSchema = z
3402
3428
  export const PlanUpdatedPayloadSchema = z
3403
3429
  .object({ steps: z.array(PlanStepSchema).max(PLAN_LIMITS.steps) })
3404
3430
  .passthrough();
3405
- /** `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
+ */
3406
3435
  export const QueueTakenPayloadSchema = z
3407
- .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
+ })
3408
3441
  .passthrough();
3409
3442
  /** Lifecycle of an agent used as a tool. `agent.delegationId` is the parent call's invocation. */
3410
3443
  export const DelegationPayloadSchema = z
@@ -1,3 +1,4 @@
1
+ import { runtimeToolOf } from "../plugins/index.js";
1
2
  import { canonical } from "../utils/canonical.js";
2
3
  function same(a, b) {
3
4
  return canonical(a) === canonical(b);
@@ -120,7 +121,12 @@ export function withoutTools(manifest, names) {
120
121
  return same(next, manifest) ? manifest : next;
121
122
  }
122
123
  function narrowAgent(agent, removed, root) {
123
- const { tools: _tools, mcpServers: _servers, ...rest } = agent;
124
+ const { tools: _tools, mcpServers: _servers, engine: _engine, ...rest } = agent;
125
+ // A Runtime plugin's tool by the name the model reads (ADR-106): `nylorun__ask` turns `ask` off.
126
+ const offPlugin = new Set([...removed].flatMap((name) => runtimeToolOf(name) ?? []));
127
+ const engine = agent.engine?.plugins !== undefined && offPlugin.size > 0
128
+ ? { ...agent.engine, plugins: agent.engine.plugins.map((plugin) => ({ ...plugin, tools: plugin.tools.filter((tool) => !offPlugin.has(tool)) })) }
129
+ : agent.engine;
124
130
  const tools = agent.tools
125
131
  ?.filter((tool) => !removed.has(tool.name))
126
132
  .map((tool) => {
@@ -134,6 +140,7 @@ function narrowAgent(agent, removed, root) {
134
140
  ...rest,
135
141
  ...(tools === undefined ? {} : { tools }),
136
142
  ...(servers === undefined ? {} : { mcpServers: servers }),
143
+ ...(engine === undefined ? {} : { engine }),
137
144
  };
138
145
  }
139
146
  function narrowServer(server, removed) {
@@ -1,7 +1,8 @@
1
1
  import { SANDBOX_TOOL_NAMES } from "../utils/sandbox.js";
2
2
  import { ENGINE_BLOCK_VERSIONS } from "./blocks.js";
3
3
  import { previewTurn } from "./preview.js";
4
- import { LOAD_SKILL_TOOL, MEMORY_TOOL, READ_SKILL_RESOURCE_TOOL, REQUEST_CONNECTION_TOOL, SCHEDULE_WAKE_TOOL, TOOL_CALL_TOOL, TRIGGERS_TOOL, TOOL_SEARCH_TOOL, UPDATE_PLAN_TOOL, } from "./tools.js";
4
+ import { LOAD_SKILL_TOOL, MEMORY_TOOL, READ_SKILL_RESOURCE_TOOL, REQUEST_CONNECTION_TOOL, SCHEDULE_WAKE_TOOL, TOOL_CALL_TOOL, TRIGGERS_TOOL, TOOL_SEARCH_TOOL, UPDATE_PLAN_TOOL, ASK_TOOL, } from "./tools.js";
5
+ import { runtimeToolOf } from "../plugins/index.js";
5
6
  import { READ_ARTIFACT_TOOL, SAVE_ARTIFACT_TOOL } from "../utils/runtime-tools.js";
6
7
  import { loopManifestOf } from "../definition/sections.js";
7
8
  /** The engine features, in the order the harness adds them. */
@@ -28,9 +29,20 @@ const TOOLS = {
28
29
  triggers: [TRIGGERS_TOOL],
29
30
  memory: [MEMORY_TOOL],
30
31
  plan: [UPDATE_PLAN_TOOL],
31
- connections: [REQUEST_CONNECTION_TOOL],
32
+ connections: [REQUEST_CONNECTION_TOOL, ASK_TOOL],
32
33
  toolSearch: [TOOL_SEARCH_TOOL, TOOL_CALL_TOOL],
33
34
  };
35
+ /** The Runtime plugin that declares each feature in an `agent-folder/3` folder (ADR-106). */
36
+ const PLUGIN_OF = {
37
+ sandbox: "nylorun-sandbox",
38
+ "artifacts.save": "nylorun-artifacts",
39
+ "artifacts.read": "nylorun-artifacts",
40
+ selfWake: "nylorun-triggers",
41
+ triggers: "nylorun-triggers",
42
+ memory: "nylorun-memory",
43
+ plan: "nylorun-plan",
44
+ connections: "nylorun-interactions",
45
+ };
34
46
  const BLOCKS = {
35
47
  skills: ["skills", "skill_folder"],
36
48
  sandbox: ["sandbox"],
@@ -47,6 +59,9 @@ const BLOCKS = {
47
59
  function explainOne(id, preview, facts) {
48
60
  const declared = preview.features.declared;
49
61
  const by = (feature) => {
62
+ // agent-folder/3: the plugin that brings it (ADR-106), or skills/ and the plugins' skills.
63
+ if (facts.plugins)
64
+ return PLUGIN_OF[feature] ?? (feature === "skills" ? "skills/ and the plugins' skills" : `engine.${feature}`);
50
65
  switch (feature) {
51
66
  case "skills":
52
67
  return "skills/";
@@ -65,7 +80,8 @@ function explainOne(id, preview, facts) {
65
80
  }
66
81
  };
67
82
  const blocks = new Set(preview.blocks.map((block) => block.name));
68
- const tools = new Set(preview.engineTools);
83
+ // A Runtime plugin's tool by its own name: nylorun__memory is memory (ADR-106).
84
+ const tools = new Set(preview.engineTools.map((name) => runtimeToolOf(name) ?? name));
69
85
  const features = ENGINE_FEATURES.map((feature) => {
70
86
  const added = TOOLS[feature].filter((name) => tools.has(name));
71
87
  const text = BLOCKS[feature].filter((name) => blocks.has(name)).map((name) => `${name}@${ENGINE_BLOCK_VERSIONS[name]}`);
@@ -105,9 +121,10 @@ export function explainEngine(manifest) {
105
121
  const preview = previewTurn(manifest);
106
122
  const loop = loopManifestOf(manifest);
107
123
  const mcpOf = (agent) => Object.keys(agent.mcpServers ?? {}).length > 0;
108
- const root = explainOne(manifest.name, preview, { root: true, pinned: preview.pinned.length > 0, mcp: mcpOf(loop) });
124
+ const plugins = manifest.harness.engine?.plugins !== undefined;
125
+ const root = explainOne(manifest.name, preview, { root: true, pinned: preview.pinned.length > 0, mcp: mcpOf(loop), plugins });
109
126
  const subagents = (loop.tools ?? []).flatMap((tool) => tool.agent && !("kind" in tool.agent) && preview.agents[tool.agent.id]
110
- ? [explainOne(tool.agent.id, preview.agents[tool.agent.id], { root: false, pinned: false, mcp: mcpOf(tool.agent) })]
127
+ ? [explainOne(tool.agent.id, preview.agents[tool.agent.id], { root: false, pinned: false, mcp: mcpOf(tool.agent), plugins })]
111
128
  : []);
112
129
  return [root, ...subagents];
113
130
  }
@@ -12,3 +12,4 @@ export * from "./mcp.js";
12
12
  export * from "./projection.js";
13
13
  export * from "./preview.js";
14
14
  export * from "./explain.js";
15
+ export * from "../plugins/index.js";
@@ -12,3 +12,4 @@ export * from "./mcp.js";
12
12
  export * from "./projection.js";
13
13
  export * from "./preview.js";
14
14
  export * from "./explain.js";
15
+ export * from "../plugins/index.js";
@@ -52,6 +52,7 @@ export interface PreviewTurnOptions {
52
52
  readonly loop?: {
53
53
  readonly plan?: boolean;
54
54
  readonly connections?: boolean;
55
+ readonly ask?: boolean;
55
56
  };
56
57
  /** The harness's configuration of our engine's tools. Default: the harness's defaults. */
57
58
  readonly limits?: Partial<EngineToolLimits>;
@@ -64,6 +64,7 @@ export function previewTurn(manifest, options = {}) {
64
64
  const plan = options.loop?.plan ?? settings.plan === true;
65
65
  const connections = options.loop?.connections ?? settings.connections === true;
66
66
  const triggers = options.triggers ?? harness?.engine?.triggers === true;
67
+ const ask = options.loop?.ask ?? settings.ask === true;
67
68
  const limits = { ...DEFAULT_ENGINE_TOOL_LIMITS, ...options.limits };
68
69
  const memoryOf = (agent) => memory && {
69
70
  access: memory.access ?? "read_write",
@@ -71,7 +72,7 @@ export function previewTurn(manifest, options = {}) {
71
72
  root: agent.id === loop.id,
72
73
  index: memory.index !== false,
73
74
  };
74
- const projection = (agent) => engineProjection(agent, runsOn, limits, memoryOf(agent), plan && agent.id === loop.id, connections && agent.id === loop.id, triggers && agent.id === loop.id);
75
+ const projection = (agent) => engineProjection(agent, runsOn, limits, memoryOf(agent), plan && agent.id === loop.id, connections && agent.id === loop.id, triggers && agent.id === loop.id, ask && agent.id === loop.id);
75
76
  const mcp = mcpToolSet(options.mcpFacts, loop, {
76
77
  config: mcpToolConfigOf(options.mcpTools),
77
78
  ...(options.model ? { model: options.model } : {}),
@@ -60,4 +60,6 @@ export interface EngineProjection {
60
60
  * the version declares `harness.engine.triggers` (`turn.start.agent.triggers`). What the agent
61
61
  * declares (`agent.engine`) decides the rest; a block it replaces is in its words.
62
62
  */
63
- export declare function engineProjection(agent: Pick<AgentManifest, "skills" | "tools" | "engine">, runsOn: Pick<TurnAgent, "sandbox" | "selfWake"> | undefined, options: Pick<EngineToolLimits, "artifactPageBytes" | "sandboxTools">, memory?: EngineMemory, plan?: boolean, connections?: boolean, triggers?: boolean): EngineProjection;
63
+ export declare function engineProjection(agent: Pick<AgentManifest, "skills" | "tools" | "engine">, runsOn: Pick<TurnAgent, "sandbox" | "selfWake"> | undefined, options: Pick<EngineToolLimits, "artifactPageBytes" | "sandboxTools">, memory?: EngineMemory, plan?: boolean, connections?: boolean, triggers?: boolean, ask?: boolean): EngineProjection;
64
+ /** The first line of server `nylorun`'s text (ADR-106). */
65
+ export declare const RUNTIME_SERVER_HEADING = "# Server nylorun\nThe Runtime's own tools, from the plugins this agent declares. Their names begin with nylorun__.";