跳转到内容
Developer Preview — APIs and language features may change before 1.0

uses

此内容尚不支持你的语言。

Preamble: declares capabilities (kernel I/O primitives or other machines) this machine may use

  • en: uses
  • de: benutzt
  • es: usa
  • fr: utilise
  • ja: 使う
  • ko: 사용
  • zh: 使用

Example — Identity, pricing and building blocks

Section titled “Example — Identity, pricing and building blocks”

A paid helper: says who it belongs to, what it needs to run, what it costs per plan, and composes shared governance from a published kit.

machine premium_helper "Premium Helper"
has agency
identity input.user_id
requires mashin "0.70.0"
uses
"@mashin/actions/http" { get }
defines
cap_items(items) => items.take(10)
accepts
user_id as text, is required
question as text, is required
responds with
result as text
behaves
compute go
{result: "ok"}
economics
pricing: subscription
currency: usd
tiers
starter
price: 29/month
limit: 1000 calls
pro
price: 99/month
ensures
includes "@kits/gaas/governance"
verifies
test "answers a paid question"
given {user_id: "u_42", question: "hi"}
expect {result: "ok"}