Skip to content

Duration Based Subscription#53

Merged
andrew-virtuals merged 8 commits intomainfrom
feat/subscription
Mar 19, 2026
Merged

Duration Based Subscription#53
andrew-virtuals merged 8 commits intomainfrom
feat/subscription

Conversation

@ariessa
Copy link
Copy Markdown
Contributor

@ariessa ariessa commented Feb 27, 2026

Duration Based Subscription

Support duration-based subscription jobs.

Summary

  • Add subscription tier support for ACP seller offerings — tiers can be defined inline in offering.json (auto-synced on acp sell create) or managed manually via acp sell sub list/create/delete commands
  • Add --subscription flag to acp job create so buyers can specify a preferred subscription tier
  • Seller runtime automatically detects subscription jobs, checks buyer subscription status via checkSubscription, and handles payment flow accordingly — no changes needed in handlers.ts

Changes

  • New file: src/commands/subscription.ts — list, create, del commands under acp sell sub
  • src/lib/api.ts — Add createSubscription, updateSubscription, deleteSubscription API functions
  • src/lib/wallet.ts — Add SubscriptionTier type, extend getMyAgentInfo return type
  • src/seller/runtime/seller.ts — Detect subscription jobs via negotiation memo, check subscription status, branch payment flow
  • src/seller/runtime/sellerApi.ts — Add checkSubscription API call
  • src/commands/sell.ts — Validate inline subscriptionTiers in offering.json, sync tiers on acp sell create (create/update), display tiers in list and inspect
  • src/commands/job.ts — Accept --subscription flag, pass preferredSubscriptionTier to API
  • bin/acp.ts — Wire up sell sub subcommands and --subscription flag routing
  • Docs: Updated README, SKILL.md, references/seller.md, references/acp-job.md

New Commands

  • acp sell sub create basic 10 7 — creates tier successfully
  • acp sell sub list — shows the created tier
  • acp sell sub delete basic — deletes the tier
  • acp sell create with subscriptionTiers in offering.json — syncs tiers
  • acp job create --subscription basic — creates job with subscription tier

@ariessa ariessa changed the base branch from dev to main March 18, 2026 14:19
Comment thread package.json Outdated
},
"dependencies": {
"axios": "^1.13.5",
"@virtuals-protocol/acp-node": "^0.3.0-beta.39",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this package isn't used

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in this commit.

Comment thread src/seller/runtime/seller.ts Outdated
Comment on lines +185 to +192
await requestPayment(jobId, {
content: `Subscription required: ${subCheck.tier.name} (${subCheck.tier.price} USDC for ${subCheck.tier.duration} days)`,
});
} else {
console.log(`[seller] Job ${jobId} — valid subscription, proceeding`);
await requestPayment(jobId, {
content: "Subscription active",
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use the normal payment flow and append the content if it's a subscription job

this would allow the handlers.requestAdditionalFunds and handlers.requestPayment to be executed (if implemented by provider)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in this commit.

@ariessa ariessa force-pushed the feat/subscription branch from d8270ba to 7f42d6b Compare March 19, 2026 08:19
@andrew-virtuals andrew-virtuals merged commit 159f18f into main Mar 19, 2026
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