@nylorun/core 0.20.0-beta → 0.22.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 (90) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +2 -2
  3. package/dist/compatibility.d.ts +88 -13
  4. package/dist/compatibility.js +88 -13
  5. package/dist/contracts.d.ts +1328 -110
  6. package/dist/contracts.js +563 -163
  7. package/dist/define.d.ts +15 -13
  8. package/dist/define.js +11 -8
  9. package/dist/definition/approval.js +12 -14
  10. package/dist/definition/assemble.d.ts +6 -10
  11. package/dist/definition/assemble.js +48 -105
  12. package/dist/definition/bind-agent.d.ts +3 -4
  13. package/dist/definition/bind-agent.js +12 -30
  14. package/dist/definition/binding.d.ts +2 -2
  15. package/dist/definition/bound.d.ts +10 -10
  16. package/dist/definition/builder.d.ts +16 -20
  17. package/dist/definition/builder.js +29 -81
  18. package/dist/definition/code-tools.d.ts +3 -3
  19. package/dist/definition/code-tools.js +6 -21
  20. package/dist/definition/declaration.d.ts +4 -7
  21. package/dist/definition/declaration.js +29 -99
  22. package/dist/definition/{tools-capability.d.ts → deferred-tools.d.ts} +3 -13
  23. package/dist/definition/{tools-capability.js → deferred-tools.js} +2 -18
  24. package/dist/definition/delegate.d.ts +2 -4
  25. package/dist/definition/delegate.js +8 -10
  26. package/dist/definition/from.d.ts +7 -4
  27. package/dist/definition/from.js +72 -117
  28. package/dist/definition/helpers.d.ts +0 -7
  29. package/dist/definition/helpers.js +0 -5
  30. package/dist/definition/http-tool.d.ts +49 -5
  31. package/dist/definition/http-tool.js +167 -5
  32. package/dist/definition/implementations.d.ts +6 -8
  33. package/dist/definition/manifest.d.ts +11 -5
  34. package/dist/definition/manifest.js +26 -26
  35. package/dist/definition/mcp.d.ts +1 -52
  36. package/dist/definition/mcp.js +0 -52
  37. package/dist/definition/media-reference.d.ts +23 -0
  38. package/dist/definition/media-reference.js +26 -0
  39. package/dist/definition/removed.d.ts +3 -10
  40. package/dist/definition/removed.js +10 -17
  41. package/dist/definition/runtime-manifest.d.ts +30 -0
  42. package/dist/definition/runtime-manifest.js +132 -0
  43. package/dist/definition/sandbox-tools.d.ts +1 -1
  44. package/dist/definition/sandbox-tools.js +1 -1
  45. package/dist/definition/skill-tools.d.ts +13 -7
  46. package/dist/definition/skill-tools.js +23 -10
  47. package/dist/definition/trace.d.ts +18 -0
  48. package/dist/definition/trace.js +42 -0
  49. package/dist/definition/variant.d.ts +5 -4
  50. package/dist/definition/variant.js +18 -51
  51. package/dist/definition/workflow/runnable.js +1 -1
  52. package/dist/errors.d.ts +1 -1
  53. package/dist/harness-api/entries.d.ts +1 -0
  54. package/dist/harness-api/entries.js +1 -0
  55. package/dist/harness-api/gates.d.ts +1 -6
  56. package/dist/harness-api/gates.js +1 -3
  57. package/dist/harness-api/harness-api.schema.json +11 -92
  58. package/dist/harness-api/index.d.ts +2 -2
  59. package/dist/harness-api/index.js +2 -2
  60. package/dist/harness-api/mcp.d.ts +0 -4
  61. package/dist/harness-api/mcp.js +0 -2
  62. package/dist/harness-api/messages.d.ts +1 -3
  63. package/dist/harness-api/messages.js +1 -3
  64. package/dist/harness-api/schema.d.ts +5 -17
  65. package/dist/harness-api/schema.js +9 -6
  66. package/dist/index.d.ts +1 -1
  67. package/dist/manifest-schemas.d.ts +6 -0
  68. package/dist/manifest-schemas.js +46 -0
  69. package/dist/schemas/agent-manifest.schema.json +905 -0
  70. package/dist/schemas/environment-manifest.schema.json +349 -0
  71. package/dist/types/agent.d.ts +1 -1
  72. package/dist/types/manifest.d.ts +47 -24
  73. package/dist/types/model.d.ts +2 -2
  74. package/dist/types/observe.d.ts +5 -18
  75. package/dist/types/part.d.ts +25 -0
  76. package/dist/types/tool.d.ts +1 -1
  77. package/dist/types/transcript.d.ts +5 -0
  78. package/dist/utils/definition-files.d.ts +11 -6
  79. package/dist/utils/definition-files.js +19 -9
  80. package/dist/utils/runtime-tools.d.ts +19 -0
  81. package/dist/utils/runtime-tools.js +30 -0
  82. package/dist/utils/sandbox.d.ts +1 -1
  83. package/dist/utils/sandbox.js +1 -1
  84. package/package.json +9 -3
  85. package/dist/definition/capability.d.ts +0 -43
  86. package/dist/definition/capability.js +0 -82
  87. package/dist/definition/sandbox-capability.d.ts +0 -44
  88. package/dist/definition/sandbox-capability.js +0 -139
  89. package/dist/types/middleware.d.ts +0 -94
  90. /package/dist/types/{middleware.js → part.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 2).
2
+ * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 3).
3
3
  * Everything a harness sends or reads has a schema here, and the Runtime validates with the same
4
4
  * schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
5
5
  * transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
@@ -7,7 +7,7 @@
7
7
  * request hash and transcript edits. No engine and no I/O.
8
8
  *
9
9
  * Three version numbers apply: the transport (path and header, 1), the messages
10
- * (`HARNESS_API_VERSION`, 2) and the Runtime protocol, which only the Runtime's own APIs carry.
10
+ * (`HARNESS_API_VERSION`, 3) and the Runtime protocol, which only the Runtime's own APIs carry.
11
11
  */
12
12
  export * from "./messages.js";
13
13
  export { HarnessApiError } from "./errors.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 2).
2
+ * `@nylorun/core/harness-api`: the public contract between core and a harness (Harness API 3).
3
3
  * Everything a harness sends or reads has a schema here, and the Runtime validates with the same
4
4
  * schemas, so these types are the enforced ones: the frames and messages (`schema.ts`), the
5
5
  * transport and the pod join (`transport.ts`), the Model and Tool Gate bodies (`gates.ts`), the
@@ -7,7 +7,7 @@
7
7
  * request hash and transcript edits. No engine and no I/O.
8
8
  *
9
9
  * Three version numbers apply: the transport (path and header, 1), the messages
10
- * (`HARNESS_API_VERSION`, 2) and the Runtime protocol, which only the Runtime's own APIs carry.
10
+ * (`HARNESS_API_VERSION`, 3) and the Runtime protocol, which only the Runtime's own APIs carry.
11
11
  */
12
12
  export * from "./messages.js";
13
13
  export { HarnessApiError } from "./errors.js";
@@ -7,7 +7,6 @@
7
7
  import { z } from "zod";
8
8
  export declare const McpToolRecordSchema: z.ZodObject<{
9
9
  agentId: z.ZodOptional<z.ZodString>;
10
- capabilityId: z.ZodString;
11
10
  serverName: z.ZodString;
12
11
  serverToolName: z.ZodString;
13
12
  name: z.ZodString;
@@ -23,7 +22,6 @@ export declare const McpToolRecordSchema: z.ZodObject<{
23
22
  /** A server's own instructions (MCP `initialize`), for the note on its deferred tools. */
24
23
  export declare const McpServerNoteSchema: z.ZodObject<{
25
24
  agentId: z.ZodOptional<z.ZodString>;
26
- capabilityId: z.ZodString;
27
25
  serverName: z.ZodString;
28
26
  instructions: z.ZodString;
29
27
  }, z.core.$strip>;
@@ -32,7 +30,6 @@ export declare const McpSnapshotSchema: z.ZodObject<{
32
30
  manifestHash: z.ZodString;
33
31
  mcpTools: z.ZodReadonly<z.ZodArray<z.ZodObject<{
34
32
  agentId: z.ZodOptional<z.ZodString>;
35
- capabilityId: z.ZodString;
36
33
  serverName: z.ZodString;
37
34
  serverToolName: z.ZodString;
38
35
  name: z.ZodString;
@@ -47,7 +44,6 @@ export declare const McpSnapshotSchema: z.ZodObject<{
47
44
  }, z.core.$strip>>>;
48
45
  servers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
49
46
  agentId: z.ZodOptional<z.ZodString>;
50
- capabilityId: z.ZodString;
51
47
  serverName: z.ZodString;
52
48
  instructions: z.ZodString;
53
49
  }, z.core.$strip>>>>;
@@ -9,7 +9,6 @@ const jsonObject = z.record(z.string(), z.unknown());
9
9
  export const McpToolRecordSchema = z.object({
10
10
  /** The agent used as a tool that declares the server; absent for the session's root agent. */
11
11
  agentId: z.string().optional(),
12
- capabilityId: z.string(),
13
12
  serverName: z.string(),
14
13
  /** The tool's name on its server, which the call sends. */
15
14
  serverToolName: z.string(),
@@ -28,7 +27,6 @@ export const McpToolRecordSchema = z.object({
28
27
  /** A server's own instructions (MCP `initialize`), for the note on its deferred tools. */
29
28
  export const McpServerNoteSchema = z.object({
30
29
  agentId: z.string().optional(),
31
- capabilityId: z.string(),
32
30
  serverName: z.string(),
33
31
  instructions: z.string(),
34
32
  });
@@ -8,9 +8,7 @@
8
8
  */
9
9
  import type { z } from "zod";
10
10
  import type { EffectIntentSchema, IntentAnswerSchema, OutcomeAnswerSchema, RecordedOutcomeSchema, ReleaseReasonSchema, RequestTypes, RunGrantSchema, RunRoutingSchema, TraceContextSchema, TurnOutputSchema, TurnStartSchema, WorkspaceBytesCallSchema, WorkspaceCallSchema, WorkspaceListCallSchema, WorkspaceDiskCallSchema, WorkspaceRecordSchema, WorkspaceSessionSchema, coreMessages, coreRequests, harnessRequests } from "./schema.js";
11
- export declare const HARNESS_API_VERSION = 2;
12
- /** The capability id of the tools a harness declares and runs itself (`capabilities.tools`, R4.2). */
13
- export declare const HARNESS_TOOLS_CAPABILITY = "harness";
11
+ export declare const HARNESS_API_VERSION = 3;
14
12
  /** The most state a custom harness may keep per session (R4.2): its serialized JSON, in bytes. */
15
13
  export declare const MAX_HARNESS_STATE_BYTES: number;
16
14
  /** Why core stopped a run. Matches the advance's abort kinds. */
@@ -1,6 +1,4 @@
1
- export const HARNESS_API_VERSION = 2;
2
- /** The capability id of the tools a harness declares and runs itself (`capabilities.tools`, R4.2). */
3
- export const HARNESS_TOOLS_CAPABILITY = "harness";
1
+ export const HARNESS_API_VERSION = 3;
4
2
  /** The most state a custom harness may keep per session (R4.2): its serialized JSON, in bytes. */
5
3
  export const MAX_HARNESS_STATE_BYTES = 256 * 1024;
6
4
  /** Why core stopped a run. Matches the advance's abort kinds. */
@@ -75,7 +75,6 @@ export declare const EffectIntentSchema: z.ZodObject<{
75
75
  path: z.ZodString;
76
76
  delegationId: z.ZodOptional<z.ZodString>;
77
77
  }, z.core.$strict>>;
78
- capabilityId: z.ZodOptional<z.ZodString>;
79
78
  toolName: z.ZodOptional<z.ZodString>;
80
79
  path: z.ZodOptional<z.ZodString>;
81
80
  key: z.ZodOptional<z.ZodString>;
@@ -251,7 +250,6 @@ export declare const RunRoutingSchema: z.ZodObject<{
251
250
  manifestHash: z.ZodString;
252
251
  mcpTools: z.ZodReadonly<z.ZodArray<z.ZodObject<{
253
252
  agentId: z.ZodOptional<z.ZodString>;
254
- capabilityId: z.ZodString;
255
253
  serverName: z.ZodString;
256
254
  serverToolName: z.ZodString;
257
255
  name: z.ZodString;
@@ -266,7 +264,6 @@ export declare const RunRoutingSchema: z.ZodObject<{
266
264
  }, z.core.$strip>>>;
267
265
  servers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
268
266
  agentId: z.ZodOptional<z.ZodString>;
269
- capabilityId: z.ZodString;
270
267
  serverName: z.ZodString;
271
268
  instructions: z.ZodString;
272
269
  }, z.core.$strip>>>>;
@@ -303,8 +300,8 @@ export declare const TraceContextSchema: z.ZodObject<{
303
300
  }, z.core.$strict>;
304
301
  /**
305
302
  * A tool a harness runs itself (R4.2, Q3), declared in `hello`: the model may call it, and the
306
- * harness journals each call as a `tool` effect of capability `harness` (`HARNESS_TOOLS_CAPABILITY`)
307
- * with intent and outcome, like a sandbox tool, so the log records what really ran. It runs in
303
+ * harness journals each call as a `tool` effect with intent and outcome, like a sandbox tool, so
304
+ * the log records what really ran. Its name may not be one the agent or the Runtime already uses. It runs in
308
305
  * the harness's own process or pod: the egress gate is its only control.
309
306
  */
310
307
  export declare const NativeToolSchema: z.ZodObject<{
@@ -351,7 +348,6 @@ export declare const TurnStartSchema: z.ZodObject<{
351
348
  manifestHash: z.ZodString;
352
349
  mcpTools: z.ZodReadonly<z.ZodArray<z.ZodObject<{
353
350
  agentId: z.ZodOptional<z.ZodString>;
354
- capabilityId: z.ZodString;
355
351
  serverName: z.ZodString;
356
352
  serverToolName: z.ZodString;
357
353
  name: z.ZodString;
@@ -366,7 +362,6 @@ export declare const TurnStartSchema: z.ZodObject<{
366
362
  }, z.core.$strip>>>;
367
363
  servers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
368
364
  agentId: z.ZodOptional<z.ZodString>;
369
- capabilityId: z.ZodString;
370
365
  serverName: z.ZodString;
371
366
  instructions: z.ZodString;
372
367
  }, z.core.$strip>>>>;
@@ -465,7 +460,7 @@ export type RequestTypes<Schemas extends RequestSchemas> = {
465
460
  /** Requests a harness sends to core, with their answers. */
466
461
  export declare const harnessRequests: {
467
462
  /**
468
- * `capabilities.workspace` declares that the harness serves the Tenant's workspaces (F6.2):
463
+ * `features.workspace` declares that the harness serves the Tenant's workspaces (F6.2):
469
464
  * core then sends it the `workspace.*` requests. The answer names the Tenant (its workspace
470
465
  * keys are scoped by it) and the sandbox backend preference the harness selects with.
471
466
  */
@@ -474,7 +469,7 @@ export declare const harnessRequests: {
474
469
  api: z.ZodNumber;
475
470
  name: z.ZodString;
476
471
  version: z.ZodString;
477
- capabilities: z.ZodObject<{
472
+ features: z.ZodObject<{
478
473
  workspace: z.ZodOptional<z.ZodUnknown>;
479
474
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
480
475
  name: z.ZodString;
@@ -484,7 +479,7 @@ export declare const harnessRequests: {
484
479
  }, z.core.$strict>;
485
480
  }, z.core.$strict>;
486
481
  result: z.ZodObject<{
487
- api: z.ZodLiteral<2>;
482
+ api: z.ZodLiteral<3>;
488
483
  tenantId: z.ZodString;
489
484
  sandbox: z.ZodObject<{
490
485
  backend: z.ZodNullable<z.ZodString>;
@@ -543,7 +538,6 @@ export declare const harnessRequests: {
543
538
  manifestHash: z.ZodString;
544
539
  mcpTools: z.ZodReadonly<z.ZodArray<z.ZodObject<{
545
540
  agentId: z.ZodOptional<z.ZodString>;
546
- capabilityId: z.ZodString;
547
541
  serverName: z.ZodString;
548
542
  serverToolName: z.ZodString;
549
543
  name: z.ZodString;
@@ -558,7 +552,6 @@ export declare const harnessRequests: {
558
552
  }, z.core.$strip>>>;
559
553
  servers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
560
554
  agentId: z.ZodOptional<z.ZodString>;
561
- capabilityId: z.ZodString;
562
555
  serverName: z.ZodString;
563
556
  instructions: z.ZodString;
564
557
  }, z.core.$strip>>>>;
@@ -620,7 +613,6 @@ export declare const harnessRequests: {
620
613
  path: z.ZodString;
621
614
  delegationId: z.ZodOptional<z.ZodString>;
622
615
  }, z.core.$strict>>;
623
- capabilityId: z.ZodOptional<z.ZodString>;
624
616
  toolName: z.ZodOptional<z.ZodString>;
625
617
  path: z.ZodOptional<z.ZodString>;
626
618
  key: z.ZodOptional<z.ZodString>;
@@ -711,7 +703,6 @@ export declare const harnessRequests: {
711
703
  manifestHash: z.ZodString;
712
704
  mcpTools: z.ZodReadonly<z.ZodArray<z.ZodObject<{
713
705
  agentId: z.ZodOptional<z.ZodString>;
714
- capabilityId: z.ZodString;
715
706
  serverName: z.ZodString;
716
707
  serverToolName: z.ZodString;
717
708
  name: z.ZodString;
@@ -726,7 +717,6 @@ export declare const harnessRequests: {
726
717
  }, z.core.$strip>>>;
727
718
  servers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
728
719
  agentId: z.ZodOptional<z.ZodString>;
729
- capabilityId: z.ZodString;
730
720
  serverName: z.ZodString;
731
721
  instructions: z.ZodString;
732
722
  }, z.core.$strip>>>>;
@@ -739,7 +729,6 @@ export declare const harnessRequests: {
739
729
  manifestHash: z.ZodString;
740
730
  mcpTools: z.ZodReadonly<z.ZodArray<z.ZodObject<{
741
731
  agentId: z.ZodOptional<z.ZodString>;
742
- capabilityId: z.ZodString;
743
732
  serverName: z.ZodString;
744
733
  serverToolName: z.ZodString;
745
734
  name: z.ZodString;
@@ -754,7 +743,6 @@ export declare const harnessRequests: {
754
743
  }, z.core.$strip>>>;
755
744
  servers: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
756
745
  agentId: z.ZodOptional<z.ZodString>;
757
- capabilityId: z.ZodString;
758
746
  serverName: z.ZodString;
759
747
  instructions: z.ZodString;
760
748
  }, z.core.$strip>>>>;
@@ -53,7 +53,6 @@ export const EffectIntentSchema = z
53
53
  manifestHash: z.string(),
54
54
  kind: z.enum(["model", "tool", "delegation", "agent"]),
55
55
  agent: z.object({ id: z.string(), path: z.string(), delegationId: z.string().optional() }).strict().optional(),
56
- capabilityId: z.string().optional(),
57
56
  toolName: z.string().optional(),
58
57
  path: z.string().optional(),
59
58
  key: z.string().optional(),
@@ -223,13 +222,17 @@ export const TraceContextSchema = z
223
222
  .strict();
224
223
  /**
225
224
  * A tool a harness runs itself (R4.2, Q3), declared in `hello`: the model may call it, and the
226
- * harness journals each call as a `tool` effect of capability `harness` (`HARNESS_TOOLS_CAPABILITY`)
227
- * with intent and outcome, like a sandbox tool, so the log records what really ran. It runs in
225
+ * harness journals each call as a `tool` effect with intent and outcome, like a sandbox tool, so
226
+ * the log records what really ran. Its name may not be one the agent or the Runtime already uses. It runs in
228
227
  * the harness's own process or pod: the egress gate is its only control.
229
228
  */
230
229
  export const NativeToolSchema = z
231
230
  .object({
232
- name: z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,63}$/),
231
+ // `__` names an MCP server's tools, which are discovered after a turn starts.
232
+ name: z
233
+ .string()
234
+ .regex(/^[A-Za-z_][A-Za-z0-9_-]{0,63}$/)
235
+ .refine((name) => !name.includes("__"), { message: "A harness's tool name must not contain '__'" }),
233
236
  description: z.string().max(4096).optional(),
234
237
  inputSchema: z.record(z.string(), z.unknown()),
235
238
  })
@@ -320,7 +323,7 @@ const outcomeObject = z.record(z.string(), z.unknown());
320
323
  /** Requests a harness sends to core, with their answers. */
321
324
  export const harnessRequests = {
322
325
  /**
323
- * `capabilities.workspace` declares that the harness serves the Tenant's workspaces (F6.2):
326
+ * `features.workspace` declares that the harness serves the Tenant's workspaces (F6.2):
324
327
  * core then sends it the `workspace.*` requests. The answer names the Tenant (its workspace
325
328
  * keys are scoped by it) and the sandbox backend preference the harness selects with.
326
329
  */
@@ -330,7 +333,7 @@ export const harnessRequests = {
330
333
  api: z.number().int(),
331
334
  name: z.string(),
332
335
  version: z.string(),
333
- capabilities: z
336
+ features: z
334
337
  .object({ workspace: z.unknown().optional(), tools: z.array(NativeToolSchema).max(64).optional() })
335
338
  .strict(),
336
339
  })
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./contracts.js";
2
- export type * from "./types/middleware.js";
2
+ export type * from "./types/part.js";
3
3
  export type * from "./types/tool.js";
4
4
  export type * from "./types/agent.js";
5
5
  export type * from "./types/observe.js";
@@ -0,0 +1,6 @@
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). */
6
+ export declare function agentManifestJsonSchema(): Record<string, unknown>;
@@ -0,0 +1,46 @@
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.
10
+ */
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;
15
+ function document(schema, id, title) {
16
+ const { $schema: _, ...definition } = z.toJSONSchema(schema, { io: "input", unrepresentable: "any" });
17
+ const properties = (definition.properties ?? {});
18
+ return {
19
+ $schema: "https://json-schema.org/draft/2020-12/schema",
20
+ $id: `https://docs.nylorun.com/schemas/${id}.json`,
21
+ title,
22
+ ...definition,
23
+ properties: {
24
+ $schema: { type: "string", description: "This document's JSON Schema, for editors; clients drop it before saving" },
25
+ ...properties,
26
+ },
27
+ };
28
+ }
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). */
44
+ export function agentManifestJsonSchema() {
45
+ return document(AgentManifestSchema, `agent-manifest/v${AGENT_MANIFEST_SCHEMA_VERSION}`, `Nylorun agent manifest ${AGENT_MANIFEST_SCHEMA_VERSION}`);
46
+ }