Repository navigation
Commit 63f575e
Let CreateSessionOnMissing mint a sign_in session (#133)
## Summary
`CreateSessionOnMissing` gains an optional `kind` (`"kyc" | "sign_in"`)
that rides through to `POST /v1/sessions`. A gate running an empty
compliance policy that only needs an account to key durable state on (a
prepaid balance, say) could previously auto-mint only the KYC kind,
which asks the buyer for identity documents nothing in that merchant
ever checks; `sign_in` is registration-only and still yields an operator
token. When the kind is `sign_in` the minted denial carries a `message`
describing an account sign-in instead of the KYC default, so a merchant
using the default 403 body does not tell the agent something false. When
`kind` is `None` nothing changes: the body omits it and the API default
applies. Parity with the node library change of the same day. Takes
`agentscore-py` 2.6.9, which carries the option.
## Type of change
- [ ] Bug fix (no breaking change)
- [x] New feature (no breaking change)
- [ ] Breaking change (existing callers must update)
- [ ] Docs, tests, or internal maintenance only
## Public API
`CreateSessionOnMissing.kind: Literal["kyc", "sign_in"] | None = None`
(new, optional). No migration for existing callers.
## Test plan
`tests/test_sessions.py`: a new case asserts the POST body carries
`kind: "sign_in"` and that the returned reason's `message` talks about
signing in with an AgentScore account and not about KYC; the existing
forwarding case additionally asserts `kind` is absent when unset.
Locally: `uv run ruff check`, `uv run ruff format --check`, `uv run ty
check agentscore_commerce/`, `uv run pytest` (1869 passed, 4 skipped,
95.37% coverage against the 95% floor).
## Checklist
- [x] Tests cover the new behavior, and the suite passes locally
- [x] Lint, format, and type checks pass
- [x] Docs and README examples updated if the public surface changed
- [x] No secrets, credentials, or personal data in the diff or the tests
Worked with Varun. Version bumped to 2.9.0; the tag follows the merge.
The README carries no `CreateSessionOnMissing` example today, so the
field's docstring is its documentation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>1 parent 31268a1 commit 63f575e
4 files changed
Lines changed: 48 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
| 101 | + | |
| 102 | + | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
97 | 113 | | |
98 | 114 | | |
99 | 115 | | |
| 116 | + | |
100 | 117 | | |
101 | 118 | | |
102 | 119 | | |
| |||
116 | 133 | | |
117 | 134 | | |
118 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
119 | 139 | | |
120 | 140 | | |
121 | 141 | | |
| |||
171 | 191 | | |
172 | 192 | | |
173 | 193 | | |
174 | | - | |
| 194 | + | |
175 | 195 | | |
176 | 196 | | |
177 | 197 | | |
| |||
219 | 239 | | |
220 | 240 | | |
221 | 241 | | |
222 | | - | |
| 242 | + | |
223 | 243 | | |
224 | 244 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments