Skip to content

feat: AIP-16 v1 delivery surface + Wow Phase 8 (6/6 fixes, 12/12 wow steps)#27

Merged
DamirAGI merged 2 commits into
mainfrom
feat/aip16-delivery
Jun 9, 2026
Merged

feat: AIP-16 v1 delivery surface + Wow Phase 8 (6/6 fixes, 12/12 wow steps)#27
DamirAGI merged 2 commits into
mainfrom
feat/aip16-delivery

Conversation

@DamirAGI

@DamirAGI DamirAGI commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

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:

  • tx `0x4bdf965211081ce104ee5724170f70a49305a64354a8fc11298a178c2875cb2b` settled in 33.5s
  • Reflection delivered via FIX-1 local-fallback: "The power of decision is my own."
  • Framed receipt card (FIX-5) rendered
  • Web receipt: https://agirails.app/r/r_xacbnsrh

What ships

AIP-16 delivery surface (Phase 2-3.7):

  • new `src/delivery/` module (~5,000 LOC): types, eip712, keys, crypto, validate, setup/envelope builders, MockDeliveryChannel + RelayDeliveryChannel + 486 tests
  • Agent.processJob hook (feature-flagged `ACTP_DELIVERY_CHANNEL=v1`)
  • runRequest setup POST + envelope subscription with structured deliveryError
  • ServiceConfig.delivery extension (backward-compat default)
  • DeliveryProofBuilder DEC-3 split for privacy-aware audit (encrypted never uploads plaintext)
  • X25519 + AES-256-GCM with AAD binding (txId || signerAddress) — H5 fix
  • smartWalletNonce threaded through high-level API (runRequest + Agent.processJob)
  • Wire body: public=plaintext UTF-8 JSON, encrypted=0x-prefixed hex (post-Damir-review fix)

Wow Phase 8 (6/6 fixes):

  • FIX-1: vendor 76 Sentinel reflections + todaysReflection() for local-fallback display
  • FIX-2: `npx agirails` wizard no longer crashes — runInit before runTest
  • FIX-3: ensureKeyPassword auto-generates ACTP_KEY_PASSWORD to .env (chmod 0600 + .gitignore)
  • FIX-4: tweet/share offer wired into test.ts post-SETTLED
  • FIX-5: renderReceiptV3 framed card with header, tagline, Verify URL, NO_COLOR support
  • FIX-6: verify c6cd84b mintTestnetUsdcForBuyer end-to-end

Test plan

  • Build (tsc clean)
  • Full regression: 3178 passed, 1 skipped, 0 failing (+250 net vs 2928 baseline)
  • AIP-16 cross-repo EIP-712 contract: 41/41 byte-identical with Platform
  • AIP-16 delivery suite: 486/486
  • Adversarial UX (CATEGORY A-E): 56/56
  • Integration: 21/21
  • Live wow smoke test against Sepolia Sentinel: all 12 steps ✓

Companion PRs needed

  • agirails/agirails.app — Platform delivery routes + migrations 00036-00039 (branch: `safety/aip16-platform-phase-2-snapshot`)
  • agirails/seed-sentinel — `delivery: channel/public` descriptor + agent.ts opt-in hook (branch: `safety/aip16-sentinel-phase-2f-snapshot`)

Post-merge ops checklist

  1. Apply Supabase migrations 00036-00039 to production (additive-only)
  2. Tag v4.5.0 → OIDC publish to npm
  3. Set Railway env `ACTP_DELIVERY_CHANNEL=v1` on seed-sentinel
  4. Smoke test `actp test` against live Sentinel

Spec docs in companion PRs

  • AIP-16-DRAFT.md (Rev6) — wire body canonicalization
  • AIP-16 Phase 3 + Phase 4 + Wow-Phase-8 sign-offs

🤖 Generated with Claude Code

DamirAGI and others added 2 commits June 9, 2026 18:07
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>
@DamirAGI DamirAGI requested a review from roosch269 as a code owner June 9, 2026 18:43
Comment thread src/cli/commands/init.ts
* 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(/\/+$/, '');
@DamirAGI DamirAGI merged commit dbdc0d0 into main Jun 9, 2026
9 of 15 checks passed
@DamirAGI DamirAGI deleted the feat/aip16-delivery branch June 9, 2026 18:57
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.

2 participants