thumbgate 1.40.10 → 1.40.13

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.
Files changed (53) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.well-known/mcp/server-card.json +1 -1
  3. package/README.md +46 -40
  4. package/adapters/claude/.mcp.json +3 -3
  5. package/adapters/forge/forge.yaml +3 -3
  6. package/adapters/future-agi/.mcp.json +1 -1
  7. package/adapters/future-agi/config.toml +1 -1
  8. package/adapters/future-agi/opencode.json +1 -1
  9. package/adapters/herdr/herdr-plugin.toml +2 -2
  10. package/adapters/mcp/server-stdio.js +1 -1
  11. package/adapters/opencode/opencode.json +1 -1
  12. package/bin/cli.js +9 -8
  13. package/bin/postinstall.js +2 -2
  14. package/config/unit-costs.json +47 -0
  15. package/package.json +16 -5
  16. package/public/admin.html +284 -29
  17. package/public/agent-manager.html +2 -2
  18. package/public/agents-cost-savings.html +1 -1
  19. package/public/codex-enterprise.html +2 -2
  20. package/public/compare.html +3 -3
  21. package/public/dashboard.html +28 -9
  22. package/public/diagnostic.html +1 -1
  23. package/public/founders.html +1 -1
  24. package/public/guide.html +4 -4
  25. package/public/index.html +80 -116
  26. package/public/install.html +19 -19
  27. package/public/js/connect-panel.js +21 -7
  28. package/public/learn.html +8 -0
  29. package/public/lessons.html +1 -1
  30. package/public/numbers.html +2 -2
  31. package/public/pricing.html +12 -9
  32. package/public/pro.html +96 -137
  33. package/public/project-switcher.js +50 -19
  34. package/scripts/auto-wire-hooks.js +36 -2
  35. package/scripts/billing.js +3 -1
  36. package/scripts/cli-schema.js +2 -3
  37. package/scripts/commercial-offer.js +1 -1
  38. package/scripts/cost-meter.js +161 -0
  39. package/scripts/gates-engine.js +26 -8
  40. package/scripts/hook-runtime.js +18 -1
  41. package/scripts/mailer/resend-mailer.js +2 -0
  42. package/scripts/owner-admin.js +338 -16
  43. package/scripts/owner-alerts.js +79 -0
  44. package/scripts/owner-telemetry.js +113 -3
  45. package/scripts/pr-manager.js +156 -41
  46. package/scripts/project-catalog.js +3 -1
  47. package/scripts/project-identity.js +10 -2
  48. package/scripts/seo-gsd.js +1 -1
  49. package/scripts/telemetry-analytics.js +7 -1
  50. package/scripts/unit-economics.js +138 -0
  51. package/server.json +2 -2
  52. package/src/api/server.js +62 -4
  53. package/src/mcp-writeguard.js +2 -2
package/public/admin.html CHANGED
@@ -161,6 +161,19 @@
161
161
  font-size: 12px;
162
162
  color: var(--muted);
163
163
  }
164
+ .delta {
165
+ font-size: 13px;
166
+ margin-top: 4px;
167
+ }
168
+ .delta.up {
169
+ color: #4ade80;
170
+ }
171
+ .delta.down {
172
+ color: #f87171;
173
+ }
174
+ .delta.flat {
175
+ color: var(--muted);
176
+ }
164
177
  .status {
165
178
  border-radius: 99px;
166
179
  padding: 3px 10px;
@@ -262,29 +275,23 @@
262
275
  <div id="content" aria-live="polite"></div>
263
276
  </main>
264
277
  <footer>
265
- Customer data stays in this private view. Payments are charge records.
266
- External booked revenue excludes identified internal and test purchases;
267
- unknown identities remain excluded. Deployment time is only shown when
268
- known.
278
+ Private and read-only. Owner and test purchases are left out of every
279
+ revenue number. JSON for agents: /v1/admin/summary, /v1/admin/economics and /v1/admin/alerts.
269
280
  </footer>
270
281
  <script nonce="__ADMIN_NONCE__">
271
282
  'use strict';
272
283
  const content = document.getElementById('content');
273
- const sections = [
274
- 'money',
275
- 'overview',
276
- 'stripe',
277
- 'data',
278
- 'analytics',
279
- 'observability',
280
- ];
284
+ // Today answers "does anything need me, and how did this week go". Overview repeated it, so it left the menu;
285
+ // its numbers stay in /v1/admin/summary for agents.
286
+ const sections = ['money', 'economics', 'analytics', 'observability', 'stripe', 'data'];
281
287
  const titles = {
282
- money: 'Money',
288
+ money: 'Today',
289
+ economics: 'Unit economics',
283
290
  overview: 'Overview',
284
291
  stripe: 'Stripe records',
285
292
  data: 'Hosted data',
286
- analytics: 'Analytics',
287
- observability: 'Observability',
293
+ analytics: 'Growth',
294
+ observability: 'Health',
288
295
  };
289
296
  let current = 'money';
290
297
  let resource = 'customers';
@@ -471,9 +478,9 @@
471
478
  : 'N/A, not reported',
472
479
  });
473
480
  return [
474
- row('Acquisition to activation', rates.acquisitionToActivation, stages.acquisition, 'no measured acquisition events'),
475
- row('Activation to paid', rates.activationToPaid, stages.activation, 'no measured activations'),
476
- row('Acquisition to paid', rates.acquisitionToPaid, stages.acquisition, 'no measured acquisition events'),
481
+ row('Acquisition event to first API-key use', rates.acquisitionToActivation, stages.acquisition, 'no measured acquisition events'),
482
+ row('First API-key use to paid', rates.activationToPaid, stages.activation, 'no recorded first API-key uses'),
483
+ row('Acquisition event to paid', rates.acquisitionToPaid, stages.acquisition, 'no measured acquisition events'),
477
484
  ];
478
485
  }
479
486
  function funnelTable(parent, funnel) {
@@ -483,7 +490,7 @@
483
490
  parent.append(
484
491
  element(
485
492
  'p',
486
- 'A lead is one distinct acquisition event identity (an acquisition, trace, visitor, session or install id) from a real checkout step; synthetic checkout sessions are excluded. ' +
493
+ 'An acquisition identity is one distinct event identity (an acquisition, trace, visitor, session or install id) from a recorded acquisition event; synthetic checkout sessions are excluded. ' +
487
494
  'An activation is the first call made with an API key. Free local use without a key is not measured, so a 0 here means none observed, not none happened.',
488
495
  'muted',
489
496
  ),
@@ -503,6 +510,7 @@
503
510
  paid: 'Paid checkouts (Stripe)',
504
511
  subscriptions: 'Active subscriptions (Stripe)',
505
512
  checkouts: 'Checkout sessions (Stripe)',
513
+ recurring: 'Renewals and cancellations (Stripe)',
506
514
  traffic: 'Site visits (telemetry)',
507
515
  leads: 'Signups and leads (ledgers)',
508
516
  };
@@ -537,7 +545,7 @@
537
545
  if (paying > 0) return 'Money is arriving: ' + paying + ' paying customers.';
538
546
  const parts = [];
539
547
  if (Number.isFinite(leads) && leads > 0 && stages.activation === 0)
540
- parts.push(leads + ' acquisition leads and 0 measured activations: no lead has made a first API-key call (free local use is not measured).');
548
+ parts.push(leads + ' distinct acquisition-event identities and 0 recorded first API-key uses. This does not establish unique people, installations or successful local use.');
541
549
  if (since && since.human === 0)
542
550
  parts.push('Since the bot check on ' + (panel.botCheckBeganLabel || 'its start date') + ', ' + since.started + ' checkout sessions started and 0 are classified as a browser (' + since.bot + ' bot-classified, ' + since.internal + ' owner or test).');
543
551
  else if (since && since.human > 0)
@@ -549,7 +557,7 @@
549
557
  if (m.value === null || m.value === undefined) return m.reason || 'Unavailable';
550
558
  if (typeof m.value === 'object') {
551
559
  const entries = Object.entries(m.value);
552
- return entries.length ? entries.map(([c, a]) => money(a, c)).join(', ') : 'None in this window';
560
+ return entries.length ? entries.map(([c, a]) => money(a, c)).join(', ') : m.status === 'partial' ? 'No amounts found in partial evidence' : 'None in this window';
553
561
  }
554
562
  return String(m.value);
555
563
  }
@@ -569,7 +577,7 @@
569
577
  const mine = activeLoad;
570
578
  const box = element('div');
571
579
  parent.append(box);
572
- box.append(element('p', 'Loading verified money and measured activation…', 'muted'));
580
+ box.append(element('p', 'Loading money and recorded first API-key use…', 'muted'));
573
581
  const read = (url) =>
574
582
  fetch(url, { credentials: 'same-origin', cache: 'no-store' }).then((r) => (r.ok ? r.json() : null)).catch(() => null);
575
583
  Promise.all([read('/v1/admin/summary'), read('/v1/admin/analytics')]).then(([summary, analytics]) => {
@@ -577,22 +585,23 @@
577
585
  box.replaceChildren();
578
586
  const fields = summary?.data?.fields;
579
587
  const funnel = analytics?.data?.funnel;
580
- box.append(element('h3', 'Verified external money'));
588
+ box.append(element('h3', 'External money and verification state'));
581
589
  if (fields)
582
590
  table(
583
591
  box,
584
592
  [['Metric', (r) => r.name], ['Value', (r) => r.value], ['State', (r) => r.state], ['Source observed', (r) => r.observed]],
585
- metricRows(fields, ['money.paying_customers', 'money.active_pro', 'money.revenue_30d', 'money.subscription_invoices_30d']),
593
+ metricRows(fields, ['money.paying_customers', 'money.active_pro', 'money.mrr', 'money.cancelling_at_period_end', 'money.revenue_30d', 'money.subscription_invoices_30d', 'usage.active_installs_7d', 'usage.active_installs_30d', 'usage.activated_installs_30d', 'usage.returning_installs_30d']),
586
594
  );
587
595
  else box.append(element('p', 'The money summary is unavailable right now. No zero is inferred.', 'notice'));
588
- box.append(element('h3', 'Measured activation'));
596
+ box.append(element('h3', 'Recorded first API-key use'));
597
+ box.append(element('p', 'Free local use never calls an API key, so this funnel cannot see it. CLI installs that captured feedback, in the table above, are the activation measure for the free product.', 'muted'));
589
598
  if (funnel) {
590
599
  cards(
591
600
  box,
592
601
  {
593
- 'Unique acquisition leads': funnel.uniqueAcquisitionLeads,
602
+ 'Distinct acquisition-event identities': funnel.uniqueAcquisitionLeads,
594
603
  'Acquisition events': funnel.stageCounts?.acquisition,
595
- 'Measured activations': funnel.stageCounts?.activation,
604
+ 'Recorded first API-key uses': funnel.stageCounts?.activation,
596
605
  'Paid customers': funnel.uniquePaidCustomers,
597
606
  'Excluded synthetic checkout sessions': funnel.excludedSyntheticCheckoutSessions,
598
607
  },
@@ -757,8 +766,238 @@
757
766
  'Data disk': r.disk.usedGb + ' GB of ' + r.disk.capacityGb + ' GB used (' + r.disk.percent + '%)',
758
767
  });
759
768
  }
769
+ // "+3 vs prior 7 days (12 → 15)": the change a reader would otherwise have to remember from last week.
770
+ function deltaWords(now, before) {
771
+ if (!Number.isFinite(now) || !Number.isFinite(before)) return { text: 'No earlier week to compare', tone: 'flat' };
772
+ const diff = now - before;
773
+ const pct = before > 0 ? ' (' + (diff >= 0 ? '+' : '') + Math.round((diff / before) * 100) + '%)' : '';
774
+ if (diff === 0) return { text: 'Same as the 7 days before', tone: 'flat' };
775
+ return { text: (diff > 0 ? '+' : '') + diff + pct + ' vs the 7 days before (' + before + ')', tone: diff > 0 ? 'up' : 'down' };
776
+ }
777
+ function weekCards(parent, weeks, extra = {}) {
778
+ const grid = element('div', undefined, 'cards');
779
+ const add = (name, value, delta) => {
780
+ const card = element('div', undefined, 'card');
781
+ card.append(element('div', value, 'value'), element('div', name, 'label'));
782
+ if (delta) card.append(element('div', delta.text, 'delta ' + delta.tone));
783
+ grid.append(card);
784
+ };
785
+ for (const [name, value] of Object.entries(extra)) add(name, value);
786
+ if (weeks) {
787
+ const rows = [
788
+ ['People on the site', 'realVisitors'],
789
+ ['Checkout starts', 'checkoutStarts'],
790
+ ['Active CLI installs', 'activeInstalls'],
791
+ ];
792
+ for (const [name, key] of rows) add(name + ', past 7 days', String(weeks.last7?.[key] ?? 'Unknown'), deltaWords(weeks.last7?.[key], weeks.prior7?.[key]));
793
+ }
794
+ parent.append(grid);
795
+ }
796
+ function mrrWords(mrr) {
797
+ if (!mrr) return null;
798
+ const entries = Object.entries(mrr);
799
+ return entries.length ? entries.map(([c, a]) => money(a, c)).join(', ') : money(0, 'usd');
800
+ }
801
+ // "Needs you": the alert rules from /v1/admin/alerts, worst first, each with what to do and a link to its tab.
802
+ function alertsBlock(parent) {
803
+ const mine = activeLoad;
804
+ const box = element('div', undefined, 'block');
805
+ box.append(element('h3', 'Needs you'));
806
+ const waiting = element('p', 'Checking alerts…', 'muted');
807
+ box.append(waiting);
808
+ parent.append(box);
809
+ fetch('/v1/admin/alerts', { credentials: 'same-origin', cache: 'no-store' })
810
+ .then((r) => (r.ok ? r.json() : null))
811
+ .catch(() => null)
812
+ .then((result) => {
813
+ if (mine !== activeLoad) return;
814
+ waiting.remove();
815
+ const alerts = result?.data?.alerts;
816
+ if (!Array.isArray(alerts)) {
817
+ box.append(element('p', 'Alerts could not be checked right now.', 'notice'));
818
+ return;
819
+ }
820
+ if (!alerts.length) {
821
+ box.append(element('p', 'Nothing needs you right now. Every alert rule passed.', 'banner green'));
822
+ }
823
+ for (const alert of alerts) {
824
+ const row = element('div', undefined, 'banner ' + (alert.level === 'red' ? 'red' : 'amber'));
825
+ row.append(element('div', alert.text), element('small', alert.action + ' '));
826
+ if (alert.tab && titles[alert.tab] && sections.includes(alert.tab)) {
827
+ const go = element('button', 'Open ' + titles[alert.tab]);
828
+ go.type = 'button';
829
+ go.addEventListener('click', () => {
830
+ current = alert.tab;
831
+ controls();
832
+ load();
833
+ });
834
+ row.append(go);
835
+ }
836
+ box.append(row);
837
+ }
838
+ box.append(
839
+ element(
840
+ 'p',
841
+ result.data.delivery === 'off'
842
+ ? 'Alerts show here only. On Railway, THUMBGATE_OWNER_ALERT_EMAIL=on emails new ones to you; THUMBGATE_OWNER_ALERT_WEBHOOK posts them to Slack or Discord.'
843
+ : 'New alerts are also sent (' + label(result.data.delivery).replace(/ on new alert$/, '') + '), checked every 15 minutes.',
844
+ 'muted',
845
+ ),
846
+ );
847
+ });
848
+ }
849
+ // Retention by weekly install cohort: of the installs first seen in a week, the share seen again 1, 2, 3… weeks later.
850
+ function cohortTable(parent, read) {
851
+ parent.append(element('h3', 'Install retention by week first seen'));
852
+ if (!read || !Array.isArray(read.cohorts)) {
853
+ parent.append(element('p', 'Cohorts are unavailable right now. No zero is inferred.', 'notice'));
854
+ return;
855
+ }
856
+ const later = Math.max(0, ...read.cohorts.map((c) => c.retained.length - 1));
857
+ const columns = [
858
+ ['Week first seen', (c) => c.weekStart + (c.includesOlder ? ' or earlier' : '')],
859
+ ['Installs', (c) => c.size],
860
+ ];
861
+ for (let k = 1; k <= later; k += 1)
862
+ columns.push([
863
+ 'Week ' + k,
864
+ (c) => (k >= c.retained.length ? '' : c.size ? Math.round((c.retained[k] / c.size) * 100) + '% (' + c.retained[k] + ')' : '–'),
865
+ ]);
866
+ table(parent, columns, read.cohorts);
867
+ parent.append(
868
+ element(
869
+ 'p',
870
+ 'Week 1 is the 7 days after the first week an install was seen. The oldest row also holds installs that began before this 8-week read.' +
871
+ (read.partial ? ' The telemetry log was cut short, so older weeks are lower bounds.' : ''),
872
+ 'muted',
873
+ ),
874
+ );
875
+ }
876
+ function channelTable(parent, channels, why) {
877
+ parent.append(element('h3', 'Where buyers come from'));
878
+ if (!Array.isArray(channels)) {
879
+ parent.append(element('p', why || 'Source not available right now', 'notice'));
880
+ return;
881
+ }
882
+ table(
883
+ parent,
884
+ [
885
+ ['Channel', (r) => r.channel],
886
+ ['Checkout starts, 30 days', (r) => (r.checkoutStarts30d === null ? 'Not read' : r.checkoutStarts30d)],
887
+ ['Paying customers, 1 year', (r) => (r.paidCustomers === null ? 'Not read' : r.paidCustomers)],
888
+ ['Revenue, 30 days', (r) => (r.revenue30d === null ? 'Not read' : mrrWords(r.revenue30d))],
889
+ ],
890
+ channels,
891
+ );
892
+ parent.append(element('p', 'The channel is the utm source a checkout carried, or direct. Bots and your own checkouts are left out of starts; a customer counts once, for their first paid checkout.', 'muted'));
893
+ }
894
+ function minutesWords(m) {
895
+ if (m < 60) return Math.round(m) + ' min';
896
+ if (m < 1440) return Math.round((m / 60) * 10) / 10 + ' h';
897
+ return Math.round((m / 1440) * 10) / 10 + ' days';
898
+ }
899
+ const usd = (n) => (Number.isFinite(n) ? '$' + (Math.abs(n) < 1 && n !== 0 ? n.toFixed(4) : n.toFixed(2)) : null);
900
+ function economicsBlock(parent, data) {
901
+ const reasons = data.reasons || {};
902
+ const or = (value, reason) => (value === null || value === undefined ? reason || 'Source not available right now' : value);
903
+ const d = data.delivery || {};
904
+ parent.append(element('h3', 'Cost to deliver · past 30 days, US dollars'));
905
+ cards(parent, {
906
+ 'Hosting (Railway, measured CPU and memory at list rates)': or(usd(d.hostingUsd), reasons.hosting),
907
+ 'Email (sends counted by the app)': d.emailUsd === null || d.emailUsd === undefined ? 'Not counted yet' : usd(d.emailUsd) + ' · ' + d.emails + ' sent',
908
+ 'Payment fees (Stripe)': or(usd(d.paymentFeesUsd), reasons.paymentFees),
909
+ 'Fixed delivery costs': d.fixedUsd ? usd(d.fixedUsd) : 'None recorded',
910
+ 'Total delivery cost': or(usd(d.totalUsd), 'Not complete yet'),
911
+ 'Build and internal costs (kept apart)': data.build?.totalUsd ? usd(data.build.totalUsd) : 'None recorded',
912
+ }, true);
913
+ parent.append(element('h3', 'Per unit'));
914
+ cards(parent, {
915
+ 'Serving cost per active install': or(usd(data.perActiveInstallUsd), reasons.activeInstalls || reasons.hosting),
916
+ 'Delivery cost per paying customer': or(usd(data.perPayingCustomerUsd), reasons.payingCustomers || reasons.hosting),
917
+ 'Revenue, past 30 days (one-time plus renewals)': or(usd(data.revenue?.totalUsd), 'Stripe not available right now'),
918
+ 'Contribution (revenue minus delivery cost)': data.contribution ? usd(data.contribution.contributionUsd) + (Number.isFinite(data.contribution.marginPct) ? ' · ' + Math.round(data.contribution.marginPct * 1000) / 10 + '% margin' : '') : 'Not complete yet',
919
+ }, true);
920
+ parent.append(element('h3', 'Contribution per sale, by plan'));
921
+ const plans = Object.values(data.plans || {}).filter((plan) => plan && Number.isFinite(plan.priceUsd));
922
+ table(parent, [
923
+ ['Plan', (r) => r.name],
924
+ ['Price', (r) => usd(r.priceUsd) + (r.priceBasis === 'list_price' ? ' (list)' : ' (Stripe average)')],
925
+ ['Payment fee', (r) => usd(r.paymentFeeUsd)],
926
+ ['Serving cost', (r) => usd(r.deliveryCostUsd)],
927
+ ['Keeps', (r) => usd(r.contributionUsd) + ' · ' + Math.round(r.marginPct * 1000) / 10 + '%' + (r.laborNote ? ' · labor not counted' : '')],
928
+ ], plans);
929
+ const access = data.paymentAccess;
930
+ parent.append(element('h3', 'Payment to access'));
931
+ if (!access) parent.append(element('p', 'Stripe or the key store is not available right now, so the check did not run.', 'notice'));
932
+ else if (access.status === 'unavailable') parent.append(element('p', access.reason, 'notice'));
933
+ else {
934
+ cards(parent, {
935
+ 'Entitled but no key': String(access.paidWithoutAccess),
936
+ 'Failed payment, key still active': access.failedPaymentWithAccess === null ? 'Not checked' : String(access.failedPaymentWithAccess),
937
+ 'Active paid keys with no Stripe payment': String(access.accessWithoutStripePayment),
938
+ 'Subscriptions with a failed payment': access.failedPaymentSubscriptions === null ? 'Not checked' : String(access.failedPaymentSubscriptions),
939
+ }, true);
940
+ parent.append(element('p', 'Entitled means an active subscription or a credit pack bought in the past year; service orders and canceled subscriptions grant no key. Used-up credit packs (' + access.exhaustedCreditKeys + ') were provisioned, so they are not missing keys. Keys with no Stripe payment can be GitHub Marketplace, PayPal or manual grants, so they are listed for review, not called wrong. Trial and free keys are left out (' + access.activeTrialOrFreeKeys + ').' + (access.complete ? '' : ' Some Stripe lists were cut short, so these counts are a lower bound.'), 'muted'));
941
+ }
942
+ for (const reason of [reasons.fixed, reasons.build, reasons.currencies, d.hosting?.reason, d.emailBasis]) if (reason) parent.append(element('p', reason, 'muted'));
943
+ parent.append(element('p', 'Rates checked ' + data.ratesCheckedAt + ' and kept in config/unit-costs.json with their sources. JSON for agents: /v1/admin/economics.', 'muted'));
944
+ }
945
+ function usageBlock(parent, usage) {
946
+ parent.append(element('h3', 'Product usage · CLI installs, past 30 days'));
947
+ if (!usage) {
948
+ parent.append(element('p', 'CLI usage is unavailable right now. No zero is inferred.', 'notice'));
949
+ return;
950
+ }
951
+ const share = (n) => (usage.activeInstalls30d > 0 && Number.isFinite(n) ? ' (' + Math.round((n / usage.activeInstalls30d) * 100) + '%)' : '');
952
+ cards(
953
+ parent,
954
+ {
955
+ 'Active installs, past 7 days': usage.activeInstalls7d,
956
+ 'Active installs, past 30 days': usage.activeInstalls30d,
957
+ 'Ran init in this window': usage.initsInWindow,
958
+ 'Captured feedback (activated)': String(usage.activatedInstalls) + share(usage.activatedInstalls),
959
+ 'Came back on a second day': String(usage.returningInstalls) + share(usage.returningInstalls),
960
+ 'First value: a real gate blocked a tool call': Number.isFinite(usage.firstValueInstalls) ? String(usage.firstValueInstalls) + share(usage.firstValueInstalls) : 'Not reported by this telemetry yet',
961
+ 'Time to first value (median)': usage.timeToFirstValue && Number.isFinite(usage.timeToFirstValue.medianMinutes) ? minutesWords(usage.timeToFirstValue.medianMinutes) + ' after install (' + usage.timeToFirstValue.installs + ' installs)' : 'N/A, no first block yet',
962
+ },
963
+ true,
964
+ );
965
+ parent.append(
966
+ element(
967
+ 'p',
968
+ 'An install is the anonymous id the CLI keeps in ~/.thumbgate. Your own machines, CI and flagged pings are left out (' +
969
+ usage.excludedInstalls +
970
+ ' excluded). Installs with telemetry turned off are not seen, so these are lower bounds. Gate blocks run locally; only the first block on each install is reported, with the minutes since install.',
971
+ 'muted',
972
+ ),
973
+ );
974
+ detail(parent, 'CLI commands run', usage.eventsByType);
975
+ detail(parent, 'Installs by version', usage.byVersion);
976
+ detail(parent, 'Installs by platform', usage.byPlatform);
977
+ }
760
978
  function render(parent, section, data) {
979
+ if (section === 'economics') economicsBlock(parent, data);
761
980
  if (section === 'money') {
981
+ alertsBlock(parent);
982
+ parent.append(element('h3', 'This week at a glance'));
983
+ const recurring = data.recurring30d;
984
+ const recurringWhy = data.reasons?.recurring || 'Source not available right now';
985
+ weekCards(parent, data.weekOverWeek, {
986
+ 'Monthly recurring revenue (list price)': data.mrr ? mrrWords(data.mrr) : (data.reasons?.mrr || 'Source not available right now'),
987
+ [recurring ? 'Renewal revenue, past 30 days (' + recurring.renewalInvoices + (recurring.renewalInvoices === 1 ? ' renewal)' : ' renewals)') : 'Renewal revenue, past 30 days']: recurring ? mrrWords(recurring.renewalRevenue) : recurringWhy,
988
+ [recurring ? 'Churn, past 30 days (' + recurring.churnedSubscriptions + ' cancelled)' : 'Churn, past 30 days']: recurring ? (Number.isFinite(recurring.churnRate) ? Math.round(recurring.churnRate * 1000) / 10 + '%' : 'N/A, no subscriptions') : recurringWhy,
989
+ 'Subscriptions cancelling at period end': data.cancellingAtPeriodEnd === null || data.cancellingAtPeriodEnd === undefined ? (data.reasons?.mrr || 'Source not available right now') : String(data.cancellingAtPeriodEnd),
990
+ });
991
+ usageBlock(parent, data.usage30d);
992
+ channelTable(parent, data.channels, data.reasons?.revenue || data.reasons?.checkouts);
993
+ parent.append(element('h3', 'Biggest evidenced obstacle'));
994
+ parent.append(element('p', describeObstacle({ 'money.paying_customers': { value: data.payingCustomers }, 'money.checkout_bot_check': { value: data.checkoutBotCheck } }, null)));
995
+ // Everything below is the evidence behind the headline numbers, folded away until asked for.
996
+ const outer = parent;
997
+ parent = element('details');
998
+ parent.append(element('summary', 'Money detail: customers, checkouts, revenue, traffic and leads'));
999
+ outer.append(parent);
1000
+ parent.append(element('h3', 'Customers and traffic'));
762
1001
  const checkouts = data.checkouts7d;
763
1002
  const traffic = data.traffic30d;
764
1003
  const why = data.reasons || {};
@@ -842,7 +1081,7 @@
842
1081
  '. Active Pro: ' +
843
1082
  basis(data.activeProBasis) +
844
1083
  '. Revenue is the total of completed Checkout Sessions created in the last 30 days, after refunds. ' +
845
- 'Subscription renewal invoices are not read, so recurring revenue is not included: subscription invoices are not collected yet.',
1084
+ 'Renewals are counted apart, as renewal revenue, from paid subscription renewal invoices.',
846
1085
  'muted',
847
1086
  ),
848
1087
  );
@@ -1024,7 +1263,7 @@
1024
1263
  'Checkout starts (30 days)': shown(traffic?.checkoutStarts, 'Telemetry store empty'),
1025
1264
  'Paid confirmations (30 days)': shown(traffic?.checkoutPaidConfirmations, 'Telemetry store empty'),
1026
1265
  'Email signups': shown(data.signups?.emailSignups, waiting),
1027
- 'External paid orders': shown(external.paidOrders, waiting),
1266
+ 'External paid orders': shown(external.paidOrders, waiting) + (external.paidOrders !== undefined && (data.reconciliation?.status !== 'ok' || data.reconciliation?.complete !== true) ? ' (partial)' : ''),
1028
1267
  },
1029
1268
  true,
1030
1269
  );
@@ -1070,6 +1309,7 @@
1070
1309
  [
1071
1310
  ['Day', (r) => r.date],
1072
1311
  ['Visitors', (r) => r.visitors],
1312
+ ['Active CLI installs', (r) => r.activeInstalls ?? 0],
1073
1313
  ['Page views', (r) => r.pageViews],
1074
1314
  ['Call to action clicks', (r) => r.ctaClicks],
1075
1315
  ['Checkout starts', (r) => r.checkoutStarts],
@@ -1078,6 +1318,14 @@
1078
1318
  [...data.daily].reverse(),
1079
1319
  );
1080
1320
  }
1321
+ if (data.weekOverWeek) {
1322
+ parent.append(element('h3', 'Past 7 days against the 7 days before'));
1323
+ weekCards(parent, data.weekOverWeek);
1324
+ }
1325
+ usageBlock(parent, data.usage);
1326
+ cohortTable(parent, data.cohorts);
1327
+ if (data.reconciliation?.status !== 'ok' || data.reconciliation?.complete !== true)
1328
+ parent.append(element('p', 'Provider reconciliation is incomplete (' + (data.reconciliation?.status || 'not reported') + '). Paid-order and revenue totals are partial ledger evidence, not verified payment outcomes. Local installations and successful first local use are not measured.', 'notice'));
1081
1329
  parent.append(
1082
1330
  element('h3', 'External booked revenue · past 30 days'),
1083
1331
  );
@@ -1098,6 +1346,13 @@
1098
1346
  'muted',
1099
1347
  ),
1100
1348
  );
1349
+ if (data.checkoutSessionDepth) {
1350
+ parent.append(element('h3', 'Checkout-session evidence coverage'));
1351
+ detail(parent, 'Existing checkout event IDs matched to Stripe session depth', data.checkoutSessionDepth, {
1352
+ sessionsCreated: 'Recorded checkout-created events', raw: 'No email or payment-attempt evidence', identified: 'Email present, not proof of a buyer', paymentAttempt: 'Payment intent present, not proof of payment', paid: 'Stripe payment status paid', unresolved: 'Session evidence not resolved', qualifiedCheckoutStarts: 'Identified or later, not unique people', basis: 'Count basis', lookupStatus: 'Provider lookup coverage',
1353
+ });
1354
+ parent.append(element('p', 'This joins existing checkout-event evidence IDs to Stripe sessions. It does not join site visitor IDs to people, prove a payment attempt was declined, or explain abandonment. Unresolved events stay unknown.', 'muted'));
1355
+ }
1101
1356
  funnelTable(parent, data.funnel);
1102
1357
  for (const key of [
1103
1358
  'funnel',
@@ -46,7 +46,7 @@
46
46
  "name": "How does ThumbGate help the Agent Manager?",
47
47
  "acceptedAnswer": {
48
48
  "@type": "Answer",
49
- "text": "ThumbGate is the pre-action enforcement layer under the role. It runs PreToolUse hooks, distills repeated thumbs-down feedback into CLAUDE.md rules, and shows the rule plus evidence on each block. Pro keeps personal recall, exports, personal dashboard proof, and adapters maintained. Enterprise service work is qualified after intake; an org-wide hosted rule library and hosted dashboard are not generally available."
49
+ "text": "ThumbGate is the pre-action enforcement layer under the role. It runs PreToolUse hooks, distills repeated thumbs-down feedback into CLAUDE.md rules, and shows the rule plus evidence on each block. Pro keeps every learned rule active and adds recall, lesson search, and exports. Enterprise service work is qualified after intake; an org-wide hosted rule library and hosted dashboard are not generally available."
50
50
  }
51
51
  },
52
52
  {
@@ -54,7 +54,7 @@
54
54
  "name": "Is ThumbGate free for the Agent Manager to start?",
55
55
  "acceptedAnswer": {
56
56
  "@type": "Answer",
57
- "text": "Yes. npx thumbgate init in one repo is free and MIT licensed, and gates work locally without a hosted account. Pro adds personal recall, personal dashboard proof, DPO/HuggingFace export, and managed adapters. Enterprise service work can add scoped rollout support after intake; a hosted org dashboard and org-wide hosted rule library are not generally available."
57
+ "text": "Yes. npx thumbgate init in one repo is free and MIT licensed, and gates work locally without a hosted account. Pro keeps every learned rule active and adds recall, lesson search, and DPO/HuggingFace export. Enterprise service work can add scoped rollout support after intake; a hosted org dashboard and org-wide hosted rule library are not generally available."
58
58
  }
59
59
  },
60
60
  {
@@ -131,7 +131,7 @@ npx thumbgate cost # see what the gates were worth</code></pre>
131
131
  <div class="quote">"The category isn't 'FinOps for AI' — it's 'gates that stop the spend so FinOps has less to report on.' One sits behind the other."</div>
132
132
 
133
133
  <div class="card">
134
- <p><strong>The free CLI is real. Pro adds the personal local dashboard, recall, exports, and managed adapters. Enterprise service work is qualified and signed after intake around local workflow controls; a hosted org dashboard and org-wide hosted rule library are not generally available.</strong></p>
134
+ <p><strong>The free CLI is real. Pro keeps every learned rule active and adds recall, lesson search, and exports. Enterprise service work is qualified and signed after intake around local workflow controls; a hosted org dashboard and org-wide hosted rule library are not generally available.</strong></p>
135
135
  <p>
136
136
  <a href="/diagnostic?utm_source=website&amp;utm_medium=agents_cost_savings_page&amp;utm_campaign=managed_workflow_gate&amp;cta_id=agents_cost_savings_managed_gate&amp;cta_placement=agents_cost_savings_page" class="cta">Get the managed workflow gate</a>
137
137
  <a href="/checkout/pro?utm_source=website&amp;utm_medium=agents_cost_savings_page&amp;utm_campaign=pro_upgrade&amp;cta_id=agents_cost_savings_pro_checkout&amp;cta_placement=agents_cost_savings_page&amp;plan_id=pro" class="secondary">Or install the free CLI →</a>
@@ -89,7 +89,7 @@
89
89
  <h2>Why this matters now</h2>
90
90
  <p>The Dell distribution channel changes who buys Codex. The individual-developer install is opt-in; the enterprise procurement install is policy-driven. The teams approving the Codex line item will ask three questions ThumbGate is built to answer:</p>
91
91
  <ol>
92
- <li><strong>What did the agent do?</strong> — capture, with evidence, on every tool call.</li>
92
+ <li><strong>What did the agent do?</strong> — capture, with evidence, on the tool calls the hook sees.</li>
93
93
  <li><strong>What did we stop it from doing?</strong> — PreToolUse gates with the rule that fired and why.</li>
94
94
  <li><strong>How do you keep this current as Codex updates?</strong> — adapter matrix that's CI-checked against upstream.</li>
95
95
  </ol>
@@ -101,7 +101,7 @@
101
101
  <p>This wires the Codex hook, sets up the local lesson DB, and gives you the capture/promote/block loop without a hosted account. If you want the standalone Codex plugin as a self-contained zip — for offline distribution to Dell-managed machines or for security review — grab it from <a href="https://github.com/IgorGanapolsky/ThumbGate/releases" target="_blank" rel="noopener" style="color:var(--cyan)">GitHub releases</a> (look for <code>codex-plugin-*.zip</code>).</p>
102
102
 
103
103
  <div class="card">
104
- <p><strong>The free CLI is real. Pro adds the personal local dashboard, recall, exports, and managed adapters. Enterprise service work is qualified and signed after intake around local workflow controls; a hosted org dashboard and org-wide hosted rule library are not generally available.</strong></p>
104
+ <p><strong>The free CLI is real. Pro keeps every learned rule active and adds recall, lesson search, and exports. Enterprise service work is qualified and signed after intake around local workflow controls; a hosted org dashboard and org-wide hosted rule library are not generally available.</strong></p>
105
105
  <p>
106
106
  <a href="/diagnostic?utm_source=website&amp;utm_medium=codex_enterprise_page&amp;utm_campaign=managed_workflow_gate&amp;cta_id=codex_enterprise_managed_gate&amp;cta_placement=codex_enterprise_page" class="cta">Get the managed workflow gate</a>
107
107
  <a href="/checkout/pro?utm_source=website&amp;utm_medium=codex_enterprise_page&amp;utm_campaign=pro_upgrade&amp;cta_id=codex_enterprise_pro_checkout&amp;cta_placement=codex_enterprise_page&amp;plan_id=pro" class="secondary">Or install the free CLI →</a>
@@ -46,7 +46,7 @@
46
46
  "name": "What is a pre-action check for AI coding agents?",
47
47
  "acceptedAnswer": {
48
48
  "@type": "Answer",
49
- "text": "A pre-action check is an enforcement layer that intercepts AI agent tool calls before they execute. Unlike prompt rules that agents can ignore, pre-action checks flag and log risky actions, and hard-block the most dangerous classes by default (secret exfiltration, supply-chain installs, and rm -rf-class deletes). Actions such as force-pushing to main, off-scope edits, or skipping tests warn by default and hard-block under strict enforcement mode (THUMBGATE_STRICT_ENFORCEMENT=1). ThumbGate implements pre-action checks via PreToolUse hooks that fire before every tool call."
49
+ "text": "A pre-action check is an enforcement layer that intercepts AI agent tool calls before they execute. Unlike prompt rules that agents can ignore, pre-action checks flag and log risky actions, and hard-block the most dangerous classes by default (secret exfiltration, supply-chain installs, and rm -rf-class deletes). Actions such as force-pushing to main, off-scope edits, or skipping tests warn by default and hard-block under strict enforcement mode (THUMBGATE_STRICT_ENFORCEMENT=1). ThumbGate implements pre-action checks via PreToolUse hooks that run before tool calls in supported integrations."
50
50
  }
51
51
  },
52
52
  {
@@ -210,7 +210,7 @@
210
210
  </tr>
211
211
  <tr>
212
212
  <td>Real-time pre-action checks</td>
213
- <td class="yes">Yes -- fires before every tool call</td>
213
+ <td class="yes">Yes -- runs before tool calls (Claude Code)</td>
214
214
  <td class="no">No -- asynchronous review</td>
215
215
  <td class="no">No -- reactive only</td>
216
216
  <td class="no">No -- prompt-time only</td>
@@ -337,7 +337,7 @@
337
337
  <div class="step-card">
338
338
  <div class="step-number">2</div>
339
339
  <h3>Check</h3>
340
- <p>Every tool call your agent makes passes through a pre-action check. Known-bad patterns are blocked before execution. Good actions pass through instantly.</p>
340
+ <p>In Claude Code, tool calls pass through a pre-action check. Known-bad patterns are blocked before execution. Good actions pass through instantly.</p>
341
341
  </div>
342
342
  <div class="step-card">
343
343
  <div class="step-number">3</div>