Skip to content

fix(aip18): pay-only publish is link-only; budget never hashed or uploaded#20

Merged
DamirAGI merged 1 commit into
mainfrom
fix/aip18-budget-privacy
Jun 5, 2026
Merged

fix(aip18): pay-only publish is link-only; budget never hashed or uploaded#20
DamirAGI merged 1 commit into
mainfrom
fix/aip18-budget-privacy

Conversation

@DamirAGI
Copy link
Copy Markdown
Collaborator

@DamirAGI DamirAGI commented Jun 5, 2026

Closes the SDK half of the AIP-18 privacy blockers. A buyer's budget is a PRIVATE operational cap (§8 invariant) but actp publish for intent: pay hashed budget-bearing content and uploaded it to IPFS/the proxy before the later on-chain skip → budget leaked.

Fixes

  • publish.ts: compute isPayOnly up front and skip the IPFS/proxy upload entirely for pay-only (no CID). The buyer links via the agirails.app DB record (wallet + signature); no service file is published (DEC-3/DEC-4). Short-circuit now precedes any network upload.
  • agirailsmd: budget added to PUBLISH_METADATA_KEYS → stripped from the canonical hash. The configHash is identical with/without budget, so it can never leak via the hash. Mirrors web config-hash.
  • init.ts: {slug}.md scan now accepts pay-only files (services.length === 0 + servicesNeeded); next-steps copy is intent-aware (buyer = link + discover).
  • agirailsApp: UpsertAgentParams.configCid is now optional (absent for buyers).
  • tests: PUBLISH_METADATA_KEYS length 9→10; new strip test proves budget never affects the canonical hash. Full SDK suite: 2906/2906.

⚠ Versioning / publish

package.json version bump is intentionally omitted — the working tree has an unrelated in-flight 4.5.0 bump + ./delivery export (AIP-16/17 delivery WIP). Tagging v4.5.0 now would publish a broken build (export points to a dist/delivery that isn't committed). Recommend shipping this as a clean 4.4.3 patch, or folding it into 4.5.0 once delivery lands — needs a decision before tagging.

Companion: agirails.app#46. Implements agirails/aips#3.

🤖 Generated with Claude Code

…oaded

AIP-18 §8 invariant: a buyer's budget is a PRIVATE operational cap and must
never appear in any hashed, published, or on-chain artifact. The publish flow
violated this — for intent:pay it computed a configHash over budget-bearing
content and uploaded that file to IPFS/the proxy BEFORE the later on-chain
skip, so budget leaked to IPFS.

Fixes:
- publish.ts: compute isPayOnly up front and skip the IPFS/proxy upload
  entirely for pay-only agents (no CID). The buyer LINKS via the agirails.app
  DB record (wallet + signature); no service file is published (DEC-3/DEC-4).
  Moves the pay-only short-circuit ahead of any network upload.
- agirailsmd: budget added to PUBLISH_METADATA_KEYS so it is stripped from the
  canonical hash — the configHash is identical with or without budget,
  guaranteeing budget can never leak via the hash. Mirrors web config-hash.
- init.ts: the {slug}.md scan now accepts pay-only files (services.length===0
  with servicesNeeded), so a buyer file isn't silently ignored; next-steps
  copy is intent-aware (buyer = link + discover, not "publish config").
- agirailsApp: UpsertAgentParams.configCid is now optional (absent for buyers).
- tests: PUBLISH_METADATA_KEYS length 9->10; new strip test proves budget
  never affects the canonical hash. Full SDK suite: 2906/2906.

Note: package.json version bump intentionally omitted — the working tree has
an unrelated in-flight 4.5.0 bump + ./delivery export (AIP-16/17 WIP). Publish
versioning is left for coordination (see PR discussion).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DamirAGI DamirAGI requested a review from roosch269 as a code owner June 5, 2026 22:31
@DamirAGI DamirAGI merged commit 35f640e into main Jun 5, 2026
14 of 17 checks passed
@DamirAGI DamirAGI deleted the fix/aip18-budget-privacy branch June 5, 2026 22:36
DamirAGI added a commit that referenced this pull request Jun 5, 2026
Ships the pay-only link-only flow: budget is never hashed, uploaded to IPFS,
or stored in any published artifact (AIP-18 DEC-2/3/4). Source merged in #20.

Version bump kept separate from the in-flight 4.5.0 delivery work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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