thumbgate 1.39.0 → 1.40.1
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/.agents/skills/craft-playbook-gate/SKILL.md +51 -0
- package/.agents/skills/qwenwork-policy-group-honesty-not-clone/SKILL.md +36 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.well-known/llms.txt +2 -2
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +11 -5
- package/adapters/claude/.mcp.json +6 -2
- package/adapters/codex/config.toml +5 -0
- package/adapters/forge/forge.yaml +4 -4
- 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 +104 -7
- package/adapters/opencode/opencode.json +1 -1
- package/adapters/strands/strands-middleware.js +31 -4
- package/bin/cli.js +191 -54
- package/config/brand-standards.json +131 -0
- package/config/gates/default.json +18 -1
- package/config/github-about.json +1 -1
- package/config/mcp-allowlists.json +16 -3
- package/config/merge-quality-checks.json +3 -1
- package/config/post-deploy-marketing-pages.json +4 -4
- package/config/schemas/task-outcome-receipt.schema.json +9 -0
- package/hooks/hooks.json +24 -0
- package/openapi/openapi.yaml +7 -3
- package/package.json +87 -33
- package/public/about.html +2 -2
- package/public/admin.html +771 -0
- package/public/agent-manager.html +3 -3
- package/public/agents-cost-savings.html +1 -1
- package/public/ai-malpractice-prevention.html +12 -12
- package/public/architecture.html +0 -1
- package/public/assets/diagrams/decision.svg +3 -3
- package/public/assets/diagrams/hero-thumbs.svg +2 -4
- package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +1 -1
- package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +1 -1
- package/public/blog/git-at-agent-scale.html +2 -2
- package/public/blog/inside-your-boundary.html +1 -1
- package/public/blog/process-over-outcome-gates.html +1 -1
- package/public/case-studies.html +5 -6
- package/public/codex-enterprise.html +1 -1
- package/public/codex-plugin.html +1 -1
- package/public/dashboard.html +775 -483
- package/public/diagnostic.html +15 -10
- package/public/enterprise-governance.html +26 -174
- package/public/eval-scorecard.html +3 -4
- package/public/eval-scorecard.json +2 -2
- package/public/evaluations.html +0 -1
- package/public/founders.html +3 -3
- package/public/gaming-playbook.html +4 -4
- package/public/guide.html +3 -5
- package/public/index.html +302 -97
- package/public/install.html +16 -10
- package/public/js/buyer-intent.js +49 -8
- package/public/lessons.html +246 -83
- package/public/numbers.html +32 -33
- package/public/operator-framework.html +44 -72
- package/public/peter.html +3 -3
- package/public/platform-partners.html +1 -1
- package/public/pricing.html +163 -66
- package/public/pro.html +3 -1
- package/public/project-switcher.js +76 -0
- package/public/whitepaper.html +1 -2
- package/scripts/action-receipts.js +393 -0
- package/scripts/activation-quickstart.js +15 -3
- package/scripts/activation-tracker.js +280 -3
- package/scripts/agent-action-inventory.js +235 -143
- package/scripts/agent-operations-planner.js +1 -1
- package/scripts/agent-readiness.js +36 -6
- package/scripts/agentic-prompt-pipelines.js +901 -0
- package/scripts/analytics-window.js +7 -1
- package/scripts/async-job-runner.js +66 -11
- package/scripts/audit-trail.js +37 -24
- package/scripts/auto-promote-gates.js +37 -27
- package/scripts/auto-wire-hooks.js +64 -25
- package/scripts/backfill-lesson-scopes.js +122 -0
- package/scripts/billing.js +889 -132
- package/scripts/bot-detection.js +112 -0
- package/scripts/brand-standards-gate.js +571 -0
- package/scripts/chatgpt-ads-readiness-pack.js +1 -1
- package/scripts/cli-demo.js +5 -27
- package/scripts/cli-schema.js +25 -1
- package/scripts/commercial-offer.js +2 -2
- package/scripts/contextfs.js +9 -3
- package/scripts/craft-playbook-gate.js +550 -0
- package/scripts/cross-encoder-reranker.js +4 -0
- package/scripts/dashboard-chat.js +11 -0
- package/scripts/dashboard.js +574 -167
- package/scripts/decision-journal.js +7 -4
- package/scripts/docker-sandbox-planner.js +3 -3
- package/scripts/export-dpo-pairs.js +12 -7
- package/scripts/failure-diagnostics.js +11 -0
- package/scripts/feedback-aggregate.js +4 -0
- package/scripts/feedback-attribution.js +6 -4
- package/scripts/feedback-history-distiller.js +18 -6
- package/scripts/feedback-loop.js +255 -89
- package/scripts/feedback-paths.js +8 -1
- package/scripts/feedback-sanitizer.js +5 -0
- package/scripts/feedback-scope.js +106 -0
- package/scripts/feedback-session.js +8 -2
- package/scripts/filesystem-search.js +13 -8
- package/scripts/financial-control-plane.js +707 -45
- package/scripts/gate-stats.js +38 -5
- package/scripts/gates-engine.js +1326 -240
- package/scripts/generate-eval-scorecard.js +0 -1
- package/scripts/gitlab-sdlc-prompts.js +397 -0
- package/scripts/harness-tool-names.js +31 -5
- package/scripts/hook-runtime.js +10 -0
- package/scripts/hybrid-feedback-context.js +7 -2
- package/scripts/intervention-policy.js +2 -1
- package/scripts/lesson-canonical.js +2 -2
- package/scripts/lesson-db.js +55 -14
- package/scripts/lesson-graph.js +2 -1
- package/scripts/lesson-retrieval.js +95 -9
- package/scripts/lesson-search.js +86 -22
- package/scripts/lesson-synthesis.js +21 -5
- package/scripts/mabl-failure-honesty.js +273 -0
- package/scripts/mailer/index.js +17 -1
- package/scripts/mailer/resend-mailer.js +213 -179
- package/scripts/migrate-project-scope.js +209 -0
- package/scripts/model-distress-detector.js +3 -3
- package/scripts/operational-integrity.js +436 -3
- package/scripts/override-audit.js +2 -0
- package/scripts/owner-admin.js +338 -0
- package/scripts/pr-manager.js +194 -1
- package/scripts/product-feedback.js +35 -0
- package/scripts/progressive-signoff.js +260 -0
- package/scripts/project-catalog.js +243 -0
- package/scripts/project-dashboard.js +61 -0
- package/scripts/project-evidence.js +172 -0
- package/scripts/project-identity.js +182 -0
- package/scripts/project-scope.js +381 -0
- package/scripts/prompt-eval.js +1 -1
- package/scripts/prompt-guard.js +446 -52
- package/scripts/proof-report.js +232 -0
- package/scripts/provider-action-normalizer.js +14 -6
- package/scripts/qwenwork-policy-group.js +413 -0
- package/scripts/rate-limiter.js +41 -0
- package/scripts/secret-redaction.js +171 -25
- package/scripts/secret-scanner.js +101 -42
- package/scripts/self-protection.js +2 -2
- package/scripts/seo-gsd.js +14 -14
- package/scripts/session-context-dedupe.js +66 -0
- package/scripts/settings-hierarchy.js +4 -2
- package/scripts/statusline-meta.js +34 -23
- package/scripts/tailscale-october-access.js +416 -0
- package/scripts/task-outcomes.js +58 -2
- package/scripts/telemetry-analytics.js +260 -16
- package/scripts/thumbgate-search.js +23 -9
- package/scripts/tool-kpi-tracker.js +5 -2
- package/scripts/tool-registry.js +42 -1
- package/scripts/triage-savings-calculator.js +1 -1
- package/scripts/vector-store.js +4 -1
- package/scripts/verified-lessons.js +270 -0
- package/scripts/verify-marketing-pages-deployed.js +2 -2
- package/scripts/workflow-sentinel.js +29 -10
- package/server.json +2 -2
- package/src/api/server.js +2478 -470
- package/src/feedback.js +21 -0
- package/src/hermes-sync-plane.js +2 -1
- package/src/index.js +2 -0
- package/src/lesson-search.js +9 -0
- package/src/mckinsey-top-company-ai-coding.js +493 -0
- package/src/mcp/email-triage-server/index.js +973 -0
- package/src/mcp/email-triage-server/package.json +12 -0
- package/src/mcp/server.js +3 -0
- package/src/mcp-writeguard.js +772 -11
- package/src/openshell-lovable-engine.js +1475 -0
- package/src/task-outcome.js +3 -0
- package/config/evals/agent-safety-eval.json +0 -447
- package/config/evals/retrieval-ranking-golden.json +0 -522
- package/config/progressive/01-wire-only.json +0 -11
- package/config/progressive/02-dashboard-empty-ok.json +0 -10
- package/config/progressive/03-one-lesson.json +0 -10
- package/config/progressive/04-warn-fires.json +0 -11
- package/config/progressive/05-strict-optional.json +0 -11
- package/config/progressive/README.md +0 -15
- package/public/assets/diagrams/agent-integration.png +0 -0
- package/public/assets/diagrams/thumbgate-architecture.png +0 -0
package/public/lessons.html
CHANGED
|
@@ -45,15 +45,18 @@
|
|
|
45
45
|
.container { max-width: 1060px; margin: 0 auto; padding: 0 24px; }
|
|
46
46
|
|
|
47
47
|
/* NAV */
|
|
48
|
-
nav { position: sticky; top: 0; z-index: 50; background: rgba(
|
|
49
|
-
nav .container { display: flex; justify-content: space-between; align-items: center; }
|
|
50
|
-
.nav-logo { font-weight: 700; font-size:
|
|
51
|
-
.nav
|
|
52
|
-
.nav-
|
|
53
|
-
.nav-links
|
|
54
|
-
.nav-
|
|
55
|
-
.nav
|
|
56
|
-
|
|
48
|
+
nav.app-top-nav { position: sticky; top: 0; z-index: 50; background: rgba(8, 11, 16, 0.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid rgba(39, 50, 70, 0.75); padding: 8px 0; }
|
|
49
|
+
nav.app-top-nav .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: nowrap; }
|
|
50
|
+
nav.app-top-nav .nav-logo { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: #f5f7fb; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; flex-shrink: 0; white-space: nowrap; }
|
|
51
|
+
nav.app-top-nav .nav-logo:hover { color: #ffffff; }
|
|
52
|
+
nav.app-top-nav .nav-logo .logo-mark { width: 28px; height: 28px; display: block; flex-shrink: 0; }
|
|
53
|
+
nav.app-top-nav .nav-links { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
|
|
54
|
+
nav.app-top-nav .nav-tab { color: #9ca8ba; text-decoration: none; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid transparent; transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease; white-space: nowrap; }
|
|
55
|
+
nav.app-top-nav .nav-tab:hover { color: #f5f7fb; background: rgba(255, 255, 255, 0.05); }
|
|
56
|
+
nav.app-top-nav .nav-tab.active { color: #f5f7fb; background: rgba(56, 215, 255, 0.12); border-color: rgba(56, 215, 255, 0.34); }
|
|
57
|
+
nav.app-top-nav .nav-github { color: #9ca8ba; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 999px; border: 1px solid rgba(39, 50, 70, 0.65); background: rgba(17, 22, 31, 0.55); transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease; flex-shrink: 0; }
|
|
58
|
+
nav.app-top-nav .nav-github:hover { color: #f5f7fb; border-color: rgba(56, 215, 255, 0.45); background: rgba(56, 215, 255, 0.1); }
|
|
59
|
+
@media (max-width: 640px) { nav.app-top-nav .container { padding-left: 14px; padding-right: 14px; gap: 8px; } nav.app-top-nav .nav-logo { font-size: 15px; gap: 8px; } nav.app-top-nav .nav-links { gap: 4px; } nav.app-top-nav .nav-tab { font-size: 13px; padding: 0 10px; } }
|
|
57
60
|
/* STATS */
|
|
58
61
|
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 32px 0; }
|
|
59
62
|
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: border-color 0.15s, transform 0.1s; cursor: pointer; }
|
|
@@ -190,36 +193,48 @@
|
|
|
190
193
|
.rule-meta { flex-direction: column; gap: 8px; }
|
|
191
194
|
}
|
|
192
195
|
|
|
193
|
-
/* Feedback
|
|
196
|
+
/* Feedback dialog: reason chips, optional note, submit stays off until a reason is chosen. */
|
|
194
197
|
.feedback-widget { position: fixed; bottom: 20px; right: 20px; z-index: 1000; }
|
|
195
|
-
.feedback-toggle { background: var(--cyan); color: var(--bg); border: none; border-radius: 50px; padding: 12px 20px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px rgba(34,211,238,0.3);
|
|
196
|
-
.feedback-
|
|
197
|
-
.feedback-
|
|
198
|
-
.feedback-panel
|
|
199
|
-
.feedback-panel
|
|
200
|
-
.feedback-
|
|
201
|
-
.feedback-panel
|
|
202
|
-
.feedback-
|
|
203
|
-
.feedback-
|
|
204
|
-
.feedback-
|
|
205
|
-
.feedback-
|
|
206
|
-
.feedback-
|
|
198
|
+
.feedback-toggle { background: var(--cyan); color: var(--bg); border: none; border-radius: 50px; padding: 12px 20px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px rgba(34,211,238,0.3); }
|
|
199
|
+
.feedback-backdrop { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.55); border: 0; padding: 0; }
|
|
200
|
+
.feedback-widget.is-open .feedback-backdrop { display: block; }
|
|
201
|
+
.feedback-panel { display: none; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); max-height: calc(100svh - 32px); overflow: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: 0 22px 80px rgba(0,0,0,0.45); z-index: 1001; }
|
|
202
|
+
.feedback-widget.is-open .feedback-panel { display: block; }
|
|
203
|
+
.feedback-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
|
|
204
|
+
.feedback-panel h3 { font-size: 18px; margin: 0; letter-spacing: -0.02em; }
|
|
205
|
+
.feedback-close { background: transparent; color: var(--text-muted); border: 0; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; }
|
|
206
|
+
.feedback-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
|
|
207
|
+
.feedback-chip { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px; font-size: 13px; line-height: 18px; cursor: pointer; font-family: inherit; }
|
|
208
|
+
.feedback-chip[aria-pressed="true"] { background: rgba(34,211,238,0.16); border-color: var(--cyan); }
|
|
209
|
+
.feedback-chip:focus-visible, .feedback-close:focus-visible, .feedback-submit:focus-visible, .feedback-panel textarea:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
|
|
210
|
+
.feedback-panel textarea { width: 100%; min-height: 96px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 12px; font-size: 14px; font-family: inherit; resize: vertical; }
|
|
211
|
+
.feedback-note { color: var(--text-muted); font-size: 12px; line-height: 1.5; margin: 8px 0 14px; }
|
|
212
|
+
.feedback-actions { display: flex; justify-content: flex-end; }
|
|
213
|
+
.feedback-submit { background: var(--cyan); color: var(--bg); border: none; border-radius: 8px; padding: 10px 18px; font-size: 13px; font-weight: 600; cursor: pointer; }
|
|
214
|
+
.feedback-submit:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
215
|
+
.feedback-success { color: var(--green); font-size: 13px; margin-top: 12px; }
|
|
216
|
+
@media (max-width: 480px) {
|
|
217
|
+
.feedback-panel { padding: 16px; border-radius: 14px; }
|
|
218
|
+
.feedback-chip { padding: 10px 12px; }
|
|
219
|
+
}
|
|
207
220
|
|
|
208
221
|
</style>
|
|
222
|
+
<script src="/project-switcher.js"></script>
|
|
209
223
|
</head>
|
|
210
224
|
<body>
|
|
211
225
|
|
|
212
|
-
|
|
226
|
+
<!-- __SIGNED_IN_APP_NAV_START__ -->
|
|
227
|
+
<nav class="app-top-nav" aria-label="Primary navigation">
|
|
213
228
|
<div class="container">
|
|
214
|
-
<a href="/
|
|
229
|
+
<a href="/" class="nav-logo" aria-label="ThumbGate home"><img src="/assets/brand/thumbgate-mark-inline-v3.svg" alt="" class="logo-mark" width="28" height="28"><span class="logo-text">ThumbGate</span></a>
|
|
215
230
|
<div class="nav-links">
|
|
216
|
-
<a href="/dashboard">Dashboard</a>
|
|
217
|
-
<a href="/lessons" class="active">Lessons</a>
|
|
218
|
-
<a href="/"
|
|
219
|
-
<a href="https://github.com/IgorGanapolsky/ThumbGate" target="_blank" rel="noopener">GitHub</a>
|
|
231
|
+
<a href="/dashboard" class="nav-tab">Dashboard</a>
|
|
232
|
+
<a href="/lessons" class="nav-tab active" aria-current="page">Lessons</a>
|
|
233
|
+
<a href="https://github.com/IgorGanapolsky/ThumbGate" class="nav-github" target="_blank" rel="noopener" aria-label="GitHub" title="GitHub"><svg viewBox="0 0 16 16" width="18" height="18" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg></a>
|
|
220
234
|
</div>
|
|
221
235
|
</div>
|
|
222
236
|
</nav>
|
|
237
|
+
<!-- __SIGNED_IN_APP_NAV_END__ -->
|
|
223
238
|
|
|
224
239
|
<div class="container">
|
|
225
240
|
<div style="margin:32px 0 24px;padding:24px;background:linear-gradient(135deg,rgba(167,139,250,0.08),rgba(34,211,238,0.05));border:1px solid rgba(167,139,250,0.2);border-radius:12px;">
|
|
@@ -365,12 +380,14 @@
|
|
|
365
380
|
<div class="pro-badge" id="proBadge" style="display:none;">
|
|
366
381
|
<h3>Unlock Full Insights</h3>
|
|
367
382
|
<p>DPO training data export, effectiveness charts, pattern clustering, weekly auto-digests, and a learned intervention policy trained from feedback, audits, and diagnostics.</p>
|
|
368
|
-
<a href="
|
|
383
|
+
<a href="/pricing">Get the $499 Setup Sprint</a>
|
|
369
384
|
</div>
|
|
370
385
|
</div>
|
|
371
386
|
</div>
|
|
372
387
|
|
|
373
388
|
<script>
|
|
389
|
+
function projectFetch(input, init) { return fetch(window.ThumbGateProjects.url(input), init); }
|
|
390
|
+
|
|
374
391
|
var allRules = [];
|
|
375
392
|
var allTimeline = [];
|
|
376
393
|
var isDemo = true;
|
|
@@ -385,19 +402,19 @@ const LOCAL_PRO_BOOTSTRAP = __LESSONS_BOOTSTRAP_ENABLED__;
|
|
|
385
402
|
function escHtml(s) { var d = document.createElement('div'); d.textContent = s; return d.innerHTML; }
|
|
386
403
|
function escAttr(s) { return escHtml(String(s || '')).replace(/"/g, '"'); }
|
|
387
404
|
|
|
388
|
-
let
|
|
405
|
+
let ACTIVE_PROJECT_KEY = '';
|
|
389
406
|
try {
|
|
390
407
|
var urlParams = new URLSearchParams(window.location.search);
|
|
391
|
-
|
|
408
|
+
ACTIVE_PROJECT_KEY = urlParams.get('project') || '';
|
|
392
409
|
} catch (e) {}
|
|
393
410
|
|
|
394
411
|
function preserveProjectQueryParams() {
|
|
395
|
-
if (!
|
|
412
|
+
if (!ACTIVE_PROJECT_KEY) return;
|
|
396
413
|
var links = document.querySelectorAll('a[href^="/dashboard"], a[href^="/lessons"], a[href="/"]');
|
|
397
414
|
links.forEach(function(link) {
|
|
398
415
|
try {
|
|
399
416
|
var url = new URL(link.href, window.location.origin);
|
|
400
|
-
url.searchParams.set('project',
|
|
417
|
+
url.searchParams.set('project', ACTIVE_PROJECT_KEY);
|
|
401
418
|
link.href = url.pathname + url.search + url.hash;
|
|
402
419
|
} catch (e) {}
|
|
403
420
|
});
|
|
@@ -406,9 +423,12 @@ function preserveProjectQueryParams() {
|
|
|
406
423
|
window.addEventListener('DOMContentLoaded', preserveProjectQueryParams);
|
|
407
424
|
|
|
408
425
|
function getHeaders() {
|
|
409
|
-
var headers = { '
|
|
410
|
-
if (
|
|
411
|
-
headers['
|
|
426
|
+
var headers = { 'Content-Type': 'application/json' };
|
|
427
|
+
if (API_KEY) {
|
|
428
|
+
headers['Authorization'] = 'Bearer ' + API_KEY;
|
|
429
|
+
}
|
|
430
|
+
if (ACTIVE_PROJECT_KEY) {
|
|
431
|
+
headers['x-thumbgate-project'] = ACTIVE_PROJECT_KEY;
|
|
412
432
|
}
|
|
413
433
|
return headers;
|
|
414
434
|
}
|
|
@@ -726,6 +746,10 @@ function renderImprovementMetrics(stats, data) {
|
|
|
726
746
|
var blocked = gateStats.blocked || 0;
|
|
727
747
|
var resolvedCount = decisionLoop.resolvedCount || 0;
|
|
728
748
|
|
|
749
|
+
if (window.ThumbGateProjects.selected && data.decisions === null) {
|
|
750
|
+
summary.textContent = 'Decision metrics are unavailable for this project. The chart shows recorded project feedback and gate decisions.';
|
|
751
|
+
grid.textContent = 'Unavailable for this project';
|
|
752
|
+
} else {
|
|
729
753
|
summary.textContent = 'ThumbGate is auto-routing ' + fastPathRate + '% of tracked decisions while holding override rate at ' + overrideRate + '% and rollback rate at ' + rollbackRate + '% across '
|
|
730
754
|
+ resolvedCount + ' resolved decision' + (resolvedCount === 1 ? '' : 's') + '. Feedback approval is ' + approvalRate + '%, and gates still recorded ' + blocked + ' deny decision' + (blocked === 1 ? '' : 's') + '.';
|
|
731
755
|
|
|
@@ -738,6 +762,8 @@ function renderImprovementMetrics(stats, data) {
|
|
|
738
762
|
return '<div class="metric-tile"><div class="metric-kicker">' + escHtml(tile.label) + '</div><div class="metric-number ' + escHtml(tile.tone) + '">' + escHtml(tile.value) + '</div><div class="metric-note">' + escHtml(tile.note) + '</div></div>';
|
|
739
763
|
}).join('');
|
|
740
764
|
|
|
765
|
+
}
|
|
766
|
+
|
|
741
767
|
var gateDays = {};
|
|
742
768
|
((gateAudit.days) || []).forEach(function(day) {
|
|
743
769
|
gateDays[day.dayKey] = day;
|
|
@@ -965,19 +991,33 @@ var demoTimeline = [
|
|
|
965
991
|
{ signal: 'down', context: 'Spent 45min on code when curl would have diagnosed in 30s', date: '3 days ago', learned: 'curl first, never edit .env' },
|
|
966
992
|
];
|
|
967
993
|
|
|
994
|
+
async function submitLessonsTalkToUs(btn) {
|
|
995
|
+
var wrap = btn.closest('[data-talk-wrap]'), emailEl = wrap && wrap.querySelector('[data-talk-email]'), statusEl = wrap && wrap.querySelector('[data-talk-status]');
|
|
996
|
+
btn.disabled = true;
|
|
997
|
+
try {
|
|
998
|
+
var res = await projectFetch('/v1/intake/workflow-sprint', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: (emailEl && emailEl.value.trim()) || undefined, workflow: 'Free-tier lessons limit (Talk to us)', urgency: 'Hit free-tier limit on /lessons', planId: 'diagnostic', ctaId: 'workflow_sprint_intake', ctaPlacement: 'free_tier_limit', page: '/lessons' }) });
|
|
999
|
+
if (res.status === 400 && emailEl && emailEl.style.display === 'none') {
|
|
1000
|
+
emailEl.style.display = 'inline-block'; emailEl.focus();
|
|
1001
|
+
if (statusEl) statusEl.textContent = 'Enter work email, then click Talk to us.';
|
|
1002
|
+
btn.disabled = false; return;
|
|
1003
|
+
}
|
|
1004
|
+
var data = await res.json().catch(function() { return {}; });
|
|
1005
|
+
if (res.ok && data.ok) {
|
|
1006
|
+
if (statusEl) statusEl.textContent = '✓ Queued — Igor will follow up directly.';
|
|
1007
|
+
if (emailEl) emailEl.style.display = 'none';
|
|
1008
|
+
btn.textContent = 'Request sent'; return;
|
|
1009
|
+
}
|
|
1010
|
+
if (statusEl) statusEl.textContent = data.detail || data.error || 'Could not queue request.';
|
|
1011
|
+
} catch (_e) { if (statusEl) statusEl.textContent = 'Network error. Try again.'; }
|
|
1012
|
+
btn.disabled = false;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
968
1015
|
function renderUpgradeWall(containerId) {
|
|
969
1016
|
var el = document.getElementById(containerId);
|
|
970
1017
|
if (!el) return;
|
|
971
1018
|
var wall = document.createElement('div');
|
|
972
1019
|
wall.style.cssText = 'position:relative;margin-top:8px;';
|
|
973
|
-
wall.innerHTML = '<div style="position:absolute;
|
|
974
|
-
'<div style="text-align:center;background:rgba(10,10,15,0.92);border:1px solid #333;border-radius:12px;padding:28px 36px;">' +
|
|
975
|
-
'<div style="font-size:20px;font-weight:700;color:#fff;margin-bottom:8px;">Unlock your full lessons</div>' +
|
|
976
|
-
'<div style="color:#aaa;margin-bottom:16px;">Pro shows your real prevention rules, timeline, and insights.</div>' +
|
|
977
|
-
'<a href="/go/pro?utm_source=lessons" rel="noopener" ' +
|
|
978
|
-
'style="display:inline-block;background:#b85c2d;color:#fff;padding:10px 24px;border-radius:8px;text-decoration:none;font-weight:700;">Start Pro now</a>' +
|
|
979
|
-
'<div style="color:#666;font-size:12px;margin-top:10px;">npx thumbgate pro --activate --key=YOUR_KEY</div>' +
|
|
980
|
-
'</div></div>';
|
|
1020
|
+
wall.innerHTML = '<div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:2;"><div data-talk-wrap style="text-align:center;background:rgba(10,10,15,0.92);border:1px solid #333;border-radius:12px;padding:24px 32px;"><div style="font-size:20px;font-weight:700;color:#fff;margin-bottom:8px;">Free tier limit reached</div><div style="color:#aaa;margin-bottom:16px;">Pro shows your real prevention rules, timeline, and insights — or talk to us about wiring one workflow.</div><div style="display:flex;gap:10px;justify-content:center;flex-wrap:wrap;align-items:center;"><a href="/go/pro-direct?utm_source=lessons&utm_medium=wall&utm_campaign=pro_upgrade&cta_id=lessons_wall_pro" rel="noopener" style="display:inline-flex;align-items:center;min-height:44px;background:#b85c2d;color:#fff;padding:10px 22px;border-radius:8px;text-decoration:none;font-weight:700;">Start Pro now</a><input type="email" data-talk-email placeholder="you@company.com" aria-label="Work email" style="display:none;min-height:44px;padding:0 12px;border-radius:8px;border:1px solid #444;background:#0d1117;color:#fff;font-size:13px;"><button type="button" data-talk-to-us onclick="submitLessonsTalkToUs(this)" style="display:inline-flex;align-items:center;min-height:44px;background:transparent;border:1px solid #38bdf8;color:#38bdf8;padding:10px 18px;border-radius:8px;font-weight:700;cursor:pointer;">Talk to us</button></div><div data-talk-status style="color:#38bdf8;font-size:12px;margin-top:8px;min-height:16px;"></div><div style="color:#666;font-size:12px;margin-top:4px;">npx thumbgate pro --activate --key=YOUR_KEY</div></div></div>';
|
|
981
1021
|
el.appendChild(wall);
|
|
982
1022
|
}
|
|
983
1023
|
|
|
@@ -1004,27 +1044,55 @@ function loadDemo() {
|
|
|
1004
1044
|
document.getElementById('proBadge').style.display = 'block';
|
|
1005
1045
|
}
|
|
1006
1046
|
|
|
1047
|
+
async function resolvePaidCookieSession() {
|
|
1048
|
+
try {
|
|
1049
|
+
var res = await projectFetch('/v1/auth/session', { credentials: 'include' });
|
|
1050
|
+
if (!res.ok) return null;
|
|
1051
|
+
var session = await res.json();
|
|
1052
|
+
if (session && session.authenticated === true && (session.tier === 'Pro' || session.tier === 'Team' || session.tier === 'Enterprise')) {
|
|
1053
|
+
return session;
|
|
1054
|
+
}
|
|
1055
|
+
} catch (_err) {}
|
|
1056
|
+
return null;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
function resolveLessonsTierName(paidSession, stats) {
|
|
1060
|
+
if (paidSession && (paidSession.tier === 'Enterprise' || paidSession.tier === 'Team')) return paidSession.tier;
|
|
1061
|
+
if (stats && (stats.tier === 'Enterprise' || stats.tier === 'Team')) return stats.tier;
|
|
1062
|
+
if (API_KEY.startsWith('tg_op_') || API_KEY.startsWith('tg_creator_')) return 'Enterprise';
|
|
1063
|
+
return 'Pro';
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
function formatLessonsModePrefix(paidSession, tierName) {
|
|
1067
|
+
if (!paidSession) return 'Local ' + tierName + ' connected';
|
|
1068
|
+
if (paidSession.ssoEmail) return tierName + ' connected (' + paidSession.ssoEmail + ')';
|
|
1069
|
+
return tierName + ' connected';
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1007
1072
|
async function loadLive() {
|
|
1008
|
-
|
|
1073
|
+
var paidSession = hasBootstrapKey() ? null : await resolvePaidCookieSession();
|
|
1074
|
+
if (!hasBootstrapKey() && !paidSession) {
|
|
1009
1075
|
loadDemo();
|
|
1010
1076
|
return;
|
|
1011
1077
|
}
|
|
1012
|
-
API_KEY = String(BOOTSTRAP_API_KEY || '').trim();
|
|
1078
|
+
API_KEY = hasBootstrapKey() ? String(BOOTSTRAP_API_KEY || '').trim() : '';
|
|
1013
1079
|
try {
|
|
1080
|
+
var reqInit = { credentials: 'include', headers: getHeaders() };
|
|
1014
1081
|
const responses = await Promise.all([
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1082
|
+
projectFetch('/v1/feedback/stats', reqInit),
|
|
1083
|
+
projectFetch('/v1/lessons/search?limit=50', reqInit),
|
|
1084
|
+
projectFetch('/v1/search?q=*&limit=40&source=feedback', reqInit),
|
|
1085
|
+
projectFetch('/v1/dashboard', reqInit)
|
|
1019
1086
|
]);
|
|
1020
1087
|
if (responses.some(function(res) { return !res.ok; })) {
|
|
1021
|
-
throw new Error('
|
|
1088
|
+
throw new Error('Live lessons session unavailable');
|
|
1022
1089
|
}
|
|
1023
1090
|
|
|
1024
1091
|
const stats = await responses[0].json();
|
|
1025
1092
|
const lessonsPayload = await responses[1].json();
|
|
1026
1093
|
const feedbackPayload = await responses[2].json();
|
|
1027
1094
|
dashboardSnapshot = await responses[3].json();
|
|
1095
|
+
window.ThumbGateProjects.refresh(getHeaders());
|
|
1028
1096
|
|
|
1029
1097
|
allRules = mapLiveRules(lessonsPayload);
|
|
1030
1098
|
var lessonMap = new Map(allRules
|
|
@@ -1040,19 +1108,18 @@ async function loadLive() {
|
|
|
1040
1108
|
document.getElementById('statTrend').textContent = ((stats.recentRate || stats.approvalRate || 0) * 100).toFixed(1) + '%';
|
|
1041
1109
|
document.getElementById('statTrendSub').textContent = 'Live approval rate';
|
|
1042
1110
|
|
|
1111
|
+
isDemo = false;
|
|
1043
1112
|
renderRules(allRules);
|
|
1044
1113
|
renderTimeline(allTimeline);
|
|
1045
1114
|
renderInsights(dashboardSnapshot);
|
|
1046
1115
|
renderImprovementMetrics(stats, dashboardSnapshot);
|
|
1047
|
-
|
|
1048
|
-
if (stats.tier) {
|
|
1049
|
-
isEnterprise = (stats.tier === 'Enterprise');
|
|
1050
|
-
}
|
|
1051
|
-
const tierName = isEnterprise ? 'Enterprise' : 'Pro';
|
|
1116
|
+
const tierName = resolveLessonsTierName(paidSession, stats);
|
|
1052
1117
|
document.getElementById('proBadge').style.display = 'none';
|
|
1053
|
-
setMode(
|
|
1118
|
+
setMode(formatLessonsModePrefix(paidSession, tierName) + ' — this lessons view is reading your live rules, feedback timeline, and insights.', false);
|
|
1054
1119
|
} catch (_err) {
|
|
1055
|
-
|
|
1120
|
+
document.getElementById('proBadge').style.display = 'none';
|
|
1121
|
+
var fallbackTier = resolveLessonsTierName(paidSession, null);
|
|
1122
|
+
setMode(formatLessonsModePrefix(paidSession, fallbackTier) + ' — live data temporarily unavailable; refresh to retry.', false);
|
|
1056
1123
|
}
|
|
1057
1124
|
}
|
|
1058
1125
|
|
|
@@ -1140,48 +1207,144 @@ loadLive().then(function() {
|
|
|
1140
1207
|
});
|
|
1141
1208
|
</script>
|
|
1142
1209
|
|
|
1143
|
-
<div class="feedback-widget">
|
|
1144
|
-
<
|
|
1145
|
-
|
|
1146
|
-
<
|
|
1147
|
-
<
|
|
1148
|
-
<
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1210
|
+
<div class="feedback-widget" id="feedbackWidget">
|
|
1211
|
+
<button class="feedback-backdrop" type="button" aria-label="Close feedback" onclick="closeFeedback()"></button>
|
|
1212
|
+
<div class="feedback-panel" id="feedbackPanel" role="dialog" aria-modal="true" aria-labelledby="feedbackTitle">
|
|
1213
|
+
<div class="feedback-head">
|
|
1214
|
+
<h3 id="feedbackTitle">Share feedback</h3>
|
|
1215
|
+
<button class="feedback-close" type="button" aria-label="Close" onclick="closeFeedback()">×</button>
|
|
1216
|
+
</div>
|
|
1217
|
+
<div class="feedback-chips" id="feedbackChips">
|
|
1218
|
+
<button type="button" class="feedback-chip" data-reason="solved-the-task" aria-pressed="false">+ Solved the task</button>
|
|
1219
|
+
<button type="button" class="feedback-chip" data-reason="followed-the-rules" aria-pressed="false">+ Followed the repo rules</button>
|
|
1220
|
+
<button type="button" class="feedback-chip" data-reason="blocked-a-risky-command" aria-pressed="false">+ Blocked a risky command</button>
|
|
1221
|
+
<button type="button" class="feedback-chip" data-reason="blocked-the-wrong-thing" aria-pressed="false">+ Blocked the wrong thing</button>
|
|
1222
|
+
<button type="button" class="feedback-chip" data-reason="missed-the-mistake" aria-pressed="false">+ Missed the mistake</button>
|
|
1223
|
+
<button type="button" class="feedback-chip" data-reason="other" aria-pressed="false">+ Other</button>
|
|
1224
|
+
</div>
|
|
1225
|
+
<textarea id="feedbackText" placeholder="Share details (optional)" aria-label="Share details (optional)"></textarea>
|
|
1226
|
+
<p class="feedback-note">This note goes to the ThumbGate team. Pick a reason. The detail line is optional, unless Other is the only reason. Then it needs at least five characters.</p>
|
|
1227
|
+
<div class="feedback-actions">
|
|
1228
|
+
<button class="feedback-submit" id="feedbackSubmit" type="button" disabled onclick="submitFeedback()">Submit</button>
|
|
1229
|
+
</div>
|
|
1230
|
+
<div id="feedbackResult" role="status"></div>
|
|
1154
1231
|
</div>
|
|
1155
|
-
<button class="feedback-toggle" onclick="
|
|
1232
|
+
<button class="feedback-toggle" type="button" onclick="openFeedback()">Feedback</button>
|
|
1156
1233
|
</div>
|
|
1157
1234
|
<script>
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1235
|
+
var feedbackSubmitPending = false;
|
|
1236
|
+
var feedbackOpener = null;
|
|
1237
|
+
function selectedFeedbackReasons() {
|
|
1238
|
+
return Array.from(document.querySelectorAll('.feedback-chip[aria-pressed="true"]')).map(function(button) {
|
|
1239
|
+
return button.getAttribute('data-reason');
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
function feedbackDetail() {
|
|
1243
|
+
return document.getElementById('feedbackText').value.replace(/\s+/g, ' ').trim();
|
|
1244
|
+
}
|
|
1245
|
+
function feedbackFocusables() {
|
|
1246
|
+
return Array.from(document.querySelectorAll('#feedbackPanel button, #feedbackPanel textarea')).filter(function(el) {
|
|
1247
|
+
return !el.disabled;
|
|
1248
|
+
});
|
|
1161
1249
|
}
|
|
1250
|
+
function refreshFeedbackSubmit() {
|
|
1251
|
+
var ids = selectedFeedbackReasons();
|
|
1252
|
+
var note = feedbackDetail();
|
|
1253
|
+
var ready = !feedbackSubmitPending
|
|
1254
|
+
&& ids.length > 0
|
|
1255
|
+
&& !(ids.length === 1 && ids[0] === 'other' && note.length < 5);
|
|
1256
|
+
document.getElementById('feedbackSubmit').disabled = !ready;
|
|
1257
|
+
}
|
|
1258
|
+
function openFeedback() {
|
|
1259
|
+
feedbackOpener = document.activeElement;
|
|
1260
|
+
document.getElementById('feedbackWidget').classList.add('is-open');
|
|
1261
|
+
document.getElementById('feedbackResult').textContent = '';
|
|
1262
|
+
var firstChip = document.querySelector('.feedback-chip');
|
|
1263
|
+
if (firstChip) firstChip.focus();
|
|
1264
|
+
}
|
|
1265
|
+
function closeFeedback() {
|
|
1266
|
+
document.getElementById('feedbackWidget').classList.remove('is-open');
|
|
1267
|
+
if (feedbackOpener && typeof feedbackOpener.focus === 'function') feedbackOpener.focus();
|
|
1268
|
+
}
|
|
1269
|
+
document.getElementById('feedbackChips').addEventListener('click', function(event) {
|
|
1270
|
+
var button = event.target.closest('.feedback-chip');
|
|
1271
|
+
if (!button) return;
|
|
1272
|
+
var pressed = button.getAttribute('aria-pressed') === 'true';
|
|
1273
|
+
button.setAttribute('aria-pressed', pressed ? 'false' : 'true');
|
|
1274
|
+
var label = button.textContent.replace(/^\+\s*/, '').replace(/^✓\s*/, '');
|
|
1275
|
+
button.textContent = pressed ? '+ ' + label : '✓ ' + label;
|
|
1276
|
+
refreshFeedbackSubmit();
|
|
1277
|
+
});
|
|
1278
|
+
document.getElementById('feedbackText').addEventListener('input', refreshFeedbackSubmit);
|
|
1279
|
+
document.addEventListener('keydown', function(event) {
|
|
1280
|
+
var open = document.getElementById('feedbackWidget').classList.contains('is-open');
|
|
1281
|
+
if (!open) return;
|
|
1282
|
+
if (event.key === 'Escape') {
|
|
1283
|
+
closeFeedback();
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
if (event.key !== 'Tab') return;
|
|
1287
|
+
var items = feedbackFocusables();
|
|
1288
|
+
if (!items.length) return;
|
|
1289
|
+
var first = items[0];
|
|
1290
|
+
var last = items[items.length - 1];
|
|
1291
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
1292
|
+
event.preventDefault();
|
|
1293
|
+
last.focus();
|
|
1294
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
1295
|
+
event.preventDefault();
|
|
1296
|
+
first.focus();
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1162
1299
|
async function submitFeedback() {
|
|
1300
|
+
if (feedbackSubmitPending) return;
|
|
1163
1301
|
var btn = document.getElementById('feedbackSubmit');
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1302
|
+
if (btn.disabled) return;
|
|
1303
|
+
feedbackSubmitPending = true;
|
|
1304
|
+
var reasons = selectedFeedbackReasons();
|
|
1305
|
+
var details = feedbackDetail();
|
|
1306
|
+
btn.disabled = true;
|
|
1307
|
+
btn.textContent = 'Submitting...';
|
|
1308
|
+
var result = document.getElementById('feedbackResult');
|
|
1168
1309
|
try {
|
|
1169
|
-
var res = await
|
|
1310
|
+
var res = await projectFetch('/api/feedback/submit', {
|
|
1170
1311
|
method: 'POST',
|
|
1171
1312
|
headers: { 'Content-Type': 'application/json' },
|
|
1172
|
-
body: JSON.stringify({
|
|
1313
|
+
body: JSON.stringify({ reasons: reasons, details: details })
|
|
1173
1314
|
});
|
|
1174
1315
|
var data = await res.json();
|
|
1316
|
+
result.textContent = '';
|
|
1175
1317
|
if (data.success) {
|
|
1176
|
-
|
|
1318
|
+
var line = document.createElement('div');
|
|
1319
|
+
line.className = 'feedback-success';
|
|
1320
|
+
if (data.issueUrl && data.issueNumber) {
|
|
1321
|
+
line.appendChild(document.createTextNode('Thanks. Filed as '));
|
|
1322
|
+
var link = document.createElement('a');
|
|
1323
|
+
link.href = data.issueUrl;
|
|
1324
|
+
link.target = '_blank';
|
|
1325
|
+
link.rel = 'noopener';
|
|
1326
|
+
link.textContent = '#' + data.issueNumber;
|
|
1327
|
+
line.appendChild(link);
|
|
1328
|
+
} else {
|
|
1329
|
+
line.textContent = 'Thanks. Saved for the ThumbGate team.';
|
|
1330
|
+
}
|
|
1331
|
+
result.appendChild(line);
|
|
1177
1332
|
document.getElementById('feedbackText').value = '';
|
|
1333
|
+
document.querySelectorAll('.feedback-chip').forEach(function(button) {
|
|
1334
|
+
button.setAttribute('aria-pressed', 'false');
|
|
1335
|
+
var label = button.textContent.replace(/^✓\s*/, '').replace(/^\+\s*/, '');
|
|
1336
|
+
button.textContent = '+ ' + label;
|
|
1337
|
+
});
|
|
1178
1338
|
} else {
|
|
1179
|
-
|
|
1339
|
+
result.textContent = data.error || 'Could not save that note.';
|
|
1180
1340
|
}
|
|
1181
1341
|
} catch (e) {
|
|
1182
|
-
|
|
1342
|
+
result.textContent = 'Network error. Try again.';
|
|
1343
|
+
} finally {
|
|
1344
|
+
feedbackSubmitPending = false;
|
|
1345
|
+
btn.textContent = 'Submit';
|
|
1346
|
+
refreshFeedbackSubmit();
|
|
1183
1347
|
}
|
|
1184
|
-
btn.disabled = false; btn.textContent = 'Submit';
|
|
1185
1348
|
}
|
|
1186
1349
|
</script>
|
|
1187
1350
|
<script src="/js/buyer-intent.js"></script>
|