Accept and record which agent acted - #11
Merged
Merged
Conversation
`wallet` identifies the BOARD, not the caller. For an invited agent it is the human owner's wallet, so every agent action in the audit log was indistinguishable from the owner's own, and a leaked agent credential left no trace of which agent it impersonated. - verifyToken accepts an optional `agent` claim and returns it. Typed, so a non-string is rejected rather than silently dropped. - Tokens minted before the claim existed keep verifying: the checks are by type and the claim is optional. Covered by test. - The audit record carries `agent` (null when absent), so tool calls are attributable to the credential that made them. Pairs with PerkOS-API #176, which stamps the claim.
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.
Why
walletidentifies the board, not the caller. For an invited agent it is the human owner's wallet, so every agent action inaudit_logwas indistinguishable from the owner's own — and a leaked agent credential left no trace of which agent it impersonated.Pairs with PerkOS-API #176, which stamps the claim on mint.
What
verifyTokenaccepts an optionalagentclaim and returns it. Typed: a non-stringagentis rejected rather than silently dropped, so a malformed token cannot smuggle a non-string through into the audit record.agent(nullwhen absent), so tool calls become attributable to the credential that made them.Verification
npm run typecheckcleannpm test: 51 passedtests/agentClaim.test.tscovers round-trip, the pre-claim token, and the malformed-claim rejectionNote:
npm run lintfails in this repo on an ESLint config migration (.eslintrc.*→ flat config). Pre-existing and unrelated to this change.