open-multi-agent-kit 0.96.2 → 0.98.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 (368) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +43 -9
  3. package/dist/cli/args.d.ts +2 -3
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +13 -189
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/help.d.ts +3 -0
  8. package/dist/cli/help.d.ts.map +1 -0
  9. package/dist/cli/help.js +194 -0
  10. package/dist/cli/help.js.map +1 -0
  11. package/dist/cli/initial-message.d.ts.map +1 -1
  12. package/dist/cli/initial-message.js +2 -1
  13. package/dist/cli/initial-message.js.map +1 -1
  14. package/dist/cli/resource-paths.d.ts +4 -0
  15. package/dist/cli/resource-paths.d.ts.map +1 -0
  16. package/dist/cli/resource-paths.js +59 -0
  17. package/dist/cli/resource-paths.js.map +1 -0
  18. package/dist/commands/adaptorch-doctor-cli.d.ts +13 -0
  19. package/dist/commands/adaptorch-doctor-cli.d.ts.map +1 -0
  20. package/dist/commands/adaptorch-doctor-cli.js +115 -0
  21. package/dist/commands/adaptorch-doctor-cli.js.map +1 -0
  22. package/dist/commands/resource-doctor-cli.d.ts +4 -0
  23. package/dist/commands/resource-doctor-cli.d.ts.map +1 -1
  24. package/dist/commands/resource-doctor-cli.js +35 -5
  25. package/dist/commands/resource-doctor-cli.js.map +1 -1
  26. package/dist/core/adaptorch-bridge.d.ts +11 -13
  27. package/dist/core/adaptorch-bridge.d.ts.map +1 -1
  28. package/dist/core/adaptorch-bridge.js +11 -13
  29. package/dist/core/adaptorch-bridge.js.map +1 -1
  30. package/dist/core/agent-session-snapshot.d.ts +16 -0
  31. package/dist/core/agent-session-snapshot.d.ts.map +1 -0
  32. package/dist/core/agent-session-snapshot.js +111 -0
  33. package/dist/core/agent-session-snapshot.js.map +1 -0
  34. package/dist/core/agent-session.d.ts +14 -10
  35. package/dist/core/agent-session.d.ts.map +1 -1
  36. package/dist/core/agent-session.js +102 -217
  37. package/dist/core/agent-session.js.map +1 -1
  38. package/dist/core/agent-tool-settings.d.ts +10 -0
  39. package/dist/core/agent-tool-settings.d.ts.map +1 -1
  40. package/dist/core/agent-tool-settings.js +10 -1
  41. package/dist/core/agent-tool-settings.js.map +1 -1
  42. package/dist/core/attachment-store.d.ts +39 -0
  43. package/dist/core/attachment-store.d.ts.map +1 -0
  44. package/dist/core/attachment-store.js +81 -0
  45. package/dist/core/attachment-store.js.map +1 -0
  46. package/dist/core/command-safety.d.ts +8 -0
  47. package/dist/core/command-safety.d.ts.map +1 -1
  48. package/dist/core/command-safety.js +140 -14
  49. package/dist/core/command-safety.js.map +1 -1
  50. package/dist/core/compaction/compaction.d.ts +13 -1
  51. package/dist/core/compaction/compaction.d.ts.map +1 -1
  52. package/dist/core/compaction/compaction.js +60 -62
  53. package/dist/core/compaction/compaction.js.map +1 -1
  54. package/dist/core/compaction/index.d.ts +1 -0
  55. package/dist/core/compaction/index.d.ts.map +1 -1
  56. package/dist/core/compaction/index.js +1 -0
  57. package/dist/core/compaction/index.js.map +1 -1
  58. package/dist/core/compaction/knowledge-triage-format.d.ts +9 -0
  59. package/dist/core/compaction/knowledge-triage-format.d.ts.map +1 -0
  60. package/dist/core/compaction/knowledge-triage-format.js +71 -0
  61. package/dist/core/compaction/knowledge-triage-format.js.map +1 -0
  62. package/dist/core/compaction/knowledge-triage-types.d.ts +7 -0
  63. package/dist/core/compaction/knowledge-triage-types.d.ts.map +1 -0
  64. package/dist/core/compaction/knowledge-triage-types.js +2 -0
  65. package/dist/core/compaction/knowledge-triage-types.js.map +1 -0
  66. package/dist/core/compaction/knowledge-triage.d.ts +29 -0
  67. package/dist/core/compaction/knowledge-triage.d.ts.map +1 -0
  68. package/dist/core/compaction/knowledge-triage.js +189 -0
  69. package/dist/core/compaction/knowledge-triage.js.map +1 -0
  70. package/dist/core/compaction/transaction.d.ts.map +1 -1
  71. package/dist/core/compaction/transaction.js +1 -1
  72. package/dist/core/compaction/transaction.js.map +1 -1
  73. package/dist/core/compaction/utils.d.ts +4 -0
  74. package/dist/core/compaction/utils.d.ts.map +1 -1
  75. package/dist/core/compaction/utils.js +37 -0
  76. package/dist/core/compaction/utils.js.map +1 -1
  77. package/dist/core/completion-sound-io.d.ts +14 -0
  78. package/dist/core/completion-sound-io.d.ts.map +1 -0
  79. package/dist/core/completion-sound-io.js +64 -0
  80. package/dist/core/completion-sound-io.js.map +1 -0
  81. package/dist/core/completion-sound.d.ts +4 -10
  82. package/dist/core/completion-sound.d.ts.map +1 -1
  83. package/dist/core/completion-sound.js +28 -58
  84. package/dist/core/completion-sound.js.map +1 -1
  85. package/dist/core/context-budget-governor-v2.d.ts +1 -1
  86. package/dist/core/context-budget-governor-v2.d.ts.map +1 -1
  87. package/dist/core/context-budget-governor-v2.js +1 -1
  88. package/dist/core/context-budget-governor-v2.js.map +1 -1
  89. package/dist/core/context-budget-relevance.d.ts +15 -2
  90. package/dist/core/context-budget-relevance.d.ts.map +1 -1
  91. package/dist/core/context-budget-relevance.js +21 -9
  92. package/dist/core/context-budget-relevance.js.map +1 -1
  93. package/dist/core/context-budget-system-prompt-items.d.ts +1 -1
  94. package/dist/core/context-budget-system-prompt-items.d.ts.map +1 -1
  95. package/dist/core/context-budget-system-prompt-items.js.map +1 -1
  96. package/dist/core/context-budget-system-prompt.d.ts +1 -1
  97. package/dist/core/context-budget-system-prompt.d.ts.map +1 -1
  98. package/dist/core/context-budget-system-prompt.js.map +1 -1
  99. package/dist/core/context-budget-v2-cache-keys.d.ts +3 -0
  100. package/dist/core/context-budget-v2-cache-keys.d.ts.map +1 -1
  101. package/dist/core/context-budget-v2-cache-keys.js +2 -0
  102. package/dist/core/context-budget-v2-cache-keys.js.map +1 -1
  103. package/dist/core/context-budget-v2-plan-cache-keys.d.ts.map +1 -1
  104. package/dist/core/context-budget-v2-plan-cache-keys.js +3 -0
  105. package/dist/core/context-budget-v2-plan-cache-keys.js.map +1 -1
  106. package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
  107. package/dist/core/context-budget-v2-planner.js +2 -1
  108. package/dist/core/context-budget-v2-planner.js.map +1 -1
  109. package/dist/core/context-budget-v2-scoring.d.ts +17 -0
  110. package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
  111. package/dist/core/context-budget-v2-scoring.js +25 -8
  112. package/dist/core/context-budget-v2-scoring.js.map +1 -1
  113. package/dist/core/context-budget-v2-selection.d.ts +2 -2
  114. package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
  115. package/dist/core/context-budget-v2-selection.js +18 -1
  116. package/dist/core/context-budget-v2-selection.js.map +1 -1
  117. package/dist/core/context-budget-v2-types.d.ts +17 -0
  118. package/dist/core/context-budget-v2-types.d.ts.map +1 -1
  119. package/dist/core/context-budget-v2-types.js +15 -0
  120. package/dist/core/context-budget-v2-types.js.map +1 -1
  121. package/dist/core/context-file.d.ts +23 -0
  122. package/dist/core/context-file.d.ts.map +1 -0
  123. package/dist/core/context-file.js +17 -0
  124. package/dist/core/context-file.js.map +1 -0
  125. package/dist/core/extensions/builtin/command-safety-gate.d.ts +3 -1
  126. package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -1
  127. package/dist/core/extensions/builtin/command-safety-gate.js +7 -0
  128. package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -1
  129. package/dist/core/extensions/types.d.ts +12 -1
  130. package/dist/core/extensions/types.d.ts.map +1 -1
  131. package/dist/core/extensions/types.js.map +1 -1
  132. package/dist/core/keybindings.d.ts +1 -1
  133. package/dist/core/keybindings.d.ts.map +1 -1
  134. package/dist/core/keybindings.js +6 -1
  135. package/dist/core/keybindings.js.map +1 -1
  136. package/dist/core/model-prompt-policy.d.ts +1 -1
  137. package/dist/core/model-prompt-policy.d.ts.map +1 -1
  138. package/dist/core/model-prompt-policy.js.map +1 -1
  139. package/dist/core/model-registry.d.ts +8 -3
  140. package/dist/core/model-registry.d.ts.map +1 -1
  141. package/dist/core/model-registry.js +71 -1
  142. package/dist/core/model-registry.js.map +1 -1
  143. package/dist/core/package-doctor-source-scan.d.ts +9 -0
  144. package/dist/core/package-doctor-source-scan.d.ts.map +1 -1
  145. package/dist/core/package-doctor-source-scan.js +77 -4
  146. package/dist/core/package-doctor-source-scan.js.map +1 -1
  147. package/dist/core/prompt-attachment.d.ts +51 -0
  148. package/dist/core/prompt-attachment.d.ts.map +1 -0
  149. package/dist/core/prompt-attachment.js +186 -0
  150. package/dist/core/prompt-attachment.js.map +1 -0
  151. package/dist/core/prompt-settlement.d.ts +6 -3
  152. package/dist/core/prompt-settlement.d.ts.map +1 -1
  153. package/dist/core/prompt-settlement.js +10 -14
  154. package/dist/core/prompt-settlement.js.map +1 -1
  155. package/dist/core/provider-resilience.d.ts +28 -0
  156. package/dist/core/provider-resilience.d.ts.map +1 -1
  157. package/dist/core/provider-resilience.js +50 -0
  158. package/dist/core/provider-resilience.js.map +1 -1
  159. package/dist/core/provider-retry.d.ts +1 -1
  160. package/dist/core/provider-retry.d.ts.map +1 -1
  161. package/dist/core/provider-retry.js +1 -1
  162. package/dist/core/provider-retry.js.map +1 -1
  163. package/dist/core/provider-usage.d.ts.map +1 -1
  164. package/dist/core/provider-usage.js +68 -2
  165. package/dist/core/provider-usage.js.map +1 -1
  166. package/dist/core/reasoning-router-promotion.d.ts +124 -0
  167. package/dist/core/reasoning-router-promotion.d.ts.map +1 -0
  168. package/dist/core/reasoning-router-promotion.js +121 -0
  169. package/dist/core/reasoning-router-promotion.js.map +1 -0
  170. package/dist/core/reasoning-router-replay-stability.d.ts +65 -0
  171. package/dist/core/reasoning-router-replay-stability.d.ts.map +1 -0
  172. package/dist/core/reasoning-router-replay-stability.js +67 -0
  173. package/dist/core/reasoning-router-replay-stability.js.map +1 -0
  174. package/dist/core/reasoning-router-v4-weights.d.ts +6 -6
  175. package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
  176. package/dist/core/reasoning-router-v4-weights.js +3 -3
  177. package/dist/core/reasoning-router-v4-weights.js.map +1 -1
  178. package/dist/core/reasoning-router-v4.d.ts.map +1 -1
  179. package/dist/core/reasoning-router-v4.js +6 -6
  180. package/dist/core/reasoning-router-v4.js.map +1 -1
  181. package/dist/core/redaction.d.ts.map +1 -1
  182. package/dist/core/redaction.js +1 -1
  183. package/dist/core/redaction.js.map +1 -1
  184. package/dist/core/resource-admission.d.ts +2 -1
  185. package/dist/core/resource-admission.d.ts.map +1 -1
  186. package/dist/core/resource-admission.js +11 -0
  187. package/dist/core/resource-admission.js.map +1 -1
  188. package/dist/core/resource-governor-format.d.ts +1 -1
  189. package/dist/core/resource-governor-format.d.ts.map +1 -1
  190. package/dist/core/resource-governor-format.js.map +1 -1
  191. package/dist/core/resource-governor-settings.d.ts +6 -12
  192. package/dist/core/resource-governor-settings.d.ts.map +1 -1
  193. package/dist/core/resource-governor-settings.js.map +1 -1
  194. package/dist/core/resource-governor-types.d.ts +24 -0
  195. package/dist/core/resource-governor-types.d.ts.map +1 -0
  196. package/dist/core/resource-governor-types.js +15 -0
  197. package/dist/core/resource-governor-types.js.map +1 -0
  198. package/dist/core/resource-loader.d.ts +1 -7
  199. package/dist/core/resource-loader.d.ts.map +1 -1
  200. package/dist/core/resource-loader.js.map +1 -1
  201. package/dist/core/resource-observation-journal.d.ts +2 -1
  202. package/dist/core/resource-observation-journal.d.ts.map +1 -1
  203. package/dist/core/resource-observation-journal.js +4 -3
  204. package/dist/core/resource-observation-journal.js.map +1 -1
  205. package/dist/core/resource-observation-report-reader.d.ts +7 -0
  206. package/dist/core/resource-observation-report-reader.d.ts.map +1 -0
  207. package/dist/core/resource-observation-report-reader.js +157 -0
  208. package/dist/core/resource-observation-report-reader.js.map +1 -0
  209. package/dist/core/resource-observation-report.d.ts +24 -0
  210. package/dist/core/resource-observation-report.d.ts.map +1 -0
  211. package/dist/core/resource-observation-report.js +101 -0
  212. package/dist/core/resource-observation-report.js.map +1 -0
  213. package/dist/core/router-feedback-collector.d.ts +1 -1
  214. package/dist/core/router-feedback-collector.d.ts.map +1 -1
  215. package/dist/core/router-feedback-collector.js.map +1 -1
  216. package/dist/core/session-bash-service.d.ts.map +1 -1
  217. package/dist/core/session-bash-service.js +4 -3
  218. package/dist/core/session-bash-service.js.map +1 -1
  219. package/dist/core/session-failure-cause.d.ts +33 -0
  220. package/dist/core/session-failure-cause.d.ts.map +1 -0
  221. package/dist/core/session-failure-cause.js +141 -0
  222. package/dist/core/session-failure-cause.js.map +1 -0
  223. package/dist/core/session-system-prompt.d.ts +1 -1
  224. package/dist/core/session-system-prompt.d.ts.map +1 -1
  225. package/dist/core/session-system-prompt.js.map +1 -1
  226. package/dist/core/session-termination.d.ts +1 -1
  227. package/dist/core/session-termination.d.ts.map +1 -1
  228. package/dist/core/session-termination.js +11 -2
  229. package/dist/core/session-termination.js.map +1 -1
  230. package/dist/core/settings-manager.d.ts +1 -1
  231. package/dist/core/settings-manager.d.ts.map +1 -1
  232. package/dist/core/settings-manager.js.map +1 -1
  233. package/dist/core/system-prompt.d.ts +1 -1
  234. package/dist/core/system-prompt.d.ts.map +1 -1
  235. package/dist/core/system-prompt.js.map +1 -1
  236. package/dist/core/tools/bash.d.ts.map +1 -1
  237. package/dist/core/tools/bash.js +10 -14
  238. package/dist/core/tools/bash.js.map +1 -1
  239. package/dist/core/tools/grep.d.ts.map +1 -1
  240. package/dist/core/tools/grep.js +13 -48
  241. package/dist/core/tools/grep.js.map +1 -1
  242. package/dist/core/tools/read.d.ts.map +1 -1
  243. package/dist/core/tools/read.js +1 -34
  244. package/dist/core/tools/read.js.map +1 -1
  245. package/dist/core/workload-classifier.d.ts +2 -10
  246. package/dist/core/workload-classifier.d.ts.map +1 -1
  247. package/dist/core/workload-classifier.js +17 -0
  248. package/dist/core/workload-classifier.js.map +1 -1
  249. package/dist/core/workload-family-matcher.d.ts +1 -1
  250. package/dist/core/workload-family-matcher.d.ts.map +1 -1
  251. package/dist/core/workload-family-matcher.js.map +1 -1
  252. package/dist/core/workload-shard-execution-types.d.ts +40 -0
  253. package/dist/core/workload-shard-execution-types.d.ts.map +1 -0
  254. package/dist/core/workload-shard-execution-types.js +14 -0
  255. package/dist/core/workload-shard-execution-types.js.map +1 -0
  256. package/dist/core/workload-shard-executor.d.ts +3 -27
  257. package/dist/core/workload-shard-executor.d.ts.map +1 -1
  258. package/dist/core/workload-shard-executor.js.map +1 -1
  259. package/dist/core/workload-shard-runner.d.ts +1 -1
  260. package/dist/core/workload-shard-runner.d.ts.map +1 -1
  261. package/dist/core/workload-shard-runner.js.map +1 -1
  262. package/dist/core/workload-types.d.ts +24 -0
  263. package/dist/core/workload-types.d.ts.map +1 -0
  264. package/dist/core/workload-types.js +15 -0
  265. package/dist/core/workload-types.js.map +1 -0
  266. package/dist/index.d.ts +1 -1
  267. package/dist/index.d.ts.map +1 -1
  268. package/dist/index.js +1 -1
  269. package/dist/index.js.map +1 -1
  270. package/dist/main.d.ts +2 -0
  271. package/dist/main.d.ts.map +1 -1
  272. package/dist/main.js +27 -47
  273. package/dist/main.js.map +1 -1
  274. package/dist/modes/interactive/components/attachment-strip.d.ts +21 -0
  275. package/dist/modes/interactive/components/attachment-strip.d.ts.map +1 -0
  276. package/dist/modes/interactive/components/attachment-strip.js +136 -0
  277. package/dist/modes/interactive/components/attachment-strip.js.map +1 -0
  278. package/dist/modes/interactive/components/footer.d.ts +6 -0
  279. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  280. package/dist/modes/interactive/components/footer.js +26 -1
  281. package/dist/modes/interactive/components/footer.js.map +1 -1
  282. package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -1
  283. package/dist/modes/interactive/components/status-sidebar.js +12 -1
  284. package/dist/modes/interactive/components/status-sidebar.js.map +1 -1
  285. package/dist/modes/interactive/interactive-mode.d.ts +23 -4
  286. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  287. package/dist/modes/interactive/interactive-mode.js +174 -53
  288. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  289. package/dist/modes/interactive/theme/omk-control-panel.json +1 -1
  290. package/dist/utils/clipboard-image.d.ts.map +1 -1
  291. package/dist/utils/clipboard-image.js +42 -33
  292. package/dist/utils/clipboard-image.js.map +1 -1
  293. package/dist/utils/clipboard.d.ts.map +1 -1
  294. package/dist/utils/clipboard.js +14 -2
  295. package/dist/utils/clipboard.js.map +1 -1
  296. package/docs/adaptorch-preview-spec.md +20 -18
  297. package/docs/adaptorch-preview.md +9 -9
  298. package/docs/compaction.md +25 -4
  299. package/docs/correctness-wall.md +10 -10
  300. package/docs/docs.json +12 -0
  301. package/docs/environment-variables.md +9 -2
  302. package/docs/extensions.md +12 -3
  303. package/docs/index.md +7 -1
  304. package/docs/metrics.md +74 -2
  305. package/docs/provider-resilience.md +11 -0
  306. package/docs/runtime-algorithms.md +359 -0
  307. package/docs/sdk.md +2 -2
  308. package/docs/settings.md +11 -10
  309. package/docs/usage.md +19 -3
  310. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  311. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  312. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  313. package/examples/extensions/gondolin/package-lock.json +2 -2
  314. package/examples/extensions/gondolin/package.json +1 -1
  315. package/examples/extensions/sandbox/package-lock.json +2 -2
  316. package/examples/extensions/sandbox/package.json +1 -1
  317. package/examples/extensions/with-deps/package-lock.json +2 -2
  318. package/examples/extensions/with-deps/package.json +1 -1
  319. package/npm-shrinkwrap.json +18 -18
  320. package/package.json +7 -7
  321. package/dist/core/context-budget-governor.d.ts +0 -67
  322. package/dist/core/context-budget-governor.d.ts.map +0 -1
  323. package/dist/core/context-budget-governor.js +0 -224
  324. package/dist/core/context-budget-governor.js.map +0 -1
  325. package/dist/core/lean-ctx.d.ts +0 -99
  326. package/dist/core/lean-ctx.d.ts.map +0 -1
  327. package/dist/core/lean-ctx.js +0 -225
  328. package/dist/core/lean-ctx.js.map +0 -1
  329. package/dist/core/read-anchors.d.ts +0 -110
  330. package/dist/core/read-anchors.d.ts.map +0 -1
  331. package/dist/core/read-anchors.js +0 -193
  332. package/dist/core/read-anchors.js.map +0 -1
  333. package/dist/core/recovery-checkpoint.d.ts +0 -196
  334. package/dist/core/recovery-checkpoint.d.ts.map +0 -1
  335. package/dist/core/recovery-checkpoint.js +0 -382
  336. package/dist/core/recovery-checkpoint.js.map +0 -1
  337. package/dist/core/sandbox-policy-v2.d.ts +0 -49
  338. package/dist/core/sandbox-policy-v2.d.ts.map +0 -1
  339. package/dist/core/sandbox-policy-v2.js +0 -368
  340. package/dist/core/sandbox-policy-v2.js.map +0 -1
  341. package/dist/core/tools/omp-pure-seams.d.ts +0 -41
  342. package/dist/core/tools/omp-pure-seams.d.ts.map +0 -1
  343. package/dist/core/tools/omp-pure-seams.js +0 -142
  344. package/dist/core/tools/omp-pure-seams.js.map +0 -1
  345. package/dist/core/tools/omp-seam-runtime.d.ts +0 -100
  346. package/dist/core/tools/omp-seam-runtime.d.ts.map +0 -1
  347. package/dist/core/tools/omp-seam-runtime.js +0 -40
  348. package/dist/core/tools/omp-seam-runtime.js.map +0 -1
  349. package/dist/guardrails/audit-logger.d.ts +0 -4
  350. package/dist/guardrails/audit-logger.d.ts.map +0 -1
  351. package/dist/guardrails/audit-logger.js +0 -28
  352. package/dist/guardrails/audit-logger.js.map +0 -1
  353. package/dist/guardrails/freedomd-adapter.d.ts +0 -16
  354. package/dist/guardrails/freedomd-adapter.d.ts.map +0 -1
  355. package/dist/guardrails/freedomd-adapter.js +0 -87
  356. package/dist/guardrails/freedomd-adapter.js.map +0 -1
  357. package/dist/orchestration/lane-grant-auditor.d.ts +0 -4
  358. package/dist/orchestration/lane-grant-auditor.d.ts.map +0 -1
  359. package/dist/orchestration/lane-grant-auditor.js +0 -87
  360. package/dist/orchestration/lane-grant-auditor.js.map +0 -1
  361. package/dist/types/guardrails.d.ts +0 -61
  362. package/dist/types/guardrails.d.ts.map +0 -1
  363. package/dist/types/guardrails.js +0 -9
  364. package/dist/types/guardrails.js.map +0 -1
  365. package/dist/types/lane-grant.d.ts +0 -58
  366. package/dist/types/lane-grant.d.ts.map +0 -1
  367. package/dist/types/lane-grant.js +0 -9
  368. package/dist/types/lane-grant.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"omp-pure-seams.js","sourceRoot":"","sources":["../../../src/core/tools/omp-pure-seams.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKxD,sDAAsD;AACtD,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC9B,IAAI,CAAoB;IAEjC,YAAY,IAAuB,EAAE,OAAe,EAAE;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAAA,CACjB;CACD;AAaD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAwC,EAAW;IACpF,MAAM,MAAM,GAAuC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACtE,OAAO,MAAM,CAAC,aAAa,KAAK,GAAG,CAAC;AAAA,CACpC;AAED,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAClD,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AACjG,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAsB;IACzE,IAAI,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC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AAY,CAAC;QAClE,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,QAAQ,EAAE,eAAe,CAAC;QAC3E,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAAC,qBAAqB,EAAE,QAAQ,EAAE,uBAAuB,CAAC;QACrG,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,CAAC;QAC9F,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,oBAAoB,CAAC;KACpG,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,GAAG,CAAC;AAAA,CACX","sourcesContent":["/**\n * Flag-gated loader for the vendored oh-my-pi \"pure\" read/search/hashline seams.\n *\n * These seams are pure data/proposal-only functions (planning + presentation +\n * hashline parsing). They do NOT touch edit/write/file-mutation paths. The\n * loader is enabled by default and opts out via OMK_OMP_SEAMS=0 (ADR-OMP-009);\n * when disabled it throws DISABLED and tool behavior falls back to the\n * pre-seam implementation byte-identically.\n *\n * The file is erasable TypeScript: no `enum`, no parameter properties, no `as`,\n * no non-null assertions, no `any` annotations, and no runtime dependencies\n * beyond the Node.js standard library.\n */\nimport { existsSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\n/** Error categories raised by the OMP pure-seam loader. */\nexport type OmpSeamsErrorCode = \"DISABLED\" | \"VENDOR_NOT_FOUND\" | \"INVALID_SEAM\";\n\n/** Typed error thrown by {@link loadOmpPureSeams}. */\nexport class OmpSeamsError extends Error {\n\treadonly code: OmpSeamsErrorCode;\n\n\tconstructor(code: OmpSeamsErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"OmpSeamsError\";\n\t\tthis.code = code;\n\t}\n}\n\n/** The validated set of pure oh-my-pi seams (data/proposal-only). */\nexport interface OmpPureSeams {\n\tplanRead(input: unknown): unknown;\n\tpresentRead(plan: unknown, file: unknown): unknown;\n\tplanSearch(input: unknown): unknown;\n\tpresentSearch(plan: unknown, matches: unknown, sourceDigests?: unknown): unknown;\n\tparseHashlineProposal(text: string): unknown;\n\thashProposalLine(text: string): Promise<string>;\n\thashProposalSource(text: string): Promise<string>;\n}\n\n/**\n * Returns true unless the seams feature is explicitly disabled\n * (OMK_OMP_SEAMS === \"0\"). Enabled by default per ADR-OMP-009.\n * Reads `process.env` when no record is supplied.\n */\nexport function isOmpSeamsEnabled(env?: Record<string, string | undefined>): boolean {\n\tconst source: Record<string, string | undefined> = env ?? process.env;\n\treturn source.OMK_OMP_SEAMS !== \"0\";\n}\n\nconst VENDOR_SEGMENT = join(\"vendor\", \"oh-my-pi\");\nconst VENDOR_MARKER = join(VENDOR_SEGMENT, \"packages\", \"coding-agent\", \"src\", \"pure\", \"read.ts\");\nconst MAX_WALK_UP_LEVELS = 8;\n\n/**\n * Walks up from `startDir` (inclusive) looking for a `vendor/oh-my-pi`\n * directory that contains the pure read seam marker file. Returns the absolute\n * vendor directory path, or `undefined` when none is found within the level cap.\n */\nexport function resolveOmpVendorDir(startDir: string): string | undefined {\n\tlet dir = isAbsolute(startDir) ? startDir : resolve(startDir);\n\tfor (let level = 0; level <= MAX_WALK_UP_LEVELS; level += 1) {\n\t\tif (existsSync(join(dir, VENDOR_MARKER))) {\n\t\t\treturn join(dir, VENDOR_SEGMENT);\n\t\t}\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) break;\n\t\tdir = parent;\n\t}\n\treturn undefined;\n}\n\n// --- internal narrowing helpers (no `as`; type guards carry the signatures) ---\n\ntype SeamFn = (...args: never[]) => unknown;\ntype SeamAsyncStrFn = (...args: never[]) => Promise<string>;\n\nfunction isSeamFn(member: unknown): member is SeamFn {\n\treturn typeof member === \"function\";\n}\n\nfunction isSeamAsyncStrFn(member: unknown): member is SeamAsyncStrFn {\n\treturn typeof member === \"function\";\n}\n\nfunction expectFn<T extends SeamFn>(member: unknown, guard: (m: unknown) => m is T, name: string): T {\n\tif (guard(member)) return member;\n\tthrow new OmpSeamsError(\"INVALID_SEAM\", `OMP seam missing or non-function: ${name}`);\n}\n\nconst READ_SEAM = join(\"packages\", \"coding-agent\", \"src\", \"pure\", \"read.ts\");\nconst SEARCH_SEAM = join(\"packages\", \"coding-agent\", \"src\", \"pure\", \"search.ts\");\nconst PROPOSAL_SEAM = join(\"packages\", \"hashline\", \"src\", \"proposal.ts\");\n\n/**\n * Loads and validates the three pure seam modules from the vendored oh-my-pi\n * tree and returns a frozen {@link OmpPureSeams} record. Throws\n * {@link OmpSeamsError} with code DISABLED when the feature is off,\n * VENDOR_NOT_FOUND when the vendor tree cannot be located, or INVALID_SEAM when\n * any expected export is missing or not a function.\n */\nexport async function loadOmpPureSeams(options?: {\n\tvendorDir?: string;\n\tenv?: Record<string, string | undefined>;\n}): Promise<OmpPureSeams> {\n\tconst env: Record<string, string | undefined> = options?.env ?? process.env;\n\tif (!isOmpSeamsEnabled(env)) {\n\t\tthrow new OmpSeamsError(\n\t\t\t\"DISABLED\",\n\t\t\t\"OMP pure seams are disabled (OMK_OMP_SEAMS=0; unset or set to any other value to enable).\",\n\t\t);\n\t}\n\n\tlet vendorDir: string | undefined = options?.vendorDir ?? env.OMK_OMP_VENDOR_DIR;\n\tif (!vendorDir) {\n\t\tconst moduleUrl = new URL(\".\", import.meta.url);\n\t\tif (moduleUrl.protocol !== \"file:\") {\n\t\t\tthrow new OmpSeamsError(\n\t\t\t\t\"VENDOR_NOT_FOUND\",\n\t\t\t\t\"OMP vendor dir was not provided and the module is not a file URL.\",\n\t\t\t);\n\t\t}\n\t\tconst found = resolveOmpVendorDir(fileURLToPath(moduleUrl));\n\t\tif (!found) {\n\t\t\tthrow new OmpSeamsError(\n\t\t\t\t\"VENDOR_NOT_FOUND\",\n\t\t\t\t\"OMP vendor dir not found by walking up from the module directory.\",\n\t\t\t);\n\t\t}\n\t\tvendorDir = found;\n\t}\n\tif (!existsSync(vendorDir)) {\n\t\tthrow new OmpSeamsError(\"VENDOR_NOT_FOUND\", `OMP vendor dir does not exist: ${vendorDir}`);\n\t}\n\n\tconst readUrl = pathToFileURL(join(vendorDir, READ_SEAM)).href;\n\tconst searchUrl = pathToFileURL(join(vendorDir, SEARCH_SEAM)).href;\n\tconst proposalUrl = pathToFileURL(join(vendorDir, PROPOSAL_SEAM)).href;\n\n\tconst readMod = await import(readUrl);\n\tconst searchMod = await import(searchUrl);\n\tconst proposalMod = await import(proposalUrl);\n\n\t// Validate every expected member up front so the INVALID_SEAM error lists\n\t// ALL missing/non-function exports, not just the first one encountered.\n\tconst expected: ReadonlyArray<readonly [unknown, string]> = [\n\t\t[readMod.planRead, \"planRead\"],\n\t\t[readMod.presentRead, \"presentRead\"],\n\t\t[searchMod.planSearch, \"planSearch\"],\n\t\t[searchMod.presentSearch, \"presentSearch\"],\n\t\t[proposalMod.parseHashlineProposal, \"parseHashlineProposal\"],\n\t\t[proposalMod.hashProposalLine, \"hashProposalLine\"],\n\t\t[proposalMod.hashProposalSource, \"hashProposalSource\"],\n\t];\n\tconst missing: string[] = [];\n\tfor (const [member, name] of expected) {\n\t\tif (typeof member !== \"function\") missing.push(name);\n\t}\n\tif (missing.length > 0) {\n\t\tthrow new OmpSeamsError(\"INVALID_SEAM\", `OMP seams missing or non-function: ${missing.join(\", \")}`);\n\t}\n\n\tconst rec: OmpPureSeams = {\n\t\tplanRead: expectFn(readMod.planRead, isSeamFn, \"planRead\"),\n\t\tpresentRead: expectFn(readMod.presentRead, isSeamFn, \"presentRead\"),\n\t\tplanSearch: expectFn(searchMod.planSearch, isSeamFn, \"planSearch\"),\n\t\tpresentSearch: expectFn(searchMod.presentSearch, isSeamFn, \"presentSearch\"),\n\t\tparseHashlineProposal: expectFn(proposalMod.parseHashlineProposal, isSeamFn, \"parseHashlineProposal\"),\n\t\thashProposalLine: expectFn(proposalMod.hashProposalLine, isSeamAsyncStrFn, \"hashProposalLine\"),\n\t\thashProposalSource: expectFn(proposalMod.hashProposalSource, isSeamAsyncStrFn, \"hashProposalSource\"),\n\t};\n\tObject.freeze(rec);\n\treturn rec;\n}\n"]}
@@ -1,100 +0,0 @@
1
- /**
2
- * Typed runtime facade over the flag-gated OMP pure-seam loader.
3
- *
4
- * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate
5
- * request validation and output presentation to the vendored OMP pure seams.
6
- * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back
7
- * byte-identically to the pre-seam implementation.
8
- *
9
- * The loader exposes unknown-in/unknown-out signatures; all structural
10
- * assertions live in this single file so tool code stays clean.
11
- */
12
- import { type OmpPureSeams } from "./omp-pure-seams.ts";
13
- export interface OmpIssue {
14
- readonly field: string;
15
- readonly code: string;
16
- readonly message: string;
17
- }
18
- export interface OmpReadPlan {
19
- readonly path: string;
20
- readonly offset: number;
21
- readonly limit: number;
22
- }
23
- export type OmpReadPlanResult = {
24
- readonly ok: true;
25
- readonly plan: OmpReadPlan;
26
- } | {
27
- readonly ok: false;
28
- readonly issues: readonly OmpIssue[];
29
- };
30
- export interface OmpReadPresentation {
31
- readonly text: string;
32
- readonly window: {
33
- readonly startLine: number;
34
- readonly endLine: number;
35
- readonly totalLines: number;
36
- readonly truncated: boolean;
37
- };
38
- }
39
- export type OmpReadPresentResult = {
40
- readonly ok: true;
41
- readonly presentation: OmpReadPresentation;
42
- } | {
43
- readonly ok: false;
44
- readonly conflicts: readonly unknown[];
45
- };
46
- export interface OmpSearchPlan {
47
- readonly pattern: string;
48
- readonly path: string;
49
- readonly glob?: string;
50
- readonly ignoreCase: boolean;
51
- readonly literal: boolean;
52
- readonly context: number;
53
- readonly limit: number;
54
- }
55
- export type OmpSearchPlanResult = {
56
- readonly ok: true;
57
- readonly plan: OmpSearchPlan;
58
- } | {
59
- readonly ok: false;
60
- readonly issues: readonly OmpIssue[];
61
- };
62
- export interface OmpSearchHostMatch {
63
- readonly file: string;
64
- readonly line: number;
65
- readonly column?: number;
66
- readonly text: string;
67
- readonly expectedLineHash?: string;
68
- }
69
- export interface OmpSearchPresentation {
70
- readonly text: string;
71
- readonly totalMatches: number;
72
- readonly omittedMatches: number;
73
- readonly truncated: boolean;
74
- }
75
- export type OmpSearchPresentResult = {
76
- readonly ok: true;
77
- readonly presentation: OmpSearchPresentation;
78
- } | {
79
- readonly ok: false;
80
- readonly conflicts: readonly unknown[];
81
- };
82
- /**
83
- * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when
84
- * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to
85
- * the caller of the returned promise.
86
- */
87
- export declare function getOmpSeams(): Promise<OmpPureSeams> | undefined;
88
- export declare function planRead(seams: OmpPureSeams, input: unknown): OmpReadPlanResult;
89
- export declare function presentRead(seams: OmpPureSeams, plan: OmpReadPlan, file: {
90
- text: string;
91
- sourceDigest?: string;
92
- lineDigests?: readonly {
93
- line: number;
94
- digest: string;
95
- }[];
96
- }): OmpReadPresentResult;
97
- export declare function planSearch(seams: OmpPureSeams, input: unknown): OmpSearchPlanResult;
98
- export declare function presentSearch(seams: OmpPureSeams, plan: OmpSearchPlan, matches: readonly OmpSearchHostMatch[]): OmpSearchPresentResult;
99
- export declare function formatOmpIssues(issues: readonly OmpIssue[]): string;
100
- //# sourceMappingURL=omp-seam-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omp-seam-runtime.d.ts","sourceRoot":"","sources":["../../../src/core/tools/omp-seam-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7F,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC3B,QAAQ,CA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AE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GACtG,oBAAoB,CAEtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAEnF;AAED,wBAAgB,aAAa,CAC5B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,SAAS,kBAAkB,EAAE,GACpC,sBAAsB,CAExB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAEnE","sourcesContent":["/**\n * Typed runtime facade over the flag-gated OMP pure-seam loader.\n *\n * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate\n * request validation and output presentation to the vendored OMP pure seams.\n * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back\n * byte-identically to the pre-seam implementation.\n *\n * The loader exposes unknown-in/unknown-out signatures; all structural\n * assertions live in this single file so tool code stays clean.\n */\nimport { isOmpSeamsEnabled, loadOmpPureSeams, type OmpPureSeams } from \"./omp-pure-seams.ts\";\n\nexport interface OmpIssue {\n\treadonly field: string;\n\treadonly code: string;\n\treadonly message: string;\n}\n\nexport interface OmpReadPlan {\n\treadonly path: string;\n\treadonly offset: number;\n\treadonly limit: number;\n}\n\nexport type OmpReadPlanResult =\n\t| { readonly ok: true; readonly plan: OmpReadPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpReadPresentation {\n\treadonly text: string;\n\treadonly window: {\n\t\treadonly startLine: number;\n\t\treadonly endLine: number;\n\t\treadonly totalLines: number;\n\t\treadonly truncated: boolean;\n\t};\n}\n\nexport type OmpReadPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpReadPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nexport interface OmpSearchPlan {\n\treadonly pattern: string;\n\treadonly path: string;\n\treadonly glob?: string;\n\treadonly ignoreCase: boolean;\n\treadonly literal: boolean;\n\treadonly context: number;\n\treadonly limit: number;\n}\n\nexport type OmpSearchPlanResult =\n\t| { readonly ok: true; readonly plan: OmpSearchPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpSearchHostMatch {\n\treadonly file: string;\n\treadonly line: number;\n\treadonly column?: number;\n\treadonly text: string;\n\treadonly expectedLineHash?: string;\n}\n\nexport interface OmpSearchPresentation {\n\treadonly text: string;\n\treadonly totalMatches: number;\n\treadonly omittedMatches: number;\n\treadonly truncated: boolean;\n}\n\nexport type OmpSearchPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpSearchPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nlet cached: Promise<OmpPureSeams> | undefined;\n\n/**\n * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when\n * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to\n * the caller of the returned promise.\n */\nexport function getOmpSeams(): Promise<OmpPureSeams> | undefined {\n\tif (!isOmpSeamsEnabled()) return undefined;\n\tcached ??= loadOmpPureSeams();\n\treturn cached;\n}\n\nexport function planRead(seams: OmpPureSeams, input: unknown): OmpReadPlanResult {\n\treturn seams.planRead(input) as OmpReadPlanResult;\n}\n\nexport function presentRead(\n\tseams: OmpPureSeams,\n\tplan: OmpReadPlan,\n\tfile: { text: string; sourceDigest?: string; lineDigests?: readonly { line: number; digest: string }[] },\n): OmpReadPresentResult {\n\treturn seams.presentRead(plan, file) as OmpReadPresentResult;\n}\n\nexport function planSearch(seams: OmpPureSeams, input: unknown): OmpSearchPlanResult {\n\treturn seams.planSearch(input) as OmpSearchPlanResult;\n}\n\nexport function presentSearch(\n\tseams: OmpPureSeams,\n\tplan: OmpSearchPlan,\n\tmatches: readonly OmpSearchHostMatch[],\n): OmpSearchPresentResult {\n\treturn seams.presentSearch(plan, matches) as OmpSearchPresentResult;\n}\n\nexport function formatOmpIssues(issues: readonly OmpIssue[]): string {\n\treturn issues.map((issue) => `${issue.field}: ${issue.message}`).join(\"; \");\n}\n"]}
@@ -1,40 +0,0 @@
1
- /**
2
- * Typed runtime facade over the flag-gated OMP pure-seam loader.
3
- *
4
- * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate
5
- * request validation and output presentation to the vendored OMP pure seams.
6
- * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back
7
- * byte-identically to the pre-seam implementation.
8
- *
9
- * The loader exposes unknown-in/unknown-out signatures; all structural
10
- * assertions live in this single file so tool code stays clean.
11
- */
12
- import { isOmpSeamsEnabled, loadOmpPureSeams } from "./omp-pure-seams.js";
13
- let cached;
14
- /**
15
- * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when
16
- * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to
17
- * the caller of the returned promise.
18
- */
19
- export function getOmpSeams() {
20
- if (!isOmpSeamsEnabled())
21
- return undefined;
22
- cached ??= loadOmpPureSeams();
23
- return cached;
24
- }
25
- export function planRead(seams, input) {
26
- return seams.planRead(input);
27
- }
28
- export function presentRead(seams, plan, file) {
29
- return seams.presentRead(plan, file);
30
- }
31
- export function planSearch(seams, input) {
32
- return seams.planSearch(input);
33
- }
34
- export function presentSearch(seams, plan, matches) {
35
- return seams.presentSearch(plan, matches);
36
- }
37
- export function formatOmpIssues(issues) {
38
- return issues.map((issue) => `${issue.field}: ${issue.message}`).join("; ");
39
- }
40
- //# sourceMappingURL=omp-seam-runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omp-seam-runtime.js","sourceRoot":"","sources":["../../../src/core/tools/omp-seam-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAiE7F,IAAI,MAAyC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,WAAW,GAAsC;IAChE,IAAI,CAAC,iBAAiB,EAAE;QAAE,OAAO,SAAS,CAAC;IAC3C,MAAM,KAAK,gBAAgB,EAAE,CAAC;IAC9B,OAAO,MAAM,CAAC;AAAA,CACd;AAED,MAAM,UAAU,QAAQ,CAAC,KAAmB,EAAE,KAAc,EAAqB;IAChF,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAsB,CAAC;AAAA,CAClD;AAED,MAAM,UAAU,WAAW,CAC1B,KAAmB,EACnB,IAAiB,EACjB,IAAwG,EACjF;IACvB,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAyB,CAAC;AAAA,CAC7D;AAED,MAAM,UAAU,UAAU,CAAC,KAAmB,EAAE,KAAc,EAAuB;IACpF,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAwB,CAAC;AAAA,CACtD;AAED,MAAM,UAAU,aAAa,CAC5B,KAAmB,EACnB,IAAmB,EACnB,OAAsC,EACb;IACzB,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAA2B,CAAC;AAAA,CACpE;AAED,MAAM,UAAU,eAAe,CAAC,MAA2B,EAAU;IACpE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CAC5E","sourcesContent":["/**\n * Typed runtime facade over the flag-gated OMP pure-seam loader.\n *\n * Wiring boundary for I2 (ADR-OMP-008/009): the read and grep tools delegate\n * request validation and output presentation to the vendored OMP pure seams.\n * Enabled by default; `OMK_OMP_SEAMS=0` opts out and tool behavior falls back\n * byte-identically to the pre-seam implementation.\n *\n * The loader exposes unknown-in/unknown-out signatures; all structural\n * assertions live in this single file so tool code stays clean.\n */\nimport { isOmpSeamsEnabled, loadOmpPureSeams, type OmpPureSeams } from \"./omp-pure-seams.ts\";\n\nexport interface OmpIssue {\n\treadonly field: string;\n\treadonly code: string;\n\treadonly message: string;\n}\n\nexport interface OmpReadPlan {\n\treadonly path: string;\n\treadonly offset: number;\n\treadonly limit: number;\n}\n\nexport type OmpReadPlanResult =\n\t| { readonly ok: true; readonly plan: OmpReadPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpReadPresentation {\n\treadonly text: string;\n\treadonly window: {\n\t\treadonly startLine: number;\n\t\treadonly endLine: number;\n\t\treadonly totalLines: number;\n\t\treadonly truncated: boolean;\n\t};\n}\n\nexport type OmpReadPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpReadPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nexport interface OmpSearchPlan {\n\treadonly pattern: string;\n\treadonly path: string;\n\treadonly glob?: string;\n\treadonly ignoreCase: boolean;\n\treadonly literal: boolean;\n\treadonly context: number;\n\treadonly limit: number;\n}\n\nexport type OmpSearchPlanResult =\n\t| { readonly ok: true; readonly plan: OmpSearchPlan }\n\t| { readonly ok: false; readonly issues: readonly OmpIssue[] };\n\nexport interface OmpSearchHostMatch {\n\treadonly file: string;\n\treadonly line: number;\n\treadonly column?: number;\n\treadonly text: string;\n\treadonly expectedLineHash?: string;\n}\n\nexport interface OmpSearchPresentation {\n\treadonly text: string;\n\treadonly totalMatches: number;\n\treadonly omittedMatches: number;\n\treadonly truncated: boolean;\n}\n\nexport type OmpSearchPresentResult =\n\t| { readonly ok: true; readonly presentation: OmpSearchPresentation }\n\t| { readonly ok: false; readonly conflicts: readonly unknown[] };\n\nlet cached: Promise<OmpPureSeams> | undefined;\n\n/**\n * Returns the memoized seam set unless `OMK_OMP_SEAMS=0`; `undefined` when\n * opted out. Loader errors (VENDOR_NOT_FOUND, INVALID_SEAM) propagate to\n * the caller of the returned promise.\n */\nexport function getOmpSeams(): Promise<OmpPureSeams> | undefined {\n\tif (!isOmpSeamsEnabled()) return undefined;\n\tcached ??= loadOmpPureSeams();\n\treturn cached;\n}\n\nexport function planRead(seams: OmpPureSeams, input: unknown): OmpReadPlanResult {\n\treturn seams.planRead(input) as OmpReadPlanResult;\n}\n\nexport function presentRead(\n\tseams: OmpPureSeams,\n\tplan: OmpReadPlan,\n\tfile: { text: string; sourceDigest?: string; lineDigests?: readonly { line: number; digest: string }[] },\n): OmpReadPresentResult {\n\treturn seams.presentRead(plan, file) as OmpReadPresentResult;\n}\n\nexport function planSearch(seams: OmpPureSeams, input: unknown): OmpSearchPlanResult {\n\treturn seams.planSearch(input) as OmpSearchPlanResult;\n}\n\nexport function presentSearch(\n\tseams: OmpPureSeams,\n\tplan: OmpSearchPlan,\n\tmatches: readonly OmpSearchHostMatch[],\n): OmpSearchPresentResult {\n\treturn seams.presentSearch(plan, matches) as OmpSearchPresentResult;\n}\n\nexport function formatOmpIssues(issues: readonly OmpIssue[]): string {\n\treturn issues.map((issue) => `${issue.field}: ${issue.message}`).join(\"; \");\n}\n"]}
@@ -1,4 +0,0 @@
1
- import type { GuardrailAuditEvent } from "../types/guardrails.ts";
2
- export declare function appendAuditEvent(auditPath: string, event: GuardrailAuditEvent): Promise<void>;
3
- export declare function readAuditEvents(auditPath: string): GuardrailAuditEvent[];
4
- //# sourceMappingURL=audit-logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit-logger.d.ts","sourceRoot":"","sources":["../../src/guardrails/audit-logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAc7F;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAOxE","sourcesContent":["import { appendFileSync, existsSync, mkdirSync, readFileSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport type { GuardrailAuditEvent } from \"../types/guardrails.ts\";\n\nexport function appendAuditEvent(auditPath: string, event: GuardrailAuditEvent): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\ttry {\n\t\t\tconst dir = dirname(auditPath);\n\t\t\tif (!existsSync(dir)) {\n\t\t\t\tmkdirSync(dir, { recursive: true });\n\t\t\t}\n\t\t\tconst line = `${JSON.stringify(event)}\\n`;\n\t\t\tappendFileSync(auditPath, line, \"utf-8\");\n\t\t\tresolve();\n\t\t} catch (err) {\n\t\t\treject(err);\n\t\t}\n\t});\n}\n\nexport function readAuditEvents(auditPath: string): GuardrailAuditEvent[] {\n\tif (!existsSync(auditPath)) return [];\n\tconst content = readFileSync(auditPath, \"utf-8\");\n\treturn content\n\t\t.split(\"\\n\")\n\t\t.filter((line) => line.trim().length > 0)\n\t\t.map((line) => JSON.parse(line) as GuardrailAuditEvent);\n}\n"]}
@@ -1,28 +0,0 @@
1
- import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
2
- import { dirname } from "node:path";
3
- export function appendAuditEvent(auditPath, event) {
4
- return new Promise((resolve, reject) => {
5
- try {
6
- const dir = dirname(auditPath);
7
- if (!existsSync(dir)) {
8
- mkdirSync(dir, { recursive: true });
9
- }
10
- const line = `${JSON.stringify(event)}\n`;
11
- appendFileSync(auditPath, line, "utf-8");
12
- resolve();
13
- }
14
- catch (err) {
15
- reject(err);
16
- }
17
- });
18
- }
19
- export function readAuditEvents(auditPath) {
20
- if (!existsSync(auditPath))
21
- return [];
22
- const content = readFileSync(auditPath, "utf-8");
23
- return content
24
- .split("\n")
25
- .filter((line) => line.trim().length > 0)
26
- .map((line) => JSON.parse(line));
27
- }
28
- //# sourceMappingURL=audit-logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit-logger.js","sourceRoot":"","sources":["../../src/guardrails/audit-logger.ts"],"names":[],"mapp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irSync, readFileSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport type { GuardrailAuditEvent } from \"../types/guardrails.ts\";\n\nexport function appendAuditEvent(auditPath: string, event: GuardrailAuditEvent): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\ttry {\n\t\t\tconst dir = dirname(auditPath);\n\t\t\tif (!existsSync(dir)) {\n\t\t\t\tmkdirSync(dir, { recursive: true });\n\t\t\t}\n\t\t\tconst line = `${JSON.stringify(event)}\\n`;\n\t\t\tappendFileSync(auditPath, line, \"utf-8\");\n\t\t\tresolve();\n\t\t} catch (err) {\n\t\t\treject(err);\n\t\t}\n\t});\n}\n\nexport function readAuditEvents(auditPath: string): GuardrailAuditEvent[] {\n\tif (!existsSync(auditPath)) return [];\n\tconst content = readFileSync(auditPath, \"utf-8\");\n\treturn content\n\t\t.split(\"\\n\")\n\t\t.filter((line) => line.trim().length > 0)\n\t\t.map((line) => JSON.parse(line) as GuardrailAuditEvent);\n}\n"]}
@@ -1,16 +0,0 @@
1
- import type { FreedomdAdapter, GuardrailDecision } from "../types/guardrails.ts";
2
- export declare class UnifiedFreedomdAdapter implements FreedomdAdapter {
3
- private policy;
4
- private goalId?;
5
- private auditPath?;
6
- constructor(options?: {
7
- policyPath?: string;
8
- goalId?: string;
9
- auditPath?: string;
10
- });
11
- evaluate(toolName: string, toolInput: unknown): Promise<GuardrailDecision>;
12
- private sanitizeInput;
13
- private suggestAlternative;
14
- private log;
15
- }
16
- //# sourceMappingURL=freedomd-adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"freedomd-adapter.d.ts","sourceRoot":"","sources":["../../src/guardrails/freedomd-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,eAAe,EAEf,iBAAiB,EAGjB,MAAM,wBAAwB,CAAC;AAahC,qBAAa,sBAAuB,YAAW,eAAe;IAC7D,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B,YAAY,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EAMjF;IAEK,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqB/E;IAED,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,kBAAkB;YAeZ,GAAG;CAWjB","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport YAML from \"yaml\";\nimport type {\n\tFreedomdAdapter,\n\tGuardrailAuditEvent,\n\tGuardrailDecision,\n\tGuardrailPolicy,\n\tGuardrailRule,\n} from \"../types/guardrails.ts\";\nimport { appendAuditEvent } from \"./audit-logger.ts\";\n\nfunction getCurrentDir(): string {\n\ttry {\n\t\treturn dirname(fileURLToPath(import.meta.url));\n\t} catch {\n\t\treturn __dirname;\n\t}\n}\n\nconst DEFAULT_POLICY_PATH = join(getCurrentDir(), \"policy.yaml\");\n\nexport class UnifiedFreedomdAdapter implements FreedomdAdapter {\n\tprivate policy: GuardrailPolicy;\n\tprivate goalId?: string;\n\tprivate auditPath?: string;\n\n\tconstructor(options?: { policyPath?: string; goalId?: string; auditPath?: string }) {\n\t\tconst path = options?.policyPath ?? DEFAULT_POLICY_PATH;\n\t\tconst raw = readFileSync(path, \"utf-8\");\n\t\tthis.policy = YAML.parse(raw) as GuardrailPolicy;\n\t\tthis.goalId = options?.goalId;\n\t\tthis.auditPath = options?.auditPath;\n\t}\n\n\tasync evaluate(toolName: string, toolInput: unknown): Promise<GuardrailDecision> {\n\t\tconst inputText = this.sanitizeInput(toolInput);\n\n\t\tfor (const rule of this.policy.rules) {\n\t\t\tif (!rule.enabled) continue;\n\t\t\tif (rule.toolName && rule.toolName !== toolName) continue;\n\t\t\tif (rule.pattern && !new RegExp(rule.pattern, \"i\").test(inputText)) continue;\n\n\t\t\tconst decision: GuardrailDecision = {\n\t\t\t\tallowed: false,\n\t\t\t\trule,\n\t\t\t\treason: `Blocked by rule \"${rule.id}\": ${rule.description}`,\n\t\t\t\tsuggestion: this.suggestAlternative(rule),\n\t\t\t};\n\t\t\tawait this.log(toolName, inputText, decision);\n\t\t\treturn decision;\n\t\t}\n\n\t\tconst allow: GuardrailDecision = { allowed: true };\n\t\tawait this.log(toolName, inputText, allow);\n\t\treturn allow;\n\t}\n\n\tprivate sanitizeInput(input: unknown): string {\n\t\tif (input === null || input === undefined) return \"\";\n\t\tif (typeof input === \"string\") return input;\n\t\ttry {\n\t\t\treturn JSON.stringify(input);\n\t\t} catch {\n\t\t\treturn String(input);\n\t\t}\n\t}\n\n\tprivate suggestAlternative(rule: GuardrailRule): string | undefined {\n\t\tswitch (rule.category) {\n\t\t\tcase \"network\":\n\t\t\t\treturn \"Use context-mode_ctx_fetch_and_index or context-mode_ctx_execute instead of shell networking.\";\n\t\t\tcase \"destructive\":\n\t\t\t\treturn \"Use targeted rm of specific files or confirm destructive operations interactively.\";\n\t\t\tcase \"privilege_escalation\":\n\t\t\t\treturn \"Run the command without sudo or use a dedicated privileged lane grant.\";\n\t\t\tcase \"secret_exposure\":\n\t\t\t\treturn \"Avoid reading secret files; use environment-variable references with $ prefix.\";\n\t\t\tdefault:\n\t\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate async log(toolName: string, toolInput: string, decision: GuardrailDecision): Promise<void> {\n\t\tif (!this.auditPath) return;\n\t\tconst event: GuardrailAuditEvent = {\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tgoalId: this.goalId,\n\t\t\ttoolName,\n\t\t\ttoolInput,\n\t\t\tdecision,\n\t\t};\n\t\tawait appendAuditEvent(this.auditPath, event);\n\t}\n}\n"]}
@@ -1,87 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import YAML from "yaml";
5
- import { appendAuditEvent } from "./audit-logger.js";
6
- function getCurrentDir() {
7
- try {
8
- return dirname(fileURLToPath(import.meta.url));
9
- }
10
- catch {
11
- return __dirname;
12
- }
13
- }
14
- const DEFAULT_POLICY_PATH = join(getCurrentDir(), "policy.yaml");
15
- export class UnifiedFreedomdAdapter {
16
- policy;
17
- goalId;
18
- auditPath;
19
- constructor(options) {
20
- const path = options?.policyPath ?? DEFAULT_POLICY_PATH;
21
- const raw = readFileSync(path, "utf-8");
22
- this.policy = YAML.parse(raw);
23
- this.goalId = options?.goalId;
24
- this.auditPath = options?.auditPath;
25
- }
26
- async evaluate(toolName, toolInput) {
27
- const inputText = this.sanitizeInput(toolInput);
28
- for (const rule of this.policy.rules) {
29
- if (!rule.enabled)
30
- continue;
31
- if (rule.toolName && rule.toolName !== toolName)
32
- continue;
33
- if (rule.pattern && !new RegExp(rule.pattern, "i").test(inputText))
34
- continue;
35
- const decision = {
36
- allowed: false,
37
- rule,
38
- reason: `Blocked by rule "${rule.id}": ${rule.description}`,
39
- suggestion: this.suggestAlternative(rule),
40
- };
41
- await this.log(toolName, inputText, decision);
42
- return decision;
43
- }
44
- const allow = { allowed: true };
45
- await this.log(toolName, inputText, allow);
46
- return allow;
47
- }
48
- sanitizeInput(input) {
49
- if (input === null || input === undefined)
50
- return "";
51
- if (typeof input === "string")
52
- return input;
53
- try {
54
- return JSON.stringify(input);
55
- }
56
- catch {
57
- return String(input);
58
- }
59
- }
60
- suggestAlternative(rule) {
61
- switch (rule.category) {
62
- case "network":
63
- return "Use context-mode_ctx_fetch_and_index or context-mode_ctx_execute instead of shell networking.";
64
- case "destructive":
65
- return "Use targeted rm of specific files or confirm destructive operations interactively.";
66
- case "privilege_escalation":
67
- return "Run the command without sudo or use a dedicated privileged lane grant.";
68
- case "secret_exposure":
69
- return "Avoid reading secret files; use environment-variable references with $ prefix.";
70
- default:
71
- return undefined;
72
- }
73
- }
74
- async log(toolName, toolInput, decision) {
75
- if (!this.auditPath)
76
- return;
77
- const event = {
78
- timestamp: new Date().toISOString(),
79
- goalId: this.goalId,
80
- toolName,
81
- toolInput,
82
- decision,
83
- };
84
- await appendAuditEvent(this.auditPath, event);
85
- }
86
- }
87
- //# sourceMappingURL=freedomd-adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"freedomd-adapter.js","sourceRoot":"","sources":["../../src/guardrails/freedomd-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAQxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,SAAS,aAAa,GAAW;IAChC,IAAI,CAAC;QACJ,OAAO,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AAAA,CACD;AAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,EAAE,aAAa,CAAC,CAAC;AAEjE,MAAM,OAAO,sBAAsB;IAC1B,MAAM,CAAkB;IACxB,MAAM,CAAU;IAChB,SAAS,CAAU;IAE3B,YAAY,OAAsE,EAAE;QACnF,MAAM,IAAI,GAAG,OAAO,EAAE,UAAU,IAAI,mBAAmB,CAAC;QACxD,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAoB,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE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K,CAAC,CAAC;QAC9B,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IAAA,CACD;IAEO,kBAAkB,CAAC,IAAmB,EAAsB;QACnE,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvB,KAAK,SAAS;gBACb,OAAO,+FAA+F,CAAC;YACxG,KAAK,aAAa;gBACjB,OAAO,oFAAoF,CAAC;YAC7F,KAAK,sBAAsB;gBAC1B,OAAO,wEAAwE,CAAC;YACjF,KAAK,iBAAiB;gBACrB,OAAO,gFAAgF,CAAC;YACzF;gBACC,OAAO,SAAS,CAAC;QACnB,CAAC;IAAA,CACD;IAEO,KAAK,CAAC,GAAG,CAAC,QAAgB,EAAE,SAAiB,EAAE,QAA2B,EAAiB;QAClG,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO;QAC5B,MAAM,KAAK,GAAwB;YAClC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ;YACR,SAAS;YACT,QAAQ;SACR,CAAC;QACF,MAAM,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAAA,CAC9C;CACD","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport YAML from \"yaml\";\nimport type {\n\tFreedomdAdapter,\n\tGuardrailAuditEvent,\n\tGuardrailDecision,\n\tGuardrailPolicy,\n\tGuardrailRule,\n} from \"../types/guardrails.ts\";\nimport { appendAuditEvent } from \"./audit-logger.ts\";\n\nfunction getCurrentDir(): string {\n\ttry {\n\t\treturn dirname(fileURLToPath(import.meta.url));\n\t} catch {\n\t\treturn __dirname;\n\t}\n}\n\nconst DEFAULT_POLICY_PATH = join(getCurrentDir(), \"policy.yaml\");\n\nexport class UnifiedFreedomdAdapter implements FreedomdAdapter {\n\tprivate policy: GuardrailPolicy;\n\tprivate goalId?: string;\n\tprivate auditPath?: string;\n\n\tconstructor(options?: { policyPath?: string; goalId?: string; auditPath?: string }) {\n\t\tconst path = options?.policyPath ?? DEFAULT_POLICY_PATH;\n\t\tconst raw = readFileSync(path, \"utf-8\");\n\t\tthis.policy = YAML.parse(raw) as GuardrailPolicy;\n\t\tthis.goalId = options?.goalId;\n\t\tthis.auditPath = options?.auditPath;\n\t}\n\n\tasync evaluate(toolName: string, toolInput: unknown): Promise<GuardrailDecision> {\n\t\tconst inputText = this.sanitizeInput(toolInput);\n\n\t\tfor (const rule of this.policy.rules) {\n\t\t\tif (!rule.enabled) continue;\n\t\t\tif (rule.toolName && rule.toolName !== toolName) continue;\n\t\t\tif (rule.pattern && !new RegExp(rule.pattern, \"i\").test(inputText)) continue;\n\n\t\t\tconst decision: GuardrailDecision = {\n\t\t\t\tallowed: false,\n\t\t\t\trule,\n\t\t\t\treason: `Blocked by rule \"${rule.id}\": ${rule.description}`,\n\t\t\t\tsuggestion: this.suggestAlternative(rule),\n\t\t\t};\n\t\t\tawait this.log(toolName, inputText, decision);\n\t\t\treturn decision;\n\t\t}\n\n\t\tconst allow: GuardrailDecision = { allowed: true };\n\t\tawait this.log(toolName, inputText, allow);\n\t\treturn allow;\n\t}\n\n\tprivate sanitizeInput(input: unknown): string {\n\t\tif (input === null || input === undefined) return \"\";\n\t\tif (typeof input === \"string\") return input;\n\t\ttry {\n\t\t\treturn JSON.stringify(input);\n\t\t} catch {\n\t\t\treturn String(input);\n\t\t}\n\t}\n\n\tprivate suggestAlternative(rule: GuardrailRule): string | undefined {\n\t\tswitch (rule.category) {\n\t\t\tcase \"network\":\n\t\t\t\treturn \"Use context-mode_ctx_fetch_and_index or context-mode_ctx_execute instead of shell networking.\";\n\t\t\tcase \"destructive\":\n\t\t\t\treturn \"Use targeted rm of specific files or confirm destructive operations interactively.\";\n\t\t\tcase \"privilege_escalation\":\n\t\t\t\treturn \"Run the command without sudo or use a dedicated privileged lane grant.\";\n\t\t\tcase \"secret_exposure\":\n\t\t\t\treturn \"Avoid reading secret files; use environment-variable references with $ prefix.\";\n\t\t\tdefault:\n\t\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate async log(toolName: string, toolInput: string, decision: GuardrailDecision): Promise<void> {\n\t\tif (!this.auditPath) return;\n\t\tconst event: GuardrailAuditEvent = {\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t\tgoalId: this.goalId,\n\t\t\ttoolName,\n\t\t\ttoolInput,\n\t\t\tdecision,\n\t\t};\n\t\tawait appendAuditEvent(this.auditPath, event);\n\t}\n}\n"]}
@@ -1,4 +0,0 @@
1
- import type { LaneGrant, LaneGrantAuditReport } from "../types/lane-grant.ts";
2
- export declare function auditLaneGrants(grants: LaneGrant[], evidencePath: string): LaneGrantAuditReport;
3
- export declare function formatAuditReport(report: LaneGrantAuditReport): string;
4
- //# sourceMappingURL=lane-grant-auditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lane-grant-auditor.d.ts","sourceRoot":"","sources":["../../src/orchestration/lane-grant-auditor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAgB,MAAM,wBAAwB,CAAC;AAsB5F,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,oBAAoB,CA+C/F;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAuBtE","sourcesContent":["import { minimatch } from \"minimatch\";\nimport type { LaneGrant, LaneGrantAuditReport, PathConflict } from \"../types/lane-grant.ts\";\n\nfunction pathsOverlap(a: string, b: string): boolean {\n\tconst normalizedA = a.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n\tconst normalizedB = b.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n\tif (normalizedA === normalizedB) return true;\n\tif (minimatch(normalizedA, normalizedB) || minimatch(normalizedB, normalizedA)) return true;\n\tif (normalizedA.startsWith(`${normalizedB}/`) || normalizedB.startsWith(`${normalizedA}/`)) return true;\n\treturn false;\n}\n\nfunction hasOverlap(scopesA: string[], scopesB: string[]): { overlaps: boolean; path: string } {\n\tfor (const a of scopesA) {\n\t\tfor (const b of scopesB) {\n\t\t\tif (pathsOverlap(a, b)) {\n\t\t\t\treturn { overlaps: true, path: a };\n\t\t\t}\n\t\t}\n\t}\n\treturn { overlaps: false, path: \"\" };\n}\n\nexport function auditLaneGrants(grants: LaneGrant[], evidencePath: string): LaneGrantAuditReport {\n\tconst conflicts: PathConflict[] = [];\n\n\tfor (let i = 0; i < grants.length; i++) {\n\t\tfor (let j = i + 1; j < grants.length; j++) {\n\t\t\tconst a = grants[i];\n\t\t\tconst b = grants[j];\n\n\t\t\t// Only writers can conflict with each other.\n\t\t\tif (a.authority !== \"write-scoped\" || b.authority !== \"write-scoped\") continue;\n\n\t\t\tconst writeA = a.allowedPaths;\n\t\t\tconst writeB = b.allowedPaths;\n\t\t\tconst overlap = hasOverlap(writeA, writeB);\n\n\t\t\tif (overlap.overlaps) {\n\t\t\t\tconflicts.push({\n\t\t\t\t\tlanes: [a.laneId, b.laneId],\n\t\t\t\t\toverlappingPath: overlap.path,\n\t\t\t\t\tseverity: \"merge-blocked\",\n\t\t\t\t\tsuggestion: `Serialize lanes ${a.laneId} and ${b.laneId}, or split write scopes so they do not overlap at ${overlap.path}.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Any grant writing to a blocked path is a merge-blocker.\n\t\tconst grant = grants[i];\n\t\tfor (const allowed of grant.allowedPaths) {\n\t\t\tfor (const blocked of grant.blockedPaths) {\n\t\t\t\tif (pathsOverlap(allowed, blocked)) {\n\t\t\t\t\tconflicts.push({\n\t\t\t\t\t\tlanes: [grant.laneId, grant.laneId],\n\t\t\t\t\t\toverlappingPath: blocked,\n\t\t\t\t\t\tseverity: \"merge-blocked\",\n\t\t\t\t\t\tsuggestion: `Remove ${blocked} from allowedPaths or add an exception; it overlaps blockedPaths in ${grant.laneId}.`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tgrants,\n\t\tconflicts,\n\t\tmergeBlocked: conflicts.some((c) => c.severity === \"merge-blocked\"),\n\t\tevidencePath,\n\t};\n}\n\nexport function formatAuditReport(report: LaneGrantAuditReport): string {\n\tconst lines: string[] = [\n\t\t`# Lane Grant Audit Report`,\n\t\t\"\",\n\t\t`- Lanes audited: ${report.grants.length}`,\n\t\t`- Conflicts detected: ${report.conflicts.length}`,\n\t\t`- Merge blocked: ${report.mergeBlocked ? \"YES\" : \"NO\"}`,\n\t\t\"\",\n\t];\n\n\tif (report.conflicts.length === 0) {\n\t\tlines.push(\"No path conflicts detected.\");\n\t} else {\n\t\tlines.push(\"## Conflicts\");\n\t\tfor (const conflict of report.conflicts) {\n\t\t\tlines.push(\n\t\t\t\t`- **${conflict.severity.toUpperCase()}** \\`${conflict.lanes.join(\" ↔ \")}\\` at \\`${conflict.overlappingPath}\\``,\n\t\t\t);\n\t\t\tlines.push(` - Suggestion: ${conflict.suggestion}`);\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n"]}
@@ -1,87 +0,0 @@
1
- import { minimatch } from "minimatch";
2
- function pathsOverlap(a, b) {
3
- const normalizedA = a.replace(/\\/g, "/").replace(/\/$/, "");
4
- const normalizedB = b.replace(/\\/g, "/").replace(/\/$/, "");
5
- if (normalizedA === normalizedB)
6
- return true;
7
- if (minimatch(normalizedA, normalizedB) || minimatch(normalizedB, normalizedA))
8
- return true;
9
- if (normalizedA.startsWith(`${normalizedB}/`) || normalizedB.startsWith(`${normalizedA}/`))
10
- return true;
11
- return false;
12
- }
13
- function hasOverlap(scopesA, scopesB) {
14
- for (const a of scopesA) {
15
- for (const b of scopesB) {
16
- if (pathsOverlap(a, b)) {
17
- return { overlaps: true, path: a };
18
- }
19
- }
20
- }
21
- return { overlaps: false, path: "" };
22
- }
23
- export function auditLaneGrants(grants, evidencePath) {
24
- const conflicts = [];
25
- for (let i = 0; i < grants.length; i++) {
26
- for (let j = i + 1; j < grants.length; j++) {
27
- const a = grants[i];
28
- const b = grants[j];
29
- // Only writers can conflict with each other.
30
- if (a.authority !== "write-scoped" || b.authority !== "write-scoped")
31
- continue;
32
- const writeA = a.allowedPaths;
33
- const writeB = b.allowedPaths;
34
- const overlap = hasOverlap(writeA, writeB);
35
- if (overlap.overlaps) {
36
- conflicts.push({
37
- lanes: [a.laneId, b.laneId],
38
- overlappingPath: overlap.path,
39
- severity: "merge-blocked",
40
- suggestion: `Serialize lanes ${a.laneId} and ${b.laneId}, or split write scopes so they do not overlap at ${overlap.path}.`,
41
- });
42
- }
43
- }
44
- // Any grant writing to a blocked path is a merge-blocker.
45
- const grant = grants[i];
46
- for (const allowed of grant.allowedPaths) {
47
- for (const blocked of grant.blockedPaths) {
48
- if (pathsOverlap(allowed, blocked)) {
49
- conflicts.push({
50
- lanes: [grant.laneId, grant.laneId],
51
- overlappingPath: blocked,
52
- severity: "merge-blocked",
53
- suggestion: `Remove ${blocked} from allowedPaths or add an exception; it overlaps blockedPaths in ${grant.laneId}.`,
54
- });
55
- }
56
- }
57
- }
58
- }
59
- return {
60
- grants,
61
- conflicts,
62
- mergeBlocked: conflicts.some((c) => c.severity === "merge-blocked"),
63
- evidencePath,
64
- };
65
- }
66
- export function formatAuditReport(report) {
67
- const lines = [
68
- `# Lane Grant Audit Report`,
69
- "",
70
- `- Lanes audited: ${report.grants.length}`,
71
- `- Conflicts detected: ${report.conflicts.length}`,
72
- `- Merge blocked: ${report.mergeBlocked ? "YES" : "NO"}`,
73
- "",
74
- ];
75
- if (report.conflicts.length === 0) {
76
- lines.push("No path conflicts detected.");
77
- }
78
- else {
79
- lines.push("## Conflicts");
80
- for (const conflict of report.conflicts) {
81
- lines.push(`- **${conflict.severity.toUpperCase()}** \`${conflict.lanes.join(" ↔ ")}\` at \`${conflict.overlappingPath}\``);
82
- lines.push(` - Suggestion: ${conflict.suggestion}`);
83
- }
84
- }
85
- return lines.join("\n");
86
- }
87
- //# sourceMappingURL=lane-grant-auditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lane-grant-auditor.js","sourceRoot":"","sources":["../../src/orchestration/lane-grant-auditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,SAAS,YAAY,CAAC,CAAS,EAAE,CAAS,EAAW;IACpD,MAAM,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7D,IAAI,WAAW,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC7C,IAAI,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5F,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,GAAG,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACxG,OAAO,KAAK,CAAC;AAAA,CACb;AAED,SAAS,UAAU,CAAC,OAAiB,EAAE,OAAiB,EAAuC;IAC9F,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACzB,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACzB,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;gBACxB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YACpC,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,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Q,CAAC,KAAK,CAAC,IAAI,CAAC,OAAK,CAAC,WAAW,QAAQ,CAAC,eAAe,IAAI,CAC/G,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,mBAAmB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACtD,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACxB","sourcesContent":["import { minimatch } from \"minimatch\";\nimport type { LaneGrant, LaneGrantAuditReport, PathConflict } from \"../types/lane-grant.ts\";\n\nfunction pathsOverlap(a: string, b: string): boolean {\n\tconst normalizedA = a.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n\tconst normalizedB = b.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n\tif (normalizedA === normalizedB) return true;\n\tif (minimatch(normalizedA, normalizedB) || minimatch(normalizedB, normalizedA)) return true;\n\tif (normalizedA.startsWith(`${normalizedB}/`) || normalizedB.startsWith(`${normalizedA}/`)) return true;\n\treturn false;\n}\n\nfunction hasOverlap(scopesA: string[], scopesB: string[]): { overlaps: boolean; path: string } {\n\tfor (const a of scopesA) {\n\t\tfor (const b of scopesB) {\n\t\t\tif (pathsOverlap(a, b)) {\n\t\t\t\treturn { overlaps: true, path: a };\n\t\t\t}\n\t\t}\n\t}\n\treturn { overlaps: false, path: \"\" };\n}\n\nexport function auditLaneGrants(grants: LaneGrant[], evidencePath: string): LaneGrantAuditReport {\n\tconst conflicts: PathConflict[] = [];\n\n\tfor (let i = 0; i < grants.length; i++) {\n\t\tfor (let j = i + 1; j < grants.length; j++) {\n\t\t\tconst a = grants[i];\n\t\t\tconst b = grants[j];\n\n\t\t\t// Only writers can conflict with each other.\n\t\t\tif (a.authority !== \"write-scoped\" || b.authority !== \"write-scoped\") continue;\n\n\t\t\tconst writeA = a.allowedPaths;\n\t\t\tconst writeB = b.allowedPaths;\n\t\t\tconst overlap = hasOverlap(writeA, writeB);\n\n\t\t\tif (overlap.overlaps) {\n\t\t\t\tconflicts.push({\n\t\t\t\t\tlanes: [a.laneId, b.laneId],\n\t\t\t\t\toverlappingPath: overlap.path,\n\t\t\t\t\tseverity: \"merge-blocked\",\n\t\t\t\t\tsuggestion: `Serialize lanes ${a.laneId} and ${b.laneId}, or split write scopes so they do not overlap at ${overlap.path}.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Any grant writing to a blocked path is a merge-blocker.\n\t\tconst grant = grants[i];\n\t\tfor (const allowed of grant.allowedPaths) {\n\t\t\tfor (const blocked of grant.blockedPaths) {\n\t\t\t\tif (pathsOverlap(allowed, blocked)) {\n\t\t\t\t\tconflicts.push({\n\t\t\t\t\t\tlanes: [grant.laneId, grant.laneId],\n\t\t\t\t\t\toverlappingPath: blocked,\n\t\t\t\t\t\tseverity: \"merge-blocked\",\n\t\t\t\t\t\tsuggestion: `Remove ${blocked} from allowedPaths or add an exception; it overlaps blockedPaths in ${grant.laneId}.`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tgrants,\n\t\tconflicts,\n\t\tmergeBlocked: conflicts.some((c) => c.severity === \"merge-blocked\"),\n\t\tevidencePath,\n\t};\n}\n\nexport function formatAuditReport(report: LaneGrantAuditReport): string {\n\tconst lines: string[] = [\n\t\t`# Lane Grant Audit Report`,\n\t\t\"\",\n\t\t`- Lanes audited: ${report.grants.length}`,\n\t\t`- Conflicts detected: ${report.conflicts.length}`,\n\t\t`- Merge blocked: ${report.mergeBlocked ? \"YES\" : \"NO\"}`,\n\t\t\"\",\n\t];\n\n\tif (report.conflicts.length === 0) {\n\t\tlines.push(\"No path conflicts detected.\");\n\t} else {\n\t\tlines.push(\"## Conflicts\");\n\t\tfor (const conflict of report.conflicts) {\n\t\t\tlines.push(\n\t\t\t\t`- **${conflict.severity.toUpperCase()}** \\`${conflict.lanes.join(\" ↔ \")}\\` at \\`${conflict.overlappingPath}\\``,\n\t\t\t);\n\t\t\tlines.push(` - Suggestion: ${conflict.suggestion}`);\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n"]}
@@ -1,61 +0,0 @@
1
- /**
2
- * Unified guardrail types for OMK hard-fork runtime.
3
- *
4
- * Integrates Freedomd strict policy with OMK native extension-based
5
- * safety hooks (formerly hooks/). All tool/block decisions flow through
6
- * a single `GuardrailDecision` produced by the `FreedomdAdapter`.
7
- */
8
- export type ToolCategory = "destructive" | "network" | "secret_exposure" | "privilege_escalation" | "filesystem" | "shell" | "unknown";
9
- export type BlockOrigin = "freedomd" | "omk_extension" | "unified_policy";
10
- export interface GuardrailRule {
11
- /** Unique rule identifier (kebab-case). */
12
- id: string;
13
- /** Human-readable description of what is being blocked. */
14
- description: string;
15
- /** Risk category for audit logs. */
16
- category: ToolCategory;
17
- /** Where this rule originated. */
18
- origin: BlockOrigin;
19
- /** Optional glob or regex matched against tool input. */
20
- pattern?: string;
21
- /** Optional exact tool name to match. */
22
- toolName?: string;
23
- /** When true the rule is active. */
24
- enabled: boolean;
25
- }
26
- export interface GuardrailPolicy {
27
- version: string;
28
- /** Default action when no rule matches. */
29
- defaultAction: "allow" | "deny";
30
- /** Ordered list of unified rules. */
31
- rules: GuardrailRule[];
32
- }
33
- export interface GuardrailDecision {
34
- allowed: boolean;
35
- /** Matched rule, if any. */
36
- rule?: GuardrailRule;
37
- /** Human-readable reason for the decision. */
38
- reason?: string;
39
- /** Suggested safe alternative, if blocked. */
40
- suggestion?: string;
41
- }
42
- export interface GuardrailAuditEvent {
43
- /** ISO-8601 timestamp. */
44
- timestamp: string;
45
- /** Goal or session identifier. */
46
- goalId?: string;
47
- /** Tool name that was evaluated. */
48
- toolName: string;
49
- /** Tool input that was evaluated (sanitized, no secrets). */
50
- toolInput: string;
51
- /** Final decision. */
52
- decision: GuardrailDecision;
53
- }
54
- export interface FreedomdAdapter {
55
- /**
56
- * Evaluate a tool call against the unified policy.
57
- * @returns a `GuardrailDecision` and optionally emits an audit event.
58
- */
59
- evaluate(toolName: string, toolInput: unknown): Promise<GuardrailDecision>;
60
- }
61
- //# sourceMappingURL=guardrails.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guardrails.d.ts","sourceRoot":"","sources":["../../src/types/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,YAAY,GACrB,aAAa,GACb,SAAS,GACT,iBAAiB,GACjB,sBAAsB,GACtB,YAAY,GACZ,OAAO,GACP,SAAS,CAAC;AAEb,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC7B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,EAAE,YAAY,CAAC;IACvB,kCAAkC;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,aAAa,EAAE,OAAO,GAAG,MAAM,CAAC;IAChC,qCAAqC;IACrC,KAAK,EAAE,aAAa,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IACnC,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,QAAQ,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC3E","sourcesContent":["/**\n * Unified guardrail types for OMK hard-fork runtime.\n *\n * Integrates Freedomd strict policy with OMK native extension-based\n * safety hooks (formerly hooks/). All tool/block decisions flow through\n * a single `GuardrailDecision` produced by the `FreedomdAdapter`.\n */\n\nexport type ToolCategory =\n\t| \"destructive\"\n\t| \"network\"\n\t| \"secret_exposure\"\n\t| \"privilege_escalation\"\n\t| \"filesystem\"\n\t| \"shell\"\n\t| \"unknown\";\n\nexport type BlockOrigin = \"freedomd\" | \"omk_extension\" | \"unified_policy\";\n\nexport interface GuardrailRule {\n\t/** Unique rule identifier (kebab-case). */\n\tid: string;\n\t/** Human-readable description of what is being blocked. */\n\tdescription: string;\n\t/** Risk category for audit logs. */\n\tcategory: ToolCategory;\n\t/** Where this rule originated. */\n\torigin: BlockOrigin;\n\t/** Optional glob or regex matched against tool input. */\n\tpattern?: string;\n\t/** Optional exact tool name to match. */\n\ttoolName?: string;\n\t/** When true the rule is active. */\n\tenabled: boolean;\n}\n\nexport interface GuardrailPolicy {\n\tversion: string;\n\t/** Default action when no rule matches. */\n\tdefaultAction: \"allow\" | \"deny\";\n\t/** Ordered list of unified rules. */\n\trules: GuardrailRule[];\n}\n\nexport interface GuardrailDecision {\n\tallowed: boolean;\n\t/** Matched rule, if any. */\n\trule?: GuardrailRule;\n\t/** Human-readable reason for the decision. */\n\treason?: string;\n\t/** Suggested safe alternative, if blocked. */\n\tsuggestion?: string;\n}\n\nexport interface GuardrailAuditEvent {\n\t/** ISO-8601 timestamp. */\n\ttimestamp: string;\n\t/** Goal or session identifier. */\n\tgoalId?: string;\n\t/** Tool name that was evaluated. */\n\ttoolName: string;\n\t/** Tool input that was evaluated (sanitized, no secrets). */\n\ttoolInput: string;\n\t/** Final decision. */\n\tdecision: GuardrailDecision;\n}\n\nexport interface FreedomdAdapter {\n\t/**\n\t * Evaluate a tool call against the unified policy.\n\t * @returns a `GuardrailDecision` and optionally emits an audit event.\n\t */\n\tevaluate(toolName: string, toolInput: unknown): Promise<GuardrailDecision>;\n}\n"]}
@@ -1,9 +0,0 @@
1
- /**
2
- * Unified guardrail types for OMK hard-fork runtime.
3
- *
4
- * Integrates Freedomd strict policy with OMK native extension-based
5
- * safety hooks (formerly hooks/). All tool/block decisions flow through
6
- * a single `GuardrailDecision` produced by the `FreedomdAdapter`.
7
- */
8
- export {};
9
- //# sourceMappingURL=guardrails.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guardrails.js","sourceRoot":"","sources":["../../src/types/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * Unified guardrail types for OMK hard-fork runtime.\n *\n * Integrates Freedomd strict policy with OMK native extension-based\n * safety hooks (formerly hooks/). All tool/block decisions flow through\n * a single `GuardrailDecision` produced by the `FreedomdAdapter`.\n */\n\nexport type ToolCategory =\n\t| \"destructive\"\n\t| \"network\"\n\t| \"secret_exposure\"\n\t| \"privilege_escalation\"\n\t| \"filesystem\"\n\t| \"shell\"\n\t| \"unknown\";\n\nexport type BlockOrigin = \"freedomd\" | \"omk_extension\" | \"unified_policy\";\n\nexport interface GuardrailRule {\n\t/** Unique rule identifier (kebab-case). */\n\tid: string;\n\t/** Human-readable description of what is being blocked. */\n\tdescription: string;\n\t/** Risk category for audit logs. */\n\tcategory: ToolCategory;\n\t/** Where this rule originated. */\n\torigin: BlockOrigin;\n\t/** Optional glob or regex matched against tool input. */\n\tpattern?: string;\n\t/** Optional exact tool name to match. */\n\ttoolName?: string;\n\t/** When true the rule is active. */\n\tenabled: boolean;\n}\n\nexport interface GuardrailPolicy {\n\tversion: string;\n\t/** Default action when no rule matches. */\n\tdefaultAction: \"allow\" | \"deny\";\n\t/** Ordered list of unified rules. */\n\trules: GuardrailRule[];\n}\n\nexport interface GuardrailDecision {\n\tallowed: boolean;\n\t/** Matched rule, if any. */\n\trule?: GuardrailRule;\n\t/** Human-readable reason for the decision. */\n\treason?: string;\n\t/** Suggested safe alternative, if blocked. */\n\tsuggestion?: string;\n}\n\nexport interface GuardrailAuditEvent {\n\t/** ISO-8601 timestamp. */\n\ttimestamp: string;\n\t/** Goal or session identifier. */\n\tgoalId?: string;\n\t/** Tool name that was evaluated. */\n\ttoolName: string;\n\t/** Tool input that was evaluated (sanitized, no secrets). */\n\ttoolInput: string;\n\t/** Final decision. */\n\tdecision: GuardrailDecision;\n}\n\nexport interface FreedomdAdapter {\n\t/**\n\t * Evaluate a tool call against the unified policy.\n\t * @returns a `GuardrailDecision` and optionally emits an audit event.\n\t */\n\tevaluate(toolName: string, toolInput: unknown): Promise<GuardrailDecision>;\n}\n"]}