Type tool request closure semantics

This commit is contained in:
Meta Vens 2026-07-13 02:12:45 +01:00
commit de58096bc6
6 changed files with 179 additions and 36 deletions

View file

@ -6597,80 +6597,71 @@ fn closure_family_assertions(
);
}
"repo.tool_request" => {
let request = parse_repo_tool_request(&content).ok();
push_assertion(
&mut assertions,
"tool-request-schema-present",
content.contains("schema_version = \"epiphany.repo_tool_request.v0\""),
request
.as_ref()
.is_some_and(RepoToolRequest::has_canonical_identity),
"Committed tool request carries the schema version.".to_string(),
);
push_assertion(
&mut assertions,
"tool-request-family-present",
content.contains("safe_action_family = \"repo.tool_request\""),
request
.as_ref()
.is_some_and(RepoToolRequest::has_canonical_identity),
"Committed tool request carries the safe action family.".to_string(),
);
push_assertion(
&mut assertions,
"tool-request-summary-present",
content.contains(&compact_summary),
request
.as_ref()
.is_some_and(|request| request.summary == compact_summary),
"Committed tool request contains the accepted pressure summary.".to_string(),
);
push_assertion(
&mut assertions,
"tool-request-section-present",
content.contains("[request]")
&& content.contains("target_directory = \"gamecult-local/daemon-tool-directory\"")
&& content.contains(
"target_capability = \"daemon-tool-capability:selected-by-review\"",
)
&& content.contains("operation = \"submitTypedToolIntent\""),
request
.as_ref()
.is_some_and(RepoToolRequest::has_request_contract),
"Committed tool request names the daemon tool directory and typed intent operation."
.to_string(),
);
push_assertion(
&mut assertions,
"tool-request-cultmesh-contracts",
content.contains("[cultmesh]")
&& content.contains(
"intent_contract = \"epiphany.cultmesh.daemon_tool_invocation_intent.v0\"",
)
&& content.contains(
"receipt_contract = \"epiphany.cultmesh.daemon_tool_invocation_receipt.v0\"",
)
&& content.contains("host_daemon_owns_execution = true")
&& content.contains("requester_owns_request = false")
&& content.contains("requires_host_liveness_ready = true")
&& content.contains("requires_cultmesh_receipts = true"),
request
.as_ref()
.is_some_and(RepoToolRequest::has_cultmesh_contract),
"Committed tool request names typed CultMesh contracts, host liveness, and host execution ownership.".to_string(),
);
push_assertion(
&mut assertions,
"tool-request-odin-provider-ownership",
content.contains("[odin]")
&& content.contains("discoverable = true")
&& content.contains("preserves_provider_ownership = true")
&& content.contains("private_verse_passthrough = false"),
request
.as_ref()
.is_some_and(RepoToolRequest::has_odin_contract),
"Committed tool request preserves Odin discovery and provider ownership boundaries."
.to_string(),
);
push_assertion(
&mut assertions,
"tool-request-authority-seals",
content.contains("[authority]")
&& content.contains("direct_tool_execution = false")
&& content.contains("arbitrary_shell_authority = false")
&& content.contains("hands_action_authority = false")
&& content.contains("state_commit_authority = false")
&& content.contains("publication_authority = false")
&& content.contains("service_lifecycle_authority = false")
&& content.contains("cross_body_mutation_authority = false")
&& content.contains("private_verse_rummaging = false"),
request
.as_ref()
.is_some_and(RepoToolRequest::has_authority_seals),
"Committed tool request denies direct execution, shell, Hands, state, publication, lifecycle, cross-body, and private-rummaging authority.".to_string(),
);
push_assertion(
&mut assertions,
"tool-request-private-seal",
content.contains("private_state_exposed = false"),
request
.as_ref()
.is_some_and(|request| !request.private_state_exposed),
"Committed tool request preserves the private-state seal.".to_string(),
);
}

View file

@ -1,6 +1,141 @@
use anyhow::{Context, Result};
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub(super) struct RepoToolRequest {
pub(super) schema_version: String,
pub(super) safe_action_family: String,
pub(super) summary: String,
pub(super) private_state_exposed: bool,
pub(super) request: RepoToolRequestBody,
pub(super) cultmesh: RepoToolRequestCultMesh,
pub(super) odin: RepoToolRequestOdin,
pub(super) authority: RepoToolRequestAuthority,
}
impl RepoToolRequest {
pub(super) fn has_canonical_identity(&self) -> bool {
self.schema_version == "epiphany.repo_tool_request.v0"
&& self.safe_action_family == "repo.tool_request"
}
pub(super) fn has_request_contract(&self) -> bool {
self.request.target_directory == "gamecult-local/daemon-tool-directory"
&& self.request.target_capability == "daemon-tool-capability:selected-by-review"
&& self.request.operation == "submitTypedToolIntent"
}
pub(super) fn has_cultmesh_contract(&self) -> bool {
self.cultmesh.intent_contract == "epiphany.cultmesh.daemon_tool_invocation_intent.v0"
&& self.cultmesh.receipt_contract
== "epiphany.cultmesh.daemon_tool_invocation_receipt.v0"
&& self.cultmesh.host_daemon_owns_execution
&& !self.cultmesh.requester_owns_request
&& self.cultmesh.requires_host_liveness_ready
&& self.cultmesh.requires_cultmesh_receipts
}
pub(super) fn has_odin_contract(&self) -> bool {
self.odin.discoverable
&& self.odin.preserves_provider_ownership
&& !self.odin.private_verse_passthrough
}
pub(super) fn has_authority_seals(&self) -> bool {
!self.authority.direct_tool_execution
&& !self.authority.arbitrary_shell_authority
&& !self.authority.hands_action_authority
&& !self.authority.state_commit_authority
&& !self.authority.publication_authority
&& !self.authority.service_lifecycle_authority
&& !self.authority.cross_body_mutation_authority
&& !self.authority.private_verse_rummaging
}
}
#[derive(Debug, Deserialize)]
pub(super) struct RepoToolRequestBody {
target_directory: String,
target_capability: String,
operation: String,
}
#[derive(Debug, Deserialize)]
pub(super) struct RepoToolRequestCultMesh {
intent_contract: String,
receipt_contract: String,
host_daemon_owns_execution: bool,
requester_owns_request: bool,
requires_host_liveness_ready: bool,
requires_cultmesh_receipts: bool,
}
#[derive(Debug, Deserialize)]
pub(super) struct RepoToolRequestOdin {
discoverable: bool,
preserves_provider_ownership: bool,
private_verse_passthrough: bool,
}
#[derive(Debug, Deserialize)]
pub(super) struct RepoToolRequestAuthority {
pub(super) direct_tool_execution: bool,
arbitrary_shell_authority: bool,
hands_action_authority: bool,
state_commit_authority: bool,
publication_authority: bool,
service_lifecycle_authority: bool,
cross_body_mutation_authority: bool,
private_verse_rummaging: bool,
}
pub(super) fn parse_repo_tool_request(text: &str) -> Result<RepoToolRequest> {
toml::from_str(text).context("tool request is not valid typed TOML")
}
#[cfg(test)]
mod tool_request_tests {
use super::*;
#[test]
fn comment_cannot_counterfeit_direct_execution_seal() {
let text = r#"
schema_version = "epiphany.repo_tool_request.v0"
safe_action_family = "repo.tool_request"
summary = "summary"
private_state_exposed = false
[request]
target_directory = "gamecult-local/daemon-tool-directory"
target_capability = "daemon-tool-capability:selected-by-review"
operation = "submitTypedToolIntent"
[cultmesh]
intent_contract = "epiphany.cultmesh.daemon_tool_invocation_intent.v0"
receipt_contract = "epiphany.cultmesh.daemon_tool_invocation_receipt.v0"
host_daemon_owns_execution = true
requester_owns_request = false
requires_host_liveness_ready = true
requires_cultmesh_receipts = true
[odin]
discoverable = true
preserves_provider_ownership = true
private_verse_passthrough = false
[authority]
# direct_tool_execution = false
direct_tool_execution = true
arbitrary_shell_authority = false
hands_action_authority = false
state_commit_authority = false
publication_authority = false
service_lifecycle_authority = false
cross_body_mutation_authority = false
private_verse_rummaging = false
"#;
let request = parse_repo_tool_request(text).expect("fixture is typed TOML");
assert!(request.authority.direct_tool_execution);
assert!(!request.has_authority_seals());
}
}
#[derive(Debug, Deserialize)]
pub(super) struct RepoDeploymentConfig {
pub(super) schema_version: String,

View file

@ -789,6 +789,16 @@ parent binary, not promoted into a generic global policy API. New typed closure
families belong in this contract organ when they protect a named family
invariant; do not rebuild generic policy mush.
## Tool-request prose substituted for typed authority
`repo.tool_request` closure treated the presence of authority-denial strings as
proof that direct execution, shell, Hands, state, publication, lifecycle,
cross-body, and private-Verse authority were absent. A comment could therefore
counterfeit the seal while the typed value granted execution. The family now
parses through `closure_contracts.rs` and checks exact request, CultMesh, Odin,
and authority semantics. A regression fixture proves commented denial text
cannot conceal `direct_tool_execution = true`.
## Unresolved: provider receipts without chronology
Bifrost body-change/GitHub publication receipts are externally owned and their

View file

@ -234,7 +234,14 @@ Historical implementation detail belongs in git history, smoke artifacts, and th
## Next real move
Continue the modeling pass beyond receipt writers. Inventory production paths where a projection, cache, adapter, scheduler, coordinator, or compatibility surface asserts a fact owned elsewhere. For each candidate, name the owner, allowed inputs, emitted state, forbidden writers, and negative proof before changing code. Also audit remaining non-receipt smoke binaries for path escape or destructive scope.
Continue the modeling pass beyond receipt writers. Tool-request closure now uses
the typed family contract and cannot accept comment-counterfeit execution seals.
Inventory remaining substring closure families and production paths where a
projection, cache, adapter, scheduler, coordinator, or compatibility surface
asserts a fact owned elsewhere. For each candidate, name the owner, allowed
inputs, emitted state, forbidden writers, and negative proof before changing
code. Also audit remaining non-receipt smoke binaries for path escape or
destructive scope.
## Verification baseline

Binary file not shown.

View file

@ -660,4 +660,4 @@ current_status:
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. swarm overview readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync.
next_action: Continue the conceptual-substitution pass. Typed deployment config/request, secret-policy, and dependency-policy contracts now live in parent-private epiphany_work/closure_contracts.rs; add future family validators there only when they protect named invariants, never as generic policy mush. Operational/evidence/self-state and operator mirrors follow owned clocks; identity chains are typed; scheduling/runbook selection do not parse prose; verse-query smoke deletion is canonically confined; writerless readiness-review is deleted. Bifrost provider receipts still need provider chronology and artifact/metrics request identity. Continue auditing remaining substring closure families, destructive path consumers, evidence/security mirrors, and adapters for borrowed authority.
next_action: Continue the conceptual-substitution pass. Typed deployment config/request, secret-policy, dependency-policy, and tool-request contracts now live in parent-private epiphany_work/closure_contracts.rs; tool-request comments cannot counterfeit execution-denial seals. Add future family validators there only when they protect named invariants, never as generic policy mush. Operational/evidence/self-state and operator mirrors follow owned clocks; identity chains are typed; scheduling/runbook selection do not parse prose; verse-query smoke deletion is canonically confined; writerless readiness-review is deleted. Bifrost provider receipts still need provider chronology and artifact/metrics request identity. Continue auditing remaining substring closure families, destructive path consumers, evidence/security mirrors, and adapters for borrowed authority.