use aion_integration_acp::catalogue;
use aion_server::assistant::mcp::{
ASSISTANT_CONTEXT_TOOL, ASSISTANT_MCP_PATH, SESSION_TOKEN_DESCRIPTION, SESSION_TOKEN_KIND,
};
use aion_server::namespace::grants::GRANT_WORDS;
const API_DOC: &str = include_str!("../../../docs/operations/API.md");
const SESSIONS_DOC: &str = include_str!("../../../docs/assistant/DIRECT-SESSIONS.md");
const DEV_CONFIG: &str = include_str!("../../../dev-config.toml");
const RETIRED_KEYS: &[&str] = &[
"default_harness = ",
"spawn_timeout_ms = ",
"turn_timeout_ms = ",
"event_buffer = ",
"tool_confinement = ",
"exit_grace_ms = ",
"[assistant.tools]",
];
const RETIREMENT_SENTENCE: &str = "Retired, not defaulted";
fn carries(document: &str, name: &str, claim: &str) {
assert!(
document.contains(claim),
"{name} does not carry `{claim}`; a capability an operator cannot read about is one they \
cannot consent to"
);
}
#[test]
fn the_api_reference_names_the_assistant_tool_and_its_route() {
carries(API_DOC, "docs/operations/API.md", ASSISTANT_CONTEXT_TOOL);
carries(API_DOC, "docs/operations/API.md", ASSISTANT_MCP_PATH);
carries(
API_DOC,
"docs/operations/API.md",
"not** in the general catalogue",
);
}
#[test]
fn the_api_reference_names_the_session_token_kind_and_says_what_it_is() {
carries(API_DOC, "docs/operations/API.md", SESSION_TOKEN_KIND);
carries(API_DOC, "docs/operations/API.md", "server-minted");
carries(API_DOC, "docs/operations/API.md", "session-scoped");
carries(API_DOC, "docs/operations/API.md", SESSION_TOKEN_DESCRIPTION);
}
#[test]
fn the_api_reference_names_every_grant_word_with_its_knobs() {
assert!(
!GRANT_WORDS.is_empty(),
"the grant vocabulary is empty, so this pin measures nothing"
);
for grant in GRANT_WORDS {
carries(API_DOC, "docs/operations/API.md", grant.word());
carries(API_DOC, "docs/operations/API.md", grant.header());
}
}
#[test]
fn the_assistant_document_carries_the_grant_word_and_the_session_token() {
let name = "docs/assistant/DIRECT-SESSIONS.md";
carries(SESSIONS_DOC, name, "assistant.sessions");
carries(SESSIONS_DOC, name, "x-aion-assistant-sessions");
carries(SESSIONS_DOC, name, SESSION_TOKEN_KIND);
carries(SESSIONS_DOC, name, "server-minted and session-scoped");
carries(SESSIONS_DOC, name, ASSISTANT_CONTEXT_TOOL);
carries(SESSIONS_DOC, name, ASSISTANT_MCP_PATH);
}
#[test]
fn the_documents_are_really_being_read() {
assert!(
API_DOC.len() > 1_000 && SESSIONS_DOC.len() > 1_000,
"the documents this pin reads are empty or truncated, so every claim above is vacuous"
);
assert!(
!API_DOC.contains("assistant_screenshot"),
"the control claim is present, so this pin cannot tell absence from presence"
);
}
#[test]
fn the_documents_carry_the_catalogue_its_availability_and_the_last_pick() {
assert!(
catalogue::CATALOGUE.len() >= 4,
"the catalogue is empty or short, so the loop below measures nothing"
);
for entry in catalogue::CATALOGUE {
carries(API_DOC, "docs/operations/API.md", entry.id);
carries(API_DOC, "docs/operations/API.md", &entry.launch());
carries(
SESSIONS_DOC,
"docs/assistant/DIRECT-SESSIONS.md",
&entry.launch(),
);
}
for (document, name) in [
(API_DOC, "docs/operations/API.md"),
(SESSIONS_DOC, "docs/assistant/DIRECT-SESSIONS.md"),
] {
carries(document, name, "install_hint");
carries(document, name, "never cached");
carries(document, name, "last pick");
}
}
#[test]
fn no_document_still_teaches_a_retired_assistant_knob() {
for (document, name) in [
(SESSIONS_DOC, "docs/assistant/DIRECT-SESSIONS.md"),
(DEV_CONFIG, "dev-config.toml"),
] {
let found = document.find(RETIREMENT_SENTENCE);
assert!(
found.is_some(),
"{name} must say `{RETIREMENT_SENTENCE}` before it names a retired key"
);
let retirement = found.unwrap_or_default();
for key in RETIRED_KEYS {
if let Some(mentioned) = document.find(key) {
assert!(
mentioned > retirement,
"{name} names the retired key `{key}` before it says the key is retired, so \
an operator reading top-down copies it into a file this server refuses"
);
}
}
carries(document, name, "[[assistant.harness.account]]");
carries(document, name, "AION_CLAUDE_WORK_DIR");
carries(document, name, "claude-code");
}
carries(
SESSIONS_DOC,
"docs/assistant/DIRECT-SESSIONS.md",
"It works out of the box",
);
}
#[test]
fn the_round_two_documents_are_really_being_read() {
assert!(
SESSIONS_DOC.len() > 1_000 && DEV_CONFIG.len() > 1_000,
"the documents these pins read are empty or truncated"
);
assert!(
!SESSIONS_DOC.contains("npx @agentclientprotocol/nonexistent-acp"),
"the control claim is present, so these pins cannot tell absence from presence"
);
}