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
@@ -0,0 +1,138 @@
1
+ 'use strict';
2
+
3
+ // Unit economics for the owner console: what it costs to deliver ThumbGate, per active install and per paying customer,
4
+ // and what each plan keeps after those costs. Pure arithmetic over numbers the app already has:
5
+ // - hosting: the container's own measured CPU and memory (scripts/cost-meter.js) at Railway's list rates
6
+ // - email: emails the mailer sent, at Resend's per-email rate
7
+ // - payment fees: Stripe's fee on each ThumbGate checkout when Stripe returned it, else the published card rate
8
+ // - revenue: Stripe checkouts and renewal invoices (US dollars only; other currencies are listed, never converted)
9
+ // Every figure carries its basis. A number that cannot be measured is null with a reason, never a guess.
10
+
11
+ const fs = require('node:fs');
12
+ const path = require('node:path');
13
+
14
+ const MONTH_SECONDS = 30 * 86400;
15
+ const cents = (usd) => (Number.isFinite(usd) ? Math.round(usd * 100) : null);
16
+ const round2 = (n) => (Number.isFinite(n) ? Math.round(n * 100) / 100 : null);
17
+ const round4 = (n) => (Number.isFinite(n) ? Math.round(n * 10000) / 10000 : null);
18
+ const usdCents = (byCurrency) => (byCurrency && Number.isSafeInteger(byCurrency.USD) ? byCurrency.USD : 0);
19
+ const sumList = (list) => (Array.isArray(list) ? list : []).filter((item) => item && Number.isFinite(item.usd) && item.usd >= 0).reduce((total, item) => total + item.usd, 0);
20
+
21
+ function loadUnitCosts(file = path.join(__dirname, '..', 'config', 'unit-costs.json')) {
22
+ try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return null; }
23
+ }
24
+
25
+ // Hosting for the window: measured compute plus the configured volume and egress, scaled to 30 days when the meter
26
+ // covered only part of the window (for example the first days after this feature shipped).
27
+ function hostingCost(meter, rates) {
28
+ if (!meter || !rates || !(meter.sampledSeconds > 0)) return { usd: null, measuredUsd: null, coverage: meter ? meter.coverage || 0 : 0, basis: 'not_measured_yet', reason: 'The cost meter has no samples yet. It records once a minute after the server starts.' };
29
+ const cpuUsd = (meter.cpuSeconds / MONTH_SECONDS) * rates.vcpuMonthUsd;
30
+ const memoryUsd = (meter.memoryGbSeconds / MONTH_SECONDS) * rates.memoryGbMonthUsd;
31
+ const measuredUsd = cpuUsd + memoryUsd;
32
+ const scale = MONTH_SECONDS / meter.sampledSeconds;
33
+ const computeMonthUsd = measuredUsd * scale;
34
+ const volumeUsd = (Number(rates.volumeGb) || 0) * (Number(rates.volumeGbMonthUsd) || 0);
35
+ const egressUsd = (Number(rates.egressGbPerMonth) || 0) * (Number(rates.egressGbUsd) || 0);
36
+ const full = meter.coverage >= 0.95;
37
+ return {
38
+ usd: round4(computeMonthUsd + volumeUsd + egressUsd),
39
+ measuredUsd: round4(measuredUsd),
40
+ parts: { cpuUsd: round4(cpuUsd * scale), memoryUsd: round4(memoryUsd * scale), volumeUsd: round4(volumeUsd), egressUsd: round4(egressUsd) },
41
+ coverage: round4(meter.coverage),
42
+ sources: meter.sources || [],
43
+ basis: full ? 'measured_30d' : 'projected_from_partial_window',
44
+ reason: full ? null : `The meter covered ${Math.round(meter.coverage * 1000) / 10}% of the 30 days, so compute is projected to 30 days from what it saw.`,
45
+ };
46
+ }
47
+
48
+ // Stripe fees in US dollars: the fees Stripe returned for ThumbGate checkouts, plus the published rate for what it did not
49
+ // return and for renewal invoices. Subscription money also pays the Stripe Billing percentage.
50
+ function paymentFees(money, rates) {
51
+ if (!money || !rates) return { usd: null, basis: 'unavailable', reason: 'Stripe numbers are not available right now.' };
52
+ const fees = money.paymentFees30d || {};
53
+ const reported = usdCents(fees.reportedFees) / 100;
54
+ const unreportedCharges = Number.isSafeInteger(fees.unreportedCharges) ? fees.unreportedCharges : 0;
55
+ const unreportedAmount = usdCents(fees.unreportedAmount) / 100;
56
+ const renewalCount = Number.isSafeInteger(money.recurring30d?.renewalInvoices) ? money.recurring30d.renewalInvoices : 0;
57
+ const renewalUsd = usdCents(money.recurring30d?.renewalRevenue) / 100;
58
+ const card = (count, amount) => count * rates.fixedUsd + amount * rates.percent;
59
+ const estimated = card(unreportedCharges, unreportedAmount) + card(renewalCount, renewalUsd) + renewalUsd * (rates.billingPercent || 0) + (usdCents(fees.subscriptionFirstCharges) / 100) * (rates.billingPercent || 0);
60
+ return { usd: round4(reported + estimated), reportedUsd: round4(reported), estimatedUsd: round4(estimated), basis: estimated > 0 ? (reported > 0 ? 'stripe_reported_plus_published_rate' : 'published_rate') : 'stripe_reported' };
61
+ }
62
+
63
+ function perUnit(totalUsd, count) {
64
+ return Number.isFinite(totalUsd) && Number.isInteger(count) && count > 0 ? round4(totalUsd / count) : null;
65
+ }
66
+
67
+ // Contribution for one plan sale: price, minus the payment fee on that price, minus the delivery cost one customer adds.
68
+ function planContribution({ priceUsd, recurring, costPerCustomerUsd, rates, laborNote = null }) {
69
+ if (!Number.isFinite(priceUsd) || !rates) return null;
70
+ const feeUsd = priceUsd * rates.percent + rates.fixedUsd + (recurring ? priceUsd * (rates.billingPercent || 0) : 0);
71
+ const deliveryUsd = Number.isFinite(costPerCustomerUsd) ? costPerCustomerUsd : 0;
72
+ const contributionUsd = priceUsd - feeUsd - deliveryUsd;
73
+ return { priceUsd: round2(priceUsd), paymentFeeUsd: round2(feeUsd), deliveryCostUsd: round4(deliveryUsd), contributionUsd: round2(contributionUsd), marginPct: round4(contributionUsd / priceUsd), laborNote };
74
+ }
75
+
76
+ // The whole board. `money` is collectMoney's data, `usage` the 30-day CLI usage, `meter` cost-meter's 30-day window.
77
+ function computeUnitEconomics({ money = null, usage = null, meter = null, costs = loadUnitCosts() } = {}) {
78
+ if (!costs) return { status: 'unavailable', reason: 'config/unit-costs.json could not be read.' };
79
+ const hosting = hostingCost(meter, costs.hosting);
80
+ const emails = meter ? meter.emails : null;
81
+ const emailUsd = Number.isInteger(emails) ? round4(emails * costs.email.costPerEmailUsd) : null;
82
+ const fees = paymentFees(money, costs.payments);
83
+ const fixedUsd = round4(sumList(costs.fixedDeliveryMonthly));
84
+ const buildUsd = round4(sumList(costs.buildAndInternalMonthly));
85
+ const parts = [hosting.usd, emailUsd, fees.usd, fixedUsd];
86
+ const deliveryUsd = parts.every(Number.isFinite) ? round4(parts.reduce((a, b) => a + b, 0)) : null;
87
+ // Serving cost (hosting, email, fixed) is shared by every install; payment fees belong to paying customers only.
88
+ const servingUsd = [hosting.usd, emailUsd, fixedUsd].every(Number.isFinite) ? hosting.usd + emailUsd + fixedUsd : null;
89
+
90
+ const activeInstalls = Number.isInteger(usage?.activeInstalls30d) ? usage.activeInstalls30d : null;
91
+ const payingCustomers = Number.isInteger(money?.payingCustomers) ? money.payingCustomers : null;
92
+ const activePro = Number.isInteger(money?.activePro) ? money.activePro : null;
93
+ const servingPerInstall = perUnit(servingUsd, activeInstalls);
94
+
95
+ const oneTimeUsd = money ? usdCents(money.revenueLast30Days) / 100 : null;
96
+ const renewalsUsd = money ? usdCents(money.recurring30d?.renewalRevenue) / 100 : null;
97
+ const revenueUsd = money ? round2(oneTimeUsd + renewalsUsd) : null;
98
+ const otherCurrencies = money ? [...new Set([...Object.keys(money.revenueLast30Days || {}), ...Object.keys(money.recurring30d?.renewalRevenue || {}), ...Object.keys(money.mrr || {})])].filter((code) => code !== 'USD') : [];
99
+ const contribution = Number.isFinite(revenueUsd) && Number.isFinite(deliveryUsd)
100
+ ? { revenueUsd, deliveryUsd, contributionUsd: round2(revenueUsd - deliveryUsd), marginPct: revenueUsd > 0 ? round4((revenueUsd - deliveryUsd) / revenueUsd) : null, afterBuildUsd: round2(revenueUsd - deliveryUsd - buildUsd) }
101
+ : null;
102
+
103
+ // Pro: the list price, or the average active subscription in dollars when Stripe has some.
104
+ const mrrUsd = money ? usdCents(money.mrr) / 100 : 0;
105
+ const proPrice = activePro > 0 && mrrUsd > 0 ? mrrUsd / activePro : costs.plans.pro.listMonthlyUsd;
106
+ const plans = {
107
+ pro: { name: costs.plans.pro.name, priceBasis: activePro > 0 && mrrUsd > 0 ? 'stripe_average_active_subscription' : 'list_price', ...planContribution({ priceUsd: proPrice, recurring: true, costPerCustomerUsd: servingPerInstall, rates: costs.payments }) },
108
+ setupSprint: { name: costs.plans.setupSprint.name, priceBasis: 'list_price', ...planContribution({ priceUsd: costs.plans.setupSprint.listUsd, recurring: false, costPerCustomerUsd: servingPerInstall, rates: costs.payments, laborNote: costs.plans.setupSprint.deliveryHoursNote }) },
109
+ };
110
+
111
+ const reasons = {};
112
+ if (hosting.reason) reasons.hosting = hosting.reason;
113
+ if (fees.reason) reasons.paymentFees = fees.reason;
114
+ if (activeInstalls === null) reasons.activeInstalls = 'CLI usage telemetry is not available right now.';
115
+ else if (activeInstalls === 0) reasons.activeInstalls = 'No active installs in 30 days, so there is no cost per install.';
116
+ if (payingCustomers === 0) reasons.payingCustomers = 'No paying customers, so there is no cost per paying customer.';
117
+ if (!costs.fixedDeliveryMonthly.length) reasons.fixed = 'No fixed delivery costs are recorded in config/unit-costs.json.';
118
+ if (!costs.buildAndInternalMonthly.length) reasons.build = 'No build or internal costs are recorded in config/unit-costs.json, so "after build costs" equals contribution.';
119
+ if (otherCurrencies.length) reasons.currencies = `Revenue in ${otherCurrencies.join(', ')} is left out: only US dollars are added up, and nothing is converted.`;
120
+
121
+ return {
122
+ status: deliveryUsd === null ? 'partial' : 'ok',
123
+ window: '30d',
124
+ ratesCheckedAt: costs.checkedAt,
125
+ delivery: { hostingUsd: hosting.usd, hosting, emails, emailUsd, emailBasis: costs.email.basis, paymentFeesUsd: fees.usd, paymentFees: fees, fixedUsd, totalUsd: deliveryUsd },
126
+ build: { totalUsd: buildUsd, items: costs.buildAndInternalMonthly },
127
+ denominators: { activeInstalls30d: activeInstalls, payingCustomers, activePro },
128
+ perActiveInstallUsd: servingPerInstall,
129
+ perPayingCustomerUsd: perUnit(deliveryUsd, payingCustomers),
130
+ revenue: { oneTimeUsd, renewalsUsd, totalUsd: revenueUsd, mrrUsd: money ? round2(mrrUsd) : null },
131
+ contribution,
132
+ plans,
133
+ reasons,
134
+ sources: { hosting: costs.hosting.source, email: costs.email.source, payments: costs.payments.source },
135
+ };
136
+ }
137
+
138
+ module.exports = { computeUnitEconomics, hostingCost, paymentFees, planContribution, loadUnitCosts, cents };
package/server.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "source": "github",
9
9
  "url": "https://github.com/IgorGanapolsky/ThumbGate"
10
10
  },
11
- "version": "1.40.10",
11
+ "version": "1.40.13",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "registryBaseUrl": "https://registry.npmjs.org",
16
16
  "identifier": "thumbgate",
17
- "version": "1.40.10",
17
+ "version": "1.40.13",
18
18
  "runtimeHint": "npx",
19
19
  "runtimeArguments": [
20
20
  {
package/src/api/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  const { withDataScope, withoutDataScope, currentDataScope, tenantDataScope, assertScopedDataPath, dataScopeKey } = require('../../scripts/feedback-scope');
3
- const { parseProjectSelection, projectForCapture, projectForRecord, matchesProject, validProjectKey } = require('../../scripts/project-identity');
3
+ const { isProjectFolder, parseProjectSelection, projectForCapture, projectForRecord, matchesProject, validProjectKey } = require('../../scripts/project-identity');
4
4
  const { readProjectRows, buildProjectCatalog } = require('../../scripts/project-catalog');
5
5
  const ownerAdmin = require('../../scripts/owner-admin');
6
6
  const opsLog = require('../../scripts/ops-log');
@@ -585,7 +585,10 @@ function serveStaticFile(res, filePath, { headOnly = false, cacheSeconds = 86400
585
585
  return;
586
586
  }
587
587
  res.setHeader('Content-Type', contentType);
588
- res.setHeader('Cache-Control', `public, max-age=${cacheSeconds}, immutable`);
588
+ // Scripts, styles and pages have no content hash in their URL, so a browser that pins them as
589
+ // immutable keeps running an old build's code after an upgrade. Only media is safe to pin.
590
+ const revalidate = ['.js', '.mjs', '.css', '.html', '.json'].includes(ext);
591
+ res.setHeader('Cache-Control', revalidate ? 'no-cache' : `public, max-age=${cacheSeconds}, immutable`);
589
592
  res.setHeader('Referrer-Policy', 'same-origin');
590
593
  res.setHeader('Accept-Ranges', 'bytes');
591
594
  const range = rangeHeader ? parseByteRange(rangeHeader, stat.size) : null;
@@ -5101,6 +5104,7 @@ function renderSitemapXml(runtimeConfig) {
5101
5104
  { path: '/peter', changefreq: 'weekly', priority: '0.9' },
5102
5105
  { path: '/workflow-hardening-sprint', changefreq: 'weekly', priority: '0.9' },
5103
5106
  { path: '/install', changefreq: 'weekly', priority: '0.9' },
5107
+ { path: '/connectors', changefreq: 'weekly', priority: '0.85' },
5104
5108
  { path: '/terms', changefreq: 'monthly', priority: '0.7' },
5105
5109
  { path: '/privacy', changefreq: 'monthly', priority: '0.7' },
5106
5110
  { path: '/support', changefreq: 'monthly', priority: '0.7' },
@@ -5132,11 +5136,11 @@ function renderSitemapXml(runtimeConfig) {
5132
5136
  { path: '/learn/codex-role-plugins-need-governance', changefreq: 'weekly', priority: '0.85' },
5133
5137
  { path: '/learn/agentic-os-team-governance', changefreq: 'weekly', priority: '0.85' },
5134
5138
  { path: '/learn/cost-aware-agent-gate-routing', changefreq: 'weekly', priority: '0.85' },
5135
- { path: '/learn/pretix-stripe-connect-marketplaces', changefreq: 'weekly', priority: '0.9' },
5136
5139
  { path: '/learn/netflix-oci-actor-critic-process-audits', changefreq: 'weekly', priority: '0.85' },
5137
5140
  { path: '/learn/future-agi-self-healing-agent-firewall', changefreq: 'weekly', priority: '0.85' },
5138
5141
  { path: '/learn/five-walls-enterprise-agent-deployment', changefreq: 'weekly', priority: '0.85' },
5139
5142
  { path: '/learn/okta-mcp-governance-per-tool-call-gates', changefreq: 'weekly', priority: '0.85' },
5143
+ { path: '/learn/ai-finops-agent-spend-guardrails', changefreq: 'weekly', priority: '0.85' },
5140
5144
  { path: '/compare/claude-code-hooks', changefreq: 'weekly', priority: '0.85' },
5141
5145
  { path: '/compare/bumblebee', changefreq: 'weekly', priority: '0.85' },
5142
5146
  { path: '/compare/anthropic-containment', changefreq: 'weekly', priority: '0.85' },
@@ -7558,6 +7562,17 @@ function createUnscopedApiServer({ ownerAdminDependencies = {} } = {}) {
7558
7562
  const humanReviewerConfig = getHumanReviewerConfig(expectedApiKey, expectedOperatorKey);
7559
7563
 
7560
7564
  const adminRuntime = ownerAdmin.createRuntimeObservations();
7565
+ // Owner alerts to the owner's own incoming webhook, only when THUMBGATE_OWNER_ALERT_WEBHOOK is set. Not under tests.
7566
+ if (!process.env.NODE_TEST_CONTEXT) ownerAdmin.startAlertDelivery(() => withoutDataScope(() => ({
7567
+ feedbackDir: getFeedbackPaths().FEEDBACK_DIR, buildMetadata: BUILD_METADATA, runtime: adminRuntime,
7568
+ hashDataIdentity, buildHostedTenantIdentity,
7569
+ health: () => ({ version: pkg.version, buildSha: BUILD_METADATA.buildSha, uptime: process.uptime() }),
7570
+ ...ownerAdminDependencies,
7571
+ })));
7572
+ // Cost meter for the owner console's unit economics: hosted deployments only (Railway sets RAILWAY_ENVIRONMENT), never under tests.
7573
+ if (!process.env.NODE_TEST_CONTEXT && (process.env.RAILWAY_ENVIRONMENT || process.env.THUMBGATE_COST_METER === '1')) {
7574
+ try { require('../../scripts/cost-meter').start({ feedbackDir: withoutDataScope(() => getFeedbackPaths().FEEDBACK_DIR) }); } catch { /* best-effort */ }
7575
+ }
7561
7576
  const observedRequests = new WeakSet();
7562
7577
  const eventBus = new EventEmitter();
7563
7578
  eventBus.setMaxListeners(200);
@@ -8799,6 +8814,33 @@ async function addContext(){
8799
8814
  return;
8800
8815
  }
8801
8816
 
8817
+ // Short, typeable route for TikTok: captions and end cards cannot carry a clickable
8818
+ // link, so people type thumbgate.ai/tiktok. Records the hit (the telemetry layer adds
8819
+ // its own human/bot flag from the headers), then 302s to the install page with utms.
8820
+ if (isGetLikeRequest && (pathname === '/tiktok' || pathname === '/tiktok/')) {
8821
+ const tiktokQuery = '?utm_source=tiktok&utm_medium=video&utm_campaign=profile';
8822
+ const journeyState = resolveJourneyState(req, parsed);
8823
+ const tiktokParsed = new URL(`/tiktok${tiktokQuery}`, hostedConfig.appOrigin);
8824
+ const tiktokAttribution = buildLandingAttribution(tiktokParsed, req);
8825
+ appendBestEffortTelemetry(getFeedbackPaths().FEEDBACK_DIR, {
8826
+ eventType: 'landing_page_view',
8827
+ clientType: 'web',
8828
+ visitorId: journeyState.visitorId,
8829
+ sessionId: journeyState.sessionId,
8830
+ acquisitionId: journeyState.acquisitionId,
8831
+ ...tiktokAttribution,
8832
+ pageType: 'tiktok_short_link',
8833
+ }, req.headers, 'tiktok_short_link');
8834
+ res.writeHead(302, {
8835
+ ...(journeyState.setCookieHeaders.length ? { 'Set-Cookie': journeyState.setCookieHeaders } : {}),
8836
+ 'Cache-Control': 'no-store',
8837
+ 'X-Robots-Tag': 'noindex,nofollow',
8838
+ Location: `/install${tiktokQuery}`,
8839
+ });
8840
+ res.end();
8841
+ return;
8842
+ }
8843
+
8802
8844
  if (isGetLikeRequest && (
8803
8845
  pathname === '/install'
8804
8846
  || pathname === '/install.html'
@@ -11252,6 +11294,17 @@ footer{margin-top:40px;padding-top:20px;border-top:1px solid #e5e7eb;color:#6b72
11252
11294
  return;
11253
11295
  }
11254
11296
 
11297
+ // Public connectors page (linked from /pricing and the site nav).
11298
+ if (isGetLikeRequest && (pathname === '/connectors' || pathname === '/connectors/' || pathname === '/connectors.html')) {
11299
+ try {
11300
+ const connectorsPageHtml = fs.readFileSync(path.join(PUBLIC_DIR, 'connectors.html'), 'utf-8');
11301
+ sendHtml(res, 200, connectorsPageHtml, {}, { headOnly: isHeadRequest });
11302
+ } catch {
11303
+ sendText(res, 404, 'Connectors page not found');
11304
+ }
11305
+ return;
11306
+ }
11307
+
11255
11308
  // Public Remote MCP Connector Documentation.
11256
11309
  if (isGetLikeRequest && (pathname === '/docs/connectors' || pathname === '/docs/connectors/' || pathname === '/docs/connectors.html')) {
11257
11310
  try {
@@ -11772,7 +11825,12 @@ footer{margin-top:40px;padding-top:20px;border-top:1px solid #e5e7eb;color:#6b72
11772
11825
  const _token = extractBearerToken(req);
11773
11826
  if (_token && _token !== expectedApiKey) recordUsage(_token);
11774
11827
  Object.assign(projectOptions, { projectKey: requestProjectKey, feedbackDir: requestFeedbackDir }, projectEvidenceForRequest(req, parsed, requestFeedbackDir, requestDataIdentity));
11775
- if (req.method === 'GET' && pathname === '/v1/projects') { sendJson(res, 200, buildProjectCatalog(requestFeedbackDir, projectOptions)); return; }
11828
+ if (req.method === 'GET' && pathname === '/v1/projects') {
11829
+ // The folder the dashboard was opened for: the page's own projectDir (loopback only), else the server's.
11830
+ const catalogDir = getEffectiveRequestedProjectSelection(req, parsed) || projectOptions.projectDir || process.env.THUMBGATE_PROJECT_DIR || null;
11831
+ sendJson(res, 200, { ...buildProjectCatalog(requestFeedbackDir, projectOptions), projectDir: catalogDir, projectDirIsProject: catalogDir ? isProjectFolder(catalogDir) : null });
11832
+ return;
11833
+ }
11776
11834
  if (requestProjectKey != null && req.method === 'GET' && ['/v1/dashboard', '/v1/feedback/stats'].includes(pathname)) {
11777
11835
  const data = generateDashboard(requestFeedbackDir, {
11778
11836
  projectKey: requestProjectKey, ...projectOptions, humanOnly: true,
@@ -344,8 +344,8 @@ const STRIPE_OFFER_CATALOG = Object.freeze({
344
344
  }),
345
345
  pro_19: Object.freeze({
346
346
  offerId: 'pro_19', productPagePath: '/pro', priceUsd: 19, billingType: 'subscription', proofPath: '/pro',
347
- headline: 'ThumbGate Pro is for one operator who already hit a repeated AI-agent failure and now needs proof: what was blocked, why it was blocked, and what changed before the next risky run.', ctaLabel: 'Start Pro',
348
- rationale: 'Start Pro when you want the local dashboard, DPO export, and a single proof lane for the repeated mistake you need to stop.',
347
+ headline: 'Keep every lesson your agent learned, and ask it what went wrong before.', ctaLabel: 'Start Pro',
348
+ rationale: 'The free CLI already denies catastrophic commands and secret leaks. ThumbGate Pro is about memory: every rule you teach with a thumbs-down stays active, you can record as many thumbs as you like, and you can search and export what was learned.',
349
349
  checkoutPath: '/go/pro-direct?utm_source=website&utm_medium=objection_rescue&utm_campaign=pro_upgrade',
350
350
  }),
351
351
  diagnostic_499: Object.freeze({