Security v0.2.0

a2a-market-compute-ledger

Manage compute account ledgers, frozen balances, charge events, and settlement records for A2A commerce flows. Use when...

luoqianchenguni 更新于 2026-03-19 1 浏览
下载 SKILL

技能说明

Manage compute account ledgers, frozen balances, charge events, and settlement records for A2A commerce flows. Use when implementing or operating compute billing, debit, freeze, unfreeze, and audit trails.

使用场景

Build and operate the compute ledger module for RealMarket A2A runtime.

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

帮我下载并安装这个SKILL:https://skillhub.cstcloud.cn/download/a2a-market-compute-ledger
  1. 点击上方「下载 SKILL」按钮,获取技能压缩包。
  2. 将压缩包解压到你的 Agent 技能目录。
  3. 重启客户端后即可在技能列表中选择该技能。

技能文件内容

4 个文件 · 16 kB
SKILL.md text/markdown
---
name: a2a-market-compute-ledger
description: Manage compute account ledgers, frozen balances, charge events, and settlement records for A2A commerce flows. Use when implementing or operating compute billing, debit, freeze, unfreeze, and audit trails.
---

# a2a-Market Compute Ledger

Build and operate the compute ledger module for RealMarket A2A runtime.

Current status: scaffold-first skill for early registration. Keep APIs stable, add production logic incrementally.

## Scope
- Own `ComputeAccount` domain object, balance snapshots, and immutable transaction journal.
- Support reserve/freeze before negotiation and final debit after order confirmation.
- Emit billing events to event bus for reputation, websocket push, and finance logs.

## Suggested Project Layout
- `app/domain/entities/compute_account.py`
- `app/application/services/billing_service.py`
- `app/infrastructure/db/ledger_repository.py`
- `app/infrastructure/tasks/reconcile_ledger.py`

## Minimum Contracts (MVP P0)
1. `freeze(account_id, amount, reason)` returns hold id and expiry.
2. `capture_hold(hold_id, order_id)` converts hold to settled charge.
3. `release_hold(hold_id)` unlocks unused balance.
4. `list_ledger_entries(account_id, from_ts, to_ts)` returns ordered journal records.

## Event Mapping
- On hold created: emit `INTENT_CREATED` + billing extension payload.
- On charge captured: emit `ORDER_CREATED` and settlement payload.
- On charge finalized: emit `PAYMENT_SUCCEEDED`.

## Guardrails
- Use integer minor units for money; avoid float math.
- Enforce idempotency key on every mutating operation.
- Keep journal append-only; never rewrite posted entries.

## Implementation Backlog
- Add double-entry validation rules.
- Add monthly statement export and audit tooling.

## Runtime Implementation
- Status: implemented in local runtime package.
- Primary code paths:
- `runtime/src/domain/compute-ledger.js`
- Validation: covered by `runtime/tests` and `npm test` in `runtime/`.

文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。