0xray 4.0.13 → 4.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (976) hide show
  1. package/.grok-plugin/plugin.json +1 -1
  2. package/.opencode/skills/api-design/SKILL.md +37 -0
  3. package/.opencode/skills/architect-tools/SKILL.md +37 -0
  4. package/.opencode/skills/architecture-patterns/SKILL.md +37 -0
  5. package/.opencode/skills/auto-format/SKILL.md +37 -0
  6. package/.opencode/skills/backend-engineer/SKILL.md +49 -0
  7. package/.opencode/skills/boot-orchestrator/SKILL.md +33 -0
  8. package/.opencode/skills/bug-triage/SKILL.md +43 -0
  9. package/.opencode/skills/code-analyzer/SKILL.md +45 -0
  10. package/.opencode/skills/code-review/SKILL.md +52 -0
  11. package/.opencode/skills/content-creator/SKILL.md +38 -0
  12. package/.opencode/skills/database-engineer/SKILL.md +46 -0
  13. package/.opencode/skills/devops-engineer/SKILL.md +49 -0
  14. package/.opencode/skills/enforcer/SKILL.md +37 -0
  15. package/.opencode/skills/framework-compliance-audit/SKILL.md +37 -0
  16. package/.opencode/skills/frontend-engineer/SKILL.md +49 -0
  17. package/.opencode/skills/frontend-ui-ux-engineer/SKILL.md +41 -0
  18. package/.opencode/skills/git-workflow/SKILL.md +37 -0
  19. package/.opencode/skills/growth-strategist/SKILL.md +48 -0
  20. package/.opencode/skills/hermes-agent/SKILL.md +212 -0
  21. package/.opencode/skills/inference-improve/SKILL.md +97 -0
  22. package/.opencode/skills/lint/SKILL.md +37 -0
  23. package/.opencode/skills/log-monitor/SKILL.md +44 -0
  24. package/.opencode/skills/mobile-developer/SKILL.md +42 -0
  25. package/.opencode/skills/model-health-check/SKILL.md +37 -0
  26. package/.opencode/skills/multimodal-looker/SKILL.md +45 -0
  27. package/.opencode/skills/orchestrator/SKILL.md +61 -0
  28. package/.opencode/skills/performance-analysis/SKILL.md +37 -0
  29. package/.opencode/skills/performance-engineer/SKILL.md +41 -0
  30. package/.opencode/skills/performance-optimization/SKILL.md +37 -0
  31. package/.opencode/skills/processor-pipeline/SKILL.md +37 -0
  32. package/.opencode/skills/project-analysis/SKILL.md +42 -0
  33. package/.opencode/skills/refactoring-strategies/SKILL.md +37 -0
  34. package/.opencode/skills/registry.json +65 -0
  35. package/.opencode/skills/researcher/SKILL.md +50 -0
  36. package/.opencode/skills/security-audit/SKILL.md +48 -0
  37. package/.opencode/skills/security-scan/SKILL.md +37 -0
  38. package/.opencode/skills/seo-consultant/SKILL.md +43 -0
  39. package/.opencode/skills/session-management/SKILL.md +36 -0
  40. package/.opencode/skills/state-manager/SKILL.md +37 -0
  41. package/.opencode/skills/storyteller/SKILL.md +130 -0
  42. package/.opencode/skills/strategist/SKILL.md +44 -0
  43. package/.opencode/skills/tech-writer/SKILL.md +37 -0
  44. package/.opencode/skills/testing-best-practices/SKILL.md +37 -0
  45. package/.opencode/skills/testing-strategy/SKILL.md +54 -0
  46. package/.opencode/skills/ui-ux-design/SKILL.md +603 -0
  47. package/.opencode/skills/xray-orchestrator/SKILL.md +141 -0
  48. package/.opencode/skills/xray-orchestrator/index.ts +267 -0
  49. package/.xray/features.json +1 -1
  50. package/.xray/features.schema.json +1 -1
  51. package/AGENTS-consumer.md +4 -2
  52. package/AGENTS.md +8 -1
  53. package/README.md +1 -1
  54. package/SKILLS.md +1 -1
  55. package/dist/.gitignore.default +67 -0
  56. package/dist/AGENTS.md +232 -0
  57. package/dist/CHANGELOG.md +2788 -0
  58. package/dist/LICENSE +21 -0
  59. package/dist/README.md +233 -0
  60. package/dist/SKILLS.md +166 -0
  61. package/dist/agents/architect.d.ts +2 -0
  62. package/dist/agents/architect.js +56 -0
  63. package/dist/agents/backend-engineer.d.ts +8 -0
  64. package/dist/agents/backend-engineer.js +81 -0
  65. package/dist/agents/bug-triage-specialist.d.ts +2 -0
  66. package/dist/agents/bug-triage-specialist.js +74 -0
  67. package/dist/agents/code-analyzer.d.ts +7 -0
  68. package/dist/agents/code-analyzer.js +150 -0
  69. package/dist/agents/code-reviewer.d.ts +2 -0
  70. package/dist/agents/code-reviewer.js +69 -0
  71. package/dist/agents/content-creator.d.ts +9 -0
  72. package/dist/agents/content-creator.js +72 -0
  73. package/dist/agents/database-engineer.d.ts +8 -0
  74. package/dist/agents/database-engineer.js +76 -0
  75. package/dist/agents/devops-engineer.d.ts +8 -0
  76. package/dist/agents/devops-engineer.js +84 -0
  77. package/dist/agents/frontend-engineer.d.ts +8 -0
  78. package/dist/agents/frontend-engineer.js +78 -0
  79. package/dist/agents/frontend-ui-ux-engineer.d.ts +8 -0
  80. package/dist/agents/frontend-ui-ux-engineer.js +64 -0
  81. package/dist/agents/growth-strategist.d.ts +8 -0
  82. package/dist/agents/growth-strategist.js +111 -0
  83. package/dist/agents/index.d.ts +25 -0
  84. package/dist/agents/index.js +47 -0
  85. package/dist/agents/known-names.d.ts +26 -0
  86. package/dist/agents/known-names.js +72 -0
  87. package/dist/agents/librarian-agents-updater.d.ts +30 -0
  88. package/dist/agents/librarian-agents-updater.js +333 -0
  89. package/dist/agents/log-monitor.d.ts +2 -0
  90. package/dist/agents/log-monitor.js +109 -0
  91. package/dist/agents/mobile-developer.d.ts +9 -0
  92. package/dist/agents/mobile-developer.js +102 -0
  93. package/dist/agents/multimodal-looker.d.ts +9 -0
  94. package/dist/agents/multimodal-looker.js +93 -0
  95. package/dist/agents/performance-engineer.d.ts +8 -0
  96. package/dist/agents/performance-engineer.js +86 -0
  97. package/dist/agents/refactorer.d.ts +2 -0
  98. package/dist/agents/refactorer.js +80 -0
  99. package/dist/agents/registry.d.ts +37 -0
  100. package/dist/agents/registry.js +354 -0
  101. package/dist/agents/researcher.d.ts +2 -0
  102. package/dist/agents/researcher.js +83 -0
  103. package/dist/agents/security-auditor.d.ts +2 -0
  104. package/dist/agents/security-auditor.js +158 -0
  105. package/dist/agents/seo-consultant.d.ts +8 -0
  106. package/dist/agents/seo-consultant.js +53 -0
  107. package/dist/agents/strategist.d.ts +7 -0
  108. package/dist/agents/strategist.js +47 -0
  109. package/dist/agents/tech-writer.d.ts +8 -0
  110. package/dist/agents/tech-writer.js +84 -0
  111. package/dist/agents/testing-lead.d.ts +2 -0
  112. package/dist/agents/testing-lead.js +95 -0
  113. package/dist/agents/types.d.ts +45 -0
  114. package/dist/agents/types.js +1 -0
  115. package/dist/analytics/consent-manager.d.ts +92 -0
  116. package/dist/analytics/consent-manager.js +257 -0
  117. package/dist/analytics/emerging-pattern-detector.d.ts +66 -0
  118. package/dist/analytics/emerging-pattern-detector.js +259 -0
  119. package/dist/analytics/pattern-learning-engine.d.ts +79 -0
  120. package/dist/analytics/pattern-learning-engine.js +277 -0
  121. package/dist/analytics/pattern-performance-tracker.d.ts +96 -0
  122. package/dist/analytics/pattern-performance-tracker.js +335 -0
  123. package/dist/analytics/predictive-analytics.d.ts +40 -0
  124. package/dist/analytics/predictive-analytics.js +247 -0
  125. package/dist/analytics/prompt-pattern-analyzer.d.ts +98 -0
  126. package/dist/analytics/prompt-pattern-analyzer.js +370 -0
  127. package/dist/analytics/routing-performance-analyzer.d.ts +100 -0
  128. package/dist/analytics/routing-performance-analyzer.js +355 -0
  129. package/dist/analytics/routing-refiner.d.ts +102 -0
  130. package/dist/analytics/routing-refiner.js +377 -0
  131. package/dist/analytics/simple-pattern-analyzer.d.ts +79 -0
  132. package/dist/analytics/simple-pattern-analyzer.js +296 -0
  133. package/dist/architect/architect-tools.d.ts +70 -0
  134. package/dist/architect/architect-tools.js +437 -0
  135. package/dist/architect/architectural-integrity.d.ts +20 -0
  136. package/dist/architect/architectural-integrity.js +78 -0
  137. package/dist/benchmark/performance-benchmark.d.ts +103 -0
  138. package/dist/benchmark/performance-benchmark.js +373 -0
  139. package/dist/cli/commands/analytics-disable.d.ts +9 -0
  140. package/dist/cli/commands/analytics-disable.js +72 -0
  141. package/dist/cli/commands/analytics-enable-action.d.ts +8 -0
  142. package/dist/cli/commands/analytics-enable-action.js +82 -0
  143. package/dist/cli/commands/analytics-preview.d.ts +9 -0
  144. package/dist/cli/commands/analytics-preview.js +106 -0
  145. package/dist/cli/commands/analytics-status.d.ts +9 -0
  146. package/dist/cli/commands/analytics-status.js +68 -0
  147. package/dist/cli/commands/antigravity-status.d.ts +9 -0
  148. package/dist/cli/commands/antigravity-status.js +106 -0
  149. package/dist/cli/commands/archive-logs.d.ts +23 -0
  150. package/dist/cli/commands/archive-logs.js +160 -0
  151. package/dist/cli/commands/credible-init.d.ts +11 -0
  152. package/dist/cli/commands/credible-init.js +82 -0
  153. package/dist/cli/commands/enforce.d.ts +12 -0
  154. package/dist/cli/commands/enforce.js +78 -0
  155. package/dist/cli/commands/foundry-mint-wear.d.ts +3 -0
  156. package/dist/cli/commands/foundry-mint-wear.js +17 -0
  157. package/dist/cli/commands/govern.d.ts +29 -0
  158. package/dist/cli/commands/govern.js +149 -0
  159. package/dist/cli/commands/grok-install.d.ts +7 -0
  160. package/dist/cli/commands/grok-install.js +16 -0
  161. package/dist/cli/commands/hermes-install.d.ts +2 -0
  162. package/dist/cli/commands/hermes-install.js +90 -0
  163. package/dist/cli/commands/mcp-install.d.ts +4 -0
  164. package/dist/cli/commands/mcp-install.js +253 -0
  165. package/dist/cli/commands/openclaw-install.d.ts +2 -0
  166. package/dist/cli/commands/openclaw-install.js +80 -0
  167. package/dist/cli/commands/opencode-install.d.ts +2 -0
  168. package/dist/cli/commands/opencode-install.js +153 -0
  169. package/dist/cli/commands/plugin-commands.d.ts +18 -0
  170. package/dist/cli/commands/plugin-commands.js +245 -0
  171. package/dist/cli/commands/publish-agent.d.ts +15 -0
  172. package/dist/cli/commands/publish-agent.js +184 -0
  173. package/dist/cli/commands/security-audit.d.ts +23 -0
  174. package/dist/cli/commands/security-audit.js +219 -0
  175. package/dist/cli/commands/skill-install.d.ts +6 -0
  176. package/dist/cli/commands/skill-install.js +522 -0
  177. package/dist/cli/commands/status.d.ts +41 -0
  178. package/dist/cli/commands/status.js +199 -0
  179. package/dist/cli/commands/storyteller.d.ts +19 -0
  180. package/dist/cli/commands/storyteller.js +230 -0
  181. package/dist/cli/index.d.ts +7 -0
  182. package/dist/cli/index.js +996 -0
  183. package/dist/cli/server.d.ts +1 -0
  184. package/dist/cli/server.js +147 -0
  185. package/dist/config/default-agents.d.ts +12 -0
  186. package/dist/config/default-agents.js +16 -0
  187. package/dist/config/routing-mappings.d.ts +26 -0
  188. package/dist/config/routing-mappings.js +151 -0
  189. package/dist/core/activity-logger.d.ts +71 -0
  190. package/dist/core/activity-logger.js +259 -0
  191. package/dist/core/adaptive-kernel.d.ts +108 -0
  192. package/dist/core/adaptive-kernel.js +191 -0
  193. package/dist/core/agent-spawn-gate.d.ts +56 -0
  194. package/dist/core/agent-spawn-gate.js +120 -0
  195. package/dist/core/boot-orchestrator.d.ts +99 -0
  196. package/dist/core/boot-orchestrator.js +809 -0
  197. package/dist/core/bridge.mjs +922 -0
  198. package/dist/core/codex-formatter.d.ts +95 -0
  199. package/dist/core/codex-formatter.js +218 -0
  200. package/dist/core/codex-injector.d.ts +73 -0
  201. package/dist/core/codex-injector.js +423 -0
  202. package/dist/core/config-loader.d.ts +59 -0
  203. package/dist/core/config-loader.js +157 -0
  204. package/dist/core/config-paths.d.ts +66 -0
  205. package/dist/core/config-paths.js +169 -0
  206. package/dist/core/context-loader.d.ts +120 -0
  207. package/dist/core/context-loader.js +268 -0
  208. package/dist/core/context-validator.d.ts +52 -0
  209. package/dist/core/context-validator.js +211 -0
  210. package/dist/core/features-config.d.ts +531 -0
  211. package/dist/core/features-config.js +524 -0
  212. package/dist/core/framework-logger.d.ts +76 -0
  213. package/dist/core/framework-logger.js +275 -0
  214. package/dist/core/index.d.ts +5 -0
  215. package/dist/core/index.js +6 -0
  216. package/dist/core/kernel-patterns.d.ts +129 -0
  217. package/dist/core/kernel-patterns.js +301 -0
  218. package/dist/core/logging-config.d.ts +10 -0
  219. package/dist/core/logging-config.js +43 -0
  220. package/dist/core/model-router.d.ts +56 -0
  221. package/dist/core/model-router.js +134 -0
  222. package/dist/core/orchestrator.d.ts +71 -0
  223. package/dist/core/orchestrator.js +408 -0
  224. package/dist/core/system-prompt-generator.d.ts +34 -0
  225. package/dist/core/system-prompt-generator.js +264 -0
  226. package/dist/core/trace-context.d.ts +12 -0
  227. package/dist/core/trace-context.js +33 -0
  228. package/dist/core/xray-activation.d.ts +14 -0
  229. package/dist/core/xray-activation.js +135 -0
  230. package/dist/delegation/agent-delegator.d.ts +185 -0
  231. package/dist/delegation/agent-delegator.js +768 -0
  232. package/dist/delegation/agent-expertise.d.ts +15 -0
  233. package/dist/delegation/agent-expertise.js +155 -0
  234. package/dist/delegation/analytics/index.d.ts +11 -0
  235. package/dist/delegation/analytics/index.js +11 -0
  236. package/dist/delegation/analytics/learning-engine.d.ts +84 -0
  237. package/dist/delegation/analytics/learning-engine.js +276 -0
  238. package/dist/delegation/analytics/outcome-tracker.d.ts +117 -0
  239. package/dist/delegation/analytics/outcome-tracker.js +278 -0
  240. package/dist/delegation/analytics/routing-analytics.d.ts +60 -0
  241. package/dist/delegation/analytics/routing-analytics.js +192 -0
  242. package/dist/delegation/ast-code-parser.d.ts +173 -0
  243. package/dist/delegation/ast-code-parser.js +877 -0
  244. package/dist/delegation/codebase-context-analyzer.d.ts +164 -0
  245. package/dist/delegation/codebase-context-analyzer.js +1040 -0
  246. package/dist/delegation/complexity-analyzer.d.ts +110 -0
  247. package/dist/delegation/complexity-analyzer.js +281 -0
  248. package/dist/delegation/complexity-core.d.ts +119 -0
  249. package/dist/delegation/complexity-core.js +219 -0
  250. package/dist/delegation/config/types.d.ts +247 -0
  251. package/dist/delegation/config/types.js +6 -0
  252. package/dist/delegation/dependency-graph-builder.d.ts +94 -0
  253. package/dist/delegation/dependency-graph-builder.js +408 -0
  254. package/dist/delegation/index.d.ts +25 -0
  255. package/dist/delegation/index.js +20 -0
  256. package/dist/delegation/metrics-aggregator.d.ts +91 -0
  257. package/dist/delegation/metrics-aggregator.js +334 -0
  258. package/dist/delegation/session-coordinator.d.ts +132 -0
  259. package/dist/delegation/session-coordinator.js +351 -0
  260. package/dist/delegation/strategy-selector.d.ts +27 -0
  261. package/dist/delegation/strategy-selector.js +107 -0
  262. package/dist/delegation/voting-coordinator.d.ts +48 -0
  263. package/dist/delegation/voting-coordinator.js +374 -0
  264. package/dist/delegation/voting-types.d.ts +154 -0
  265. package/dist/delegation/voting-types.js +9 -0
  266. package/dist/delegation/weighted-voting-aggregator.d.ts +36 -0
  267. package/dist/delegation/weighted-voting-aggregator.js +193 -0
  268. package/dist/enforcement/core/index.d.ts +14 -0
  269. package/dist/enforcement/core/index.js +18 -0
  270. package/dist/enforcement/core/rule-executor.d.ts +157 -0
  271. package/dist/enforcement/core/rule-executor.js +364 -0
  272. package/dist/enforcement/core/rule-hierarchy.d.ts +145 -0
  273. package/dist/enforcement/core/rule-hierarchy.js +258 -0
  274. package/dist/enforcement/core/rule-registry.d.ts +196 -0
  275. package/dist/enforcement/core/rule-registry.js +239 -0
  276. package/dist/enforcement/core/violation-fixer.d.ts +105 -0
  277. package/dist/enforcement/core/violation-fixer.js +650 -0
  278. package/dist/enforcement/enforcer-tools.d.ts +85 -0
  279. package/dist/enforcement/enforcer-tools.js +818 -0
  280. package/dist/enforcement/index.d.ts +22 -0
  281. package/dist/enforcement/index.js +40 -0
  282. package/dist/enforcement/loaders/agent-triage-loader.d.ts +98 -0
  283. package/dist/enforcement/loaders/agent-triage-loader.js +221 -0
  284. package/dist/enforcement/loaders/agents-md-validation-loader.d.ts +75 -0
  285. package/dist/enforcement/loaders/agents-md-validation-loader.js +251 -0
  286. package/dist/enforcement/loaders/base-loader.d.ts +82 -0
  287. package/dist/enforcement/loaders/base-loader.js +85 -0
  288. package/dist/enforcement/loaders/codex-loader.d.ts +76 -0
  289. package/dist/enforcement/loaders/codex-loader.js +395 -0
  290. package/dist/enforcement/loaders/index.d.ts +36 -0
  291. package/dist/enforcement/loaders/index.js +39 -0
  292. package/dist/enforcement/loaders/loader-orchestrator.d.ts +96 -0
  293. package/dist/enforcement/loaders/loader-orchestrator.js +167 -0
  294. package/dist/enforcement/loaders/processor-loader.d.ts +59 -0
  295. package/dist/enforcement/loaders/processor-loader.js +112 -0
  296. package/dist/enforcement/rule-enforcer.d.ts +142 -0
  297. package/dist/enforcement/rule-enforcer.js +298 -0
  298. package/dist/enforcement/test-auto-healing.d.ts +83 -0
  299. package/dist/enforcement/test-auto-healing.js +325 -0
  300. package/dist/enforcement/types.d.ts +500 -0
  301. package/dist/enforcement/types.js +29 -0
  302. package/dist/enforcement/validators/architecture-validators.d.ts +154 -0
  303. package/dist/enforcement/validators/architecture-validators.js +599 -0
  304. package/dist/enforcement/validators/base-validator.d.ts +87 -0
  305. package/dist/enforcement/validators/base-validator.js +107 -0
  306. package/dist/enforcement/validators/code-quality-validators.d.ts +88 -0
  307. package/dist/enforcement/validators/code-quality-validators.js +335 -0
  308. package/dist/enforcement/validators/index.d.ts +14 -0
  309. package/dist/enforcement/validators/index.js +20 -0
  310. package/dist/enforcement/validators/security-validators.d.ts +52 -0
  311. package/dist/enforcement/validators/security-validators.js +219 -0
  312. package/dist/enforcement/validators/testing-validators.d.ts +80 -0
  313. package/dist/enforcement/validators/testing-validators.js +252 -0
  314. package/dist/enforcement/validators/validator-registry.d.ts +91 -0
  315. package/dist/enforcement/validators/validator-registry.js +149 -0
  316. package/dist/execution/opencode-cli-invoker.d.ts +8 -0
  317. package/dist/execution/opencode-cli-invoker.js +173 -0
  318. package/dist/execution/proposal-applier.d.ts +24 -0
  319. package/dist/execution/proposal-applier.js +254 -0
  320. package/dist/governance/codex-policy.service.d.ts +56 -0
  321. package/dist/governance/codex-policy.service.js +166 -0
  322. package/dist/governance/governance-core.d.ts +53 -0
  323. package/dist/governance/governance-core.js +168 -0
  324. package/dist/governance/governance-service.d.ts +39 -0
  325. package/dist/governance/governance-service.js +351 -0
  326. package/dist/governance/governance-types.d.ts +90 -0
  327. package/dist/governance/governance-types.js +11 -0
  328. package/dist/governance/llm-governance-provider.d.ts +16 -0
  329. package/dist/governance/llm-governance-provider.js +284 -0
  330. package/dist/governance/local-confer.d.ts +10 -0
  331. package/dist/governance/local-confer.js +27 -0
  332. package/dist/index.d.ts +28 -0
  333. package/dist/index.js +24 -0
  334. package/dist/inference/deploy-verifier.d.ts +26 -0
  335. package/dist/inference/deploy-verifier.js +161 -0
  336. package/dist/inference/index.d.ts +10 -0
  337. package/dist/inference/index.js +5 -0
  338. package/dist/inference/inference-accumulator.d.ts +29 -0
  339. package/dist/inference/inference-accumulator.js +126 -0
  340. package/dist/inference/inference-agent-invoker.d.ts +3 -0
  341. package/dist/inference/inference-agent-invoker.js +67 -0
  342. package/dist/inference/inference-applier.d.ts +4 -0
  343. package/dist/inference/inference-applier.js +178 -0
  344. package/dist/inference/inference-cycle.d.ts +70 -0
  345. package/dist/inference/inference-cycle.js +392 -0
  346. package/dist/inference/inference-proposal-generator.d.ts +3 -0
  347. package/dist/inference/inference-proposal-generator.js +149 -0
  348. package/dist/inference/semantic-patterns.d.ts +7 -0
  349. package/dist/inference/semantic-patterns.js +310 -0
  350. package/dist/inference/session-capture.d.ts +32 -0
  351. package/dist/inference/session-capture.js +308 -0
  352. package/dist/infrastructure/iac-validator.d.ts +150 -0
  353. package/dist/infrastructure/iac-validator.js +465 -0
  354. package/dist/infrastructure/schemas/cloud-schemas.d.ts +482 -0
  355. package/dist/infrastructure/schemas/cloud-schemas.js +488 -0
  356. package/dist/integrations/base/ExampleIntegration.d.ts +46 -0
  357. package/dist/integrations/base/ExampleIntegration.js +180 -0
  358. package/dist/integrations/base/Integration.d.ts +266 -0
  359. package/dist/integrations/base/Integration.js +394 -0
  360. package/dist/integrations/base/README.md +446 -0
  361. package/dist/integrations/base/index.d.ts +11 -0
  362. package/dist/integrations/base/index.js +15 -0
  363. package/dist/integrations/base/registry.d.ts +272 -0
  364. package/dist/integrations/base/registry.js +605 -0
  365. package/dist/integrations/base/types.d.ts +167 -0
  366. package/dist/integrations/base/types.js +117 -0
  367. package/dist/integrations/cursor/README.md +61 -0
  368. package/dist/integrations/cursor/hooks/after-file-edit.js +38 -0
  369. package/dist/integrations/cursor/hooks/cursor-hook-utils.js +170 -0
  370. package/dist/integrations/cursor/hooks/cursor-usage-receipt.js +298 -0
  371. package/dist/integrations/cursor/hooks/hooks.json +20 -0
  372. package/dist/integrations/cursor/hooks/pre-compact.js +88 -0
  373. package/dist/integrations/cursor/hooks/pre-tool-use.js +105 -0
  374. package/dist/integrations/enforcement-gate.d.ts +44 -0
  375. package/dist/integrations/enforcement-gate.js +348 -0
  376. package/dist/integrations/governance/governance-client.d.ts +75 -0
  377. package/dist/integrations/governance/governance-client.js +315 -0
  378. package/dist/integrations/governance/index.d.ts +98 -0
  379. package/dist/integrations/governance/index.js +365 -0
  380. package/dist/integrations/governance/types.d.ts +238 -0
  381. package/dist/integrations/governance/types.js +96 -0
  382. package/dist/integrations/grok/grok-cli.d.ts +31 -0
  383. package/dist/integrations/grok/grok-cli.js +222 -0
  384. package/dist/integrations/grok/hooks/grok-hook-activity.js +53 -0
  385. package/dist/integrations/grok/hooks/grok-hook-utils.js +372 -0
  386. package/dist/integrations/grok/hooks/post-tool-use.js +118 -0
  387. package/dist/integrations/grok/hooks/pre-tool-use.js +136 -0
  388. package/dist/integrations/grok/hooks/session-start.js +189 -0
  389. package/dist/integrations/grok/plugin/0xray/.mcp.json +35 -0
  390. package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +70 -0
  391. package/dist/integrations/hermes-agent/.mcp.json +32 -0
  392. package/dist/integrations/hermes-agent/__init__.py +790 -0
  393. package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
  394. package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
  395. package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
  396. package/dist/integrations/hermes-agent/after-install.md +71 -0
  397. package/dist/integrations/hermes-agent/bridge.mjs +1060 -0
  398. package/dist/integrations/hermes-agent/conftest.py +14 -0
  399. package/dist/integrations/hermes-agent/logs/framework/routing-outcomes.json +1 -0
  400. package/dist/integrations/hermes-agent/plugin.yaml +12 -0
  401. package/dist/integrations/hermes-agent/schemas.py +149 -0
  402. package/dist/integrations/hermes-agent/test_plugin.py +1100 -0
  403. package/dist/integrations/hermes-agent/tools.py +357 -0
  404. package/dist/integrations/hooks/confer-hook-runtime.mjs +49 -0
  405. package/dist/integrations/hooks/delegation-gate-runtime.mjs +110 -0
  406. package/dist/integrations/hooks/pipeline-hook-runtime.mjs +211 -0
  407. package/dist/integrations/hooks/plan-hook-runtime.mjs +68 -0
  408. package/dist/integrations/hooks/station-hook-runtime.cjs +509 -0
  409. package/dist/integrations/hooks/station-hook-runtime.mjs +26 -0
  410. package/dist/integrations/hooks/station-memory-ingest.mjs +45 -0
  411. package/dist/integrations/hooks/station-memory-match.mjs +47 -0
  412. package/dist/integrations/hooks/synthesis-hook-runtime.mjs +50 -0
  413. package/dist/integrations/hooks/user-aside-hook-runtime.mjs +49 -0
  414. package/dist/integrations/openclaw/README.md +134 -0
  415. package/dist/integrations/openclaw/api-server.d.ts +86 -0
  416. package/dist/integrations/openclaw/api-server.js +388 -0
  417. package/dist/integrations/openclaw/client.d.ts +125 -0
  418. package/dist/integrations/openclaw/client.js +499 -0
  419. package/dist/integrations/openclaw/config.d.ts +95 -0
  420. package/dist/integrations/openclaw/config.js +372 -0
  421. package/dist/integrations/openclaw/hooks/pre-tool-gate-runtime.mjs +102 -0
  422. package/dist/integrations/openclaw/hooks/xray-hooks.d.ts +123 -0
  423. package/dist/integrations/openclaw/hooks/xray-hooks.js +279 -0
  424. package/dist/integrations/openclaw/index.d.ts +100 -0
  425. package/dist/integrations/openclaw/index.js +367 -0
  426. package/dist/integrations/openclaw/plugin/xray-pre-tool/index.js +75 -0
  427. package/dist/integrations/openclaw/plugin/xray-pre-tool/openclaw.plugin.json +10 -0
  428. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +12 -0
  429. package/dist/integrations/openclaw/pre-tool-gate.d.ts +19 -0
  430. package/dist/integrations/openclaw/pre-tool-gate.js +39 -0
  431. package/dist/integrations/openclaw/types.d.ts +425 -0
  432. package/dist/integrations/openclaw/types.js +152 -0
  433. package/dist/integrations/plugins/index.d.ts +9 -0
  434. package/dist/integrations/plugins/index.js +9 -0
  435. package/dist/integrations/plugins/plugin-integration.d.ts +288 -0
  436. package/dist/integrations/plugins/plugin-integration.js +605 -0
  437. package/dist/integrations/plugins/plugin-registry.d.ts +223 -0
  438. package/dist/integrations/plugins/plugin-registry.js +579 -0
  439. package/dist/mcps/agent-resolver.d.ts +45 -0
  440. package/dist/mcps/agent-resolver.js +105 -0
  441. package/dist/mcps/architect-tools.server.d.ts +16 -0
  442. package/dist/mcps/architect-tools.server.js +217 -0
  443. package/dist/mcps/auto-format.server.d.ts +18 -0
  444. package/dist/mcps/auto-format.server.js +395 -0
  445. package/dist/mcps/boot-orchestrator.server.d.ts +48 -0
  446. package/dist/mcps/boot-orchestrator.server.js +835 -0
  447. package/dist/mcps/config/config-loader.d.ts +56 -0
  448. package/dist/mcps/config/config-loader.js +140 -0
  449. package/dist/mcps/config/config-validator.d.ts +40 -0
  450. package/dist/mcps/config/config-validator.js +101 -0
  451. package/dist/mcps/config/index.d.ts +31 -0
  452. package/dist/mcps/config/index.js +30 -0
  453. package/dist/mcps/config/plugin-server-registry.d.ts +126 -0
  454. package/dist/mcps/config/plugin-server-registry.js +222 -0
  455. package/dist/mcps/config/server-config-registry.d.ts +51 -0
  456. package/dist/mcps/config/server-config-registry.js +349 -0
  457. package/dist/mcps/connection/connection-manager.d.ts +39 -0
  458. package/dist/mcps/connection/connection-manager.js +79 -0
  459. package/dist/mcps/connection/connection-pool.d.ts +64 -0
  460. package/dist/mcps/connection/connection-pool.js +164 -0
  461. package/dist/mcps/connection/mcp-connection.d.ts +66 -0
  462. package/dist/mcps/connection/mcp-connection.js +233 -0
  463. package/dist/mcps/connection/process-spawner.d.ts +24 -0
  464. package/dist/mcps/connection/process-spawner.js +34 -0
  465. package/dist/mcps/enforcer-tools.server.d.ts +26 -0
  466. package/dist/mcps/enforcer-tools.server.js +712 -0
  467. package/dist/mcps/estimation.server.d.ts +19 -0
  468. package/dist/mcps/estimation.server.js +149 -0
  469. package/dist/mcps/framework-compliance-audit.server.d.ts +20 -0
  470. package/dist/mcps/framework-compliance-audit.server.js +471 -0
  471. package/dist/mcps/framework-help.server.d.ts +13 -0
  472. package/dist/mcps/framework-help.server.js +383 -0
  473. package/dist/mcps/governance.server.d.ts +36 -0
  474. package/dist/mcps/governance.server.js +499 -0
  475. package/dist/mcps/in-process-skill-registry.d.ts +20 -0
  476. package/dist/mcps/in-process-skill-registry.js +48 -0
  477. package/dist/mcps/index.d.ts +17 -0
  478. package/dist/mcps/index.js +65 -0
  479. package/dist/mcps/knowledge-skills/api-design.server.d.ts +13 -0
  480. package/dist/mcps/knowledge-skills/api-design.server.js +92 -0
  481. package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +13 -0
  482. package/dist/mcps/knowledge-skills/architecture-patterns.server.js +82 -0
  483. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.d.ts +31 -0
  484. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +434 -0
  485. package/dist/mcps/knowledge-skills/code-analyzer.server.d.ts +29 -0
  486. package/dist/mcps/knowledge-skills/code-analyzer.server.js +578 -0
  487. package/dist/mcps/knowledge-skills/code-review.server.d.ts +44 -0
  488. package/dist/mcps/knowledge-skills/code-review.server.js +783 -0
  489. package/dist/mcps/knowledge-skills/content-creator.server.d.ts +11 -0
  490. package/dist/mcps/knowledge-skills/content-creator.server.js +234 -0
  491. package/dist/mcps/knowledge-skills/database-design.server.d.ts +41 -0
  492. package/dist/mcps/knowledge-skills/database-design.server.js +788 -0
  493. package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +41 -0
  494. package/dist/mcps/knowledge-skills/devops-deployment.server.js +1147 -0
  495. package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +13 -0
  496. package/dist/mcps/knowledge-skills/git-workflow.server.js +83 -0
  497. package/dist/mcps/knowledge-skills/growth-strategist.server.d.ts +11 -0
  498. package/dist/mcps/knowledge-skills/growth-strategist.server.js +339 -0
  499. package/dist/mcps/knowledge-skills/log-monitor.server.d.ts +22 -0
  500. package/dist/mcps/knowledge-skills/log-monitor.server.js +431 -0
  501. package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +17 -0
  502. package/dist/mcps/knowledge-skills/mobile-development.server.js +495 -0
  503. package/dist/mcps/knowledge-skills/multimodal-looker.server.d.ts +53 -0
  504. package/dist/mcps/knowledge-skills/multimodal-looker.server.js +1028 -0
  505. package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +69 -0
  506. package/dist/mcps/knowledge-skills/performance-optimization.server.js +1537 -0
  507. package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +35 -0
  508. package/dist/mcps/knowledge-skills/project-analysis.server.js +724 -0
  509. package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +31 -0
  510. package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +762 -0
  511. package/dist/mcps/knowledge-skills/security-audit.server.d.ts +46 -0
  512. package/dist/mcps/knowledge-skills/security-audit.server.js +684 -0
  513. package/dist/mcps/knowledge-skills/seo-consultant.server.d.ts +24 -0
  514. package/dist/mcps/knowledge-skills/seo-consultant.server.js +745 -0
  515. package/dist/mcps/knowledge-skills/session-management.server.d.ts +22 -0
  516. package/dist/mcps/knowledge-skills/session-management.server.js +394 -0
  517. package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +32 -0
  518. package/dist/mcps/knowledge-skills/skill-invocation.server.js +454 -0
  519. package/dist/mcps/knowledge-skills/storyteller.server.d.ts +11 -0
  520. package/dist/mcps/knowledge-skills/storyteller.server.js +167 -0
  521. package/dist/mcps/knowledge-skills/strategist.server.d.ts +15 -0
  522. package/dist/mcps/knowledge-skills/strategist.server.js +172 -0
  523. package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +45 -0
  524. package/dist/mcps/knowledge-skills/tech-writer.server.js +1016 -0
  525. package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +34 -0
  526. package/dist/mcps/knowledge-skills/testing-best-practices.server.js +694 -0
  527. package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +45 -0
  528. package/dist/mcps/knowledge-skills/testing-strategy.server.js +689 -0
  529. package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +67 -0
  530. package/dist/mcps/knowledge-skills/ui-ux-design.server.js +1265 -0
  531. package/dist/mcps/lint.server.d.ts +15 -0
  532. package/dist/mcps/lint.server.js +340 -0
  533. package/dist/mcps/mcp-client.d.ts +157 -0
  534. package/dist/mcps/mcp-client.js +574 -0
  535. package/dist/mcps/model-health-check.server.d.ts +14 -0
  536. package/dist/mcps/model-health-check.server.js +201 -0
  537. package/dist/mcps/orchestrator/aside-context.d.ts +21 -0
  538. package/dist/mcps/orchestrator/aside-context.js +207 -0
  539. package/dist/mcps/orchestrator/config/agent-capabilities.d.ts +39 -0
  540. package/dist/mcps/orchestrator/config/agent-capabilities.js +128 -0
  541. package/dist/mcps/orchestrator/config/memory-routing-bridge.d.ts +12 -0
  542. package/dist/mcps/orchestrator/config/memory-routing-bridge.js +71 -0
  543. package/dist/mcps/orchestrator/execution/execution-planner.d.ts +64 -0
  544. package/dist/mcps/orchestrator/execution/execution-planner.js +320 -0
  545. package/dist/mcps/orchestrator/handlers/complexity-handler.d.ts +55 -0
  546. package/dist/mcps/orchestrator/handlers/complexity-handler.js +285 -0
  547. package/dist/mcps/orchestrator/handlers/status-handler.d.ts +71 -0
  548. package/dist/mcps/orchestrator/handlers/status-handler.js +239 -0
  549. package/dist/mcps/orchestrator/handlers/task-handler.d.ts +59 -0
  550. package/dist/mcps/orchestrator/handlers/task-handler.js +354 -0
  551. package/dist/mcps/orchestrator/index.d.ts +6 -0
  552. package/dist/mcps/orchestrator/index.js +5 -0
  553. package/dist/mcps/orchestrator/server.d.ts +38 -0
  554. package/dist/mcps/orchestrator/server.js +538 -0
  555. package/dist/mcps/orchestrator/types.d.ts +131 -0
  556. package/dist/mcps/orchestrator/types.js +6 -0
  557. package/dist/mcps/orchestrator.server.d.ts +10 -0
  558. package/dist/mcps/orchestrator.server.js +20 -0
  559. package/dist/mcps/performance-analysis.server.d.ts +25 -0
  560. package/dist/mcps/performance-analysis.server.js +488 -0
  561. package/dist/mcps/processor-pipeline.server.d.ts +29 -0
  562. package/dist/mcps/processor-pipeline.server.js +531 -0
  563. package/dist/mcps/protocol/protocol-constants.d.ts +46 -0
  564. package/dist/mcps/protocol/protocol-constants.js +46 -0
  565. package/dist/mcps/registry.json +109 -0
  566. package/dist/mcps/researcher-confidence.d.ts +21 -0
  567. package/dist/mcps/researcher-confidence.js +92 -0
  568. package/dist/mcps/researcher.server.d.ts +29 -0
  569. package/dist/mcps/researcher.server.js +419 -0
  570. package/dist/mcps/security-scan.server.d.ts +19 -0
  571. package/dist/mcps/security-scan.server.js +517 -0
  572. package/dist/mcps/shared/knowledge-skill-base.d.ts +17 -0
  573. package/dist/mcps/shared/knowledge-skill-base.js +52 -0
  574. package/dist/mcps/shared/prompt-security-validator.d.ts +44 -0
  575. package/dist/mcps/shared/prompt-security-validator.js +148 -0
  576. package/dist/mcps/shared/security-scanner.d.ts +119 -0
  577. package/dist/mcps/shared/security-scanner.js +429 -0
  578. package/dist/mcps/simulation/index.d.ts +12 -0
  579. package/dist/mcps/simulation/index.js +12 -0
  580. package/dist/mcps/simulation/server-simulations.d.ts +39 -0
  581. package/dist/mcps/simulation/server-simulations.js +219 -0
  582. package/dist/mcps/simulation/simulation-engine.d.ts +51 -0
  583. package/dist/mcps/simulation/simulation-engine.js +96 -0
  584. package/dist/mcps/state-manager.server.d.ts +27 -0
  585. package/dist/mcps/state-manager.server.js +609 -0
  586. package/dist/mcps/tools/index.d.ts +14 -0
  587. package/dist/mcps/tools/index.js +14 -0
  588. package/dist/mcps/tools/tool-cache.d.ts +53 -0
  589. package/dist/mcps/tools/tool-cache.js +112 -0
  590. package/dist/mcps/tools/tool-discovery.d.ts +27 -0
  591. package/dist/mcps/tools/tool-discovery.js +65 -0
  592. package/dist/mcps/tools/tool-executor.d.ts +41 -0
  593. package/dist/mcps/tools/tool-executor.js +75 -0
  594. package/dist/mcps/tools/tool-registry.d.ts +42 -0
  595. package/dist/mcps/tools/tool-registry.js +67 -0
  596. package/dist/mcps/types/index.d.ts +13 -0
  597. package/dist/mcps/types/index.js +15 -0
  598. package/dist/mcps/types/json-rpc.types.d.ts +35 -0
  599. package/dist/mcps/types/json-rpc.types.js +7 -0
  600. package/dist/mcps/types/mcp.types.d.ts +105 -0
  601. package/dist/mcps/types/mcp.types.js +7 -0
  602. package/dist/memory-routing/index.d.ts +6 -0
  603. package/dist/memory-routing/index.js +4 -0
  604. package/dist/memory-routing/null-provider.d.ts +14 -0
  605. package/dist/memory-routing/null-provider.js +63 -0
  606. package/dist/memory-routing/provider-loader.d.ts +6 -0
  607. package/dist/memory-routing/provider-loader.js +165 -0
  608. package/dist/memory-routing/provider-registry.d.ts +8 -0
  609. package/dist/memory-routing/provider-registry.js +41 -0
  610. package/dist/memory-routing/types.d.ts +111 -0
  611. package/dist/memory-routing/types.js +7 -0
  612. package/dist/memory-routing/validate-config.d.ts +7 -0
  613. package/dist/memory-routing/validate-config.js +32 -0
  614. package/dist/metrics/agent-metrics.d.ts +169 -0
  615. package/dist/metrics/agent-metrics.js +574 -0
  616. package/dist/metrics/index.d.ts +6 -0
  617. package/dist/metrics/index.js +6 -0
  618. package/dist/monitoring/advanced-profiler.d.ts +51 -0
  619. package/dist/monitoring/advanced-profiler.js +232 -0
  620. package/dist/monitoring/memory-monitor.d.ts +113 -0
  621. package/dist/monitoring/memory-monitor.js +315 -0
  622. package/dist/monitoring/nudge-watchdog.d.ts +87 -0
  623. package/dist/monitoring/nudge-watchdog.js +355 -0
  624. package/dist/monitoring/test-auto-generation-monitor.d.ts +64 -0
  625. package/dist/monitoring/test-auto-generation-monitor.js +157 -0
  626. package/dist/nucleus/aside-worktree.d.ts +41 -0
  627. package/dist/nucleus/aside-worktree.js +164 -0
  628. package/dist/nucleus/autonomy-kernel.d.ts +55 -0
  629. package/dist/nucleus/autonomy-kernel.js +234 -0
  630. package/dist/nucleus/confer.d.ts +57 -0
  631. package/dist/nucleus/confer.js +322 -0
  632. package/dist/nucleus/default-plugins.d.ts +17 -0
  633. package/dist/nucleus/default-plugins.js +173 -0
  634. package/dist/nucleus/delegation-gate.d.ts +105 -0
  635. package/dist/nucleus/delegation-gate.js +582 -0
  636. package/dist/nucleus/govern-http.d.ts +59 -0
  637. package/dist/nucleus/govern-http.js +175 -0
  638. package/dist/nucleus/index.d.ts +17 -0
  639. package/dist/nucleus/index.js +12 -0
  640. package/dist/nucleus/kernel.d.ts +51 -0
  641. package/dist/nucleus/kernel.js +62 -0
  642. package/dist/nucleus/lead-dev-plan-persistence.d.ts +70 -0
  643. package/dist/nucleus/lead-dev-plan-persistence.js +402 -0
  644. package/dist/nucleus/pending-delegations.d.ts +71 -0
  645. package/dist/nucleus/pending-delegations.js +285 -0
  646. package/dist/nucleus/plugin-registry.d.ts +132 -0
  647. package/dist/nucleus/plugin-registry.js +175 -0
  648. package/dist/nucleus/spawn-plan-resolution.d.ts +20 -0
  649. package/dist/nucleus/spawn-plan-resolution.js +42 -0
  650. package/dist/nucleus/suit-temperament.d.ts +40 -0
  651. package/dist/nucleus/suit-temperament.js +159 -0
  652. package/dist/nucleus/synthesis-completion.d.ts +6 -0
  653. package/dist/nucleus/synthesis-completion.js +29 -0
  654. package/dist/nucleus/synthesis-consult-receipt.d.ts +32 -0
  655. package/dist/nucleus/synthesis-consult-receipt.js +171 -0
  656. package/dist/nucleus/synthesis-context.d.ts +31 -0
  657. package/dist/nucleus/synthesis-context.js +86 -0
  658. package/dist/nucleus/synthesis.d.ts +54 -0
  659. package/dist/nucleus/synthesis.js +196 -0
  660. package/dist/nucleus/thin-dispatch.d.ts +33 -0
  661. package/dist/nucleus/thin-dispatch.js +85 -0
  662. package/dist/nucleus/user-aside.d.ts +70 -0
  663. package/dist/nucleus/user-aside.js +393 -0
  664. package/dist/orchestrator/agent-spawn-governor.d.ts +126 -0
  665. package/dist/orchestrator/agent-spawn-governor.js +558 -0
  666. package/dist/orchestrator/enhanced-multi-agent-orchestrator.d.ts +156 -0
  667. package/dist/orchestrator/enhanced-multi-agent-orchestrator.js +399 -0
  668. package/dist/orchestrator/intelligent-commit-batcher.d.ts +114 -0
  669. package/dist/orchestrator/intelligent-commit-batcher.js +344 -0
  670. package/dist/orchestrator/multi-agent-orchestration-coordinator.d.ts +126 -0
  671. package/dist/orchestrator/multi-agent-orchestration-coordinator.js +455 -0
  672. package/dist/orchestrator/orchestrator.d.ts +141 -0
  673. package/dist/orchestrator/orchestrator.js +648 -0
  674. package/dist/orchestrator/self-direction-activation.d.ts +108 -0
  675. package/dist/orchestrator/self-direction-activation.js +244 -0
  676. package/dist/orchestrator/universal-librarian-consultation.d.ts +98 -0
  677. package/dist/orchestrator/universal-librarian-consultation.js +216 -0
  678. package/dist/orchestrator/universal-registry-bridge.d.ts +84 -0
  679. package/dist/orchestrator/universal-registry-bridge.js +246 -0
  680. package/dist/performance/performance-budget-enforcer.d.ts +157 -0
  681. package/dist/performance/performance-budget-enforcer.js +433 -0
  682. package/dist/performance/performance-regression-tester.d.ts +107 -0
  683. package/dist/performance/performance-regression-tester.js +341 -0
  684. package/dist/plugin/plugin-codex-context.d.ts +18 -0
  685. package/dist/plugin/plugin-codex-context.js +87 -0
  686. package/dist/plugin/plugin-helpers.d.ts +23 -0
  687. package/dist/plugin/plugin-helpers.js +155 -0
  688. package/dist/plugin/plugin-logger.d.ts +8 -0
  689. package/dist/plugin/plugin-logger.js +46 -0
  690. package/dist/plugin/plugin-modules.d.ts +11 -0
  691. package/dist/plugin/plugin-modules.js +144 -0
  692. package/dist/plugin/plugin-quality-gate.d.ts +11 -0
  693. package/dist/plugin/plugin-quality-gate.js +88 -0
  694. package/dist/plugin/plugin-types.d.ts +93 -0
  695. package/dist/plugin/plugin-types.js +1 -0
  696. package/dist/plugin/xray-codex-injection.d.ts +39 -0
  697. package/dist/plugin/xray-codex-injection.js +399 -0
  698. package/dist/postprocessor/PostProcessor.d.ts +108 -0
  699. package/dist/postprocessor/PostProcessor.js +1053 -0
  700. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +11 -0
  701. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
  702. package/dist/postprocessor/analysis/FailureAnalysisEngine.d.ts +39 -0
  703. package/dist/postprocessor/analysis/FailureAnalysisEngine.js +245 -0
  704. package/dist/postprocessor/autofix/AutoFixEngine.d.ts +48 -0
  705. package/dist/postprocessor/autofix/AutoFixEngine.js +254 -0
  706. package/dist/postprocessor/autofix/FixValidator.d.ts +23 -0
  707. package/dist/postprocessor/autofix/FixValidator.js +56 -0
  708. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +44 -0
  709. package/dist/postprocessor/config/ProcessorConfigLoader.js +16 -0
  710. package/dist/postprocessor/config.d.ts +6 -0
  711. package/dist/postprocessor/config.js +65 -0
  712. package/dist/postprocessor/escalation/EscalationEngine.d.ts +154 -0
  713. package/dist/postprocessor/escalation/EscalationEngine.js +492 -0
  714. package/dist/postprocessor/integration.d.ts +156 -0
  715. package/dist/postprocessor/integration.js +194 -0
  716. package/dist/postprocessor/metamorphosis/SelfProposalEngine.d.ts +87 -0
  717. package/dist/postprocessor/metamorphosis/SelfProposalEngine.js +472 -0
  718. package/dist/postprocessor/metamorphosis/index.d.ts +2 -0
  719. package/dist/postprocessor/metamorphosis/index.js +1 -0
  720. package/dist/postprocessor/monitoring/MonitoringEngine.d.ts +40 -0
  721. package/dist/postprocessor/monitoring/MonitoringEngine.js +125 -0
  722. package/dist/postprocessor/redeploy/RedeployCoordinator.d.ts +91 -0
  723. package/dist/postprocessor/redeploy/RedeployCoordinator.js +342 -0
  724. package/dist/postprocessor/redeploy/RetryHandler.d.ts +49 -0
  725. package/dist/postprocessor/redeploy/RetryHandler.js +118 -0
  726. package/dist/postprocessor/services/RegressionAnalysisService.d.ts +39 -0
  727. package/dist/postprocessor/services/RegressionAnalysisService.js +130 -0
  728. package/dist/postprocessor/success/SuccessHandler.d.ts +57 -0
  729. package/dist/postprocessor/success/SuccessHandler.js +134 -0
  730. package/dist/postprocessor/triggers/APITrigger.d.ts +34 -0
  731. package/dist/postprocessor/triggers/APITrigger.js +114 -0
  732. package/dist/postprocessor/triggers/GitHookTrigger.d.ts +38 -0
  733. package/dist/postprocessor/triggers/GitHookTrigger.js +557 -0
  734. package/dist/postprocessor/triggers/WebhookTrigger.d.ts +46 -0
  735. package/dist/postprocessor/triggers/WebhookTrigger.js +210 -0
  736. package/dist/postprocessor/types.d.ts +227 -0
  737. package/dist/postprocessor/types.js +4 -0
  738. package/dist/processors/doc-write-guard.d.ts +6 -0
  739. package/dist/processors/doc-write-guard.js +46 -0
  740. package/dist/processors/implementations/agents-md-validation-processor.d.ts +62 -0
  741. package/dist/processors/implementations/agents-md-validation-processor.js +285 -0
  742. package/dist/processors/implementations/async-pattern-processor.d.ts +47 -0
  743. package/dist/processors/implementations/async-pattern-processor.js +157 -0
  744. package/dist/processors/implementations/codex-compliance-processor.d.ts +7 -0
  745. package/dist/processors/implementations/codex-compliance-processor.js +57 -0
  746. package/dist/processors/implementations/commit-batcher-processor.d.ts +13 -0
  747. package/dist/processors/implementations/commit-batcher-processor.js +71 -0
  748. package/dist/processors/implementations/console-log-guard-processor.d.ts +32 -0
  749. package/dist/processors/implementations/console-log-guard-processor.js +162 -0
  750. package/dist/processors/implementations/coverage-analysis-processor.d.ts +19 -0
  751. package/dist/processors/implementations/coverage-analysis-processor.js +137 -0
  752. package/dist/processors/implementations/error-boundary-processor.d.ts +7 -0
  753. package/dist/processors/implementations/error-boundary-processor.js +44 -0
  754. package/dist/processors/implementations/inference-improvement-processor.d.ts +36 -0
  755. package/dist/processors/implementations/inference-improvement-processor.js +262 -0
  756. package/dist/processors/implementations/log-protection-processor.d.ts +29 -0
  757. package/dist/processors/implementations/log-protection-processor.js +117 -0
  758. package/dist/processors/implementations/nudge-processor.d.ts +21 -0
  759. package/dist/processors/implementations/nudge-processor.js +129 -0
  760. package/dist/processors/implementations/performance-budget-processor.d.ts +49 -0
  761. package/dist/processors/implementations/performance-budget-processor.js +216 -0
  762. package/dist/processors/implementations/postprocessor-chain-validator.d.ts +45 -0
  763. package/dist/processors/implementations/postprocessor-chain-validator.js +148 -0
  764. package/dist/processors/implementations/pre-validate-processor.d.ts +7 -0
  765. package/dist/processors/implementations/pre-validate-processor.js +18 -0
  766. package/dist/processors/implementations/publish-preflight-processor.d.ts +37 -0
  767. package/dist/processors/implementations/publish-preflight-processor.js +240 -0
  768. package/dist/processors/implementations/refactoring-logging-processor-wrapper.d.ts +7 -0
  769. package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +33 -0
  770. package/dist/processors/implementations/refactoring-logging-processor.d.ts +31 -0
  771. package/dist/processors/implementations/refactoring-logging-processor.js +96 -0
  772. package/dist/processors/implementations/regression-testing-processor.d.ts +20 -0
  773. package/dist/processors/implementations/regression-testing-processor.js +59 -0
  774. package/dist/processors/implementations/session-capture-processor.d.ts +14 -0
  775. package/dist/processors/implementations/session-capture-processor.js +37 -0
  776. package/dist/processors/implementations/session-summary-processor.d.ts +26 -0
  777. package/dist/processors/implementations/session-summary-processor.js +125 -0
  778. package/dist/processors/implementations/spawn-governance-processor.d.ts +57 -0
  779. package/dist/processors/implementations/spawn-governance-processor.js +218 -0
  780. package/dist/processors/implementations/state-validation-processor.d.ts +11 -0
  781. package/dist/processors/implementations/state-validation-processor.js +15 -0
  782. package/dist/processors/implementations/storytelling-trigger-processor.d.ts +40 -0
  783. package/dist/processors/implementations/storytelling-trigger-processor.js +563 -0
  784. package/dist/processors/implementations/test-auto-creation-processor.d.ts +16 -0
  785. package/dist/processors/implementations/test-auto-creation-processor.js +483 -0
  786. package/dist/processors/implementations/test-execution-processor.d.ts +11 -0
  787. package/dist/processors/implementations/test-execution-processor.js +132 -0
  788. package/dist/processors/implementations/typescript-compilation-processor.d.ts +37 -0
  789. package/dist/processors/implementations/typescript-compilation-processor.js +86 -0
  790. package/dist/processors/implementations/version-compliance-processor.d.ts +80 -0
  791. package/dist/processors/implementations/version-compliance-processor.js +222 -0
  792. package/dist/processors/processor-interfaces.d.ts +126 -0
  793. package/dist/processors/processor-interfaces.js +125 -0
  794. package/dist/processors/processor-manager.d.ts +80 -0
  795. package/dist/processors/processor-manager.js +826 -0
  796. package/dist/processors/processor-types.d.ts +189 -0
  797. package/dist/processors/processor-types.js +11 -0
  798. package/dist/public/XrayService.d.ts +17 -0
  799. package/dist/public/XrayService.js +40 -0
  800. package/dist/public/about.html +228 -0
  801. package/dist/public/enterprise.html +27 -0
  802. package/dist/public/features.html +102 -0
  803. package/dist/public/index.d.ts +4 -0
  804. package/dist/public/index.html +145 -0
  805. package/dist/public/index.js +2 -0
  806. package/dist/reporting/framework-reporting-system.d.ts +19 -0
  807. package/dist/reporting/framework-reporting-system.js +187 -0
  808. package/dist/reporting/log-parser.d.ts +10 -0
  809. package/dist/reporting/log-parser.js +281 -0
  810. package/dist/reporting/metrics.d.ts +15 -0
  811. package/dist/reporting/metrics.js +202 -0
  812. package/dist/reporting/report-formatter.d.ts +5 -0
  813. package/dist/reporting/report-formatter.js +146 -0
  814. package/dist/reporting/types.d.ts +102 -0
  815. package/dist/reporting/types.js +1 -0
  816. package/dist/scripts/activate-kernel-pipeline.d.ts +7 -0
  817. package/dist/scripts/activate-kernel-pipeline.js +101 -0
  818. package/dist/scripts/integration.d.ts +36 -0
  819. package/dist/scripts/integration.js +233 -0
  820. package/dist/scripts/pre-command +26 -0
  821. package/dist/scripts/pre-command.mjs +358 -0
  822. package/dist/security/comprehensive-security-audit.d.ts +157 -0
  823. package/dist/security/comprehensive-security-audit.js +1004 -0
  824. package/dist/security/index.d.ts +13 -0
  825. package/dist/security/index.js +13 -0
  826. package/dist/security/prompt-security-validator.d.ts +44 -0
  827. package/dist/security/prompt-security-validator.js +148 -0
  828. package/dist/security/security-agent-coordinator.d.ts +71 -0
  829. package/dist/security/security-agent-coordinator.js +203 -0
  830. package/dist/security/security-auditor.d.ts +55 -0
  831. package/dist/security/security-auditor.js +583 -0
  832. package/dist/security/security-hardener.d.ts +61 -0
  833. package/dist/security/security-hardener.js +169 -0
  834. package/dist/security/security-hardening-system.d.ts +238 -0
  835. package/dist/security/security-hardening-system.js +726 -0
  836. package/dist/security/security-headers.d.ts +63 -0
  837. package/dist/security/security-headers.js +117 -0
  838. package/dist/security/security-orchestration-layer.d.ts +118 -0
  839. package/dist/security/security-orchestration-layer.js +495 -0
  840. package/dist/security/security-scanner.d.ts +119 -0
  841. package/dist/security/security-scanner.js +429 -0
  842. package/dist/services/inference-tuner.d.ts +76 -0
  843. package/dist/services/inference-tuner.js +300 -0
  844. package/dist/session/index.d.ts +3 -0
  845. package/dist/session/index.js +3 -0
  846. package/dist/session/session-cleanup-manager.d.ts +117 -0
  847. package/dist/session/session-cleanup-manager.js +365 -0
  848. package/dist/session/session-monitor.d.ts +132 -0
  849. package/dist/session/session-monitor.js +502 -0
  850. package/dist/session/session-state-manager.d.ts +144 -0
  851. package/dist/session/session-state-manager.js +521 -0
  852. package/dist/skills/api-design/SKILL.md +37 -0
  853. package/dist/skills/architect-tools/SKILL.md +37 -0
  854. package/dist/skills/architecture-patterns/SKILL.md +37 -0
  855. package/dist/skills/auto-format/SKILL.md +37 -0
  856. package/dist/skills/backend-engineer/SKILL.md +49 -0
  857. package/dist/skills/boot-orchestrator/SKILL.md +33 -0
  858. package/dist/skills/bug-triage/SKILL.md +43 -0
  859. package/dist/skills/code-analyzer/SKILL.md +45 -0
  860. package/dist/skills/code-review/SKILL.md +52 -0
  861. package/dist/skills/content-creator/SKILL.md +38 -0
  862. package/dist/skills/database-engineer/SKILL.md +46 -0
  863. package/dist/skills/devops-engineer/SKILL.md +49 -0
  864. package/dist/skills/enforcer/SKILL.md +37 -0
  865. package/dist/skills/framework-compliance-audit/SKILL.md +37 -0
  866. package/dist/skills/frontend-engineer/SKILL.md +49 -0
  867. package/dist/skills/frontend-ui-ux-engineer/SKILL.md +41 -0
  868. package/dist/skills/git-workflow/SKILL.md +37 -0
  869. package/dist/skills/growth-strategist/SKILL.md +48 -0
  870. package/dist/skills/hermes-agent/SKILL.md +212 -0
  871. package/dist/skills/inference-improve/SKILL.md +97 -0
  872. package/dist/skills/lint/SKILL.md +37 -0
  873. package/dist/skills/log-monitor/SKILL.md +44 -0
  874. package/dist/skills/mobile-developer/SKILL.md +42 -0
  875. package/dist/skills/model-health-check/SKILL.md +37 -0
  876. package/dist/skills/multimodal-looker/SKILL.md +45 -0
  877. package/dist/skills/orchestrator/SKILL.md +61 -0
  878. package/dist/skills/performance-analysis/SKILL.md +37 -0
  879. package/dist/skills/performance-engineer/SKILL.md +41 -0
  880. package/dist/skills/performance-optimization/SKILL.md +37 -0
  881. package/dist/skills/processor-pipeline/SKILL.md +37 -0
  882. package/dist/skills/project-analysis/SKILL.md +42 -0
  883. package/dist/skills/refactoring-strategies/SKILL.md +37 -0
  884. package/dist/skills/registry.json +65 -0
  885. package/dist/skills/researcher/SKILL.md +50 -0
  886. package/dist/skills/security-audit/SKILL.md +48 -0
  887. package/dist/skills/security-scan/SKILL.md +37 -0
  888. package/dist/skills/seo-consultant/SKILL.md +43 -0
  889. package/dist/skills/session-management/SKILL.md +36 -0
  890. package/dist/skills/state-manager/SKILL.md +37 -0
  891. package/dist/skills/storyteller/SKILL.md +130 -0
  892. package/dist/skills/strategist/SKILL.md +44 -0
  893. package/dist/skills/tech-writer/SKILL.md +37 -0
  894. package/dist/skills/testing-best-practices/SKILL.md +37 -0
  895. package/dist/skills/testing-strategy/SKILL.md +54 -0
  896. package/dist/skills/ui-ux-design/SKILL.md +603 -0
  897. package/dist/skills/xray-orchestrator/SKILL.md +141 -0
  898. package/dist/skills/xray-orchestrator/index.d.ts +12 -0
  899. package/dist/skills/xray-orchestrator/index.js +223 -0
  900. package/dist/state/context-providers.d.ts +4 -0
  901. package/dist/state/context-providers.js +1 -0
  902. package/dist/state/index.d.ts +4 -0
  903. package/dist/state/index.js +7 -0
  904. package/dist/state/state-manager.d.ts +41 -0
  905. package/dist/state/state-manager.js +207 -0
  906. package/dist/state/state-types.d.ts +5 -0
  907. package/dist/state/state-types.js +1 -0
  908. package/dist/testing/memory-regression-suite.d.ts +105 -0
  909. package/dist/testing/memory-regression-suite.js +258 -0
  910. package/dist/tools/assess-complexity-tool.d.ts +28 -0
  911. package/dist/tools/assess-complexity-tool.js +44 -0
  912. package/dist/tools/query-routing-tool.d.ts +17 -0
  913. package/dist/tools/query-routing-tool.js +59 -0
  914. package/dist/types/metamorphosis.d.ts +21 -0
  915. package/dist/types/metamorphosis.js +6 -0
  916. package/dist/utils/batch-operations.d.ts +25 -0
  917. package/dist/utils/batch-operations.js +292 -0
  918. package/dist/utils/codex-parser.d.ts +60 -0
  919. package/dist/utils/codex-parser.js +444 -0
  920. package/dist/utils/command-runner.d.ts +32 -0
  921. package/dist/utils/command-runner.js +96 -0
  922. package/dist/utils/import-resolver.d.ts +54 -0
  923. package/dist/utils/import-resolver.js +189 -0
  924. package/dist/utils/language-detector.d.ts +43 -0
  925. package/dist/utils/language-detector.js +382 -0
  926. package/dist/utils/path-resolver.d.ts +48 -0
  927. package/dist/utils/path-resolver.js +112 -0
  928. package/dist/utils/shutdown-handler.d.ts +26 -0
  929. package/dist/utils/shutdown-handler.js +74 -0
  930. package/dist/utils/task-graph.d.ts +29 -0
  931. package/dist/utils/task-graph.js +106 -0
  932. package/dist/utils/test-template-generator.d.ts +25 -0
  933. package/dist/utils/test-template-generator.js +178 -0
  934. package/dist/utils/token-manager.d.ts +48 -0
  935. package/dist/utils/token-manager.js +163 -0
  936. package/dist/validation/agent-config-validator.d.ts +110 -0
  937. package/dist/validation/agent-config-validator.js +280 -0
  938. package/dist/validation/estimation-validator.d.ts +61 -0
  939. package/dist/validation/estimation-validator.js +241 -0
  940. package/dist/validation/orchestration-flow-validator.d.ts +87 -0
  941. package/dist/validation/orchestration-flow-validator.js +606 -0
  942. package/dist/validation/report-content-validator.d.ts +42 -0
  943. package/dist/validation/report-content-validator.js +218 -0
  944. package/llms.txt +5 -3
  945. package/package.json +4 -2
  946. package/scripts/foundry/CHANGELOG.md +34 -0
  947. package/scripts/foundry/README.md +12 -0
  948. package/scripts/foundry/assert-packed-dist-cli.mjs +97 -0
  949. package/scripts/foundry/blip-render.cjs +1237 -0
  950. package/scripts/foundry/blip-rippel.cjs +1963 -0
  951. package/scripts/foundry/blip.mjs +109 -0
  952. package/scripts/foundry/cli.mjs +8 -4
  953. package/scripts/foundry/inspect.mjs +117 -7
  954. package/scripts/foundry/mint-suit.cjs +215 -14
  955. package/scripts/foundry/package.json +6 -0
  956. package/scripts/foundry/plant/agents/blip-inspect.yml +5 -0
  957. package/scripts/foundry/plant/agents/blip.yml +5 -0
  958. package/scripts/foundry/plant/agents/sound-inspect.yml +5 -0
  959. package/scripts/foundry/plant/agents/sound.yml +5 -0
  960. package/scripts/foundry/plant/motions/MOTION-REGISTRY.md +35 -0
  961. package/scripts/foundry/plant/motions/registry.json +81 -0
  962. package/scripts/foundry/plant/skills/blip/SKILL.md +39 -0
  963. package/scripts/foundry/plant/skills/blip-inspect/SKILL.md +32 -0
  964. package/scripts/foundry/plant/skills/inspect/SKILL.md +2 -2
  965. package/scripts/foundry/plant/skills/sound/SKILL.md +29 -0
  966. package/scripts/foundry/plant/skills/sound-inspect/SKILL.md +28 -0
  967. package/scripts/foundry/release-gate.mjs +18 -10
  968. package/scripts/foundry/release.mjs +3 -0
  969. package/scripts/foundry/sound-bed.cjs +454 -0
  970. package/scripts/foundry/sound-rippel.cjs +1434 -0
  971. package/scripts/foundry/sound.mjs +93 -0
  972. package/scripts/node/assert-packed-dist-cli.mjs +4 -0
  973. package/scripts/node/consumer-install-smoke.mjs +20 -1
  974. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  975. package/xray/features.json +1 -1
  976. package/xray/features.schema.json +1 -1
@@ -0,0 +1,1434 @@
1
+ /**
2
+ * Sound mill renderer — Rippel prototype as lineage, crystal-clear modern mix as the bar.
3
+ *
4
+ * SSOT (htafolla/rippel-synapse-flow@e5014cd):
5
+ * professionalTechnoInstruments.ts
6
+ * professionalPhonkInstruments.ts
7
+ * professionalJazzInstruments.ts (synthetic drums / sax fallback)
8
+ * professionalAmbientInstruments.ts (pad / keys envelopes)
9
+ * ProfessionalOrchestrator.ts (intro → body → outro)
10
+ * globalAudioManager.ts ProfessionalMixer
11
+ * getGenreConfig.ts / checksumService.ts (tempo tables)
12
+ *
13
+ * Tone.Offline is blocked in Node (no OfflineAudioContext). This is a lean headless
14
+ * port of those chains, then mixed like a mill — not the Lovable volume-hack soup,
15
+ * not the #62 three-sine bed.
16
+ *
17
+ * 4.44s is a Short, not a loop tile: hook → turn → tag on the motion grid.
18
+ */
19
+
20
+ const TONE_OFFLINE_BLOCKER =
21
+ "Tone.Offline blocked in Node: Missing the native OfflineAudioContext constructor. Lean Node port of MembraneSynth / MetalSynth / mixer topology.";
22
+
23
+ const ENGINE = "rippel-headless";
24
+ const MIX = "crystal";
25
+ const TOPOLOGY = "membrane+metal+mixer";
26
+ const SSOT = {
27
+ repo: "htafolla/rippel-synapse-flow",
28
+ commit: "e5014cd46fbe5f132391333d8296f4416896dbee",
29
+ };
30
+
31
+ /** Desktop (not mobile) construction numbers from the prototype. */
32
+ const RIPPEL = {
33
+ technoKick: {
34
+ pitchDecay: 0.08,
35
+ octaves: 10,
36
+ attack: 0.005,
37
+ decay: 0.5,
38
+ release: 0.8,
39
+ eq: { low: 6, mid: -2, high: -8 },
40
+ dist: 0.2,
41
+ comp: { thresholdDb: -20, ratio: 10 },
42
+ volDb: -6,
43
+ noteHz: 65.406, // C2 — generate-sequence kick
44
+ },
45
+ technoSnare: {
46
+ pitchDecay: 0.05,
47
+ octaves: 10,
48
+ attack: 0.005,
49
+ decay: 0.1,
50
+ release: 0.1,
51
+ bandpass: 4000,
52
+ dist: 0.8,
53
+ comp: { thresholdDb: -24, ratio: 6 },
54
+ volDb: -8,
55
+ },
56
+ technoHat: {
57
+ harmonicity: 5.1,
58
+ modulationIndex: 32,
59
+ resonance: 4000,
60
+ octaves: 1.5,
61
+ attack: 0.001,
62
+ decay: 0.05,
63
+ release: 0.02,
64
+ hp: 12000,
65
+ comp: { thresholdDb: -30, ratio: 4 },
66
+ volDb: -8,
67
+ },
68
+ technoBass: {
69
+ harmonicity: 1.005,
70
+ vibratoAmount: 0.1,
71
+ vibratoRate: 2,
72
+ attack: 0.01,
73
+ decay: 0.25,
74
+ sustain: 0.4,
75
+ release: 1.2,
76
+ lp: 250,
77
+ dist: 0.4,
78
+ eq: { low: 3, mid: -2, high: -6 },
79
+ comp: { thresholdDb: -24, ratio: 8 },
80
+ volDb: -8,
81
+ },
82
+ phonk808: {
83
+ pitchDecay: 0.12,
84
+ octaves: 16,
85
+ attack: 0.001,
86
+ decay: 1.2,
87
+ release: 2.0,
88
+ dist: 0.15,
89
+ eq: { low: 2, mid: -2, high: -8 },
90
+ hp: 30,
91
+ lp: 8000,
92
+ comp: { thresholdDb: -10, ratio: 4, attack: 0.003, release: 0.12 },
93
+ volDb: -3,
94
+ noteHz: 32.703, // C1
95
+ },
96
+ phonkCowbell: {
97
+ harmonicity: 5.1,
98
+ modulationIndex: 32,
99
+ resonance: 4000,
100
+ octaves: 1.5,
101
+ attack: 0.001,
102
+ decay: 0.15,
103
+ release: 0.3,
104
+ dist: 0.15,
105
+ eq: { high: 2, mid: 2, low: -10 },
106
+ lp: 8000,
107
+ volDb: -12,
108
+ },
109
+ phonkReese: {
110
+ attack: 0.01,
111
+ decay: 0.6,
112
+ sustain: 0.8,
113
+ release: 1.2,
114
+ dist: 0.2,
115
+ lp: 200,
116
+ lpQ: 1.5,
117
+ eq: { high: -8, mid: -2, low: 2 },
118
+ volDb: -6,
119
+ },
120
+ jazzKick: {
121
+ pitchDecay: 0.03,
122
+ octaves: 6,
123
+ attack: 0.001,
124
+ decay: 0.2,
125
+ release: 0.8,
126
+ volDb: -7,
127
+ },
128
+ jazzRide: {
129
+ harmonicity: 3.1,
130
+ modulationIndex: 16,
131
+ resonance: 2000,
132
+ octaves: 0.8,
133
+ attack: 0.001,
134
+ decay: 0.3,
135
+ release: 0.2,
136
+ },
137
+ jazzBrush: { attack: 0.001, decay: 0.15, release: 0.05 },
138
+ jazzSax: {
139
+ attack: 0.08,
140
+ decay: 0.2,
141
+ sustain: 0.7,
142
+ release: 0.6,
143
+ bp: 800,
144
+ bpQ: 1.2,
145
+ eq: { high: -2, mid: 4, low: -3 },
146
+ },
147
+ ambientPad: {
148
+ attack: 0.55, // 3.0s in the app; shortened so a 4s bed still has a body
149
+ decay: 1.2,
150
+ sustain: 0.85,
151
+ release: 1.6,
152
+ lp: 1200,
153
+ eq: { high: -8, mid: 3, low: 4 },
154
+ volDb: -5,
155
+ },
156
+ mixer: {
157
+ masterVolume: 0.7,
158
+ masterCompDb: -12,
159
+ masterEq: { high: 1.2, mid: 0, low: 0.8 },
160
+ limiterDb: -0.1,
161
+ },
162
+ };
163
+
164
+ /**
165
+ * Prototype stacked limiters + 0.8 snare grit. The mill keeps the topology and
166
+ * tightens the mix: rumble HP, mud cut, milder saturation, sidechain, one limiter.
167
+ */
168
+ const CRYSTAL = {
169
+ kickFloorHz: 28,
170
+ eightOhEightFloorHz: 24,
171
+ mudHz: 320,
172
+ mudDb: -3.5,
173
+ distScale: 0.55,
174
+ hatAirHz: 9000,
175
+ sidechain: 0.55,
176
+ peakTarget: 0.82,
177
+ };
178
+
179
+ const GENRE_ALIASES = {
180
+ ambient: "ambient",
181
+ techno: "techno",
182
+ jazz: "jazz",
183
+ phonk: "phonk",
184
+ destination: "ambient",
185
+ };
186
+
187
+ const TEMPO_TABLES = {
188
+ ambient: [70, 80, 90],
189
+ techno: [120, 128, 140],
190
+ jazz: [100, 110, 120],
191
+ phonk: [130, 140, 150],
192
+ };
193
+
194
+ const GENRES = {
195
+ ambient: {
196
+ bpm: 90,
197
+ voices: ["triangle-pad", "rhodes-keys", "membrane-sub", "metal-air", "mixer"],
198
+ },
199
+ techno: {
200
+ bpm: 128,
201
+ voices: ["membrane-kick", "metal-hat", "snare-clap", "duo-bass", "mixer"],
202
+ },
203
+ phonk: {
204
+ bpm: 150,
205
+ voices: ["membrane-808", "metal-hat", "metal-cowbell", "reese-bass", "mixer"],
206
+ },
207
+ jazz: {
208
+ bpm: 120,
209
+ voices: ["membrane-kick", "metal-ride", "brush-snare", "upright-bass", "sax-lead", "mixer"],
210
+ },
211
+ };
212
+
213
+ const SCALES = {
214
+ ambient: [261.63, 311.13, 349.23, 392.0, 466.16],
215
+ techno: [65.41, 87.31, 130.81, 174.61, 196.0],
216
+ phonk: [32.7, 43.65, 55.0, 65.41, 82.41],
217
+ jazz: [130.81, 164.81, 196.0, 220.0, 261.63],
218
+ };
219
+
220
+ function dbLin(db) {
221
+ return Math.pow(10, db / 20);
222
+ }
223
+
224
+ function resolveGenre(name) {
225
+ const raw = String(name || "ambient")
226
+ .trim()
227
+ .toLowerCase();
228
+ const id = GENRE_ALIASES[raw] || (GENRES[raw] ? raw : "ambient");
229
+ const spec = GENRES[id];
230
+ return { id, alias: raw !== id ? raw : null, bpm: spec.bpm, voices: [...spec.voices] };
231
+ }
232
+
233
+ function tempoFromSeed(genreId, seedHex) {
234
+ const table = TEMPO_TABLES[genreId] || TEMPO_TABLES.ambient;
235
+ const hex = String(seedHex || "").replace(/^0x/, "");
236
+ const n = Number.parseInt(hex.slice(8, 16) || hex.slice(0, 8) || "1", 16);
237
+ const idx = Number.isFinite(n) ? n % table.length : 0;
238
+ return table[idx];
239
+ }
240
+
241
+ /** Shared motion/audio grid. phase0=0 so t=0 is downbeat for both LFOs and the bed. */
242
+ function motionGrid(seedHex, genre) {
243
+ const g = resolveGenre(genre);
244
+ const bpm = tempoFromSeed(g.id, seedHex);
245
+ return {
246
+ genre: g.id,
247
+ bpm,
248
+ beatSec: 60 / bpm,
249
+ phase0: 0,
250
+ downbeat: 0,
251
+ e: 0.25,
252
+ and: 0.5,
253
+ a: 0.75,
254
+ syncopate: true,
255
+ };
256
+ }
257
+
258
+ function ease01(a, b, x) {
259
+ if (b <= a) return x >= b ? 1 : 0;
260
+ const t = x < a ? 0 : x > b ? 1 : (x - a) / (b - a);
261
+ return t * t * (3 - 2 * t);
262
+ }
263
+
264
+ /**
265
+ * 4.44s entertainment spine — YouTube-short form, not a pasted bar.
266
+ * hook (beats 0–2) → turn (2 → last ~1.1) → tag. Hits are one-shots, not strobe.
267
+ * hookEase/turnEase/tagEase are continuous weights (crossfade). Binary hook/turn/tag stay section flags.
268
+ */
269
+ function shortformPhrase(t, seconds, grid) {
270
+ const dur = seconds > 0 ? seconds : 4.44;
271
+ const beatSec = (grid && grid.beatSec) || 60 / 90;
272
+ const beats = t / beatSec;
273
+ const total = dur / beatSec;
274
+ const hookEnd = 2;
275
+ const tagLen = Math.min(1.25, Math.max(0.85, total * 0.2));
276
+ const tagStart = Math.max(hookEnd + 1.6, total - tagLen);
277
+ let section = "tag";
278
+ if (beats < hookEnd) section = "hook";
279
+ else if (beats < tagStart) section = "turn";
280
+ function near(at) {
281
+ const d = Math.abs(beats - at);
282
+ return d < 0.14 ? 1 - d / 0.14 : 0;
283
+ }
284
+ const fade = 0.28;
285
+ const hookEase = 1 - ease01(hookEnd - fade, hookEnd + fade, beats);
286
+ const tagEase = ease01(tagStart - fade, tagStart + fade, beats);
287
+ const turnEase = Math.max(0, 1 - hookEase - tagEase);
288
+ return {
289
+ section,
290
+ beats,
291
+ total,
292
+ hook: section === "hook" ? 1 : 0,
293
+ turn: section === "turn" ? 1 : 0,
294
+ tag: section === "tag" ? 1 : 0,
295
+ hookEase,
296
+ turnEase,
297
+ tagEase,
298
+ turnHit: near(hookEnd),
299
+ tagHit: near(tagStart),
300
+ hookEndBeats: hookEnd,
301
+ tagStartBeats: tagStart,
302
+ };
303
+ }
304
+
305
+ function padTones(genreId, scale) {
306
+ const s = scale || SCALES[genreId] || SCALES.ambient;
307
+ if (genreId === "ambient") return [s[0] * 0.75, s[0], s[1], s[3]];
308
+ if (genreId === "jazz") return [s[0], s[2], s[3], s[0] * 2];
309
+ if (genreId === "phonk") return [s[0], s[0] * 1.5, s[3]];
310
+ return [s[0], s[2], s[3]];
311
+ }
312
+
313
+ function degreeLine(kind, count) {
314
+ if (kind === "bass") {
315
+ const cell = [0, 0, 3, 4];
316
+ return Array.from({ length: count }, (_, i) => cell[i % cell.length]);
317
+ }
318
+ if (kind === "rhodes") {
319
+ const cell = [0, 2, 4, 4, 2, 0];
320
+ return Array.from({ length: count }, (_, i) => cell[i % cell.length]);
321
+ }
322
+ const cell = [0, 0, 2, 3];
323
+ return Array.from({ length: count }, (_, i) => cell[i % cell.length]);
324
+ }
325
+
326
+ function walkDegree(last, len, rng) {
327
+ const dir = rng() < 0.5 ? -1 : 1;
328
+ const next = last + dir;
329
+ if (next < 0) return 0;
330
+ if (next >= len) return len - 1;
331
+ return next;
332
+ }
333
+
334
+ function gridTime(grid, beats) {
335
+ return (grid.phase0 || 0) + beats * grid.beatSec;
336
+ }
337
+
338
+ function mixInto(dest, src, start, gain) {
339
+ const offset = Math.max(0, start | 0);
340
+ const g = gain || 1;
341
+ for (let i = 0; i < src.length; i++) {
342
+ const j = offset + i;
343
+ if (j >= dest.length) break;
344
+ dest[j] += src[i] * g;
345
+ }
346
+ }
347
+
348
+ function expDecay(t, decay) {
349
+ if (decay <= 0) return t <= 0 ? 1 : 0;
350
+ if (t < 0) return 0;
351
+ return Math.exp((-5 * t) / decay);
352
+ }
353
+
354
+ function attackGain(t, attack) {
355
+ if (attack <= 0) return 1;
356
+ if (t >= attack) return 1;
357
+ if (t <= 0) return 0;
358
+ const x = t / attack;
359
+ return x * x;
360
+ }
361
+
362
+ function adsr(t, attack, decay, sustain, release, hold) {
363
+ const held = hold == null ? 0 : hold;
364
+ if (t < 0) return 0;
365
+ if (t < attack) return attackGain(t, attack);
366
+ if (t < attack + decay) {
367
+ const u = (t - attack) / Math.max(decay, 1e-6);
368
+ return 1 - (1 - sustain) * u;
369
+ }
370
+ if (t < attack + decay + held) return sustain;
371
+ const relT = t - attack - decay - held;
372
+ if (relT >= release) return 0;
373
+ return sustain * expDecay(relT, release);
374
+ }
375
+
376
+ function oneshotAmp(t, attack, decay) {
377
+ return attackGain(t, attack) * expDecay(Math.max(0, t - attack), decay);
378
+ }
379
+
380
+ function saw(phase) {
381
+ return 2 * ((phase / (2 * Math.PI)) % 1) - 1;
382
+ }
383
+
384
+ function triangle(phase) {
385
+ const p = ((phase / (2 * Math.PI)) % 1 + 1) % 1;
386
+ return p < 0.5 ? 4 * p - 1 : 3 - 4 * p;
387
+ }
388
+
389
+ function square(phase) {
390
+ return Math.sin(phase) >= 0 ? 1 : -1;
391
+ }
392
+
393
+ function polyBlep(t, dt) {
394
+ if (dt <= 0) return 0;
395
+ if (t < dt) {
396
+ const x = t / dt;
397
+ return x + x - x * x - 1;
398
+ }
399
+ if (t > 1 - dt) {
400
+ const x = (t - 1) / dt;
401
+ return x * x + x + x + 1;
402
+ }
403
+ return 0;
404
+ }
405
+
406
+ function sawBlep(phase, inc) {
407
+ const t = ((phase / (2 * Math.PI)) % 1 + 1) % 1;
408
+ const dt = Math.abs(inc) / (2 * Math.PI);
409
+ return 2 * t - 1 - polyBlep(t, dt);
410
+ }
411
+
412
+ function squareBlep(phase, inc) {
413
+ const t = ((phase / (2 * Math.PI)) % 1 + 1) % 1;
414
+ const dt = Math.abs(inc) / (2 * Math.PI);
415
+ const s = t < 0.5 ? 1 : -1;
416
+ return s + polyBlep(t, dt) - polyBlep((t + 0.5) % 1, dt);
417
+ }
418
+
419
+ function noiseLcg(seed) {
420
+ let s = (seed >>> 0) || 1;
421
+ return function next() {
422
+ s = (Math.imul(s, 1664525) + 1013904223) >>> 0;
423
+ return s / 4294967296;
424
+ };
425
+ }
426
+
427
+ function biquadCoeffs(kind, freq, q, sampleRate, gainDb) {
428
+ const f = Math.max(20, Math.min((sampleRate || 44100) * 0.45, freq || 1000));
429
+ const sr = sampleRate || 44100;
430
+ const w0 = (2 * Math.PI * f) / sr;
431
+ const cos = Math.cos(w0);
432
+ const sin = Math.sin(w0);
433
+ const qq = Math.max(0.2, q || 0.707);
434
+ const alpha = sin / (2 * qq);
435
+ const a = Math.pow(10, (gainDb || 0) / 40);
436
+ let b0 = 1;
437
+ let b1 = 0;
438
+ let b2 = 0;
439
+ let a0 = 1;
440
+ let a1 = 0;
441
+ let a2 = 0;
442
+ if (kind === "highpass") {
443
+ b0 = (1 + cos) / 2;
444
+ b1 = -(1 + cos);
445
+ b2 = (1 + cos) / 2;
446
+ a0 = 1 + alpha;
447
+ a1 = -2 * cos;
448
+ a2 = 1 - alpha;
449
+ } else if (kind === "bandpass") {
450
+ b0 = alpha;
451
+ b1 = 0;
452
+ b2 = -alpha;
453
+ a0 = 1 + alpha;
454
+ a1 = -2 * cos;
455
+ a2 = 1 - alpha;
456
+ } else if (kind === "peaking") {
457
+ b0 = 1 + alpha * a;
458
+ b1 = -2 * cos;
459
+ b2 = 1 - alpha * a;
460
+ a0 = 1 + alpha / a;
461
+ a1 = -2 * cos;
462
+ a2 = 1 - alpha / a;
463
+ } else {
464
+ b0 = (1 - cos) / 2;
465
+ b1 = 1 - cos;
466
+ b2 = (1 - cos) / 2;
467
+ a0 = 1 + alpha;
468
+ a1 = -2 * cos;
469
+ a2 = 1 - alpha;
470
+ }
471
+ return { b0: b0 / a0, b1: b1 / a0, b2: b2 / a0, a1: a1 / a0, a2: a2 / a0 };
472
+ }
473
+
474
+ function biquad(kind, freq, q, sampleRate, gainDb) {
475
+ const c = biquadCoeffs(kind, freq, q, sampleRate, gainDb);
476
+ let x1 = 0;
477
+ let x2 = 0;
478
+ let y1 = 0;
479
+ let y2 = 0;
480
+ return {
481
+ step(x) {
482
+ const y = c.b0 * x + c.b1 * x1 + c.b2 * x2 - c.a1 * y1 - c.a2 * y2;
483
+ x2 = x1;
484
+ x1 = x;
485
+ y2 = y1;
486
+ y1 = y;
487
+ return y;
488
+ },
489
+ };
490
+ }
491
+
492
+ function highpass(cutoff, sampleRate) {
493
+ const rc = 1 / (2 * Math.PI * Math.max(40, cutoff));
494
+ const dt = 1 / sampleRate;
495
+ const a = rc / (rc + dt);
496
+ let prevX = 0;
497
+ let prevY = 0;
498
+ return {
499
+ step(x) {
500
+ const y = a * (prevY + x - prevX);
501
+ prevX = x;
502
+ prevY = y;
503
+ return y;
504
+ },
505
+ };
506
+ }
507
+
508
+ function lowpass(cutoff, sampleRate) {
509
+ const rc = 1 / (2 * Math.PI * Math.max(20, cutoff));
510
+ const dt = 1 / sampleRate;
511
+ const a = dt / (rc + dt);
512
+ let y = 0;
513
+ return {
514
+ step(x) {
515
+ y += a * (x - y);
516
+ return y;
517
+ },
518
+ };
519
+ }
520
+
521
+ function bandpass(cutoff, sampleRate) {
522
+ const hp = highpass(cutoff * 0.7, sampleRate);
523
+ const lp = lowpass(cutoff * 1.4, sampleRate);
524
+ return {
525
+ step(x) {
526
+ return lp.step(hp.step(x));
527
+ },
528
+ };
529
+ }
530
+
531
+ function makeEq3(sampleRate) {
532
+ const lp = lowpass(250, sampleRate);
533
+ const hp = highpass(2500, sampleRate);
534
+ return {
535
+ step(x, lowDb, midDb, highDb) {
536
+ const l = lp.step(x);
537
+ const h = hp.step(x);
538
+ const m = x - l - h;
539
+ return l * dbLin(lowDb) + m * dbLin(midDb) + h * dbLin(highDb);
540
+ },
541
+ };
542
+ }
543
+
544
+ function distort(x, amount) {
545
+ const a = Math.max(0, amount) * CRYSTAL.distScale;
546
+ if (a <= 0.001) return x;
547
+ const k = 1 + a * 12;
548
+ return Math.tanh(x * k) / Math.tanh(k);
549
+ }
550
+
551
+ function compress(samples, threshold, ratio, sampleRate, attackSec, releaseSec) {
552
+ const out = new Float64Array(samples.length);
553
+ let env = 0;
554
+ const atk = 1 - Math.exp(-1 / (Math.max(0.0008, attackSec || 0.004) * sampleRate));
555
+ const rel = 1 - Math.exp(-1 / (Math.max(0.02, releaseSec || 0.12) * sampleRate));
556
+ for (let i = 0; i < samples.length; i++) {
557
+ const x = Math.abs(samples[i]);
558
+ env += (x > env ? atk : rel) * (x - env);
559
+ const gain = env > threshold ? threshold / env + (1 - threshold / env) / ratio : 1;
560
+ out[i] = samples[i] * gain;
561
+ }
562
+ return out;
563
+ }
564
+
565
+ function limiter(samples, ceiling) {
566
+ const out = new Float64Array(samples.length);
567
+ const cap = Math.max(0.2, ceiling);
568
+ for (let i = 0; i < samples.length; i++) {
569
+ const x = samples[i];
570
+ const a = Math.abs(x);
571
+ out[i] = a > cap ? Math.sign(x) * (cap + (a - cap) / (1 + (a - cap) * 8)) : x;
572
+ }
573
+ return out;
574
+ }
575
+
576
+ function normalize(samples, peakTarget) {
577
+ let peak = 0;
578
+ for (let i = 0; i < samples.length; i++) {
579
+ const a = Math.abs(samples[i]);
580
+ if (a > peak) peak = a;
581
+ }
582
+ const scale = peak > 0 ? peakTarget / peak : 0;
583
+ const out = new Float64Array(samples.length);
584
+ for (let i = 0; i < samples.length; i++) out[i] = samples[i] * scale;
585
+ return out;
586
+ }
587
+
588
+ function envelopeFollow(samples, sampleRate, attack, release) {
589
+ const out = new Float64Array(samples.length);
590
+ let env = 0;
591
+ const atk = 1 - Math.exp(-1 / (attack * sampleRate));
592
+ const rel = 1 - Math.exp(-1 / (release * sampleRate));
593
+ for (let i = 0; i < samples.length; i++) {
594
+ const x = Math.abs(samples[i]);
595
+ env += (x > env ? atk : rel) * (x - env);
596
+ out[i] = env;
597
+ }
598
+ return out;
599
+ }
600
+
601
+ function applyBus(samples, sampleRate, { hp, lp, eq, dist, comp, volDb }) {
602
+ const hpF = hp ? highpass(hp, sampleRate) : null;
603
+ const lpF = lp ? lowpass(lp, sampleRate) : null;
604
+ const mud = highpass(CRYSTAL.mudHz, sampleRate);
605
+ const eq3 = eq ? makeEq3(sampleRate) : null;
606
+ const out = new Float64Array(samples.length);
607
+ const mudKeep = dbLin(CRYSTAL.mudDb);
608
+ for (let i = 0; i < samples.length; i++) {
609
+ let x = samples[i];
610
+ if (hpF) x = hpF.step(x);
611
+ if (lpF) x = lpF.step(x);
612
+ const air = mud.step(x);
613
+ x = x * (1 - 0.28) + air * (0.28 + (1 - mudKeep) * 0.15);
614
+ if (eq3 && eq) x = eq3.step(x, eq.low || 0, eq.mid || 0, eq.high || 0);
615
+ if (dist) x = distort(x, dist);
616
+ out[i] = x * dbLin(volDb || 0);
617
+ }
618
+ if (comp) {
619
+ return compress(
620
+ out,
621
+ dbLin(comp.thresholdDb),
622
+ comp.ratio,
623
+ sampleRate,
624
+ comp.attack,
625
+ comp.release,
626
+ );
627
+ }
628
+ return out;
629
+ }
630
+
631
+ /** Tone MembraneSynth: sine + exponential pitch drop, floored so it does not become DC. */
632
+ function renderMembrane({
633
+ sampleRate,
634
+ freq,
635
+ octaves,
636
+ pitchDecay,
637
+ attack,
638
+ decay,
639
+ release,
640
+ velocity,
641
+ floorHz,
642
+ shape,
643
+ }) {
644
+ const rel = release || 0.12;
645
+ const dur = attack + decay + rel;
646
+ const n = Math.floor(dur * sampleRate);
647
+ const out = new Float64Array(n);
648
+ const floor = floorHz || CRYSTAL.kickFloorHz;
649
+ const endFreq = Math.max(floor, freq * Math.pow(2, -octaves));
650
+ let phase = 0;
651
+ for (let i = 0; i < n; i++) {
652
+ const t = i / sampleRate;
653
+ const f =
654
+ t < pitchDecay ? freq * Math.pow(endFreq / freq, t / Math.max(pitchDecay, 1e-6)) : endFreq;
655
+ const inc = (2 * Math.PI * f) / sampleRate;
656
+ const osc = shape === "square" ? squareBlep(phase, inc) : Math.sin(phase);
657
+ const harm =
658
+ shape === "square" ? 0 : Math.sin(phase * 2) * Math.max(0, 1 - t / Math.max(pitchDecay, 1e-6)) * 0.32;
659
+ out[i] = velocity * oneshotAmp(t, attack, decay + rel * 0.45) * (osc + harm);
660
+ phase += inc;
661
+ }
662
+ return out;
663
+ }
664
+
665
+ function kickClick(sampleRate, velocity) {
666
+ const n = Math.floor(0.007 * sampleRate);
667
+ const out = new Float64Array(n);
668
+ const hp = biquad("highpass", 1400, 0.7, sampleRate);
669
+ const noise = noiseLcg(0x51ed);
670
+ let phase = 0;
671
+ for (let i = 0; i < n; i++) {
672
+ const t = i / sampleRate;
673
+ const env = Math.exp(-t / 0.0022);
674
+ const click = 0.5 * Math.sin(phase) + 0.5 * (noise() * 2 - 1);
675
+ out[i] = velocity * env * hp.step(click);
676
+ phase += (2 * Math.PI * 2400) / sampleRate;
677
+ }
678
+ return out;
679
+ }
680
+
681
+ /**
682
+ * Tone MetalSynth: FM square/square + high resonance, short env.
683
+ */
684
+ function renderMetal({
685
+ sampleRate,
686
+ freq,
687
+ harmonicity,
688
+ modulationIndex,
689
+ resonance,
690
+ attack,
691
+ decay,
692
+ release,
693
+ velocity,
694
+ }) {
695
+ const rel = release || 0.02;
696
+ const dur = attack + decay + rel;
697
+ const n = Math.floor(dur * sampleRate);
698
+ const out = new Float64Array(n);
699
+ const hp = biquad("highpass", Math.max(800, resonance * 0.55), 0.7, sampleRate);
700
+ const bp = biquad("bandpass", Math.max(900, resonance), 5.2, sampleRate);
701
+ const noise = noiseLcg((freq * 100) | 0);
702
+ let carrierPhase = 0;
703
+ let modPhase = 0;
704
+ const modHz = freq * harmonicity;
705
+ for (let i = 0; i < n; i++) {
706
+ const t = i / sampleRate;
707
+ const mod = Math.sin(modPhase);
708
+ const carrier = Math.sin(carrierPhase + modulationIndex * 0.08 * mod);
709
+ const grit = noise() * 2 - 1;
710
+ const amp = velocity * oneshotAmp(t, attack, decay + rel);
711
+ out[i] = hp.step(bp.step(carrier * 0.74 + grit * 0.26) * amp);
712
+ carrierPhase += (2 * Math.PI * freq) / sampleRate;
713
+ modPhase += (2 * Math.PI * modHz) / sampleRate;
714
+ }
715
+ return out;
716
+ }
717
+
718
+ function renderDuoBass({ sampleRate, freq, velocity, hold }) {
719
+ const p = RIPPEL.technoBass;
720
+ const dur = p.attack + p.decay + (hold || 0.18) + p.release * 0.5;
721
+ const n = Math.floor(dur * sampleRate);
722
+ const out = new Float64Array(n);
723
+ const lp0 = biquad("lowpass", 420, 0.85, sampleRate);
724
+ const lp1 = biquad("lowpass", 140, 0.8, sampleRate);
725
+ const lpA = biquad("lowpass", p.lp, 1.1, sampleRate);
726
+ const lpB = biquad("lowpass", p.lp, 0.9, sampleRate);
727
+ let ph0 = 0;
728
+ let ph1 = 0;
729
+ for (let i = 0; i < n; i++) {
730
+ const t = i / sampleRate;
731
+ const env = adsr(t, p.attack, p.decay, p.sustain, p.release, hold || 0.12);
732
+ const vib = 1 + p.vibratoAmount * 0.15 * Math.sin(2 * Math.PI * p.vibratoRate * t);
733
+ const inc0 = (2 * Math.PI * freq * vib) / sampleRate;
734
+ const inc1 = (2 * Math.PI * freq * p.harmonicity * vib) / sampleRate;
735
+ const v0 = lp0.step(sawBlep(ph0, inc0));
736
+ const v1 = lp1.step(triangle(ph1));
737
+ out[i] = velocity * env * lpB.step(lpA.step(0.62 * v0 + 0.38 * v1));
738
+ ph0 += inc0;
739
+ ph1 += inc1;
740
+ }
741
+ return out;
742
+ }
743
+
744
+ function renderReese({ sampleRate, freq, velocity, hold }) {
745
+ const p = RIPPEL.phonkReese;
746
+ const dur = p.attack + p.decay + (hold || 0.25) + p.release * 0.4;
747
+ const n = Math.floor(dur * sampleRate);
748
+ const out = new Float64Array(n);
749
+ const lp = lowpass(p.lp, sampleRate);
750
+ let ph0 = 0;
751
+ let ph1 = 0;
752
+ for (let i = 0; i < n; i++) {
753
+ const t = i / sampleRate;
754
+ const env = adsr(t, p.attack, p.decay, p.sustain, p.release, hold || 0.2);
755
+ const mix = 0.5 * saw(ph0) + 0.5 * saw(ph1);
756
+ out[i] = velocity * env * lp.step(mix);
757
+ ph0 += (2 * Math.PI * freq) / sampleRate;
758
+ ph1 += (2 * Math.PI * freq * 1.01) / sampleRate;
759
+ }
760
+ return out;
761
+ }
762
+
763
+ function renderCowbell({ sampleRate, velocity }) {
764
+ const p = RIPPEL.phonkCowbell;
765
+ return renderMetal({
766
+ sampleRate,
767
+ freq: 845,
768
+ harmonicity: p.harmonicity,
769
+ modulationIndex: p.modulationIndex,
770
+ resonance: p.resonance,
771
+ attack: p.attack,
772
+ decay: p.decay,
773
+ release: p.release,
774
+ velocity,
775
+ });
776
+ }
777
+
778
+ function renderBrush({ sampleRate, velocity, rng }) {
779
+ const p = RIPPEL.jazzBrush;
780
+ const n = Math.floor((p.attack + p.decay + p.release + 0.04) * sampleRate);
781
+ const out = new Float64Array(n);
782
+ const hp = highpass(1800, sampleRate);
783
+ const lp = lowpass(6500, sampleRate);
784
+ for (let i = 0; i < n; i++) {
785
+ const t = i / sampleRate;
786
+ const noise = rng() * 2 - 1;
787
+ out[i] = lp.step(hp.step(velocity * oneshotAmp(t, p.attack, p.decay) * noise));
788
+ }
789
+ return out;
790
+ }
791
+
792
+ function renderSax({ sampleRate, freq, velocity, hold }) {
793
+ const p = RIPPEL.jazzSax;
794
+ const dur = p.attack + p.decay + (hold || 0.22) + p.release;
795
+ const n = Math.floor(dur * sampleRate);
796
+ const out = new Float64Array(n);
797
+ const bp = bandpass(p.bp, sampleRate);
798
+ const eq = makeEq3(sampleRate);
799
+ let phase = 0;
800
+ for (let i = 0; i < n; i++) {
801
+ const t = i / sampleRate;
802
+ const env = adsr(t, p.attack, p.decay, p.sustain, p.release, hold || 0.18);
803
+ const breath = (Math.sin(phase * 0.17) * 0.04 + 0.02) * (Math.sin(phase * 11.3) > 0 ? 1 : -1);
804
+ const tone = 0.82 * saw(phase) + 0.18 * triangle(phase * 2);
805
+ out[i] = eq.step(bp.step(velocity * env * (tone + breath)), p.eq.low, p.eq.mid, p.eq.high);
806
+ phase += (2 * Math.PI * freq) / sampleRate;
807
+ }
808
+ return out;
809
+ }
810
+
811
+ function renderRhodes({ sampleRate, freq, velocity }) {
812
+ const attack = 0.008;
813
+ const decay = 0.55;
814
+ const n = Math.floor(2.2 * sampleRate);
815
+ const out = new Float64Array(n);
816
+ const lp = biquad("lowpass", 2600, 0.8, sampleRate);
817
+ const hp = biquad("highpass", 220, 0.7, sampleRate);
818
+ const hammer = noiseLcg((freq * 17) | 0);
819
+ const tine = biquad("highpass", 1800, 0.8, sampleRate);
820
+ let phase = 0;
821
+ let mod = 0;
822
+ for (let i = 0; i < n; i++) {
823
+ const t = i / sampleRate;
824
+ const env = adsr(t, attack, decay, 0.38, 1.8, 0.04);
825
+ const index = 6.5 * Math.exp(-t / 0.22) + 0.35;
826
+ const fm = Math.sin(mod) * index;
827
+ const body = Math.sin(phase + fm);
828
+ const tick = tine.step((hammer() * 2 - 1) * Math.exp(-t / 0.012) * 0.22);
829
+ out[i] = hp.step(lp.step(velocity * env * (body + tick)));
830
+ phase += (2 * Math.PI * freq) / sampleRate;
831
+ mod += (2 * Math.PI * freq) / sampleRate;
832
+ }
833
+ return out;
834
+ }
835
+
836
+ function renderPad(n, sampleRate, freqs, rng, attack) {
837
+ const p = RIPPEL.ambientPad;
838
+ const out = new Float64Array(n);
839
+ const hp = biquad("highpass", 180, 0.7, sampleRate);
840
+ const eq = makeEq3(sampleRate);
841
+ const phases = freqs.map(() => rng() * Math.PI * 2);
842
+ const detune = freqs.map(() => 0.996 + rng() * 0.008);
843
+ const lfo = freqs.map(() => 0.09 + rng() * 0.16);
844
+ const tap = new Float64Array(Math.max(8, Math.floor(0.018 * sampleRate)));
845
+ let tapI = 0;
846
+ let cutoff = p.lp;
847
+ let lp = biquad("lowpass", cutoff, 0.9, sampleRate);
848
+ for (let i = 0; i < n; i++) {
849
+ const t = i / sampleRate;
850
+ if (i % 64 === 0) {
851
+ cutoff = p.lp * (0.82 + 0.18 * Math.sin(2 * Math.PI * 0.21 * t));
852
+ lp = biquad("lowpass", cutoff, 0.95, sampleRate);
853
+ }
854
+ const env = adsr(t, attack || p.attack, p.decay, p.sustain, p.release, Math.max(0, n / sampleRate - 2));
855
+ let mix = 0;
856
+ for (let v = 0; v < freqs.length; v++) {
857
+ const f = freqs[v] * detune[v];
858
+ const inc = (2 * Math.PI * f) / sampleRate;
859
+ const ph = phases[v] + 2 * Math.PI * f * t + 0.01 * Math.sin(2 * Math.PI * lfo[v] * t);
860
+ mix += 0.62 * sawBlep(ph, inc) + 0.38 * triangle(ph);
861
+ }
862
+ const dry = hp.step(lp.step((mix / freqs.length) * env));
863
+ const delayed = tap[tapI];
864
+ tap[tapI] = dry;
865
+ tapI = (tapI + 1) % tap.length;
866
+ out[i] = eq.step(dry * 0.82 + delayed * 0.18, p.eq.low, p.eq.mid, p.eq.high);
867
+ }
868
+ return out;
869
+ }
870
+
871
+ /** Moving air bed — not a sine drone. Pink-ish noise through a wandering bandpass. */
872
+ function renderAirGlue(n, sampleRate, rng, amount) {
873
+ const out = new Float64Array(n);
874
+ const hp = highpass(180, sampleRate);
875
+ const lp = lowpass(1400, sampleRate);
876
+ let b0 = 0;
877
+ let b1 = 0;
878
+ let b2 = 0;
879
+ const lfoHz = 0.17 + rng() * 0.11;
880
+ for (let i = 0; i < n; i++) {
881
+ const t = i / sampleRate;
882
+ const white = rng() * 2 - 1;
883
+ b0 = 0.997 * b0 + white * 0.04;
884
+ b1 = 0.985 * b1 + white * 0.05;
885
+ b2 = 0.95 * b2 + white * 0.1;
886
+ const pink = (b0 + b1 + b2) / 3;
887
+ const wobble = 0.7 + 0.3 * Math.sin(2 * Math.PI * lfoHz * t);
888
+ out[i] = lp.step(hp.step(pink)) * amount * wobble;
889
+ }
890
+ return out;
891
+ }
892
+
893
+ function masterEnvelope(samples, sampleRate, seconds, lock) {
894
+ const blip = Boolean(lock) && seconds <= 5;
895
+ const introHold = blip ? 0 : 0.5;
896
+ const introEase = blip ? 0.03 : 0.35;
897
+ const fadeSec = blip ? 0.35 : 1;
898
+ const fadeStart = Math.max(seconds - fadeSec, blip ? seconds * 0.88 : 1.25);
899
+ const out = new Float64Array(samples.length);
900
+ for (let i = 0; i < samples.length; i++) {
901
+ const t = i / sampleRate;
902
+ let g = 1;
903
+ if (blip && t < introEase) {
904
+ g = t / introEase;
905
+ } else if (!blip && t < introHold) g = 0.46;
906
+ else if (!blip && t < introHold + introEase) {
907
+ const u = (t - introHold) / introEase;
908
+ g = 0.46 + 0.54 * (0.5 - 0.5 * Math.cos(Math.PI * u));
909
+ } else if (t >= fadeStart) {
910
+ const u = (t - fadeStart) / Math.max(seconds - fadeStart, 1e-6);
911
+ g = 1 - (0.5 - 0.5 * Math.cos(Math.PI * Math.min(1, u)));
912
+ }
913
+ out[i] = samples[i] * g;
914
+ }
915
+ return out;
916
+ }
917
+
918
+ function renderPlate(samples, sampleRate) {
919
+ const delays = [0.0297, 0.0371, 0.0411, 0.0437].map((s) => Math.max(2, Math.floor(s * sampleRate)));
920
+ const bufs = delays.map((d) => new Float64Array(d));
921
+ const idx = delays.map(() => 0);
922
+ const pre = Math.floor(0.012 * sampleRate);
923
+ const hp = biquad("highpass", 1500, 0.7, sampleRate);
924
+ const lp = biquad("lowpass", 7800, 0.8, sampleRate);
925
+ const out = new Float64Array(samples.length);
926
+ for (let i = 0; i < samples.length; i++) {
927
+ const x = i >= pre ? samples[i - pre] : 0;
928
+ let acc = 0;
929
+ for (let c = 0; c < bufs.length; c++) {
930
+ const d = bufs[c][idx[c]];
931
+ bufs[c][idx[c]] = x + d * 0.52;
932
+ idx[c] = (idx[c] + 1) % bufs[c].length;
933
+ acc += d;
934
+ }
935
+ out[i] = lp.step(hp.step(acc * 0.25));
936
+ }
937
+ return out;
938
+ }
939
+
940
+ function schedule(seconds, step, endPad) {
941
+ const times = [];
942
+ const end = seconds - (endPad || 0.1);
943
+ for (let t = 0; t < end; t += step) times.push(t);
944
+ return times;
945
+ }
946
+
947
+ function pick(arr, rng) {
948
+ return arr[Math.floor(rng() * arr.length) % arr.length];
949
+ }
950
+
951
+ function sectionGain(t, seconds, lock) {
952
+ const p = t / seconds;
953
+ if (lock && seconds <= 5) {
954
+ if (p > 0.88) return 0.72;
955
+ return 1;
956
+ }
957
+ if (p < 0.15) return 0.62;
958
+ if (p < 0.4) return 0.88;
959
+ if (p < 0.75) return 1;
960
+ if (p < 0.9) return 0.82;
961
+ return 0.55;
962
+ }
963
+
964
+ function renderRippelBed({ brief, genre, seconds, seedHex, rng, sampleRate, syncopate }) {
965
+ void brief;
966
+ const g = resolveGenre(genre);
967
+ const grid = motionGrid(seedHex, g.id);
968
+ g.bpm = grid.bpm;
969
+ const lock = Boolean(syncopate);
970
+ const n = Math.floor(sampleRate * seconds);
971
+ const kickBus = new Float64Array(n);
972
+ const hatBus = new Float64Array(n);
973
+ const colorBus = new Float64Array(n);
974
+ const padBus = new Float64Array(n);
975
+ const beat = grid.beatSec;
976
+ const scale = SCALES[g.id] || SCALES.ambient;
977
+ const hatSlip = (t) => (lock ? t : t + (rng() - 0.5) * 0.003);
978
+
979
+ if (g.id === "techno") {
980
+ const kick = RIPPEL.technoKick;
981
+ const hat = RIPPEL.technoHat;
982
+ const snare = RIPPEL.technoSnare;
983
+ for (const t of schedule(seconds, beat, 0.08)) {
984
+ const hit = renderMembrane({
985
+ sampleRate,
986
+ freq: kick.noteHz,
987
+ octaves: kick.octaves,
988
+ pitchDecay: kick.pitchDecay,
989
+ attack: kick.attack,
990
+ decay: kick.decay,
991
+ release: kick.release,
992
+ velocity: 0.92 * sectionGain(t, seconds, lock),
993
+ floorHz: CRYSTAL.kickFloorHz,
994
+ });
995
+ mixInto(kickBus, hit, Math.floor(t * sampleRate), 1);
996
+ mixInto(kickBus, kickClick(sampleRate, 0.22), Math.floor(t * sampleRate), 1);
997
+ }
998
+ for (const t of schedule(seconds, beat / 2, 0.04)) {
999
+ const off = Math.round(t / (beat / 2)) % 2 === 1;
1000
+ const hit = renderMetal({
1001
+ sampleRate,
1002
+ freq: 380,
1003
+ harmonicity: hat.harmonicity,
1004
+ modulationIndex: hat.modulationIndex,
1005
+ resonance: hat.resonance,
1006
+ attack: hat.attack,
1007
+ decay: hat.decay,
1008
+ release: hat.release,
1009
+ velocity: (off ? 0.34 : 0.2) * sectionGain(t, seconds, lock),
1010
+ });
1011
+ mixInto(hatBus, hit, Math.floor(hatSlip(t) * sampleRate), 1);
1012
+ }
1013
+ for (const t of schedule(seconds, beat * 2, 0.08)) {
1014
+ const at = t + beat;
1015
+ if (at >= seconds - 0.1) continue;
1016
+ const hit = renderMembrane({
1017
+ sampleRate,
1018
+ freq: 196,
1019
+ octaves: snare.octaves,
1020
+ pitchDecay: snare.pitchDecay,
1021
+ attack: snare.attack,
1022
+ decay: snare.decay,
1023
+ release: snare.release,
1024
+ velocity: 0.42,
1025
+ floorHz: 120,
1026
+ shape: "square",
1027
+ });
1028
+ const bp = bandpass(snare.bandpass, sampleRate);
1029
+ for (let i = 0; i < hit.length; i++) hit[i] = bp.step(hit[i]);
1030
+ mixInto(colorBus, hit, Math.floor(at * sampleRate), 0.85);
1031
+ }
1032
+ const technoLine = degreeLine("bass", 8);
1033
+ for (const t of schedule(seconds, beat, 0.12)) {
1034
+ const beatIdx = Math.round(t / beat);
1035
+ const bass = renderDuoBass({
1036
+ sampleRate,
1037
+ freq: scale[technoLine[beatIdx % technoLine.length] % scale.length],
1038
+ velocity: 0.42,
1039
+ hold: beat * 0.45,
1040
+ });
1041
+ mixInto(colorBus, bass, Math.floor(t * sampleRate), 1);
1042
+ }
1043
+ } else if (g.id === "phonk") {
1044
+ mixInto(padBus, renderPad(n, sampleRate, padTones("phonk", scale), rng, 0.35), 0, 0.22);
1045
+ const kick = RIPPEL.phonk808;
1046
+ const hat = RIPPEL.technoHat;
1047
+ for (const t of schedule(seconds, beat, 0.12)) {
1048
+ const hit = renderMembrane({
1049
+ sampleRate,
1050
+ freq: kick.noteHz,
1051
+ octaves: kick.octaves,
1052
+ pitchDecay: kick.pitchDecay,
1053
+ attack: kick.attack,
1054
+ decay: kick.decay,
1055
+ release: kick.release,
1056
+ velocity: 0.78 * sectionGain(t, seconds, lock),
1057
+ floorHz: CRYSTAL.eightOhEightFloorHz,
1058
+ });
1059
+ mixInto(kickBus, hit, Math.floor(t * sampleRate), 1);
1060
+ mixInto(kickBus, kickClick(sampleRate, 0.1), Math.floor(t * sampleRate), 1);
1061
+ }
1062
+ for (const t of schedule(seconds, beat / 2, 0.04)) {
1063
+ const hit = renderMetal({
1064
+ sampleRate,
1065
+ freq: 420,
1066
+ harmonicity: hat.harmonicity,
1067
+ modulationIndex: 36,
1068
+ resonance: 4500,
1069
+ attack: 0.001,
1070
+ decay: 0.055,
1071
+ release: 0.02,
1072
+ velocity: 0.18 * sectionGain(t, seconds, lock),
1073
+ });
1074
+ mixInto(hatBus, hit, Math.floor(hatSlip(t) * sampleRate), 1);
1075
+ }
1076
+ for (const t of schedule(seconds, beat, 0.08)) {
1077
+ mixInto(
1078
+ colorBus,
1079
+ renderCowbell({ sampleRate, velocity: 0.2 }),
1080
+ Math.floor((t + beat / 2) * sampleRate),
1081
+ 1,
1082
+ );
1083
+ }
1084
+ const phonkLine = [0, 3];
1085
+ for (const t of schedule(seconds, beat * 2, 0.2)) {
1086
+ const beatIdx = Math.round(t / beat);
1087
+ const bass = renderReese({
1088
+ sampleRate,
1089
+ freq: scale[phonkLine[beatIdx % phonkLine.length] % scale.length],
1090
+ velocity: 0.38,
1091
+ hold: beat * 0.9,
1092
+ });
1093
+ mixInto(colorBus, bass, Math.floor((t + beat * 0.5) * sampleRate), 1);
1094
+ }
1095
+ } else if (g.id === "jazz") {
1096
+ mixInto(padBus, renderPad(n, sampleRate, padTones("jazz", scale), rng, 0.4), 0, 0.28);
1097
+ const kick = RIPPEL.jazzKick;
1098
+ const ride = RIPPEL.jazzRide;
1099
+ const swing = beat / 2 * 0.32;
1100
+ for (const t of schedule(seconds, beat, 0.1)) {
1101
+ const hit = renderMembrane({
1102
+ sampleRate,
1103
+ freq: 73.4,
1104
+ octaves: kick.octaves,
1105
+ pitchDecay: kick.pitchDecay,
1106
+ attack: kick.attack,
1107
+ decay: kick.decay,
1108
+ release: kick.release,
1109
+ velocity: 0.55 * sectionGain(t, seconds, lock),
1110
+ floorHz: 40,
1111
+ });
1112
+ mixInto(kickBus, hit, Math.floor(t * sampleRate), 1);
1113
+ }
1114
+ for (const t of schedule(seconds, beat / 2, 0.05)) {
1115
+ const eighth = Math.round(t / (beat / 2));
1116
+ const at = eighth % 2 === 1 ? t + swing : t;
1117
+ const hit = renderMetal({
1118
+ sampleRate,
1119
+ freq: 280,
1120
+ harmonicity: ride.harmonicity,
1121
+ modulationIndex: ride.modulationIndex,
1122
+ resonance: ride.resonance,
1123
+ attack: ride.attack,
1124
+ decay: ride.decay,
1125
+ release: ride.release,
1126
+ velocity: 0.18 * sectionGain(t, seconds, lock),
1127
+ });
1128
+ mixInto(hatBus, hit, Math.floor(at * sampleRate), 1);
1129
+ }
1130
+ for (const t of schedule(seconds, beat * 2, 0.1)) {
1131
+ mixInto(
1132
+ colorBus,
1133
+ renderBrush({ sampleRate, velocity: 0.28, rng }),
1134
+ Math.floor((t + beat) * sampleRate),
1135
+ 1,
1136
+ );
1137
+ }
1138
+ let walk = 0;
1139
+ for (const t of schedule(seconds, beat, 0.12)) {
1140
+ walk = walkDegree(walk, scale.length, rng);
1141
+ const bass = renderDuoBass({
1142
+ sampleRate,
1143
+ freq: scale[walk] / 2,
1144
+ velocity: 0.34,
1145
+ hold: beat * 0.55,
1146
+ });
1147
+ mixInto(colorBus, bass, Math.floor(t * sampleRate), 0.85);
1148
+ }
1149
+ const saxCell = degreeLine("rhodes", 6);
1150
+ let saxI = 0;
1151
+ for (const t of schedule(seconds, beat * 2, 0.25)) {
1152
+ const deg = saxCell[saxI % saxCell.length];
1153
+ saxI += 1;
1154
+ mixInto(
1155
+ colorBus,
1156
+ renderSax({ sampleRate, freq: scale[deg % scale.length] * 2, velocity: 0.22, hold: beat * 0.8 }),
1157
+ Math.floor((t + beat * 0.25) * sampleRate),
1158
+ 1,
1159
+ );
1160
+ }
1161
+ } else {
1162
+ const padFreqs = padTones("ambient", scale);
1163
+ mixInto(padBus, renderPad(n, sampleRate, padFreqs, rng, RIPPEL.ambientPad.attack), 0, dbLin(-8));
1164
+ const bassLine = degreeLine("bass", 8);
1165
+ const rhodesLine = degreeLine("rhodes", 8);
1166
+ let rhodesI = 0;
1167
+ let bassWalk = bassLine[0] % scale.length;
1168
+ const phrase0 = shortformPhrase(0, seconds, grid);
1169
+ const turnAt = phrase0.hookEndBeats * beat;
1170
+ const tagAt = phrase0.tagStartBeats * beat;
1171
+ for (const t of schedule(seconds, beat, 0.2)) {
1172
+ const phrase = shortformPhrase(t, seconds, grid);
1173
+ const lastKick = phrase.tagEase > 0.55 && phrase.beats + 1 >= phrase.total;
1174
+ const vel =
1175
+ (lastKick ? 0.92 : 0.7 + 0.16 * phrase.hookEase + 0.06 * phrase.turnEase) *
1176
+ sectionGain(t, seconds, lock);
1177
+ const hit = renderMembrane({
1178
+ sampleRate,
1179
+ freq: 36.7,
1180
+ octaves: 4.5,
1181
+ pitchDecay: 0.09,
1182
+ attack: 0.004,
1183
+ decay: 0.45,
1184
+ release: 0.6,
1185
+ velocity: vel,
1186
+ floorHz: CRYSTAL.kickFloorHz,
1187
+ });
1188
+ mixInto(kickBus, hit, Math.floor(t * sampleRate), 1);
1189
+ mixInto(kickBus, kickClick(sampleRate, lastKick ? 0.22 : 0.16), Math.floor(t * sampleRate), 1);
1190
+ }
1191
+ if (lock && turnAt < seconds - 0.05) {
1192
+ mixInto(
1193
+ hatBus,
1194
+ renderMetal({
1195
+ sampleRate,
1196
+ freq: 320,
1197
+ harmonicity: 5.1,
1198
+ modulationIndex: 28,
1199
+ resonance: 3200,
1200
+ attack: 0.003,
1201
+ decay: 0.22,
1202
+ release: 0.1,
1203
+ velocity: 0.48,
1204
+ }),
1205
+ Math.floor(turnAt * sampleRate),
1206
+ 1,
1207
+ );
1208
+ mixInto(kickBus, kickClick(sampleRate, 0.2), Math.floor(turnAt * sampleRate), 1);
1209
+ }
1210
+ if (lock && tagAt < seconds - 0.05) {
1211
+ mixInto(
1212
+ colorBus,
1213
+ renderRhodes({ sampleRate, freq: scale[4 % scale.length] * 2, velocity: 0.46 }),
1214
+ Math.floor(tagAt * sampleRate),
1215
+ 1,
1216
+ );
1217
+ mixInto(
1218
+ kickBus,
1219
+ renderMembrane({
1220
+ sampleRate,
1221
+ freq: 41.2,
1222
+ octaves: 4.2,
1223
+ pitchDecay: 0.08,
1224
+ attack: 0.003,
1225
+ decay: 0.38,
1226
+ release: 0.5,
1227
+ velocity: 0.8,
1228
+ floorHz: CRYSTAL.kickFloorHz,
1229
+ }),
1230
+ Math.floor(tagAt * sampleRate),
1231
+ 1,
1232
+ );
1233
+ }
1234
+ for (const t of schedule(seconds, beat, 0.08)) {
1235
+ const at = lock ? t + beat * grid.and : t;
1236
+ if (at >= seconds - 0.08) continue;
1237
+ const phrase = shortformPhrase(at, seconds, grid);
1238
+ const hatW = 1 - 0.45 * phrase.tagEase;
1239
+ const hit = renderMetal({
1240
+ sampleRate,
1241
+ freq: 240,
1242
+ harmonicity: 4.8,
1243
+ modulationIndex: 22,
1244
+ resonance: 2800,
1245
+ attack: 0.004,
1246
+ decay: 0.18,
1247
+ release: 0.08,
1248
+ velocity: (lock ? 0.38 : 0.16) * hatW * sectionGain(t, seconds, lock),
1249
+ });
1250
+ mixInto(hatBus, hit, Math.floor(at * sampleRate), 1);
1251
+ }
1252
+ for (const t of schedule(seconds, beat, 0.12)) {
1253
+ const beatIdx = Math.round(t / beat);
1254
+ const phrase = shortformPhrase(t, seconds, grid);
1255
+ if (lock && phrase.hookEase > 0.55 && beatIdx % 4 === 1) continue;
1256
+ if (lock && phrase.tagEase > 0.55 && beatIdx % 2 === 1) continue;
1257
+ if (phrase.turnEase > 0.35) bassWalk = walkDegree(bassWalk, scale.length, rng);
1258
+ else bassWalk = bassLine[beatIdx % bassLine.length] % scale.length;
1259
+ const register = phrase.turnEase > 0.5 ? 1 : 2;
1260
+ mixInto(
1261
+ colorBus,
1262
+ renderDuoBass({
1263
+ sampleRate,
1264
+ freq: scale[bassWalk] / register,
1265
+ velocity: 0.36,
1266
+ hold: beat * 0.42,
1267
+ }),
1268
+ Math.floor(t * sampleRate),
1269
+ 1,
1270
+ );
1271
+ }
1272
+ for (const t of schedule(seconds, beat * 2, 0.2)) {
1273
+ const beatIdx = Math.round(t / beat);
1274
+ const phrase = shortformPhrase(t + beat * (lock ? grid.a : 0.5), seconds, grid);
1275
+ if (lock && phrase.hookEase > 0.6) continue;
1276
+ if (phrase.tagEase > 0.6) continue;
1277
+ const deg = rhodesLine[rhodesI % rhodesLine.length];
1278
+ rhodesI += 1;
1279
+ mixInto(
1280
+ colorBus,
1281
+ renderRhodes({ sampleRate, freq: scale[deg % scale.length], velocity: 0.4 }),
1282
+ Math.floor((t + beat * (lock ? grid.a : 0.5)) * sampleRate),
1283
+ 1,
1284
+ );
1285
+ void beatIdx;
1286
+ }
1287
+ }
1288
+
1289
+ const kickCh = applyBus(kickBus, sampleRate, {
1290
+ hp: g.id === "phonk" ? RIPPEL.phonk808.hp : 30,
1291
+ lp: g.id === "phonk" ? RIPPEL.phonk808.lp : 9000,
1292
+ eq: g.id === "phonk" ? RIPPEL.phonk808.eq : RIPPEL.technoKick.eq,
1293
+ dist: g.id === "phonk" ? RIPPEL.phonk808.dist : RIPPEL.technoKick.dist,
1294
+ comp: g.id === "phonk" ? RIPPEL.phonk808.comp : RIPPEL.technoKick.comp,
1295
+ volDb: g.id === "ambient" ? -4 : g.id === "jazz" ? RIPPEL.jazzKick.volDb : g.id === "phonk" ? RIPPEL.phonk808.volDb : RIPPEL.technoKick.volDb,
1296
+ });
1297
+ const hatCh = applyBus(hatBus, sampleRate, {
1298
+ hp: g.id === "techno" || g.id === "phonk" ? CRYSTAL.hatAirHz : 7200,
1299
+ lp: 16000,
1300
+ eq: { low: -10, mid: -2, high: 3 },
1301
+ dist: 0.04,
1302
+ comp: RIPPEL.technoHat.comp,
1303
+ volDb: RIPPEL.technoHat.volDb,
1304
+ });
1305
+ const colorCh = applyBus(colorBus, sampleRate, {
1306
+ hp: g.id === "ambient" ? 90 : 40,
1307
+ lp: g.id === "phonk" ? 7000 : 9000,
1308
+ eq: g.id === "techno" ? RIPPEL.technoBass.eq : g.id === "phonk" ? RIPPEL.phonkReese.eq : { low: -2, mid: 2, high: -3 },
1309
+ dist: g.id === "techno" ? RIPPEL.technoBass.dist : g.id === "phonk" ? RIPPEL.phonkReese.dist : 0.08,
1310
+ comp: RIPPEL.technoBass.comp,
1311
+ volDb: g.id === "techno" ? RIPPEL.technoBass.volDb : g.id === "phonk" ? RIPPEL.phonkReese.volDb : -8,
1312
+ });
1313
+ const padCh = applyBus(padBus, sampleRate, {
1314
+ hp: lock && g.id === "ambient" ? 180 : 90,
1315
+ lp: 6200,
1316
+ eq: { low: lock ? -5 : -2, mid: 2, high: -2 },
1317
+ dist: 0,
1318
+ volDb: -2,
1319
+ });
1320
+
1321
+ const kickEnv = envelopeFollow(kickCh, sampleRate, 0.003, 0.2);
1322
+ const glue = renderAirGlue(n, sampleRate, rng, g.id === "ambient" ? (lock ? 0.03 : 0.07) : g.id === "phonk" ? 0.04 : 0.028);
1323
+ const wetSrc = new Float64Array(n);
1324
+ for (let i = 0; i < n; i++) wetSrc[i] = hatCh[i] * 0.62 + colorCh[i] * 0.38;
1325
+ const plate = renderPlate(wetSrc, sampleRate);
1326
+ const mix = new Float64Array(n);
1327
+ const kickGain = g.id === "ambient" ? (lock ? 1 : 0.7) : 0.9;
1328
+ const hatGain = g.id === "techno" || g.id === "phonk" ? 0.72 : g.id === "ambient" ? 0.58 : 0.48;
1329
+ const padGain = g.id === "ambient" ? (lock ? 0.17 : 0.48) : g.id === "jazz" ? 0.36 : g.id === "phonk" ? 0.42 : 0.12;
1330
+ for (let i = 0; i < n; i++) {
1331
+ const duck = 1 / (1 + CRYSTAL.sidechain * kickEnv[i] * 7);
1332
+ mix[i] =
1333
+ kickCh[i] * kickGain +
1334
+ hatCh[i] * hatGain +
1335
+ colorCh[i] * 0.52 * duck +
1336
+ padCh[i] * padGain * duck +
1337
+ plate[i] * 0.1 +
1338
+ glue[i];
1339
+ }
1340
+
1341
+ const masterEq = makeEq3(sampleRate);
1342
+ const mEq = RIPPEL.mixer.masterEq;
1343
+ for (let i = 0; i < n; i++) {
1344
+ mix[i] = masterEq.step(mix[i], mEq.low, mEq.mid, mEq.high) * RIPPEL.mixer.masterVolume;
1345
+ }
1346
+ let glued = compress(mix, dbLin(-16), g.id === "phonk" ? 5 : 2.6, sampleRate, 0.008, 0.16);
1347
+ const shaped = masterEnvelope(glued, sampleRate, seconds, lock);
1348
+ const peaked = normalize(shaped, CRYSTAL.peakTarget);
1349
+ const samples = limiter(peaked, dbLin(RIPPEL.mixer.limiterDb));
1350
+
1351
+ return {
1352
+ samples,
1353
+ sampleRate,
1354
+ seconds,
1355
+ seed: seedHex,
1356
+ genre: g,
1357
+ grid: { ...grid, syncopate: lock },
1358
+ engine: ENGINE,
1359
+ mix: MIX,
1360
+ ssot: SSOT,
1361
+ toneOffline: TONE_OFFLINE_BLOCKER,
1362
+ topology: TOPOLOGY,
1363
+ };
1364
+ }
1365
+
1366
+ function bandEnergy(samples, sampleRate, loHz, hiHz) {
1367
+ const hp = highpass(loHz, sampleRate);
1368
+ const lp = lowpass(hiHz, sampleRate);
1369
+ let acc = 0;
1370
+ for (let i = 0; i < samples.length; i++) {
1371
+ const x = lp.step(hp.step(samples[i]));
1372
+ acc += x * x;
1373
+ }
1374
+ return Math.sqrt(acc / samples.length);
1375
+ }
1376
+
1377
+ function highpassEnergy(samples, sampleRate, cutoffHz) {
1378
+ const hp = highpass(cutoffHz, sampleRate);
1379
+ let acc = 0;
1380
+ for (let i = 0; i < samples.length; i++) {
1381
+ const x = hp.step(samples[i]);
1382
+ acc += x * x;
1383
+ }
1384
+ return Math.sqrt(acc / samples.length);
1385
+ }
1386
+
1387
+ function zeroCrossRate(samples) {
1388
+ let crosses = 0;
1389
+ for (let i = 1; i < samples.length; i++) {
1390
+ if (samples[i] === 0 || samples[i] * samples[i - 1] < 0) crosses += 1;
1391
+ }
1392
+ return crosses / samples.length;
1393
+ }
1394
+
1395
+ function crestFactor(samples) {
1396
+ let peak = 0;
1397
+ let acc = 0;
1398
+ for (let i = 0; i < samples.length; i++) {
1399
+ const a = Math.abs(samples[i]);
1400
+ if (a > peak) peak = a;
1401
+ acc += samples[i] * samples[i];
1402
+ }
1403
+ const rms = Math.sqrt(acc / samples.length);
1404
+ return rms > 0 ? peak / rms : 0;
1405
+ }
1406
+
1407
+ module.exports = {
1408
+ TONE_OFFLINE_BLOCKER,
1409
+ ENGINE,
1410
+ MIX,
1411
+ TOPOLOGY,
1412
+ SSOT,
1413
+ RIPPEL,
1414
+ CRYSTAL,
1415
+ GENRE_ALIASES,
1416
+ GENRES,
1417
+ SCALES,
1418
+ resolveGenre,
1419
+ tempoFromSeed,
1420
+ motionGrid,
1421
+ shortformPhrase,
1422
+ padTones,
1423
+ degreeLine,
1424
+ gridTime,
1425
+ renderRippelBed,
1426
+ renderMembrane,
1427
+ renderMetal,
1428
+ renderDuoBass,
1429
+ renderCowbell,
1430
+ bandEnergy,
1431
+ highpassEnergy,
1432
+ zeroCrossRate,
1433
+ crestFactor,
1434
+ };