pack.verify
Přečte adresář balíčku uvnitř repozitáře proti jeho pack.json: každý soubor, který jmenuje, je přítomen se svým digestem a nic jiného tam není, obsah každého nesení souboru má digest, který zaznamenává jeho značka, žádná nesená cesta není binárka, artefakt, odkaz ani gitlink podle profilu, který manifest jmenuje, žádný soubor nepřekračuje tokenový rozpočet profilu ani neobsahuje bajt NUL či únik a souborů není víc, než profil dovoluje. Nečitelný manifest je neměřeno, nikdy ne úspěch.
Přečte adresář balíčku uvnitř repozitáře proti jeho pack.json: každý soubor, který jmenuje, je přítomen se svým digestem a nic jiného tam není, obsah každého nesení souboru má digest, který zaznamenává jeho značka, žádná nesená cesta není binárka, artefakt, odkaz ani gitlink podle profilu, který manifest jmenuje, žádný soubor nepřekračuje tokenový rozpočet profilu ani neobsahuje bajt NUL či únik a souborů není víc, než profil dovoluje. Nečitelný manifest je neměřeno, nikdy ne úspěch.
- query
- behaviorally_verified
- module pack
- #pack
- #archive
- #privacy
- #evidence
Zpřístupnění
Kde je tato jedna definice dosažitelná. Absence je explicitní: povrch, který není uveden, ji nenese.
| povrch | jako |
|---|---|
| MCP | nástroj majordomus_pack_verify |
| HTTP | GET /api/v1/pack/verify operationId pack.verify |
| příkazová řádka | majordomus pack verify |
Schémata
Kanonický vstup a výstup z typů Rustu; schéma nástroje MCP a parametry a odpovědi OpenAPI se odvozují z nich.
vstup · PackVerifyInput
pack.verify: adresář zapsaného balíčku, který musí ležet uvnitř repozitáře, ze kterého byl sestaven.
use majordomus_cli::capability::builtin::pack::PackVerifyInput;
let input = PackVerifyInput { dir: "tmp/packs/x".into() };
assert_eq!(input.dir, "tmp/packs/x");| vlastnost | typ | povinné | popis |
|---|---|---|---|
| dir | string | ano | Adresář balíčku uvnitř repozitáře: relativní k jeho kořeni, nebo absolutní pod ním. |
JSON Schema
{
"additionalProperties": false,
"description": "The input of `pack.verify`: the directory of a pack that was written, which must lie\ninside the repository it was built from.\n\n```\nuse majordomus_cli::capability::builtin::pack::PackVerifyInput;\nlet input = PackVerifyInput { dir: \"tmp/packs/x\".into() };\nassert_eq!(input.dir, \"tmp/packs/x\");\n```",
"properties": {
"dir": {
"description": "The pack's directory, inside the repository: relative to its root, or absolute\nunder it.",
"type": "string"
}
},
"required": [
"dir"
],
"title": "PackVerifyInput",
"type": "object"
}výstup · PackVerdict
Příklady níže sestavují balíček repozitáře obsahujícího main.rs.
use majordomus_cli::pack::{build, plan, verify, PackVerdict, Profiles};
#### use std::process::Command;
#### let dir = tempfile::tempdir().unwrap();
#### let (root, share) = (dir.path().join("repo"), dir.path().join("share"));
#### std::fs::create_dir_all(&root).unwrap();
#### std::fs::create_dir_all(&share).unwrap();
#### std::fs::write(share.join("archive.yaml"), "default: chat\nprofiles:\n - id: chat\n binary: drop\n artifacts: drop\n shards:\n max_count: 5\n max_tokens: 4000\n").unwrap();
#### let git = |a: &[&str]| assert!(Command::new("git").arg("-C").arg(&root)
#### .args(["-c", "user.email=t@example.com", "-c", "user.name=t"]).args(a)
#### .status().unwrap().success());
#### git(&["init", "-q"]);
#### std::fs::write(root.join("main.rs"), "fn main() {}\n").unwrap();
#### git(&["add", "-A"]);
#### git(&["commit", "-q", "-m", "one"]);
let profiles = Profiles::load(&share, &root).unwrap();
let out = dir.path().join("pack");
let v: PackVerdict = build(&plan(&root, &share, None), &root, &out).unwrap();
assert_eq!((v.files, v.sources), (2, 1), "the index and one shard, carrying one file");
assert_eq!(v.profile.as_deref(), Some("chat"));
// a directory with no manifest is not measured, which is not a pass
let v: PackVerdict = verify(dir.path(), &profiles, &root);
assert!(!v.measured && !v.passes);| vlastnost | typ | povinné | popis |
|---|---|---|---|
| commit | string | null | ne | Commit, který pojmenovává jeho manifest. |
| dir | string | ano | Přečtený adresář. |
| soubory | integer | ano | Kolik souborů drží, včetně indexu. |
| zjištění | array | ano | Každý nález. Prázdné je úspěšná odpověď. |
| largest_tokens | integer | ano | Tokeny jeho největšího souboru. |
| naměřeno | boolean | ano | Zda se balíček vůbec dal přečíst. false není úspěch. |
| průchody | boolean | ano | true, když byl balíček přečten a nic se nenašlo. |
| profil | string | null | ne | Profil, který pojmenovává jeho manifest. |
| důvod | string | null | ne | Proč to nešlo, když to nešlo. |
| zdroje | integer | ano | Kolik zdrojových souborů jeho shardy nesou. |
JSON Schema
{
"$defs": {
"PackFinding": {
"description": "A reason the pack cannot be built as planned, or a written pack is not what its\nmanifest says: a stable code, the path when there is one, and the remedy.\n\nThe examples below plan a repository holding `main.rs` and a `logo.png` whose content is\nbinary, with a distribution whose `chat` profile has limits and whose `bare` one has none.\n\n```\nuse majordomus_cli::pack::{plan, PackFinding};\n# use std::process::Command;\n# let dir = tempfile::tempdir().unwrap();\n# let (root, share) = (dir.path().join(\"repo\"), dir.path().join(\"share\"));\n# std::fs::create_dir_all(&root).unwrap();\n# std::fs::create_dir_all(&share).unwrap();\n# std::fs::write(share.join(\"archive.yaml\"), \"default: chat\\nprofiles:\\n - id: chat\\n binary: drop\\n artifacts: drop\\n shards:\\n max_count: 5\\n max_tokens: 4000\\n - id: bare\\n binary: drop\\n\").unwrap();\n# let git = |a: &[&str]| assert!(Command::new(\"git\").arg(\"-C\").arg(&root)\n# .args([\"-c\", \"user.email=t@example.com\", \"-c\", \"user.name=t\"]).args(a)\n# .status().unwrap().success());\n# git(&[\"init\", \"-q\"]);\n# std::fs::write(root.join(\"main.rs\"), \"fn main() {}\\n\").unwrap();\n# std::fs::write(root.join(\"logo.png\"), b\"\\x89PNG\\0\\x01\").unwrap();\n# git(&[\"add\", \"-A\"]);\n# git(&[\"commit\", \"-q\", \"-m\", \"one\"]);\nlet findings: Vec<PackFinding> = plan(&root, &share, Some(\"bare\")).plan.findings;\nassert_eq!(findings[0].code, \"pack.no_limits\");\nassert!(findings[0].path.is_none() && !findings[0].remedy.is_empty());\n```",
"properties": {
"code": {
"description": "A stable code: `pack.file_too_large`, `pack.too_many_shards`, `pack.index_too_large`, `pack.leak`,\n`pack.empty`, `pack.no_limits`, and from verification `pack.tampered`,\n`pack.not_text`, `pack.forbidden_path`, `pack.missing`, `pack.stray`,\n`pack.over_budget`, `pack.manifest`.",
"type": "string"
},
"message": {
"description": "What is wrong.",
"type": "string"
},
"path": {
"description": "The path the finding is about, when it is about one.",
"type": [
"string",
"null"
]
},
"remedy": {
"description": "What settles it.",
"type": "string"
}
},
"required": [
"code",
"message",
"remedy"
],
"type": "object"
}
},
"description": "The verdict on a written pack: whether it could be read, what its manifest names, how\nmany files and sources it holds, and every finding against it.\n\nThe examples below build a pack of a repository holding `main.rs`.\n\n```\nuse majordomus_cli::pack::{build, plan, verify, PackVerdict, Profiles};\n# use std::process::Command;\n# let dir = tempfile::tempdir().unwrap();\n# let (root, share) = (dir.path().join(\"repo\"), dir.path().join(\"share\"));\n# std::fs::create_dir_all(&root).unwrap();\n# std::fs::create_dir_all(&share).unwrap();\n# std::fs::write(share.join(\"archive.yaml\"), \"default: chat\\nprofiles:\\n - id: chat\\n binary: drop\\n artifacts: drop\\n shards:\\n max_count: 5\\n max_tokens: 4000\\n\").unwrap();\n# let git = |a: &[&str]| assert!(Command::new(\"git\").arg(\"-C\").arg(&root)\n# .args([\"-c\", \"user.email=t@example.com\", \"-c\", \"user.name=t\"]).args(a)\n# .status().unwrap().success());\n# git(&[\"init\", \"-q\"]);\n# std::fs::write(root.join(\"main.rs\"), \"fn main() {}\\n\").unwrap();\n# git(&[\"add\", \"-A\"]);\n# git(&[\"commit\", \"-q\", \"-m\", \"one\"]);\nlet profiles = Profiles::load(&share, &root).unwrap();\nlet out = dir.path().join(\"pack\");\nlet v: PackVerdict = build(&plan(&root, &share, None), &root, &out).unwrap();\nassert_eq!((v.files, v.sources), (2, 1), \"the index and one shard, carrying one file\");\nassert_eq!(v.profile.as_deref(), Some(\"chat\"));\n// a directory with no manifest is not measured, which is not a pass\nlet v: PackVerdict = verify(dir.path(), &profiles, &root);\nassert!(!v.measured && !v.passes);\n```",
"properties": {
"commit": {
"description": "The commit its manifest names.",
"type": [
"string",
"null"
]
},
"dir": {
"description": "The directory read.",
"type": "string"
},
"files": {
"description": "How many files it holds, the index included.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"findings": {
"description": "Every finding. Empty is the passing answer.",
"items": {
"$ref": "#/$defs/PackFinding"
},
"type": "array"
},
"largest_tokens": {
"description": "The tokens of its largest file.",
"format": "uint64",
"minimum": 0,
"type": "integer"
},
"measured": {
"description": "Whether the pack could be read at all. `false` is not a pass.",
"type": "boolean"
},
"passes": {
"description": "`true` when the pack was read and nothing was found.",
"type": "boolean"
},
"profile": {
"description": "The profile its manifest names.",
"type": [
"string",
"null"
]
},
"reason": {
"description": "Why it could not, when it could not.",
"type": [
"string",
"null"
]
},
"sources": {
"description": "How many source files its shards carry.",
"format": "uint",
"minimum": 0,
"type": "integer"
}
},
"required": [
"measured",
"dir",
"files",
"sources",
"largest_tokens",
"findings",
"passes"
],
"title": "PackVerdict",
"type": "object"
}Politiky
- benchmark
- povinné — cíl na každém transportu, který expozice deklaruje; případy jsou ty ze vstupního typu
- cache
- vypnuto — každé volání spustí handler
Cíle benchmarku
Odvozeno z registru pro tento repozitář: jeden požadavek na transport a případy, které poskytuje typ vstupu. Celá matice je na stránce měření výkonu.