@nylorun/runtime 0.30.0-beta → 0.32.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.32.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - b3dad06: Both ends of the agent folder loop (track T7).
8
+
9
+ - `nylorun init <path>` names the agent after the path's last segment (`init agents/hello`). `--example` adds `tools/get_order.json`, `mcp.json` (a `Bearer ${ORDERS_MCP_TOKEN}` header) and `triggers/new-order.md`, explained in the folder's README.md, and the result passes `nylorun check`. The first run in a project (the nearest directory with `.git`) writes `.gitattributes` (`* text=auto eol=lf`), ignores `.nylorun/credentials.json` in `.gitignore`, and maps the folder files to their JSON Schemas in `.vscode/settings.json`, merged into an existing file. Its hint names `apply --agent` and `chat`.
10
+ - `nylorun apply --agent [<id>]` makes the Agent from the manifest after a save (or on an unchanged one), or moves it, as `nylorun agents put` does, and prints what it needs a person for.
11
+ - `nylorun apply --watch [--save]` checks and plans again on each change to the folders (and the files their `runtime.json` extends); it saves only with `--save`.
12
+ - A plan's change to the instructions prints their text diff, `-` and `+` lines.
13
+ - `nylorun chat <agent> [--session <id>] [--message <text>]` opens or reuses a session, sends `--message` or each line of standard input, and prints the reply as it comes.
14
+ - `nylorun check --json` prints `{ folders: [{ path, ok, manifest?, diagnostics }] }` for CI, with the same exit codes. `check` says "1 file", and `nylorun --version` prints the version.
15
+ - `packFolder` (`@nylorun/agents`) leaves out what the folder's `.nyloignore` names (gitignore rules), and resolves `extends` in `runtime.json`: the packed file is the merge, the folder's own keys winning, with `.nylorun/origin.json` naming the files it came from; a missing file or a cycle is a `FolderError`. `ignoreMatcher` is exported.
16
+ - `session.approve(id, approved)` and `session.respond(id, value)` take no options: each makes its own idempotency key.
17
+ - The Runtime's Agent view names each required secret of the version it runs that has no value, as an attention item (`secret_unset: required secret ORDERS_TOKEN unset`, state `input_required`), until it is set.
18
+ - The compiler's refusal of an unresolved `extends` says to resolve it before uploading.
19
+
20
+ - b3dad06: Compare two versions' agent folders, and set what a folder may hold per Tenant (track T7).
21
+
22
+ - **`GET /v1/agent-manifests/{name}/source/diff?from=<v>&to=<v>`** answers the files added, removed and changed (by SHA-256) from one version's source to another's, each list sorted by path, and how many stayed the same (`AgentManifestSourceDiff` in `@nylorun/core/contracts`). A version saved as JSON has no source (`404`); a `from` or `to` that is not a version number is `400`. `client.agentManifests.sourceDiff(name, from, to)` in `@nylorun/agents` calls it.
23
+ - **Folder limits are Tenant settings**: the Runtime limits `folderFiles` (2,000), `folderBytes` (50 MiB) and `folderTextFileBytes` (1 MiB), T6's fixed values, set with `PUT /v1/tenant/limits` like the others. A folder save with more files or bytes is `413 limit_exceeded` (`details.limit` names the limit), and the compiler holds each Markdown or JSON file to `folderTextFileBytes` (`422 folder_invalid`).
24
+ - `compileAgentFolder({ entries, files, name, limits })` takes the limits as an optional input (`AgentFolderLimits`); each left out is `AGENT_FOLDER_LIMITS`'.
25
+ - `@nylorun/agents` also exports the types `AgentManifestSource`, `AgentManifestSourceDiff`, `AgentManifestSourceSummary` and `AgentFolderDiagnostic`, and `AGENT_FOLDER_MEDIA_TYPE`.
26
+
27
+ ### Patch Changes
28
+
29
+ - 498d972: `nylorun check --fix` makes the edits the compiler's diagnostics carry (track T7). A diagnostic one edit fixes has a `fix` (`AgentFolderFix`, in `AgentFolderDiagnostic` and the Runtime API's): `rename_key` for an unknown key with exactly one did-you-mean (in `AGENT.md`, a trigger, a `SKILL.md`, a tool file, `runtime.json`, `mcp.json`, `flow.json` and a JSON Schema's keywords), at its line and column, and none when two keys are as close or the key it would be is already there; `crlf` for a file with CRLF line ends, which is now a `crlf` note (it is read as LF, as before); and `move_skill_secrets` for `secrets` in a root skill's `SKILL.md`, when `AGENT.md` lists none for the skill, or lists them all. Messages, manifests and hashes are unchanged. `applyFolderFixes` in `@nylorun/core/folder` makes them on text: the key token renamed with every other byte kept, LF line ends, and the secrets moved to `AGENT.md`'s `skills` block as `migrate folder` writes it, skipping (with why) a fix whose text is no longer where it was.
30
+
31
+ `nylorun check` marks each fixable problem `(fixable with --fix)` and writes nothing. `check --fix` makes the edits in the folder's files, prints each change by file, and checks again until nothing is left to fix; it leaves a file whose bytes changed since it was checked (writing nothing when one changes while it fixes), and a `runtime.json` that `extends` another. `check --json` gives each diagnostic's `fix`, and with `--fix` each folder's `fixed` and `unfixed`.
32
+
33
+ - Pin core to the tested release.
34
+ - Pin harness to the tested release.
35
+ - Updated dependencies [498d972]
36
+ - Updated dependencies [d23304e]
37
+ - Updated dependencies [b3dad06]
38
+ - Updated dependencies [b3dad06]
39
+ - Updated dependencies [b3dad06]
40
+ - Updated dependencies [498d972]
41
+ - Updated dependencies [b3dad06]
42
+ - Updated dependencies
43
+ - @nylorun/core@0.28.0-beta
44
+ - @nylorun/harness@0.29.4-beta
45
+
46
+ ## 0.31.0-beta
47
+
48
+ ### Minor Changes
49
+
50
+ - aaa079f: The Runtime saves agent folders (track T6). `PUT /v1/agent-manifests/{name}` with `Content-Type: application/vnd.nylorun.folder+json` takes a folder by hash (`PutAgentFolderRequestSchema`): the files uploaded first, the Markdown and JSON read back from the definition file store and compiled with `compileAgentFolder`. A folder that does not compile is `422 folder_invalid`, with the compiler's diagnostics by file, line and column in `details.diagnostics`. A save keeps the folder as the version's source: `AgentManifestView.source` summarises it, `GET /v1/agent-manifests/{name}/versions/{v}/source` lists its files and `.../source/files/{path}` returns one. With `?dryRun=true` the plan adds the compiled `manifest`, the `diagnostics` and the `compiler`. A folder whose manifest is unchanged saves no version, and says so (`source_not_saved`). New Host feature `agent-folders`; new error code `folder_invalid`.
51
+
52
+ ### Patch Changes
53
+
54
+ - Pin core to the tested release.
55
+ - Pin harness to the tested release.
56
+ - Updated dependencies [9ba6634]
57
+ - Updated dependencies [aaa079f]
58
+ - Updated dependencies
59
+ - @nylorun/core@0.27.0-beta
60
+ - @nylorun/harness@0.29.3-beta
61
+
3
62
  ## 0.30.0-beta
4
63
 
5
64
  ### Minor Changes
@@ -21,6 +21,7 @@ export declare const Rejected: z.ZodObject<{
21
21
  credential_rejected: "credential_rejected";
22
22
  credential_required: "credential_required";
23
23
  definition_files_missing: "definition_files_missing";
24
+ folder_invalid: "folder_invalid";
24
25
  harness_mismatch: "harness_mismatch";
25
26
  host_rejected: "host_rejected";
26
27
  incompatible_host: "incompatible_host";
@@ -517,6 +518,56 @@ export declare const PutAgentManifestRequest: z.ZodObject<{
517
518
  }, z.core.$strict>>;
518
519
  requestId: z.ZodOptional<z.ZodString>;
519
520
  }, z.core.$strict>;
521
+ export declare const PutAgentFolderRequest: z.ZodObject<{
522
+ requestId: z.ZodOptional<z.ZodString>;
523
+ format: z.ZodLiteral<"nylorun.folder.v2">;
524
+ entries: z.ZodArray<z.ZodObject<{
525
+ path: z.ZodString;
526
+ size: z.ZodNumber;
527
+ sha256: z.ZodString;
528
+ contentType: z.ZodOptional<z.ZodString>;
529
+ mode: z.ZodOptional<z.ZodNumber>;
530
+ }, z.core.$strict>>;
531
+ }, z.core.$strict>;
532
+ export declare const AgentManifestSource: z.ZodObject<{
533
+ name: z.ZodString;
534
+ version: z.ZodNumber;
535
+ compiler: z.ZodString;
536
+ files: z.ZodNumber;
537
+ bytes: z.ZodNumber;
538
+ entries: z.ZodArray<z.ZodObject<{
539
+ path: z.ZodString;
540
+ size: z.ZodNumber;
541
+ sha256: z.ZodString;
542
+ }, z.core.$strict>>;
543
+ }, z.core.$strict>;
544
+ export declare const AgentManifestSourceDiff: z.ZodObject<{
545
+ name: z.ZodString;
546
+ from: z.ZodNumber;
547
+ to: z.ZodNumber;
548
+ added: z.ZodArray<z.ZodObject<{
549
+ path: z.ZodString;
550
+ size: z.ZodNumber;
551
+ sha256: z.ZodString;
552
+ }, z.core.$strict>>;
553
+ removed: z.ZodArray<z.ZodObject<{
554
+ path: z.ZodString;
555
+ size: z.ZodNumber;
556
+ sha256: z.ZodString;
557
+ }, z.core.$strict>>;
558
+ changed: z.ZodArray<z.ZodObject<{
559
+ path: z.ZodString;
560
+ from: z.ZodObject<{
561
+ size: z.ZodNumber;
562
+ sha256: z.ZodString;
563
+ }, z.core.$strict>;
564
+ to: z.ZodObject<{
565
+ size: z.ZodNumber;
566
+ sha256: z.ZodString;
567
+ }, z.core.$strict>;
568
+ }, z.core.$strict>>;
569
+ unchanged: z.ZodNumber;
570
+ }, z.core.$strict>;
520
571
  export declare const AgentManifestView: z.ZodObject<{
521
572
  name: z.ZodString;
522
573
  version: z.ZodNumber;
@@ -622,6 +673,11 @@ export declare const AgentManifestView: z.ZodObject<{
622
673
  }, z.core.$strict>;
623
674
  createdAt: z.ZodString;
624
675
  agents: z.ZodNumber;
676
+ source: z.ZodOptional<z.ZodObject<{
677
+ compiler: z.ZodString;
678
+ files: z.ZodNumber;
679
+ bytes: z.ZodNumber;
680
+ }, z.core.$strict>>;
625
681
  }, z.core.$strict>;
626
682
  export declare const AgentManifestPlan: z.ZodObject<{
627
683
  name: z.ZodString;
@@ -654,6 +710,133 @@ export declare const AgentManifestPlan: z.ZodObject<{
654
710
  nextStart: z.ZodNumber;
655
711
  secrets: z.ZodNumber;
656
712
  }, z.core.$strict>;
713
+ manifest: z.ZodOptional<z.ZodObject<{
714
+ manifestSchemaVersion: z.ZodLiteral<8>;
715
+ name: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
716
+ description: z.ZodOptional<z.ZodString>;
717
+ metadata: z.ZodOptional<z.ZodType<import("@nylorun/core/define").JsonObject, unknown, z.core.$ZodTypeInternals<import("@nylorun/core/define").JsonObject, unknown>>>;
718
+ harness: z.ZodUnion<readonly [z.ZodType<import("@nylorun/core/contracts").WorkflowHarnessSection, unknown, z.core.$ZodTypeInternals<import("@nylorun/core/contracts").WorkflowHarnessSection, unknown>>, z.ZodType<import("@nylorun/core/contracts").AgentHarnessSection, unknown, z.core.$ZodTypeInternals<import("@nylorun/core/contracts").AgentHarnessSection, unknown>>]>;
719
+ runtime: z.ZodOptional<z.ZodObject<{
720
+ kind: z.ZodEnum<{
721
+ none: "none";
722
+ pod: "pod";
723
+ virtual: "virtual";
724
+ }>;
725
+ image: z.ZodOptional<z.ZodString>;
726
+ resources: z.ZodOptional<z.ZodObject<{
727
+ cpus: z.ZodOptional<z.ZodNumber>;
728
+ memory: z.ZodOptional<z.ZodString>;
729
+ }, z.core.$strict>>;
730
+ storage: z.ZodOptional<z.ZodString>;
731
+ network: z.ZodOptional<z.ZodObject<{
732
+ allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
733
+ }, z.core.$strict>>;
734
+ lifecycle: z.ZodOptional<z.ZodObject<{
735
+ idle: z.ZodOptional<z.ZodString>;
736
+ deleteAfter: z.ZodOptional<z.ZodString>;
737
+ }, z.core.$strict>>;
738
+ setup: z.ZodOptional<z.ZodArray<z.ZodObject<{
739
+ command: z.ZodString;
740
+ cwd: z.ZodOptional<z.ZodString>;
741
+ timeout: z.ZodOptional<z.ZodString>;
742
+ }, z.core.$strict>>>;
743
+ files: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
744
+ artifactId: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
745
+ version: z.ZodNumber;
746
+ path: z.ZodString;
747
+ }, z.core.$strict>, z.ZodObject<{
748
+ path: z.ZodString;
749
+ files: z.ZodRecord<z.ZodString, z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
750
+ }, z.core.$strict>]>>>;
751
+ limits: z.ZodOptional<z.ZodObject<{
752
+ artifacts: z.ZodOptional<z.ZodObject<{
753
+ fileBytes: z.ZodOptional<z.ZodNumber>;
754
+ totalBytes: z.ZodOptional<z.ZodNumber>;
755
+ }, z.core.$strict>>;
756
+ skills: z.ZodOptional<z.ZodObject<{
757
+ totalBytes: z.ZodOptional<z.ZodNumber>;
758
+ }, z.core.$strict>>;
759
+ disk: z.ZodOptional<z.ZodObject<{
760
+ versionBytes: z.ZodOptional<z.ZodNumber>;
761
+ versionEntries: z.ZodOptional<z.ZodNumber>;
762
+ }, z.core.$strict>>;
763
+ }, z.core.$strict>>;
764
+ secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
765
+ required: z.ZodOptional<z.ZodBoolean>;
766
+ description: z.ZodOptional<z.ZodString>;
767
+ type: z.ZodLiteral<"environment_secret">;
768
+ allowedHosts: z.ZodArray<z.ZodString>;
769
+ inject: z.ZodOptional<z.ZodObject<{
770
+ header: z.ZodString;
771
+ format: z.ZodString;
772
+ }, z.core.$strict>>;
773
+ }, z.core.$strict>, z.ZodObject<{
774
+ required: z.ZodOptional<z.ZodBoolean>;
775
+ description: z.ZodOptional<z.ZodString>;
776
+ type: z.ZodLiteral<"environment_variable">;
777
+ }, z.core.$strict>, z.ZodObject<{
778
+ via: z.ZodOptional<z.ZodString>;
779
+ identity: z.ZodOptional<z.ZodObject<{
780
+ header: z.ZodString;
781
+ }, z.core.$strict>>;
782
+ required: z.ZodOptional<z.ZodBoolean>;
783
+ description: z.ZodOptional<z.ZodString>;
784
+ type: z.ZodLiteral<"bearer">;
785
+ url: z.ZodString;
786
+ }, z.core.$strict>, z.ZodObject<{
787
+ via: z.ZodOptional<z.ZodString>;
788
+ identity: z.ZodOptional<z.ZodObject<{
789
+ header: z.ZodString;
790
+ }, z.core.$strict>>;
791
+ required: z.ZodOptional<z.ZodBoolean>;
792
+ description: z.ZodOptional<z.ZodString>;
793
+ type: z.ZodLiteral<"headers">;
794
+ url: z.ZodString;
795
+ }, z.core.$strict>], "type">>>;
796
+ triggers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
797
+ schedule: z.ZodOptional<z.ZodString>;
798
+ timezone: z.ZodOptional<z.ZodString>;
799
+ at: z.ZodOptional<z.ZodISODateTime>;
800
+ webhook: z.ZodOptional<z.ZodEnum<{
801
+ "standard-webhooks": "standard-webhooks";
802
+ }>>;
803
+ session: z.ZodString;
804
+ prompt: z.ZodString;
805
+ }, z.core.$strict>>>;
806
+ selfWake: z.ZodOptional<z.ZodBoolean>;
807
+ }, z.core.$strict>>;
808
+ }, z.core.$strict>>;
809
+ diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
810
+ severity: z.ZodEnum<{
811
+ error: "error";
812
+ info: "info";
813
+ note: "note";
814
+ warning: "warning";
815
+ }>;
816
+ code: z.ZodString;
817
+ message: z.ZodString;
818
+ file: z.ZodOptional<z.ZodString>;
819
+ line: z.ZodOptional<z.ZodNumber>;
820
+ column: z.ZodOptional<z.ZodNumber>;
821
+ pointer: z.ZodOptional<z.ZodString>;
822
+ fix: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
823
+ kind: z.ZodLiteral<"rename_key">;
824
+ file: z.ZodString;
825
+ line: z.ZodNumber;
826
+ column: z.ZodNumber;
827
+ from: z.ZodString;
828
+ to: z.ZodString;
829
+ }, z.core.$strict>, z.ZodObject<{
830
+ kind: z.ZodLiteral<"crlf">;
831
+ file: z.ZodString;
832
+ }, z.core.$strict>, z.ZodObject<{
833
+ kind: z.ZodLiteral<"move_skill_secrets">;
834
+ file: z.ZodString;
835
+ skill: z.ZodString;
836
+ secrets: z.ZodArray<z.ZodString>;
837
+ }, z.core.$strict>], "kind">>;
838
+ }, z.core.$strict>>>;
839
+ compiler: z.ZodOptional<z.ZodString>;
657
840
  }, z.core.$strict>;
658
841
  export declare const SaveAgentManifestResponse: z.ZodObject<{
659
842
  manifest: z.ZodObject<{
@@ -761,12 +944,47 @@ export declare const SaveAgentManifestResponse: z.ZodObject<{
761
944
  }, z.core.$strict>;
762
945
  createdAt: z.ZodString;
763
946
  agents: z.ZodNumber;
947
+ source: z.ZodOptional<z.ZodObject<{
948
+ compiler: z.ZodString;
949
+ files: z.ZodNumber;
950
+ bytes: z.ZodNumber;
951
+ }, z.core.$strict>>;
764
952
  }, z.core.$strict>;
765
953
  unchanged: z.ZodBoolean;
766
954
  warnings: z.ZodArray<z.ZodObject<{
767
955
  code: z.ZodString;
768
956
  message: z.ZodString;
769
957
  }, z.core.$strict>>;
958
+ diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
959
+ severity: z.ZodEnum<{
960
+ error: "error";
961
+ info: "info";
962
+ note: "note";
963
+ warning: "warning";
964
+ }>;
965
+ code: z.ZodString;
966
+ message: z.ZodString;
967
+ file: z.ZodOptional<z.ZodString>;
968
+ line: z.ZodOptional<z.ZodNumber>;
969
+ column: z.ZodOptional<z.ZodNumber>;
970
+ pointer: z.ZodOptional<z.ZodString>;
971
+ fix: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
972
+ kind: z.ZodLiteral<"rename_key">;
973
+ file: z.ZodString;
974
+ line: z.ZodNumber;
975
+ column: z.ZodNumber;
976
+ from: z.ZodString;
977
+ to: z.ZodString;
978
+ }, z.core.$strict>, z.ZodObject<{
979
+ kind: z.ZodLiteral<"crlf">;
980
+ file: z.ZodString;
981
+ }, z.core.$strict>, z.ZodObject<{
982
+ kind: z.ZodLiteral<"move_skill_secrets">;
983
+ file: z.ZodString;
984
+ skill: z.ZodString;
985
+ secrets: z.ZodArray<z.ZodString>;
986
+ }, z.core.$strict>], "kind">>;
987
+ }, z.core.$strict>>>;
770
988
  }, z.core.$strict>;
771
989
  export declare const ListAgentManifestsResponse: z.ZodObject<{
772
990
  manifests: z.ZodArray<z.ZodObject<{
@@ -874,6 +1092,11 @@ export declare const ListAgentManifestsResponse: z.ZodObject<{
874
1092
  }, z.core.$strict>;
875
1093
  createdAt: z.ZodString;
876
1094
  agents: z.ZodNumber;
1095
+ source: z.ZodOptional<z.ZodObject<{
1096
+ compiler: z.ZodString;
1097
+ files: z.ZodNumber;
1098
+ bytes: z.ZodNumber;
1099
+ }, z.core.$strict>>;
877
1100
  }, z.core.$strict>>;
878
1101
  }, z.core.$strict>;
879
1102
  export declare const AgentManifestVersions: z.ZodObject<{
@@ -1753,6 +1976,9 @@ export declare const PutTenantLimitsRequest: z.ZodObject<{
1753
1976
  flowConcurrency: z.ZodOptional<z.ZodNumber>;
1754
1977
  flowMapItems: z.ZodOptional<z.ZodNumber>;
1755
1978
  flowLoopIterations: z.ZodOptional<z.ZodNumber>;
1979
+ folderFiles: z.ZodOptional<z.ZodNumber>;
1980
+ folderBytes: z.ZodOptional<z.ZodNumber>;
1981
+ folderTextFileBytes: z.ZodOptional<z.ZodNumber>;
1756
1982
  }, z.core.$strict>>;
1757
1983
  requestId: z.ZodOptional<z.ZodString>;
1758
1984
  }, z.core.$strict>;
@@ -1828,6 +2054,9 @@ export declare const TenantLimitsView: z.ZodObject<{
1828
2054
  flowConcurrency: z.ZodNumber;
1829
2055
  flowMapItems: z.ZodNumber;
1830
2056
  flowLoopIterations: z.ZodNumber;
2057
+ folderFiles: z.ZodNumber;
2058
+ folderBytes: z.ZodNumber;
2059
+ folderTextFileBytes: z.ZodNumber;
1831
2060
  }, z.core.$strict>;
1832
2061
  }, z.core.$strict>;
1833
2062
  export declare const ArtifactTree: z.ZodObject<{
@@ -5,7 +5,7 @@
5
5
  * global registry.
6
6
  */
7
7
  import { z } from "zod";
8
- import { QueuedResponseSchema, TriggerListSchema, MemoryListSchema, MemorySchema, PutMemoryRequestSchema, MemoryVersionPageSchema, MemoryVersionDetailSchema, TriggerRunPageSchema, RunTriggerResponseSchema, WebhookSecretResponseSchema, WebhookAcceptedResponseSchema, AgentManifestV8Schema, EnvironmentSecretSlotsSchema, DeleteAgentManifestResponseSchema, AgentManifestPlanSchema, AgentManifestVersionsSchema, AgentManifestViewSchema, ListAgentManifestsResponseSchema, PutAgentManifestRequestSchema, PutAgentSecretValueRequestSchema, SaveAgentManifestResponseSchema, SessionListItemSchema, ModelCallSchema, SessionPageSchema, SessionManifestViewSchema, HistoryPageSchema, SessionUsageTotalsSchema, ModelCallsPageSchema, ModelCallExportPageSchema, AgentPageSchema, ToolCallSchema, ToolCallsPageSchema, TurnTraceSchema, JwksSchema, SigningKeyListSchema, SigningKeyViewSchema, RotateSigningKeysRequestSchema, RevokeSigningKeyRequestSchema, MeResponseSchema, TenantStatusSchema, ResetTenantRequestSchema, ResetTenantResponseSchema, SeedTenantConfigRequestSchema, SeedTenantConfigResponseSchema, HostModelCatalogSchema, TenantSandboxViewSchema, ModelUsageTotalsSchema, ModelBudgetsSchema, PutModelBudgetsRequestSchema, ToolPolicySchema, PutToolPolicyRequestSchema, PutModelInputsRequestSchema, ModelInputsViewSchema, PutTenantEnvironmentsRequestSchema, ListProvidersResponseSchema, HostModelViewSchema, PutHostModelRequestSchema, SelectHostModelRequestSchema, PutAgentSecretRequestSchema, AgentSecretViewSchema, ListAgentSecretsResponseSchema, McpPreviewRequestSchema, McpPreviewSchema, CredentialCoverageRequestSchema, CredentialCoverageSchema, DeletedResponseSchema, ListSessionsResponseSchema, LiveEventSchema, PutAgentRequestSchema, PutSessionRequestSchema, SessionItemsResponseSchema, SessionViewSchema, StreamClosedFrameSchema, AcceptedResponseSchema, SandboxToolOutcomeSchema, AgentViewSchema, AgentSnapshotSchema, RestoreAgentRequestSchema, ForkAgentRequestSchema, AgentForkPlanSchema, ForkAgentResponseSchema, PutAgentDryRunResponseSchema, RestartAgentRequestSchema, AgentRestoreSchema, AgentDiskVersionsSchema, ListAgentsResponseSchema, DeleteAgentResponseSchema, ListAgentEventsResponseSchema, ArtifactViewSchema, ArtifactListItemSchema, ArtifactPageSchema, ArtifactVersionViewSchema, ListArtifactsResponseSchema, UploadArtifactResponseSchema, DefinitionFileViewSchema, DeleteArtifactResponseSchema, CreateArtifactLinkRequestSchema, ArtifactLinkSchema, PutTenantArtifactsRequestSchema, PutTenantSkillsRequestSchema, PutTenantLimitsRequestSchema, TenantLimitsViewSchema, TenantArtifactsViewSchema, TenantSkillsViewSchema, ArtifactTreeSchema, ArtifactDiffSchema, SessionCommandSchema, ListOperatorKeysResponseSchema, PutOperatorKeyResponseSchema, DeleteOperatorKeyResponseSchema, OperatorKeySchema, ProtocolRejectedResponseSchema, RejectedResponseSchema, EVENT_SCHEMAS, EVENT_TYPES, } from "@nylorun/core/contracts";
8
+ import { QueuedResponseSchema, TriggerListSchema, MemoryListSchema, MemorySchema, PutMemoryRequestSchema, MemoryVersionPageSchema, MemoryVersionDetailSchema, TriggerRunPageSchema, RunTriggerResponseSchema, WebhookSecretResponseSchema, WebhookAcceptedResponseSchema, AgentManifestV8Schema, EnvironmentSecretSlotsSchema, DeleteAgentManifestResponseSchema, AgentManifestPlanSchema, AgentManifestVersionsSchema, AgentManifestViewSchema, ListAgentManifestsResponseSchema, PutAgentManifestRequestSchema, PutAgentFolderRequestSchema, AgentManifestSourceSchema, AgentManifestSourceDiffSchema, PutAgentSecretValueRequestSchema, SaveAgentManifestResponseSchema, SessionListItemSchema, ModelCallSchema, SessionPageSchema, SessionManifestViewSchema, HistoryPageSchema, SessionUsageTotalsSchema, ModelCallsPageSchema, ModelCallExportPageSchema, AgentPageSchema, ToolCallSchema, ToolCallsPageSchema, TurnTraceSchema, JwksSchema, SigningKeyListSchema, SigningKeyViewSchema, RotateSigningKeysRequestSchema, RevokeSigningKeyRequestSchema, MeResponseSchema, TenantStatusSchema, ResetTenantRequestSchema, ResetTenantResponseSchema, SeedTenantConfigRequestSchema, SeedTenantConfigResponseSchema, HostModelCatalogSchema, TenantSandboxViewSchema, ModelUsageTotalsSchema, ModelBudgetsSchema, PutModelBudgetsRequestSchema, ToolPolicySchema, PutToolPolicyRequestSchema, PutModelInputsRequestSchema, ModelInputsViewSchema, PutTenantEnvironmentsRequestSchema, ListProvidersResponseSchema, HostModelViewSchema, PutHostModelRequestSchema, SelectHostModelRequestSchema, PutAgentSecretRequestSchema, AgentSecretViewSchema, ListAgentSecretsResponseSchema, McpPreviewRequestSchema, McpPreviewSchema, CredentialCoverageRequestSchema, CredentialCoverageSchema, DeletedResponseSchema, ListSessionsResponseSchema, LiveEventSchema, PutAgentRequestSchema, PutSessionRequestSchema, SessionItemsResponseSchema, SessionViewSchema, StreamClosedFrameSchema, AcceptedResponseSchema, SandboxToolOutcomeSchema, AgentViewSchema, AgentSnapshotSchema, RestoreAgentRequestSchema, ForkAgentRequestSchema, AgentForkPlanSchema, ForkAgentResponseSchema, PutAgentDryRunResponseSchema, RestartAgentRequestSchema, AgentRestoreSchema, AgentDiskVersionsSchema, ListAgentsResponseSchema, DeleteAgentResponseSchema, ListAgentEventsResponseSchema, ArtifactViewSchema, ArtifactListItemSchema, ArtifactPageSchema, ArtifactVersionViewSchema, ListArtifactsResponseSchema, UploadArtifactResponseSchema, DefinitionFileViewSchema, DeleteArtifactResponseSchema, CreateArtifactLinkRequestSchema, ArtifactLinkSchema, PutTenantArtifactsRequestSchema, PutTenantSkillsRequestSchema, PutTenantLimitsRequestSchema, TenantLimitsViewSchema, TenantArtifactsViewSchema, TenantSkillsViewSchema, ArtifactTreeSchema, ArtifactDiffSchema, SessionCommandSchema, ListOperatorKeysResponseSchema, PutOperatorKeyResponseSchema, DeleteOperatorKeyResponseSchema, OperatorKeySchema, ProtocolRejectedResponseSchema, RejectedResponseSchema, EVENT_SCHEMAS, EVENT_TYPES, } from "@nylorun/core/contracts";
9
9
  function named(id, schema) {
10
10
  return schema.meta({ id });
11
11
  }
@@ -21,6 +21,9 @@ export const AgentView = named("AgentView", AgentViewSchema);
21
21
  export const EnvironmentSecretSlots = named("EnvironmentSecretSlots", EnvironmentSecretSlotsSchema);
22
22
  export const AgentManifest = named("AgentManifest", AgentManifestV8Schema);
23
23
  export const PutAgentManifestRequest = named("PutAgentManifestRequest", PutAgentManifestRequestSchema);
24
+ export const PutAgentFolderRequest = named("PutAgentFolderRequest", PutAgentFolderRequestSchema);
25
+ export const AgentManifestSource = named("AgentManifestSource", AgentManifestSourceSchema);
26
+ export const AgentManifestSourceDiff = named("AgentManifestSourceDiff", AgentManifestSourceDiffSchema);
24
27
  export const AgentManifestView = named("AgentManifestView", AgentManifestViewSchema);
25
28
  export const AgentManifestPlan = named("AgentManifestPlan", AgentManifestPlanSchema);
26
29
  export const SaveAgentManifestResponse = named("SaveAgentManifestResponse", SaveAgentManifestResponseSchema);
@@ -3,7 +3,9 @@
3
3
  * versioned documents Agents are made from, each with a harness and a runtime section. A save
4
4
  * moves every Agent that tracks the manifest to the new version; a pinned one stays. Reading needs `agents:read` (or a write scope), saving and deleting
5
5
  * `agent-manifests:write`, from any client (Q12). A token caller reaches none: a manifest holds
6
- * an agent's instructions, tools and servers.
6
+ * an agent's instructions, tools and servers. A save may send an agent folder by hash instead of
7
+ * the manifest (track T6): the Runtime compiles it and keeps it as the version's source, and
8
+ * `source/diff` compares two versions' sources (track T7).
7
9
  */
8
10
  import type { OpenAPIHono } from "@hono/zod-openapi";
9
11
  import type { TenantEnv } from "../app.js";
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
- import { isAgentManifestName, PutAgentManifestRequestSchema } from "@nylorun/core/contracts";
3
- import { AgentManifestPlan, AgentManifestVersions, AgentManifestView, DeleteAgentManifestResponse, ListAgentManifestsResponse, PutAgentManifestRequest, SaveAgentManifestResponse, } from "../../components.js";
2
+ import { AGENT_FOLDER_MEDIA_TYPE, contentTypeFor, isAgentManifestName, PutAgentFolderRequestSchema, PutAgentManifestRequestSchema, } from "@nylorun/core/contracts";
3
+ import { AgentManifestPlan, AgentManifestSource, AgentManifestSourceDiff, AgentManifestVersions, AgentManifestView, DeleteAgentManifestResponse, ListAgentManifestsResponse, PutAgentFolderRequest, PutAgentManifestRequest, SaveAgentManifestResponse, } from "../../components.js";
4
4
  import { requirePrincipal } from "../../../tenant/auth.js";
5
5
  import { fail } from "../../../tenant/http.js";
6
- import { agentManifestVersions, deleteAgentManifest, getAgentManifest, listAgentManifests, saveAgentManifest, } from "../../../tenant/agent-manifests.js";
6
+ import { agentManifestVersions, deleteAgentManifest, diffAgentManifestSources, getAgentManifest, getAgentManifestSource, listAgentManifests, readAgentManifestSourceFile, saveAgentFolder, saveAgentManifest, } from "../../../tenant/agent-manifests.js";
7
7
  import { readJson } from "../body.js";
8
8
  import { tenantRoute } from "../define.js";
9
9
  import { jsonResponse } from "../respond.js";
@@ -59,13 +59,19 @@ export function agentManifestRoutes(api) {
59
59
  path: "/v1/agent-manifests/{name}",
60
60
  tags: ["Agent manifests"],
61
61
  summary: "Save an agent manifest",
62
- description: "Saves the manifest as its next version, or answers the latest unchanged when nothing differs. Every Agent that tracks the manifest moves to the new version: at once, at its pod's next start for a runtime change a pod applies only when it starts, or once a required secret the version adds is set; a pinned one stays, and so does one whose kind, harness or storage the version changes (`agents_behind`). The Runtime checks the harness and runtime sections against each other: a custom harness needs a pod with an image, every credential the harness names is a declared slot of the right type, and the runtime's kind gives the loop the sandbox it needs; every gap is named in one `422 manifest_inconsistent` (`details.gaps`). `If-Match: <version>` refuses the save with `412 manifest_changed` when the latest version is no longer the one you read (`0` for a manifest that does not exist yet). With `?dryRun=true` the answer is the plan: the changes by section, every reason a save would be refused (`errors`, the gaps first), warnings, the Agents it would move (`moves`) and how many stay on older versions (`behind`); nothing is saved. Clients compose the authoring files and drop their `$schema` before they send one document.",
62
+ description: "Saves the manifest as its next version, or answers the latest unchanged when nothing differs. Every Agent that tracks the manifest moves to the new version: at once, at its pod's next start for a runtime change a pod applies only when it starts, or once a required secret the version adds is set; a pinned one stays, and so does one whose kind, harness or storage the version changes (`agents_behind`). The Runtime checks the harness and runtime sections against each other: a custom harness needs a pod with an image, every credential the harness names is a declared slot of the right type, and the runtime's kind gives the loop the sandbox it needs; every gap is named in one `422 manifest_inconsistent` (`details.gaps`). `If-Match: <version>` refuses the save with `412 manifest_changed` when the latest version is no longer the one you read (`0` for a manifest that does not exist yet). With `?dryRun=true` the answer is the plan: the changes by section, every reason a save would be refused (`errors`, the gaps first), warnings, the Agents it would move (`moves`) and how many stay on older versions (`behind`); nothing is saved. Clients compose the authoring files and drop their `$schema` before they send one document. With `Content-Type: application/vnd.nylorun.folder+json` the body is an agent folder by hash instead (feature `agent-folders`): every file uploaded first with `PUT /v1/files/sha256:<hex>`, the Runtime compiles it with `@nylorun/core/folder`, a folder that does not compile is `422 folder_invalid` (`details.diagnostics`, each with its file, line and column), and the version keeps the folder as its source; the plan adds the compiled `manifest`, the compiler's `diagnostics` and `compiler`.",
63
63
  request: {
64
64
  params: namePath,
65
65
  query: z.object({
66
66
  dryRun: z.enum(["true", "false"]).optional().meta({ description: "`true`: answer the plan and save nothing" }),
67
67
  }),
68
- body: { required: true, content: { "application/json": { schema: PutAgentManifestRequest } } },
68
+ body: {
69
+ required: true,
70
+ content: {
71
+ "application/json": { schema: PutAgentManifestRequest },
72
+ [AGENT_FOLDER_MEDIA_TYPE]: { schema: PutAgentFolderRequest },
73
+ },
74
+ },
69
75
  },
70
76
  responses: {
71
77
  200: json(z.union([SaveAgentManifestResponse, AgentManifestPlan]), "The version saved, or the plan with dryRun"),
@@ -74,16 +80,23 @@ export function agentManifestRoutes(api) {
74
80
  },
75
81
  412: { description: "If-Match named a version that is no longer the latest (`manifest_changed`)" },
76
82
  413: { description: "A skill's files hold more than the manifest's skill limit together (`limit_exceeded`)" },
77
- 422: { description: "The harness and runtime sections do not fit (`manifest_inconsistent`, `details.gaps`)" },
83
+ 422: {
84
+ description: "The harness and runtime sections do not fit (`manifest_inconsistent`, `details.gaps`), or an agent folder does not compile (`folder_invalid`, `details.diagnostics`)",
85
+ },
78
86
  },
79
87
  }, async (c) => {
80
88
  const name = nameOf(c.req.param("name"));
81
- const body = PutAgentManifestRequestSchema.parse(await readJson(c));
82
89
  const ifMatch = ifMatchOf(c.req.header("if-match"));
83
- const options = ifMatch === undefined ? {} : { ifMatch };
84
- return jsonResponse(200, c.req.query("dryRun") === "true"
90
+ const options = { ...(ifMatch === undefined ? {} : { ifMatch }), ...(c.req.query("dryRun") === "true" ? { dryRun: true } : {}) };
91
+ const media = (c.req.header("content-type") ?? "").split(";")[0].trim().toLowerCase();
92
+ if (media === AGENT_FOLDER_MEDIA_TYPE) {
93
+ const folder = PutAgentFolderRequestSchema.parse(await readJson(c));
94
+ return jsonResponse(200, await saveAgentFolder(c.env.tenant, name, folder, c.get("scope"), options));
95
+ }
96
+ const body = PutAgentManifestRequestSchema.parse(await readJson(c));
97
+ return jsonResponse(200, options.dryRun
85
98
  ? await saveAgentManifest(c.env.tenant, name, body, c.get("scope"), { ...options, dryRun: true })
86
- : await saveAgentManifest(c.env.tenant, name, body, c.get("scope"), options));
99
+ : await saveAgentManifest(c.env.tenant, name, body, c.get("scope"), { ...options, dryRun: false }));
87
100
  });
88
101
  tenantRoute(api, READ, {
89
102
  method: "get",
@@ -120,6 +133,72 @@ export function agentManifestRoutes(api) {
120
133
  requirePrincipal(c.get("scope"));
121
134
  return jsonResponse(200, await getAgentManifest(c.env.tenant, nameOf(c.req.param("name")), versionOf(c.req.param("version"))));
122
135
  });
136
+ tenantRoute(api, READ, {
137
+ method: "get",
138
+ path: "/v1/agent-manifests/{name}/versions/{version}/source",
139
+ tags: ["Agent manifests"],
140
+ summary: "Get the folder a version was compiled from",
141
+ description: "The agent folder the version was saved from (feature `agent-folders`): its compiler, size and every file, sorted by path. A version saved as JSON has none (`404`).",
142
+ request: { params: namePath.extend({ version: z.string().meta({ description: "The version number" }) }) },
143
+ responses: { 200: json(AgentManifestSource, "The folder") },
144
+ }, async (c) => {
145
+ requirePrincipal(c.get("scope"));
146
+ return jsonResponse(200, await getAgentManifestSource(c.env.tenant, nameOf(c.req.param("name")), versionOf(c.req.param("version"))));
147
+ });
148
+ tenantRoute(api, READ, {
149
+ method: "get",
150
+ path: "/v1/agent-manifests/{name}/versions/{version}/source/files/{path}",
151
+ tags: ["Agent manifests"],
152
+ summary: "Download one file of a version's folder",
153
+ description: "Streams the file at `path` (its path in the folder, with `/` percent-encoded as `%2F`) as it was saved.",
154
+ request: {
155
+ params: namePath.extend({
156
+ version: z.string().meta({ description: "The version number" }),
157
+ path: z.string().meta({ description: "The file's path in the folder, percent-encoded" }),
158
+ }),
159
+ },
160
+ responses: {
161
+ 200: {
162
+ description: "The file's bytes",
163
+ content: { "application/octet-stream": { schema: z.string().meta({ format: "binary" }) } },
164
+ },
165
+ },
166
+ }, async (c) => {
167
+ requirePrincipal(c.get("scope"));
168
+ const path = c.req.param("path");
169
+ const file = await readAgentManifestSourceFile(c.env.tenant, nameOf(c.req.param("name")), versionOf(c.req.param("version")), path);
170
+ return new Response(file.body, {
171
+ status: 200,
172
+ headers: { "content-type": contentTypeFor(path), "content-length": String(file.size) },
173
+ });
174
+ });
175
+ tenantRoute(api, READ, {
176
+ method: "get",
177
+ path: "/v1/agent-manifests/{name}/source/diff",
178
+ tags: ["Agent manifests"],
179
+ summary: "Compare two versions' folders",
180
+ description: "The files added, removed and changed from version `from`'s source to version `to`'s, by path, a file changed when its SHA-256 differs (feature `agent-folders`). Each list is sorted by path. A version saved as JSON has no source (`404`).",
181
+ request: {
182
+ params: namePath,
183
+ query: z.object({
184
+ from: z.string().meta({ description: "The version to compare from" }),
185
+ to: z.string().meta({ description: "The version to compare to" }),
186
+ }),
187
+ },
188
+ responses: {
189
+ 200: json(AgentManifestSourceDiff, "What changed"),
190
+ 400: { description: "`from` or `to` is not a version number" },
191
+ 404: { description: "No such version, or one was saved as JSON and has no source" },
192
+ },
193
+ }, async (c) => {
194
+ requirePrincipal(c.get("scope"));
195
+ const name = nameOf(c.req.param("name"));
196
+ const from = Number(c.req.query("from"));
197
+ const to = Number(c.req.query("to"));
198
+ if (!Number.isInteger(from) || from < 1 || !Number.isInteger(to) || to < 1)
199
+ fail(400, "from and to are the versions to compare: positive integers");
200
+ return jsonResponse(200, await diffAgentManifestSources(c.env.tenant, name, from, to));
201
+ });
123
202
  tenantRoute(api, WRITE, {
124
203
  method: "delete",
125
204
  path: "/v1/agent-manifests/{name}",
@@ -119,6 +119,9 @@ const RUNTIME_TAGS = [
119
119
  "GET /v1/agent-manifests/{name}",
120
120
  "GET /v1/agent-manifests/{name}/versions",
121
121
  "GET /v1/agent-manifests/{name}/versions/{version}",
122
+ "GET /v1/agent-manifests/{name}/versions/{version}/source",
123
+ "GET /v1/agent-manifests/{name}/versions/{version}/source/files/{path}",
124
+ "GET /v1/agent-manifests/{name}/source/diff",
122
125
  "DELETE /v1/agent-manifests/{name}",
123
126
  ],
124
127
  },
package/dist/host/http.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createHash, timingSafeEqual } from "node:crypto";
2
2
  import { jsonResponse } from "../api/http/respond.js";
3
3
  import { HOST_PROTOCOL, } from "@nylorun/core/compatibility";
4
+ import { AGENT_FOLDER_MEDIA_TYPE } from "@nylorun/core/contracts";
4
5
  export const OPAQUE_NOT_FOUND = {
5
6
  status: "rejected",
6
7
  code: "not_found",
@@ -113,7 +114,8 @@ export function isJsonContentType(value) {
113
114
  if (value === undefined)
114
115
  return false;
115
116
  const media = value.split(";")[0].trim().toLowerCase();
116
- return media === "application/json";
117
+ // An agent folder by hash (track T6) is JSON too.
118
+ return media === "application/json" || media === AGENT_FOLDER_MEDIA_TYPE;
117
119
  }
118
120
  /** True when the request carries a body (Content-Length > 0 or chunked). */
119
121
  export function requestHasBody(request) {