Skip to content

feat(PR25): human-to-agent delegation profile#41

Merged
naory merged 1 commit intomainfrom
feat/pr-human-agent-profile
Mar 14, 2026
Merged

feat(PR25): human-to-agent delegation profile#41
naory merged 1 commit intomainfrom
feat/pr-human-agent-profile

Conversation

@naory
Copy link
Copy Markdown
Collaborator

@naory naory commented Mar 14, 2026

Summary

Extends MPCP to support human DID principals delegating bounded spending authority to AI agents.

Schema / types

  • PolicyGrantLike + CreatePolicyGrantInput: revocationEndpoint and allowedPurposes fields
  • BudgetScope: add TRIP for multi-day/multi-session delegations
  • budgetScopeSchema, policyGrantForVerificationSchema: updated accordingly
  • SBA verifier (sba.ts): accept TRIP scope alongside SESSION

New utility

  • src/protocol/revocation.ts: checkRevocation(endpoint, grantId, options?) — async revocation check with configurable timeout; verifier pipeline stays stateless and synchronous
  • Exported from sdk/index.ts

Demo

  • examples/human-agent-trip/: Alice (DID key) delegates an $800 Paris trip budget to her AI agent
    • Demonstrates: allowedPurposes filter (restaurant skipped), TRIP scope budget enforcement, 3 approved stops, post-trip audit, live revocation via mocked endpoint
  • npm run example:human-agent-trip

Tests

  • test/protocol/revocation.test.ts (8 tests: happy path, revoked, timeout, error, URL encoding)
  • test/schema/artifact-schemas.test.ts: TRIP scope acceptance
  • test/protocol/policyGrant.test.ts: revocationEndpoint + allowedPurposes flow-through

Test plan

  • npm run build — clean compile
  • npm test — 194/194 tests pass (22 test files)
  • npm run example:human-agent-trip — full demo runs, revocation shown

Related

Spec PR: mpcp-spec feat/spec-human-agent-profile

🤖 Generated with Claude Code

Extends MPCP to support human DID principals delegating bounded spending
authority to AI agents via PolicyGrant.

Schema / types:
- PolicyGrantLike + CreatePolicyGrantInput: revocationEndpoint, allowedPurposes
- BudgetScope: add TRIP for multi-day/multi-session delegations
- budgetScopeSchema: add TRIP
- policyGrantForVerificationSchema: add both new fields
- SBA verifier: accept TRIP scope alongside SESSION

New utility:
- src/protocol/revocation.ts: checkRevocation() — async endpoint check with
  timeout; verifier stays stateless and synchronous
- Exported from sdk/index.ts

Demo:
- examples/human-agent-trip/: Alice delegates $800 Paris trip to AI agent
  Shows purpose filtering, budget enforcement, post-trip audit, revocation
- npm run example:human-agent-trip

Tests:
- test/protocol/revocation.test.ts (8 tests)
- test/schema/artifact-schemas.test.ts: TRIP scope
- test/protocol/policyGrant.test.ts: revocationEndpoint + allowedPurposes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naory naory merged commit 340dd5e into main Mar 14, 2026
@naory naory deleted the feat/pr-human-agent-profile branch March 14, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant