thumbgate 0.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/.claude-plugin/README.md +134 -0
  2. package/.claude-plugin/bundle/icon.png +0 -0
  3. package/.claude-plugin/bundle/icon.svg +18 -0
  4. package/.claude-plugin/bundle/server/index.js +24 -0
  5. package/.claude-plugin/marketplace.json +36 -0
  6. package/.claude-plugin/plugin.json +21 -0
  7. package/.well-known/mcp/server-card.json +231 -0
  8. package/LICENSE +21 -0
  9. package/README.md +375 -0
  10. package/adapters/README.md +9 -0
  11. package/adapters/amp/skills/thumbgate-feedback/SKILL.md +22 -0
  12. package/adapters/chatgpt/INSTALL.md +83 -0
  13. package/adapters/chatgpt/openapi.yaml +1281 -0
  14. package/adapters/claude/.mcp.json +14 -0
  15. package/adapters/codex/config.toml +9 -0
  16. package/adapters/gemini/function-declarations.json +224 -0
  17. package/adapters/mcp/server-stdio.js +788 -0
  18. package/adapters/opencode/opencode.json +15 -0
  19. package/bin/cli.js +1484 -0
  20. package/bin/memory.sh +64 -0
  21. package/bin/obsidian-sync.sh +20 -0
  22. package/bin/postinstall.js +37 -0
  23. package/config/build-metadata.json +4 -0
  24. package/config/e2e-critical-flows.json +45 -0
  25. package/config/gate-templates.json +77 -0
  26. package/config/gates/claim-verification.json +29 -0
  27. package/config/gates/computer-use.json +39 -0
  28. package/config/gates/default.json +117 -0
  29. package/config/github-about.json +25 -0
  30. package/config/mcp-allowlists.json +135 -0
  31. package/config/model-tiers.json +33 -0
  32. package/config/partner-routing.json +132 -0
  33. package/config/policy-bundles/constrained-v1.json +64 -0
  34. package/config/policy-bundles/default-v1.json +91 -0
  35. package/config/rubrics/default-v1.json +52 -0
  36. package/config/skill-packs/react-testing.json +23 -0
  37. package/config/skill-packs/stripe-integration/references/api-spec.json +1 -0
  38. package/config/skill-packs/stripe-integration/references/webhook-guide.md +3 -0
  39. package/config/skill-specs/pr-reviewer.json +9 -0
  40. package/config/skill-specs/release-status.json +9 -0
  41. package/config/skill-specs/ticket-triage.json +9 -0
  42. package/config/subagent-profiles.json +32 -0
  43. package/config/tessl-tiles.json +29 -0
  44. package/config/thumbgate-settings.managed.json +12 -0
  45. package/openapi/openapi.yaml +1281 -0
  46. package/package.json +283 -0
  47. package/plugins/amp-skill/INSTALL.md +52 -0
  48. package/plugins/amp-skill/SKILL.md +64 -0
  49. package/plugins/claude-codex-bridge/.claude-plugin/plugin.json +22 -0
  50. package/plugins/claude-codex-bridge/.mcp.json +12 -0
  51. package/plugins/claude-codex-bridge/INSTALL.md +43 -0
  52. package/plugins/claude-codex-bridge/README.md +46 -0
  53. package/plugins/claude-codex-bridge/scripts/codex-bridge.js +288 -0
  54. package/plugins/claude-codex-bridge/skills/adversarial-review/SKILL.md +24 -0
  55. package/plugins/claude-codex-bridge/skills/result/SKILL.md +22 -0
  56. package/plugins/claude-codex-bridge/skills/review/SKILL.md +28 -0
  57. package/plugins/claude-codex-bridge/skills/second-pass/SKILL.md +27 -0
  58. package/plugins/claude-codex-bridge/skills/setup/SKILL.md +21 -0
  59. package/plugins/claude-codex-bridge/skills/status/SKILL.md +19 -0
  60. package/plugins/claude-skill/INSTALL.md +55 -0
  61. package/plugins/claude-skill/SKILL.md +46 -0
  62. package/plugins/codex-profile/.codex-plugin/plugin.json +43 -0
  63. package/plugins/codex-profile/.mcp.json +12 -0
  64. package/plugins/codex-profile/AGENTS.md +20 -0
  65. package/plugins/codex-profile/INSTALL.md +66 -0
  66. package/plugins/codex-profile/README.md +37 -0
  67. package/plugins/cursor-marketplace/.cursor-plugin/plugin.json +23 -0
  68. package/plugins/cursor-marketplace/CHANGELOG.md +30 -0
  69. package/plugins/cursor-marketplace/LICENSE +21 -0
  70. package/plugins/cursor-marketplace/README.md +124 -0
  71. package/plugins/cursor-marketplace/agents/reliability-reviewer.md +31 -0
  72. package/plugins/cursor-marketplace/assets/logo-400x400.png +0 -0
  73. package/plugins/cursor-marketplace/commands/capture-feedback.md +33 -0
  74. package/plugins/cursor-marketplace/commands/check-gates.md +25 -0
  75. package/plugins/cursor-marketplace/commands/show-lessons.md +27 -0
  76. package/plugins/cursor-marketplace/hooks/hooks.json +10 -0
  77. package/plugins/cursor-marketplace/mcp.json +12 -0
  78. package/plugins/cursor-marketplace/rules/feedback-capture.mdc +34 -0
  79. package/plugins/cursor-marketplace/rules/pre-action-gates.mdc +30 -0
  80. package/plugins/cursor-marketplace/rules/session-continuity.mdc +28 -0
  81. package/plugins/cursor-marketplace/scripts/gate-check.sh +11 -0
  82. package/plugins/cursor-marketplace/skills/capture-feedback/SKILL.md +47 -0
  83. package/plugins/cursor-marketplace/skills/prevention-rules/SKILL.md +31 -0
  84. package/plugins/cursor-marketplace/skills/recall-context/SKILL.md +30 -0
  85. package/plugins/cursor-marketplace/skills/search-lessons/SKILL.md +33 -0
  86. package/plugins/gemini-extension/INSTALL.md +92 -0
  87. package/plugins/gemini-extension/gemini_prompt.txt +14 -0
  88. package/plugins/gemini-extension/tool_contract.json +45 -0
  89. package/plugins/opencode-profile/INSTALL.md +57 -0
  90. package/public/assets/instagram-card.png +0 -0
  91. package/public/assets/tiktok-agent-memory.mp4 +0 -0
  92. package/public/blog.html +400 -0
  93. package/public/dashboard.html +1093 -0
  94. package/public/guide.html +317 -0
  95. package/public/index.html +1014 -0
  96. package/public/learn/agent-harness-pattern.html +180 -0
  97. package/public/learn/ai-agent-persistent-memory.html +202 -0
  98. package/public/learn/learn.css +45 -0
  99. package/public/learn/mcp-pre-action-gates-explained.html +172 -0
  100. package/public/learn/stop-ai-agent-force-push.html +134 -0
  101. package/public/learn/vibe-coding-safety-net.html +142 -0
  102. package/public/learn.html +213 -0
  103. package/public/lessons.html +650 -0
  104. package/public/vercel.json +8 -0
  105. package/scripts/__pycache__/train_from_feedback.cpython-312.pyc +0 -0
  106. package/scripts/a2ui-engine.js +73 -0
  107. package/scripts/access-anomaly-detector.js +12 -0
  108. package/scripts/adk-consolidator.js +266 -0
  109. package/scripts/agent-readiness.js +220 -0
  110. package/scripts/agent-security-hardening.js +227 -0
  111. package/scripts/agentic-data-pipeline.js +847 -0
  112. package/scripts/analytics-report.js +328 -0
  113. package/scripts/analytics-window.js +158 -0
  114. package/scripts/async-job-runner.js +1001 -0
  115. package/scripts/audit-trail.js +398 -0
  116. package/scripts/auto-promote-gates.js +299 -0
  117. package/scripts/auto-wire-hooks.js +312 -0
  118. package/scripts/autonomous-sales-agent.js +39 -0
  119. package/scripts/autoresearch-runner.js +216 -0
  120. package/scripts/background-agent-governance.js +237 -0
  121. package/scripts/behavioral-extraction.js +97 -0
  122. package/scripts/belief-update.js +84 -0
  123. package/scripts/billing.js +2438 -0
  124. package/scripts/bot-detector.js +50 -0
  125. package/scripts/budget-guard.js +173 -0
  126. package/scripts/build-claude-mcpb.js +189 -0
  127. package/scripts/build-metadata.js +97 -0
  128. package/scripts/check-congruence.js +322 -0
  129. package/scripts/cli-feedback.js +135 -0
  130. package/scripts/cli-telemetry.js +87 -0
  131. package/scripts/cloudflare-dynamic-sandbox.js +315 -0
  132. package/scripts/code-reasoning.js +350 -0
  133. package/scripts/codegraph-context.js +466 -0
  134. package/scripts/commercial-offer.js +56 -0
  135. package/scripts/computer-use-firewall.js +250 -0
  136. package/scripts/context-engine.js +694 -0
  137. package/scripts/contextfs.js +1287 -0
  138. package/scripts/conversation-context.js +119 -0
  139. package/scripts/creator-campaigns.js +239 -0
  140. package/scripts/daemon-manager.js +108 -0
  141. package/scripts/daily-digest.js +11 -0
  142. package/scripts/dashboard-render-spec.js +395 -0
  143. package/scripts/dashboard.js +1058 -0
  144. package/scripts/data-governance.js +173 -0
  145. package/scripts/delegation-runtime.js +900 -0
  146. package/scripts/deploy-gcp.sh +44 -0
  147. package/scripts/deploy-policy.js +263 -0
  148. package/scripts/disagreement-mining.js +315 -0
  149. package/scripts/dispatch-brief.js +159 -0
  150. package/scripts/distribution-surfaces.js +44 -0
  151. package/scripts/dpo-optimizer.js +209 -0
  152. package/scripts/ephemeral-agent-store.js +219 -0
  153. package/scripts/eval-harness.js +56 -0
  154. package/scripts/evolution-state.js +241 -0
  155. package/scripts/experiment-tracker.js +267 -0
  156. package/scripts/export-databricks-bundle.js +242 -0
  157. package/scripts/export-dpo-pairs.js +345 -0
  158. package/scripts/export-kto-pairs.js +310 -0
  159. package/scripts/export-training.js +448 -0
  160. package/scripts/failure-diagnostics.js +558 -0
  161. package/scripts/feedback-attribution.js +313 -0
  162. package/scripts/feedback-fallback.js +111 -0
  163. package/scripts/feedback-history-distiller.js +391 -0
  164. package/scripts/feedback-inbox-read.js +162 -0
  165. package/scripts/feedback-loop.js +1887 -0
  166. package/scripts/feedback-paths.js +145 -0
  167. package/scripts/feedback-quality.js +139 -0
  168. package/scripts/feedback-root-consolidator.js +238 -0
  169. package/scripts/feedback-schema.js +426 -0
  170. package/scripts/feedback-session.js +286 -0
  171. package/scripts/feedback-to-memory.js +185 -0
  172. package/scripts/feedback-to-rules.js +163 -0
  173. package/scripts/filesystem-search.js +404 -0
  174. package/scripts/funnel-analytics.js +35 -0
  175. package/scripts/gate-satisfy.js +42 -0
  176. package/scripts/gate-stats.js +116 -0
  177. package/scripts/gate-templates.js +70 -0
  178. package/scripts/gates-engine.js +816 -0
  179. package/scripts/generate-paperbanana-diagrams.sh +99 -0
  180. package/scripts/generate-pretool-hook.sh +40 -0
  181. package/scripts/github-about.js +350 -0
  182. package/scripts/github-outreach.js +65 -0
  183. package/scripts/gtm-revenue-loop.js +520 -0
  184. package/scripts/hallucination-detector.js +226 -0
  185. package/scripts/hf-papers.js +317 -0
  186. package/scripts/history-distiller.js +200 -0
  187. package/scripts/hook-auto-capture.sh +95 -0
  188. package/scripts/hook-stop-pr-thread-check.sh +68 -0
  189. package/scripts/hook-stop-self-score.sh +51 -0
  190. package/scripts/hook-stop-verify-deploy.sh +31 -0
  191. package/scripts/hook-thumbgate-cache-updater.js +48 -0
  192. package/scripts/hook-verify-before-done.sh +20 -0
  193. package/scripts/hosted-config.js +170 -0
  194. package/scripts/hybrid-feedback-context.js +676 -0
  195. package/scripts/install-mcp.js +159 -0
  196. package/scripts/intent-router.js +392 -0
  197. package/scripts/internal-agent-bootstrap.js +490 -0
  198. package/scripts/jsonl-watcher.js +155 -0
  199. package/scripts/lesson-db.js +613 -0
  200. package/scripts/lesson-inference.js +315 -0
  201. package/scripts/lesson-retrieval.js +95 -0
  202. package/scripts/lesson-rotation.js +137 -0
  203. package/scripts/lesson-search.js +644 -0
  204. package/scripts/lesson-synthesis.js +196 -0
  205. package/scripts/license.js +50 -0
  206. package/scripts/local-model-profile.js +383 -0
  207. package/scripts/markdown-escape.js +12 -0
  208. package/scripts/marketing-experiment.js +671 -0
  209. package/scripts/mcp-config.js +149 -0
  210. package/scripts/mcp-policy.js +99 -0
  211. package/scripts/memalign-recall.js +111 -0
  212. package/scripts/memory-firewall.js +222 -0
  213. package/scripts/memory-migration.js +296 -0
  214. package/scripts/meta-policy.js +194 -0
  215. package/scripts/metered-billing.js +16 -0
  216. package/scripts/model-tier-router.js +301 -0
  217. package/scripts/money-watcher.js +71 -0
  218. package/scripts/multi-hop-recall.js +240 -0
  219. package/scripts/natural-language-harness.js +330 -0
  220. package/scripts/obsidian-export.js +712 -0
  221. package/scripts/operational-dashboard.js +103 -0
  222. package/scripts/operational-summary.js +93 -0
  223. package/scripts/optimize-context.js +17 -0
  224. package/scripts/org-dashboard.js +201 -0
  225. package/scripts/partner-orchestration.js +146 -0
  226. package/scripts/per-step-scoring.js +165 -0
  227. package/scripts/perplexity-marketing.js +466 -0
  228. package/scripts/pii-scanner.js +153 -0
  229. package/scripts/plan-gate.js +154 -0
  230. package/scripts/post-everywhere.js +308 -0
  231. package/scripts/post-to-x-retry.sh +22 -0
  232. package/scripts/post-to-x.js +369 -0
  233. package/scripts/pr-manager.js +236 -0
  234. package/scripts/predictive-insights.js +356 -0
  235. package/scripts/principle-extractor.js +162 -0
  236. package/scripts/pro-features.js +40 -0
  237. package/scripts/pro-local-dashboard.js +174 -0
  238. package/scripts/problem-detail.js +53 -0
  239. package/scripts/product-feedback.js +134 -0
  240. package/scripts/profile-router.js +245 -0
  241. package/scripts/prompt-dlp.js +221 -0
  242. package/scripts/prompt-guard.js +83 -0
  243. package/scripts/prove-adapters.js +863 -0
  244. package/scripts/prove-attribution.js +365 -0
  245. package/scripts/prove-automation.js +653 -0
  246. package/scripts/prove-autoresearch.js +304 -0
  247. package/scripts/prove-claim-verification.js +277 -0
  248. package/scripts/prove-cloudflare-sandbox.js +163 -0
  249. package/scripts/prove-data-pipeline.js +410 -0
  250. package/scripts/prove-data-quality.js +227 -0
  251. package/scripts/prove-evolution.js +352 -0
  252. package/scripts/prove-harnesses.js +287 -0
  253. package/scripts/prove-intelligence.js +259 -0
  254. package/scripts/prove-lancedb.js +371 -0
  255. package/scripts/prove-local-intelligence.js +342 -0
  256. package/scripts/prove-loop-closure.js +263 -0
  257. package/scripts/prove-predictive-insights.js +357 -0
  258. package/scripts/prove-runtime.js +350 -0
  259. package/scripts/prove-seo-gsd.js +234 -0
  260. package/scripts/prove-settings.js +279 -0
  261. package/scripts/prove-subway-upgrades.js +277 -0
  262. package/scripts/prove-tessl.js +229 -0
  263. package/scripts/prove-training-export.js +327 -0
  264. package/scripts/prove-workflow-contract.js +116 -0
  265. package/scripts/prove-xmemory.js +332 -0
  266. package/scripts/publish-decision.js +133 -0
  267. package/scripts/pulse.js +80 -0
  268. package/scripts/rate-limiter.js +125 -0
  269. package/scripts/reddit-dm-outreach.js +182 -0
  270. package/scripts/reddit-monitor-cron.sh +26 -0
  271. package/scripts/reflector-agent.js +221 -0
  272. package/scripts/reminder-engine.js +132 -0
  273. package/scripts/revenue-status.js +472 -0
  274. package/scripts/risk-scorer.js +458 -0
  275. package/scripts/rlaif-self-audit.js +129 -0
  276. package/scripts/rubric-engine.js +230 -0
  277. package/scripts/schedule-manager.js +251 -0
  278. package/scripts/secret-scanner.js +414 -0
  279. package/scripts/self-heal.js +147 -0
  280. package/scripts/self-healing-check.js +188 -0
  281. package/scripts/semantic-layer.js +98 -0
  282. package/scripts/seo-gsd.js +1153 -0
  283. package/scripts/settings-hierarchy.js +214 -0
  284. package/scripts/shieldcortex-memory-firewall-runner.mjs +53 -0
  285. package/scripts/skill-exporter.js +262 -0
  286. package/scripts/skill-generator.js +446 -0
  287. package/scripts/skill-materializer.js +134 -0
  288. package/scripts/skill-packs.js +136 -0
  289. package/scripts/skill-proposer.js +99 -0
  290. package/scripts/skill-quality-tracker.js +284 -0
  291. package/scripts/slo-alert-engine.js +14 -0
  292. package/scripts/slow-loop.js +72 -0
  293. package/scripts/social-analytics/db/schema.sql +32 -0
  294. package/scripts/social-analytics/digest.js +256 -0
  295. package/scripts/social-analytics/generate-instagram-card.js +97 -0
  296. package/scripts/social-analytics/instagram-thumbgate-post.js +73 -0
  297. package/scripts/social-analytics/mcp-server.js +289 -0
  298. package/scripts/social-analytics/normalizer.js +580 -0
  299. package/scripts/social-analytics/notify.js +162 -0
  300. package/scripts/social-analytics/poll-all.js +107 -0
  301. package/scripts/social-analytics/pollers/github.js +195 -0
  302. package/scripts/social-analytics/pollers/instagram.js +253 -0
  303. package/scripts/social-analytics/pollers/linkedin.js +330 -0
  304. package/scripts/social-analytics/pollers/plausible.js +247 -0
  305. package/scripts/social-analytics/pollers/reddit.js +306 -0
  306. package/scripts/social-analytics/pollers/threads.js +233 -0
  307. package/scripts/social-analytics/pollers/tiktok.js +203 -0
  308. package/scripts/social-analytics/pollers/x.js +227 -0
  309. package/scripts/social-analytics/pollers/youtube.js +304 -0
  310. package/scripts/social-analytics/pollers/zernio.js +180 -0
  311. package/scripts/social-analytics/publish-instagram-thumbgate.js +85 -0
  312. package/scripts/social-analytics/publishers/devto.js +122 -0
  313. package/scripts/social-analytics/publishers/instagram.js +317 -0
  314. package/scripts/social-analytics/publishers/linkedin.js +294 -0
  315. package/scripts/social-analytics/publishers/reddit.js +390 -0
  316. package/scripts/social-analytics/publishers/threads.js +275 -0
  317. package/scripts/social-analytics/publishers/tiktok.js +217 -0
  318. package/scripts/social-analytics/publishers/x.js +259 -0
  319. package/scripts/social-analytics/publishers/youtube.js +223 -0
  320. package/scripts/social-analytics/publishers/zernio.js +209 -0
  321. package/scripts/social-analytics/run-digest.js +34 -0
  322. package/scripts/social-analytics/store.js +257 -0
  323. package/scripts/social-analytics/utm.js +143 -0
  324. package/scripts/social-pipeline.js +2628 -0
  325. package/scripts/social-quality-gate.js +18 -0
  326. package/scripts/social-reply-monitor.js +445 -0
  327. package/scripts/status-dashboard.js +155 -0
  328. package/scripts/statusline-lesson.js +16 -0
  329. package/scripts/statusline-tower.js +8 -0
  330. package/scripts/statusline.sh +116 -0
  331. package/scripts/stripe-live-status.js +115 -0
  332. package/scripts/subagent-profiles.js +79 -0
  333. package/scripts/sync-gh-secrets-from-env.sh +70 -0
  334. package/scripts/sync-github-about.js +52 -0
  335. package/scripts/sync-version.js +451 -0
  336. package/scripts/synthetic-dpo.js +234 -0
  337. package/scripts/telemetry-analytics.js +821 -0
  338. package/scripts/tessl-export.js +371 -0
  339. package/scripts/test-coverage.js +120 -0
  340. package/scripts/thompson-sampling.js +417 -0
  341. package/scripts/thumbgate-search.js +189 -0
  342. package/scripts/tool-kpi-tracker.js +12 -0
  343. package/scripts/tool-registry.js +811 -0
  344. package/scripts/train_from_feedback.py +910 -0
  345. package/scripts/user-profile.js +78 -0
  346. package/scripts/validate-feedback.js +580 -0
  347. package/scripts/validate-workflow-contract.js +287 -0
  348. package/scripts/vector-store.js +198 -0
  349. package/scripts/verification-loop.js +291 -0
  350. package/scripts/verify-obsidian-setup.sh +269 -0
  351. package/scripts/verify-run.js +269 -0
  352. package/scripts/webhook-delivery.js +62 -0
  353. package/scripts/weekly-auto-post.js +124 -0
  354. package/scripts/workflow-runs.js +154 -0
  355. package/scripts/workflow-sprint-intake.js +475 -0
  356. package/scripts/workspace-evolver.js +374 -0
  357. package/scripts/x-autonomous-marketing.js +139 -0
  358. package/scripts/xmemory-lite.js +405 -0
  359. package/skills/agent-memory/SKILL.md +97 -0
  360. package/skills/solve-architecture-autonomy/SKILL.md +17 -0
  361. package/skills/solve-architecture-autonomy/tool.js +33 -0
  362. package/skills/thumbgate/SKILL.md +114 -0
  363. package/skills/thumbgate-feedback/SKILL.md +49 -0
  364. package/src/api/server.js +4208 -0
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { spawnSync } = require('child_process');
7
+
8
+ const {
9
+ buildCloudflareSandboxPlan,
10
+ verifyDispatchEnvelope,
11
+ } = require('./cloudflare-dynamic-sandbox');
12
+
13
+ const ROOT = path.join(__dirname, '..');
14
+ const DEFAULT_PROOF_DIR = process.env.THUMBGATE_PROOF_DIR || path.join(ROOT, 'proof');
15
+
16
+ function npmCommand() {
17
+ return process.platform === 'win32' ? 'npm.cmd' : 'npm';
18
+ }
19
+
20
+ function ensureDir(dirPath) {
21
+ fs.mkdirSync(dirPath, { recursive: true });
22
+ }
23
+
24
+ function runCommand(command, args, cwd = ROOT) {
25
+ const result = spawnSync(command, args, {
26
+ cwd,
27
+ encoding: 'utf8',
28
+ stdio: ['ignore', 'pipe', 'pipe'],
29
+ });
30
+
31
+ return {
32
+ ok: result.status === 0,
33
+ stdout: result.stdout || '',
34
+ stderr: result.stderr || '',
35
+ output: `${result.stdout || ''}${result.stderr || ''}`,
36
+ };
37
+ }
38
+
39
+ function addCheck(report, id, passed, evidence) {
40
+ report.checks.push({ id, passed, evidence });
41
+ if (passed) report.summary.passed += 1;
42
+ else report.summary.failed += 1;
43
+ }
44
+
45
+ function writeReport(report, proofDir) {
46
+ ensureDir(proofDir);
47
+ const jsonPath = path.join(proofDir, 'cloudflare-sandbox-report.json');
48
+ const mdPath = path.join(proofDir, 'cloudflare-sandbox-report.md');
49
+ fs.writeFileSync(jsonPath, JSON.stringify(report, null, 2));
50
+ const markdown = [
51
+ '# Cloudflare Sandbox Proof',
52
+ '',
53
+ `Generated: ${report.generatedAt}`,
54
+ '',
55
+ `Passed: ${report.summary.passed}`,
56
+ `Failed: ${report.summary.failed}`,
57
+ '',
58
+ ...report.checks.map((check) => `- ${check.passed ? 'PASS' : 'FAIL'} ${check.id}: ${check.evidence}`),
59
+ '',
60
+ ].join('\n');
61
+ fs.writeFileSync(mdPath, markdown);
62
+ return { jsonPath, mdPath };
63
+ }
64
+
65
+ function main() {
66
+ const report = {
67
+ generatedAt: new Date().toISOString(),
68
+ checks: [],
69
+ summary: {
70
+ passed: 0,
71
+ failed: 0,
72
+ },
73
+ };
74
+
75
+ const unit = runCommand(process.execPath, [
76
+ '--test',
77
+ 'tests/cloudflare-dynamic-sandbox.test.js',
78
+ 'tests/cloudflare-sandbox-api.test.js',
79
+ ]);
80
+ addCheck(
81
+ report,
82
+ 'CFW-01',
83
+ unit.ok,
84
+ unit.ok ? 'cloudflare sandbox planner + API tests passed' : unit.output.trim(),
85
+ );
86
+
87
+ const worker = runCommand(npmCommand(), [
88
+ 'exec',
89
+ '--yes',
90
+ '--package=tsx',
91
+ '--',
92
+ 'tsx',
93
+ '--test',
94
+ 'workers/src/sandbox.test.ts',
95
+ ]);
96
+ addCheck(
97
+ report,
98
+ 'CFW-02',
99
+ worker.ok,
100
+ worker.ok ? 'worker sandbox route tests passed' : worker.output.trim(),
101
+ );
102
+
103
+ const plan = buildCloudflareSandboxPlan({
104
+ workloadType: 'history_distillation',
105
+ tier: 'team',
106
+ tenantId: 'team_thumbgate',
107
+ requiresIsolation: true,
108
+ allowedHosts: ['api.anthropic.com'],
109
+ context: 'Prove hosted sandbox dispatch.',
110
+ task: { title: 'Proof dispatch' },
111
+ }, {
112
+ sharedSecret: 'proof-secret',
113
+ now: '2026-04-03T16:00:00.000Z',
114
+ });
115
+ addCheck(
116
+ report,
117
+ 'CFW-03',
118
+ plan.provider === 'cloudflare_dynamic_worker' && plan.shouldDispatch === true,
119
+ `provider=${plan.provider}; shouldDispatch=${plan.shouldDispatch}; route=${plan.route}`,
120
+ );
121
+
122
+ const signatureOk = verifyDispatchEnvelope({
123
+ body: plan.envelope,
124
+ secret: 'proof-secret',
125
+ timestamp: plan.headers['x-thumbgate-sandbox-timestamp'],
126
+ signature: plan.headers['x-thumbgate-sandbox-signature'],
127
+ now: Date.parse('2026-04-03T16:00:00.000Z'),
128
+ });
129
+ addCheck(
130
+ report,
131
+ 'CFW-04',
132
+ signatureOk,
133
+ `signatureReady=${plan.signatureReady}; verified=${signatureOk}`,
134
+ );
135
+
136
+ const repoBound = buildCloudflareSandboxPlan({
137
+ workloadType: 'workflow_triage',
138
+ tier: 'team',
139
+ repoPath: '/tmp/repo',
140
+ });
141
+ addCheck(
142
+ report,
143
+ 'CFW-05',
144
+ repoBound.provider === 'railway_control_plane' && repoBound.shouldDispatch === false,
145
+ `provider=${repoBound.provider}; shouldDispatch=${repoBound.shouldDispatch}`,
146
+ );
147
+
148
+ addCheck(
149
+ report,
150
+ 'CFW-06',
151
+ Array.isArray(plan.envelope.bindings) && plan.envelope.bindings.includes('MEMORY_KV'),
152
+ `bindings=${plan.envelope.bindings.join(',')}`,
153
+ );
154
+
155
+ const { jsonPath, mdPath } = writeReport(report, DEFAULT_PROOF_DIR);
156
+ console.log(`Cloudflare sandbox proof written to ${jsonPath} and ${mdPath}`);
157
+
158
+ if (report.summary.failed > 0) {
159
+ process.exitCode = 1;
160
+ }
161
+ }
162
+
163
+ main();
@@ -0,0 +1,410 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const os = require('node:os');
5
+ const path = require('node:path');
6
+
7
+ const ROOT = path.join(__dirname, '..');
8
+
9
+ function resolveProofPaths() {
10
+ const proofDir = process.env.THUMBGATE_PROOF_DIR || path.join(ROOT, 'proof');
11
+ return {
12
+ proofDir,
13
+ reportJson: path.join(proofDir, 'data-pipeline-report.json'),
14
+ reportMd: path.join(proofDir, 'data-pipeline-report.md'),
15
+ };
16
+ }
17
+
18
+ function loadFresh(modulePath) {
19
+ const resolved = require.resolve(modulePath);
20
+ delete require.cache[resolved];
21
+ return require(modulePath);
22
+ }
23
+
24
+ function buildStubTelemetry() {
25
+ return {
26
+ window: {
27
+ window: '30d',
28
+ timeZone: 'America/New_York',
29
+ bounded: true,
30
+ startLocalDate: '2026-03-01',
31
+ endLocalDate: '2026-03-30',
32
+ now: '2026-03-30T12:00:00.000Z',
33
+ },
34
+ totalEvents: 3,
35
+ latestSeenAt: '2026-03-30T12:00:00.000Z',
36
+ byClientType: { web: 3 },
37
+ byEventType: { landing_page_view: 1, checkout_start: 1, reason_not_buying: 1 },
38
+ visitors: {
39
+ totalEvents: 3,
40
+ uniqueVisitors: 1,
41
+ uniqueSessions: 1,
42
+ pageViews: 1,
43
+ attributedPageViews: 1,
44
+ attributionCoverageRate: 1,
45
+ visitorIdCoverageRate: 1,
46
+ sessionIdCoverageRate: 1,
47
+ acquisitionIdCoverageRate: 1,
48
+ byCreator: { reach_vb: 1 },
49
+ bySource: { producthunt: 1 },
50
+ byCampaign: { ph_launch: 1 },
51
+ byTrafficChannel: { producthunt: 1 },
52
+ byCommunity: { ProductHunt: 1 },
53
+ byOfferCode: { PH_EARLY: 1 },
54
+ byCampaignVariant: { launch_comment: 1 },
55
+ byReferrerHost: { 'www.producthunt.com': 1 },
56
+ },
57
+ ctas: {
58
+ totalClicks: 1,
59
+ checkoutStarts: 1,
60
+ uniqueCheckoutStarters: 1,
61
+ checkoutFailures: 0,
62
+ checkoutCancelled: 0,
63
+ checkoutAbandoned: 0,
64
+ paidConfirmations: 1,
65
+ byCreator: { reach_vb: 1 },
66
+ bySource: { producthunt: 1 },
67
+ byCampaign: { ph_launch: 1 },
68
+ byTrafficChannel: { producthunt: 1 },
69
+ byCommunity: { ProductHunt: 1 },
70
+ byOfferCode: { PH_EARLY: 1 },
71
+ byCampaignVariant: { launch_comment: 1 },
72
+ checkoutStartsBySource: { producthunt: 1 },
73
+ checkoutStartsByCampaign: { ph_launch: 1 },
74
+ checkoutStartsByTrafficChannel: { producthunt: 1 },
75
+ checkoutStartsByCreator: { reach_vb: 1 },
76
+ checkoutStartsByCommunity: { ProductHunt: 1 },
77
+ checkoutStartsByOfferCode: { PH_EARLY: 1 },
78
+ checkoutStartsByCampaignVariant: { launch_comment: 1 },
79
+ byId: { pricing_pro: 1 },
80
+ },
81
+ buyerLoss: {
82
+ totalSignals: 1,
83
+ reasonsByCode: { too_expensive: 1 },
84
+ },
85
+ seo: {
86
+ landingViews: 0,
87
+ bySurface: {},
88
+ byQuery: {},
89
+ },
90
+ cli: {
91
+ uniqueInstalls: 0,
92
+ byPlatform: {},
93
+ },
94
+ recent: [],
95
+ };
96
+ }
97
+
98
+ function buildStubBilling(overrides = {}) {
99
+ return {
100
+ generatedAt: '2026-03-30T12:00:00.000Z',
101
+ window: {
102
+ window: '30d',
103
+ timeZone: 'America/New_York',
104
+ bounded: true,
105
+ startLocalDate: '2026-03-01',
106
+ endLocalDate: '2026-03-30',
107
+ now: '2026-03-30T12:00:00.000Z',
108
+ },
109
+ coverage: {
110
+ source: 'funnel_ledger+revenue_ledger+key_store+workflow_sprint_leads',
111
+ },
112
+ signups: {
113
+ uniqueLeads: 1,
114
+ },
115
+ revenue: {
116
+ paidCustomers: 1,
117
+ bookedRevenueCents: 4900,
118
+ },
119
+ pipeline: {
120
+ workflowSprintLeads: { byCreator: { reach_vb: 1 } },
121
+ qualifiedWorkflowSprintLeads: { byCreator: { reach_vb: 1 } },
122
+ },
123
+ attribution: {
124
+ acquisitionByCreator: { reach_vb: 1 },
125
+ acquisitionBySource: { producthunt: 1 },
126
+ acquisitionByCampaign: { ph_launch: 1 },
127
+ acquisitionByCommunity: { ProductHunt: 1 },
128
+ acquisitionByOfferCode: { PH_EARLY: 1 },
129
+ paidByCreator: { reach_vb: 1 },
130
+ paidBySource: { producthunt: 1 },
131
+ paidByCampaign: { ph_launch: 1 },
132
+ paidByCommunity: { ProductHunt: 1 },
133
+ paidByOfferCode: { PH_EARLY: 1 },
134
+ bookedRevenueByCreatorCents: { reach_vb: 4900 },
135
+ bookedRevenueBySourceCents: { producthunt: 4900 },
136
+ bookedRevenueByCampaignCents: { ph_launch: 4900 },
137
+ bookedRevenueByCommunityCents: { ProductHunt: 4900 },
138
+ bookedRevenueByOfferCodeCents: { PH_EARLY: 4900 },
139
+ },
140
+ trafficMetrics: {},
141
+ operatorGeneratedAcquisition: {},
142
+ dataQuality: {
143
+ unreconciledPaidEvents: 0,
144
+ },
145
+ keys: {
146
+ active: 1,
147
+ totalUsage: 42,
148
+ },
149
+ ...overrides,
150
+ };
151
+ }
152
+
153
+ async function run() {
154
+ const results = { passed: 0, failed: 0, requirements: {} };
155
+ const { proofDir, reportJson, reportMd } = resolveProofPaths();
156
+
157
+ const checks = [
158
+ {
159
+ id: 'DATA-PIPE-01',
160
+ desc: 'materializeAgenticDataPipeline builds raw, staging, semantic, and lineage layers from billing and telemetry inputs',
161
+ fn: async () => {
162
+ const { materializeAgenticDataPipeline } = loadFresh('./agentic-data-pipeline');
163
+ const feedbackDir = fs.mkdtempSync(path.join(os.tmpdir(), 'thumbgate-data-pipeline-proof-'));
164
+ try {
165
+ const snapshot = await materializeAgenticDataPipeline({
166
+ feedbackDir,
167
+ write: false,
168
+ recordWorkflowRun: false,
169
+ telemetryEvents: [
170
+ {
171
+ receivedAt: '2026-03-30T11:00:00.000Z',
172
+ eventType: 'landing_page_view',
173
+ },
174
+ {
175
+ receivedAt: '2026-03-30T11:05:00.000Z',
176
+ eventType: 'checkout_start',
177
+ },
178
+ ],
179
+ telemetryAnalytics: buildStubTelemetry(),
180
+ billingSummary: buildStubBilling(),
181
+ });
182
+
183
+ if (snapshot.semantic.metrics.bookedRevenueCents !== 4900) {
184
+ throw new Error('Expected booked revenue semantic metric');
185
+ }
186
+ if (!snapshot.staging.dims.creators.some((entry) => entry.key === 'reach_vb')) {
187
+ throw new Error('Expected one staged creator row');
188
+ }
189
+ if (snapshot.staging.dims.sources.length !== 1) {
190
+ throw new Error('Expected one staged source row');
191
+ }
192
+ if (snapshot.lineage.stages.length !== 3) {
193
+ throw new Error('Expected three lineage stages');
194
+ }
195
+ } finally {
196
+ fs.rmSync(feedbackDir, { recursive: true, force: true });
197
+ }
198
+ },
199
+ },
200
+ {
201
+ id: 'DATA-PIPE-02',
202
+ desc: 'pipeline reruns are idempotent and downgrade to noop when source hashes do not change',
203
+ fn: async () => {
204
+ const { materializeAgenticDataPipeline } = loadFresh('./agentic-data-pipeline');
205
+ const feedbackDir = fs.mkdtempSync(path.join(os.tmpdir(), 'thumbgate-data-pipeline-proof-'));
206
+ try {
207
+ const first = await materializeAgenticDataPipeline({
208
+ feedbackDir,
209
+ write: true,
210
+ recordWorkflowRun: false,
211
+ telemetryEvents: [{ receivedAt: '2026-03-30T11:00:00.000Z', eventType: 'landing_page_view' }],
212
+ telemetryAnalytics: buildStubTelemetry(),
213
+ billingSummary: buildStubBilling(),
214
+ });
215
+ const second = await materializeAgenticDataPipeline({
216
+ feedbackDir,
217
+ write: true,
218
+ recordWorkflowRun: false,
219
+ telemetryEvents: [{ receivedAt: '2026-03-30T11:00:00.000Z', eventType: 'landing_page_view' }],
220
+ telemetryAnalytics: buildStubTelemetry(),
221
+ billingSummary: buildStubBilling(),
222
+ });
223
+
224
+ if (first.snapshotId !== second.snapshotId) {
225
+ throw new Error('Expected stable snapshot IDs across identical reruns');
226
+ }
227
+ if (second.lineage.incremental.mode !== 'noop') {
228
+ throw new Error('Expected noop incremental mode on identical rerun');
229
+ }
230
+ } finally {
231
+ fs.rmSync(feedbackDir, { recursive: true, force: true });
232
+ }
233
+ },
234
+ },
235
+ {
236
+ id: 'DATA-PIPE-03',
237
+ desc: 'reconciliation flags unreconciled paid events and telemetry coverage drift as warnings',
238
+ fn: async () => {
239
+ const { materializeAgenticDataPipeline } = loadFresh('./agentic-data-pipeline');
240
+ const feedbackDir = fs.mkdtempSync(path.join(os.tmpdir(), 'thumbgate-data-pipeline-proof-'));
241
+ try {
242
+ const snapshot = await materializeAgenticDataPipeline({
243
+ feedbackDir,
244
+ write: false,
245
+ recordWorkflowRun: false,
246
+ telemetryEvents: [{ receivedAt: '2026-03-30T11:00:00.000Z', eventType: 'landing_page_view' }],
247
+ telemetryAnalytics: {
248
+ ...buildStubTelemetry(),
249
+ visitors: {
250
+ ...buildStubTelemetry().visitors,
251
+ attributionCoverageRate: 0.25,
252
+ },
253
+ ctas: {
254
+ ...buildStubTelemetry().ctas,
255
+ checkoutStarts: 0,
256
+ },
257
+ },
258
+ billingSummary: buildStubBilling({
259
+ revenue: {
260
+ paidCustomers: 2,
261
+ bookedRevenueCents: 4900,
262
+ },
263
+ dataQuality: {
264
+ unreconciledPaidEvents: 1,
265
+ },
266
+ }),
267
+ });
268
+
269
+ if (snapshot.staging.reconciliation.status !== 'warning') {
270
+ throw new Error('Expected warning reconciliation status');
271
+ }
272
+ if (snapshot.semantic.metrics.pipelineWarnings < 2) {
273
+ throw new Error('Expected multiple pipeline warnings');
274
+ }
275
+ } finally {
276
+ fs.rmSync(feedbackDir, { recursive: true, force: true });
277
+ }
278
+ },
279
+ },
280
+ {
281
+ id: 'DATA-PIPE-04',
282
+ desc: 'schedule manager emits a managed async-job spec for automated pipeline materialization',
283
+ fn: () => {
284
+ const { buildAgenticDataPipelineSchedule } = loadFresh('./schedule-manager');
285
+ const schedule = buildAgenticDataPipelineSchedule({
286
+ id: 'nightly-data-pipeline',
287
+ feedbackDir: '/tmp/thumbgate-feedback',
288
+ outDir: '/tmp/thumbgate-pipeline',
289
+ window: '30d',
290
+ recordWorkflowRun: false,
291
+ });
292
+
293
+ if (!schedule.command.includes('async-job-runner.js')) {
294
+ throw new Error('Expected async job runner schedule command');
295
+ }
296
+ if (schedule.jobSpec.stages[0].name !== 'materialize_pipeline') {
297
+ throw new Error('Expected pipeline materialization stage');
298
+ }
299
+ },
300
+ },
301
+ {
302
+ id: 'DATA-PIPE-05',
303
+ desc: 'semantic-layer consumes the staged pipeline and surfaces pipeline quality metrics',
304
+ fn: async () => {
305
+ const { getBusinessMetrics } = loadFresh('./semantic-layer');
306
+ const metrics = await getBusinessMetrics({
307
+ write: false,
308
+ recordWorkflowRun: false,
309
+ telemetryEvents: [{ receivedAt: '2026-03-30T11:00:00.000Z', eventType: 'landing_page_view' }],
310
+ telemetryAnalytics: buildStubTelemetry(),
311
+ billingSummary: buildStubBilling(),
312
+ });
313
+
314
+ if (metrics.pipeline.reconciliationStatus !== 'healthy') {
315
+ throw new Error('Expected healthy reconciliation status');
316
+ }
317
+ if (metrics.metrics.attributionCoverageRate !== 1) {
318
+ throw new Error('Expected attribution coverage metric');
319
+ }
320
+ },
321
+ },
322
+ {
323
+ id: 'DATA-PIPE-06',
324
+ desc: 'verify-run full includes the data-pipeline proof lane and artifact',
325
+ fn: () => {
326
+ const { buildVerifyPlan, recordVerifyWorkflowRun } = loadFresh('./verify-run');
327
+ const commands = buildVerifyPlan('full')
328
+ .map((step) => [step.command, ...(step.args || [])].join(' '))
329
+ .join('\n');
330
+
331
+ if (!commands.includes('prove:data-pipeline')) {
332
+ throw new Error('verify:full is missing prove:data-pipeline');
333
+ }
334
+
335
+ const feedbackDir = fs.mkdtempSync(path.join(os.tmpdir(), 'thumbgate-data-pipeline-proof-'));
336
+ const cwd = fs.mkdtempSync(path.join(os.tmpdir(), 'thumbgate-data-pipeline-proof-cwd-'));
337
+ try {
338
+ const entry = recordVerifyWorkflowRun('full', cwd, feedbackDir);
339
+ if (!entry.proofArtifacts.some((artifact) => artifact.endsWith(path.join('proof', 'data-pipeline-report.json')))) {
340
+ throw new Error('verify workflow run is missing data pipeline proof artifact');
341
+ }
342
+ } finally {
343
+ fs.rmSync(feedbackDir, { recursive: true, force: true });
344
+ fs.rmSync(cwd, { recursive: true, force: true });
345
+ }
346
+ },
347
+ },
348
+ ];
349
+
350
+ console.log('Agentic Data Pipeline - Proof Gate\n');
351
+ console.log('Checking requirements:\n');
352
+
353
+ for (const check of checks) {
354
+ try {
355
+ await check.fn();
356
+ results.passed += 1;
357
+ results.requirements[check.id] = { desc: check.desc, status: 'passed' };
358
+ console.log(`✅ ${check.id} — ${check.desc}`);
359
+ } catch (error) {
360
+ results.failed += 1;
361
+ results.requirements[check.id] = {
362
+ desc: check.desc,
363
+ status: 'failed',
364
+ error: error.message,
365
+ };
366
+ console.log(`❌ ${check.id} — ${check.desc}`);
367
+ console.log(` ${error.message}`);
368
+ }
369
+ }
370
+
371
+ ensureDir(proofDir);
372
+ const report = {
373
+ phase: '15-agentic-data-pipeline',
374
+ generatedAt: new Date().toISOString(),
375
+ passed: results.passed,
376
+ failed: results.failed,
377
+ requirements: results.requirements,
378
+ };
379
+ fs.writeFileSync(reportJson, `${JSON.stringify(report, null, 2)}\n`, 'utf8');
380
+
381
+ const markdown = [
382
+ '# Agentic Data Pipeline Proof Report',
383
+ '',
384
+ `- passed: ${results.passed}`,
385
+ `- failed: ${results.failed}`,
386
+ '',
387
+ ...Object.entries(results.requirements).map(([id, entry]) => {
388
+ const prefix = entry.status === 'passed' ? '[x]' : '[ ]';
389
+ const suffix = entry.error ? ` — ${entry.error}` : '';
390
+ return `${prefix} **${id}** ${entry.desc}${suffix}`;
391
+ }),
392
+ '',
393
+ `${results.passed} passed, ${results.failed} failed`,
394
+ ].join('\n');
395
+ fs.writeFileSync(reportMd, `${markdown}\n`, 'utf8');
396
+
397
+ console.log(`\n${results.passed} passed, ${results.failed} failed`);
398
+ if (results.failed > 0) {
399
+ process.exitCode = 1;
400
+ }
401
+ }
402
+
403
+ function ensureDir(dirPath) {
404
+ fs.mkdirSync(dirPath, { recursive: true });
405
+ }
406
+
407
+ run().catch((error) => {
408
+ console.error(error.message);
409
+ process.exit(1);
410
+ });