Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Pricing says it plainly: models at the provider's price, the agent rate for what g1t runs around every model call (the gateway, secrets, routing, context and pass-through to your own provider, so your own keys too), everything else at cost plus 20%, your own runners free, no seats; Security and quality comes with the plan with no separate fee, and live activations end. Each agent has an effort setting, Auto to Max, with what a typical task has cost at each level, and Spend's Spend less, keep quality suggests a lower level only when the agent's own past work shows quality held, to apply or dismiss. The pricing, spend and agents guides say how. | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import type { AgentEffortCosts } from "@g1t/contracts"; | |
| 5 | ||
| 6 | import { readEffort } from "./agent-form.ts"; | |
| 7 | import { acceptedLabel, costAt, costLine, effortSetting, savingLabel, totalSaving } from "./effort.ts"; | |
| 8 | ||
| 9 | const costs: AgentEffortCosts = { | |
| 10 | handle: "reviewer", | |
| 11 | effort: "high", | |
| 12 | window_days: 28, | |
| 13 | levels: [ | |
| 14 | { effort: "low", sessions: 0, typical_micros: null, accepted_share: null }, | |
| 15 | { effort: "medium", sessions: 1, typical_micros: 210_000, accepted_share: 1 }, | |
| 16 | { effort: "high", sessions: 14, typical_micros: 480_000, accepted_share: 13 / 14 }, | |
| 17 | { effort: "max", sessions: 0, typical_micros: null, accepted_share: null }, | |
| 18 | ], | |
| 19 | }; | |
| 20 | ||
| 21 | test("a level's cost is what its sessions measured, and none where it never ran", () => { | |
| 22 | assert.equal(costLine(costs, "high"), "$0.48 a typical task, from 14 sessions in the last 28 days"); | |
| 23 | assert.equal(costLine(costs, "medium"), "$0.21 a typical task, from 1 session in the last 28 days"); | |
| 24 | assert.equal(costLine(costs, "low"), "No sessions at Low in the last 28 days, so no figure yet."); | |
| 25 | assert.equal(costLine(costs, "auto"), "$0.21 a typical task at Medium, from 1 session in the last 28 days"); | |
| 26 | assert.equal(costLine(null, "high"), "Costs couldn't be read right now."); | |
| 27 | assert.equal(costAt(costs, "max"), null); | |
| 28 | assert.equal(acceptedLabel(costAt(costs, "high")), "93%"); | |
| 29 | }); | |
| 30 | ||
| 31 | test("the setting reads from routing and the form, Auto when absent or unknown", () => { | |
| 32 | assert.equal(effortSetting({ effort: "max" }), "max"); | |
| 33 | assert.equal(effortSetting({}), "auto"); | |
| 34 | assert.equal(effortSetting(null), "auto"); | |
| 35 | assert.equal(readEffort("low"), "low"); | |
| 36 | assert.equal(readEffort("turbo"), null); | |
| 37 | }); | |
| 38 | ||
| 39 | test("savings add up from the open suggestions only", () => { | |
| 40 | const rec = (status: "open" | "thin", saving: number | null) => ({ status, saving_month_micros: saving }) as never; | |
| 41 | assert.equal(totalSaving({ checked_at: null, window_days: 28, open: [rec("open", 31_000_000), rec("open", 4_000_000)], thin: [rec("thin", null)], resolved: [] }), 35_000_000); | |
| 42 | assert.equal(totalSaving(null), 0); | |
| 43 | assert.equal(savingLabel({ saving_month_micros: 31_000_000 }), "About $31.00 a month"); | |
| 44 | assert.equal(savingLabel({ saving_month_micros: null }), ""); | |
| 45 | }); |