@meridian-flow/mars-schema 0.35.0 → 0.36.0

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 (46) hide show
  1. package/README.md +9 -3
  2. package/fixtures/alias-candidates/auto-sonnet/expected.json +7 -0
  3. package/fixtures/alias-candidates/auto-sonnet/request.json +100 -0
  4. package/fixtures/alias-candidates/no-match-is-empty/expected.json +1 -0
  5. package/fixtures/alias-candidates/no-match-is-empty/request.json +94 -0
  6. package/fixtures/alias-candidates/pinned-alone/expected.json +3 -0
  7. package/fixtures/alias-candidates/pinned-alone/request.json +92 -0
  8. package/fixtures/alias-candidates/pinned-widened-by-match/expected.json +10 -0
  9. package/fixtures/alias-candidates/pinned-widened-by-match/request.json +98 -0
  10. package/fixtures/alias-narrow/all-providers/expected.json +27 -0
  11. package/fixtures/alias-narrow/all-providers/request.json +32 -0
  12. package/fixtures/alias-narrow/default-list/expected.json +18 -0
  13. package/fixtures/alias-narrow/default-list/request.json +29 -0
  14. package/fixtures/alias-narrow/named-list/expected.json +11 -0
  15. package/fixtures/alias-narrow/named-list/request.json +33 -0
  16. package/fixtures/alias-resolve-all/meridian-base-real-rows/expected.json +21 -0
  17. package/fixtures/alias-resolve-all/meridian-base-real-rows/request.json +2759 -0
  18. package/fixtures/read/manifest-broken-tables/expected.json +78 -0
  19. package/fixtures/read/manifest-broken-tables/mars.toml +24 -0
  20. package/fixtures/read/manifest-consumer-invalid/expected.json +50 -0
  21. package/fixtures/read/manifest-consumer-invalid/mars.toml +13 -0
  22. package/fixtures/read/manifest-consumer-no-package/expected.json +16 -0
  23. package/fixtures/read/manifest-consumer-no-package/mars.toml +5 -0
  24. package/fixtures/read/manifest-dependencies/expected.json +12 -1
  25. package/fixtures/read/manifest-every-table/expected.json +211 -0
  26. package/fixtures/read/manifest-every-table/mars.toml +95 -0
  27. package/fixtures/read/manifest-meridian-base/expected.json +235 -0
  28. package/fixtures/read/manifest-meridian-base/mars.toml +161 -0
  29. package/fixtures/read/manifest-unsafe-dependencies/expected.json +82 -0
  30. package/fixtures/read/manifest-unsafe-dependencies/mars.toml +14 -0
  31. package/fixtures/read/manifest-unsafe-values/expected.json +100 -0
  32. package/fixtures/read/manifest-unsafe-values/mars.toml +28 -0
  33. package/fixtures/resolve/locked-commit-missing-latest/expected.json +4 -2
  34. package/fixtures/version/select-latest-constraint-keeps-lock/expected.json +3 -0
  35. package/index.d.ts +147 -15
  36. package/node/mars_schema_wasm.d.ts +30 -11
  37. package/node/mars_schema_wasm.js +97 -34
  38. package/node/mars_schema_wasm_bg.wasm +0 -0
  39. package/node/mars_schema_wasm_bg.wasm.d.ts +7 -4
  40. package/package.json +1 -1
  41. package/web/mars_schema_wasm.d.ts +37 -15
  42. package/web/mars_schema_wasm.js +94 -34
  43. package/web/mars_schema_wasm_bg.wasm +0 -0
  44. package/web/mars_schema_wasm_bg.wasm.d.ts +7 -4
  45. package/fixtures/version/select-latest-constraint-ignores-lock/expected.json +0 -3
  46. /package/fixtures/version/{select-latest-constraint-ignores-lock → select-latest-constraint-keeps-lock}/input.json +0 -0
package/index.d.ts CHANGED
@@ -177,15 +177,110 @@ export interface DependencyEntry {
177
177
  }
178
178
 
179
179
  /**
180
- * The reading of `mars.toml`: the `[package]` table as any definition reading, and the
181
- * dependencies the package declares in declaration order, one `selectVersion` call per entry. A
182
- * table is omitted when empty, and both when `fields` is `null`. An entry that breaks a rule is
183
- * left out with a `dependency.*` diagnostic (an error in `[dependencies]`, a warning in
184
- * `[local-dependencies]`, which a dependent never installs from).
180
+ * A `[models.<alias>]` table, as Mars writes it back: `model` pins an id, `match` (with
181
+ * `exclude` and `provider`) selects from the catalog, and an alias may have both, `match`
182
+ * then widening what a pinned alias accepts. At least one of `model` and `match` is set.
183
+ * Pass one to `resolveAlias`, `aliasCandidates` or `resolveAliases` (each alias of its `models`),
184
+ * or build it in code. Every one of the three refuses a key outside this list with
185
+ * `input.invalid`; a key may be `null`, the same as unset. `native` is on the error's list of
186
+ * keys but is refused with its own message: `[models.<alias>.native]` is no longer supported.
187
+ */
188
+ export interface ModelAlias {
189
+ /** A pinned model id, taken as written. */
190
+ model?: string;
191
+ /** Globs (`*` only) every selected id matches. */
192
+ match?: string[];
193
+ /** Globs no selected id matches; only with `match`. */
194
+ exclude?: string[];
195
+ /** A models.dev provider key (`anthropic`); `meta-llama` and `meta` are one provider. */
196
+ provider?: string | null;
197
+ harness?: Harness;
198
+ description?: string;
199
+ prompting?: string;
200
+ default_effort?: Effort | "auto";
201
+ autocompact?: number;
202
+ autocompact_pct?: number;
203
+ }
204
+
205
+ /** Launch overrides for one agent, `[agents.<name>]`. Omitted keys are unset. */
206
+ export interface AgentOverlay {
207
+ description?: string;
208
+ model?: string;
209
+ harness?: string;
210
+ effort?: Effort | "auto";
211
+ approval?: Approval;
212
+ sandbox?: Sandbox;
213
+ network?: Network;
214
+ "network-allow"?: string[] | { replace: string[] };
215
+ "network-deny"?: string[] | { replace: string[] };
216
+ "model-invocable"?: boolean;
217
+ "user-invocable"?: boolean;
218
+ tools?: Record<string, "allow" | "deny" | "ask">;
219
+ "model-policies"?: ModelPolicyRule[];
220
+ }
221
+
222
+ /** `[skills.<name>]`. */
223
+ export interface SkillOverlay {
224
+ description?: string;
225
+ "model-invocable"?: boolean;
226
+ "user-invocable"?: boolean;
227
+ }
228
+
229
+ /** `[settings]`, in the spellings Mars writes back; omitted when the file has none. Keys unset in the file are omitted. */
230
+ export interface Settings {
231
+ managed_root?: string;
232
+ targets?: string[];
233
+ models_cache_ttl_hours?: number;
234
+ min_mars_version?: string;
235
+ default_harness?: string;
236
+ default_model?: string;
237
+ default_network?: Network;
238
+ "network-allow"?: string[] | { replace: string[] };
239
+ "network-deny"?: string[] | { replace: string[] };
240
+ tools?: Record<string, "allow" | "deny" | "ask">;
241
+ harness_order?: string[];
242
+ provider_order?: string[];
243
+ catalog_providers?: string[];
244
+ agent_emission?: "auto" | "always" | "never";
245
+ meridian?: {
246
+ agent_copy?: { harnesses: string[]; include_fanout: boolean };
247
+ fanout?: { agents: string[] };
248
+ };
249
+ "model-policies"?: ModelPolicyRule[];
250
+ }
251
+
252
+ /**
253
+ * The reading of `mars.toml`: the `[package]` table as any definition reading, the dependencies
254
+ * the package declares in declaration order (one `selectVersion` call per entry), and every
255
+ * other table Mars reads. A table is omitted when empty or absent, and the dependency tables
256
+ * when `fields` is `null`. An entry that breaks a rule is left out with a `dependency.*`
257
+ * diagnostic (an error in `[dependencies]`, a warning in `[local-dependencies]`, which a
258
+ * dependent never installs from).
259
+ *
260
+ * A `mars.toml` with no `[package]` is consumer configuration: `fields` is `null`, there is no
261
+ * error for the missing table, and the dependency tables and every consumer table are read.
262
+ *
263
+ * Each consumer table (`plugin`, `settings`, `models.<alias>`, `agents.<name>`,
264
+ * `skills.<name>`) is read on its own: one that breaks a rule is left out with a
265
+ * `config.invalid` error whose `path` names it (`["models", "a"]`, `["settings"]`), and the others
266
+ * are returned. A refusal (`[settings.tools]` with a `*`, a `min_mars_version` that is not a
267
+ * requirement) is a `config.invalid` error too, the table kept. A key Mars does not read is a
268
+ * `field.unknown` info at its path, as `mars validate` shows it. `settings` is omitted when the
269
+ * file sets nothing in it.
270
+ *
271
+ * Every table is plain JSON, as `frontmatter` is: a TOML datetime is its text, and a value or
272
+ * key JSON cannot hold (an integer beyond ±(2^53 − 1), a `__proto__` key) is left out with a
273
+ * `toml.non-json-value` error at its path (for `plugin`, at the key under it).
185
274
  */
186
275
  export interface ManifestRead extends DefinitionRead<ManifestFields> {
187
276
  dependencies?: { [name: string]: DependencyEntry };
188
277
  "local-dependencies"?: { [name: string]: DependencyEntry };
278
+ /** `[plugin]`, as written. */
279
+ plugin?: JsonValue;
280
+ settings?: Settings;
281
+ models?: { [alias: string]: ModelAlias };
282
+ agents?: { [name: string]: AgentOverlay };
283
+ skills?: { [name: string]: SkillOverlay };
189
284
  }
190
285
 
191
286
  export type Reading =
@@ -195,7 +290,8 @@ export type Reading =
195
290
 
196
291
  /**
197
292
  * Read one file; the package-relative `path` picks the reader. Any path other than
198
- * `mars.toml`, `agents/<slug>.md` or `skills/<slug>/SKILL.md` throws.
293
+ * `mars.toml`, `agents/<slug>.md` or `skills/<slug>/SKILL.md` throws `read.unrecognized-path`, and
294
+ * an argument that is not a string throws `input.invalid`.
199
295
  */
200
296
  export function read(path: "mars.toml", text: string): ManifestRead;
201
297
  export function read(path: `agents/${string}.md`, text: string): DefinitionRead<AgentFields>;
@@ -633,8 +729,7 @@ export function satisfiesRequirement(requirement: string, version: string): bool
633
729
  * first (one branch or commit pin wins; two pins, or a pin beside a semver range, throw), then
634
730
  * keeps `locked` (`{ locked: true }`) when it meets every range, even if `available` no longer
635
731
  * lists its tag (only an upgrade moves a lock), else chooses the newest tag in `available` that
636
- * meets them. A `latest` (or `null`) constraint allows any tag and makes the newest win over
637
- * `locked`. A tag that is not a version (`nightly`) is ignored, and with none left the result is
732
+ * meets them. A `latest` (or `null`) constraint allows any tag, so it keeps `locked` too. A tag that is not a version (`nightly`) is ignored, and with none left the result is
638
733
  * `untagged`: the default branch. Constraints are `[requester, version | null]` as the manifests spell them
639
734
  * (`v2`, `^1.2`, `>=0.5`, a branch, `latest`); see `satisfies` for the grammar.
640
735
  */
@@ -978,12 +1073,49 @@ export function resolveEffort(
978
1073
  host: Host,
979
1074
  ): EffortResolution;
980
1075
 
1076
+ /** A models.dev model as an alias reads it: `provider` is the models.dev key (`anthropic`). */
1077
+ export interface ModelRow {
1078
+ id: string;
1079
+ provider: string;
1080
+ /** A row from Mars's own snapshot: `provider` is the display name, so this key is used instead. */
1081
+ provider_key?: string | null;
1082
+ release_date?: string | null;
1083
+ }
1084
+
1085
+ /**
1086
+ * The rows of the providers a project's `catalog_providers` names: the rows `mars models resolve`
1087
+ * resolves over, since the CLI narrows models.dev this way before it resolves any alias. Pass
1088
+ * every row models.dev lists and the project's `settings.catalog_providers` (`["*"]` keeps every
1089
+ * provider); with `undefined` it keeps the providers a project that sets none gets: `anthropic`,
1090
+ * `openai`, `google`, `meta`, `deepseek`, `xai` and `openrouter`. A row's provider is its
1091
+ * `provider_key`, else its `provider`; `meta-llama` and `meta` are one provider. The rows come back
1092
+ * as given. Resolve over the unnarrowed rows and an alias may pick a model from a provider the
1093
+ * project does not read (`deepseek`, `sol`).
1094
+ */
1095
+ export function narrowRows(rows: ModelRow[], providers?: string[]): ModelRow[];
1096
+
1097
+ /**
1098
+ * The id `alias` resolves to among models.dev rows, or `null`: a pinned `model` as written, else
1099
+ * the best row an `auto` alias selects. Every `match` glob hits, no `exclude` glob hits,
1100
+ * `provider` matches when given, `-latest` ids are skipped, then the newest `release_date`, the
1101
+ * shorter id and alphabetical order break ties. The code `mars models resolve` runs.
1102
+ */
1103
+ export function resolveAlias(rows: ModelRow[], alias: ModelAlias): string | null;
1104
+
1105
+ /**
1106
+ * Every id `alias` accepts, in `resolveAlias`'s order (newest first). A pinned `model` comes
1107
+ * first, then the rows `match`, `exclude` and `provider` select (a pinned alias with `match` and
1108
+ * no `provider` takes the provider its model id names). A pinned alias with no `match` accepts
1109
+ * its `model` alone.
1110
+ */
1111
+ export function aliasCandidates(rows: ModelRow[], alias: ModelAlias): string[];
1112
+
981
1113
  /**
982
- * The id an `auto` alias selects among models.dev rows, or `null`: every `match` glob hits, no
983
- * `exclude` glob hits, `provider` (a models.dev key) matches when given, `-latest` ids are
984
- * skipped, then the newest `release_date`, the shorter id and alphabetical order break ties.
1114
+ * `resolveAlias` for each alias of a parsed manifest's `models`, keyed by alias name in file
1115
+ * order: the id, or `null` when an `auto` alias selects nothing. A manifest with no `models`
1116
+ * gives `{}`.
985
1117
  */
986
- export function resolveAlias(
987
- rows: { id: string; provider: string; release_date?: string | null }[],
988
- options: { match: string[]; exclude?: string[]; provider?: string | null },
989
- ): string | null;
1118
+ export function resolveAliases(
1119
+ manifest: { models?: { [alias: string]: ModelAlias } },
1120
+ rows: ModelRow[],
1121
+ ): { [alias: string]: string | null };
@@ -1,6 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * Every id an alias accepts, in `resolveAlias`'s order.
6
+ */
7
+ export function aliasCandidates(rows: any, alias: any): any;
8
+
4
9
  /**
5
10
  * What a package's files say is wrong with it, from `{files, context?, declaredDialect?,
6
11
  * dependencies?}`: `prepare`, `links::package` and `mars_schema::check::check`, in that order.
@@ -25,6 +30,14 @@ export function emitValue(value: any, indent: number): string;
25
30
  */
26
31
  export function inspect(argument: any): any;
27
32
 
33
+ /**
34
+ * The rows of the providers a project's `catalog_providers` names, the rows `mars models
35
+ * resolve` resolves over: `providers` is that list, `["*"]` allows every provider, and
36
+ * `undefined` is the list a project that sets none gets. A row's provider is its `provider_key`,
37
+ * else its `provider`. The rows come back as given.
38
+ */
39
+ export function narrowRows(rows: any, providers: any): any;
40
+
28
41
  /**
29
42
  * Schema v1 packages for a selection: `{tree, source?, hint?, selection?}` to a `Normalized`.
30
43
  * A remote marketplace plugin is fetched by the caller and normalized as its own tree, with
@@ -45,13 +58,13 @@ export function prepare(argument: any): any;
45
58
  * `meridian-flow`): the native names per action, each rule's gap or coverage, and how the
46
59
  * host handles `ask`. The same code `mars sync` lowers an agent's tools with.
47
60
  */
48
- export function project(rules: any, host: string): any;
61
+ export function project(rules: any, host: any): any;
49
62
 
50
63
  /**
51
64
  * Read one schema file. `path` is package-relative and picks the reader: `mars.toml`,
52
65
  * `agents/<slug>.md` or `skills/<slug>/SKILL.md`. Any other path throws.
53
66
  */
54
- export function read(path: string, text: string): any;
67
+ export function read(path: any, text: any): any;
55
68
 
56
69
  /**
57
70
  * A `hook.toml`'s `[hooks]` as each of `targets` (roots such as `.claude`) takes it:
@@ -71,12 +84,17 @@ export function renderHooks(hook_toml: string, targets: string[], tokens: any):
71
84
  export function resolve(input: any): any;
72
85
 
73
86
  /**
74
- * The model id an `auto` alias selects among models.dev rows, or `null`: every `match` glob
75
- * hits, no `exclude` glob hits, the provider matches when given, `-latest` ids are skipped, and
76
- * the newest `release_date` wins, then the shorter id, then alphabetical order. The code
77
- * `mars models resolve` runs.
87
+ * The model id an alias resolves to among models.dev rows, or `null`: a pinned `model` as
88
+ * written, else the best row an `auto` alias selects. The code `mars models resolve` runs.
89
+ */
90
+ export function resolveAlias(rows: any, alias: any): any;
91
+
92
+ /**
93
+ * Resolve every alias of a parsed manifest's `models`, the way `mars models resolve` does. The
94
+ * manifest is a full reading, so its other keys are not checked; each alias is checked as
95
+ * `resolveAlias` checks its own.
78
96
  */
79
- export function resolveAlias(rows: any, options: any): any;
97
+ export function resolveAliases(manifest: any, rows: any): any;
80
98
 
81
99
  /**
82
100
  * The level to send for `requested` on a model and a host: `{ level, moved }`. `requested` is
@@ -96,13 +114,13 @@ export function rewriteBlock(frontmatter: any): string;
96
114
  * Whether `version` meets a dependency entry's `version` text (`null` or `"latest"` is any
97
115
  * version; a branch or commit pin is met by none). A `version` that is not semver throws.
98
116
  */
99
- export function satisfies(constraint: string | null | undefined, version: string): boolean;
117
+ export function satisfies(constraint: any, version: any): boolean;
100
118
 
101
119
  /**
102
120
  * Whether `version` meets a package's `requires-mars` / `requires-meridian`. A requirement that
103
121
  * is not one, or a `version` that is not semver, throws.
104
122
  */
105
- export function satisfiesRequirement(requirement: string, version: string): boolean;
123
+ export function satisfiesRequirement(requirement: any, version: any): boolean;
106
124
 
107
125
  /**
108
126
  * The items a graph installs: `{requests, packages, root?}` to a `SelectionResult`. `packages` is
@@ -120,8 +138,9 @@ export function selectItems(argument: any): any;
120
138
  * `{pin} | {locked: true} | {tag} | {untagged: true}`. `available` is the repository's tags; one
121
139
  * that is not a version (`nightly`) is ignored. `constraints` is every `[requester, version |
122
140
  * null]` on the package, as the manifests spell them; `locked` is kept (`{locked: true}`, even
123
- * if `available` no longer lists it) when it meets every range and no constraint is `latest`,
124
- * else the newest allowed version is chosen. A refusal throws with a `version.*` code.
141
+ * if `available` no longer lists it) when it meets every range, a `latest` or `null` constraint
142
+ * included (it allows any version, so a locked package stays until it is upgraded); otherwise
143
+ * the newest allowed version is chosen. A refusal throws with a `version.*` code.
125
144
  */
126
145
  export function selectVersion(argument: any): any;
127
146
 
@@ -1,5 +1,28 @@
1
1
  /* @ts-self-types="./mars_schema_wasm.d.ts" */
2
2
 
3
+ /**
4
+ * Every id an alias accepts, in `resolveAlias`'s order.
5
+ * @param {any} rows
6
+ * @param {any} alias
7
+ * @returns {any}
8
+ */
9
+ function aliasCandidates(rows, alias) {
10
+ try {
11
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
12
+ wasm.aliasCandidates(retptr, addHeapObject(rows), addHeapObject(alias));
13
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
14
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
15
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
16
+ if (r2) {
17
+ throw takeObject(r1);
18
+ }
19
+ return takeObject(r0);
20
+ } finally {
21
+ wasm.__wbindgen_add_to_stack_pointer(16);
22
+ }
23
+ }
24
+ exports.aliasCandidates = aliasCandidates;
25
+
3
26
  /**
4
27
  * What a package's files say is wrong with it, from `{files, context?, declaredDialect?,
5
28
  * dependencies?}`: `prepare`, `links::package` and `mars_schema::check::check`, in that order.
@@ -101,6 +124,32 @@ function inspect(argument) {
101
124
  }
102
125
  exports.inspect = inspect;
103
126
 
127
+ /**
128
+ * The rows of the providers a project's `catalog_providers` names, the rows `mars models
129
+ * resolve` resolves over: `providers` is that list, `["*"]` allows every provider, and
130
+ * `undefined` is the list a project that sets none gets. A row's provider is its `provider_key`,
131
+ * else its `provider`. The rows come back as given.
132
+ * @param {any} rows
133
+ * @param {any} providers
134
+ * @returns {any}
135
+ */
136
+ function narrowRows(rows, providers) {
137
+ try {
138
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
139
+ wasm.narrowRows(retptr, addHeapObject(rows), addHeapObject(providers));
140
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
141
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
142
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
143
+ if (r2) {
144
+ throw takeObject(r1);
145
+ }
146
+ return takeObject(r0);
147
+ } finally {
148
+ wasm.__wbindgen_add_to_stack_pointer(16);
149
+ }
150
+ }
151
+ exports.narrowRows = narrowRows;
152
+
104
153
  /**
105
154
  * Schema v1 packages for a selection: `{tree, source?, hint?, selection?}` to a `Normalized`.
106
155
  * A remote marketplace plugin is fetched by the caller and normalized as its own tree, with
@@ -155,15 +204,13 @@ exports.prepare = prepare;
155
204
  * `meridian-flow`): the native names per action, each rule's gap or coverage, and how the
156
205
  * host handles `ask`. The same code `mars sync` lowers an agent's tools with.
157
206
  * @param {any} rules
158
- * @param {string} host
207
+ * @param {any} host
159
208
  * @returns {any}
160
209
  */
161
210
  function project(rules, host) {
162
211
  try {
163
212
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
164
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_export, wasm.__wbindgen_export2);
165
- const len0 = WASM_VECTOR_LEN;
166
- wasm.project(retptr, addHeapObject(rules), ptr0, len0);
213
+ wasm.project(retptr, addHeapObject(rules), addHeapObject(host));
167
214
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
168
215
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
169
216
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -180,18 +227,14 @@ exports.project = project;
180
227
  /**
181
228
  * Read one schema file. `path` is package-relative and picks the reader: `mars.toml`,
182
229
  * `agents/<slug>.md` or `skills/<slug>/SKILL.md`. Any other path throws.
183
- * @param {string} path
184
- * @param {string} text
230
+ * @param {any} path
231
+ * @param {any} text
185
232
  * @returns {any}
186
233
  */
187
234
  function read(path, text) {
188
235
  try {
189
236
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
190
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
191
- const len0 = WASM_VECTOR_LEN;
192
- const ptr1 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
193
- const len1 = WASM_VECTOR_LEN;
194
- wasm.read(retptr, ptr0, len0, ptr1, len1);
237
+ wasm.read(retptr, addHeapObject(path), addHeapObject(text));
195
238
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
196
239
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
197
240
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -263,18 +306,16 @@ function resolve(input) {
263
306
  exports.resolve = resolve;
264
307
 
265
308
  /**
266
- * The model id an `auto` alias selects among models.dev rows, or `null`: every `match` glob
267
- * hits, no `exclude` glob hits, the provider matches when given, `-latest` ids are skipped, and
268
- * the newest `release_date` wins, then the shorter id, then alphabetical order. The code
269
- * `mars models resolve` runs.
309
+ * The model id an alias resolves to among models.dev rows, or `null`: a pinned `model` as
310
+ * written, else the best row an `auto` alias selects. The code `mars models resolve` runs.
270
311
  * @param {any} rows
271
- * @param {any} options
312
+ * @param {any} alias
272
313
  * @returns {any}
273
314
  */
274
- function resolveAlias(rows, options) {
315
+ function resolveAlias(rows, alias) {
275
316
  try {
276
317
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
277
- wasm.resolveAlias(retptr, addHeapObject(rows), addHeapObject(options));
318
+ wasm.resolveAlias(retptr, addHeapObject(rows), addHeapObject(alias));
278
319
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
279
320
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
280
321
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -288,6 +329,31 @@ function resolveAlias(rows, options) {
288
329
  }
289
330
  exports.resolveAlias = resolveAlias;
290
331
 
332
+ /**
333
+ * Resolve every alias of a parsed manifest's `models`, the way `mars models resolve` does. The
334
+ * manifest is a full reading, so its other keys are not checked; each alias is checked as
335
+ * `resolveAlias` checks its own.
336
+ * @param {any} manifest
337
+ * @param {any} rows
338
+ * @returns {any}
339
+ */
340
+ function resolveAliases(manifest, rows) {
341
+ try {
342
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
343
+ wasm.resolveAliases(retptr, addHeapObject(manifest), addHeapObject(rows));
344
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
345
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
346
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
347
+ if (r2) {
348
+ throw takeObject(r1);
349
+ }
350
+ return takeObject(r0);
351
+ } finally {
352
+ wasm.__wbindgen_add_to_stack_pointer(16);
353
+ }
354
+ }
355
+ exports.resolveAliases = resolveAliases;
356
+
291
357
  /**
292
358
  * The level to send for `requested` on a model and a host: `{ level, moved }`. `requested` is
293
359
  * a level, `"auto"` or `null` (both send no effort). `model` is the models.dev row's
@@ -354,18 +420,14 @@ exports.rewriteBlock = rewriteBlock;
354
420
  /**
355
421
  * Whether `version` meets a dependency entry's `version` text (`null` or `"latest"` is any
356
422
  * version; a branch or commit pin is met by none). A `version` that is not semver throws.
357
- * @param {string | null | undefined} constraint
358
- * @param {string} version
423
+ * @param {any} constraint
424
+ * @param {any} version
359
425
  * @returns {boolean}
360
426
  */
361
427
  function satisfies(constraint, version) {
362
428
  try {
363
429
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
364
- var ptr0 = isLikeNone(constraint) ? 0 : passStringToWasm0(constraint, wasm.__wbindgen_export, wasm.__wbindgen_export2);
365
- var len0 = WASM_VECTOR_LEN;
366
- const ptr1 = passStringToWasm0(version, wasm.__wbindgen_export, wasm.__wbindgen_export2);
367
- const len1 = WASM_VECTOR_LEN;
368
- wasm.satisfies(retptr, ptr0, len0, ptr1, len1);
430
+ wasm.satisfies(retptr, addHeapObject(constraint), addHeapObject(version));
369
431
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
370
432
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
371
433
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -382,18 +444,14 @@ exports.satisfies = satisfies;
382
444
  /**
383
445
  * Whether `version` meets a package's `requires-mars` / `requires-meridian`. A requirement that
384
446
  * is not one, or a `version` that is not semver, throws.
385
- * @param {string} requirement
386
- * @param {string} version
447
+ * @param {any} requirement
448
+ * @param {any} version
387
449
  * @returns {boolean}
388
450
  */
389
451
  function satisfiesRequirement(requirement, version) {
390
452
  try {
391
453
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
392
- const ptr0 = passStringToWasm0(requirement, wasm.__wbindgen_export, wasm.__wbindgen_export2);
393
- const len0 = WASM_VECTOR_LEN;
394
- const ptr1 = passStringToWasm0(version, wasm.__wbindgen_export, wasm.__wbindgen_export2);
395
- const len1 = WASM_VECTOR_LEN;
396
- wasm.satisfiesRequirement(retptr, ptr0, len0, ptr1, len1);
454
+ wasm.satisfiesRequirement(retptr, addHeapObject(requirement), addHeapObject(version));
397
455
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
398
456
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
399
457
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -440,8 +498,9 @@ exports.selectItems = selectItems;
440
498
  * `{pin} | {locked: true} | {tag} | {untagged: true}`. `available` is the repository's tags; one
441
499
  * that is not a version (`nightly`) is ignored. `constraints` is every `[requester, version |
442
500
  * null]` on the package, as the manifests spell them; `locked` is kept (`{locked: true}`, even
443
- * if `available` no longer lists it) when it meets every range and no constraint is `latest`,
444
- * else the newest allowed version is chosen. A refusal throws with a `version.*` code.
501
+ * if `available` no longer lists it) when it meets every range, a `latest` or `null` constraint
502
+ * included (it allows any version, so a locked package stays until it is upgraded); otherwise
503
+ * the newest allowed version is chosen. A refusal throws with a `version.*` code.
445
504
  * @param {any} argument
446
505
  * @returns {any}
447
506
  */
@@ -732,6 +791,10 @@ function __wbg_get_imports() {
732
791
  __wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
733
792
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
734
793
  },
794
+ __wbg_push_a6822215aa43e71c: function(arg0, arg1) {
795
+ const ret = getObject(arg0).push(getObject(arg1));
796
+ return ret;
797
+ },
735
798
  __wbg_set_52b1e1eb5bed906a: function(arg0, arg1, arg2) {
736
799
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
737
800
  return addHeapObject(ret);
Binary file
@@ -1,21 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const aliasCandidates: (a: number, b: number, c: number) => void;
4
5
  export const check: (a: number, b: number) => void;
5
6
  export const effortLevels: (a: number) => void;
6
7
  export const emitValue: (a: number, b: number, c: number) => void;
7
8
  export const inspect: (a: number, b: number) => void;
9
+ export const narrowRows: (a: number, b: number, c: number) => void;
8
10
  export const normalize: (a: number, b: number) => void;
9
11
  export const prepare: (a: number, b: number) => void;
10
- export const project: (a: number, b: number, c: number, d: number) => void;
11
- export const read: (a: number, b: number, c: number, d: number, e: number) => void;
12
+ export const project: (a: number, b: number, c: number) => void;
13
+ export const read: (a: number, b: number, c: number) => void;
12
14
  export const renderHooks: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
15
  export const resolve: (a: number, b: number) => void;
14
16
  export const resolveAlias: (a: number, b: number, c: number) => void;
17
+ export const resolveAliases: (a: number, b: number, c: number) => void;
15
18
  export const resolveEffort: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
16
19
  export const rewriteBlock: (a: number, b: number) => void;
17
- export const satisfies: (a: number, b: number, c: number, d: number, e: number) => void;
18
- export const satisfiesRequirement: (a: number, b: number, c: number, d: number, e: number) => void;
20
+ export const satisfies: (a: number, b: number, c: number) => void;
21
+ export const satisfiesRequirement: (a: number, b: number, c: number) => void;
19
22
  export const selectItems: (a: number, b: number) => void;
20
23
  export const selectVersion: (a: number, b: number) => void;
21
24
  export const version: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meridian-flow/mars-schema",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Mars agent schema reader and lossless editor",
5
5
  "license": "MIT",
6
6
  "repository": {