context-brake 0.0.0-stage → 1.0.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 (506) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +361 -2
  3. package/dist/assets/runtime/antigravity-cli-hook.mjs +19174 -0
  4. package/dist/assets/runtime/claude-code-hook.mjs +19302 -0
  5. package/dist/assets/runtime/claude-code-mod.mjs +18579 -0
  6. package/dist/assets/runtime/claude-code-statusline.mjs +18749 -0
  7. package/dist/assets/runtime/codex-cli-hook.mjs +19299 -0
  8. package/dist/assets/runtime/context-brake-runtime.mjs +6 -0
  9. package/dist/assets/runtime/cursor-hook.mjs +19181 -0
  10. package/dist/assets/runtime/github-copilot-cli-hook.mjs +19186 -0
  11. package/dist/assets/runtime/omp-extension.js +19237 -0
  12. package/dist/assets/runtime/omp-restart.js +18763 -0
  13. package/dist/assets/runtime/opencode-plugin.js +19200 -0
  14. package/dist/assets/runtime/pi-extension.js +19228 -0
  15. package/dist/assets/runtime/pi-restart.js +18758 -0
  16. package/dist/src/cli/argument-parser.d.ts +20 -0
  17. package/dist/src/cli/argument-parser.js +45 -0
  18. package/dist/src/cli/argument-validator.d.ts +8 -0
  19. package/dist/src/cli/argument-validator.js +24 -0
  20. package/dist/src/cli/assistant/ask.d.ts +10 -0
  21. package/dist/src/cli/assistant/ask.js +36 -0
  22. package/dist/src/cli/assistant/assistant-context.d.ts +9 -0
  23. package/dist/src/cli/assistant/assistant-context.js +18 -0
  24. package/dist/src/cli/assistant/assistant-questions.d.ts +3 -0
  25. package/dist/src/cli/assistant/assistant-questions.js +26 -0
  26. package/dist/src/cli/assistant/assistant-session.d.ts +5 -0
  27. package/dist/src/cli/assistant/assistant-session.js +25 -0
  28. package/dist/src/cli/assistant/clack-prompt-port.d.ts +14 -0
  29. package/dist/src/cli/assistant/clack-prompt-port.js +47 -0
  30. package/dist/src/cli/assistant/equivalent-command.d.ts +1 -0
  31. package/dist/src/cli/assistant/equivalent-command.js +16 -0
  32. package/dist/src/cli/assistant/prompt-factory.d.ts +3 -0
  33. package/dist/src/cli/assistant/prompt-factory.js +16 -0
  34. package/dist/src/cli/assistant/prompt-port.d.ts +14 -0
  35. package/dist/src/cli/assistant/prompt-port.js +28 -0
  36. package/dist/src/cli/assistant/questions-gitignore.d.ts +7 -0
  37. package/dist/src/cli/assistant/questions-gitignore.js +14 -0
  38. package/dist/src/cli/assistant/questions-harness.d.ts +9 -0
  39. package/dist/src/cli/assistant/questions-harness.js +52 -0
  40. package/dist/src/cli/assistant/questions-misc.d.ts +10 -0
  41. package/dist/src/cli/assistant/questions-misc.js +25 -0
  42. package/dist/src/cli/assistant/questions-restart.d.ts +15 -0
  43. package/dist/src/cli/assistant/questions-restart.js +51 -0
  44. package/dist/src/cli/assistant/questions-snapshot.d.ts +9 -0
  45. package/dist/src/cli/assistant/questions-snapshot.js +64 -0
  46. package/dist/src/cli/assistant/snapshot-specs.d.ts +4 -0
  47. package/dist/src/cli/assistant/snapshot-specs.js +22 -0
  48. package/dist/src/cli/assistant/summary.d.ts +2 -0
  49. package/dist/src/cli/assistant/summary.js +34 -0
  50. package/dist/src/cli/assistant/types.d.ts +37 -0
  51. package/dist/src/cli/assistant/types.js +1 -0
  52. package/dist/src/cli/assistant/ui-prompt.d.ts +29 -0
  53. package/dist/src/cli/assistant/ui-prompt.js +1 -0
  54. package/dist/src/cli/commands/doctor.d.ts +3 -0
  55. package/dist/src/cli/commands/doctor.js +56 -0
  56. package/dist/src/cli/commands/init.d.ts +4 -0
  57. package/dist/src/cli/commands/init.js +26 -0
  58. package/dist/src/cli/commands/remove.d.ts +3 -0
  59. package/dist/src/cli/commands/remove.js +62 -0
  60. package/dist/src/cli/composition-root.d.ts +3 -0
  61. package/dist/src/cli/composition-root.js +62 -0
  62. package/dist/src/cli/confirmation.d.ts +6 -0
  63. package/dist/src/cli/confirmation.js +22 -0
  64. package/dist/src/cli/detection-collector.d.ts +14 -0
  65. package/dist/src/cli/detection-collector.js +31 -0
  66. package/dist/src/cli/exit-codes.d.ts +8 -0
  67. package/dist/src/cli/exit-codes.js +8 -0
  68. package/dist/src/cli/gitignore-findings.d.ts +3 -0
  69. package/dist/src/cli/gitignore-findings.js +11 -0
  70. package/dist/src/cli/handoff-findings.d.ts +5 -0
  71. package/dist/src/cli/handoff-findings.js +15 -0
  72. package/dist/src/cli/init-arguments.d.ts +25 -0
  73. package/dist/src/cli/init-arguments.js +70 -0
  74. package/dist/src/cli/init-config-state.d.ts +14 -0
  75. package/dist/src/cli/init-config-state.js +19 -0
  76. package/dist/src/cli/init-config-updates.d.ts +13 -0
  77. package/dist/src/cli/init-config-updates.js +35 -0
  78. package/dist/src/cli/init-flow.d.ts +14 -0
  79. package/dist/src/cli/init-flow.js +72 -0
  80. package/dist/src/cli/init-option-rules.d.ts +11 -0
  81. package/dist/src/cli/init-option-rules.js +29 -0
  82. package/dist/src/cli/main.d.ts +3 -0
  83. package/dist/src/cli/main.js +62 -0
  84. package/dist/src/cli/output/detection-text.d.ts +2 -0
  85. package/dist/src/cli/output/detection-text.js +3 -0
  86. package/dist/src/cli/output/doctor-mode-text.d.ts +2 -0
  87. package/dist/src/cli/output/doctor-mode-text.js +12 -0
  88. package/dist/src/cli/output/doctor-sessions-text.d.ts +2 -0
  89. package/dist/src/cli/output/doctor-sessions-text.js +12 -0
  90. package/dist/src/cli/output/json.d.ts +1 -0
  91. package/dist/src/cli/output/json.js +3 -0
  92. package/dist/src/cli/output/text.d.ts +5 -0
  93. package/dist/src/cli/output/text.js +68 -0
  94. package/dist/src/cli/snapshot-helper.d.ts +3 -0
  95. package/dist/src/cli/snapshot-helper.js +25 -0
  96. package/dist/src/cli/terminal.d.ts +9 -0
  97. package/dist/src/cli/terminal.js +18 -0
  98. package/dist/src/core/contracts/adapter.d.ts +49 -0
  99. package/dist/src/core/contracts/adapter.js +1 -0
  100. package/dist/src/core/contracts/auto-restart.d.ts +10 -0
  101. package/dist/src/core/contracts/auto-restart.js +10 -0
  102. package/dist/src/core/contracts/changes.d.ts +219 -0
  103. package/dist/src/core/contracts/changes.js +13 -0
  104. package/dist/src/core/contracts/configuration.d.ts +81 -0
  105. package/dist/src/core/contracts/configuration.js +52 -0
  106. package/dist/src/core/contracts/context-window-report.d.ts +16 -0
  107. package/dist/src/core/contracts/context-window-report.js +8 -0
  108. package/dist/src/core/contracts/diagnostics.d.ts +546 -0
  109. package/dist/src/core/contracts/diagnostics.js +35 -0
  110. package/dist/src/core/contracts/handoff.d.ts +10 -0
  111. package/dist/src/core/contracts/handoff.js +3 -0
  112. package/dist/src/core/contracts/harness.d.ts +73 -0
  113. package/dist/src/core/contracts/harness.js +23 -0
  114. package/dist/src/core/contracts/hook-phase.d.ts +12 -0
  115. package/dist/src/core/contracts/hook-phase.js +1 -0
  116. package/dist/src/core/contracts/manifest.d.ts +69 -0
  117. package/dist/src/core/contracts/manifest.js +20 -0
  118. package/dist/src/core/contracts/processes.d.ts +24 -0
  119. package/dist/src/core/contracts/processes.js +1 -0
  120. package/dist/src/core/contracts/restart-host.d.ts +32 -0
  121. package/dist/src/core/contracts/restart-host.js +3 -0
  122. package/dist/src/core/contracts/restart-log.d.ts +52 -0
  123. package/dist/src/core/contracts/restart-log.js +15 -0
  124. package/dist/src/core/contracts/runtime.d.ts +50 -0
  125. package/dist/src/core/contracts/runtime.js +1 -0
  126. package/dist/src/core/contracts/session-ledger.d.ts +144 -0
  127. package/dist/src/core/contracts/session-ledger.js +38 -0
  128. package/dist/src/core/contracts/statusline-line.d.ts +20 -0
  129. package/dist/src/core/contracts/statusline-line.js +13 -0
  130. package/dist/src/core/contracts/zones.d.ts +18 -0
  131. package/dist/src/core/contracts/zones.js +4 -0
  132. package/dist/src/core/services/active-sessions.d.ts +17 -0
  133. package/dist/src/core/services/active-sessions.js +35 -0
  134. package/dist/src/core/services/asset-currency.d.ts +17 -0
  135. package/dist/src/core/services/asset-currency.js +72 -0
  136. package/dist/src/core/services/auto-restart-merge.d.ts +26 -0
  137. package/dist/src/core/services/auto-restart-merge.js +30 -0
  138. package/dist/src/core/services/auto-restart-notices.d.ts +6 -0
  139. package/dist/src/core/services/auto-restart-notices.js +27 -0
  140. package/dist/src/core/services/auto-restart-policy.d.ts +26 -0
  141. package/dist/src/core/services/auto-restart-policy.js +23 -0
  142. package/dist/src/core/services/brake-engine.d.ts +24 -0
  143. package/dist/src/core/services/brake-engine.js +61 -0
  144. package/dist/src/core/services/change-plan-service.d.ts +11 -0
  145. package/dist/src/core/services/change-plan-service.js +60 -0
  146. package/dist/src/core/services/config-legacy-checks.d.ts +6 -0
  147. package/dist/src/core/services/config-legacy-checks.js +28 -0
  148. package/dist/src/core/services/debug-mode-merge.d.ts +25 -0
  149. package/dist/src/core/services/debug-mode-merge.js +21 -0
  150. package/dist/src/core/services/detection-service.d.ts +6 -0
  151. package/dist/src/core/services/detection-service.js +54 -0
  152. package/dist/src/core/services/doctor-checks.d.ts +6 -0
  153. package/dist/src/core/services/doctor-checks.js +24 -0
  154. package/dist/src/core/services/doctor-report-extras.d.ts +11 -0
  155. package/dist/src/core/services/doctor-report-extras.js +23 -0
  156. package/dist/src/core/services/doctor-service.d.ts +24 -0
  157. package/dist/src/core/services/doctor-service.js +82 -0
  158. package/dist/src/core/services/failure-policy.d.ts +38 -0
  159. package/dist/src/core/services/failure-policy.js +63 -0
  160. package/dist/src/core/services/gitignore-block.d.ts +10 -0
  161. package/dist/src/core/services/gitignore-block.js +61 -0
  162. package/dist/src/core/services/gitignore-merge.d.ts +23 -0
  163. package/dist/src/core/services/gitignore-merge.js +21 -0
  164. package/dist/src/core/services/gitignore-plan.d.ts +34 -0
  165. package/dist/src/core/services/gitignore-plan.js +65 -0
  166. package/dist/src/core/services/harness-exclusion.d.ts +14 -0
  167. package/dist/src/core/services/harness-exclusion.js +19 -0
  168. package/dist/src/core/services/harness-removal.d.ts +23 -0
  169. package/dist/src/core/services/harness-removal.js +34 -0
  170. package/dist/src/core/services/injection-policy.d.ts +9 -0
  171. package/dist/src/core/services/injection-policy.js +5 -0
  172. package/dist/src/core/services/installation-adapters.d.ts +21 -0
  173. package/dist/src/core/services/installation-adapters.js +28 -0
  174. package/dist/src/core/services/installation-builder.d.ts +24 -0
  175. package/dist/src/core/services/installation-builder.js +66 -0
  176. package/dist/src/core/services/installation-findings.d.ts +5 -0
  177. package/dist/src/core/services/installation-findings.js +19 -0
  178. package/dist/src/core/services/installation-service.d.ts +36 -0
  179. package/dist/src/core/services/installation-service.js +50 -0
  180. package/dist/src/core/services/manifest-change.d.ts +11 -0
  181. package/dist/src/core/services/manifest-change.js +16 -0
  182. package/dist/src/core/services/no-harness-finding.d.ts +3 -0
  183. package/dist/src/core/services/no-harness-finding.js +9 -0
  184. package/dist/src/core/services/removal-helper.d.ts +10 -0
  185. package/dist/src/core/services/removal-helper.js +48 -0
  186. package/dist/src/core/services/removal-service.d.ts +19 -0
  187. package/dist/src/core/services/removal-service.js +45 -0
  188. package/dist/src/core/services/report-service.d.ts +30 -0
  189. package/dist/src/core/services/report-service.js +71 -0
  190. package/dist/src/core/services/reset-notice.d.ts +3 -0
  191. package/dist/src/core/services/reset-notice.js +8 -0
  192. package/dist/src/core/services/restart-doctor-findings.d.ts +10 -0
  193. package/dist/src/core/services/restart-doctor-findings.js +24 -0
  194. package/dist/src/core/services/restart-flow.d.ts +13 -0
  195. package/dist/src/core/services/restart-flow.js +50 -0
  196. package/dist/src/core/services/restart-guards.d.ts +6 -0
  197. package/dist/src/core/services/restart-guards.js +25 -0
  198. package/dist/src/core/services/restart-install-extras.d.ts +27 -0
  199. package/dist/src/core/services/restart-install-extras.js +39 -0
  200. package/dist/src/core/services/restart-mode.d.ts +4 -0
  201. package/dist/src/core/services/restart-mode.js +6 -0
  202. package/dist/src/core/services/runtime-error-checks.d.ts +11 -0
  203. package/dist/src/core/services/runtime-error-checks.js +20 -0
  204. package/dist/src/core/services/session-counters.d.ts +15 -0
  205. package/dist/src/core/services/session-counters.js +33 -0
  206. package/dist/src/core/services/session-reset-handler.d.ts +18 -0
  207. package/dist/src/core/services/session-reset-handler.js +24 -0
  208. package/dist/src/core/services/session-zone.d.ts +30 -0
  209. package/dist/src/core/services/session-zone.js +25 -0
  210. package/dist/src/core/services/snapshot-merge.d.ts +22 -0
  211. package/dist/src/core/services/snapshot-merge.js +25 -0
  212. package/dist/src/core/services/statusline-summary.d.ts +10 -0
  213. package/dist/src/core/services/statusline-summary.js +13 -0
  214. package/dist/src/core/services/support-service.d.ts +2 -0
  215. package/dist/src/core/services/support-service.js +57 -0
  216. package/dist/src/core/services/telemetry-block.d.ts +14 -0
  217. package/dist/src/core/services/telemetry-block.js +17 -0
  218. package/dist/src/core/services/usage-resolver.d.ts +20 -0
  219. package/dist/src/core/services/usage-resolver.js +23 -0
  220. package/dist/src/core/services/version-service.d.ts +14 -0
  221. package/dist/src/core/services/version-service.js +45 -0
  222. package/dist/src/core/services/window-trust.d.ts +2 -0
  223. package/dist/src/core/services/window-trust.js +3 -0
  224. package/dist/src/core/services/zone-classifier.d.ts +11 -0
  225. package/dist/src/core/services/zone-classifier.js +24 -0
  226. package/dist/src/core/services/zone-guidance.d.ts +6 -0
  227. package/dist/src/core/services/zone-guidance.js +32 -0
  228. package/dist/src/core/validation/configuration-sanitizer.d.ts +10 -0
  229. package/dist/src/core/validation/configuration-sanitizer.js +31 -0
  230. package/dist/src/core/validation/configuration-validator.d.ts +18 -0
  231. package/dist/src/core/validation/configuration-validator.js +45 -0
  232. package/dist/src/infrastructure/diagnostics/in-process-sampler.d.ts +18 -0
  233. package/dist/src/infrastructure/diagnostics/in-process-sampler.js +63 -0
  234. package/dist/src/infrastructure/diagnostics/overhead-measurer.d.ts +12 -0
  235. package/dist/src/infrastructure/diagnostics/overhead-measurer.js +77 -0
  236. package/dist/src/infrastructure/diagnostics/p95.d.ts +1 -0
  237. package/dist/src/infrastructure/diagnostics/p95.js +9 -0
  238. package/dist/src/infrastructure/diagnostics/process-sampler.d.ts +7 -0
  239. package/dist/src/infrastructure/diagnostics/process-sampler.js +69 -0
  240. package/dist/src/infrastructure/diagnostics/sample-failure.d.ts +10 -0
  241. package/dist/src/infrastructure/diagnostics/sample-failure.js +19 -0
  242. package/dist/src/infrastructure/git/git-context.d.ts +3 -0
  243. package/dist/src/infrastructure/git/git-context.js +25 -0
  244. package/dist/src/infrastructure/harnesses/antigravity-cli/adapter.d.ts +14 -0
  245. package/dist/src/infrastructure/harnesses/antigravity-cli/adapter.js +84 -0
  246. package/dist/src/infrastructure/harnesses/antigravity-cli/capabilities.d.ts +2 -0
  247. package/dist/src/infrastructure/harnesses/antigravity-cli/capabilities.js +6 -0
  248. package/dist/src/infrastructure/harnesses/antigravity-cli/detector.d.ts +4 -0
  249. package/dist/src/infrastructure/harnesses/antigravity-cli/detector.js +56 -0
  250. package/dist/src/infrastructure/harnesses/antigravity-cli/planner.d.ts +7 -0
  251. package/dist/src/infrastructure/harnesses/antigravity-cli/planner.js +62 -0
  252. package/dist/src/infrastructure/harnesses/antigravity-cli/runtime.d.ts +9 -0
  253. package/dist/src/infrastructure/harnesses/antigravity-cli/runtime.js +51 -0
  254. package/dist/src/infrastructure/harnesses/antigravity-cli/schemas.d.ts +31 -0
  255. package/dist/src/infrastructure/harnesses/antigravity-cli/schemas.js +19 -0
  256. package/dist/src/infrastructure/harnesses/claude-code/adapter.d.ts +14 -0
  257. package/dist/src/infrastructure/harnesses/claude-code/adapter.js +84 -0
  258. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-diagnostics.d.ts +9 -0
  259. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-diagnostics.js +60 -0
  260. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-files.d.ts +12 -0
  261. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-files.js +24 -0
  262. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-ownership.d.ts +5 -0
  263. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-ownership.js +41 -0
  264. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-planner.d.ts +7 -0
  265. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-planner.js +81 -0
  266. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-settings.d.ts +4 -0
  267. package/dist/src/infrastructure/harnesses/claude-code/auto-restart-settings.js +29 -0
  268. package/dist/src/infrastructure/harnesses/claude-code/capabilities.d.ts +2 -0
  269. package/dist/src/infrastructure/harnesses/claude-code/capabilities.js +6 -0
  270. package/dist/src/infrastructure/harnesses/claude-code/claude-hooks-config.d.ts +1 -0
  271. package/dist/src/infrastructure/harnesses/claude-code/claude-hooks-config.js +25 -0
  272. package/dist/src/infrastructure/harnesses/claude-code/claude-merger.d.ts +14 -0
  273. package/dist/src/infrastructure/harnesses/claude-code/claude-merger.js +44 -0
  274. package/dist/src/infrastructure/harnesses/claude-code/detector.d.ts +6 -0
  275. package/dist/src/infrastructure/harnesses/claude-code/detector.js +14 -0
  276. package/dist/src/infrastructure/harnesses/claude-code/mod/hooks.d.ts +6 -0
  277. package/dist/src/infrastructure/harnesses/claude-code/mod/hooks.js +43 -0
  278. package/dist/src/infrastructure/harnesses/claude-code/mod/host.d.ts +56 -0
  279. package/dist/src/infrastructure/harnesses/claude-code/mod/host.js +1 -0
  280. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-config.d.ts +8 -0
  281. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-config.js +31 -0
  282. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-guards.d.ts +3 -0
  283. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-guards.js +13 -0
  284. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-info.d.ts +4 -0
  285. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-info.js +5 -0
  286. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-log.d.ts +4 -0
  287. package/dist/src/infrastructure/harnesses/claude-code/mod/mod-log.js +34 -0
  288. package/dist/src/infrastructure/harnesses/claude-code/mod/register.d.ts +2 -0
  289. package/dist/src/infrastructure/harnesses/claude-code/mod/register.js +23 -0
  290. package/dist/src/infrastructure/harnesses/claude-code/mod/restart-facts.d.ts +3 -0
  291. package/dist/src/infrastructure/harnesses/claude-code/mod/restart-facts.js +12 -0
  292. package/dist/src/infrastructure/harnesses/claude-code/mod/restart-flow.d.ts +4 -0
  293. package/dist/src/infrastructure/harnesses/claude-code/mod/restart-flow.js +22 -0
  294. package/dist/src/infrastructure/harnesses/claude-code/mod/restart-host.d.ts +7 -0
  295. package/dist/src/infrastructure/harnesses/claude-code/mod/restart-host.js +35 -0
  296. package/dist/src/infrastructure/harnesses/claude-code/mod/turn-state.d.ts +7 -0
  297. package/dist/src/infrastructure/harnesses/claude-code/mod/turn-state.js +12 -0
  298. package/dist/src/infrastructure/harnesses/claude-code/planner.d.ts +7 -0
  299. package/dist/src/infrastructure/harnesses/claude-code/planner.js +72 -0
  300. package/dist/src/infrastructure/harnesses/claude-code/runtime.d.ts +10 -0
  301. package/dist/src/infrastructure/harnesses/claude-code/runtime.js +82 -0
  302. package/dist/src/infrastructure/harnesses/claude-code/schemas.d.ts +42 -0
  303. package/dist/src/infrastructure/harnesses/claude-code/schemas.js +30 -0
  304. package/dist/src/infrastructure/harnesses/claude-code/statusline-bridge.d.ts +12 -0
  305. package/dist/src/infrastructure/harnesses/claude-code/statusline-bridge.js +78 -0
  306. package/dist/src/infrastructure/harnesses/claude-code/statusline-context-window.d.ts +5 -0
  307. package/dist/src/infrastructure/harnesses/claude-code/statusline-context-window.js +50 -0
  308. package/dist/src/infrastructure/harnesses/claude-code/statusline-default.d.ts +6 -0
  309. package/dist/src/infrastructure/harnesses/claude-code/statusline-default.js +38 -0
  310. package/dist/src/infrastructure/harnesses/claude-code/statusline-diagnostics.d.ts +3 -0
  311. package/dist/src/infrastructure/harnesses/claude-code/statusline-diagnostics.js +70 -0
  312. package/dist/src/infrastructure/harnesses/claude-code/statusline-output.d.ts +9 -0
  313. package/dist/src/infrastructure/harnesses/claude-code/statusline-output.js +15 -0
  314. package/dist/src/infrastructure/harnesses/claude-code/statusline-payload.d.ts +7 -0
  315. package/dist/src/infrastructure/harnesses/claude-code/statusline-payload.js +36 -0
  316. package/dist/src/infrastructure/harnesses/claude-code/statusline-planner.d.ts +4 -0
  317. package/dist/src/infrastructure/harnesses/claude-code/statusline-planner.js +82 -0
  318. package/dist/src/infrastructure/harnesses/claude-code/statusline-previous.d.ts +17 -0
  319. package/dist/src/infrastructure/harnesses/claude-code/statusline-previous.js +41 -0
  320. package/dist/src/infrastructure/harnesses/claude-code/statusline-restore.d.ts +9 -0
  321. package/dist/src/infrastructure/harnesses/claude-code/statusline-restore.js +31 -0
  322. package/dist/src/infrastructure/harnesses/claude-code/statusline-settings.d.ts +33 -0
  323. package/dist/src/infrastructure/harnesses/claude-code/statusline-settings.js +63 -0
  324. package/dist/src/infrastructure/harnesses/claude-code/statusline-shell.d.ts +13 -0
  325. package/dist/src/infrastructure/harnesses/claude-code/statusline-shell.js +28 -0
  326. package/dist/src/infrastructure/harnesses/claude-code/statusline-state.d.ts +21 -0
  327. package/dist/src/infrastructure/harnesses/claude-code/statusline-state.js +29 -0
  328. package/dist/src/infrastructure/harnesses/claude-code/transcript-usage.d.ts +6 -0
  329. package/dist/src/infrastructure/harnesses/claude-code/transcript-usage.js +24 -0
  330. package/dist/src/infrastructure/harnesses/codex-cli/adapter.d.ts +14 -0
  331. package/dist/src/infrastructure/harnesses/codex-cli/adapter.js +90 -0
  332. package/dist/src/infrastructure/harnesses/codex-cli/capabilities.d.ts +2 -0
  333. package/dist/src/infrastructure/harnesses/codex-cli/capabilities.js +6 -0
  334. package/dist/src/infrastructure/harnesses/codex-cli/detector.d.ts +6 -0
  335. package/dist/src/infrastructure/harnesses/codex-cli/detector.js +13 -0
  336. package/dist/src/infrastructure/harnesses/codex-cli/planner.d.ts +7 -0
  337. package/dist/src/infrastructure/harnesses/codex-cli/planner.js +75 -0
  338. package/dist/src/infrastructure/harnesses/codex-cli/rollout-usage.d.ts +6 -0
  339. package/dist/src/infrastructure/harnesses/codex-cli/rollout-usage.js +27 -0
  340. package/dist/src/infrastructure/harnesses/codex-cli/runtime.d.ts +10 -0
  341. package/dist/src/infrastructure/harnesses/codex-cli/runtime.js +85 -0
  342. package/dist/src/infrastructure/harnesses/codex-cli/schemas.d.ts +47 -0
  343. package/dist/src/infrastructure/harnesses/codex-cli/schemas.js +25 -0
  344. package/dist/src/infrastructure/harnesses/common/antigravity-hooks-updater.d.ts +4 -0
  345. package/dist/src/infrastructure/harnesses/common/antigravity-hooks-updater.js +57 -0
  346. package/dist/src/infrastructure/harnesses/common/change-target.d.ts +1 -0
  347. package/dist/src/infrastructure/harnesses/common/change-target.js +40 -0
  348. package/dist/src/infrastructure/harnesses/common/codex-hooks-updater.d.ts +13 -0
  349. package/dist/src/infrastructure/harnesses/common/codex-hooks-updater.js +79 -0
  350. package/dist/src/infrastructure/harnesses/common/cursor-hooks-updater.d.ts +3 -0
  351. package/dist/src/infrastructure/harnesses/common/cursor-hooks-updater.js +63 -0
  352. package/dist/src/infrastructure/harnesses/common/diagnostic-helpers.d.ts +7 -0
  353. package/dist/src/infrastructure/harnesses/common/diagnostic-helpers.js +60 -0
  354. package/dist/src/infrastructure/harnesses/common/hook-event-cleanup.d.ts +3 -0
  355. package/dist/src/infrastructure/harnesses/common/hook-event-cleanup.js +50 -0
  356. package/dist/src/infrastructure/harnesses/common/in-process-restart-log.d.ts +9 -0
  357. package/dist/src/infrastructure/harnesses/common/in-process-restart-log.js +36 -0
  358. package/dist/src/infrastructure/harnesses/common/in-process-restart-state.d.ts +11 -0
  359. package/dist/src/infrastructure/harnesses/common/in-process-restart-state.js +50 -0
  360. package/dist/src/infrastructure/harnesses/common/in-process-restart-support.d.ts +13 -0
  361. package/dist/src/infrastructure/harnesses/common/in-process-restart-support.js +15 -0
  362. package/dist/src/infrastructure/harnesses/common/in-process-support.d.ts +18 -0
  363. package/dist/src/infrastructure/harnesses/common/in-process-support.js +40 -0
  364. package/dist/src/infrastructure/harnesses/common/jsonl-tail-reader.d.ts +6 -0
  365. package/dist/src/infrastructure/harnesses/common/jsonl-tail-reader.js +76 -0
  366. package/dist/src/infrastructure/harnesses/common/path-helpers.d.ts +6 -0
  367. package/dist/src/infrastructure/harnesses/common/path-helpers.js +51 -0
  368. package/dist/src/infrastructure/harnesses/common/removal-config-validator.d.ts +2 -0
  369. package/dist/src/infrastructure/harnesses/common/removal-config-validator.js +14 -0
  370. package/dist/src/infrastructure/harnesses/common/restart-asset-plan.d.ts +12 -0
  371. package/dist/src/infrastructure/harnesses/common/restart-asset-plan.js +37 -0
  372. package/dist/src/infrastructure/harnesses/common/restart-diagnostics.d.ts +12 -0
  373. package/dist/src/infrastructure/harnesses/common/restart-diagnostics.js +49 -0
  374. package/dist/src/infrastructure/harnesses/common/runtime-assets.d.ts +1 -0
  375. package/dist/src/infrastructure/harnesses/common/runtime-assets.js +23 -0
  376. package/dist/src/infrastructure/harnesses/common/runtime-support.d.ts +8 -0
  377. package/dist/src/infrastructure/harnesses/common/runtime-support.js +44 -0
  378. package/dist/src/infrastructure/harnesses/common/version-probes.d.ts +3 -0
  379. package/dist/src/infrastructure/harnesses/common/version-probes.js +21 -0
  380. package/dist/src/infrastructure/harnesses/cursor/adapter.d.ts +14 -0
  381. package/dist/src/infrastructure/harnesses/cursor/adapter.js +70 -0
  382. package/dist/src/infrastructure/harnesses/cursor/capabilities.d.ts +2 -0
  383. package/dist/src/infrastructure/harnesses/cursor/capabilities.js +6 -0
  384. package/dist/src/infrastructure/harnesses/cursor/detector.d.ts +6 -0
  385. package/dist/src/infrastructure/harnesses/cursor/detector.js +13 -0
  386. package/dist/src/infrastructure/harnesses/cursor/planner.d.ts +7 -0
  387. package/dist/src/infrastructure/harnesses/cursor/planner.js +66 -0
  388. package/dist/src/infrastructure/harnesses/cursor/runtime.d.ts +9 -0
  389. package/dist/src/infrastructure/harnesses/cursor/runtime.js +49 -0
  390. package/dist/src/infrastructure/harnesses/cursor/schemas.d.ts +39 -0
  391. package/dist/src/infrastructure/harnesses/cursor/schemas.js +23 -0
  392. package/dist/src/infrastructure/harnesses/github-copilot-cli/adapter.d.ts +14 -0
  393. package/dist/src/infrastructure/harnesses/github-copilot-cli/adapter.js +69 -0
  394. package/dist/src/infrastructure/harnesses/github-copilot-cli/capabilities.d.ts +2 -0
  395. package/dist/src/infrastructure/harnesses/github-copilot-cli/capabilities.js +6 -0
  396. package/dist/src/infrastructure/harnesses/github-copilot-cli/detector.d.ts +6 -0
  397. package/dist/src/infrastructure/harnesses/github-copilot-cli/detector.js +15 -0
  398. package/dist/src/infrastructure/harnesses/github-copilot-cli/planner.d.ts +7 -0
  399. package/dist/src/infrastructure/harnesses/github-copilot-cli/planner.js +66 -0
  400. package/dist/src/infrastructure/harnesses/github-copilot-cli/runtime.d.ts +9 -0
  401. package/dist/src/infrastructure/harnesses/github-copilot-cli/runtime.js +67 -0
  402. package/dist/src/infrastructure/harnesses/github-copilot-cli/schemas.d.ts +35 -0
  403. package/dist/src/infrastructure/harnesses/github-copilot-cli/schemas.js +21 -0
  404. package/dist/src/infrastructure/harnesses/oh-my-pi/adapter.d.ts +14 -0
  405. package/dist/src/infrastructure/harnesses/oh-my-pi/adapter.js +64 -0
  406. package/dist/src/infrastructure/harnesses/oh-my-pi/capabilities.d.ts +2 -0
  407. package/dist/src/infrastructure/harnesses/oh-my-pi/capabilities.js +6 -0
  408. package/dist/src/infrastructure/harnesses/oh-my-pi/detector.d.ts +6 -0
  409. package/dist/src/infrastructure/harnesses/oh-my-pi/detector.js +13 -0
  410. package/dist/src/infrastructure/harnesses/oh-my-pi/events.d.ts +8 -0
  411. package/dist/src/infrastructure/harnesses/oh-my-pi/events.js +65 -0
  412. package/dist/src/infrastructure/harnesses/oh-my-pi/planner.d.ts +7 -0
  413. package/dist/src/infrastructure/harnesses/oh-my-pi/planner.js +32 -0
  414. package/dist/src/infrastructure/harnesses/oh-my-pi/restart.d.ts +28 -0
  415. package/dist/src/infrastructure/harnesses/oh-my-pi/restart.js +79 -0
  416. package/dist/src/infrastructure/harnesses/oh-my-pi/runtime.d.ts +17 -0
  417. package/dist/src/infrastructure/harnesses/oh-my-pi/runtime.js +69 -0
  418. package/dist/src/infrastructure/harnesses/oh-my-pi/schemas.d.ts +50 -0
  419. package/dist/src/infrastructure/harnesses/oh-my-pi/schemas.js +17 -0
  420. package/dist/src/infrastructure/harnesses/opencode/adapter.d.ts +14 -0
  421. package/dist/src/infrastructure/harnesses/opencode/adapter.js +64 -0
  422. package/dist/src/infrastructure/harnesses/opencode/capabilities.d.ts +2 -0
  423. package/dist/src/infrastructure/harnesses/opencode/capabilities.js +6 -0
  424. package/dist/src/infrastructure/harnesses/opencode/detector.d.ts +6 -0
  425. package/dist/src/infrastructure/harnesses/opencode/detector.js +16 -0
  426. package/dist/src/infrastructure/harnesses/opencode/events.d.ts +8 -0
  427. package/dist/src/infrastructure/harnesses/opencode/events.js +36 -0
  428. package/dist/src/infrastructure/harnesses/opencode/planner.d.ts +6 -0
  429. package/dist/src/infrastructure/harnesses/opencode/planner.js +23 -0
  430. package/dist/src/infrastructure/harnesses/opencode/runtime.d.ts +20 -0
  431. package/dist/src/infrastructure/harnesses/opencode/runtime.js +51 -0
  432. package/dist/src/infrastructure/harnesses/opencode/schemas.d.ts +51 -0
  433. package/dist/src/infrastructure/harnesses/opencode/schemas.js +32 -0
  434. package/dist/src/infrastructure/harnesses/pi/adapter.d.ts +14 -0
  435. package/dist/src/infrastructure/harnesses/pi/adapter.js +64 -0
  436. package/dist/src/infrastructure/harnesses/pi/capabilities.d.ts +2 -0
  437. package/dist/src/infrastructure/harnesses/pi/capabilities.js +6 -0
  438. package/dist/src/infrastructure/harnesses/pi/detector.d.ts +6 -0
  439. package/dist/src/infrastructure/harnesses/pi/detector.js +10 -0
  440. package/dist/src/infrastructure/harnesses/pi/events.d.ts +8 -0
  441. package/dist/src/infrastructure/harnesses/pi/events.js +65 -0
  442. package/dist/src/infrastructure/harnesses/pi/planner.d.ts +7 -0
  443. package/dist/src/infrastructure/harnesses/pi/planner.js +32 -0
  444. package/dist/src/infrastructure/harnesses/pi/restart.d.ts +33 -0
  445. package/dist/src/infrastructure/harnesses/pi/restart.js +69 -0
  446. package/dist/src/infrastructure/harnesses/pi/runtime.d.ts +17 -0
  447. package/dist/src/infrastructure/harnesses/pi/runtime.js +67 -0
  448. package/dist/src/infrastructure/harnesses/pi/schemas.d.ts +50 -0
  449. package/dist/src/infrastructure/harnesses/pi/schemas.js +17 -0
  450. package/dist/src/infrastructure/harnesses/registry.d.ts +6 -0
  451. package/dist/src/infrastructure/harnesses/registry.js +94 -0
  452. package/dist/src/infrastructure/process/node-process-runner.d.ts +8 -0
  453. package/dist/src/infrastructure/process/node-process-runner.js +66 -0
  454. package/dist/src/infrastructure/process/process-tree.d.ts +2 -0
  455. package/dist/src/infrastructure/process/process-tree.js +28 -0
  456. package/dist/src/infrastructure/runtime/hook-deadline.d.ts +26 -0
  457. package/dist/src/infrastructure/runtime/hook-deadline.js +55 -0
  458. package/dist/src/infrastructure/runtime/hook-failure.d.ts +14 -0
  459. package/dist/src/infrastructure/runtime/hook-failure.js +22 -0
  460. package/dist/src/infrastructure/runtime/in-process-host.d.ts +16 -0
  461. package/dist/src/infrastructure/runtime/in-process-host.js +75 -0
  462. package/dist/src/infrastructure/runtime/node-runtime-logs.d.ts +8 -0
  463. package/dist/src/infrastructure/runtime/node-runtime-logs.js +21 -0
  464. package/dist/src/infrastructure/runtime/node-session-ledger.d.ts +17 -0
  465. package/dist/src/infrastructure/runtime/node-session-ledger.js +68 -0
  466. package/dist/src/infrastructure/runtime/process-hook-host.d.ts +25 -0
  467. package/dist/src/infrastructure/runtime/process-hook-host.js +79 -0
  468. package/dist/src/infrastructure/runtime/runtime-composition.d.ts +29 -0
  469. package/dist/src/infrastructure/runtime/runtime-composition.js +41 -0
  470. package/dist/src/infrastructure/runtime/runtime-paths.d.ts +12 -0
  471. package/dist/src/infrastructure/runtime/runtime-paths.js +45 -0
  472. package/dist/src/infrastructure/runtime/runtime-state-reader.d.ts +9 -0
  473. package/dist/src/infrastructure/runtime/runtime-state-reader.js +82 -0
  474. package/dist/src/infrastructure/storage/atomic-writer.d.ts +2 -0
  475. package/dist/src/infrastructure/storage/atomic-writer.js +35 -0
  476. package/dist/src/infrastructure/storage/change-applier.d.ts +10 -0
  477. package/dist/src/infrastructure/storage/change-applier.js +80 -0
  478. package/dist/src/infrastructure/storage/directory-pruner.d.ts +8 -0
  479. package/dist/src/infrastructure/storage/directory-pruner.js +76 -0
  480. package/dist/src/infrastructure/storage/handoff-claim-lock.d.ts +3 -0
  481. package/dist/src/infrastructure/storage/handoff-claim-lock.js +32 -0
  482. package/dist/src/infrastructure/storage/json-document-editor.d.ts +5 -0
  483. package/dist/src/infrastructure/storage/json-document-editor.js +52 -0
  484. package/dist/src/infrastructure/storage/json-span-utils.d.ts +24 -0
  485. package/dist/src/infrastructure/storage/json-span-utils.js +104 -0
  486. package/dist/src/infrastructure/storage/json-validator.d.ts +13 -0
  487. package/dist/src/infrastructure/storage/json-validator.js +61 -0
  488. package/dist/src/infrastructure/storage/manifest-store.d.ts +11 -0
  489. package/dist/src/infrastructure/storage/manifest-store.js +45 -0
  490. package/dist/src/infrastructure/storage/node-file-system.d.ts +4 -0
  491. package/dist/src/infrastructure/storage/node-file-system.js +33 -0
  492. package/dist/src/infrastructure/storage/node-handoff-store.d.ts +11 -0
  493. package/dist/src/infrastructure/storage/node-handoff-store.js +96 -0
  494. package/dist/src/infrastructure/storage/package-metadata.d.ts +7 -0
  495. package/dist/src/infrastructure/storage/package-metadata.js +58 -0
  496. package/dist/src/infrastructure/storage/path-boundary.d.ts +11 -0
  497. package/dist/src/infrastructure/storage/path-boundary.js +73 -0
  498. package/dist/src/infrastructure/storage/project-config-store.d.ts +9 -0
  499. package/dist/src/infrastructure/storage/project-config-store.js +24 -0
  500. package/dist/src/infrastructure/storage/runtime-state-files.d.ts +12 -0
  501. package/dist/src/infrastructure/storage/runtime-state-files.js +22 -0
  502. package/docs/telemetry-block.md +149 -0
  503. package/package.json +65 -4
  504. package/schemas/context-brake.config.schema.json +177 -0
  505. package/schemas/doctor-report.schema.json +595 -0
  506. package/schemas/install-report.schema.json +458 -0
@@ -0,0 +1,28 @@
1
+ type Payload = Record<string, unknown>;
2
+ export type OmpRestartContext = {
3
+ readonly cwd?: string | undefined;
4
+ readonly mode?: string | undefined;
5
+ readonly hasUI?: boolean | undefined;
6
+ readonly sessionManager?: {
7
+ readonly getSessionId?: () => string;
8
+ } | undefined;
9
+ readonly ui?: {
10
+ readonly notify?: (message: string, level?: string) => void;
11
+ readonly getEditorText?: () => string;
12
+ readonly setEditorText?: (text: string) => void;
13
+ } | undefined;
14
+ readonly newSession?: () => Promise<{
15
+ cancelled: boolean;
16
+ }>;
17
+ };
18
+ type Handler = (payload: Payload, context: OmpRestartContext) => Promise<unknown>;
19
+ export type OmpRestartApi = {
20
+ on(event: string, handler: Handler): void;
21
+ registerCommand(name: string, command: {
22
+ description: string;
23
+ handler(args: string, context: OmpRestartContext): Promise<void>;
24
+ }): void;
25
+ sendUserMessage(text: string): void;
26
+ };
27
+ export declare function createOmpRestartExtension(api: OmpRestartApi): void;
28
+ export {};
@@ -0,0 +1,79 @@
1
+ import { foldToolCalls, resetConsecutive } from '../../../core/services/restart-guards.js';
2
+ import { handleTurnEnd } from '../../../core/services/restart-flow.js';
3
+ import { systemClock } from '../../runtime/runtime-composition.js';
4
+ import { NodeHandoffStore } from '../../storage/node-handoff-store.js';
5
+ import { recordInProcessDecision } from '../common/in-process-restart-log.js';
6
+ import { recordRestartLoaded, reportFailures } from '../common/in-process-restart-support.js';
7
+ import { countToolCall, inProcessStandDown, memoryGuardStore, readRestartSettings, RESTART_COMMAND, startTurn, takeToolCalls, turnStartedAt } from '../common/in-process-restart-state.js';
8
+ import { textValue } from '../common/runtime-support.js';
9
+ import { stopMessageText } from './events.js';
10
+ const HARNESS = 'oh-my-pi';
11
+ const INTERACTIVE_MODE = 'tui';
12
+ const INTERACTIVE_SOURCE = 'interactive';
13
+ const COMMAND_TEXT = `/${RESTART_COMMAND}`;
14
+ const pending = new Map();
15
+ function prefill(context, root, request) {
16
+ const editor = context.ui;
17
+ if (editor?.setEditorText === undefined || (editor.getEditorText?.() ?? '').trim() !== '') {
18
+ void request.onRejected();
19
+ return;
20
+ }
21
+ pending.set(root, request);
22
+ editor.setEditorText(COMMAND_TEXT);
23
+ }
24
+ function hostFor(context, root) {
25
+ const target = { root, harness: HARNESS, sessionId: context.sessionManager?.getSessionId?.() ?? 'unknown' };
26
+ return {
27
+ guards: memoryGuardStore(root),
28
+ handoff: new NodeHandoffStore(root, systemClock),
29
+ standDown: async () => inProcessStandDown(context.mode === INTERACTIVE_MODE && context.hasUI === true),
30
+ turnStartedAt: () => turnStartedAt(root),
31
+ resumeForSeed: async () => null,
32
+ openSession: (request) => prefill(context, root, request),
33
+ log: (code) => recordInProcessDecision(target, code, systemClock.now()),
34
+ notify: (text) => context.ui?.notify?.(text, 'info'),
35
+ };
36
+ }
37
+ async function onSessionStop(payload, context) {
38
+ const root = textValue(context.cwd);
39
+ if (root === null)
40
+ return;
41
+ await foldToolCalls(memoryGuardStore(root), takeToolCalls(root));
42
+ const settings = await readRestartSettings(root);
43
+ if (settings === undefined)
44
+ return;
45
+ await handleTurnEnd(hostFor(context, root), { text: stopMessageText(payload['last_assistant_message']), settings });
46
+ }
47
+ async function runRestartCommand(api, context) {
48
+ const root = textValue(context.cwd);
49
+ const request = root === null ? undefined : pending.get(root);
50
+ if (root === null || request === undefined || context.newSession === undefined)
51
+ return;
52
+ pending.delete(root);
53
+ try {
54
+ if ((await context.newSession()).cancelled)
55
+ return request.onRejected();
56
+ await request.onOpened();
57
+ api.sendUserMessage(request.seed);
58
+ }
59
+ catch {
60
+ await request.onRejected();
61
+ }
62
+ }
63
+ async function onInput(payload, context) {
64
+ const root = textValue(context.cwd);
65
+ const typed = payload['source'] === INTERACTIVE_SOURCE && textValue(payload['text'])?.trim() !== COMMAND_TEXT;
66
+ if (root !== null && typed)
67
+ await resetConsecutive(memoryGuardStore(root));
68
+ }
69
+ export function createOmpRestartExtension(api) {
70
+ api.on('agent_start', async (_payload, context) => { const root = textValue(context.cwd); if (root !== null)
71
+ startTurn(root, systemClock.now().getTime()); });
72
+ api.on('tool_result', async (_payload, context) => { const root = textValue(context.cwd); if (root !== null)
73
+ countToolCall(root); });
74
+ api.on('input', (payload, context) => reportFailures(context, () => onInput(payload, context)));
75
+ api.on('session_start', (_payload, context) => reportFailures(context, () => recordRestartLoaded(context, HARNESS)));
76
+ api.on('session_switch', (_payload, context) => reportFailures(context, () => recordRestartLoaded(context, HARNESS)));
77
+ api.on('session_stop', (payload, context) => reportFailures(context, () => onSessionStop(payload, context)));
78
+ api.registerCommand(RESTART_COMMAND, { description: 'ContextBrake: open a new session and resume from the recorded state', handler: (_args, context) => reportFailures(context, () => runRestartCommand(api, context)) });
79
+ }
@@ -0,0 +1,17 @@
1
+ import type { RuntimeDescriptor } from '../../../core/contracts/runtime.js';
2
+ export { mapOmpEvent, mapOmpInput, renderOmpToolResult } from './events.js';
3
+ export declare const ompDescriptor: RuntimeDescriptor;
4
+ export type OmpContext = {
5
+ readonly cwd?: string | undefined;
6
+ readonly sessionManager?: {
7
+ readonly getSessionId?: () => string;
8
+ } | undefined;
9
+ readonly getContextUsage?: (() => unknown) | undefined;
10
+ readonly ui?: {
11
+ readonly notify?: (message: string, level?: string) => void;
12
+ } | undefined;
13
+ };
14
+ export type OmpApi = {
15
+ on?: (event: string, handler: (payload: unknown, context: OmpContext) => Promise<unknown>) => void;
16
+ };
17
+ export declare function createOmpExtension(api: OmpApi): void;
@@ -0,0 +1,69 @@
1
+ import { createRuntimeResolver, measuredUsageFrom, runInProcessEvent } from '../common/in-process-support.js';
2
+ import { requireIdentifier, textValue } from '../common/runtime-support.js';
3
+ import { OMP_CAPABILITIES } from './capabilities.js';
4
+ import { mapOmpEvent, mapOmpInput, renderOmpToolResult } from './events.js';
5
+ export { mapOmpEvent, mapOmpInput, renderOmpToolResult } from './events.js';
6
+ const HARNESS = 'oh-my-pi';
7
+ const ESTIMATION = { baselineTokens: 15000, tokensPerTurn: 150 };
8
+ export const ompDescriptor = { harness: HARNESS, capabilities: OMP_CAPABILITIES, estimation: ESTIMATION, newSessionCommand: '/new' };
9
+ function rootOf(context) {
10
+ return textValue(context.cwd);
11
+ }
12
+ function sessionOf(context) {
13
+ return { harness: HARNESS, sessionId: requireIdentifier(context.sessionManager?.getSessionId?.()), agentId: null };
14
+ }
15
+ function measuredOf(context) {
16
+ return measuredUsageFrom(context.getContextUsage?.());
17
+ }
18
+ function eventOf(eventName, payload, context) {
19
+ try {
20
+ return mapOmpEvent(eventName, payload, sessionOf(context));
21
+ }
22
+ catch {
23
+ return null;
24
+ }
25
+ }
26
+ async function handleToolResult(payload, context, resolver) {
27
+ const event = eventOf('tool_result', payload, context);
28
+ if (event === null)
29
+ return undefined;
30
+ const engineInput = { measured: measuredOf(context), ...mapOmpInput('tool_result', payload) };
31
+ const decision = await runInProcessEvent({ resolver, projectRoot: rootOf(context), event, engineInput });
32
+ return decision.kind === 'context' ? renderOmpToolResult(payload, decision.block) : undefined;
33
+ }
34
+ async function recordBoot(event, context, state) {
35
+ if (event === null)
36
+ return;
37
+ const decision = await runInProcessEvent({ resolver: state.resolver, projectRoot: rootOf(context), event });
38
+ if (decision.kind === 'context')
39
+ state.pendingBoots.set(event.session.sessionId, decision.block);
40
+ }
41
+ async function handleBeforeAgentStart(context, pendingBoots) {
42
+ const sessionId = context.sessionManager?.getSessionId?.();
43
+ if (!sessionId)
44
+ return undefined;
45
+ const message = pendingBoots.get(sessionId);
46
+ if (!message)
47
+ return undefined;
48
+ pendingBoots.delete(sessionId);
49
+ return { message };
50
+ }
51
+ async function handleSessionStop(payload, context, resolver) {
52
+ const event = eventOf('session_stop', payload, context);
53
+ if (event === null)
54
+ return;
55
+ const decision = await runInProcessEvent({ resolver, projectRoot: rootOf(context), event });
56
+ if (decision.kind === 'notify_user')
57
+ context.ui?.notify?.(decision.text, 'info');
58
+ }
59
+ export function createOmpExtension(api) {
60
+ const resolver = createRuntimeResolver(ompDescriptor);
61
+ const pendingBoots = new Map();
62
+ api.on?.('tool_result', (payload, context) => handleToolResult(payload, context, resolver));
63
+ api.on?.('session_start', (payload, context) => recordBoot(eventOf('session_start', payload, context), context, { resolver, pendingBoots }));
64
+ api.on?.('session_switch', (payload, context) => recordBoot(eventOf('session_switch', payload, context), context, { resolver, pendingBoots }));
65
+ api.on?.('session_compact', (payload, context) => recordBoot(eventOf('session_compact', payload, context), context, { resolver, pendingBoots }));
66
+ api.on?.('auto_compaction_end', (payload, context) => recordBoot(eventOf('auto_compaction_end', payload, context), context, { resolver, pendingBoots }));
67
+ api.on?.('before_agent_start', (_payload, context) => handleBeforeAgentStart(context, pendingBoots));
68
+ api.on?.('session_stop', (payload, context) => handleSessionStop(payload, context, resolver));
69
+ }
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod/mini';
2
+ export declare const ompSettingsFileSchema: z.ZodMiniObject<{
3
+ extensions: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
4
+ }, z.core.$loose>;
5
+ export declare const ompPayloadSchema: z.ZodMiniObject<{
6
+ toolName: z.ZodMiniOptional<z.ZodMiniString<string>>;
7
+ toolCallId: z.ZodMiniOptional<z.ZodMiniString<string>>;
8
+ input: z.ZodMiniOptional<z.ZodMiniUnknown>;
9
+ content: z.ZodMiniOptional<z.ZodMiniUnknown>;
10
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
11
+ message: z.ZodMiniOptional<z.ZodMiniUnknown>;
12
+ last_assistant_message: z.ZodMiniOptional<z.ZodMiniUnknown>;
13
+ }, z.core.$loose>;
14
+ export declare const ompToolResultPayloadSchema: z.ZodMiniObject<{
15
+ toolName: z.ZodMiniOptional<z.ZodMiniString<string>>;
16
+ toolCallId: z.ZodMiniOptional<z.ZodMiniString<string>>;
17
+ input: z.ZodMiniOptional<z.ZodMiniUnknown>;
18
+ content: z.ZodMiniOptional<z.ZodMiniUnknown>;
19
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
20
+ message: z.ZodMiniOptional<z.ZodMiniUnknown>;
21
+ last_assistant_message: z.ZodMiniOptional<z.ZodMiniUnknown>;
22
+ }, z.core.$loose>;
23
+ export declare const ompSessionStartPayloadSchema: z.ZodMiniObject<{
24
+ toolName: z.ZodMiniOptional<z.ZodMiniString<string>>;
25
+ toolCallId: z.ZodMiniOptional<z.ZodMiniString<string>>;
26
+ input: z.ZodMiniOptional<z.ZodMiniUnknown>;
27
+ content: z.ZodMiniOptional<z.ZodMiniUnknown>;
28
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
29
+ message: z.ZodMiniOptional<z.ZodMiniUnknown>;
30
+ last_assistant_message: z.ZodMiniOptional<z.ZodMiniUnknown>;
31
+ }, z.core.$loose>;
32
+ export declare const ompSessionCompactPayloadSchema: z.ZodMiniObject<{
33
+ toolName: z.ZodMiniOptional<z.ZodMiniString<string>>;
34
+ toolCallId: z.ZodMiniOptional<z.ZodMiniString<string>>;
35
+ input: z.ZodMiniOptional<z.ZodMiniUnknown>;
36
+ content: z.ZodMiniOptional<z.ZodMiniUnknown>;
37
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
38
+ message: z.ZodMiniOptional<z.ZodMiniUnknown>;
39
+ last_assistant_message: z.ZodMiniOptional<z.ZodMiniUnknown>;
40
+ }, z.core.$loose>;
41
+ export declare const ompSessionStopPayloadSchema: z.ZodMiniObject<{
42
+ toolName: z.ZodMiniOptional<z.ZodMiniString<string>>;
43
+ toolCallId: z.ZodMiniOptional<z.ZodMiniString<string>>;
44
+ input: z.ZodMiniOptional<z.ZodMiniUnknown>;
45
+ content: z.ZodMiniOptional<z.ZodMiniUnknown>;
46
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
47
+ message: z.ZodMiniOptional<z.ZodMiniUnknown>;
48
+ last_assistant_message: z.ZodMiniOptional<z.ZodMiniUnknown>;
49
+ }, z.core.$loose>;
50
+ export type OmpPayload = z.infer<typeof ompPayloadSchema>;
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod/mini';
2
+ export const ompSettingsFileSchema = z.looseObject({
3
+ extensions: z.optional(z.array(z.string())),
4
+ });
5
+ export const ompPayloadSchema = z.looseObject({
6
+ toolName: z.optional(z.string()),
7
+ toolCallId: z.optional(z.string()),
8
+ input: z.optional(z.unknown()),
9
+ content: z.optional(z.unknown()),
10
+ reason: z.optional(z.string()),
11
+ message: z.optional(z.unknown()),
12
+ last_assistant_message: z.optional(z.unknown()),
13
+ });
14
+ export const ompToolResultPayloadSchema = ompPayloadSchema;
15
+ export const ompSessionStartPayloadSchema = ompPayloadSchema;
16
+ export const ompSessionCompactPayloadSchema = ompPayloadSchema;
17
+ export const ompSessionStopPayloadSchema = ompPayloadSchema;
@@ -0,0 +1,14 @@
1
+ import type { BenchmarkFixture, HarnessAdapter, HarnessContext } from '../../../core/contracts/adapter.js';
2
+ import type { DiagnosticFinding } from '../../../core/contracts/diagnostics.js';
3
+ import { type CapabilityProfile, type DetectionEvidence, type VersionProbe } from '../../../core/contracts/harness.js';
4
+ export declare class OpenCodeAdapter implements HarnessAdapter {
5
+ readonly id = "opencode";
6
+ readonly executionModel: "in_process";
7
+ capabilityProfile(version?: VersionProbe): CapabilityProfile;
8
+ detect(context: HarnessContext): Promise<readonly DetectionEvidence[]>;
9
+ probeVersion(context: HarnessContext): Promise<VersionProbe>;
10
+ planInstall(context: HarnessContext): Promise<import("../../../core/contracts/adapter.js").AdapterPlan>;
11
+ planRemove(context: HarnessContext): Promise<import("../../../core/contracts/adapter.js").AdapterPlan>;
12
+ diagnose(context: HarnessContext): Promise<readonly DiagnosticFinding[]>;
13
+ benchmarkFixture(): BenchmarkFixture;
14
+ }
@@ -0,0 +1,64 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { resolve } from 'node:path';
3
+ import {} from '../../../core/contracts/harness.js';
4
+ import { deriveSupportProfile } from '../../../core/services/support-service.js';
5
+ import { validateJsonDocument } from '../../storage/json-validator.js';
6
+ import { createIntegrationMissingFinding, createInvalidConfigFinding } from '../common/diagnostic-helpers.js';
7
+ import { pathExists } from '../common/path-helpers.js';
8
+ import { probeExecutableVersion } from '../common/version-probes.js';
9
+ import { detectOpenCode, OPENCODE_EXECUTABLES } from './detector.js';
10
+ import { OPENCODE_CAPABILITIES } from './capabilities.js';
11
+ import { OPENCODE_PLUGIN_FILE, planOpenCodeInstall, planOpenCodeRemove } from './planner.js';
12
+ export class OpenCodeAdapter {
13
+ id = 'opencode';
14
+ executionModel = 'in_process';
15
+ capabilityProfile(version) {
16
+ return deriveSupportProfile({ harness: this.id, capabilities: OPENCODE_CAPABILITIES, version });
17
+ }
18
+ detect(context) {
19
+ return detectOpenCode(context.projectRoot, context.userHome);
20
+ }
21
+ probeVersion(context) {
22
+ return probeExecutableVersion(context.runner, OPENCODE_EXECUTABLES);
23
+ }
24
+ planInstall(context) {
25
+ return planOpenCodeInstall(context.projectRoot);
26
+ }
27
+ planRemove(context) {
28
+ return planOpenCodeRemove(context.projectRoot);
29
+ }
30
+ async diagnose(context) {
31
+ const findings = [];
32
+ const pluginPath = resolve(context.projectRoot, OPENCODE_PLUGIN_FILE);
33
+ const jsonPath = resolve(context.projectRoot, 'opencode.json');
34
+ if (!(await pathExists(pluginPath))) {
35
+ findings.push(createIntegrationMissingFinding(this.id, OPENCODE_PLUGIN_FILE));
36
+ }
37
+ if (await pathExists(jsonPath)) {
38
+ try {
39
+ const raw = await readFile(jsonPath, 'utf8');
40
+ const validation = validateJsonDocument(raw);
41
+ if (!validation.valid) {
42
+ findings.push(createInvalidConfigFinding(this.id, 'opencode.json', validation.errors.join('; ')));
43
+ }
44
+ }
45
+ catch (err) {
46
+ const msg = err instanceof Error ? err.message : String(err);
47
+ findings.push(createInvalidConfigFinding(this.id, 'opencode.json', msg));
48
+ }
49
+ }
50
+ return findings;
51
+ }
52
+ benchmarkFixture() {
53
+ return {
54
+ harness: this.id,
55
+ executionModel: 'in_process',
56
+ event: 'tool.execute.after',
57
+ targetMilliseconds: 15,
58
+ samplePayload: {
59
+ input: { tool: 'bash', sessionID: 'bench-opencode', callID: 'call_bench' },
60
+ output: { args: { command: 'ls' }, output: 'file.txt' },
61
+ },
62
+ };
63
+ }
64
+ }
@@ -0,0 +1,2 @@
1
+ import type { CapabilityDefinition } from '../../../core/contracts/harness.js';
2
+ export declare const OPENCODE_CAPABILITIES: readonly CapabilityDefinition[];
@@ -0,0 +1,6 @@
1
+ export const OPENCODE_CAPABILITIES = [
2
+ { id: 'post_tool_telemetry', state: 'unsupported', impact: 'Model visibility of post-tool output modification is unconfirmed in OpenCode.' },
3
+ { id: 'session_boot', state: 'unsupported', impact: 'Stable boot injection is experimental in OpenCode.' },
4
+ { id: 'context_usage', state: 'unsupported', impact: 'No documented API exposes context usage to OpenCode plugins.' },
5
+ { id: 'auto_restart', state: 'unsupported', impact: 'No restart: this harness cannot inject the resume instruction.' },
6
+ ];
@@ -0,0 +1,6 @@
1
+ import type { DetectionEvidence } from '../../../core/contracts/harness.js';
2
+ export declare const OPENCODE_PROJECT_FILES: readonly ["opencode.json", "opencode.jsonc"];
3
+ export declare const OPENCODE_PROJECT_DIRS: readonly [".opencode"];
4
+ export declare const OPENCODE_USER_FILES: readonly [".config/opencode/plugins", ".config/opencode/opencode.json"];
5
+ export declare const OPENCODE_EXECUTABLES: readonly ["opencode"];
6
+ export declare function detectOpenCode(projectRoot: string, userHome?: string): Promise<readonly DetectionEvidence[]>;
@@ -0,0 +1,16 @@
1
+ import { checkProjectEvidence, checkUserEvidence } from '../common/path-helpers.js';
2
+ export const OPENCODE_PROJECT_FILES = [
3
+ 'opencode.json',
4
+ 'opencode.jsonc',
5
+ ];
6
+ export const OPENCODE_PROJECT_DIRS = ['.opencode'];
7
+ export const OPENCODE_USER_FILES = [
8
+ '.config/opencode/plugins',
9
+ '.config/opencode/opencode.json',
10
+ ];
11
+ export const OPENCODE_EXECUTABLES = ['opencode'];
12
+ export async function detectOpenCode(projectRoot, userHome) {
13
+ const project = await checkProjectEvidence(projectRoot, OPENCODE_PROJECT_FILES, OPENCODE_PROJECT_DIRS);
14
+ const machine = await checkUserEvidence(OPENCODE_USER_FILES, userHome);
15
+ return [...project, ...machine];
16
+ }
@@ -0,0 +1,8 @@
1
+ import type { RuntimeEvent, SessionKey } from '../../../core/contracts/runtime.js';
2
+ export declare function mapOpenCodeToolResult(input: unknown, output: unknown, session: SessionKey): RuntimeEvent;
3
+ export declare function openCodeObservedCharacters(output: unknown): number;
4
+ export type OpenCodeSessionEvent = {
5
+ readonly type: 'session.created' | 'session.compacted';
6
+ readonly sessionId: string | null;
7
+ };
8
+ export declare function mapOpenCodeSessionEvent(payload: unknown): OpenCodeSessionEvent | null;
@@ -0,0 +1,36 @@
1
+ import { asRecord, characterLength, parsePayload, textValue } from '../common/runtime-support.js';
2
+ import { opencodeEventPayloadSchema, opencodeToolAfterOutputSchema, opencodeToolExecuteInputSchema } from './schemas.js';
3
+ const SHELL_TOOLS = ['bash'];
4
+ const WRITE_TOOLS = ['write', 'edit'];
5
+ const READ_TOOLS = ['read'];
6
+ function toolOf(name, args) {
7
+ const tool = name ?? 'unknown';
8
+ const record = asRecord(args);
9
+ if (SHELL_TOOLS.includes(tool))
10
+ return { name: tool, category: 'shell', paths: [], command: textValue(record?.['command']) };
11
+ const path = textValue(record?.['filePath']);
12
+ if (path === null)
13
+ return { name: tool, category: 'other', paths: [], command: null };
14
+ if (WRITE_TOOLS.includes(tool))
15
+ return { name: tool, category: 'file_write', paths: [path], command: null };
16
+ if (READ_TOOLS.includes(tool))
17
+ return { name: tool, category: 'file_read', paths: [path], command: null };
18
+ return { name: tool, category: 'other', paths: [], command: null };
19
+ }
20
+ export function mapOpenCodeToolResult(input, output, session) {
21
+ const data = parsePayload(opencodeToolExecuteInputSchema, input);
22
+ const args = parsePayload(opencodeToolAfterOutputSchema, output ?? {}).args;
23
+ return { kind: 'post_tool', session, tool: toolOf(data.tool, args), toolUseId: data.callID ?? null };
24
+ }
25
+ export function openCodeObservedCharacters(output) {
26
+ return characterLength(parsePayload(opencodeToolAfterOutputSchema, output ?? {}).args);
27
+ }
28
+ export function mapOpenCodeSessionEvent(payload) {
29
+ const data = parsePayload(opencodeEventPayloadSchema, payload);
30
+ const type = data.event?.type;
31
+ if (type !== 'session.created' && type !== 'session.compacted')
32
+ return null;
33
+ const properties = data.event?.properties;
34
+ const sessionId = textValue(properties?.sessionID) ?? textValue(properties?.sessionId) ?? textValue(properties?.info?.id) ?? textValue(properties?.id);
35
+ return { type, sessionId };
36
+ }
@@ -0,0 +1,6 @@
1
+ import type { AdapterPlan } from '../../../core/contracts/adapter.js';
2
+ import type { ManagedEntry } from '../../../core/contracts/manifest.js';
3
+ export declare const OPENCODE_PLUGIN_FILE = ".opencode/plugins/context-brake.js";
4
+ export declare function buildOpenCodeEntries(): ManagedEntry[];
5
+ export declare function planOpenCodeInstall(projectRoot: string): Promise<AdapterPlan>;
6
+ export declare function planOpenCodeRemove(projectRoot: string): Promise<AdapterPlan>;
@@ -0,0 +1,23 @@
1
+ import { resolveChangeTarget } from '../common/change-target.js';
2
+ import { loadRuntimeAsset } from '../common/runtime-assets.js';
3
+ export const OPENCODE_PLUGIN_FILE = '.opencode/plugins/context-brake.js';
4
+ export function buildOpenCodeEntries() {
5
+ return [
6
+ { harness: 'opencode', path: OPENCODE_PLUGIN_FILE, identity: `plugin|${OPENCODE_PLUGIN_FILE}` },
7
+ ];
8
+ }
9
+ export async function planOpenCodeInstall(projectRoot) {
10
+ const realPlugin = await resolveChangeTarget(projectRoot, OPENCODE_PLUGIN_FILE);
11
+ const content = await loadRuntimeAsset('opencode-plugin.js');
12
+ const changes = [
13
+ { path: OPENCODE_PLUGIN_FILE, realPath: realPlugin, kind: 'create', owner: 'runtime_asset', content, preview: { summary: 'Install OpenCode plugin' } },
14
+ ];
15
+ return { harness: 'opencode', changes, conflicts: [], entries: buildOpenCodeEntries() };
16
+ }
17
+ export async function planOpenCodeRemove(projectRoot) {
18
+ const realPlugin = await resolveChangeTarget(projectRoot, OPENCODE_PLUGIN_FILE);
19
+ const changes = [
20
+ { path: OPENCODE_PLUGIN_FILE, realPath: realPlugin, kind: 'delete', owner: 'runtime_asset', content: null, preview: { summary: 'Delete OpenCode plugin' } },
21
+ ];
22
+ return { harness: 'opencode', changes, conflicts: [], entries: buildOpenCodeEntries() };
23
+ }
@@ -0,0 +1,20 @@
1
+ import type { RuntimeDescriptor } from '../../../core/contracts/runtime.js';
2
+ import { type InProcessRuntimeResolver } from '../common/in-process-support.js';
3
+ export { mapOpenCodeSessionEvent, mapOpenCodeToolResult, openCodeObservedCharacters } from './events.js';
4
+ export declare const openCodeDescriptor: RuntimeDescriptor;
5
+ export type OpenCodePluginHooks = {
6
+ readonly 'tool.execute.after'?: (input: unknown, output: unknown) => Promise<void>;
7
+ readonly event?: (payload: unknown) => Promise<void>;
8
+ };
9
+ export type OpenCodeHandlerInput = {
10
+ readonly input: unknown;
11
+ readonly output: unknown;
12
+ readonly projectRoot: string;
13
+ readonly resolver: InProcessRuntimeResolver;
14
+ };
15
+ export type OpenCodeEventHandlerInput = {
16
+ readonly payload: unknown;
17
+ readonly projectRoot: string;
18
+ readonly resolver: InProcessRuntimeResolver;
19
+ };
20
+ export declare function createOpenCodePlugin(context?: unknown): OpenCodePluginHooks;
@@ -0,0 +1,51 @@
1
+ import { createRuntimeResolver, runInProcessEvent } from '../common/in-process-support.js';
2
+ import { asRecord, parsePayload, textValue } from '../common/runtime-support.js';
3
+ import { OPENCODE_CAPABILITIES } from './capabilities.js';
4
+ import { mapOpenCodeSessionEvent, mapOpenCodeToolResult, openCodeObservedCharacters } from './events.js';
5
+ import { opencodeToolExecuteInputSchema } from './schemas.js';
6
+ export { mapOpenCodeSessionEvent, mapOpenCodeToolResult, openCodeObservedCharacters } from './events.js';
7
+ const HARNESS = 'opencode';
8
+ const ESTIMATION = { baselineTokens: 15000, tokensPerTurn: 150 };
9
+ const FALLBACK_SESSION_ID = 'project';
10
+ export const openCodeDescriptor = { harness: HARNESS, capabilities: OPENCODE_CAPABILITIES, estimation: ESTIMATION, newSessionCommand: null };
11
+ function resolveProjectRoot(context) {
12
+ const record = asRecord(context);
13
+ return textValue(record?.['directory']) ?? textValue(record?.['worktree']) ?? process.cwd();
14
+ }
15
+ function sessionKeyOf(input, fallbackSessionId) {
16
+ const data = parsePayload(opencodeToolExecuteInputSchema, input);
17
+ return { harness: HARNESS, sessionId: textValue(data.sessionID) ?? textValue(data.sessionId) ?? fallbackSessionId ?? FALLBACK_SESSION_ID, agentId: null };
18
+ }
19
+ async function handleAfter(args) {
20
+ let event;
21
+ try {
22
+ event = mapOpenCodeToolResult(args.input, args.output, sessionKeyOf(args.input, null));
23
+ }
24
+ catch {
25
+ return;
26
+ }
27
+ const engineInput = { observedCharacters: openCodeObservedCharacters(args.output) };
28
+ await runInProcessEvent({ resolver: args.resolver, projectRoot: args.projectRoot, event, engineInput });
29
+ }
30
+ async function handleEvent(args) {
31
+ let mapped;
32
+ try {
33
+ mapped = mapOpenCodeSessionEvent(args.payload);
34
+ }
35
+ catch {
36
+ return;
37
+ }
38
+ if (mapped === null)
39
+ return;
40
+ const reason = mapped.type === 'session.created' ? 'new' : 'compact';
41
+ const event = { kind: 'session_reset', session: sessionKeyOf({}, mapped.sessionId), reason };
42
+ await runInProcessEvent({ resolver: args.resolver, projectRoot: args.projectRoot, event });
43
+ }
44
+ export function createOpenCodePlugin(context) {
45
+ const resolver = createRuntimeResolver(openCodeDescriptor);
46
+ const projectRoot = resolveProjectRoot(context);
47
+ return {
48
+ 'tool.execute.after': (input, output) => handleAfter({ input, output, projectRoot, resolver }),
49
+ event: (payload) => handleEvent({ payload, projectRoot, resolver }),
50
+ };
51
+ }
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod/mini';
2
+ export declare const opencodeConfigFileSchema: z.ZodMiniObject<{
3
+ plugin: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
4
+ }, z.core.$loose>;
5
+ export declare const opencodeToolExecuteInputSchema: z.ZodMiniObject<{
6
+ tool: z.ZodMiniOptional<z.ZodMiniString<string>>;
7
+ sessionID: z.ZodMiniOptional<z.ZodMiniString<string>>;
8
+ sessionId: z.ZodMiniOptional<z.ZodMiniString<string>>;
9
+ callID: z.ZodMiniOptional<z.ZodMiniString<string>>;
10
+ }, z.core.$loose>;
11
+ export declare const opencodeToolAfterOutputSchema: z.ZodMiniObject<{
12
+ args: z.ZodMiniOptional<z.ZodMiniUnknown>;
13
+ output: z.ZodMiniOptional<z.ZodMiniUnknown>;
14
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
15
+ metadata: z.ZodMiniOptional<z.ZodMiniUnknown>;
16
+ }, z.core.$loose>;
17
+ export declare const opencodeSessionPropertiesSchema: z.ZodMiniObject<{
18
+ sessionID: z.ZodMiniOptional<z.ZodMiniString<string>>;
19
+ sessionId: z.ZodMiniOptional<z.ZodMiniString<string>>;
20
+ id: z.ZodMiniOptional<z.ZodMiniString<string>>;
21
+ info: z.ZodMiniOptional<z.ZodMiniObject<{
22
+ id: z.ZodMiniOptional<z.ZodMiniString<string>>;
23
+ }, z.core.$loose>>;
24
+ }, z.core.$loose>;
25
+ export declare const opencodeEventPayloadSchema: z.ZodMiniObject<{
26
+ event: z.ZodMiniOptional<z.ZodMiniObject<{
27
+ type: z.ZodMiniOptional<z.ZodMiniString<string>>;
28
+ properties: z.ZodMiniOptional<z.ZodMiniObject<{
29
+ sessionID: z.ZodMiniOptional<z.ZodMiniString<string>>;
30
+ sessionId: z.ZodMiniOptional<z.ZodMiniString<string>>;
31
+ id: z.ZodMiniOptional<z.ZodMiniString<string>>;
32
+ info: z.ZodMiniOptional<z.ZodMiniObject<{
33
+ id: z.ZodMiniOptional<z.ZodMiniString<string>>;
34
+ }, z.core.$loose>>;
35
+ }, z.core.$loose>>;
36
+ }, z.core.$loose>>;
37
+ }, z.core.$loose>;
38
+ export declare const opencodeToolExecuteAfterPayloadSchema: z.ZodMiniObject<{
39
+ input: z.ZodMiniOptional<z.ZodMiniObject<{
40
+ tool: z.ZodMiniOptional<z.ZodMiniString<string>>;
41
+ sessionID: z.ZodMiniOptional<z.ZodMiniString<string>>;
42
+ sessionId: z.ZodMiniOptional<z.ZodMiniString<string>>;
43
+ callID: z.ZodMiniOptional<z.ZodMiniString<string>>;
44
+ }, z.core.$loose>>;
45
+ output: z.ZodMiniOptional<z.ZodMiniObject<{
46
+ args: z.ZodMiniOptional<z.ZodMiniUnknown>;
47
+ output: z.ZodMiniOptional<z.ZodMiniUnknown>;
48
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
49
+ metadata: z.ZodMiniOptional<z.ZodMiniUnknown>;
50
+ }, z.core.$loose>>;
51
+ }, z.core.$loose>;
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod/mini';
2
+ export const opencodeConfigFileSchema = z.looseObject({
3
+ plugin: z.optional(z.array(z.string())),
4
+ });
5
+ export const opencodeToolExecuteInputSchema = z.looseObject({
6
+ tool: z.optional(z.string()),
7
+ sessionID: z.optional(z.string()),
8
+ sessionId: z.optional(z.string()),
9
+ callID: z.optional(z.string()),
10
+ });
11
+ export const opencodeToolAfterOutputSchema = z.looseObject({
12
+ args: z.optional(z.unknown()),
13
+ output: z.optional(z.unknown()),
14
+ title: z.optional(z.string()),
15
+ metadata: z.optional(z.unknown()),
16
+ });
17
+ export const opencodeSessionPropertiesSchema = z.looseObject({
18
+ sessionID: z.optional(z.string()),
19
+ sessionId: z.optional(z.string()),
20
+ id: z.optional(z.string()),
21
+ info: z.optional(z.looseObject({ id: z.optional(z.string()) })),
22
+ });
23
+ export const opencodeEventPayloadSchema = z.looseObject({
24
+ event: z.optional(z.looseObject({
25
+ type: z.optional(z.string()),
26
+ properties: z.optional(opencodeSessionPropertiesSchema),
27
+ })),
28
+ });
29
+ export const opencodeToolExecuteAfterPayloadSchema = z.looseObject({
30
+ input: z.optional(opencodeToolExecuteInputSchema),
31
+ output: z.optional(opencodeToolAfterOutputSchema),
32
+ });
@@ -0,0 +1,14 @@
1
+ import type { BenchmarkFixture, HarnessAdapter, HarnessContext } from '../../../core/contracts/adapter.js';
2
+ import type { DiagnosticFinding } from '../../../core/contracts/diagnostics.js';
3
+ import { type CapabilityProfile, type DetectionEvidence, type VersionProbe } from '../../../core/contracts/harness.js';
4
+ export declare class PiAdapter implements HarnessAdapter {
5
+ readonly id = "pi";
6
+ readonly executionModel: "in_process";
7
+ capabilityProfile(version?: VersionProbe): CapabilityProfile;
8
+ detect(context: HarnessContext): Promise<readonly DetectionEvidence[]>;
9
+ probeVersion(context: HarnessContext): Promise<VersionProbe>;
10
+ planInstall(context: HarnessContext): Promise<import("../../../core/contracts/adapter.js").AdapterPlan>;
11
+ planRemove(context: HarnessContext): Promise<import("../../../core/contracts/adapter.js").AdapterPlan>;
12
+ diagnose(context: HarnessContext): Promise<readonly DiagnosticFinding[]>;
13
+ benchmarkFixture(): BenchmarkFixture;
14
+ }