Aller au contenu
Developer Preview — APIs and language features may change before 1.0

guarantees

Ce contenu n’est pas encore disponible dans votre langue.

Governance: PINS a guarantee the runtime already gives (records, durable) into the machine’s own text, so a cold reader sees it in source. A pin the runtime cannot confirm refuses compilation

  • en: guarantees
  • de: Garantien
  • es: garantías / garantias
  • fr: garanties
  • ja: 保証事項
  • ko: 보증
  • zh: 保证

Example — Borrowing and lending authority

Section titled “Example — Borrowing and lending authority”

Sends a line to a script that writes it to disk. The machine holds a write radius and LENDS exactly that radius to the tool for one call; it also says what it would accept on loan itself, and pins the guarantees the runtime already gives.

machine file_courier
accepts
line as text, is required
responds with
ok as boolean
behaves
ask write_it, from: "@mashin/actions/exec/node"
lending filesystem.write under "/tmp/courier"
command: "node write_line.js"
environment: {LINE: input.line}
compute done
{ok: steps.write_it.exit_code == 0}
ensures
permissions
allowed to filesystem.write under "/tmp/courier"
needs
capability filesystem.write
guarantees
records
durable
verifies
test "the lent write lands and is reported"
assuming write_it {exit_code: 0, stdout: "", stderr: ""}
given {line: "hello"}
expect {ok: true}