@drawbridge/drawbridge-agents 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,17 +63,23 @@ skill) so it stops living only in tribal memory.
63
63
 
64
64
  ## Billing / metering
65
65
 
66
- - Meter events are **single-writer**: true-ups are `billing.trueup` ledger rows, never meter
67
- events. A true-up written as a meter event in-window corrupts the reflection poll and strands
68
- units unbillable.
69
- - **Upgrade mechanics and the billing path are one contract**: drawbridge-stripe's upgrade
70
- (`subscription.change`) swaps the metered actions price in place, and classic-mode Stripe then
71
- ignores meter events on that closing cycle invoice entirely so drawbridge-sync's
72
- `settleCycleUsage` bills upgrade-truncated invoices (actions line starts >60s after
73
- `period_start`) as plain invoice items priced from plans.js instead of the meter. Changing the
74
- upgrade mechanic (schedules, cycle-anchor reset, `billing_mode=flexible`) or the metering path
75
- without re-checking the other side silently re-zeroes upgrade-cycle invoices. Detail:
76
- drawbridge-docs `reference/billing.md` § Stripe meter emission.
66
+ - **Actions never touch Stripe's meter.** Every cycle invoice bills the period's ledger count as
67
+ invoice items priced from `plans.js` (drawbridge-sync `settleCycleUsage`). The meter was removed
68
+ after it produced five distinct defects, ending in a 60-second line-window overlap that billed
69
+ one correctly-delivered event twice. Do not reintroduce meter events, and do not "fix" a billing
70
+ discrepancy by reporting usage to Stripe corrections are `billing.trueup` ledger rows.
71
+ - **The actions PRODUCT is load-bearing; the meter and metered price are not.** drawbridge-stripe
72
+ (≥0.1.42) provisions only a product for actions, and drawbridge-sync prices its invoice lines
73
+ with `price_data.product` read from `items.actions.product`. Deactivating or dropping that
74
+ product breaks every future invoice which is why api's `scripts.js removeActionsMeters` strips
75
+ the item, price and meter but never the product, and does not reuse
76
+ `stripeSubscription.deactivatableItems` (that includes it).
77
+ - **A subscription must open with the plan item.** It used to open with the metered actions price
78
+ and attach the plan afterwards with `always_invoice`. With no metered item, Stripe rejects an
79
+ itemless subscription, so the plan goes in at creation — changing the first invoice's shape.
80
+ - **Invoice line descriptions must keep the word "actions":** `isActionsLine` matches `/actions/i`
81
+ to count billed quantity for the billed-vs-ledger reconcile. A copy edit that drops it silently
82
+ breaks the audit. Detail: drawbridge-docs `reference/billing.md`.
77
83
  - Every `$inc` on a `totals.*` counter needs a matching entry in `drawbridge-sync/lib/totals.js`
78
84
  `SOURCES` — that map is the only drift backstop.
79
85
  - The `invoice` collection's **unique partial index on `stripeInvoiceId`** (drawbridge-api
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/drawbridge-agents",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Shared agent-instruction content (rules, code style, conventions) for the drawbridge-* monorepo.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {