thumbgate 1.40.9 → 1.40.12

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 (46) 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/package.json +9 -5
  15. package/public/admin.html +229 -29
  16. package/public/agent-manager.html +2 -2
  17. package/public/agents-cost-savings.html +1 -1
  18. package/public/codex-enterprise.html +2 -2
  19. package/public/compare.html +3 -3
  20. package/public/dashboard.html +28 -9
  21. package/public/diagnostic.html +1 -1
  22. package/public/founders.html +1 -1
  23. package/public/guide.html +4 -4
  24. package/public/index.html +80 -116
  25. package/public/install.html +19 -19
  26. package/public/js/connect-panel.js +21 -7
  27. package/public/lessons.html +1 -1
  28. package/public/numbers.html +2 -2
  29. package/public/pricing.html +12 -9
  30. package/public/pro.html +96 -137
  31. package/public/project-switcher.js +42 -18
  32. package/scripts/auto-wire-hooks.js +36 -2
  33. package/scripts/billing.js +3 -1
  34. package/scripts/cli-schema.js +2 -3
  35. package/scripts/commercial-offer.js +1 -1
  36. package/scripts/gates-engine.js +26 -8
  37. package/scripts/hook-runtime.js +18 -1
  38. package/scripts/owner-admin.js +212 -13
  39. package/scripts/owner-alerts.js +79 -0
  40. package/scripts/owner-telemetry.js +93 -3
  41. package/scripts/project-catalog.js +3 -1
  42. package/scripts/project-identity.js +4 -1
  43. package/scripts/seo-gsd.js +1 -1
  44. package/scripts/telemetry-analytics.js +14 -4
  45. package/server.json +2 -2
  46. package/src/api/server.js +51 -3
@@ -105,7 +105,10 @@ function resolveLocalProjectUncached(cwd = process.cwd(), options = {}) {
105
105
  if (canonicalRemote(remote)) return projectFromRemote(remote);
106
106
  // Common git metadata gives remote-less worktrees the identity of their repository.
107
107
  if (common && path.basename(common) === '.git') root = path.dirname(common);
108
- return { projectKey: `local_${hash(`${machineIdentity(options)}\0${root}`)}`, projectName: safeProjectName(path.basename(root), 'Local project'), identitySource: 'local' };
108
+ // A session started in the home folder belongs to no project; naming it after the user's login reads like a project called "<username>".
109
+ const homeFolder = (() => { try { return fs.realpathSync(os.homedir()); } catch { return null; } })();
110
+ const projectName = homeFolder && root === homeFolder ? 'Home folder (no project)' : safeProjectName(path.basename(root), 'Local project');
111
+ return { projectKey: `local_${hash(`${machineIdentity(options)}\0${root}`)}`, projectName, identitySource: 'local' };
109
112
  }
110
113
  function legacyAlias(record = {}, options = {}) {
111
114
  const registry = options.recordType === 'agent-registry.jsonl' || record.recordType === 'agent-registry.jsonl';
@@ -566,7 +566,7 @@ const PRETOOLUSE_HOOK_GUIDE_SPEC = Object.freeze({
566
566
  ],
567
567
  [
568
568
  'Does this run locally or call a cloud service?',
569
- 'Local-first. The PreToolUse decision happens in the hook process on your machine in milliseconds — no network round-trip, no cloud dependency, no data leaving the laptop. Pro adds personal recall, exports, dashboard proof, and managed adapter coverage. Enterprise service work is qualified after intake; hosted rule sharing and a hosted org dashboard are not generally available.',
569
+ 'Local-first. The PreToolUse decision happens in the hook process on your machine in milliseconds — no network round-trip, no cloud dependency, no data leaving the laptop. Pro keeps every learned rule active and adds recall, lesson search, and exports. Enterprise service work is qualified after intake; hosted rule sharing and a hosted org dashboard are not generally available.',
570
570
  ],
571
571
  ],
572
572
  relatedPaths: ['/guides/mcp-tool-governance', '/guides/ai-agent-pre-action-approval-gates', '/guides/ai-coding-agent-zero-trust'],
@@ -449,6 +449,11 @@ function classifyTelemetryAudience(entry = {}, raw = {}, options = {}) {
449
449
  addAudienceReason(reasons, 'internal_host');
450
450
  }
451
451
 
452
+ // The CLI and server classifiers label the owner's own machines and build servers; trust that label.
453
+ if (['owner', 'ci'].includes(String(raw.visitorType || entry.visitorType || '').trim().toLowerCase())) {
454
+ addAudienceReason(reasons, 'internal_operator_or_ci');
455
+ }
456
+
452
457
  if (includesAnyToken([userAgent, ...identityValues], [
453
458
  'codex',
454
459
  'github-actions',
@@ -598,7 +603,8 @@ function sanitizeTelemetryPayload(payload = {}, headers = {}, options = {}) {
598
603
  cookies.thumbgate_acquisition_id,
599
604
  cookies.tg_aid
600
605
  ),
601
- version: pickFirstText(raw.version, raw.appVersion),
606
+ // The CLI sends its package version as `pkgVersion`; without it every CLI ping was stored with no version.
607
+ version: pickFirstText(raw.version, raw.appVersion, raw.pkgVersion),
602
608
  platform: pickFirstText(raw.platform),
603
609
  nodeVersion: pickFirstText(raw.nodeVersion),
604
610
  page: pickFirstText(raw.page, raw.landingPath, raw.path),
@@ -710,10 +716,16 @@ const WINDOW_TELEMETRY_TAIL_BYTES = Object.freeze({
710
716
  '90d': 64 * 1024 * 1024,
711
717
  });
712
718
 
719
+ // The unbounded (lifetime) window must read at least as much as any bounded window. Left
720
+ // without a budget, readTextTail() fell back to a 4 MB tail on logs over 64 MB, so lifetime
721
+ // visitors (1,950) came out below 30-day visitors (13,947) in production.
722
+ const LIFETIME_TELEMETRY_TAIL_BYTES = Math.max(...Object.values(WINDOW_TELEMETRY_TAIL_BYTES));
723
+
713
724
  function resolveBoundedTelemetryTailBytes(analyticsWindow, options = {}) {
714
725
  const explicit = Number(options.telemetryTailBytes);
715
726
  if (Number.isFinite(explicit) && explicit > 0) return explicit;
716
727
  const windowKey = analyticsWindow?.window;
728
+ if (windowKey === 'lifetime') return LIFETIME_TELEMETRY_TAIL_BYTES;
717
729
  return WINDOW_TELEMETRY_TAIL_BYTES[windowKey] || DEFAULT_BOUNDED_TELEMETRY_TAIL_BYTES;
718
730
  }
719
731
 
@@ -980,9 +992,7 @@ function summarizeExternalTrafficQuality(events) {
980
992
 
981
993
  function getTelemetrySummary(feedbackDir, options = {}) {
982
994
  const analyticsWindow = resolveAnalyticsWindow(options);
983
- const telemetryLoadOptions = analyticsWindow.bounded
984
- ? { maxBytes: resolveBoundedTelemetryTailBytes(analyticsWindow, options) }
985
- : {};
995
+ const telemetryLoadOptions = { maxBytes: resolveBoundedTelemetryTailBytes(analyticsWindow, options) };
986
996
  // readTextTail() applies an unconditional ceiling even for the unbounded
987
997
  // ("lifetime") window, so a large enough telemetry log is read as a tail.
988
998
  // Carry that fact through instead of presenting a tail as complete history.
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.9",
11
+ "version": "1.40.12",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "registryBaseUrl": "https://registry.npmjs.org",
16
16
  "identifier": "thumbgate",
17
- "version": "1.40.9",
17
+ "version": "1.40.12",
18
18
  "runtimeHint": "npx",
19
19
  "runtimeArguments": [
20
20
  {
package/src/api/server.js CHANGED
@@ -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,7 +5136,6 @@ 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' },
@@ -7558,6 +7561,13 @@ function createUnscopedApiServer({ ownerAdminDependencies = {} } = {}) {
7558
7561
  const humanReviewerConfig = getHumanReviewerConfig(expectedApiKey, expectedOperatorKey);
7559
7562
 
7560
7563
  const adminRuntime = ownerAdmin.createRuntimeObservations();
7564
+ // Owner alerts to the owner's own incoming webhook, only when THUMBGATE_OWNER_ALERT_WEBHOOK is set. Not under tests.
7565
+ if (!process.env.NODE_TEST_CONTEXT) ownerAdmin.startAlertDelivery(() => withoutDataScope(() => ({
7566
+ feedbackDir: getFeedbackPaths().FEEDBACK_DIR, buildMetadata: BUILD_METADATA, runtime: adminRuntime,
7567
+ hashDataIdentity, buildHostedTenantIdentity,
7568
+ health: () => ({ version: pkg.version, buildSha: BUILD_METADATA.buildSha, uptime: process.uptime() }),
7569
+ ...ownerAdminDependencies,
7570
+ })));
7561
7571
  const observedRequests = new WeakSet();
7562
7572
  const eventBus = new EventEmitter();
7563
7573
  eventBus.setMaxListeners(200);
@@ -8799,6 +8809,33 @@ async function addContext(){
8799
8809
  return;
8800
8810
  }
8801
8811
 
8812
+ // Short, typeable route for TikTok: captions and end cards cannot carry a clickable
8813
+ // link, so people type thumbgate.ai/tiktok. Records the hit (the telemetry layer adds
8814
+ // its own human/bot flag from the headers), then 302s to the install page with utms.
8815
+ if (isGetLikeRequest && (pathname === '/tiktok' || pathname === '/tiktok/')) {
8816
+ const tiktokQuery = '?utm_source=tiktok&utm_medium=video&utm_campaign=profile';
8817
+ const journeyState = resolveJourneyState(req, parsed);
8818
+ const tiktokParsed = new URL(`/tiktok${tiktokQuery}`, hostedConfig.appOrigin);
8819
+ const tiktokAttribution = buildLandingAttribution(tiktokParsed, req);
8820
+ appendBestEffortTelemetry(getFeedbackPaths().FEEDBACK_DIR, {
8821
+ eventType: 'landing_page_view',
8822
+ clientType: 'web',
8823
+ visitorId: journeyState.visitorId,
8824
+ sessionId: journeyState.sessionId,
8825
+ acquisitionId: journeyState.acquisitionId,
8826
+ ...tiktokAttribution,
8827
+ pageType: 'tiktok_short_link',
8828
+ }, req.headers, 'tiktok_short_link');
8829
+ res.writeHead(302, {
8830
+ ...(journeyState.setCookieHeaders.length ? { 'Set-Cookie': journeyState.setCookieHeaders } : {}),
8831
+ 'Cache-Control': 'no-store',
8832
+ 'X-Robots-Tag': 'noindex,nofollow',
8833
+ Location: `/install${tiktokQuery}`,
8834
+ });
8835
+ res.end();
8836
+ return;
8837
+ }
8838
+
8802
8839
  if (isGetLikeRequest && (
8803
8840
  pathname === '/install'
8804
8841
  || pathname === '/install.html'
@@ -11252,6 +11289,17 @@ footer{margin-top:40px;padding-top:20px;border-top:1px solid #e5e7eb;color:#6b72
11252
11289
  return;
11253
11290
  }
11254
11291
 
11292
+ // Public connectors page (linked from /pricing and the site nav).
11293
+ if (isGetLikeRequest && (pathname === '/connectors' || pathname === '/connectors/' || pathname === '/connectors.html')) {
11294
+ try {
11295
+ const connectorsPageHtml = fs.readFileSync(path.join(PUBLIC_DIR, 'connectors.html'), 'utf-8');
11296
+ sendHtml(res, 200, connectorsPageHtml, {}, { headOnly: isHeadRequest });
11297
+ } catch {
11298
+ sendText(res, 404, 'Connectors page not found');
11299
+ }
11300
+ return;
11301
+ }
11302
+
11255
11303
  // Public Remote MCP Connector Documentation.
11256
11304
  if (isGetLikeRequest && (pathname === '/docs/connectors' || pathname === '/docs/connectors/' || pathname === '/docs/connectors.html')) {
11257
11305
  try {
@@ -11772,7 +11820,7 @@ footer{margin-top:40px;padding-top:20px;border-top:1px solid #e5e7eb;color:#6b72
11772
11820
  const _token = extractBearerToken(req);
11773
11821
  if (_token && _token !== expectedApiKey) recordUsage(_token);
11774
11822
  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; }
11823
+ if (req.method === 'GET' && pathname === '/v1/projects') { sendJson(res, 200, { ...buildProjectCatalog(requestFeedbackDir, projectOptions), projectDir: projectOptions.projectDir || process.env.THUMBGATE_PROJECT_DIR || null }); return; }
11776
11824
  if (requestProjectKey != null && req.method === 'GET' && ['/v1/dashboard', '/v1/feedback/stats'].includes(pathname)) {
11777
11825
  const data = generateDashboard(requestFeedbackDir, {
11778
11826
  projectKey: requestProjectKey, ...projectOptions, humanOnly: true,