@nylorun/core 0.27.0-beta → 0.28.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 (43) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +3 -1
  3. package/dist/contracts.d.ts +153 -1
  4. package/dist/contracts.js +62 -7
  5. package/dist/define.d.ts +2 -1
  6. package/dist/define.js +2 -1
  7. package/dist/definition/cron.d.ts +15 -0
  8. package/dist/definition/cron.js +155 -0
  9. package/dist/definition/sections.d.ts +11 -0
  10. package/dist/definition/sections.js +29 -20
  11. package/dist/folder/compile.d.ts +43 -5
  12. package/dist/folder/compile.js +499 -88
  13. package/dist/folder/context.d.ts +97 -0
  14. package/dist/folder/context.js +79 -0
  15. package/dist/folder/decompile.d.ts +18 -0
  16. package/dist/folder/decompile.js +660 -0
  17. package/dist/folder/fix.d.ts +22 -0
  18. package/dist/folder/fix.js +191 -0
  19. package/dist/folder/flow.d.ts +42 -0
  20. package/dist/folder/flow.js +215 -0
  21. package/dist/folder/frontmatter.d.ts +5 -2
  22. package/dist/folder/frontmatter.js +8 -4
  23. package/dist/folder/index.d.ts +7 -2
  24. package/dist/folder/index.js +6 -1
  25. package/dist/folder/json-schema.d.ts +15 -0
  26. package/dist/folder/json-schema.js +212 -0
  27. package/dist/folder/nested.d.ts +24 -0
  28. package/dist/folder/nested.js +378 -0
  29. package/dist/folder/plugins.d.ts +23 -0
  30. package/dist/folder/plugins.js +155 -0
  31. package/dist/folder/schemas.d.ts +8 -0
  32. package/dist/folder/schemas.js +238 -0
  33. package/dist/folder/suggest.d.ts +13 -0
  34. package/dist/folder/suggest.js +63 -0
  35. package/dist/schemas/agent-folder/agent-md.schema.json +143 -0
  36. package/dist/schemas/agent-folder/flow.schema.json +466 -0
  37. package/dist/schemas/agent-folder/mcp.schema.json +59 -0
  38. package/dist/schemas/agent-folder/runtime.schema.json +447 -0
  39. package/dist/schemas/agent-folder/tool.schema.json +77 -0
  40. package/dist/schemas/agent-folder/trigger-md.schema.json +65 -0
  41. package/dist/utils/runtime-limits.d.ts +8 -0
  42. package/dist/utils/runtime-limits.js +19 -0
  43. package/package.json +8 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @nylorun/core
2
2
 
3
+ ## 0.28.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+
9
+ `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`.
10
+
11
+ - d23304e: `compileAgentFolder` gives every verdict that needs no Runtime, so `nylorun check` is the whole truth offline, with file, line and column. Each `inputSchema`, `outputSchema` and schema file is checked as JSON Schema 2020-12 (`json_schema_invalid`: a `type` such as `"objekt"`, with a did-you-mean, `properties` that is not a map, `required` that is not a list of names, in every nested schema) and as the engine reads it each turn (`if`/`then`, `not`, `dependentRequired`, `unevaluatedProperties`, a `$ref` outside `$defs` are refused); a keyword close to a known one (`proprties`) is a warning. A trigger's cron and time zone are read as the Runtime reads them (`schedule_invalid`, `timezone_invalid`, with a did-you-mean), in `triggers/*.md` and in `runtime.json`. The harness and runtime sections are checked against each other at the field that asks (`manifest_inconsistent`: skills with no sandbox, a custom harness such as `harness: workflow` off a pod, a credential bound to another URL), and the runtime's kind against what the folder asks of it (`runtime_kind`: `files/` needs a pod, `network` a sandbox). `approval` is no longer a key in `AGENT.md`, a tool file, `mcp.json` or a server's tool settings: `approval_removed` names the Tenant's tool policy (`nylorun tenant tool-policy`) as the way to ask a person.
12
+
13
+ Secrets warn, never refuse. A `.env` or key file is a `secret_file` warning instead of a refusal, and a literal value in an `Authorization`, `X-Api-Key`, `Api-Key`, `Cookie` or `*-Token` header, or a token-shaped string (`ghp_`, `github_pat_`, `sk-`, `xox…-`, a JWT) in any `mcp.json` header, is a `secret_literal` warning. Each says the folder is kept byte-exact as the version's source, readable with `agents:read`, and names `"Bearer ${NAME}"` with the value in the Agent's vault. A root `tool-policy.json`, `policy.json` or `*.policy.json` is a `tool_policy_file` warning: tool policy is the Tenant's.
14
+
15
+ Messages are the compiler's own: a field, what it takes and a did-you-mean (`kind is "virtual", "pod" or "none", not "virtal". Did you mean 'virtual'?`), never zod's `Invalid input` or `Too small`; a typo inside `memory` is named at its key, not as an invalid harness; a missing `session` and an empty trigger body say what they are. A `loop` key the nylorun harness does not read (`loop_key`) and an agent with no instructions (`instructions_empty`) are warnings. CRLF frontmatter compiles as LF does. `instructions/*.md` are read in natural order (`2-x.md` before `10-y.md`), which changes the manifest only for folders with ten or more of them. `$schema` is accepted in every JSON file and left out of the manifest (a JSON Schema's own stays, as its dialect); one that names another kind of file, or a schema that is not ours, is a `schema_url` warning, and `runtime.json` also takes the `runtime-manifest` schema. `@nylorun/core/define` adds `sectionGapsAt` (each gap with its manifest path), `cronScheduleIssue`, `isTimeZone` and `timeZoneNames`.
16
+
17
+ - b3dad06: Agent folders convert both ways (track T7, D80). `folderOfManifest(manifest)` in `@nylorun/core/folder` (also exported by `@nylorun/agents`) writes the agent folder that compiles back to the same manifest: name, description, metadata, harness, memory, loop and server and skill settings in `AGENT.md`, the first instruction as its body and the rest as `instructions/NN-*.md`, HTTP tools as `tools/<name>.json`, subagents as `agents/<name>/`, a flow as `flow.json` (v3's node tree, naming agents by id and tools by file name) with one flat `agents/<id>/` for its agents and its sub-flows' (a sub-flow is an `agents/<id>/` with its own `flow.json`, and a tool stage or HTTP verifier a `tools/<name>.json` beside the `flow.json` that names it), MCP servers in `mcp.json` with `Bearer ${SLOT}` or `${SLOT}` for a credential, triggers as `triggers/<id>.md`, and `runtime.json` without the slots the compiler derives the same way. It checks itself by compiling the folder, says whether the hash is the same (`exact`), and notes what it writes differently. Skills are written from their bytes when given them, else as a placeholder with the files to copy in. An embedded agent's display `name` is left out with a note, since a folder names an agent by its id.
18
+
19
+ `nylorun export --folder <name>[@<version>]` writes the folder of a saved manifest, from JSON or TypeScript; `nylorun migrate folder <dir>` writes the folder of a three-file folder, offline, with its skills; `nylorun pull <name>[@<version>]` writes back the folder a version was saved from, byte for byte, and says to use `export --folder` for a version saved as JSON. None writes over a file with other bytes.
20
+
21
+ Deprecated, still read: the three-file format (`agent.manifest.json`), whose `composeManifest` and `nylorun apply` now warn and name `nylorun migrate folder`, and `secrets` in a `SKILL.md`, which the skills loader warns about (a `DeprecationWarning` from `.skills()`): an agent folder lists a skill's secrets in `AGENT.md`.
22
+
23
+ - b3dad06: Agent folders compile flows, subagents and vendored Agent Plugins (track T7). `agents/<id>/` of an agent is offered to it as a tool, as the TypeScript builder offers an agent used as a tool: named `<id>`, input `{ task }`, one level deep, with no `runtime.json`, `triggers/` or `files/` of its own. `flow.json` makes a folder a flow (`harness.kind: "workflow"`, v3's node tree): every `flow.json` under the flow root names stages from the root's one `agents/` by id, a stage with its own `flow.json` is a sub-flow, and the compiler embeds each agent where v3 wants it. `"tool": "<name>"` names `tools/<name>.json` beside the `flow.json`, and a loop's `verify` takes `{ agent }` or `{ tool }`. A flow's `AGENT.md` takes `inputSchema` and has no body; an unknown agent or tool is an error with its file, line, column and a did-you-mean, and an agent no flow names is a warning. `plugins/<name>/` folds a plugin's skills and `mcp.json` servers as `.plugin()` does, labelled, and notes what Nylorun does not run (hooks, commands). Diagnostics keep their file, line and column across nested folders (`agents/research/flow.json:3:12`). New codes: `flow_invalid`, `flow_body`, `flow_refused`, `flow_namespace`, `flow_cycle`, `agent_unknown`, `agent_unused`, `agent_name`, `tool_unknown`, `tool_unused`, `tool_twice`, `input_schema_refused`, `nested_refused`, `subagent_depth`, `credential_unsupported`, `plugin_invalid`, `plugin_unknown_key`, `plugin_duplicate` and `plugin_part_ignored`. `flow.json`, `agents/` and `plugins/` are no longer refused as `not_supported`.
24
+ - 498d972: JSON Schemas for each kind of file in an agent folder (track T7, design §3.10), the ones `nylorun init` maps in `.vscode/settings.json` and the compiler takes in `$schema`. Each is JSON Schema 2020-12 at `https://docs.nylorun.com/schemas/agent-folder/v1/<kind>.json`, exported as `@nylorun/core/schemas/agent-folder-<kind>.json`: `runtime` (`runtime.json`, with `$schema` and `extends`, and `kind` required unless `extends` names a file that gives it), `tool` (`tools/<name>.json`), `mcp` (`mcp.json`, Agent Plugins syntax), `flow` (`flow.json`'s node tree: exactly one of `agent`, `tool`, `chain`, `switch`, `parallel`, `map` and `loop`, and `id`), and `agent-md` and `trigger-md` for the frontmatter of `AGENT.md` and `triggers/<id>.md`. `agentFolderJsonSchemas()` in `@nylorun/core/folder` gives them by kind (`AGENT_FOLDER_SCHEMA_KINDS`). They are built from what the compiler checks: its key lists name each document's properties, and a value the manifest takes as it is comes from the manifest's own schema, so an unknown key is refused where the compiler refuses it, and `loop` and `metadata` stay open. `@nylorun/core/contracts` also exports `HttpToolTargetSchema`, `McpToolSettingsSchema`, `HarnessMemorySchema` and `AGENT_MANIFEST_NAME_PATTERN`, which they are built from.
25
+
26
+ `flow.json` now takes `$schema`, as every JSON file of a folder does: the compiler refused it before. A URL that names another kind of file is a warning.
27
+
28
+ - b3dad06: Compare two versions' agent folders, and set what a folder may hold per Tenant (track T7).
29
+
30
+ - **`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.
31
+ - **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`).
32
+ - `compileAgentFolder({ entries, files, name, limits })` takes the limits as an optional input (`AgentFolderLimits`); each left out is `AGENT_FOLDER_LIMITS`'.
33
+ - `@nylorun/agents` also exports the types `AgentManifestSource`, `AgentManifestSourceDiff`, `AgentManifestSourceSummary` and `AgentFolderDiagnostic`, and `AGENT_FOLDER_MEDIA_TYPE`.
34
+
35
+ ### Patch Changes
36
+
37
+ - b3dad06: Both ends of the agent folder loop (track T7).
38
+
39
+ - `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`.
40
+ - `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.
41
+ - `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`.
42
+ - A plan's change to the instructions prints their text diff, `-` and `+` lines.
43
+ - `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.
44
+ - `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.
45
+ - `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.
46
+ - `session.approve(id, approved)` and `session.respond(id, value)` take no options: each makes its own idempotency key.
47
+ - 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.
48
+ - The compiler's refusal of an unresolved `extends` says to resolve it before uploading.
49
+
3
50
  ## 0.27.0-beta
4
51
 
5
52
  ### Minor Changes
package/README.md CHANGED
@@ -7,9 +7,11 @@ HTTP client, Node host or SDK dependencies.
7
7
  - `/contracts`: runtime request, event, action and response schemas.
8
8
  - `/compatibility`: protocol/definition versions and canonical manifest hashing.
9
9
  - `/folder`: agent folders. `compileAgentFolder` turns a folder of Markdown and JSON
10
- (`AGENT.md`, `runtime.json`, `mcp.json`, `skills/`, `tools/`, `triggers/`, `files/`) into
10
+ (`AGENT.md`, `runtime.json`, `mcp.json`, `skills/`, `tools/`, `triggers/`, `files/`,
11
+ subagents in `agents/<id>/`, a flow in `flow.json`, Agent Plugins in `plugins/<name>/`) into
11
12
  agent manifest v8, with every diagnostic by file, line and column. Pure: the Runtime
12
13
  compiles every folder it is sent with it, and `nylorun check` checks one offline.
14
+ `folderOfManifest` writes the folder of a manifest, which compiles back to it.
13
15
  - `/transport`: what every Runtime client does on the wire: the `/health`
14
16
  compatibility probe (`checkHealth`), protocol ranges, request headers and
15
17
  response bodies. Browser-safe; `@nylorun/agents` and `@nylorun/admin` build on it.
@@ -17,8 +17,30 @@ export type { ErrorCode } from "./compatibility.js";
17
17
  export declare const RequestIdSchema: z.ZodString;
18
18
  /** At most 256 characters: an identifier's grammar is the protocol's (it crosses the Runtime API, the Harness API and tokens, and means the same in every installation), so its length is a constant of protocol 15, not a setting. */
19
19
  export declare const IdempotencyKeySchema: z.ZodString;
20
+ /** One tool's settings on an MCP server: `enabled`, `approval` and `deferred`. */
21
+ export declare const McpToolSettingsSchema: z.ZodObject<{
22
+ enabled: z.ZodOptional<z.ZodBoolean>;
23
+ approval: z.ZodOptional<z.ZodEnum<{
24
+ always: "always";
25
+ never: "never";
26
+ }>>;
27
+ deferred: z.ZodOptional<z.ZodBoolean>;
28
+ }, z.core.$strict>;
20
29
  /** A remote MCP server as a manifest declares it (`streamable-http` or `sse`). */
21
30
  export declare const McpServerManifestSchema: z.ZodType<McpServerManifest>;
31
+ /** An HTTP tool's request: its `url` (a template of the input's fields), `method`, `credential` and `timeoutMs`. */
32
+ export declare const HttpToolTargetSchema: z.ZodObject<{
33
+ url: z.ZodString;
34
+ method: z.ZodOptional<z.ZodEnum<{
35
+ DELETE: "DELETE";
36
+ GET: "GET";
37
+ PATCH: "PATCH";
38
+ POST: "POST";
39
+ PUT: "PUT";
40
+ }>>;
41
+ credential: z.ZodOptional<z.ZodString>;
42
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
43
+ }, z.core.$strict>;
22
44
  /**
23
45
  * An environment variable name a shell secret or plain variable may take: a POSIX
24
46
  * name, of any length (POSIX and Linux set none; a request's body bounds it). Names the sandbox
@@ -115,6 +137,12 @@ export declare const EnvironmentFileSchema: z.ZodUnion<readonly [z.ZodObject<{
115
137
  files: z.ZodRecord<z.ZodString, z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
116
138
  }, z.core.$strict>]>;
117
139
  export type EnvironmentFile = z.infer<typeof EnvironmentFileSchema>;
140
+ /**
141
+ * An agent manifest's name (protocol 16): 1–64 letters, digits, `.`, `_` and `-`, starting with a
142
+ * letter or digit, such as `triage`; a version is at most 9 digits. Manifest names and Agent ids
143
+ * are separate namespaces.
144
+ */
145
+ export declare const AGENT_MANIFEST_NAME_PATTERN: RegExp;
118
146
  export declare function isAgentManifestName(value: unknown): value is string;
119
147
  export declare const AgentManifestNameSchema: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
120
148
  /**
@@ -1128,6 +1156,17 @@ export declare const EnvironmentSecretSlotsSchema: z.ZodRecord<z.ZodString, z.Zo
1128
1156
  export type EnvironmentSecretSlots = z.infer<typeof EnvironmentSecretSlotsSchema>;
1129
1157
  /** The schema version of an agent manifest the Runtime saves at `/v1/agent-manifests/{name}`. */
1130
1158
  export declare const AGENT_MANIFEST_V8_SCHEMA_VERSION = 8;
1159
+ /**
1160
+ * `harness.memory`: turns the Agent's memory on. Its `access` holds in every turn,
1161
+ * whoever starts it; `instructions` follow the engine's own memory rules.
1162
+ */
1163
+ export declare const HarnessMemorySchema: z.ZodObject<{
1164
+ access: z.ZodOptional<z.ZodEnum<{
1165
+ read_only: "read_only";
1166
+ read_write: "read_write";
1167
+ }>>;
1168
+ instructions: z.ZodOptional<z.ZodString>;
1169
+ }, z.core.$strict>;
1131
1170
  /** What runs inside the loop of an agent: the `harness` section of agent manifest v8. */
1132
1171
  export declare const AgentHarnessSectionSchema: z.ZodType<AgentHarnessSection>;
1133
1172
  /** A flow's `harness` section (`kind: "workflow"`). */
@@ -2159,10 +2198,33 @@ export declare const AgentManifestSavedBySchema: z.ZodObject<{
2159
2198
  actor: z.ZodString;
2160
2199
  }, z.core.$strict>;
2161
2200
  /** One version of an agent manifest. */
2201
+ /**
2202
+ * The edit that fixes a diagnostic, when only one edit can (track T7, `nylorun check --fix`):
2203
+ * `rename_key` renames the key at `line` and `column` of `file` from `from` to `to`, the one known
2204
+ * key it is close to; `crlf` makes `file`'s CRLF line ends LF; `move_skill_secrets` moves a
2205
+ * `SKILL.md`'s `secrets` to `AGENT.md`'s `skills` block, as `skills: { <skill>: { secrets } }`.
2206
+ */
2207
+ export declare const AgentFolderFixSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2208
+ kind: z.ZodLiteral<"rename_key">;
2209
+ file: z.ZodString;
2210
+ line: z.ZodNumber;
2211
+ column: z.ZodNumber;
2212
+ from: z.ZodString;
2213
+ to: z.ZodString;
2214
+ }, z.core.$strict>, z.ZodObject<{
2215
+ kind: z.ZodLiteral<"crlf">;
2216
+ file: z.ZodString;
2217
+ }, z.core.$strict>, z.ZodObject<{
2218
+ kind: z.ZodLiteral<"move_skill_secrets">;
2219
+ file: z.ZodString;
2220
+ skill: z.ZodString;
2221
+ secrets: z.ZodArray<z.ZodString>;
2222
+ }, z.core.$strict>], "kind">;
2223
+ export type AgentFolderFix = z.infer<typeof AgentFolderFixSchema>;
2162
2224
  /**
2163
2225
  * One problem or remark about an agent folder (track T6): an `error` keeps it from compiling.
2164
2226
  * `file` is the path in the folder, with the line and column when known; `pointer` the field in
2165
- * the manifest.
2227
+ * the manifest; `fix` the edit that fixes it, when only one edit can.
2166
2228
  */
2167
2229
  export declare const AgentFolderDiagnosticSchema: z.ZodObject<{
2168
2230
  severity: z.ZodEnum<{
@@ -2177,6 +2239,22 @@ export declare const AgentFolderDiagnosticSchema: z.ZodObject<{
2177
2239
  line: z.ZodOptional<z.ZodNumber>;
2178
2240
  column: z.ZodOptional<z.ZodNumber>;
2179
2241
  pointer: z.ZodOptional<z.ZodString>;
2242
+ fix: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2243
+ kind: z.ZodLiteral<"rename_key">;
2244
+ file: z.ZodString;
2245
+ line: z.ZodNumber;
2246
+ column: z.ZodNumber;
2247
+ from: z.ZodString;
2248
+ to: z.ZodString;
2249
+ }, z.core.$strict>, z.ZodObject<{
2250
+ kind: z.ZodLiteral<"crlf">;
2251
+ file: z.ZodString;
2252
+ }, z.core.$strict>, z.ZodObject<{
2253
+ kind: z.ZodLiteral<"move_skill_secrets">;
2254
+ file: z.ZodString;
2255
+ skill: z.ZodString;
2256
+ secrets: z.ZodArray<z.ZodString>;
2257
+ }, z.core.$strict>], "kind">>;
2180
2258
  }, z.core.$strict>;
2181
2259
  export type AgentFolderDiagnostic = z.infer<typeof AgentFolderDiagnosticSchema>;
2182
2260
  /** The folder a version was compiled from (track T6): the compiler that built it, and its size. */
@@ -2338,6 +2416,39 @@ export declare const AgentManifestSourceSchema: z.ZodObject<{
2338
2416
  }, z.core.$strict>>;
2339
2417
  }, z.core.$strict>;
2340
2418
  export type AgentManifestSource = z.infer<typeof AgentManifestSourceSchema>;
2419
+ /**
2420
+ * `GET /v1/agent-manifests/{name}/source/diff?from=&to=` (track T7): what changed between two
2421
+ * versions' sources, by path and SHA-256. Each list is sorted by path; `unchanged` counts the
2422
+ * files both hold with the same bytes.
2423
+ */
2424
+ export declare const AgentManifestSourceDiffSchema: z.ZodObject<{
2425
+ name: z.ZodString;
2426
+ from: z.ZodNumber;
2427
+ to: z.ZodNumber;
2428
+ added: z.ZodArray<z.ZodObject<{
2429
+ path: z.ZodString;
2430
+ size: z.ZodNumber;
2431
+ sha256: z.ZodString;
2432
+ }, z.core.$strict>>;
2433
+ removed: z.ZodArray<z.ZodObject<{
2434
+ path: z.ZodString;
2435
+ size: z.ZodNumber;
2436
+ sha256: z.ZodString;
2437
+ }, z.core.$strict>>;
2438
+ changed: z.ZodArray<z.ZodObject<{
2439
+ path: z.ZodString;
2440
+ from: z.ZodObject<{
2441
+ size: z.ZodNumber;
2442
+ sha256: z.ZodString;
2443
+ }, z.core.$strict>;
2444
+ to: z.ZodObject<{
2445
+ size: z.ZodNumber;
2446
+ sha256: z.ZodString;
2447
+ }, z.core.$strict>;
2448
+ }, z.core.$strict>>;
2449
+ unchanged: z.ZodNumber;
2450
+ }, z.core.$strict>;
2451
+ export type AgentManifestSourceDiff = z.infer<typeof AgentManifestSourceDiffSchema>;
2341
2452
  export type AgentManifestView = z.infer<typeof AgentManifestViewSchema>;
2342
2453
  /** `GET /v1/agent-manifests`: each manifest's latest version, by name. */
2343
2454
  export declare const ListAgentManifestsResponseSchema: z.ZodObject<{
@@ -2639,6 +2750,22 @@ export declare const AgentManifestPlanSchema: z.ZodObject<{
2639
2750
  line: z.ZodOptional<z.ZodNumber>;
2640
2751
  column: z.ZodOptional<z.ZodNumber>;
2641
2752
  pointer: z.ZodOptional<z.ZodString>;
2753
+ fix: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2754
+ kind: z.ZodLiteral<"rename_key">;
2755
+ file: z.ZodString;
2756
+ line: z.ZodNumber;
2757
+ column: z.ZodNumber;
2758
+ from: z.ZodString;
2759
+ to: z.ZodString;
2760
+ }, z.core.$strict>, z.ZodObject<{
2761
+ kind: z.ZodLiteral<"crlf">;
2762
+ file: z.ZodString;
2763
+ }, z.core.$strict>, z.ZodObject<{
2764
+ kind: z.ZodLiteral<"move_skill_secrets">;
2765
+ file: z.ZodString;
2766
+ skill: z.ZodString;
2767
+ secrets: z.ZodArray<z.ZodString>;
2768
+ }, z.core.$strict>], "kind">>;
2642
2769
  }, z.core.$strict>>>;
2643
2770
  compiler: z.ZodOptional<z.ZodString>;
2644
2771
  }, z.core.$strict>;
@@ -2774,6 +2901,22 @@ export declare const SaveAgentManifestResponseSchema: z.ZodObject<{
2774
2901
  line: z.ZodOptional<z.ZodNumber>;
2775
2902
  column: z.ZodOptional<z.ZodNumber>;
2776
2903
  pointer: z.ZodOptional<z.ZodString>;
2904
+ fix: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2905
+ kind: z.ZodLiteral<"rename_key">;
2906
+ file: z.ZodString;
2907
+ line: z.ZodNumber;
2908
+ column: z.ZodNumber;
2909
+ from: z.ZodString;
2910
+ to: z.ZodString;
2911
+ }, z.core.$strict>, z.ZodObject<{
2912
+ kind: z.ZodLiteral<"crlf">;
2913
+ file: z.ZodString;
2914
+ }, z.core.$strict>, z.ZodObject<{
2915
+ kind: z.ZodLiteral<"move_skill_secrets">;
2916
+ file: z.ZodString;
2917
+ skill: z.ZodString;
2918
+ secrets: z.ZodArray<z.ZodString>;
2919
+ }, z.core.$strict>], "kind">>;
2777
2920
  }, z.core.$strict>>>;
2778
2921
  }, z.core.$strict>;
2779
2922
  export type SaveAgentManifestResponse = z.infer<typeof SaveAgentManifestResponseSchema>;
@@ -7477,6 +7620,9 @@ export declare const TenantLimitsConfigSchema: z.ZodObject<{
7477
7620
  flowConcurrency: z.ZodOptional<z.ZodNumber>;
7478
7621
  flowMapItems: z.ZodOptional<z.ZodNumber>;
7479
7622
  flowLoopIterations: z.ZodOptional<z.ZodNumber>;
7623
+ folderFiles: z.ZodOptional<z.ZodNumber>;
7624
+ folderBytes: z.ZodOptional<z.ZodNumber>;
7625
+ folderTextFileBytes: z.ZodOptional<z.ZodNumber>;
7480
7626
  }, z.core.$strict>>;
7481
7627
  }, z.core.$strict>;
7482
7628
  export type TenantLimitsConfig = z.infer<typeof TenantLimitsConfigSchema>;
@@ -7553,6 +7699,9 @@ export declare const PutTenantLimitsRequestSchema: z.ZodObject<{
7553
7699
  flowConcurrency: z.ZodOptional<z.ZodNumber>;
7554
7700
  flowMapItems: z.ZodOptional<z.ZodNumber>;
7555
7701
  flowLoopIterations: z.ZodOptional<z.ZodNumber>;
7702
+ folderFiles: z.ZodOptional<z.ZodNumber>;
7703
+ folderBytes: z.ZodOptional<z.ZodNumber>;
7704
+ folderTextFileBytes: z.ZodOptional<z.ZodNumber>;
7556
7705
  }, z.core.$strict>>;
7557
7706
  requestId: z.ZodOptional<z.ZodString>;
7558
7707
  }, z.core.$strict>;
@@ -7630,6 +7779,9 @@ export declare const TenantLimitsViewSchema: z.ZodObject<{
7630
7779
  flowConcurrency: z.ZodNumber;
7631
7780
  flowMapItems: z.ZodNumber;
7632
7781
  flowLoopIterations: z.ZodNumber;
7782
+ folderFiles: z.ZodNumber;
7783
+ folderBytes: z.ZodNumber;
7784
+ folderTextFileBytes: z.ZodNumber;
7633
7785
  }, z.core.$strict>;
7634
7786
  }, z.core.$strict>;
7635
7787
  export type TenantLimitsView = z.infer<typeof TenantLimitsViewSchema>;
package/dist/contracts.js CHANGED
@@ -61,6 +61,8 @@ const mcpToolSettingsSchema = z
61
61
  })
62
62
  .strict()
63
63
  .meta({ id: "McpToolSettings" });
64
+ /** One tool's settings on an MCP server: `enabled`, `approval` and `deferred`. */
65
+ export const McpToolSettingsSchema = mcpToolSettingsSchema;
64
66
  /** Per-tool settings keyed by the server's tool names, `"*"` for the rest. */
65
67
  const mcpServerSettings = {
66
68
  deferred: z.boolean().optional(),
@@ -160,6 +162,8 @@ const httpToolTargetSchema = z
160
162
  timeoutMs: z.number().int().positive().max(TIMER_MAX_MS).optional(),
161
163
  })
162
164
  .strict();
165
+ /** An HTTP tool's request: its `url` (a template of the input's fields), `method`, `credential` and `timeoutMs`. */
166
+ export const HttpToolTargetSchema = httpToolTargetSchema;
163
167
  /** A name kept for a later kind of `what` (tool, verifier), refused for now. */
164
168
  const reservedKind = (what) => z
165
169
  .unknown()
@@ -635,7 +639,7 @@ export const EnvironmentFileSchema = z.union([
635
639
  * letter or digit, such as `triage`; a version is at most 9 digits. Manifest names and Agent ids
636
640
  * are separate namespaces.
637
641
  */
638
- const AGENT_MANIFEST_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
642
+ export const AGENT_MANIFEST_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
639
643
  export function isAgentManifestName(value) {
640
644
  return typeof value === "string" && AGENT_MANIFEST_NAME_PATTERN.test(value);
641
645
  }
@@ -1604,16 +1608,15 @@ const harnessLoopField = definitionJson
1604
1608
  * `harness.memory`: turns the Agent's memory on. Its `access` holds in every turn,
1605
1609
  * whoever starts it; `instructions` follow the engine's own memory rules.
1606
1610
  */
1607
- const harnessMemoryField = z
1608
- .strictObject({
1611
+ export const HarnessMemorySchema = z.strictObject({
1609
1612
  access: z.enum(MEMORY_ACCESS).optional().meta({ description: "`read_write` (the default) or `read_only`" }),
1610
1613
  instructions: z
1611
1614
  .string()
1612
1615
  .max(MEMORY_INSTRUCTIONS_MAX)
1613
1616
  .optional()
1614
1617
  .meta({ description: "What this agent should remember, after the engine's own memory rules" }),
1615
- })
1616
- .optional()
1618
+ });
1619
+ const harnessMemoryField = HarnessMemorySchema.optional()
1617
1620
  .meta({ description: "The Agent's memory: Markdown files under /memories it keeps across sessions" });
1618
1621
  /** Fields the harness section refuses with where they went. */
1619
1622
  const REMOVED_HARNESS_FIELDS = Object.freeze({
@@ -1999,10 +2002,32 @@ export const PutAgentManifestRequestSchema = AgentManifestV8Schema.extend({
1999
2002
  /** Who saved a version: the subject a request acted for, else `application`. */
2000
2003
  export const AgentManifestSavedBySchema = z.object({ actor: z.string() }).strict();
2001
2004
  /** One version of an agent manifest. */
2005
+ /**
2006
+ * The edit that fixes a diagnostic, when only one edit can (track T7, `nylorun check --fix`):
2007
+ * `rename_key` renames the key at `line` and `column` of `file` from `from` to `to`, the one known
2008
+ * key it is close to; `crlf` makes `file`'s CRLF line ends LF; `move_skill_secrets` moves a
2009
+ * `SKILL.md`'s `secrets` to `AGENT.md`'s `skills` block, as `skills: { <skill>: { secrets } }`.
2010
+ */
2011
+ export const AgentFolderFixSchema = z
2012
+ .discriminatedUnion("kind", [
2013
+ z
2014
+ .object({
2015
+ kind: z.literal("rename_key"),
2016
+ file: z.string(),
2017
+ line: z.number().int().positive(),
2018
+ column: z.number().int().positive(),
2019
+ from: z.string(),
2020
+ to: z.string(),
2021
+ })
2022
+ .strict(),
2023
+ z.object({ kind: z.literal("crlf"), file: z.string() }).strict(),
2024
+ z.object({ kind: z.literal("move_skill_secrets"), file: z.string(), skill: z.string(), secrets: z.array(z.string()) }).strict(),
2025
+ ])
2026
+ .meta({ id: "AgentFolderFix" });
2002
2027
  /**
2003
2028
  * One problem or remark about an agent folder (track T6): an `error` keeps it from compiling.
2004
2029
  * `file` is the path in the folder, with the line and column when known; `pointer` the field in
2005
- * the manifest.
2030
+ * the manifest; `fix` the edit that fixes it, when only one edit can.
2006
2031
  */
2007
2032
  export const AgentFolderDiagnosticSchema = z
2008
2033
  .object({
@@ -2013,6 +2038,7 @@ export const AgentFolderDiagnosticSchema = z
2013
2038
  line: z.number().int().positive().optional(),
2014
2039
  column: z.number().int().positive().optional(),
2015
2040
  pointer: z.string().optional(),
2041
+ fix: AgentFolderFixSchema.optional(),
2016
2042
  })
2017
2043
  .strict()
2018
2044
  .meta({ id: "AgentFolderDiagnostic" });
@@ -2063,6 +2089,10 @@ export const PutAgentFolderRequestSchema = z
2063
2089
  entries: z.array(AgentFolderEntrySchema),
2064
2090
  })
2065
2091
  .strict();
2092
+ /** One file of a version's source: its path, size and SHA-256 (lowercase hex). */
2093
+ const AgentManifestSourceEntrySchema = z
2094
+ .object({ path: z.string(), size: z.number().int().nonnegative(), sha256: z.string() })
2095
+ .strict();
2066
2096
  /** `GET /v1/agent-manifests/{name}/versions/{v}/source`: the folder a version was compiled from. */
2067
2097
  export const AgentManifestSourceSchema = z
2068
2098
  .object({
@@ -2072,7 +2102,32 @@ export const AgentManifestSourceSchema = z
2072
2102
  files: z.number().int().nonnegative(),
2073
2103
  bytes: z.number().int().nonnegative(),
2074
2104
  /** Every file, sorted by path. */
2075
- entries: z.array(z.object({ path: z.string(), size: z.number().int().nonnegative(), sha256: z.string() }).strict()),
2105
+ entries: z.array(AgentManifestSourceEntrySchema),
2106
+ })
2107
+ .strict();
2108
+ /**
2109
+ * `GET /v1/agent-manifests/{name}/source/diff?from=&to=` (track T7): what changed between two
2110
+ * versions' sources, by path and SHA-256. Each list is sorted by path; `unchanged` counts the
2111
+ * files both hold with the same bytes.
2112
+ */
2113
+ export const AgentManifestSourceDiffSchema = z
2114
+ .object({
2115
+ name: z.string(),
2116
+ from: z.number().int().positive(),
2117
+ to: z.number().int().positive(),
2118
+ /** Files only `to` holds. */
2119
+ added: z.array(AgentManifestSourceEntrySchema),
2120
+ /** Files only `from` holds. */
2121
+ removed: z.array(AgentManifestSourceEntrySchema),
2122
+ /** Files both hold with other bytes: each as `from` held it and as `to` does. */
2123
+ changed: z.array(z
2124
+ .object({
2125
+ path: z.string(),
2126
+ from: z.object({ size: z.number().int().nonnegative(), sha256: z.string() }).strict(),
2127
+ to: z.object({ size: z.number().int().nonnegative(), sha256: z.string() }).strict(),
2128
+ })
2129
+ .strict()),
2130
+ unchanged: z.number().int().nonnegative(),
2076
2131
  })
2077
2132
  .strict();
2078
2133
  /** `GET /v1/agent-manifests`: each manifest's latest version, by name. */
package/dist/define.d.ts CHANGED
@@ -44,7 +44,8 @@ export { bindTool } from "./definition/bind-tool.js";
44
44
  export { bindOutputContract } from "./definition/output-contract.js";
45
45
  export type { TurnOutputContract } from "./definition/output-contract.js";
46
46
  export { agentFrom } from "./definition/from.js";
47
- export { harnessIdOf, harnessSectionOf, isWorkflowHarness, kindMeets, loopManifestOf, normalizeCredentialUrl, pluginsOf, runtimeOf, sandboxNeedOf, sectionGaps, type SandboxNeed, } from "./definition/sections.js";
47
+ export { harnessIdOf, harnessSectionOf, isWorkflowHarness, kindMeets, loopManifestOf, normalizeCredentialUrl, pluginsOf, runtimeOf, sandboxNeedOf, sectionGaps, sectionGapsAt, type SandboxNeed, type SectionGap, } from "./definition/sections.js";
48
+ export { cronScheduleIssue, isTimeZone, timeZoneNames } from "./definition/cron.js";
48
49
  export { mediaReferenceOf, type MediaReference } from "./definition/media-reference.js";
49
50
  export type { SessionToolRef } from "./definition/from.js";
50
51
  export { schemaFromJSON } from "./definition/schema-json.js";
package/dist/define.js CHANGED
@@ -23,7 +23,8 @@ export { isVariantOf } from "./definition/variant.js";
23
23
  export { bindTool } from "./definition/bind-tool.js";
24
24
  export { bindOutputContract } from "./definition/output-contract.js";
25
25
  export { agentFrom } from "./definition/from.js";
26
- export { harnessIdOf, harnessSectionOf, isWorkflowHarness, kindMeets, loopManifestOf, normalizeCredentialUrl, pluginsOf, runtimeOf, sandboxNeedOf, sectionGaps, } from "./definition/sections.js";
26
+ export { harnessIdOf, harnessSectionOf, isWorkflowHarness, kindMeets, loopManifestOf, normalizeCredentialUrl, pluginsOf, runtimeOf, sandboxNeedOf, sectionGaps, sectionGapsAt, } from "./definition/sections.js";
27
+ export { cronScheduleIssue, isTimeZone, timeZoneNames } from "./definition/cron.js";
27
28
  export { mediaReferenceOf } from "./definition/media-reference.js";
28
29
  export { schemaFromJSON } from "./definition/schema-json.js";
29
30
  export { normalizeSchema } from "./definition/schema.js";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A trigger's `schedule` and `timezone`, checked with no clock and no Node API, so the CLI's
3
+ * offline check, the compiler and the Runtime read them alike. The cron is five fields (minute,
4
+ * hour, day of the month, month, day of the week), each `*`, a value, a range `a-b`, a step `/n`
5
+ * on any of those, or a list of them; months and days of the week also take their three-letter
6
+ * names (`JAN`, `MON`), in any case. Day 7 of the week is Sunday, as 0 is. The day of the month
7
+ * also takes `L` (its last day), and the day of the week `5L` (the month's last Friday) and
8
+ * `1#2` (its second Monday). `?` stands for `*` in either day field.
9
+ */
10
+ /** Why `schedule` is not a five-field cron, worded for a person; undefined when it is one. */
11
+ export declare function cronScheduleIssue(schedule: string): string | undefined;
12
+ /** Whether `zone` is a time zone this platform knows: an IANA name, such as `Asia/Kolkata`. */
13
+ export declare function isTimeZone(zone: string): boolean;
14
+ /** The IANA time zones this platform knows, for a "did you mean"; empty where it cannot list them. */
15
+ export declare function timeZoneNames(): readonly string[];
@@ -0,0 +1,155 @@
1
+ /**
2
+ * A trigger's `schedule` and `timezone`, checked with no clock and no Node API, so the CLI's
3
+ * offline check, the compiler and the Runtime read them alike. The cron is five fields (minute,
4
+ * hour, day of the month, month, day of the week), each `*`, a value, a range `a-b`, a step `/n`
5
+ * on any of those, or a list of them; months and days of the week also take their three-letter
6
+ * names (`JAN`, `MON`), in any case. Day 7 of the week is Sunday, as 0 is. The day of the month
7
+ * also takes `L` (its last day), and the day of the week `5L` (the month's last Friday) and
8
+ * `1#2` (its second Monday). `?` stands for `*` in either day field.
9
+ */
10
+ const MONTHS = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
11
+ const DAYS = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
12
+ /** The most days each month can have, for a day of the month no listed month reaches. */
13
+ const MONTH_DAYS = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
14
+ const FIELDS = [
15
+ { name: "minute", min: 0, max: 59 },
16
+ { name: "hour", min: 0, max: 23 },
17
+ { name: "day of the month", min: 1, max: 31 },
18
+ { name: "month", min: 1, max: 12, names: MONTHS },
19
+ { name: "day of the week", min: 0, max: 7, names: DAYS },
20
+ ];
21
+ const DAY_OF_MONTH = 2;
22
+ const MONTH = 3;
23
+ const DAY_OF_WEEK = 4;
24
+ /** Why `schedule` is not a five-field cron, worded for a person; undefined when it is one. */
25
+ export function cronScheduleIssue(schedule) {
26
+ const parts = schedule.trim().split(/\s+/);
27
+ if (schedule.trim() === "" || parts.length !== 5)
28
+ return `schedule is five cron fields, minute hour day-of-month month day-of-week, such as "0 9 * * MON-FRI"; ${JSON.stringify(schedule)} has ${schedule.trim() === "" ? "none" : parts.length}`;
29
+ const fields = [];
30
+ for (const [index, field] of FIELDS.entries()) {
31
+ const read = readField(parts[index], index, field);
32
+ if (typeof read === "string")
33
+ return `schedule ${JSON.stringify(schedule)}: ${read}`;
34
+ fields.push(read);
35
+ }
36
+ // A day of the month no listed month has never comes, unless a day of the week is listed too
37
+ // (the cron then runs on either).
38
+ const days = fields[DAY_OF_MONTH];
39
+ const months = fields[MONTH];
40
+ if (!days.every && !days.special && fields[DAY_OF_WEEK].every) {
41
+ const longest = Math.max(...(months.every ? MONTH_DAYS : [...months.values].map((month) => MONTH_DAYS[month - 1])));
42
+ const first = Math.min(...days.values);
43
+ if (first > longest)
44
+ return `schedule ${JSON.stringify(schedule)} never runs: no month it lists has day ${first}`;
45
+ }
46
+ return undefined;
47
+ }
48
+ /** What a field lists, or why it is not valid. */
49
+ function readField(text, index, field) {
50
+ const values = new Set();
51
+ let every = false;
52
+ let special = false;
53
+ for (const item of text.split(",")) {
54
+ if (item === "")
55
+ return `the ${field.name} has an empty entry between commas`;
56
+ if ((item === "?" || item === "*") && (item === "*" || index === DAY_OF_MONTH || index === DAY_OF_WEEK)) {
57
+ every = true;
58
+ continue;
59
+ }
60
+ if (index === DAY_OF_MONTH && item.toUpperCase() === "L") {
61
+ special = true;
62
+ continue;
63
+ }
64
+ if (index === DAY_OF_WEEK) {
65
+ const last = /^(\w+)L$/i.exec(item);
66
+ const nth = /^(\w+)#(\w+)$/.exec(item);
67
+ if (last || nth) {
68
+ const day = valueOf(last ? last[1] : nth[1], field);
69
+ if (typeof day === "string")
70
+ return day;
71
+ if (nth && !/^(?:[1-5]|L)$/i.test(nth[2]))
72
+ return `#${nth[2]} in ${item} is which ${DAYS[day % 7]} of the month: 1 to 5, or L for the last`;
73
+ special = true;
74
+ continue;
75
+ }
76
+ }
77
+ const slash = item.split("/");
78
+ if (slash.length > 2)
79
+ return `${item} has two steps: write one, such as */15`;
80
+ const [base, step] = slash;
81
+ if (step !== undefined && !/^\d+$/.test(step))
82
+ return `the step in ${item} is a whole number, such as */15`;
83
+ if (step !== undefined && Number(step) === 0)
84
+ return `the step in ${item} is 0: a step is 1 or more`;
85
+ let from = field.min;
86
+ let to = field.max;
87
+ if (base !== "*" && !(base === "?" && (index === DAY_OF_MONTH || index === DAY_OF_WEEK))) {
88
+ const range = base.split("-");
89
+ if (range.length > 2 || range.some((part) => part === ""))
90
+ return `${item} is not a value or a range of the ${field.name}, such as ${field.names ? `${field.names[1]}-${field.names[3]}` : `${field.min}-${field.min + 2}`}`;
91
+ const low = valueOf(range[0], field);
92
+ if (typeof low === "string")
93
+ return low;
94
+ const high = range.length === 2 ? valueOf(range[1], field) : step === undefined ? low : field.max;
95
+ if (typeof high === "string")
96
+ return high;
97
+ if (low > high)
98
+ return `the range ${base} runs backwards: write it from the lower value`;
99
+ from = low;
100
+ to = high;
101
+ }
102
+ else if (step === undefined)
103
+ every = true;
104
+ for (let value = from; value <= to; value += Number(step ?? 1))
105
+ values.add(value);
106
+ }
107
+ return { values, every, special };
108
+ }
109
+ /** The number a field's value stands for, or why it is none. */
110
+ function valueOf(text, field) {
111
+ if (/^\d+$/.test(text)) {
112
+ const value = Number(text);
113
+ if (value < field.min || value > field.max)
114
+ return `the ${field.name} is ${field.min}-${field.max}, and ${text} is not`;
115
+ return value;
116
+ }
117
+ const names = field.names;
118
+ const at = names?.indexOf(text.toUpperCase()) ?? -1;
119
+ if (names && at >= 0)
120
+ return field.min + at;
121
+ const close = names?.find((name) => text.toUpperCase().startsWith(name));
122
+ return `${JSON.stringify(text)} is not a ${field.name}: write ${field.min}-${field.max}${names ? ` or ${names[0]}-${names.at(-1)}` : ""}${close ? `. Did you mean ${close}?` : ""}`;
123
+ }
124
+ /** Whether `zone` is a time zone this platform knows: an IANA name, such as `Asia/Kolkata`. */
125
+ export function isTimeZone(zone) {
126
+ try {
127
+ new Intl.DateTimeFormat(undefined, { timeZone: zone });
128
+ return true;
129
+ }
130
+ catch {
131
+ return false;
132
+ }
133
+ }
134
+ /**
135
+ * Current IANA names that platforms list under an older one (`Intl.supportedValuesOf` gives
136
+ * `Asia/Calcutta`), so a "did you mean" offers the name people write today.
137
+ */
138
+ const CURRENT_ZONE_NAMES = [
139
+ "Asia/Kolkata",
140
+ "Asia/Ho_Chi_Minh",
141
+ "Asia/Kathmandu",
142
+ "Asia/Yangon",
143
+ "Europe/Kyiv",
144
+ "America/Argentina/Buenos_Aires",
145
+ "America/Nuuk",
146
+ "Atlantic/Faroe",
147
+ "Pacific/Chuuk",
148
+ "Pacific/Pohnpei",
149
+ ];
150
+ /** The IANA time zones this platform knows, for a "did you mean"; empty where it cannot list them. */
151
+ export function timeZoneNames() {
152
+ if (typeof Intl.supportedValuesOf !== "function")
153
+ return [];
154
+ return [...CURRENT_ZONE_NAMES.filter(isTimeZone), ...Intl.supportedValuesOf("timeZone")];
155
+ }