@songsid/agend 2.3.0-beta.5 → 2.3.0-beta.7
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/dist/agent-cli-instructions.md +1 -1
- package/dist/agent-cli.js +21 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.js +4 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-file-read.js +68 -8
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-whats-new.js +4 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.js +3 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/authority-state.d.ts +38 -0
- package/dist/authority/authority-state.js +114 -0
- package/dist/authority/authority-state.js.map +1 -0
- package/dist/authority/session-authorizations.d.ts +43 -0
- package/dist/authority/session-authorizations.js +102 -0
- package/dist/authority/session-authorizations.js.map +1 -0
- package/dist/authority/web-authority.d.ts +31 -11
- package/dist/authority/web-authority.js +39 -12
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/cache-ledger.d.ts +16 -3
- package/dist/cache-ledger.js +33 -13
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-service.d.ts +55 -3
- package/dist/cache-service.js +152 -16
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/mcp-tools.js +12 -6
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +2 -2
- package/dist/classic-channel-manager.js +2 -6
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/config-validator.js +10 -4
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.js +2 -0
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +8 -0
- package/dist/delivery-outbox.js +7 -1
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +109 -2
- package/dist/fleet-manager.js +280 -12
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -1
- package/dist/general-knowledge/skills/multi-channel/SKILL.md +2 -1
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +81 -25
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +55 -8
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
- package/dist/human-delivery-receipts.d.ts +14 -0
- package/dist/human-delivery-receipts.js +42 -6
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-names.d.ts +4 -0
- package/dist/instance-names.js +12 -0
- package/dist/instance-names.js.map +1 -0
- package/dist/instructions.d.ts +8 -1
- package/dist/instructions.js +9 -2
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +52 -0
- package/dist/locale.js.map +1 -1
- package/dist/outbound-handlers.d.ts +6 -0
- package/dist/outbound-handlers.js +45 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +57 -1
- package/dist/outbound-schemas.js +33 -1
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +8 -2
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/rollout-index.d.ts +5 -0
- package/dist/rollout-index.js +26 -5
- package/dist/rollout-index.js.map +1 -1
- package/dist/settings-api.d.ts +6 -0
- package/dist/settings-api.js +50 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +27 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +8 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/tool-permissions.d.ts +0 -7
- package/dist/tool-permissions.js +73 -5
- package/dist/tool-permissions.js.map +1 -1
- package/dist/topic-commands.d.ts +2 -1
- package/dist/topic-commands.js +2 -4
- package/dist/topic-commands.js.map +1 -1
- package/dist/types.d.ts +13 -2
- package/dist/ui/app-effects.js +43 -25
- package/dist/ui/chat-ambient.js +306 -0
- package/dist/ui/chat-effect-posters.js +6 -7
- package/dist/ui/chat-effects.js +38 -15
- package/dist/ui/chat-strings.js +17 -4
- package/dist/ui/panel-chat.js +15 -7
- package/dist/ui/panel-settings.js +4 -1
- package/dist/ui/settings-appearance.js +8 -0
- package/dist/ui/settings-mods.js +19 -6
- package/dist/ui/settings-owner-effects.js +3 -3
- package/dist/ui/settings-strings.js +28 -0
- package/dist/ui/settings-web-authority.js +91 -0
- package/dist/ui/shared/app-session.js +2 -0
- package/dist/ui/shared/app-shell.js +2 -1
- package/dist/ui/shared/app-themes.js +24 -6
- package/dist/ui/shared/app.css +42 -8
- package/dist/ui/shared/effect-app-runtime.js +67 -18
- package/dist/ui/shared/effect-chat-runtime.js +16 -3
- package/dist/ui/shared/effect-frame.js +17 -3
- package/dist/ui/shared/effect-policy.js +18 -4
- package/dist/ui/shared/effect-registry.js +11 -18
- package/dist/ui/shared/effect-stock-trust.js +2 -2
- package/dist/ui/shared/effect-trial-stage.js +18 -7
- package/dist/ui/shared/fx-motion.js +58 -0
- package/dist/ui/shared/web-authorize.js +151 -0
- package/dist/usage-report.d.ts +147 -0
- package/dist/usage-report.js +195 -0
- package/dist/usage-report.js.map +1 -0
- package/dist/usage-rollup.d.ts +51 -0
- package/dist/usage-rollup.js +168 -0
- package/dist/usage-rollup.js.map +1 -0
- package/dist/web-ambient.d.ts +72 -0
- package/dist/web-ambient.js +154 -0
- package/dist/web-ambient.js.map +1 -0
- package/dist/web-api.d.ts +32 -0
- package/dist/web-api.js +143 -18
- package/dist/web-api.js.map +1 -1
- package/dist/web-appearance-tools.d.ts +3 -0
- package/dist/web-appearance-tools.js +18 -3
- package/dist/web-appearance-tools.js.map +1 -1
- package/dist/web-appearance-view.d.ts +14 -2
- package/dist/web-appearance-view.js +32 -5
- package/dist/web-appearance-view.js.map +1 -1
- package/dist/web-appearance.d.ts +15 -1
- package/dist/web-appearance.js +77 -1
- package/dist/web-appearance.js.map +1 -1
- package/dist/web-asset-parts.d.ts +2 -2
- package/dist/web-asset-parts.js +3 -3
- package/dist/web-asset-parts.js.map +1 -1
- package/dist/web-auth.js +3 -1
- package/dist/web-auth.js.map +1 -1
- package/dist/web-effect-bootstrap.d.ts +12 -0
- package/dist/web-effect-bootstrap.js +49 -0
- package/dist/web-effect-bootstrap.js.map +1 -0
- package/dist/web-effect-bundle.js +46 -1
- package/dist/web-effect-bundle.js.map +1 -1
- package/dist/web-effect-playback.d.ts +30 -0
- package/dist/web-effect-playback.js +71 -0
- package/dist/web-effect-playback.js.map +1 -0
- package/dist/web-effect-profiles.d.ts +4 -4
- package/dist/web-effect-service.d.ts +11 -4
- package/dist/web-effect-service.js +25 -4
- package/dist/web-effect-service.js.map +1 -1
- package/dist/web-effect-tools.d.ts +1 -0
- package/dist/web-effect-tools.js +2 -1
- package/dist/web-effect-tools.js.map +1 -1
- package/dist/web-effect-worker.d.ts +1 -1
- package/dist/web-effect-worker.js +2 -2
- package/dist/web-effect-worker.js.map +1 -1
- package/dist/web-guest-access.js +3 -1
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-mod-agent.js +5 -1
- package/dist/web-mod-agent.js.map +1 -1
- package/dist/web-mod-bundle.d.ts +9 -1
- package/dist/web-mod-bundle.js +62 -3
- package/dist/web-mod-bundle.js.map +1 -1
- package/dist/web-mod-export.d.ts +9 -0
- package/dist/web-mod-export.js +21 -0
- package/dist/web-mod-export.js.map +1 -1
- package/dist/web-mod-store.d.ts +2 -1
- package/dist/web-mod-store.js +13 -6
- package/dist/web-mod-store.js.map +1 -1
- package/dist/web-session-authorization.d.ts +132 -0
- package/dist/web-session-authorization.js +193 -0
- package/dist/web-session-authorization.js.map +1 -0
- package/dist/web-session.d.ts +5 -0
- package/dist/web-session.js +16 -0
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +24 -2
- package/dist/web-settings-patch.js +47 -1
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-settings-tools.d.ts +8 -0
- package/dist/web-settings-tools.js +14 -1
- package/dist/web-settings-tools.js.map +1 -1
- package/dist/web-theme-store.d.ts +39 -0
- package/dist/web-theme-store.js +122 -11
- package/dist/web-theme-store.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-authority.js","sourceRoot":"","sources":["../../src/authority/web-authority.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web-authority.js","sourceRoot":"","sources":["../../src/authority/web-authority.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AA0CvE,2HAA2H;AAC3H,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAW,CAAC;AAShF,4HAA4H;AAC5H,MAAM,UAAU,kBAAkB,CAAC,GAA0B;IAC3D,MAAM,CAAC,GAAG,GAAG,EAAE,kBAAkB,CAAC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,iBAAiB,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAC5F,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC;IACrI,qHAAqH;IACrH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,aAAa,KAAK,IAAI,EAAE,YAAY,EAAE,KAAK,GAAG,SAAS,EAAE,CAAC;AACrH,CAAC;AAED,qGAAqG;AACrG,MAAM,kBAAkB,GAAG,CAAC,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,kBAAkB,EAAE,KAAK,CAAU,CAAC;AAEjI,SAAS,eAAe,CAAC,OAA2B;IAClD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,MA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AAI,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC;WAC3H,OAAO,CAAC,CAAC,YAAY,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,aAAa,KAAK,QAAQ,CAAC;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA+E,EAAE,MAAqB;IACrI,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACzD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;IAAC,CAAC;IACrE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAAE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;IACrD,yFAAyF;IACzF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,IAAI,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC;IACrI,IAAI,OAAO;QAAE,OAAO,WAAW,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/cache-ledger.d.ts
CHANGED
|
@@ -41,10 +41,20 @@ export declare const GAP_EVENT_SEC = 240;
|
|
|
41
41
|
export declare const KEEP_DAYS = 31;
|
|
42
42
|
/** [requests, uncached, read, write5m, write1h, write, output] */
|
|
43
43
|
export type HourTotals = [number, number, number, number, number, number, number];
|
|
44
|
+
/**
|
|
45
|
+
* `src` (#2122): the same totals split by where they were read from — `sourceKey(reader, profile)`: the transcript reader
|
|
46
|
+
* (claude, codex) and the credential profile (claude: its config dir's profile, "default" without one; codex:
|
|
47
|
+
* "unrecorded", since a rollout does not say which login wrote it). Each source keeps its own exact totals. What `m`
|
|
48
|
+
* holds beyond the sum of `src` was counted before #2122 and reads as unknown (hourSources) — never relabelled with
|
|
49
|
+
* today's backend or profile.
|
|
50
|
+
*/
|
|
44
51
|
export interface HourAgg {
|
|
45
52
|
m: Record<string, HourTotals>;
|
|
46
53
|
g: number[];
|
|
54
|
+
src?: Record<string, Record<string, HourTotals>>;
|
|
47
55
|
}
|
|
56
|
+
/** A source of an hour's totals: the reader that read them and the profile it read them under. */
|
|
57
|
+
export declare const sourceKey: (reader: TranscriptKind, profile: string) => string;
|
|
48
58
|
/**
|
|
49
59
|
* One long gap: [tEnd, gapSec, contextCached, contextModel, ttlSec, model, promptAfter, measuredWrite, estimatedWrite].
|
|
50
60
|
* - `contextCached`/`contextModel`: what the previous request left cached, and its model — what a ping would read.
|
|
@@ -99,9 +109,12 @@ export declare function claudeTtlAfter(turn: Turn, current: number | undefined):
|
|
|
99
109
|
* Fold one turn into the ledger, in file order. Turns older than `cutoff` only move the session's last point (the
|
|
100
110
|
* next gap needs it); everything else is counted. Pure apart from mutating `ledger`.
|
|
101
111
|
*/
|
|
102
|
-
export declare function addTurn(ledger: Ledger, file: FileCursor, turn: Turn, cutoff: number): void;
|
|
103
|
-
/**
|
|
104
|
-
|
|
112
|
+
export declare function addTurn(ledger: Ledger, file: FileCursor, turn: Turn, cutoff: number, profile?: string): void;
|
|
113
|
+
/**
|
|
114
|
+
* Drop what is older than `cutoff` (hours and gap events). `foldedThrough` (#2122): an hour is dropped only once the
|
|
115
|
+
* usage rollup holds it (usage-rollup.ts: fold, then prune) — never one after the rollup's durable checkpoint.
|
|
116
|
+
*/
|
|
117
|
+
export declare function pruneLedger(ledger: Ledger, cutoff: number, foldedThrough?: number): void;
|
|
105
118
|
/** The turn a Claude Code transcript line records, or null; a message already counted (`file.ids`) is null too. */
|
|
106
119
|
export declare function claudeLine(line: ScanLine, file: FileCursor): Turn | null;
|
|
107
120
|
/** The turn a Codex rollout line records, or null. A `turn_context` line updates the file's model. */
|
package/dist/cache-ledger.js
CHANGED
|
@@ -25,6 +25,8 @@ export const GAP_BUCKETS = GAP_EDGES.length + 1;
|
|
|
25
25
|
/** Gaps at least this long are kept one by one (the shortest keep-warm interval is a 5-minute TTL's 270 s). */
|
|
26
26
|
export const GAP_EVENT_SEC = 240;
|
|
27
27
|
export const KEEP_DAYS = 31;
|
|
28
|
+
/** A source of an hour's totals: the reader that read them and the profile it read them under. */
|
|
29
|
+
export const sourceKey = (reader, profile) => `${reader}:${profile}`;
|
|
28
30
|
/** A dictionary keyed by names from outside (paths, model ids): every key an own property (#1467 lesson). */
|
|
29
31
|
const dict = () => Object.create(null);
|
|
30
32
|
export function emptyLedger() { return { v: 2, files: dict(), hours: dict(), gaps: [] }; }
|
|
@@ -44,7 +46,17 @@ export function reviveLedger(raw) {
|
|
|
44
46
|
for (const [mk, tot] of Object.entries(v.m ?? {}))
|
|
45
47
|
if (Array.isArray(tot) && tot.length === 7)
|
|
46
48
|
m[mk] = tot;
|
|
47
|
-
|
|
49
|
+
const src = dict();
|
|
50
|
+
for (const [sk, sm] of Object.entries(v.src ?? {})) {
|
|
51
|
+
if (!/^(?:claude|codex):.{1,120}$/s.test(sk) || !sm || typeof sm !== "object")
|
|
52
|
+
continue;
|
|
53
|
+
const into = dict();
|
|
54
|
+
for (const [mk, tot] of Object.entries(sm))
|
|
55
|
+
if (Array.isArray(tot) && tot.length === 7 && tot.every(n => Number.isFinite(n)))
|
|
56
|
+
into[mk] = tot;
|
|
57
|
+
src[sk] = into;
|
|
58
|
+
}
|
|
59
|
+
l.hours[k] = { m, g: v.g, ...(Object.keys(src).length ? { src } : {}) };
|
|
48
60
|
}
|
|
49
61
|
if (Array.isArray(r.gaps))
|
|
50
62
|
l.gaps = r.gaps.filter((g) => Array.isArray(g) && g.length === 9);
|
|
@@ -71,7 +83,7 @@ export function claudeTtlAfter(turn, current) {
|
|
|
71
83
|
* Fold one turn into the ledger, in file order. Turns older than `cutoff` only move the session's last point (the
|
|
72
84
|
* next gap needs it); everything else is counted. Pure apart from mutating `ledger`.
|
|
73
85
|
*/
|
|
74
|
-
export function addTurn(ledger, file, turn, cutoff) {
|
|
86
|
+
export function addTurn(ledger, file, turn, cutoff, profile) {
|
|
75
87
|
const prev = file.last;
|
|
76
88
|
const ttlBefore = file.kind === "claude" ? (file.ttl ?? CLAUDE_DEFAULT_TTL_SEC) : CODEX_TTL_SEC;
|
|
77
89
|
if (file.kind === "claude")
|
|
@@ -85,14 +97,19 @@ export function addTurn(ledger, file, turn, cutoff) {
|
|
|
85
97
|
const hk = String(hourOf(turn.t));
|
|
86
98
|
const hour = ledger.hours[hk] ??= { m: dict(), g: new Array(GAP_BUCKETS).fill(0) };
|
|
87
99
|
const mk = modelKey(turn.model, turn.prompt);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
const bump = (tot) => {
|
|
101
|
+
tot[0] += 1;
|
|
102
|
+
tot[1] += turn.uncached;
|
|
103
|
+
tot[2] += turn.read;
|
|
104
|
+
tot[3] += turn.write5m;
|
|
105
|
+
tot[4] += turn.write1h;
|
|
106
|
+
tot[5] += turn.write ?? 0;
|
|
107
|
+
tot[6] += turn.output;
|
|
108
|
+
};
|
|
109
|
+
bump(hour.m[mk] ??= [0, 0, 0, 0, 0, 0, 0]);
|
|
110
|
+
// #2122: and under its source — the reader that read it (this file's kind) and the profile it was read under.
|
|
111
|
+
const src = (hour.src ??= dict())[sourceKey(file.kind, profile ?? "unknown")] ??= dict();
|
|
112
|
+
bump(src[mk] ??= [0, 0, 0, 0, 0, 0, 0]);
|
|
96
113
|
if (!prev)
|
|
97
114
|
return;
|
|
98
115
|
const gap = (turn.t - prev.t) / 1000;
|
|
@@ -105,10 +122,13 @@ export function addTurn(ledger, file, turn, cutoff) {
|
|
|
105
122
|
const estimated = file.kind === "claude" ? turn.write5m + turn.write1h : turn.uncached + (turn.write ?? 0);
|
|
106
123
|
ledger.gaps.push([turn.t, gap, prev.ctx, prev.model, ttlBefore, turn.model, turn.prompt, measured, estimated]);
|
|
107
124
|
}
|
|
108
|
-
/**
|
|
109
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Drop what is older than `cutoff` (hours and gap events). `foldedThrough` (#2122): an hour is dropped only once the
|
|
127
|
+
* usage rollup holds it (usage-rollup.ts: fold, then prune) — never one after the rollup's durable checkpoint.
|
|
128
|
+
*/
|
|
129
|
+
export function pruneLedger(ledger, cutoff, foldedThrough = Number.POSITIVE_INFINITY) {
|
|
110
130
|
for (const k of Object.keys(ledger.hours))
|
|
111
|
-
if (Number(k) + HOUR <= cutoff)
|
|
131
|
+
if (Number(k) + HOUR <= cutoff && Number(k) <= foldedThrough)
|
|
112
132
|
delete ledger.hours[k];
|
|
113
133
|
if (ledger.gaps.length && ledger.gaps[0][0] < cutoff)
|
|
114
134
|
ledger.gaps = ledger.gaps.filter((g) => g[0] >= cutoff);
|
package/dist/cache-ledger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-ledger.js","sourceRoot":"","sources":["../src/cache-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAiB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAmBjD,sFAAsF;AACtF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AAChD,+GAA+G;AAC/G,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AACjC,MAAM,CAAC,MAAM,SAAS,GAAG,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,KAAK;QAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,CAAC;IACtF,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,wBAAwB,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,wBAAwB,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9H,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;AACxK,CAAC"}
|
package/dist/cache-service.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type Ledger } from "./cache-ledger.js";
|
|
1
2
|
import { type InstanceAnalysis } from "./cache-analysis.js";
|
|
3
|
+
import { type UsageDays } from "./usage-rollup.js";
|
|
2
4
|
/** An instance to analyse: a fleet.yaml instance, or a ClassicBot room (its workspace under the AgEnD home). */
|
|
3
5
|
export interface CacheInstance {
|
|
4
6
|
name: string;
|
|
@@ -7,6 +9,11 @@ export interface CacheInstance {
|
|
|
7
9
|
ledgerPath: string;
|
|
8
10
|
/** #1699: this instance's claude config dir (its credential profile's); absent = claudeProjectsDir()'s parent. */
|
|
9
11
|
claudeConfigDir?: string;
|
|
12
|
+
/**
|
|
13
|
+
* #2122: the profile the hours read now are tagged with — the claude profile whose config dir is read ("default"
|
|
14
|
+
* without one); "unrecorded" for codex (a rollout does not say which login wrote it).
|
|
15
|
+
*/
|
|
16
|
+
profile?: string;
|
|
10
17
|
}
|
|
11
18
|
export interface CacheServiceOptions {
|
|
12
19
|
instances(): CacheInstance[];
|
|
@@ -18,6 +25,8 @@ export interface CacheServiceOptions {
|
|
|
18
25
|
path: string;
|
|
19
26
|
mtimeMs: number;
|
|
20
27
|
}>;
|
|
28
|
+
/** #2122: how much the last listing of `root` could not read (rollout-index.ts `unreadable`); absent: 0. */
|
|
29
|
+
rolloutsUnreadable?(root: string): number;
|
|
21
30
|
/** Where the rollout → working-directory map is kept (one session_meta read per rollout, ever). */
|
|
22
31
|
metaPath: string;
|
|
23
32
|
now?: () => number;
|
|
@@ -27,6 +36,8 @@ export interface CacheServiceOptions {
|
|
|
27
36
|
log?: (level: "info" | "warn" | "debug", msg: string, extra?: Record<string, unknown>) => void;
|
|
28
37
|
/** Monotonic milliseconds for the published report's age (tests); default performance.now. */
|
|
29
38
|
monotonic?: () => number;
|
|
39
|
+
/** #2122: the zone days are folded in (defaults.scheduler.default_timezone, else the host's). */
|
|
40
|
+
zone?: () => string;
|
|
30
41
|
}
|
|
31
42
|
export type CacheWindow = "24h" | "7d" | "30d";
|
|
32
43
|
export declare const WINDOWS: Record<CacheWindow, number>;
|
|
@@ -70,6 +81,8 @@ export interface CacheReport {
|
|
|
70
81
|
export declare class CacheService {
|
|
71
82
|
private readonly o;
|
|
72
83
|
private readonly ledgers;
|
|
84
|
+
/** #2122: each instance's daily rollup (usage-rollup.ts), beside its ledger. */
|
|
85
|
+
private readonly rollups;
|
|
73
86
|
private readonly dirty;
|
|
74
87
|
/** Rollout path → the inode its session_meta was read from, and the cwd it names (null: not a session_meta). */
|
|
75
88
|
private meta;
|
|
@@ -81,6 +94,11 @@ export declare class CacheService {
|
|
|
81
94
|
private closing;
|
|
82
95
|
private pending;
|
|
83
96
|
private caughtUp;
|
|
97
|
+
/**
|
|
98
|
+
* #2122 §5.5: instances whose transcripts could not all be listed or read during this catch-up (EACCES, EIO… — a source
|
|
99
|
+
* that is simply not there is not one). The catch-up then proves nothing about them: no coverage is recorded.
|
|
100
|
+
*/
|
|
101
|
+
private readonly unread;
|
|
84
102
|
private readonly now;
|
|
85
103
|
constructor(o: CacheServiceOptions);
|
|
86
104
|
/** Catch up now (joins a catch-up already running). */
|
|
@@ -104,6 +122,20 @@ export declare class CacheService {
|
|
|
104
122
|
stop(): Promise<void>;
|
|
105
123
|
scanning(): CacheReport["scanning"];
|
|
106
124
|
private catchUp;
|
|
125
|
+
private zone;
|
|
126
|
+
private daysPath;
|
|
127
|
+
/** #2122: an instance's rollup, read once. */
|
|
128
|
+
rollupFor(inst: CacheInstance): Promise<UsageDays>;
|
|
129
|
+
/**
|
|
130
|
+
* #2122 §5.2: fold the hours about to leave the ledger into the rollup — on a copy, kept only once it is on disk — and
|
|
131
|
+
* return the checkpoint that is durable now (the ledger is pruned through it, never past it).
|
|
132
|
+
*/
|
|
133
|
+
private foldBeforePrune;
|
|
134
|
+
/**
|
|
135
|
+
* #2122 §5.5: a catch-up finished — for each instance whose sources were all listed and read, every one changed in the
|
|
136
|
+
* read window has been read up to now (an empty source included: a real zero). One that failed proves nothing.
|
|
137
|
+
*/
|
|
138
|
+
private recordCoverage;
|
|
107
139
|
private ledgerFor;
|
|
108
140
|
/**
|
|
109
141
|
* The instances whose transcripts land where another's do — the same Claude project (working directory), the
|
|
@@ -117,6 +149,11 @@ export declare class CacheService {
|
|
|
117
149
|
*/
|
|
118
150
|
pass(): Promise<number>;
|
|
119
151
|
private passOnce;
|
|
152
|
+
/**
|
|
153
|
+
* #2122: an instance not read now (a backend AgEnD cannot measure, or a working directory it shares) keeps what it
|
|
154
|
+
* measured before: its ledger's old hours are still folded into the rollup before they leave, as anyone's.
|
|
155
|
+
*/
|
|
156
|
+
private keepHistory;
|
|
120
157
|
/** A file that is not the one the cursor read (another inode, or shorter): keep the session's end, start at its end. */
|
|
121
158
|
private followFromEnd;
|
|
122
159
|
private read;
|
|
@@ -134,15 +171,30 @@ export declare class CacheService {
|
|
|
134
171
|
* Never reads a transcript itself.
|
|
135
172
|
*/
|
|
136
173
|
published(window: CacheWindow, maxAgeMs?: number): Promise<CacheReport>;
|
|
174
|
+
/**
|
|
175
|
+
* #2122: what the usage report reads — each instance's ledger and rollup as they are now, or why it has none. Never
|
|
176
|
+
* reads a transcript (a catch-up is started, not waited for).
|
|
177
|
+
*/
|
|
178
|
+
usageData(): Promise<{
|
|
179
|
+
scanning: CacheReport["scanning"];
|
|
180
|
+
instances: Array<{
|
|
181
|
+
inst: CacheInstance;
|
|
182
|
+
status: InstanceReport["status"];
|
|
183
|
+
with?: string[];
|
|
184
|
+
ledger: Ledger;
|
|
185
|
+
days: UsageDays;
|
|
186
|
+
}>;
|
|
187
|
+
}>;
|
|
137
188
|
/** The analysis for a window, from the ledgers as they are now (a catch-up is started, not waited for). */
|
|
138
189
|
report(window: CacheWindow): Promise<CacheReport>;
|
|
139
190
|
}
|
|
140
191
|
/**
|
|
141
192
|
* A rollout's session_meta, read with one bounded read through the descriptor whose inode it records. Null while the
|
|
142
|
-
* first line is not complete yet (the next pass reads it again); `cwd: null` for a complete first
|
|
143
|
-
* a session_meta
|
|
193
|
+
* first line is not complete yet, or the file is gone (the next pass reads it again); `cwd: null` for a complete first
|
|
194
|
+
* line that is not a session_meta; "unreadable" when it is there and could not be read (EACCES, EIO… — #2122: not a
|
|
195
|
+
* real absence).
|
|
144
196
|
*/
|
|
145
197
|
export declare function rolloutMeta(path: string): Promise<{
|
|
146
198
|
ino: number;
|
|
147
199
|
cwd: string | null;
|
|
148
|
-
} | null>;
|
|
200
|
+
} | null | "unreadable">;
|
package/dist/cache-service.js
CHANGED
|
@@ -20,6 +20,7 @@ import { scanJsonl } from "./cache-scan.js";
|
|
|
20
20
|
import { addTurn, claudeLine, codexLine, emptyLedger, KEEP_DAYS, pruneLedger, reviveLedger } from "./cache-ledger.js";
|
|
21
21
|
import { analyzeLedger } from "./cache-analysis.js";
|
|
22
22
|
import { PRICES_CHECKED, PRICE_SOURCES } from "./cache-prices.js";
|
|
23
|
+
import { addCoverage, foldHours, pruneDays, readDays, writeDays } from "./usage-rollup.js";
|
|
23
24
|
export const WINDOWS = { "24h": 86_400_000, "7d": 7 * 86_400_000, "30d": 30 * 86_400_000 };
|
|
24
25
|
/** A window name as asked (a query string, a tool argument); anything unknown is the default, 7 days. */
|
|
25
26
|
export const cacheWindow = (w) => (Object.prototype.hasOwnProperty.call(WINDOWS, w) ? w : "7d");
|
|
@@ -28,9 +29,13 @@ const META_MAX_BYTES = 256 * 1024; // session_meta carries the instructions (~22
|
|
|
28
29
|
const kindOf = (backend) => (backend === "claude-code" ? "claude" : backend === "codex" ? "codex" : null);
|
|
29
30
|
const sleep = (ms) => new Promise((r) => { const h = setTimeout(r, ms); h.unref?.(); });
|
|
30
31
|
const dict = () => Object.create(null);
|
|
32
|
+
/** An error that means the path is not there (never was, or went): a real absence, not a failure to read it. */
|
|
33
|
+
const gone = (err) => err?.code === "ENOENT";
|
|
31
34
|
export class CacheService {
|
|
32
35
|
o;
|
|
33
36
|
ledgers = new Map();
|
|
37
|
+
/** #2122: each instance's daily rollup (usage-rollup.ts), beside its ledger. */
|
|
38
|
+
rollups = new Map();
|
|
34
39
|
dirty = new Set();
|
|
35
40
|
/** Rollout path → the inode its session_meta was read from, and the cwd it names (null: not a session_meta). */
|
|
36
41
|
meta = null;
|
|
@@ -42,6 +47,11 @@ export class CacheService {
|
|
|
42
47
|
closing = false;
|
|
43
48
|
pending = { bytes: 0, files: 0 };
|
|
44
49
|
caughtUp = false;
|
|
50
|
+
/**
|
|
51
|
+
* #2122 §5.5: instances whose transcripts could not all be listed or read during this catch-up (EACCES, EIO… — a source
|
|
52
|
+
* that is simply not there is not one). The catch-up then proves nothing about them: no coverage is recorded.
|
|
53
|
+
*/
|
|
54
|
+
unread = new Set();
|
|
45
55
|
now;
|
|
46
56
|
constructor(o) {
|
|
47
57
|
this.o = o;
|
|
@@ -101,10 +111,13 @@ export class CacheService {
|
|
|
101
111
|
return { active: this.running !== null, caughtUp: this.caughtUp, pendingBytes: this.pending.bytes, pendingFiles: this.pending.files };
|
|
102
112
|
}
|
|
103
113
|
async catchUp() {
|
|
114
|
+
this.unread.clear();
|
|
104
115
|
for (;;) {
|
|
105
116
|
const left = await this.pass();
|
|
106
|
-
if (left === 0)
|
|
117
|
+
if (left === 0) {
|
|
107
118
|
this.caughtUp = true;
|
|
119
|
+
await this.recordCoverage();
|
|
120
|
+
}
|
|
108
121
|
// Stop looping when: all caught up, explicitly stopped, or closing (stop()
|
|
109
122
|
// fenced new admission — let the current physical pass write its dirty data,
|
|
110
123
|
// then exit rather than scanning the full backlog during shutdown).
|
|
@@ -113,6 +126,55 @@ export class CacheService {
|
|
|
113
126
|
await sleep(this.o.pauseMs ?? 25);
|
|
114
127
|
}
|
|
115
128
|
}
|
|
129
|
+
zone() { return this.o.zone?.() || Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"; }
|
|
130
|
+
daysPath(inst) { return join(dirname(inst.ledgerPath), "usage-days.json"); }
|
|
131
|
+
/** #2122: an instance's rollup, read once. */
|
|
132
|
+
async rollupFor(inst) {
|
|
133
|
+
let d = this.rollups.get(inst.name);
|
|
134
|
+
if (d)
|
|
135
|
+
return d;
|
|
136
|
+
d = await readDays(this.daysPath(inst));
|
|
137
|
+
const again = this.rollups.get(inst.name);
|
|
138
|
+
if (again)
|
|
139
|
+
return again;
|
|
140
|
+
this.rollups.set(inst.name, d);
|
|
141
|
+
return d;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* #2122 §5.2: fold the hours about to leave the ledger into the rollup — on a copy, kept only once it is on disk — and
|
|
145
|
+
* return the checkpoint that is durable now (the ledger is pruned through it, never past it).
|
|
146
|
+
*/
|
|
147
|
+
async foldBeforePrune(inst, ledger, cutoff) {
|
|
148
|
+
const current = await this.rollupFor(inst);
|
|
149
|
+
const next = structuredClone(current);
|
|
150
|
+
const folded = foldHours(next, ledger, cutoff, this.zone());
|
|
151
|
+
const pruned = pruneDays(next, this.now(), this.zone());
|
|
152
|
+
if (!folded && !pruned)
|
|
153
|
+
return current.checkpoint;
|
|
154
|
+
if (!(await writeDays(this.daysPath(inst), next))) {
|
|
155
|
+
this.o.log?.("warn", "usage rollup: could not be saved; the ledger keeps those hours until it can", { instance: inst.name });
|
|
156
|
+
return current.checkpoint;
|
|
157
|
+
}
|
|
158
|
+
this.rollups.set(inst.name, next);
|
|
159
|
+
return next.checkpoint;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* #2122 §5.5: a catch-up finished — for each instance whose sources were all listed and read, every one changed in the
|
|
163
|
+
* read window has been read up to now (an empty source included: a real zero). One that failed proves nothing.
|
|
164
|
+
*/
|
|
165
|
+
async recordCoverage() {
|
|
166
|
+
const now = this.now();
|
|
167
|
+
const insts = this.o.instances();
|
|
168
|
+
const shared = await this.shared(insts);
|
|
169
|
+
for (const inst of insts) {
|
|
170
|
+
if (!kindOf(inst.backend) || shared.has(inst.name) || this.unread.has(inst.name))
|
|
171
|
+
continue;
|
|
172
|
+
const next = structuredClone(await this.rollupFor(inst));
|
|
173
|
+
addCoverage(next, now - KEEP_DAYS * DAY, now);
|
|
174
|
+
if (await writeDays(this.daysPath(inst), next))
|
|
175
|
+
this.rollups.set(inst.name, next);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
116
178
|
async ledgerFor(inst) {
|
|
117
179
|
let l = this.ledgers.get(inst.name);
|
|
118
180
|
if (l)
|
|
@@ -175,8 +237,10 @@ export class CacheService {
|
|
|
175
237
|
if (this.stopped)
|
|
176
238
|
break;
|
|
177
239
|
const kind = kindOf(inst.backend);
|
|
178
|
-
if (!kind || shared.has(inst.name))
|
|
240
|
+
if (!kind || shared.has(inst.name)) {
|
|
241
|
+
await this.keepHistory(inst, cutoff);
|
|
179
242
|
continue;
|
|
243
|
+
}
|
|
180
244
|
const ledger = await this.ledgerFor(inst);
|
|
181
245
|
const files = kind === "claude" ? await this.claudeFiles(inst, cutoff) : codex.get(inst.name) ?? [];
|
|
182
246
|
const listed = new Set(files.map((f) => f.path));
|
|
@@ -205,7 +269,9 @@ export class CacheService {
|
|
|
205
269
|
behindFiles++;
|
|
206
270
|
continue;
|
|
207
271
|
}
|
|
208
|
-
const done = await this.read(ledger, cur, f.path, budget, cutoff);
|
|
272
|
+
const done = await this.read(ledger, cur, f.path, budget, cutoff, inst.profile);
|
|
273
|
+
if (done.failed)
|
|
274
|
+
this.unread.add(inst.name);
|
|
209
275
|
this.dirty.add(inst.name);
|
|
210
276
|
budget -= done.read;
|
|
211
277
|
if (done.behind > 0) {
|
|
@@ -213,7 +279,8 @@ export class CacheService {
|
|
|
213
279
|
behindFiles++;
|
|
214
280
|
}
|
|
215
281
|
}
|
|
216
|
-
|
|
282
|
+
// #2122: fold, then prune — the ledger never drops an hour the rollup does not durably hold.
|
|
283
|
+
pruneLedger(ledger, cutoff, await this.foldBeforePrune(inst, ledger, cutoff));
|
|
217
284
|
}
|
|
218
285
|
this.pending = { bytes: behindBytes, files: behindFiles };
|
|
219
286
|
// A ledger read something new (or lost a file): a published report is out of date (Fable #2030 P2 — a pass that
|
|
@@ -223,6 +290,19 @@ export class CacheService {
|
|
|
223
290
|
await this.save(insts);
|
|
224
291
|
return behindBytes;
|
|
225
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* #2122: an instance not read now (a backend AgEnD cannot measure, or a working directory it shares) keeps what it
|
|
295
|
+
* measured before: its ledger's old hours are still folded into the rollup before they leave, as anyone's.
|
|
296
|
+
*/
|
|
297
|
+
async keepHistory(inst, cutoff) {
|
|
298
|
+
const ledger = await this.ledgerFor(inst);
|
|
299
|
+
const before = Object.keys(ledger.hours).length;
|
|
300
|
+
if (!before)
|
|
301
|
+
return;
|
|
302
|
+
pruneLedger(ledger, cutoff, await this.foldBeforePrune(inst, ledger, cutoff));
|
|
303
|
+
if (Object.keys(ledger.hours).length !== before)
|
|
304
|
+
this.dirty.add(inst.name);
|
|
305
|
+
}
|
|
226
306
|
/** A file that is not the one the cursor read (another inode, or shorter): keep the session's end, start at its end. */
|
|
227
307
|
followFromEnd(ledger, path, cur, ino, size) {
|
|
228
308
|
const next = { kind: cur.kind, ino, offset: size };
|
|
@@ -234,12 +314,12 @@ export class CacheService {
|
|
|
234
314
|
next.ttl = cur.ttl;
|
|
235
315
|
return ledger.files[path] = next;
|
|
236
316
|
}
|
|
237
|
-
async read(ledger, cur, path, budget, cutoff) {
|
|
317
|
+
async read(ledger, cur, path, budget, cutoff, profile) {
|
|
238
318
|
try {
|
|
239
319
|
const res = await scanJsonl(path, cur.offset, { maxBytes: budget, ino: cur.ino }, (line) => {
|
|
240
320
|
const turn = cur.kind === "claude" ? claudeLine(line, cur) : codexLine(line, cur);
|
|
241
321
|
if (turn)
|
|
242
|
-
addTurn(ledger, cur, turn, cutoff);
|
|
322
|
+
addTurn(ledger, cur, turn, cutoff, profile);
|
|
243
323
|
});
|
|
244
324
|
if (res.replaced) {
|
|
245
325
|
this.followFromEnd(ledger, path, cur, res.ino, res.size);
|
|
@@ -256,17 +336,21 @@ export class CacheService {
|
|
|
256
336
|
}
|
|
257
337
|
catch (err) {
|
|
258
338
|
this.o.log?.("debug", "cache analysis: could not read a transcript", { path, err: String(err) });
|
|
259
|
-
|
|
339
|
+
// Gone since the listing: nothing left to read. Anything else: not read (the cursor stays; a later pass retries).
|
|
340
|
+
return gone(err) ? { read: 1, behind: 0 } : { read: 1, behind: 0, failed: true };
|
|
260
341
|
}
|
|
261
342
|
}
|
|
262
343
|
async claudeFiles(inst, cutoff) {
|
|
263
344
|
const projects = inst.claudeConfigDir ? join(inst.claudeConfigDir, "projects") : this.o.claudeProjectsDir();
|
|
264
345
|
const dir = join(projects, this.o.claudeKey(inst.workingDirectory));
|
|
265
346
|
let names;
|
|
347
|
+
// No project directory: this instance has written nothing there (a real zero). Unreadable: not listed at all.
|
|
266
348
|
try {
|
|
267
349
|
names = await readdir(dir);
|
|
268
350
|
}
|
|
269
|
-
catch {
|
|
351
|
+
catch (err) {
|
|
352
|
+
if (!gone(err))
|
|
353
|
+
this.unread.add(inst.name);
|
|
270
354
|
return [];
|
|
271
355
|
}
|
|
272
356
|
const out = [];
|
|
@@ -279,7 +363,10 @@ export class CacheService {
|
|
|
279
363
|
if (st.isFile() && st.mtimeMs >= cutoff)
|
|
280
364
|
out.push({ path, ino: st.ino, size: st.size });
|
|
281
365
|
}
|
|
282
|
-
catch {
|
|
366
|
+
catch (err) {
|
|
367
|
+
if (!gone(err))
|
|
368
|
+
this.unread.add(inst.name);
|
|
369
|
+
}
|
|
283
370
|
}
|
|
284
371
|
return out;
|
|
285
372
|
}
|
|
@@ -305,10 +392,19 @@ export class CacheService {
|
|
|
305
392
|
catch { /* none yet */ }
|
|
306
393
|
}
|
|
307
394
|
let rollouts = [];
|
|
395
|
+
// A listing that could not read part of the tree may miss any codex instance's rollouts: none of them is covered.
|
|
396
|
+
const unlisted = () => { for (const i of codexInsts)
|
|
397
|
+
this.unread.add(i.name); };
|
|
308
398
|
try {
|
|
309
|
-
|
|
399
|
+
const root = this.o.codexSessionsDir();
|
|
400
|
+
rollouts = this.o.listRollouts(root).filter((r) => r.mtimeMs >= cutoff);
|
|
401
|
+
if ((this.o.rolloutsUnreadable?.(root) ?? 0) > 0)
|
|
402
|
+
unlisted();
|
|
403
|
+
}
|
|
404
|
+
catch (err) {
|
|
405
|
+
if (!gone(err))
|
|
406
|
+
unlisted(); /* else no sessions yet */
|
|
310
407
|
}
|
|
311
|
-
catch { /* no sessions yet */ }
|
|
312
408
|
const live = new Set();
|
|
313
409
|
for (const r of rollouts) {
|
|
314
410
|
live.add(r.path);
|
|
@@ -316,13 +412,21 @@ export class CacheService {
|
|
|
316
412
|
try {
|
|
317
413
|
st = await stat(r.path);
|
|
318
414
|
}
|
|
319
|
-
catch {
|
|
415
|
+
catch (err) {
|
|
416
|
+
if (!gone(err))
|
|
417
|
+
unlisted();
|
|
320
418
|
continue;
|
|
321
419
|
}
|
|
322
420
|
let m = this.meta[r.path];
|
|
323
421
|
// Read once per physical file; a first line still being written is read again next pass.
|
|
324
422
|
if (!m || m.ino !== st.ino) {
|
|
325
423
|
const read = await rolloutMeta(r.path);
|
|
424
|
+
// Unreadable (not gone, not just unfinished): whose it is cannot be known, so no codex instance is covered.
|
|
425
|
+
if (read === "unreadable") {
|
|
426
|
+
unlisted();
|
|
427
|
+
delete this.meta[r.path];
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
326
430
|
if (read) {
|
|
327
431
|
m = this.meta[r.path] = read;
|
|
328
432
|
this.metaDirty = true;
|
|
@@ -379,6 +483,37 @@ export class CacheService {
|
|
|
379
483
|
report.catch(() => this.memo.delete(window));
|
|
380
484
|
return report;
|
|
381
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* #2122: what the usage report reads — each instance's ledger and rollup as they are now, or why it has none. Never
|
|
488
|
+
* reads a transcript (a catch-up is started, not waited for).
|
|
489
|
+
*/
|
|
490
|
+
async usageData() {
|
|
491
|
+
this.start();
|
|
492
|
+
void this.kick();
|
|
493
|
+
const insts = this.o.instances();
|
|
494
|
+
const shared = await this.shared(insts);
|
|
495
|
+
const out = [];
|
|
496
|
+
for (const inst of insts) {
|
|
497
|
+
await this.ledgerFor(inst);
|
|
498
|
+
await this.rollupFor(inst);
|
|
499
|
+
// One instance's ledger and rollup copied together, with no await between: a pass folds an hour into a new rollup
|
|
500
|
+
// and prunes it from the ledger later, so both copies hold it (the report counts it once, by the checkpoint) or
|
|
501
|
+
// one does — never neither. Copies, so a pass that runs while the next instance is loaded changes nothing here.
|
|
502
|
+
const live = this.ledgers.get(inst.name);
|
|
503
|
+
const ledger = { ...emptyLedger(), hours: structuredClone(live.hours), ...(live.writesSeen ? { writesSeen: true } : {}) }; // what the report reads
|
|
504
|
+
const days = structuredClone(this.rollups.get(inst.name));
|
|
505
|
+
// `status` is about collecting now; what it measured before (another backend, a directory it did not share yet)
|
|
506
|
+
// is in `ledger` and `days` either way.
|
|
507
|
+
const kind = kindOf(inst.backend), others = shared.get(inst.name);
|
|
508
|
+
if (!kind)
|
|
509
|
+
out.push({ inst, status: inst.backend.startsWith("kiro") ? "credit_billed" : "unsupported", ledger, days });
|
|
510
|
+
else if (others)
|
|
511
|
+
out.push({ inst, status: "shared", with: others, ledger, days });
|
|
512
|
+
else
|
|
513
|
+
out.push({ inst, status: "ok", ledger, days });
|
|
514
|
+
}
|
|
515
|
+
return { scanning: this.scanning(), instances: out };
|
|
516
|
+
}
|
|
382
517
|
/** The analysis for a window, from the ledgers as they are now (a catch-up is started, not waited for). */
|
|
383
518
|
async report(window) {
|
|
384
519
|
this.start();
|
|
@@ -435,8 +570,9 @@ async function cwdKeys(dir) {
|
|
|
435
570
|
}
|
|
436
571
|
/**
|
|
437
572
|
* A rollout's session_meta, read with one bounded read through the descriptor whose inode it records. Null while the
|
|
438
|
-
* first line is not complete yet (the next pass reads it again); `cwd: null` for a complete first
|
|
439
|
-
* a session_meta
|
|
573
|
+
* first line is not complete yet, or the file is gone (the next pass reads it again); `cwd: null` for a complete first
|
|
574
|
+
* line that is not a session_meta; "unreadable" when it is there and could not be read (EACCES, EIO… — #2122: not a
|
|
575
|
+
* real absence).
|
|
440
576
|
*/
|
|
441
577
|
export async function rolloutMeta(path) {
|
|
442
578
|
let fh;
|
|
@@ -456,8 +592,8 @@ export async function rolloutMeta(path) {
|
|
|
456
592
|
return { ino, cwd: null };
|
|
457
593
|
}
|
|
458
594
|
}
|
|
459
|
-
catch {
|
|
460
|
-
return null;
|
|
595
|
+
catch (err) {
|
|
596
|
+
return gone(err) ? null : "unreadable";
|
|
461
597
|
}
|
|
462
598
|
finally {
|
|
463
599
|
await fh?.close().catch(() => { });
|