@evermore.work/server 2026.509.0-canary.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 (1045) hide show
  1. package/dist/adapters/builtin-adapter-types.d.ts +5 -0
  2. package/dist/adapters/builtin-adapter-types.d.ts.map +1 -0
  3. package/dist/adapters/builtin-adapter-types.js +17 -0
  4. package/dist/adapters/builtin-adapter-types.js.map +1 -0
  5. package/dist/adapters/codex-models.d.ts +5 -0
  6. package/dist/adapters/codex-models.d.ts.map +1 -0
  7. package/dist/adapters/codex-models.js +105 -0
  8. package/dist/adapters/codex-models.js.map +1 -0
  9. package/dist/adapters/cursor-models.d.ts +13 -0
  10. package/dist/adapters/cursor-models.d.ts.map +1 -0
  11. package/dist/adapters/cursor-models.js +148 -0
  12. package/dist/adapters/cursor-models.js.map +1 -0
  13. package/dist/adapters/http/execute.d.ts +3 -0
  14. package/dist/adapters/http/execute.d.ts.map +1 -0
  15. package/dist/adapters/http/execute.js +51 -0
  16. package/dist/adapters/http/execute.js.map +1 -0
  17. package/dist/adapters/http/execute.test.d.ts +2 -0
  18. package/dist/adapters/http/execute.test.d.ts.map +1 -0
  19. package/dist/adapters/http/execute.test.js +40 -0
  20. package/dist/adapters/http/execute.test.js.map +1 -0
  21. package/dist/adapters/http/index.d.ts +3 -0
  22. package/dist/adapters/http/index.d.ts.map +1 -0
  23. package/dist/adapters/http/index.js +20 -0
  24. package/dist/adapters/http/index.js.map +1 -0
  25. package/dist/adapters/http/test.d.ts +3 -0
  26. package/dist/adapters/http/test.d.ts.map +1 -0
  27. package/dist/adapters/http/test.js +106 -0
  28. package/dist/adapters/http/test.js.map +1 -0
  29. package/dist/adapters/index.d.ts +4 -0
  30. package/dist/adapters/index.d.ts.map +1 -0
  31. package/dist/adapters/index.js +3 -0
  32. package/dist/adapters/index.js.map +1 -0
  33. package/dist/adapters/plugin-loader.d.ts +28 -0
  34. package/dist/adapters/plugin-loader.d.ts.map +1 -0
  35. package/dist/adapters/plugin-loader.js +196 -0
  36. package/dist/adapters/plugin-loader.js.map +1 -0
  37. package/dist/adapters/process/execute.d.ts +3 -0
  38. package/dist/adapters/process/execute.d.ts.map +1 -0
  39. package/dist/adapters/process/execute.js +70 -0
  40. package/dist/adapters/process/execute.js.map +1 -0
  41. package/dist/adapters/process/index.d.ts +3 -0
  42. package/dist/adapters/process/index.d.ts.map +1 -0
  43. package/dist/adapters/process/index.js +23 -0
  44. package/dist/adapters/process/index.js.map +1 -0
  45. package/dist/adapters/process/test.d.ts +3 -0
  46. package/dist/adapters/process/test.d.ts.map +1 -0
  47. package/dist/adapters/process/test.js +77 -0
  48. package/dist/adapters/process/test.js.map +1 -0
  49. package/dist/adapters/registry.d.ts +69 -0
  50. package/dist/adapters/registry.d.ts.map +1 -0
  51. package/dist/adapters/registry.js +566 -0
  52. package/dist/adapters/registry.js.map +1 -0
  53. package/dist/adapters/types.d.ts +2 -0
  54. package/dist/adapters/types.d.ts.map +1 -0
  55. package/dist/adapters/types.js +2 -0
  56. package/dist/adapters/types.js.map +1 -0
  57. package/dist/adapters/utils.d.ts +43 -0
  58. package/dist/adapters/utils.d.ts.map +1 -0
  59. package/dist/adapters/utils.js +52 -0
  60. package/dist/adapters/utils.js.map +1 -0
  61. package/dist/agent-auth-jwt.d.ts +14 -0
  62. package/dist/agent-auth-jwt.d.ts.map +1 -0
  63. package/dist/agent-auth-jwt.js +117 -0
  64. package/dist/agent-auth-jwt.js.map +1 -0
  65. package/dist/app.d.ts +43 -0
  66. package/dist/app.d.ts.map +1 -0
  67. package/dist/app.js +373 -0
  68. package/dist/app.js.map +1 -0
  69. package/dist/attachment-types.d.ts +23 -0
  70. package/dist/attachment-types.d.ts.map +1 -0
  71. package/dist/attachment-types.js +91 -0
  72. package/dist/attachment-types.js.map +1 -0
  73. package/dist/auth/better-auth.d.ts +33 -0
  74. package/dist/auth/better-auth.d.ts.map +1 -0
  75. package/dist/auth/better-auth.js +133 -0
  76. package/dist/auth/better-auth.js.map +1 -0
  77. package/dist/board-claim.d.ts +23 -0
  78. package/dist/board-claim.d.ts.map +1 -0
  79. package/dist/board-claim.js +115 -0
  80. package/dist/board-claim.js.map +1 -0
  81. package/dist/config-file.d.ts +3 -0
  82. package/dist/config-file.d.ts.map +1 -0
  83. package/dist/config-file.js +16 -0
  84. package/dist/config-file.js.map +1 -0
  85. package/dist/config.d.ts +44 -0
  86. package/dist/config.d.ts.map +1 -0
  87. package/dist/config.js +226 -0
  88. package/dist/config.js.map +1 -0
  89. package/dist/dev-runner-worktree.d.ts +15 -0
  90. package/dist/dev-runner-worktree.d.ts.map +1 -0
  91. package/dist/dev-runner-worktree.js +68 -0
  92. package/dist/dev-runner-worktree.js.map +1 -0
  93. package/dist/dev-server-status.d.ts +27 -0
  94. package/dist/dev-server-status.d.ts.map +1 -0
  95. package/dist/dev-server-status.js +74 -0
  96. package/dist/dev-server-status.js.map +1 -0
  97. package/dist/dev-watch-ignore.d.ts +2 -0
  98. package/dist/dev-watch-ignore.d.ts.map +1 -0
  99. package/dist/dev-watch-ignore.js +36 -0
  100. package/dist/dev-watch-ignore.js.map +1 -0
  101. package/dist/errors.d.ts +12 -0
  102. package/dist/errors.d.ts.map +1 -0
  103. package/dist/errors.js +28 -0
  104. package/dist/errors.js.map +1 -0
  105. package/dist/home-paths.d.ts +17 -0
  106. package/dist/home-paths.d.ts.map +1 -0
  107. package/dist/home-paths.js +75 -0
  108. package/dist/home-paths.js.map +1 -0
  109. package/dist/index.d.ts +10 -0
  110. package/dist/index.d.ts.map +1 -0
  111. package/dist/index.js +753 -0
  112. package/dist/index.js.map +1 -0
  113. package/dist/lib/join-request-dedupe.d.ts +11 -0
  114. package/dist/lib/join-request-dedupe.d.ts.map +1 -0
  115. package/dist/lib/join-request-dedupe.js +49 -0
  116. package/dist/lib/join-request-dedupe.js.map +1 -0
  117. package/dist/log-redaction.d.ts +11 -0
  118. package/dist/log-redaction.d.ts.map +1 -0
  119. package/dist/log-redaction.js +122 -0
  120. package/dist/log-redaction.js.map +1 -0
  121. package/dist/middleware/auth.d.ts +12 -0
  122. package/dist/middleware/auth.d.ts.map +1 -0
  123. package/dist/middleware/auth.js +302 -0
  124. package/dist/middleware/auth.js.map +1 -0
  125. package/dist/middleware/board-mutation-guard.d.ts +3 -0
  126. package/dist/middleware/board-mutation-guard.d.ts.map +1 -0
  127. package/dist/middleware/board-mutation-guard.js +67 -0
  128. package/dist/middleware/board-mutation-guard.js.map +1 -0
  129. package/dist/middleware/error-handler.d.ts +17 -0
  130. package/dist/middleware/error-handler.d.ts.map +1 -0
  131. package/dist/middleware/error-handler.js +45 -0
  132. package/dist/middleware/error-handler.js.map +1 -0
  133. package/dist/middleware/http-log-policy.d.ts +2 -0
  134. package/dist/middleware/http-log-policy.d.ts.map +1 -0
  135. package/dist/middleware/http-log-policy.js +52 -0
  136. package/dist/middleware/http-log-policy.js.map +1 -0
  137. package/dist/middleware/index.d.ts +4 -0
  138. package/dist/middleware/index.d.ts.map +1 -0
  139. package/dist/middleware/index.js +4 -0
  140. package/dist/middleware/index.js.map +1 -0
  141. package/dist/middleware/logger.d.ts +4 -0
  142. package/dist/middleware/logger.d.ts.map +1 -0
  143. package/dist/middleware/logger.js +92 -0
  144. package/dist/middleware/logger.js.map +1 -0
  145. package/dist/middleware/private-hostname-guard.d.ts +11 -0
  146. package/dist/middleware/private-hostname-guard.d.ts.map +1 -0
  147. package/dist/middleware/private-hostname-guard.js +78 -0
  148. package/dist/middleware/private-hostname-guard.js.map +1 -0
  149. package/dist/middleware/validate.d.ts +4 -0
  150. package/dist/middleware/validate.d.ts.map +1 -0
  151. package/dist/middleware/validate.js +7 -0
  152. package/dist/middleware/validate.js.map +1 -0
  153. package/dist/onboarding-assets/ceo/AGENTS.md +59 -0
  154. package/dist/onboarding-assets/ceo/HEARTBEAT.md +85 -0
  155. package/dist/onboarding-assets/ceo/SOUL.md +33 -0
  156. package/dist/onboarding-assets/ceo/TOOLS.md +3 -0
  157. package/dist/onboarding-assets/default/AGENTS.md +17 -0
  158. package/dist/paths.d.ts +3 -0
  159. package/dist/paths.d.ts.map +1 -0
  160. package/dist/paths.js +31 -0
  161. package/dist/paths.js.map +1 -0
  162. package/dist/realtime/live-events-ws.d.ts +28 -0
  163. package/dist/realtime/live-events-ws.d.ts.map +1 -0
  164. package/dist/realtime/live-events-ws.js +187 -0
  165. package/dist/realtime/live-events-ws.js.map +1 -0
  166. package/dist/redaction.d.ts +5 -0
  167. package/dist/redaction.d.ts.map +1 -0
  168. package/dist/redaction.js +98 -0
  169. package/dist/redaction.js.map +1 -0
  170. package/dist/routes/access.d.ts +82 -0
  171. package/dist/routes/access.d.ts.map +1 -0
  172. package/dist/routes/access.js +3411 -0
  173. package/dist/routes/access.js.map +1 -0
  174. package/dist/routes/activity.d.ts +3 -0
  175. package/dist/routes/activity.d.ts.map +1 -0
  176. package/dist/routes/activity.js +90 -0
  177. package/dist/routes/activity.js.map +1 -0
  178. package/dist/routes/adapters.d.ts +16 -0
  179. package/dist/routes/adapters.d.ts.map +1 -0
  180. package/dist/routes/adapters.js +527 -0
  181. package/dist/routes/adapters.js.map +1 -0
  182. package/dist/routes/agents.d.ts +6 -0
  183. package/dist/routes/agents.d.ts.map +1 -0
  184. package/dist/routes/agents.js +2753 -0
  185. package/dist/routes/agents.js.map +1 -0
  186. package/dist/routes/approvals.d.ts +6 -0
  187. package/dist/routes/approvals.d.ts.map +1 -0
  188. package/dist/routes/approvals.js +300 -0
  189. package/dist/routes/approvals.js.map +1 -0
  190. package/dist/routes/assets.d.ts +4 -0
  191. package/dist/routes/assets.d.ts.map +1 -0
  192. package/dist/routes/assets.js +309 -0
  193. package/dist/routes/assets.js.map +1 -0
  194. package/dist/routes/auth.d.ts +3 -0
  195. package/dist/routes/auth.d.ts.map +1 -0
  196. package/dist/routes/auth.js +82 -0
  197. package/dist/routes/auth.js.map +1 -0
  198. package/dist/routes/authz.d.ts +19 -0
  199. package/dist/routes/authz.d.ts.map +1 -0
  200. package/dist/routes/authz.js +75 -0
  201. package/dist/routes/authz.js.map +1 -0
  202. package/dist/routes/companies.d.ts +4 -0
  203. package/dist/routes/companies.d.ts.map +1 -0
  204. package/dist/routes/companies.js +359 -0
  205. package/dist/routes/companies.js.map +1 -0
  206. package/dist/routes/company-skills.d.ts +3 -0
  207. package/dist/routes/company-skills.d.ts.map +1 -0
  208. package/dist/routes/company-skills.js +258 -0
  209. package/dist/routes/company-skills.js.map +1 -0
  210. package/dist/routes/costs.d.ts +11 -0
  211. package/dist/routes/costs.d.ts.map +1 -0
  212. package/dist/routes/costs.js +285 -0
  213. package/dist/routes/costs.js.map +1 -0
  214. package/dist/routes/dashboard.d.ts +3 -0
  215. package/dist/routes/dashboard.d.ts.map +1 -0
  216. package/dist/routes/dashboard.js +15 -0
  217. package/dist/routes/dashboard.js.map +1 -0
  218. package/dist/routes/environment-selection.d.ts +13 -0
  219. package/dist/routes/environment-selection.d.ts.map +1 -0
  220. package/dist/routes/environment-selection.js +30 -0
  221. package/dist/routes/environment-selection.js.map +1 -0
  222. package/dist/routes/environments.d.ts +6 -0
  223. package/dist/routes/environments.d.ts.map +1 -0
  224. package/dist/routes/environments.js +401 -0
  225. package/dist/routes/environments.js.map +1 -0
  226. package/dist/routes/execution-workspaces.d.ts +3 -0
  227. package/dist/routes/execution-workspaces.d.ts.map +1 -0
  228. package/dist/routes/execution-workspaces.js +536 -0
  229. package/dist/routes/execution-workspaces.js.map +1 -0
  230. package/dist/routes/goals.d.ts +3 -0
  231. package/dist/routes/goals.d.ts.map +1 -0
  232. package/dist/routes/goals.js +101 -0
  233. package/dist/routes/goals.js.map +1 -0
  234. package/dist/routes/health.d.ts +9 -0
  235. package/dist/routes/health.d.ts.map +1 -0
  236. package/dist/routes/health.js +114 -0
  237. package/dist/routes/health.js.map +1 -0
  238. package/dist/routes/inbox-dismissals.d.ts +3 -0
  239. package/dist/routes/inbox-dismissals.d.ts.map +1 -0
  240. package/dist/routes/inbox-dismissals.js +58 -0
  241. package/dist/routes/inbox-dismissals.js.map +1 -0
  242. package/dist/routes/index.d.ts +22 -0
  243. package/dist/routes/index.d.ts.map +1 -0
  244. package/dist/routes/index.js +22 -0
  245. package/dist/routes/index.js.map +1 -0
  246. package/dist/routes/instance-database-backups.d.ts +15 -0
  247. package/dist/routes/instance-database-backups.d.ts.map +1 -0
  248. package/dist/routes/instance-database-backups.js +12 -0
  249. package/dist/routes/instance-database-backups.js.map +1 -0
  250. package/dist/routes/instance-settings.d.ts +3 -0
  251. package/dist/routes/instance-settings.d.ts.map +1 -0
  252. package/dist/routes/instance-settings.js +110 -0
  253. package/dist/routes/instance-settings.js.map +1 -0
  254. package/dist/routes/issue-tree-control.d.ts +3 -0
  255. package/dist/routes/issue-tree-control.d.ts.map +1 -0
  256. package/dist/routes/issue-tree-control.js +363 -0
  257. package/dist/routes/issue-tree-control.js.map +1 -0
  258. package/dist/routes/issues-checkout-wakeup.d.ts +9 -0
  259. package/dist/routes/issues-checkout-wakeup.d.ts.map +1 -0
  260. package/dist/routes/issues-checkout-wakeup.js +12 -0
  261. package/dist/routes/issues-checkout-wakeup.js.map +1 -0
  262. package/dist/routes/issues.d.ts +23 -0
  263. package/dist/routes/issues.d.ts.map +1 -0
  264. package/dist/routes/issues.js +3886 -0
  265. package/dist/routes/issues.js.map +1 -0
  266. package/dist/routes/llms.d.ts +3 -0
  267. package/dist/routes/llms.d.ts.map +1 -0
  268. package/dist/routes/llms.js +80 -0
  269. package/dist/routes/llms.js.map +1 -0
  270. package/dist/routes/org-chart-svg.d.ts +25 -0
  271. package/dist/routes/org-chart-svg.d.ts.map +1 -0
  272. package/dist/routes/org-chart-svg.js +656 -0
  273. package/dist/routes/org-chart-svg.js.map +1 -0
  274. package/dist/routes/plugin-ui-static.d.ts +69 -0
  275. package/dist/routes/plugin-ui-static.d.ts.map +1 -0
  276. package/dist/routes/plugin-ui-static.js +411 -0
  277. package/dist/routes/plugin-ui-static.js.map +1 -0
  278. package/dist/routes/plugins.d.ts +121 -0
  279. package/dist/routes/plugins.d.ts.map +1 -0
  280. package/dist/routes/plugins.js +2192 -0
  281. package/dist/routes/plugins.js.map +1 -0
  282. package/dist/routes/projects.d.ts +3 -0
  283. package/dist/routes/projects.d.ts.map +1 -0
  284. package/dist/routes/projects.js +566 -0
  285. package/dist/routes/projects.js.map +1 -0
  286. package/dist/routes/routines.d.ts +6 -0
  287. package/dist/routes/routines.d.ts.map +1 -0
  288. package/dist/routes/routines.js +417 -0
  289. package/dist/routes/routines.js.map +1 -0
  290. package/dist/routes/secrets.d.ts +3 -0
  291. package/dist/routes/secrets.d.ts.map +1 -0
  292. package/dist/routes/secrets.js +128 -0
  293. package/dist/routes/secrets.js.map +1 -0
  294. package/dist/routes/sidebar-badges.d.ts +3 -0
  295. package/dist/routes/sidebar-badges.d.ts.map +1 -0
  296. package/dist/routes/sidebar-badges.js +68 -0
  297. package/dist/routes/sidebar-badges.js.map +1 -0
  298. package/dist/routes/sidebar-preferences.d.ts +3 -0
  299. package/dist/routes/sidebar-preferences.d.ts.map +1 -0
  300. package/dist/routes/sidebar-preferences.js +63 -0
  301. package/dist/routes/sidebar-preferences.js.map +1 -0
  302. package/dist/routes/user-profiles.d.ts +3 -0
  303. package/dist/routes/user-profiles.d.ts.map +1 -0
  304. package/dist/routes/user-profiles.js +337 -0
  305. package/dist/routes/user-profiles.js.map +1 -0
  306. package/dist/routes/workspace-command-authz.d.ts +14 -0
  307. package/dist/routes/workspace-command-authz.d.ts.map +1 -0
  308. package/dist/routes/workspace-command-authz.js +83 -0
  309. package/dist/routes/workspace-command-authz.js.map +1 -0
  310. package/dist/routes/workspace-runtime-service-authz.d.ts +12 -0
  311. package/dist/routes/workspace-runtime-service-authz.d.ts.map +1 -0
  312. package/dist/routes/workspace-runtime-service-authz.js +96 -0
  313. package/dist/routes/workspace-runtime-service-authz.js.map +1 -0
  314. package/dist/runtime-api.d.ts +19 -0
  315. package/dist/runtime-api.d.ts.map +1 -0
  316. package/dist/runtime-api.js +137 -0
  317. package/dist/runtime-api.js.map +1 -0
  318. package/dist/secrets/external-stub-providers.d.ts +5 -0
  319. package/dist/secrets/external-stub-providers.d.ts.map +1 -0
  320. package/dist/secrets/external-stub-providers.js +21 -0
  321. package/dist/secrets/external-stub-providers.js.map +1 -0
  322. package/dist/secrets/local-encrypted-provider.d.ts +3 -0
  323. package/dist/secrets/local-encrypted-provider.d.ts.map +1 -0
  324. package/dist/secrets/local-encrypted-provider.js +116 -0
  325. package/dist/secrets/local-encrypted-provider.js.map +1 -0
  326. package/dist/secrets/provider-registry.d.ts +5 -0
  327. package/dist/secrets/provider-registry.d.ts.map +1 -0
  328. package/dist/secrets/provider-registry.js +20 -0
  329. package/dist/secrets/provider-registry.js.map +1 -0
  330. package/dist/secrets/types.d.ts +21 -0
  331. package/dist/secrets/types.d.ts.map +1 -0
  332. package/dist/secrets/types.js +2 -0
  333. package/dist/secrets/types.js.map +1 -0
  334. package/dist/services/access.d.ts +171 -0
  335. package/dist/services/access.d.ts.map +1 -0
  336. package/dist/services/access.js +522 -0
  337. package/dist/services/access.js.map +1 -0
  338. package/dist/services/activity-log.d.ts +19 -0
  339. package/dist/services/activity-log.d.ts.map +1 -0
  340. package/dist/services/activity-log.js +99 -0
  341. package/dist/services/activity-log.js.map +1 -0
  342. package/dist/services/activity.d.ts +462 -0
  343. package/dist/services/activity.d.ts.map +1 -0
  344. package/dist/services/activity.js +443 -0
  345. package/dist/services/activity.js.map +1 -0
  346. package/dist/services/adapter-plugin-store.d.ts +36 -0
  347. package/dist/services/adapter-plugin-store.d.ts.map +1 -0
  348. package/dist/services/adapter-plugin-store.js +154 -0
  349. package/dist/services/adapter-plugin-store.js.map +1 -0
  350. package/dist/services/agent-instructions.d.ts +91 -0
  351. package/dist/services/agent-instructions.d.ts.map +1 -0
  352. package/dist/services/agent-instructions.js +580 -0
  353. package/dist/services/agent-instructions.js.map +1 -0
  354. package/dist/services/agent-permissions.d.ts +6 -0
  355. package/dist/services/agent-permissions.d.ts.map +1 -0
  356. package/dist/services/agent-permissions.js +18 -0
  357. package/dist/services/agent-permissions.js.map +1 -0
  358. package/dist/services/agent-start-lock.d.ts +2 -0
  359. package/dist/services/agent-start-lock.d.ts.map +1 -0
  360. package/dist/services/agent-start-lock.js +43 -0
  361. package/dist/services/agent-start-lock.js.map +1 -0
  362. package/dist/services/agents.d.ts +2253 -0
  363. package/dist/services/agents.d.ts.map +1 -0
  364. package/dist/services/agents.js +609 -0
  365. package/dist/services/agents.js.map +1 -0
  366. package/dist/services/approvals.d.ts +546 -0
  367. package/dist/services/approvals.d.ts.map +1 -0
  368. package/dist/services/approvals.js +212 -0
  369. package/dist/services/approvals.js.map +1 -0
  370. package/dist/services/assets.d.ts +33 -0
  371. package/dist/services/assets.d.ts.map +1 -0
  372. package/dist/services/assets.js +17 -0
  373. package/dist/services/assets.js.map +1 -0
  374. package/dist/services/board-auth.d.ts +239 -0
  375. package/dist/services/board-auth.d.ts.map +1 -0
  376. package/dist/services/board-auth.js +300 -0
  377. package/dist/services/board-auth.js.map +1 -0
  378. package/dist/services/budgets.d.ts +38 -0
  379. package/dist/services/budgets.d.ts.map +1 -0
  380. package/dist/services/budgets.js +784 -0
  381. package/dist/services/budgets.js.map +1 -0
  382. package/dist/services/companies.d.ts +154 -0
  383. package/dist/services/companies.d.ts.map +1 -0
  384. package/dist/services/companies.js +267 -0
  385. package/dist/services/companies.js.map +1 -0
  386. package/dist/services/company-export-readme.d.ts +17 -0
  387. package/dist/services/company-export-readme.d.ts.map +1 -0
  388. package/dist/services/company-export-readme.js +148 -0
  389. package/dist/services/company-export-readme.js.map +1 -0
  390. package/dist/services/company-member-roles.d.ts +9 -0
  391. package/dist/services/company-member-roles.d.ts.map +1 -0
  392. package/dist/services/company-member-roles.js +46 -0
  393. package/dist/services/company-member-roles.js.map +1 -0
  394. package/dist/services/company-portability.d.ts +24 -0
  395. package/dist/services/company-portability.d.ts.map +1 -0
  396. package/dist/services/company-portability.js +4076 -0
  397. package/dist/services/company-portability.js.map +1 -0
  398. package/dist/services/company-search-rate-limit.d.ts +22 -0
  399. package/dist/services/company-search-rate-limit.d.ts.map +1 -0
  400. package/dist/services/company-search-rate-limit.js +38 -0
  401. package/dist/services/company-search-rate-limit.js.map +1 -0
  402. package/dist/services/company-search.d.ts +8 -0
  403. package/dist/services/company-search.d.ts.map +1 -0
  404. package/dist/services/company-search.js +626 -0
  405. package/dist/services/company-search.js.map +1 -0
  406. package/dist/services/company-skills.d.ts +77 -0
  407. package/dist/services/company-skills.d.ts.map +1 -0
  408. package/dist/services/company-skills.js +2120 -0
  409. package/dist/services/company-skills.js.map +1 -0
  410. package/dist/services/costs.d.ts +127 -0
  411. package/dist/services/costs.d.ts.map +1 -0
  412. package/dist/services/costs.js +409 -0
  413. package/dist/services/costs.js.map +1 -0
  414. package/dist/services/cron.d.ts +80 -0
  415. package/dist/services/cron.d.ts.map +1 -0
  416. package/dist/services/cron.js +300 -0
  417. package/dist/services/cron.js.map +1 -0
  418. package/dist/services/dashboard.d.ts +34 -0
  419. package/dist/services/dashboard.d.ts.map +1 -0
  420. package/dist/services/dashboard.js +142 -0
  421. package/dist/services/dashboard.js.map +1 -0
  422. package/dist/services/default-agent-instructions.d.ts +9 -0
  423. package/dist/services/default-agent-instructions.d.ts.map +1 -0
  424. package/dist/services/default-agent-instructions.js +20 -0
  425. package/dist/services/default-agent-instructions.js.map +1 -0
  426. package/dist/services/documents.d.ts +199 -0
  427. package/dist/services/documents.d.ts.map +1 -0
  428. package/dist/services/documents.js +411 -0
  429. package/dist/services/documents.js.map +1 -0
  430. package/dist/services/environment-config.d.ts +43 -0
  431. package/dist/services/environment-config.d.ts.map +1 -0
  432. package/dist/services/environment-config.js +388 -0
  433. package/dist/services/environment-config.js.map +1 -0
  434. package/dist/services/environment-execution-target.d.ts +21 -0
  435. package/dist/services/environment-execution-target.d.ts.map +1 -0
  436. package/dist/services/environment-execution-target.js +119 -0
  437. package/dist/services/environment-execution-target.js.map +1 -0
  438. package/dist/services/environment-probe.d.ts +9 -0
  439. package/dist/services/environment-probe.d.ts.map +1 -0
  440. package/dist/services/environment-probe.js +106 -0
  441. package/dist/services/environment-probe.js.map +1 -0
  442. package/dist/services/environment-run-orchestrator.d.ts +124 -0
  443. package/dist/services/environment-run-orchestrator.d.ts.map +1 -0
  444. package/dist/services/environment-run-orchestrator.js +392 -0
  445. package/dist/services/environment-run-orchestrator.js.map +1 -0
  446. package/dist/services/environment-runtime.d.ts +90 -0
  447. package/dist/services/environment-runtime.d.ts.map +1 -0
  448. package/dist/services/environment-runtime.js +934 -0
  449. package/dist/services/environment-runtime.js.map +1 -0
  450. package/dist/services/environments.d.ts +36 -0
  451. package/dist/services/environments.d.ts.map +1 -0
  452. package/dist/services/environments.js +260 -0
  453. package/dist/services/environments.js.map +1 -0
  454. package/dist/services/execution-workspace-policy.d.ts +30 -0
  455. package/dist/services/execution-workspace-policy.d.ts.map +1 -0
  456. package/dist/services/execution-workspace-policy.js +195 -0
  457. package/dist/services/execution-workspace-policy.js.map +1 -0
  458. package/dist/services/execution-workspaces.d.ts +30 -0
  459. package/dist/services/execution-workspaces.d.ts.map +1 -0
  460. package/dist/services/execution-workspaces.js +635 -0
  461. package/dist/services/execution-workspaces.js.map +1 -0
  462. package/dist/services/feedback-redaction.d.ts +23 -0
  463. package/dist/services/feedback-redaction.d.ts.map +1 -0
  464. package/dist/services/feedback-redaction.js +150 -0
  465. package/dist/services/feedback-redaction.js.map +1 -0
  466. package/dist/services/feedback-share-client.d.ts +9 -0
  467. package/dist/services/feedback-share-client.d.ts.map +1 -0
  468. package/dist/services/feedback-share-client.js +46 -0
  469. package/dist/services/feedback-share-client.js.map +1 -0
  470. package/dist/services/feedback.d.ts +93 -0
  471. package/dist/services/feedback.d.ts.map +1 -0
  472. package/dist/services/feedback.js +1717 -0
  473. package/dist/services/feedback.js.map +1 -0
  474. package/dist/services/finance.d.ts +93 -0
  475. package/dist/services/finance.d.ts.map +1 -0
  476. package/dist/services/finance.js +120 -0
  477. package/dist/services/finance.js.map +1 -0
  478. package/dist/services/github-fetch.d.ts +4 -0
  479. package/dist/services/github-fetch.d.ts.map +1 -0
  480. package/dist/services/github-fetch.js +23 -0
  481. package/dist/services/github-fetch.js.map +1 -0
  482. package/dist/services/goals.d.ts +433 -0
  483. package/dist/services/goals.d.ts.map +1 -0
  484. package/dist/services/goals.js +54 -0
  485. package/dist/services/goals.js.map +1 -0
  486. package/dist/services/heartbeat-run-summary.d.ts +7 -0
  487. package/dist/services/heartbeat-run-summary.d.ts.map +1 -0
  488. package/dist/services/heartbeat-run-summary.js +84 -0
  489. package/dist/services/heartbeat-run-summary.js.map +1 -0
  490. package/dist/services/heartbeat-stop-metadata.d.ts +28 -0
  491. package/dist/services/heartbeat-stop-metadata.d.ts.map +1 -0
  492. package/dist/services/heartbeat-stop-metadata.js +86 -0
  493. package/dist/services/heartbeat-stop-metadata.js.map +1 -0
  494. package/dist/services/heartbeat-stop-metadata.test.d.ts +2 -0
  495. package/dist/services/heartbeat-stop-metadata.test.d.ts.map +1 -0
  496. package/dist/services/heartbeat-stop-metadata.test.js +93 -0
  497. package/dist/services/heartbeat-stop-metadata.test.js.map +1 -0
  498. package/dist/services/heartbeat.d.ts +1484 -0
  499. package/dist/services/heartbeat.d.ts.map +1 -0
  500. package/dist/services/heartbeat.js +7557 -0
  501. package/dist/services/heartbeat.js.map +1 -0
  502. package/dist/services/hire-hook.d.ts +14 -0
  503. package/dist/services/hire-hook.d.ts.map +1 -0
  504. package/dist/services/hire-hook.js +85 -0
  505. package/dist/services/hire-hook.js.map +1 -0
  506. package/dist/services/inbox-dismissals.d.ts +22 -0
  507. package/dist/services/inbox-dismissals.d.ts.map +1 -0
  508. package/dist/services/inbox-dismissals.js +33 -0
  509. package/dist/services/inbox-dismissals.js.map +1 -0
  510. package/dist/services/index.d.ts +44 -0
  511. package/dist/services/index.d.ts.map +1 -0
  512. package/dist/services/index.js +44 -0
  513. package/dist/services/index.js.map +1 -0
  514. package/dist/services/instance-settings.d.ts +11 -0
  515. package/dist/services/instance-settings.d.ts.map +1 -0
  516. package/dist/services/instance-settings.js +138 -0
  517. package/dist/services/instance-settings.js.map +1 -0
  518. package/dist/services/invite-grants.d.ts +15 -0
  519. package/dist/services/invite-grants.d.ts.map +1 -0
  520. package/dist/services/invite-grants.js +50 -0
  521. package/dist/services/invite-grants.js.map +1 -0
  522. package/dist/services/issue-approvals.d.ts +56 -0
  523. package/dist/services/issue-approvals.d.ts.map +1 -0
  524. package/dist/services/issue-approvals.js +153 -0
  525. package/dist/services/issue-approvals.js.map +1 -0
  526. package/dist/services/issue-assignment-wakeup.d.ts +29 -0
  527. package/dist/services/issue-assignment-wakeup.d.ts.map +1 -0
  528. package/dist/services/issue-assignment-wakeup.js +22 -0
  529. package/dist/services/issue-assignment-wakeup.js.map +1 -0
  530. package/dist/services/issue-continuation-summary.d.ts +66 -0
  531. package/dist/services/issue-continuation-summary.d.ts.map +1 -0
  532. package/dist/services/issue-continuation-summary.js +212 -0
  533. package/dist/services/issue-continuation-summary.js.map +1 -0
  534. package/dist/services/issue-execution-policy.d.ts +93 -0
  535. package/dist/services/issue-execution-policy.d.ts.map +1 -0
  536. package/dist/services/issue-execution-policy.js +838 -0
  537. package/dist/services/issue-execution-policy.js.map +1 -0
  538. package/dist/services/issue-goal-fallback.d.ts +18 -0
  539. package/dist/services/issue-goal-fallback.d.ts.map +1 -0
  540. package/dist/services/issue-goal-fallback.js +33 -0
  541. package/dist/services/issue-goal-fallback.js.map +1 -0
  542. package/dist/services/issue-liveness.d.ts +3 -0
  543. package/dist/services/issue-liveness.d.ts.map +1 -0
  544. package/dist/services/issue-liveness.js +2 -0
  545. package/dist/services/issue-liveness.js.map +1 -0
  546. package/dist/services/issue-references.d.ts +21 -0
  547. package/dist/services/issue-references.d.ts.map +1 -0
  548. package/dist/services/issue-references.js +318 -0
  549. package/dist/services/issue-references.js.map +1 -0
  550. package/dist/services/issue-thread-interactions.d.ts +76 -0
  551. package/dist/services/issue-thread-interactions.d.ts.map +1 -0
  552. package/dist/services/issue-thread-interactions.js +923 -0
  553. package/dist/services/issue-thread-interactions.js.map +1 -0
  554. package/dist/services/issue-thread-interactions.test.d.ts +2 -0
  555. package/dist/services/issue-thread-interactions.test.d.ts.map +1 -0
  556. package/dist/services/issue-thread-interactions.test.js +195 -0
  557. package/dist/services/issue-thread-interactions.test.js.map +1 -0
  558. package/dist/services/issue-tree-control.d.ts +89 -0
  559. package/dist/services/issue-tree-control.d.ts.map +1 -0
  560. package/dist/services/issue-tree-control.js +933 -0
  561. package/dist/services/issue-tree-control.js.map +1 -0
  562. package/dist/services/issues.d.ts +710 -0
  563. package/dist/services/issues.d.ts.map +1 -0
  564. package/dist/services/issues.js +3199 -0
  565. package/dist/services/issues.js.map +1 -0
  566. package/dist/services/json-schema-secret-refs.d.ts +5 -0
  567. package/dist/services/json-schema-secret-refs.d.ts.map +1 -0
  568. package/dist/services/json-schema-secret-refs.js +67 -0
  569. package/dist/services/json-schema-secret-refs.js.map +1 -0
  570. package/dist/services/live-events.d.ts +17 -0
  571. package/dist/services/live-events.d.ts.map +1 -0
  572. package/dist/services/live-events.js +33 -0
  573. package/dist/services/live-events.js.map +1 -0
  574. package/dist/services/local-service-supervisor.d.ts +56 -0
  575. package/dist/services/local-service-supervisor.d.ts.map +1 -0
  576. package/dist/services/local-service-supervisor.js +284 -0
  577. package/dist/services/local-service-supervisor.js.map +1 -0
  578. package/dist/services/plugin-capability-validator.d.ts +108 -0
  579. package/dist/services/plugin-capability-validator.d.ts.map +1 -0
  580. package/dist/services/plugin-capability-validator.js +313 -0
  581. package/dist/services/plugin-capability-validator.js.map +1 -0
  582. package/dist/services/plugin-config-validator.d.ts +26 -0
  583. package/dist/services/plugin-config-validator.d.ts.map +1 -0
  584. package/dist/services/plugin-config-validator.js +41 -0
  585. package/dist/services/plugin-config-validator.js.map +1 -0
  586. package/dist/services/plugin-database.d.ts +49 -0
  587. package/dist/services/plugin-database.d.ts.map +1 -0
  588. package/dist/services/plugin-database.js +440 -0
  589. package/dist/services/plugin-database.js.map +1 -0
  590. package/dist/services/plugin-dev-watcher.d.ts +30 -0
  591. package/dist/services/plugin-dev-watcher.d.ts.map +1 -0
  592. package/dist/services/plugin-dev-watcher.js +241 -0
  593. package/dist/services/plugin-dev-watcher.js.map +1 -0
  594. package/dist/services/plugin-environment-driver.d.ts +124 -0
  595. package/dist/services/plugin-environment-driver.d.ts.map +1 -0
  596. package/dist/services/plugin-environment-driver.js +224 -0
  597. package/dist/services/plugin-environment-driver.js.map +1 -0
  598. package/dist/services/plugin-event-bus.d.ts +149 -0
  599. package/dist/services/plugin-event-bus.d.ts.map +1 -0
  600. package/dist/services/plugin-event-bus.js +258 -0
  601. package/dist/services/plugin-event-bus.js.map +1 -0
  602. package/dist/services/plugin-host-service-cleanup.d.ts +14 -0
  603. package/dist/services/plugin-host-service-cleanup.d.ts.map +1 -0
  604. package/dist/services/plugin-host-service-cleanup.js +37 -0
  605. package/dist/services/plugin-host-service-cleanup.js.map +1 -0
  606. package/dist/services/plugin-host-services.d.ts +17 -0
  607. package/dist/services/plugin-host-services.d.ts.map +1 -0
  608. package/dist/services/plugin-host-services.js +1861 -0
  609. package/dist/services/plugin-host-services.js.map +1 -0
  610. package/dist/services/plugin-job-coordinator.d.ts +81 -0
  611. package/dist/services/plugin-job-coordinator.d.ts.map +1 -0
  612. package/dist/services/plugin-job-coordinator.js +172 -0
  613. package/dist/services/plugin-job-coordinator.js.map +1 -0
  614. package/dist/services/plugin-job-scheduler.d.ts +163 -0
  615. package/dist/services/plugin-job-scheduler.d.ts.map +1 -0
  616. package/dist/services/plugin-job-scheduler.js +454 -0
  617. package/dist/services/plugin-job-scheduler.js.map +1 -0
  618. package/dist/services/plugin-job-store.d.ts +208 -0
  619. package/dist/services/plugin-job-store.d.ts.map +1 -0
  620. package/dist/services/plugin-job-store.js +350 -0
  621. package/dist/services/plugin-job-store.js.map +1 -0
  622. package/dist/services/plugin-lifecycle.d.ts +203 -0
  623. package/dist/services/plugin-lifecycle.d.ts.map +1 -0
  624. package/dist/services/plugin-lifecycle.js +476 -0
  625. package/dist/services/plugin-lifecycle.js.map +1 -0
  626. package/dist/services/plugin-loader.d.ts +445 -0
  627. package/dist/services/plugin-loader.d.ts.map +1 -0
  628. package/dist/services/plugin-loader.js +1273 -0
  629. package/dist/services/plugin-loader.js.map +1 -0
  630. package/dist/services/plugin-local-folders.d.ts +48 -0
  631. package/dist/services/plugin-local-folders.d.ts.map +1 -0
  632. package/dist/services/plugin-local-folders.js +461 -0
  633. package/dist/services/plugin-local-folders.js.map +1 -0
  634. package/dist/services/plugin-log-retention.d.ts +20 -0
  635. package/dist/services/plugin-log-retention.d.ts.map +1 -0
  636. package/dist/services/plugin-log-retention.js +63 -0
  637. package/dist/services/plugin-log-retention.js.map +1 -0
  638. package/dist/services/plugin-managed-agents.d.ts +15 -0
  639. package/dist/services/plugin-managed-agents.d.ts.map +1 -0
  640. package/dist/services/plugin-managed-agents.js +414 -0
  641. package/dist/services/plugin-managed-agents.js.map +1 -0
  642. package/dist/services/plugin-managed-routines.d.ts +41 -0
  643. package/dist/services/plugin-managed-routines.d.ts.map +1 -0
  644. package/dist/services/plugin-managed-routines.js +416 -0
  645. package/dist/services/plugin-managed-routines.js.map +1 -0
  646. package/dist/services/plugin-manifest-validator.d.ts +79 -0
  647. package/dist/services/plugin-manifest-validator.d.ts.map +1 -0
  648. package/dist/services/plugin-manifest-validator.js +84 -0
  649. package/dist/services/plugin-manifest-validator.js.map +1 -0
  650. package/dist/services/plugin-registry.d.ts +2550 -0
  651. package/dist/services/plugin-registry.d.ts.map +1 -0
  652. package/dist/services/plugin-registry.js +581 -0
  653. package/dist/services/plugin-registry.js.map +1 -0
  654. package/dist/services/plugin-runtime-sandbox.d.ts +40 -0
  655. package/dist/services/plugin-runtime-sandbox.d.ts.map +1 -0
  656. package/dist/services/plugin-runtime-sandbox.js +154 -0
  657. package/dist/services/plugin-runtime-sandbox.js.map +1 -0
  658. package/dist/services/plugin-secrets-handler.d.ts +81 -0
  659. package/dist/services/plugin-secrets-handler.d.ts.map +1 -0
  660. package/dist/services/plugin-secrets-handler.js +231 -0
  661. package/dist/services/plugin-secrets-handler.js.map +1 -0
  662. package/dist/services/plugin-state-store.d.ts +92 -0
  663. package/dist/services/plugin-state-store.d.ts.map +1 -0
  664. package/dist/services/plugin-state-store.js +190 -0
  665. package/dist/services/plugin-state-store.js.map +1 -0
  666. package/dist/services/plugin-stream-bus.d.ts +29 -0
  667. package/dist/services/plugin-stream-bus.d.ts.map +1 -0
  668. package/dist/services/plugin-stream-bus.js +48 -0
  669. package/dist/services/plugin-stream-bus.js.map +1 -0
  670. package/dist/services/plugin-tool-dispatcher.d.ts +180 -0
  671. package/dist/services/plugin-tool-dispatcher.d.ts.map +1 -0
  672. package/dist/services/plugin-tool-dispatcher.js +224 -0
  673. package/dist/services/plugin-tool-dispatcher.js.map +1 -0
  674. package/dist/services/plugin-tool-registry.d.ts +192 -0
  675. package/dist/services/plugin-tool-registry.d.ts.map +1 -0
  676. package/dist/services/plugin-tool-registry.js +224 -0
  677. package/dist/services/plugin-tool-registry.js.map +1 -0
  678. package/dist/services/plugin-worker-manager.d.ts +262 -0
  679. package/dist/services/plugin-worker-manager.d.ts.map +1 -0
  680. package/dist/services/plugin-worker-manager.js +836 -0
  681. package/dist/services/plugin-worker-manager.js.map +1 -0
  682. package/dist/services/productivity-review.d.ts +83 -0
  683. package/dist/services/productivity-review.d.ts.map +1 -0
  684. package/dist/services/productivity-review.js +652 -0
  685. package/dist/services/productivity-review.js.map +1 -0
  686. package/dist/services/project-workspace-runtime-config.d.ts +4 -0
  687. package/dist/services/project-workspace-runtime-config.d.ts.map +1 -0
  688. package/dist/services/project-workspace-runtime-config.js +54 -0
  689. package/dist/services/project-workspace-runtime-config.js.map +1 -0
  690. package/dist/services/projects.d.ts +99 -0
  691. package/dist/services/projects.d.ts.map +1 -0
  692. package/dist/services/projects.js +879 -0
  693. package/dist/services/projects.js.map +1 -0
  694. package/dist/services/quota-windows.d.ts +9 -0
  695. package/dist/services/quota-windows.d.ts.map +1 -0
  696. package/dist/services/quota-windows.js +56 -0
  697. package/dist/services/quota-windows.js.map +1 -0
  698. package/dist/services/recovery/index.d.ts +10 -0
  699. package/dist/services/recovery/index.d.ts.map +1 -0
  700. package/dist/services/recovery/index.js +6 -0
  701. package/dist/services/recovery/index.js.map +1 -0
  702. package/dist/services/recovery/issue-graph-liveness.d.ts +85 -0
  703. package/dist/services/recovery/issue-graph-liveness.d.ts.map +1 -0
  704. package/dist/services/recovery/issue-graph-liveness.js +343 -0
  705. package/dist/services/recovery/issue-graph-liveness.js.map +1 -0
  706. package/dist/services/recovery/model-profile-hint.d.ts +8 -0
  707. package/dist/services/recovery/model-profile-hint.d.ts.map +1 -0
  708. package/dist/services/recovery/model-profile-hint.js +11 -0
  709. package/dist/services/recovery/model-profile-hint.js.map +1 -0
  710. package/dist/services/recovery/origins.d.ts +36 -0
  711. package/dist/services/recovery/origins.d.ts.map +1 -0
  712. package/dist/services/recovery/origins.js +45 -0
  713. package/dist/services/recovery/origins.js.map +1 -0
  714. package/dist/services/recovery/pause-hold-guard.d.ts +6 -0
  715. package/dist/services/recovery/pause-hold-guard.d.ts.map +1 -0
  716. package/dist/services/recovery/pause-hold-guard.js +6 -0
  717. package/dist/services/recovery/pause-hold-guard.js.map +1 -0
  718. package/dist/services/recovery/run-liveness-continuations.d.ts +50 -0
  719. package/dist/services/recovery/run-liveness-continuations.d.ts.map +1 -0
  720. package/dist/services/recovery/run-liveness-continuations.js +117 -0
  721. package/dist/services/recovery/run-liveness-continuations.js.map +1 -0
  722. package/dist/services/recovery/service.d.ts +195 -0
  723. package/dist/services/recovery/service.d.ts.map +1 -0
  724. package/dist/services/recovery/service.js +2210 -0
  725. package/dist/services/recovery/service.js.map +1 -0
  726. package/dist/services/recovery/successful-run-handoff.d.ts +87 -0
  727. package/dist/services/recovery/successful-run-handoff.d.ts.map +1 -0
  728. package/dist/services/recovery/successful-run-handoff.js +297 -0
  729. package/dist/services/recovery/successful-run-handoff.js.map +1 -0
  730. package/dist/services/recovery/successful-run-handoff.test.d.ts +2 -0
  731. package/dist/services/recovery/successful-run-handoff.test.d.ts.map +1 -0
  732. package/dist/services/recovery/successful-run-handoff.test.js +267 -0
  733. package/dist/services/recovery/successful-run-handoff.test.js.map +1 -0
  734. package/dist/services/routines.d.ts +166 -0
  735. package/dist/services/routines.d.ts.map +1 -0
  736. package/dist/services/routines.js +1937 -0
  737. package/dist/services/routines.js.map +1 -0
  738. package/dist/services/run-continuations.d.ts +3 -0
  739. package/dist/services/run-continuations.d.ts.map +1 -0
  740. package/dist/services/run-continuations.js +2 -0
  741. package/dist/services/run-continuations.js.map +1 -0
  742. package/dist/services/run-liveness.d.ts +46 -0
  743. package/dist/services/run-liveness.d.ts.map +1 -0
  744. package/dist/services/run-liveness.js +275 -0
  745. package/dist/services/run-liveness.js.map +1 -0
  746. package/dist/services/run-log-store.d.ts +34 -0
  747. package/dist/services/run-log-store.d.ts.map +1 -0
  748. package/dist/services/run-log-store.js +111 -0
  749. package/dist/services/run-log-store.js.map +1 -0
  750. package/dist/services/sandbox-provider-runtime.d.ts +132 -0
  751. package/dist/services/sandbox-provider-runtime.d.ts.map +1 -0
  752. package/dist/services/sandbox-provider-runtime.js +216 -0
  753. package/dist/services/sandbox-provider-runtime.js.map +1 -0
  754. package/dist/services/secrets.d.ts +515 -0
  755. package/dist/services/secrets.d.ts.map +1 -0
  756. package/dist/services/secrets.js +290 -0
  757. package/dist/services/secrets.js.map +1 -0
  758. package/dist/services/sidebar-badges.d.ts +14 -0
  759. package/dist/services/sidebar-badges.d.ts.map +1 -0
  760. package/dist/services/sidebar-badges.js +48 -0
  761. package/dist/services/sidebar-badges.js.map +1 -0
  762. package/dist/services/sidebar-preferences.d.ts +9 -0
  763. package/dist/services/sidebar-preferences.d.ts.map +1 -0
  764. package/dist/services/sidebar-preferences.js +82 -0
  765. package/dist/services/sidebar-preferences.js.map +1 -0
  766. package/dist/services/work-products.d.ts +14 -0
  767. package/dist/services/work-products.d.ts.map +1 -0
  768. package/dist/services/work-products.js +100 -0
  769. package/dist/services/work-products.js.map +1 -0
  770. package/dist/services/workspace-operation-log-store.d.ts +33 -0
  771. package/dist/services/workspace-operation-log-store.d.ts.map +1 -0
  772. package/dist/services/workspace-operation-log-store.js +110 -0
  773. package/dist/services/workspace-operation-log-store.js.map +1 -0
  774. package/dist/services/workspace-operations.d.ts +44 -0
  775. package/dist/services/workspace-operations.d.ts.map +1 -0
  776. package/dist/services/workspace-operations.js +211 -0
  777. package/dist/services/workspace-operations.js.map +1 -0
  778. package/dist/services/workspace-realization.d.ts +33 -0
  779. package/dist/services/workspace-realization.d.ts.map +1 -0
  780. package/dist/services/workspace-realization.js +221 -0
  781. package/dist/services/workspace-realization.js.map +1 -0
  782. package/dist/services/workspace-runtime-read-model.d.ts +92 -0
  783. package/dist/services/workspace-runtime-read-model.d.ts.map +1 -0
  784. package/dist/services/workspace-runtime-read-model.js +67 -0
  785. package/dist/services/workspace-runtime-read-model.js.map +1 -0
  786. package/dist/services/workspace-runtime.d.ts +238 -0
  787. package/dist/services/workspace-runtime.d.ts.map +1 -0
  788. package/dist/services/workspace-runtime.js +2388 -0
  789. package/dist/services/workspace-runtime.js.map +1 -0
  790. package/dist/startup-banner.d.ts +32 -0
  791. package/dist/startup-banner.d.ts.map +1 -0
  792. package/dist/startup-banner.js +118 -0
  793. package/dist/startup-banner.js.map +1 -0
  794. package/dist/storage/index.d.ts +6 -0
  795. package/dist/storage/index.d.ts.map +1 -0
  796. package/dist/storage/index.js +29 -0
  797. package/dist/storage/index.js.map +1 -0
  798. package/dist/storage/local-disk-provider.d.ts +3 -0
  799. package/dist/storage/local-disk-provider.d.ts.map +1 -0
  800. package/dist/storage/local-disk-provider.js +79 -0
  801. package/dist/storage/local-disk-provider.js.map +1 -0
  802. package/dist/storage/provider-registry.d.ts +4 -0
  803. package/dist/storage/provider-registry.d.ts.map +1 -0
  804. package/dist/storage/provider-registry.js +15 -0
  805. package/dist/storage/provider-registry.js.map +1 -0
  806. package/dist/storage/s3-provider.d.ts +11 -0
  807. package/dist/storage/s3-provider.d.ts.map +1 -0
  808. package/dist/storage/s3-provider.js +123 -0
  809. package/dist/storage/s3-provider.js.map +1 -0
  810. package/dist/storage/service.d.ts +3 -0
  811. package/dist/storage/service.d.ts.map +1 -0
  812. package/dist/storage/service.js +120 -0
  813. package/dist/storage/service.js.map +1 -0
  814. package/dist/storage/types.d.ts +55 -0
  815. package/dist/storage/types.d.ts.map +1 -0
  816. package/dist/storage/types.js +2 -0
  817. package/dist/storage/types.js.map +1 -0
  818. package/dist/telemetry.d.ts +6 -0
  819. package/dist/telemetry.d.ts.map +1 -0
  820. package/dist/telemetry.js +20 -0
  821. package/dist/telemetry.js.map +1 -0
  822. package/dist/ui-branding.d.ts +13 -0
  823. package/dist/ui-branding.d.ts.map +1 -0
  824. package/dist/ui-branding.js +187 -0
  825. package/dist/ui-branding.js.map +1 -0
  826. package/dist/version.d.ts +2 -0
  827. package/dist/version.d.ts.map +1 -0
  828. package/dist/version.js +5 -0
  829. package/dist/version.js.map +1 -0
  830. package/dist/vite-html-renderer.d.ts +18 -0
  831. package/dist/vite-html-renderer.d.ts.map +1 -0
  832. package/dist/vite-html-renderer.js +61 -0
  833. package/dist/vite-html-renderer.js.map +1 -0
  834. package/dist/worktree-config.d.ts +19 -0
  835. package/dist/worktree-config.d.ts.map +1 -0
  836. package/dist/worktree-config.js +368 -0
  837. package/dist/worktree-config.js.map +1 -0
  838. package/package.json +90 -0
  839. package/skills/diagnose-why-work-stopped/SKILL.md +161 -0
  840. package/skills/evermore/SKILL.md +366 -0
  841. package/skills/evermore/references/api-reference.md +899 -0
  842. package/skills/evermore/references/company-skills.md +193 -0
  843. package/skills/evermore/references/issue-workspaces.md +80 -0
  844. package/skills/evermore/references/routines.md +187 -0
  845. package/skills/evermore/references/workflows.md +141 -0
  846. package/skills/evermore-converting-plans-to-tasks/SKILL.md +42 -0
  847. package/skills/evermore-create-agent/SKILL.md +163 -0
  848. package/skills/evermore-create-agent/references/agent-instruction-templates.md +123 -0
  849. package/skills/evermore-create-agent/references/agents/coder.md +64 -0
  850. package/skills/evermore-create-agent/references/agents/qa.md +88 -0
  851. package/skills/evermore-create-agent/references/agents/securityengineer.md +135 -0
  852. package/skills/evermore-create-agent/references/agents/uxdesigner.md +115 -0
  853. package/skills/evermore-create-agent/references/api-reference.md +110 -0
  854. package/skills/evermore-create-agent/references/baseline-role-guide.md +168 -0
  855. package/skills/evermore-create-agent/references/draft-review-checklist.md +95 -0
  856. package/skills/evermore-create-plugin/SKILL.md +101 -0
  857. package/skills/evermore-dev/SKILL.md +267 -0
  858. package/skills/para-memory-files/SKILL.md +104 -0
  859. package/skills/para-memory-files/references/schemas.md +35 -0
  860. package/skills/terminal-bench-loop/SKILL.md +236 -0
  861. package/ui-dist/android-chrome-192x192.png +0 -0
  862. package/ui-dist/android-chrome-512x512.png +0 -0
  863. package/ui-dist/apple-touch-icon.png +0 -0
  864. package/ui-dist/assets/_basePickBy-Ds9oHp1_.js +1 -0
  865. package/ui-dist/assets/_baseUniq-CHYwQyJ_.js +1 -0
  866. package/ui-dist/assets/apl-B4CMkyY2.js +1 -0
  867. package/ui-dist/assets/arc-CiUKtBzk.js +1 -0
  868. package/ui-dist/assets/architectureDiagram-VXUJARFQ-CAW2b6pT.js +36 -0
  869. package/ui-dist/assets/asciiarmor-Df11BRmG.js +1 -0
  870. package/ui-dist/assets/asn1-EdZsLKOL.js +1 -0
  871. package/ui-dist/assets/asterisk-B-8jnY81.js +1 -0
  872. package/ui-dist/assets/blockDiagram-VD42YOAC-1Rk6YCcn.js +122 -0
  873. package/ui-dist/assets/brainfuck-C4LP7Hcl.js +1 -0
  874. package/ui-dist/assets/c4Diagram-YG6GDRKO-DF5RJtyZ.js +10 -0
  875. package/ui-dist/assets/channel-D7SqxhNi.js +1 -0
  876. package/ui-dist/assets/chunk-4BX2VUAB-BSZDJAxk.js +1 -0
  877. package/ui-dist/assets/chunk-55IACEB6-DgVOW-V3.js +1 -0
  878. package/ui-dist/assets/chunk-B4BG7PRW-C1sGAq6t.js +165 -0
  879. package/ui-dist/assets/chunk-DI55MBZ5-DZyfq3VK.js +220 -0
  880. package/ui-dist/assets/chunk-FMBD7UC4-D6K9nYXi.js +15 -0
  881. package/ui-dist/assets/chunk-QN33PNHL-BJ0Ni2l9.js +1 -0
  882. package/ui-dist/assets/chunk-QZHKN3VN-Cwjr0vxG.js +1 -0
  883. package/ui-dist/assets/chunk-TZMSLE5B-C2RGCkyV.js +1 -0
  884. package/ui-dist/assets/classDiagram-2ON5EDUG-Cx1PlXXb.js +1 -0
  885. package/ui-dist/assets/classDiagram-v2-WZHVMYZB-Cx1PlXXb.js +1 -0
  886. package/ui-dist/assets/clike-B9uivgTg.js +1 -0
  887. package/ui-dist/assets/clojure-BMjYHr_A.js +1 -0
  888. package/ui-dist/assets/clone-5ZE-SRxk.js +1 -0
  889. package/ui-dist/assets/cmake-BQqOBYOt.js +1 -0
  890. package/ui-dist/assets/cobol-CWcv1MsR.js +1 -0
  891. package/ui-dist/assets/coffeescript-S37ZYGWr.js +1 -0
  892. package/ui-dist/assets/commonlisp-DBKNyK5s.js +1 -0
  893. package/ui-dist/assets/cose-bilkent-S5V4N54A-CW0Mh3DC.js +1 -0
  894. package/ui-dist/assets/crystal-SjHAIU92.js +1 -0
  895. package/ui-dist/assets/css-BnMrqG3P.js +1 -0
  896. package/ui-dist/assets/cypher-C_CwsFkJ.js +1 -0
  897. package/ui-dist/assets/cytoscape.esm-jbPEKk2Y.js +321 -0
  898. package/ui-dist/assets/d-pRatUO7H.js +1 -0
  899. package/ui-dist/assets/dagre-6UL2VRFP-BXDbyGyw.js +4 -0
  900. package/ui-dist/assets/defaultLocale-DX6XiGOO.js +1 -0
  901. package/ui-dist/assets/diagram-PSM6KHXK-BHW-b3P9.js +24 -0
  902. package/ui-dist/assets/diagram-QEK2KX5R-vjGsaMmX.js +43 -0
  903. package/ui-dist/assets/diagram-S2PKOQOG-BHVhRqBj.js +24 -0
  904. package/ui-dist/assets/diff-DbItnlRl.js +1 -0
  905. package/ui-dist/assets/dockerfile-BKs6k2Af.js +1 -0
  906. package/ui-dist/assets/dtd-DF_7sFjM.js +1 -0
  907. package/ui-dist/assets/dylan-DwRh75JA.js +1 -0
  908. package/ui-dist/assets/ebnf-CDyGwa7X.js +1 -0
  909. package/ui-dist/assets/ecl-Cabwm37j.js +1 -0
  910. package/ui-dist/assets/eiffel-CnydiIhH.js +1 -0
  911. package/ui-dist/assets/elm-vLlmbW-K.js +1 -0
  912. package/ui-dist/assets/erDiagram-Q2GNP2WA-DwsdEDB2.js +60 -0
  913. package/ui-dist/assets/erlang-BNw1qcRV.js +1 -0
  914. package/ui-dist/assets/factor-kuTfRLto.js +1 -0
  915. package/ui-dist/assets/fcl-Kvtd6kyn.js +1 -0
  916. package/ui-dist/assets/flowDiagram-NV44I4VS-Bv7drkZu.js +162 -0
  917. package/ui-dist/assets/forth-Ffai-XNe.js +1 -0
  918. package/ui-dist/assets/fortran-DYz_wnZ1.js +1 -0
  919. package/ui-dist/assets/ganttDiagram-JELNMOA3-DyYAGyjV.js +267 -0
  920. package/ui-dist/assets/gas-Bneqetm1.js +1 -0
  921. package/ui-dist/assets/gherkin-heZmZLOM.js +1 -0
  922. package/ui-dist/assets/gitGraphDiagram-V2S2FVAM-DmKJJ2X0.js +65 -0
  923. package/ui-dist/assets/graph-BI12oqz9.js +1 -0
  924. package/ui-dist/assets/groovy-D9Dt4D0W.js +1 -0
  925. package/ui-dist/assets/haskell-Cw1EW3IL.js +1 -0
  926. package/ui-dist/assets/haxe-H-WmDvRZ.js +1 -0
  927. package/ui-dist/assets/http-DBlCnlav.js +1 -0
  928. package/ui-dist/assets/idl-BEugSyMb.js +1 -0
  929. package/ui-dist/assets/index-B1YmgKZD.js +1 -0
  930. package/ui-dist/assets/index-B5EG1mbW.js +1 -0
  931. package/ui-dist/assets/index-B63DPkk7.js +2 -0
  932. package/ui-dist/assets/index-BAalUM2u.js +1 -0
  933. package/ui-dist/assets/index-BCyQqUEQ.js +1 -0
  934. package/ui-dist/assets/index-BSRsyahM.js +1 -0
  935. package/ui-dist/assets/index-B_Iu4zUd.js +1 -0
  936. package/ui-dist/assets/index-C-BdZUIH.js +1 -0
  937. package/ui-dist/assets/index-CGgUnSQj.js +6 -0
  938. package/ui-dist/assets/index-COTIEysQ.js +1 -0
  939. package/ui-dist/assets/index-ChSqseHR.js +1 -0
  940. package/ui-dist/assets/index-Ckf1hADU.js +534 -0
  941. package/ui-dist/assets/index-D4M1TSCO.js +3 -0
  942. package/ui-dist/assets/index-DCTk2CN-.js +7 -0
  943. package/ui-dist/assets/index-DI-wyUUr.js +1 -0
  944. package/ui-dist/assets/index-DNtLqZ-D.js +1 -0
  945. package/ui-dist/assets/index-DSRR_614.css +1 -0
  946. package/ui-dist/assets/index-DarmgkJv.js +1 -0
  947. package/ui-dist/assets/index-DdcxF71a.js +1 -0
  948. package/ui-dist/assets/index-DfwWaMga.js +1 -0
  949. package/ui-dist/assets/index-SzUviW57.js +13 -0
  950. package/ui-dist/assets/index-VjZhELb6.js +1 -0
  951. package/ui-dist/assets/index-mEcmy8wG.js +1 -0
  952. package/ui-dist/assets/index-q7ldlDv6.js +1 -0
  953. package/ui-dist/assets/infoDiagram-HS3SLOUP-CqAxMRbC.js +2 -0
  954. package/ui-dist/assets/init-Gi6I4Gst.js +1 -0
  955. package/ui-dist/assets/javascript-iXu5QeM3.js +1 -0
  956. package/ui-dist/assets/journeyDiagram-XKPGCS4Q-DUJiudtY.js +139 -0
  957. package/ui-dist/assets/julia-DuME0IfC.js +1 -0
  958. package/ui-dist/assets/kanban-definition-3W4ZIXB7-CiRgJ4X2.js +89 -0
  959. package/ui-dist/assets/katex-B95LWT_Q.js +261 -0
  960. package/ui-dist/assets/layout-DJ8V2pqt.js +1 -0
  961. package/ui-dist/assets/linear-BwnNUuyZ.js +1 -0
  962. package/ui-dist/assets/livescript-BwQOo05w.js +1 -0
  963. package/ui-dist/assets/lua-BgMRiT3U.js +1 -0
  964. package/ui-dist/assets/mathematica-DTrFuWx2.js +1 -0
  965. package/ui-dist/assets/mbox-CNhZ1qSd.js +1 -0
  966. package/ui-dist/assets/mermaid.core-DLCiCWj4.js +250 -0
  967. package/ui-dist/assets/mindmap-definition-VGOIOE7T-epIiGA01.js +68 -0
  968. package/ui-dist/assets/mirc-CjQqDB4T.js +1 -0
  969. package/ui-dist/assets/mllike-CXdrOF99.js +1 -0
  970. package/ui-dist/assets/modelica-Dc1JOy9r.js +1 -0
  971. package/ui-dist/assets/mscgen-BA5vi2Kp.js +1 -0
  972. package/ui-dist/assets/mumps-BT43cFF4.js +1 -0
  973. package/ui-dist/assets/nginx-DdIZxoE0.js +1 -0
  974. package/ui-dist/assets/nsis-LdVXkNf5.js +1 -0
  975. package/ui-dist/assets/ntriples-BfvgReVJ.js +1 -0
  976. package/ui-dist/assets/octave-Ck1zUtKM.js +1 -0
  977. package/ui-dist/assets/ordinal-Cboi1Yqb.js +1 -0
  978. package/ui-dist/assets/oz-BzwKVEFT.js +1 -0
  979. package/ui-dist/assets/pascal--L3eBynH.js +1 -0
  980. package/ui-dist/assets/perl-CdXCOZ3F.js +1 -0
  981. package/ui-dist/assets/pieDiagram-ADFJNKIX-CHx4pJ9Y.js +30 -0
  982. package/ui-dist/assets/pig-CevX1Tat.js +1 -0
  983. package/ui-dist/assets/powershell-CFHJl5sT.js +1 -0
  984. package/ui-dist/assets/properties-C78fOPTZ.js +1 -0
  985. package/ui-dist/assets/protobuf-ChK-085T.js +1 -0
  986. package/ui-dist/assets/pug-DeIclll2.js +1 -0
  987. package/ui-dist/assets/puppet-DMA9R1ak.js +1 -0
  988. package/ui-dist/assets/python-BuPzkPfP.js +1 -0
  989. package/ui-dist/assets/q-pXgVlZs6.js +1 -0
  990. package/ui-dist/assets/quadrantDiagram-AYHSOK5B-D0tXmGxE.js +7 -0
  991. package/ui-dist/assets/r-B6wPVr8A.js +1 -0
  992. package/ui-dist/assets/requirementDiagram-UZGBJVZJ-BgFc9Xc4.js +64 -0
  993. package/ui-dist/assets/rpm-CTu-6PCP.js +1 -0
  994. package/ui-dist/assets/ruby-B2Rjki9n.js +1 -0
  995. package/ui-dist/assets/sankeyDiagram-TZEHDZUN-DqntX5wV.js +10 -0
  996. package/ui-dist/assets/sas-B4kiWyti.js +1 -0
  997. package/ui-dist/assets/scheme-C41bIUwD.js +1 -0
  998. package/ui-dist/assets/sequenceDiagram-WL72ISMW-BfIJeGAT.js +145 -0
  999. package/ui-dist/assets/shell-CjFT_Tl9.js +1 -0
  1000. package/ui-dist/assets/sieve-C3Gn_uJK.js +1 -0
  1001. package/ui-dist/assets/simple-mode-GW_nhZxv.js +1 -0
  1002. package/ui-dist/assets/smalltalk-CnHTOXQT.js +1 -0
  1003. package/ui-dist/assets/solr-DehyRSwq.js +1 -0
  1004. package/ui-dist/assets/sparql-DkYu6x3z.js +1 -0
  1005. package/ui-dist/assets/spreadsheet-BCZA_wO0.js +1 -0
  1006. package/ui-dist/assets/sql-D0XecflT.js +1 -0
  1007. package/ui-dist/assets/stateDiagram-FKZM4ZOC-CBlsmcoW.js +1 -0
  1008. package/ui-dist/assets/stateDiagram-v2-4FDKWEC3-DJtH2tCS.js +1 -0
  1009. package/ui-dist/assets/stex-C3f8Ysf7.js +1 -0
  1010. package/ui-dist/assets/stylus-B533Al4x.js +1 -0
  1011. package/ui-dist/assets/swift-BzpIVaGY.js +1 -0
  1012. package/ui-dist/assets/tcl-DVfN8rqt.js +1 -0
  1013. package/ui-dist/assets/textile-CnDTJFAw.js +1 -0
  1014. package/ui-dist/assets/tiddlywiki-DO-Gjzrf.js +1 -0
  1015. package/ui-dist/assets/tiki-DGYXhP31.js +1 -0
  1016. package/ui-dist/assets/timeline-definition-IT6M3QCI-C2XyT4Lo.js +61 -0
  1017. package/ui-dist/assets/toml-Bm5Em-hy.js +1 -0
  1018. package/ui-dist/assets/treemap-GDKQZRPO-DvTrxs0e.js +154 -0
  1019. package/ui-dist/assets/troff-wAsdV37c.js +1 -0
  1020. package/ui-dist/assets/ttcn-CfJYG6tj.js +1 -0
  1021. package/ui-dist/assets/ttcn-cfg-B9xdYoR4.js +1 -0
  1022. package/ui-dist/assets/turtle-B1tBg_DP.js +1 -0
  1023. package/ui-dist/assets/vb-CmGdzxic.js +1 -0
  1024. package/ui-dist/assets/vbscript-BuJXcnF6.js +1 -0
  1025. package/ui-dist/assets/velocity-D8B20fx6.js +1 -0
  1026. package/ui-dist/assets/verilog-C6RDOZhf.js +1 -0
  1027. package/ui-dist/assets/vhdl-lSbBsy5d.js +1 -0
  1028. package/ui-dist/assets/webidl-ZXfAyPTL.js +1 -0
  1029. package/ui-dist/assets/xquery-DzFWVndE.js +1 -0
  1030. package/ui-dist/assets/xychartDiagram-PRI3JC2R-pTizTbG0.js +7 -0
  1031. package/ui-dist/assets/yacas-BJ4BC0dw.js +1 -0
  1032. package/ui-dist/assets/z80-Hz9HOZM7.js +1 -0
  1033. package/ui-dist/brands/opencode-logo-dark-square.svg +18 -0
  1034. package/ui-dist/brands/opencode-logo-light-square.svg +18 -0
  1035. package/ui-dist/favicon-16x16.png +0 -0
  1036. package/ui-dist/favicon-32x32.png +0 -0
  1037. package/ui-dist/favicon.ico +0 -0
  1038. package/ui-dist/favicon.svg +9 -0
  1039. package/ui-dist/index.html +49 -0
  1040. package/ui-dist/site.webmanifest +30 -0
  1041. package/ui-dist/sw.js +42 -0
  1042. package/ui-dist/worktree-favicon-16x16.png +0 -0
  1043. package/ui-dist/worktree-favicon-32x32.png +0 -0
  1044. package/ui-dist/worktree-favicon.ico +0 -0
  1045. package/ui-dist/worktree-favicon.svg +9 -0
@@ -0,0 +1,1273 @@
1
+ /**
2
+ * PluginLoader — discovery, installation, and runtime activation of plugins.
3
+ *
4
+ * This service is the entry point for the plugin system's I/O boundary:
5
+ *
6
+ * 1. **Discovery** — Scans the local plugin directory
7
+ * (`~/.evermore/plugins/`) and `node_modules` for packages matching
8
+ * the `evermore-plugin-*` naming convention. Aggregates results with
9
+ * path-based deduplication.
10
+ *
11
+ * 2. **Installation** — `installPlugin()` downloads from npm (or reads a
12
+ * local path), validates the manifest, checks capability consistency,
13
+ * and persists the install record.
14
+ *
15
+ * 3. **Runtime activation** — `activatePlugin()` wires up a loaded plugin
16
+ * with all runtime services: resolves its entrypoint, builds
17
+ * capability-gated host handlers, spawns a worker process, syncs job
18
+ * declarations, registers event subscriptions, and discovers tools.
19
+ *
20
+ * 4. **Shutdown** — `shutdownAll()` gracefully stops all active workers
21
+ * and unregisters runtime hooks.
22
+ *
23
+ * @see PLUGIN_SPEC.md §8 — Plugin Discovery
24
+ * @see PLUGIN_SPEC.md §10 — Package Contract
25
+ * @see PLUGIN_SPEC.md §12 — Process Model
26
+ */
27
+ import { existsSync } from "node:fs";
28
+ import { readdir, readFile, rm, stat } from "node:fs/promises";
29
+ import { execFile } from "node:child_process";
30
+ import os from "node:os";
31
+ import path from "node:path";
32
+ import { fileURLToPath, pathToFileURL } from "node:url";
33
+ import { promisify } from "node:util";
34
+ import { logger } from "../middleware/logger.js";
35
+ import { pluginManifestValidator } from "./plugin-manifest-validator.js";
36
+ import { pluginCapabilityValidator } from "./plugin-capability-validator.js";
37
+ import { pluginRegistryService } from "./plugin-registry.js";
38
+ import { pluginDatabaseService } from "./plugin-database.js";
39
+ const execFileAsync = promisify(execFile);
40
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
41
+ // ---------------------------------------------------------------------------
42
+ // Constants
43
+ // ---------------------------------------------------------------------------
44
+ /**
45
+ * Naming convention for npm-published Evermore plugins.
46
+ * Packages matching this pattern are considered Evermore plugins.
47
+ *
48
+ * @see PLUGIN_SPEC.md §10 — Package Contract
49
+ */
50
+ export const NPM_PLUGIN_PACKAGE_PREFIX = "evermore-plugin-";
51
+ /**
52
+ * Default local plugin directory. The loader scans this directory for
53
+ * locally-installed plugin packages.
54
+ *
55
+ * @see PLUGIN_SPEC.md §8.1 — On-Disk Layout
56
+ */
57
+ export const DEFAULT_LOCAL_PLUGIN_DIR = path.join(os.homedir(), ".evermore", "plugins");
58
+ const DEV_TSX_LOADER_PATH = path.resolve(__dirname, "../../../cli/node_modules/tsx/dist/loader.mjs");
59
+ function getDeclaredPageRoutePaths(manifest) {
60
+ return (manifest.ui?.slots ?? [])
61
+ .filter((slot) => slot.type === "page" && typeof slot.routePath === "string" && slot.routePath.length > 0)
62
+ .map((slot) => slot.routePath);
63
+ }
64
+ // ---------------------------------------------------------------------------
65
+ // Helpers
66
+ // ---------------------------------------------------------------------------
67
+ /**
68
+ * Check whether a package name matches the Evermore plugin naming convention.
69
+ * Accepts both the "evermore-plugin-" prefix and scoped "@scope/plugin-" packages.
70
+ *
71
+ * @see PLUGIN_SPEC.md §10 — Package Contract
72
+ */
73
+ export function isPluginPackageName(name) {
74
+ if (name.startsWith(NPM_PLUGIN_PACKAGE_PREFIX))
75
+ return true;
76
+ // Also accept scoped packages like @acme/plugin-linear or @evermore.work/plugin-*
77
+ if (name.includes("/")) {
78
+ const localPart = name.split("/")[1] ?? "";
79
+ return localPart.startsWith("plugin-");
80
+ }
81
+ return false;
82
+ }
83
+ /**
84
+ * Read and parse a package.json from a directory path.
85
+ * Returns null if no package.json exists.
86
+ */
87
+ async function readPackageJson(dir) {
88
+ const pkgPath = path.join(dir, "package.json");
89
+ if (!existsSync(pkgPath))
90
+ return null;
91
+ try {
92
+ const raw = await readFile(pkgPath, "utf-8");
93
+ return JSON.parse(raw);
94
+ }
95
+ catch {
96
+ return null;
97
+ }
98
+ }
99
+ /**
100
+ * Resolve the manifest entrypoint from a package.json and package root.
101
+ *
102
+ * The spec defines a "evermorePlugin" key in package.json with a "manifest"
103
+ * subkey pointing to the manifest module. This helper resolves the path.
104
+ *
105
+ * @see PLUGIN_SPEC.md §10 — Package Contract
106
+ */
107
+ function resolveManifestPath(packageRoot, pkgJson) {
108
+ const evermorePlugin = pkgJson["evermorePlugin"];
109
+ if (evermorePlugin !== null &&
110
+ typeof evermorePlugin === "object" &&
111
+ !Array.isArray(evermorePlugin)) {
112
+ const manifestRelPath = evermorePlugin["manifest"];
113
+ if (typeof manifestRelPath === "string") {
114
+ // NOTE: the resolved path is returned as-is even if the file does not yet
115
+ // exist on disk (e.g. the package has not been built). Callers MUST guard
116
+ // with existsSync() before passing the path to loadManifestFromPath().
117
+ return path.resolve(packageRoot, manifestRelPath);
118
+ }
119
+ }
120
+ // Fallback: look for dist/manifest.js as a convention
121
+ const conventionalPath = path.join(packageRoot, "dist", "manifest.js");
122
+ if (existsSync(conventionalPath)) {
123
+ return conventionalPath;
124
+ }
125
+ // Fallback: look for manifest.js at package root
126
+ const rootManifestPath = path.join(packageRoot, "manifest.js");
127
+ if (existsSync(rootManifestPath)) {
128
+ return rootManifestPath;
129
+ }
130
+ return null;
131
+ }
132
+ function parseSemver(version) {
133
+ const match = version.match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);
134
+ if (!match)
135
+ return null;
136
+ return {
137
+ major: Number(match[1]),
138
+ minor: Number(match[2]),
139
+ patch: Number(match[3]),
140
+ prerelease: match[4] ? match[4].split(".") : [],
141
+ };
142
+ }
143
+ function compareIdentifiers(left, right) {
144
+ const leftIsNumeric = /^\d+$/.test(left);
145
+ const rightIsNumeric = /^\d+$/.test(right);
146
+ if (leftIsNumeric && rightIsNumeric) {
147
+ return Number(left) - Number(right);
148
+ }
149
+ if (leftIsNumeric)
150
+ return -1;
151
+ if (rightIsNumeric)
152
+ return 1;
153
+ return left.localeCompare(right);
154
+ }
155
+ function compareSemver(left, right) {
156
+ const leftParsed = parseSemver(left);
157
+ const rightParsed = parseSemver(right);
158
+ if (!leftParsed || !rightParsed) {
159
+ throw new Error(`Invalid semver comparison: '${left}' vs '${right}'`);
160
+ }
161
+ const coreOrder = ["major", "minor", "patch"].map((key) => leftParsed[key] - rightParsed[key]).find((delta) => delta !== 0);
162
+ if (coreOrder) {
163
+ return coreOrder;
164
+ }
165
+ if (leftParsed.prerelease.length === 0 && rightParsed.prerelease.length === 0) {
166
+ return 0;
167
+ }
168
+ if (leftParsed.prerelease.length === 0)
169
+ return 1;
170
+ if (rightParsed.prerelease.length === 0)
171
+ return -1;
172
+ const maxLength = Math.max(leftParsed.prerelease.length, rightParsed.prerelease.length);
173
+ for (let index = 0; index < maxLength; index += 1) {
174
+ const leftId = leftParsed.prerelease[index];
175
+ const rightId = rightParsed.prerelease[index];
176
+ if (leftId === undefined)
177
+ return -1;
178
+ if (rightId === undefined)
179
+ return 1;
180
+ const diff = compareIdentifiers(leftId, rightId);
181
+ if (diff !== 0)
182
+ return diff;
183
+ }
184
+ return 0;
185
+ }
186
+ function getMinimumHostVersion(manifest) {
187
+ return manifest.minimumHostVersion ?? manifest.minimumEvermoreVersion;
188
+ }
189
+ /**
190
+ * Extract UI contribution metadata from a manifest for route serialization.
191
+ *
192
+ * Returns `null` when the plugin does not declare any UI slots or launchers.
193
+ * Launcher declarations are aggregated from both the legacy top-level
194
+ * `launchers` field and the preferred `ui.launchers` field.
195
+ */
196
+ export function getPluginUiContributionMetadata(manifest) {
197
+ const slots = manifest.ui?.slots ?? [];
198
+ const launchers = [
199
+ ...(manifest.launchers ?? []),
200
+ ...(manifest.ui?.launchers ?? []),
201
+ ];
202
+ if (slots.length === 0 && launchers.length === 0) {
203
+ return null;
204
+ }
205
+ return {
206
+ uiEntryFile: "index.js",
207
+ slots,
208
+ launchers,
209
+ };
210
+ }
211
+ // ---------------------------------------------------------------------------
212
+ // Factory
213
+ // ---------------------------------------------------------------------------
214
+ /**
215
+ * Create a PluginLoader service.
216
+ *
217
+ * The loader is responsible for plugin discovery, installation, and runtime
218
+ * activation. It reads plugin packages from the local filesystem and npm,
219
+ * validates their manifests, registers them in the database, and — when
220
+ * runtime services are provided — initialises worker processes, event
221
+ * subscriptions, job schedules, webhook endpoints, and agent tools.
222
+ *
223
+ * Usage (discovery & install only):
224
+ * ```ts
225
+ * const loader = pluginLoader(db, { enableLocalFilesystem: true });
226
+ *
227
+ * // Discover all available plugins
228
+ * const result = await loader.discoverAll();
229
+ * for (const plugin of result.discovered) {
230
+ * console.log(plugin.packageName, plugin.manifest?.id);
231
+ * }
232
+ *
233
+ * // Install a specific plugin
234
+ * const discovered = await loader.installPlugin({
235
+ * packageName: "evermore-plugin-linear",
236
+ * version: "^1.0.0",
237
+ * });
238
+ * ```
239
+ *
240
+ * Usage (full runtime activation at server startup):
241
+ * ```ts
242
+ * const loader = pluginLoader(db, loaderOpts, {
243
+ * workerManager,
244
+ * eventBus,
245
+ * jobScheduler,
246
+ * jobStore,
247
+ * toolDispatcher,
248
+ * lifecycleManager,
249
+ * buildHostHandlers: (pluginId, manifest) => ({ ... }),
250
+ * instanceInfo: { instanceId: "inst-1", hostVersion: "1.0.0" },
251
+ * });
252
+ *
253
+ * // Load all ready plugins at startup
254
+ * const loadResult = await loader.loadAll();
255
+ * console.log(`Loaded ${loadResult.succeeded}/${loadResult.total} plugins`);
256
+ *
257
+ * // Load a single plugin after install
258
+ * const singleResult = await loader.loadSingle(pluginId);
259
+ *
260
+ * // Shutdown all plugin workers on server exit
261
+ * await loader.shutdownAll();
262
+ * ```
263
+ *
264
+ * @see PLUGIN_SPEC.md §8.1 — On-Disk Layout
265
+ * @see PLUGIN_SPEC.md §8.3 — Install Process
266
+ * @see PLUGIN_SPEC.md §12 — Process Model
267
+ */
268
+ export function pluginLoader(db, options = {}, runtimeServices) {
269
+ const { localPluginDir = DEFAULT_LOCAL_PLUGIN_DIR, migrationDb = db, enableLocalFilesystem = true, enableNpmDiscovery = true, } = options;
270
+ const registry = pluginRegistryService(db);
271
+ const manifestValidator = pluginManifestValidator();
272
+ const capabilityValidator = pluginCapabilityValidator();
273
+ const log = logger.child({ service: "plugin-loader" });
274
+ const hostVersion = runtimeServices?.instanceInfo.hostVersion;
275
+ async function assertPageRoutePathsAvailable(manifest) {
276
+ const requestedRoutePaths = getDeclaredPageRoutePaths(manifest);
277
+ if (requestedRoutePaths.length === 0)
278
+ return;
279
+ const uniqueRequested = new Set(requestedRoutePaths);
280
+ if (uniqueRequested.size !== requestedRoutePaths.length) {
281
+ throw new Error(`Plugin ${manifest.id} declares duplicate page routePath values`);
282
+ }
283
+ const installedPlugins = await registry.listInstalled();
284
+ for (const plugin of installedPlugins) {
285
+ if (plugin.pluginKey === manifest.id)
286
+ continue;
287
+ const installedManifest = plugin.manifestJson;
288
+ if (!installedManifest)
289
+ continue;
290
+ const installedRoutePaths = new Set(getDeclaredPageRoutePaths(installedManifest));
291
+ const conflictingRoute = requestedRoutePaths.find((routePath) => installedRoutePaths.has(routePath));
292
+ if (conflictingRoute) {
293
+ throw new Error(`Plugin ${manifest.id} routePath "${conflictingRoute}" conflicts with installed plugin ${plugin.pluginKey}`);
294
+ }
295
+ }
296
+ }
297
+ // -------------------------------------------------------------------------
298
+ // Internal helpers
299
+ // -------------------------------------------------------------------------
300
+ /**
301
+ * Fetch a plugin from npm or local path, then parse and validate its manifest.
302
+ *
303
+ * This internal helper encapsulates the core plugin retrieval and validation
304
+ * logic used by both install and upgrade operations. It handles:
305
+ * 1. Resolving the package from npm or local filesystem.
306
+ * 2. Installing the package via npm if necessary.
307
+ * 3. Reading and parsing the plugin manifest.
308
+ * 4. Validating API version compatibility.
309
+ * 5. Validating manifest capabilities.
310
+ *
311
+ * @param installOptions - Options specifying the package to fetch.
312
+ * @returns A `DiscoveredPlugin` object containing the validated manifest.
313
+ */
314
+ async function fetchAndValidate(installOptions) {
315
+ const { packageName, localPath, version, installDir } = installOptions;
316
+ if (!packageName && !localPath) {
317
+ throw new Error("Either packageName or localPath must be provided");
318
+ }
319
+ const targetInstallDir = installDir ?? localPluginDir;
320
+ // Step 1 & 2: Resolve and install package
321
+ let resolvedPackagePath;
322
+ let resolvedPackageName;
323
+ if (localPath) {
324
+ // Local path install — validate the directory exists
325
+ const absLocalPath = path.resolve(localPath);
326
+ if (!existsSync(absLocalPath)) {
327
+ throw new Error(`Local plugin path does not exist: ${absLocalPath}`);
328
+ }
329
+ resolvedPackagePath = absLocalPath;
330
+ const pkgJson = await readPackageJson(absLocalPath);
331
+ resolvedPackageName =
332
+ typeof pkgJson?.["name"] === "string"
333
+ ? pkgJson["name"]
334
+ : path.basename(absLocalPath);
335
+ log.info({ localPath: absLocalPath, packageName: resolvedPackageName }, "plugin-loader: fetching plugin from local path");
336
+ }
337
+ else {
338
+ // npm install
339
+ const spec = version ? `${packageName}@${version}` : packageName;
340
+ log.info({ spec, installDir: targetInstallDir }, "plugin-loader: fetching plugin from npm");
341
+ try {
342
+ // Use execFile (not exec) to avoid shell injection from package name/version.
343
+ // --ignore-scripts prevents preinstall/install/postinstall hooks from
344
+ // executing arbitrary code on the host before manifest validation.
345
+ await execFileAsync("npm", ["install", spec, "--prefix", targetInstallDir, "--save", "--ignore-scripts"], { timeout: 120_000 });
346
+ }
347
+ catch (err) {
348
+ throw new Error(`npm install failed for ${spec}: ${String(err)}`);
349
+ }
350
+ // Resolve the package path after installation
351
+ const nodeModulesPath = path.join(targetInstallDir, "node_modules");
352
+ resolvedPackageName = packageName;
353
+ // Handle scoped packages
354
+ if (resolvedPackageName.startsWith("@")) {
355
+ const [scope, name] = resolvedPackageName.split("/");
356
+ resolvedPackagePath = path.join(nodeModulesPath, scope, name);
357
+ }
358
+ else {
359
+ resolvedPackagePath = path.join(nodeModulesPath, resolvedPackageName);
360
+ }
361
+ if (!existsSync(resolvedPackagePath)) {
362
+ throw new Error(`Package directory not found after installation: ${resolvedPackagePath}`);
363
+ }
364
+ }
365
+ // Step 3: Read and validate plugin manifest
366
+ // Note: this.loadManifest (used via current context)
367
+ const pkgJson = await readPackageJson(resolvedPackagePath);
368
+ if (!pkgJson)
369
+ throw new Error(`Missing package.json at ${resolvedPackagePath}`);
370
+ const manifestPath = resolveManifestPath(resolvedPackagePath, pkgJson);
371
+ if (!manifestPath || !existsSync(manifestPath)) {
372
+ throw new Error(`Package ${resolvedPackageName} at ${resolvedPackagePath} does not appear to be a Evermore plugin (no manifest found).`);
373
+ }
374
+ const manifest = await loadManifestFromPath(manifestPath);
375
+ // Step 4: Reject incompatible plugin API versions
376
+ if (!manifestValidator.getSupportedVersions().includes(manifest.apiVersion)) {
377
+ throw new Error(`Plugin ${manifest.id} declares apiVersion ${manifest.apiVersion} which is not supported by this host. ` +
378
+ `Supported versions: ${manifestValidator.getSupportedVersions().join(", ")}`);
379
+ }
380
+ // Step 5: Validate manifest capabilities are consistent
381
+ const capResult = capabilityValidator.validateManifestCapabilities(manifest);
382
+ if (!capResult.allowed) {
383
+ throw new Error(`Plugin ${manifest.id} manifest has inconsistent capabilities. ` +
384
+ `Missing required capabilities for declared features: ${capResult.missing.join(", ")}`);
385
+ }
386
+ await assertPageRoutePathsAvailable(manifest);
387
+ // Step 6: Reject plugins that require a newer host than the running server
388
+ const minimumHostVersion = getMinimumHostVersion(manifest);
389
+ if (minimumHostVersion && hostVersion) {
390
+ if (compareSemver(hostVersion, minimumHostVersion) < 0) {
391
+ throw new Error(`Plugin ${manifest.id} requires host version ${minimumHostVersion} or newer, ` +
392
+ `but this server is running ${hostVersion}`);
393
+ }
394
+ }
395
+ // Use the version declared in the manifest (required field per the spec)
396
+ const resolvedVersion = manifest.version;
397
+ return {
398
+ packagePath: resolvedPackagePath,
399
+ packageName: resolvedPackageName,
400
+ version: resolvedVersion,
401
+ source: localPath ? "local-filesystem" : "npm",
402
+ manifest,
403
+ };
404
+ }
405
+ /**
406
+ * Attempt to load and validate a plugin manifest from a resolved path.
407
+ * Returns the manifest on success or throws with a descriptive error.
408
+ */
409
+ async function loadManifestFromPath(manifestPath) {
410
+ let raw;
411
+ try {
412
+ // Dynamic import works for both .js (ESM) and .cjs (CJS) manifests
413
+ const manifestUrl = pathToFileURL(manifestPath);
414
+ const manifestStat = await stat(manifestPath);
415
+ manifestUrl.searchParams.set("mtime", String(Math.trunc(manifestStat.mtimeMs)));
416
+ const mod = await import(manifestUrl.href);
417
+ // The manifest may be the default export or the module itself
418
+ raw = mod["default"] ?? mod;
419
+ }
420
+ catch (err) {
421
+ throw new Error(`Failed to load manifest module at ${manifestPath}: ${String(err)}`);
422
+ }
423
+ return manifestValidator.parseOrThrow(raw);
424
+ }
425
+ async function loadManifestFromPackageRoot(packageRoot) {
426
+ const pkgJson = await readPackageJson(packageRoot);
427
+ if (!pkgJson)
428
+ return null;
429
+ const manifestPath = resolveManifestPath(packageRoot, pkgJson);
430
+ if (!manifestPath || !existsSync(manifestPath))
431
+ return null;
432
+ return loadManifestFromPath(manifestPath);
433
+ }
434
+ async function refreshPluginManifestFromPackage(plugin, packageRoot) {
435
+ const manifest = await loadManifestFromPackageRoot(packageRoot);
436
+ if (!manifest) {
437
+ throw new Error(`Plugin package ${plugin.packageName} no longer exposes a Evermore manifest`);
438
+ }
439
+ if (manifest.id !== plugin.pluginKey) {
440
+ throw new Error(`Plugin manifest ID '${manifest.id}' does not match installed plugin '${plugin.pluginKey}'`);
441
+ }
442
+ if (JSON.stringify(manifest) === JSON.stringify(plugin.manifestJson)) {
443
+ return plugin;
444
+ }
445
+ await registry.update(plugin.id, {
446
+ packageName: plugin.packageName,
447
+ version: manifest.version,
448
+ manifest,
449
+ });
450
+ return {
451
+ ...plugin,
452
+ version: manifest.version,
453
+ apiVersion: manifest.apiVersion,
454
+ categories: manifest.categories,
455
+ manifestJson: manifest,
456
+ };
457
+ }
458
+ /**
459
+ * Build a DiscoveredPlugin from a resolved package directory, or null
460
+ * if the package is not a Evermore plugin.
461
+ */
462
+ async function buildDiscoveredPlugin(packagePath, source) {
463
+ const pkgJson = await readPackageJson(packagePath);
464
+ if (!pkgJson)
465
+ return null;
466
+ const packageName = typeof pkgJson["name"] === "string" ? pkgJson["name"] : "";
467
+ const version = typeof pkgJson["version"] === "string" ? pkgJson["version"] : "0.0.0";
468
+ // Determine if this is a plugin package at all
469
+ const hasEvermorePlugin = "evermorePlugin" in pkgJson;
470
+ const nameMatchesConvention = isPluginPackageName(packageName);
471
+ if (!hasEvermorePlugin && !nameMatchesConvention) {
472
+ return null;
473
+ }
474
+ const manifestPath = resolveManifestPath(packagePath, pkgJson);
475
+ if (!manifestPath || !existsSync(manifestPath)) {
476
+ // Found a potential plugin package but no manifest entry point — treat
477
+ // as a discovery-only result with no manifest
478
+ return {
479
+ packagePath,
480
+ packageName,
481
+ version,
482
+ source,
483
+ manifest: null,
484
+ };
485
+ }
486
+ try {
487
+ const manifest = await loadManifestFromPath(manifestPath);
488
+ return {
489
+ packagePath,
490
+ packageName,
491
+ version,
492
+ source,
493
+ manifest,
494
+ };
495
+ }
496
+ catch (err) {
497
+ // Rethrow with context — callers catch and route to the errors array
498
+ throw new Error(`Plugin ${packageName}: ${String(err)}`);
499
+ }
500
+ }
501
+ // -------------------------------------------------------------------------
502
+ // Public API
503
+ // -------------------------------------------------------------------------
504
+ return {
505
+ // -----------------------------------------------------------------------
506
+ // discoverAll
507
+ // -----------------------------------------------------------------------
508
+ async discoverAll(npmSearchDirs) {
509
+ const allDiscovered = [];
510
+ const allErrors = [];
511
+ const sources = [];
512
+ if (enableLocalFilesystem) {
513
+ sources.push("local-filesystem");
514
+ const fsResult = await this.discoverFromLocalFilesystem();
515
+ allDiscovered.push(...fsResult.discovered);
516
+ allErrors.push(...fsResult.errors);
517
+ }
518
+ if (enableNpmDiscovery) {
519
+ sources.push("npm");
520
+ const npmResult = await this.discoverFromNpm(npmSearchDirs);
521
+ // Deduplicate against already-discovered packages (same package path)
522
+ const existingPaths = new Set(allDiscovered.map((d) => d.packagePath));
523
+ for (const plugin of npmResult.discovered) {
524
+ if (!existingPaths.has(plugin.packagePath)) {
525
+ allDiscovered.push(plugin);
526
+ }
527
+ }
528
+ allErrors.push(...npmResult.errors);
529
+ }
530
+ // Future: registry source (options.registryUrl)
531
+ if (options.registryUrl) {
532
+ sources.push("registry");
533
+ log.warn({ registryUrl: options.registryUrl }, "plugin-loader: remote registry discovery is not yet implemented");
534
+ }
535
+ log.info({
536
+ discovered: allDiscovered.length,
537
+ errors: allErrors.length,
538
+ sources,
539
+ }, "plugin-loader: discovery complete");
540
+ return { discovered: allDiscovered, errors: allErrors, sources };
541
+ },
542
+ // -----------------------------------------------------------------------
543
+ // discoverFromLocalFilesystem
544
+ // -----------------------------------------------------------------------
545
+ async discoverFromLocalFilesystem(dir) {
546
+ const scanDir = dir ?? localPluginDir;
547
+ const discovered = [];
548
+ const errors = [];
549
+ if (!existsSync(scanDir)) {
550
+ log.debug({ dir: scanDir }, "plugin-loader: local plugin directory does not exist, skipping");
551
+ return { discovered, errors, sources: ["local-filesystem"] };
552
+ }
553
+ let entries;
554
+ try {
555
+ entries = await readdir(scanDir);
556
+ }
557
+ catch (err) {
558
+ log.warn({ dir: scanDir, err }, "plugin-loader: failed to read local plugin directory");
559
+ return { discovered, errors, sources: ["local-filesystem"] };
560
+ }
561
+ for (const entry of entries) {
562
+ const entryPath = path.join(scanDir, entry);
563
+ // Check if entry is a directory
564
+ let entryStat;
565
+ try {
566
+ entryStat = await stat(entryPath);
567
+ }
568
+ catch {
569
+ continue;
570
+ }
571
+ if (!entryStat.isDirectory())
572
+ continue;
573
+ // Handle scoped packages: @scope/plugin-name is a subdirectory
574
+ if (entry.startsWith("@")) {
575
+ let scopedEntries;
576
+ try {
577
+ scopedEntries = await readdir(entryPath);
578
+ }
579
+ catch {
580
+ continue;
581
+ }
582
+ for (const scopedEntry of scopedEntries) {
583
+ const scopedPath = path.join(entryPath, scopedEntry);
584
+ try {
585
+ const scopedStat = await stat(scopedPath);
586
+ if (!scopedStat.isDirectory())
587
+ continue;
588
+ const plugin = await buildDiscoveredPlugin(scopedPath, "local-filesystem");
589
+ if (plugin)
590
+ discovered.push(plugin);
591
+ }
592
+ catch (err) {
593
+ errors.push({
594
+ packagePath: scopedPath,
595
+ packageName: `${entry}/${scopedEntry}`,
596
+ error: String(err),
597
+ });
598
+ }
599
+ }
600
+ continue;
601
+ }
602
+ try {
603
+ const plugin = await buildDiscoveredPlugin(entryPath, "local-filesystem");
604
+ if (plugin)
605
+ discovered.push(plugin);
606
+ }
607
+ catch (err) {
608
+ const pkgJson = await readPackageJson(entryPath);
609
+ const packageName = typeof pkgJson?.["name"] === "string" ? pkgJson["name"] : entry;
610
+ errors.push({ packagePath: entryPath, packageName, error: String(err) });
611
+ }
612
+ }
613
+ log.debug({ dir: scanDir, discovered: discovered.length, errors: errors.length }, "plugin-loader: local filesystem scan complete");
614
+ return { discovered, errors, sources: ["local-filesystem"] };
615
+ },
616
+ // -----------------------------------------------------------------------
617
+ // discoverFromNpm
618
+ // -----------------------------------------------------------------------
619
+ async discoverFromNpm(searchDirs) {
620
+ const discovered = [];
621
+ const errors = [];
622
+ // Determine the node_modules directories to search.
623
+ // When searchDirs is undefined OR empty, fall back to the conventional
624
+ // defaults (cwd/node_modules and localPluginDir/node_modules).
625
+ // To search nowhere explicitly, pass a non-empty array of non-existent paths.
626
+ const dirsToSearch = searchDirs && searchDirs.length > 0 ? searchDirs : [];
627
+ if (dirsToSearch.length === 0) {
628
+ // Default: search node_modules relative to the process working directory
629
+ // and also the local plugin dir's node_modules
630
+ const cwdNodeModules = path.join(process.cwd(), "node_modules");
631
+ const localNodeModules = path.join(localPluginDir, "node_modules");
632
+ if (existsSync(cwdNodeModules))
633
+ dirsToSearch.push(cwdNodeModules);
634
+ if (existsSync(localNodeModules))
635
+ dirsToSearch.push(localNodeModules);
636
+ }
637
+ for (const nodeModulesDir of dirsToSearch) {
638
+ if (!existsSync(nodeModulesDir))
639
+ continue;
640
+ let entries;
641
+ try {
642
+ entries = await readdir(nodeModulesDir);
643
+ }
644
+ catch {
645
+ continue;
646
+ }
647
+ for (const entry of entries) {
648
+ const entryPath = path.join(nodeModulesDir, entry);
649
+ // Handle scoped packages (@scope/*)
650
+ if (entry.startsWith("@")) {
651
+ let scopedEntries;
652
+ try {
653
+ scopedEntries = await readdir(entryPath);
654
+ }
655
+ catch {
656
+ continue;
657
+ }
658
+ for (const scopedEntry of scopedEntries) {
659
+ const fullName = `${entry}/${scopedEntry}`;
660
+ if (!isPluginPackageName(fullName))
661
+ continue;
662
+ const scopedPath = path.join(entryPath, scopedEntry);
663
+ try {
664
+ const plugin = await buildDiscoveredPlugin(scopedPath, "npm");
665
+ if (plugin)
666
+ discovered.push(plugin);
667
+ }
668
+ catch (err) {
669
+ errors.push({
670
+ packagePath: scopedPath,
671
+ packageName: fullName,
672
+ error: String(err),
673
+ });
674
+ }
675
+ }
676
+ continue;
677
+ }
678
+ // Non-scoped packages: check naming convention
679
+ if (!isPluginPackageName(entry))
680
+ continue;
681
+ let entryStat;
682
+ try {
683
+ entryStat = await stat(entryPath);
684
+ }
685
+ catch {
686
+ continue;
687
+ }
688
+ if (!entryStat.isDirectory())
689
+ continue;
690
+ try {
691
+ const plugin = await buildDiscoveredPlugin(entryPath, "npm");
692
+ if (plugin)
693
+ discovered.push(plugin);
694
+ }
695
+ catch (err) {
696
+ const pkgJson = await readPackageJson(entryPath);
697
+ const packageName = typeof pkgJson?.["name"] === "string" ? pkgJson["name"] : entry;
698
+ errors.push({ packagePath: entryPath, packageName, error: String(err) });
699
+ }
700
+ }
701
+ }
702
+ log.debug({ searchDirs: dirsToSearch, discovered: discovered.length, errors: errors.length }, "plugin-loader: npm discovery scan complete");
703
+ return { discovered, errors, sources: ["npm"] };
704
+ },
705
+ // -----------------------------------------------------------------------
706
+ // loadManifest
707
+ // -----------------------------------------------------------------------
708
+ async loadManifest(packagePath) {
709
+ const pkgJson = await readPackageJson(packagePath);
710
+ if (!pkgJson)
711
+ return null;
712
+ const hasEvermorePlugin = "evermorePlugin" in pkgJson;
713
+ const packageName = typeof pkgJson["name"] === "string" ? pkgJson["name"] : "";
714
+ const nameMatchesConvention = isPluginPackageName(packageName);
715
+ if (!hasEvermorePlugin && !nameMatchesConvention) {
716
+ return null;
717
+ }
718
+ const manifestPath = resolveManifestPath(packagePath, pkgJson);
719
+ if (!manifestPath || !existsSync(manifestPath))
720
+ return null;
721
+ return loadManifestFromPath(manifestPath);
722
+ },
723
+ // -----------------------------------------------------------------------
724
+ // installPlugin
725
+ // -----------------------------------------------------------------------
726
+ async installPlugin(installOptions) {
727
+ const discovered = await fetchAndValidate(installOptions);
728
+ const manifest = discovered.manifest;
729
+ // Step 6: Persist install record and apply plugin-owned schema migrations
730
+ // in one database transaction. If migration validation fails, the plugin
731
+ // row, namespace record, migration ledger, and created schema all roll back.
732
+ const installDb = manifest.database ? migrationDb : db;
733
+ await installDb.transaction(async (tx) => {
734
+ const txDb = tx;
735
+ const txRegistry = pluginRegistryService(txDb);
736
+ const installed = await txRegistry.install({
737
+ packageName: discovered.packageName,
738
+ packagePath: discovered.source === "local-filesystem" ? discovered.packagePath : undefined,
739
+ }, manifest);
740
+ if (!installed) {
741
+ throw new Error(`Plugin install did not return a registry row: ${manifest.id}`);
742
+ }
743
+ if (manifest.database) {
744
+ await pluginDatabaseService(txDb).applyMigrations(installed.id, manifest, discovered.packagePath, { persistFailure: false });
745
+ }
746
+ });
747
+ log.info({
748
+ pluginId: manifest.id,
749
+ packageName: discovered.packageName,
750
+ version: discovered.version,
751
+ capabilities: manifest.capabilities,
752
+ }, "plugin-loader: plugin installed successfully");
753
+ return discovered;
754
+ },
755
+ // -----------------------------------------------------------------------
756
+ // upgradePlugin
757
+ // -----------------------------------------------------------------------
758
+ /**
759
+ * Upgrade an already-installed plugin to a newer version.
760
+ *
761
+ * This method:
762
+ * 1. Fetches and validates the new plugin package using `fetchAndValidate`.
763
+ * 2. Ensures the new manifest ID matches the existing plugin ID for safety.
764
+ * 3. Updates the plugin record in the registry with the new version and manifest.
765
+ *
766
+ * @param pluginId - The UUID of the plugin to upgrade.
767
+ * @param upgradeOptions - Options for the upgrade (packageName, localPath, version).
768
+ * @returns The old and new manifests, along with the discovery metadata.
769
+ * @throws {Error} If the plugin is not found or if the new manifest ID differs.
770
+ */
771
+ async upgradePlugin(pluginId, upgradeOptions) {
772
+ const plugin = (await registry.getById(pluginId));
773
+ if (!plugin)
774
+ throw new Error(`Plugin not found: ${pluginId}`);
775
+ const oldManifest = plugin.manifestJson;
776
+ const { packageName = plugin.packageName,
777
+ // For local-path installs, fall back to the stored packagePath so
778
+ // `upgradePlugin` can re-read the manifest from disk without needing
779
+ // the caller to re-supply the path every time.
780
+ localPath = plugin.packagePath ?? undefined, version, } = upgradeOptions;
781
+ log.info({ pluginId, packageName, version, localPath }, "plugin-loader: upgrading plugin");
782
+ // 1. Fetch/Install the new version
783
+ const discovered = await fetchAndValidate({
784
+ packageName,
785
+ localPath,
786
+ version,
787
+ installDir: localPluginDir,
788
+ });
789
+ const newManifest = discovered.manifest;
790
+ // 2. Validate it's the same plugin ID
791
+ if (newManifest.id !== oldManifest.id) {
792
+ throw new Error(`Upgrade failed: new manifest ID '${newManifest.id}' does not match existing plugin ID '${oldManifest.id}'`);
793
+ }
794
+ // 3. Detect capability escalation — new capabilities not in the old manifest
795
+ const oldCaps = new Set(oldManifest.capabilities ?? []);
796
+ const newCaps = newManifest.capabilities ?? [];
797
+ const escalated = newCaps.filter((c) => !oldCaps.has(c));
798
+ if (escalated.length > 0) {
799
+ log.warn({ pluginId, escalated, oldVersion: oldManifest.version, newVersion: newManifest.version }, "plugin-loader: upgrade introduces new capabilities — requires admin approval");
800
+ throw new Error(`Upgrade for "${pluginId}" introduces new capabilities that require approval: ${escalated.join(", ")}. ` +
801
+ `The previous version declared [${[...oldCaps].join(", ")}]. ` +
802
+ `Please review and approve the capability escalation before upgrading.`);
803
+ }
804
+ // 4. Update the existing record
805
+ await registry.update(pluginId, {
806
+ packageName: discovered.packageName,
807
+ version: discovered.version,
808
+ manifest: newManifest,
809
+ });
810
+ return {
811
+ oldManifest,
812
+ newManifest,
813
+ discovered,
814
+ };
815
+ },
816
+ // -----------------------------------------------------------------------
817
+ // isSupportedApiVersion
818
+ // -----------------------------------------------------------------------
819
+ isSupportedApiVersion(apiVersion) {
820
+ return manifestValidator.getSupportedVersions().includes(apiVersion);
821
+ },
822
+ // -----------------------------------------------------------------------
823
+ // cleanupInstallArtifacts
824
+ // -----------------------------------------------------------------------
825
+ async cleanupInstallArtifacts(plugin) {
826
+ const managedTargets = new Set();
827
+ const managedNodeModulesDir = resolveManagedInstallPackageDir(localPluginDir, plugin.packageName);
828
+ const directManagedDir = path.join(localPluginDir, plugin.packageName);
829
+ managedTargets.add(managedNodeModulesDir);
830
+ if (isPathInsideDir(directManagedDir, localPluginDir)) {
831
+ managedTargets.add(directManagedDir);
832
+ }
833
+ if (plugin.packagePath && isPathInsideDir(plugin.packagePath, localPluginDir)) {
834
+ managedTargets.add(path.resolve(plugin.packagePath));
835
+ }
836
+ const packageJsonPath = path.join(localPluginDir, "package.json");
837
+ if (existsSync(packageJsonPath)) {
838
+ try {
839
+ await execFileAsync("npm", ["uninstall", plugin.packageName, "--prefix", localPluginDir, "--ignore-scripts"], { timeout: 120_000 });
840
+ }
841
+ catch (err) {
842
+ log.warn({
843
+ pluginId: plugin.id,
844
+ pluginKey: plugin.pluginKey,
845
+ packageName: plugin.packageName,
846
+ err: err instanceof Error ? err.message : String(err),
847
+ }, "plugin-loader: npm uninstall failed during cleanup, falling back to direct removal");
848
+ }
849
+ }
850
+ for (const target of managedTargets) {
851
+ if (!existsSync(target))
852
+ continue;
853
+ await rm(target, { recursive: true, force: true });
854
+ }
855
+ },
856
+ // -----------------------------------------------------------------------
857
+ // getLocalPluginDir
858
+ // -----------------------------------------------------------------------
859
+ getLocalPluginDir() {
860
+ return localPluginDir;
861
+ },
862
+ // -----------------------------------------------------------------------
863
+ // hasRuntimeServices
864
+ // -----------------------------------------------------------------------
865
+ hasRuntimeServices() {
866
+ return runtimeServices !== undefined;
867
+ },
868
+ // -----------------------------------------------------------------------
869
+ // -----------------------------------------------------------------------
870
+ // loadAll
871
+ // -----------------------------------------------------------------------
872
+ /**
873
+ * loadAll — Loads and activates all plugins that are currently in 'ready' status.
874
+ *
875
+ * This method is typically called during server startup. It fetches all ready
876
+ * plugins from the registry and attempts to activate them in parallel using
877
+ * Promise.allSettled. Failures in individual plugins do not prevent others from loading.
878
+ *
879
+ * @returns A promise that resolves with summary statistics of the load operation.
880
+ */
881
+ async loadAll() {
882
+ if (!runtimeServices) {
883
+ throw new Error("Cannot loadAll: no PluginRuntimeServices provided. " +
884
+ "Pass runtime services as the third argument to pluginLoader().");
885
+ }
886
+ log.info("plugin-loader: loading all ready plugins");
887
+ // Fetch all plugins in ready status, ordered by installOrder
888
+ const readyPlugins = (await registry.listByStatus("ready"));
889
+ if (readyPlugins.length === 0) {
890
+ log.info("plugin-loader: no ready plugins to load");
891
+ return { total: 0, succeeded: 0, failed: 0, results: [] };
892
+ }
893
+ log.info({ count: readyPlugins.length }, "plugin-loader: found ready plugins to load");
894
+ // Load plugins in parallel
895
+ const results = await Promise.allSettled(readyPlugins.map((plugin) => activatePlugin(plugin)));
896
+ const loadResults = results.map((r, i) => {
897
+ if (r.status === "fulfilled")
898
+ return r.value;
899
+ return {
900
+ plugin: readyPlugins[i],
901
+ success: false,
902
+ error: String(r.reason),
903
+ registered: { worker: false, eventSubscriptions: 0, jobs: 0, webhooks: 0, tools: 0 },
904
+ };
905
+ });
906
+ const succeeded = loadResults.filter((r) => r.success).length;
907
+ const failed = loadResults.filter((r) => !r.success).length;
908
+ log.info({
909
+ total: readyPlugins.length,
910
+ succeeded,
911
+ failed,
912
+ }, "plugin-loader: loadAll complete");
913
+ return {
914
+ total: readyPlugins.length,
915
+ succeeded,
916
+ failed,
917
+ results: loadResults,
918
+ };
919
+ },
920
+ // -----------------------------------------------------------------------
921
+ // loadSingle
922
+ // -----------------------------------------------------------------------
923
+ /**
924
+ * loadSingle — Loads and activates a single plugin by its ID.
925
+ *
926
+ * This method retrieves the plugin from the registry, ensures it's in a valid
927
+ * state, and then calls activatePlugin to start its worker and register its
928
+ * capabilities (tools, jobs, etc.).
929
+ *
930
+ * @param pluginId - The UUID of the plugin to load.
931
+ * @returns A promise that resolves with the result of the activation.
932
+ */
933
+ async loadSingle(pluginId) {
934
+ if (!runtimeServices) {
935
+ throw new Error("Cannot loadSingle: no PluginRuntimeServices provided. " +
936
+ "Pass runtime services as the third argument to pluginLoader().");
937
+ }
938
+ const plugin = (await registry.getById(pluginId));
939
+ if (!plugin) {
940
+ throw new Error(`Plugin not found: ${pluginId}`);
941
+ }
942
+ // If the plugin is in 'installed' status, transition it to 'ready' first.
943
+ // lifecycleManager.load() transitions the status AND activates the plugin
944
+ // via activateReadyPlugin() → loadSingle() (recursive call with 'ready'
945
+ // status) → activatePlugin(). We must NOT call activatePlugin() again here,
946
+ // as that would double-start the worker and duplicate registrations.
947
+ if (plugin.status === "installed") {
948
+ await runtimeServices.lifecycleManager.load(pluginId);
949
+ const updated = (await registry.getById(pluginId));
950
+ if (!updated)
951
+ throw new Error(`Plugin not found after status update: ${pluginId}`);
952
+ return {
953
+ plugin: updated,
954
+ success: true,
955
+ registered: { worker: true, eventSubscriptions: 0, jobs: 0, webhooks: 0, tools: 0 },
956
+ };
957
+ }
958
+ if (plugin.status !== "ready") {
959
+ throw new Error(`Cannot load plugin in status '${plugin.status}'. ` +
960
+ `Plugin must be in 'installed' or 'ready' status.`);
961
+ }
962
+ return activatePlugin(plugin);
963
+ },
964
+ // -----------------------------------------------------------------------
965
+ // unloadSingle
966
+ // -----------------------------------------------------------------------
967
+ async unloadSingle(pluginId, pluginKey) {
968
+ if (!runtimeServices) {
969
+ throw new Error("Cannot unloadSingle: no PluginRuntimeServices provided.");
970
+ }
971
+ log.info({ pluginId, pluginKey }, "plugin-loader: unloading single plugin");
972
+ const { workerManager, eventBus, jobScheduler, toolDispatcher, } = runtimeServices;
973
+ // 1. Unregister from job scheduler (cancels in-flight runs)
974
+ try {
975
+ await jobScheduler.unregisterPlugin(pluginId);
976
+ }
977
+ catch (err) {
978
+ log.warn({ pluginId, err: err instanceof Error ? err.message : String(err) }, "plugin-loader: failed to unregister from job scheduler (best-effort)");
979
+ }
980
+ // 2. Clear event subscriptions
981
+ eventBus.clearPlugin(pluginKey);
982
+ // 3. Unregister agent tools
983
+ toolDispatcher.unregisterPluginTools(pluginKey);
984
+ // 4. Stop the worker process
985
+ try {
986
+ if (workerManager.isRunning(pluginId)) {
987
+ await workerManager.stopWorker(pluginId);
988
+ }
989
+ }
990
+ catch (err) {
991
+ log.warn({ pluginId, err: err instanceof Error ? err.message : String(err) }, "plugin-loader: failed to stop worker during unload (best-effort)");
992
+ }
993
+ log.info({ pluginId, pluginKey }, "plugin-loader: plugin unloaded successfully");
994
+ },
995
+ // -----------------------------------------------------------------------
996
+ // shutdownAll
997
+ // -----------------------------------------------------------------------
998
+ async shutdownAll() {
999
+ if (!runtimeServices) {
1000
+ throw new Error("Cannot shutdownAll: no PluginRuntimeServices provided.");
1001
+ }
1002
+ log.info("plugin-loader: shutting down all plugins");
1003
+ const { workerManager, jobScheduler } = runtimeServices;
1004
+ // 1. Stop the job scheduler tick loop
1005
+ jobScheduler.stop();
1006
+ // 2. Stop all worker processes
1007
+ await workerManager.stopAll();
1008
+ log.info("plugin-loader: all plugins shut down");
1009
+ },
1010
+ };
1011
+ // -------------------------------------------------------------------------
1012
+ // Internal: activatePlugin — shared logic for loadAll and loadSingle
1013
+ // -------------------------------------------------------------------------
1014
+ /**
1015
+ * Activate a single plugin: spawn its worker, register event subscriptions,
1016
+ * sync jobs, register tools.
1017
+ *
1018
+ * This is the core orchestration logic shared by `loadAll()` and `loadSingle()`.
1019
+ * Failures are caught and reported in the result; the plugin is marked as
1020
+ * `error` in the database when activation fails.
1021
+ */
1022
+ async function activatePlugin(plugin) {
1023
+ const pluginId = plugin.id;
1024
+ const pluginKey = plugin.pluginKey;
1025
+ let activePlugin = plugin;
1026
+ let manifest = activePlugin.manifestJson;
1027
+ const registered = {
1028
+ worker: false,
1029
+ eventSubscriptions: 0,
1030
+ jobs: 0,
1031
+ webhooks: 0,
1032
+ tools: 0,
1033
+ };
1034
+ // Guard: runtime services must exist (callers already checked)
1035
+ if (!runtimeServices) {
1036
+ return {
1037
+ plugin,
1038
+ success: false,
1039
+ error: "No runtime services available",
1040
+ registered,
1041
+ };
1042
+ }
1043
+ const { workerManager, eventBus, jobScheduler, jobStore, toolDispatcher, lifecycleManager, buildHostHandlers, instanceInfo, } = runtimeServices;
1044
+ try {
1045
+ log.info({ pluginId, pluginKey, version: plugin.version }, "plugin-loader: activating plugin");
1046
+ // ------------------------------------------------------------------
1047
+ // 1. Resolve worker entrypoint
1048
+ // ------------------------------------------------------------------
1049
+ const packageRoot = resolvePluginPackageRoot(activePlugin, localPluginDir);
1050
+ activePlugin = await refreshPluginManifestFromPackage(activePlugin, packageRoot);
1051
+ manifest = activePlugin.manifestJson;
1052
+ const workerEntrypoint = resolveWorkerEntrypoint(activePlugin, localPluginDir);
1053
+ // ------------------------------------------------------------------
1054
+ // 2. Apply restricted database migrations before worker startup
1055
+ // ------------------------------------------------------------------
1056
+ const databaseNamespace = manifest.database
1057
+ ? (await pluginDatabaseService(migrationDb).applyMigrations(pluginId, manifest, packageRoot))?.namespaceName ?? null
1058
+ : null;
1059
+ // ------------------------------------------------------------------
1060
+ // 3. Build host handlers for this plugin
1061
+ // ------------------------------------------------------------------
1062
+ const hostHandlers = buildHostHandlers(pluginId, manifest);
1063
+ // ------------------------------------------------------------------
1064
+ // 4. Retrieve plugin config (if any)
1065
+ // ------------------------------------------------------------------
1066
+ let config = {};
1067
+ try {
1068
+ const configRow = await registry.getConfig(pluginId);
1069
+ if (configRow && typeof configRow === "object" && "configJson" in configRow) {
1070
+ config = configRow.configJson ?? {};
1071
+ }
1072
+ }
1073
+ catch {
1074
+ // Config may not exist yet — use empty object
1075
+ log.debug({ pluginId }, "plugin-loader: no config found, using empty config");
1076
+ }
1077
+ // ------------------------------------------------------------------
1078
+ // 5. Spawn worker process
1079
+ // ------------------------------------------------------------------
1080
+ const workerOptions = {
1081
+ entrypointPath: workerEntrypoint,
1082
+ manifest,
1083
+ config,
1084
+ instanceInfo,
1085
+ apiVersion: manifest.apiVersion,
1086
+ databaseNamespace,
1087
+ hostHandlers,
1088
+ autoRestart: true,
1089
+ env: {
1090
+ EVERMORE_DEPLOYMENT_MODE: instanceInfo.deploymentMode ?? "",
1091
+ EVERMORE_DEPLOYMENT_EXPOSURE: instanceInfo.deploymentExposure ?? "",
1092
+ },
1093
+ };
1094
+ // Repo-local plugin installs can resolve workspace TS sources at runtime
1095
+ // (for example @evermore.work/shared exports). Run those workers through
1096
+ // the tsx loader so first-party example plugins work in development.
1097
+ if (activePlugin.packagePath && existsSync(DEV_TSX_LOADER_PATH)) {
1098
+ workerOptions.execArgv = ["--import", DEV_TSX_LOADER_PATH];
1099
+ }
1100
+ await workerManager.startWorker(pluginId, workerOptions);
1101
+ registered.worker = true;
1102
+ log.info({ pluginId, pluginKey }, "plugin-loader: worker started");
1103
+ // ------------------------------------------------------------------
1104
+ // 6. Sync job declarations and register with scheduler
1105
+ // ------------------------------------------------------------------
1106
+ const jobDeclarations = manifest.jobs ?? [];
1107
+ if (jobDeclarations.length > 0) {
1108
+ await jobStore.syncJobDeclarations(pluginId, jobDeclarations);
1109
+ await jobScheduler.registerPlugin(pluginId);
1110
+ registered.jobs = jobDeclarations.length;
1111
+ log.info({ pluginId, pluginKey, jobs: jobDeclarations.length }, "plugin-loader: job declarations synced and plugin registered with scheduler");
1112
+ }
1113
+ // ------------------------------------------------------------------
1114
+ // 6. Register event subscriptions
1115
+ //
1116
+ // Note: Event subscriptions are declared at runtime by the plugin
1117
+ // worker via the SDK's ctx.events.on() calls. The event bus manages
1118
+ // per-plugin subscription scoping. Here we ensure the event bus has
1119
+ // a scoped handle ready for this plugin — the actual subscriptions
1120
+ // are registered by the host handler layer when the worker calls
1121
+ // events.subscribe via RPC.
1122
+ //
1123
+ // The bus.forPlugin() call creates the scoped handle if needed;
1124
+ // any previous subscriptions for this plugin are preserved if the
1125
+ // worker is restarting.
1126
+ // ------------------------------------------------------------------
1127
+ const _scopedBus = eventBus.forPlugin(pluginKey);
1128
+ registered.eventSubscriptions = eventBus.subscriptionCount(pluginKey);
1129
+ log.debug({ pluginId, pluginKey }, "plugin-loader: event bus scoped handle ready");
1130
+ // ------------------------------------------------------------------
1131
+ // 7. Register webhook endpoints (manifest-declared)
1132
+ //
1133
+ // Webhooks are statically declared in the manifest. The actual
1134
+ // endpoint routing is handled by the plugin routes module which
1135
+ // checks the manifest for declared webhooks. No explicit
1136
+ // registration step is needed here — the manifest is persisted
1137
+ // in the DB and the route handler reads it at request time.
1138
+ //
1139
+ // We track the count for the result reporting.
1140
+ // ------------------------------------------------------------------
1141
+ const webhookDeclarations = manifest.webhooks ?? [];
1142
+ registered.webhooks = webhookDeclarations.length;
1143
+ if (webhookDeclarations.length > 0) {
1144
+ log.info({ pluginId, pluginKey, webhooks: webhookDeclarations.length }, "plugin-loader: webhook endpoints declared in manifest");
1145
+ }
1146
+ // ------------------------------------------------------------------
1147
+ // 8. Register agent tools
1148
+ // ------------------------------------------------------------------
1149
+ const toolDeclarations = manifest.tools ?? [];
1150
+ if (toolDeclarations.length > 0) {
1151
+ toolDispatcher.registerPluginTools(pluginKey, manifest);
1152
+ registered.tools = toolDeclarations.length;
1153
+ log.info({ pluginId, pluginKey, tools: toolDeclarations.length }, "plugin-loader: agent tools registered");
1154
+ }
1155
+ // ------------------------------------------------------------------
1156
+ // Done — plugin fully activated
1157
+ // ------------------------------------------------------------------
1158
+ log.info({
1159
+ pluginId,
1160
+ pluginKey,
1161
+ version: activePlugin.version,
1162
+ registered,
1163
+ }, "plugin-loader: plugin activated successfully");
1164
+ return { plugin: activePlugin, success: true, registered };
1165
+ }
1166
+ catch (err) {
1167
+ const errorMessage = err instanceof Error ? err.message : String(err);
1168
+ log.error({ pluginId, pluginKey, err: errorMessage }, "plugin-loader: failed to activate plugin");
1169
+ // Mark the plugin as errored in the database so it is not retried
1170
+ // automatically on next startup without operator intervention.
1171
+ try {
1172
+ await lifecycleManager.markError(pluginId, `Activation failed: ${errorMessage}`);
1173
+ }
1174
+ catch (markErr) {
1175
+ log.error({
1176
+ pluginId,
1177
+ err: markErr instanceof Error ? markErr.message : String(markErr),
1178
+ }, "plugin-loader: failed to mark plugin as error after activation failure");
1179
+ }
1180
+ return {
1181
+ plugin: activePlugin,
1182
+ success: false,
1183
+ error: errorMessage,
1184
+ registered,
1185
+ };
1186
+ }
1187
+ }
1188
+ }
1189
+ // ---------------------------------------------------------------------------
1190
+ // Worker entrypoint resolution
1191
+ // ---------------------------------------------------------------------------
1192
+ /**
1193
+ * Resolve the absolute path to a plugin's worker entrypoint from its manifest
1194
+ * and known install locations.
1195
+ *
1196
+ * The manifest `entrypoints.worker` field is relative to the package root.
1197
+ * We check the local plugin directory (where the package was installed) and
1198
+ * also the package directory if it was a local-path install.
1199
+ *
1200
+ * @see PLUGIN_SPEC.md §10 — Package Contract
1201
+ */
1202
+ function resolveWorkerEntrypoint(plugin, localPluginDir) {
1203
+ const manifest = plugin.manifestJson;
1204
+ const workerRelPath = manifest.entrypoints.worker;
1205
+ // For local-path installs we persist the resolved package path; use it first
1206
+ if (plugin.packagePath && existsSync(plugin.packagePath)) {
1207
+ const entrypoint = path.resolve(plugin.packagePath, workerRelPath);
1208
+ if (entrypoint.startsWith(path.resolve(plugin.packagePath)) && existsSync(entrypoint)) {
1209
+ return entrypoint;
1210
+ }
1211
+ }
1212
+ // Try the local plugin directory (standard npm install location)
1213
+ const packageName = plugin.packageName;
1214
+ let packageDir;
1215
+ if (packageName.startsWith("@")) {
1216
+ // Scoped package: @scope/plugin-name → localPluginDir/node_modules/@scope/plugin-name
1217
+ const [scope, name] = packageName.split("/");
1218
+ packageDir = path.join(localPluginDir, "node_modules", scope, name);
1219
+ }
1220
+ else {
1221
+ packageDir = path.join(localPluginDir, "node_modules", packageName);
1222
+ }
1223
+ // Also check if the package exists directly under localPluginDir
1224
+ // (for direct local-path installs or symlinked packages)
1225
+ const directDir = path.join(localPluginDir, packageName);
1226
+ // Try in order: node_modules path, direct path
1227
+ for (const dir of [packageDir, directDir]) {
1228
+ const entrypoint = path.resolve(dir, workerRelPath);
1229
+ // Security: ensure entrypoint is actually inside the directory (prevent path traversal)
1230
+ if (!entrypoint.startsWith(path.resolve(dir))) {
1231
+ continue;
1232
+ }
1233
+ if (existsSync(entrypoint)) {
1234
+ return entrypoint;
1235
+ }
1236
+ }
1237
+ // Fallback: try the worker path as-is (absolute or relative to cwd)
1238
+ // ONLY if it's already an absolute path and we trust the manifest (which we've already validated)
1239
+ if (path.isAbsolute(workerRelPath) && existsSync(workerRelPath)) {
1240
+ return workerRelPath;
1241
+ }
1242
+ throw new Error(`Worker entrypoint not found for plugin "${plugin.pluginKey}". ` +
1243
+ `Checked: ${path.resolve(packageDir, workerRelPath)}, ` +
1244
+ `${path.resolve(directDir, workerRelPath)}`);
1245
+ }
1246
+ function resolvePluginPackageRoot(plugin, localPluginDir) {
1247
+ if (plugin.packagePath && existsSync(plugin.packagePath)) {
1248
+ return path.resolve(plugin.packagePath);
1249
+ }
1250
+ const packageName = plugin.packageName;
1251
+ const packageDir = packageName.startsWith("@")
1252
+ ? path.join(localPluginDir, "node_modules", ...packageName.split("/"))
1253
+ : path.join(localPluginDir, "node_modules", packageName);
1254
+ if (existsSync(packageDir))
1255
+ return packageDir;
1256
+ const directDir = path.join(localPluginDir, packageName);
1257
+ if (existsSync(directDir))
1258
+ return directDir;
1259
+ throw new Error(`Package root not found for plugin "${plugin.pluginKey}"`);
1260
+ }
1261
+ function resolveManagedInstallPackageDir(localPluginDir, packageName) {
1262
+ if (packageName.startsWith("@")) {
1263
+ return path.join(localPluginDir, "node_modules", ...packageName.split("/"));
1264
+ }
1265
+ return path.join(localPluginDir, "node_modules", packageName);
1266
+ }
1267
+ function isPathInsideDir(candidatePath, parentDir) {
1268
+ const resolvedCandidate = path.resolve(candidatePath);
1269
+ const resolvedParent = path.resolve(parentDir);
1270
+ const relative = path.relative(resolvedParent, resolvedCandidate);
1271
+ return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
1272
+ }
1273
+ //# sourceMappingURL=plugin-loader.js.map