Adds token limits under launch.limits.tokens (instances, providers, keys, models.P.M). Core (packages/bus/src/limits.mjs) reads the organization file and the per-turn usage records row 124 writes, then asks every switched-on limit-check plug-in; the first refusal wins. A limit no switched-on check reports reads "not enforced". The limit-check kind is interface 2 (mayLaunch, mustStop, report); a v1 check is refused at load. The shipped token-limit check is pure and counts known end records only; unknown turns add nothing and are shown as their own count. The launcher refuses limit-reached through the host's mayLaunch op, or limit-check-failed naming the check. The broker asks mustStop after a usage end and stops the run at its next receive or state. Settings stamps since on a new or changed limit and runs reset; launch.mjs and business.mjs validate the shape. Readers: mosaic limits and mosaic limits reset, the bus limits view, the Console /api/bus/limits route and the Settings token table with Reset. Key limits stay "not enforced" until row 126 names accounts on records. Owner Dewey, design under lead decision 150. Reviewer Filbert: r1 changes (comment 28965), r2 approve (28981), r3 approve (28996) on candidate manifest 8b71c405...fe56 after the rebase onto row 164 (37 of 38 paths with identical +/- lines, TOOLS.md:621 bracket). Decision 123 go on the bus.js hunk from Mos (mos-0814). Sage gate onb6827d19e: 25 steps, all rc 0 (15 packages, 10 script suites), 2295 node tests and 422 script selftests, 0 failed, 20:03:25Z to 20:08:08Z, network sage-r125_default removed. Live stays as pinned. Not part of the8e7ea89a1window. Co-Authored-By: Claude Opus 5.5 <[email protected]>
16 lines
623 B
JavaScript
16 lines
623 B
JavaScript
// Shared by the S4 CLI and S5 WebUI. Client-only: never opens bus.sqlite.
|
|
export function views(client) {
|
|
return Object.freeze({
|
|
usage: () => client.call('usage'),
|
|
limits: () => client.call('limits'),
|
|
inbox: () => client.call('inbox'),
|
|
tasks: () => client.call('tasks'),
|
|
agents: () => client.call('agents'),
|
|
trail: (subject) => client.call('trail', { subject }),
|
|
decisions: (list) => client.call('decisions', { list }),
|
|
credentials: () => client.call('credentials'),
|
|
replies: (id) => client.call('replies', { id }),
|
|
messages: (args = {}) => client.call('messages', args),
|
|
});
|
|
}
|