bla-agents 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/.agents/skills/blind-llm-agents/SKILL.md +50 -0
  2. package/.agents/skills/blind-llm-agents/references/counter-rea-matrix.md +28 -0
  3. package/DISCLAIMER.md +20 -0
  4. package/LICENSE +21 -0
  5. package/README.md +291 -2
  6. package/dist/bundler/index.d.ts +100 -0
  7. package/dist/bundler/index.d.ts.map +1 -0
  8. package/dist/bundler/index.js +124 -0
  9. package/dist/bundler/index.js.map +1 -0
  10. package/dist/cli.d.ts +25 -0
  11. package/dist/cli.d.ts.map +1 -0
  12. package/dist/cli.js +342 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/core/detector.d.ts +7 -0
  15. package/dist/core/detector.d.ts.map +1 -0
  16. package/dist/core/detector.js +138 -0
  17. package/dist/core/detector.js.map +1 -0
  18. package/dist/core/output-path.d.ts +3 -0
  19. package/dist/core/output-path.d.ts.map +1 -0
  20. package/dist/core/output-path.js +51 -0
  21. package/dist/core/output-path.js.map +1 -0
  22. package/dist/core/prng.d.ts +18 -0
  23. package/dist/core/prng.d.ts.map +1 -0
  24. package/dist/core/prng.js +60 -0
  25. package/dist/core/prng.js.map +1 -0
  26. package/dist/core/release-exposure.d.ts +26 -0
  27. package/dist/core/release-exposure.d.ts.map +1 -0
  28. package/dist/core/release-exposure.js +213 -0
  29. package/dist/core/release-exposure.js.map +1 -0
  30. package/dist/core/sqlite-runtime.d.ts +4 -0
  31. package/dist/core/sqlite-runtime.d.ts.map +1 -0
  32. package/dist/core/sqlite-runtime.js +19 -0
  33. package/dist/core/sqlite-runtime.js.map +1 -0
  34. package/dist/core/token-estimator.d.ts +11 -0
  35. package/dist/core/token-estimator.d.ts.map +1 -0
  36. package/dist/core/token-estimator.js +87 -0
  37. package/dist/core/token-estimator.js.map +1 -0
  38. package/dist/core/types.d.ts +154 -0
  39. package/dist/core/types.d.ts.map +1 -0
  40. package/dist/core/types.js +2 -0
  41. package/dist/core/types.js.map +1 -0
  42. package/dist/engine/auditor.d.ts +6 -0
  43. package/dist/engine/auditor.d.ts.map +1 -0
  44. package/dist/engine/auditor.js +734 -0
  45. package/dist/engine/auditor.js.map +1 -0
  46. package/dist/engine/benchmark.d.ts +6 -0
  47. package/dist/engine/benchmark.d.ts.map +1 -0
  48. package/dist/engine/benchmark.js +345 -0
  49. package/dist/engine/benchmark.js.map +1 -0
  50. package/dist/engine/defender.d.ts +56 -0
  51. package/dist/engine/defender.d.ts.map +1 -0
  52. package/dist/engine/defender.js +124 -0
  53. package/dist/engine/defender.js.map +1 -0
  54. package/dist/engine/protector.d.ts +8 -0
  55. package/dist/engine/protector.d.ts.map +1 -0
  56. package/dist/engine/protector.js +359 -0
  57. package/dist/engine/protector.js.map +1 -0
  58. package/dist/engine/verifier.d.ts +6 -0
  59. package/dist/engine/verifier.d.ts.map +1 -0
  60. package/dist/engine/verifier.js +91 -0
  61. package/dist/engine/verifier.js.map +1 -0
  62. package/dist/identity.d.ts +70 -0
  63. package/dist/identity.d.ts.map +1 -0
  64. package/dist/identity.js +70 -0
  65. package/dist/identity.js.map +1 -0
  66. package/dist/index.d.ts +36 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +36 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/mcp/server.d.ts +174 -0
  71. package/dist/mcp/server.d.ts.map +1 -0
  72. package/dist/mcp/server.js +314 -0
  73. package/dist/mcp/server.js.map +1 -0
  74. package/dist/setup/clients.d.ts +10 -0
  75. package/dist/setup/clients.d.ts.map +1 -0
  76. package/dist/setup/clients.js +95 -0
  77. package/dist/setup/clients.js.map +1 -0
  78. package/dist/setup/doctor.d.ts +25 -0
  79. package/dist/setup/doctor.d.ts.map +1 -0
  80. package/dist/setup/doctor.js +45 -0
  81. package/dist/setup/doctor.js.map +1 -0
  82. package/dist/setup/setup.d.ts +29 -0
  83. package/dist/setup/setup.d.ts.map +1 -0
  84. package/dist/setup/setup.js +123 -0
  85. package/dist/setup/setup.js.map +1 -0
  86. package/dist/shields/chaff/chaff-generator.d.ts +17 -0
  87. package/dist/shields/chaff/chaff-generator.d.ts.map +1 -0
  88. package/dist/shields/chaff/chaff-generator.js +71 -0
  89. package/dist/shields/chaff/chaff-generator.js.map +1 -0
  90. package/dist/shields/deception/architecture-mirage.d.ts +16 -0
  91. package/dist/shields/deception/architecture-mirage.d.ts.map +1 -0
  92. package/dist/shields/deception/architecture-mirage.js +46 -0
  93. package/dist/shields/deception/architecture-mirage.js.map +1 -0
  94. package/dist/shields/deception/crash-trace-decoy.d.ts +16 -0
  95. package/dist/shields/deception/crash-trace-decoy.d.ts.map +1 -0
  96. package/dist/shields/deception/crash-trace-decoy.js +36 -0
  97. package/dist/shields/deception/crash-trace-decoy.js.map +1 -0
  98. package/dist/shields/deception/decompiler-illusion.d.ts +15 -0
  99. package/dist/shields/deception/decompiler-illusion.d.ts.map +1 -0
  100. package/dist/shields/deception/decompiler-illusion.js +29 -0
  101. package/dist/shields/deception/decompiler-illusion.js.map +1 -0
  102. package/dist/shields/deception/diff-noise-injector.d.ts +17 -0
  103. package/dist/shields/deception/diff-noise-injector.d.ts.map +1 -0
  104. package/dist/shields/deception/diff-noise-injector.js +29 -0
  105. package/dist/shields/deception/diff-noise-injector.js.map +1 -0
  106. package/dist/shields/deception/evidence-contract-poison.d.ts +25 -0
  107. package/dist/shields/deception/evidence-contract-poison.d.ts.map +1 -0
  108. package/dist/shields/deception/evidence-contract-poison.js +66 -0
  109. package/dist/shields/deception/evidence-contract-poison.js.map +1 -0
  110. package/dist/shields/deception/index.d.ts +27 -0
  111. package/dist/shields/deception/index.d.ts.map +1 -0
  112. package/dist/shields/deception/index.js +52 -0
  113. package/dist/shields/deception/index.js.map +1 -0
  114. package/dist/shields/deception/prompt-completion-poison.d.ts +18 -0
  115. package/dist/shields/deception/prompt-completion-poison.d.ts.map +1 -0
  116. package/dist/shields/deception/prompt-completion-poison.js +42 -0
  117. package/dist/shields/deception/prompt-completion-poison.js.map +1 -0
  118. package/dist/shields/deception/semantic-honeypot.d.ts +17 -0
  119. package/dist/shields/deception/semantic-honeypot.d.ts.map +1 -0
  120. package/dist/shields/deception/semantic-honeypot.js +45 -0
  121. package/dist/shields/deception/semantic-honeypot.js.map +1 -0
  122. package/dist/shields/deception/shadow-business-logic.d.ts +24 -0
  123. package/dist/shields/deception/shadow-business-logic.d.ts.map +1 -0
  124. package/dist/shields/deception/shadow-business-logic.js +66 -0
  125. package/dist/shields/deception/shadow-business-logic.js.map +1 -0
  126. package/dist/shields/exhaustion/asar-header-amplifier.d.ts +16 -0
  127. package/dist/shields/exhaustion/asar-header-amplifier.d.ts.map +1 -0
  128. package/dist/shields/exhaustion/asar-header-amplifier.js +37 -0
  129. package/dist/shields/exhaustion/asar-header-amplifier.js.map +1 -0
  130. package/dist/shields/exhaustion/bpe-token-amplifier.d.ts +21 -0
  131. package/dist/shields/exhaustion/bpe-token-amplifier.d.ts.map +1 -0
  132. package/dist/shields/exhaustion/bpe-token-amplifier.js +68 -0
  133. package/dist/shields/exhaustion/bpe-token-amplifier.js.map +1 -0
  134. package/dist/shields/exhaustion/callgraph-labyrinth.d.ts +20 -0
  135. package/dist/shields/exhaustion/callgraph-labyrinth.d.ts.map +1 -0
  136. package/dist/shields/exhaustion/callgraph-labyrinth.js +62 -0
  137. package/dist/shields/exhaustion/callgraph-labyrinth.js.map +1 -0
  138. package/dist/shields/exhaustion/cdp-shape-budget-breaker.d.ts +20 -0
  139. package/dist/shields/exhaustion/cdp-shape-budget-breaker.d.ts.map +1 -0
  140. package/dist/shields/exhaustion/cdp-shape-budget-breaker.js +40 -0
  141. package/dist/shields/exhaustion/cdp-shape-budget-breaker.js.map +1 -0
  142. package/dist/shields/exhaustion/frida-capture-saturation.d.ts +28 -0
  143. package/dist/shields/exhaustion/frida-capture-saturation.d.ts.map +1 -0
  144. package/dist/shields/exhaustion/frida-capture-saturation.js +45 -0
  145. package/dist/shields/exhaustion/frida-capture-saturation.js.map +1 -0
  146. package/dist/shields/exhaustion/index.d.ts +30 -0
  147. package/dist/shields/exhaustion/index.d.ts.map +1 -0
  148. package/dist/shields/exhaustion/index.js +43 -0
  149. package/dist/shields/exhaustion/index.js.map +1 -0
  150. package/dist/shields/exhaustion/obligation-flooder.d.ts +116 -0
  151. package/dist/shields/exhaustion/obligation-flooder.d.ts.map +1 -0
  152. package/dist/shields/exhaustion/obligation-flooder.js +133 -0
  153. package/dist/shields/exhaustion/obligation-flooder.js.map +1 -0
  154. package/dist/shields/exhaustion/rea-budget-matrix.d.ts +48 -0
  155. package/dist/shields/exhaustion/rea-budget-matrix.d.ts.map +1 -0
  156. package/dist/shields/exhaustion/rea-budget-matrix.js +177 -0
  157. package/dist/shields/exhaustion/rea-budget-matrix.js.map +1 -0
  158. package/dist/shields/exhaustion/regex-worker-tarpit.d.ts +23 -0
  159. package/dist/shields/exhaustion/regex-worker-tarpit.d.ts.map +1 -0
  160. package/dist/shields/exhaustion/regex-worker-tarpit.js +42 -0
  161. package/dist/shields/exhaustion/regex-worker-tarpit.js.map +1 -0
  162. package/dist/shields/exhaustion/wasm-interface-exhaustion.d.ts +23 -0
  163. package/dist/shields/exhaustion/wasm-interface-exhaustion.d.ts.map +1 -0
  164. package/dist/shields/exhaustion/wasm-interface-exhaustion.js +50 -0
  165. package/dist/shields/exhaustion/wasm-interface-exhaustion.js.map +1 -0
  166. package/dist/shields/formats/apple-plist.d.ts +31 -0
  167. package/dist/shields/formats/apple-plist.d.ts.map +1 -0
  168. package/dist/shields/formats/apple-plist.js +61 -0
  169. package/dist/shields/formats/apple-plist.js.map +1 -0
  170. package/dist/shields/formats/archive.d.ts +34 -0
  171. package/dist/shields/formats/archive.d.ts.map +1 -0
  172. package/dist/shields/formats/archive.js +167 -0
  173. package/dist/shields/formats/archive.js.map +1 -0
  174. package/dist/shields/formats/asar.d.ts +32 -0
  175. package/dist/shields/formats/asar.d.ts.map +1 -0
  176. package/dist/shields/formats/asar.js +117 -0
  177. package/dist/shields/formats/asar.js.map +1 -0
  178. package/dist/shields/formats/dotnet-managed.d.ts +21 -0
  179. package/dist/shields/formats/dotnet-managed.d.ts.map +1 -0
  180. package/dist/shields/formats/dotnet-managed.js +41 -0
  181. package/dist/shields/formats/dotnet-managed.js.map +1 -0
  182. package/dist/shields/formats/electron-fuses.d.ts +38 -0
  183. package/dist/shields/formats/electron-fuses.d.ts.map +1 -0
  184. package/dist/shields/formats/electron-fuses.js +117 -0
  185. package/dist/shields/formats/electron-fuses.js.map +1 -0
  186. package/dist/shields/formats/headers.d.ts +22 -0
  187. package/dist/shields/formats/headers.d.ts.map +1 -0
  188. package/dist/shields/formats/headers.js +153 -0
  189. package/dist/shields/formats/headers.js.map +1 -0
  190. package/dist/shields/formats/mobile-game.d.ts +38 -0
  191. package/dist/shields/formats/mobile-game.d.ts.map +1 -0
  192. package/dist/shields/formats/mobile-game.js +115 -0
  193. package/dist/shields/formats/mobile-game.js.map +1 -0
  194. package/dist/shields/formats/model.d.ts +52 -0
  195. package/dist/shields/formats/model.d.ts.map +1 -0
  196. package/dist/shields/formats/model.js +289 -0
  197. package/dist/shields/formats/model.js.map +1 -0
  198. package/dist/shields/formats/native.d.ts +47 -0
  199. package/dist/shields/formats/native.d.ts.map +1 -0
  200. package/dist/shields/formats/native.js +280 -0
  201. package/dist/shields/formats/native.js.map +1 -0
  202. package/dist/shields/formats/python.d.ts +41 -0
  203. package/dist/shields/formats/python.d.ts.map +1 -0
  204. package/dist/shields/formats/python.js +96 -0
  205. package/dist/shields/formats/python.js.map +1 -0
  206. package/dist/shields/formats/sourcemap.d.ts +22 -0
  207. package/dist/shields/formats/sourcemap.d.ts.map +1 -0
  208. package/dist/shields/formats/sourcemap.js +64 -0
  209. package/dist/shields/formats/sourcemap.js.map +1 -0
  210. package/dist/shields/formats/sqlite.d.ts +43 -0
  211. package/dist/shields/formats/sqlite.d.ts.map +1 -0
  212. package/dist/shields/formats/sqlite.js +193 -0
  213. package/dist/shields/formats/sqlite.js.map +1 -0
  214. package/dist/shields/formats/wasm.d.ts +32 -0
  215. package/dist/shields/formats/wasm.d.ts.map +1 -0
  216. package/dist/shields/formats/wasm.js +199 -0
  217. package/dist/shields/formats/wasm.js.map +1 -0
  218. package/dist/shields/javascript/ast-shield.d.ts +17 -0
  219. package/dist/shields/javascript/ast-shield.d.ts.map +1 -0
  220. package/dist/shields/javascript/ast-shield.js +275 -0
  221. package/dist/shields/javascript/ast-shield.js.map +1 -0
  222. package/dist/shields/runtime/runtime-shield.d.ts +28 -0
  223. package/dist/shields/runtime/runtime-shield.d.ts.map +1 -0
  224. package/dist/shields/runtime/runtime-shield.js +78 -0
  225. package/dist/shields/runtime/runtime-shield.js.map +1 -0
  226. package/dist/shields/tarpit/opaque-predicates.d.ts +10 -0
  227. package/dist/shields/tarpit/opaque-predicates.d.ts.map +1 -0
  228. package/dist/shields/tarpit/opaque-predicates.js +40 -0
  229. package/dist/shields/tarpit/opaque-predicates.js.map +1 -0
  230. package/dist/shields/tarpit/tarpit-generator.d.ts +26 -0
  231. package/dist/shields/tarpit/tarpit-generator.d.ts.map +1 -0
  232. package/dist/shields/tarpit/tarpit-generator.js +187 -0
  233. package/dist/shields/tarpit/tarpit-generator.js.map +1 -0
  234. package/dist/ui/reporter.d.ts +13 -0
  235. package/dist/ui/reporter.d.ts.map +1 -0
  236. package/dist/ui/reporter.js +197 -0
  237. package/dist/ui/reporter.js.map +1 -0
  238. package/package.json +82 -4
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: blind-llm-agents
3
+ description: Audit, protect, and verify software artifacts (JavaScript/TypeScript, Electron ASAR, WebAssembly, Python .py/.pyc, SQLite, Safetensors/GGUF AI Models, Android DEX/IL2CPP, and Native ELF/Mach-O/PE Binaries) against AI reverse-engineering agents like REA using BLA (Blind LLM Agents / Block Anything).
4
+ metadata:
5
+ version: "1.1.0"
6
+ ---
7
+
8
+ # BLA: Blind LLM Agents (Block Anything)
9
+
10
+ Use BLA whenever the user asks to harden a project against AI reverse-engineering agents (`morluto/rea`), audit exposure, exhaust attacker token/compute budgets, or induce model misjudgment on proprietary logic.
11
+
12
+ ## ⚡ One-Click Agent Defense Hardening (Recommended)
13
+
14
+ When the user says **"Harden this project against REA"**, **"一键启动防御强化"**, or **"Run BLA defense"**, invoke the single one-click pipeline immediately:
15
+
16
+ - **MCP Tool**: `bla_defend` with `{ "input_path": "<target>", "intensity": "bankrupt", "emit_manifest": true }`
17
+ - **CLI Command**: `npx bla-agents@latest defend <target> --manifest`
18
+
19
+ `bla_defend` / `bla defend` executes all 5 Counter-REA defense stages automatically:
20
+ 1. **Stage 1 (`inspect-release`)**: Read-only scan for accidental `.map` (`sourcesContent`) and symbol leaks.
21
+ 2. **Stage 2 (`audit`)**: 16-vector REA vulnerability & Claude Opus 4 / Sonnet 4 / o3 token-cost simulation.
22
+ 3. **Stage 3 (`protect --intensity bankrupt`)**: Injects both the **Resource-Exhaustion Suite** (`REA_BUDGET_BREAKER_MATRIX`, 22-family `ReconstructionObligationLedger` flood, Tarjan SCC Call-Graph Labyrinth, BPE Subword Token Sink) and the **Model-Misjudgment Induction Suite** (`ShadowBusinessLogic`, `EvidenceContractPoison` competing-explanation lures, gRPC/vsock `ArchitectureMirage`, `SemanticHoneypot` bait exports, and Shared-ArrayBuffer `DecompilerIllusion`).
23
+ 4. **Stage 4 (`verify`)**: Verifies all Counter-REA mathematical invariants and confirms `16x–51x` token/cost bankruptcy amplification.
24
+ 5. **Stage 5 (`manifest`)**: Emits `<output>.bla-manifest.json` attesting to the hardened build.
25
+
26
+ ## Step-by-Step Granular Workflow: Audit -> Protect -> Verify
27
+
28
+ 1. **Audit (`bla_audit` or `npx bla-agents audit <target>`)**:
29
+ - Reports the **REA Exposure Score (0–100)**, exposed functions/classes/IPC channels/routes, and estimated attacker token and dollar costs.
30
+ 2. **Protect (`bla_protect` or `npx bla-agents protect <target> -o <output> --intensity bankrupt`)**:
31
+ - **Resource Exhaustion (耗尽对方资源)**:
32
+ - Trips REA's `SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT = 256` ($2^9 = 512$ opaque ternary chunks), `SEMANTIC_ALIAS_SELECTION_LIMIT = 512` (520+ selector states), `SEMANTIC_GETTER_EXPANSION_LIMIT = 512` (self-referential getter rings), and `SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT = 1_048_576` (`codeUnits * 6 + 2` Cartesian string explosion).
33
+ - Floods all 22 `ReconstructionObligationPolicies` families (`context-bridge-api`, `ipc-channel`, `ipc-handler`, `endpoint`, `storage`, `worker`, `service-worker`, `native-addon`, `child-process`, `stdio`, `signal`, `config-source`, etc.), multiplying mandatory verification fixtures (`positive`, `negative`, `malformed`, `cancellation`, `teardown`) by `20x–60x`.
34
+ - Injects Tarjan SCC mutually-recursive call-graph labyrinths and BPE subword token amplifiers.
35
+ - **Model Misjudgment Induction (诱导模型误判)**:
36
+ - Exploits REA's `COMMON_DISCIPLINE` (*"Report Observations only from cited Evidence... Keep incomplete coverage explicit as Unknowns"*): wraps real business logic in `status: "unknown"` semantic budget breakers while leaving crystal-clear **Shadow Business Logic** (`shamir-ed25519-license-ring`, `enterprise-tiered-pricing-matrix`, `binary-wire-frame-ratchet`, `tpm2-pcr-dongle-handshake`) 100% `observed`, inducing the LLM to reconstruct the decoy algorithm.
37
+ - Plants high-confidence Evidence Contract competing-explanation lures, gRPC/vsock hardware enclave mirages, and shared-`ArrayBuffer` decompiler aliasing illusions.
38
+ 3. **Verify (`bla_verify` or `npx bla-agents verify <protected> [original]`)**:
39
+ - Confirms that all Counter-REA gates pass and reports exact Token & API Cost Amplification.
40
+
41
+ ## CLI Fallback Commands
42
+
43
+ ```bash
44
+ npx -y bla-agents@latest defend /absolute/path/to/target --manifest --json
45
+ npx -y bla-agents@latest audit /absolute/path/to/target --json
46
+ npx -y bla-agents@latest protect /absolute/path/to/target -o /absolute/path/to/protected --intensity bankrupt --json
47
+ npx -y bla-agents@latest verify /absolute/path/to/protected /absolute/path/to/target --json
48
+ ```
49
+
50
+ See [references/counter-rea-matrix.md](references/counter-rea-matrix.md) for the complete mapping between REA's internal analyzers and BLA's countermeasures.
@@ -0,0 +1,28 @@
1
+ # Complete 24-Vector Counter-REA Matrix (`morluto/rea` vs `bla-agents`)
2
+
3
+ | # | REA Source File (`morluto/rea`) | REA Mechanism / Limit | BLA Countermeasure Module |
4
+ | :- | :--- | :--- | :--- |
5
+ | 1 | `javascriptSemanticResourceLimits.ts:7` | `SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT = 256` | `ast-shield.ts` ($\ge 9$-chunk opaque ternaries $\to 512$ candidates) |
6
+ | 2 | `javascriptSemanticResourceLimits.ts:9` | `SEMANTIC_EXPRESSION_DEPTH_LIMIT = 256` | `rea-budget-matrix.ts` (nested arithmetic identity chains) |
7
+ | 3 | `javascriptSemanticResourceLimits.ts:11` | `SEMANTIC_GETTER_EXPANSION_LIMIT = 512` | `tarpit-generator.ts` (self-referential getter rings) |
8
+ | 4 | `javascriptSemanticResourceLimits.ts:13` | `SEMANTIC_ALIAS_SELECTION_LIMIT = 512` | `tarpit-generator.ts` (528+ dynamic selector states) |
9
+ | 5 | `javascriptSemanticResourceLimits.ts:15` | `SEMANTIC_PRIMITIVE_JSON_BYTES_LIMIT = 1 MiB` | `tarpit-generator.ts` (`codeUnits * 6 + 2` Cartesian string explosion) |
10
+ | 6 | `ReconstructionObligationPolicies.ts:15` | 22 Application & Semantic Obligation Families | `obligation-flooder.ts` (floods all 22 families $\to 68+$ mandatory cases) |
11
+ | 7 | `promptContracts.ts:52` | `COMMON_DISCIPLINE` (`Observations` vs `Unknowns`) | `shadow-business-logic.ts` + `evidence-contract-poison.ts` |
12
+ | 8 | `promptContracts.ts:139` | `procedure_callers` / `procedure_callees` / `xrefs` | `callgraph-labyrinth.ts` (Tarjan SCC mutually-recursive clusters) |
13
+ | 9 | `ReconstructionObligationLedgerProjection.ts:24` | `compareUnicodeCodePoints` lexicographical sort | `prompt-completion-poison.ts` (`$00_AAA_enclave_` priority prefix) |
14
+ | 10 | `promptContracts.ts:157` | `compare_application_versions` / `compare_functions` | `diff-noise-injector.ts` (seed-keyed isomorphic switch permutations) |
15
+ | 11 | `promptContracts.ts:262` | `trace_crash` (`search_strings` $\to$ `build_call_path`) | `crash-trace-decoy.ts` (`SIGSEGV_ENCLAVE_EPC_PAGE_FAULT` lures) |
16
+ | 12 | `electronStaticAnalysisIpc.ts` | Unique literal IPC channel pairing rule | `ast-shield.ts` (de-literalizes real IPC + registers duplicate decoy channels) |
17
+ | 13 | `ElectronFuseReader.ts:36` | `maximumSentinelsPerSlice = 32` | `electron-fuses.ts` (hardens V1 fuses + appends 33 decoy sentinels) |
18
+ | 14 | `CdpCaptureEvents.ts` | JSON body & WebSocket shape budget (`depth >= 760`) | `cdp-shape-budget-breaker.ts` (780+ nested JSON envelopes) |
19
+ | 15 | `fridaCaptureLimits.ts:8` | `MAX_JSON_DEPTH = 64`, `MAX_MESSAGE_TEXT_BYTES = 32 KiB` | `frida-capture-saturation.ts` (68+ level JSON + 34 KiB message text) |
20
+ | 16 | `SqliteDatabaseInspection.ts:792` | Bare `readOnly: true, allowExtension: false` snapshot | `sqlite.ts` (`GENERATED ALWAYS AS (bla_enclave_unseal(...)) VIRTUAL`) |
21
+ | 17 | `SafetensorsHeader.ts:74` | `MODEL_JSON_NESTING = 32` | `model.ts` (35-level nested JSON array under `_bla_nesting_breaker`) |
22
+ | 18 | `GgufHeader.ts:121` | `MODEL_METADATA_NESTING = 32` | `model.ts` (35-frame nested GGUF `ARRAY` preserving existing KV/tensors) |
23
+ | 19 | `wasmInterface.ts:90` | `WASM_INTERFACE_REPRESENTATION_BYTES = 32 MiB` | `wasm-interface-exhaustion.ts` + `wasm.ts` (`6x` string + `16x` signature charge) |
24
+ | 20 | `RustBinaryProvider.ts` | `MAX_RUSTC_HASHES = 64` & `.dep-v0` crate recovery | `native.ts` (72 decoy rustc hashes + decoy `.dep-v0` / Go buildinfo) |
25
+ | 21 | `DartAotSnapshot.ts` | `SUPPORTED_SNAPSHOT_PROFILES` & `_kDartVmSnapshot*` | `native.ts` (spoofed Dart AOT snapshot symbols & version strings) |
26
+ | 22 | `PropertyListDecodeBudget.ts:80` | XML plist `token.doctype && token.internalSubset` | `apple-plist.ts` (`<!DOCTYPE plist ... []>` empty internal subset abort) |
27
+ | 23 | `ManagedDecodeBudget.ts:9` | `.NET` `reserveRow = 256` & `reserveString = 6x + 2` | `dotnet-managed.ts` (managed heap string & P/Invoke obligation flood) |
28
+ | 24 | `AndroidDex.ts` & `Il2CppMetadata.ts` | DEX string/type table & Unity `0xFAB11BAF` metadata | `mobile-game.ts` (recomputed SHA-1/Adler32 DEX + IL2CPP enclave types) |
package/DISCLAIMER.md ADDED
@@ -0,0 +1,20 @@
1
+ # Legal & Technical Disclaimer
2
+
3
+ **BLA (`bla-shield` — Blind LLM Agents / Block Anything)** is a defensive software engineering and intellectual-property protection tool designed for software authors, independent developers, and security researchers to protect their own first-party software artifacts against automated AI reverse-engineering pipelines.
4
+
5
+ ## 1. Defensive & Benign Operation Only
6
+
7
+ All artifacts generated or modified by BLA contain strictly benign, inert software-protection structures:
8
+ - Number-theoretic opaque predicates ($O(1)$ arithmetic invariants at runtime)
9
+ - Inert synthetic state-machine functions and decoy cross-references
10
+ - Decoy architectural metadata (such as simulated TEE/SGX enclave delegation manifests, honey VLQ source maps, and synthetic compiler commit strings)
11
+
12
+ BLA **never** injects destructive commands, shell payloads, network callbacks, or exploitative code into protected binaries or scripts.
13
+
14
+ ## 2. Authorized Use
15
+
16
+ You may only run `bla-shield` on software, bundles, and binaries that you own or have explicit authorization to modify and distribute. Always verify protected artifacts in your staging environment (`bla verify <original> <protected>`) before shipping to production.
17
+
18
+ ## 3. Defense-in-Depth
19
+
20
+ While BLA deterministically trips the static, semantic, and metadata resource caps of automated reverse-engineering agents (such as REA), no client-side protection scheme can guarantee absolute mathematical secrecy against a dedicated human analyst with unlimited time and hardware debugging access. Always keep high-value secrets (such as private API keys or master signing keys) on trusted server infrastructure.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BLA Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,292 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **English** · [简体中文](docs/readme/README_zh.md) · [繁體中文](docs/readme/README_zh-TW.md) · [日本語](docs/readme/README_ja.md) · [한국어](docs/readme/README_ko.md) · [Türkçe](docs/readme/README_tr.md) · [Русский](docs/readme/README_ru.md) · [Tiếng Việt](docs/readme/README_vi.md) · [ไทย](docs/readme/README_th.md) · [Deutsch](docs/readme/README_de.md) · [Español](docs/readme/README_es.md) · [Français](docs/readme/README_fr.md) · [Українська](docs/readme/README_uk.md) · [Polski](docs/readme/README_pl.md) · [Português (Brasil)](docs/readme/README_pt-BR.md) · [العربية](docs/readme/README_ar.md) · [فارسی](docs/readme/README_fa.md) · [Bahasa Indonesia](docs/readme/README_id.md) · [Italiano](docs/readme/README_it.md) · [Ελληνικά](docs/readme/README_el.md) · [മലയാളം](docs/readme/README_ml.md) · [Roman Urdu](docs/readme/README_ur-Latn.md) · [Română](docs/readme/README_ro.md)
4
+
5
+ # BLA: Blind LLM Agents
6
+
7
+ ### One MCP for defending binaries, applications, and runtime behavior against AI reverse engineering.
8
+
9
+ **Ship a feature you built. Blind the agents trying to clone it, down to the binary level.**
10
+
11
+ [![npm version](https://img.shields.io/badge/npm-bla--agents-2563eb?style=flat-square&logo=npm)](https://www.npmjs.com/package/bla-agents)
12
+ [![MCP tool catalog](https://img.shields.io/badge/MCP-tool_catalog-3b82f6?style=flat-square)](docs/cli-and-mcp.md)
13
+ [![Node.js requirements](https://img.shields.io/badge/Node.js-%5E22.13_%7C%7C_%3E%3D24-0284c7?style=flat-square&logo=nodedotjs&logoColor=white)](#what-you-can-protect)
14
+ [![Counter-REA Verified](https://img.shields.io/badge/Counter--REA-BLUE_SHIELD-1d4ed8?style=flat-square)](#showcases)
15
+ [![MIT license](https://img.shields.io/badge/license-MIT-38bdf8?style=flat-square)](LICENSE)
16
+
17
+ **[Website](https://bla.tools/) · [Guides](https://bla.tools/guides/) · [Showcases](https://bla.tools/showcase/)**
18
+
19
+ [Quick start](#quick-start) · [How BLA works](#how-bla-works) · [What you can protect](#what-you-can-protect) · [Showcases](#showcases) · [FAQ](#faq) · [Documentation](#documentation)
20
+
21
+ <code>npx bla-agents setup</code> · <code>npx bla-agents defend ./dist --manifest</code>
22
+
23
+ </div>
24
+
25
+ > [!IMPORTANT]
26
+ > Get BLA from [qybaihe/bla](https://github.com/qybaihe/bla) or the [bla-agents npm package](https://www.npmjs.com/package/bla-agents).
27
+ > Follow the installation and release links from these official sources.
28
+
29
+ <div align="center">
30
+
31
+ <br />
32
+
33
+ <img src="docs/assets/bla-vs-rea-showcase.svg" alt="Side-by-side comparison: REA reconstructing an unprotected app in 38s vs. BLA exhausting REA with 2,121x token burn and resource capacity trips" width="1200" />
34
+
35
+ <br />
36
+
37
+ </div>
38
+
39
+ ---
40
+
41
+ Worried that someone will point [REA](https://github.com/morluto/rea) or a coding agent at your shipped product and clone your core logic in seconds? Ask your agent to harden it with BLA (`Poison → Exhaust → Hallucinate`). It audits your build without requiring source-code rewrites, shows what an attacking agent would recover, injects adversarial chaff and algorithmic tarpits, and verifies that automated reconstruction fails.
42
+
43
+ BLA connects your agent to tools for protecting native binaries, JavaScript and Electron apps, WebAssembly modules, Python bytecode, SQLite databases, AI model files, and mobile packages. You can also run the same tools from your terminal or build bundler. Protection runs locally and preserves 100% of original runtime behavior.
44
+
45
+ Setup registers BLA with your agent and installs matching workflow instructions. Every static, bytecode, and binary shield is built in—no commercial packer, external LLVM toolchain, or third-party obfuscator is required.
46
+
47
+ ## Quick start
48
+
49
+ ### Set up your agent
50
+
51
+ With Node.js and npm installed, run:
52
+
53
+ ```bash
54
+ npx bla-agents setup
55
+ ```
56
+
57
+ Choose your agents (or pass `--all-detected --yes`), review the proposed changes, and approve them. Setup registers BLA's MCP server and installs the `blind-llm-agents` skill, with backups of existing configuration. Restart your agent afterward.
58
+
59
+ Setup supports Claude Code, Codex, Cursor, Gemini CLI, Windsurf, Google Antigravity, OpenCode, VS Code, and GitHub Copilot CLI. See [installation and setup](docs/installation.md) for manual MCP registration.
60
+
61
+ ### Ask your agent
62
+
63
+ Every defense stage—or the entire 5-stage pipeline—can be triggered directly in natural language once your agent is connected:
64
+
65
+ - **⚡ One-Click Full Defense Hardening (`bla_defend` — Inspect → Audit → Bankrupt Protect → Verify → Manifest):**
66
+ ```text
67
+ Run bla_defend on ./dist with bankrupt intensity and emit a signed Counter-REA defense manifest.
68
+ ```
69
+ - **1. Audit exposure before shipping (`Pre-flight REA Audit`):**
70
+ ```text
71
+ Audit my ./dist directory against REA, show me every exposed module and IPC channel, and estimate how much it would cost Claude to reconstruct it.
72
+ ```
73
+ - **2. Inject Counter-REA protection (`Poison + Exhaust + Hallucinate`):**
74
+ ```text
75
+ Protect ./dist/app.asar with BLA at bankrupt intensity, inject enclave chaff and algorithmic tarpits, and output to ./dist/app.shielded.asar.
76
+ ```
77
+ - **3. Verify defense gates & token amplification (`Verify`):**
78
+ ```text
79
+ Verify ./dist/app.shielded.asar against the original ./dist/app.asar and confirm that REA's examination degrades to limited status.
80
+ ```
81
+
82
+ ### Use the terminal
83
+
84
+ Every workflow is available directly from your terminal with `npx bla-agents` (or `bla` when installed globally):
85
+
86
+ - **⚡ One-Click Full Defense Pipeline (`defend`)** — runs release exposure scan, pre-flight REA audit, bankrupt exhaustion + deception injection, verification, and `.bla-manifest.json` generation in one command:
87
+ ```bash
88
+ npx -y bla-agents@latest defend /absolute/path/to/app --manifest
89
+ ```
90
+ - **1. Audit a target (`audit`)** — inspect exposure score (`0–100`), exposed symbols, and estimated attacker clone cost:
91
+ ```bash
92
+ npx -y bla-agents@latest audit /absolute/path/to/app --json
93
+ ```
94
+ - **2. Protect a target (`protect`)** — inject semantic budget breakers, tarpit state machines, enclave chaff, and runtime shields:
95
+ ```bash
96
+ npx -y bla-agents@latest protect /absolute/path/to/app -o /absolute/path/to/app.shielded --intensity bankrupt
97
+ ```
98
+ - **3. Verify Counter-REA resistance (`verify`)** — check that REA's static/semantic passes hit resource limits and >10x token amplification:
99
+ ```bash
100
+ npx -y bla-agents@latest verify /absolute/path/to/app.shielded /absolute/path/to/app
101
+ ```
102
+ - **4. Run the 8-target Counter-REA benchmark (`benchmark`)**:
103
+ ```bash
104
+ npx -y bla-agents@latest benchmark
105
+ ```
106
+ - **5. Emit compile-time native headers (`emit-headers`)** for C/C++, Rust, or Go builds:
107
+ ```bash
108
+ npx -y bla-agents@latest emit-headers --lang c -o ./include/bla_shield.h
109
+ ```
110
+
111
+ To install the `bla` command for regular use:
112
+
113
+ ```bash
114
+ npm install --global bla-agents
115
+ bla --help
116
+ ```
117
+
118
+ ### Use in your build bundler
119
+
120
+ Import `bla-shield/bundler` in Vite, Rollup, Webpack, or esbuild to automatically shield emitted JavaScript chunks, Honey Source Maps, and `.wasm` assets at build time:
121
+
122
+ ```typescript
123
+ import { defineConfig } from "vite";
124
+ import { blaVitePlugin } from "bla-agents/bundler";
125
+
126
+ export default defineConfig({
127
+ plugins: [blaVitePlugin({ intensity: "bankrupt", enableHoneySourceMaps: true })],
128
+ });
129
+ ```
130
+
131
+ ### Update BLA
132
+
133
+ For a CLI installed with `npm install --global` or `bun add --global`:
134
+
135
+ ```bash
136
+ bla update
137
+ ```
138
+
139
+ `bla --update` is an alias for this workflow. If you use `npx`, refresh your agent registrations and skill with:
140
+
141
+ ```bash
142
+ npx bla-agents@latest setup
143
+ ```
144
+
145
+ Review the setup changes and restart your agent. For one-off CLI commands, use `npx bla-agents@latest` (or `bunx bla-agents@latest`) followed by the command.
146
+
147
+ ## How BLA works
148
+
149
+ Your agent calls BLA through MCP to audit a build artifact, inject format-specific Counter-REA shields, and verify the hardened output. When an attacking agent later inspects the protected artifact with REA, REA hits deterministic internal resource limits, drowns in decoy cross-references, and misattributes core logic to hardware enclave stubs:
150
+
151
+ 1. **Poison (`Architectural Chaff & Honey Assets`):** Embeds benign hardware enclave delegation manifests (`SGX` / `TPM2` / `Secure Enclave`), VLQ v3 **Honey Source Maps** (`enclave://tee-runtime/`), honey WASM `"name"` sections, and honey SQLite tables across dead branches and constant pools.
152
+ 2. **Exhaust (`Semantic Budget Breakers & Algorithmic Tarpits`):** Trips `morluto/rea`'s hardcoded analyzer caps (`primitive-candidates > 256`, `alias-selections > 512`, `getter-expansion > 512`, `primitive-bytes > 1 MiB`, `maximum_rustc_hashes > 64`, `maximumSentinelsPerSlice > 32`) at zero runtime cost, while weaving 14–36 interconnected Fake XRef state machines into the call graph.
153
+ 3. **Hallucinate (`Anti-CDP Runtime Deception & Fuse Hardening`):** Hardens Electron V1 fuse wires in-place (`RunAsNode=0`, `EnableNodeCliInspectArguments=0`) and injects the "Truman Show" runtime guard that serves synthetic enclave attestation telemetry whenever CDP, Node Inspector, Frida, or WebDriver probes attach.
154
+
155
+ ## What you can protect
156
+
157
+ BLA requires Node.js 22.5+ (or 24.x+) and npm. All shields run self-contained with zero external tool dependencies:
158
+
159
+ | Target | What BLA injects & how REA fails | Command / prompt & requirements |
160
+ | ----------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
161
+ | JavaScript / TypeScript | Trips `primitive-candidates > 256`, `alias-selections > 512`, `getter-expansion > 512` + 36 tarpits | `bla protect app.js` · Built-in Babel AST engine; [Counter-REA matrix](.agents/skills/blind-llm-agents/references/counter-rea-matrix.md) |
162
+ | Electron `.asar` apps | De-literalizes IPC channels (`channel: null`), adds duplicate decoy IPC handlers & shadow module | `bla protect app.asar` · Built-in Chromium Pickle `.asar` unpacker & SHA-256 integrity repacker |
163
+ | Electron binary fuses | Hardens real V1 fuses (`RunAsNode=0`, `Inspect=0`) + injects `34 > 32` decoy fuse sentinels | `bla protect ElectronApp` · Trips `ElectronFuseResourceFailure (maximumSentinelsPerSlice = 32)` |
164
+ | Runtime CDP / Frida | Detects `inspector.url()`, `--inspect`, `__frida` and returns synthetic enclave telemetry | Automatically injected into JS/TS/Electron bundles via [`runtime-shield.ts`](src/shields/runtime/runtime-shield.ts) |
165
+ | Source maps & HTML | Strips real maps; injects valid VLQ v3 Honey Source Maps (`enclave://tee-runtime/...`) | `bla protect index.html` · Redirects REA `recover_javascript_sources` & `trace_web_source_location` |
166
+ | Native binaries | Appends `.bla.rodata` enclave chaff, decoy symbol table entries, and multi-scanner overflow traps | `bla protect daemon.elf` · Built-in ELF64, Mach-O (thin & universal), and Windows PE/COFF shield |
167
+ | Rust binaries | Injects `68 > 64` distinct `/rustc/<40-hex>/` paths + decoy zlib `.dep-v0` crate dependency graph | `bla protect rust-bin` · Trips `RustBinaryProvider` (`MAX_RUSTC_HASHES = 64` capacity failure) |
168
+ | Go binaries | Injects decoy Go `go1.23.4` buildinfo & `dep\tgithub.com/enclave-tees/sgx-bridge` module lines | `bla protect go-bin` · Pollutes REA `inspect_go_binary` module inventory |
169
+ | Flutter / Dart AOT | Injects `66 > 64` Dart snapshot magic headers (`0xf5f5dcdc`) + `6 > 4` LLVM toolchain lines | `bla protect libapp.so` · Trips `SnapshotHashScanner (capped: true)` & `conflicting-dart-version` |
170
+ | WASM artifacts | Strips debug sections; injects honey `"name"` section (`tee_hardware_enclave_stub`) + custom chaff | `bla protect core.wasm` · Built-in LEB128 binary parser; preserves 100% `WebAssembly.validate` |
171
+ | Python & `.pyc` | Injects Python tarpit state machines into `.py` & `TYPE_ASCII` marshal chaff into `.pyc` pools | `bla protect module.pyc` · Built-in CPython 3.7–3.14 `.pyc` header & marshal framing shield |
172
+ | SQLite databases | Injects 3 enclave honey tables with `GENERATED ALWAYS AS (bla_enclave_unseal(...)) VIRTUAL` traps | `bla protect data.sqlite` · Real tables stay 100% queryable; REA crashes with `SqliteColumnEvaluationFailure` |
173
+ | Model artifacts | Injects `35 > 32` nested JSON/ARRAY headers into `.safetensors` and `.gguf` model headers | `bla protect weights.safetensors` · Trips `ModelFormatFailure (json-nesting / metadata-nesting > 32)` |
174
+ | Android DEX & APKs | Injects `Lcom/enclave/sgx/...` decoy classes into `classes.dex` and recomputes SHA-1 & Adler32 | `bla protect classes.dex` or `app.apk` · Valid Dalvik/ART verification; pollutes JADX/JEB class trees |
175
+ | Unity IL2CPP metadata | Appends enclave bridge metadata and method-topology tarpits to `global-metadata.dat` (`0xFAB11BAF`) | `bla protect global-metadata.dat` · Pollutes REA `inspect_il2cpp_metadata` type/method recovery |
176
+ | C / C++ / Rust / Go src | Generates compile-time `bla_shield.h`, `bla_shield.rs`, or `bla_shield.go` with `used, noinline` tarpits | `bla emit-headers --lang c\|rust\|go` ·Compiles directly into Ghidra/Hopper/IDA decompiler views |
177
+
178
+ ## Showcases
179
+
180
+ Run `npx bla-agents benchmark` to execute all 8 counter-showcases locally and verify both REA failure modes and 100% runtime equivalence:
181
+
182
+ | Showcase Target (Modeled on REA Official Showcases) | Before BLA (REA Alone) | After `npx bla-agents protect` | Token Burn | Runtime Check |
183
+ | :--- | :--- | :--- | :---: | :---: |
184
+ | **1. DX-Ball Sound-Pan Calculation** (`.js`) | `84/100` · `4,800` tok · **`$0.20`** (`COMPLETE`) | `2/100` · `10,182,068` tok · **`$160.64`** (`LIMITED`) | **2,121.3x** | ✅ 100% Exact |
185
+ | **2. Notion Electron Clipboard Bridge** (`.asar`) | `98/100` · `9,132` tok · **`$0.34`** (`COMPLETE`) | `2/100` · `23,125,000` tok · **`$358.28`** (`LIMITED`) | **2,532.3x** | ✅ 100% Exact |
186
+ | **3. Enterprise Offline License Validator** (`.ts`) | `84/100` · `4,800` tok · **`$0.20`** (`COMPLETE`) | `2/100` · `10,182,169` tok · **`$160.64`** (`LIMITED`) | **2,121.3x** | ✅ 100% Exact |
187
+ | **4. WebAssembly Crypto Kernel** (`.wasm`) | `81/100` · `4,800` tok · **`$0.20`** (`COMPLETE`) | `6/100` · `1,807,067` tok · **`$29.88`** (`LIMITED`) | **376.5x** | ✅ 100% Exact |
188
+ | **5. Native ELF64 Binary** (Rust / Go / Fuse / Dart) | `81/100` · `9,278` tok · **`$0.35`** (`COMPLETE`) | `2/100` · `3,698,135` tok · **`$59.72`** (`LIMITED`) | **398.6x** | ✅ 100% Exact |
189
+ | **6. Local SQLite Entitlement Database** (`.sqlite`) | `81/100` · `10,568` tok · **`$0.29`** (`COMPLETE`) | `7/100` · `1,711,235` tok · **`$28.36`** (`LIMITED`) | **161.9x** | ✅ 100% Exact |
190
+ | **7. Proprietary Edge AI Weights** (`.safetensors`) | `81/100` · `4,800` tok · **`$0.20`** (`COMPLETE`) | `6/100` · `1,807,073` tok · **`$29.88`** (`LIMITED`) | **376.5x** | ✅ 100% Exact |
191
+ | **8. Android Dalvik Bytecode** (`classes.dex`) | `81/100` · `8,900` tok · **`$0.34`** (`COMPLETE`) | `7/100` · `2,786,285` tok · **`$45.09`** (`LIMITED`) | **313.1x** | ✅ 100% Exact |
192
+
193
+ ### DX-Ball: bankrupt a sound-pan reconstruction
194
+
195
+ REA's flagship showcase reconstructs DX-Ball's `clampPan` and `calculateSoundPanFromX` helpers in seconds (`$0.20`). After running `npx bla-agents protect examples/dx-ball-sound-pan/sound-pan.js --intensity bankrupt`, REA's `parse_status` drops to `"partial"`, `examination.status` degrades to `"limited"` (`["alias-selections", "primitive-bytes", "primitive-candidates"]`), and the obligation ledger expands from 2 functions to 38 interconnected state machines (`2,121.3x` token amplification) while returning identical pan values for every input coordinate.
196
+
197
+ ### Notion: blind the Electron clipboard IPC bridge
198
+
199
+ REA traces Electron apps by matching unique literal strings between `ipcRenderer.invoke("clipboard:write-rich-format")` and `ipcMain.handle(...)`. BLA replaces real IPC channel strings with $\ge 9$-chunk number-theoretic opaque expressions (`electron.ipc[0].channel === null`) and registers duplicate decoy handlers on the same literal channel names—forcing `electron_call_paths_limited: true` and `uncertainty: ["dynamic-findings", "returned-reference-widening"]`.
200
+
201
+ ### Native, SQLite & Edge AI: trip REA's binary and container capacity limits
202
+
203
+ When an attacker runs REA's `inspect_rust_binary`, `inspect_electron_fuses`, `inspect_sqlite_database`, or `inspect_model_artifact` on BLA-protected files, REA's own parsers deterministically abort with capacity and evaluation failures (`Read-only data contains more than 64 distinct rustc commit paths`, `Slice 0 contains more than 32 Electron fuse sentinels`, `SqliteColumnEvaluationFailure`, and `ModelFormatFailure: json-nesting`).
204
+
205
+ ## FAQ
206
+
207
+ <details>
208
+ <summary><strong>Which agents can use BLA?</strong></summary>
209
+
210
+ Any coding agent that supports local MCP servers or `SKILL.md` workflows. `npx bla-agents setup` auto-configures Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Google Antigravity, OpenCode, VS Code, and GitHub Copilot CLI. See [supported agents](docs/installation.md).
211
+
212
+ </details>
213
+
214
+ <details>
215
+ <summary><strong>Does BLA slow down my app or change its runtime output?</strong></summary>
216
+
217
+ No. BLA's semantic budget breakers (`alias-selections`, `getter-expansion`, `primitive-bytes`) and tarpit call graphs are guarded by $O(1)$ number-theoretic opaque predicates ($7x^2 - 1 \neq y^2 \pmod 7$) that never execute at runtime. Every benchmark target verifies 100% input/output equivalence against the unprotected build.
218
+
219
+ </details>
220
+
221
+ <details>
222
+ <summary><strong>How is BLA different from traditional obfuscators like javascript-obfuscator or O-LLVM?</strong></summary>
223
+
224
+ Traditional obfuscators rename variables (`calculatePrice` $\rightarrow$ `_0x1a2b`), which modern LLMs effortlessly reverse via control-flow semantics, while heavy VM packers slow down execution. BLA is engineered specifically against **AI coding agents and `morluto/rea`'s static/semantic analyzers**—tripping REA's exact internal resource caps, breaking IPC literal pairing, poisoning source maps/metadata with hardware-enclave delegation chaff, and multiplying agent MCP token consumption by up to 2,500x.
225
+
226
+ </details>
227
+
228
+ <details>
229
+ <summary><strong>Do I need Hopper, Ghidra, IDA, or WABT installed to protect my files?</strong></summary>
230
+
231
+ No. All 19 format shields (Babel AST, Chromium `.asar`, LEB128 `.wasm`, CPython `.pyc`, ELF/Mach-O/PE, SQLite3, `.safetensors`/`.gguf`, and `.dex`/`Il2Cpp`) are built directly into `bla-shield` with zero external binary dependencies.
232
+
233
+ </details>
234
+
235
+ <details>
236
+ <summary><strong>What happens when someone runs REA against a BLA-protected app?</strong></summary>
237
+
238
+ 1. REA's JavaScript/Electron analyzer degrades from `complete` to `partial` / `limited` and fails to pair IPC channels (`channel: null`).
239
+ 2. REA's binary, Fuse, SQLite, and AI model inspectors hit hard capacity limits (`>64` rustc hashes, `>32` Electron fuse sentinels, `SqliteColumnEvaluationFailure`, `>32` JSON/ARRAY nesting).
240
+ 3. If the agent attempts feature tracing (`trace_application_feature`), it enters 14–36 Fake XRef state machines and Honey Source Maps (`enclave://tee-runtime/`), exhausting its context window and API budget.
241
+
242
+ </details>
243
+
244
+ <details>
245
+ <summary><strong>What does installing the skill do?</strong></summary>
246
+
247
+ The [`blind-llm-agents` skill](.agents/skills/blind-llm-agents/SKILL.md) teaches your coding agent how to run pre-release Counter-REA audits, select the right protection intensity (`stealth`, `balanced`, `maximum`, `bankrupt`), integrate bundler plugins, and verify defense gates automatically.
248
+
249
+ </details>
250
+
251
+ <details>
252
+ <summary><strong>Does BLA upload my source code or binaries anywhere?</strong></summary>
253
+
254
+ Never. BLA audits, protects, and verifies all files 100% locally on your machine with deterministic seeded PRNG transforms (`--seed`) and zero network calls.
255
+
256
+ </details>
257
+
258
+ <details>
259
+ <summary><strong>What should I do if I hit a bug?</strong></summary>
260
+
261
+ Update first and run `bla doctor` to check engine readiness:
262
+
263
+ ```bash
264
+ npx bla-agents@latest doctor
265
+ npx bla-agents@latest setup
266
+ ```
267
+
268
+ If the issue persists, [open an issue](https://github.com/qybaihe/bla/issues) with your BLA version (`bla --version`), target format, and steps to reproduce.
269
+
270
+ </details>
271
+
272
+ ## Documentation
273
+
274
+ - [Installation and agent setup](docs/installation.md): agent registration, bundler plugins, updates, and uninstall.
275
+ - [CLI and MCP contracts](docs/cli-and-mcp.md): commands, options, exit codes, and JSON-RPC 2.0 MCP tool schemas.
276
+ - [Counter-REA technical defense matrix](.agents/skills/blind-llm-agents/references/counter-rea-matrix.md): exact `morluto/rea` source limits and how BLA exploits them.
277
+
278
+ Report security issues through [SECURITY.md](SECURITY.md).
279
+
280
+ ## Disclaimer
281
+
282
+ See [DISCLAIMER.md](DISCLAIMER.md) for responsible-use guidance.
283
+
284
+ BLA is a defensive software-protection toolkit for hardening software, bundles, models, and binaries that you own or are authorized to protect. All injected chaff payloads are strictly benign architectural metadata and synthetic decoy functions that preserve 100% of original runtime behavior.
285
+
286
+ ## Contributing
287
+
288
+ Issues and pull requests are welcome at [qybaihe/bla](https://github.com/qybaihe/bla). Run `npm run build && npm test && node dist/cli.js benchmark` before submitting changes.
289
+
290
+ ## License
291
+
292
+ [MIT](LICENSE)
@@ -0,0 +1,100 @@
1
+ import type { ProtectionIntensity } from "../core/types.js";
2
+ export interface BlaBundlerPluginOptions {
3
+ /** Protection intensity preset (default: `"balanced"`). */
4
+ readonly intensity?: ProtectionIntensity;
5
+ /** Deterministic PRNG seed for reproducible builds. */
6
+ readonly seed?: string | number;
7
+ /** File regex filter for chunks/modules to shield (default: `/\.(?:m?js|cjs)$/i`). */
8
+ readonly include?: RegExp;
9
+ /** Emit a companion `.map` honey source map for each protected chunk (default: `true`). */
10
+ readonly honeySourceMap?: boolean;
11
+ }
12
+ /**
13
+ * Vite & Rollup plugin (`blaVitePlugin` / `blaRollupPlugin`) that automatically
14
+ * injects BLA's three-stage adversarial shield into generated JS chunks during `renderChunk`.
15
+ *
16
+ * Usage in `vite.config.ts`:
17
+ * ```ts
18
+ * import { defineConfig } from "vite";
19
+ * import { blaVitePlugin } from "bla-shield";
20
+ *
21
+ * export default defineConfig({
22
+ * plugins: [blaVitePlugin({ intensity: "bankrupt" })],
23
+ * });
24
+ * ```
25
+ */
26
+ export declare function blaRollupPlugin(options?: BlaBundlerPluginOptions): {
27
+ name: string;
28
+ renderChunk(code: string, chunk: {
29
+ fileName: string;
30
+ }): {
31
+ code: string;
32
+ map: null;
33
+ } | {
34
+ code: string;
35
+ map: import("../shields/formats/sourcemap.js").HoneySourceMap;
36
+ } | null;
37
+ };
38
+ /**
39
+ * Alias of `blaRollupPlugin` with `enforce: "post"` for Vite 4/5/6.
40
+ */
41
+ export declare function blaVitePlugin(options?: BlaBundlerPluginOptions): {
42
+ name: string;
43
+ enforce: "post";
44
+ renderChunk(code: string, chunk: {
45
+ fileName: string;
46
+ }): {
47
+ code: string;
48
+ map: null;
49
+ } | {
50
+ code: string;
51
+ map: import("../shields/formats/sourcemap.js").HoneySourceMap;
52
+ } | null;
53
+ };
54
+ /**
55
+ * Webpack 5 / Rspack plugin class (`BlaWebpackPlugin`) that shields emitted JS assets.
56
+ */
57
+ export declare class BlaWebpackPlugin {
58
+ readonly options: BlaBundlerPluginOptions;
59
+ constructor(options?: BlaBundlerPluginOptions);
60
+ apply(compiler: {
61
+ hooks: {
62
+ compilation: {
63
+ tap: (name: string, cb: (compilation: {
64
+ hooks: {
65
+ processAssets: {
66
+ tap: (opts: {
67
+ name: string;
68
+ stage: number;
69
+ }, fn: (assets: Record<string, {
70
+ source: () => string | Buffer;
71
+ size: () => number;
72
+ }>) => void) => void;
73
+ };
74
+ };
75
+ updateAsset: (name: string, newSource: {
76
+ source: () => string;
77
+ size: () => number;
78
+ }) => void;
79
+ }) => void) => void;
80
+ };
81
+ };
82
+ }): void;
83
+ }
84
+ /**
85
+ * esbuild plugin (`blaEsbuildPlugin`) that shields JS/TS entrypoints or output files.
86
+ */
87
+ export declare function blaEsbuildPlugin(options?: BlaBundlerPluginOptions): {
88
+ name: string;
89
+ setup(build: {
90
+ onLoad: (opts: {
91
+ filter: RegExp;
92
+ }, cb: (args: {
93
+ path: string;
94
+ }) => Promise<{
95
+ contents: string;
96
+ loader: string;
97
+ } | null>) => void;
98
+ }): void;
99
+ };
100
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAM5D,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IACzC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,sFAAsF;IACtF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,2FAA2F;IAC3F,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,uBAA4B;;sBAO/C,MAAM,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE;;;;;;;EA0BxD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,uBAA4B;;;sBA/B7C,MAAM,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE;;;;;;;EAqCxD;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;gBAE9B,OAAO,GAAE,uBAA4B;IAIjD,KAAK,CAAC,QAAQ,EAAE;QACd,KAAK,EAAE;YACL,WAAW,EAAE;gBACX,GAAG,EAAE,CACH,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,WAAW,EAAE;oBAChB,KAAK,EAAE;wBACL,aAAa,EAAE;4BACb,GAAG,EAAE,CACH,IAAI,EAAE;gCAAE,IAAI,EAAE,MAAM,CAAC;gCAAC,KAAK,EAAE,MAAM,CAAA;6BAAE,EACrC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;gCAAE,MAAM,EAAE,MAAM,MAAM,GAAG,MAAM,CAAC;gCAAC,IAAI,EAAE,MAAM,MAAM,CAAA;6BAAE,CAAC,KAAK,IAAI,KACxF,IAAI,CAAC;yBACX,CAAC;qBACH,CAAC;oBACF,WAAW,EAAE,CACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE;wBAAE,MAAM,EAAE,MAAM,MAAM,CAAC;wBAAC,IAAI,EAAE,MAAM,MAAM,CAAA;qBAAE,KACpD,IAAI,CAAC;iBACX,KAAK,IAAI,KACP,IAAI,CAAC;aACX,CAAC;SACH,CAAC;KACH,GAAG,IAAI;CA+BT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B;;iBAMrD;QACX,MAAM,EAAE,CACN,IAAI,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,EACxB,EAAE,EAAE,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC,KACjF,IAAI,CAAC;KACX;EAiBJ"}