stitchkit 0.132.2 → 0.133.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 (341) hide show
  1. package/CHANGELOG.md +181 -1
  2. package/dist/agent-executor/acp/v1-connect.d.ts +12 -1
  3. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
  4. package/dist/agent-executor/acp/v1-driver.d.ts +3 -1
  5. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
  6. package/dist/agent-executor/acp/v1-handlers.d.ts +9 -1
  7. package/dist/agent-executor/acp/v1-handlers.d.ts.map +1 -1
  8. package/dist/agent-executor/acp/v1-permission.d.ts +3 -2
  9. package/dist/agent-executor/acp/v1-permission.d.ts.map +1 -1
  10. package/dist/agent-executor/acp/v1-probe.d.ts +10 -1
  11. package/dist/agent-executor/acp/v1-probe.d.ts.map +1 -1
  12. package/dist/agent-executor/acp/v1-session.d.ts +11 -2
  13. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  14. package/dist/agent-executor/acp/v1-turn.d.ts +13 -10
  15. package/dist/agent-executor/acp/v1-turn.d.ts.map +1 -1
  16. package/dist/agent-executor/claude/cli-driver.d.ts +6 -0
  17. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
  18. package/dist/agent-executor/claude/record-router.d.ts +44 -0
  19. package/dist/agent-executor/claude/record-router.d.ts.map +1 -0
  20. package/dist/agent-executor/claude/session.d.ts +2 -0
  21. package/dist/agent-executor/claude/session.d.ts.map +1 -1
  22. package/dist/agent-executor/claude-sdk/controls.d.ts +1 -0
  23. package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -1
  24. package/dist/agent-executor/claude-sdk/driver.d.ts +20 -2
  25. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
  26. package/dist/agent-executor/claude-sdk/engine-spawn.d.ts +18 -0
  27. package/dist/agent-executor/claude-sdk/engine-spawn.d.ts.map +1 -0
  28. package/dist/agent-executor/claude-sdk/query-loop.d.ts +9 -7
  29. package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
  30. package/dist/agent-executor/claude-sdk/query-manager.d.ts +42 -0
  31. package/dist/agent-executor/claude-sdk/query-manager.d.ts.map +1 -0
  32. package/dist/agent-executor/claude-sdk/query-options.d.ts +4 -1
  33. package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -1
  34. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
  35. package/dist/agent-executor/codex/capabilities.d.ts +8 -0
  36. package/dist/agent-executor/codex/capabilities.d.ts.map +1 -0
  37. package/dist/agent-executor/codex/connect.d.ts +6 -1
  38. package/dist/agent-executor/codex/connect.d.ts.map +1 -1
  39. package/dist/agent-executor/codex/driver.d.ts +10 -0
  40. package/dist/agent-executor/codex/driver.d.ts.map +1 -1
  41. package/dist/agent-executor/codex/event-routing.d.ts +23 -1
  42. package/dist/agent-executor/codex/event-routing.d.ts.map +1 -1
  43. package/dist/agent-executor/codex/handlers.d.ts +24 -4
  44. package/dist/agent-executor/codex/handlers.d.ts.map +1 -1
  45. package/dist/agent-executor/codex/limits.d.ts +17 -0
  46. package/dist/agent-executor/codex/limits.d.ts.map +1 -1
  47. package/dist/agent-executor/codex/request-answers.d.ts +23 -3
  48. package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
  49. package/dist/agent-executor/codex/session-bind.d.ts +6 -1
  50. package/dist/agent-executor/codex/session-bind.d.ts.map +1 -1
  51. package/dist/agent-executor/codex/session-types.d.ts +5 -1
  52. package/dist/agent-executor/codex/session-types.d.ts.map +1 -1
  53. package/dist/agent-executor/codex/session.d.ts.map +1 -1
  54. package/dist/agent-executor/codex/shared-server.d.ts.map +1 -1
  55. package/dist/agent-executor/codex/shared-thread.d.ts +7 -7
  56. package/dist/agent-executor/codex/shared-thread.d.ts.map +1 -1
  57. package/dist/agent-executor/codex/thread-open.d.ts +12 -3
  58. package/dist/agent-executor/codex/thread-open.d.ts.map +1 -1
  59. package/dist/agent-executor/engine-requests.d.ts +42 -0
  60. package/dist/agent-executor/engine-requests.d.ts.map +1 -1
  61. package/dist/agent-executor/handoff-schemas.d.ts.map +1 -1
  62. package/dist/agent-executor/handoff.d.ts.map +1 -1
  63. package/dist/agent-executor/image-input.d.ts +6 -5
  64. package/dist/agent-executor/image-input.d.ts.map +1 -1
  65. package/dist/agent-executor/profile.d.ts +3 -5
  66. package/dist/agent-executor/profile.d.ts.map +1 -1
  67. package/dist/agent-executor/session-primitives.d.ts +64 -3
  68. package/dist/agent-executor/session-primitives.d.ts.map +1 -1
  69. package/dist/agent-executor/testing/claude-sdk-stubs.d.ts +5 -0
  70. package/dist/agent-executor/testing/claude-sdk-stubs.d.ts.map +1 -0
  71. package/dist/agent-executor/testing/conformance-lifecycle.d.ts +11 -0
  72. package/dist/agent-executor/testing/conformance-lifecycle.d.ts.map +1 -0
  73. package/dist/agent-executor/testing/conformance-support.d.ts +23 -0
  74. package/dist/agent-executor/testing/conformance-support.d.ts.map +1 -0
  75. package/dist/agent-executor/testing/conformance.d.ts +7 -2
  76. package/dist/agent-executor/testing/conformance.d.ts.map +1 -1
  77. package/dist/agent-executor/testing/consumer-stubs.d.ts +5 -3
  78. package/dist/agent-executor/testing/consumer-stubs.d.ts.map +1 -1
  79. package/dist/agent-executor/testing/fake-codex-app-server.d.ts +5 -1
  80. package/dist/agent-executor/testing/fake-codex-app-server.d.ts.map +1 -1
  81. package/dist/agent-executor/testing/replay-driver.d.ts +6 -0
  82. package/dist/agent-executor/testing/replay-driver.d.ts.map +1 -1
  83. package/dist/agent-executor/testing/replay-gate.d.ts +4 -1
  84. package/dist/agent-executor/testing/replay-gate.d.ts.map +1 -1
  85. package/dist/agent-runtime/deferred-tool-types.d.ts +2 -0
  86. package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
  87. package/dist/agent-runtime/deferred-tools.d.ts.map +1 -1
  88. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  89. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  90. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  91. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  92. package/dist/browser/client.d.ts.map +1 -1
  93. package/dist/browser/operation-refusal.d.ts +10 -0
  94. package/dist/browser/operation-refusal.d.ts.map +1 -0
  95. package/dist/contract/client-types.d.ts +13 -4
  96. package/dist/contract/client-types.d.ts.map +1 -1
  97. package/dist/contract/define-validation.d.ts +6 -0
  98. package/dist/contract/define-validation.d.ts.map +1 -1
  99. package/dist/contract/define.d.ts +3 -0
  100. package/dist/contract/define.d.ts.map +1 -1
  101. package/dist/contract/errors-factory.d.ts +8 -2
  102. package/dist/contract/errors-factory.d.ts.map +1 -1
  103. package/dist/contract/errors.d.ts +9 -0
  104. package/dist/contract/errors.d.ts.map +1 -1
  105. package/dist/contract/fingerprint.d.ts +4 -1
  106. package/dist/contract/fingerprint.d.ts.map +1 -1
  107. package/dist/contract/operation-refusals.d.ts +51 -0
  108. package/dist/contract/operation-refusals.d.ts.map +1 -0
  109. package/dist/contract/tool-options.d.ts +4 -0
  110. package/dist/contract/tool-options.d.ts.map +1 -1
  111. package/dist/entrypoints/agent-executor/acp.js +254 -196
  112. package/dist/entrypoints/agent-executor/claude-sdk.js +467 -294
  113. package/dist/entrypoints/agent-executor/claude.js +130 -99
  114. package/dist/entrypoints/agent-executor/codex.js +441 -314
  115. package/dist/entrypoints/agent-executor/testing/claude-sdk.d.ts +3 -0
  116. package/dist/entrypoints/agent-executor/testing/claude-sdk.d.ts.map +1 -0
  117. package/dist/entrypoints/agent-executor/testing/claude-sdk.js +329 -0
  118. package/dist/entrypoints/agent-executor/testing.d.ts +1 -2
  119. package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -1
  120. package/dist/entrypoints/agent-executor/testing.js +413 -667
  121. package/dist/entrypoints/agent-executor.d.ts +1 -1
  122. package/dist/entrypoints/agent-executor.d.ts.map +1 -1
  123. package/dist/entrypoints/agent-executor.js +12 -12
  124. package/dist/entrypoints/agent-runtime/browser.js +2 -2
  125. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  126. package/dist/entrypoints/agent-runtime/harness.js +8 -8
  127. package/dist/entrypoints/agent-runtime/postgres.js +5 -5
  128. package/dist/entrypoints/agent-runtime/realtime.js +2 -2
  129. package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
  130. package/dist/entrypoints/agent-runtime/sqlite/bun.js +6 -6
  131. package/dist/entrypoints/agent-runtime/sqlite/node.js +6 -6
  132. package/dist/entrypoints/agent-runtime/testing.js +5 -5
  133. package/dist/entrypoints/agent-runtime.js +26 -18
  134. package/dist/entrypoints/application/grammy.js +1 -1
  135. package/dist/entrypoints/application.js +2 -2
  136. package/dist/entrypoints/cli.js +8 -8
  137. package/dist/entrypoints/contract.d.ts +3 -2
  138. package/dist/entrypoints/contract.d.ts.map +1 -1
  139. package/dist/entrypoints/contract.js +6 -4
  140. package/dist/entrypoints/files/packaging.d.ts +4 -1
  141. package/dist/entrypoints/files/packaging.d.ts.map +1 -1
  142. package/dist/entrypoints/files/packaging.js +868 -167
  143. package/dist/entrypoints/files.js +1 -1
  144. package/dist/entrypoints/handler.js +7 -7
  145. package/dist/entrypoints/http.js +2 -2
  146. package/dist/entrypoints/index.js +10 -8
  147. package/dist/entrypoints/node.js +11 -11
  148. package/dist/entrypoints/observability.js +1 -1
  149. package/dist/entrypoints/process/bootstrap.d.ts +3 -0
  150. package/dist/entrypoints/process/bootstrap.d.ts.map +1 -0
  151. package/dist/entrypoints/process/bootstrap.js +16 -0
  152. package/dist/entrypoints/process.js +7 -7
  153. package/dist/entrypoints/realtime.js +3 -3
  154. package/dist/entrypoints/remote.js +8 -7
  155. package/dist/entrypoints/server.js +30 -14
  156. package/dist/entrypoints/service-host/macos.js +72 -206
  157. package/dist/entrypoints/service-host/work.d.ts +15 -0
  158. package/dist/entrypoints/service-host/work.d.ts.map +1 -0
  159. package/dist/entrypoints/service-host/work.js +676 -0
  160. package/dist/entrypoints/service-host.js +146 -536
  161. package/dist/entrypoints/telegram/screens.js +4 -4
  162. package/dist/entrypoints/telegram.js +4 -4
  163. package/dist/entrypoints/testing.d.ts +2 -1
  164. package/dist/entrypoints/testing.d.ts.map +1 -1
  165. package/dist/entrypoints/testing.js +27 -8
  166. package/dist/entrypoints/tools/agent.js +6 -6
  167. package/dist/entrypoints/tools/connections.js +2 -2
  168. package/dist/entrypoints/tools/invoker.js +5 -5
  169. package/dist/entrypoints/tools/mcp.js +8 -6
  170. package/dist/entrypoints/tools/toolkit.js +11 -9
  171. package/dist/entrypoints/tools.js +19 -17
  172. package/dist/entrypoints/tracking/contract.js +1 -1
  173. package/dist/entrypoints/tracking/performance.js +3 -3
  174. package/dist/files/client-artifact.d.ts +14 -42
  175. package/dist/files/client-artifact.d.ts.map +1 -1
  176. package/dist/files/client-build.d.ts +57 -0
  177. package/dist/files/client-build.d.ts.map +1 -0
  178. package/dist/files/client-declarations.d.ts +35 -0
  179. package/dist/files/client-declarations.d.ts.map +1 -0
  180. package/dist/files/client-package-contract.d.ts +162 -0
  181. package/dist/files/client-package-contract.d.ts.map +1 -0
  182. package/dist/files/client-package-proof.d.ts +38 -0
  183. package/dist/files/client-package-proof.d.ts.map +1 -0
  184. package/dist/files/client-package.d.ts +17 -0
  185. package/dist/files/client-package.d.ts.map +1 -0
  186. package/dist/files/declaration-specifiers.d.ts +30 -0
  187. package/dist/files/declaration-specifiers.d.ts.map +1 -0
  188. package/dist/{index-v759mzed.js → index-02r5sq9p.js} +36 -23
  189. package/dist/{index-0r15pkjq.js → index-0k1ba0ss.js} +1 -1
  190. package/dist/{index-znd1b57f.js → index-1dn2wjq6.js} +5 -4
  191. package/dist/{index-p06z7g7w.js → index-1p8q0yrt.js} +6 -5
  192. package/dist/{index-wa6h4tz6.js → index-1qwd54n3.js} +6 -5
  193. package/dist/index-2dzc7mv9.js +174 -0
  194. package/dist/index-2mz8hj58.js +155 -0
  195. package/dist/{index-17qgm6xe.js → index-34k82crg.js} +2 -2
  196. package/dist/index-3mcbr8sx.js +349 -0
  197. package/dist/{index-ybdq8kk2.js → index-3y2tzhr8.js} +3 -3
  198. package/dist/{index-fgahdc7s.js → index-5n3a8hd8.js} +5 -3
  199. package/dist/{index-jb4m241t.js → index-6918kxbf.js} +45 -1
  200. package/dist/{index-n3bm7zqq.js → index-6kmjcm81.js} +4 -4
  201. package/dist/{index-akf0xkrm.js → index-78da4g74.js} +1 -1
  202. package/dist/{index-9pv126eh.js → index-7fjbdga8.js} +7 -1
  203. package/dist/{index-zhshhxew.js → index-8jf4bt7v.js} +1 -1
  204. package/dist/{index-p16q492v.js → index-8t9dr41h.js} +18 -5
  205. package/dist/{index-xq4s9mka.js → index-8yt3rwe7.js} +1 -1
  206. package/dist/{index-39c2hj6h.js → index-9c76vfxf.js} +7 -3
  207. package/dist/index-9ft4n9j1.js +432 -0
  208. package/dist/{index-sd4e5x5j.js → index-9wdrwx3b.js} +8 -7
  209. package/dist/{index-z114ax5e.js → index-an7vcmwf.js} +49 -2
  210. package/dist/{index-pzhqydxb.js → index-d04w81fz.js} +1 -1
  211. package/dist/index-d2drhb9c.js +219 -0
  212. package/dist/{index-8gmmdz7k.js → index-dacxr7nf.js} +1 -1
  213. package/dist/{index-dnzxxf8a.js → index-dm6nxkn1.js} +1 -1
  214. package/dist/index-dxft2mnm.js +42 -0
  215. package/dist/{index-rxh3qy4x.js → index-fzd477xk.js} +1 -1
  216. package/dist/{index-xgae0bn7.js → index-g4gstmp1.js} +2 -2
  217. package/dist/{index-athc412x.js → index-g5fgeb6v.js} +1 -1
  218. package/dist/{index-z9d74jmb.js → index-gbhj370g.js} +3 -3
  219. package/dist/{index-3fym4j8n.js → index-gtaaxe9d.js} +1 -1
  220. package/dist/{index-v59pxmf1.js → index-jpecjm30.js} +2 -2
  221. package/dist/index-k9g061ma.js +164 -0
  222. package/dist/{index-669374qc.js → index-ma26mfnt.js} +84 -315
  223. package/dist/{index-ryxb427v.js → index-msxf2r8x.js} +16 -3
  224. package/dist/{index-rbd2rq3z.js → index-nr4fhfn4.js} +1 -1
  225. package/dist/{index-qa2jjb65.js → index-pbekeqzm.js} +1 -1
  226. package/dist/{index-mkfhpk11.js → index-pq6g1k9t.js} +2 -2
  227. package/dist/{index-gya4hwh3.js → index-pws5c3x6.js} +21 -1
  228. package/dist/{index-x2fb37t0.js → index-q427q23r.js} +3 -2
  229. package/dist/{index-jcrj0b8z.js → index-qggqqja2.js} +39 -2
  230. package/dist/{index-jxtg307y.js → index-rkjfzs0a.js} +1 -1
  231. package/dist/{index-5tdc0q43.js → index-rw8ze745.js} +5 -3
  232. package/dist/index-s43tr4my.js +129 -0
  233. package/dist/{index-f9p62ean.js → index-stpy56r3.js} +175 -249
  234. package/dist/index-t5g5rm9n.js +213 -0
  235. package/dist/{index-z20pdxeb.js → index-tmv3ez1h.js} +3 -3
  236. package/dist/{index-dcsxj68j.js → index-tqjamnax.js} +1 -1
  237. package/dist/{index-j15dhkda.js → index-wddcfbng.js} +1 -325
  238. package/dist/{index-9sfhje6y.js → index-wh70tmpd.js} +24 -234
  239. package/dist/index-wxjv4sqx.js +82 -0
  240. package/dist/{index-qhjmmsm2.js → index-x46y9z26.js} +2 -2
  241. package/dist/{index-nk0cy9g1.js → index-y53cqwke.js} +1 -1
  242. package/dist/{index-sv5svtq7.js → index-y68gavb5.js} +1 -1
  243. package/dist/{index-5y7j383h.js → index-yrhw10ef.js} +1 -1
  244. package/dist/process/bootstrap.d.ts +12 -0
  245. package/dist/process/bootstrap.d.ts.map +1 -0
  246. package/dist/process/owner-loss-guard.d.ts +2 -9
  247. package/dist/process/owner-loss-guard.d.ts.map +1 -1
  248. package/dist/process/work-root.d.ts +20 -0
  249. package/dist/process/work-root.d.ts.map +1 -0
  250. package/dist/server/contract-identity.d.ts.map +1 -1
  251. package/dist/server/contract-method.d.ts +12 -0
  252. package/dist/server/contract-method.d.ts.map +1 -1
  253. package/dist/server/implement.d.ts.map +1 -1
  254. package/dist/server/openapi.d.ts.map +1 -1
  255. package/dist/server/types.d.ts +10 -9
  256. package/dist/server/types.d.ts.map +1 -1
  257. package/dist/service-host/host-adapter.d.ts +2 -0
  258. package/dist/service-host/host-adapter.d.ts.map +1 -1
  259. package/dist/service-host/work/command.d.ts +72 -0
  260. package/dist/service-host/work/command.d.ts.map +1 -0
  261. package/dist/service-host/work/errors.d.ts +29 -0
  262. package/dist/service-host/work/errors.d.ts.map +1 -0
  263. package/dist/service-host/work/host.d.ts +38 -0
  264. package/dist/service-host/work/host.d.ts.map +1 -0
  265. package/dist/service-host/work/launch.d.ts +51 -0
  266. package/dist/service-host/work/launch.d.ts.map +1 -0
  267. package/dist/service-host/work/membership.d.ts +51 -0
  268. package/dist/service-host/work/membership.d.ts.map +1 -0
  269. package/dist/service-host/work/origin.d.ts +79 -0
  270. package/dist/service-host/work/origin.d.ts.map +1 -0
  271. package/dist/service-host/work/owner.d.ts +45 -0
  272. package/dist/service-host/work/owner.d.ts.map +1 -0
  273. package/dist/service-host/work/placement.d.ts +55 -0
  274. package/dist/service-host/work/placement.d.ts.map +1 -0
  275. package/dist/service-host/work/probe.d.ts +24 -0
  276. package/dist/service-host/work/probe.d.ts.map +1 -0
  277. package/dist/service-host/work/scope-command.d.ts +68 -0
  278. package/dist/service-host/work/scope-command.d.ts.map +1 -0
  279. package/dist/sync/session.d.ts +4 -1
  280. package/dist/sync/session.d.ts.map +1 -1
  281. package/dist/testing/surface-manifest-digest.d.ts +2 -0
  282. package/dist/testing/surface-manifest-digest.d.ts.map +1 -1
  283. package/dist/testing/surface-manifest.d.ts +32 -3
  284. package/dist/testing/surface-manifest.d.ts.map +1 -1
  285. package/dist/tools/agent.d.ts +2 -0
  286. package/dist/tools/agent.d.ts.map +1 -1
  287. package/dist/tools/cli/stream-surface.d.ts.map +1 -1
  288. package/dist/tools/internal/mcp-projection.d.ts +58 -0
  289. package/dist/tools/internal/mcp-projection.d.ts.map +1 -0
  290. package/dist/tools/internal/surface-projector.d.ts +3 -47
  291. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  292. package/dist/tools/invoker.d.ts +2 -0
  293. package/dist/tools/invoker.d.ts.map +1 -1
  294. package/dist/tools/manifest.d.ts +2 -0
  295. package/dist/tools/manifest.d.ts.map +1 -1
  296. package/dist/tools/mcp/handler.d.ts.map +1 -1
  297. package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -1
  298. package/dist/tools/mcp/mount.d.ts +4 -0
  299. package/dist/tools/mcp/mount.d.ts.map +1 -1
  300. package/dist/tools/mcp/prepare.d.ts +5 -2
  301. package/dist/tools/mcp/prepare.d.ts.map +1 -1
  302. package/dist/tools/mount.d.ts +2 -0
  303. package/dist/tools/mount.d.ts.map +1 -1
  304. package/dist/tools/remote.d.ts.map +1 -1
  305. package/dist/tools/schema/nesting-limit.d.ts +8 -0
  306. package/dist/tools/schema/nesting-limit.d.ts.map +1 -0
  307. package/dist/tools/schema/presentation.d.ts +7 -0
  308. package/dist/tools/schema/presentation.d.ts.map +1 -1
  309. package/dist/tools/surface.d.ts.map +1 -1
  310. package/llms/agent-executor-acp.txt +3 -3
  311. package/llms/agent-executor-claude-sdk.txt +1 -1
  312. package/llms/agent-executor-claude.txt +1 -1
  313. package/llms/agent-executor-codex.txt +1 -1
  314. package/llms/agent-executor-testing-claude-sdk.txt +28 -0
  315. package/llms/agent-executor-testing.txt +7 -8
  316. package/llms/agent-executor.txt +27 -4
  317. package/llms/agent-runtime.txt +1 -1
  318. package/llms/contract.txt +8 -2
  319. package/llms/files-packaging.txt +11 -6
  320. package/llms/process-bootstrap.txt +18 -0
  321. package/llms/process.2.txt +215 -18
  322. package/llms/process.txt +130 -92
  323. package/llms/server.4.txt +49 -1
  324. package/llms/service-host-work.txt +34 -0
  325. package/llms/stitchkit.2.txt +31 -0
  326. package/llms/stitchkit.txt +78 -75
  327. package/llms/sync.txt +5 -2
  328. package/llms/testing.txt +1 -0
  329. package/llms/tools.2.txt +747 -775
  330. package/llms/tools.3.txt +846 -210
  331. package/llms/tools.4.txt +226 -0
  332. package/llms/tools.txt +3 -790
  333. package/llms/{upgrading-0.128.0-0.132.0.txt → upgrading-0.128.0-0.133.0.txt} +194 -6
  334. package/llms/upgrading.txt +1 -1
  335. package/llms-full.txt +746 -135
  336. package/llms.txt +18 -16
  337. package/package.json +12 -4
  338. package/dist/entrypoints/process/owner-loss.d.ts +0 -3
  339. package/dist/entrypoints/process/owner-loss.d.ts.map +0 -1
  340. package/dist/entrypoints/process/owner-loss.js +0 -7
  341. package/llms/process-owner-loss.txt +0 -18
@@ -16,11 +16,23 @@ import {
16
16
  ArtifactManifestSchema2,
17
17
  computeSha256Hex,
18
18
  computeArtifactManifestDigest2,
19
+ sameHostPath
20
+ } from "../index-d2drhb9c.js";
21
+ import"../index-6kec3b14.js";
22
+ import {
23
+ probeLiveness,
24
+ ProcessInstanceSchema2,
25
+ sameProcessInstance,
26
+ observeProcessInstance2,
27
+ observeProcessInstanceAt,
28
+ probeProcessOwner2,
29
+ probeProcessOwnerWith
30
+ } from "../index-673drwkn.js";
31
+ import"../index-jpecjm30.js";
32
+ import"../index-pbekeqzm.js";
33
+ import {
19
34
  isProcessGoneError,
20
35
  classifyOwnerEvidence,
21
- isAbsoluteNormalPath,
22
- sameHostPath,
23
- createBaseServiceHostAdapter,
24
36
  extractPlistLabel,
25
37
  LaunchdJobError2,
26
38
  LaunchdKeepAliveSchema2,
@@ -34,25 +46,44 @@ import {
34
46
  assertAbsolutePlistPath,
35
47
  lintLaunchdPlist2,
36
48
  readLaunchdPlist2
37
- } from "../index-9sfhje6y.js";
38
- import"../index-6kec3b14.js";
49
+ } from "../index-wh70tmpd.js";
39
50
  import {
40
- probeLiveness,
41
- ProcessInstanceSchema2,
42
- sameProcessInstance,
43
- observeProcessInstance2,
44
- observeProcessInstanceAt,
45
- probeProcessOwner2,
46
- probeProcessOwnerWith
47
- } from "../index-673drwkn.js";
48
- import"../index-v59pxmf1.js";
49
- import"../index-qa2jjb65.js";
51
+ SystemdScopeSchema2,
52
+ SystemdUnitError2,
53
+ OCTAL_MODE_PATTERN,
54
+ EXEC_PREFIX,
55
+ EXEC_PREFIX_MESSAGE,
56
+ SystemdTimespanSchema,
57
+ SystemdTimeoutSchema,
58
+ SystemdBindReadOnlyPathSchema,
59
+ SystemdSuccessExitStatusItemSchema,
60
+ SystemdAddressFamilySchema,
61
+ assertCleanValue,
62
+ formatSystemdExecLine,
63
+ formatSystemdEnvironmentLine,
64
+ formatSystemdScalar,
65
+ formatSystemdDuration,
66
+ toStringList,
67
+ formatRelativeManagedDirectory,
68
+ formatBindReadOnlyPath,
69
+ DEFAULT_SYSTEMD_UNIT_MODE,
70
+ SYSTEMCTL_PATH,
71
+ createDefaultSystemdHostAdapter2,
72
+ assertValidSystemdUnitName,
73
+ assertSystemdUnitPath,
74
+ systemdScopeArgs,
75
+ resolveUnitSearchDirs,
76
+ foreignUnitSource,
77
+ checkSystemdUnit2,
78
+ systemdUnitActive2,
79
+ systemdMainPid2
80
+ } from "../index-9ft4n9j1.js";
50
81
  import {
51
82
  PolledJsonFile2
52
83
  } from "../index-j0ef04jw.js";
53
84
  import {
54
85
  runNativeCommand2
55
- } from "../index-pzhqydxb.js";
86
+ } from "../index-d04w81fz.js";
56
87
  import {
57
88
  messageOf
58
89
  } from "../index-r9kq5ark.js";
@@ -1723,429 +1754,8 @@ async function reloadLaunchdJob(options) {
1723
1754
  throw new LaunchdJobError2(code, message, { cause, rolledBack, rollbackError });
1724
1755
  }
1725
1756
  }
1726
- // src/service-host/systemd-inspect.ts
1727
- import { readdir as readdir2 } from "node:fs/promises";
1728
- import { dirname as dirname2, join as join3, posix } from "node:path";
1729
-
1730
- // src/service-host/systemd-render-shared.ts
1731
- import { z as z2 } from "zod";
1732
- var SystemdScopeSchema = z2.enum(["system", "user"]);
1733
-
1734
- class SystemdUnitError extends Error {
1735
- code;
1736
- rolledBack;
1737
- rollbackError;
1738
- foreignDropIns;
1739
- constructor(code, message, options) {
1740
- super(message, options);
1741
- this.name = "SystemdUnitError";
1742
- this.code = code;
1743
- this.rolledBack = options?.rolledBack ?? false;
1744
- this.rollbackError = options?.rollbackError;
1745
- this.foreignDropIns = options?.foreignDropIns;
1746
- }
1747
- }
1748
- var OCTAL_MODE_PATTERN = /^[0-7]{3,4}$/;
1749
- var ENV_KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
1750
- var EXEC_PREFIX = /^[-@:+!]/;
1751
- var EXEC_PREFIX_MESSAGE = "the executable must not start with one of systemd's prefixes (-, @, :, +, !): quoting does not disarm them";
1752
- var SYSTEMD_TIMESPAN_UNIT = "(?:usec|us|msec|ms|seconds|second|sec|s|minutes|minute|min|m|hours|hour|hr|h|days|day|d|weeks|week|w|months|month|M|years|year|y)";
1753
- var SYSTEMD_TIMESPAN_PATTERN = new RegExp(`^\\d+(?:\\.\\d+)?${SYSTEMD_TIMESPAN_UNIT}?(?:\\s+\\d+(?:\\.\\d+)?${SYSTEMD_TIMESPAN_UNIT}?)*$`);
1754
- var SYSTEMD_SIGNAL_PATTERN = /^(?:SIG)?(?:HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR1|SEGV|USR2|PIPE|ALRM|TERM|CHLD|CONT|STOP|TSTP|TTIN|TTOU|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS)$/;
1755
- var MAX_SYSTEMD_INTERVAL_SECONDS = 18446744073708;
1756
- var SystemdIntervalSecondsSchema = z2.number().finite().nonnegative().max(MAX_SYSTEMD_INTERVAL_SECONDS);
1757
- var SystemdTimespanSchema = z2.union([
1758
- SystemdIntervalSecondsSchema,
1759
- z2.string().regex(SYSTEMD_TIMESPAN_PATTERN, "must be a valid systemd timespan")
1760
- ]);
1761
- var SystemdTimeoutSchema = z2.union([
1762
- SystemdIntervalSecondsSchema,
1763
- z2.literal("infinity"),
1764
- z2.string().regex(SYSTEMD_TIMESPAN_PATTERN, 'must be a valid systemd timespan or "infinity"')
1765
- ]);
1766
- var SystemdBindReadOnlyPathSchema = z2.union([
1767
- z2.string().min(1),
1768
- z2.strictObject({
1769
- source: z2.string().min(1),
1770
- target: z2.string().min(1).optional(),
1771
- ignoreMissing: z2.boolean().optional()
1772
- })
1773
- ]);
1774
- var SystemdSuccessExitStatusItemSchema = z2.union([
1775
- z2.number().int().min(0).max(255),
1776
- z2.string().regex(SYSTEMD_SIGNAL_PATTERN, "must be an exit code 0..255 or POSIX signal name")
1777
- ]);
1778
- var SystemdAddressFamilySchema = z2.union([
1779
- z2.literal("none"),
1780
- z2.string().regex(/^AF_[A-Z0-9_]+$/, 'must be "none" or an AF_* address family')
1781
- ]);
1782
- function hasLineBreakOrNul(value) {
1783
- return value.includes(`
1784
- `) || value.includes("\r") || value.includes("\x00");
1785
- }
1786
- function assertCleanValue(field, value) {
1787
- if (hasLineBreakOrNul(value)) {
1788
- throw new SystemdUnitError("INVALID_CONFIG", `Systemd field '${field}' must not contain newline, carriage return, or NUL characters`);
1789
- }
1790
- }
1791
- function assertNoWhitespace(field, value) {
1792
- if (/\s/.test(value)) {
1793
- throw new SystemdUnitError("INVALID_CONFIG", `Systemd field '${field}' must not contain whitespace: ${JSON.stringify(value)}`);
1794
- }
1795
- }
1796
- function escapeSystemdSpecifiers(value, allowHomeSpecifier) {
1797
- if (!allowHomeSpecifier)
1798
- return value.replaceAll("%", "%%");
1799
- let result = "";
1800
- for (let index = 0;index < value.length; index += 1) {
1801
- const ch = value[index];
1802
- if (ch === "%") {
1803
- const next = value[index + 1];
1804
- if (next === "%") {
1805
- result += "%%%%";
1806
- index += 1;
1807
- } else if (next === "h") {
1808
- result += "%h";
1809
- index += 1;
1810
- } else {
1811
- result += "%%";
1812
- }
1813
- } else {
1814
- result += ch;
1815
- }
1816
- }
1817
- return result;
1818
- }
1819
- function formatSystemdExecToken(field, token, allowHomeSpecifier) {
1820
- assertCleanValue(field, token);
1821
- const specEscaped = escapeSystemdSpecifiers(token, allowHomeSpecifier);
1822
- const safeDollar = specEscaped.replaceAll("$", "$$$$");
1823
- const needsQuotes = token.length === 0 || /[\s"'\\;]/.test(token);
1824
- if (!needsQuotes)
1825
- return safeDollar;
1826
- const quoted = safeDollar.replaceAll("\\", "\\\\").replaceAll('"', "\\\"");
1827
- return `"${quoted}"`;
1828
- }
1829
- function formatSystemdExecLine(field, argv, allowHomeSpecifier) {
1830
- return argv.map((token, index) => formatSystemdExecToken(`${field}[${index}]`, token, allowHomeSpecifier)).join(" ");
1831
- }
1832
- function formatSystemdEnvironmentLine(key, value, allowHomeSpecifier) {
1833
- if (!ENV_KEY_PATTERN.test(key)) {
1834
- throw new SystemdUnitError("INVALID_CONFIG", `Invalid systemd environment variable name: ${JSON.stringify(key)}`);
1835
- }
1836
- assertCleanValue(`environment.${key}`, value);
1837
- const specEscaped = escapeSystemdSpecifiers(value, allowHomeSpecifier);
1838
- const quoted = specEscaped.replaceAll("\\", "\\\\").replaceAll('"', "\\\"");
1839
- return `Environment="${key}=${quoted}"`;
1840
- }
1841
- function formatSystemdScalar(field, value, allowHomeSpecifier, forbidWhitespace = false) {
1842
- assertCleanValue(field, value);
1843
- if (value.endsWith("\\")) {
1844
- throw new SystemdUnitError("INVALID_CONFIG", `Systemd field '${field}' must not end with a trailing backslash (line continuation)`);
1845
- }
1846
- if (forbidWhitespace)
1847
- assertNoWhitespace(field, value);
1848
- return escapeSystemdSpecifiers(value, allowHomeSpecifier);
1849
- }
1850
- function formatSystemdNumber(value) {
1851
- if (Number.isInteger(value))
1852
- return String(value);
1853
- if (value > 0 && value < 0.000001) {
1854
- throw new SystemdUnitError("INVALID_CONFIG", `Systemd numeric duration ${value} is below microsecond precision and would round to 0`);
1855
- }
1856
- return value.toFixed(6).replace(/\.?0+$/, "");
1857
- }
1858
- function formatSystemdDuration(field, value, forbidWhitespace = false) {
1859
- if (typeof value === "number")
1860
- return formatSystemdNumber(value);
1861
- return formatSystemdScalar(field, value, false, forbidWhitespace);
1862
- }
1863
- function toStringList(value) {
1864
- if (value === undefined)
1865
- return [];
1866
- return typeof value === "string" ? [value] : value;
1867
- }
1868
- function formatRelativeManagedDirectory(field, value) {
1869
- assertCleanValue(field, value);
1870
- assertNoWhitespace(field, value);
1871
- if (value.startsWith("/") || value.endsWith("\\") || value.includes(":") || value.includes("\\") || value.split("/").some((seg) => seg === "" || seg === "." || seg === "..")) {
1872
- throw new SystemdUnitError("INVALID_CONFIG", `Systemd field '${field}' must be a relative normal directory name without ':', whitespace, or '..': ${JSON.stringify(value)}`);
1873
- }
1874
- return escapeSystemdSpecifiers(value, false);
1875
- }
1876
- var BIND_FORBIDDEN_CHARS = /[\s:"'\\]/;
1877
- function assertBindPathSegment(field, path) {
1878
- assertCleanValue(field, path);
1879
- if (!isAbsoluteNormalPath(path) || BIND_FORBIDDEN_CHARS.test(path)) {
1880
- throw new SystemdUnitError("INVALID_CONFIG", `Systemd field '${field}' must be an absolute normal path without whitespace, ':', quotes, or backslashes: ${JSON.stringify(path)}`);
1881
- }
1882
- return escapeSystemdSpecifiers(path, false);
1883
- }
1884
- function formatBindReadOnlyPath(field, entry) {
1885
- if (typeof entry === "string") {
1886
- return assertBindPathSegment(field, entry);
1887
- }
1888
- const source = assertBindPathSegment(`${field}.source`, entry.source);
1889
- const target = entry.target !== undefined ? `:${assertBindPathSegment(`${field}.target`, entry.target)}` : "";
1890
- return `${entry.ignoreMissing ? "-" : ""}${source}${target}`;
1891
- }
1892
-
1893
- // src/service-host/systemd-inspect.ts
1894
- var DEFAULT_SYSTEMD_UNIT_MODE = 420;
1895
- var SYSTEMCTL_PATH = "/usr/bin/systemctl";
1896
- var SHOW_PROPERTIES = "LoadState,FragmentPath,DropInPaths,ActiveState,SubState,MainPID,UnitFileState,NeedDaemonReload";
1897
- var SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/;
1898
- function createDefaultSystemdHostAdapter() {
1899
- return {
1900
- ...createBaseServiceHostAdapter({
1901
- defaultFileMode: DEFAULT_SYSTEMD_UNIT_MODE,
1902
- nullOnNonRegularFile: true
1903
- }),
1904
- async listDir(path) {
1905
- try {
1906
- return await readdir2(path);
1907
- } catch (cause) {
1908
- if (errnoOf(cause) === "ENOENT")
1909
- return null;
1910
- throw cause;
1911
- }
1912
- }
1913
- };
1914
- }
1915
- function hasAsciiControlChar(value) {
1916
- for (let index = 0;index < value.length; index += 1) {
1917
- const code = value.charCodeAt(index);
1918
- if (code <= 31 || code === 127)
1919
- return true;
1920
- }
1921
- return false;
1922
- }
1923
- function assertValidSystemdUnitName(unitName) {
1924
- if (unitName.length === 0 || unitName === "." || unitName.startsWith("-") || unitName.includes("/") || unitName.includes("\\") || unitName.includes("..") || /\s/.test(unitName) || hasAsciiControlChar(unitName)) {
1925
- throw new SystemdUnitError("INVALID_CONFIG", `Invalid systemd unit name: ${JSON.stringify(unitName)}`);
1926
- }
1927
- }
1928
- function assertSystemdUnitPath(unitPath) {
1929
- if (!isAbsoluteNormalPath(unitPath)) {
1930
- throw new SystemdUnitError("INVALID_CONFIG", `Unit path must be an absolute, normal path without NUL bytes: ${JSON.stringify(unitPath)}`);
1931
- }
1932
- }
1933
- function systemdScopeArgs(scope, args) {
1934
- const parsed = SystemdScopeSchema.parse(scope);
1935
- return parsed === "user" ? ["--user", ...args] : [...args];
1936
- }
1937
- function parseSystemdProperties(stdout) {
1938
- const map = new Map;
1939
- for (const rawLine of stdout.split(`
1940
- `)) {
1941
- const line = rawLine.trimEnd();
1942
- const eq = line.indexOf("=");
1943
- if (eq <= 0)
1944
- continue;
1945
- map.set(line.slice(0, eq), line.slice(eq + 1));
1946
- }
1947
- return map;
1948
- }
1949
- function parseMainPid(raw) {
1950
- if (!raw)
1951
- return null;
1952
- const trimmed = raw.trim();
1953
- if (!/^\d+$/.test(trimmed))
1954
- return null;
1955
- const pid = Number(trimmed);
1956
- return Number.isSafeInteger(pid) && pid > 0 ? pid : null;
1957
- }
1958
- function parseUnitPathDirs(stdout) {
1959
- const trimmed = stdout.trim();
1960
- if (trimmed.length === 0)
1961
- return [];
1962
- const raw = trimmed.startsWith("UnitPath=") ? trimmed.slice("UnitPath=".length) : trimmed;
1963
- return raw.split(/\s+/).map((entry) => entry.trim()).filter((entry) => entry.startsWith("/"));
1964
- }
1965
- function normalizePosixDir(dir) {
1966
- const normalized = posix.normalize(dir);
1967
- return normalized.length > 1 && normalized.endsWith("/") ? normalized.slice(0, -1) : normalized;
1968
- }
1969
- function isAllowedHostServiceDropIn(unitName, dropInPath, trustedSearchDirs) {
1970
- if (!unitName.endsWith(".service"))
1971
- return false;
1972
- if (!dropInPath.startsWith("/"))
1973
- return false;
1974
- if (dropInPath.includes(".."))
1975
- return false;
1976
- if (posix.normalize(dropInPath) !== dropInPath)
1977
- return false;
1978
- if (!dropInPath.endsWith(".conf"))
1979
- return false;
1980
- const parentDir = posix.dirname(dropInPath);
1981
- if (posix.basename(parentDir) !== "service.d")
1982
- return false;
1983
- const grandParentDir = posix.dirname(parentDir);
1984
- return trustedSearchDirs.has(grandParentDir);
1985
- }
1986
- function templateUnitNameOf(unitName) {
1987
- const atIndex = unitName.indexOf("@");
1988
- if (atIndex <= 0)
1989
- return null;
1990
- const dotIndex = unitName.lastIndexOf(".");
1991
- if (dotIndex <= atIndex + 1)
1992
- return null;
1993
- return `${unitName.slice(0, atIndex + 1)}${unitName.slice(dotIndex)}`;
1994
- }
1995
- async function resolveUnitSearchDirs(unitPath, scope, extraSearchDirs, adapter) {
1996
- const searchDirs = new Set([
1997
- dirname2(unitPath),
1998
- dirname2(await adapter.canonicalPath(unitPath))
1999
- ]);
2000
- const unitPathResult = await adapter.runCommand(SYSTEMCTL_PATH, systemdScopeArgs(scope, ["show", "--no-pager", "--property=UnitPath", "--value"]));
2001
- if (unitPathResult.exitCode !== 0) {
2002
- throw new SystemdUnitError("COMMAND_FAILED", `systemctl show --property=UnitPath failed (exit ${unitPathResult.exitCode}): ${unitPathResult.stderr.trim()}`);
2003
- }
2004
- const managerDirs = parseUnitPathDirs(unitPathResult.stdout);
2005
- if (managerDirs.length > 0) {
2006
- for (const dir of managerDirs)
2007
- searchDirs.add(dir);
2008
- } else if (scope === "system") {
2009
- searchDirs.add("/etc/systemd/system");
2010
- searchDirs.add("/run/systemd/system");
2011
- }
2012
- for (const dir of extraSearchDirs ?? [])
2013
- searchDirs.add(dir);
2014
- return [...searchDirs];
2015
- }
2016
- async function collectForeignDropIns(unitName, unitPath, scope, dropInPathsProp, extraSearchDirs, adapter) {
2017
- const searchDirs = await resolveUnitSearchDirs(unitPath, scope, extraSearchDirs, adapter);
2018
- const trustedSearchDirs = new Set(searchDirs.map(normalizePosixDir));
2019
- const found = new Set;
2020
- if (dropInPathsProp) {
2021
- for (const token of dropInPathsProp.trim().split(/\s+/)) {
2022
- if (token.length === 0)
2023
- continue;
2024
- if (isAllowedHostServiceDropIn(unitName, token, trustedSearchDirs))
2025
- continue;
2026
- found.add(token);
2027
- }
2028
- }
2029
- const templateUnitName = templateUnitNameOf(unitName);
2030
- const dropInDirNames = templateUnitName !== null ? [`${unitName}.d`, `${templateUnitName}.d`] : [`${unitName}.d`];
2031
- for (const dir of searchDirs) {
2032
- for (const dropInDirName of dropInDirNames) {
2033
- const dropInDir = join3(dir, dropInDirName);
2034
- const entries = await adapter.listDir(dropInDir);
2035
- if (!entries)
2036
- continue;
2037
- for (const entry of entries) {
2038
- if (entry.endsWith(".conf"))
2039
- found.add(join3(dropInDir, entry));
2040
- }
2041
- }
2042
- }
2043
- return [...found].sort();
2044
- }
2045
- function foreignUnitSource(check, unitPath) {
2046
- if (check.loadState === "masked")
2047
- return "the unit is masked";
2048
- if (check.loadState === "not-found" || check.fragmentIsUnitPath)
2049
- return;
2050
- if (check.loadState === null)
2051
- return "systemctl show reported no LoadState";
2052
- if (check.fragmentPath === null) {
2053
- return `systemd has it ${check.loadState} with no unit file`;
2054
- }
2055
- return `systemd loads it from ${check.fragmentPath}, not ${unitPath}`;
2056
- }
2057
- function resolveExpectedDigest(options) {
2058
- const hasContent = options.expectedContent !== undefined;
2059
- const hasDigest = options.expectedDigest !== undefined;
2060
- if (hasContent === hasDigest) {
2061
- throw new SystemdUnitError("INVALID_CONFIG", "checkSystemdUnit requires exactly one of expectedContent or expectedDigest");
2062
- }
2063
- if (options.expectedDigest !== undefined) {
2064
- if (!SHA256_HEX_PATTERN.test(options.expectedDigest)) {
2065
- throw new SystemdUnitError("INVALID_CONFIG", `Invalid expectedDigest: expected 64 lowercase hex characters, got ${JSON.stringify(options.expectedDigest)}`);
2066
- }
2067
- return options.expectedDigest;
2068
- }
2069
- return computeSha256Hex(options.expectedContent ?? "");
2070
- }
2071
- async function checkSystemdUnit(options) {
2072
- assertValidSystemdUnitName(options.unitName);
2073
- assertSystemdUnitPath(options.unitPath);
2074
- const expectedDigest = resolveExpectedDigest(options);
2075
- const adapter = options.adapter ?? createDefaultSystemdHostAdapter();
2076
- const existingBytes = await adapter.readFile(options.unitPath);
2077
- const actualDigest = existingBytes === null ? null : computeSha256Hex(existingBytes);
2078
- const showResult = await adapter.runCommand(SYSTEMCTL_PATH, systemdScopeArgs(options.scope, [
2079
- "show",
2080
- "--no-pager",
2081
- `--property=${SHOW_PROPERTIES}`,
2082
- "--",
2083
- options.unitName
2084
- ]));
2085
- if (showResult.exitCode !== 0) {
2086
- throw new SystemdUnitError("COMMAND_FAILED", `systemctl show failed for ${options.unitName} (exit ${showResult.exitCode}): ${showResult.stderr.trim()}`);
2087
- }
2088
- const props = parseSystemdProperties(showResult.stdout);
2089
- const loadState = props.get("LoadState") || null;
2090
- const fragmentPath = props.get("FragmentPath") || null;
2091
- const fragmentIsUnitPath = fragmentPath !== null && await sameHostPath(adapter, fragmentPath, options.unitPath);
2092
- const activeState = props.get("ActiveState") || null;
2093
- const mainPid = parseMainPid(props.get("MainPID"));
2094
- const unitFileState = props.get("UnitFileState") || null;
2095
- const needsReload = props.get("NeedDaemonReload") === "yes";
2096
- const foreignDropIns = await collectForeignDropIns(options.unitName, options.unitPath, options.scope, props.get("DropInPaths"), options.unitSearchDirs, adapter);
2097
- let status;
2098
- if (foreignDropIns.length > 0)
2099
- status = "foreign-drop-in";
2100
- else if (loadState === "masked")
2101
- status = "fragment-mismatch";
2102
- else if (actualDigest === null) {
2103
- status = foreignUnitSource({ loadState, fragmentPath, fragmentIsUnitPath }, options.unitPath) === undefined ? "missing" : "fragment-mismatch";
2104
- } else if (actualDigest !== expectedDigest)
2105
- status = "digest-mismatch";
2106
- else if (loadState !== "loaded" || !fragmentIsUnitPath) {
2107
- status = "fragment-mismatch";
2108
- } else
2109
- status = "matches";
2110
- return {
2111
- ok: status === "matches",
2112
- status,
2113
- expectedDigest,
2114
- actualDigest,
2115
- loadState,
2116
- fragmentPath,
2117
- fragmentIsUnitPath,
2118
- foreignDropIns,
2119
- activeState,
2120
- mainPid,
2121
- unitFileState,
2122
- needsReload
2123
- };
2124
- }
2125
- async function systemdUnitActive(options) {
2126
- assertValidSystemdUnitName(options.unitName);
2127
- const adapter = options.adapter ?? createDefaultSystemdHostAdapter();
2128
- const result = await adapter.runCommand(SYSTEMCTL_PATH, systemdScopeArgs(options.scope, ["is-active", "--", options.unitName]));
2129
- return result.exitCode === 0 && result.stdout.trim() === "active";
2130
- }
2131
- async function systemdMainPid(options) {
2132
- assertValidSystemdUnitName(options.unitName);
2133
- const adapter = options.adapter ?? createDefaultSystemdHostAdapter();
2134
- const result = await adapter.runCommand(SYSTEMCTL_PATH, systemdScopeArgs(options.scope, [
2135
- "show",
2136
- "--no-pager",
2137
- "--property=MainPID",
2138
- "--value",
2139
- "--",
2140
- options.unitName
2141
- ]));
2142
- if (result.exitCode !== 0)
2143
- return null;
2144
- return parseMainPid(result.stdout);
2145
- }
2146
-
2147
1757
  // src/service-host/systemd-links.ts
2148
- import { basename, join as join4 } from "node:path";
1758
+ import { basename, join as join3 } from "node:path";
2149
1759
  var LINK_DIR_SUFFIXES = [".wants", ".requires", ".upholds"];
2150
1760
  var ALSO_LINE = /^[ \t]*Also[ \t]*=(.*)$/;
2151
1761
  function enablementNamesOf(unitName, unitPath, contents) {
@@ -2176,10 +1786,10 @@ async function readEnablementLinks(adapter, dirs, names) {
2176
1786
  };
2177
1787
  for (const dir of dirs) {
2178
1788
  for (const entry of await adapter.listDir(dir) ?? []) {
2179
- const path = join4(dir, entry);
1789
+ const path = join3(dir, entry);
2180
1790
  if (LINK_DIR_SUFFIXES.some((suffix) => entry.endsWith(suffix))) {
2181
1791
  for (const child of await adapter.listDir(path) ?? [])
2182
- await take(join4(path, child), child);
1792
+ await take(join3(path, child), child);
2183
1793
  } else {
2184
1794
  await take(path, entry);
2185
1795
  }
@@ -2190,7 +1800,7 @@ async function readEnablementLinks(adapter, dirs, names) {
2190
1800
  async function restoreEnablementLinks(adapter, unitName, before, now) {
2191
1801
  const changed = [...before].filter(([path, target]) => now.get(path) !== target);
2192
1802
  if (changed.length > 0) {
2193
- throw new SystemdUnitError("COMMAND_FAILED", `cannot put back the enable links of ${unitName}: ${changed.map(([path, target]) => `${path} -> ${target}`).join(", ")} changed during the apply`);
1803
+ throw new SystemdUnitError2("COMMAND_FAILED", `cannot put back the enable links of ${unitName}: ${changed.map(([path, target]) => `${path} -> ${target}`).join(", ")} changed during the apply`);
2194
1804
  }
2195
1805
  const added = [...now.keys()].filter((path) => !before.has(path));
2196
1806
  for (const path of added)
@@ -2206,21 +1816,21 @@ function differentLinks(a, b) {
2206
1816
  async function runSystemctlChecked(adapter, scope, args) {
2207
1817
  const result = await adapter.runCommand(SYSTEMCTL_PATH, systemdScopeArgs(scope, args));
2208
1818
  if (result.exitCode !== 0) {
2209
- throw new SystemdUnitError("COMMAND_FAILED", `systemctl ${args.join(" ")} failed (exit ${result.exitCode}): ${result.stderr.trim()}`);
1819
+ throw new SystemdUnitError2("COMMAND_FAILED", `systemctl ${args.join(" ")} failed (exit ${result.exitCode}): ${result.stderr.trim()}`);
2210
1820
  }
2211
1821
  }
2212
1822
  function assertOwnedRegularPath(unitName, unitPath, standing) {
2213
1823
  if (standing.kind === "symlink" || standing.kind === "other") {
2214
- throw new SystemdUnitError("FOREIGN_FRAGMENT", `Refusing to manage ${unitName}: ${unitPath} is ${standing.kind === "symlink" ? `a symbolic link to ${standing.target}` : "not a regular file"}, not a unit file of ours to replace`, { rolledBack: false });
1824
+ throw new SystemdUnitError2("FOREIGN_FRAGMENT", `Refusing to manage ${unitName}: ${unitPath} is ${standing.kind === "symlink" ? `a symbolic link to ${standing.target}` : "not a regular file"}, not a unit file of ours to replace`, { rolledBack: false });
2215
1825
  }
2216
1826
  }
2217
1827
  function assertNoForeignUnit(unitName, unitPath, check) {
2218
1828
  if (check.foreignDropIns.length > 0) {
2219
- throw new SystemdUnitError("FOREIGN_DROP_IN", `Refusing to manage ${unitName}: foreign drop-ins present (${check.foreignDropIns.join(", ")})`, { rolledBack: false, foreignDropIns: check.foreignDropIns });
1829
+ throw new SystemdUnitError2("FOREIGN_DROP_IN", `Refusing to manage ${unitName}: foreign drop-ins present (${check.foreignDropIns.join(", ")})`, { rolledBack: false, foreignDropIns: check.foreignDropIns });
2220
1830
  }
2221
1831
  const foreign = foreignUnitSource(check, unitPath);
2222
1832
  if (foreign !== undefined) {
2223
- throw new SystemdUnitError("FOREIGN_FRAGMENT", `Refusing to manage ${unitName}: ${foreign}`, { rolledBack: false });
1833
+ throw new SystemdUnitError2("FOREIGN_FRAGMENT", `Refusing to manage ${unitName}: ${foreign}`, { rolledBack: false });
2224
1834
  }
2225
1835
  }
2226
1836
  async function restoreUnitEnablement(adapter, point) {
@@ -2231,18 +1841,18 @@ async function restoreUnitEnablement(adapter, point) {
2231
1841
  }
2232
1842
  const differ = differentLinks(point.linksBefore, await read());
2233
1843
  if (differ.length > 0) {
2234
- throw new SystemdUnitError("COMMAND_FAILED", `the enable links of ${unitName} differ from before the apply: ${differ.join(", ")}`);
1844
+ throw new SystemdUnitError2("COMMAND_FAILED", `the enable links of ${unitName} differ from before the apply: ${differ.join(", ")}`);
2235
1845
  }
2236
1846
  if (point.previousBytes === null)
2237
1847
  return;
2238
1848
  const expected = point.previousUnitFileState;
2239
1849
  if (expected === null) {
2240
- throw new SystemdUnitError("COMMAND_FAILED", `UnitFileState of ${unitName} was unknown before the apply: its enablement cannot be checked`);
1850
+ throw new SystemdUnitError2("COMMAND_FAILED", `UnitFileState of ${unitName} was unknown before the apply: its enablement cannot be checked`);
2241
1851
  }
2242
1852
  const result = await adapter.runCommand(SYSTEMCTL_PATH, systemdScopeArgs(scope, ["is-enabled", "--", unitName]));
2243
1853
  const state = result.stdout.trim();
2244
1854
  if (state !== expected) {
2245
- throw new SystemdUnitError("COMMAND_FAILED", `UnitFileState of ${unitName} is ${state || "unknown"} after rollback, not ${expected}${result.stderr.trim() ? ` (${result.stderr.trim()})` : ""}`);
1855
+ throw new SystemdUnitError2("COMMAND_FAILED", `UnitFileState of ${unitName} is ${state || "unknown"} after rollback, not ${expected}${result.stderr.trim() ? ` (${result.stderr.trim()})` : ""}`);
2246
1856
  }
2247
1857
  }
2248
1858
 
@@ -2254,21 +1864,21 @@ var MAX_WAIT_MS2 = 300000;
2254
1864
  function assertSystemdWaitMs(name, value, allowZero) {
2255
1865
  const min = allowZero ? 0 : 1;
2256
1866
  if (!Number.isSafeInteger(value) || value < min || value > MAX_WAIT_MS2) {
2257
- throw new SystemdUnitError("INVALID_CONFIG", `Invalid ${name}: expected integer in [${min}, ${MAX_WAIT_MS2}], got ${value}`);
1867
+ throw new SystemdUnitError2("INVALID_CONFIG", `Invalid ${name}: expected integer in [${min}, ${MAX_WAIT_MS2}], got ${value}`);
2258
1868
  }
2259
1869
  }
2260
1870
  async function waitForStableSystemdUnit(unitName, scope, adapter, startupTimeoutMs, stabilityMs, pollIntervalMs) {
2261
1871
  const startDeadline = adapter.now() + startupTimeoutMs;
2262
1872
  let candidatePid = null;
2263
1873
  for (;; ) {
2264
- const active = await systemdUnitActive({ unitName, scope, adapter });
2265
- const pid = active ? await systemdMainPid({ unitName, scope, adapter }) : null;
1874
+ const active = await systemdUnitActive2({ unitName, scope, adapter });
1875
+ const pid = active ? await systemdMainPid2({ unitName, scope, adapter }) : null;
2266
1876
  if (active && pid !== null) {
2267
1877
  candidatePid = pid;
2268
1878
  break;
2269
1879
  }
2270
1880
  if (adapter.now() >= startDeadline) {
2271
- throw new SystemdUnitError("START_TIMEOUT", `Systemd unit ${unitName} did not reach active state with MainPID within ${startupTimeoutMs}ms`);
1881
+ throw new SystemdUnitError2("START_TIMEOUT", `Systemd unit ${unitName} did not reach active state with MainPID within ${startupTimeoutMs}ms`);
2272
1882
  }
2273
1883
  await adapter.sleep(Math.min(pollIntervalMs, Math.max(1, startDeadline - adapter.now())));
2274
1884
  }
@@ -2276,10 +1886,10 @@ async function waitForStableSystemdUnit(unitName, scope, adapter, startupTimeout
2276
1886
  const stableDeadline = stableSince + stabilityMs;
2277
1887
  while (adapter.now() < stableDeadline) {
2278
1888
  await adapter.sleep(Math.min(pollIntervalMs, Math.max(1, stableDeadline - adapter.now())));
2279
- const active = await systemdUnitActive({ unitName, scope, adapter });
2280
- const pid = active ? await systemdMainPid({ unitName, scope, adapter }) : null;
1889
+ const active = await systemdUnitActive2({ unitName, scope, adapter });
1890
+ const pid = active ? await systemdMainPid2({ unitName, scope, adapter }) : null;
2281
1891
  if (!active || pid !== candidatePid) {
2282
- throw new SystemdUnitError("UNSTABLE_CANDIDATE", `Systemd unit ${unitName} lost stability during ${stabilityMs}ms window (expected PID ${candidatePid}, observed ${pid ?? "none"})`);
1892
+ throw new SystemdUnitError2("UNSTABLE_CANDIDATE", `Systemd unit ${unitName} lost stability during ${stabilityMs}ms window (expected PID ${candidatePid}, observed ${pid ?? "none"})`);
2283
1893
  }
2284
1894
  }
2285
1895
  return { mainPid: candidatePid, stableForMs: adapter.now() - stableSince };
@@ -2325,8 +1935,8 @@ async function applySystemdUnit(options, defaultEnable) {
2325
1935
  assertSystemdWaitMs("stabilityMs", stabilityMs, true);
2326
1936
  assertSystemdWaitMs("pollIntervalMs", pollIntervalMs, false);
2327
1937
  assertSystemdWaitMs("startupTimeoutMs", startupTimeoutMs, false);
2328
- const adapter = options.adapter ?? createDefaultSystemdHostAdapter();
2329
- const preCheck = await checkSystemdUnit({
1938
+ const adapter = options.adapter ?? createDefaultSystemdHostAdapter2();
1939
+ const preCheck = await checkSystemdUnit2({
2330
1940
  unitName: options.unitName,
2331
1941
  unitPath: options.unitPath,
2332
1942
  expectedContent: options.content,
@@ -2336,7 +1946,7 @@ async function applySystemdUnit(options, defaultEnable) {
2336
1946
  });
2337
1947
  assertNoForeignUnit(options.unitName, options.unitPath, preCheck);
2338
1948
  if (ONESHOT_TYPE.test(options.content)) {
2339
- throw new SystemdUnitError("UNSUPPORTED_UNIT_TYPE", `Refusing to apply ${options.unitName}: Type=oneshot has no main process to hold stable`, { rolledBack: false });
1949
+ throw new SystemdUnitError2("UNSUPPORTED_UNIT_TYPE", `Refusing to apply ${options.unitName}: Type=oneshot has no main process to hold stable`, { rolledBack: false });
2340
1950
  }
2341
1951
  const standing = await adapter.inspectPath(options.unitPath);
2342
1952
  assertOwnedRegularPath(options.unitName, options.unitPath, standing);
@@ -2355,7 +1965,7 @@ async function applySystemdUnit(options, defaultEnable) {
2355
1965
  let didRestart = false;
2356
1966
  try {
2357
1967
  await runSystemctlChecked(adapter, options.scope, ["daemon-reload"]);
2358
- const loaded = await checkSystemdUnit({
1968
+ const loaded = await checkSystemdUnit2({
2359
1969
  unitName: options.unitName,
2360
1970
  unitPath: options.unitPath,
2361
1971
  expectedContent: options.content,
@@ -2364,7 +1974,7 @@ async function applySystemdUnit(options, defaultEnable) {
2364
1974
  adapter
2365
1975
  });
2366
1976
  if (loaded.status !== "matches") {
2367
- throw new SystemdUnitError("FOREIGN_FRAGMENT", `systemd did not load ${options.unitPath} for ${options.unitName} (${loaded.status}, LoadState=${loaded.loadState ?? "unknown"}, FragmentPath=${loaded.fragmentPath ?? "none"})`);
1977
+ throw new SystemdUnitError2("FOREIGN_FRAGMENT", `systemd did not load ${options.unitPath} for ${options.unitName} (${loaded.status}, LoadState=${loaded.loadState ?? "unknown"}, FragmentPath=${loaded.fragmentPath ?? "none"})`);
2368
1978
  }
2369
1979
  if (enable) {
2370
1980
  didEnable = true;
@@ -2398,10 +2008,10 @@ async function applySystemdUnit(options, defaultEnable) {
2398
2008
  } catch (rbError) {
2399
2009
  rollbackError = rbError;
2400
2010
  }
2401
- const code = cause instanceof SystemdUnitError ? cause.code : "COMMAND_FAILED";
2011
+ const code = cause instanceof SystemdUnitError2 ? cause.code : "COMMAND_FAILED";
2402
2012
  const baseMessage = messageOf(cause);
2403
2013
  const message = !rolledBack && rollbackError !== undefined ? `${baseMessage}; rollback also failed: ${messageOf(rollbackError)}` : baseMessage;
2404
- throw new SystemdUnitError(code, message, { cause, rolledBack, rollbackError });
2014
+ throw new SystemdUnitError2(code, message, { cause, rolledBack, rollbackError });
2405
2015
  }
2406
2016
  }
2407
2017
  function installAndStartSystemdUnit(options) {
@@ -2411,20 +2021,20 @@ function reloadSystemdUnit(options) {
2411
2021
  return applySystemdUnit(options, false);
2412
2022
  }
2413
2023
  // src/service-host/systemd-render.ts
2414
- import { z as z3 } from "zod";
2415
- var SystemdServiceUnitConfigSchema = z3.strictObject({
2416
- description: z3.string().min(1),
2417
- scope: SystemdScopeSchema.default("system"),
2418
- execStart: z3.array(z3.string()).min(1),
2419
- execStartPre: z3.array(z3.array(z3.string()).min(1)).optional(),
2420
- workingDirectory: z3.string().min(1).optional(),
2421
- environment: z3.record(z3.string(), z3.string()).optional(),
2422
- environmentFile: z3.union([z3.string().min(1), z3.array(z3.string().min(1))]).optional(),
2423
- user: z3.string().min(1).optional(),
2424
- group: z3.string().min(1).optional(),
2425
- dynamicUser: z3.boolean().optional(),
2426
- type: z3.enum(["simple", "exec", "forking", "oneshot", "notify"]).optional(),
2427
- restart: z3.enum([
2024
+ import { z as z2 } from "zod";
2025
+ var SystemdServiceUnitConfigSchema = z2.strictObject({
2026
+ description: z2.string().min(1),
2027
+ scope: SystemdScopeSchema2.default("system"),
2028
+ execStart: z2.array(z2.string()).min(1),
2029
+ execStartPre: z2.array(z2.array(z2.string()).min(1)).optional(),
2030
+ workingDirectory: z2.string().min(1).optional(),
2031
+ environment: z2.record(z2.string(), z2.string()).optional(),
2032
+ environmentFile: z2.union([z2.string().min(1), z2.array(z2.string().min(1))]).optional(),
2033
+ user: z2.string().min(1).optional(),
2034
+ group: z2.string().min(1).optional(),
2035
+ dynamicUser: z2.boolean().optional(),
2036
+ type: z2.enum(["simple", "exec", "forking", "oneshot", "notify"]).optional(),
2037
+ restart: z2.enum([
2428
2038
  "no",
2429
2039
  "on-success",
2430
2040
  "on-failure",
@@ -2433,34 +2043,34 @@ var SystemdServiceUnitConfigSchema = z3.strictObject({
2433
2043
  "on-abort",
2434
2044
  "always"
2435
2045
  ]).optional(),
2436
- restartSec: z3.union([z3.number().nonnegative(), z3.string().min(1)]).optional(),
2046
+ restartSec: z2.union([z2.number().nonnegative(), z2.string().min(1)]).optional(),
2437
2047
  startLimitIntervalSec: SystemdTimespanSchema.optional(),
2438
- successExitStatus: z3.array(SystemdSuccessExitStatusItemSchema).min(1).optional(),
2048
+ successExitStatus: z2.array(SystemdSuccessExitStatusItemSchema).min(1).optional(),
2439
2049
  timeoutStartSec: SystemdTimeoutSchema.optional(),
2440
- timeoutStopSec: z3.union([z3.number().positive(), z3.string().min(1)]).optional(),
2441
- killMode: z3.enum(["control-group", "mixed", "process", "none"]).optional(),
2442
- oomScoreAdjust: z3.number().int().min(-1000).max(1000).optional(),
2443
- oomPolicy: z3.enum(["continue", "stop", "kill"]).optional(),
2444
- ioAccounting: z3.boolean().optional(),
2445
- nice: z3.number().int().min(-20).max(19).optional(),
2446
- ioSchedulingClass: z3.enum(["none", "realtime", "best-effort", "idle"]).optional(),
2447
- umask: z3.string().regex(OCTAL_MODE_PATTERN).optional(),
2448
- noNewPrivileges: z3.boolean().optional(),
2449
- privateNetwork: z3.boolean().optional(),
2450
- privateTmp: z3.boolean().optional(),
2451
- protectSystem: z3.union([z3.boolean(), z3.enum(["full", "strict"])]).optional(),
2452
- protectHome: z3.union([z3.boolean(), z3.enum(["read-only", "tmpfs"])]).optional(),
2453
- restrictAddressFamilies: z3.array(SystemdAddressFamilySchema).min(1).optional(),
2454
- bindReadOnlyPaths: z3.array(SystemdBindReadOnlyPathSchema).min(1).optional(),
2455
- runtimeDirectory: z3.union([z3.string().min(1), z3.array(z3.string().min(1))]).optional(),
2456
- runtimeDirectoryMode: z3.string().regex(OCTAL_MODE_PATTERN).optional(),
2457
- stateDirectory: z3.union([z3.string().min(1), z3.array(z3.string().min(1)).min(1)]).optional(),
2458
- stateDirectoryMode: z3.string().regex(OCTAL_MODE_PATTERN).optional(),
2459
- limitNOFILE: z3.union([z3.number().int().positive(), z3.literal("infinity")]).optional(),
2460
- after: z3.array(z3.string().min(1)).optional(),
2461
- wants: z3.array(z3.string().min(1)).optional(),
2462
- wantedBy: z3.array(z3.string().min(1)).optional(),
2463
- allowHomeSpecifier: z3.boolean().default(false)
2050
+ timeoutStopSec: z2.union([z2.number().positive(), z2.string().min(1)]).optional(),
2051
+ killMode: z2.enum(["control-group", "mixed", "process", "none"]).optional(),
2052
+ oomScoreAdjust: z2.number().int().min(-1000).max(1000).optional(),
2053
+ oomPolicy: z2.enum(["continue", "stop", "kill"]).optional(),
2054
+ ioAccounting: z2.boolean().optional(),
2055
+ nice: z2.number().int().min(-20).max(19).optional(),
2056
+ ioSchedulingClass: z2.enum(["none", "realtime", "best-effort", "idle"]).optional(),
2057
+ umask: z2.string().regex(OCTAL_MODE_PATTERN).optional(),
2058
+ noNewPrivileges: z2.boolean().optional(),
2059
+ privateNetwork: z2.boolean().optional(),
2060
+ privateTmp: z2.boolean().optional(),
2061
+ protectSystem: z2.union([z2.boolean(), z2.enum(["full", "strict"])]).optional(),
2062
+ protectHome: z2.union([z2.boolean(), z2.enum(["read-only", "tmpfs"])]).optional(),
2063
+ restrictAddressFamilies: z2.array(SystemdAddressFamilySchema).min(1).optional(),
2064
+ bindReadOnlyPaths: z2.array(SystemdBindReadOnlyPathSchema).min(1).optional(),
2065
+ runtimeDirectory: z2.union([z2.string().min(1), z2.array(z2.string().min(1))]).optional(),
2066
+ runtimeDirectoryMode: z2.string().regex(OCTAL_MODE_PATTERN).optional(),
2067
+ stateDirectory: z2.union([z2.string().min(1), z2.array(z2.string().min(1)).min(1)]).optional(),
2068
+ stateDirectoryMode: z2.string().regex(OCTAL_MODE_PATTERN).optional(),
2069
+ limitNOFILE: z2.union([z2.number().int().positive(), z2.literal("infinity")]).optional(),
2070
+ after: z2.array(z2.string().min(1)).optional(),
2071
+ wants: z2.array(z2.string().min(1)).optional(),
2072
+ wantedBy: z2.array(z2.string().min(1)).optional(),
2073
+ allowHomeSpecifier: z2.boolean().default(false)
2464
2074
  }).check((ctx) => {
2465
2075
  const value = ctx.value;
2466
2076
  if ((value.execStart[0] ?? "").length === 0) {
@@ -2677,7 +2287,7 @@ function renderInstallSection(parsed) {
2677
2287
  function renderSystemdServiceUnit(config) {
2678
2288
  const parsedResult = SystemdServiceUnitConfigSchema.safeParse(config);
2679
2289
  if (!parsedResult.success) {
2680
- throw new SystemdUnitError("INVALID_CONFIG", `Invalid systemd unit configuration: ${parsedResult.error.message}`, { cause: parsedResult.error });
2290
+ throw new SystemdUnitError2("INVALID_CONFIG", `Invalid systemd unit configuration: ${parsedResult.error.message}`, { cause: parsedResult.error });
2681
2291
  }
2682
2292
  const parsed = parsedResult.data;
2683
2293
  const allowHome = parsed.allowHomeSpecifier;
@@ -2750,10 +2360,10 @@ function assertPairNames(serviceUnitName, timerUnitName) {
2750
2360
  assertValidSystemdUnitName(serviceUnitName);
2751
2361
  assertValidSystemdUnitName(timerUnitName);
2752
2362
  if (!serviceUnitName.endsWith(".service")) {
2753
- throw new SystemdUnitError("INVALID_CONFIG", `serviceUnitName must end with '.service': ${JSON.stringify(serviceUnitName)}`);
2363
+ throw new SystemdUnitError2("INVALID_CONFIG", `serviceUnitName must end with '.service': ${JSON.stringify(serviceUnitName)}`);
2754
2364
  }
2755
2365
  if (!timerUnitName.endsWith(".timer")) {
2756
- throw new SystemdUnitError("INVALID_CONFIG", `timerUnitName must end with '.timer': ${JSON.stringify(timerUnitName)}`);
2366
+ throw new SystemdUnitError2("INVALID_CONFIG", `timerUnitName must end with '.timer': ${JSON.stringify(timerUnitName)}`);
2757
2367
  }
2758
2368
  }
2759
2369
  function assertTimerTargetsService(timerContent, timerUnitName, serviceUnitName) {
@@ -2775,19 +2385,19 @@ function assertTimerTargetsService(timerContent, timerUnitName, serviceUnitName)
2775
2385
  declared.push((match[1] ?? "").trim());
2776
2386
  }
2777
2387
  if (declared.length > 1) {
2778
- throw new SystemdUnitError("INVALID_CONFIG", `Timer ${timerUnitName} declares multiple Unit= directives in [Timer]`);
2388
+ throw new SystemdUnitError2("INVALID_CONFIG", `Timer ${timerUnitName} declares multiple Unit= directives in [Timer]`);
2779
2389
  }
2780
2390
  const target = declared.length === 1 ? declared[0] : `${timerUnitName.slice(0, -".timer".length)}.service`;
2781
2391
  if (!target || target !== serviceUnitName) {
2782
- throw new SystemdUnitError("INVALID_CONFIG", `Timer ${timerUnitName} targets ${JSON.stringify(target)}, expected ${JSON.stringify(serviceUnitName)}`);
2392
+ throw new SystemdUnitError2("INVALID_CONFIG", `Timer ${timerUnitName} targets ${JSON.stringify(target)}, expected ${JSON.stringify(serviceUnitName)}`);
2783
2393
  }
2784
2394
  }
2785
2395
  async function checkSystemdTimerPair(options) {
2786
2396
  assertPairNames(options.serviceUnitName, options.timerUnitName);
2787
2397
  assertSystemdUnitPath(options.serviceUnitPath);
2788
2398
  assertSystemdUnitPath(options.timerUnitPath);
2789
- const adapter = options.adapter ?? createDefaultSystemdHostAdapter();
2790
- const service = await checkSystemdUnit({
2399
+ const adapter = options.adapter ?? createDefaultSystemdHostAdapter2();
2400
+ const service = await checkSystemdUnit2({
2791
2401
  unitName: options.serviceUnitName,
2792
2402
  unitPath: options.serviceUnitPath,
2793
2403
  ...options.expectedServiceContent !== undefined && {
@@ -2800,7 +2410,7 @@ async function checkSystemdTimerPair(options) {
2800
2410
  ...options.unitSearchDirs ? { unitSearchDirs: options.unitSearchDirs } : {},
2801
2411
  adapter
2802
2412
  });
2803
- const timer = await checkSystemdUnit({
2413
+ const timer = await checkSystemdUnit2({
2804
2414
  unitName: options.timerUnitName,
2805
2415
  unitPath: options.timerUnitPath,
2806
2416
  ...options.expectedTimerContent !== undefined && {
@@ -2844,13 +2454,13 @@ async function activateTimerAfterReload(adapter, options, pre, loaded, wroteTime
2844
2454
  options.timerUnitName
2845
2455
  ]);
2846
2456
  }
2847
- const active = await systemdUnitActive({
2457
+ const active = await systemdUnitActive2({
2848
2458
  unitName: options.timerUnitName,
2849
2459
  scope: options.scope,
2850
2460
  adapter
2851
2461
  });
2852
2462
  if (!active) {
2853
- throw new SystemdUnitError("START_TIMEOUT", `Systemd timer ${options.timerUnitName} is not active after activation`);
2463
+ throw new SystemdUnitError2("START_TIMEOUT", `Systemd timer ${options.timerUnitName} is not active after activation`);
2854
2464
  }
2855
2465
  }
2856
2466
  return {
@@ -2863,7 +2473,7 @@ async function installSystemdTimerPair(options) {
2863
2473
  assertSystemdUnitPath(options.serviceUnitPath);
2864
2474
  assertSystemdUnitPath(options.timerUnitPath);
2865
2475
  assertTimerTargetsService(options.timerContent, options.timerUnitName, options.serviceUnitName);
2866
- const adapter = options.adapter ?? createDefaultSystemdHostAdapter();
2476
+ const adapter = options.adapter ?? createDefaultSystemdHostAdapter2();
2867
2477
  const mode = options.mode ?? DEFAULT_SYSTEMD_UNIT_MODE;
2868
2478
  const enable = options.enable ?? true;
2869
2479
  const start = options.start ?? true;
@@ -2938,10 +2548,10 @@ async function installSystemdTimerPair(options) {
2938
2548
  adapter
2939
2549
  });
2940
2550
  if (!loaded.service.ok) {
2941
- throw new SystemdUnitError("FOREIGN_FRAGMENT", `systemd did not load ${options.serviceUnitPath} for ${options.serviceUnitName} (${loaded.service.status})`);
2551
+ throw new SystemdUnitError2("FOREIGN_FRAGMENT", `systemd did not load ${options.serviceUnitPath} for ${options.serviceUnitName} (${loaded.service.status})`);
2942
2552
  }
2943
2553
  if (!loaded.timer.ok) {
2944
- throw new SystemdUnitError("FOREIGN_FRAGMENT", `systemd did not load ${options.timerUnitPath} for ${options.timerUnitName} (${loaded.timer.status})`);
2554
+ throw new SystemdUnitError2("FOREIGN_FRAGMENT", `systemd did not load ${options.timerUnitPath} for ${options.timerUnitName} (${loaded.timer.status})`);
2945
2555
  }
2946
2556
  const finalState = await activateTimerAfterReload(adapter, options, pre, loaded, wroteTimer, enable, start, {
2947
2557
  onEnable: () => {
@@ -2987,22 +2597,22 @@ async function installSystemdTimerPair(options) {
2987
2597
  } catch (rbError) {
2988
2598
  rollbackError = rbError;
2989
2599
  }
2990
- const code = cause instanceof SystemdUnitError ? cause.code : "COMMAND_FAILED";
2600
+ const code = cause instanceof SystemdUnitError2 ? cause.code : "COMMAND_FAILED";
2991
2601
  const baseMessage = messageOf(cause);
2992
2602
  const message = !rolledBack && rollbackError !== undefined ? `${baseMessage}; rollback also failed: ${messageOf(rollbackError)}` : baseMessage;
2993
- throw new SystemdUnitError(code, message, { cause, rolledBack, rollbackError });
2603
+ throw new SystemdUnitError2(code, message, { cause, rolledBack, rollbackError });
2994
2604
  }
2995
2605
  }
2996
2606
  // src/service-host/systemd-timer-render.ts
2997
- import { z as z4 } from "zod";
2998
- var OnCalendarItemSchema = z4.string().refine((value) => value.trim().length > 0, "onCalendar expression must not be empty");
2999
- var SystemdTimerUnitConfigSchema = z4.strictObject({
3000
- description: z4.string().min(1),
3001
- scope: SystemdScopeSchema.default("system"),
3002
- after: z4.array(z4.string().min(1)).optional(),
3003
- wants: z4.array(z4.string().min(1)).optional(),
3004
- unit: z4.string().min(1).optional(),
3005
- onCalendar: z4.union([OnCalendarItemSchema, z4.array(OnCalendarItemSchema).min(1)]).optional(),
2607
+ import { z as z3 } from "zod";
2608
+ var OnCalendarItemSchema = z3.string().refine((value) => value.trim().length > 0, "onCalendar expression must not be empty");
2609
+ var SystemdTimerUnitConfigSchema = z3.strictObject({
2610
+ description: z3.string().min(1),
2611
+ scope: SystemdScopeSchema2.default("system"),
2612
+ after: z3.array(z3.string().min(1)).optional(),
2613
+ wants: z3.array(z3.string().min(1)).optional(),
2614
+ unit: z3.string().min(1).optional(),
2615
+ onCalendar: z3.union([OnCalendarItemSchema, z3.array(OnCalendarItemSchema).min(1)]).optional(),
3006
2616
  onBootSec: SystemdTimespanSchema.optional(),
3007
2617
  onStartupSec: SystemdTimespanSchema.optional(),
3008
2618
  onActiveSec: SystemdTimespanSchema.optional(),
@@ -3010,9 +2620,9 @@ var SystemdTimerUnitConfigSchema = z4.strictObject({
3010
2620
  onUnitInactiveSec: SystemdTimespanSchema.optional(),
3011
2621
  accuracySec: SystemdTimespanSchema.optional(),
3012
2622
  randomizedDelaySec: SystemdTimespanSchema.optional(),
3013
- persistent: z4.boolean().optional(),
3014
- wantedBy: z4.array(z4.string().min(1)).optional(),
3015
- allowHomeSpecifier: z4.boolean().default(false)
2623
+ persistent: z3.boolean().optional(),
2624
+ wantedBy: z3.array(z3.string().min(1)).optional(),
2625
+ allowHomeSpecifier: z3.boolean().default(false)
3016
2626
  }).check((ctx) => {
3017
2627
  const value = ctx.value;
3018
2628
  const hasTrigger = value.onCalendar !== undefined || value.onBootSec !== undefined || value.onStartupSec !== undefined || value.onActiveSec !== undefined || value.onUnitActiveSec !== undefined || value.onUnitInactiveSec !== undefined;
@@ -3044,7 +2654,7 @@ var SystemdTimerUnitConfigSchema = z4.strictObject({
3044
2654
  function renderSystemdTimerUnit(config) {
3045
2655
  const parsedResult = SystemdTimerUnitConfigSchema.safeParse(config);
3046
2656
  if (!parsedResult.success) {
3047
- throw new SystemdUnitError("INVALID_CONFIG", `Invalid systemd timer configuration: ${parsedResult.error.message}`, { cause: parsedResult.error });
2657
+ throw new SystemdUnitError2("INVALID_CONFIG", `Invalid systemd timer configuration: ${parsedResult.error.message}`, { cause: parsedResult.error });
3048
2658
  }
3049
2659
  const parsed = parsedResult.data;
3050
2660
  const allowHome = parsed.allowHomeSpecifier;
@@ -3121,18 +2731,18 @@ export {
3121
2731
  LaunchdPlistConfigSchema2 as LaunchdPlistConfigSchema,
3122
2732
  LaunchdSessionTypeSchema2 as LaunchdSessionTypeSchema,
3123
2733
  PLUTIL_PATH2 as PLUTIL_PATH,
3124
- SystemdScopeSchema,
2734
+ SystemdScopeSchema2 as SystemdScopeSchema,
3125
2735
  SystemdServiceUnitConfigSchema,
3126
2736
  SystemdTimerUnitConfigSchema,
3127
- SystemdUnitError,
2737
+ SystemdUnitError2 as SystemdUnitError,
3128
2738
  activateVersionedArtifact,
3129
2739
  bootoutLaunchdJob,
3130
2740
  checkSystemdTimerPair,
3131
- checkSystemdUnit,
2741
+ checkSystemdUnit2 as checkSystemdUnit,
3132
2742
  computeArtifactManifestDigest2 as computeArtifactManifestDigest,
3133
2743
  createDefaultLaunchdHostAdapter2 as createDefaultLaunchdHostAdapter,
3134
2744
  createDefaultProcessIdentityAdapter,
3135
- createDefaultSystemdHostAdapter,
2745
+ createDefaultSystemdHostAdapter2 as createDefaultSystemdHostAdapter,
3136
2746
  createPolledJsonConfigSource,
3137
2747
  inspectLaunchdJob,
3138
2748
  installAndStartSystemdUnit,
@@ -3148,8 +2758,8 @@ export {
3148
2758
  renderSystemdTimerUnit,
3149
2759
  rollbackVersionedArtifact,
3150
2760
  startConfigReloader,
3151
- systemdMainPid,
3152
- systemdUnitActive,
2761
+ systemdMainPid2 as systemdMainPid,
2762
+ systemdUnitActive2 as systemdUnitActive,
3153
2763
  verifyArtifactDirectory,
3154
2764
  verifySupervisedProcess
3155
2765
  };