Site assistant (Marty 2026-11-15): chat widget in the Stack POL look on every page, CANNED + FACTS from this repo (the on-page FAQ, programs.js, the 5-minute indexer, opt-in member pages, holds nothing, no income promise), retrieval over the shared network knowledge base on the hub (netkb.js as hub site stackpol; another site named = its answer, with its tracked LinkSpin link), reasoning off, account problems hand off to network support. Static server now serves .js/.css; Dockerfile copies the chat modules. chatbot.test 125 pass

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-15 13:11:04 -06:00
parent 3a6ac0a81e
commit 7446df2f4f
12 changed files with 916 additions and 3 deletions
+75
View File
@@ -0,0 +1,75 @@
// Stack POL's site assistant (Marty 2026-11-15): what it knows. The engine is chatcore.js (the same on every rebuilt site);
// retrieval also covers the other network sites through the hub (netkb.js), this site's entries first.
// Stack POL has no database and no data volume: its own entries live in memory (seeded from this file at boot), and the
// OpenRouter key comes from the OPENROUTER_API_KEY env (a Coolify secret). No admin knowledge-base editing here.
//
// Every fact below was checked against this repo on KNOWLEDGE_DATE: server.js (the on-page FAQ, the pages, /api/totals, member
// stacks only when switched on), programs.js (the programs and their kinds), README.md (the indexer refreshes every 5 minutes;
// members are named only when opted in). Stack POL sells nothing and holds nothing.
// HOUSE RULE: when a feature changes, update CANNED and FACTS in the same commit and bump KNOWLEDGE_DATE.
// Plain words, no em dashes, never a promise of income, never quote totals as what someone will earn, never RM Circle.
'use strict';
const core = require('./chatcore');
const { PROGRAMS } = require('./programs');
const KNOWLEDGE_DATE = '2026-11-15';
const URL_ = String(process.env.SITE_URL || 'https://stackpol.com').replace(/\/+$/, '');
const SUPPORT = 'https://instantadpay.com/support';
const NAMES = PROGRAMS.map(p => p.n).join(', ');
const NOT_INCOME = 'No promise of income is made: the totals are what the whole network has paid so far, and many members earn little or nothing.';
const CANNED = [
{ id: 'support', title: 'Talk to a person, or a problem with my account', q: ['How do I contact support?', 'My payout is not on the ledger', 'I need a real person'], tags: ['support', 'help', 'ticket', 'problem'],
re: core.SUPPORT_RE, handoff: true,
a: 'Network support handles every network site: open ' + SUPPORT + ', say which program it is about, and include your username, your wallet address and the transaction link if you have one. Marty answers there and by email. Tap "Open network support" below and your question goes with you.' },
{ id: 'about', title: 'What is Stack POL?', q: ['What is Stack POL?', 'How does Stack POL work?', 'What is this site?'], tags: ['stack pol', 'overview', 'ledger', 'payouts'],
re: /(what('s| is) (stack ?pol|this (site|place))|how does (stack ?pol|this site|it) work)/i,
a: 'Stack POL adds up every POL payout from the programs in the network: InstantAdPay, LinkSpin, the other network sites and the games that pay POL. The front page shows everyone combined, every row links to its Polygon transaction, and a member who switches it on gets their own page with their own stack. Stack POL only shows payouts; it sells nothing and holds nothing. ' + NOT_INCOME },
{ id: 'numbers', title: 'Where the numbers come from', q: ['Where do the numbers come from?', 'How often does it update?', 'Can I check a payment?'], tags: ['numbers', 'ledger', 'polygonscan', 'update'],
re: /(where do the numbers|numbers come from|how often|update[sd]?\b|refresh|check (a |the )?payment|polygonscan|verify)/i,
a: 'From each program\'s own payout records and from the network contracts on Polygon, refreshed every 5 minutes. Every row in the ledger (' + URL_ + '/ledger) links to its Polygon transaction, so anyone can check it on Polygonscan.' },
{ id: 'income', title: 'Is this income? Will I earn this much?', q: ['Will I earn this much?', 'Is this income?', 'How much can I make?'], tags: ['income', 'earnings', 'promise'],
re: /(will i (earn|make|get)|how much (can|will|do) (i|you|people) (earn|make)|is (this|it) income|earn this much|guarantee)/i,
a: NOT_INCOME + ' What one member stacks depends on what they do in each program.' },
{ id: 'my-page', title: 'Your own Stack POL page', q: ['How do I get my own Stack POL page?', 'Why is my name not on Stack POL?', 'How do I hide my page?'], tags: ['my page', 'opt in', 'username', 'promo tools'],
re: /(my (own )?(stack|page)|own (stack )?page|switch on|opt.?in|my name (is )?not|hide my|show my stack)/i,
a: 'Join InstantAdPay free, link a wallet, and switch on "Show my Stack POL page" in Promo tools. Your page lives at ' + URL_ + '/your-username and updates every 5 minutes. Members are named on Stack POL only when they switch it on.' },
{ id: 'programs', title: 'Which programs are on Stack POL', q: ['Which programs are on Stack POL?', 'Where does the POL come from?', 'Are the games included?'], tags: ['programs', 'games', 'sites', 'earn pages'],
re: /(which programs|what programs|programs (are|on)|where does the pol come from|games? (included|on)|\/earn)/i,
a: 'The programs on Stack POL: ' + NAMES + '. Each has its own page (for example ' + URL_ + '/earn/viraladblitz) and its own ledger filter, and each pays straight to members\' own wallets on Polygon. See them all at ' + URL_ + '/programs' },
{ id: 'start', title: 'How to start', q: ['How do I start?', 'How do I join?', 'Is it free?'], tags: ['join', 'start', 'free', 'instantadpay'],
re: /(how (do|can) i (start|join|sign ?up)|\bjoin\b|sign ?up|get started|is (it|this) free|free to join)/i,
a: 'Start free on InstantAdPay (https://instantadpay.com/join): one network account works across every network site. What you stack depends on what you do in each program. ' + NOT_INCOME },
{ id: 'custody', title: 'Does Stack POL hold my money?', q: ['Does Stack POL hold my money?', 'How do I withdraw from Stack POL?'], tags: ['custody', 'withdraw', 'wallet', 'safe'],
re: /(hold (my|the) (money|funds|pol)|withdraw|cash ?out|balance|safe|scam|legit)/i,
a: 'No. Stack POL only shows payouts. Every payment goes straight from the program to your own wallet on Polygon, so there is nothing here to withdraw.' },
{ id: 'pol', title: 'What is POL?', q: ['What is POL?', 'Is POL the same as MATIC?', 'Which wallet do I need?'], tags: ['pol', 'polygon', 'matic', 'wallet'],
re: /(what is pol|\bpol\b|matic|polygon|wallet|safepal|metamask)/i,
a: 'POL is the native token of the Polygon network, formerly MATIC. Fees are a fraction of a cent and transfers confirm in seconds, which is why small payouts work on it. To receive payouts, use SafePal or any other crypto wallet on Polygon, and never share your recovery phrase.' },
{ id: 'blog', title: 'The blog', q: ['Is there a blog?', 'Where are the guides?'], tags: ['blog', 'guides', 'articles'],
re: /\bblog\b|articles?|guides?|rss/i,
a: 'The blog at ' + URL_ + '/blog has guides on building in POL across the network, with an RSS feed at ' + URL_ + '/blog/feed.xml.' }
];
const FAQ = [
{ id: 'f-network', title: 'Stack POL and the network', source: 'faq', tags: ['network', 'one account'],
questions: ['Is Stack POL part of InstantAdPay?', 'Which network sites are there?'],
answer: 'Stack POL is the network\'s payout tracker. One network account works across InstantAdPay, LinkSpin, Downline Banners, Viral Banner Blitz, ViralAdBlitz, DownlineHydra, 5xYourTeam, Stack POL and Earners Corner, and each site\'s member payouts show here.' }
];
const FACTS = () => [
'- WHAT IT IS: Stack POL (' + URL_ + ') adds up every POL payout across the network: ' + NAMES + '. Front page = everyone combined (network totals, last 7 days, latest payouts), /programs, /earn/<program> pages, /ledger (filter ?p=), opt-in member pages ' + URL_ + '/<username>, /blog. It sells nothing and holds nothing: every payment goes from the program straight to the member\'s wallet on Polygon.',
'- DATA: each program\'s payout records and the network contracts on Polygon, refreshed every 5 minutes; every ledger row links to its Polygon transaction. Members are named only when they switch on "Show my Stack POL page" in InstantAdPay Promo tools (join InstantAdPay free and link a wallet first).',
'- NEVER quote a total as what someone will earn; never state a maximum. ' + NOT_INCOME,
'- For how a program pays (prices, splits, rules), use that program\'s own knowledge-base entries and send people to that site. SUPPORT: network support at ' + SUPPORT + '.'
].join('\n');
const SITE = {
id: 'stackpol', hubSite: 'stackpol', netId: 'stackpol', name: 'Stack POL', url: URL_, supportUrl: SUPPORT, knowledgeDate: KNOWLEDGE_DATE,
dataDir: null, canned: CANNED, faq: FAQ, facts: FACTS,
intro: 'You are the assistant on Stack POL (' + URL_ + '), the network\'s payout tracker: it adds up every POL payout across the network\'s sites and games, each one checkable on Polygon. Most questions about how to earn belong to a specific program: answer from that program\'s entries and link to it.',
quickTopics: ['What is Stack POL?', 'How do I get my own page?', 'What is ViralAdBlitz?', 'How does Downline Banners pay?']
};
function init() { return core.init(SITE); }
module.exports = { init, handle: core.handle, answer: core.answer, KNOWLEDGE_DATE, CANNED, FAQ, SITE };