@telora/daemon 0.19.43 → 0.19.74

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 (542) hide show
  1. package/build-info.json +8 -3
  2. package/dist/assembly-engine.d.ts +9 -0
  3. package/dist/assembly-engine.d.ts.map +1 -1
  4. package/dist/assembly-engine.js.map +1 -1
  5. package/dist/audit-hooks.js +1 -1
  6. package/dist/audit-shape.d.ts +103 -0
  7. package/dist/audit-shape.d.ts.map +1 -0
  8. package/dist/audit-shape.js +81 -0
  9. package/dist/audit-shape.js.map +1 -0
  10. package/dist/branch-status.js +2 -2
  11. package/dist/branch-status.js.map +1 -1
  12. package/dist/ci-sensor-loop.d.ts +47 -0
  13. package/dist/ci-sensor-loop.d.ts.map +1 -0
  14. package/dist/ci-sensor-loop.js +116 -0
  15. package/dist/ci-sensor-loop.js.map +1 -0
  16. package/dist/ci-status-git.d.ts +52 -0
  17. package/dist/ci-status-git.d.ts.map +1 -0
  18. package/dist/ci-status-git.js +86 -0
  19. package/dist/ci-status-git.js.map +1 -0
  20. package/dist/ci-status.d.ts +122 -0
  21. package/dist/ci-status.d.ts.map +1 -0
  22. package/dist/ci-status.js +114 -0
  23. package/dist/ci-status.js.map +1 -0
  24. package/dist/cli/connect/agents.d.ts +24 -0
  25. package/dist/cli/connect/agents.d.ts.map +1 -0
  26. package/dist/cli/connect/agents.js +65 -0
  27. package/dist/cli/connect/agents.js.map +1 -0
  28. package/dist/cli/connect/claude.d.ts +31 -0
  29. package/dist/cli/connect/claude.d.ts.map +1 -0
  30. package/dist/cli/connect/claude.js +104 -0
  31. package/dist/cli/connect/claude.js.map +1 -0
  32. package/dist/cli/connect/cline.d.ts +37 -0
  33. package/dist/cli/connect/cline.d.ts.map +1 -0
  34. package/dist/cli/connect/cline.js +115 -0
  35. package/dist/cli/connect/cline.js.map +1 -0
  36. package/dist/cli/connect/codex.d.ts +44 -0
  37. package/dist/cli/connect/codex.d.ts.map +1 -0
  38. package/dist/cli/connect/codex.js +111 -0
  39. package/dist/cli/connect/codex.js.map +1 -0
  40. package/dist/cli/connect/ide.d.ts +69 -0
  41. package/dist/cli/connect/ide.d.ts.map +1 -0
  42. package/dist/cli/connect/ide.js +134 -0
  43. package/dist/cli/connect/ide.js.map +1 -0
  44. package/dist/cli/connect/scaffolding.d.ts +31 -0
  45. package/dist/cli/connect/scaffolding.d.ts.map +1 -0
  46. package/dist/cli/connect/scaffolding.js +52 -0
  47. package/dist/cli/connect/scaffolding.js.map +1 -0
  48. package/dist/cli/connect/shared.d.ts +30 -0
  49. package/dist/cli/connect/shared.d.ts.map +1 -0
  50. package/dist/cli/connect/shared.js +11 -0
  51. package/dist/cli/connect/shared.js.map +1 -0
  52. package/dist/cli/connect.d.ts +9 -210
  53. package/dist/cli/connect.d.ts.map +1 -1
  54. package/dist/cli/connect.js +10 -526
  55. package/dist/cli/connect.js.map +1 -1
  56. package/dist/cli/open.js +2 -2
  57. package/dist/completion/event.d.ts +3 -0
  58. package/dist/completion/event.d.ts.map +1 -1
  59. package/dist/completion/event.js +44 -9
  60. package/dist/completion/event.js.map +1 -1
  61. package/dist/completion/merge-phase.d.ts +3 -0
  62. package/dist/completion/merge-phase.d.ts.map +1 -1
  63. package/dist/completion/merge-phase.js +35 -3
  64. package/dist/completion/merge-phase.js.map +1 -1
  65. package/dist/completion/read-only-pristine.d.ts +1 -1
  66. package/dist/completion/read-only-pristine.d.ts.map +1 -1
  67. package/dist/completion/read-only-pristine.js +1 -1
  68. package/dist/completion/read-only-pristine.js.map +1 -1
  69. package/dist/completion/review-exit-phase.d.ts +30 -3
  70. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  71. package/dist/completion/review-exit-phase.js +203 -15
  72. package/dist/completion/review-exit-phase.js.map +1 -1
  73. package/dist/completion/status-advance-phase.js +1 -1
  74. package/dist/completion/status-advance-phase.js.map +1 -1
  75. package/dist/completion/team-completion.d.ts.map +1 -1
  76. package/dist/completion/team-completion.js +22 -2
  77. package/dist/completion/team-completion.js.map +1 -1
  78. package/dist/completion/team-lifecycle.js +1 -1
  79. package/dist/completion/terminated-work-reconcile.js +1 -1
  80. package/dist/completion/terminated-work-reconcile.js.map +1 -1
  81. package/dist/condition-evaluators.d.ts +41 -2
  82. package/dist/condition-evaluators.d.ts.map +1 -1
  83. package/dist/condition-evaluators.js +37 -288
  84. package/dist/condition-evaluators.js.map +1 -1
  85. package/dist/context-audit.d.ts +1 -1
  86. package/dist/context-audit.d.ts.map +1 -1
  87. package/dist/context-lock.d.ts +1 -1
  88. package/dist/context-lock.d.ts.map +1 -1
  89. package/dist/control-state.d.ts +2 -2
  90. package/dist/control-state.d.ts.map +1 -1
  91. package/dist/control-state.js +4 -3
  92. package/dist/control-state.js.map +1 -1
  93. package/dist/daemon-process.d.ts +1 -1
  94. package/dist/daemon-process.d.ts.map +1 -1
  95. package/dist/delivery-advance-block.d.ts +1 -1
  96. package/dist/delivery-advance-block.d.ts.map +1 -1
  97. package/dist/delivery-advance-block.js +1 -1
  98. package/dist/delivery-advance-block.js.map +1 -1
  99. package/dist/delivery-lifecycle.js +1 -1
  100. package/dist/delivery-reconciler-shadow.d.ts +1 -1
  101. package/dist/delivery-reconciler-shadow.d.ts.map +1 -1
  102. package/dist/delivery-reconciler-shadow.js +1 -1
  103. package/dist/delivery-reconciler-shadow.js.map +1 -1
  104. package/dist/delivery-reconciler.d.ts +1 -0
  105. package/dist/delivery-reconciler.d.ts.map +1 -1
  106. package/dist/delivery-reconciler.js +6 -0
  107. package/dist/delivery-reconciler.js.map +1 -1
  108. package/dist/directive-executor.js +1 -1
  109. package/dist/directive-executor.js.map +1 -1
  110. package/dist/drift-eval-loop.d.ts.map +1 -1
  111. package/dist/drift-eval-loop.js +6 -14
  112. package/dist/drift-eval-loop.js.map +1 -1
  113. package/dist/escalations.d.ts +1 -1
  114. package/dist/escalations.d.ts.map +1 -1
  115. package/dist/escalations.js +1 -1
  116. package/dist/escalations.js.map +1 -1
  117. package/dist/evaluation-context.d.ts +2 -33
  118. package/dist/evaluation-context.d.ts.map +1 -1
  119. package/dist/evaluation-context.js +2 -56
  120. package/dist/evaluation-context.js.map +1 -1
  121. package/dist/focus-engine.d.ts +14 -5
  122. package/dist/focus-engine.d.ts.map +1 -1
  123. package/dist/focus-engine.js +35 -289
  124. package/dist/focus-engine.js.map +1 -1
  125. package/dist/focus-executor.d.ts +10 -791
  126. package/dist/focus-executor.d.ts.map +1 -1
  127. package/dist/focus-executor.js +42 -1566
  128. package/dist/focus-executor.js.map +1 -1
  129. package/dist/focus-lifecycle.js +2 -2
  130. package/dist/focus-lifecycle.js.map +1 -1
  131. package/dist/focus-loop-registry.d.ts +52 -0
  132. package/dist/focus-loop-registry.d.ts.map +1 -0
  133. package/dist/focus-loop-registry.js +328 -0
  134. package/dist/focus-loop-registry.js.map +1 -0
  135. package/dist/focus-merge.d.ts +1 -1
  136. package/dist/focus-merge.d.ts.map +1 -1
  137. package/dist/focus-merge.js +3 -3
  138. package/dist/focus-merge.js.map +1 -1
  139. package/dist/focus-phase.d.ts +4 -0
  140. package/dist/focus-phase.d.ts.map +1 -1
  141. package/dist/focus-phase.js +3 -3
  142. package/dist/focus-phase.js.map +1 -1
  143. package/dist/focus-stage-lifecycle/planning-release.d.ts +197 -0
  144. package/dist/focus-stage-lifecycle/planning-release.d.ts.map +1 -0
  145. package/dist/focus-stage-lifecycle/planning-release.js +312 -0
  146. package/dist/focus-stage-lifecycle/planning-release.js.map +1 -0
  147. package/dist/focus-stage-lifecycle/review-convergence.d.ts +133 -0
  148. package/dist/focus-stage-lifecycle/review-convergence.d.ts.map +1 -0
  149. package/dist/focus-stage-lifecycle/review-convergence.js +235 -0
  150. package/dist/focus-stage-lifecycle/review-convergence.js.map +1 -0
  151. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +133 -0
  152. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -0
  153. package/dist/focus-stage-lifecycle/wedge-watchdog.js +365 -0
  154. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -0
  155. package/dist/focus-stage-lifecycle.d.ts +22 -403
  156. package/dist/focus-stage-lifecycle.d.ts.map +1 -1
  157. package/dist/focus-stage-lifecycle.js +26 -798
  158. package/dist/focus-stage-lifecycle.js.map +1 -1
  159. package/dist/{git-activity.d.ts → git/activity.d.ts} +1 -1
  160. package/dist/git/activity.d.ts.map +1 -0
  161. package/dist/{git-activity.js → git/activity.js} +2 -2
  162. package/dist/git/activity.js.map +1 -0
  163. package/dist/{git-branch.d.ts → git/branch.d.ts} +2 -2
  164. package/dist/git/branch.d.ts.map +1 -0
  165. package/dist/{git-branch.js → git/branch.js} +2 -2
  166. package/dist/git/branch.js.map +1 -0
  167. package/dist/{git-fetch.d.ts → git/fetch.d.ts} +2 -2
  168. package/dist/git/fetch.d.ts.map +1 -0
  169. package/dist/{git-fetch.js → git/fetch.js} +1 -1
  170. package/dist/git/fetch.js.map +1 -0
  171. package/dist/{git-genesis.d.ts → git/genesis.d.ts} +3 -3
  172. package/dist/git/genesis.d.ts.map +1 -0
  173. package/dist/{git-genesis.js → git/genesis.js} +5 -5
  174. package/dist/git/genesis.js.map +1 -0
  175. package/dist/git/index.d.ts +36 -0
  176. package/dist/git/index.d.ts.map +1 -0
  177. package/dist/git/index.js +36 -0
  178. package/dist/git/index.js.map +1 -0
  179. package/dist/{git-integration.d.ts → git/integration.d.ts} +2 -2
  180. package/dist/git/integration.d.ts.map +1 -0
  181. package/dist/{git-integration.js → git/integration.js} +4 -4
  182. package/dist/git/integration.js.map +1 -0
  183. package/dist/{git-merge-helpers.d.ts → git/merge-helpers.d.ts} +3 -3
  184. package/dist/git/merge-helpers.d.ts.map +1 -0
  185. package/dist/{git-merge-helpers.js → git/merge-helpers.js} +3 -3
  186. package/dist/git/merge-helpers.js.map +1 -0
  187. package/dist/{git-merge-lock.d.ts → git/merge-lock.d.ts} +1 -1
  188. package/dist/git/merge-lock.d.ts.map +1 -0
  189. package/dist/{git-merge-lock.js → git/merge-lock.js} +1 -1
  190. package/dist/git/merge-lock.js.map +1 -0
  191. package/dist/{git-merge-strategies.d.ts → git/merge-strategies.d.ts} +2 -2
  192. package/dist/git/merge-strategies.d.ts.map +1 -0
  193. package/dist/{git-merge-strategies.js → git/merge-strategies.js} +3 -3
  194. package/dist/git/merge-strategies.js.map +1 -0
  195. package/dist/{git-merge.d.ts → git/merge.d.ts} +4 -4
  196. package/dist/git/merge.d.ts.map +1 -0
  197. package/dist/{git-merge.js → git/merge.js} +4 -4
  198. package/dist/git/merge.js.map +1 -0
  199. package/dist/{git-state-detector.d.ts → git/state-detector.d.ts} +2 -2
  200. package/dist/git/state-detector.d.ts.map +1 -0
  201. package/dist/{git-state-detector.js → git/state-detector.js} +7 -7
  202. package/dist/git/state-detector.js.map +1 -0
  203. package/dist/{git-types.d.ts → git/types.d.ts} +2 -2
  204. package/dist/git/types.d.ts.map +1 -0
  205. package/dist/{git-types.js → git/types.js} +1 -1
  206. package/dist/git/types.js.map +1 -0
  207. package/dist/{git-utils.d.ts → git/utils.d.ts} +1 -1
  208. package/dist/git/utils.d.ts.map +1 -0
  209. package/dist/{git-utils.js → git/utils.js} +2 -2
  210. package/dist/git/utils.js.map +1 -0
  211. package/dist/git.d.ts +5 -5
  212. package/dist/git.d.ts.map +1 -1
  213. package/dist/git.js +10 -10
  214. package/dist/git.js.map +1 -1
  215. package/dist/guard-engine.d.ts +3 -2
  216. package/dist/guard-engine.d.ts.map +1 -1
  217. package/dist/guard-engine.js +2 -2
  218. package/dist/guard-engine.js.map +1 -1
  219. package/dist/install-probe-tick.d.ts +63 -0
  220. package/dist/install-probe-tick.d.ts.map +1 -0
  221. package/dist/install-probe-tick.js +137 -0
  222. package/dist/install-probe-tick.js.map +1 -0
  223. package/dist/install-probe.d.ts +115 -0
  224. package/dist/install-probe.d.ts.map +1 -0
  225. package/dist/install-probe.js +197 -0
  226. package/dist/install-probe.js.map +1 -0
  227. package/dist/listener-auto-advance.d.ts.map +1 -1
  228. package/dist/listener-auto-advance.js +51 -9
  229. package/dist/listener-auto-advance.js.map +1 -1
  230. package/dist/listener.d.ts.map +1 -1
  231. package/dist/listener.js +15 -7
  232. package/dist/listener.js.map +1 -1
  233. package/dist/{loop-context-audit-pass.d.ts → loops/context-audit-pass.d.ts} +4 -4
  234. package/dist/loops/context-audit-pass.d.ts.map +1 -0
  235. package/dist/{loop-context-audit-pass.js → loops/context-audit-pass.js} +7 -7
  236. package/dist/loops/context-audit-pass.js.map +1 -0
  237. package/dist/{loop-engine-types.d.ts → loops/engine-types.d.ts} +1 -1
  238. package/dist/loops/engine-types.d.ts.map +1 -0
  239. package/dist/{loop-engine-types.js → loops/engine-types.js} +1 -1
  240. package/dist/loops/engine-types.js.map +1 -0
  241. package/dist/{loop-engine.d.ts → loops/engine.d.ts} +6 -6
  242. package/dist/loops/engine.d.ts.map +1 -0
  243. package/dist/{loop-engine.js → loops/engine.js} +13 -13
  244. package/dist/loops/engine.js.map +1 -0
  245. package/dist/{loop-event-bus.d.ts → loops/event-bus.d.ts} +1 -1
  246. package/dist/loops/event-bus.d.ts.map +1 -0
  247. package/dist/{loop-event-bus.js → loops/event-bus.js} +1 -1
  248. package/dist/loops/event-bus.js.map +1 -0
  249. package/dist/loops/index.d.ts +33 -0
  250. package/dist/loops/index.d.ts.map +1 -0
  251. package/dist/loops/index.js +32 -0
  252. package/dist/loops/index.js.map +1 -0
  253. package/dist/{loop-llm-client.d.ts → loops/llm-client.d.ts} +3 -3
  254. package/dist/loops/llm-client.d.ts.map +1 -0
  255. package/dist/{loop-llm-client.js → loops/llm-client.js} +3 -3
  256. package/dist/loops/llm-client.js.map +1 -0
  257. package/dist/{loop-llm-flag.d.ts → loops/llm-flag.d.ts} +1 -1
  258. package/dist/loops/llm-flag.d.ts.map +1 -0
  259. package/dist/{loop-llm-flag.js → loops/llm-flag.js} +1 -1
  260. package/dist/loops/llm-flag.js.map +1 -0
  261. package/dist/{loop-operational-block.d.ts → loops/operational-block.d.ts} +1 -1
  262. package/dist/loops/operational-block.d.ts.map +1 -0
  263. package/dist/{loop-operational-block.js → loops/operational-block.js} +1 -1
  264. package/dist/loops/operational-block.js.map +1 -0
  265. package/dist/{loop-prompt-builder.d.ts → loops/prompt-builder.d.ts} +2 -2
  266. package/dist/loops/prompt-builder.d.ts.map +1 -0
  267. package/dist/{loop-prompt-builder.js → loops/prompt-builder.js} +1 -1
  268. package/dist/loops/prompt-builder.js.map +1 -0
  269. package/dist/{loop-variance.d.ts → loops/variance.d.ts} +1 -1
  270. package/dist/loops/variance.d.ts.map +1 -0
  271. package/dist/{loop-variance.js → loops/variance.js} +1 -1
  272. package/dist/loops/variance.js.map +1 -0
  273. package/dist/merge-back-loop.d.ts.map +1 -1
  274. package/dist/merge-back-loop.js +4 -3
  275. package/dist/merge-back-loop.js.map +1 -1
  276. package/dist/merge-detector.js +2 -2
  277. package/dist/merge-detector.js.map +1 -1
  278. package/dist/{nexus-endpoint-clearance.d.ts → nexus/endpoint-clearance.d.ts} +2 -2
  279. package/dist/nexus/endpoint-clearance.d.ts.map +1 -0
  280. package/dist/{nexus-endpoint-clearance.js → nexus/endpoint-clearance.js} +2 -2
  281. package/dist/nexus/endpoint-clearance.js.map +1 -0
  282. package/dist/{nexus-escalation-bridge.d.ts → nexus/escalation-bridge.d.ts} +1 -1
  283. package/dist/nexus/escalation-bridge.d.ts.map +1 -0
  284. package/dist/{nexus-escalation-bridge.js → nexus/escalation-bridge.js} +2 -2
  285. package/dist/nexus/escalation-bridge.js.map +1 -0
  286. package/dist/{nexus-incoming.d.ts → nexus/incoming.d.ts} +2 -2
  287. package/dist/nexus/incoming.d.ts.map +1 -0
  288. package/dist/{nexus-incoming.js → nexus/incoming.js} +2 -2
  289. package/dist/nexus/incoming.js.map +1 -0
  290. package/dist/nexus/index.d.ts +20 -0
  291. package/dist/nexus/index.d.ts.map +1 -0
  292. package/dist/nexus/index.js +20 -0
  293. package/dist/nexus/index.js.map +1 -0
  294. package/dist/{nexus-intake-spawn.d.ts → nexus/intake-spawn.d.ts} +3 -3
  295. package/dist/nexus/intake-spawn.d.ts.map +1 -0
  296. package/dist/{nexus-intake-spawn.js → nexus/intake-spawn.js} +1 -1
  297. package/dist/nexus/intake-spawn.js.map +1 -0
  298. package/dist/{nexus-intake.d.ts → nexus/intake.d.ts} +2 -2
  299. package/dist/nexus/intake.d.ts.map +1 -0
  300. package/dist/{nexus-intake.js → nexus/intake.js} +4 -4
  301. package/dist/nexus/intake.js.map +1 -0
  302. package/dist/{nexus-return.d.ts → nexus/return.d.ts} +3 -3
  303. package/dist/nexus/return.d.ts.map +1 -0
  304. package/dist/{nexus-return.js → nexus/return.js} +4 -4
  305. package/dist/nexus/return.js.map +1 -0
  306. package/dist/otlp/index.d.ts +19 -0
  307. package/dist/otlp/index.d.ts.map +1 -0
  308. package/dist/otlp/index.js +19 -0
  309. package/dist/otlp/index.js.map +1 -0
  310. package/dist/{otlp-log-parser.d.ts → otlp/log-parser.d.ts} +2 -2
  311. package/dist/otlp/log-parser.d.ts.map +1 -0
  312. package/dist/{otlp-log-parser.js → otlp/log-parser.js} +5 -6
  313. package/dist/otlp/log-parser.js.map +1 -0
  314. package/dist/{otlp-metric-parser.d.ts → otlp/metric-parser.d.ts} +2 -2
  315. package/dist/otlp/metric-parser.d.ts.map +1 -0
  316. package/dist/{otlp-metric-parser.js → otlp/metric-parser.js} +4 -5
  317. package/dist/otlp/metric-parser.js.map +1 -0
  318. package/dist/{otlp-port-manager.d.ts → otlp/port-manager.d.ts} +1 -1
  319. package/dist/otlp/port-manager.d.ts.map +1 -0
  320. package/dist/{otlp-port-manager.js → otlp/port-manager.js} +1 -1
  321. package/dist/otlp/port-manager.js.map +1 -0
  322. package/dist/{otlp-receiver.d.ts → otlp/receiver.d.ts} +2 -2
  323. package/dist/otlp/receiver.d.ts.map +1 -0
  324. package/dist/{otlp-receiver.js → otlp/receiver.js} +5 -33
  325. package/dist/otlp/receiver.js.map +1 -0
  326. package/dist/{otlp-types.d.ts → otlp/types.d.ts} +1 -9
  327. package/dist/otlp/types.d.ts.map +1 -0
  328. package/dist/{otlp-types.js → otlp/types.js} +1 -27
  329. package/dist/otlp/types.js.map +1 -0
  330. package/dist/pipeline-config.d.ts +1 -1
  331. package/dist/{prd-controller.d.ts → prd/controller.d.ts} +7 -7
  332. package/dist/prd/controller.d.ts.map +1 -0
  333. package/dist/{prd-controller.js → prd/controller.js} +11 -11
  334. package/dist/prd/controller.js.map +1 -0
  335. package/dist/{prd-divergence.d.ts → prd/divergence.d.ts} +2 -2
  336. package/dist/prd/divergence.d.ts.map +1 -0
  337. package/dist/{prd-divergence.js → prd/divergence.js} +1 -1
  338. package/dist/prd/divergence.js.map +1 -0
  339. package/dist/{prd-focus-pushdown.d.ts → prd/focus-pushdown.d.ts} +2 -2
  340. package/dist/prd/focus-pushdown.d.ts.map +1 -0
  341. package/dist/{prd-focus-pushdown.js → prd/focus-pushdown.js} +3 -3
  342. package/dist/prd/focus-pushdown.js.map +1 -0
  343. package/dist/{prd-frontier.d.ts → prd/frontier.d.ts} +2 -2
  344. package/dist/prd/frontier.d.ts.map +1 -0
  345. package/dist/{prd-frontier.js → prd/frontier.js} +1 -1
  346. package/dist/prd/frontier.js.map +1 -0
  347. package/dist/prd/index.d.ts +26 -0
  348. package/dist/prd/index.d.ts.map +1 -0
  349. package/dist/prd/index.js +25 -0
  350. package/dist/prd/index.js.map +1 -0
  351. package/dist/{prd-steward.d.ts → prd/steward.d.ts} +4 -4
  352. package/dist/prd/steward.d.ts.map +1 -0
  353. package/dist/{prd-steward.js → prd/steward.js} +4 -4
  354. package/dist/prd/steward.js.map +1 -0
  355. package/dist/{prd-viability.d.ts → prd/viability.d.ts} +2 -2
  356. package/dist/prd/viability.d.ts.map +1 -0
  357. package/dist/{prd-viability.js → prd/viability.js} +1 -1
  358. package/dist/prd/viability.js.map +1 -0
  359. package/dist/product-scaffold.js +2 -2
  360. package/dist/product-scaffold.js.map +1 -1
  361. package/dist/prompt-sections/persona-sections.d.ts +32 -0
  362. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  363. package/dist/prompt-sections/persona-sections.js +78 -2
  364. package/dist/prompt-sections/persona-sections.js.map +1 -1
  365. package/dist/queries/context-lock-queries.js +1 -1
  366. package/dist/queries/context-lock-queries.js.map +1 -1
  367. package/dist/queries/deliveries.d.ts +31 -0
  368. package/dist/queries/deliveries.d.ts.map +1 -1
  369. package/dist/queries/deliveries.js +5 -0
  370. package/dist/queries/deliveries.js.map +1 -1
  371. package/dist/queries/focuses.d.ts +17 -0
  372. package/dist/queries/focuses.d.ts.map +1 -1
  373. package/dist/queries/focuses.js +27 -0
  374. package/dist/queries/focuses.js.map +1 -1
  375. package/dist/queries/schemas.d.ts +8 -0
  376. package/dist/queries/schemas.d.ts.map +1 -1
  377. package/dist/queries/schemas.js +16 -0
  378. package/dist/queries/schemas.js.map +1 -1
  379. package/dist/reality-pole.js +1 -1
  380. package/dist/resolvers/git-diff-against-base.d.ts.map +1 -1
  381. package/dist/resolvers/git-diff-against-base.js +4 -1
  382. package/dist/resolvers/git-diff-against-base.js.map +1 -1
  383. package/dist/resolvers/prd-context.js +1 -1
  384. package/dist/sensor-sweep.js +1 -1
  385. package/dist/spawn/model-routing.d.ts +277 -0
  386. package/dist/spawn/model-routing.d.ts.map +1 -0
  387. package/dist/spawn/model-routing.js +464 -0
  388. package/dist/spawn/model-routing.js.map +1 -0
  389. package/dist/spawn/process-spawn.d.ts +128 -0
  390. package/dist/spawn/process-spawn.d.ts.map +1 -0
  391. package/dist/spawn/process-spawn.js +378 -0
  392. package/dist/spawn/process-spawn.js.map +1 -0
  393. package/dist/spawn/prompt-assembly.d.ts +143 -0
  394. package/dist/spawn/prompt-assembly.d.ts.map +1 -0
  395. package/dist/spawn/prompt-assembly.js +263 -0
  396. package/dist/spawn/prompt-assembly.js.map +1 -0
  397. package/dist/spawn/shared.d.ts +72 -0
  398. package/dist/spawn/shared.d.ts.map +1 -0
  399. package/dist/spawn/shared.js +14 -0
  400. package/dist/spawn/shared.js.map +1 -0
  401. package/dist/spawn/spawn-decision.d.ts +189 -0
  402. package/dist/spawn/spawn-decision.d.ts.map +1 -0
  403. package/dist/spawn/spawn-decision.js +361 -0
  404. package/dist/spawn/spawn-decision.js.map +1 -0
  405. package/dist/spawn/worktree-session.d.ts +105 -0
  406. package/dist/spawn/worktree-session.d.ts.map +1 -0
  407. package/dist/spawn/worktree-session.js +216 -0
  408. package/dist/spawn/worktree-session.js.map +1 -0
  409. package/dist/spawner/lifecycle.js +2 -2
  410. package/dist/spawner/lifecycle.js.map +1 -1
  411. package/dist/spawner/resolution.js +1 -1
  412. package/dist/stall-detector-config.d.ts +4 -0
  413. package/dist/stall-detector-config.d.ts.map +1 -1
  414. package/dist/stall-detector-config.js +6 -0
  415. package/dist/stall-detector-config.js.map +1 -1
  416. package/dist/state-cascade.js +1 -1
  417. package/dist/state-cascade.js.map +1 -1
  418. package/dist/team-prompt-base.d.ts +1 -1
  419. package/dist/team-prompt-base.d.ts.map +1 -1
  420. package/dist/team-prompt-base.js +1 -1
  421. package/dist/team-prompt-base.js.map +1 -1
  422. package/dist/trigger-executor.d.ts +5 -9
  423. package/dist/trigger-executor.d.ts.map +1 -1
  424. package/dist/trigger-executor.js +14 -36
  425. package/dist/trigger-executor.js.map +1 -1
  426. package/dist/types/focus.d.ts +13 -0
  427. package/dist/types/focus.d.ts.map +1 -1
  428. package/dist/types/workflow.d.ts +1 -3
  429. package/dist/types/workflow.d.ts.map +1 -1
  430. package/dist/unified-engine-lifecycle.js +1 -1
  431. package/dist/unified-init.d.ts +3 -3
  432. package/dist/unified-init.d.ts.map +1 -1
  433. package/dist/unified-init.js +9 -25
  434. package/dist/unified-init.js.map +1 -1
  435. package/dist/unified-shell.d.ts +3 -3
  436. package/dist/unified-shell.js +4 -4
  437. package/dist/unified-shell.js.map +1 -1
  438. package/dist/verification-engine.d.ts.map +1 -1
  439. package/dist/verification-engine.js +15 -0
  440. package/dist/verification-engine.js.map +1 -1
  441. package/dist/{worktree-focus.d.ts → worktree/focus.d.ts} +2 -2
  442. package/dist/worktree/focus.d.ts.map +1 -0
  443. package/dist/{worktree-focus.js → worktree/focus.js} +7 -7
  444. package/dist/worktree/focus.js.map +1 -0
  445. package/dist/worktree/index.d.ts +16 -0
  446. package/dist/worktree/index.d.ts.map +1 -0
  447. package/dist/worktree/index.js +16 -0
  448. package/dist/worktree/index.js.map +1 -0
  449. package/dist/{worktree-safety.d.ts → worktree/safety.d.ts} +1 -1
  450. package/dist/worktree/safety.d.ts.map +1 -0
  451. package/dist/{worktree-safety.js → worktree/safety.js} +2 -2
  452. package/dist/worktree/safety.js.map +1 -0
  453. package/dist/{worktree-state.d.ts → worktree/state.d.ts} +1 -1
  454. package/dist/worktree/state.d.ts.map +1 -0
  455. package/dist/{worktree-state.js → worktree/state.js} +6 -6
  456. package/dist/worktree/state.js.map +1 -0
  457. package/dist/worktree.d.ts +1 -1
  458. package/dist/worktree.js +5 -5
  459. package/dist/worktree.js.map +1 -1
  460. package/package.json +5 -4
  461. package/dist/git-activity.d.ts.map +0 -1
  462. package/dist/git-activity.js.map +0 -1
  463. package/dist/git-branch.d.ts.map +0 -1
  464. package/dist/git-branch.js.map +0 -1
  465. package/dist/git-fetch.d.ts.map +0 -1
  466. package/dist/git-fetch.js.map +0 -1
  467. package/dist/git-genesis.d.ts.map +0 -1
  468. package/dist/git-genesis.js.map +0 -1
  469. package/dist/git-integration.d.ts.map +0 -1
  470. package/dist/git-integration.js.map +0 -1
  471. package/dist/git-merge-helpers.d.ts.map +0 -1
  472. package/dist/git-merge-helpers.js.map +0 -1
  473. package/dist/git-merge-lock.d.ts.map +0 -1
  474. package/dist/git-merge-lock.js.map +0 -1
  475. package/dist/git-merge-strategies.d.ts.map +0 -1
  476. package/dist/git-merge-strategies.js.map +0 -1
  477. package/dist/git-merge.d.ts.map +0 -1
  478. package/dist/git-merge.js.map +0 -1
  479. package/dist/git-state-detector.d.ts.map +0 -1
  480. package/dist/git-state-detector.js.map +0 -1
  481. package/dist/git-types.d.ts.map +0 -1
  482. package/dist/git-types.js.map +0 -1
  483. package/dist/git-utils.d.ts.map +0 -1
  484. package/dist/git-utils.js.map +0 -1
  485. package/dist/loop-context-audit-pass.d.ts.map +0 -1
  486. package/dist/loop-context-audit-pass.js.map +0 -1
  487. package/dist/loop-engine-types.d.ts.map +0 -1
  488. package/dist/loop-engine-types.js.map +0 -1
  489. package/dist/loop-engine.d.ts.map +0 -1
  490. package/dist/loop-engine.js.map +0 -1
  491. package/dist/loop-event-bus.d.ts.map +0 -1
  492. package/dist/loop-event-bus.js.map +0 -1
  493. package/dist/loop-llm-client.d.ts.map +0 -1
  494. package/dist/loop-llm-client.js.map +0 -1
  495. package/dist/loop-llm-flag.d.ts.map +0 -1
  496. package/dist/loop-llm-flag.js.map +0 -1
  497. package/dist/loop-operational-block.d.ts.map +0 -1
  498. package/dist/loop-operational-block.js.map +0 -1
  499. package/dist/loop-prompt-builder.d.ts.map +0 -1
  500. package/dist/loop-prompt-builder.js.map +0 -1
  501. package/dist/loop-variance.d.ts.map +0 -1
  502. package/dist/loop-variance.js.map +0 -1
  503. package/dist/nexus-endpoint-clearance.d.ts.map +0 -1
  504. package/dist/nexus-endpoint-clearance.js.map +0 -1
  505. package/dist/nexus-escalation-bridge.d.ts.map +0 -1
  506. package/dist/nexus-escalation-bridge.js.map +0 -1
  507. package/dist/nexus-incoming.d.ts.map +0 -1
  508. package/dist/nexus-incoming.js.map +0 -1
  509. package/dist/nexus-intake-spawn.d.ts.map +0 -1
  510. package/dist/nexus-intake-spawn.js.map +0 -1
  511. package/dist/nexus-intake.d.ts.map +0 -1
  512. package/dist/nexus-intake.js.map +0 -1
  513. package/dist/nexus-return.d.ts.map +0 -1
  514. package/dist/nexus-return.js.map +0 -1
  515. package/dist/otlp-log-parser.d.ts.map +0 -1
  516. package/dist/otlp-log-parser.js.map +0 -1
  517. package/dist/otlp-metric-parser.d.ts.map +0 -1
  518. package/dist/otlp-metric-parser.js.map +0 -1
  519. package/dist/otlp-port-manager.d.ts.map +0 -1
  520. package/dist/otlp-port-manager.js.map +0 -1
  521. package/dist/otlp-receiver.d.ts.map +0 -1
  522. package/dist/otlp-receiver.js.map +0 -1
  523. package/dist/otlp-types.d.ts.map +0 -1
  524. package/dist/otlp-types.js.map +0 -1
  525. package/dist/prd-controller.d.ts.map +0 -1
  526. package/dist/prd-controller.js.map +0 -1
  527. package/dist/prd-divergence.d.ts.map +0 -1
  528. package/dist/prd-divergence.js.map +0 -1
  529. package/dist/prd-focus-pushdown.d.ts.map +0 -1
  530. package/dist/prd-focus-pushdown.js.map +0 -1
  531. package/dist/prd-frontier.d.ts.map +0 -1
  532. package/dist/prd-frontier.js.map +0 -1
  533. package/dist/prd-steward.d.ts.map +0 -1
  534. package/dist/prd-steward.js.map +0 -1
  535. package/dist/prd-viability.d.ts.map +0 -1
  536. package/dist/prd-viability.js.map +0 -1
  537. package/dist/worktree-focus.d.ts.map +0 -1
  538. package/dist/worktree-focus.js.map +0 -1
  539. package/dist/worktree-safety.d.ts.map +0 -1
  540. package/dist/worktree-safety.js.map +0 -1
  541. package/dist/worktree-state.d.ts.map +0 -1
  542. package/dist/worktree-state.js.map +0 -1
@@ -18,10 +18,14 @@ import { homedir } from 'node:os';
18
18
  import { isLegacyMcpConfigShape, resolveMcpServerPath, writeMcpConfigFile, } from '../mcp-resolution.js';
19
19
  import { ensureGlobalStateDir, resolveDaemonLogPath } from '../daemon-process.js';
20
20
  import { STARTER_PROMPT } from '../prompts/starter-prompt.js';
21
- import { TELORA_CLAUDE_MD_BEGIN, TELORA_CLAUDE_MD_END, renderClaudeMd, SEED_BODY, SEED_MCP_REGISTRATION_SENTENCE, } from '../templates/claude-md.js';
22
- import { TELORA_AGENTS_MD_BEGIN, TELORA_AGENTS_MD_END, renderAgentsMd, } from '../templates/agents-md.js';
23
- import { buildClaudeSettings, mergeClaudeSettings, } from '../templates/claude-settings.js';
24
21
  import { writeProductCodexHome, renderManualCodexProfile, } from './codex-provision.js';
22
+ import { harnessGitignoreEntries, writeHarnessScaffolding, } from './connect/scaffolding.js';
23
+ export { writeOrMergeClaudeMd, writeOrMergeClaudeSettings } from './connect/claude.js';
24
+ export { writeOrMergeAgentsMd } from './connect/agents.js';
25
+ export { renderCodexMcpBlock, writeOrMergeCodexMcpToml } from './connect/codex.js';
26
+ export { renderClineRules, writeClineProjectRules, renderClineMcpSettings, writeOrMergeClineMcpSettings, } from './connect/cline.js';
27
+ export { DEFAULT_IDE_HARNESS_PRELOAD, IDE_MCP_REGISTRATION_SENTENCE, IDE_MCP_CONFIG_PATH, renderIdeMcpConfig, writeIdeMcpConfig, writeIdeHarnessScaffolding, } from './connect/ide.js';
28
+ export { harnessGitignoreEntries, writeHarnessScaffolding } from './connect/scaffolding.js';
25
29
  /**
26
30
  * Production Telora API URL embedded in the published @telora/daemon package.
27
31
  * Override with TELORA_URL for local dev.
@@ -60,17 +64,6 @@ export const OPERATOR_HARNESSES = [
60
64
  export function isOperatorHarness(value) {
61
65
  return OPERATOR_HARNESSES.includes(value);
62
66
  }
63
- /**
64
- * Default `TELORA_MCP_PRELOAD` for the IDE harnesses (cursor / vscode).
65
- *
66
- * Static-surface clients ignore `tools/list_changed`, so `telora_discover`
67
- * lazy-loading never becomes callable mid-session -- they need the domains
68
- * they will actually use registered at startup. This modest set (escalations,
69
- * wiki, reality-tree planning) covers inspection + light-operator work while
70
- * keeping the active tool surface under the ~40-tool ceiling those clients
71
- * impose. Operators can widen it by editing the generated MCP config.
72
- */
73
- export const DEFAULT_IDE_HARNESS_PRELOAD = 'agent,wiki,reality_trees';
74
67
  /**
75
68
  * Map a redeem error code to a one-line remediation hint.
76
69
  */
@@ -209,10 +202,9 @@ export function writeConnectDaemonConfig(params) {
209
202
  integrationBranch: 'integration',
210
203
  maxTotalSessions: 5,
211
204
  },
212
- factory: {
213
- enabled: true,
214
- maxConcurrentInstances: 3,
215
- },
205
+ // The factory engine is retired. Newly generated configs carry only the
206
+ // focus engine; a legacy `engines.factory` block in an existing config is
207
+ // still tolerated (ignored, force-disabled) on load by unified-shell.
216
208
  },
217
209
  };
218
210
  writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', { mode: 0o600 });
@@ -405,482 +397,6 @@ export function findExistingProductForRepo(repoPath) {
405
397
  }
406
398
  return null;
407
399
  }
408
- /**
409
- * Write or merge a seeded `CLAUDE.md` at the repo root.
410
- *
411
- * - Fresh repo: writes the seeded block straight in.
412
- * - Existing CLAUDE.md without the Telora delimiters: appends a delimited
413
- * Telora block at the end. The user's content is untouched.
414
- * - Existing CLAUDE.md WITH the delimiters: replaces only the delimited
415
- * block. Re-runs are byte-identical (no churn, no duplication).
416
- *
417
- * Idempotent at the filesystem level: when the computed content equals what
418
- * is already on disk, NO write occurs (no spurious mtime bump, no git churn).
419
- * The daemon re-invokes this on every boot to self-heal the seed block, so
420
- * the unchanged-common-case must not touch the file.
421
- */
422
- export function writeOrMergeClaudeMd(repoPath, productName, io) {
423
- const path = resolve(repoPath, 'CLAUDE.md');
424
- const seedBlock = renderClaudeMd(productName);
425
- if (!existsSync(path)) {
426
- writeFileSync(path, seedBlock);
427
- io.out(`Wrote ${path}.\n`);
428
- return;
429
- }
430
- const existing = readFileSync(path, 'utf-8');
431
- const beginIdx = existing.indexOf(TELORA_CLAUDE_MD_BEGIN);
432
- let newContent;
433
- let message;
434
- if (beginIdx === -1) {
435
- // No prior Telora block -- append, preserving user content.
436
- const sep = existing.endsWith('\n') ? '\n' : '\n\n';
437
- newContent = existing + sep + seedBlock;
438
- message = `Appended Telora seed block to ${path}.\n`;
439
- }
440
- else {
441
- const endIdx = existing.indexOf(TELORA_CLAUDE_MD_END, beginIdx);
442
- if (endIdx === -1) {
443
- // Begin marker without end -- treat as malformed. Append a fresh block
444
- // rather than risk corrupting whatever's there.
445
- const sep = existing.endsWith('\n') ? '\n' : '\n\n';
446
- newContent = existing + sep + seedBlock;
447
- message = `Appended Telora seed block to ${path} (prior block was malformed).\n`;
448
- }
449
- else {
450
- // Replace the existing Telora block in place.
451
- const after = endIdx + TELORA_CLAUDE_MD_END.length;
452
- // Trim a trailing newline after the end marker so we don't accumulate
453
- // blank lines on each re-run.
454
- const trailingNewline = existing[after] === '\n' ? 1 : 0;
455
- newContent =
456
- existing.slice(0, beginIdx) +
457
- seedBlock.trimEnd() +
458
- '\n' +
459
- existing.slice(after + trailingNewline);
460
- message = `Refreshed Telora seed block in ${path}.\n`;
461
- }
462
- }
463
- // Idempotency guard: skip the write entirely when nothing would change.
464
- // This keeps the boot-time self-heal a no-op for already-current repos.
465
- if (newContent === existing)
466
- return;
467
- writeFileSync(path, newContent);
468
- io.out(message);
469
- }
470
- /**
471
- * Write or merge a seeded `AGENTS.md` at the repo root (Codex harness).
472
- *
473
- * The exact analog of `writeOrMergeClaudeMd` for the Codex operator surface:
474
- * AGENTS.md is Codex's CLAUDE.md-equivalent. Same merge semantics --
475
- * - Fresh repo: writes the seeded block straight in.
476
- * - Existing AGENTS.md without the Telora delimiters: appends a delimited
477
- * block at the end; user content untouched.
478
- * - Existing AGENTS.md WITH the delimiters: replaces only the delimited block.
479
- *
480
- * Idempotent at the filesystem level: when the computed content equals what is
481
- * already on disk, NO write occurs (no spurious mtime bump, no git churn). The
482
- * daemon re-invokes this on boot to self-heal the seed block, so the
483
- * unchanged-common-case must not touch the file.
484
- */
485
- export function writeOrMergeAgentsMd(repoPath, inv, io) {
486
- const path = resolve(repoPath, 'AGENTS.md');
487
- const seedBlock = renderAgentsMd(inv);
488
- if (!existsSync(path)) {
489
- writeFileSync(path, seedBlock);
490
- io.out(`Wrote ${path}.\n`);
491
- return;
492
- }
493
- const existing = readFileSync(path, 'utf-8');
494
- const beginIdx = existing.indexOf(TELORA_AGENTS_MD_BEGIN);
495
- let newContent;
496
- let message;
497
- if (beginIdx === -1) {
498
- const sep = existing.endsWith('\n') ? '\n' : '\n\n';
499
- newContent = existing + sep + seedBlock;
500
- message = `Appended Telora seed block to ${path}.\n`;
501
- }
502
- else {
503
- const endIdx = existing.indexOf(TELORA_AGENTS_MD_END, beginIdx);
504
- if (endIdx === -1) {
505
- const sep = existing.endsWith('\n') ? '\n' : '\n\n';
506
- newContent = existing + sep + seedBlock;
507
- message = `Appended Telora seed block to ${path} (prior block was malformed).\n`;
508
- }
509
- else {
510
- const after = endIdx + TELORA_AGENTS_MD_END.length;
511
- const trailingNewline = existing[after] === '\n' ? 1 : 0;
512
- newContent =
513
- existing.slice(0, beginIdx) +
514
- seedBlock.trimEnd() +
515
- '\n' +
516
- existing.slice(after + trailingNewline);
517
- message = `Refreshed Telora seed block in ${path}.\n`;
518
- }
519
- }
520
- // Idempotency guard: skip the write entirely when nothing would change.
521
- if (newContent === existing)
522
- return;
523
- writeFileSync(path, newContent);
524
- io.out(message);
525
- }
526
- // Delimiter comments wrapping the Telora MCP block in the operator's
527
- // ~/.codex/config.toml. TOML comments start with '#', so these are inert to
528
- // the parser yet let us replace exactly our block on re-runs.
529
- const TELORA_CODEX_MCP_BEGIN = '# BEGIN TELORA MCP';
530
- const TELORA_CODEX_MCP_END = '# END TELORA MCP';
531
- /**
532
- * Render the delimited Telora MCP block for the operator's personal
533
- * `~/.codex/config.toml`. Mirrors the `.mcp.json` shape (command=node + the
534
- * resolved abs path to @telora/mcp-products) but as a TOML `[mcp_servers.telora]`
535
- * table, the form Codex reads. Profile is `human` (operator-interactive),
536
- * matching the `.mcp.json` the Claude path writes.
537
- *
538
- * Carries the MCP profile ONLY -- never workstation identity. Identity
539
- * (`TELORA_URL` / `TELORA_TRACKER_ID`) resolves from the single source
540
- * `~/.telora/daemon.json` via the MCP server's `loadCredentials()` fallback,
541
- * so a persisted copy here would only be a drift hazard. Keeping it out is the
542
- * single-source invariant (the `.mcp.json` builder omits it for the same
543
- * reason).
544
- *
545
- * Values are emitted as JSON-encoded TOML string literals, which is valid TOML
546
- * for the path value we control here.
547
- */
548
- export function renderCodexMcpBlock(params) {
549
- const lines = [
550
- TELORA_CODEX_MCP_BEGIN,
551
- `[mcp_servers.telora]`,
552
- `command = "node"`,
553
- `args = [${JSON.stringify(params.mcpServerPath)}]`,
554
- `[mcp_servers.telora.env]`,
555
- `TELORA_MCP_PROFILE = "human"`,
556
- TELORA_CODEX_MCP_END,
557
- ];
558
- return lines.join('\n') + '\n';
559
- }
560
- /**
561
- * Register the Telora MCP server in the operator's personal
562
- * `~/.codex/config.toml` (NOT the per-product execution CODEX_HOME -- that is
563
- * `codex-provision.ts`, a separate concern). This is what makes the Telora
564
- * tool surface reachable from the operator's interactive Codex chat.
565
- *
566
- * Idempotent delimited merge, mirroring `writeOrMergeClaudeMd`: replace the
567
- * `# BEGIN/END TELORA MCP` block in place if present, append it if absent,
568
- * never duplicate. When the computed content equals what is on disk, NO write
569
- * occurs. `homeOverride` lets tests target a temp HOME.
570
- *
571
- * Best-effort: if the MCP package cannot be resolved, prints a warning and
572
- * returns without touching the file (the connect flow must not abort).
573
- */
574
- export function writeOrMergeCodexMcpToml(io, params = {}) {
575
- let mcpServerPath;
576
- try {
577
- mcpServerPath = resolveMcpServerPath();
578
- }
579
- catch (err) {
580
- io.err(`Warning: could not resolve @telora/mcp-products; skipping Codex MCP registration: ${err instanceof Error ? err.message : String(err)}\n`);
581
- return;
582
- }
583
- const home = params.homeOverride ?? homedir();
584
- const dir = resolve(home, '.codex');
585
- const path = resolve(dir, 'config.toml');
586
- const block = renderCodexMcpBlock({ mcpServerPath });
587
- if (!existsSync(dir))
588
- mkdirSync(dir, { recursive: true, mode: 0o700 });
589
- if (!existsSync(path)) {
590
- writeFileSync(path, block, { mode: 0o600 });
591
- io.out(`Wrote ${path}.\n`);
592
- return;
593
- }
594
- const existing = readFileSync(path, 'utf-8');
595
- const beginIdx = existing.indexOf(TELORA_CODEX_MCP_BEGIN);
596
- let newContent;
597
- let message;
598
- if (beginIdx === -1) {
599
- const sep = existing.endsWith('\n') ? '\n' : '\n\n';
600
- newContent = existing.trimEnd().length === 0 ? block : existing + sep + block;
601
- message = `Registered Telora MCP server in ${path}.\n`;
602
- }
603
- else {
604
- const endIdx = existing.indexOf(TELORA_CODEX_MCP_END, beginIdx);
605
- if (endIdx === -1) {
606
- const sep = existing.endsWith('\n') ? '\n' : '\n\n';
607
- newContent = existing + sep + block;
608
- message = `Registered Telora MCP server in ${path} (prior block was malformed).\n`;
609
- }
610
- else {
611
- const after = endIdx + TELORA_CODEX_MCP_END.length;
612
- const trailingNewline = existing[after] === '\n' ? 1 : 0;
613
- newContent =
614
- existing.slice(0, beginIdx) +
615
- block.trimEnd() +
616
- '\n' +
617
- existing.slice(after + trailingNewline);
618
- message = `Refreshed Telora MCP server registration in ${path}.\n`;
619
- }
620
- }
621
- // Idempotency guard: skip the write when nothing would change.
622
- if (newContent === existing)
623
- return;
624
- writeFileSync(path, newContent, { mode: 0o600 });
625
- io.out(message);
626
- }
627
- const CLINE_MCP_REGISTRATION_SENTENCE = 'The Telora MCP server is registered in `~/.cline/data/settings/cline_mcp_settings.json`.';
628
- /**
629
- * Render a project-level Cline rules file carrying the same Telora seed
630
- * discipline as CLAUDE.md / AGENTS.md. Cline CLI reads project rules from
631
- * `.cline/rules/`, so this is the operator-facing context equivalent for the
632
- * Cline harness.
633
- */
634
- export function renderClineRules(inv) {
635
- const productLabel = inv.productName ? `${inv.productName} (${inv.productId})` : inv.productId;
636
- const body = SEED_BODY.replace(SEED_MCP_REGISTRATION_SENTENCE, CLINE_MCP_REGISTRATION_SENTENCE);
637
- return (`# Telora Workstation\n\n` +
638
- `This workstation is connected to Telora. The connection invariant is recorded here for Cline CLI sessions:\n\n` +
639
- `- Telora URL: ${inv.teloraUrl}\n` +
640
- `- Organization: ${inv.organizationId}\n` +
641
- `- Product: ${productLabel}\n\n` +
642
- body);
643
- }
644
- /**
645
- * Write the Telora Cline project rules file. The file is owned by the connect
646
- * flow, so re-runs replace it wholesale; user-authored Cline rules live beside
647
- * it under `.cline/rules/`.
648
- */
649
- export function writeClineProjectRules(repoPath, inv, io) {
650
- const dir = resolve(repoPath, '.cline', 'rules');
651
- const path = resolve(dir, 'telora.md');
652
- const content = renderClineRules(inv);
653
- if (!existsSync(dir))
654
- mkdirSync(dir, { recursive: true });
655
- if (existsSync(path) && readFileSync(path, 'utf-8') === content)
656
- return;
657
- writeFileSync(path, content);
658
- io.out(`Wrote ${path}.\n`);
659
- }
660
- /**
661
- * Render the Cline CLI MCP config object. Current Cline CLI documentation
662
- * stores MCP settings under `~/.cline/data/settings/cline_mcp_settings.json`
663
- * with a top-level `mcpServers` map.
664
- *
665
- * Carries the MCP profile ONLY -- never workstation identity. Like the
666
- * `.mcp.json` and Codex builders, identity (`TELORA_URL` / `TELORA_TRACKER_ID`)
667
- * resolves from the single source `~/.telora/daemon.json` via the MCP server's
668
- * `loadCredentials()` fallback; a persisted copy here would only drift.
669
- */
670
- export function renderClineMcpSettings(params) {
671
- return {
672
- mcpServers: {
673
- telora: {
674
- command: 'node',
675
- args: [params.mcpServerPath],
676
- env: {
677
- TELORA_MCP_PROFILE: 'human',
678
- },
679
- disabled: false,
680
- autoApprove: [],
681
- },
682
- },
683
- };
684
- }
685
- export function writeOrMergeClineMcpSettings(io, params = {}) {
686
- let mcpServerPath;
687
- try {
688
- mcpServerPath = resolveMcpServerPath();
689
- }
690
- catch (err) {
691
- io.err(`Warning: could not resolve @telora/mcp-products; skipping Cline MCP registration: ${err instanceof Error ? err.message : String(err)}\n`);
692
- return;
693
- }
694
- const home = params.homeOverride ?? homedir();
695
- const dir = resolve(home, '.cline', 'data', 'settings');
696
- const path = resolve(dir, 'cline_mcp_settings.json');
697
- const desired = renderClineMcpSettings({ mcpServerPath });
698
- if (!existsSync(dir))
699
- mkdirSync(dir, { recursive: true, mode: 0o700 });
700
- let parsed = {};
701
- if (existsSync(path)) {
702
- try {
703
- const raw = readFileSync(path, 'utf-8');
704
- const candidate = JSON.parse(raw);
705
- if (candidate && typeof candidate === 'object' && !Array.isArray(candidate)) {
706
- parsed = candidate;
707
- }
708
- }
709
- catch (err) {
710
- io.err(`Warning: ${path} is not valid JSON; leaving it alone: ${err instanceof Error ? err.message : String(err)}\n`);
711
- return;
712
- }
713
- }
714
- const existingServers = parsed.mcpServers && typeof parsed.mcpServers === 'object' && !Array.isArray(parsed.mcpServers)
715
- ? parsed.mcpServers
716
- : {};
717
- const desiredServers = desired.mcpServers;
718
- const next = {
719
- ...parsed,
720
- mcpServers: {
721
- ...existingServers,
722
- telora: desiredServers.telora,
723
- },
724
- };
725
- const content = JSON.stringify(next, null, 2) + '\n';
726
- if (existsSync(path) && readFileSync(path, 'utf-8') === content)
727
- return;
728
- writeFileSync(path, content, { mode: 0o600 });
729
- io.out(`Registered Telora MCP server in ${path}.\n`);
730
- }
731
- /**
732
- * The MCP-registration sentence spliced into the AGENTS.md seed body for each
733
- * IDE harness. Both Cursor and VS Code read AGENTS.md natively, but they load
734
- * MCP from different project files, so the seeded discipline must name the
735
- * right one. (`renderAgentsMd` defaults to the Codex `~/.codex/config.toml`
736
- * location; these override it.)
737
- */
738
- export const IDE_MCP_REGISTRATION_SENTENCE = {
739
- cursor: 'The Telora MCP server is registered in `.cursor/mcp.json`.',
740
- vscode: 'The Telora MCP server is registered in `.vscode/mcp.json`.',
741
- };
742
- /** Project-relative path of the MCP config file for each IDE harness. */
743
- export const IDE_MCP_CONFIG_PATH = {
744
- cursor: '.cursor/mcp.json',
745
- vscode: '.vscode/mcp.json',
746
- };
747
- /**
748
- * Build the project-level MCP config object for an IDE harness.
749
- *
750
- * Cursor reads `.cursor/mcp.json` with a top-level `mcpServers` map (the same
751
- * shape as `.mcp.json`). VS Code reads `.vscode/mcp.json` with a top-level
752
- * `servers` map whose entries declare `type: "stdio"`.
753
- *
754
- * Both carry the MCP profile + domain-preload env ONLY -- never workstation
755
- * identity. Identity (`TELORA_URL` / `TELORA_TRACKER_ID`) resolves from the
756
- * single source `~/.telora/daemon.json` via the MCP server's
757
- * `loadCredentials()` fallback, so a persisted copy here would only drift --
758
- * the same single-source invariant the `.mcp.json` / Codex / Cline builders
759
- * hold. The preload env is what makes these static-surface clients usable:
760
- * it registers the named domains at startup rather than via `telora_discover`.
761
- */
762
- export function renderIdeMcpConfig(kind, params) {
763
- const env = {
764
- TELORA_MCP_PROFILE: 'human',
765
- TELORA_MCP_PRELOAD: params.preload,
766
- };
767
- if (kind === 'cursor') {
768
- return {
769
- mcpServers: {
770
- telora: { command: 'node', args: [params.mcpServerPath], env },
771
- },
772
- };
773
- }
774
- return {
775
- servers: {
776
- telora: { type: 'stdio', command: 'node', args: [params.mcpServerPath], env },
777
- },
778
- };
779
- }
780
- /**
781
- * Write the Telora project MCP config for an IDE harness (`.cursor/mcp.json`
782
- * or `.vscode/mcp.json`).
783
- *
784
- * Idempotent JSON merge, mirroring `writeOrMergeClineMcpSettings`: preserve any
785
- * user-authored server entries, replace only the `telora` key, and skip the
786
- * write when nothing would change. Best-effort: if the MCP package cannot be
787
- * resolved, prints a warning and returns without touching the file (the connect
788
- * flow must not abort). `params.preload` defaults to `DEFAULT_IDE_HARNESS_PRELOAD`.
789
- */
790
- export function writeIdeMcpConfig(repoPath, kind, io, params = {}) {
791
- let mcpServerPath;
792
- try {
793
- mcpServerPath = resolveMcpServerPath();
794
- }
795
- catch (err) {
796
- io.err(`Warning: could not resolve @telora/mcp-products; skipping ${kind} MCP registration: ${err instanceof Error ? err.message : String(err)}\n`);
797
- return;
798
- }
799
- const dir = resolve(repoPath, kind === 'cursor' ? '.cursor' : '.vscode');
800
- const path = resolve(dir, 'mcp.json');
801
- const mapKey = kind === 'cursor' ? 'mcpServers' : 'servers';
802
- const desired = renderIdeMcpConfig(kind, {
803
- mcpServerPath,
804
- preload: params.preload ?? DEFAULT_IDE_HARNESS_PRELOAD,
805
- });
806
- if (!existsSync(dir))
807
- mkdirSync(dir, { recursive: true });
808
- let parsed = {};
809
- if (existsSync(path)) {
810
- try {
811
- const candidate = JSON.parse(readFileSync(path, 'utf-8'));
812
- if (candidate && typeof candidate === 'object' && !Array.isArray(candidate)) {
813
- parsed = candidate;
814
- }
815
- }
816
- catch (err) {
817
- io.err(`Warning: ${path} is not valid JSON; leaving it alone: ${err instanceof Error ? err.message : String(err)}\n`);
818
- return;
819
- }
820
- }
821
- const existingServers = parsed[mapKey] && typeof parsed[mapKey] === 'object' && !Array.isArray(parsed[mapKey])
822
- ? parsed[mapKey]
823
- : {};
824
- const desiredServers = desired[mapKey];
825
- const next = {
826
- ...parsed,
827
- [mapKey]: { ...existingServers, telora: desiredServers.telora },
828
- };
829
- const content = JSON.stringify(next, null, 2) + '\n';
830
- if (existsSync(path) && readFileSync(path, 'utf-8') === content)
831
- return;
832
- writeFileSync(path, content);
833
- io.out(`Registered Telora MCP server in ${path}.\n`);
834
- }
835
- /**
836
- * Write the full IDE-harness scaffolding (AGENTS.md seed + project MCP config)
837
- * for `cursor` or `vscode`. Extracted so both `connect --harness <ide>` and the
838
- * token-free `harness add <ide>` verb write byte-identical output.
839
- */
840
- export function writeIdeHarnessScaffolding(repoPath, kind, inv, io) {
841
- writeOrMergeAgentsMd(repoPath, { ...inv, mcpRegistrationSentence: IDE_MCP_REGISTRATION_SENTENCE[kind] }, io);
842
- writeIdeMcpConfig(repoPath, kind, io);
843
- }
844
- /**
845
- * The `.gitignore` entries a harness's scaffolding requires beyond the always-
846
- * added `.telora/` + `.mcp.json`. Only the IDE harnesses add a project MCP
847
- * config (per-user-machine, absolute path -> not shared).
848
- */
849
- export function harnessGitignoreEntries(harness) {
850
- return harness === 'cursor' || harness === 'vscode' ? [IDE_MCP_CONFIG_PATH[harness]] : [];
851
- }
852
- /**
853
- * Write the harness-specific agent scaffolding for the chosen operator harness.
854
- * This is the ONE place the per-harness writer set is dispatched, so both
855
- * `connect --harness <h>` and the token-free `harness add <h>` verb produce
856
- * byte-identical output for a given identity.
857
- *
858
- * - claude: CLAUDE.md + .claude/settings.json
859
- * - codex: AGENTS.md + Telora MCP in ~/.codex/config.toml
860
- * - cline: .cline/rules/telora.md + Telora MCP in ~/.cline settings
861
- * - cursor: AGENTS.md + .cursor/mcp.json (preload env)
862
- * - vscode: AGENTS.md + .vscode/mcp.json (preload env)
863
- *
864
- * Does NOT touch `.gitignore` -- callers pair this with
865
- * `ensureGitignoreEntries(repoPath, io, harnessGitignoreEntries(harness))`.
866
- */
867
- export function writeHarnessScaffolding(repoPath, harness, inv, io) {
868
- if (harness === 'codex') {
869
- writeOrMergeAgentsMd(repoPath, inv, io);
870
- writeOrMergeCodexMcpToml(io);
871
- }
872
- else if (harness === 'cline') {
873
- writeClineProjectRules(repoPath, inv, io);
874
- writeOrMergeClineMcpSettings(io);
875
- }
876
- else if (harness === 'cursor' || harness === 'vscode') {
877
- writeIdeHarnessScaffolding(repoPath, harness, inv, io);
878
- }
879
- else {
880
- writeOrMergeClaudeMd(repoPath, inv.productName ?? null, io);
881
- writeOrMergeClaudeSettings(repoPath, io);
882
- }
883
- }
884
400
  /**
885
401
  * Resolve the connected-workstation identity for `repoPath` from
886
402
  * `~/.telora/daemon.json`: the top-level `teloraUrl` / `organizationId` plus the
@@ -914,38 +430,6 @@ export function readConnectedIdentity(repoPath) {
914
430
  }
915
431
  return null;
916
432
  }
917
- /**
918
- * Write or deep-merge `<repo>/.claude/settings.json`.
919
- *
920
- * Fresh: writes the template directly.
921
- * Existing: deep-merges our `permissions.allow` entries into the user's
922
- * settings, deduplicating. All other top-level keys are untouched.
923
- * Re-runs produce no diff.
924
- */
925
- export function writeOrMergeClaudeSettings(repoPath, io) {
926
- const dir = resolve(repoPath, '.claude');
927
- const path = resolve(dir, 'settings.json');
928
- const seed = buildClaudeSettings();
929
- if (!existsSync(dir))
930
- mkdirSync(dir, { recursive: true });
931
- let existing = null;
932
- if (existsSync(path)) {
933
- try {
934
- const parsed = JSON.parse(readFileSync(path, 'utf-8'));
935
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
936
- existing = parsed;
937
- }
938
- }
939
- catch (err) {
940
- io.err(`Warning: existing ${path} is not valid JSON; leaving it alone: ` +
941
- `${err instanceof Error ? err.message : String(err)}\n`);
942
- return;
943
- }
944
- }
945
- const merged = mergeClaudeSettings(existing, seed);
946
- writeFileSync(path, JSON.stringify(merged, null, 2) + '\n');
947
- io.out(existing ? `Merged Telora entries into ${path}.\n` : `Wrote ${path}.\n`);
948
- }
949
433
  // ── Workstation tracking (D4): telora-ai detection + hook merge ─────────
950
434
  /**
951
435
  * Locate the `telora-ai` Python CLI on PATH. Returns the absolute path if