feat: intent-routing example + approve_federation_agent command#369
Merged
toadkicker merged 15 commits intomainfrom Apr 24, 2026
Merged
feat: intent-routing example + approve_federation_agent command#369toadkicker merged 15 commits intomainfrom
toadkicker merged 15 commits intomainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… fallback Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… handshake Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
BM25 scores on term overlap — prompts with no shared tokens score zero and fall through. Added comment explaining this so readers don't think the index magically handles all prompts. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Covers DynamicAgentSource::Federation variant, ad_to_federation_def helper, approve_federation_agent Tauri command, and BM25 integration test proving approved agents are routable after promotion to local DB. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Marks agents approved from federation peer registries. No local keypair (operator_key_seed is None) — the operator's DID is the signing authority. Adds serde round-trip test for the new variant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wire DynamicAgentSource::Federation into source_to_str() and the papillon-shared DB insert match - Add ad_to_federation_def() helper: converts a verified AgentAdvertisement to a DynamicAgentDef with source=Federation, operator_key_seed=None - Add approve_federation_agent Tauri command: verifies signature via verify_key_from_did + ad.verify(), persists to SQLite, registers in live local registry — BM25 picks it up on next IntentIndex build - Add 6 unit tests covering all branches Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dler Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Proves that ad_to_federation_def() output is immediately visible to IntentIndex (BM25) — the core invariant that closes the federation-agent routing gap. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
toadkicker has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Benchmark Regression ReportThreshold: 10% regression vs baseline from main |
…ines - examples/intent-routing: remove `&` from `agent_op.did()` call (clippy::needless_borrows_for_generic_args) - cargo fmt applied to papillon and pap-intent-routing packages Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
toadkicker has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Two test helpers in commands/agents.rs passed &kp.did() where kp.did() already returns a String — the borrow is redundant since String: Into<String>. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
toadkicker has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/intent-routing: New self-contained example demonstrating Papillon's real 2-level intent pipeline — URL fast-path (detect_intent) → BM25 semantic index (IntentIndex::classify) → honest DuckDuckGo fallback. Comments explicitly explain that BM25 is a term-frequency scorer and the prompts are cherry-picked catalog matches. The resolved action type drives a full 6-phase PAP handshake (mandate → delegation → session → co-signed receipt).DynamicAgentSource::Federation: New enum variant marking agents approved from federation peer registries. No local keypair (operator_key_seed = None) — the operator's DID is the signing authority. Fixes the non-exhaustive match inpapillon-shared/src/db/native.rs.approve_federation_agentTauri command: validates advertisement signature viaverify_key_from_did+ad.verify(), converts to aDynamicAgentDefwithsource = Federation, persists to SQLite, and registers in the live local registry. Federation agents are immediately visible toIntentIndex(BM25) on the nextIntentIndex::new()call — closing the gap whereAgentAdvertisementobjects from remote registries were invisible to the BM25 routing layer.Test Plan
cargo test -p pap-intent-routing— 6 tests pass (BM25 routing, URL fast-path, fallback, full handshake integration)cargo test -p pap-agents—dynamic_agent_source_variants_round_trip+federation_source_serializes_as_federationpasscargo test -p papillon --lib commands::agents— 7 tests pass includingapproved_federation_def_is_visible_to_bm25cargo test -p papillon -p papillon-shared -p pap-agents -p pap-intent-routing— 353 tests, 0 failurescargo check -p papillon— clean compile after rebase on main🤖 Generated with Claude Code