Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2f90047
Accept MPP method tempo (push mode) when MPP_TEMPO_RECIPIENT is set
claude Oct 4, 2026
6ada795
Clearer /api/explain description for agents
claude Oct 5, 2026
e2c21e4
Merge remote branch (already merged history)
claude Oct 5, 2026
57e398c
Add glama.json to claim the Glama listing
claude Oct 5, 2026
88577ee
Merge remote branch (already merged history)
claude Oct 5, 2026
2eeeeec
MCP registry: clearer description (says when an agent would use it)
claude Oct 5, 2026
ce242d7
Merge remote branch (already merged history)
claude Oct 5, 2026
71f6a3e
Homepage: a row of prices right under the intro
claude Oct 6, 2026
fd7ae48
Merge remote branch (already merged history)
claude Oct 6, 2026
193799b
Usage log: record the network a refused payment was tried on
claude Oct 6, 2026
2d888e4
Merge branch 'claude/x402-agents-solana-payments-nceg9b' of https://g…
claude Oct 6, 2026
322505c
Pay in RLUSD on the XRP Ledger (x402 exact, xrpl:0)
claude Oct 7, 2026
aa35a9d
Merge branch 'claude/x402-agents-solana-payments-nceg9b' of https://g…
claude Oct 7, 2026
633f050
XRPL: also accept payers built on t54's SDK
claude Oct 7, 2026
3033055
Merge remote-tracking branch 'origin/main' into claude/x402-agents-so…
claude Oct 7, 2026
fdab3b3
SEO: canonical tag, robots.txt and sitemap.xml for the homepage
claude Oct 7, 2026
0027283
Merge branch 'claude/x402-agents-solana-payments-nceg9b' of https://g…
claude Oct 7, 2026
823b132
CI: run the tests on every pull request and on main
claude Oct 7, 2026
60e2caa
Merge branch 'claude/x402-agents-solana-payments-nceg9b' of https://g…
claude Oct 7, 2026
d81e01e
Usage log: record why an MPP credential was refused
claude Oct 7, 2026
7a491d3
Merge branch 'claude/x402-agents-solana-payments-nceg9b' of https://g…
claude Oct 7, 2026
84c2f4e
Pay in USDC on Algorand (ALGORAND_PAY_TO)
claude Oct 8, 2026
a6cec2a
Merge remote branch
claude Oct 8, 2026
aa499c8
Name the seller in the 402: x402-merchant extension
claude Oct 9, 2026
7ec7ce1
Merge remote branch (already in main)
claude Oct 9, 2026
9c7b5d0
MCP: output schemas and structured content on every tool
claude Oct 9, 2026
3fdf50f
Merge remote branch (already in main)
claude Oct 9, 2026
80dd8e2
Merge stale remote branch claude/x402-agents-solana-payments-nceg9b
claude Oct 13, 2026
725218e
Discovery: a name and description per resource in /.well-known/x402
claude Oct 13, 2026
97ffd96
Merge stale remote branch claude/x402-agents-solana-payments-nceg9b
claude Oct 13, 2026
775fa73
Security headers on every answer
claude Oct 13, 2026
f2ea313
Merge stale remote branch claude/x402-agents-solana-payments-nceg9b
claude Oct 13, 2026
3ff3a26
Weekly dependency audit with one issue while a finding is open
claude Oct 13, 2026
5aba932
Merge stale remote branch claude/x402-agents-solana-payments-nceg9b
claude Oct 13, 2026
95976ef
Usage log: say why an x402 payment was refused
claude Oct 13, 2026
915ba79
Merge stale remote branch claude/x402-agents-solana-payments-nceg9b
claude Oct 14, 2026
aa20d90
Usage log: write in batches (at most every 10 minutes) and read the d…
claude Oct 14, 2026
1f46f12
Merge stale remote branch claude/x402-agents-solana-payments-nceg9b
claude Oct 14, 2026
9c636a9
Usage log: the next write to the same day file skips the read
claude Oct 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/usage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,32 @@ test('usage log: writes are batched (one read and one write for several calls),
assert.equal(file.slice(old.length).trim().split('\n').length, 2);
assert.deepEqual(calls, [`GET /repos/Fizzl13/usage-log/contents/${path}`, `PUT /repos/Fizzl13/usage-log/contents/${path}`]);
});

test('usage log: the next write to the same day file skips the read; a file changed elsewhere is read again', async () => {
const crypto = require('node:crypto');
const { createUsageLog } = require('../usage-log');
const shaOf = (text) => { const b = Buffer.from(text); return crypto.createHash('sha1').update(`blob ${b.length}\0`).update(b).digest('hex'); };
let file = null;
const calls = [];
// Like GitHub: a write must name the sha of the file it replaces.
const fetchFn = async (url, opts = {}) => {
const method = opts.method || 'GET';
calls.push(method);
if (method === 'GET') return file === null ? new Response('{}', { status: 404 }) : new Response(file);
const body = JSON.parse(opts.body);
if (file !== null && body.sha !== shaOf(file)) return new Response('{}', { status: 409 });
file = Buffer.from(body.content, 'base64').toString('utf8');
return Response.json({}, { status: 201 });
};
const log = createUsageLog({ service: 'plaintext', env: { USAGE_LOG_TOKEN: 't' }, fetchFn, now: () => new Date('2026-10-14T10:00:00Z'), log: { warn() {}, error() {} } });
log.record({ route: 'check-wallet', status: 402 });
await log.flush();
log.record({ route: 'explain', status: 200 });
await log.flush();
assert.deepEqual(calls, ['GET', 'PUT', 'PUT'], 'one read, then writes only');
file += '{"t":"2026-10-14T10:00:01.000Z","service":"plaintext","route":"other"}\n'; // another writer appended
log.record({ route: 'explain', status: 402 });
await log.flush();
assert.deepEqual(calls.slice(3), ['PUT', 'GET', 'PUT']);
assert.deepEqual(file.trim().split('\n').map((l) => JSON.parse(l).route), ['check-wallet', 'explain', 'other', 'explain'], 'no line lost');
});
36 changes: 25 additions & 11 deletions usage-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,29 +170,43 @@ function createUsageLog({ service, env = process.env, fetchFn = globalThis.fetch
'user-agent': `usage-log/${service}`,
};

// The day file as this service last wrote it. Only this service writes its own files, so the next append to
// the same file skips the read (half the bandwidth of a write); if the file did change (a deploy's old and new
// instance both writing), GitHub refuses the stale sha with a 409 and the file is read again.
let last = null; // { path, sha, text }

// Appends lines to one file: read (for the sha), write, retry on a race.
async function append(path, lines) {
for (let attempt = 0; attempt < 4; attempt++) {
const url = `${API}/repos/${repo}/contents/${path}`;
// The raw file: the JSON form leaves out the content of files over 1 MB, which would then be overwritten
// with only the new lines. The sha GitHub wants back is the git blob sha of exactly these bytes.
const current = await fetchFn(url, { headers: { ...headers, accept: 'application/vnd.github.raw+json' } });
let sha;
let text = '';
if (current.status === 200) {
const raw = Buffer.from(await current.arrayBuffer());
sha = blobSha(raw);
text = raw.toString('utf8');
} else if (current.status !== 404) {
throw new Error(`read ${path}: HTTP ${current.status}`);
if (attempt === 0 && last && last.path === path) {
({ sha, text } = last);
} else {
// The raw file: the JSON form leaves out the content of files over 1 MB, which would then be overwritten
// with only the new lines. The sha GitHub wants back is the git blob sha of exactly these bytes.
const current = await fetchFn(url, { headers: { ...headers, accept: 'application/vnd.github.raw+json' } });
if (current.status === 200) {
const raw = Buffer.from(await current.arrayBuffer());
sha = blobSha(raw);
text = raw.toString('utf8');
} else if (current.status !== 404) {
throw new Error(`read ${path}: HTTP ${current.status}`);
}
}
const content = Buffer.from(text + lines.join('\n') + '\n');
const body = {
message: `${service}: ${lines.length} call${lines.length === 1 ? '' : 's'}`,
content: Buffer.from(text + lines.join('\n') + '\n').toString('base64'),
content: content.toString('base64'),
...(sha ? { sha } : {}),
};
const put = await fetchFn(url, { method: 'PUT', headers: { ...headers, 'content-type': 'application/json' }, body: JSON.stringify(body) });
if (put.status === 200 || put.status === 201) return;
if (put.status === 200 || put.status === 201) {
last = { path, sha: blobSha(content), text: content.toString('utf8') };
return;
}
last = null;
if (put.status !== 409 && put.status !== 422) throw new Error(`write ${path}: HTTP ${put.status}`);
await new Promise((r) => setTimeout(r, 250 * (attempt + 1)));
}
Expand Down
Loading