chompyy 0.4.7 → 0.6.0
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/README.md +40 -6
- package/dist/advice.js +2 -1
- package/dist/agentlimits.js +77 -0
- package/dist/agentusage.js +96 -0
- package/dist/appstate.js +72 -5
- package/dist/away.js +44 -5
- package/dist/blueprint.js +3 -7
- package/dist/board.js +4 -0
- package/dist/cli.js +328 -15
- package/dist/codexquota.js +106 -0
- package/dist/codexusage.js +10 -0
- package/dist/config.js +2 -0
- package/dist/context.js +30 -0
- package/dist/costs.js +1 -0
- package/dist/daytime.js +68 -0
- package/dist/demon.js +20 -0
- package/dist/didwork.js +46 -0
- package/dist/label.js +33 -0
- package/dist/learning.js +35 -0
- package/dist/menu.js +17 -0
- package/dist/nightcap.js +60 -0
- package/dist/nudge.js +47 -18
- package/dist/pacing.js +16 -1
- package/dist/questions.js +71 -0
- package/dist/recap.js +74 -0
- package/dist/receipt.js +48 -0
- package/dist/recipe.js +79 -0
- package/dist/send.js +46 -20
- package/dist/stamps.js +14 -0
- package/dist/taste.js +67 -7
- package/dist/triggers.js +5 -0
- package/dist/unkeep.js +220 -0
- package/dist/usage.js +21 -1
- package/dist/vendor/codeburn/antigravity.js +309 -0
- package/dist/vendor/codeburn/codex.js +429 -0
- package/dist/vendor/codeburn/copilot.js +292 -0
- package/dist/vendor/codeburn/gemini.js +195 -0
- package/dist/vendor/codeburn/grokbot.js +182 -0
- package/dist/vendor/codeburn/kimi.js +178 -0
- package/dist/vendor/codeburn/shims/chalk.js +14 -0
- package/dist/vendor/codeburn/shims/strip-ansi.js +6 -0
- package/dist/vendor/codeburn/src/act/backup.js +83 -0
- package/dist/vendor/codeburn/src/act/model-defaults.js +151 -0
- package/dist/vendor/codeburn/src/act/types.js +37 -0
- package/dist/vendor/codeburn/src/bash-utils.js +204 -0
- package/dist/vendor/codeburn/src/behavioral-weight.js +47 -0
- package/dist/vendor/codeburn/src/cache-dir.js +26 -0
- package/dist/vendor/codeburn/src/cache-refresh-lock.js +543 -0
- package/dist/vendor/codeburn/src/cache-sweep.js +67 -0
- package/dist/vendor/codeburn/src/classifier.js +209 -0
- package/dist/vendor/codeburn/src/claude-identity.js +223 -0
- package/dist/vendor/codeburn/src/codex-cache.js +377 -0
- package/dist/vendor/codeburn/src/codex-fork-replay.js +232 -0
- package/dist/vendor/codeburn/src/codex-jsonl-fields.js +99 -0
- package/dist/vendor/codeburn/src/codex-session-index.js +113 -0
- package/dist/vendor/codeburn/src/codex-throughput.js +544 -0
- package/dist/vendor/codeburn/src/compare-stats.js +405 -0
- package/dist/vendor/codeburn/src/config.js +145 -0
- package/dist/vendor/codeburn/src/content-utils.js +56 -0
- package/dist/vendor/codeburn/src/context-tree-codex.js +329 -0
- package/dist/vendor/codeburn/src/context-tree.js +664 -0
- package/dist/vendor/codeburn/src/copilot-aiu.js +16 -0
- package/dist/vendor/codeburn/src/currency.js +189 -0
- package/dist/vendor/codeburn/src/cursor-cache.js +238 -0
- package/dist/vendor/codeburn/src/cursor-import.js +402 -0
- package/dist/vendor/codeburn/src/cursor-sync.js +256 -0
- package/dist/vendor/codeburn/src/daily-cache.js +2036 -0
- package/dist/vendor/codeburn/src/data/litellm-snapshot.json +1 -0
- package/dist/vendor/codeburn/src/data/pricing-fallback.json +1 -0
- package/dist/vendor/codeburn/src/day-aggregator.js +327 -0
- package/dist/vendor/codeburn/src/editor-data-dir.js +11 -0
- package/dist/vendor/codeburn/src/fetch-utils.js +18 -0
- package/dist/vendor/codeburn/src/format.js +118 -0
- package/dist/vendor/codeburn/src/fs-utils.js +270 -0
- package/dist/vendor/codeburn/src/git-origin.js +334 -0
- package/dist/vendor/codeburn/src/granular-history.js +328 -0
- package/dist/vendor/codeburn/src/hermes-session-ledger.js +512 -0
- package/dist/vendor/codeburn/src/launcher-homes.js +142 -0
- package/dist/vendor/codeburn/src/live-sessions.js +358 -0
- package/dist/vendor/codeburn/src/math-utils.js +8 -0
- package/dist/vendor/codeburn/src/menubar-json.js +294 -0
- package/dist/vendor/codeburn/src/models.js +1879 -0
- package/dist/vendor/codeburn/src/optimize-one-hour-cache.js +92 -0
- package/dist/vendor/codeburn/src/optimize.js +4110 -0
- package/dist/vendor/codeburn/src/parse-workers.js +219 -0
- package/dist/vendor/codeburn/src/parser.js +6953 -0
- package/dist/vendor/codeburn/src/path-privacy.js +26 -0
- package/dist/vendor/codeburn/src/plans.js +135 -0
- package/dist/vendor/codeburn/src/pr-signals.js +132 -0
- package/dist/vendor/codeburn/src/project-filter-warnings.js +33 -0
- package/dist/vendor/codeburn/src/provider-issues.js +30 -0
- package/dist/vendor/codeburn/src/providers/amp.js +286 -0
- package/dist/vendor/codeburn/src/providers/antigravity.js +1731 -0
- package/dist/vendor/codeburn/src/providers/claude.js +551 -0
- package/dist/vendor/codeburn/src/providers/cline-cli.js +401 -0
- package/dist/vendor/codeburn/src/providers/cline.js +63 -0
- package/dist/vendor/codeburn/src/providers/codebuff.js +336 -0
- package/dist/vendor/codeburn/src/providers/codewhale.js +442 -0
- package/dist/vendor/codeburn/src/providers/codex.js +1720 -0
- package/dist/vendor/codeburn/src/providers/command-code.js +196 -0
- package/dist/vendor/codeburn/src/providers/copilot.js +3278 -0
- package/dist/vendor/codeburn/src/providers/crush.js +226 -0
- package/dist/vendor/codeburn/src/providers/cursor-agent.js +837 -0
- package/dist/vendor/codeburn/src/providers/cursor.js +1163 -0
- package/dist/vendor/codeburn/src/providers/devin.js +569 -0
- package/dist/vendor/codeburn/src/providers/droid.js +324 -0
- package/dist/vendor/codeburn/src/providers/dsh.js +690 -0
- package/dist/vendor/codeburn/src/providers/forge.js +245 -0
- package/dist/vendor/codeburn/src/providers/gemini.js +230 -0
- package/dist/vendor/codeburn/src/providers/goose.js +252 -0
- package/dist/vendor/codeburn/src/providers/grok.js +581 -0
- package/dist/vendor/codeburn/src/providers/grokbot.js +290 -0
- package/dist/vendor/codeburn/src/providers/hermes.js +771 -0
- package/dist/vendor/codeburn/src/providers/ibm-bob.js +53 -0
- package/dist/vendor/codeburn/src/providers/index.js +360 -0
- package/dist/vendor/codeburn/src/providers/kilo-code.js +50 -0
- package/dist/vendor/codeburn/src/providers/kimi.js +363 -0
- package/dist/vendor/codeburn/src/providers/kimicode.js +402 -0
- package/dist/vendor/codeburn/src/providers/kiro.js +1174 -0
- package/dist/vendor/codeburn/src/providers/lingtai-tui.js +372 -0
- package/dist/vendor/codeburn/src/providers/mistral-vibe-unified.js +236 -0
- package/dist/vendor/codeburn/src/providers/mistral-vibe.js +405 -0
- package/dist/vendor/codeburn/src/providers/mux.js +242 -0
- package/dist/vendor/codeburn/src/providers/open-design.js +217 -0
- package/dist/vendor/codeburn/src/providers/openclaude.js +309 -0
- package/dist/vendor/codeburn/src/providers/openclaw.js +442 -0
- package/dist/vendor/codeburn/src/providers/opencode-file-parser.js +131 -0
- package/dist/vendor/codeburn/src/providers/opencode.js +91 -0
- package/dist/vendor/codeburn/src/providers/pi.js +429 -0
- package/dist/vendor/codeburn/src/providers/quickdesk.js +491 -0
- package/dist/vendor/codeburn/src/providers/qwen.js +193 -0
- package/dist/vendor/codeburn/src/providers/session-message.js +118 -0
- package/dist/vendor/codeburn/src/providers/sqlite-session-parser.js +457 -0
- package/dist/vendor/codeburn/src/providers/types.js +5 -0
- package/dist/vendor/codeburn/src/providers/vercel-gateway.js +135 -0
- package/dist/vendor/codeburn/src/providers/vscode-cline-parser.js +212 -0
- package/dist/vendor/codeburn/src/providers/warp.js +575 -0
- package/dist/vendor/codeburn/src/providers/zcode.js +249 -0
- package/dist/vendor/codeburn/src/providers/zed.js +187 -0
- package/dist/vendor/codeburn/src/providers/zerostack.js +139 -0
- package/dist/vendor/codeburn/src/quota/antigravity.js +310 -0
- package/dist/vendor/codeburn/src/quota/claude.js +244 -0
- package/dist/vendor/codeburn/src/quota/cursor.js +301 -0
- package/dist/vendor/codeburn/src/quota/security.js +299 -0
- package/dist/vendor/codeburn/src/quota/types.js +1 -0
- package/dist/vendor/codeburn/src/scan-facts.js +99 -0
- package/dist/vendor/codeburn/src/session-cache.js +3040 -0
- package/dist/vendor/codeburn/src/session-count-label.js +14 -0
- package/dist/vendor/codeburn/src/session-output.js +139 -0
- package/dist/vendor/codeburn/src/session-population.js +30 -0
- package/dist/vendor/codeburn/src/sessions-report.js +1342 -0
- package/dist/vendor/codeburn/src/sqlite.js +528 -0
- package/dist/vendor/codeburn/src/sync/otlp.js +420 -0
- package/dist/vendor/codeburn/src/telemetry-snapshot.js +244 -0
- package/dist/vendor/codeburn/src/token-estimate.js +5 -0
- package/dist/vendor/codeburn/src/types.js +16 -0
- package/dist/vendor/codeburn/src/work-units.js +126 -0
- package/dist/vendor/codeburn/src/workflow-insights.js +228 -0
- package/dist/vendor/codeburn/src/wsl.js +198 -0
- package/dist/vendor/codeburn/src/yield.js +666 -0
- package/package.json +11 -3
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
// @ts-nocheck: codeburn type-checks this under its own tsconfig; Chompyy adds noUncheckedIndexedAccess (see UPSTREAM.md)
|
|
2
|
+
import { open, rename, unlink, mkdir } from 'fs/promises';
|
|
3
|
+
import { existsSync, readFileSync, unlinkSync } from 'fs';
|
|
4
|
+
import { randomBytes } from 'crypto';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { getCodeburnCacheDir } from './cache-dir.js';
|
|
7
|
+
// Sidecar ledger for Hermes lifetime totals that keep growing after a day is
|
|
8
|
+
// sealed. Contract (iamtoruk #1121 review):
|
|
9
|
+
//
|
|
10
|
+
// - Reset 150 → 0 → 40 is in contract: an all-zero (or shrinking) snapshot
|
|
11
|
+
// advances last-seen without a negative observation; later growth is new
|
|
12
|
+
// spend on the observation day.
|
|
13
|
+
// - Restores are out of contract: state.db restored from backup without
|
|
14
|
+
// wiping the ledger ⇒ regrowth is re-credited; wipe both or accept it.
|
|
15
|
+
// A post-reset high-water-mark guard is rejected: it would eat genuine
|
|
16
|
+
// 150→0→40 resets, which are treated as new spend by design.
|
|
17
|
+
// - Recovery horizon is the warm session-cache baseline. `seedHermesCursorsFromProviderSection`
|
|
18
|
+
// copies cached lifetime totals into missing cursors so growth *since the
|
|
19
|
+
// last warm parse* is recovered. Growth dropped *before* that parse stays
|
|
20
|
+
// dropped: sealed days are not re-read. This slice does not bump
|
|
21
|
+
// DAILY_CACHE_VERSION (one cold re-parse for every user) to recover history.
|
|
22
|
+
// v3 discards the local-only v2 migration candidate. Seeding v2 from the warm
|
|
23
|
+
// session cache could preserve lifetime totals while assigning historical
|
|
24
|
+
// observations to the migration day, inflating that day's scoped Hermes spend.
|
|
25
|
+
// v4: the calculated basis stopped adding reasoning tokens on top of an output
|
|
26
|
+
// count that already holds them. A v3 cursor that priced reasoning that way is
|
|
27
|
+
// carried with `rebuild` set, and the next snapshot its source still supplies
|
|
28
|
+
// reprices its observations in place (repriceRebuild). A cursor whose source is gone
|
|
29
|
+
// gets no such snapshot and keeps the v3 figure: it holds the tokens but not
|
|
30
|
+
// the model, so there is no rate to reprice its output at.
|
|
31
|
+
export const HERMES_SESSION_LEDGER_FILENAME = 'hermes-session-ledger.v4.json';
|
|
32
|
+
export const HERMES_SESSION_LEDGER_VERSION = 4;
|
|
33
|
+
const HERMES_SESSION_LEDGER_V3_FILENAME = 'hermes-session-ledger.v3.json';
|
|
34
|
+
export class HermesLedgerPublicationError extends Error {
|
|
35
|
+
name = 'HermesLedgerPublicationError';
|
|
36
|
+
constructor(message, options) {
|
|
37
|
+
super(message, options);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function isHermesLedgerPublicationError(err) {
|
|
41
|
+
return err instanceof HermesLedgerPublicationError;
|
|
42
|
+
}
|
|
43
|
+
const ZERO_TOKENS = {
|
|
44
|
+
inputTokens: 0,
|
|
45
|
+
outputTokens: 0,
|
|
46
|
+
cacheReadTokens: 0,
|
|
47
|
+
cacheWriteTokens: 0,
|
|
48
|
+
reasoningTokens: 0,
|
|
49
|
+
};
|
|
50
|
+
let nowFn = () => new Date();
|
|
51
|
+
let memory = null;
|
|
52
|
+
let memoryDir = null;
|
|
53
|
+
export function setHermesLedgerNow(fn) {
|
|
54
|
+
nowFn = fn;
|
|
55
|
+
}
|
|
56
|
+
export function resetHermesLedgerNow() {
|
|
57
|
+
nowFn = () => new Date();
|
|
58
|
+
}
|
|
59
|
+
export function hermesLedgerNow() {
|
|
60
|
+
return nowFn();
|
|
61
|
+
}
|
|
62
|
+
export function hermesSessionLedgerPath() {
|
|
63
|
+
return join(getCodeburnCacheDir(), HERMES_SESSION_LEDGER_FILENAME);
|
|
64
|
+
}
|
|
65
|
+
export function emptyHermesSessionLedger() {
|
|
66
|
+
return { version: HERMES_SESSION_LEDGER_VERSION, cursors: {} };
|
|
67
|
+
}
|
|
68
|
+
export function resetHermesSessionLedgerForTests() {
|
|
69
|
+
memory = null;
|
|
70
|
+
memoryDir = null;
|
|
71
|
+
nowFn = () => new Date();
|
|
72
|
+
}
|
|
73
|
+
export function parseHermesDedupKey(key) {
|
|
74
|
+
if (!key.startsWith('hermes:'))
|
|
75
|
+
return null;
|
|
76
|
+
const rest = key.slice('hermes:'.length);
|
|
77
|
+
const obsMatch = rest.match(/^(.*):obs:(\d+)$/);
|
|
78
|
+
const body = obsMatch ? obsMatch[1] : rest;
|
|
79
|
+
const colon = body.indexOf(':');
|
|
80
|
+
if (colon <= 0)
|
|
81
|
+
return null;
|
|
82
|
+
const profile = body.slice(0, colon);
|
|
83
|
+
const sessionId = body.slice(colon + 1);
|
|
84
|
+
if (!profile || !sessionId)
|
|
85
|
+
return null;
|
|
86
|
+
return {
|
|
87
|
+
profile,
|
|
88
|
+
sessionId,
|
|
89
|
+
observationIndex: obsMatch ? Number(obsMatch[2]) : undefined,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export function isHermesObservationKey(key) {
|
|
93
|
+
return key.startsWith('hermes:') && /:obs:\d+$/.test(key);
|
|
94
|
+
}
|
|
95
|
+
export function hermesBaselineKey(profile, sessionId) {
|
|
96
|
+
return `hermes:${profile}:${sessionId}`;
|
|
97
|
+
}
|
|
98
|
+
export function hermesObservationKey(profile, sessionId, n) {
|
|
99
|
+
return `hermes:${profile}:${sessionId}:obs:${n}`;
|
|
100
|
+
}
|
|
101
|
+
export function getHermesCursor(ledger, profile, sessionId) {
|
|
102
|
+
return ledger.cursors[profile]?.[sessionId];
|
|
103
|
+
}
|
|
104
|
+
export function listHermesCursorSessionIds(ledger, profile) {
|
|
105
|
+
return Object.keys(ledger.cursors[profile] ?? {});
|
|
106
|
+
}
|
|
107
|
+
export function zeroHermesTokens() {
|
|
108
|
+
return { ...ZERO_TOKENS };
|
|
109
|
+
}
|
|
110
|
+
function tokenList(t) {
|
|
111
|
+
return [t.inputTokens, t.outputTokens, t.cacheReadTokens, t.cacheWriteTokens, t.reasoningTokens];
|
|
112
|
+
}
|
|
113
|
+
function tokensGte(curr, last) {
|
|
114
|
+
const a = tokenList(curr);
|
|
115
|
+
const b = tokenList(last);
|
|
116
|
+
return a.every((v, i) => v >= b[i]);
|
|
117
|
+
}
|
|
118
|
+
function tokensEqual(a, b) {
|
|
119
|
+
return tokenList(a).every((v, i) => v === tokenList(b)[i]);
|
|
120
|
+
}
|
|
121
|
+
function subtractTokens(curr, last) {
|
|
122
|
+
return {
|
|
123
|
+
inputTokens: curr.inputTokens - last.inputTokens,
|
|
124
|
+
outputTokens: curr.outputTokens - last.outputTokens,
|
|
125
|
+
cacheReadTokens: curr.cacheReadTokens - last.cacheReadTokens,
|
|
126
|
+
cacheWriteTokens: curr.cacheWriteTokens - last.cacheWriteTokens,
|
|
127
|
+
reasoningTokens: curr.reasoningTokens - last.reasoningTokens,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function hasPositiveTokenDelta(delta) {
|
|
131
|
+
return tokenList(delta).some(v => v > 0);
|
|
132
|
+
}
|
|
133
|
+
export function applyHermesSnapshot(existing, snapshot) {
|
|
134
|
+
if (!existing) {
|
|
135
|
+
const first = {
|
|
136
|
+
index: 0,
|
|
137
|
+
timestamp: snapshot.startedAt,
|
|
138
|
+
...snapshot.tokens,
|
|
139
|
+
costUSD: snapshot.costUSD,
|
|
140
|
+
costBasis: snapshot.costBasis,
|
|
141
|
+
supplementaryAccounting: false,
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
cursor: {
|
|
145
|
+
profile: snapshot.profile,
|
|
146
|
+
sessionId: snapshot.sessionId,
|
|
147
|
+
lastSeen: {
|
|
148
|
+
...snapshot.tokens,
|
|
149
|
+
costUSD: snapshot.costUSD,
|
|
150
|
+
costBasis: snapshot.costBasis,
|
|
151
|
+
},
|
|
152
|
+
observations: [first],
|
|
153
|
+
},
|
|
154
|
+
dirty: true,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const last = existing.lastSeen;
|
|
158
|
+
const sameCost = snapshot.costUSD === last.costUSD && snapshot.costBasis === last.costBasis;
|
|
159
|
+
if (tokensEqual(snapshot.tokens, last) && sameCost) {
|
|
160
|
+
return { cursor: existing, dirty: false };
|
|
161
|
+
}
|
|
162
|
+
// Shrink, including all-zero: new baseline. Do not emit a negative. Keep sealed history.
|
|
163
|
+
if (!tokensGte(snapshot.tokens, last)) {
|
|
164
|
+
return {
|
|
165
|
+
cursor: {
|
|
166
|
+
...existing,
|
|
167
|
+
lastSeen: {
|
|
168
|
+
...snapshot.tokens,
|
|
169
|
+
costUSD: snapshot.costUSD,
|
|
170
|
+
costBasis: snapshot.costBasis,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
dirty: true,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const tokenDelta = subtractTokens(snapshot.tokens, last);
|
|
177
|
+
const positiveTokens = hasPositiveTokenDelta(tokenDelta);
|
|
178
|
+
const costGrew = snapshot.costUSD >= last.costUSD;
|
|
179
|
+
const costDelta = costGrew ? snapshot.costUSD - last.costUSD : 0;
|
|
180
|
+
// Before billing-mode-v1, warm-cache recovery labelled every non-estimated
|
|
181
|
+
// baseline `actual`, including an included $0 subscription call. Repair only
|
|
182
|
+
// that exact one-observation seed when the live cumulative row now supplies
|
|
183
|
+
// the stronger included fact. Multi-observation histories are real deltas and
|
|
184
|
+
// keep each stored basis unchanged.
|
|
185
|
+
const first = existing.observations[0];
|
|
186
|
+
const legacyIncludedSeed = snapshot.costBasis === 'included'
|
|
187
|
+
&& snapshot.costUSD === 0
|
|
188
|
+
&& last.costBasis === 'actual'
|
|
189
|
+
&& last.costUSD === 0
|
|
190
|
+
&& existing.observations.length === 1
|
|
191
|
+
&& first?.index === 0
|
|
192
|
+
&& first.costBasis === 'actual'
|
|
193
|
+
&& first.costUSD === 0
|
|
194
|
+
&& tokensEqual(first, snapshot.tokens);
|
|
195
|
+
if (!positiveTokens && costDelta === 0 && legacyIncludedSeed) {
|
|
196
|
+
return {
|
|
197
|
+
cursor: {
|
|
198
|
+
...existing,
|
|
199
|
+
lastSeen: { ...snapshot.tokens, costUSD: 0, costBasis: 'included' },
|
|
200
|
+
observations: [{ ...first, costBasis: 'included' }],
|
|
201
|
+
},
|
|
202
|
+
dirty: true,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (!positiveTokens && costDelta === 0) {
|
|
206
|
+
// Tokens held (or only cost reset / basis change). Advance last-seen, no observation.
|
|
207
|
+
return {
|
|
208
|
+
cursor: {
|
|
209
|
+
...existing,
|
|
210
|
+
lastSeen: {
|
|
211
|
+
...snapshot.tokens,
|
|
212
|
+
costUSD: snapshot.costUSD,
|
|
213
|
+
costBasis: snapshot.costBasis,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
dirty: true,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const nextIndex = existing.observations.reduce((max, obs) => Math.max(max, obs.index), 0) + 1;
|
|
220
|
+
const observation = {
|
|
221
|
+
index: nextIndex,
|
|
222
|
+
timestamp: snapshot.observedAt,
|
|
223
|
+
...tokenDelta,
|
|
224
|
+
costUSD: costDelta,
|
|
225
|
+
costBasis: snapshot.costBasis,
|
|
226
|
+
supplementaryAccounting: true,
|
|
227
|
+
};
|
|
228
|
+
return {
|
|
229
|
+
cursor: {
|
|
230
|
+
...existing,
|
|
231
|
+
lastSeen: {
|
|
232
|
+
...snapshot.tokens,
|
|
233
|
+
costUSD: snapshot.costUSD,
|
|
234
|
+
costBasis: snapshot.costBasis,
|
|
235
|
+
},
|
|
236
|
+
observations: [...existing.observations, observation],
|
|
237
|
+
},
|
|
238
|
+
dirty: true,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function putCursor(ledger, cursor) {
|
|
242
|
+
return {
|
|
243
|
+
version: HERMES_SESSION_LEDGER_VERSION,
|
|
244
|
+
cursors: {
|
|
245
|
+
...ledger.cursors,
|
|
246
|
+
[cursor.profile]: {
|
|
247
|
+
...(ledger.cursors[cursor.profile] ?? {}),
|
|
248
|
+
[cursor.sessionId]: cursor,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function isNum(v) {
|
|
254
|
+
return typeof v === 'number' && Number.isFinite(v);
|
|
255
|
+
}
|
|
256
|
+
function isCostBasis(v) {
|
|
257
|
+
return v === 'actual' || v === 'estimated' || v === 'calculated' || v === 'included';
|
|
258
|
+
}
|
|
259
|
+
function validateTokens(o) {
|
|
260
|
+
return isNum(o['inputTokens'])
|
|
261
|
+
&& isNum(o['outputTokens'])
|
|
262
|
+
&& isNum(o['cacheReadTokens'])
|
|
263
|
+
&& isNum(o['cacheWriteTokens'])
|
|
264
|
+
&& isNum(o['reasoningTokens']);
|
|
265
|
+
}
|
|
266
|
+
function validateObservation(v) {
|
|
267
|
+
if (!v || typeof v !== 'object')
|
|
268
|
+
return false;
|
|
269
|
+
const o = v;
|
|
270
|
+
return validateTokens(o)
|
|
271
|
+
&& isNum(o['index'])
|
|
272
|
+
&& typeof o['timestamp'] === 'string'
|
|
273
|
+
&& isNum(o['costUSD'])
|
|
274
|
+
&& isCostBasis(o['costBasis'])
|
|
275
|
+
&& typeof o['supplementaryAccounting'] === 'boolean';
|
|
276
|
+
}
|
|
277
|
+
function validateCursor(v) {
|
|
278
|
+
if (!v || typeof v !== 'object')
|
|
279
|
+
return false;
|
|
280
|
+
const o = v;
|
|
281
|
+
if (typeof o['profile'] !== 'string' || typeof o['sessionId'] !== 'string')
|
|
282
|
+
return false;
|
|
283
|
+
if (!o['lastSeen'] || typeof o['lastSeen'] !== 'object')
|
|
284
|
+
return false;
|
|
285
|
+
const last = o['lastSeen'];
|
|
286
|
+
if (!validateTokens(last) || !isNum(last['costUSD']) || !isCostBasis(last['costBasis']))
|
|
287
|
+
return false;
|
|
288
|
+
if (!Array.isArray(o['observations']) || !o['observations'].every(validateObservation))
|
|
289
|
+
return false;
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
function validateLedger(raw, version = HERMES_SESSION_LEDGER_VERSION) {
|
|
293
|
+
if (!raw || typeof raw !== 'object')
|
|
294
|
+
return false;
|
|
295
|
+
const o = raw;
|
|
296
|
+
if (o['version'] !== version)
|
|
297
|
+
return false;
|
|
298
|
+
if (!o['cursors'] || typeof o['cursors'] !== 'object' || Array.isArray(o['cursors']))
|
|
299
|
+
return false;
|
|
300
|
+
for (const profileCursors of Object.values(o['cursors'])) {
|
|
301
|
+
if (!profileCursors || typeof profileCursors !== 'object' || Array.isArray(profileCursors))
|
|
302
|
+
return false;
|
|
303
|
+
if (!Object.values(profileCursors).every(validateCursor))
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
function migrateV3Ledger() {
|
|
309
|
+
const path = join(getCodeburnCacheDir(), HERMES_SESSION_LEDGER_V3_FILENAME);
|
|
310
|
+
if (!existsSync(path))
|
|
311
|
+
return null;
|
|
312
|
+
try {
|
|
313
|
+
const parsed = JSON.parse(readFileSync(path, 'utf-8'));
|
|
314
|
+
if (!validateLedger(parsed, 3))
|
|
315
|
+
return null;
|
|
316
|
+
const cursors = {};
|
|
317
|
+
for (const [profile, sessions] of Object.entries(parsed.cursors)) {
|
|
318
|
+
cursors[profile] = {};
|
|
319
|
+
for (const [sessionId, cursor] of Object.entries(sessions)) {
|
|
320
|
+
const reasoningPriced = cursor.observations.some(o => o.costBasis === 'calculated' && o.reasoningTokens > 0);
|
|
321
|
+
cursors[profile][sessionId] = reasoningPriced ? { ...cursor, rebuild: true } : cursor;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return { version: HERMES_SESSION_LEDGER_VERSION, cursors };
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function readLedgerFromDisk() {
|
|
331
|
+
const path = hermesSessionLedgerPath();
|
|
332
|
+
if (!existsSync(path)) {
|
|
333
|
+
const migrated = migrateV3Ledger();
|
|
334
|
+
if (migrated)
|
|
335
|
+
return migrated;
|
|
336
|
+
// The v1 file is superseded and can never be read again: the parse-version
|
|
337
|
+
// bump forces a cold re-parse that rebuilds every cursor from source.
|
|
338
|
+
// Left behind it is dead bytes that only invite a future reader to trust
|
|
339
|
+
// observations recorded under an accounting this branch replaced.
|
|
340
|
+
const v1 = join(getCodeburnCacheDir(), 'hermes-session-ledger.v1.json');
|
|
341
|
+
if (existsSync(v1)) {
|
|
342
|
+
try {
|
|
343
|
+
unlinkSync(v1);
|
|
344
|
+
}
|
|
345
|
+
catch { /* another process got there first */ }
|
|
346
|
+
}
|
|
347
|
+
return emptyHermesSessionLedger();
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
const parsed = JSON.parse(readFileSync(path, 'utf-8'));
|
|
351
|
+
if (!validateLedger(parsed))
|
|
352
|
+
return emptyHermesSessionLedger();
|
|
353
|
+
return parsed;
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
return emptyHermesSessionLedger();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
export function loadHermesSessionLedger() {
|
|
360
|
+
const dir = getCodeburnCacheDir();
|
|
361
|
+
if (memory && memoryDir === dir)
|
|
362
|
+
return memory;
|
|
363
|
+
const loaded = readLedgerFromDisk();
|
|
364
|
+
memory = loaded;
|
|
365
|
+
memoryDir = dir;
|
|
366
|
+
return loaded;
|
|
367
|
+
}
|
|
368
|
+
async function writeFileAtomic(finalPath, payload) {
|
|
369
|
+
const tempPath = `${finalPath}.${randomBytes(8).toString('hex')}.tmp`;
|
|
370
|
+
const handle = await open(tempPath, 'w', 0o600);
|
|
371
|
+
try {
|
|
372
|
+
await handle.writeFile(payload, { encoding: 'utf-8' });
|
|
373
|
+
await handle.sync();
|
|
374
|
+
}
|
|
375
|
+
finally {
|
|
376
|
+
await handle.close();
|
|
377
|
+
}
|
|
378
|
+
try {
|
|
379
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
380
|
+
try {
|
|
381
|
+
await rename(tempPath, finalPath);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
catch (err) {
|
|
385
|
+
const code = err.code;
|
|
386
|
+
if ((code !== 'EPERM' && code !== 'EBUSY') || attempt === 2)
|
|
387
|
+
throw err;
|
|
388
|
+
await new Promise(resolve => { setTimeout(resolve, 10 * (attempt + 1)); });
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch (err) {
|
|
393
|
+
await unlink(tempPath).catch(() => undefined);
|
|
394
|
+
throw err;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
export async function persistHermesSessionLedger(ledger) {
|
|
398
|
+
const dir = getCodeburnCacheDir();
|
|
399
|
+
const finalPath = join(dir, HERMES_SESSION_LEDGER_FILENAME);
|
|
400
|
+
try {
|
|
401
|
+
await mkdir(dir, { recursive: true });
|
|
402
|
+
await writeFileAtomic(finalPath, JSON.stringify(ledger));
|
|
403
|
+
}
|
|
404
|
+
catch (err) {
|
|
405
|
+
throw new HermesLedgerPublicationError(`failed to publish Hermes session ledger at ${finalPath}`, { cause: err });
|
|
406
|
+
}
|
|
407
|
+
memory = ledger;
|
|
408
|
+
memoryDir = dir;
|
|
409
|
+
}
|
|
410
|
+
// The rebuild reprices a v3 cursor in place: every observation keeps its index
|
|
411
|
+
// and day and is scaled by the snapshot's cost over the stored one. Growth since
|
|
412
|
+
// the v3 write is then left to applyHermesSnapshot as a new observation. A
|
|
413
|
+
// snapshot smaller than the observations it would reprice cannot price them, so
|
|
414
|
+
// the flag stays for a later snapshot that can.
|
|
415
|
+
function repriceRebuild(cursor, snapshot) {
|
|
416
|
+
const held = cursor.observations.reduce((sum, o) => ({
|
|
417
|
+
inputTokens: sum.inputTokens + o.inputTokens,
|
|
418
|
+
outputTokens: sum.outputTokens + o.outputTokens,
|
|
419
|
+
cacheReadTokens: sum.cacheReadTokens + o.cacheReadTokens,
|
|
420
|
+
cacheWriteTokens: sum.cacheWriteTokens + o.cacheWriteTokens,
|
|
421
|
+
reasoningTokens: sum.reasoningTokens + o.reasoningTokens,
|
|
422
|
+
}), zeroHermesTokens());
|
|
423
|
+
if (!tokensGte(snapshot.tokens, held))
|
|
424
|
+
return cursor;
|
|
425
|
+
const { rebuild: _rebuild, ...rest } = cursor;
|
|
426
|
+
const heldCost = cursor.observations.reduce((sum, o) => sum + o.costUSD, 0);
|
|
427
|
+
// ponytail: when the session grew, the share of the snapshot cost already
|
|
428
|
+
// held is estimated by token count (reasoning sits inside output). Exact when
|
|
429
|
+
// nothing grew; the snapshot carries no rates to split it any better.
|
|
430
|
+
const weight = (t) => t.inputTokens + t.outputTokens + t.cacheReadTokens + t.cacheWriteTokens;
|
|
431
|
+
const share = weight(snapshot.tokens) > 0 ? weight(held) / weight(snapshot.tokens) : 1;
|
|
432
|
+
const costUSD = snapshot.costUSD * share;
|
|
433
|
+
// Beside observations stored at $0 (no price to scale), the priced ones are
|
|
434
|
+
// scaled but never up, since the v4 rule only removes reasoning priced twice,
|
|
435
|
+
// and what the recomputed cost leaves over goes to the $0 ones by token share.
|
|
436
|
+
const unpricedWeight = cursor.observations.filter(o => o.costUSD <= 0).reduce((sum, o) => sum + weight(o), 0);
|
|
437
|
+
const factor = heldCost <= 0 ? 0 : unpricedWeight > 0 ? Math.min(1, costUSD / heldCost) : costUSD / heldCost;
|
|
438
|
+
const remainder = Math.max(0, costUSD - heldCost * factor);
|
|
439
|
+
const repriced = (o) => o.costUSD > 0
|
|
440
|
+
? o.costUSD * factor
|
|
441
|
+
: unpricedWeight > 0 ? remainder * weight(o) / unpricedWeight : 0;
|
|
442
|
+
return {
|
|
443
|
+
...rest,
|
|
444
|
+
lastSeen: { ...held, costUSD, costBasis: snapshot.costBasis },
|
|
445
|
+
observations: cursor.observations.map(o => ({ ...o, costUSD: repriced(o) })),
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
export async function recordHermesSnapshot(snapshot) {
|
|
449
|
+
const ledger = loadHermesSessionLedger();
|
|
450
|
+
const stored = getHermesCursor(ledger, snapshot.profile, snapshot.sessionId);
|
|
451
|
+
// An all-zero snapshot is a reset or a vanished row, not a source to rebuild from.
|
|
452
|
+
const existing = stored?.rebuild && hasPositiveTokenDelta(snapshot.tokens) ? repriceRebuild(stored, snapshot) : stored;
|
|
453
|
+
const { cursor, dirty } = applyHermesSnapshot(existing, snapshot);
|
|
454
|
+
if (dirty || existing !== stored)
|
|
455
|
+
await persistHermesSessionLedger(putCursor(ledger, cursor));
|
|
456
|
+
return cursor;
|
|
457
|
+
}
|
|
458
|
+
function cachedCallToSnapshotTokens(call) {
|
|
459
|
+
return {
|
|
460
|
+
inputTokens: call.usage.inputTokens,
|
|
461
|
+
outputTokens: call.usage.outputTokens,
|
|
462
|
+
cacheReadTokens: call.usage.cacheReadInputTokens,
|
|
463
|
+
cacheWriteTokens: call.usage.cacheCreationInputTokens,
|
|
464
|
+
reasoningTokens: call.usage.reasoningTokens,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
export async function seedHermesCursorsFromProviderSection(section) {
|
|
468
|
+
// Seeds missing cursors from the already-loaded warm cache so the next
|
|
469
|
+
// observation is a delta against last-seen lifetime, not a dump of the
|
|
470
|
+
// whole session at `now`. Does not re-read sealed days: historically
|
|
471
|
+
// dropped growth stays dropped (see file-level contract).
|
|
472
|
+
const ledger = loadHermesSessionLedger();
|
|
473
|
+
let next = ledger;
|
|
474
|
+
let dirty = false;
|
|
475
|
+
for (const file of Object.values(section.files)) {
|
|
476
|
+
for (const turn of file.turns) {
|
|
477
|
+
for (const call of turn.calls) {
|
|
478
|
+
if (call.provider !== 'hermes')
|
|
479
|
+
continue;
|
|
480
|
+
const parsed = parseHermesDedupKey(call.deduplicationKey);
|
|
481
|
+
if (!parsed || parsed.observationIndex != null)
|
|
482
|
+
continue;
|
|
483
|
+
if (getHermesCursor(next, parsed.profile, parsed.sessionId))
|
|
484
|
+
continue;
|
|
485
|
+
const tokens = cachedCallToSnapshotTokens(call);
|
|
486
|
+
const costUSD = call.costUSD ?? 0;
|
|
487
|
+
const costBasis = call.billing === 'subscription'
|
|
488
|
+
? 'included'
|
|
489
|
+
: call.billing === 'metered'
|
|
490
|
+
? 'actual'
|
|
491
|
+
: call.isEstimated ? 'calculated' : 'actual';
|
|
492
|
+
const cursor = {
|
|
493
|
+
profile: parsed.profile,
|
|
494
|
+
sessionId: parsed.sessionId,
|
|
495
|
+
lastSeen: { ...tokens, costUSD, costBasis },
|
|
496
|
+
observations: [{
|
|
497
|
+
index: 0,
|
|
498
|
+
timestamp: call.timestamp,
|
|
499
|
+
...tokens,
|
|
500
|
+
costUSD,
|
|
501
|
+
costBasis,
|
|
502
|
+
supplementaryAccounting: false,
|
|
503
|
+
}],
|
|
504
|
+
};
|
|
505
|
+
next = putCursor(next, cursor);
|
|
506
|
+
dirty = true;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if (dirty)
|
|
511
|
+
await persistHermesSessionLedger(next);
|
|
512
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// @ts-nocheck: codeburn type-checks this under its own tsconfig; Chompyy adds noUncheckedIndexedAccess (see UPSTREAM.md)
|
|
2
|
+
import { existsSync, readdirSync, realpathSync } from 'fs';
|
|
3
|
+
import { homedir } from 'os';
|
|
4
|
+
import { join, resolve, sep } from 'path';
|
|
5
|
+
import { readTextHeadSync } from './fs-utils.js';
|
|
6
|
+
function resolveHome(dir) {
|
|
7
|
+
try {
|
|
8
|
+
return realpathSync(dir);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return resolve(dir);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** True when two Codex homes are the same physical tree. */
|
|
15
|
+
export function sameCodexHome(a, b) {
|
|
16
|
+
return resolveHome(a) === resolveHome(b);
|
|
17
|
+
}
|
|
18
|
+
/** True when `dir` is a Codex home nested under a launcher nest, and a distinct
|
|
19
|
+
* primary Codex home exists. Gate for overlap-only filtering — it does not by
|
|
20
|
+
* itself drop sessions. The production no-arg factory uses this to walk both
|
|
21
|
+
* trees; an explicit nest factory uses it to drop overlapping nest ids. */
|
|
22
|
+
export function isNestedLauncherCodexHome(dir, opts) {
|
|
23
|
+
const resolved = resolveHome(dir);
|
|
24
|
+
const primary = resolveHome(opts.primaryDir);
|
|
25
|
+
if (resolved === primary)
|
|
26
|
+
return false;
|
|
27
|
+
const underLauncher = opts.launcherRoots.some(root => {
|
|
28
|
+
const r = resolveHome(root);
|
|
29
|
+
return resolved === r || resolved.startsWith(r + sep);
|
|
30
|
+
});
|
|
31
|
+
if (!underLauncher)
|
|
32
|
+
return false;
|
|
33
|
+
return existsSync(primary);
|
|
34
|
+
}
|
|
35
|
+
// Same bound as `readFirstLine` in providers/codex.ts. Real Codex
|
|
36
|
+
// session_meta first lines are ~22–27 KB; 8 KiB truncates them mid-JSON.
|
|
37
|
+
export const FIRST_LINE_READ_CAP = 1024 * 1024;
|
|
38
|
+
/** Session id from the first `session_meta` line of a Codex rollout file.
|
|
39
|
+
* Missing / unreadable files return undefined — callers must not drop those. */
|
|
40
|
+
export function rolloutFileSessionId(filePath) {
|
|
41
|
+
try {
|
|
42
|
+
const slice = readTextHeadSync(filePath, FIRST_LINE_READ_CAP);
|
|
43
|
+
if (slice.length === 0)
|
|
44
|
+
return undefined;
|
|
45
|
+
const nl = slice.indexOf(0x0a);
|
|
46
|
+
// Hit the 1 MiB cap without a newline: incomplete, not a parseable id.
|
|
47
|
+
if (nl === -1 && slice.length === FIRST_LINE_READ_CAP)
|
|
48
|
+
return undefined;
|
|
49
|
+
const line = (nl === -1 ? slice : slice.subarray(0, nl)).toString('utf8');
|
|
50
|
+
if (!line)
|
|
51
|
+
return undefined;
|
|
52
|
+
const parsed = JSON.parse(line);
|
|
53
|
+
if (!parsed || typeof parsed !== 'object')
|
|
54
|
+
return undefined;
|
|
55
|
+
const payload = parsed.payload;
|
|
56
|
+
const id = payload?.session_id;
|
|
57
|
+
return typeof id === 'string' && id.length > 0 ? id : undefined;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** `rollout-*.jsonl`, or the `.jsonl.zst` form Codex compresses cold rollouts into. */
|
|
64
|
+
export function isRolloutFileName(name) {
|
|
65
|
+
return name.startsWith('rollout-') && (name.endsWith('.jsonl') || name.endsWith('.jsonl.zst'));
|
|
66
|
+
}
|
|
67
|
+
/** Rollout filename without `.jsonl` / `.jsonl.zst`. */
|
|
68
|
+
export function rolloutStem(name) {
|
|
69
|
+
return name.replace(/\.jsonl(\.zst)?$/, '');
|
|
70
|
+
}
|
|
71
|
+
export function walkRolloutFiles(codexDir, visit) {
|
|
72
|
+
const take = (dir, file) => {
|
|
73
|
+
if (isRolloutFileName(file))
|
|
74
|
+
visit(join(dir, file));
|
|
75
|
+
};
|
|
76
|
+
const sessionsDir = join(codexDir, 'sessions');
|
|
77
|
+
try {
|
|
78
|
+
for (const year of readdirSync(sessionsDir)) {
|
|
79
|
+
if (!/^\d{4}$/.test(year))
|
|
80
|
+
continue;
|
|
81
|
+
const yearDir = join(sessionsDir, year);
|
|
82
|
+
for (const month of readdirSync(yearDir)) {
|
|
83
|
+
if (!/^\d{2}$/.test(month))
|
|
84
|
+
continue;
|
|
85
|
+
const monthDir = join(yearDir, month);
|
|
86
|
+
for (const day of readdirSync(monthDir)) {
|
|
87
|
+
if (!/^\d{2}$/.test(day))
|
|
88
|
+
continue;
|
|
89
|
+
const dayDir = join(monthDir, day);
|
|
90
|
+
for (const file of readdirSync(dayDir))
|
|
91
|
+
take(dayDir, file);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// missing tree
|
|
98
|
+
}
|
|
99
|
+
const archivedDir = join(codexDir, 'archived_sessions');
|
|
100
|
+
try {
|
|
101
|
+
for (const file of readdirSync(archivedDir))
|
|
102
|
+
take(archivedDir, file);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// missing archive
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Session ids under a Codex home (sessions/YYYY/MM/DD + archived).
|
|
109
|
+
* Identity is the rollout's `payload.session_id`, not the filename: Codex
|
|
110
|
+
* names embed a timestamp+uuid so basename collisions are rare, but a
|
|
111
|
+
* dollar-protecting dedup cannot treat 'unlikely' as identity. */
|
|
112
|
+
export function listRolloutSessionIds(codexDir) {
|
|
113
|
+
const ids = new Set();
|
|
114
|
+
walkRolloutFiles(codexDir, filePath => {
|
|
115
|
+
const id = rolloutFileSessionId(filePath);
|
|
116
|
+
if (id)
|
|
117
|
+
ids.add(id);
|
|
118
|
+
});
|
|
119
|
+
return ids;
|
|
120
|
+
}
|
|
121
|
+
export function defaultBilledCodexHome() {
|
|
122
|
+
return join(homedir(), '.codex');
|
|
123
|
+
}
|
|
124
|
+
export function defaultLauncherRoots() {
|
|
125
|
+
return [join(homedir(), '.buzz')];
|
|
126
|
+
}
|
|
127
|
+
/** Surfaces that drive another billed store. Not providers. No session count.
|
|
128
|
+
* Presence of `~/.buzz` is the heuristic — we do not inspect a nested Codex
|
|
129
|
+
* tree here (that store is billed via the Codex provider). */
|
|
130
|
+
export function collectLauncherNotes(home = homedir()) {
|
|
131
|
+
const notes = [];
|
|
132
|
+
const buzz = join(home, '.buzz');
|
|
133
|
+
if (existsSync(buzz)) {
|
|
134
|
+
notes.push({
|
|
135
|
+
name: 'buzz',
|
|
136
|
+
path: buzz,
|
|
137
|
+
billedVia: 'codex',
|
|
138
|
+
verdict: 'LAUNCHER (heuristic; billed via Codex)',
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return notes;
|
|
142
|
+
}
|