@claude-flow/cli 3.32.26 → 3.32.30

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 (403) hide show
  1. package/.claude/helpers/.helpers-version +1 -1
  2. package/.claude/helpers/helpers.manifest.json +2 -2
  3. package/catalog-manifest.json +4 -4
  4. package/dist/src/commands/index.d.ts +1 -0
  5. package/dist/src/commands/index.js +5 -3
  6. package/dist/src/commands/memory.js +49 -5
  7. package/dist/src/commands/metaharness.js +25 -5
  8. package/dist/src/commands/policy.d.ts +4 -0
  9. package/dist/src/commands/policy.js +107 -0
  10. package/dist/src/index.js +18 -0
  11. package/dist/src/init/claudemd-generator.js +53 -2
  12. package/dist/src/mcp-client.js +25 -1
  13. package/dist/src/mcp-tools/capability-brain.d.ts +134 -0
  14. package/dist/src/mcp-tools/capability-brain.js +697 -0
  15. package/dist/src/mcp-tools/guidance-tools.d.ts +2 -0
  16. package/dist/src/mcp-tools/guidance-tools.js +369 -37
  17. package/dist/src/mcp-tools/index.d.ts +4 -1
  18. package/dist/src/mcp-tools/index.js +3 -1
  19. package/dist/src/mcp-tools/memory-tools.js +26 -0
  20. package/dist/src/mcp-tools/metaharness-tools.js +27 -1
  21. package/dist/src/mcp-tools/policy-tools.d.ts +3 -0
  22. package/dist/src/mcp-tools/policy-tools.js +121 -0
  23. package/dist/src/memory/memory-bridge.d.ts +11 -0
  24. package/dist/src/memory/memory-bridge.js +100 -21
  25. package/dist/src/memory/memory-initializer.d.ts +22 -1
  26. package/dist/src/memory/memory-initializer.js +184 -39
  27. package/dist/src/services/bounded-worker-pool.d.ts +28 -0
  28. package/dist/src/services/bounded-worker-pool.js +90 -0
  29. package/dist/src/services/harness-flywheel-runtime.d.ts +2 -0
  30. package/dist/src/services/harness-flywheel-runtime.js +18 -0
  31. package/dist/src/services/harness-flywheel.d.ts +4 -1
  32. package/dist/src/services/harness-flywheel.js +27 -6
  33. package/dist/src/services/policy-runtime.d.ts +38 -0
  34. package/dist/src/services/policy-runtime.js +340 -0
  35. package/node_modules/@claude-flow/codex/.agents/skills/memory-management/SKILL.md +45 -0
  36. package/node_modules/@claude-flow/codex/.agents/skills/security-audit/SKILL.md +46 -0
  37. package/node_modules/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md +46 -0
  38. package/node_modules/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md +53 -0
  39. package/node_modules/@claude-flow/codex/README.md +1044 -0
  40. package/node_modules/@claude-flow/codex/dist/cli.d.ts +9 -0
  41. package/node_modules/@claude-flow/codex/dist/cli.d.ts.map +1 -0
  42. package/node_modules/@claude-flow/codex/dist/cli.js +686 -0
  43. package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -0
  44. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +17 -0
  45. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -0
  46. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +278 -0
  47. package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -0
  48. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts +8 -0
  49. package/node_modules/@claude-flow/codex/dist/dual-mode/index.d.ts.map +1 -0
  50. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js +7 -0
  51. package/node_modules/@claude-flow/codex/dist/dual-mode/index.js.map +1 -0
  52. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +143 -0
  53. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -0
  54. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +621 -0
  55. package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -0
  56. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts +12 -0
  57. package/node_modules/@claude-flow/codex/dist/generators/agents-md.d.ts.map +1 -0
  58. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js +730 -0
  59. package/node_modules/@claude-flow/codex/dist/generators/agents-md.js.map +1 -0
  60. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts +74 -0
  61. package/node_modules/@claude-flow/codex/dist/generators/config-toml.d.ts.map +1 -0
  62. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js +922 -0
  63. package/node_modules/@claude-flow/codex/dist/generators/config-toml.js.map +1 -0
  64. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts +9 -0
  65. package/node_modules/@claude-flow/codex/dist/generators/index.d.ts.map +1 -0
  66. package/node_modules/@claude-flow/codex/dist/generators/index.js +9 -0
  67. package/node_modules/@claude-flow/codex/dist/generators/index.js.map +1 -0
  68. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +20 -0
  69. package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -0
  70. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +951 -0
  71. package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -0
  72. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts +46 -0
  73. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.d.ts.map +1 -0
  74. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js +126 -0
  75. package/node_modules/@claude-flow/codex/dist/harness/build-evidence.js.map +1 -0
  76. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts +153 -0
  77. package/node_modules/@claude-flow/codex/dist/harness/contract.d.ts.map +1 -0
  78. package/node_modules/@claude-flow/codex/dist/harness/contract.js +44 -0
  79. package/node_modules/@claude-flow/codex/dist/harness/contract.js.map +1 -0
  80. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts +33 -0
  81. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.d.ts.map +1 -0
  82. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js +175 -0
  83. package/node_modules/@claude-flow/codex/dist/harness/in-memory-fenced-lease-reference.js.map +1 -0
  84. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts +42 -0
  85. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.d.ts.map +1 -0
  86. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js +140 -0
  87. package/node_modules/@claude-flow/codex/dist/harness/in-memory-inbox-reference.js.map +1 -0
  88. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts +19 -0
  89. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.d.ts.map +1 -0
  90. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js +79 -0
  91. package/node_modules/@claude-flow/codex/dist/harness/in-memory-run-receipt-reference.js.map +1 -0
  92. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts +9 -0
  93. package/node_modules/@claude-flow/codex/dist/harness/index.d.ts.map +1 -0
  94. package/node_modules/@claude-flow/codex/dist/harness/index.js +9 -0
  95. package/node_modules/@claude-flow/codex/dist/harness/index.js.map +1 -0
  96. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts +8 -0
  97. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.d.ts.map +1 -0
  98. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js +10 -0
  99. package/node_modules/@claude-flow/codex/dist/harness/portable-case-fold.js.map +1 -0
  100. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts +68 -0
  101. package/node_modules/@claude-flow/codex/dist/harness/repository-state.d.ts.map +1 -0
  102. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js +403 -0
  103. package/node_modules/@claude-flow/codex/dist/harness/repository-state.js.map +1 -0
  104. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts +3 -0
  105. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.d.ts.map +1 -0
  106. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js +14 -0
  107. package/node_modules/@claude-flow/codex/dist/harness/unsigned-integer.js.map +1 -0
  108. package/node_modules/@claude-flow/codex/dist/index.d.ts +53 -0
  109. package/node_modules/@claude-flow/codex/dist/index.d.ts.map +1 -0
  110. package/node_modules/@claude-flow/codex/dist/index.js +54 -0
  111. package/node_modules/@claude-flow/codex/dist/index.js.map +1 -0
  112. package/node_modules/@claude-flow/codex/dist/initializer.d.ts +98 -0
  113. package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -0
  114. package/node_modules/@claude-flow/codex/dist/initializer.js +795 -0
  115. package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -0
  116. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts +3 -0
  117. package/node_modules/@claude-flow/codex/dist/loop/cli.d.ts.map +1 -0
  118. package/node_modules/@claude-flow/codex/dist/loop/cli.js +123 -0
  119. package/node_modules/@claude-flow/codex/dist/loop/cli.js.map +1 -0
  120. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts +58 -0
  121. package/node_modules/@claude-flow/codex/dist/loop/index.d.ts.map +1 -0
  122. package/node_modules/@claude-flow/codex/dist/loop/index.js +230 -0
  123. package/node_modules/@claude-flow/codex/dist/loop/index.js.map +1 -0
  124. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts +28 -0
  125. package/node_modules/@claude-flow/codex/dist/mcp-config.d.ts.map +1 -0
  126. package/node_modules/@claude-flow/codex/dist/mcp-config.js +121 -0
  127. package/node_modules/@claude-flow/codex/dist/mcp-config.js.map +1 -0
  128. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts +114 -0
  129. package/node_modules/@claude-flow/codex/dist/migrations/index.d.ts.map +1 -0
  130. package/node_modules/@claude-flow/codex/dist/migrations/index.js +880 -0
  131. package/node_modules/@claude-flow/codex/dist/migrations/index.js.map +1 -0
  132. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts +92 -0
  133. package/node_modules/@claude-flow/codex/dist/templates/index.d.ts.map +1 -0
  134. package/node_modules/@claude-flow/codex/dist/templates/index.js +284 -0
  135. package/node_modules/@claude-flow/codex/dist/templates/index.js.map +1 -0
  136. package/node_modules/@claude-flow/codex/dist/types.d.ts +240 -0
  137. package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -0
  138. package/node_modules/@claude-flow/codex/dist/types.js +8 -0
  139. package/node_modules/@claude-flow/codex/dist/types.js.map +1 -0
  140. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts +42 -0
  141. package/node_modules/@claude-flow/codex/dist/validators/index.d.ts.map +1 -0
  142. package/node_modules/@claude-flow/codex/dist/validators/index.js +929 -0
  143. package/node_modules/@claude-flow/codex/dist/validators/index.js.map +1 -0
  144. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts +37 -0
  145. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.d.ts.map +1 -0
  146. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js +137 -0
  147. package/node_modules/@claude-flow/codex/dist/worktrees/coordinator.js.map +1 -0
  148. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts +2 -0
  149. package/node_modules/@claude-flow/codex/dist/worktrees/index.d.ts.map +1 -0
  150. package/node_modules/@claude-flow/codex/dist/worktrees/index.js +2 -0
  151. package/node_modules/@claude-flow/codex/dist/worktrees/index.js.map +1 -0
  152. package/node_modules/@claude-flow/codex/package.json +122 -0
  153. package/node_modules/@claude-flow/plugin-agent-federation/README.md +49 -0
  154. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts +130 -0
  155. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.d.ts.map +1 -0
  156. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js +239 -0
  157. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/agent-card.js.map +1 -0
  158. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts +34 -0
  159. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.d.ts.map +1 -0
  160. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js +69 -0
  161. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/consume.js.map +1 -0
  162. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts +46 -0
  163. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.d.ts.map +1 -0
  164. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js +84 -0
  165. package/node_modules/@claude-flow/plugin-agent-federation/dist/a2a/well-known.js.map +1 -0
  166. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts +27 -0
  167. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.d.ts.map +1 -0
  168. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js +46 -0
  169. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/claim-checker.js.map +1 -0
  170. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts +192 -0
  171. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.d.ts.map +1 -0
  172. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js +253 -0
  173. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-breaker-service.js.map +1 -0
  174. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts +211 -0
  175. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.d.ts.map +1 -0
  176. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +501 -0
  177. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -0
  178. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +114 -0
  179. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -0
  180. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +356 -0
  181. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -0
  182. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts +41 -0
  183. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.d.ts.map +1 -0
  184. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js +184 -0
  185. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/policy-engine.js.map +1 -0
  186. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts +150 -0
  187. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.d.ts.map +1 -0
  188. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js +128 -0
  189. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/spend-reporter.js.map +1 -0
  190. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts +74 -0
  191. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.d.ts.map +1 -0
  192. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js +179 -0
  193. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/trust-evaluator.js.map +1 -0
  194. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts +13 -0
  195. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.d.ts.map +1 -0
  196. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +189 -0
  197. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js.map +1 -0
  198. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts +7 -0
  199. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.d.ts.map +1 -0
  200. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js +317 -0
  201. package/node_modules/@claude-flow/plugin-agent-federation/dist/cli-commands.js.map +1 -0
  202. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts +45 -0
  203. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.d.ts.map +1 -0
  204. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js +71 -0
  205. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-envelope.js.map +1 -0
  206. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts +104 -0
  207. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.d.ts.map +1 -0
  208. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js +152 -0
  209. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-node.js.map +1 -0
  210. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts +55 -0
  211. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.d.ts.map +1 -0
  212. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js +105 -0
  213. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/federation-session.js.map +1 -0
  214. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts +17 -0
  215. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.d.ts.map +1 -0
  216. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js +35 -0
  217. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/entities/trust-level.js.map +1 -0
  218. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts +69 -0
  219. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.d.ts.map +1 -0
  220. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js +149 -0
  221. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/audit-service.js.map +1 -0
  222. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts +68 -0
  223. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.d.ts.map +1 -0
  224. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js +161 -0
  225. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/discovery-service.js.map +1 -0
  226. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts +58 -0
  227. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.d.ts.map +1 -0
  228. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js +122 -0
  229. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/handshake-service.js.map +1 -0
  230. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts +65 -0
  231. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.d.ts.map +1 -0
  232. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js +208 -0
  233. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/pii-pipeline-service.js.map +1 -0
  234. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +51 -0
  235. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -0
  236. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +147 -0
  237. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -0
  238. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts +71 -0
  239. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.d.ts.map +1 -0
  240. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js +194 -0
  241. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-firewall-service.js.map +1 -0
  242. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts +156 -0
  243. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.d.ts.map +1 -0
  244. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js +292 -0
  245. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-mesh-service.js.map +1 -0
  246. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts +98 -0
  247. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.d.ts.map +1 -0
  248. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js +122 -0
  249. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/wg-witness-service.js.map +1 -0
  250. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts +89 -0
  251. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.d.ts.map +1 -0
  252. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js +165 -0
  253. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-budget.js.map +1 -0
  254. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts +92 -0
  255. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.d.ts.map +1 -0
  256. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js +100 -0
  257. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/federation-node-state.js.map +1 -0
  258. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts +70 -0
  259. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.d.ts.map +1 -0
  260. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js +104 -0
  261. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/value-objects/wg-config.js.map +1 -0
  262. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts +23 -0
  263. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.d.ts.map +1 -0
  264. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js +24 -0
  265. package/node_modules/@claude-flow/plugin-agent-federation/dist/index.js.map +1 -0
  266. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts +10 -0
  267. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.d.ts.map +1 -0
  268. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js +439 -0
  269. package/node_modules/@claude-flow/plugin-agent-federation/dist/mcp-tools.js.map +1 -0
  270. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts +19 -0
  271. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -0
  272. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +515 -0
  273. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -0
  274. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +72 -0
  275. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -0
  276. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +269 -0
  277. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -0
  278. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts +3 -0
  279. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.d.ts.map +1 -0
  280. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js +3 -0
  281. package/node_modules/@claude-flow/plugin-agent-federation/dist/version.js.map +1 -0
  282. package/node_modules/@claude-flow/plugin-agent-federation/package.json +64 -0
  283. package/node_modules/@claude-flow/security/README.md +292 -0
  284. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts +97 -0
  285. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.d.ts.map +1 -0
  286. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js +537 -0
  287. package/node_modules/@claude-flow/security/dist/CVE-REMEDIATION.js.map +1 -0
  288. package/node_modules/@claude-flow/security/dist/application/index.d.ts +7 -0
  289. package/node_modules/@claude-flow/security/dist/application/index.d.ts.map +1 -0
  290. package/node_modules/@claude-flow/security/dist/application/index.js +7 -0
  291. package/node_modules/@claude-flow/security/dist/application/index.js.map +1 -0
  292. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts +71 -0
  293. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.d.ts.map +1 -0
  294. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js +153 -0
  295. package/node_modules/@claude-flow/security/dist/application/services/security-application-service.js.map +1 -0
  296. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts +148 -0
  297. package/node_modules/@claude-flow/security/dist/authorization/propagator.d.ts.map +1 -0
  298. package/node_modules/@claude-flow/security/dist/authorization/propagator.js +182 -0
  299. package/node_modules/@claude-flow/security/dist/authorization/propagator.js.map +1 -0
  300. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts +176 -0
  301. package/node_modules/@claude-flow/security/dist/credential-generator.d.ts.map +1 -0
  302. package/node_modules/@claude-flow/security/dist/credential-generator.js +272 -0
  303. package/node_modules/@claude-flow/security/dist/credential-generator.js.map +1 -0
  304. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts +68 -0
  305. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.d.ts.map +1 -0
  306. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js +132 -0
  307. package/node_modules/@claude-flow/security/dist/domain/entities/security-context.js.map +1 -0
  308. package/node_modules/@claude-flow/security/dist/domain/index.d.ts +8 -0
  309. package/node_modules/@claude-flow/security/dist/domain/index.d.ts.map +1 -0
  310. package/node_modules/@claude-flow/security/dist/domain/index.js +8 -0
  311. package/node_modules/@claude-flow/security/dist/domain/index.js.map +1 -0
  312. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts +71 -0
  313. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.d.ts.map +1 -0
  314. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js +237 -0
  315. package/node_modules/@claude-flow/security/dist/domain/services/security-domain-service.js.map +1 -0
  316. package/node_modules/@claude-flow/security/dist/index.d.ts +129 -0
  317. package/node_modules/@claude-flow/security/dist/index.d.ts.map +1 -0
  318. package/node_modules/@claude-flow/security/dist/index.js +176 -0
  319. package/node_modules/@claude-flow/security/dist/index.js.map +1 -0
  320. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +306 -0
  321. package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -0
  322. package/node_modules/@claude-flow/security/dist/input-validator.js +393 -0
  323. package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -0
  324. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts +48 -0
  325. package/node_modules/@claude-flow/security/dist/keychain-adapter.d.ts.map +1 -0
  326. package/node_modules/@claude-flow/security/dist/keychain-adapter.js +0 -0
  327. package/node_modules/@claude-flow/security/dist/keychain-adapter.js.map +1 -0
  328. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts +133 -0
  329. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.d.ts.map +1 -0
  330. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js +254 -0
  331. package/node_modules/@claude-flow/security/dist/mcp-composition-inspector.js.map +1 -0
  332. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts +31 -0
  333. package/node_modules/@claude-flow/security/dist/oauth/browser.d.ts.map +1 -0
  334. package/node_modules/@claude-flow/security/dist/oauth/browser.js +55 -0
  335. package/node_modules/@claude-flow/security/dist/oauth/browser.js.map +1 -0
  336. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +37 -0
  337. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -0
  338. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +86 -0
  339. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -0
  340. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts +57 -0
  341. package/node_modules/@claude-flow/security/dist/oauth/client.d.ts.map +1 -0
  342. package/node_modules/@claude-flow/security/dist/oauth/client.js +120 -0
  343. package/node_modules/@claude-flow/security/dist/oauth/client.js.map +1 -0
  344. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts +25 -0
  345. package/node_modules/@claude-flow/security/dist/oauth/pkce.d.ts.map +1 -0
  346. package/node_modules/@claude-flow/security/dist/oauth/pkce.js +36 -0
  347. package/node_modules/@claude-flow/security/dist/oauth/pkce.js.map +1 -0
  348. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts +128 -0
  349. package/node_modules/@claude-flow/security/dist/password-hasher.d.ts.map +1 -0
  350. package/node_modules/@claude-flow/security/dist/password-hasher.js +190 -0
  351. package/node_modules/@claude-flow/security/dist/password-hasher.js.map +1 -0
  352. package/node_modules/@claude-flow/security/dist/path-validator.d.ts +148 -0
  353. package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -0
  354. package/node_modules/@claude-flow/security/dist/path-validator.js +421 -0
  355. package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -0
  356. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts +125 -0
  357. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.d.ts.map +1 -0
  358. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js +186 -0
  359. package/node_modules/@claude-flow/security/dist/plugins/integrity-verifier.js.map +1 -0
  360. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts +5 -0
  361. package/node_modules/@claude-flow/security/dist/policy/canonical.d.ts.map +1 -0
  362. package/node_modules/@claude-flow/security/dist/policy/canonical.js +30 -0
  363. package/node_modules/@claude-flow/security/dist/policy/canonical.js.map +1 -0
  364. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +34 -0
  365. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -0
  366. package/node_modules/@claude-flow/security/dist/policy/engine.js +285 -0
  367. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -0
  368. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts +9 -0
  369. package/node_modules/@claude-flow/security/dist/policy/envelope.d.ts.map +1 -0
  370. package/node_modules/@claude-flow/security/dist/policy/envelope.js +90 -0
  371. package/node_modules/@claude-flow/security/dist/policy/envelope.js.map +1 -0
  372. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts +4 -0
  373. package/node_modules/@claude-flow/security/dist/policy/evaluator.d.ts.map +1 -0
  374. package/node_modules/@claude-flow/security/dist/policy/evaluator.js +119 -0
  375. package/node_modules/@claude-flow/security/dist/policy/evaluator.js.map +1 -0
  376. package/node_modules/@claude-flow/security/dist/policy/index.d.ts +7 -0
  377. package/node_modules/@claude-flow/security/dist/policy/index.d.ts.map +1 -0
  378. package/node_modules/@claude-flow/security/dist/policy/index.js +7 -0
  379. package/node_modules/@claude-flow/security/dist/policy/index.js.map +1 -0
  380. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts +238 -0
  381. package/node_modules/@claude-flow/security/dist/policy/product-plane.d.ts.map +1 -0
  382. package/node_modules/@claude-flow/security/dist/policy/product-plane.js +1022 -0
  383. package/node_modules/@claude-flow/security/dist/policy/product-plane.js.map +1 -0
  384. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +169 -0
  385. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -0
  386. package/node_modules/@claude-flow/security/dist/policy/types.js +2 -0
  387. package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -0
  388. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts +180 -0
  389. package/node_modules/@claude-flow/security/dist/safe-executor.d.ts.map +1 -0
  390. package/node_modules/@claude-flow/security/dist/safe-executor.js +390 -0
  391. package/node_modules/@claude-flow/security/dist/safe-executor.js.map +1 -0
  392. package/node_modules/@claude-flow/security/dist/token-generator.d.ts +224 -0
  393. package/node_modules/@claude-flow/security/dist/token-generator.d.ts.map +1 -0
  394. package/node_modules/@claude-flow/security/dist/token-generator.js +351 -0
  395. package/node_modules/@claude-flow/security/dist/token-generator.js.map +1 -0
  396. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts +126 -0
  397. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.d.ts.map +1 -0
  398. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js +257 -0
  399. package/node_modules/@claude-flow/security/dist/tool-output-guardrail.js.map +1 -0
  400. package/node_modules/@claude-flow/security/package.json +44 -0
  401. package/package.json +44 -12
  402. package/plugins/ruflo-metaharness/scripts/smoke.sh +22 -14
  403. package/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs +3 -1
@@ -0,0 +1,90 @@
1
+ function matches(patterns, value) {
2
+ if (!patterns?.length)
3
+ return true;
4
+ if (!value)
5
+ return false;
6
+ return patterns.some((pattern) => (pattern === '*'
7
+ || pattern === value
8
+ || (pattern.endsWith('*') && value.startsWith(pattern.slice(0, -1)))));
9
+ }
10
+ function subset(child, parent) {
11
+ if (!parent?.length)
12
+ return true;
13
+ if (!child?.length)
14
+ return false;
15
+ return child.every((value) => matches(parent, value));
16
+ }
17
+ export function checkCapabilityEnvelope(action, envelope, now = Date.now()) {
18
+ if (!envelope)
19
+ return { allowed: true };
20
+ if (envelope.expiresAt !== undefined && envelope.expiresAt <= now) {
21
+ return { allowed: false, reason: 'capability-envelope-expired' };
22
+ }
23
+ const checks = [
24
+ [matches(envelope.actions, action.type), 'action-outside-envelope'],
25
+ [matches(envelope.resources, action.resource), 'resource-outside-envelope'],
26
+ [matches(envelope.tools, action.tool), 'tool-outside-envelope'],
27
+ [matches(envelope.servers, action.server), 'server-outside-envelope'],
28
+ [matches(envelope.environments, action.environment), 'environment-outside-envelope'],
29
+ ];
30
+ if (action.namespace) {
31
+ const namespaces = action.type.includes('read')
32
+ ? envelope.readNamespaces
33
+ : envelope.writeNamespaces;
34
+ checks.push([matches(namespaces, action.namespace), 'namespace-outside-envelope']);
35
+ }
36
+ if (action.costUsd !== undefined && envelope.maxCostUsd !== undefined) {
37
+ checks.push([action.costUsd <= envelope.maxCostUsd, 'cost-outside-envelope']);
38
+ }
39
+ if (action.tokens !== undefined && envelope.maxTokens !== undefined) {
40
+ checks.push([action.tokens <= envelope.maxTokens, 'tokens-outside-envelope']);
41
+ }
42
+ if (action.concurrency !== undefined && envelope.maxConcurrency !== undefined) {
43
+ checks.push([action.concurrency <= envelope.maxConcurrency, 'concurrency-outside-envelope']);
44
+ }
45
+ if (action.network === true)
46
+ checks.push([envelope.network === true, 'network-outside-envelope']);
47
+ if (action.destructive === true)
48
+ checks.push([envelope.destructive === true, 'destructive-outside-envelope']);
49
+ const failed = checks.find(([allowed]) => !allowed);
50
+ return failed ? { allowed: false, reason: failed[1] } : { allowed: true };
51
+ }
52
+ export function isEnvelopeReduction(parent, child) {
53
+ const listChecks = [
54
+ subset(child.actions, parent.actions),
55
+ subset(child.resources, parent.resources),
56
+ subset(child.tools, parent.tools),
57
+ subset(child.servers, parent.servers),
58
+ subset(child.readNamespaces, parent.readNamespaces),
59
+ subset(child.writeNamespaces, parent.writeNamespaces),
60
+ subset(child.environments, parent.environments),
61
+ ];
62
+ const numericChecks = [
63
+ [child.maxCostUsd, parent.maxCostUsd],
64
+ [child.maxTokens, parent.maxTokens],
65
+ [child.maxConcurrency, parent.maxConcurrency],
66
+ [child.delegationDepth, parent.delegationDepth],
67
+ [child.expiresAt, parent.expiresAt],
68
+ ];
69
+ return listChecks.every(Boolean)
70
+ && numericChecks.every(([next, current]) => (current === undefined
71
+ ? true
72
+ : next !== undefined && next <= current))
73
+ && !(child.network === true && parent.network !== true)
74
+ && !(child.destructive === true && parent.destructive !== true);
75
+ }
76
+ export function delegateEnvelope(parent, child) {
77
+ if ((parent.delegationDepth ?? 0) <= 0) {
78
+ throw new Error('delegation-depth-exhausted');
79
+ }
80
+ const reduced = {
81
+ ...parent,
82
+ ...child,
83
+ delegationDepth: Math.min(child.delegationDepth ?? Number.MAX_SAFE_INTEGER, (parent.delegationDepth ?? 0) - 1),
84
+ expiresAt: Math.min(child.expiresAt ?? Number.MAX_SAFE_INTEGER, parent.expiresAt ?? Number.MAX_SAFE_INTEGER),
85
+ };
86
+ if (!isEnvelopeReduction(parent, reduced))
87
+ throw new Error('capability-envelope-cannot-grow');
88
+ return reduced;
89
+ }
90
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/policy/envelope.ts"],"names":[],"mappings":"AAOA,SAAS,OAAO,CAAC,QAAuC,EAAE,KAAyB;IACjF,IAAI,CAAC,QAAQ,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAChC,OAAO,KAAK,GAAG;WACZ,OAAO,KAAK,KAAK;WACjB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACrE,CAAC,CAAC;AACL,CAAC;AAED,SAAS,MAAM,CAAC,KAAoC,EAAE,MAAqC;IACzF,IAAI,CAAC,MAAM,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IACjC,IAAI,CAAC,KAAK,EAAE,MAAM;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,MAAoB,EACp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AAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,MAA0B,EAC1B,KAAyB;IAEzB,IAAI,CAAC,MAAM,CAAC,eAAe,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,OAAO,GAAG;QACd,GAAG,MAAM;QACT,GAAG,KAAK;QACR,eAAe,EAAE,IAAI,CAAC,GAAG,CACvB,KAAK,CAAC,eAAe,IAAI,MAAM,CAAC,gBAAgB,EAChD,CAAC,MAAM,CAAC,eAAe,IAAI,CAAC,CAAC,GAAG,CAAC,CAClC;QACD,SAAS,EAAE,IAAI,CAAC,GAAG,CACjB,KAAK,CAAC,SAAS,IAAI,MAAM,CAAC,gBAAgB,EAC1C,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,gBAAgB,CAC5C;KACF,CAAC;IACF,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC9F,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { PolicyDecision, PolicyMode, PolicyRequest, PolicyRule } from './types.js';
2
+ export declare function ruleMatches(rule: PolicyRule, request: PolicyRequest): boolean;
3
+ export declare function evaluatePolicy(request: PolicyRequest, rules: readonly PolicyRule[], mode: PolicyMode, verifiedEvidenceIds?: readonly string[]): Omit<PolicyDecision, 'receiptId'>;
4
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../src/policy/evaluator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,aAAa,EACb,UAAU,EACX,MAAM,YAAY,CAAC;AA0CpB,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAU7E;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,IAAI,EAAE,UAAU,EAChB,mBAAmB,GAAE,SAAS,MAAM,EAAO,GAC1C,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,CA+DnC"}
@@ -0,0 +1,119 @@
1
+ import { checkCapabilityEnvelope } from './envelope.js';
2
+ function matches(patterns, value) {
3
+ if (!patterns?.length)
4
+ return true;
5
+ if (!value)
6
+ return false;
7
+ return patterns.some((pattern) => (pattern === '*'
8
+ || pattern === value
9
+ || (pattern.endsWith('*') && value.startsWith(pattern.slice(0, -1)))));
10
+ }
11
+ function constraintsPass(request, constraints) {
12
+ if (!constraints)
13
+ return true;
14
+ const { action } = request;
15
+ const evidence = request.context?.evidence ?? [];
16
+ const verifiedIds = new Set(request.context?.metadata?.verifiedEvidenceIds instanceof Array
17
+ ? request.context.metadata.verifiedEvidenceIds
18
+ : []);
19
+ const verifiedEvidence = evidence.filter((item) => item.id && verifiedIds.has(item.id));
20
+ if (constraints.maxCostUsd !== undefined
21
+ && (action.costUsd === undefined || action.costUsd > constraints.maxCostUsd))
22
+ return false;
23
+ if (constraints.maxTokens !== undefined
24
+ && (action.tokens === undefined || action.tokens > constraints.maxTokens))
25
+ return false;
26
+ if (constraints.maxConcurrency !== undefined
27
+ && (action.concurrency === undefined || action.concurrency > constraints.maxConcurrency))
28
+ return false;
29
+ if (constraints.network === false && action.network === true)
30
+ return false;
31
+ if (constraints.destructive === false && action.destructive === true)
32
+ return false;
33
+ if (constraints.allowedNamespaces?.length && !matches(constraints.allowedNamespaces, action.namespace))
34
+ return false;
35
+ // Signature verification is performed by the engine's trusted verifier.
36
+ // A caller-authored `signed: true` flag is deliberately ignored.
37
+ if (constraints.requireSignedEvidence && verifiedEvidence.length === 0)
38
+ return false;
39
+ if (constraints.requiredProvenance?.length) {
40
+ const relevant = constraints.requireSignedEvidence ? verifiedEvidence : evidence;
41
+ const available = new Set(relevant.map((item) => item.provenance));
42
+ if (!constraints.requiredProvenance.every((type) => available.has(type)))
43
+ return false;
44
+ }
45
+ return true;
46
+ }
47
+ export function ruleMatches(rule, request) {
48
+ if (rule.enabled === false)
49
+ return false;
50
+ const { identity, action } = request;
51
+ return matches(rule.actions, action.type)
52
+ && matches(rule.resources, action.resource)
53
+ && matches(rule.principals, identity.id)
54
+ && (!rule.identityTypes?.length || rule.identityTypes.includes(identity.type))
55
+ && (!rule.roles?.length || rule.roles.some((role) => identity.roles?.includes(role)))
56
+ && matches(rule.environments, action.environment)
57
+ && constraintsPass(request, rule.constraints);
58
+ }
59
+ export function evaluatePolicy(request, rules, mode, verifiedEvidenceIds = []) {
60
+ const requestId = request.requestId ?? crypto.randomUUID();
61
+ const envelope = checkCapabilityEnvelope(request.action, request.context?.envelope, request.context?.now);
62
+ if (!envelope.allowed) {
63
+ return {
64
+ requestId,
65
+ outcome: 'denied',
66
+ // A capability envelope is delegated authority, not an observation-mode
67
+ // rule. Crossing it is always blocked, including legacy installations.
68
+ enforcedOutcome: 'denied',
69
+ mode,
70
+ reason: envelope.reason ?? 'capability-envelope-denied',
71
+ matchedRules: [],
72
+ obligations: [],
73
+ };
74
+ }
75
+ const verifiedRequest = {
76
+ ...request,
77
+ context: {
78
+ ...request.context,
79
+ metadata: {
80
+ ...request.context?.metadata,
81
+ verifiedEvidenceIds: [...verifiedEvidenceIds],
82
+ },
83
+ },
84
+ };
85
+ const matched = rules
86
+ .filter((rule) => ruleMatches(rule, verifiedRequest))
87
+ .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0) || a.id.localeCompare(b.id));
88
+ const deny = matched.find((rule) => rule.effect === 'deny');
89
+ const approval = matched.find((rule) => rule.effect === 'require_approval');
90
+ const allow = matched.find((rule) => rule.effect === 'allow');
91
+ let outcome;
92
+ let reason;
93
+ if (deny) {
94
+ outcome = 'denied';
95
+ reason = `denied-by:${deny.id}`;
96
+ }
97
+ else if (approval) {
98
+ outcome = 'approval_required';
99
+ reason = `approval-required-by:${approval.id}`;
100
+ }
101
+ else if (allow) {
102
+ outcome = 'allowed';
103
+ reason = `allowed-by:${allow.id}`;
104
+ }
105
+ else {
106
+ outcome = mode === 'legacy' ? 'allowed' : 'denied';
107
+ reason = mode === 'legacy' ? 'legacy-default-allow' : 'default-deny';
108
+ }
109
+ return {
110
+ requestId,
111
+ outcome,
112
+ enforcedOutcome: mode === 'enforce' ? outcome : 'allowed',
113
+ mode,
114
+ reason,
115
+ matchedRules: matched.map((rule) => rule.id),
116
+ obligations: approval ? ['valid-human-approval'] : [],
117
+ };
118
+ }
119
+ //# sourceMappingURL=evaluator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../../src/policy/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AASxD,SAAS,OAAO,CAAC,QAAuC,EAAE,KAAyB;IACjF,IAAI,CAAC,QAAQ,EAAE,MAAM;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAChC,OAAO,KAAK,GAAG;WACZ,OAAO,KAAK,KAAK;WACjB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACrE,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,OAAsB,EAAE,WAA0C;IACzF,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC;IACjD,MAAM,WAAW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S;QACzD,IAAI;QACJ,MAAM;QACN,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAAE;KACtD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './types.js';
2
+ export * from './canonical.js';
3
+ export * from './envelope.js';
4
+ export * from './evaluator.js';
5
+ export * from './engine.js';
6
+ export * from './product-plane.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './types.js';
2
+ export * from './canonical.js';
3
+ export * from './envelope.js';
4
+ export * from './evaluator.js';
5
+ export * from './engine.js';
6
+ export * from './product-plane.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Cognitum product-plane claim federation primitives.
3
+ *
4
+ * This module intentionally contains no grant-verification or domain mutation
5
+ * logic. It validates the portable, reference-only envelope that a local
6
+ * policy enforcement point can evaluate before consulting its authoritative
7
+ * identity, tenancy, and permission stores.
8
+ */
9
+ import { type KeyLike } from 'node:crypto';
10
+ export declare const PRODUCT_ACTION_ENVELOPE_VERSION: "cognitum.action.v1";
11
+ export declare const PRODUCT_ACTIONS: readonly ["dashboard.read", "dashboard.status.read", "inference.invoke", "inference.stream", "usage.read", "pod.spawn", "benchmark.run", "evolution.propose", "evolution.promote", "comms.thread.read", "comms.thread.post", "comms.projection.read", "comms.board.admin", "cog.proposal.create", "cog.proposal.review", "cog.proposal.approve", "cog.instance.acquire", "cog.instance.operate", "cog.deploy", "cog.rollback", "ruview.space.read", "ruview.semantic.publish", "ruview.automation.propose", "ruview.automation.approve", "ruview.device.command", "cognition.route", "cognition.critique", "memory.recall", "memory.propose", "evidence.read", "memory.commit-validated"];
12
+ export type ProductAction = (typeof PRODUCT_ACTIONS)[number];
13
+ export declare const PRODUCT_AUTHORITIES: readonly ["cognitum.control-plane", "cognitum.cog", "meta-llm", "comms", "agentbbs", "ruview.edge", "ruflo.policy", "ruflo.memory"];
14
+ export type ProductAuthority = (typeof PRODUCT_AUTHORITIES)[number];
15
+ export declare const IDENTITY_NAMESPACES: readonly ["cognitum-principal", "firebase-subject", "meta-llm-account", "agentbbs-public-key", "workload", "ruflo-agent", "legacy-principal"];
16
+ export type IdentityNamespace = (typeof IDENTITY_NAMESPACES)[number];
17
+ export declare const TENANT_NAMESPACES: readonly ["cognitum-tenant", "meta-llm-account", "meta-llm-sub-tenant", "comms-tenant", "agentbbs-board", "ruview-space"];
18
+ export type TenantNamespace = (typeof TENANT_NAMESPACES)[number];
19
+ export type PrivacyClass = 'P0' | 'P1' | 'P2' | 'P3';
20
+ export interface NamespacedIdentity {
21
+ namespace: IdentityNamespace;
22
+ id: string;
23
+ }
24
+ export interface NamespacedTenantRef {
25
+ namespace: TenantNamespace;
26
+ id: string;
27
+ }
28
+ export interface AuthoritativeReference {
29
+ authority: ProductAuthority;
30
+ tenantRef: NamespacedTenantRef;
31
+ /**
32
+ * Authority-qualified record kind, for example
33
+ * `meta-llm/inference` or `ruview.edge/semantic-observation`.
34
+ */
35
+ sourceType: string;
36
+ sourceId: string;
37
+ sourceVersion: string;
38
+ sourceDigest: `sha256:${string}`;
39
+ }
40
+ export interface ProductActionEnvelopeV1 {
41
+ schemaVersion: typeof PRODUCT_ACTION_ENVELOPE_VERSION;
42
+ eventId: string;
43
+ issuer: ProductAuthority;
44
+ audience: ProductAuthority;
45
+ subject: NamespacedIdentity;
46
+ actor?: NamespacedIdentity;
47
+ tenantRef: NamespacedTenantRef;
48
+ action: ProductAction;
49
+ resourceRefs: string[];
50
+ requestDigest?: `sha256:${string}`;
51
+ contentDigest?: `sha256:${string}`;
52
+ idempotencyKey?: string;
53
+ correlationId: string;
54
+ causationId?: string;
55
+ authoritativeSource: AuthoritativeReference;
56
+ sequence?: string;
57
+ policyReceiptId: string;
58
+ capabilityId?: string;
59
+ validationReceiptId?: string;
60
+ occurredAt: string;
61
+ expiresAt?: string;
62
+ privacyClass: PrivacyClass;
63
+ }
64
+ export type AvailabilityCheck = 'yes' | 'no' | 'unknown';
65
+ export type IdentityAvailability = 'verified' | 'unverified' | 'invalid' | 'unknown';
66
+ /**
67
+ * Independent integration-health dimensions. In particular, an authorized
68
+ * claim changes only `authorized`; it does not imply configuration,
69
+ * reachability, service health, or verified browser/workload identity.
70
+ */
71
+ export interface ProductAvailabilityDimensions {
72
+ identity: IdentityAvailability;
73
+ configured: AvailabilityCheck;
74
+ reachable: AvailabilityCheck;
75
+ healthy: AvailabilityCheck;
76
+ authorized: AvailabilityCheck;
77
+ }
78
+ export type ProductAvailability = 'available' | 'degraded' | 'blocked' | 'unavailable';
79
+ export declare function classifyProductAvailability(dimensions: ProductAvailabilityDimensions): ProductAvailability;
80
+ export interface RuViewSemanticObservationV1 {
81
+ schemaVersion: 'ruview.semantic-observation.v1';
82
+ spaceRef: NamespacedTenantRef & {
83
+ namespace: 'ruview-space';
84
+ };
85
+ observationType: string;
86
+ /**
87
+ * Privacy-minimized semantic data only. Binary values, arrays, and raw
88
+ * sensing field names are rejected by the wire validator.
89
+ */
90
+ value: Record<string, string | number | boolean | null>;
91
+ confidence: number;
92
+ uncertainty?: number;
93
+ abstained: boolean;
94
+ modelDigest: `sha256:${string}`;
95
+ calibrationDigest?: `sha256:${string}`;
96
+ hardwareRef?: string;
97
+ privacyClass: 'P2' | 'P3';
98
+ observedAt: string;
99
+ expiresAt: string;
100
+ /** Canonical unsigned decimal string; JSON cannot safely carry bigint. */
101
+ sequence: string;
102
+ }
103
+ export interface ValidationIssue {
104
+ path: string;
105
+ code: 'invalid_type' | 'missing' | 'unknown_field' | 'unsupported_value' | 'invalid_format' | 'invalid_authority' | 'identity_namespace_required' | 'tenant_mismatch' | 'privacy_ceiling_exceeded';
106
+ message: string;
107
+ }
108
+ export type ValidationResult<T> = {
109
+ ok: true;
110
+ value: T;
111
+ } | {
112
+ ok: false;
113
+ issues: ValidationIssue[];
114
+ };
115
+ export interface ProductActionRequirements {
116
+ requestDigest: boolean;
117
+ contentDigest: boolean;
118
+ idempotencyKey: boolean;
119
+ expiry: boolean;
120
+ capability: boolean;
121
+ validationReceipt: boolean;
122
+ }
123
+ /**
124
+ * Actions must be anchored in the product that owns their authoritative
125
+ * outcome. Read-model actions permit the explicitly listed source domains.
126
+ */
127
+ export declare const ACTION_AUTHORITIES: Readonly<Record<ProductAction, readonly ProductAuthority[]>>;
128
+ /**
129
+ * Explicit obligations avoid inference from action spelling. New actions do
130
+ * not become privileged merely because a caller supplies a valid signature.
131
+ */
132
+ export declare const PRODUCT_ACTION_REQUIREMENTS: Readonly<Record<ProductAction, ProductActionRequirements>>;
133
+ export declare function identityKey(identity: NamespacedIdentity): string;
134
+ export declare function sameIdentity(left: NamespacedIdentity, right: NamespacedIdentity): boolean;
135
+ export declare function tenantRefKey(tenant: NamespacedTenantRef): string;
136
+ export declare function isProductAction(value: unknown): value is ProductAction;
137
+ export declare function validateAuthoritativeReference(input: unknown, options?: {
138
+ action?: ProductAction;
139
+ tenantRef?: NamespacedTenantRef;
140
+ }): ValidationResult<AuthoritativeReference>;
141
+ export declare function validateProductActionEnvelope(input: unknown): ValidationResult<ProductActionEnvelopeV1>;
142
+ export type RuViewSemanticFieldKind = 'boolean' | 'number' | 'string' | 'nullable-string';
143
+ export interface RuViewSemanticFieldSchema {
144
+ kind: RuViewSemanticFieldKind;
145
+ required?: boolean;
146
+ min?: number;
147
+ max?: number;
148
+ maxLength?: number;
149
+ enum?: readonly string[];
150
+ }
151
+ export interface RuViewObservationSchema {
152
+ privacyClasses: readonly ('P2' | 'P3')[];
153
+ fields: Readonly<Record<string, RuViewSemanticFieldSchema>>;
154
+ }
155
+ export type RuViewObservationRegistry = Readonly<Record<string, RuViewObservationSchema>>;
156
+ /**
157
+ * The default edge-export surface is deliberately small and semantic. A new
158
+ * observation type or field requires explicit schema registration; arbitrary
159
+ * keys are never accepted based on a deny-list alone.
160
+ */
161
+ export declare const DEFAULT_RUVIEW_OBSERVATION_REGISTRY: RuViewObservationRegistry;
162
+ export declare function validateRuViewSemanticObservation(input: unknown, registry?: RuViewObservationRegistry): ValidationResult<RuViewSemanticObservationV1>;
163
+ /**
164
+ * RFC 8785/JCS-compatible canonical JSON for this I-JSON profile.
165
+ *
166
+ * ECMAScript's JSON number serialization supplies the JCS number rendering.
167
+ * Non-finite numbers, sparse arrays, undefined values, non-plain objects, and
168
+ * invalid Unicode are rejected instead of being silently coerced.
169
+ */
170
+ export declare function canonicalizeProductPlane(value: unknown): string;
171
+ export declare function canonicalProductPlaneBytes(value: unknown): Uint8Array;
172
+ export declare function canonicalProductPlaneDigest(value: unknown): `sha256:${string}`;
173
+ export interface SignedProductActionEnvelopeV1 {
174
+ envelope: ProductActionEnvelopeV1;
175
+ algorithm: 'Ed25519';
176
+ keyId: string;
177
+ signature: string;
178
+ }
179
+ export type SignatureVerifier = (input: {
180
+ issuer: ProductAuthority;
181
+ keyId: string;
182
+ algorithm: 'Ed25519';
183
+ canonicalBytes: Uint8Array;
184
+ signature: Uint8Array;
185
+ }) => boolean | Promise<boolean>;
186
+ export type AuthorityKeyResolver = (issuer: ProductAuthority, keyId: string) => KeyLike | null | undefined | Promise<KeyLike | null | undefined>;
187
+ export interface ReplayReservationInput {
188
+ key: string;
189
+ bindingDigest: `sha256:${string}`;
190
+ expiresAt: number;
191
+ }
192
+ export type ReplayReservation = 'reserved' | 'replay' | 'conflict';
193
+ /**
194
+ * The implementation must reserve atomically. A lookup-then-insert adapter is
195
+ * not a conforming replay store under concurrent delivery.
196
+ */
197
+ export interface ProductEnvelopeReplayStore {
198
+ reserve(input: ReplayReservationInput): ReplayReservation | Promise<ReplayReservation>;
199
+ }
200
+ export type LocalAuthorizationDecision = boolean | {
201
+ allowed: boolean;
202
+ reason?: string;
203
+ };
204
+ export interface ProductEnvelopeVerifierOptions {
205
+ expectedAudience: ProductAuthority;
206
+ expectedTenantRef: NamespacedTenantRef;
207
+ now?: () => number;
208
+ maxAgeMs?: number;
209
+ maxFutureSkewMs?: number;
210
+ resolveKey?: AuthorityKeyResolver;
211
+ verifySignature?: SignatureVerifier;
212
+ replayStore: ProductEnvelopeReplayStore;
213
+ policyVerifier: (envelope: ProductActionEnvelopeV1) => LocalAuthorizationDecision | Promise<LocalAuthorizationDecision>;
214
+ capabilityVerifier: (envelope: ProductActionEnvelopeV1) => LocalAuthorizationDecision | Promise<LocalAuthorizationDecision>;
215
+ }
216
+ export type ProductEnvelopeVerificationCode = 'malformed_signed_envelope' | 'invalid_envelope' | 'audience_mismatch' | 'tenant_mismatch' | 'not_yet_valid' | 'stale' | 'expired' | 'signature_configuration_missing' | 'key_not_found' | 'signature_invalid' | 'policy_denied' | 'capability_denied' | 'replay_detected' | 'idempotency_conflict' | 'verification_error';
217
+ export type ProductEnvelopeVerificationResult = {
218
+ ok: true;
219
+ envelope: ProductActionEnvelopeV1;
220
+ canonicalDigest: `sha256:${string}`;
221
+ replayKey: string;
222
+ } | {
223
+ ok: false;
224
+ code: ProductEnvelopeVerificationCode;
225
+ reason: string;
226
+ issues?: ValidationIssue[];
227
+ };
228
+ /**
229
+ * Verify a signed product action as an ingress policy-enforcement decision.
230
+ *
231
+ * Signature validity is necessary but insufficient: audience, tenant,
232
+ * freshness, replay state, local policy, and the action-bound capability are
233
+ * checked independently. Service availability is intentionally absent; a
234
+ * valid claim never implies that its target is configured, reachable, or
235
+ * healthy.
236
+ */
237
+ export declare function verifySignedProductActionEnvelope(input: unknown, options: ProductEnvelopeVerifierOptions): Promise<ProductEnvelopeVerificationResult>;
238
+ //# sourceMappingURL=product-plane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-plane.d.ts","sourceRoot":"","sources":["../../src/policy/product-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA+C,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAExF,eAAO,MAAM,+BAA+B,EAAG,oBAA6B,CAAC;AAE7E,eAAO,MAAM,eAAe,2pBAgClB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,mBAAmB,qIAStB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,mBAAmB,+IAQtB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,iBAAiB,2HAOpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,eAAe,CAA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