This repository was archived by the owner on Jun 7, 2026. It is now read-only.
feat(intent): ordvec semantic index + typed SD-JWT disclosure context#399
Open
toadkicker wants to merge 3 commits into
Open
feat(intent): ordvec semantic index + typed SD-JWT disclosure context#399toadkicker wants to merge 3 commits into
toadkicker wants to merge 3 commits into
Conversation
Add the first intent-browser UI slice for Papillon's schema-driven workflow. - Render schema.org SearchResultsPage and SearchResult payloads as typed search result cards. - Register the search result renderer in the default block renderer registry. - Show the existing intent-browser empty state when a canvas has no blocks. - Group pending approvals by action and disclosure shape in the ghost run panel. - Let users select candidate agents, fill one shared disclosure form, render selected agents, or deny the group. - Add UI styling for grouped ghost approvals, agent choices, disclosure fields, and search result cards. - Ignore generated Gradle state under bindings/java/.gradle. Verification: cargo check --manifest-path apps/papillon/frontend/Cargo.toml; just check-wasm; just run-example pap-search-example.
- keep SearchResultsTemplate registered only for SearchResultsPage - reject unresolved URI templates and unsafe schemes before pap:// conversion - avoid duplicate top-level SearchResult extraction when collection data exists - gate grouped approvals while principal attributes load and submit only declared disclosures - restore branded empty canvas hero styling - add frontend unit tests for search parsing, URL conversion, grouping, and disclosure filtering - update the frontend handshake test helper for the current AgentInfo shape
Adds a three-level intent routing chain that routes queries through the
schema.org ontology to produce correctly-typed selective disclosure grants
for the PAP handshake, replacing the hardcoded schema:Person fallback.
## Intent routing chain
Level 1 (unchanged): deterministic URL fast-path (~0µs)
Level 2: BM25 token index, now served from an AppState cache built once
at startup — ~5µs read vs ~1ms DB+rebuild per call previously.
Invalidated by agent insert/delete/update commands.
Level 2.5 (new): ordvec RankQuant semantic index (~5ms, no network).
Ontology mode (preferred): query → nearest schema.org type URI →
catalog agents by returns/object_types match. Activated when
schema-ontology.tvrq + schema-types.json exist in the model dir.
Descriptor mode (fallback): embeds agent descriptors at startup.
Both modes fall through gracefully when model files are absent.
Level 3 (unchanged): federation NLU handshake
## Disclosure context type
classify_intent() now returns a 4-tuple including disclosure_context_type:
the schema.org type that scopes the SD-JWT DisclosureEntry in Phase 2 of
the PAP handshake. Threaded through IntentPlan, process_prompt*, and
HandshakeParams to the DisclosureSet constructor. The SD-JWT envelope is
now typed to the actual data domain (e.g. schema:ExchangeRateSpecification
for currency queries) rather than the hardcoded schema:Person fallback.
## Catalog fixes
- frankfurter.toml: description now includes "convert", strengthens BM25
signal for currency queries; llm_instructions expanded with examples
- nominatim.toml: removed "convert" from description to eliminate false
BM25 match against currency queries ("convert 100 usd to mx")
## New: examples/seed-ontology
Standalone binary that downloads all-MiniLM-L6-v2 weights, fetches the
schema.org types CSV (1,466 types), embeds each type as label+comment+
supertypes, and writes schema-ontology.tvrq + schema-types.json to the
Papillon model directory. Run once; updates automatically when re-run.
## Verified
"convert 100 usd to mx" → schema:ExchangeRateSpecification →
Frankfurter Exchange Rates (schema:TradeAction) ✓
724 tests passing across pap-agents, papillon-shared, papillon,
pap-intent-routing.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
SemanticIndex(ordvecRankQuant+ MiniLM-L6-v2) as Level 2.5 between BM25 and federation NLU. Ontology mode routes queries through 1,466 embedded schema.org types to find catalog agents byreturns/object_typesmatch. Closes the "convert 100 usd to mx → geocoder" mismatch at the architecture level, not just by patching descriptor text.classify_intent()now returns a 4th value,disclosure_context_type, threaded throughIntentPlan,process_prompt*, andHandshakeParamsto theDisclosureSetconstructor in Phase 2. The SD-JWT envelope is now typed to the actual data domain (schema:ExchangeRateSpecification,schema:GeoCoordinates, etc.) rather than the hardcodedschema:Personfallback.IntentIndexbuilt once at startup, shared viaArc<RwLock<>>, invalidated by agent mutations — ~5µs cache read vs ~1ms DB+rebuild perclassify_intentcall.New:
examples/seed-ontologyRun once to bootstrap the ontology index:
Downloads
all-MiniLM-L6-v2weights (~22MB), fetches the schema.org types CSV, embeds 1,466 types, writesschema-ontology.tvrq(137KB) +schema-types.json(35KB) to~/Library/Application Support/papillon/models/.The semantic path is a no-op if the files are absent — falls through to BM25 then federation NLU transparently.
Catalog fixes
frankfurter.toml: added "convert" to description and examples tollm_instructionsnominatim.toml: replaced "convert place names" → "resolve place names"Test plan
cargo test -p pap-agents -p papillon-shared -p papillon -p pap-intent-routing— 724 tests, all greensemantic_index_ontology_routes_currency_querysmoke test: "convert 100 usd to mx" →Frankfurter Exchange Rates (schema:TradeAction)✓SemanticIndex::from_ontologyreturnsNonegracefully when model files absent (CI safe)AppStatecache correctly invalidated onsave_agent,delete_agent,update_agent,approve_federation_agent🤖 Generated with Claude Code