@phnx-labs/agents-cli 0.1.0 → 1.14.1

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 (554) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +283 -372
  3. package/dist/commands/alias.d.ts +11 -0
  4. package/dist/commands/alias.js +117 -0
  5. package/dist/commands/beta.d.ts +2 -0
  6. package/dist/commands/beta.js +53 -0
  7. package/dist/commands/cloud.d.ts +8 -1
  8. package/dist/commands/cloud.js +108 -22
  9. package/dist/commands/commands.d.ts +9 -1
  10. package/dist/commands/commands.js +24 -172
  11. package/dist/commands/daemon.d.ts +8 -1
  12. package/dist/commands/daemon.js +13 -5
  13. package/dist/commands/doctor.d.ts +15 -0
  14. package/dist/commands/doctor.js +132 -0
  15. package/dist/commands/drive.d.ts +8 -1
  16. package/dist/commands/drive.js +20 -3
  17. package/dist/commands/exec.d.ts +8 -1
  18. package/dist/commands/exec.js +96 -27
  19. package/dist/commands/factory.d.ts +19 -0
  20. package/dist/commands/factory.js +71 -0
  21. package/dist/commands/fork.d.ts +8 -1
  22. package/dist/commands/fork.js +11 -4
  23. package/dist/commands/hooks.d.ts +9 -1
  24. package/dist/commands/hooks.js +30 -182
  25. package/dist/commands/init.d.ts +15 -1
  26. package/dist/commands/init.js +168 -74
  27. package/dist/commands/mcp.d.ts +9 -1
  28. package/dist/commands/mcp.js +11 -7
  29. package/dist/commands/models.d.ts +8 -1
  30. package/dist/commands/models.js +16 -4
  31. package/dist/commands/packages.d.ts +8 -1
  32. package/dist/commands/packages.js +13 -7
  33. package/dist/commands/permissions.d.ts +9 -1
  34. package/dist/commands/permissions.js +3 -3
  35. package/dist/commands/plugins.d.ts +8 -1
  36. package/dist/commands/plugins.js +13 -2
  37. package/dist/commands/profiles.d.ts +9 -1
  38. package/dist/commands/profiles.js +56 -7
  39. package/dist/commands/prune.d.ts +22 -0
  40. package/dist/commands/prune.js +191 -0
  41. package/dist/commands/pty.d.ts +1 -1
  42. package/dist/commands/pty.js +2 -1
  43. package/dist/commands/pull.d.ts +8 -1
  44. package/dist/commands/pull.js +58 -128
  45. package/dist/commands/refresh-memory.d.ts +7 -1
  46. package/dist/commands/refresh-memory.js +7 -1
  47. package/dist/commands/repo.d.ts +15 -0
  48. package/dist/commands/repo.js +570 -0
  49. package/dist/commands/resource-view.d.ts +10 -3
  50. package/dist/commands/resource-view.js +18 -5
  51. package/dist/commands/routines.d.ts +8 -1
  52. package/dist/commands/routines.js +17 -4
  53. package/dist/commands/rules.d.ts +9 -1
  54. package/dist/commands/rules.js +16 -11
  55. package/dist/commands/secrets.d.ts +8 -1
  56. package/dist/commands/secrets.js +235 -63
  57. package/dist/commands/sessions-picker.d.ts +2 -1
  58. package/dist/commands/sessions-picker.js +88 -11
  59. package/dist/commands/sessions-tail.d.ts +19 -0
  60. package/dist/commands/sessions-tail.js +235 -0
  61. package/dist/commands/sessions.d.ts +2 -1
  62. package/dist/commands/sessions.js +188 -7
  63. package/dist/commands/skills.d.ts +9 -1
  64. package/dist/commands/skills.js +28 -178
  65. package/dist/commands/status.d.ts +7 -1
  66. package/dist/commands/status.js +7 -1
  67. package/dist/commands/subagents.d.ts +8 -1
  68. package/dist/commands/subagents.js +11 -1
  69. package/dist/commands/sync.d.ts +8 -1
  70. package/dist/commands/sync.js +8 -1
  71. package/dist/commands/teams-picker.d.ts +4 -1
  72. package/dist/commands/teams-picker.js +55 -3
  73. package/dist/commands/teams.d.ts +15 -1
  74. package/dist/commands/teams.js +323 -69
  75. package/dist/commands/usage.d.ts +11 -0
  76. package/dist/commands/usage.js +60 -0
  77. package/dist/commands/utils.d.ts +6 -1
  78. package/dist/commands/utils.js +6 -1
  79. package/dist/commands/versions.d.ts +8 -1
  80. package/dist/commands/versions.js +4 -3
  81. package/dist/commands/view.d.ts +47 -2
  82. package/dist/commands/view.js +317 -24
  83. package/dist/index.d.ts +7 -2
  84. package/dist/index.js +172 -34
  85. package/dist/lib/acp/client.d.ts +31 -0
  86. package/dist/lib/acp/client.js +117 -0
  87. package/dist/lib/acp/harnesses.d.ts +26 -0
  88. package/dist/lib/acp/harnesses.js +65 -0
  89. package/dist/lib/acp/run.d.ts +18 -0
  90. package/dist/lib/acp/run.js +39 -0
  91. package/dist/lib/agents.d.ts +74 -2
  92. package/dist/lib/agents.js +197 -21
  93. package/dist/lib/artifact-actions.d.ts +8 -4
  94. package/dist/lib/artifact-actions.js +8 -6
  95. package/dist/lib/auto-pull-worker.d.ts +11 -0
  96. package/dist/lib/auto-pull-worker.js +121 -0
  97. package/dist/lib/auto-pull.d.ts +31 -0
  98. package/dist/lib/auto-pull.js +97 -0
  99. package/dist/lib/beta.d.ts +23 -0
  100. package/dist/lib/beta.js +90 -0
  101. package/dist/lib/capabilities.d.ts +29 -0
  102. package/dist/lib/capabilities.js +74 -0
  103. package/dist/lib/cloud/codex.d.ts +9 -3
  104. package/dist/lib/cloud/codex.js +53 -13
  105. package/dist/lib/cloud/factory.d.ts +8 -3
  106. package/dist/lib/cloud/factory.js +19 -3
  107. package/dist/lib/cloud/registry.d.ts +10 -1
  108. package/dist/lib/cloud/registry.js +14 -3
  109. package/dist/lib/cloud/rush.d.ts +63 -3
  110. package/dist/lib/cloud/rush.js +273 -20
  111. package/dist/lib/cloud/store.d.ts +13 -1
  112. package/dist/lib/cloud/store.js +23 -4
  113. package/dist/lib/cloud/stream.d.ts +6 -1
  114. package/dist/lib/cloud/stream.js +95 -39
  115. package/dist/lib/cloud/types.d.ts +153 -8
  116. package/dist/lib/cloud/types.js +34 -2
  117. package/dist/lib/command-skills.d.ts +20 -0
  118. package/dist/lib/command-skills.js +142 -0
  119. package/dist/lib/commands.d.ts +22 -2
  120. package/dist/lib/commands.js +51 -11
  121. package/dist/lib/convert.d.ts +10 -1
  122. package/dist/lib/convert.js +9 -1
  123. package/dist/lib/daemon.d.ts +21 -1
  124. package/dist/lib/daemon.js +97 -4
  125. package/dist/lib/drive-sync.d.ts +18 -1
  126. package/dist/lib/drive-sync.js +57 -15
  127. package/dist/lib/exec.d.ts +23 -6
  128. package/dist/lib/exec.js +53 -17
  129. package/dist/lib/fs-walk.d.ts +2 -0
  130. package/dist/lib/fs-walk.js +40 -0
  131. package/dist/lib/fuzzy.d.ts +53 -0
  132. package/dist/lib/fuzzy.js +72 -0
  133. package/dist/lib/gemini-settings.d.ts +4 -0
  134. package/dist/lib/gemini-settings.js +33 -0
  135. package/dist/lib/git.d.ts +12 -2
  136. package/dist/lib/git.js +17 -6
  137. package/dist/lib/help.d.ts +20 -1
  138. package/dist/lib/help.js +45 -6
  139. package/dist/lib/hooks/match.d.ts +32 -0
  140. package/dist/lib/hooks/match.js +120 -0
  141. package/dist/lib/hooks.d.ts +17 -4
  142. package/dist/lib/hooks.js +119 -101
  143. package/dist/lib/manifest.d.ts +6 -1
  144. package/dist/lib/manifest.js +15 -4
  145. package/dist/lib/markdown.d.ts +0 -1
  146. package/dist/lib/markdown.js +6 -1
  147. package/dist/lib/mcp.d.ts +0 -1
  148. package/dist/lib/mcp.js +29 -33
  149. package/dist/lib/memory-compile.d.ts +13 -3
  150. package/dist/lib/memory-compile.js +31 -9
  151. package/dist/lib/memory.d.ts +14 -7
  152. package/dist/lib/memory.js +67 -38
  153. package/dist/lib/migrate.d.ts +8 -0
  154. package/dist/lib/migrate.js +85 -0
  155. package/dist/lib/models.d.ts +10 -4
  156. package/dist/lib/models.js +36 -15
  157. package/dist/lib/onepassword.d.ts +63 -0
  158. package/dist/lib/onepassword.js +186 -0
  159. package/dist/lib/paths.d.ts +8 -0
  160. package/dist/lib/paths.js +20 -0
  161. package/dist/lib/permissions.d.ts +24 -2
  162. package/dist/lib/permissions.js +117 -48
  163. package/dist/lib/picker.d.ts +10 -1
  164. package/dist/lib/picker.js +15 -1
  165. package/dist/lib/plugins.d.ts +7 -1
  166. package/dist/lib/plugins.js +10 -1
  167. package/dist/lib/profiles-presets.d.ts +10 -1
  168. package/dist/lib/profiles-presets.js +9 -1
  169. package/dist/lib/profiles.d.ts +35 -1
  170. package/dist/lib/profiles.js +36 -15
  171. package/dist/lib/pty-client.d.ts +1 -1
  172. package/dist/lib/pty-client.js +0 -1
  173. package/dist/lib/pty-server.d.ts +16 -2
  174. package/dist/lib/pty-server.js +92 -3
  175. package/dist/lib/registry.d.ts +23 -3
  176. package/dist/lib/registry.js +153 -8
  177. package/dist/lib/resources.d.ts +28 -1
  178. package/dist/lib/resources.js +79 -1
  179. package/dist/lib/rotate.d.ts +40 -13
  180. package/dist/lib/rotate.js +238 -40
  181. package/dist/lib/routines.d.ts +29 -1
  182. package/dist/lib/routines.js +32 -5
  183. package/dist/lib/runner.d.ts +14 -1
  184. package/dist/lib/runner.js +22 -3
  185. package/dist/lib/sandbox.d.ts +16 -1
  186. package/dist/lib/sandbox.js +39 -16
  187. package/dist/lib/scheduler.d.ts +8 -1
  188. package/dist/lib/scheduler.js +8 -1
  189. package/dist/lib/secrets/AgentsKeychain.app/Contents/CodeResources +0 -0
  190. package/dist/lib/secrets/AgentsKeychain.app/Contents/Info.plist +22 -0
  191. package/dist/lib/secrets/AgentsKeychain.app/Contents/MacOS/AgentsKeychain +0 -0
  192. package/dist/lib/secrets/AgentsKeychain.app/Contents/_CodeSignature/CodeResources +123 -0
  193. package/dist/lib/secrets/AgentsKeychain.app/Contents/embedded.provisionprofile +0 -0
  194. package/dist/lib/{secrets-bundles.d.ts → secrets/bundles.d.ts} +12 -2
  195. package/dist/lib/{secrets-bundles.js → secrets/bundles.js} +38 -17
  196. package/dist/lib/secrets/index.d.ts +55 -0
  197. package/dist/lib/secrets/index.js +211 -0
  198. package/dist/lib/secrets/profiles.d.ts +10 -0
  199. package/dist/lib/secrets/profiles.js +13 -0
  200. package/dist/lib/session/active.d.ts +43 -0
  201. package/dist/lib/session/active.js +392 -0
  202. package/dist/lib/session/artifacts.d.ts +12 -1
  203. package/dist/lib/session/artifacts.js +25 -5
  204. package/dist/lib/session/cloud.d.ts +30 -0
  205. package/dist/lib/session/cloud.js +121 -0
  206. package/dist/lib/session/db.d.ts +23 -2
  207. package/dist/lib/session/db.js +76 -12
  208. package/dist/lib/session/discover.d.ts +19 -4
  209. package/dist/lib/session/discover.js +344 -48
  210. package/dist/lib/session/parse.d.ts +28 -1
  211. package/dist/lib/session/parse.js +267 -9
  212. package/dist/lib/session/prompt.d.ts +9 -1
  213. package/dist/lib/session/prompt.js +17 -3
  214. package/dist/lib/session/render.d.ts +13 -1
  215. package/dist/lib/session/render.js +20 -1
  216. package/dist/lib/session/team-filter.d.ts +9 -1
  217. package/dist/lib/session/team-filter.js +11 -2
  218. package/dist/lib/session/types.d.ts +16 -2
  219. package/dist/lib/session/types.js +10 -2
  220. package/dist/lib/shims.d.ts +64 -5
  221. package/dist/lib/shims.js +309 -47
  222. package/dist/lib/skills.d.ts +27 -2
  223. package/dist/lib/skills.js +127 -65
  224. package/dist/lib/sqlite.d.ts +43 -0
  225. package/dist/lib/sqlite.js +94 -0
  226. package/dist/lib/state.d.ts +112 -27
  227. package/dist/lib/state.js +320 -148
  228. package/dist/lib/subagents.d.ts +9 -1
  229. package/dist/lib/subagents.js +70 -63
  230. package/dist/lib/sync-manifest.d.ts +81 -0
  231. package/dist/lib/sync-manifest.js +450 -0
  232. package/dist/lib/teams/agents.d.ts +103 -5
  233. package/dist/lib/teams/agents.js +414 -91
  234. package/dist/lib/teams/api.d.ts +26 -3
  235. package/dist/lib/teams/api.js +63 -3
  236. package/dist/lib/teams/debug.d.ts +6 -1
  237. package/dist/lib/teams/debug.js +6 -1
  238. package/dist/lib/teams/file_ops.d.ts +7 -1
  239. package/dist/lib/teams/file_ops.js +7 -1
  240. package/dist/lib/teams/index.d.ts +15 -0
  241. package/dist/lib/teams/index.js +14 -0
  242. package/dist/lib/teams/parsers.d.ts +4 -1
  243. package/dist/lib/teams/parsers.js +11 -1
  244. package/dist/lib/teams/persistence.d.ts +15 -1
  245. package/dist/lib/teams/persistence.js +102 -20
  246. package/dist/lib/teams/registry.d.ts +12 -1
  247. package/dist/lib/teams/registry.js +116 -33
  248. package/dist/lib/teams/summarizer.d.ts +15 -1
  249. package/dist/lib/teams/summarizer.js +14 -1
  250. package/dist/lib/teams/supervisor.d.ts +48 -0
  251. package/dist/lib/teams/supervisor.js +73 -0
  252. package/dist/lib/template.d.ts +8 -6
  253. package/dist/lib/template.js +8 -6
  254. package/dist/lib/types.d.ts +147 -8
  255. package/dist/lib/types.js +26 -3
  256. package/dist/lib/usage.d.ts +32 -1
  257. package/dist/lib/usage.js +70 -6
  258. package/dist/lib/version-duplicates.d.ts +21 -0
  259. package/dist/lib/version-duplicates.js +90 -0
  260. package/dist/lib/versions.d.ts +33 -4
  261. package/dist/lib/versions.js +376 -108
  262. package/package.json +32 -17
  263. package/scripts/postinstall.js +126 -30
  264. package/dist/commands/__tests__/sessions.test.d.ts +0 -2
  265. package/dist/commands/__tests__/sessions.test.d.ts.map +0 -1
  266. package/dist/commands/__tests__/sessions.test.js +0 -636
  267. package/dist/commands/__tests__/sessions.test.js.map +0 -1
  268. package/dist/commands/cloud.d.ts.map +0 -1
  269. package/dist/commands/cloud.js.map +0 -1
  270. package/dist/commands/commands.d.ts.map +0 -1
  271. package/dist/commands/commands.js.map +0 -1
  272. package/dist/commands/daemon.d.ts.map +0 -1
  273. package/dist/commands/daemon.js.map +0 -1
  274. package/dist/commands/drive.d.ts.map +0 -1
  275. package/dist/commands/drive.js.map +0 -1
  276. package/dist/commands/exec.d.ts.map +0 -1
  277. package/dist/commands/exec.js.map +0 -1
  278. package/dist/commands/fork.d.ts.map +0 -1
  279. package/dist/commands/fork.js.map +0 -1
  280. package/dist/commands/hooks.d.ts.map +0 -1
  281. package/dist/commands/hooks.js.map +0 -1
  282. package/dist/commands/init.d.ts.map +0 -1
  283. package/dist/commands/init.js.map +0 -1
  284. package/dist/commands/mcp.d.ts.map +0 -1
  285. package/dist/commands/mcp.js.map +0 -1
  286. package/dist/commands/models.d.ts.map +0 -1
  287. package/dist/commands/models.js.map +0 -1
  288. package/dist/commands/packages.d.ts.map +0 -1
  289. package/dist/commands/packages.js.map +0 -1
  290. package/dist/commands/permissions.d.ts.map +0 -1
  291. package/dist/commands/permissions.js.map +0 -1
  292. package/dist/commands/plugins.d.ts.map +0 -1
  293. package/dist/commands/plugins.js.map +0 -1
  294. package/dist/commands/profiles.d.ts.map +0 -1
  295. package/dist/commands/profiles.js.map +0 -1
  296. package/dist/commands/pty.d.ts.map +0 -1
  297. package/dist/commands/pty.js.map +0 -1
  298. package/dist/commands/pull.d.ts.map +0 -1
  299. package/dist/commands/pull.js.map +0 -1
  300. package/dist/commands/push.d.ts +0 -3
  301. package/dist/commands/push.d.ts.map +0 -1
  302. package/dist/commands/push.js +0 -180
  303. package/dist/commands/push.js.map +0 -1
  304. package/dist/commands/refresh-memory.d.ts.map +0 -1
  305. package/dist/commands/refresh-memory.js.map +0 -1
  306. package/dist/commands/resource-view.d.ts.map +0 -1
  307. package/dist/commands/resource-view.js.map +0 -1
  308. package/dist/commands/routines.d.ts.map +0 -1
  309. package/dist/commands/routines.js.map +0 -1
  310. package/dist/commands/rules.d.ts.map +0 -1
  311. package/dist/commands/rules.js.map +0 -1
  312. package/dist/commands/secrets.d.ts.map +0 -1
  313. package/dist/commands/secrets.js.map +0 -1
  314. package/dist/commands/sessions-picker.d.ts.map +0 -1
  315. package/dist/commands/sessions-picker.js.map +0 -1
  316. package/dist/commands/sessions.d.ts.map +0 -1
  317. package/dist/commands/sessions.js.map +0 -1
  318. package/dist/commands/skills.d.ts.map +0 -1
  319. package/dist/commands/skills.js.map +0 -1
  320. package/dist/commands/status.d.ts.map +0 -1
  321. package/dist/commands/status.js.map +0 -1
  322. package/dist/commands/subagents.d.ts.map +0 -1
  323. package/dist/commands/subagents.js.map +0 -1
  324. package/dist/commands/sync.d.ts.map +0 -1
  325. package/dist/commands/sync.js.map +0 -1
  326. package/dist/commands/teams-picker.d.ts.map +0 -1
  327. package/dist/commands/teams-picker.js.map +0 -1
  328. package/dist/commands/teams.d.ts.map +0 -1
  329. package/dist/commands/teams.js.map +0 -1
  330. package/dist/commands/utils.d.ts.map +0 -1
  331. package/dist/commands/utils.js.map +0 -1
  332. package/dist/commands/versions.d.ts.map +0 -1
  333. package/dist/commands/versions.js.map +0 -1
  334. package/dist/commands/view.d.ts.map +0 -1
  335. package/dist/commands/view.js.map +0 -1
  336. package/dist/index.d.ts.map +0 -1
  337. package/dist/index.js.map +0 -1
  338. package/dist/lib/__tests__/bugfixes.test.d.ts +0 -2
  339. package/dist/lib/__tests__/bugfixes.test.d.ts.map +0 -1
  340. package/dist/lib/__tests__/bugfixes.test.js +0 -192
  341. package/dist/lib/__tests__/bugfixes.test.js.map +0 -1
  342. package/dist/lib/__tests__/exec.test.d.ts +0 -2
  343. package/dist/lib/__tests__/exec.test.d.ts.map +0 -1
  344. package/dist/lib/__tests__/exec.test.js +0 -446
  345. package/dist/lib/__tests__/exec.test.js.map +0 -1
  346. package/dist/lib/__tests__/git-sync.test.d.ts +0 -2
  347. package/dist/lib/__tests__/git-sync.test.d.ts.map +0 -1
  348. package/dist/lib/__tests__/git-sync.test.js +0 -138
  349. package/dist/lib/__tests__/git-sync.test.js.map +0 -1
  350. package/dist/lib/__tests__/hooks.test.d.ts +0 -2
  351. package/dist/lib/__tests__/hooks.test.d.ts.map +0 -1
  352. package/dist/lib/__tests__/hooks.test.js +0 -203
  353. package/dist/lib/__tests__/hooks.test.js.map +0 -1
  354. package/dist/lib/__tests__/memory-compile.test.d.ts +0 -2
  355. package/dist/lib/__tests__/memory-compile.test.d.ts.map +0 -1
  356. package/dist/lib/__tests__/memory-compile.test.js +0 -95
  357. package/dist/lib/__tests__/memory-compile.test.js.map +0 -1
  358. package/dist/lib/__tests__/models.test.d.ts +0 -2
  359. package/dist/lib/__tests__/models.test.d.ts.map +0 -1
  360. package/dist/lib/__tests__/models.test.js +0 -239
  361. package/dist/lib/__tests__/models.test.js.map +0 -1
  362. package/dist/lib/__tests__/rotate.test.d.ts +0 -2
  363. package/dist/lib/__tests__/rotate.test.d.ts.map +0 -1
  364. package/dist/lib/__tests__/rotate.test.js +0 -80
  365. package/dist/lib/__tests__/rotate.test.js.map +0 -1
  366. package/dist/lib/__tests__/secrets-bundles.test.d.ts +0 -2
  367. package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +0 -1
  368. package/dist/lib/__tests__/secrets-bundles.test.js +0 -104
  369. package/dist/lib/__tests__/secrets-bundles.test.js.map +0 -1
  370. package/dist/lib/__tests__/secrets.test.d.ts +0 -2
  371. package/dist/lib/__tests__/secrets.test.d.ts.map +0 -1
  372. package/dist/lib/__tests__/secrets.test.js +0 -90
  373. package/dist/lib/__tests__/secrets.test.js.map +0 -1
  374. package/dist/lib/__tests__/shims.test.d.ts +0 -2
  375. package/dist/lib/__tests__/shims.test.d.ts.map +0 -1
  376. package/dist/lib/__tests__/shims.test.js +0 -39
  377. package/dist/lib/__tests__/shims.test.js.map +0 -1
  378. package/dist/lib/__tests__/usage.test.d.ts +0 -2
  379. package/dist/lib/__tests__/usage.test.d.ts.map +0 -1
  380. package/dist/lib/__tests__/usage.test.js +0 -220
  381. package/dist/lib/__tests__/usage.test.js.map +0 -1
  382. package/dist/lib/__tests__/versions.test.d.ts +0 -2
  383. package/dist/lib/__tests__/versions.test.d.ts.map +0 -1
  384. package/dist/lib/__tests__/versions.test.js +0 -63
  385. package/dist/lib/__tests__/versions.test.js.map +0 -1
  386. package/dist/lib/agents.d.ts.map +0 -1
  387. package/dist/lib/agents.js.map +0 -1
  388. package/dist/lib/artifact-actions.d.ts.map +0 -1
  389. package/dist/lib/artifact-actions.js.map +0 -1
  390. package/dist/lib/cloud/codex.d.ts.map +0 -1
  391. package/dist/lib/cloud/codex.js.map +0 -1
  392. package/dist/lib/cloud/factory.d.ts.map +0 -1
  393. package/dist/lib/cloud/factory.js.map +0 -1
  394. package/dist/lib/cloud/registry.d.ts.map +0 -1
  395. package/dist/lib/cloud/registry.js.map +0 -1
  396. package/dist/lib/cloud/rush.d.ts.map +0 -1
  397. package/dist/lib/cloud/rush.js.map +0 -1
  398. package/dist/lib/cloud/store.d.ts.map +0 -1
  399. package/dist/lib/cloud/store.js.map +0 -1
  400. package/dist/lib/cloud/stream.d.ts.map +0 -1
  401. package/dist/lib/cloud/stream.js.map +0 -1
  402. package/dist/lib/cloud/types.d.ts.map +0 -1
  403. package/dist/lib/cloud/types.js.map +0 -1
  404. package/dist/lib/commands.d.ts.map +0 -1
  405. package/dist/lib/commands.js.map +0 -1
  406. package/dist/lib/convert.d.ts.map +0 -1
  407. package/dist/lib/convert.js.map +0 -1
  408. package/dist/lib/daemon.d.ts.map +0 -1
  409. package/dist/lib/daemon.js.map +0 -1
  410. package/dist/lib/drive-sync.d.ts.map +0 -1
  411. package/dist/lib/drive-sync.js.map +0 -1
  412. package/dist/lib/exec.d.ts.map +0 -1
  413. package/dist/lib/exec.js.map +0 -1
  414. package/dist/lib/factory.d.ts +0 -57
  415. package/dist/lib/factory.d.ts.map +0 -1
  416. package/dist/lib/factory.js +0 -110
  417. package/dist/lib/factory.js.map +0 -1
  418. package/dist/lib/git.d.ts.map +0 -1
  419. package/dist/lib/git.js.map +0 -1
  420. package/dist/lib/help.d.ts.map +0 -1
  421. package/dist/lib/help.js.map +0 -1
  422. package/dist/lib/hooks.d.ts.map +0 -1
  423. package/dist/lib/hooks.js.map +0 -1
  424. package/dist/lib/manifest.d.ts.map +0 -1
  425. package/dist/lib/manifest.js.map +0 -1
  426. package/dist/lib/markdown.d.ts.map +0 -1
  427. package/dist/lib/markdown.js.map +0 -1
  428. package/dist/lib/mcp.d.ts.map +0 -1
  429. package/dist/lib/mcp.js.map +0 -1
  430. package/dist/lib/memory-compile.d.ts.map +0 -1
  431. package/dist/lib/memory-compile.js.map +0 -1
  432. package/dist/lib/memory.d.ts.map +0 -1
  433. package/dist/lib/memory.js.map +0 -1
  434. package/dist/lib/models.d.ts.map +0 -1
  435. package/dist/lib/models.js.map +0 -1
  436. package/dist/lib/permissions.d.ts.map +0 -1
  437. package/dist/lib/permissions.js.map +0 -1
  438. package/dist/lib/picker.d.ts.map +0 -1
  439. package/dist/lib/picker.js.map +0 -1
  440. package/dist/lib/plugins.d.ts.map +0 -1
  441. package/dist/lib/plugins.js.map +0 -1
  442. package/dist/lib/profiles-keychain.d.ts +0 -3
  443. package/dist/lib/profiles-keychain.d.ts.map +0 -1
  444. package/dist/lib/profiles-keychain.js +0 -10
  445. package/dist/lib/profiles-keychain.js.map +0 -1
  446. package/dist/lib/profiles-presets.d.ts.map +0 -1
  447. package/dist/lib/profiles-presets.js.map +0 -1
  448. package/dist/lib/profiles.d.ts.map +0 -1
  449. package/dist/lib/profiles.js.map +0 -1
  450. package/dist/lib/pty-client.d.ts.map +0 -1
  451. package/dist/lib/pty-client.js.map +0 -1
  452. package/dist/lib/pty-server.d.ts.map +0 -1
  453. package/dist/lib/pty-server.js.map +0 -1
  454. package/dist/lib/registry.d.ts.map +0 -1
  455. package/dist/lib/registry.js.map +0 -1
  456. package/dist/lib/resources.d.ts.map +0 -1
  457. package/dist/lib/resources.js.map +0 -1
  458. package/dist/lib/rotate.d.ts.map +0 -1
  459. package/dist/lib/rotate.js.map +0 -1
  460. package/dist/lib/routines.d.ts.map +0 -1
  461. package/dist/lib/routines.js.map +0 -1
  462. package/dist/lib/runner.d.ts.map +0 -1
  463. package/dist/lib/runner.js.map +0 -1
  464. package/dist/lib/sandbox.d.ts.map +0 -1
  465. package/dist/lib/sandbox.js.map +0 -1
  466. package/dist/lib/scheduler.d.ts.map +0 -1
  467. package/dist/lib/scheduler.js.map +0 -1
  468. package/dist/lib/secrets-bundles.d.ts.map +0 -1
  469. package/dist/lib/secrets-bundles.js.map +0 -1
  470. package/dist/lib/secrets.d.ts +0 -27
  471. package/dist/lib/secrets.d.ts.map +0 -1
  472. package/dist/lib/secrets.js +0 -127
  473. package/dist/lib/secrets.js.map +0 -1
  474. package/dist/lib/session/__tests__/db.test.d.ts +0 -2
  475. package/dist/lib/session/__tests__/db.test.d.ts.map +0 -1
  476. package/dist/lib/session/__tests__/db.test.js +0 -54
  477. package/dist/lib/session/__tests__/db.test.js.map +0 -1
  478. package/dist/lib/session/__tests__/discover.test.d.ts +0 -2
  479. package/dist/lib/session/__tests__/discover.test.d.ts.map +0 -1
  480. package/dist/lib/session/__tests__/discover.test.js +0 -63
  481. package/dist/lib/session/__tests__/discover.test.js.map +0 -1
  482. package/dist/lib/session/__tests__/prompt.test.d.ts +0 -2
  483. package/dist/lib/session/__tests__/prompt.test.d.ts.map +0 -1
  484. package/dist/lib/session/__tests__/prompt.test.js +0 -44
  485. package/dist/lib/session/__tests__/prompt.test.js.map +0 -1
  486. package/dist/lib/session/__tests__/render.test.d.ts +0 -2
  487. package/dist/lib/session/__tests__/render.test.d.ts.map +0 -1
  488. package/dist/lib/session/__tests__/render.test.js +0 -602
  489. package/dist/lib/session/__tests__/render.test.js.map +0 -1
  490. package/dist/lib/session/artifacts.d.ts.map +0 -1
  491. package/dist/lib/session/artifacts.js.map +0 -1
  492. package/dist/lib/session/db.d.ts.map +0 -1
  493. package/dist/lib/session/db.js.map +0 -1
  494. package/dist/lib/session/discover.d.ts.map +0 -1
  495. package/dist/lib/session/discover.js.map +0 -1
  496. package/dist/lib/session/parse.d.ts.map +0 -1
  497. package/dist/lib/session/parse.js.map +0 -1
  498. package/dist/lib/session/prompt.d.ts.map +0 -1
  499. package/dist/lib/session/prompt.js.map +0 -1
  500. package/dist/lib/session/prompt.test.d.ts +0 -2
  501. package/dist/lib/session/prompt.test.d.ts.map +0 -1
  502. package/dist/lib/session/prompt.test.js +0 -57
  503. package/dist/lib/session/prompt.test.js.map +0 -1
  504. package/dist/lib/session/render.d.ts.map +0 -1
  505. package/dist/lib/session/render.js.map +0 -1
  506. package/dist/lib/session/team-filter.d.ts.map +0 -1
  507. package/dist/lib/session/team-filter.js.map +0 -1
  508. package/dist/lib/session/team-filter.test.d.ts +0 -2
  509. package/dist/lib/session/team-filter.test.d.ts.map +0 -1
  510. package/dist/lib/session/team-filter.test.js +0 -157
  511. package/dist/lib/session/team-filter.test.js.map +0 -1
  512. package/dist/lib/session/types.d.ts.map +0 -1
  513. package/dist/lib/session/types.js.map +0 -1
  514. package/dist/lib/shims.d.ts.map +0 -1
  515. package/dist/lib/shims.js.map +0 -1
  516. package/dist/lib/skills.d.ts.map +0 -1
  517. package/dist/lib/skills.js.map +0 -1
  518. package/dist/lib/state.d.ts.map +0 -1
  519. package/dist/lib/state.js.map +0 -1
  520. package/dist/lib/subagents.d.ts.map +0 -1
  521. package/dist/lib/subagents.js.map +0 -1
  522. package/dist/lib/teams/agents.d.ts.map +0 -1
  523. package/dist/lib/teams/agents.js.map +0 -1
  524. package/dist/lib/teams/api.d.ts.map +0 -1
  525. package/dist/lib/teams/api.js.map +0 -1
  526. package/dist/lib/teams/cloud.d.ts +0 -11
  527. package/dist/lib/teams/cloud.d.ts.map +0 -1
  528. package/dist/lib/teams/cloud.js +0 -169
  529. package/dist/lib/teams/cloud.js.map +0 -1
  530. package/dist/lib/teams/debug.d.ts.map +0 -1
  531. package/dist/lib/teams/debug.js.map +0 -1
  532. package/dist/lib/teams/file_ops.d.ts.map +0 -1
  533. package/dist/lib/teams/file_ops.js.map +0 -1
  534. package/dist/lib/teams/parsers.d.ts.map +0 -1
  535. package/dist/lib/teams/parsers.js.map +0 -1
  536. package/dist/lib/teams/persistence.d.ts.map +0 -1
  537. package/dist/lib/teams/persistence.js.map +0 -1
  538. package/dist/lib/teams/ralph.d.ts +0 -8
  539. package/dist/lib/teams/ralph.d.ts.map +0 -1
  540. package/dist/lib/teams/ralph.js +0 -59
  541. package/dist/lib/teams/ralph.js.map +0 -1
  542. package/dist/lib/teams/registry.d.ts.map +0 -1
  543. package/dist/lib/teams/registry.js.map +0 -1
  544. package/dist/lib/teams/summarizer.d.ts.map +0 -1
  545. package/dist/lib/teams/summarizer.js.map +0 -1
  546. package/dist/lib/template.d.ts.map +0 -1
  547. package/dist/lib/template.js.map +0 -1
  548. package/dist/lib/types.d.ts.map +0 -1
  549. package/dist/lib/types.js.map +0 -1
  550. package/dist/lib/usage.d.ts.map +0 -1
  551. package/dist/lib/usage.js.map +0 -1
  552. package/dist/lib/versions.d.ts.map +0 -1
  553. package/dist/lib/versions.js.map +0 -1
  554. package/scripts/rebuild-sqlite.sh +0 -46
@@ -1,12 +1,25 @@
1
+ /**
2
+ * Job execution engine for routines.
3
+ *
4
+ * Builds agent-specific CLI commands from job configs, spawns them with
5
+ * sandboxed or unsandboxed environments, captures stdout to log files,
6
+ * enforces timeouts, and extracts the final assistant report from the
7
+ * agent's stream-JSON output.
8
+ */
1
9
  import type { JobConfig, RunMeta } from './routines.js';
2
10
  import type { AgentId } from './types.js';
11
+ /** Result of a completed job execution, including metadata and optional report. */
3
12
  export interface RunResult {
4
13
  meta: RunMeta;
5
14
  reportPath: string | null;
6
15
  }
16
+ /** Build the full CLI argv for executing a job, applying mode, model, and permission flags. */
7
17
  export declare function buildJobCommand(config: JobConfig, resolvedPrompt: string): string[];
18
+ /** Execute a job synchronously (waits for completion or timeout before resolving). */
8
19
  export declare function executeJob(config: JobConfig): Promise<RunResult>;
20
+ /** Spawn a job as a detached process and return immediately with run metadata. */
9
21
  export declare function executeJobDetached(config: JobConfig): Promise<RunMeta>;
22
+ /** Extract the final assistant message from a stream-JSON log file as a markdown report. */
10
23
  export declare function extractReport(stdoutPath: string, agentType: AgentId): string | null;
24
+ /** Scan all runs marked "running" and finalize any whose process has exited. */
11
25
  export declare function monitorRunningJobs(): void;
12
- //# sourceMappingURL=runner.d.ts.map
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Job execution engine for routines.
3
+ *
4
+ * Builds agent-specific CLI commands from job configs, spawns them with
5
+ * sandboxed or unsandboxed environments, captures stdout to log files,
6
+ * enforces timeouts, and extracts the final assistant report from the
7
+ * agent's stream-JSON output.
8
+ */
1
9
  import { spawn } from 'child_process';
2
10
  import * as fs from 'fs';
3
11
  import * as path from 'path';
@@ -6,11 +14,13 @@ import { resolveJobPrompt, parseTimeout, writeRunMeta, getRunDir, } from './rout
6
14
  import { getRunsDir } from './state.js';
7
15
  import { prepareJobHome, buildSpawnEnv } from './sandbox.js';
8
16
  import { resolveModel, buildReasoningFlags } from './models.js';
17
+ /** CLI command templates per agent, with {prompt} as a placeholder. */
9
18
  const AGENT_COMMANDS = {
10
19
  claude: ['claude', '-p', '--verbose', '{prompt}', '--output-format', 'stream-json', '--permission-mode', 'plan'],
11
20
  codex: ['codex', 'exec', '--sandbox', 'workspace-write', '{prompt}', '--json'],
12
21
  gemini: ['gemini', '{prompt}', '--output-format', 'stream-json'],
13
22
  };
23
+ /** Build the full CLI argv for executing a job, applying mode, model, and permission flags. */
14
24
  export function buildJobCommand(config, resolvedPrompt) {
15
25
  const template = AGENT_COMMANDS[config.agent];
16
26
  if (!template) {
@@ -31,6 +41,12 @@ export function buildJobCommand(config, resolvedPrompt) {
31
41
  }
32
42
  if (config.allow?.dirs) {
33
43
  for (const dir of config.allow.dirs) {
44
+ // Reject leading '-' so a routine YAML can't smuggle an argv flag like
45
+ // `--dangerously-skip-permissions` past the sandbox by hiding it as an
46
+ // allow.dirs entry.
47
+ if (dir.startsWith('-')) {
48
+ throw new Error(`allow.dirs entries must not start with '-': ${JSON.stringify(dir)}`);
49
+ }
34
50
  const resolved = dir.replace(/^~/, os.homedir());
35
51
  cmd.push('--add-dir', resolved);
36
52
  }
@@ -89,6 +105,7 @@ function appendModelAndReasoning(cmd, config) {
89
105
  function generateRunId() {
90
106
  return new Date().toISOString().replace(/[:.]/g, '-');
91
107
  }
108
+ /** Execute a job synchronously (waits for completion or timeout before resolving). */
92
109
  export async function executeJob(config) {
93
110
  const resolvedPrompt = resolveJobPrompt(config);
94
111
  const cmd = buildJobCommand(config, resolvedPrompt);
@@ -98,7 +115,7 @@ export async function executeJob(config) {
98
115
  const runDir = getRunDir(config.name, runId);
99
116
  fs.mkdirSync(runDir, { recursive: true });
100
117
  const stdoutPath = path.join(runDir, 'stdout.log');
101
- const stdoutFd = fs.openSync(stdoutPath, 'w');
118
+ const stdoutFd = fs.openSync(stdoutPath, 'w', 0o600);
102
119
  let spawnEnv = useSandbox ? buildSpawnEnv(overlayHome) : { ...process.env };
103
120
  if (config.timezone) {
104
121
  spawnEnv.TZ = config.timezone;
@@ -179,6 +196,7 @@ export async function executeJob(config) {
179
196
  child.unref();
180
197
  });
181
198
  }
199
+ /** Spawn a job as a detached process and return immediately with run metadata. */
182
200
  export async function executeJobDetached(config) {
183
201
  const resolvedPrompt = resolveJobPrompt(config);
184
202
  const cmd = buildJobCommand(config, resolvedPrompt);
@@ -188,7 +206,7 @@ export async function executeJobDetached(config) {
188
206
  const runDir = getRunDir(config.name, runId);
189
207
  fs.mkdirSync(runDir, { recursive: true });
190
208
  const stdoutPath = path.join(runDir, 'stdout.log');
191
- const stdoutFd = fs.openSync(stdoutPath, 'w');
209
+ const stdoutFd = fs.openSync(stdoutPath, 'w', 0o600);
192
210
  let spawnEnv = useSandbox ? buildSpawnEnv(overlayHome) : { ...process.env };
193
211
  if (config.timezone) {
194
212
  spawnEnv.TZ = config.timezone;
@@ -233,6 +251,7 @@ function extractAndSaveReport(stdoutPath, agentType, runDir) {
233
251
  }
234
252
  return null;
235
253
  }
254
+ /** Extract the final assistant message from a stream-JSON log file as a markdown report. */
236
255
  export function extractReport(stdoutPath, agentType) {
237
256
  if (!fs.existsSync(stdoutPath))
238
257
  return null;
@@ -273,6 +292,7 @@ export function extractReport(stdoutPath, agentType) {
273
292
  return null;
274
293
  }
275
294
  }
295
+ /** Scan all runs marked "running" and finalize any whose process has exited. */
276
296
  export function monitorRunningJobs() {
277
297
  const runsDir = getRunsDir();
278
298
  if (!fs.existsSync(runsDir))
@@ -308,4 +328,3 @@ export function monitorRunningJobs() {
308
328
  }
309
329
  }
310
330
  }
311
- //# sourceMappingURL=runner.js.map
@@ -1,10 +1,25 @@
1
+ /**
2
+ * Sandbox environment for routine job execution.
3
+ *
4
+ * Creates an overlay HOME directory per job with symlinked allowed
5
+ * directories and agent-specific config files (permissions, settings).
6
+ * The spawned agent process sees only the overlay, limiting filesystem
7
+ * access to explicitly allowed paths.
8
+ */
1
9
  import type { JobConfig } from './routines.js';
10
+ /** Build a restricted environment for a sandboxed process, setting HOME to the overlay. */
2
11
  export declare function buildSpawnEnv(overlayHome: string, extraEnv?: Record<string, string>): Record<string, string>;
12
+ /** Get the overlay HOME directory path for a named job. */
3
13
  export declare function getJobHomePath(name: string): string;
14
+ /** Create a fresh overlay HOME for a job, including agent config and allowed-dir symlinks. */
4
15
  export declare function prepareJobHome(config: JobConfig): string;
16
+ /** Remove a job's overlay HOME directory entirely. */
5
17
  export declare function cleanJobHome(name: string): void;
18
+ /** Symlink allowed directories into the overlay HOME, skipping paths outside the real HOME. */
6
19
  export declare function symlinkAllowedDirs(overlayHome: string, dirs: string[]): void;
20
+ /** Generate a Claude settings.json in the overlay with scoped permissions from the job config. */
7
21
  export declare function generateClaudeConfig(overlayHome: string, config: JobConfig): void;
22
+ /** Generate a Codex config.toml in the overlay with model and approval-mode settings. */
8
23
  export declare function generateCodexConfig(overlayHome: string, config: JobConfig): void;
24
+ /** Generate a Gemini settings.json in the overlay from the job's config block. */
9
25
  export declare function generateGeminiConfig(overlayHome: string, config: JobConfig): void;
10
- //# sourceMappingURL=sandbox.d.ts.map
@@ -1,8 +1,18 @@
1
+ /**
2
+ * Sandbox environment for routine job execution.
3
+ *
4
+ * Creates an overlay HOME directory per job with symlinked allowed
5
+ * directories and agent-specific config files (permissions, settings).
6
+ * The spawned agent process sees only the overlay, limiting filesystem
7
+ * access to explicitly allowed paths.
8
+ */
1
9
  import * as fs from 'fs';
2
10
  import * as path from 'path';
3
11
  import * as os from 'os';
12
+ import { setGeminiAutoUpdateDisabled, updateGeminiSettings } from './gemini-settings.js';
4
13
  import { getRoutinesDir } from './state.js';
5
14
  const REAL_HOME = os.homedir();
15
+ /** Environment variables forwarded from the parent process into the sandbox. */
6
16
  const ENV_ALLOWLIST = [
7
17
  'PATH',
8
18
  'SHELL',
@@ -25,13 +35,20 @@ const ENV_ALLOWLIST = [
25
35
  'NO_COLOR',
26
36
  'FORCE_COLOR',
27
37
  ];
28
- // Tools safe to grant as wildcards (no filesystem access)
38
+ /** Tools safe to grant as wildcards (no filesystem access). */
29
39
  const SAFE_TOOLS = {
30
40
  web_search: 'WebSearch(*)',
31
41
  web_fetch: 'WebFetch(*)',
32
42
  };
33
- // Bare tool names that get scoped to allow.dirs, never wildcarded
43
+ /** Bare tool names that get scoped to allow.dirs, never wildcarded. */
34
44
  const DIR_SCOPED_TOOLS = new Set(['read', 'write', 'edit', 'glob', 'grep', 'notebook_edit']);
45
+ function tomlString(value) {
46
+ if (/[\r\n]/.test(value)) {
47
+ throw new Error(`TOML value contains newline: ${JSON.stringify(value)}`);
48
+ }
49
+ return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
50
+ }
51
+ /** Build a restricted environment for a sandboxed process, setting HOME to the overlay. */
35
52
  export function buildSpawnEnv(overlayHome, extraEnv) {
36
53
  const env = { HOME: overlayHome };
37
54
  for (const key of ENV_ALLOWLIST) {
@@ -44,9 +61,11 @@ export function buildSpawnEnv(overlayHome, extraEnv) {
44
61
  }
45
62
  return env;
46
63
  }
64
+ /** Get the overlay HOME directory path for a named job. */
47
65
  export function getJobHomePath(name) {
48
66
  return path.join(getRoutinesDir(), name, 'home');
49
67
  }
68
+ /** Create a fresh overlay HOME for a job, including agent config and allowed-dir symlinks. */
50
69
  export function prepareJobHome(config) {
51
70
  const overlayHome = getJobHomePath(config.name);
52
71
  cleanJobHome(config.name);
@@ -65,12 +84,14 @@ export function prepareJobHome(config) {
65
84
  }
66
85
  return overlayHome;
67
86
  }
87
+ /** Remove a job's overlay HOME directory entirely. */
68
88
  export function cleanJobHome(name) {
69
89
  const overlayHome = getJobHomePath(name);
70
90
  if (fs.existsSync(overlayHome)) {
71
91
  fs.rmSync(overlayHome, { recursive: true, force: true });
72
92
  }
73
93
  }
94
+ /** Symlink allowed directories into the overlay HOME, skipping paths outside the real HOME. */
74
95
  export function symlinkAllowedDirs(overlayHome, dirs) {
75
96
  for (const dir of dirs) {
76
97
  const expanded = dir.replace(/^~/, REAL_HOME);
@@ -99,6 +120,7 @@ export function symlinkAllowedDirs(overlayHome, dirs) {
99
120
  }
100
121
  }
101
122
  }
123
+ /** Generate a Claude settings.json in the overlay with scoped permissions from the job config. */
102
124
  export function generateClaudeConfig(overlayHome, config) {
103
125
  const claudeDir = path.join(overlayHome, '.claude');
104
126
  fs.mkdirSync(claudeDir, { recursive: true });
@@ -156,13 +178,14 @@ export function generateClaudeConfig(overlayHome, config) {
156
178
  };
157
179
  fs.writeFileSync(path.join(claudeDir, 'settings.json'), JSON.stringify(settings, null, 2), 'utf-8');
158
180
  }
181
+ /** Generate a Codex config.toml in the overlay with model and approval-mode settings. */
159
182
  export function generateCodexConfig(overlayHome, config) {
160
183
  const codexDir = path.join(overlayHome, '.codex');
161
184
  fs.mkdirSync(codexDir, { recursive: true });
162
185
  const lines = [];
163
186
  const model = config.config?.model;
164
187
  if (model) {
165
- lines.push(`model = "${model}"`);
188
+ lines.push(`model = ${tomlString(model)}`);
166
189
  }
167
190
  if (config.mode === 'edit') {
168
191
  lines.push('approval_mode = "full-auto"');
@@ -175,7 +198,7 @@ export function generateCodexConfig(overlayHome, config) {
175
198
  if (key === 'model')
176
199
  continue;
177
200
  if (typeof value === 'string') {
178
- lines.push(`${key} = "${value}"`);
201
+ lines.push(`${key} = ${tomlString(value)}`);
179
202
  }
180
203
  else if (typeof value === 'boolean' || typeof value === 'number') {
181
204
  lines.push(`${key} = ${value}`);
@@ -184,18 +207,18 @@ export function generateCodexConfig(overlayHome, config) {
184
207
  }
185
208
  fs.writeFileSync(path.join(codexDir, 'config.toml'), lines.join('\n') + '\n', 'utf-8');
186
209
  }
210
+ /** Generate a Gemini settings.json in the overlay from the job's config block. */
187
211
  export function generateGeminiConfig(overlayHome, config) {
188
- const geminiDir = path.join(overlayHome, '.gemini');
189
- fs.mkdirSync(geminiDir, { recursive: true });
190
- const settings = {};
191
- if (config.config?.model) {
192
- settings.model = config.config.model;
193
- }
194
- if (config.config) {
195
- for (const [key, value] of Object.entries(config.config)) {
196
- settings[key] = value;
212
+ const settingsPath = path.join(overlayHome, '.gemini', 'settings.json');
213
+ updateGeminiSettings(settingsPath, (settings) => {
214
+ if (config.config?.model) {
215
+ settings.model = config.config.model;
197
216
  }
198
- }
199
- fs.writeFileSync(path.join(geminiDir, 'settings.json'), JSON.stringify(settings, null, 2), 'utf-8');
217
+ if (config.config) {
218
+ for (const [key, value] of Object.entries(config.config)) {
219
+ settings[key] = value;
220
+ }
221
+ }
222
+ setGeminiAutoUpdateDisabled(settings);
223
+ });
200
224
  }
201
- //# sourceMappingURL=sandbox.js.map
@@ -1,4 +1,12 @@
1
+ /**
2
+ * Cron-based job scheduler for routines.
3
+ *
4
+ * Wraps the croner library to manage scheduled jobs in-memory. The daemon
5
+ * process creates a single JobScheduler instance that loads enabled jobs
6
+ * on startup and reloads them on SIGHUP.
7
+ */
1
8
  import type { JobConfig } from './routines.js';
9
+ /** In-memory cron scheduler that triggers a callback when jobs fire. */
2
10
  export declare class JobScheduler {
3
11
  private jobs;
4
12
  private onTrigger;
@@ -15,4 +23,3 @@ export declare class JobScheduler {
15
23
  enabled: boolean;
16
24
  }>;
17
25
  }
18
- //# sourceMappingURL=scheduler.d.ts.map
@@ -1,5 +1,13 @@
1
+ /**
2
+ * Cron-based job scheduler for routines.
3
+ *
4
+ * Wraps the croner library to manage scheduled jobs in-memory. The daemon
5
+ * process creates a single JobScheduler instance that loads enabled jobs
6
+ * on startup and reloads them on SIGHUP.
7
+ */
1
8
  import { Cron } from 'croner';
2
9
  import { listJobs, deleteJob } from './routines.js';
10
+ /** In-memory cron scheduler that triggers a callback when jobs fire. */
3
11
  export class JobScheduler {
4
12
  jobs = new Map();
5
13
  onTrigger;
@@ -66,4 +74,3 @@ export class JobScheduler {
66
74
  return result;
67
75
  }
68
76
  }
69
- //# sourceMappingURL=scheduler.js.map
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleIdentifier</key>
6
+ <string>com.phnx-labs.agents-keychain</string>
7
+ <key>CFBundleName</key>
8
+ <string>AgentsKeychain</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>AgentsKeychain</string>
11
+ <key>CFBundlePackageType</key>
12
+ <string>APPL</string>
13
+ <key>CFBundleVersion</key>
14
+ <string>1</string>
15
+ <key>CFBundleShortVersionString</key>
16
+ <string>1.0</string>
17
+ <key>LSMinimumSystemVersion</key>
18
+ <string>12.0</string>
19
+ <key>LSUIElement</key>
20
+ <true/>
21
+ </dict>
22
+ </plist>
@@ -0,0 +1,123 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>files</key>
6
+ <dict/>
7
+ <key>files2</key>
8
+ <dict>
9
+ <key>embedded.provisionprofile</key>
10
+ <dict>
11
+ <key>hash2</key>
12
+ <data>
13
+ 2vfA/eR3dTYgNc/fXhdADUPkp5tRIepPzE3FCLfDx4w=
14
+ </data>
15
+ </dict>
16
+ </dict>
17
+ <key>rules</key>
18
+ <dict>
19
+ <key>^Resources/</key>
20
+ <true/>
21
+ <key>^Resources/.*\.lproj/</key>
22
+ <dict>
23
+ <key>optional</key>
24
+ <true/>
25
+ <key>weight</key>
26
+ <real>1000</real>
27
+ </dict>
28
+ <key>^Resources/.*\.lproj/locversion.plist$</key>
29
+ <dict>
30
+ <key>omit</key>
31
+ <true/>
32
+ <key>weight</key>
33
+ <real>1100</real>
34
+ </dict>
35
+ <key>^Resources/Base\.lproj/</key>
36
+ <dict>
37
+ <key>weight</key>
38
+ <real>1010</real>
39
+ </dict>
40
+ <key>^version.plist$</key>
41
+ <true/>
42
+ </dict>
43
+ <key>rules2</key>
44
+ <dict>
45
+ <key>.*\.dSYM($|/)</key>
46
+ <dict>
47
+ <key>weight</key>
48
+ <real>11</real>
49
+ </dict>
50
+ <key>^(.*/)?\.DS_Store$</key>
51
+ <dict>
52
+ <key>omit</key>
53
+ <true/>
54
+ <key>weight</key>
55
+ <real>2000</real>
56
+ </dict>
57
+ <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
58
+ <dict>
59
+ <key>nested</key>
60
+ <true/>
61
+ <key>weight</key>
62
+ <real>10</real>
63
+ </dict>
64
+ <key>^.*</key>
65
+ <true/>
66
+ <key>^Info\.plist$</key>
67
+ <dict>
68
+ <key>omit</key>
69
+ <true/>
70
+ <key>weight</key>
71
+ <real>20</real>
72
+ </dict>
73
+ <key>^PkgInfo$</key>
74
+ <dict>
75
+ <key>omit</key>
76
+ <true/>
77
+ <key>weight</key>
78
+ <real>20</real>
79
+ </dict>
80
+ <key>^Resources/</key>
81
+ <dict>
82
+ <key>weight</key>
83
+ <real>20</real>
84
+ </dict>
85
+ <key>^Resources/.*\.lproj/</key>
86
+ <dict>
87
+ <key>optional</key>
88
+ <true/>
89
+ <key>weight</key>
90
+ <real>1000</real>
91
+ </dict>
92
+ <key>^Resources/.*\.lproj/locversion.plist$</key>
93
+ <dict>
94
+ <key>omit</key>
95
+ <true/>
96
+ <key>weight</key>
97
+ <real>1100</real>
98
+ </dict>
99
+ <key>^Resources/Base\.lproj/</key>
100
+ <dict>
101
+ <key>weight</key>
102
+ <real>1010</real>
103
+ </dict>
104
+ <key>^[^/]+$</key>
105
+ <dict>
106
+ <key>nested</key>
107
+ <true/>
108
+ <key>weight</key>
109
+ <real>10</real>
110
+ </dict>
111
+ <key>^embedded\.provisionprofile$</key>
112
+ <dict>
113
+ <key>weight</key>
114
+ <real>20</real>
115
+ </dict>
116
+ <key>^version\.plist$</key>
117
+ <dict>
118
+ <key>weight</key>
119
+ <real>20</real>
120
+ </dict>
121
+ </dict>
122
+ </dict>
123
+ </plist>
@@ -1,10 +1,21 @@
1
- import { type BundleValue, type SecretRef } from './secrets.js';
1
+ /**
2
+ * Secret bundles -- named sets of keychain-backed environment variables.
3
+ *
4
+ * Each bundle is a YAML file in ~/.agents/secrets/ declaring key names.
5
+ * Values live in the macOS Keychain and are injected into the agent's
6
+ * environment at spawn time via `agents run --secrets <bundle>`.
7
+ */
8
+ import { type BundleValue, type SecretRef } from './index.js';
9
+ /** A named set of environment variable definitions backed by various secret providers. */
2
10
  export interface SecretsBundle {
3
11
  name: string;
4
12
  description?: string;
5
13
  allow_exec?: boolean;
14
+ /** When true, keychain-backed values are stored in iCloud Keychain so they sync across the user's Macs. */
15
+ icloud_sync?: boolean;
6
16
  vars: Record<string, BundleValue>;
7
17
  }
18
+ /** Validate a bundle name against the allowed pattern. Throws on invalid input. */
8
19
  export declare function validateBundleName(name: string): void;
9
20
  export declare function validateEnvKey(key: string): void;
10
21
  export declare function bundleExists(name: string): boolean;
@@ -26,4 +37,3 @@ export declare function keychainItemsForBundle(bundle: SecretsBundle): Array<{
26
37
  }>;
27
38
  export declare function parseDotenv(content: string): Record<string, string>;
28
39
  export type { SecretRef };
29
- //# sourceMappingURL=secrets-bundles.d.ts.map
@@ -1,10 +1,18 @@
1
+ /**
2
+ * Secret bundles -- named sets of keychain-backed environment variables.
3
+ *
4
+ * Each bundle is a YAML file in ~/.agents/secrets/ declaring key names.
5
+ * Values live in the macOS Keychain and are injected into the agent's
6
+ * environment at spawn time via `agents run --secrets <bundle>`.
7
+ */
1
8
  import * as fs from 'fs';
2
9
  import * as path from 'path';
3
10
  import * as yaml from 'yaml';
4
- import { getSecretsDir } from './state.js';
5
- import { parseBundleValue, resolveRef, secretsKeychainItem, } from './secrets.js';
11
+ import { getSecretsDir, getUserSecretsDir } from '../state.js';
12
+ import { parseBundleValue, resolveRef, secretsKeychainItem, } from './index.js';
6
13
  const BUNDLE_NAME_PATTERN = /^[a-z0-9][a-z0-9-_]{0,48}$/i;
7
14
  const ENV_KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
15
+ /** Validate a bundle name against the allowed pattern. Throws on invalid input. */
8
16
  export function validateBundleName(name) {
9
17
  if (!BUNDLE_NAME_PATTERN.test(name)) {
10
18
  throw new Error(`Invalid bundle name '${name}'. Use letters, digits, dash, underscore (max 48 chars).`);
@@ -16,7 +24,14 @@ export function validateEnvKey(key) {
16
24
  }
17
25
  }
18
26
  function bundlePath(name) {
19
- return path.join(getSecretsDir(), `${name}.yml`);
27
+ // Check user dir first (for reads), write to user dir
28
+ const userPath = path.join(getUserSecretsDir(), `${name}.yml`);
29
+ if (fs.existsSync(userPath))
30
+ return userPath;
31
+ const systemPath = path.join(getSecretsDir(), `${name}.yml`);
32
+ if (fs.existsSync(systemPath))
33
+ return systemPath;
34
+ return userPath; // default write location
20
35
  }
21
36
  export function bundleExists(name) {
22
37
  return fs.existsSync(bundlePath(name));
@@ -36,6 +51,7 @@ export function readBundle(name) {
36
51
  name: parsed.name || name,
37
52
  description: parsed.description,
38
53
  allow_exec: Boolean(parsed.allow_exec),
54
+ icloud_sync: Boolean(parsed.icloud_sync),
39
55
  vars: parsed.vars && typeof parsed.vars === 'object' ? parsed.vars : {},
40
56
  };
41
57
  for (const key of Object.keys(bundle.vars)) {
@@ -48,12 +64,13 @@ export function writeBundle(bundle) {
48
64
  for (const key of Object.keys(bundle.vars)) {
49
65
  validateEnvKey(key);
50
66
  }
51
- const dir = getSecretsDir();
67
+ const dir = getUserSecretsDir();
52
68
  fs.mkdirSync(dir, { recursive: true });
53
69
  const body = yaml.stringify({
54
70
  name: bundle.name,
55
71
  description: bundle.description,
56
72
  allow_exec: bundle.allow_exec ? true : undefined,
73
+ icloud_sync: bundle.icloud_sync ? true : undefined,
57
74
  vars: bundle.vars,
58
75
  });
59
76
  const file = bundlePath(bundle.name);
@@ -70,18 +87,22 @@ export function deleteBundle(name) {
70
87
  return true;
71
88
  }
72
89
  export function listBundles() {
73
- const dir = getSecretsDir();
74
- if (!fs.existsSync(dir))
75
- return [];
76
- const entries = fs.readdirSync(dir).filter((f) => f.endsWith('.yml') || f.endsWith('.yaml'));
90
+ const seen = new Set();
77
91
  const bundles = [];
78
- for (const entry of entries) {
79
- const name = entry.replace(/\.(yml|yaml)$/, '');
80
- try {
81
- bundles.push(readBundle(name));
82
- }
83
- catch {
84
- // Skip malformed bundles; surfaced via `agents secrets view <name>`.
92
+ for (const dir of [getUserSecretsDir(), getSecretsDir()]) {
93
+ if (!fs.existsSync(dir))
94
+ continue;
95
+ for (const entry of fs.readdirSync(dir).filter((f) => f.endsWith('.yml') || f.endsWith('.yaml'))) {
96
+ const name = entry.replace(/\.(yml|yaml)$/, '');
97
+ if (seen.has(name))
98
+ continue;
99
+ seen.add(name);
100
+ try {
101
+ bundles.push(readBundle(name));
102
+ }
103
+ catch {
104
+ // Skip malformed bundles; surfaced via `agents secrets view <name>`.
105
+ }
85
106
  }
86
107
  }
87
108
  return bundles.sort((a, b) => a.name.localeCompare(b.name));
@@ -114,13 +135,14 @@ export function resolveBundleEnv(bundle) {
114
135
  try {
115
136
  env[key] = resolveRef(parsed.ref, {
116
137
  allowExec: bundle.allow_exec,
138
+ iCloudSync: bundle.icloud_sync,
117
139
  keychainItemFor: (shortId) => secretsKeychainItem(bundle.name, shortId),
118
140
  });
119
141
  }
120
142
  catch (err) {
121
143
  const msg = err.message;
122
144
  if (parsed.ref.provider === 'keychain' && /not found/.test(msg)) {
123
- throw new Error(`${msg} Run: agents secrets set ${bundle.name} ${key}`);
145
+ throw new Error(`${msg} Run: agents secrets add ${bundle.name} ${key}`);
124
146
  }
125
147
  throw new Error(`Bundle '${bundle.name}' key '${key}': ${msg}`);
126
148
  }
@@ -165,4 +187,3 @@ export function parseDotenv(content) {
165
187
  }
166
188
  return out;
167
189
  }
168
- //# sourceMappingURL=secrets-bundles.js.map
@@ -0,0 +1,55 @@
1
+ /**
2
+ * macOS Keychain integration for secure credential storage.
3
+ *
4
+ * Calls a compiled Swift helper (keychain-helper.swift) to store and retrieve
5
+ * API keys and tokens via the Security framework, with kSecAttrSynchronizable
6
+ * set so iCloud Keychain syncs them across the user's Macs.
7
+ */
8
+ /** Supported secret resolution backends. */
9
+ export type SecretProvider = 'keychain' | 'env' | 'file' | 'exec';
10
+ /** A typed reference to a secret, consisting of a provider and a provider-specific value. */
11
+ export interface SecretRef {
12
+ provider: SecretProvider;
13
+ value: string;
14
+ }
15
+ /**
16
+ * A bundle YAML value: either a string (literal or provider-prefixed ref) or
17
+ * an object `{value: string}` used to escape a literal that would otherwise
18
+ * be parsed as a ref (e.g. a URL that happens to start with 'env:').
19
+ */
20
+ export type BundleValue = string | {
21
+ value: string;
22
+ };
23
+ /** Parse a bundle YAML value into either a literal string or a typed secret ref. */
24
+ export declare function parseBundleValue(raw: BundleValue): {
25
+ literal: string;
26
+ } | {
27
+ ref: SecretRef;
28
+ };
29
+ /** Serialize a secret ref back to its `provider:value` string form. */
30
+ export declare function serializeRef(ref: SecretRef): string;
31
+ /** Build the keychain item name for a profile provider token. */
32
+ export declare function profileKeychainItem(provider: string): string;
33
+ /** Build the keychain item name for a secrets-bundle key. */
34
+ export declare function secretsKeychainItem(bundle: string, key: string): string;
35
+ /** Check if a keychain item exists (macOS only). */
36
+ export declare function hasKeychainToken(item: string, sync?: boolean): boolean;
37
+ /** Retrieve a secret value from the macOS Keychain. Throws if not found. */
38
+ export declare function getKeychainToken(item: string, sync?: boolean): string;
39
+ /** Store or update a secret value in the macOS Keychain. iCloud-synced when sync=true. */
40
+ export declare function setKeychainToken(item: string, value: string, sync?: boolean): void;
41
+ /** Delete a keychain item. Returns true if it existed. */
42
+ export declare function deleteKeychainToken(item: string, sync?: boolean): boolean;
43
+ /** Options controlling how secret refs are resolved. */
44
+ export interface ResolveOptions {
45
+ /** Translate a short keychain ID to a fully namespaced item name. */
46
+ keychainItemFor?: (shortId: string) => string;
47
+ /** Allow exec: refs. When false (default), exec refs throw. */
48
+ allowExec?: boolean;
49
+ /** Restrict env: refs to this allowlist. When undefined, any env var may be read. */
50
+ envAllowlist?: string[];
51
+ /** Read keychain refs from the iCloud-synced keychain backend. */
52
+ iCloudSync?: boolean;
53
+ }
54
+ /** Resolve a secret ref to its plaintext value using the appropriate provider. */
55
+ export declare function resolveRef(ref: SecretRef, opts?: ResolveOptions): string;