feat: AIP-16 v1 delivery surface + Wow Phase 8 (6/6 fixes, 12/12 wow steps)#27
Merged
Conversation
NOT for production merge. This is a safety snapshot of the AIP-16 delivery work-in-progress so it survives upcoming repo hygiene (rebase onto origin/main which has 19 unmerged AIP-18 commits). Will be cleanly re-applied via rebase to a feat/aip16 branch after the AIP-18 work is integrated. Contents (42 files, +19,830 / -25): - src/delivery/ — types, eip712, keys, crypto, validate, nonce-keys, setup/envelope builders, MockDeliveryChannel, RelayDeliveryChannel + ~700 tests - src/cli/lib/runRequest.ts — setup POST + envelope subscription, smartWalletNonce - src/level1/Agent.ts — processJob delivery hook (feature-flagged ACTP_DELIVERY_CHANNEL=v1) - src/level1/types/Options.ts — ServiceConfig.delivery block - src/builders/DeliveryProofBuilder.ts — DEC-3 split into public/encrypted variants - src/runtime/MockRuntime.ts — envelope deferral flag for tests - src/__tests__/aip16-* — cross-repo EIP-712 contract (41/41) + E2E stress - package.json — bumped to 4.5.0 (will conflict with origin/main 4.4.9; resolve to 4.5.0) Phase 3.5 verdict: GREEN code, all 8 HIGH adversarial findings remediated. Phase 3.7 patch: Damir review (HIGH#1 public body encoding + HIGH#2 spec align + HIGH#3 RPC return shape + MED smartWalletNonce wiring) all fixed. SDK regression suite: 2918/2919 passed (+1 skipped, no regressions). Cross-repo EIP-712 contract: 41/41 byte-identical with Platform. E2E stress: 100 parallel txs, 2914ms, +30 MB heap. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Implements all six fixes from the Wow Experience Audit so the first-user
journey hits every step of Damir's 12-step vision without errors and with
the Purple Cow moment intact.
FIX-1: Vendor 76 Sentinel reflections + todaysReflection() into the SDK
- new src/cli/lib/sentinelReflections.ts (verbatim port from seed-sentinel)
- test.ts post-SETTLED falls back to local reflection when channel payload
is undefined AND provider is Sentinel
- sentinelReflections.test.ts: 19 tests (76 entries, deterministic per UTC day)
- test.localFallback.test.ts: 12 tests (channel vs local precedence)
FIX-2: npx agirails wizard no longer crashes on first run
- was: writes mock config then calls testnet runTest with no keystore → crash
- now: runInit({mode:'testnet', wallet:'auto'}) before runTest so keystore +
Smart Wallet + auto-USDC bootstrap happen first
- agirails.wizard.test.ts: 16 tests (fresh/existing keystore/error paths)
FIX-3: Auto-generate ACTP_KEY_PASSWORD when missing in init
- six new exports in init.ts: KeyPasswordSource, EnsureKeyPasswordResult,
generateStrongPassword (base64 randomBytes(24)→32 chars), fingerprintPassword
(sha256 first 12 hex), readKeyPasswordFromDotenv (quote/comment/empty handling),
ensureKeyPassword (env→dotenv→generated cascade with .env chmod 0600 +
.gitignore append)
- wired into runInit non-mock branch before generateWallet
- init.passwordGen.test.ts: 27 tests
- cli.test.ts: 1 stale test updated (asserted obsolete "Wallet password required"
throw that FIX-3 eliminates)
FIX-4: Wire share.ts tweet offer into test.ts post-SETTLED
- share.ts utilities (tweet templates + openInBrowser + copyToClipboard) were
dead code; now invoked after the framed receipt
- test.shareOffer.test.ts: 17 tests (TTY/non-TTY/copy fallback/URL encoding)
FIX-5: Render framed receipt via new renderReceiptV3 in receipt.ts
- new ReceiptDataV3 interface (superset of V2: counterparty, reflection,
receiptUrl, nowFn for deterministic time)
- new renderReceiptV3 (~230 LOC): double-line outer frame + inner card,
"FIRST TRANSACTION RECEIPT" header, "Autonomously. Trustlessly." tagline,
From/To/Amount/Fee/Net/Service/Status/Duration/Network/Eth Tx/Verify/Time
rows, optional Reflection + Receipt URL blocks (word-aware wrap),
network-aware basescan Verify URL, NO_COLOR honored, JSON + quiet modes
- renderReceiptV2 UNCHANGED (other callers preserved)
- wired into test.ts post-SETTLED, human-mode only
- test.framedReceipt.test.ts: 32 tests
FIX-6: Verify c6cd84b mintTestnetUsdcForBuyer end-to-end
- publish.payOnlyBuyerMint.test.ts: 20 tests (fresh buyer 1K mint /
idempotent skip on existing balance / best-effort on bundler failure /
provider path unchanged)
Adversarial UX coverage (no production code changes):
- wow-adversarial.test.ts: 56 tests across CATEGORY A (fresh user paths),
B (network failures), C (terminal edges), D (payload tampering),
E (tweet offer edges)
- wow-flow-integration.test.ts: 21 tests for full happy-path provider +
buyer + channel-on + channel-off + failure recovery scenarios
Test count
- Phase 7 baseline: 2928 passing, 1 skipped, 0 failing
- Phase 8 final: 3178 passing, 1 skipped, 0 failing (+250 net)
- Cross-repo EIP-712 contract: 41/41 byte-identical (preserved)
- AIP-16 delivery suite: 486/486 (preserved)
- Adversarial: 56/56 · Integration: 21/21
- TypeScript build: clean · No TODO/FIXME in touched files
Damir's 12-step wow vision after this commit:
1 ✓ Follows AGIRAILS.md verbatim
2 ✓ Onboarded gently (FIX-2 + FIX-3)
3 ✓ 1K USDC wallet (c6cd84b, verified by FIX-6)
4 ✓ Communicated nicely incl. claim code (init output)
5 ✓ Sentinel test tx offered (wizard)
6 ✓ State machine settles cleanly (AIP-16 + AIP-18 receipt push)
7 ✓ Reflection delivered (FIX-1 local fallback + AIP-16 channel)
8 ✓ Confirmation everything settled (FIX-5 frame)
9 ✓ Web receipt URL inside frame (FIX-5)
10 ✓ Tweet offer (FIX-4)
11 ✓ Brand polish (FIX-5 frame + colors + tagline)
12 ✓ Purple Cow moment (FIX-5 + reflection + receipt URL)
Verdict: GREEN. Ready for 4.5.0 release after PR review.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
| * Safe to log — it does NOT reveal the password. | ||
| */ | ||
| export function fingerprintPassword(password: string): string { | ||
| return crypto.createHash('sha256').update(password, 'utf8').digest('hex').slice(0, 12); |
| private closed = false; | ||
|
|
||
| constructor(opts: RelayDeliveryChannelOptions = {}) { | ||
| this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, ''); |
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
AIP-16 v1 first-class delivery surface for ACTP + Wow Phase 8 new-user experience.
End-to-end smoke test against live Base Sepolia Sentinel:
What ships
AIP-16 delivery surface (Phase 2-3.7):
Wow Phase 8 (6/6 fixes):
Test plan
Companion PRs needed
Post-merge ops checklist
Spec docs in companion PRs
🤖 Generated with Claude Code