@tempoxyz/patron 0.0.16 → 0.0.18

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 CHANGED
@@ -7,9 +7,10 @@ npx @tempoxyz/patron
7
7
  ```
8
8
 
9
9
  First run signs you in with Tempo Wallet, asks for a monthly budget (default $5), buys
10
- seals and adds a hook to Claude Code. After that, every page Claude Code fetches pays its
11
- site one seal. Nothing stays running: the hook runs once per read and exits, and when
12
- seals run low it starts a one-shot purchase that exits when done.
10
+ seals and adds a hook to every supported agent it finds. After that, every page an agent
11
+ reads pays its site one seal. Nothing stays running: the hook hands each read to a one-shot
12
+ background payment and exits at once, so the agent never waits, and when seals run low it
13
+ starts a one-shot purchase that exits when done.
13
14
 
14
15
  Run `npx @tempoxyz/patron` again for status (seals left, pages paid, budget used, rank) and to pause,
15
16
  change the budget or uninstall.
@@ -24,9 +25,23 @@ change the budget or uninstall.
24
25
  | `patron budget <usd>` | Change the monthly budget |
25
26
  | `patron tip <url> [usd]` | Tip a site, $0.10 by default |
26
27
  | `patron name <handle>` | Set your public leaderboard name |
28
+ | `patron per-page <usd>` | What each site gets per page read, $0.001 to $0.01 |
27
29
  | `patron uninstall` | Remove agent hooks, optionally local data |
28
30
  | `patron hook` | Run by agents after each web read |
29
31
 
32
+ ## What gets paid
33
+
34
+ - A fetched page pays its site only when it loads (a 2xx status). Error pages, blocks and
35
+ redirect notices pay nothing.
36
+ - A search pays each site in its results, up to 10 sites per search.
37
+ - Each site's seals are redeemed at once, in separate relayed requests, never batched: the
38
+ gateway cannot tell which sites one reader read together.
39
+ - Sites are paid per registrable domain: `docs.python.org` pays `python.org`. Authors on shared
40
+ hosts are paid as their own site: `alice.github.io`, `app.vercel.app`, `alice.substack.com`.
41
+ X profiles and posts pay the profile.
42
+ - Never paid: mail, chat and private documents (Gmail, Google Docs, Slack, WhatsApp), sign-in
43
+ pages, banking, health portals, link shorteners (`t.co`, `bit.ly`), localhost and IPs.
44
+
30
45
  ## Privacy
31
46
 
32
47
  Seals are Privacy Pass blind tokens (RFC 9578). The gateway knows your address bought a
@@ -48,9 +63,9 @@ limit equal to the budget, renewed every 30 days.
48
63
  | Agent | Hook |
49
64
  | :- | :- |
50
65
  | Claude Code | Async `PostToolUse` hook for WebFetch and WebSearch in `~/.claude/settings.json` |
51
-
52
- Codex runs web search as a hosted tool that hooks do not see, and Cursor and Amp have no
53
- documented hook for web reads, so they are not supported yet.
66
+ | Cursor | `postToolUse` hook for WebFetch and WebSearch in `~/.cursor/hooks.json` |
67
+ | Codex | `notify` and a `Stop` hook; pays the sites in the session rollout at the end of each turn |
68
+ | Amp | Plugin in `~/.config/amp/plugins/patron.ts` for `read_web_page` and `web_search` |
54
69
 
55
70
  ## Environment
56
71
 
package/dist/bin.js CHANGED
@@ -4,10 +4,14 @@ const require = __patronCreateRequire(import.meta.url)
4
4
 
5
5
  // src/bin.ts
6
6
  if (process.argv[2] === "hook") {
7
- const { runHookProcess } = await import("./chunks/hook-process-GKUDU2B3.js");
7
+ const { runHookProcess } = await import("./chunks/hook-process-YHSATQFR.js");
8
8
  await runHookProcess().catch(() => void 0);
9
9
  process.exit(0);
10
+ } else if (process.argv[2] === "pay") {
11
+ const { runPayProcess } = await import("./chunks/hook-process-YHSATQFR.js");
12
+ await runPayProcess().catch(() => void 0);
13
+ process.exit(0);
10
14
  } else {
11
- const { run } = await import("./chunks/-UIKBA3CN.js");
15
+ const { run } = await import("./chunks/-643GYNS6.js");
12
16
  process.exitCode = await run(process.argv.slice(2));
13
17
  }
@@ -1,46 +1,50 @@
1
1
  import { createRequire as __patronCreateRequire } from 'node:module'
2
2
  const require = __patronCreateRequire(import.meta.url)
3
3
  import {
4
- DEFAULT_MONTHLY_BUDGET_USD,
5
4
  FileTokenStore,
6
5
  LeaderboardResponse,
7
- MAX_TOKENS_PER_PAGE,
8
- MIN_TOKENS_PER_PAGE,
9
- PACK_SIZE,
10
6
  PatronInfo,
11
7
  STARTER_TOKENS,
12
- TOKEN_PRICE_UNITS,
13
8
  budgetTokens,
14
9
  buyTokens,
15
- clampTokensPerPage,
16
10
  codexHome,
17
11
  codexPaths,
18
- formatUsd,
19
12
  hasPatronHandler,
20
13
  installCodex,
21
14
  isObject,
22
15
  isPatronHandler,
23
16
  loadIssuer,
24
17
  needsRefill,
25
- normalizePayee,
26
18
  parseUsd,
27
19
  profileMessage,
28
20
  purchasableTokens,
29
21
  readJsonObject,
30
22
  redeem,
31
23
  removeCodex,
32
- resolveSettings,
33
- settingsFor,
34
- startRefill,
35
24
  tipTokens,
36
- tokensToUnits,
37
25
  upgradeCodex,
38
26
  withHooksKey,
39
27
  withPatronGroup,
40
28
  withPatronStatus,
41
29
  withoutPatronHandlers,
42
30
  writeJsonObject
43
- } from "./chunk-4Z6ZIXMK.js";
31
+ } from "./chunk-XJOIDBXC.js";
32
+ import {
33
+ startRefill
34
+ } from "./chunk-CV2WYKM7.js";
35
+ import {
36
+ DEFAULT_MONTHLY_BUDGET_USD,
37
+ MAX_TOKENS_PER_PAGE,
38
+ MIN_TOKENS_PER_PAGE,
39
+ PACK_SIZE,
40
+ TOKEN_PRICE_UNITS,
41
+ clampTokensPerPage,
42
+ formatUsd,
43
+ normalizePayee,
44
+ resolveSettings,
45
+ settingsFor,
46
+ tokensToUnits
47
+ } from "./chunk-CF4LJZLC.js";
44
48
  import {
45
49
  AGENT_IDS,
46
50
  ensureHome,
@@ -53,7 +57,8 @@ import {
53
57
  withLock,
54
58
  writeConfig,
55
59
  writePrivateFile
56
- } from "./chunk-FXE4CGY7.js";
60
+ } from "./chunk-RDEPJ6XD.js";
61
+ import "./chunk-GTMLTZRN.js";
57
62
 
58
63
  // src/index.ts
59
64
  import { readFileSync } from "node:fs";
@@ -614,7 +619,7 @@ ${styleText(title, "bold", color)}
614
619
  // src/purchase.ts
615
620
  var REFILL_LOCK_STALE_MS = 5 * 60 * 1e3;
616
621
  var defaultOpenWallet = async (settings, config, issuer, maxUnits) => {
617
- const { openWallet } = await import("./wallet-JDUPZN7E.js");
622
+ const { openWallet } = await import("./wallet-WNPT6R4M.js");
618
623
  return openWallet(settings, config.wallet, issuer, maxUnits);
619
624
  };
620
625
  async function buyWithinBudget(settings, config, wanted, openWallet = defaultOpenWallet) {
@@ -885,7 +890,7 @@ async function setup(deps) {
885
890
  deps,
886
891
  settings.privateKey ? "Using PATRON_PRIVATE_KEY" : "Signing in with Tempo Wallet"
887
892
  );
888
- const { signIn } = await import("./wallet-JDUPZN7E.js");
893
+ const { signIn } = await import("./wallet-WNPT6R4M.js");
889
894
  const account = await signIn(settings, { budgetUnits, issuer, output: deps.stdout });
890
895
  done(deps, `Signed in as ${account.address}`);
891
896
  const config = {
@@ -999,7 +1004,7 @@ async function changeBudget(deps, input) {
999
1004
  } else budget = await askBudget(deps, config.monthlyBudgetUsd);
1000
1005
  if (config.wallet === "tempo" && budget > config.monthlyBudgetUsd) {
1001
1006
  step(deps, "Approve the new spending limit in Tempo Wallet");
1002
- const { authorizeBudget } = await import("./wallet-JDUPZN7E.js");
1007
+ const { authorizeBudget } = await import("./wallet-WNPT6R4M.js");
1003
1008
  const issuer = await loadIssuer(settings.home, settings.gatewayUrl, {
1004
1009
  fetch: deps.fetch
1005
1010
  });
@@ -1111,7 +1116,7 @@ async function setName(deps, name) {
1111
1116
  const issuer = await loadIssuer(settings.home, settings.gatewayUrl, {
1112
1117
  fetch: deps.fetch
1113
1118
  });
1114
- const open = deps.openWallet ?? (async (s, c, i, max) => (await import("./wallet-JDUPZN7E.js")).openWallet(s, c.wallet, i, max));
1119
+ const open = deps.openWallet ?? (async (s, c, i, max) => (await import("./wallet-WNPT6R4M.js")).openWallet(s, c.wallet, i, max));
1115
1120
  const wallet = await open(settings, config, issuer, 0n);
1116
1121
  await setProfile(settings.gatewayUrl, wallet, name, deps.fetch);
1117
1122
  await writeConfig(settings.home, { ...config, name });