@vesviet/agent-skills 5.7.3 → 5.10.0

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 (241) hide show
  1. package/INDEX.md +21 -18
  2. package/README.md +11 -10
  3. package/VERSION +1 -1
  4. package/adapters/antigravity/ANTIGRAVITY.md +89 -4
  5. package/adapters/antigravity/INDEX_TIER1.json +1294 -0
  6. package/adapters/antigravity/a2a-config.template.yaml +22 -8
  7. package/adapters/antigravity/role-skill-index.json +48 -19
  8. package/adapters/claude/CLAUDE_ADAPTER.md +1 -1
  9. package/adapters/claude/settings.template.json +7 -3
  10. package/adapters/cursor/hooks.template.json +3 -1
  11. package/core/contracts/README.md +4 -1
  12. package/core/contracts/schemas/INDEX.md +7 -1
  13. package/core/contracts/schemas/a2a-artifact.json +9 -2
  14. package/core/contracts/schemas/a2a-jsonrpc-envelope.json +7 -2
  15. package/core/contracts/schemas/a2a-task-progress.json +15 -4
  16. package/core/contracts/schemas/a2a-task.json +11 -3
  17. package/core/contracts/schemas/agent-card.json +48 -1
  18. package/core/contracts/schemas/agent-skills-discovery.json +91 -0
  19. package/core/contracts/schemas/compliance-report.json +255 -0
  20. package/core/contracts/schemas/mcp-server-card.json +193 -0
  21. package/core/contracts/schemas/seo-content-brief.json +1 -1
  22. package/core/contracts/schemas/seo-weekly-board.json +1 -1
  23. package/core/contracts/schemas/series-article.json +1 -1
  24. package/core/policies/action-boundaries.yaml +334 -2
  25. package/core/policies/mcp-tool-map.yaml +61 -4
  26. package/core/roles/3d-graphics-engineer.md +5 -1
  27. package/core/roles/README.md +1 -1
  28. package/core/roles/agent-coordinator.md +21 -3
  29. package/core/roles/agent-discovery-engineer.md +27 -8
  30. package/core/roles/ai-systems-engineer.md +3 -1
  31. package/core/roles/aws-engineer.md +6 -8
  32. package/core/roles/backend-developer.md +5 -5
  33. package/core/roles/business-analyst.md +4 -2
  34. package/core/roles/cloudflare-engineer.md +4 -2
  35. package/core/roles/content-manager.md +3 -1
  36. package/core/roles/content-writer.md +3 -1
  37. package/core/roles/data-analyst.md +3 -1
  38. package/core/roles/data-engineer.md +3 -1
  39. package/core/roles/devops-engineer.md +9 -9
  40. package/core/roles/ecommerce-engineer.md +7 -7
  41. package/core/roles/frontend-developer.md +10 -8
  42. package/core/roles/game-developer.md +5 -3
  43. package/core/roles/mmo-engineer.md +8 -9
  44. package/core/roles/mobile-engineer.md +5 -3
  45. package/core/roles/product-manager.md +8 -9
  46. package/core/roles/project-manager.md +10 -13
  47. package/core/roles/prompt-engineer.md +6 -4
  48. package/core/roles/qa-engineer.md +9 -9
  49. package/core/roles/references/vietnam-accounting-specialist-review-checklist.md +6 -6
  50. package/core/roles/researcher.md +12 -14
  51. package/core/roles/reverse-engineer.md +5 -2
  52. package/core/roles/reviewer.md +7 -5
  53. package/core/roles/role-standard.md +23 -1
  54. package/core/roles/sdet.md +7 -5
  55. package/core/roles/security-engineer.md +9 -7
  56. package/core/roles/seo-analyst.md +9 -7
  57. package/core/roles/solution-architect.md +8 -9
  58. package/core/roles/sre.md +8 -6
  59. package/core/roles/system-engineer.md +20 -20
  60. package/core/roles/task-planner.md +8 -10
  61. package/core/roles/teacher.md +8 -6
  62. package/core/roles/technical-architect.md +10 -8
  63. package/core/roles/technical-lead.md +9 -7
  64. package/core/roles/technical-writer.md +8 -6
  65. package/core/roles/ui-ux-designer.md +8 -7
  66. package/core/roles/vietnam-accounting-specialist.md +26 -24
  67. package/core/roles/vietnam-legal-counsel.md +6 -4
  68. package/core/rules/code.md +11 -6
  69. package/core/skills/README.md +3 -2
  70. package/core/skills/agent/agent-a2a-protocol/SKILL.md +25 -93
  71. package/core/skills/agent/agent-memory-compaction/SKILL.md +27 -0
  72. package/core/skills/agent/architect-mcp-server/SKILL.md +35 -27
  73. package/core/skills/agent/configure-agent-commerce/SKILL.md +2 -0
  74. package/core/skills/agent/configure-agent-commerce/examples/ucp-commerce-manifest-and-endpoints.json +55 -0
  75. package/core/skills/agent/configure-agent-commerce/references/acp-ucp-agent-commerce-manifest-specs.md +66 -0
  76. package/core/skills/agent/configure-agent-skills/SKILL.md +60 -68
  77. package/core/skills/agent/manage-agent-identity/SKILL.md +2 -0
  78. package/core/skills/agent/manage-agent-identity/examples/agent-identity-spire-workload.yaml +72 -0
  79. package/core/skills/agent/manage-agent-identity/references/nhi-lifecycle-and-token-rotation.md +45 -0
  80. package/core/skills/ai/openrouter-task/SKILL.md +5 -5
  81. package/core/skills/ai-agent/agent-evaluation/resources/eval-benchmarks/eval-cases.json +529 -0
  82. package/core/skills/ai-agent/agent-evaluation/resources/eval-benchmarks/eval-manifest.yaml +61 -0
  83. package/core/skills/ai-agent/agent-evaluation/scripts/run-eval-benchmark.py +856 -0
  84. package/core/skills/ai-agent/agent-evaluation/tests/test_golden_benchmarks.py +248 -0
  85. package/core/skills/ai-agent/context-optimization/SKILL.md +61 -60
  86. package/core/skills/ai-agent/context-optimization/examples/context-pruner-and-reorderer.py +85 -0
  87. package/core/skills/ai-agent/context-optimization/references/token-budgeting-and-attention-allocation.md +47 -0
  88. package/core/skills/ai-agent/memory-hygiene/SKILL.md +13 -0
  89. package/core/skills/ai-agent/memory-hygiene/examples/memory-audit-and-compaction-routine.py +90 -0
  90. package/core/skills/ai-agent/memory-hygiene/references/agent-memory-vault-spec.md +137 -0
  91. package/core/skills/ai-agent/memory-hygiene/references/owasp-asi06-and-memory-poisoning-defense.md +38 -0
  92. package/core/skills/backend/add-api-endpoint/examples/express-zod-rfc9457-endpoint.md +329 -0
  93. package/core/skills/backend/add-api-endpoint/examples/kratos-go-clean-architecture-endpoint.md +405 -0
  94. package/core/skills/backend/add-api-endpoint/references/idempotency-and-rate-limiting.md +116 -0
  95. package/core/skills/backend/add-event-handler/SKILL.md +1 -1
  96. package/core/skills/backend/scaffold-new-service/SKILL.md +2 -1
  97. package/core/skills/backend/scaffold-new-service/references/deep-modules-and-seams.md +43 -0
  98. package/core/skills/business/elicit-requirements/SKILL.md +1 -0
  99. package/core/skills/commerce/handle-checkout-flow/SKILL.md +3 -1
  100. package/core/skills/commerce/handle-checkout-flow/examples/production-checkout-orchestrator.ts +185 -0
  101. package/core/skills/commerce/handle-checkout-flow/references/pci-dss-v4-and-agentic-checkout-specs.md +72 -0
  102. package/core/skills/commerce/integrate-payment-gateway/SKILL.md +3 -1
  103. package/core/skills/commerce/integrate-payment-gateway/examples/resilient-webhook-and-mpp-handler.ts +164 -0
  104. package/core/skills/commerce/integrate-payment-gateway/references/mpp-x402-and-webhook-security-specs.md +47 -0
  105. package/core/skills/commerce/manage-order-fulfillment/SKILL.md +3 -1
  106. package/core/skills/commerce/manage-order-fulfillment/examples/temporal-fulfillment-saga.ts +104 -0
  107. package/core/skills/commerce/manage-order-fulfillment/references/event-sourced-fulfillment-and-carrier-webhooks.md +58 -0
  108. package/core/skills/commerce/manage-product-catalog/SKILL.md +3 -1
  109. package/core/skills/commerce/manage-product-catalog/examples/hybrid-search-and-governance-pipeline.ts +120 -0
  110. package/core/skills/commerce/manage-product-catalog/references/semantic-vector-catalog-and-graphrag.md +54 -0
  111. package/core/skills/content/write-article/SKILL.md +1 -1
  112. package/core/skills/document/pdf/SKILL.md +1 -0
  113. package/core/skills/document/pdf/references/pdf-acroforms-and-pdfplumber-specs.md +54 -0
  114. package/core/skills/document/pdf/scripts/check_fillable_fields.py +144 -0
  115. package/core/skills/document/pdf/scripts/fill_fillable_fields.py +145 -0
  116. package/core/skills/documentation/configure-llms-txt/SKILL.md +2 -0
  117. package/core/skills/documentation/configure-llms-txt/examples/canonical-llms-txt-and-full-txt.md +45 -0
  118. package/core/skills/documentation/configure-llms-txt/references/llms-txt-and-llms-full-txt-standard.md +37 -0
  119. package/core/skills/documentation/write-documentation/SKILL.md +3 -1
  120. package/core/skills/documentation/write-documentation/examples/microservice-production-readme-and-api-docs.md +70 -0
  121. package/core/skills/documentation/write-documentation/references/diataxis-framework-and-doc-standards.md +62 -0
  122. package/core/skills/foundation/ai-risk-assessment/SKILL.md +3 -5
  123. package/core/skills/foundation/ai-risk-assessment/examples/genai-system-risk-register.md +67 -0
  124. package/core/skills/foundation/ai-risk-assessment/references/nist-ai-rmf-and-eu-ai-act-taxonomy.md +49 -0
  125. package/core/skills/foundation/conduct-research/SKILL.md +1 -1
  126. package/core/skills/foundation/discernment-nudge/SKILL.md +1 -0
  127. package/core/skills/foundation/plan-technical-delivery/SKILL.md +2 -1
  128. package/core/skills/foundation/release-notes/SKILL.md +2 -3
  129. package/core/skills/foundation/release-notes/examples/enterprise-platform-release-notes.md +42 -0
  130. package/core/skills/foundation/release-notes/references/keep-a-changelog-and-semver-governance.md +43 -0
  131. package/core/skills/foundation/systematic-debugging/SKILL.md +5 -0
  132. package/core/skills/foundation/write-tests/examples/anti-tautological-tdd-walkthrough.md +204 -0
  133. package/core/skills/foundation/write-tests/examples/testcontainers-kratos-integration-test.md +186 -0
  134. package/core/skills/foundation/write-tests/references/contract-and-chaos-testing.md +187 -0
  135. package/core/skills/frontend/INDEX.json +16 -0
  136. package/core/skills/frontend/add-page-route/SKILL.md +3 -1
  137. package/core/skills/frontend/add-page-route/examples/streaming-rsc-page-with-view-transition.tsx +133 -0
  138. package/core/skills/frontend/add-page-route/references/rsc-routing-and-view-transitions.md +72 -0
  139. package/core/skills/frontend/add-ui-component/SKILL.md +3 -1
  140. package/core/skills/frontend/add-ui-component/examples/compound-dialog-and-form-actions.tsx +193 -0
  141. package/core/skills/frontend/add-ui-component/references/react19-component-standards-and-anti-slop.md +55 -0
  142. package/core/skills/frontend/component-composition/SKILL.md +2 -1
  143. package/core/skills/frontend/component-composition/examples/headless-combobox-compound-component.tsx +207 -0
  144. package/core/skills/frontend/frontend-testing/SKILL.md +3 -1
  145. package/core/skills/frontend/frontend-testing/examples/playwright-e2e-with-msw-and-axe.spec.ts +87 -0
  146. package/core/skills/frontend/frontend-testing/references/playwright-msw-and-a11y-testing-standards.md +78 -0
  147. package/core/skills/frontend/implement-ai-disclosure/SKILL.md +118 -0
  148. package/core/skills/frontend/implement-webmcp/SKILL.md +3 -1
  149. package/core/skills/frontend/implement-webmcp/examples/webmcp-provider-and-hitl-modal.tsx +163 -0
  150. package/core/skills/frontend/implement-webmcp/references/webmcp-architecture-and-hitl-security.md +48 -0
  151. package/core/skills/frontend/integrate-api-client/SKILL.md +3 -1
  152. package/core/skills/frontend/integrate-api-client/examples/orval-query-and-streaming-mutation.ts +102 -0
  153. package/core/skills/frontend/integrate-api-client/references/orval-tanstack-query-and-streaming-specs.md +57 -0
  154. package/core/skills/frontend/setup-design-system/SKILL.md +3 -1
  155. package/core/skills/frontend/setup-design-system/examples/tailwind-v4-theme-and-dtcg-tokens.css +87 -0
  156. package/core/skills/frontend/setup-design-system/references/tailwind-v4-oklch-and-dtcg-tokens.md +61 -0
  157. package/core/skills/frontend/setup-visual-regression/SKILL.md +3 -1
  158. package/core/skills/frontend/setup-visual-regression/examples/visual-regression-playwright.config.ts +83 -0
  159. package/core/skills/frontend/setup-visual-regression/references/visual-regression-docker-and-masking-specs.md +46 -0
  160. package/core/skills/gamedev/abstract-input-actions/SKILL.md +2 -0
  161. package/core/skills/gamedev/abstract-input-actions/examples/input-action-manager.ts +85 -0
  162. package/core/skills/gamedev/abstract-input-actions/references/action-mapping-and-analog-deadzones.md +54 -0
  163. package/core/skills/gamedev/architect-ecs-systems/SKILL.md +2 -0
  164. package/core/skills/gamedev/architect-ecs-systems/examples/bevy-flecs-combat-system.rs +73 -0
  165. package/core/skills/gamedev/architect-ecs-systems/references/data-oriented-design-and-archetype-ecs.md +39 -0
  166. package/core/skills/gamedev/author-game-ai/SKILL.md +2 -0
  167. package/core/skills/gamedev/author-game-ai/examples/modular-behavior-tree-ai.ts +98 -0
  168. package/core/skills/gamedev/author-game-ai/references/behavior-trees-and-utility-ai-curves.md +47 -0
  169. package/core/skills/gamedev/configure-physics-collision/SKILL.md +2 -0
  170. package/core/skills/gamedev/configure-physics-collision/examples/kinematic-physics-substepping.cpp +100 -0
  171. package/core/skills/gamedev/configure-physics-collision/references/continuous-collision-detection-and-substepping.md +50 -0
  172. package/core/skills/gamedev/develop-gameplay-systems/SKILL.md +2 -0
  173. package/core/skills/gamedev/develop-gameplay-systems/examples/kinematic-character-controller.gd +86 -0
  174. package/core/skills/gamedev/develop-gameplay-systems/references/deterministic-gameplay-state-machines.md +42 -0
  175. package/core/skills/gamedev/implement-save-persistence/SKILL.md +2 -0
  176. package/core/skills/gamedev/implement-save-persistence/examples/versioned-save-manager.ts +127 -0
  177. package/core/skills/gamedev/implement-save-persistence/references/versioned-save-schemas-and-checksums.md +44 -0
  178. package/core/skills/gamedev/render-webgl-threejs/SKILL.md +2 -0
  179. package/core/skills/gamedev/render-webgl-threejs/examples/production-threejs-webgpu-scene.ts +116 -0
  180. package/core/skills/gamedev/render-webgl-threejs/references/webgpu-threejs-pbr-pipeline.md +56 -0
  181. package/core/skills/mmo/analyze-campaign-roi/SKILL.md +2 -0
  182. package/core/skills/mmo/analyze-campaign-roi/examples/campaign-roi-and-roas-dashboard.py +80 -0
  183. package/core/skills/mmo/analyze-campaign-roi/references/multi-touch-attribution-and-cpa-analytics.md +33 -0
  184. package/core/skills/mmo/create-automation-script/SKILL.md +2 -0
  185. package/core/skills/mmo/create-automation-script/examples/stealth-browser-automation-flow.ts +65 -0
  186. package/core/skills/mmo/create-automation-script/references/stealth-cdp-and-behavioral-mimicry.md +37 -0
  187. package/core/skills/mmo/deploy-mmo-infrastructure/SKILL.md +2 -0
  188. package/core/skills/mmo/deploy-mmo-infrastructure/examples/proxy-health-probe-and-rotation-daemon.py +75 -0
  189. package/core/skills/mmo/deploy-mmo-infrastructure/references/proxy-pool-rotation-and-anti-detect-specs.md +45 -0
  190. package/core/skills/mmo/deploy-proxyware-fleet/SKILL.md +2 -0
  191. package/core/skills/mmo/deploy-proxyware-fleet/examples/docker-compose-depin-light-node-fleet.yaml +52 -0
  192. package/core/skills/mmo/deploy-proxyware-fleet/references/depin-bandwidth-monetization-node-specs.md +43 -0
  193. package/core/skills/mmo/generate-mmo-content/SKILL.md +2 -0
  194. package/core/skills/mmo/generate-mmo-content/examples/pseo-programmatic-page-generator.ts +76 -0
  195. package/core/skills/mmo/generate-mmo-content/references/pseo-landing-pages-and-social-video-hooks.md +39 -0
  196. package/core/skills/mmo/manage-mmo-assets/SKILL.md +2 -0
  197. package/core/skills/mmo/manage-mmo-assets/examples/mmo-asset-vault-manager.py +63 -0
  198. package/core/skills/mmo/manage-mmo-assets/references/mmo-asset-rbac-and-vault-isolation.md +38 -0
  199. package/core/skills/mmo/setup-tracking-system/SKILL.md +2 -0
  200. package/core/skills/mmo/setup-tracking-system/examples/meta-capi-s2s-event-dispatcher.ts +79 -0
  201. package/core/skills/mmo/setup-tracking-system/references/server-to-server-postback-and-capi-specs.md +45 -0
  202. package/core/skills/platform/add-telemetry-instrumentation/SKILL.md +2 -0
  203. package/core/skills/platform/add-telemetry-instrumentation/examples/kratos-otel-middleware-instrumentation.go +87 -0
  204. package/core/skills/platform/add-telemetry-instrumentation/references/opentelemetry-semantic-conventions-2026.md +37 -0
  205. package/core/skills/platform/aws-infrastructure/SKILL.md +2 -0
  206. package/core/skills/platform/aws-infrastructure/examples/opentofu-eks-pod-identity-vpc.tf +101 -0
  207. package/core/skills/platform/aws-infrastructure/references/opentofu-aws-zero-trust-and-irsa.md +40 -0
  208. package/core/skills/platform/setup-deployment/SKILL.md +4 -0
  209. package/core/skills/platform/setup-deployment/examples/kustomize-production-service-manifests.yaml +123 -0
  210. package/core/skills/platform/setup-deployment/references/interactive-hitl-wizard.md +55 -0
  211. package/core/skills/platform/setup-deployment/references/k8s-gitops-and-kustomize-invariants.md +40 -0
  212. package/core/skills/platform/supply-chain-security/SKILL.md +2 -0
  213. package/core/skills/platform/supply-chain-security/examples/github-actions-sbom-cosign.yaml +57 -0
  214. package/core/skills/platform/supply-chain-security/references/slsa-provenance-and-sbom-sigstore.md +60 -0
  215. package/core/skills/product/build-story-map/SKILL.md +2 -0
  216. package/core/skills/repo-ops/review-code/SKILL.md +2 -2
  217. package/core/skills/repo-ops/review-code/examples/adversarial-two-axis-pr-review.md +167 -0
  218. package/core/skills/repo-ops/review-code/examples/ai-vibe-slop-remediation.md +220 -0
  219. package/core/skills/repo-ops/review-code/references/supply-chain-and-migration-safety.md +103 -0
  220. package/core/skills/repo-ops/review-service/SKILL.md +1 -1
  221. package/core/skills/security-data/database-maintenance/SKILL.md +1 -1
  222. package/core/skills/security-data/manage-secrets/SKILL.md +2 -0
  223. package/core/skills/security-data/manage-secrets/examples/external-secrets-vault-crds.yaml +53 -0
  224. package/core/skills/security-data/manage-secrets/references/zero-trust-secret-rotation-and-eso.md +30 -0
  225. package/core/skills/security-data/manage-vietnam-accounting/SKILL.md +7 -7
  226. package/core/skills/security-data/prompt-injection-defense/SKILL.md +2 -0
  227. package/core/skills/security-data/prompt-injection-defense/examples/bounded-tool-execution-wrapper.py +78 -0
  228. package/core/skills/security-data/prompt-injection-defense/references/prompt-injection-taxonomy-and-delimiters.md +37 -0
  229. package/core/skills/security-data/reverse-engineer-binary/SKILL.md +2 -0
  230. package/core/skills/security-data/reverse-engineer-binary/examples/binary-triage-and-vulnerability-dossier.md +58 -0
  231. package/core/skills/security-data/reverse-engineer-binary/references/ghidra-radare2-and-rea-evidence-ledgers.md +43 -0
  232. package/core/skills/security-data/security-audit/SKILL.md +3 -1
  233. package/core/skills/security-data/security-audit/examples/enterprise-service-security-audit-report.md +54 -0
  234. package/core/skills/security-data/security-audit/references/owasp-asi-and-cvss4-threat-modeling.md +39 -0
  235. package/core/skills/security-data/skill-preflight-ast-check/SKILL.md +2 -0
  236. package/core/skills/security-data/skill-preflight-ast-check/references/ast-lethal-trifecta-and-static-vetting.md +38 -0
  237. package/core/skills/security-data/skill-preflight-ast-check/scripts/scan-skill-ast.py +127 -0
  238. package/overlays/README.md +1 -1
  239. package/overlays/security-research/README.md +1 -1
  240. package/package.json +2 -2
  241. package/overlays/security-research/skills/reverse-engineer-binary/SKILL.md +0 -129
@@ -0,0 +1,65 @@
1
+ import { chromium, Page } from 'playwright';
2
+
3
+ // Helper: Bezier curve point interpolation for mouse movement
4
+ function cubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number {
5
+ return (
6
+ Math.pow(1 - t, 3) * p0 +
7
+ 3 * Math.pow(1 - t, 2) * t * p1 +
8
+ 3 * (1 - t) * Math.pow(t, 2) * p2 +
9
+ Math.pow(t, 3) * p3
10
+ );
11
+ }
12
+
13
+ export class StealthAutomationFlow {
14
+ private cdpUrl: string;
15
+
16
+ constructor(cdpUrl: string = 'http://127.0.0.1:9222') {
17
+ this.cdpUrl = cdpUrl;
18
+ }
19
+
20
+ // Humanized typing simulation with variable inter-key latency
21
+ public async humanType(page: Page, selector: string, text: string) {
22
+ await page.click(selector);
23
+ for (const char of text) {
24
+ await page.keyboard.press(char);
25
+ const delay = 80 + Math.random() * 160; // 80ms - 240ms jitter
26
+ await new Promise((r) => setTimeout(r, delay));
27
+ }
28
+ }
29
+
30
+ // Humanized mouse movement using Cubic Bezier trajectories
31
+ public async humanMove(page: Page, targetX: number, targetY: number, steps: number = 25) {
32
+ const startX = 100;
33
+ const startY = 100;
34
+
35
+ // Randomize control points
36
+ const cp1X = startX + (targetX - startX) * 0.25 + (Math.random() * 40 - 20);
37
+ const cp1Y = startY + (targetY - startY) * 0.1 + (Math.random() * 40 - 20);
38
+ const cp2X = startX + (targetX - startX) * 0.75 + (Math.random() * 40 - 20);
39
+ const cp2Y = startY + (targetY - startY) * 0.9 + (Math.random() * 40 - 20);
40
+
41
+ for (let i = 0; i <= steps; i++) {
42
+ const t = i / steps;
43
+ const curX = cubicBezier(t, startX, cp1X, cp2X, targetX);
44
+ const curY = cubicBezier(t, startY, cp1Y, cp2Y, targetY);
45
+ await page.mouse.move(curX, curY);
46
+ await new Promise((r) => setTimeout(r, 10 + Math.random() * 15));
47
+ }
48
+ }
49
+
50
+ public async executeSession(targetUrl: string) {
51
+ // Connect over CDP to avoid runtime webdriver detection
52
+ const browser = await chromium.connectOverCDP(this.cdpUrl);
53
+ const context = browser.contexts()[0] || (await browser.newContext());
54
+ const page = await context.newPage();
55
+
56
+ console.log(`Navigating to ${targetUrl} via stealth CDP connection...`);
57
+ await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });
58
+
59
+ // Execute humanized interaction sequence
60
+ await this.humanMove(page, 450, 320);
61
+ await new Promise((r) => setTimeout(r, 600));
62
+
63
+ await browser.close();
64
+ }
65
+ }
@@ -0,0 +1,37 @@
1
+ # Stealth Chrome DevTools Protocol (CDP) & Behavioral Mimicry (2026)
2
+
3
+ ## 1. Browser Fingerprint Coherence
4
+
5
+ Modern bot detection systems (Cloudflare Turnstile, DataDome, Kasada) inspect cross-layer hardware coherence. Inconsistent fingerprint parameters trigger immediate CAPTCHA challenges:
6
+
7
+ ```
8
+ ┌────────────────────────────────────────────────────────┐
9
+ │ HARDWARE COHERENCE MATRIX │
10
+ ├─────────────────────┬──────────────────────────────────┤
11
+ │ User-Agent │ macOS 15.1; Intel Mac OS X │
12
+ │ WebGL Vendor/Render │ Apple / Apple M3 Pro │
13
+ │ WebGPU Adapter │ Apple M3 Pro, Metal Backend │
14
+ │ AudioContext Noise │ Deterministic profile PRNG seed │
15
+ │ Canvas 2D Readback │ 1-bit continuity noise │
16
+ │ JA4 / JA4T TLS │ macOS TLS extension order │
17
+ │ WebRTC Local IP │ Disabled or residential exit IP │
18
+ └────────────────────────────────────────────────────────┘
19
+ ```
20
+
21
+ ## 2. CDP vs Monkey-Patching
22
+
23
+ - **Prohibited**: Runtime monkey-patching (`Object.defineProperty(navigator, 'webdriver')`, `playwright-stealth`). Modern engines detect tampering with prototype chains and proxy wrappers.
24
+ - **Mandated**: Native Chrome DevTools Protocol (CDP) connections to anti-detect browsers or C++ patched browser engines (Camoufox).
25
+
26
+ ## 3. Humanized Biometrics (Bézier Trajectories & Typing Jitter)
27
+
28
+ Linear cursor moves or instant `page.fill()` calls flag automated agents immediately:
29
+ 1. **Mouse Trajectories**: Cubic Bézier curves with randomized control points ($P_1, P_2$) modeling physical arm movement, acceleration, deceleration, and micro-overshoots.
30
+ 2. **Keyboard Cadence**: 80ms–320ms inter-key delays with Gaussian distribution; occasional typo insertions followed by natural `Backspace` corrections.
31
+ 3. **Scroll Dynamics**: Variable scroll delta steps simulating mouse wheel inertia.
32
+
33
+ ## 4. Turnstile Challenge Automated Resolution
34
+
35
+ - Inspect nested Shadow DOM iframes (`challenges.cloudflare.com`).
36
+ - Approach `#challenge-stage` with multi-step Bézier cursor interpolation.
37
+ - Poll `input[name="cf-turnstile-response"]` for cryptographic token generation.
@@ -135,3 +135,5 @@ Skip emission for local sandbox experiments that do not cross role boundaries.
135
135
 
136
136
  - **deploy-proxyware-fleet**: Orchestrate decentralized bandwidth monetization nodes on provisioned network infrastructure.
137
137
  - **setup-deployment**: Generic CI/CD and cloud deployment workflows outside MMO performance environments.
138
+ - Companion reference: `references/proxy-pool-rotation-and-anti-detect-specs.md`
139
+ - Companion example: `examples/proxy-health-probe-and-rotation-daemon.py`
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env python3
2
+ """Proxy Health Probe and Failover Daemon (2026).
3
+
4
+ Monitors residential and 4G proxy pools, verifying p95 latency thresholds,
5
+ fraud scores, and remote DNS leaks before traffic routing.
6
+ """
7
+
8
+ import time
9
+ import requests
10
+ from dataclasses import dataclass
11
+ from typing import List, Optional
12
+
13
+
14
+ @dataclass
15
+ class ProxyNode:
16
+ endpoint_url: str
17
+ pool_type: str # 'residential' | '4g_mobile'
18
+ last_latency_ms: float = 0.0
19
+ fraud_score: int = 0
20
+ is_healthy: bool = False
21
+
22
+
23
+ class ProxyHealthDaemon:
24
+ def __init__(self, proxy_nodes: List[ProxyNode], max_latency_ms: float = 1200.0, max_fraud: int = 25):
25
+ self.nodes = proxy_nodes
26
+ self.max_latency = max_latency_ms
27
+ self.max_fraud = max_fraud
28
+ self.active_node: Optional[ProxyNode] = None
29
+
30
+ def probe_node(self, node: ProxyNode) -> bool:
31
+ """Executes a diagnostic HTTP probe via the candidate proxy."""
32
+ proxies = {
33
+ "http": node.endpoint_url,
34
+ "https": node.endpoint_url,
35
+ }
36
+ t0 = time.perf_counter()
37
+ try:
38
+ # Probe against diagnostic JSON endpoint (with 3-second timeout)
39
+ resp = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=3.0)
40
+ latency = (time.perf_counter() - t0) * 1000.0
41
+ node.last_latency_ms = latency
42
+
43
+ if resp.status_code == 200 and latency <= self.max_latency:
44
+ # Mock fraud verification
45
+ node.fraud_score = 10 # Passed IPQS / Scamalytics threshold
46
+ node.is_healthy = True
47
+ return True
48
+ else:
49
+ node.is_healthy = False
50
+ return False
51
+ except Exception as e:
52
+ node.is_healthy = False
53
+ node.last_latency_ms = 9999.0
54
+ return False
55
+
56
+ def select_active_proxy(self) -> Optional[ProxyNode]:
57
+ """Selects the lowest-latency healthy proxy from the pool."""
58
+ for node in self.nodes:
59
+ if self.probe_node(node):
60
+ self.active_node = node
61
+ return node
62
+ return None
63
+
64
+
65
+ if __name__ == "__main__":
66
+ test_pool = [
67
+ ProxyNode("socks5h://res-node1.provider.internal:1080", "residential"),
68
+ ProxyNode("socks5h://res-node2.provider.internal:1080", "residential"),
69
+ ProxyNode("socks5h://mobile-node1.provider.internal:1080", "4g_mobile"),
70
+ ]
71
+ daemon = ProxyHealthDaemon(test_pool)
72
+ print("Initiating Proxy Health Probe Cycle:")
73
+ # In real execution, tests live endpoints; here demonstrates probe loop
74
+ for p in test_pool:
75
+ print(f" Probing {p.endpoint_url} [{p.pool_type}]...")
@@ -0,0 +1,45 @@
1
+ # Proxy Pool Rotation & Anti-Detect Infrastructure Specifications (2026)
2
+
3
+ ## 1. Architecture: Isolated Proxy & Profile Topology
4
+
5
+ High-concurrency automation requires strict network and hardware fingerprint isolation. Shared proxy pools or leaky DNS servers immediately trigger anti-fraud graph clustering:
6
+
7
+ ```
8
+ Automated Account Worker
9
+ │
10
+ ▼
11
+ Anti-Detect Browser (Camoufox / Chromium Stealth)
12
+ - Isolated Canvas / WebGL fingerprint
13
+ - Hardware Concurrency & AudioContext spoofing
14
+ │
15
+ ▼ (SOCKS5 with Remote DNS Resolution)
16
+ Dedicated Proxy Sidecar (WireGuard / Shadowsocks)
17
+ - Enforces 1:1 Account-to-IP affinity
18
+ - Rejects Datacenter ASNs (Residential & 4G Mobile only)
19
+ │
20
+ ▼
21
+ Residential Proxy Exit Gateway (p95 < 1200ms, Fraud Score <= 25)
22
+ ```
23
+
24
+ ## 2. Dynamic Health Probing & Quality Metrics
25
+
26
+ All proxy gateways undergo active background probing before traffic routing:
27
+ 1. **Latency Ceiling**: P95 latency must remain $< 1200\text{ms}$. Spike above $2500\text{ms}$ triggers automated rerouting.
28
+ 2. **Fraud & IP Quality Scoring**:
29
+ - Query Scamalytics / IPQS APIs.
30
+ - Fraud Score must be $\le 25$.
31
+ - Flag `is_datacenter == true` triggers immediate rejection.
32
+ 3. **Leakage Verification**:
33
+ - WebRTC ICE Candidates: Must strictly emit the proxy exit IP. Zero host network interfaces exposed.
34
+ - DNS Resolution: Remote exit node resolution only (`socks5h://`). Zero leaks to Google/Cloudflare/AWS datacenter DNS.
35
+
36
+ ## 3. The 7-Stage Warmup Finite State Machine (FSM)
37
+
38
+ Ad accounts progress through a deterministic warmup state machine before high-velocity operations:
39
+ - `INITIALIZING` (Day 0): Profile creation, hardware fingerprint generation, IP validation.
40
+ - `PASSIVE_BROWSING` (Days 1–2): Top 500 news/editorial sites, natural mouse trajectories, cookie priming.
41
+ - `COOKIE_ACCUMULATION` (Days 3–4): E-commerce sites, cart additions, advertising pixel triggers.
42
+ - `INTERACTIVE_AUTH` (Day 5): SSO OAuth logins, 2FA registration, email confirmation loops.
43
+ - `ACTIVE_WARMUP` (Days 6–7): Platform likes, natural feed scrolls, low-velocity profile edits.
44
+ - `PRODUCTION_READY` (Day 8+): Full programmatic automation and campaign operations.
45
+ - `QUARANTINE`: Automatic fail-safe state triggered on CAPTCHA storms or account checkpointing.
@@ -131,3 +131,5 @@ Skip emission for local single-node test runs that do not cross role boundaries.
131
131
 
132
132
  - **deploy-mmo-infrastructure**: Provision the core residential proxy gateways and network tunnels powering the DePIN fleet.
133
133
  - **setup-deployment**: Generic cloud container orchestration and service lifecycle management.
134
+ - Companion reference: `references/depin-bandwidth-monetization-node-specs.md`
135
+ - Companion example: `examples/docker-compose-depin-light-node-fleet.yaml`
@@ -0,0 +1,52 @@
1
+ version: "3.8"
2
+
3
+ services:
4
+ residential-gateway:
5
+ image: wireguard/client:latest
6
+ cap_add:
7
+ - NET_ADMIN
8
+ environment:
9
+ - WG_CONFIG_FILE=/etc/wireguard/wg0.conf
10
+ volumes:
11
+ - ./wireguard/wg0.conf:/etc/wireguard/wg0.conf:ro
12
+ restart: always
13
+
14
+ grass-node-01:
15
+ image: depin/grass-light-node:v2.4.0
16
+ network_mode: "service:residential-gateway"
17
+ read_only: true
18
+ tmpfs:
19
+ - /tmp:rw,size=512M
20
+ - /dev/shm:rw,size=512M
21
+ environment:
22
+ - WALLET_PUBLIC_KEY=7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
23
+ - NODE_SIGNATURE=3N8vKjW_Sample_Ed25519_Delegated_Signature_Base64==
24
+ - TELEMETRY_WS_URL=wss://telemetry.wynd.network/v1
25
+ - LOG_LEVEL=warn
26
+ deploy:
27
+ resources:
28
+ limits:
29
+ cpus: "0.25"
30
+ memory: 256M
31
+ reservations:
32
+ cpus: "0.05"
33
+ memory: 64M
34
+ restart: unless-stopped
35
+
36
+ nodepay-node-01:
37
+ image: depin/nodepay-light-node:v1.8.2
38
+ network_mode: "service:residential-gateway"
39
+ read_only: true
40
+ tmpfs:
41
+ - /tmp:rw,size=512M
42
+ - /dev/shm:rw,size=512M
43
+ environment:
44
+ - WALLET_PUBLIC_KEY=7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
45
+ - NODE_SIGNATURE=4M9wLkX_Sample_Ed25519_Delegated_Signature_Base64==
46
+ - TELEMETRY_WS_URL=wss://network.nodepay.ai/v1
47
+ deploy:
48
+ resources:
49
+ limits:
50
+ cpus: "0.25"
51
+ memory: 256M
52
+ restart: unless-stopped
@@ -0,0 +1,43 @@
1
+ # DePIN Bandwidth Monetization & Light Node Specifications (2026)
2
+
3
+ ## 1. DePIN Protocol Landscape
4
+
5
+ Decentralized Physical Infrastructure Networks (DePIN) for bandwidth monetization (Grass / Wynd Network, Dawn, Nodepay, Gradient) replace legacy centralized proxy networks by rewarding residential node operators with verifiable cryptographic tokens:
6
+
7
+ ```
8
+ ┌────────────────────────────────────────────────────────┐
9
+ │ DePIN ARCHITECTURE │
10
+ ├────────────────────────────────────────────────────────┤
11
+ │ Solana / EVM Wallet (Ed25519 / Secp256k1) │
12
+ │ - Delegated session-scoped auth signature (Off-chain)│
13
+ ├────────────────────────────────────────────────────────┤
14
+ │ Light Node Client Container │
15
+ │ - Read-only rootfs (`readOnlyRootFilesystem: true`) │
16
+ │ - Ephemeral tmpfs (`/tmp`, `/dev/shm` 512MB) │
17
+ │ - Strict cgroups (CPU <= 0.25, Memory <= 256MB) │
18
+ ├────────────────────────────────────────────────────────┤
19
+ │ Residential Network Gateway │
20
+ │ - SOCKS5 / WireGuard Remote DNS Resolution │
21
+ │ - Verified Residential ISP (Zero Datacenter ASNs) │
22
+ ├────────────────────────────────────────────────────────┤
23
+ │ DePIN Protocol Telemetry (WebSocket wss://) │
24
+ │ - Continuous ping/pong heartbeat (Uptime > 98%) │
25
+ │ - Epoch reward scoring and point multipliers │
26
+ └────────────────────────────────────────────────────────┘
27
+ ```
28
+
29
+ ## 2. Cryptographic Wallet Authentication
30
+
31
+ - **Zero Private Keys in Containers**: Private keys are kept in secure offline KMS or cold wallets.
32
+ - **Session Signature Protocol**:
33
+ ```
34
+ Message = "DePIN-Auth:" + challenge_nonce + ":" + timestamp_epoch
35
+ Signature = Ed25519_Sign(Private_Key, Message)
36
+ ```
37
+ - Containers receive only the public address, challenge nonce, and session signature.
38
+
39
+ ## 3. Container Hardening & Resource Isolation
40
+
41
+ - `read_only: true` with `tmpfs` mounts to prevent unconstrained logging and disk space exhaustion.
42
+ - Enforce strict resource limits per node: `cpus: "0.25"`, `memory: 256M`.
43
+ - Prometheus/Grafana exporter scraping connection state, ping latency, and epoch score multipliers.
@@ -132,3 +132,5 @@ Skip emission for single-asset local experiments that do not cross role boundari
132
132
 
133
133
  - **setup-deployment**: Deploy generated programmatic landing pages to CDNs or hosting infrastructure.
134
134
  - **analyze-campaign-roi**: Measure conversion rates, organic search traffic, and CPA of generated content.
135
+ - Companion reference: `references/pseo-landing-pages-and-social-video-hooks.md`
136
+ - Companion example: `examples/pseo-programmatic-page-generator.ts`
@@ -0,0 +1,76 @@
1
+ export interface ProductRecord {
2
+ slug: string;
3
+ name: string;
4
+ category: string;
5
+ priceUsd: number;
6
+ rating: number;
7
+ reviewCount: number;
8
+ keyFeature: string;
9
+ pros: string[];
10
+ cons: string[];
11
+ faqs: Array<{ question: string; answer: string }>;
12
+ }
13
+
14
+ export class PSeoPageGenerator {
15
+ // Generates Answer-First BLUF summary (<= 60 words)
16
+ public generateBluf(product: ProductRecord): string {
17
+ return (
18
+ `The ${product.name} stands out as the premier ${product.category} for value and performance. ` +
19
+ `Scoring ${product.rating}/5 across ${product.reviewCount} verified benchmarks, it delivers ${product.keyFeature} ` +
20
+ `at an accessible $${product.priceUsd} price point, outperforming comparable flagship alternatives.`
21
+ );
22
+ }
23
+
24
+ // Injects JSON-LD structured data schema
25
+ public generateJsonLd(product: ProductRecord): string {
26
+ const schema = {
27
+ '@context': 'https://schema.org',
28
+ '@type': 'Product',
29
+ name: product.name,
30
+ description: `Comprehensive benchmark review and technical analysis of the ${product.name}.`,
31
+ offers: {
32
+ '@type': 'Offer',
33
+ price: product.priceUsd,
34
+ priceCurrency: 'USD',
35
+ availability: 'https://schema.org/InStock',
36
+ },
37
+ aggregateRating: {
38
+ '@type': 'AggregateRating',
39
+ ratingValue: product.rating,
40
+ reviewCount: product.reviewCount,
41
+ },
42
+ };
43
+ return `<script type="application/ld+json">\n${JSON.stringify(schema, null, 2)}\n</script>`;
44
+ }
45
+
46
+ // Renders complete programmatic HTML landing page
47
+ public renderPage(product: ProductRecord): string {
48
+ const bluf = this.generateBluf(product);
49
+ const jsonLd = this.generateJsonLd(product);
50
+
51
+ return `<!DOCTYPE html>
52
+ <html lang="en">
53
+ <head>
54
+ <meta charset="UTF-8">
55
+ <title>${product.name} Review & Benchmarks (2026)</title>
56
+ ${jsonLd}
57
+ </head>
58
+ <body>
59
+ <main class="pseo-container">
60
+ <h1>${product.name}: Comprehensive Benchmark & Analysis</h1>
61
+ <section class="bluf-box" style="border: 1px solid #0284c7; padding: 16px; border-radius: 8px;">
62
+ <p><strong>Quick Verdict:</strong> ${bluf}</p>
63
+ </section>
64
+ <section class="specs-grid">
65
+ <h2>Specifications</h2>
66
+ <ul>
67
+ <li>Price: $${product.priceUsd}</li>
68
+ <li>Rating: ${product.rating} / 5.0</li>
69
+ <li>Core Advantage: ${product.keyFeature}</li>
70
+ </ul>
71
+ </section>
72
+ </main>
73
+ </body>
74
+ </html>`;
75
+ }
76
+ }
@@ -0,0 +1,39 @@
1
+ # Programmatic SEO (pSEO) & Social Video Hook Specifications (2026)
2
+
3
+ ## 1. Programmatic SEO (pSEO) Layout & Answer-First Standards
4
+
5
+ Modern search indexing and Google AI Overviews prioritize immediate, high-density factual answers (BLUF - Bottom Line Up Front):
6
+
7
+ ```
8
+ ┌────────────────────────────────────────────────────────┐
9
+ │ BLUF Answer Box (Above-the-fold, <= 60 words) │
10
+ │ - Immediate factual verdict, key differentiator │
11
+ ├────────────────────────────────────────────────────────┤
12
+ │ JSON-LD Structured Data Schema │
13
+ │ - Product, Review, AggregateRating, FAQPage │
14
+ ├────────────────────────────────────────────────────────┤
15
+ │ High-Information-Gain Comparison Matrix │
16
+ │ - Primary dataset specs, real benchmark metrics │
17
+ ├────────────────────────────────────────────────────────┤
18
+ │ FAQ Accordion & Deep Technical Specifications │
19
+ └────────────────────────────────────────────────────────┘
20
+ ```
21
+
22
+ ## 2. JSON-LD Schema Invariants
23
+
24
+ Every programmatic landing page must inject valid schema markup:
25
+ - `@context`: `"https://schema.org"`
26
+ - `@type`: `"Product"` or `"ItemPage"`
27
+ - `review`: Valid review author and `ratingValue` ($\le 5.0$).
28
+ - `aggregateRating`: Real review counts and verified ratings.
29
+
30
+ ## 3. Multimodal Social Video Hook Pacing (TikTok / Reels / Shorts)
31
+
32
+ High-converting direct-response social video scripts follow a strict 45–60s timeline:
33
+ 1. **The 3-Second Hook (0–3s)**:
34
+ - *Negative Framing*: "Stop doing X until you see this..."
35
+ - *Pattern Interrupt*: Visual discrepancy or counter-intuitive demonstration.
36
+ - *Curiosity Gap*: "The secret reason why..."
37
+ 2. **Agitation & Friction (3–15s)**: Clarify the painful alternative.
38
+ 3. **Product Demonstration & Unique Value (15–45s)**: Visual proof and solution delivery.
39
+ 4. **Actionable Call-to-Action (45–60s)**: Clear, low-friction next step.
@@ -132,3 +132,5 @@ Skip emission for local asset lookups that do not cross role boundaries.
132
132
 
133
133
  - **deploy-mmo-infrastructure**: Provision isolated Anti-Detect Browser profiles and proxy networks bound to these asset silos.
134
134
  - **setup-tracking-system**: Configure tracking assets (Pixels/Datasets) referenced in the catalog.
135
+ - Companion reference: `references/mmo-asset-rbac-and-vault-isolation.md`
136
+ - Companion example: `examples/mmo-asset-vault-manager.py`
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env python3
2
+ """MMO Asset Vault and TOTP Manager (2026).
3
+
4
+ Manages isolated operational silos, fetches encrypted credentials from Vault,
5
+ and generates RFC 6238 TOTP tokens for automated login flows.
6
+ """
7
+
8
+ import os
9
+ import pyotp
10
+ from dataclasses import dataclass
11
+ from typing import Dict, Optional
12
+
13
+
14
+ @dataclass
15
+ class SiloAssetConfig:
16
+ silo_id: str
17
+ admin_email: str
18
+ totp_seed: str
19
+ vcc_last4: str
20
+ vcc_bin: str
21
+ proxy_endpoint: str
22
+
23
+
24
+ class MMOAssetVaultManager:
25
+ def __init__(self):
26
+ # Simulated Vault cache populated from KMS/Vault
27
+ self._silo_store: Dict[str, SiloAssetConfig] = {}
28
+
29
+ def register_silo(self, config: SiloAssetConfig):
30
+ # Verify BIN diversity: ensure no two silos share both BIN and Proxy Subnet
31
+ for existing in self._silo_store.values():
32
+ if existing.vcc_bin == config.vcc_bin and existing.proxy_endpoint == config.proxy_endpoint:
33
+ raise ValueError(f"Silo isolation violation: shared BIN and Proxy with {existing.silo_id}")
34
+ self._silo_store[config.silo_id] = config
35
+
36
+ def generate_totp_code(self, silo_id: str) -> str:
37
+ """Generates dynamic RFC 6238 6-digit TOTP verification code."""
38
+ silo = self._silo_store.get(silo_id)
39
+ if not silo:
40
+ raise KeyError(f"Silo not found: {silo_id}")
41
+
42
+ totp = pyotp.TOTP(silo.totp_seed, interval=30, digits=6)
43
+ return totp.now()
44
+
45
+ def get_silo_details(self, silo_id: str) -> Optional[SiloAssetConfig]:
46
+ return self._silo_store.get(silo_id)
47
+
48
+
49
+ if __name__ == "__main__":
50
+ manager = MMOAssetVaultManager()
51
+ manager.register_silo(
52
+ SiloAssetConfig(
53
+ silo_id="silo-alpha",
54
+ admin_email="ops-alpha@corp.internal",
55
+ totp_seed="JBSWY3DPEHPK3PXP", # Standard test base32 seed
56
+ vcc_last4="4242",
57
+ vcc_bin="424242",
58
+ proxy_endpoint="socks5h://res-pool1.provider:1080",
59
+ )
60
+ )
61
+
62
+ code = manager.generate_totp_code("silo-alpha")
63
+ print(f"Generated 2FA TOTP code for silo-alpha: {code}")
@@ -0,0 +1,38 @@
1
+ # MMO Asset RBAC & Vault Isolation Specifications (2026)
2
+
3
+ ## 1. Silo Compartmentalization Architecture
4
+
5
+ Cascading platform bans ("chết chùm") propagate along graph edges linking ad accounts: shared payment methods, identical ASN subnets, common admin users, or co-located pixel IDs. Strict silo compartmentalization eliminates these graph linkages:
6
+
7
+ ```
8
+ ┌────────────────────────────────────────────────────────┐
9
+ │ SILO ALPHA │
10
+ │ - ASN: AS15169 (Residential ISP Pool 1) │
11
+ │ - VCC: BIN 424242 (Stripe Issuing Account A) │
12
+ │ - Admin: Via Identity Alpha (TOTP Seed Alpha) │
13
+ │ - Vault Path: secret/mmo/silos/alpha │
14
+ └────────────────────────────────────────────────────────┘
15
+ ▲
16
+ STRICT GRAPH PARTITION (Zero Overlap)
17
+ ▼
18
+ ┌────────────────────────────────────────────────────────┐
19
+ │ SILO BETA │
20
+ │ - ASN: AS7018 (4G Mobile Pool 2) │
21
+ │ - VCC: BIN 532959 (Airwallex Account B) │
22
+ │ - Admin: Via Identity Beta (TOTP Seed Beta) │
23
+ │ - Vault Path: secret/mmo/silos/beta │
24
+ └────────────────────────────────────────────────────────┘
25
+ ```
26
+
27
+ ## 2. Programmatic RFC 6238 TOTP Integration
28
+
29
+ - Store raw base32 TOTP secret seeds exclusively within HashiCorp Vault / AWS Secrets Manager.
30
+ - Generate dynamic 6-digit verification tokens on-demand during login workflows.
31
+ - Clock drift tolerance: allow $\pm 1$ time-step window ($30\text{s}$) to avoid authentication rejections due to server NTP offsets.
32
+
33
+ ## 3. Virtual Commercial Card (VCC) & BIN Diversity
34
+
35
+ - **1:1 Binding**: Exactly one virtual commercial card per advertising account.
36
+ - **BIN Diversity**: Sourcing VCCs across multiple financial institutions (Stripe, Airwallex, Privacy) ensures that a fraud flag on one card issuer's BIN does not freeze accounts across other silos.
37
+ - **Velocity Controls**: Enforce daily and monthly spending caps at the card level.
38
+ - **Immediate Quarantine**: If a card payment fails or triggers an ad account review, that VCC is immediately quarantined and retired. Never reassign a flagged card to a clean account.
@@ -147,3 +147,5 @@ Skip emission for local tracking experiments that do not cross role boundaries.
147
147
 
148
148
  - **analyze-campaign-roi**: Ingest and evaluate conversion and attribution data collected by this tracking system.
149
149
  - **integrate-api-client**: Implement client-side click-capture and event dispatch snippets on custom landing pages.
150
+ - Companion reference: `references/server-to-server-postback-and-capi-specs.md`
151
+ - Companion example: `examples/meta-capi-s2s-event-dispatcher.ts`
@@ -0,0 +1,79 @@
1
+ import * as crypto from 'crypto';
2
+
3
+ export interface ConversionEvent {
4
+ eventName: 'Purchase' | 'Lead' | 'AddToCart';
5
+ eventId: string; // Shared UUIDv4 for deduplication
6
+ eventTime: number; // Unix epoch seconds
7
+ eventSourceUrl: string;
8
+ userData: {
9
+ email?: string;
10
+ phone?: string;
11
+ fbp?: string;
12
+ fbc?: string;
13
+ clientIp: string;
14
+ clientUserAgent: string;
15
+ };
16
+ customData?: {
17
+ currency: string;
18
+ value: number;
19
+ orderId?: string;
20
+ };
21
+ }
22
+
23
+ export class MetaCapiDispatcher {
24
+ private pixelId: string;
25
+ private accessToken: string;
26
+ private apiVersion = 'v20.0';
27
+
28
+ constructor(pixelId: string, accessToken: string) {
29
+ this.pixelId = pixelId;
30
+ this.accessToken = accessToken;
31
+ }
32
+
33
+ private hashSha256(value: string): string {
34
+ return crypto.createHash('sha256').update(value.trim().toLowerCase()).digest('hex');
35
+ }
36
+
37
+ private normalizePhone(phone: string): string {
38
+ return phone.replace(/[^0-9+]/g, '');
39
+ }
40
+
41
+ public async dispatchEvent(event: ConversionEvent): Promise<boolean> {
42
+ const payload = {
43
+ data: [
44
+ {
45
+ event_name: event.eventName,
46
+ event_time: event.eventTime,
47
+ event_id: event.eventId,
48
+ event_source_url: event.eventSourceUrl,
49
+ action_source: 'website',
50
+ user_data: {
51
+ em: event.userData.email ? [this.hashSha256(event.userData.email)] : undefined,
52
+ ph: event.userData.phone ? [this.hashSha256(this.normalizePhone(event.userData.phone))] : undefined,
53
+ fbp: event.userData.fbp,
54
+ fbc: event.userData.fbc,
55
+ client_ip_address: event.userData.clientIp,
56
+ client_user_agent: event.userData.clientUserAgent,
57
+ },
58
+ custom_data: event.customData,
59
+ },
60
+ ],
61
+ };
62
+
63
+ const endpoint = `https://graph.facebook.com/${this.apiVersion}/${this.pixelId}/events?access_token=${this.accessToken}`;
64
+
65
+ const res = await fetch(endpoint, {
66
+ method: 'POST',
67
+ headers: { 'Content-Type': 'application/json' },
68
+ body: JSON.stringify(payload),
69
+ });
70
+
71
+ if (!res.ok) {
72
+ const errorText = await res.text();
73
+ console.error(`Meta CAPI error (${res.status}): ${errorText}`);
74
+ return false;
75
+ }
76
+
77
+ return true;
78
+ }
79
+ }