instar 1.3.2001 → 1.3.2002
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.
- package/dashboard/console/accounts.js +2 -1
- package/dashboard/console/quota-forecast-model.js +66 -0
- package/dashboard/console/quota-forecast.js +35 -0
- package/dist/data/standards-guard-index.json +1 -1
- package/dist/data/standards-guard-index.meta.json +2 -2
- package/dist/data/standards-registry.meta.json +1 -1
- package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
- package/dist/native/instar-desktop-host +0 -0
- package/package.json +1 -1
- package/src/data/awareness/quota-pacing.md +2 -0
- package/src/data/builtin-manifest.json +2 -2
- package/src/data/standards-guard-index.json +1 -1
- package/src/data/standards-guard-index.meta.json +2 -2
- package/src/data/standards-registry.meta.json +1 -1
- package/upgrades/1.3.2002.md +18 -0
- package/upgrades/side-effects/quota-pacing-dashboard.md +64 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// cancel a sign-in POST /subscription-pool/follow-me/cancel bearer
|
|
8
8
|
// repair / retry / cancel POST /subscription-relogin/repair-cell operator session
|
|
9
9
|
|
|
10
|
+
import { quotaForecastCard } from './quota-forecast.js';
|
|
10
11
|
import { buildAccountsPage, frameworkName, resetWords } from './accounts-model.js';
|
|
11
12
|
import { el, setKids, pageHead, askLink, sheet, closeSheet, story, details, note, cantTell, askPin, forgetOperatorSession, firstPaint, arrivalScroll, markNeed } from './ui.js';
|
|
12
13
|
import { legacyHref } from './nav-model.js';
|
|
@@ -99,7 +100,7 @@ export async function renderAccounts(main, ctx) {
|
|
|
99
100
|
pageHead({ eyebrow: 'Capacity · Accounts', headline: page.headline, sub: page.sub, tone: page.tone, facts: page.facts }),
|
|
100
101
|
page.partial ? note(page.partial) : null,
|
|
101
102
|
!relogin.ok ? note(`Couldn't read sign-in repairs: ${relogin.reason}.`) : null,
|
|
102
|
-
notices, needs, autoRepairSection(autoRepair, refresh), list, legacyLink());
|
|
103
|
+
notices, needs, autoRepairSection(autoRepair, refresh), list, quotaForecastCard(get, page.accounts), legacyLink());
|
|
103
104
|
const want = new URLSearchParams((location.hash.split('?')[1] || '')).get('s');
|
|
104
105
|
if (want === 'needs') arrivalScroll(needs);
|
|
105
106
|
if (want === 'auto-repair') arrivalScroll(main.querySelector('#sec-auto-repair'));
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Read-only presentation of the existing quota-pacing/1 measurement.
|
|
2
|
+
const finite = (n) => typeof n === 'number' && Number.isFinite(n);
|
|
3
|
+
const number = (n) => String(Math.round(n * 10) / 10);
|
|
4
|
+
const percent = (n) => `${Math.round(Math.min(100, Math.max(0, n)))}%`;
|
|
5
|
+
const count = (n) => Number.isSafeInteger(n) && n >= 0 ? n : 0;
|
|
6
|
+
const plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
|
|
7
|
+
|
|
8
|
+
function calibrationLine(c) {
|
|
9
|
+
const scored = count(c?.scored);
|
|
10
|
+
let line = scored
|
|
11
|
+
? `${scored} ${plural(scored, 'forecast')} checked against real resets. ${count(c.inside)} finished within the predicted range.${finite(c.meanAbsError) ? ` The average error was ${number(c.meanAbsError)} percentage points.` : ''} These are observed comparisons, not a guarantee.`
|
|
12
|
+
: 'No forecasts have been checked against real resets yet.';
|
|
13
|
+
const censored = count(c?.censored);
|
|
14
|
+
const missing = Array.isArray(c?.outcomes) ? c.outcomes.filter((o) => o?.status === 'no-forecast').length : 0;
|
|
15
|
+
if (censored) line += ` ${censored} ${plural(censored, 'reset')} lacked a recent final reading.`;
|
|
16
|
+
if (missing) line += ` ${missing} ${plural(missing, 'reset')} had no usable forecast.`;
|
|
17
|
+
return line;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function windowLines(w, label, now) {
|
|
21
|
+
const reset = Date.parse(w?.resetsAt);
|
|
22
|
+
if (!w || !finite(w.central) || !finite(w.low) || !finite(w.high)) return [`Not enough history to estimate ${label} usage at reset.`];
|
|
23
|
+
if (!Number.isFinite(reset) || reset <= now) return [`Cannot estimate: the ${label} reset needs a fresh reading.`];
|
|
24
|
+
return [
|
|
25
|
+
...(finite(w.used) ? [`Currently ${percent(w.used)} of the ${label} allowance is used.`] : []),
|
|
26
|
+
`At the current pace, about ${percent(w.central)} of the ${label} allowance will be used by reset.${w.central >= 100 ? ' The account is expected to reach this limit.' : ''}`,
|
|
27
|
+
`Recent spending rates suggest ${percent(w.low)} to ${percent(w.high)} used by reset. This is a pace range, not a confidence interval.`,
|
|
28
|
+
`${label === 'weekly' ? 'Weekly' : label} reset: ${new Date(reset).toLocaleString(undefined, { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' })}.`,
|
|
29
|
+
...(w.usesHourlyRows ? ['Some older readings are hourly summaries.'] : []),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function accountView(a, names, now) {
|
|
34
|
+
let lines;
|
|
35
|
+
if (a.disagree) lines = ['Cannot estimate: the machines disagree about this account.'];
|
|
36
|
+
else if (!a.fresh) lines = ['Cannot estimate: this account needs a fresh reading.'];
|
|
37
|
+
else if (a.identityUnknown) lines = ['Cannot estimate confidently until the account identity is confirmed.'];
|
|
38
|
+
else lines = [...windowLines(a.weekly, 'weekly', now), ...(a.fable ? windowLines(a.fable, 'Fable', now) : [])];
|
|
39
|
+
return { name: names.get(a.accountId) || 'Unnamed account', lines };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function buildQuotaForecast(response, accounts = [], now = Date.now()) {
|
|
43
|
+
const data = response?.data;
|
|
44
|
+
const unavailable = { state: 'unavailable', reason: 'The forecast could not be read. Account controls are still available.' };
|
|
45
|
+
if (!response?.ok) return (data?.error === 'quota-pacing-off' || response?.reason === 'switched off on this agent') ? { state: 'off' } : unavailable;
|
|
46
|
+
if (data?.schema !== 'quota-pacing/1' || !Array.isArray(data.providers)) return unavailable;
|
|
47
|
+
const generated = Date.parse(data.generatedAt);
|
|
48
|
+
// An independently loaded card must not present a cached response as a current outlook.
|
|
49
|
+
if (!Number.isFinite(generated) || generated > now + 60_000 || now - generated > 5 * 60_000) {
|
|
50
|
+
return { state: 'stale', reason: 'The forecast response is out of date. Refresh to check again.' };
|
|
51
|
+
}
|
|
52
|
+
const names = new Map(accounts.map((a) => [a.id, a.name]));
|
|
53
|
+
const providers = data.providers.filter((p) => p && Array.isArray(p.accounts)).map((p) => ({
|
|
54
|
+
name: typeof p.label === 'string' ? p.label : 'Provider',
|
|
55
|
+
fableOutlook: typeof p.fableRunway?.plain === 'string' ? p.fableRunway.plain : null,
|
|
56
|
+
outlook: typeof p.plain === 'string' ? p.plain : 'There is not enough history for an outlook.',
|
|
57
|
+
accounts: p.accounts.filter((a) => a && typeof a.accountId === 'string').map((a) => accountView(a, names, now)),
|
|
58
|
+
assumptions: Array.isArray(p.assumptions) ? p.assumptions.filter((s) => typeof s === 'string') : [],
|
|
59
|
+
}));
|
|
60
|
+
const failed = Array.isArray(data.sources) ? data.sources.filter((s) => s?.status === 'failed').length : 0;
|
|
61
|
+
return {
|
|
62
|
+
state: 'ready', providers, calibration: calibrationLine(data.calibration),
|
|
63
|
+
coverage: failed ? `${failed} ${plural(failed, 'machine')} could not be read. The outlook may be incomplete.` : null,
|
|
64
|
+
measured: `Forecast calculated ${new Date(generated).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' })}.`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { el } from './ui.js';
|
|
2
|
+
import { buildQuotaForecast } from './quota-forecast-model.js';
|
|
3
|
+
|
|
4
|
+
// A separate request keeps sign-in controls independent of slower pool telemetry.
|
|
5
|
+
export function quotaForecastCard(get, accounts = []) {
|
|
6
|
+
const host = el('section', { class: 'card', id: 'sec-quota-forecast', 'data-state': 'loading', 'aria-label': 'Allowance forecast' },
|
|
7
|
+
el('h2', { class: 'card-title', text: 'Allowance forecast' }),
|
|
8
|
+
el('p', { class: 'card-note', text: 'Checking recent spending and reset history…' }));
|
|
9
|
+
const render = (response) => {
|
|
10
|
+
const view = buildQuotaForecast(response, accounts);
|
|
11
|
+
host.dataset.state = view.state;
|
|
12
|
+
if (view.state === 'off') { host.hidden = true; return; }
|
|
13
|
+
if (view.state !== 'ready') {
|
|
14
|
+
host.replaceChildren(el('h2', { class: 'card-title', text: 'Allowance forecast' }), el('p', { class: 'card-note', text: view.reason }));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
host.replaceChildren(...[
|
|
18
|
+
el('h2', { class: 'card-title', text: 'Allowance forecast' }),
|
|
19
|
+
el('p', { class: 'card-note', text: `${view.measured} Estimates follow recent spending; they do not change where work runs.` }),
|
|
20
|
+
view.coverage ? el('p', { class: 'card-note', text: view.coverage }) : null,
|
|
21
|
+
!view.providers.length ? el('p', { class: 'card-line', text: 'No account forecasts are available yet.' }) : null,
|
|
22
|
+
view.providers.map((p) => el('details', { class: 'sheet-block' },
|
|
23
|
+
el('summary', { text: `${p.name}: ${p.outlook}` }),
|
|
24
|
+
p.fableOutlook ? el('p', { class: 'card-line', text: `Fable allowance: ${p.fableOutlook}` }) : null,
|
|
25
|
+
p.accounts.map((a) => el('div', { class: 'sheet-block' },
|
|
26
|
+
el('h3', { class: 'row-title', text: a.name }),
|
|
27
|
+
a.lines.map((text) => el('p', { class: 'card-line', text })))),
|
|
28
|
+
p.assumptions.length ? el('details', {}, el('summary', { text: 'What this estimate assumes' }),
|
|
29
|
+
p.assumptions.map((text) => el('p', { class: 'card-note', text }))) : null)),
|
|
30
|
+
el('h3', { class: 'row-title', text: 'Compared with real resets' }),
|
|
31
|
+
el('p', { class: 'card-line', text: view.calibration })].flat(Infinity).filter((node) => node != null));
|
|
32
|
+
};
|
|
33
|
+
Promise.resolve().then(() => get('/quota-pacing', 12_000)).then(render).catch(() => render({ ok: false }));
|
|
34
|
+
return host;
|
|
35
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "source-tree",
|
|
4
4
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
5
|
-
"packageVersion": "1.3.
|
|
5
|
+
"packageVersion": "1.3.2002",
|
|
6
6
|
"guards": [
|
|
7
7
|
{
|
|
8
8
|
"ref": "docs/audits/phase-b/f10-triage.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sha256": "
|
|
2
|
+
"sha256": "07cdf6f99d28948cb3340b3980399e68b189a0023d24660b2cf0a70565c0bd67",
|
|
3
3
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
4
|
-
"packageVersion": "1.3.
|
|
4
|
+
"packageVersion": "1.3.2002"
|
|
5
5
|
}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -7,4 +7,6 @@ Will an account's quota expire unused, or will Claude or Codex run out of weekly
|
|
|
7
7
|
curl -H "Authorization: Bearer $AUTH" http://localhost:{{port}}/quota-pacing
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
+
The dashboard Accounts page includes an Allowance forecast section with provider outlooks, expandable account estimates and comparisons with actual resets. Missing or stale history stays unknown. Read the sample count before describing forecast accuracy; two observed outcomes do not establish reliability. The section loads independently of sign-in controls and never changes account routing or spending.
|
|
11
|
+
|
|
10
12
|
Spec: docs/specs/quota-pacing-forecast.md.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./builtin-manifest.schema.json",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"generatedAt": "2026-11-
|
|
5
|
-
"instarVersion": "1.3.
|
|
4
|
+
"generatedAt": "2026-11-24T13:20:39.192Z",
|
|
5
|
+
"instarVersion": "1.3.2002",
|
|
6
6
|
"entryCount": 210,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "source-tree",
|
|
4
4
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
5
|
-
"packageVersion": "1.3.
|
|
5
|
+
"packageVersion": "1.3.2002",
|
|
6
6
|
"guards": [
|
|
7
7
|
{
|
|
8
8
|
"ref": "docs/audits/phase-b/f10-triage.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"sha256": "
|
|
2
|
+
"sha256": "07cdf6f99d28948cb3340b3980399e68b189a0023d24660b2cf0a70565c0bd67",
|
|
3
3
|
"registrySha256": "11e2a45ab1345e2ded6499404ee9962e4e48bcfed4677a4d31dac4492565d2fa",
|
|
4
|
-
"packageVersion": "1.3.
|
|
4
|
+
"packageVersion": "1.3.2002"
|
|
5
5
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- assembled-by: assemble-next-md -->
|
|
4
|
+
<!-- bump: patch -->
|
|
5
|
+
|
|
6
|
+
## What Changed
|
|
7
|
+
|
|
8
|
+
The Accounts page now includes an independently loaded Allowance forecast section, using the existing owner-only forecast API. Provider outlooks and expandable named-account estimates sit alongside a count of forecasts checked against actual resets. Stale, conflicting and missing readings remain uncertain. Unavailable telemetry leaves account controls usable.
|
|
9
|
+
|
|
10
|
+
## What to Tell Your User
|
|
11
|
+
|
|
12
|
+
You can now see whether recent spending is likely to use an account's weekly allowance before it resets. Open Accounts and look for Allowance forecast. The section also says how many forecasts have been compared with real resets, so a small sample does not look like a proven prediction. It measures only; it does not move work or spend anything.
|
|
13
|
+
|
|
14
|
+
## Summary of New Capabilities
|
|
15
|
+
|
|
16
|
+
A read-only presentation of the existing forecast and calibration. No new setting, endpoint, model call or spending control.
|
|
17
|
+
|
|
18
|
+
The separate Fable allowance is shown separately wherever the existing API provides it, both in provider outlook and account projections; it is never combined with the weekly budget. The original brainstorm’s plan explicitly requires this distinction.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Side-Effects Review — Allowance forecast on Accounts
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `quota-pacing-dashboard`
|
|
4
|
+
**Date:** 2026-11-22
|
|
5
|
+
**Author:** echo
|
|
6
|
+
**Second-pass reviewer:** reset_spec_completeness
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
Tier1, small and reversible: two presentation modules plus mounting on the existing Accounts page, an awareness update, and unit/HTTP/lifecycle tests. The existing forecast endpoint, arithmetic, history, quota policy, account selection and authorization remain unchanged. One independent review round; focused tests cover data-flow through real HTTP and production initialization. Reverting removes the view without state repair.
|
|
11
|
+
|
|
12
|
+
## Decision-point inventory
|
|
13
|
+
|
|
14
|
+
No new behavioral authority. Existing forecast measurements pass through a display-only model. Unknown data and a stale cached response display uncertainty, never zero capacity. A five-minute generated-response age guard and one-minute future-clock tolerance only change wording to unavailable; they never hold work. Raw account names and provider text are written with textContent.
|
|
15
|
+
|
|
16
|
+
## 1. Over-block
|
|
17
|
+
|
|
18
|
+
No work or account controls are blocked. A separate request prevents slow forecast telemetry from delaying sign-in controls. An unconfirmed account identity is shown conservatively rather than treated as confirmed capacity. Off-state hides only the forecast section.
|
|
19
|
+
|
|
20
|
+
## 2. Under-block
|
|
21
|
+
|
|
22
|
+
The view is read-only. It does not certify reliability from a small sample, treat missing numbers as zero, or use forecasts as permission to move work. Requests remain behind the existing authenticated owner-only endpoint.
|
|
23
|
+
|
|
24
|
+
## 3. Level-of-abstraction fit
|
|
25
|
+
|
|
26
|
+
A pure view model translates the existing quota-pacing/1 response into paragraphs. DOM rendering uses shared card/details/text primitives on Accounts. No duplicate forecast engine, store, endpoint or background loop.
|
|
27
|
+
|
|
28
|
+
## 4. Signal vs authority compliance
|
|
29
|
+
|
|
30
|
+
Reference: docs/signal-vs-authority.md. This is a signal presentation only. The scheduler and existing placement retain sole behavior authority. No LLM call or brittle blocking rule is introduced.
|
|
31
|
+
|
|
32
|
+
## 4b. Judgment-point check
|
|
33
|
+
|
|
34
|
+
The operator explicitly authorized the next project card, a plain forecast dashboard after comparison with real resets. A read-only live snapshot contained two scored outcomes (mean absolute error2.4 percentage points, one inside range), which is sufficient to display calibration but not establish reliability. Displayed forecast ranges are explicitly pace ranges, not confidence intervals. Missing outcomes are separately disclosed.
|
|
35
|
+
|
|
36
|
+
## 5. Interactions
|
|
37
|
+
|
|
38
|
+
Accounts controls keep their existing behavior. The card fetches independently and failure is local to that section. Existing provider identity merging and partial-source disclosures are preserved. No registration, mutation or spending request is added.
|
|
39
|
+
|
|
40
|
+
## 6. External surfaces
|
|
41
|
+
|
|
42
|
+
Accounts gains a section with collapsed provider details, named account forecasts and calibration. Dynamic text is never interpreted as HTML. No private identity hash or machine ID is used as a display name. The existing credentials are neither read nor written by the new code.
|
|
43
|
+
|
|
44
|
+
## 6b. Operator-surface quality
|
|
45
|
+
|
|
46
|
+
Complete sentences explain reset projections and unknowns. The view states it measures rather than changes where work runs. Existing CSS primitives provide the responsive layout. Visible calibration sample counts prevent overclaiming forecast maturity.
|
|
47
|
+
|
|
48
|
+
## 7. Multi-machine posture
|
|
49
|
+
|
|
50
|
+
The existing pool-scope endpoint merges by identity across machines and reports failed sources; the card displays partial coverage. No machine-local decision, store or notification source is introduced. The awareness entry reaches updated agents through the existing registry.
|
|
51
|
+
|
|
52
|
+
## 8. Rollback cost
|
|
53
|
+
|
|
54
|
+
Revert this presentation change. No migration, state cleanup, credential change or session restart is necessary.
|
|
55
|
+
|
|
56
|
+
## Validation
|
|
57
|
+
|
|
58
|
+
Unit checks cover numeric/missing/stale/identity/conflict boundaries and DOM failure/escaping. Existing real HTTP replay and initialized-server lifecycle tests now feed their actual responses through the view model. Targeted results, type checking and normal lint/commit/push logs are retained under .instar/recovery/token-reset-routing/dashboard-*.log. Full normal verification remains required before merge; no full-suite, publication or installed success is claimed here.
|
|
59
|
+
|
|
60
|
+
Final targeted evidence:91 unit checks passed across forecast, existing Accounts and awareness registry;10 real-HTTP integration checks and2 initialized-server lifecycle checks passed. Type checking passed. Independent review identified the real dashboard wrapper’s disabled-response shape; the view now accepts it and an actual Accounts renderer test proves the card mounts hidden while the page stays available. The reviewer concurred after that correction.
|
|
61
|
+
|
|
62
|
+
The separate Fable allowance is shown separately wherever the existing API provides it, both in provider outlook and account projections; it is never combined with the weekly budget. The original brainstorm’s plan explicitly requires this distinction.
|
|
63
|
+
|
|
64
|
+
The focused completeness delta for the separate Fable window received reviewer concurrence with no material finding. Its current usage, projection and reset remain independent of the weekly window.
|