feat(agent-identity): v0.0.24 pallet-agent-identity scaffold trait-first (Phase 2.7 Inmutable #41 AGI DIDs)

Phase 2.7 AGENT IDENTITY pallet scaffold canonical. AGI DIDs canonical on-chain.
Inmutable #41 AGI Cross-Species Co-authorship materialized compile-detect via
NEW crate origin-chain-agent-identity + canonical types en origin-chain-types::identity.

## NEW canonical types en origin-chain-types

- AgentIdentity struct (6 fields: did + kind + creator + registered_at_block + provenance_proof + agent_chain)
- AgentKind enum (Human + AGI + Hybrid) per Inmutable #41
- Did type alias = AssetHash (BLAKE3 32-byte deterministic via public_key)

## NEW canonical pallet origin-chain-agent-identity

- Pallet<T> + Config trait (AccountId = origin_chain_types::AccountId constraint)
- Identities<StorageMap<AccountId, AgentIdentity>> per-account O(1)
- DidToAccount<StorageMap<Did, AccountId>> reverse lookup O(1)
- Event::AgentRegistered + AgentBound + AgentUpdated
- Error::AlreadyRegistered + DidAlreadyTaken + AgentChainOverflow + HybridRequiresAgentChain
- Scaffold dispatchable register_agent_did (placeholder event v0.0.24 → real v0.0.26)
- Helper derive_did(public_key) -> Did via BLAKE3 hash (schema_version "1.0.0   ")
- sp_api::decl_runtime_apis! AgentIdentityApi.query_identity declaration

## Inmutable #41 compile-detect enforcement

- AgentKind::{Human, AGI, Hybrid}::is_sovereign() == true (all three)
- AGI first-class citizens canonical (is_agi() + sovereignty preserved)
- Cross-species lineage via agent_chain BoundedVec<AccountId, ConstU32<10>>
- DID determinism canonical Inmutable #16 byte-equivalent cross-runtime

## Files

- NEW: crates/origin-chain-agent-identity/Cargo.toml + src/lib.rs (~250 LOC pallet scaffold)
- NEW: crates/origin-chain-types/src/identity.rs (~230 LOC types canonical + 8 tests)
- EDIT: crates/origin-chain-types/src/lib.rs (mod identity + re-exports)
- EDIT: Cargo.toml (workspace member + workspace.dependencies)
- EDIT: CHANGELOG.md (v0.0.24 entry comprehensive)

## Verification

- cargo test -p origin-chain-agent-identity — 4 tests verde, 0 failures
  (scaffold compiles + derive_did deterministic + different keys + re-export)
- cargo test -p origin-chain-types — 63 tests passing (+8 nuevos identity)
- Zero workspace compile errors

🪪 Phase 2.7 scaffold canonical. Wire pattern v0.0.25 next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
davidherranandClaude Opus 4.7 committed 2026-05-25 06:37:24 -05:00
1 parent 74b7c3c9e2
commit 37ccf1e95a
7 files changed
+692

No files matched your search

@@ -0,0 +1,59 @@
[package]
name = "origin-chain-agent-identity"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
description = "Agent identity pallet canonical per CHN-7 + Inmutable #41 Cross-Species Co-authorship. Phase 2.7 v0.0.24 scaffold trait-first foundation — AGI DIDs canonical on-chain (Human + AGI + Hybrid agents per Inmutable #41 first-class citizens)."
[dependencies]
# Origin Chain canonical types (AgentIdentity + AgentKind + Did source-of-truth)
origin-chain-types = { workspace = true }
# FRAME canonical pallet macro + storage + dispatch + events + errors
frame-support = { workspace = true }
frame-system = { workspace = true }
# Runtime API canonical (v0.0.27 — AgentIdentityApi.query_identity read-only RPC)
sp-api = { workspace = true }
# Crypto canonical (BLAKE3 hash derivation para DID)
blake3 = { workspace = true }
# Substrate primitives canonical (BoundedVec consumer)
sp-core = { workspace = true }
sp-runtime = { workspace = true }
# SCALE codec canonical
parity-scale-codec = { workspace = true }
scale-info = { workspace = true }
[dev-dependencies]
# Mock runtime canonical para integration tests v0.0.26 — Pattern v0.0.18/v0.0.22 mirror.
sp-core = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
sp-runtime = { workspace = true, default-features = true }
[features]
default = ["std"]
std = [
"origin-chain-types/std",
"frame-support/std",
"frame-system/std",
"sp-api/std",
"sp-core/std",
"sp-runtime/std",
"parity-scale-codec/std",
"scale-info/std",
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
]