feat(billing): bill Cursor executor usage via stream-json token parsing
Memind CI / Test, build, and release guards (push) Failing after 14m36s

Parse Cursor CLI usage from stream-json output and charge through billSessionUsage so subscription quota is consumed first and wallet overage applies when needed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-27 10:16:38 +08:00
parent 884e819f70
commit f95d766f69
9 changed files with 344 additions and 8 deletions
+5 -4
View File
@@ -15,13 +15,14 @@ test('buildCodeRunCompletionReply never exposes cursor brand to users', () => {
assert.doesNotMatch(reply, /cursor/i);
});
test('buildCodeRunCompletionReply sanitizes cursor wording in stdout', () => {
test('buildCodeRunCompletionReply prefers displayStdout over raw stream-json stdout', () => {
const reply = buildCodeRunCompletionReply({
executor: 'cursor',
stdout: 'cursor agent finished editing public/page.html',
stdout: '{"type":"result","result":"hidden"}\n',
displayStdout: '已写入 public/spring-poem.html',
});
assert.match(reply, /TKMind 智趣 finished editing public\/page\.html/);
assert.doesNotMatch(reply, /\bcursor\b/i);
assert.match(reply, /已写入 public\/spring-poem\.html/);
assert.doesNotMatch(reply, /"type":"result"/);
});
test('sanitizeUserFacingBrandText replaces cursor wording', () => {