@meridian-flow/mars-schema 0.32.1 → 0.33.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.
- package/README.md +1 -0
- package/fixtures/prepare/legacy-agent-no-frontmatter/expected/mars.toml +4 -0
- package/fixtures/prepare/legacy-agent-no-frontmatter/expected.json +94 -0
- package/fixtures/prepare/legacy-agent-no-frontmatter/input/agents/coder.md +1 -0
- package/fixtures/prepare/legacy-agent-no-frontmatter/input/mars.toml +3 -0
- package/fixtures/prepare/legacy-agent-no-frontmatter/request.json +3 -0
- package/fixtures/prepare/schema-1-agent-no-frontmatter/expected.json +95 -0
- package/fixtures/prepare/schema-1-agent-no-frontmatter/input/agents/coder.md +5 -0
- package/fixtures/prepare/schema-1-agent-no-frontmatter/input/mars.toml +4 -0
- package/fixtures/prepare/schema-1-agent-no-frontmatter/request.json +3 -0
- package/fixtures/read/agent-frontmatter-clean/agent.md +5 -0
- package/fixtures/read/agent-frontmatter-clean/expected.json +37 -0
- package/fixtures/read/agent-no-frontmatter-body-only/agent.md +1 -0
- package/fixtures/read/agent-no-frontmatter-body-only/expected.json +35 -0
- package/fixtures/read/agent-no-frontmatter-stray-line/agent.md +6 -0
- package/fixtures/read/agent-no-frontmatter-stray-line/expected.json +35 -0
- package/node/mars_schema_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/web/mars_schema_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ interface DefinitionRead<Fields> {
|
|
|
58
58
|
- `fields` has the kebab-case spellings the file uses (`"model-invocable"`, `"harness-overrides"`), `xhigh` and `read-only` as written, and `null` or `[]` where the file sets nothing. `AgentFields`, `SkillFields` and `ManifestFields` are in `index.d.ts`; for `mars.toml`, `frontmatter` holds the pairs of the `[package]` table.
|
|
59
59
|
- `diagnostics` carry a stable `code` (`field.removed`, `field.unknown`, `yaml.anchor`, ...), a `severity` of `error`, `warning` or `info`, and a `path` of keys and indexes into the file (`["model-policies", 0, "when"]`). Locate the diagnostic in the text with your own parser: `range` is for fence and YAML-syntax errors only, and no reader sets it yet. Errors do not stop the reading, so an editor can show the form and the problem together.
|
|
60
60
|
- `frontmatter` omits a key whose value has no JSON form (a YAML tag, a non-string key, an integer beyond ±(2^53 − 1), a `__proto__` key) and reports it as `yaml.non-json-value` (`toml.non-json-value` for `mars.toml`). Mapping keys keep file order at every depth; JavaScript objects list integer-like keys such as `"1"` first.
|
|
61
|
+
- An Agent whose first line is not `---` has no frontmatter, so every field takes its default and the file reads as the widest Agent. `read("agents/<slug>.md", text)` reports it as the error `frontmatter.missing`, with the defaults in `fields` and the whole file in `body`; `prepare` reports it the same way for a schema 1 package. A pre-v1 or foreign package's body-only Agent is not an error, and a skill with no frontmatter keeps its `skill.no-frontmatter` warning.
|
|
61
62
|
- Frontmatter has two limits, because the YAML scanners take time that grows with the square of the nesting depth and a server that reads untrusted files must not stall: a block over 64 KiB is `frontmatter.too-large`, and one that opens `[` or `{` more than 64 deep (counted over the raw text) is `frontmatter.too-deep`. Either gives `fields: null` and no other diagnostic. Real frontmatter is under 2 KiB and nests a few levels; the limits apply to `read`, `prepare` and `normalize` alike.
|
|
62
63
|
|
|
63
64
|
### Editing without losing the rest of the file
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"classification": {
|
|
3
|
+
"kind": "mars-legacy"
|
|
4
|
+
},
|
|
5
|
+
"manifest": {
|
|
6
|
+
"source_path": "mars.toml",
|
|
7
|
+
"output_path": "mars.toml",
|
|
8
|
+
"reading": {
|
|
9
|
+
"frontmatter": [
|
|
10
|
+
[
|
|
11
|
+
"name",
|
|
12
|
+
"demo"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"version",
|
|
16
|
+
"1.0.0"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"schema",
|
|
20
|
+
1
|
|
21
|
+
]
|
|
22
|
+
],
|
|
23
|
+
"fields": {
|
|
24
|
+
"name": "demo",
|
|
25
|
+
"version": "1.0.0",
|
|
26
|
+
"schema": 1
|
|
27
|
+
},
|
|
28
|
+
"body": null,
|
|
29
|
+
"diagnostics": []
|
|
30
|
+
},
|
|
31
|
+
"change": {
|
|
32
|
+
"kind": "edited",
|
|
33
|
+
"paths": [
|
|
34
|
+
[
|
|
35
|
+
"package",
|
|
36
|
+
"schema"
|
|
37
|
+
]
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"definitions": [
|
|
42
|
+
{
|
|
43
|
+
"kind": "agent",
|
|
44
|
+
"slug": "coder",
|
|
45
|
+
"source_path": "agents/coder.md",
|
|
46
|
+
"output_path": "agents/coder.md",
|
|
47
|
+
"reading": {
|
|
48
|
+
"frontmatter": [],
|
|
49
|
+
"fields": {
|
|
50
|
+
"name": null,
|
|
51
|
+
"description": null,
|
|
52
|
+
"harness": null,
|
|
53
|
+
"model": null,
|
|
54
|
+
"mode": null,
|
|
55
|
+
"model-invocable": true,
|
|
56
|
+
"user-invocable": true,
|
|
57
|
+
"approval": null,
|
|
58
|
+
"sandbox": null,
|
|
59
|
+
"network": null,
|
|
60
|
+
"network-allow": [],
|
|
61
|
+
"network-deny": [],
|
|
62
|
+
"effort": null,
|
|
63
|
+
"skills": {
|
|
64
|
+
"load": [],
|
|
65
|
+
"available": []
|
|
66
|
+
},
|
|
67
|
+
"subagents": [],
|
|
68
|
+
"tools": [],
|
|
69
|
+
"harness-overrides": {},
|
|
70
|
+
"model-policies": []
|
|
71
|
+
},
|
|
72
|
+
"body": "Body only\n",
|
|
73
|
+
"diagnostics": []
|
|
74
|
+
},
|
|
75
|
+
"change": {
|
|
76
|
+
"kind": "none"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"payload": [],
|
|
81
|
+
"selection": {
|
|
82
|
+
"definitions": [
|
|
83
|
+
{
|
|
84
|
+
"kind": "agent",
|
|
85
|
+
"slug": "coder",
|
|
86
|
+
"output_path": "agents/coder.md",
|
|
87
|
+
"skills": []
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"edges": [],
|
|
91
|
+
"uses_providers": []
|
|
92
|
+
},
|
|
93
|
+
"diagnostics": {}
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Body only
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"classification": {
|
|
3
|
+
"kind": "schema-1"
|
|
4
|
+
},
|
|
5
|
+
"manifest": {
|
|
6
|
+
"source_path": "mars.toml",
|
|
7
|
+
"output_path": "mars.toml",
|
|
8
|
+
"reading": {
|
|
9
|
+
"frontmatter": [
|
|
10
|
+
[
|
|
11
|
+
"name",
|
|
12
|
+
"demo"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"version",
|
|
16
|
+
"1.0.0"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"schema",
|
|
20
|
+
1
|
|
21
|
+
]
|
|
22
|
+
],
|
|
23
|
+
"fields": {
|
|
24
|
+
"name": "demo",
|
|
25
|
+
"version": "1.0.0",
|
|
26
|
+
"schema": 1
|
|
27
|
+
},
|
|
28
|
+
"body": null,
|
|
29
|
+
"diagnostics": []
|
|
30
|
+
},
|
|
31
|
+
"change": {
|
|
32
|
+
"kind": "none"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"definitions": [
|
|
36
|
+
{
|
|
37
|
+
"kind": "agent",
|
|
38
|
+
"slug": "coder",
|
|
39
|
+
"source_path": "agents/coder.md",
|
|
40
|
+
"output_path": "agents/coder.md",
|
|
41
|
+
"reading": {
|
|
42
|
+
"frontmatter": [],
|
|
43
|
+
"fields": {
|
|
44
|
+
"name": null,
|
|
45
|
+
"description": null,
|
|
46
|
+
"harness": null,
|
|
47
|
+
"model": null,
|
|
48
|
+
"mode": null,
|
|
49
|
+
"model-invocable": true,
|
|
50
|
+
"user-invocable": true,
|
|
51
|
+
"approval": null,
|
|
52
|
+
"sandbox": null,
|
|
53
|
+
"network": null,
|
|
54
|
+
"network-allow": [],
|
|
55
|
+
"network-deny": [],
|
|
56
|
+
"effort": null,
|
|
57
|
+
"skills": {
|
|
58
|
+
"load": [],
|
|
59
|
+
"available": []
|
|
60
|
+
},
|
|
61
|
+
"subagents": [],
|
|
62
|
+
"tools": [],
|
|
63
|
+
"harness-overrides": {},
|
|
64
|
+
"model-policies": []
|
|
65
|
+
},
|
|
66
|
+
"body": "stray\n---\nsandbox: read-only\n---\nBody\n",
|
|
67
|
+
"diagnostics": [
|
|
68
|
+
{
|
|
69
|
+
"code": "frontmatter.missing",
|
|
70
|
+
"severity": "error",
|
|
71
|
+
"path": [],
|
|
72
|
+
"message": "an Agent's frontmatter must open with a first line that is exactly `---`; without it every field takes its default"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"change": {
|
|
77
|
+
"kind": "none"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"payload": [],
|
|
82
|
+
"selection": {
|
|
83
|
+
"definitions": [
|
|
84
|
+
{
|
|
85
|
+
"kind": "agent",
|
|
86
|
+
"slug": "coder",
|
|
87
|
+
"output_path": "agents/coder.md",
|
|
88
|
+
"skills": []
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"edges": [],
|
|
92
|
+
"uses_providers": []
|
|
93
|
+
},
|
|
94
|
+
"diagnostics": {}
|
|
95
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"frontmatter": [
|
|
3
|
+
[
|
|
4
|
+
"name",
|
|
5
|
+
"reviewer"
|
|
6
|
+
],
|
|
7
|
+
[
|
|
8
|
+
"sandbox",
|
|
9
|
+
"read-only"
|
|
10
|
+
]
|
|
11
|
+
],
|
|
12
|
+
"fields": {
|
|
13
|
+
"name": "reviewer",
|
|
14
|
+
"description": null,
|
|
15
|
+
"harness": null,
|
|
16
|
+
"model": null,
|
|
17
|
+
"mode": null,
|
|
18
|
+
"model-invocable": true,
|
|
19
|
+
"user-invocable": true,
|
|
20
|
+
"approval": null,
|
|
21
|
+
"sandbox": "read-only",
|
|
22
|
+
"network": null,
|
|
23
|
+
"network-allow": [],
|
|
24
|
+
"network-deny": [],
|
|
25
|
+
"effort": null,
|
|
26
|
+
"skills": {
|
|
27
|
+
"load": [],
|
|
28
|
+
"available": []
|
|
29
|
+
},
|
|
30
|
+
"subagents": [],
|
|
31
|
+
"tools": [],
|
|
32
|
+
"harness-overrides": {},
|
|
33
|
+
"model-policies": []
|
|
34
|
+
},
|
|
35
|
+
"body": "You are a reviewer.\n",
|
|
36
|
+
"diagnostics": []
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
You are a reviewer.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"frontmatter": [],
|
|
3
|
+
"fields": {
|
|
4
|
+
"name": null,
|
|
5
|
+
"description": null,
|
|
6
|
+
"harness": null,
|
|
7
|
+
"model": null,
|
|
8
|
+
"mode": null,
|
|
9
|
+
"model-invocable": true,
|
|
10
|
+
"user-invocable": true,
|
|
11
|
+
"approval": null,
|
|
12
|
+
"sandbox": null,
|
|
13
|
+
"network": null,
|
|
14
|
+
"network-allow": [],
|
|
15
|
+
"network-deny": [],
|
|
16
|
+
"effort": null,
|
|
17
|
+
"skills": {
|
|
18
|
+
"load": [],
|
|
19
|
+
"available": []
|
|
20
|
+
},
|
|
21
|
+
"subagents": [],
|
|
22
|
+
"tools": [],
|
|
23
|
+
"harness-overrides": {},
|
|
24
|
+
"model-policies": []
|
|
25
|
+
},
|
|
26
|
+
"body": "You are a reviewer.\n",
|
|
27
|
+
"diagnostics": [
|
|
28
|
+
{
|
|
29
|
+
"code": "frontmatter.missing",
|
|
30
|
+
"severity": "error",
|
|
31
|
+
"path": [],
|
|
32
|
+
"message": "an Agent's frontmatter must open with a first line that is exactly `---`; without it every field takes its default"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"frontmatter": [],
|
|
3
|
+
"fields": {
|
|
4
|
+
"name": null,
|
|
5
|
+
"description": null,
|
|
6
|
+
"harness": null,
|
|
7
|
+
"model": null,
|
|
8
|
+
"mode": null,
|
|
9
|
+
"model-invocable": true,
|
|
10
|
+
"user-invocable": true,
|
|
11
|
+
"approval": null,
|
|
12
|
+
"sandbox": null,
|
|
13
|
+
"network": null,
|
|
14
|
+
"network-allow": [],
|
|
15
|
+
"network-deny": [],
|
|
16
|
+
"effort": null,
|
|
17
|
+
"skills": {
|
|
18
|
+
"load": [],
|
|
19
|
+
"available": []
|
|
20
|
+
},
|
|
21
|
+
"subagents": [],
|
|
22
|
+
"tools": [],
|
|
23
|
+
"harness-overrides": {},
|
|
24
|
+
"model-policies": []
|
|
25
|
+
},
|
|
26
|
+
"body": "oops\n---\nname: reviewer\nsandbox: read-only\n---\nYou are a reviewer.\n",
|
|
27
|
+
"diagnostics": [
|
|
28
|
+
{
|
|
29
|
+
"code": "frontmatter.missing",
|
|
30
|
+
"severity": "error",
|
|
31
|
+
"path": [],
|
|
32
|
+
"message": "an Agent's frontmatter must open with a first line that is exactly `---`; without it every field takes its default"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|