@nylorun/core 0.23.0-beta → 0.24.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.
@@ -11,7 +11,7 @@ import * as mcp from "./mcp.js";
11
11
  import * as entries from "./entries.js";
12
12
  import * as transport from "./transport.js";
13
13
  import { HARNESS_API_VERSION } from "./messages.js";
14
- import { ArtifactMetaSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnEnvironmentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, } from "./schema.js";
14
+ import { ArtifactMetaSchema, EffectIntentSchema, FrameSchema, HarnessCheckpointSchema, IntentAnswerSchema, ModelDescriptorSchema, EffectTargetSchema, TurnAgentSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TranscriptUpdateSchema, TurnOutputSchema, TurnStartSchema, coreMessages, coreRequests, harnessRequests, } from "./schema.js";
15
15
  const named = {
16
16
  ArtifactMetaSchema,
17
17
  EffectIntentSchema,
@@ -20,7 +20,7 @@ const named = {
20
20
  IntentAnswerSchema,
21
21
  ModelDescriptorSchema,
22
22
  EffectTargetSchema,
23
- TurnEnvironmentSchema,
23
+ TurnAgentSchema,
24
24
  OutcomeAnswerSchema,
25
25
  RecordedOutcomeSchema,
26
26
  RunGrantSchema,
@@ -10,8 +10,8 @@
10
10
  * which a socket validates it with.
11
11
  */
12
12
  import type { z } from "zod";
13
- import type { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, EffectTargetSchema, IntentAnswerSchema, ModelDescriptorSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, ReleaseReasonSchema, RequestTypes, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TurnEnvironmentSchema, TurnOutputSchema, TurnStartSchema, WorkspaceCallSchema, WorkspaceDiskCallSchema, WorkspaceRecordSchema, WorkspaceSessionSchema, coreMessages, coreRequests, harnessRequests } from "./schema.js";
14
- export declare const HARNESS_API_VERSION = 4;
13
+ import type { ArtifactMetaSchema, CompactionFactsSchema, EffectIntentSchema, EffectTargetSchema, IntentAnswerSchema, ModelDescriptorSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, ReleaseReasonSchema, RequestTypes, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TurnAgentSchema, TurnMemorySchema, TurnOutputSchema, TurnStartSchema, WorkspaceCallSchema, WorkspaceDiskCallSchema, WorkspaceRecordSchema, WorkspaceSessionSchema, coreMessages, coreRequests, harnessRequests } from "./schema.js";
14
+ export declare const HARNESS_API_VERSION = 5;
15
15
  /** Why core stopped a run. Matches the advance's abort kinds. */
16
16
  export declare const ABORT_REASONS: readonly ["cancel", "shutdown", "deadline", "ownership.lost"];
17
17
  export type AbortReason = (typeof ABORT_REASONS)[number];
@@ -42,7 +42,9 @@ export type EffectIntent = z.infer<typeof EffectIntentSchema>;
42
42
  /** What a tool call runs: the record routes it by `kind` (protocol 15). */
43
43
  export type EffectTarget = z.infer<typeof EffectTargetSchema>;
44
44
  /** The Environment a turn runs in (`turn.start.environment`, protocol 15). */
45
- export type TurnEnvironment = z.infer<typeof TurnEnvironmentSchema>;
45
+ export type TurnAgent = z.infer<typeof TurnAgentSchema>;
46
+ /** The Agent's memory as a turn starts (`turn.start.memory`, track T5). */
47
+ export type TurnMemory = z.infer<typeof TurnMemorySchema>;
46
48
  /** An artifact as the artifact seam shows it to a harness (`artifact.read`, `artifact.write`). */
47
49
  export type ArtifactMeta = z.infer<typeof ArtifactMetaSchema>;
48
50
  /** One `artifact.read` answer: the artifact, and up to one chunk of its bytes from `offset`. */
@@ -1,4 +1,4 @@
1
- export const HARNESS_API_VERSION = 4;
1
+ export const HARNESS_API_VERSION = 5;
2
2
  /** Why core stopped a run. Matches the advance's abort kinds. */
3
3
  export const ABORT_REASONS = ["cancel", "shutdown", "deadline", "ownership.lost"];
4
4
  /**
@@ -113,6 +113,12 @@ export declare const EffectTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
113
  kind: z.ZodLiteral<"sandbox">;
114
114
  }, z.core.$strict>, z.ZodObject<{
115
115
  kind: z.ZodLiteral<"harness">;
116
+ }, z.core.$strict>, z.ZodObject<{
117
+ kind: z.ZodLiteral<"runtime">;
118
+ operation: z.ZodEnum<{
119
+ memory: "memory";
120
+ schedule_wake: "schedule_wake";
121
+ }>;
116
122
  }, z.core.$strict>], "kind">;
117
123
  /**
118
124
  * One effect the engine asks for: a `HostEffect`, by structure. Model intents carry no `input`.
@@ -167,6 +173,12 @@ export declare const EffectIntentSchema: z.ZodObject<{
167
173
  kind: z.ZodLiteral<"sandbox">;
168
174
  }, z.core.$strict>, z.ZodObject<{
169
175
  kind: z.ZodLiteral<"harness">;
176
+ }, z.core.$strict>, z.ZodObject<{
177
+ kind: z.ZodLiteral<"runtime">;
178
+ operation: z.ZodEnum<{
179
+ memory: "memory";
180
+ schedule_wake: "schedule_wake";
181
+ }>;
170
182
  }, z.core.$strict>], "kind">>;
171
183
  skill: z.ZodOptional<z.ZodString>;
172
184
  purpose: z.ZodOptional<z.ZodLiteral<"summary">>;
@@ -333,8 +345,10 @@ export declare const RunRoutingSchema: z.ZodObject<{
333
345
  /**
334
346
  * The fields of `TurnStart.checkpoint` a harness reads (R4.2); the rest are our engine's. An
335
347
  * agent turn's `input` is the turn's message: a string, `{text, metadata?}`, `{content,
336
- * metadata?}` with user content parts, `{kind: "continue"}` for the next segment of a yielded
337
- * turn, or an approval or response event. Effect ids are prefixed `<turnId>:<segment>:`
348
+ * metadata?}` with user content parts, `{kind: "messages", messages}` for messages that waited in
349
+ * the session's queue (protocol 17: each one of the shapes before, each its own user message, in
350
+ * order), `{kind: "continue"}` for the next segment of a yielded turn, or an approval or response
351
+ * event. Effect ids are prefixed `<turnId>:<segment>:`
338
352
  * (`effectIdOf`), and every intent carries `manifestHash`. `state` is the harness's own, as its
339
353
  * last output left it: core stores it unread (at most `limits.harnessStateBytes` for a harness
340
354
  * other than ours) and folds the transcript every segment, whatever the state holds. A model
@@ -377,11 +391,12 @@ export declare const ModelDescriptorSchema: z.ZodObject<{
377
391
  reasoning: z.ZodOptional<z.ZodBoolean>;
378
392
  }, z.core.$strict>;
379
393
  /**
380
- * The Environment a turn runs in (protocol 15): its id and kind and, when the session has a
394
+ * The Agent a turn runs on (Harness API 5, protocol 16): its id and kind and, when it has a
381
395
  * sandbox, the workspace its commands start in. A harness writes the model's instructions and
382
396
  * defines its sandbox tools from it; the sandbox's spec is the routing's (`routing.sandbox.spec`).
397
+ * The Agent's runtime section never reaches the harness.
383
398
  */
384
- export declare const TurnEnvironmentSchema: z.ZodObject<{
399
+ export declare const TurnAgentSchema: z.ZodObject<{
385
400
  id: z.ZodString;
386
401
  kind: z.ZodEnum<{
387
402
  none: "none";
@@ -391,6 +406,24 @@ export declare const TurnEnvironmentSchema: z.ZodObject<{
391
406
  sandbox: z.ZodOptional<z.ZodObject<{
392
407
  workspace: z.ZodString;
393
408
  }, z.core.$strict>>;
409
+ selfWake: z.ZodOptional<z.ZodBoolean>;
410
+ }, z.core.$strict>;
411
+ /**
412
+ * The Agent's memory as a turn starts (track T5, D72), present when the version its session runs
413
+ * sets `harness.memory`: its access in every turn, the agent's own `instructions`, and the index a
414
+ * harness pins in the session (one line per memory, newest first, with its description, within
415
+ * the Runtime limits `memoryIndexLines` and `memoryIndexBytes`; `truncated` when some were left
416
+ * out). A harness offers the `memory` tool (a `runtime` effect, operation `memory`), view only for
417
+ * `read_only` and for its sub-agents.
418
+ */
419
+ export declare const TurnMemorySchema: z.ZodObject<{
420
+ access: z.ZodEnum<{
421
+ read_only: "read_only";
422
+ read_write: "read_write";
423
+ }>;
424
+ instructions: z.ZodOptional<z.ZodString>;
425
+ index: z.ZodString;
426
+ truncated: z.ZodBoolean;
394
427
  }, z.core.$strict>;
395
428
  /** What a run starts from: `turn.start` (message, continue, resume) or `approval.answer`. */
396
429
  export declare const TurnStartSchema: z.ZodObject<{
@@ -403,6 +436,20 @@ export declare const TurnStartSchema: z.ZodObject<{
403
436
  flow: "flow";
404
437
  }>;
405
438
  manifest: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
439
+ definition: z.ZodOptional<z.ZodObject<{
440
+ name: z.ZodString;
441
+ version: z.ZodNumber;
442
+ }, z.core.$strict>>;
443
+ loop: z.ZodOptional<z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>>;
444
+ memory: z.ZodOptional<z.ZodObject<{
445
+ access: z.ZodEnum<{
446
+ read_only: "read_only";
447
+ read_write: "read_write";
448
+ }>;
449
+ instructions: z.ZodOptional<z.ZodString>;
450
+ index: z.ZodString;
451
+ truncated: z.ZodBoolean;
452
+ }, z.core.$strict>>;
406
453
  checkpoint: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
407
454
  mcp: z.ZodOptional<z.ZodObject<{
408
455
  servers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -476,7 +523,7 @@ export declare const TurnStartSchema: z.ZodObject<{
476
523
  maxOutputTokens: z.ZodNumber;
477
524
  reasoning: z.ZodOptional<z.ZodBoolean>;
478
525
  }, z.core.$strict>>;
479
- environment: z.ZodOptional<z.ZodObject<{
526
+ agent: z.ZodOptional<z.ZodObject<{
480
527
  id: z.ZodString;
481
528
  kind: z.ZodEnum<{
482
529
  none: "none";
@@ -486,6 +533,7 @@ export declare const TurnStartSchema: z.ZodObject<{
486
533
  sandbox: z.ZodOptional<z.ZodObject<{
487
534
  workspace: z.ZodString;
488
535
  }, z.core.$strict>>;
536
+ selfWake: z.ZodOptional<z.ZodBoolean>;
489
537
  }, z.core.$strict>>;
490
538
  }, z.core.$strict>;
491
539
  /**
@@ -598,7 +646,7 @@ export declare const harnessRequests: {
598
646
  }, z.core.$strict>;
599
647
  }, z.core.$strict>;
600
648
  result: z.ZodObject<{
601
- api: z.ZodLiteral<4>;
649
+ api: z.ZodLiteral<5>;
602
650
  tenantId: z.ZodString;
603
651
  sandbox: z.ZodObject<{
604
652
  backend: z.ZodNullable<z.ZodString>;
@@ -629,6 +677,20 @@ export declare const harnessRequests: {
629
677
  flow: "flow";
630
678
  }>;
631
679
  manifest: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
680
+ definition: z.ZodOptional<z.ZodObject<{
681
+ name: z.ZodString;
682
+ version: z.ZodNumber;
683
+ }, z.core.$strict>>;
684
+ loop: z.ZodOptional<z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>>;
685
+ memory: z.ZodOptional<z.ZodObject<{
686
+ access: z.ZodEnum<{
687
+ read_only: "read_only";
688
+ read_write: "read_write";
689
+ }>;
690
+ instructions: z.ZodOptional<z.ZodString>;
691
+ index: z.ZodString;
692
+ truncated: z.ZodBoolean;
693
+ }, z.core.$strict>>;
632
694
  checkpoint: z.ZodType<object, unknown, z.core.$ZodTypeInternals<object, unknown>>;
633
695
  mcp: z.ZodOptional<z.ZodObject<{
634
696
  servers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -702,7 +764,7 @@ export declare const harnessRequests: {
702
764
  maxOutputTokens: z.ZodNumber;
703
765
  reasoning: z.ZodOptional<z.ZodBoolean>;
704
766
  }, z.core.$strict>>;
705
- environment: z.ZodOptional<z.ZodObject<{
767
+ agent: z.ZodOptional<z.ZodObject<{
706
768
  id: z.ZodString;
707
769
  kind: z.ZodEnum<{
708
770
  none: "none";
@@ -712,6 +774,7 @@ export declare const harnessRequests: {
712
774
  sandbox: z.ZodOptional<z.ZodObject<{
713
775
  workspace: z.ZodString;
714
776
  }, z.core.$strict>>;
777
+ selfWake: z.ZodOptional<z.ZodBoolean>;
715
778
  }, z.core.$strict>>;
716
779
  }, z.core.$strict>;
717
780
  }, z.core.$strict>;
@@ -771,6 +834,12 @@ export declare const harnessRequests: {
771
834
  kind: z.ZodLiteral<"sandbox">;
772
835
  }, z.core.$strict>, z.ZodObject<{
773
836
  kind: z.ZodLiteral<"harness">;
837
+ }, z.core.$strict>, z.ZodObject<{
838
+ kind: z.ZodLiteral<"runtime">;
839
+ operation: z.ZodEnum<{
840
+ memory: "memory";
841
+ schedule_wake: "schedule_wake";
842
+ }>;
774
843
  }, z.core.$strict>], "kind">>;
775
844
  skill: z.ZodOptional<z.ZodString>;
776
845
  purpose: z.ZodOptional<z.ZodLiteral<"summary">>;
@@ -81,6 +81,13 @@ export const EffectTargetSchema = z.discriminatedUnion("kind", [
81
81
  z.object({ kind: z.literal("http"), tool: z.string().min(1) }).strict(),
82
82
  z.object({ kind: z.literal("sandbox") }).strict(),
83
83
  z.object({ kind: z.literal("harness") }).strict(),
84
+ /**
85
+ * An operation the Runtime itself serves, in the transaction that journals the call, keyed by
86
+ * the effect id (track T4): `schedule_wake` books the session's next turn (D77); `memory` (track
87
+ * T5, D72) is a call of the `memory` tool, with Anthropic's memory tool parameters as its input,
88
+ * on the Agent's memories. Answered at once; the harness never executes it.
89
+ */
90
+ z.object({ kind: z.literal("runtime"), operation: z.enum(["schedule_wake", "memory"]) }).strict(),
84
91
  ]);
85
92
  /**
86
93
  * One effect the engine asks for: a `HostEffect`, by structure. Model intents carry no `input`.
@@ -259,8 +266,10 @@ export const RunRoutingSchema = z
259
266
  /**
260
267
  * The fields of `TurnStart.checkpoint` a harness reads (R4.2); the rest are our engine's. An
261
268
  * agent turn's `input` is the turn's message: a string, `{text, metadata?}`, `{content,
262
- * metadata?}` with user content parts, `{kind: "continue"}` for the next segment of a yielded
263
- * turn, or an approval or response event. Effect ids are prefixed `<turnId>:<segment>:`
269
+ * metadata?}` with user content parts, `{kind: "messages", messages}` for messages that waited in
270
+ * the session's queue (protocol 17: each one of the shapes before, each its own user message, in
271
+ * order), `{kind: "continue"}` for the next segment of a yielded turn, or an approval or response
272
+ * event. Effect ids are prefixed `<turnId>:<segment>:`
264
273
  * (`effectIdOf`), and every intent carries `manifestHash`. `state` is the harness's own, as its
265
274
  * last output left it: core stores it unread (at most `limits.harnessStateBytes` for a harness
266
275
  * other than ours) and folds the transcript every segment, whatever the state holds. A model
@@ -300,16 +309,38 @@ export const ModelDescriptorSchema = z
300
309
  })
301
310
  .strict();
302
311
  /**
303
- * The Environment a turn runs in (protocol 15): its id and kind and, when the session has a
312
+ * The Agent a turn runs on (Harness API 5, protocol 16): its id and kind and, when it has a
304
313
  * sandbox, the workspace its commands start in. A harness writes the model's instructions and
305
314
  * defines its sandbox tools from it; the sandbox's spec is the routing's (`routing.sandbox.spec`).
315
+ * The Agent's runtime section never reaches the harness.
306
316
  */
307
- export const TurnEnvironmentSchema = z
317
+ export const TurnAgentSchema = z
308
318
  .object({
309
319
  id,
310
320
  kind: z.enum(ENVIRONMENT_KINDS),
311
321
  /** Present when the session has a sandbox. */
312
322
  sandbox: z.object({ workspace: z.string().regex(/^\//) }).strict().optional(),
323
+ /**
324
+ * The version the session runs sets `runtime.selfWake` (track T4, D77): our engine offers
325
+ * `schedule_wake`, a `runtime` effect.
326
+ */
327
+ selfWake: z.boolean().optional(),
328
+ })
329
+ .strict();
330
+ /**
331
+ * The Agent's memory as a turn starts (track T5, D72), present when the version its session runs
332
+ * sets `harness.memory`: its access in every turn, the agent's own `instructions`, and the index a
333
+ * harness pins in the session (one line per memory, newest first, with its description, within
334
+ * the Runtime limits `memoryIndexLines` and `memoryIndexBytes`; `truncated` when some were left
335
+ * out). A harness offers the `memory` tool (a `runtime` effect, operation `memory`), view only for
336
+ * `read_only` and for its sub-agents.
337
+ */
338
+ export const TurnMemorySchema = z
339
+ .object({
340
+ access: z.enum(["read_write", "read_only"]),
341
+ instructions: z.string().optional(),
342
+ index: z.string(),
343
+ truncated: z.boolean(),
313
344
  })
314
345
  .strict();
315
346
  /** What a run starts from: `turn.start` (message, continue, resume) or `approval.answer`. */
@@ -317,8 +348,21 @@ export const TurnStartSchema = z
317
348
  .object({
318
349
  type: z.enum(["turn.start", "approval.answer"]),
319
350
  engine: z.enum(["agent", "flow"]),
320
- /** The turn's manifest (agent) or the workflow manifest (flow). */
351
+ /**
352
+ * The turn's loop manifest: the harness section of the agent manifest version its session
353
+ * pinned, with the manifest's name as its `id` (agent manifest v7's shape), or the workflow
354
+ * manifest (flow). A flow's leaf session gets its embedded agent's.
355
+ */
321
356
  manifest: document,
357
+ /** The agent manifest version the session pinned (protocol 16), for the harness's records. */
358
+ definition: z.object({ name: z.string(), version: z.number().int().positive() }).strict().optional(),
359
+ /**
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.
362
+ */
363
+ loop: document.optional(),
364
+ /** The Agent's memory (track T5), when the version its session runs sets `harness.memory`. Absent for a flow. */
365
+ memory: TurnMemorySchema.optional(),
322
366
  /** The segment's checkpoint; an agent's state has no transcript (`transcript.cursor`). */
323
367
  checkpoint: document,
324
368
  /**
@@ -364,10 +408,10 @@ export const TurnStartSchema = z
364
408
  */
365
409
  model: ModelDescriptorSchema.optional(),
366
410
  /**
367
- * The Environment the session runs in (protocol 15): what our engine writes the sandbox notes
368
- * and defines the sandbox tools from. Absent when the session names none, and for a flow.
411
+ * The Agent the session runs on (Harness API 5; `environment` before): what our engine writes
412
+ * the sandbox notes and defines the sandbox tools from. Absent for a flow.
369
413
  */
370
- environment: TurnEnvironmentSchema.optional(),
414
+ agent: TurnAgentSchema.optional(),
371
415
  })
372
416
  .strict();
373
417
  /**
@@ -1,6 +1,10 @@
1
- /** The agent manifest version these documents describe. */
2
- export declare const AGENT_MANIFEST_SCHEMA_VERSION = 7;
3
- /** The environment manifest's JSON Schema document (draft 2020-12). */
4
- export declare function environmentManifestJsonSchema(): Record<string, unknown>;
5
- /** The agent manifest's JSON Schema document (draft 2020-12). */
1
+ /**
2
+ * Agent manifest v8's JSON Schema document (protocol 16): the authoring form, whose `harness`
3
+ * and `runtime` may each be a path to an authoring file, as `agent.manifest.json` is written.
4
+ * What the API receives has both sections written out (`AgentManifestV8Schema`).
5
+ */
6
6
  export declare function agentManifestJsonSchema(): Record<string, unknown>;
7
+ /** `harness.manifest.json`'s JSON Schema document: the harness section as an authoring file. */
8
+ export declare function harnessManifestJsonSchema(): Record<string, unknown>;
9
+ /** `runtime.manifest.json`'s JSON Schema document: the runtime section as an authoring file. */
10
+ export declare function runtimeManifestJsonSchema(): Record<string, unknown>;
@@ -1,17 +1,15 @@
1
1
  /**
2
- * The agent manifest and the environment manifest as JSON Schema documents (protocol 14, D63),
3
- * generated from the zod schemas the Runtime validates with, so an editor checks a manifest file
4
- * from its `$schema` and a client in another language validates what core enforces. The build
5
- * writes them to `dist/schemas/` (`@nylorun/core/schemas/agent-manifest.json` and
6
- * `@nylorun/core/schemas/environment-manifest.json`). Both allow a top-level `$schema`, which
7
- * the CLI and SDK drop before they save: the Runtime's own schemas stay strict. The environment
8
- * manifest's `files` also allow the CLI's `{ path, from }`, a folder beside the file that
9
- * `nylorun environments manifests save` hashes into `{ path, files }`: the Runtime never sees it.
2
+ * Agent manifest v8 and its two authoring files as JSON Schema documents (protocol 16),
3
+ * generated from the zod schemas the Runtime and the composer validate with, so an editor checks
4
+ * a manifest file from its `$schema` and a client in another language validates what core
5
+ * enforces. The build writes them to `dist/schemas/`: `@nylorun/core/schemas/agent-manifest.json`
6
+ * (`agent.manifest.json`, whose sections may be paths), `harness-manifest.json` and
7
+ * `runtime-manifest.json`. Each allows a top-level `$schema`, which the composer drops before it
8
+ * saves: the Runtime's own schemas stay strict. A runtime file's `files` also allow `{ path,
9
+ * from }`, a folder beside the file the composer hashes into `{ path, files }`.
10
10
  */
11
11
  import { z } from "zod";
12
- import { AgentManifestSchema, ENVIRONMENT_MANIFEST_SCHEMA_VERSION, EnvironmentManifestSchema, } from "./contracts.js";
13
- /** The agent manifest version these documents describe. */
14
- export const AGENT_MANIFEST_SCHEMA_VERSION = 7;
12
+ import { AGENT_MANIFEST_V8_SCHEMA_VERSION, AgentManifestFileSchema, HARNESS_MANIFEST_FILE_SCHEMA_VERSION, HarnessManifestFileSchema, RUNTIME_MANIFEST_FILE_SCHEMA_VERSION, RuntimeManifestFileSchema, } from "./contracts.js";
15
13
  function document(schema, id, title) {
16
14
  const { $schema: _, ...definition } = z.toJSONSchema(schema, { io: "input", unrepresentable: "any" });
17
15
  const properties = (definition.properties ?? {});
@@ -26,21 +24,19 @@ function document(schema, id, title) {
26
24
  },
27
25
  };
28
26
  }
29
- /** The environment manifest's JSON Schema document (draft 2020-12). */
30
- export function environmentManifestJsonSchema() {
31
- const schema = document(EnvironmentManifestSchema, `environment-manifest/v${ENVIRONMENT_MANIFEST_SCHEMA_VERSION}`, `Nylorun environment manifest ${ENVIRONMENT_MANIFEST_SCHEMA_VERSION}`);
32
- const shapes = schema.properties.files.items.anyOf;
33
- const tree = shapes.find((shape) => "files" in shape.properties);
34
- shapes.push({
35
- type: "object",
36
- description: "For the CLI only: a folder, relative to this file, that `nylorun environments manifests save` uploads by hash and saves as { path, files }",
37
- properties: { path: tree?.properties.path, from: { type: "string", minLength: 1 } },
38
- required: ["path", "from"],
39
- additionalProperties: false,
40
- });
41
- return schema;
42
- }
43
- /** The agent manifest's JSON Schema document (draft 2020-12). */
27
+ /**
28
+ * Agent manifest v8's JSON Schema document (protocol 16): the authoring form, whose `harness`
29
+ * and `runtime` may each be a path to an authoring file, as `agent.manifest.json` is written.
30
+ * What the API receives has both sections written out (`AgentManifestV8Schema`).
31
+ */
44
32
  export function agentManifestJsonSchema() {
45
- return document(AgentManifestSchema, `agent-manifest/v${AGENT_MANIFEST_SCHEMA_VERSION}`, `Nylorun agent manifest ${AGENT_MANIFEST_SCHEMA_VERSION}`);
33
+ return document(AgentManifestFileSchema, `agent-manifest/v${AGENT_MANIFEST_V8_SCHEMA_VERSION}`, `Nylorun agent manifest ${AGENT_MANIFEST_V8_SCHEMA_VERSION}`);
34
+ }
35
+ /** `harness.manifest.json`'s JSON Schema document: the harness section as an authoring file. */
36
+ export function harnessManifestJsonSchema() {
37
+ return document(HarnessManifestFileSchema, `harness-manifest/v${HARNESS_MANIFEST_FILE_SCHEMA_VERSION}`, `Nylorun harness manifest ${HARNESS_MANIFEST_FILE_SCHEMA_VERSION}`);
38
+ }
39
+ /** `runtime.manifest.json`'s JSON Schema document: the runtime section as an authoring file. */
40
+ export function runtimeManifestJsonSchema() {
41
+ return document(RuntimeManifestFileSchema, `runtime-manifest/v${RUNTIME_MANIFEST_FILE_SCHEMA_VERSION}`, `Nylorun runtime manifest ${RUNTIME_MANIFEST_FILE_SCHEMA_VERSION}`);
46
42
  }