thumbgate 1.40.13 → 1.40.14
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/.claude-plugin/plugin.json +1 -1
- package/.well-known/mcp/server-card.json +1 -1
- package/adapters/claude/.mcp.json +3 -3
- package/adapters/forge/forge.yaml +3 -3
- package/adapters/future-agi/.mcp.json +1 -1
- package/adapters/future-agi/config.toml +1 -1
- package/adapters/future-agi/opencode.json +1 -1
- package/adapters/herdr/herdr-plugin.toml +2 -2
- package/adapters/mcp/server-stdio.js +18 -5
- package/adapters/opencode/opencode.json +1 -1
- package/bin/cli.js +6 -7
- package/package.json +7 -7
- package/public/index.html +2 -2
- package/public/install.html +8 -8
- package/public/numbers.html +2 -2
- package/scripts/activation-tracker.js +106 -5
- package/scripts/check-update.js +116 -1
- package/scripts/cli-feedback.js +8 -7
- package/scripts/first-block-upsell.js +30 -6
- package/scripts/owner-admin.js +1 -1
- package/scripts/owner-alerts.js +6 -1
- package/scripts/statusline-human-counts.js +52 -7
- package/server.json +2 -2
- package/src/api/server.js +31 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thumbgate",
|
|
3
3
|
"description": "One 👎 becomes a hard rule the agent cannot bypass. Captures thumbs-down feedback, distills it into PreToolUse Pre-Action Checks, enforced across every future Claude Code session.",
|
|
4
|
-
"version": "1.40.
|
|
4
|
+
"version": "1.40.14",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Igor Ganapolsky",
|
|
7
7
|
"email": "ig5973700@gmail.com",
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"thumbgate": {
|
|
4
4
|
"command": "npx",
|
|
5
|
-
"args": ["--yes", "--package", "thumbgate@1.40.
|
|
5
|
+
"args": ["--yes", "--package", "thumbgate@1.40.14", "thumbgate", "serve"]
|
|
6
6
|
}
|
|
7
7
|
},
|
|
8
8
|
"hooks": {
|
|
9
9
|
"preToolUse": {
|
|
10
10
|
"command": "npx",
|
|
11
|
-
"args": ["--yes", "--package", "thumbgate@1.40.
|
|
11
|
+
"args": ["--yes", "--package", "thumbgate@1.40.14", "thumbgate", "gate-check"]
|
|
12
12
|
},
|
|
13
13
|
"userPromptSubmit": {
|
|
14
14
|
"command": "npx",
|
|
15
|
-
"args": ["--yes", "--package", "thumbgate@1.40.
|
|
15
|
+
"args": ["--yes", "--package", "thumbgate@1.40.14", "thumbgate", "hook-auto-capture"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -9,12 +9,12 @@ version: "1"
|
|
|
9
9
|
skills:
|
|
10
10
|
thumbgate-gate-check:
|
|
11
11
|
description: "ThumbGate PreToolUse gate — blocks known-bad tool calls"
|
|
12
|
-
command: "npx --yes --package thumbgate@1.40.
|
|
12
|
+
command: "npx --yes --package thumbgate@1.40.14 thumbgate gate-check"
|
|
13
13
|
trigger: pre_tool_use
|
|
14
14
|
|
|
15
15
|
thumbgate-feedback:
|
|
16
16
|
description: "ThumbGate UserPromptSubmit guard & feedback capture — blocks pasted passwords/keys and logs safe prompt context"
|
|
17
|
-
command: "npx --yes --package thumbgate@1.40.
|
|
17
|
+
command: "npx --yes --package thumbgate@1.40.14 thumbgate hook-auto-capture"
|
|
18
18
|
trigger: user_prompt
|
|
19
19
|
|
|
20
20
|
mcp:
|
|
@@ -23,6 +23,6 @@ mcp:
|
|
|
23
23
|
args:
|
|
24
24
|
- "--yes"
|
|
25
25
|
- "--package"
|
|
26
|
-
- "thumbgate@1.40.
|
|
26
|
+
- "thumbgate@1.40.14"
|
|
27
27
|
- "thumbgate"
|
|
28
28
|
- "serve"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[plugin]
|
|
2
2
|
id = "thumbgate-approvals"
|
|
3
3
|
name = "ThumbGate Approvals"
|
|
4
|
-
version = "1.40.
|
|
4
|
+
version = "1.40.14"
|
|
5
5
|
minHerdrVersion = "0.7.0"
|
|
6
6
|
description = "Pre-action governance, spend guard, and safety approval gates for multi-agent terminal sessions in Herdr."
|
|
7
7
|
platforms = ["linux", "macos", "windows"]
|
|
@@ -12,7 +12,7 @@ category = "Security & Governance"
|
|
|
12
12
|
|
|
13
13
|
[mcp_server]
|
|
14
14
|
command = "npx"
|
|
15
|
-
args = ["--yes", "--package", "thumbgate@1.40.
|
|
15
|
+
args = ["--yes", "--package", "thumbgate@1.40.14", "thumbgate", "serve"]
|
|
16
16
|
|
|
17
17
|
[mcp_server.env]
|
|
18
18
|
THUMBGATE_ENFORCE_ENTITLEMENTS = "1"
|
|
@@ -334,7 +334,7 @@ const {
|
|
|
334
334
|
finalizeSession: finalizeFeedbackSession,
|
|
335
335
|
} = require('../../scripts/feedback-session');
|
|
336
336
|
|
|
337
|
-
const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.40.
|
|
337
|
+
const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.40.14' };
|
|
338
338
|
const COMMERCE_CATEGORIES = [
|
|
339
339
|
'product_recommendation',
|
|
340
340
|
'brand_compliance',
|
|
@@ -1124,9 +1124,11 @@ async function callToolInner(name, args) {
|
|
|
1124
1124
|
cwd: resolveWorkspaceCwd(args.cwd),
|
|
1125
1125
|
lessonId: args.lessonId,
|
|
1126
1126
|
lessonKey: args.lessonKey,
|
|
1127
|
-
// A
|
|
1128
|
-
//
|
|
1129
|
-
|
|
1127
|
+
// An agent calling this tool is not a person. A call is a person's thumb only when it carries the
|
|
1128
|
+
// user-prompt hook's tag, which the hook adds when the thumb came from the person's own message.
|
|
1129
|
+
// Everything else is recorded as automated, whatever the caller says.
|
|
1130
|
+
reviewOrigin: args.reviewOrigin === 'imported' ? 'imported'
|
|
1131
|
+
: (args.reviewOrigin === 'human' && Array.isArray(args.tags) && args.tags.includes('user-prompt-thumbs') ? 'human' : 'automated'),
|
|
1130
1132
|
}));
|
|
1131
1133
|
}
|
|
1132
1134
|
case 'feedback_summary':
|
|
@@ -1956,11 +1958,22 @@ async function handleRequest(message) {
|
|
|
1956
1958
|
return null;
|
|
1957
1959
|
}
|
|
1958
1960
|
if (message.method === 'initialize') {
|
|
1959
|
-
|
|
1961
|
+
const result = {
|
|
1960
1962
|
protocolVersion: '2024-11-05',
|
|
1961
1963
|
capabilities: { tools: {} },
|
|
1962
1964
|
serverInfo: SERVER_INFO,
|
|
1963
1965
|
};
|
|
1966
|
+
// Old hook runtimes never self-upgrade, so the (usually @latest) MCP server is the one
|
|
1967
|
+
// place that can notice the gap. Detect and report only; never install. Best-effort.
|
|
1968
|
+
try {
|
|
1969
|
+
const skewLib = require('../../scripts/check-update');
|
|
1970
|
+
const skew = skewLib.detectSkew({ currentVersion: SERVER_INFO.version });
|
|
1971
|
+
if (skew.skewed) {
|
|
1972
|
+
result.instructions = skewLib.buildSkewNotice(skew.runtimeVersion, skew.currentVersion);
|
|
1973
|
+
skewLib.reportSkewOnce({ skew });
|
|
1974
|
+
}
|
|
1975
|
+
} catch { /* never fail initialize */ }
|
|
1976
|
+
return result;
|
|
1964
1977
|
}
|
|
1965
1978
|
if (message.method === 'ping') return {};
|
|
1966
1979
|
if (message.method === 'tools/list') return { tools: getExposedTools() };
|
package/bin/cli.js
CHANGED
|
@@ -34,20 +34,17 @@ const PRO_CHECKOUT_URL = PRO_MONTHLY_PAYMENT_LINK;
|
|
|
34
34
|
const TRIAL_DAYS = 7;
|
|
35
35
|
|
|
36
36
|
function checkoutUrlFor(source, content) {
|
|
37
|
+
// Every CLI upgrade link goes through thumbgate.ai/go/pro, never a raw Stripe payment link:
|
|
38
|
+
// only that route attributes the click, opens a session tied to the buyer, and provisions the key.
|
|
37
39
|
try {
|
|
38
|
-
const
|
|
39
|
-
? 'https://buy.stripe.com/7sYfZhaiE1eSbO99uj3sI0d'
|
|
40
|
-
: PRO_CHECKOUT_URL;
|
|
41
|
-
const url = new URL(base);
|
|
40
|
+
const url = new URL(PRO_CHECKOUT_URL);
|
|
42
41
|
url.searchParams.set('utm_source', source || 'cli');
|
|
43
42
|
url.searchParams.set('utm_medium', 'cli');
|
|
44
43
|
url.searchParams.set('utm_campaign', 'pro_conversion');
|
|
45
44
|
if (content) url.searchParams.set('utm_content', content);
|
|
46
45
|
return url.toString();
|
|
47
46
|
} catch (_) {
|
|
48
|
-
return
|
|
49
|
-
? 'https://buy.stripe.com/7sYfZhaiE1eSbO99uj3sI0d'
|
|
50
|
-
: PRO_CHECKOUT_URL;
|
|
47
|
+
return PRO_CHECKOUT_URL;
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
|
|
@@ -225,6 +222,8 @@ function limitNudge(action, limitResult = {}) {
|
|
|
225
222
|
const reason = limitResult.message
|
|
226
223
|
? String(limitResult.message).split('\n')[0]
|
|
227
224
|
: 'Free tier limit reached.';
|
|
225
|
+
// The free-tier wall is an upgrade moment; count it so the funnel can see it.
|
|
226
|
+
try { trackEvent('cli_limit_hit', { action, limitType: limitResult.limitType || null }); } catch (_) { /* best-effort */ }
|
|
228
227
|
process.stderr.write(
|
|
229
228
|
`\n 🔒 ${reason}\n` +
|
|
230
229
|
usageLine +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thumbgate",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.14",
|
|
4
4
|
"description": "ThumbGate Pre-Action Checks self-improve from ranked lessons and repeated failures, hard-block detected secret leaks, and block matches in strict mode.",
|
|
5
5
|
"homepage": "https://thumbgate.ai",
|
|
6
6
|
"repository": {
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
"test:thumbgate-skill": "node --test tests/thumbgate-skill.test.js",
|
|
842
842
|
"test:discoverable-skills": "node --test tests/discoverable-skills.test.js",
|
|
843
843
|
"test:discoverable-skill-skills": "node --test tests/discoverable-skill-skills.test.js",
|
|
844
|
-
"test:statusline": "node --test tests/claude-feedback-sync.test.js tests/statusline.test.js tests/statusline-aggregation.test.js tests/statusline-context.test.js tests/statusline-links.test.js tests/statusline-e2e.test.js tests/statusline-human-counts.test.js tests/statusline-human-counts-env.test.js",
|
|
844
|
+
"test:statusline": "node --test tests/claude-feedback-sync.test.js tests/statusline.test.js tests/statusline-aggregation.test.js tests/statusline-context.test.js tests/statusline-links.test.js tests/statusline-e2e.test.js tests/statusline-human-counts.test.js tests/statusline-human-counts-env.test.js tests/statusline-fake-thumbs.test.js tests/e2e/one-count.e2e.test.js",
|
|
845
845
|
"test:statusline-cache-aggregate": "node --test tests/statusline-cache-aggregate.test.js",
|
|
846
846
|
"test:no-internal-orchestration-leaks": "node --test tests/no-internal-orchestration-leaks.test.js",
|
|
847
847
|
"test:memory-dedup": "node --test tests/memory-dedup.test.js",
|
|
@@ -1232,7 +1232,7 @@
|
|
|
1232
1232
|
"test:mcp-oauth-reviewer": "node --test tests/mcp-oauth-reviewer.test.js",
|
|
1233
1233
|
"test:dashboard-chat": "node --test tests/dashboard-chat.test.js",
|
|
1234
1234
|
"test:gitar-integration": "node --test tests/gitar-integration.test.js",
|
|
1235
|
-
"test:api": "node --test --test-concurrency=1 tests/api-server.test.js tests/api-events-sse.test.js tests/api-auth-config.test.js tests/mcp-server.test.js tests/adapters.test.js tests/openapi-parity.test.js tests/budget-guard.test.js tests/context-manager.test.js tests/contextfs.test.js tests/job-api.test.js tests/pack-templates.test.js tests/dashboard.test.js tests/dashboard-jsonl-bound.test.js tests/dashboard-limits.test.js tests/cli-progress.test.js tests/dashboard-render-spec.test.js tests/dashboard-html.test.js tests/agent-readiness.test.js tests/progressive-signoff.test.js tests/mcp-policy.test.js tests/subagent-profiles.test.js tests/intent-router.test.js tests/internal-agent-bootstrap.test.js tests/lesson-search.test.js tests/thumbgate-search.test.js tests/document-intake.test.js tests/rubric-engine.test.js tests/self-healing-check.test.js tests/self-heal.test.js tests/feedback-schema.test.js tests/thompson-sampling.test.js tests/feedback-sequences.test.js tests/diversity-tracking.test.js tests/vector-store.test.js tests/gemini-embedding-policy.test.js tests/feedback-attribution.test.js tests/hybrid-feedback-context.test.js tests/loop-closure.test.js tests/code-reasoning.test.js tests/feedback-loop.test.js tests/feedback-inbox-read.test.js tests/feedback-to-memory.test.js tests/test-coverage.test.js tests/version-metadata.test.js tests/claude-mcpb.test.js tests/claude-codex-bridge.test.js tests/cursor-plugin.test.js tests/codex-plugin.test.js tests/ide-marketplace-extensions.test.js tests/telemetry-analytics.test.js tests/claude-first-claims.test.js tests/public-landing.test.js tests/lessons-page.test.js tests/pro-landing.test.js tests/local-model-profile.test.js tests/risk-scorer.test.js tests/context-compaction.test.js tests/reminder-engine.test.js tests/verification-loop.test.js tests/async-job-runner.test.js tests/commerce-quality.test.js tests/recall-limit.test.js tests/problem-detail.test.js tests/natural-language-harness.test.js tests/settings-hierarchy.test.js tests/classifier-routing.test.js tests/dashboard-response-cache.test.js tests/onboarding-first-block.test.js tests/sso-authorize-no-typed-email.test.js tests/admin-board.test.js tests/sso-next-redirect.test.js tests/admin-money-labels.test.js tests/admin-observability.test.js tests/funnel-copy.test.js tests/owner-money-stripe.test.js",
|
|
1235
|
+
"test:api": "node --test --test-concurrency=1 tests/api-server.test.js tests/api-events-sse.test.js tests/api-auth-config.test.js tests/mcp-server.test.js tests/adapters.test.js tests/openapi-parity.test.js tests/budget-guard.test.js tests/context-manager.test.js tests/contextfs.test.js tests/job-api.test.js tests/pack-templates.test.js tests/dashboard.test.js tests/dashboard-jsonl-bound.test.js tests/dashboard-limits.test.js tests/cli-progress.test.js tests/dashboard-render-spec.test.js tests/dashboard-html.test.js tests/agent-readiness.test.js tests/progressive-signoff.test.js tests/mcp-policy.test.js tests/subagent-profiles.test.js tests/intent-router.test.js tests/internal-agent-bootstrap.test.js tests/lesson-search.test.js tests/thumbgate-search.test.js tests/document-intake.test.js tests/rubric-engine.test.js tests/self-healing-check.test.js tests/self-heal.test.js tests/feedback-schema.test.js tests/thompson-sampling.test.js tests/feedback-sequences.test.js tests/diversity-tracking.test.js tests/vector-store.test.js tests/gemini-embedding-policy.test.js tests/feedback-attribution.test.js tests/hybrid-feedback-context.test.js tests/loop-closure.test.js tests/code-reasoning.test.js tests/feedback-loop.test.js tests/feedback-inbox-read.test.js tests/feedback-to-memory.test.js tests/test-coverage.test.js tests/version-metadata.test.js tests/claude-mcpb.test.js tests/claude-codex-bridge.test.js tests/cursor-plugin.test.js tests/codex-plugin.test.js tests/ide-marketplace-extensions.test.js tests/telemetry-analytics.test.js tests/claude-first-claims.test.js tests/public-landing.test.js tests/lessons-page.test.js tests/pro-landing.test.js tests/local-model-profile.test.js tests/risk-scorer.test.js tests/context-compaction.test.js tests/reminder-engine.test.js tests/verification-loop.test.js tests/async-job-runner.test.js tests/commerce-quality.test.js tests/recall-limit.test.js tests/problem-detail.test.js tests/natural-language-harness.test.js tests/settings-hierarchy.test.js tests/classifier-routing.test.js tests/dashboard-response-cache.test.js tests/onboarding-first-block.test.js tests/activation-first-block-delivery.test.js tests/runtime-version-skew.test.js tests/sso-authorize-no-typed-email.test.js tests/admin-board.test.js tests/sso-next-redirect.test.js tests/admin-money-labels.test.js tests/admin-observability.test.js tests/funnel-copy.test.js tests/owner-money-stripe.test.js",
|
|
1236
1236
|
"test:leak-scanner": "node --test tests/leak-scanner.test.js",
|
|
1237
1237
|
"test:tool-contract-validator": "node --test tests/tool-contract-validator.test.js",
|
|
1238
1238
|
"test:letta-adapter": "node --test tests/letta-adapter.test.js",
|
|
@@ -1309,7 +1309,7 @@
|
|
|
1309
1309
|
"test:adapter-pins": "node --test tests/adapter-version-pins.test.js",
|
|
1310
1310
|
"test:secret-egress": "node --test tests/secret-egress-gate.test.js",
|
|
1311
1311
|
"test:harness-tool-names": "node --test tests/harness-tool-names.test.js",
|
|
1312
|
-
"test:feedback-reward": "node --test tests/feedback-reward-score.test.js",
|
|
1312
|
+
"test:feedback-reward": "node --test tests/feedback-reward-score.test.js tests/feedback-thumbs-down-promotion.test.js",
|
|
1313
1313
|
"test:capability-wiring": "node --test tests/capability-wiring-ratchet.test.js && node --test tests/prove-vlt-dogfood.test.js && node --test tests/context-engineering-checklist.test.js",
|
|
1314
1314
|
"test:llm-gateway": "node --test tests/llm-gateway-provider.test.js",
|
|
1315
1315
|
"test:request-envelope": "node --test tests/request-envelope.test.js",
|
|
@@ -1533,7 +1533,7 @@
|
|
|
1533
1533
|
},
|
|
1534
1534
|
"dependencies": {
|
|
1535
1535
|
"@anthropic-ai/sdk": "^1.3.0",
|
|
1536
|
-
"@google/genai": "3.
|
|
1536
|
+
"@google/genai": "3.6.1",
|
|
1537
1537
|
"@lancedb/lancedb": "^0.41.0",
|
|
1538
1538
|
"apache-arrow": "^18.1.0",
|
|
1539
1539
|
"better-sqlite3": "^12.11.1",
|
|
@@ -1558,7 +1558,7 @@
|
|
|
1558
1558
|
"js-yaml": "5.5.0",
|
|
1559
1559
|
"sharp": "0.35.5",
|
|
1560
1560
|
"shell-quote": "1.12.0",
|
|
1561
|
-
"undici": "8.
|
|
1561
|
+
"undici": "8.13.1",
|
|
1562
1562
|
"test-exclude": {
|
|
1563
1563
|
"glob": "14.0.3",
|
|
1564
1564
|
"minimatch": "11.0.4"
|
|
@@ -1571,7 +1571,7 @@
|
|
|
1571
1571
|
"@playwright/test": "^1.62.1",
|
|
1572
1572
|
"c8": "^12.0.0",
|
|
1573
1573
|
"launch-editor": "^2.14.2",
|
|
1574
|
-
"undici": "8.
|
|
1574
|
+
"undici": "8.13.1"
|
|
1575
1575
|
},
|
|
1576
1576
|
"hotfix": "gate-check-bypass-2026-06-03"
|
|
1577
1577
|
}
|
package/public/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<meta name="generator" content="ThumbGate">
|
|
7
7
|
<meta name="author" content="Igor Ganapolsky">
|
|
8
|
-
<meta name="thumbgate-version" content="1.40.
|
|
8
|
+
<meta name="thumbgate-version" content="1.40.14">
|
|
9
9
|
__GOOGLE_SITE_VERIFICATION_META__
|
|
10
10
|
<link rel="icon" type="image/png" href="/thumbgate-icon.png">
|
|
11
11
|
<link rel="canonical" href="__APP_ORIGIN__/">
|
|
@@ -1047,7 +1047,7 @@ $ ... "rm -rf ~/"
|
|
|
1047
1047
|
|
|
1048
1048
|
<footer>
|
|
1049
1049
|
<div class="shell footer-inner">
|
|
1050
|
-
<span>ThumbGate · MIT License · npm v1.40.
|
|
1050
|
+
<span>ThumbGate · MIT License · npm v1.40.14</span>
|
|
1051
1051
|
<div class="footer-links">
|
|
1052
1052
|
<a href="https://github.com/IgorGanapolsky/ThumbGate" target="_blank" rel="noopener">GitHub</a>
|
|
1053
1053
|
<a href="/guide">Technical setup</a>
|
package/public/install.html
CHANGED
|
@@ -140,7 +140,7 @@ __GA_BOOTSTRAP__
|
|
|
140
140
|
<a class="btn-secondary" href="/diagnostic?utm_source=install_page&utm_medium=owned_page&utm_campaign=marketplace_distribution">$499 Setup Sprint (separate)</a>
|
|
141
141
|
</div>
|
|
142
142
|
<div class="proof-strip" aria-label="Verified live distribution surfaces">
|
|
143
|
-
<div class="proof"><strong>npm</strong><span>thumbgate@1.40.
|
|
143
|
+
<div class="proof"><strong>npm</strong><span>thumbgate@1.40.14</span></div>
|
|
144
144
|
<div class="proof"><strong>VS Code</strong><span>Marketplace version live</span></div>
|
|
145
145
|
<div class="proof"><strong>Open VSX</strong><span>Antigravity-compatible path</span></div>
|
|
146
146
|
<div class="proof"><strong>MCP Registry</strong><span>1.39.1 is latest</span></div>
|
|
@@ -154,12 +154,12 @@ __GA_BOOTSTRAP__
|
|
|
154
154
|
<p class="section-lede">Use the local CLI path for immediate enforcement. Use marketplace installs where your editor supports them. Use the diagnostic path when you need a human-reviewed gate map for one risky workflow. New install: <a href="/guides/progressive-wiring">prove the pipe first</a> (doctor green, empty dashboard OK) before expecting a gate to fire.</p>
|
|
155
155
|
<div class="grid">
|
|
156
156
|
<article class="card" id="quickstart"><h3>First gate block in one command</h3><p>Promote your first prevention rule and watch ThumbGate stop a repeat mistake. Free includes the built-in rules and 3 learned rules, after a 7-day local Pro trial.</p><pre><code>npx thumbgate quickstart</code></pre></article>
|
|
157
|
-
<article class="card"><h3>CLI and MCP-compatible agents</h3><p>Fastest path for Claude Code, Cursor, Codex, Gemini CLI, Amp, Cline, OpenCode, and local MCP-compatible agents.</p><pre><code>npx -y thumbgate@1.40.
|
|
158
|
-
npx -y thumbgate@1.40.
|
|
159
|
-
npx -y thumbgate@1.40.
|
|
160
|
-
<article class="card"><h3>Claude Desktop</h3><p>Use the npm-backed MCP server today. The Claude Desktop `.mcpb` directory submission packet is prepared separately.</p><pre><code>claude mcp add thumbgate -- npx --yes --package thumbgate@1.40.
|
|
161
|
-
<article class="card"><h3>Cursor</h3><p>The public Cursor Marketplace listing is not live yet. Use the CLI wiring while the dashboard submission is resolved.</p><pre><code>npx -y thumbgate@1.40.
|
|
162
|
-
<article class="card"><h3>Codex</h3><p>Use the local adapter now. Public Codex self-serve plugin publishing is not open yet, so the GitHub Release asset is the distribution proof.</p><pre><code>npx -y thumbgate@1.40.
|
|
157
|
+
<article class="card"><h3>CLI and MCP-compatible agents</h3><p>Fastest path for Claude Code, Cursor, Codex, Gemini CLI, Amp, Cline, OpenCode, and local MCP-compatible agents.</p><pre><code>npx -y thumbgate@1.40.14 init --agent claude
|
|
158
|
+
npx -y thumbgate@1.40.14 doctor
|
|
159
|
+
npx -y thumbgate@1.40.14 doctor --fix</code></pre></article>
|
|
160
|
+
<article class="card"><h3>Claude Desktop</h3><p>Use the npm-backed MCP server today. The Claude Desktop `.mcpb` directory submission packet is prepared separately.</p><pre><code>claude mcp add thumbgate -- npx --yes --package thumbgate@1.40.14 thumbgate serve</code></pre></article>
|
|
161
|
+
<article class="card"><h3>Cursor</h3><p>The public Cursor Marketplace listing is not live yet. Use the CLI wiring while the dashboard submission is resolved.</p><pre><code>npx -y thumbgate@1.40.14 init --agent cursor</code></pre></article>
|
|
162
|
+
<article class="card"><h3>Codex</h3><p>Use the local adapter now. Public Codex self-serve plugin publishing is not open yet, so the GitHub Release asset is the distribution proof.</p><pre><code>npx -y thumbgate@1.40.14 init --agent codex</code></pre></article>
|
|
163
163
|
<article class="card" id="grok"><h3>Grok</h3><p>Grok Build CLI. There is no Grok store listing. This command adds the npm server. <code>npx thumbgate init</code> also writes the Claude-style config Grok reads.</p><pre><code>grok mcp add thumbgate -- npx -y thumbgate mcp</code></pre></article>
|
|
164
164
|
<article class="card" id="hermes"><h3>Hermes</h3><p>Local hook for Nous Research Hermes. Merge <code>adapters/hermes/config.yaml</code> into <code>~/.hermes/config.yaml</code>. There is no Hermes directory listing.</p><pre><code>npx --yes --package thumbgate thumbgate hermes-gate</code></pre></article>
|
|
165
165
|
</div>
|
|
@@ -170,7 +170,7 @@ npx -y thumbgate@1.40.13 doctor --fix</code></pre></article>
|
|
|
170
170
|
<h2>Verified public surfaces.</h2>
|
|
171
171
|
<p class="section-lede">These are the surfaces safe to claim in public copy right now. Pending surfaces are listed so buyers do not get sent to dead marketplace pages.</p>
|
|
172
172
|
<div class="status-list">
|
|
173
|
-
<div class="status"><span class="badge live">LIVE</span><div><strong><a href="https://www.npmjs.com/package/thumbgate">npm package</a></strong><span>`thumbgate@1.40.
|
|
173
|
+
<div class="status"><span class="badge live">LIVE</span><div><strong><a href="https://www.npmjs.com/package/thumbgate">npm package</a></strong><span>`thumbgate@1.40.14` is the canonical runtime install.</span></div></div>
|
|
174
174
|
<div class="status"><span class="badge live">LIVE</span><div><strong><a href="https://marketplace.visualstudio.com/items?itemName=igorganapolsky.thumbgate">VS Code Marketplace</a></strong><span>Latest Marketplace version is `1.28.1`, behind npm. For the current version, use Open VSX or the GitHub Release VSIX.</span></div></div>
|
|
175
175
|
<div class="status"><span class="badge live">LIVE</span><div><strong><a href="https://open-vsx.org/extension/igorganapolsky/thumbgate">Open VSX</a></strong><span>Public registry latest version is `1.40.10`; use this path for VS Code-compatible IDEs that consume Open VSX.</span></div></div>
|
|
176
176
|
<div class="status"><span class="badge live">LIVE</span><div><strong><a href="https://registry.modelcontextprotocol.io/v0/servers?search=thumbgate">MCP Registry</a></strong><span>Public search returns `io.github.IgorGanapolsky/thumbgate` version `1.39.1` as latest.</span></div></div>
|
package/public/numbers.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"alternateName": "thumbgate",
|
|
27
27
|
"applicationCategory": "DeveloperApplication",
|
|
28
28
|
"operatingSystem": "Cross-platform, Node.js >=18.18.0",
|
|
29
|
-
"softwareVersion": "1.40.
|
|
29
|
+
"softwareVersion": "1.40.14",
|
|
30
30
|
"url": "https://thumbgate-production.up.railway.app/numbers",
|
|
31
31
|
"dateModified": "2026-11-12",
|
|
32
32
|
"creator": {
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
<main class="container">
|
|
202
202
|
<h1>The Numbers</h1>
|
|
203
203
|
<p class="subtitle">Generated first-party operational snapshot from the ThumbGate runtime. This is not customer traction, install volume, revenue, or proof that a configured gate has fired.</p>
|
|
204
|
-
<div class="freshness">Updated: 2026-11-12 · Version 1.40.
|
|
204
|
+
<div class="freshness">Updated: 2026-11-12 · Version 1.40.14</div>
|
|
205
205
|
<div class="truth-note"><strong>Read this first:</strong> configured checks are inventory. Recorded blocks and warnings are usage evidence. This snapshot currently reports 8,602 recorded hard-block event(s) and 2 recorded warning event(s).</div>
|
|
206
206
|
|
|
207
207
|
<h2>Gate enforcement</h2>
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* is a no-op for the lifetime of that install.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
const crypto = require('node:crypto');
|
|
27
28
|
const fs = require('node:fs');
|
|
28
29
|
const { spawn } = require('node:child_process');
|
|
29
30
|
const http = require('node:http');
|
|
@@ -186,6 +187,11 @@ function resolveActivationAccountAuth(options = {}) {
|
|
|
186
187
|
return { apiKey, apiBaseUrl };
|
|
187
188
|
}
|
|
188
189
|
|
|
190
|
+
// A short one-way fingerprint, so the marker file never stores the key itself.
|
|
191
|
+
function hashKeyForMarker(apiKey) {
|
|
192
|
+
return crypto.createHash('sha256').update(String(apiKey)).digest('hex').slice(0, 16);
|
|
193
|
+
}
|
|
194
|
+
|
|
189
195
|
function postActivationEvent(endpointUrl, apiKey, bodyObj, awaitDelivery = false) {
|
|
190
196
|
const payload = JSON.stringify(bodyObj);
|
|
191
197
|
const parsed = new URL(endpointUrl);
|
|
@@ -248,7 +254,13 @@ function reportFirstBlockActivation(metadata = {}) {
|
|
|
248
254
|
const firstBlockAt = existing.firstBlockAt || metadata.firstBlockAt || existing.blockedAt || new Date().toISOString();
|
|
249
255
|
const { apiKey, apiBaseUrl } = resolveActivationAccountAuth(metadata);
|
|
250
256
|
|
|
251
|
-
|
|
257
|
+
const keyAlreadyRejected = Boolean(
|
|
258
|
+
apiKey
|
|
259
|
+
&& existing.firstBlockAnonReportedAt
|
|
260
|
+
&& existing.firstBlockAuthRejectedKeyHash
|
|
261
|
+
&& existing.firstBlockAuthRejectedKeyHash === hashKeyForMarker(apiKey)
|
|
262
|
+
);
|
|
263
|
+
if (existing.firstBlockReportedAt || (!apiKey && existing.firstBlockAnonReportedAt) || keyAlreadyRejected) {
|
|
252
264
|
if (!existing.firstBlockAt || existing.event !== 'first_block') {
|
|
253
265
|
writeJsonSafe(markerPath, { ...existing, firstBlockAt, event: 'first_block', at: existing.at || firstBlockAt });
|
|
254
266
|
}
|
|
@@ -283,6 +295,8 @@ function reportFirstBlockActivation(metadata = {}) {
|
|
|
283
295
|
clientType: 'cli',
|
|
284
296
|
firstBlockAt,
|
|
285
297
|
installId,
|
|
298
|
+
// Without this the server classifies the event by User-Agent (node sends none) as a bot.
|
|
299
|
+
visitorType: (() => { try { return classifyInstall(); } catch { return undefined; } })(),
|
|
286
300
|
...(gateId ? { gateId: String(gateId).slice(0, 120) } : {}),
|
|
287
301
|
};
|
|
288
302
|
|
|
@@ -292,6 +306,27 @@ function reportFirstBlockActivation(metadata = {}) {
|
|
|
292
306
|
? `${apiBaseUrl}/v1/activation/first-block`
|
|
293
307
|
: `${apiBaseUrl}/v1/telemetry/ping`;
|
|
294
308
|
return postActivationEvent(targetUrl, apiKey, eventPayload, true).then((res) => {
|
|
309
|
+
if (!res.ok && apiKey && (res.statusCode === 401 || res.statusCode === 403)) {
|
|
310
|
+
// The stored key no longer authenticates (rotated operator key, expired
|
|
311
|
+
// trial, wrong host). Don't lose the activation: report it anonymously,
|
|
312
|
+
// and remember the rejected key so every later gate firing stops retrying
|
|
313
|
+
// the account route with it.
|
|
314
|
+
const rejectedKeyHash = hashKeyForMarker(apiKey);
|
|
315
|
+
return postActivationEvent(`${apiBaseUrl}/v1/telemetry/ping`, '', eventPayload, true).then((anon) => {
|
|
316
|
+
const latest = readJsonSafe(markerPath) || nextMarker;
|
|
317
|
+
const stamp = new Date().toISOString();
|
|
318
|
+
writeJsonSafe(markerPath, {
|
|
319
|
+
...latest,
|
|
320
|
+
at: latest.at || firstBlockAt,
|
|
321
|
+
firstBlockAt: latest.firstBlockAt || firstBlockAt,
|
|
322
|
+
event: 'first_block',
|
|
323
|
+
firstBlockAuthRejectedKeyHash: rejectedKeyHash,
|
|
324
|
+
firstBlockAuthRejectedAt: stamp,
|
|
325
|
+
...(anon.ok ? { firstBlockAnonReportedAt: stamp } : {}),
|
|
326
|
+
});
|
|
327
|
+
return { reported: Boolean(anon.ok), statusCode: res.statusCode, fallback: 'anonymous', firstBlockAt };
|
|
328
|
+
});
|
|
329
|
+
}
|
|
295
330
|
if (res.ok) {
|
|
296
331
|
const latest = readJsonSafe(markerPath) || nextMarker;
|
|
297
332
|
const stamp = new Date().toISOString();
|
|
@@ -347,19 +382,84 @@ function extractEntryBlockMinutes(e) {
|
|
|
347
382
|
return typeof ms === 'number' && Number.isFinite(ms) ? Math.round((ms / 60_000) * 10) / 10 : null;
|
|
348
383
|
}
|
|
349
384
|
|
|
385
|
+
const FIRST_BLOCK_EVENT_NAMES = new Set(['first_block', 'first_blocked_tool_call']);
|
|
386
|
+
const CHECKOUT_VIEW_EVENTS = new Set(['checkout_interstitial_view']);
|
|
387
|
+
const CHECKOUT_CLICK_EVENTS = new Set(['checkout_interstitial_cta_clicked', 'stripe_redirect_started', 'checkout_start']);
|
|
388
|
+
const CHECKOUT_PAID_EVENTS = new Set(['checkout_success_page_view']);
|
|
389
|
+
|
|
390
|
+
function isInternalEntry(e) {
|
|
391
|
+
return e.visitorType === 'bot' || e.visitorType === 'ci' || e.visitorType === 'owner';
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function isCliAttributed(e) {
|
|
395
|
+
const source = String(e.utmSource || e.source || '').toLowerCase();
|
|
396
|
+
return source === 'cli' || source.startsWith('cli_');
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* The activated -> upgrade-shown -> checkout funnel, counted per install (CLI stages) and per
|
|
401
|
+
* event (web stages that carry utm_source=cli). See docs/decisions/2026-11-24-revenue-funnel-activation.md.
|
|
402
|
+
*/
|
|
403
|
+
function summarizeActivationFunnel(entries = []) {
|
|
404
|
+
const installs = new Set();
|
|
405
|
+
const activated = new Set();
|
|
406
|
+
const upsellShown = new Set();
|
|
407
|
+
const limitHit = new Set();
|
|
408
|
+
const funnel = { cliCheckoutViews: 0, cliCheckoutClicks: 0, cliCheckoutPaidPageViews: 0, firstBlockCheckoutViews: 0 };
|
|
409
|
+
for (const e of Array.isArray(entries) ? entries : []) {
|
|
410
|
+
if (!e || isInternalEntry(e)) continue;
|
|
411
|
+
const type = e.eventType || e.event || '';
|
|
412
|
+
if (e.installId && (e.clientType === 'cli' || e.client === 'cli')) installs.add(e.installId);
|
|
413
|
+
if (e.installId && FIRST_BLOCK_EVENT_NAMES.has(type)) activated.add(e.installId);
|
|
414
|
+
if (e.installId && type === 'first_block_upsell_shown') upsellShown.add(e.installId);
|
|
415
|
+
if (e.installId && type === 'cli_limit_hit') limitHit.add(e.installId);
|
|
416
|
+
if (!isCliAttributed(e)) continue;
|
|
417
|
+
if (CHECKOUT_VIEW_EVENTS.has(type)) {
|
|
418
|
+
funnel.cliCheckoutViews += 1;
|
|
419
|
+
if (String(e.utmMedium || '').toLowerCase() === 'first_block') funnel.firstBlockCheckoutViews += 1;
|
|
420
|
+
}
|
|
421
|
+
if (CHECKOUT_CLICK_EVENTS.has(type)) funnel.cliCheckoutClicks += 1;
|
|
422
|
+
if (CHECKOUT_PAID_EVENTS.has(type)) funnel.cliCheckoutPaidPageViews += 1;
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
cliInstalls: installs.size,
|
|
426
|
+
activatedInstalls: activated.size,
|
|
427
|
+
upsellShownInstalls: upsellShown.size,
|
|
428
|
+
limitHitInstalls: limitHit.size,
|
|
429
|
+
...funnel,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
350
433
|
function summarizeFirstBlockEvents(entries = []) {
|
|
351
434
|
if (!Array.isArray(entries) || entries.length === 0) {
|
|
352
435
|
return { count: 0, medianMinutes: null, under5MinutesCount: 0 };
|
|
353
436
|
}
|
|
354
437
|
let count = 0;
|
|
355
438
|
const minutesList = [];
|
|
439
|
+
// installId -> its timing sample (null until an event for it carries one). The count is per
|
|
440
|
+
// install, but the timing may arrive on a later event of the same install (first_block carries
|
|
441
|
+
// none; first_blocked_tool_call carries minutesSinceInstall), so pick it independently.
|
|
442
|
+
const installTiming = new Map();
|
|
356
443
|
for (const e of entries) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
444
|
+
// Production CLIs report the activation as `first_block` (reportFirstBlockActivation);
|
|
445
|
+
// older builds sent `first_blocked_tool_call`. Count either, once per install.
|
|
446
|
+
if (!FIRST_BLOCK_EVENT_NAMES.has(e?.eventType || e?.event)) continue;
|
|
447
|
+
if (e.visitorType === 'bot' || e.visitorType === 'ci' || e.visitorType === 'owner') continue;
|
|
360
448
|
const m = extractEntryBlockMinutes(e);
|
|
361
|
-
|
|
449
|
+
const sample = m !== null && m >= 0 ? m : null;
|
|
450
|
+
if (e.installId) {
|
|
451
|
+
if (!installTiming.has(e.installId)) {
|
|
452
|
+
installTiming.set(e.installId, sample);
|
|
453
|
+
count += 1;
|
|
454
|
+
} else if (installTiming.get(e.installId) === null && sample !== null) {
|
|
455
|
+
installTiming.set(e.installId, sample);
|
|
456
|
+
}
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
count += 1;
|
|
460
|
+
if (sample !== null) minutesList.push(sample);
|
|
362
461
|
}
|
|
462
|
+
for (const sample of installTiming.values()) if (sample !== null) minutesList.push(sample);
|
|
363
463
|
if (count === 0 || minutesList.length === 0) {
|
|
364
464
|
return { count, medianMinutes: null, under5MinutesCount: 0 };
|
|
365
465
|
}
|
|
@@ -389,6 +489,7 @@ module.exports = {
|
|
|
389
489
|
reportFirstBlockActivation,
|
|
390
490
|
resolveActivationAccountAuth,
|
|
391
491
|
summarizeFirstBlockEvents,
|
|
492
|
+
summarizeActivationFunnel,
|
|
392
493
|
computeDaysSinceInstall,
|
|
393
494
|
computeMinutesSinceInstall,
|
|
394
495
|
readMarker,
|
package/scripts/check-update.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const https = require('https');
|
|
7
|
-
const
|
|
7
|
+
const os = require('os');
|
|
8
|
+
const { execSync, execFileSync } = require('child_process');
|
|
8
9
|
|
|
9
10
|
const PROJECT_ROOT = path.join(__dirname, '..');
|
|
10
11
|
const GITHUB_REPO = 'IgorGanapolsky/ThumbGate';
|
|
@@ -196,6 +197,104 @@ async function checkUpdate(options = {}) {
|
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
|
|
200
|
+
// Hook runtime version skew: hooks run the cached ~/.thumbgate/runtime, which never
|
|
201
|
+
// auto-upgrades by design. Detect and report only; never install.
|
|
202
|
+
// See docs/decisions/2026-11-24-revenue-funnel-activation.md (loop 2).
|
|
203
|
+
|
|
204
|
+
const SKEW_REPORT_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
205
|
+
const STATE_FILE = 'runtime-skew-reported.json';
|
|
206
|
+
const UPDATE_COMMAND = 'npx thumbgate@latest self-update';
|
|
207
|
+
|
|
208
|
+
function runtimeDir(env = process.env) {
|
|
209
|
+
const home = env.HOME || env.USERPROFILE || os.homedir();
|
|
210
|
+
return path.join(home, '.thumbgate', 'runtime');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function readRuntimeVersion(dir = runtimeDir()) {
|
|
214
|
+
try {
|
|
215
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(dir, 'node_modules', 'thumbgate', 'package.json'), 'utf8'));
|
|
216
|
+
return typeof pkg.version === 'string' ? pkg.version : null;
|
|
217
|
+
} catch {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function parse(v) {
|
|
223
|
+
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(String(v || ''));
|
|
224
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function isOlder(a, b) {
|
|
228
|
+
const pa = parse(a);
|
|
229
|
+
const pb = parse(b);
|
|
230
|
+
if (!pa || !pb) return false;
|
|
231
|
+
for (let i = 0; i < 3; i += 1) {
|
|
232
|
+
if (pa[i] !== pb[i]) return pa[i] < pb[i];
|
|
233
|
+
}
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** @returns {{ skewed: boolean, runtimeVersion: string|null, currentVersion: string }} */
|
|
238
|
+
function detectSkew({ currentVersion, dir } = {}) {
|
|
239
|
+
const runtimeVersion = readRuntimeVersion(dir);
|
|
240
|
+
return { skewed: Boolean(runtimeVersion && isOlder(runtimeVersion, currentVersion)), runtimeVersion, currentVersion };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function buildSkewNotice(runtimeVersion, currentVersion) {
|
|
244
|
+
return `ThumbGate's hooks on this machine run v${runtimeVersion}, but v${currentVersion} is installed for the MCP server, `
|
|
245
|
+
+ `so fixes since v${runtimeVersion} are not active in the hooks. If the person asks about ThumbGate or its gates, `
|
|
246
|
+
+ `tell them once that \`${UPDATE_COMMAND}\` updates the hooks.`;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Send one `runtime_version_skew` ping per 24h per machine. Never throws, never blocks.
|
|
251
|
+
* `track` defaults to cli-telemetry.trackEvent and is skipped under the node test runner.
|
|
252
|
+
*/
|
|
253
|
+
function reportSkewOnce({ skew, env = process.env, now = Date.now(), stateDir, track } = {}) {
|
|
254
|
+
try {
|
|
255
|
+
if (!skew || !skew.skewed) return false;
|
|
256
|
+
if (env.THUMBGATE_NO_TELEMETRY === '1' || env.DO_NOT_TRACK === '1') return false;
|
|
257
|
+
const send = track || ((eventType, metadata) => {
|
|
258
|
+
if (env.NODE_TEST_CONTEXT || process.env.NODE_TEST_CONTEXT) return;
|
|
259
|
+
require('./cli-telemetry').trackEvent(eventType, metadata);
|
|
260
|
+
});
|
|
261
|
+
const dir = stateDir || path.join(path.dirname(runtimeDir(env)));
|
|
262
|
+
const file = path.join(dir, STATE_FILE);
|
|
263
|
+
let last = 0;
|
|
264
|
+
try { last = Number(JSON.parse(fs.readFileSync(file, 'utf8')).at) || 0; } catch { /* first time */ }
|
|
265
|
+
if (now - last < SKEW_REPORT_INTERVAL_MS) return false;
|
|
266
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
267
|
+
fs.writeFileSync(file, JSON.stringify({ at: now, runtimeVersion: skew.runtimeVersion, currentVersion: skew.currentVersion }));
|
|
268
|
+
send('runtime_version_skew', { runtimeVersion: skew.runtimeVersion, currentVersion: skew.currentVersion });
|
|
269
|
+
return true;
|
|
270
|
+
} catch {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// npm.cmd needs cmd.exe, which expands %VARS% even inside quotes, so on Windows run npm-cli.js with node.
|
|
276
|
+
function npmRunner(platform = process.platform, nodePath = process.execPath) {
|
|
277
|
+
if (platform !== 'win32') return (cmd, args) => execFileSync(cmd, args, { stdio: 'inherit' });
|
|
278
|
+
const cli = path.join(path.dirname(nodePath), 'node_modules', 'npm', 'bin', 'npm-cli.js');
|
|
279
|
+
return (cmd, args) => execFileSync(nodePath, [cli, ...args], { stdio: 'inherit' });
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Hooks run the cached runtime first (published-cli.js), so self-update refreshes it too. Never throws.
|
|
283
|
+
function refreshHookRuntime(options = {}) {
|
|
284
|
+
const dir = options.dir || runtimeDir();
|
|
285
|
+
if (!fs.existsSync(dir)) return { refreshed: false, reason: 'no-runtime' };
|
|
286
|
+
const before = readRuntimeVersion(dir);
|
|
287
|
+
const run = options.run || npmRunner();
|
|
288
|
+
try {
|
|
289
|
+
console.log(`Updating hook runtime in ${dir} (was ${before ? `v${before}` : 'unknown'})`);
|
|
290
|
+
run('npm', ['install', '--prefix', dir, '--no-save', '--omit=dev', '--no-audit', '--no-fund', 'thumbgate@latest']);
|
|
291
|
+
return { refreshed: true, before, after: readRuntimeVersion(dir) };
|
|
292
|
+
} catch (err) {
|
|
293
|
+
console.error(`⚠️ Hook runtime update failed: ${err.message}. Run: npm install --prefix "${dir}" thumbgate@latest`);
|
|
294
|
+
return { refreshed: false, reason: 'install-failed', before };
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
199
298
|
function selfUpdate() {
|
|
200
299
|
const current = getLocalVersion();
|
|
201
300
|
console.log(`Attempting self-update for ThumbGate...`);
|
|
@@ -209,6 +308,12 @@ function selfUpdate() {
|
|
|
209
308
|
try {
|
|
210
309
|
console.log('Running: npm install -g thumbgate@latest');
|
|
211
310
|
execSync('npm install -g thumbgate@latest', { stdio: 'inherit' });
|
|
311
|
+
// Hooks run from the cached runtime, not the global install, so update it too.
|
|
312
|
+
const runtime = refreshHookRuntime();
|
|
313
|
+
if (runtime.reason === 'install-failed') {
|
|
314
|
+
console.error('❌ Self-update incomplete: hooks still run the old runtime.');
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
212
317
|
console.log('✨ Self-update complete! Run `thumbgate version` to verify.');
|
|
213
318
|
return true;
|
|
214
319
|
} catch (err) {
|
|
@@ -221,6 +326,16 @@ function selfUpdate() {
|
|
|
221
326
|
module.exports = {
|
|
222
327
|
checkUpdate,
|
|
223
328
|
selfUpdate,
|
|
329
|
+
refreshHookRuntime,
|
|
330
|
+
npmRunner,
|
|
331
|
+
runtimeDir,
|
|
332
|
+
readRuntimeVersion,
|
|
333
|
+
isOlder,
|
|
334
|
+
detectSkew,
|
|
335
|
+
buildSkewNotice,
|
|
336
|
+
reportSkewOnce,
|
|
337
|
+
RUNTIME_SKEW_STATE_FILE: STATE_FILE,
|
|
338
|
+
UPDATE_COMMAND,
|
|
224
339
|
getLocalVersion,
|
|
225
340
|
isNewer,
|
|
226
341
|
};
|
package/scripts/cli-feedback.js
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* node scripts/cli-feedback.js down "what went wrong"
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
const { captureFeedback
|
|
16
|
+
const { captureFeedback } = require('./feedback-loop');
|
|
17
|
+
const { computeHumanCounts } = require('./statusline-human-counts');
|
|
17
18
|
const { loadOptionalModule } = require('./private-core-boundary');
|
|
18
19
|
// Keep the optional distiller from breaking the public package.
|
|
19
20
|
const { distillFromHistory } = loadOptionalModule('./history-distiller', () => ({
|
|
@@ -73,14 +74,14 @@ function processInlineFeedback({ signal, context, chatHistory, whatWentWrong, wh
|
|
|
73
74
|
// 3. Get the most recent lesson and stats
|
|
74
75
|
const recentLesson = getRecentLesson();
|
|
75
76
|
const lessonStats = getLessonStats();
|
|
76
|
-
|
|
77
|
+
// The same counter the status line and the dashboard headline use, so the three surfaces cannot disagree.
|
|
78
|
+
const counts = computeHumanCounts({ cwd: process.cwd() });
|
|
77
79
|
const stats = {
|
|
78
80
|
...lessonStats,
|
|
79
|
-
total:
|
|
80
|
-
positive:
|
|
81
|
-
negative:
|
|
82
|
-
|
|
83
|
-
excludedTotal: feedbackStats.excludedTotal,
|
|
81
|
+
total: counts.up + counts.down,
|
|
82
|
+
positive: counts.up,
|
|
83
|
+
negative: counts.down,
|
|
84
|
+
notCounted: counts.notCounted,
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
// 4. If the user wrote an explicit "never …" / "always …" directive, surface
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* One plain upgrade line right after a user's FIRST real block, then at most once per 7 days.
|
|
5
5
|
*
|
|
6
|
-
* Shape: "ThumbGate just stopped <what>. Pro adds <feature> - thumbgate.ai/
|
|
6
|
+
* Shape: "ThumbGate just stopped <what>. Pro adds <feature> - https://thumbgate.ai/checkout/pro?utm_source=cli&..."
|
|
7
|
+
*
|
|
8
|
+
* The link carries a scheme so terminals make it clickable, and it opens the checkout page (one click
|
|
9
|
+
* to Stripe) instead of /pricing (two). Each showing sends a `first_block_upsell_shown` ping so the
|
|
10
|
+
* activated -> shown -> checkout funnel has a denominator.
|
|
11
|
+
* See docs/decisions/2026-11-24-revenue-funnel-activation.md.
|
|
7
12
|
*
|
|
8
13
|
* Channel: a PreToolUse hook is never a TTY (stdin and stdout are pipes), so the line is not printed.
|
|
9
14
|
* It rides in the hook JSON's top-level `systemMessage`, which the host shows to the person and
|
|
@@ -19,7 +24,13 @@ const fs = require('node:fs');
|
|
|
19
24
|
const path = require('node:path');
|
|
20
25
|
|
|
21
26
|
const COOLDOWN_MS = 7 * 24 * 60 * 60 * 1000;
|
|
22
|
-
const
|
|
27
|
+
const UPSELL_BASE_URL = 'https://thumbgate.ai/checkout/pro';
|
|
28
|
+
const PRICING_URL = `${UPSELL_BASE_URL}?utm_source=cli&utm_medium=first_block&utm_campaign=first_block_upsell`;
|
|
29
|
+
|
|
30
|
+
function upsellUrl(gateId) {
|
|
31
|
+
const safeGate = String(gateId || '').toLowerCase().replace(/[^a-z0-9-]/g, '').slice(0, 40);
|
|
32
|
+
return safeGate && STOPPED_PHRASES[safeGate] ? `${PRICING_URL}&utm_content=${safeGate}` : PRICING_URL;
|
|
33
|
+
}
|
|
23
34
|
const STATE_FILE = 'first-block-upsell.json';
|
|
24
35
|
const CI_VARS = ['CI', 'GITHUB_ACTIONS', 'TRAVIS', 'CIRCLECI', 'JENKINS_URL', 'GITLAB_CI', 'CODEBUILD_BUILD_ID'];
|
|
25
36
|
|
|
@@ -47,7 +58,7 @@ function proFeature() {
|
|
|
47
58
|
}
|
|
48
59
|
|
|
49
60
|
function buildLine(gateId) {
|
|
50
|
-
return `ThumbGate just stopped ${stoppedPhrase(gateId)}. Pro adds ${proFeature()} - ${
|
|
61
|
+
return `ThumbGate just stopped ${stoppedPhrase(gateId)}. Pro adds ${proFeature()} - ${upsellUrl(gateId)}`;
|
|
51
62
|
}
|
|
52
63
|
|
|
53
64
|
// A paying, licensed, creator or owner install never sees the line. The 7-day trial is NOT exempt:
|
|
@@ -80,7 +91,19 @@ function readState(file) {
|
|
|
80
91
|
* Decide whether to show the line for a real block, and record it when shown.
|
|
81
92
|
* @returns {{ show: boolean, line?: string, reason?: string }}
|
|
82
93
|
*/
|
|
83
|
-
|
|
94
|
+
// Fire-and-forget ping when the line is shown. Never in tests unless a tracker is injected.
|
|
95
|
+
function defaultTrack(eventType, metadata, env) {
|
|
96
|
+
if (env.NODE_TEST_CONTEXT || env.NODE_ENV === 'test' || process.env.NODE_TEST_CONTEXT) return;
|
|
97
|
+
if (env.THUMBGATE_NO_TELEMETRY === '1' || env.DO_NOT_TRACK === '1') return;
|
|
98
|
+
try { require('./cli-telemetry').trackEvent(eventType, metadata); } catch { /* best-effort */ }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function shown(gate, shownCount, track, env) {
|
|
102
|
+
try { track('first_block_upsell_shown', { gateId: gate ? String(gate).slice(0, 120) : null, shownCount }, env); } catch { /* best-effort */ }
|
|
103
|
+
return { show: true, line: buildLine(gate) };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function maybeUpsell({ gate, env = process.env, now = Date.now(), stateDir, exempt = defaultExempt, track = defaultTrack } = {}) {
|
|
84
107
|
try {
|
|
85
108
|
if (env.THUMBGATE_NO_UPSELL === '1') return { show: false, reason: 'opt-out' };
|
|
86
109
|
if (CI_VARS.some((name) => env[name])) return { show: false, reason: 'ci' };
|
|
@@ -102,7 +125,7 @@ function maybeUpsell({ gate, env = process.env, now = Date.now(), stateDir, exem
|
|
|
102
125
|
} catch (err) {
|
|
103
126
|
return { show: false, reason: err && err.code === 'EEXIST' ? 'claimed-elsewhere' : 'state-unwritable' };
|
|
104
127
|
}
|
|
105
|
-
return
|
|
128
|
+
return shown(gate, 1, track, env);
|
|
106
129
|
}
|
|
107
130
|
|
|
108
131
|
if (state.corrupt) {
|
|
@@ -126,7 +149,7 @@ function maybeUpsell({ gate, env = process.env, now = Date.now(), stateDir, exem
|
|
|
126
149
|
} catch {
|
|
127
150
|
return { show: false, reason: 'state-unwritable' };
|
|
128
151
|
}
|
|
129
|
-
return
|
|
152
|
+
return shown(gate, next.shownCount, track, env);
|
|
130
153
|
} catch {
|
|
131
154
|
return { show: false, reason: 'error' };
|
|
132
155
|
}
|
|
@@ -177,6 +200,7 @@ module.exports = {
|
|
|
177
200
|
COOLDOWN_MS,
|
|
178
201
|
PRICING_URL,
|
|
179
202
|
STATE_FILE,
|
|
203
|
+
upsellUrl,
|
|
180
204
|
STOPPED_PHRASES,
|
|
181
205
|
stoppedPhrase,
|
|
182
206
|
buildLine,
|
package/scripts/owner-admin.js
CHANGED
|
@@ -1092,7 +1092,7 @@ function startAlertDelivery(makeDeps, { intervalMs = 15 * 60 * 1000, firstCheckM
|
|
|
1092
1092
|
try {
|
|
1093
1093
|
const deps = makeDeps();
|
|
1094
1094
|
const result = await collectAlerts(deps, AbortSignal.timeout(30000));
|
|
1095
|
-
const firing = result.data.alerts.filter(
|
|
1095
|
+
const firing = result.data.alerts.filter(ownerAlerts.isDeliverable);
|
|
1096
1096
|
const state = readState(deps);
|
|
1097
1097
|
const before = new Set(Array.isArray(state?.firing) ? state.firing : []);
|
|
1098
1098
|
const added = firing.filter((alert) => !before.has(alert.id));
|
package/scripts/owner-alerts.js
CHANGED
|
@@ -76,4 +76,9 @@ function createAlertTracker() {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
// These alerts compare raw event counts that still include our own agents, tests and bots, and installs counted by
|
|
80
|
+
// anonymous id. They stay on the admin page, but are never sent by email or webhook until the counts are filtered.
|
|
81
|
+
const UNFILTERED_COUNT_ALERTS = new Set(['visitors_drop', 'checkout_drop', 'installs_drop', 'activation_low']);
|
|
82
|
+
const isDeliverable = (alert) => alert.level !== 'info' && !UNFILTERED_COUNT_ALERTS.has(alert.id);
|
|
83
|
+
|
|
84
|
+
module.exports = { evaluateAlerts, formatAlertMessage, createAlertTracker, UNFILTERED_COUNT_ALERTS, isDeliverable };
|
|
@@ -36,6 +36,22 @@ function isScrapedHumanThumb(row) {
|
|
|
36
36
|
return tags.includes('claude-history-sync');
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// "[Eci.Psn.StockService] Igor: thumbs up": the prefix names the project the thumb was given in.
|
|
40
|
+
function contextProjectPrefix(row) {
|
|
41
|
+
const match = String(row.context || '').match(/^\s*\[([^\]]{1,80})\]/);
|
|
42
|
+
return match ? match[1].trim().toLowerCase() : null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Only a thumbs-up can be auto-made this way: "found a successful pattern" is the sync's own guess, and a
|
|
46
|
+
// positive row with no text that the system logged as no-action names nothing. A distilled failure quotes the
|
|
47
|
+
// person's own message, so it stays.
|
|
48
|
+
function isAutoGenerated(row) {
|
|
49
|
+
if (normalizeSignal(row) !== 'up') return false;
|
|
50
|
+
const context = String(row.context || '').trim();
|
|
51
|
+
if (!context) return String(row.actionType || '').toLowerCase() === 'no-action';
|
|
52
|
+
return /^history-aware distillation found a successful pattern/i.test(context);
|
|
53
|
+
}
|
|
54
|
+
|
|
39
55
|
function collectHumanRows(options = {}) {
|
|
40
56
|
const env = options.env || process.env;
|
|
41
57
|
const cwd = options.cwd || process.cwd();
|
|
@@ -49,6 +65,8 @@ function collectHumanRows(options = {}) {
|
|
|
49
65
|
|
|
50
66
|
const seen = new Set();
|
|
51
67
|
const mineRows = [];
|
|
68
|
+
// Rows read but kept out of the headline. Nothing is deleted or rewritten; they are only not counted.
|
|
69
|
+
const excluded = { otherProject: 0, unassignedNoEvidence: 0, autoGenerated: 0 };
|
|
52
70
|
const ownDir = path.resolve(feedbackDir);
|
|
53
71
|
// THUMBGATE_FEEDBACK_DIR can point the resolved dir at the shared store, which
|
|
54
72
|
// would hide this project's own log. The project's own .thumbgate folder is always read too.
|
|
@@ -66,7 +84,13 @@ function collectHumanRows(options = {}) {
|
|
|
66
84
|
if (seen.has(row.id)) continue;
|
|
67
85
|
seen.add(row.id);
|
|
68
86
|
}
|
|
69
|
-
|
|
87
|
+
// A thumb given in another project never counts here, whatever key it carries.
|
|
88
|
+
const prefix = contextProjectPrefix(row);
|
|
89
|
+
if (prefix && prefix !== projectName.toLowerCase()) {
|
|
90
|
+
if (normalizeSignal(row)) excluded.otherProject += 1;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
mineRows.push({ row, unassigned: row.projectKey === 'unassigned' });
|
|
70
94
|
}
|
|
71
95
|
}
|
|
72
96
|
|
|
@@ -75,7 +99,7 @@ function collectHumanRows(options = {}) {
|
|
|
75
99
|
// labelled automated counts when such evidence sits next to it; without it the
|
|
76
100
|
// row is a lesson the agent logged on its own judgment.
|
|
77
101
|
const scraped = { up: [], down: [] };
|
|
78
|
-
for (const row of mineRows) {
|
|
102
|
+
for (const { row } of mineRows) {
|
|
79
103
|
const signal = normalizeSignal(row);
|
|
80
104
|
const at = rowTime(row);
|
|
81
105
|
if (signal && at !== null && isScrapedHumanThumb(row)) scraped[signal].push(at);
|
|
@@ -86,13 +110,34 @@ function collectHumanRows(options = {}) {
|
|
|
86
110
|
return Boolean(signal) && at !== null && scraped[signal].some((t) => Math.abs(t - at) <= CORROBORATION_MS);
|
|
87
111
|
};
|
|
88
112
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
113
|
+
// A row written before project tracking carries no key, so it proves nothing about
|
|
114
|
+
// which project it belongs to. It counts only when the row itself shows the person
|
|
115
|
+
// typed the thumb (the user-prompt hook tag, or a history-sync scrape beside it).
|
|
116
|
+
// Text in the context ("Explicit user thumbs-up") is the agent's own wording and proves nothing.
|
|
117
|
+
const hasPersonEvidence = (row) => {
|
|
118
|
+
const tags = Array.isArray(row.tags) ? row.tags : [];
|
|
119
|
+
return tags.includes('user-prompt-thumbs') || corroborated(row);
|
|
120
|
+
};
|
|
121
|
+
const counted = [];
|
|
122
|
+
for (const { row, unassigned } of mineRows) {
|
|
123
|
+
if (!normalizeSignal(row)) continue;
|
|
124
|
+
if (!(isCountedHumanFeedback(row) || (isLegacyMcpCapture(row) && corroborated(row)))) continue;
|
|
125
|
+
// A learning the history sync distilled on its own, or a row with no text at all, is never a thumb.
|
|
126
|
+
if (isAutoGenerated(row)) {
|
|
127
|
+
excluded.autoGenerated += 1;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (unassigned && !hasPersonEvidence(row)) {
|
|
131
|
+
excluded.unassignedNoEvidence += 1;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
counted.push(row);
|
|
135
|
+
}
|
|
136
|
+
return { rows: counted, projectKey, projectName, projectDir, excluded };
|
|
92
137
|
}
|
|
93
138
|
|
|
94
139
|
function computeHumanCounts(options = {}) {
|
|
95
|
-
const { rows, projectName } = collectHumanRows(options);
|
|
140
|
+
const { rows, projectName, excluded } = collectHumanRows(options);
|
|
96
141
|
let up = 0;
|
|
97
142
|
let down = 0;
|
|
98
143
|
let latestDown = null;
|
|
@@ -105,7 +150,7 @@ function computeHumanCounts(options = {}) {
|
|
|
105
150
|
if (at !== null && (!latestDown || at > latestDown.at)) latestDown = { at, row };
|
|
106
151
|
}
|
|
107
152
|
}
|
|
108
|
-
return { up, down, label: 'this project', project: projectName, latestDown: describeLatestDown(latestDown) };
|
|
153
|
+
return { up, down, label: 'this project', project: projectName, latestDown: describeLatestDown(latestDown), notCounted: excluded.unassignedNoEvidence };
|
|
109
154
|
}
|
|
110
155
|
|
|
111
156
|
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
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.
|
|
11
|
+
"version": "1.40.14",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "thumbgate",
|
|
17
|
-
"version": "1.40.
|
|
17
|
+
"version": "1.40.14",
|
|
18
18
|
"runtimeHint": "npx",
|
|
19
19
|
"runtimeArguments": [
|
|
20
20
|
{
|
package/src/api/server.js
CHANGED
|
@@ -255,6 +255,7 @@ const {
|
|
|
255
255
|
} = require('../../scripts/gates-engine');
|
|
256
256
|
const {
|
|
257
257
|
summarizeFirstBlockEvents,
|
|
258
|
+
summarizeActivationFunnel,
|
|
258
259
|
} = require('../../scripts/activation-tracker');
|
|
259
260
|
const {
|
|
260
261
|
evaluateOperationalIntegrity,
|
|
@@ -3152,6 +3153,7 @@ const CHECKOUT_GATE_NOTICES = Object.freeze({
|
|
|
3152
3153
|
retry: "We couldn't confirm that click. Press the button again.",
|
|
3153
3154
|
network: 'Your connection changed while we confirmed the click. Press the button again.',
|
|
3154
3155
|
busy: 'Many checkouts are starting from your network right now. Wait a minute, then press the button again.',
|
|
3156
|
+
unavailable: "We couldn't open the Stripe payment page just now. Nothing was charged. Press the button again in a minute.",
|
|
3155
3157
|
});
|
|
3156
3158
|
|
|
3157
3159
|
function checkoutGateNoticeCode(reason) {
|
|
@@ -3871,6 +3873,8 @@ async function serveTrackedLinkRedirect({ req, res, parsed, hostedConfig, isHead
|
|
|
3871
3873
|
return;
|
|
3872
3874
|
}
|
|
3873
3875
|
}
|
|
3876
|
+
// Set when an admitted click could not get a Stripe session; the visitor is told instead of silently seeing the same page.
|
|
3877
|
+
let sessionFailure = null;
|
|
3874
3878
|
if (!isHeadRequest && isDirectProSessionSlug(target.slug) && process.env.STRIPE_SECRET_KEY) {
|
|
3875
3879
|
try {
|
|
3876
3880
|
const dynamicSessionUrl = await tryCreateDirectProCheckoutRedirect({
|
|
@@ -3894,6 +3898,7 @@ async function serveTrackedLinkRedirect({ req, res, parsed, hostedConfig, isHead
|
|
|
3894
3898
|
res.end();
|
|
3895
3899
|
return;
|
|
3896
3900
|
}
|
|
3901
|
+
sessionFailure = 'no_session_url';
|
|
3897
3902
|
} catch (err) {
|
|
3898
3903
|
if (err && err.code === 'AUTOMATED_CHECKOUT_BLOCKED') {
|
|
3899
3904
|
const deflectUrl = new URL(target.botDeflectPath || '/checkout/pro', hostedConfig.appOrigin);
|
|
@@ -3910,6 +3915,8 @@ async function serveTrackedLinkRedirect({ req, res, parsed, hostedConfig, isHead
|
|
|
3910
3915
|
}
|
|
3911
3916
|
// Dynamic session creation failed: Pro slugs go to the confirm page below.
|
|
3912
3917
|
console.warn('[checkout] dynamic session creation failed', target.slug, err && (err.code || err.message));
|
|
3918
|
+
// Only a short code-shaped value reaches telemetry; any other error text becomes 'error'.
|
|
3919
|
+
sessionFailure = err && typeof err.code === 'string' && /^[A-Za-z0-9_]{1,40}$/.test(err.code) ? err.code : 'error';
|
|
3913
3920
|
}
|
|
3914
3921
|
}
|
|
3915
3922
|
if (isProSubscriptionSlug(target.slug)) {
|
|
@@ -3917,6 +3924,16 @@ async function serveTrackedLinkRedirect({ req, res, parsed, hostedConfig, isHead
|
|
|
3917
3924
|
// the visitor to the confirm page, never to a payment link.
|
|
3918
3925
|
const confirmUrl = new URL('/checkout/pro', hostedConfig.appOrigin);
|
|
3919
3926
|
appendTrackedLinkQueryParams(confirmUrl, parsed, { ...target, allowCustomerEmail: false });
|
|
3927
|
+
if (sessionFailure && req.method === 'POST') {
|
|
3928
|
+
// A real buyer clicked Pay and nothing opened: say so, and count it (the reason code only, never free text).
|
|
3929
|
+
confirmUrl.searchParams.set('gate_notice', 'unavailable');
|
|
3930
|
+
appendBestEffortTelemetry(
|
|
3931
|
+
FEEDBACK_DIR,
|
|
3932
|
+
{ eventType: 'checkout_session_failed', clientType: 'web', page: `/go/${target.slug}`, reason: sessionFailure.slice(0, 60), planId: 'pro' },
|
|
3933
|
+
req.headers,
|
|
3934
|
+
'checkout_session_failed'
|
|
3935
|
+
);
|
|
3936
|
+
}
|
|
3920
3937
|
res.writeHead(302, {
|
|
3921
3938
|
...(journeyState.setCookieHeaders.length ? { 'Set-Cookie': journeyState.setCookieHeaders } : {}),
|
|
3922
3939
|
'Cache-Control': 'no-store',
|
|
@@ -7002,6 +7019,10 @@ async function handleFirstBlockActivationRoute(req, res, expectedApiKey, expecte
|
|
|
7002
7019
|
clientType: 'cli',
|
|
7003
7020
|
installId: trustedInstallId,
|
|
7004
7021
|
firstBlockAt: recorded.firstBlockAt,
|
|
7022
|
+
// Keep the CLI's own classification; an admin or operator key is the owner by definition.
|
|
7023
|
+
visitorType: (isAdmin || isOperator)
|
|
7024
|
+
? 'owner'
|
|
7025
|
+
: (['real_user', 'owner', 'ci'].includes(body?.visitorType) ? body.visitorType : 'real_user'),
|
|
7005
7026
|
...(typeof body?.gateId === 'string' ? { gateId: body.gateId.slice(0, 120) } : {}),
|
|
7006
7027
|
}, req.headers);
|
|
7007
7028
|
} catch { /* telemetry best-effort */ }
|
|
@@ -10428,8 +10449,13 @@ a{color:#8b9}</style></head><body><form class="card" method="post" action="/oaut
|
|
|
10428
10449
|
const sevenDaysAgo = now - 7 * 24 * 60 * 60 * 1000;
|
|
10429
10450
|
|
|
10430
10451
|
const classified = entries.map(e => {
|
|
10452
|
+
if (e.visitorType) return e;
|
|
10453
|
+
// A CLI ping comes from node, not a browser, so an empty User-Agent says nothing about it;
|
|
10454
|
+
// UA classification would label every unclassified CLI event (e.g. first_block) a bot.
|
|
10455
|
+
// The CLI marks CI and owner installs itself; one that didn't is a real install.
|
|
10456
|
+
if ((e.clientType || e.client) === 'cli') return { ...e, visitorType: 'real_user' };
|
|
10431
10457
|
const cls = bd.classifyVisitor({ headers: { 'user-agent': e.userAgent || '' }, email: e.email || '' });
|
|
10432
|
-
return { ...e, visitorType:
|
|
10458
|
+
return { ...e, visitorType: cls.type };
|
|
10433
10459
|
});
|
|
10434
10460
|
|
|
10435
10461
|
const recent = classified.filter(e => {
|
|
@@ -10464,6 +10490,8 @@ a{color:#8b9}</style></head><body><form class="card" method="post" action="/oaut
|
|
|
10464
10490
|
'cli_capture', 'cli_recall', 'cli_stats',
|
|
10465
10491
|
'activation_first_rule_promoted',
|
|
10466
10492
|
'first_blocked_tool_call',
|
|
10493
|
+
// What production CLIs actually send for the first gate firing.
|
|
10494
|
+
'first_block',
|
|
10467
10495
|
]);
|
|
10468
10496
|
const thirtyDaysAgo = now - 30 * 24 * 60 * 60 * 1000;
|
|
10469
10497
|
const last30 = classified.filter(e => {
|
|
@@ -10514,6 +10542,7 @@ a{color:#8b9}</style></head><body><form class="card" method="post" action="/oaut
|
|
|
10514
10542
|
activeInstalls: activeInstalls30d.size,
|
|
10515
10543
|
uniqueSessions: uniqueSessions30d.size,
|
|
10516
10544
|
firstBlockedToolCall: summarizeFirstBlockEvents(last30),
|
|
10545
|
+
activationFunnel: summarizeActivationFunnel(last30),
|
|
10517
10546
|
},
|
|
10518
10547
|
last7Days: {
|
|
10519
10548
|
total: recent.length,
|
|
@@ -10525,6 +10554,7 @@ a{color:#8b9}</style></head><body><form class="card" method="post" action="/oaut
|
|
|
10525
10554
|
activeInstalls: activeInstalls7d.size,
|
|
10526
10555
|
uniqueSessions: uniqueSessions7d.size,
|
|
10527
10556
|
firstBlockedToolCall: summarizeFirstBlockEvents(recent),
|
|
10557
|
+
activationFunnel: summarizeActivationFunnel(recent),
|
|
10528
10558
|
},
|
|
10529
10559
|
byEventType,
|
|
10530
10560
|
byVisitorType,
|