operon-agents-core 0.1.0-alpha.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 (511) hide show
  1. package/LICENSE +55 -0
  2. package/README.md +7 -0
  3. package/dist/agent/agent.d.ts +65 -0
  4. package/dist/agent/agent.js +39 -0
  5. package/dist/agent/compose-hooks.d.ts +13 -0
  6. package/dist/agent/compose-hooks.js +197 -0
  7. package/dist/agent/concurrency.d.ts +22 -0
  8. package/dist/agent/concurrency.js +70 -0
  9. package/dist/agent/context-report.d.ts +60 -0
  10. package/dist/agent/context-report.js +45 -0
  11. package/dist/agent/graph.d.ts +48 -0
  12. package/dist/agent/graph.js +129 -0
  13. package/dist/agent/guardrail.d.ts +105 -0
  14. package/dist/agent/guardrail.js +314 -0
  15. package/dist/agent/handoff-executor.d.ts +21 -0
  16. package/dist/agent/handoff-executor.js +95 -0
  17. package/dist/agent/handoff.d.ts +42 -0
  18. package/dist/agent/handoff.js +70 -0
  19. package/dist/agent/index.d.ts +25 -0
  20. package/dist/agent/index.js +19 -0
  21. package/dist/agent/instruction-context.d.ts +33 -0
  22. package/dist/agent/instruction-context.js +100 -0
  23. package/dist/agent/pause.d.ts +12 -0
  24. package/dist/agent/pause.js +82 -0
  25. package/dist/agent/profile-builtins.d.ts +8 -0
  26. package/dist/agent/profile-builtins.js +130 -0
  27. package/dist/agent/profiles.d.ts +94 -0
  28. package/dist/agent/profiles.js +264 -0
  29. package/dist/agent/recovery.d.ts +10 -0
  30. package/dist/agent/recovery.js +151 -0
  31. package/dist/agent/run-support.d.ts +79 -0
  32. package/dist/agent/run-support.js +211 -0
  33. package/dist/agent/runner.d.ts +246 -0
  34. package/dist/agent/runner.js +786 -0
  35. package/dist/agent/session.d.ts +363 -0
  36. package/dist/agent/session.js +937 -0
  37. package/dist/agent/subagent-tools.d.ts +18 -0
  38. package/dist/agent/subagent-tools.js +650 -0
  39. package/dist/agent/subagent.d.ts +56 -0
  40. package/dist/agent/subagent.js +50 -0
  41. package/dist/agent/toolset.d.ts +24 -0
  42. package/dist/agent/toolset.js +112 -0
  43. package/dist/agent/workflow/index.d.ts +9 -0
  44. package/dist/agent/workflow/index.js +8 -0
  45. package/dist/agent/workflow/journal.d.ts +180 -0
  46. package/dist/agent/workflow/journal.js +224 -0
  47. package/dist/agent/workflow/manager.d.ts +27 -0
  48. package/dist/agent/workflow/manager.js +33 -0
  49. package/dist/agent/workflow/parse.d.ts +17 -0
  50. package/dist/agent/workflow/parse.js +174 -0
  51. package/dist/agent/workflow/prompt.d.ts +8 -0
  52. package/dist/agent/workflow/prompt.js +84 -0
  53. package/dist/agent/workflow/runtime.d.ts +64 -0
  54. package/dist/agent/workflow/runtime.js +380 -0
  55. package/dist/agent/workflow/sandbox.d.ts +35 -0
  56. package/dist/agent/workflow/sandbox.js +90 -0
  57. package/dist/agent/workflow/snapshot.d.ts +36 -0
  58. package/dist/agent/workflow/snapshot.js +9 -0
  59. package/dist/agent/workflow/structured.d.ts +35 -0
  60. package/dist/agent/workflow/structured.js +79 -0
  61. package/dist/agent/workflow/tool.d.ts +14 -0
  62. package/dist/agent/workflow/tool.js +569 -0
  63. package/dist/agent/workflow/types.d.ts +100 -0
  64. package/dist/agent/workflow/types.js +17 -0
  65. package/dist/agent/worktree.d.ts +38 -0
  66. package/dist/agent/worktree.js +56 -0
  67. package/dist/capabilities/assembler.d.ts +39 -0
  68. package/dist/capabilities/assembler.js +171 -0
  69. package/dist/capabilities/background/agent-task.d.ts +51 -0
  70. package/dist/capabilities/background/agent-task.js +101 -0
  71. package/dist/capabilities/background/command-task.d.ts +43 -0
  72. package/dist/capabilities/background/command-task.js +86 -0
  73. package/dist/capabilities/background/index.d.ts +20 -0
  74. package/dist/capabilities/background/index.js +57 -0
  75. package/dist/capabilities/background/manager.d.ts +194 -0
  76. package/dist/capabilities/background/manager.js +1131 -0
  77. package/dist/capabilities/background/persist-disk.d.ts +17 -0
  78. package/dist/capabilities/background/persist-disk.js +66 -0
  79. package/dist/capabilities/background/persist.d.ts +61 -0
  80. package/dist/capabilities/background/persist.js +117 -0
  81. package/dist/capabilities/background/question-task.d.ts +32 -0
  82. package/dist/capabilities/background/question-task.js +56 -0
  83. package/dist/capabilities/background/registrar.d.ts +12 -0
  84. package/dist/capabilities/background/registrar.js +9 -0
  85. package/dist/capabilities/background/swappable-sink.d.ts +20 -0
  86. package/dist/capabilities/background/swappable-sink.js +20 -0
  87. package/dist/capabilities/background/task.d.ts +114 -0
  88. package/dist/capabilities/background/task.js +20 -0
  89. package/dist/capabilities/background/tools.d.ts +6 -0
  90. package/dist/capabilities/background/tools.js +190 -0
  91. package/dist/capabilities/background/workflow-task.d.ts +48 -0
  92. package/dist/capabilities/background/workflow-task.js +91 -0
  93. package/dist/capabilities/capability-state.d.ts +13 -0
  94. package/dist/capabilities/capability-state.js +37 -0
  95. package/dist/capabilities/capability.d.ts +145 -0
  96. package/dist/capabilities/capability.js +2 -0
  97. package/dist/capabilities/compaction/full.d.ts +27 -0
  98. package/dist/capabilities/compaction/full.js +155 -0
  99. package/dist/capabilities/compaction/index.d.ts +17 -0
  100. package/dist/capabilities/compaction/index.js +145 -0
  101. package/dist/capabilities/compaction/instruction.d.ts +2 -0
  102. package/dist/capabilities/compaction/instruction.js +31 -0
  103. package/dist/capabilities/compaction/micro.d.ts +17 -0
  104. package/dist/capabilities/compaction/micro.js +57 -0
  105. package/dist/capabilities/compaction/service.d.ts +28 -0
  106. package/dist/capabilities/compaction/service.js +52 -0
  107. package/dist/capabilities/compaction/strategy.d.ts +43 -0
  108. package/dist/capabilities/compaction/strategy.js +116 -0
  109. package/dist/capabilities/compaction/tokens.d.ts +5 -0
  110. package/dist/capabilities/compaction/tokens.js +28 -0
  111. package/dist/capabilities/goal/goal-store.d.ts +69 -0
  112. package/dist/capabilities/goal/goal-store.js +172 -0
  113. package/dist/capabilities/goal/index.d.ts +6 -0
  114. package/dist/capabilities/goal/index.js +31 -0
  115. package/dist/capabilities/goal/injector.d.ts +9 -0
  116. package/dist/capabilities/goal/injector.js +79 -0
  117. package/dist/capabilities/goal/tools.d.ts +6 -0
  118. package/dist/capabilities/goal/tools.js +86 -0
  119. package/dist/capabilities/index.d.ts +25 -0
  120. package/dist/capabilities/index.js +22 -0
  121. package/dist/capabilities/injection.d.ts +44 -0
  122. package/dist/capabilities/injection.js +112 -0
  123. package/dist/capabilities/plan/index.d.ts +6 -0
  124. package/dist/capabilities/plan/index.js +25 -0
  125. package/dist/capabilities/plan/injector.d.ts +13 -0
  126. package/dist/capabilities/plan/injector.js +83 -0
  127. package/dist/capabilities/plan/plan-mode.d.ts +38 -0
  128. package/dist/capabilities/plan/plan-mode.js +113 -0
  129. package/dist/capabilities/plan/policies.d.ts +6 -0
  130. package/dist/capabilities/plan/policies.js +89 -0
  131. package/dist/capabilities/plan/tools.d.ts +15 -0
  132. package/dist/capabilities/plan/tools.js +87 -0
  133. package/dist/capabilities/skills/flow-provider.d.ts +6 -0
  134. package/dist/capabilities/skills/flow-provider.js +50 -0
  135. package/dist/capabilities/skills/index.d.ts +43 -0
  136. package/dist/capabilities/skills/index.js +48 -0
  137. package/dist/capabilities/skills/injector.d.ts +11 -0
  138. package/dist/capabilities/skills/injector.js +27 -0
  139. package/dist/capabilities/skills/parser.d.ts +36 -0
  140. package/dist/capabilities/skills/parser.js +334 -0
  141. package/dist/capabilities/skills/registry.d.ts +33 -0
  142. package/dist/capabilities/skills/registry.js +118 -0
  143. package/dist/capabilities/skills/scanner.d.ts +26 -0
  144. package/dist/capabilities/skills/scanner.js +154 -0
  145. package/dist/capabilities/skills/service.d.ts +39 -0
  146. package/dist/capabilities/skills/service.js +68 -0
  147. package/dist/capabilities/skills/skill-tool.d.ts +13 -0
  148. package/dist/capabilities/skills/skill-tool.js +72 -0
  149. package/dist/capabilities/skills/types.d.ts +62 -0
  150. package/dist/capabilities/skills/types.js +26 -0
  151. package/dist/capabilities/task/index.d.ts +23 -0
  152. package/dist/capabilities/task/index.js +38 -0
  153. package/dist/capabilities/task/injector.d.ts +9 -0
  154. package/dist/capabilities/task/injector.js +62 -0
  155. package/dist/capabilities/task/persist-disk.d.ts +19 -0
  156. package/dist/capabilities/task/persist-disk.js +84 -0
  157. package/dist/capabilities/task/persist.d.ts +52 -0
  158. package/dist/capabilities/task/persist.js +84 -0
  159. package/dist/capabilities/task/task-store.d.ts +44 -0
  160. package/dist/capabilities/task/task-store.js +106 -0
  161. package/dist/capabilities/task/tools.d.ts +12 -0
  162. package/dist/capabilities/task/tools.js +164 -0
  163. package/dist/capabilities/todo/index.d.ts +8 -0
  164. package/dist/capabilities/todo/index.js +21 -0
  165. package/dist/capabilities/todo/injector.d.ts +9 -0
  166. package/dist/capabilities/todo/injector.js +68 -0
  167. package/dist/capabilities/todo/todo-store.d.ts +19 -0
  168. package/dist/capabilities/todo/todo-store.js +36 -0
  169. package/dist/capabilities/todo/tools.d.ts +6 -0
  170. package/dist/capabilities/todo/tools.js +70 -0
  171. package/dist/capabilities/tool-provider.d.ts +12 -0
  172. package/dist/capabilities/tool-provider.js +20 -0
  173. package/dist/capabilities/user-hooks/engine.d.ts +22 -0
  174. package/dist/capabilities/user-hooks/engine.js +105 -0
  175. package/dist/capabilities/user-hooks/index.d.ts +13 -0
  176. package/dist/capabilities/user-hooks/index.js +126 -0
  177. package/dist/capabilities/user-hooks/types.d.ts +26 -0
  178. package/dist/capabilities/user-hooks/types.js +19 -0
  179. package/dist/capabilities/workflow/index.d.ts +16 -0
  180. package/dist/capabilities/workflow/index.js +15 -0
  181. package/dist/commands/index.d.ts +31 -0
  182. package/dist/commands/index.js +318 -0
  183. package/dist/config/config-store.d.ts +29 -0
  184. package/dist/config/config-store.js +103 -0
  185. package/dist/config/file-source.d.ts +40 -0
  186. package/dist/config/file-source.js +78 -0
  187. package/dist/config/flags.d.ts +13 -0
  188. package/dist/config/flags.js +25 -0
  189. package/dist/config/index.d.ts +17 -0
  190. package/dist/config/index.js +10 -0
  191. package/dist/config/merge.d.ts +5 -0
  192. package/dist/config/merge.js +57 -0
  193. package/dist/config/model-catalog.d.ts +17 -0
  194. package/dist/config/model-catalog.js +37 -0
  195. package/dist/config/paths.d.ts +31 -0
  196. package/dist/config/paths.js +28 -0
  197. package/dist/config/provider-manager.d.ts +57 -0
  198. package/dist/config/provider-manager.js +344 -0
  199. package/dist/config/resolver.d.ts +40 -0
  200. package/dist/config/resolver.js +52 -0
  201. package/dist/config/schema.d.ts +389 -0
  202. package/dist/config/schema.js +132 -0
  203. package/dist/events/events.d.ts +348 -0
  204. package/dist/events/events.js +146 -0
  205. package/dist/events/index.d.ts +10 -0
  206. package/dist/events/index.js +5 -0
  207. package/dist/events/projection.d.ts +207 -0
  208. package/dist/events/projection.js +438 -0
  209. package/dist/events/publisher.d.ts +48 -0
  210. package/dist/events/publisher.js +404 -0
  211. package/dist/events/redacting-sink.d.ts +11 -0
  212. package/dist/events/redacting-sink.js +31 -0
  213. package/dist/home.d.ts +16 -0
  214. package/dist/home.js +20 -0
  215. package/dist/index.d.ts +22 -0
  216. package/dist/index.js +22 -0
  217. package/dist/internal.d.ts +33 -0
  218. package/dist/internal.js +29 -0
  219. package/dist/llm/auth.d.ts +22 -0
  220. package/dist/llm/auth.js +112 -0
  221. package/dist/llm/capability.d.ts +13 -0
  222. package/dist/llm/capability.js +45 -0
  223. package/dist/llm/define-model.d.ts +110 -0
  224. package/dist/llm/define-model.js +252 -0
  225. package/dist/llm/errors.d.ts +33 -0
  226. package/dist/llm/errors.js +154 -0
  227. package/dist/llm/index.d.ts +14 -0
  228. package/dist/llm/index.js +8 -0
  229. package/dist/llm/model.d.ts +43 -0
  230. package/dist/llm/model.js +9 -0
  231. package/dist/llm/retry.d.ts +35 -0
  232. package/dist/llm/retry.js +160 -0
  233. package/dist/llm/runtime.d.ts +25 -0
  234. package/dist/llm/runtime.js +38 -0
  235. package/dist/logging/diagnostics.d.ts +21 -0
  236. package/dist/logging/diagnostics.js +46 -0
  237. package/dist/logging/index.d.ts +11 -0
  238. package/dist/logging/index.js +7 -0
  239. package/dist/logging/logger.d.ts +25 -0
  240. package/dist/logging/logger.js +54 -0
  241. package/dist/logging/paths.d.ts +11 -0
  242. package/dist/logging/paths.js +20 -0
  243. package/dist/logging/policy.d.ts +5 -0
  244. package/dist/logging/policy.js +19 -0
  245. package/dist/logging/redact.d.ts +10 -0
  246. package/dist/logging/redact.js +95 -0
  247. package/dist/logging/sinks.d.ts +67 -0
  248. package/dist/logging/sinks.js +117 -0
  249. package/dist/loop/context.d.ts +69 -0
  250. package/dist/loop/context.js +129 -0
  251. package/dist/loop/errors.d.ts +8 -0
  252. package/dist/loop/errors.js +27 -0
  253. package/dist/loop/events.d.ts +14 -0
  254. package/dist/loop/events.js +2 -0
  255. package/dist/loop/index.d.ts +10 -0
  256. package/dist/loop/index.js +7 -0
  257. package/dist/loop/interruption.d.ts +118 -0
  258. package/dist/loop/interruption.js +191 -0
  259. package/dist/loop/run-turn.d.ts +54 -0
  260. package/dist/loop/run-turn.js +203 -0
  261. package/dist/loop/scheduler.d.ts +18 -0
  262. package/dist/loop/scheduler.js +71 -0
  263. package/dist/loop/steer.d.ts +122 -0
  264. package/dist/loop/steer.js +209 -0
  265. package/dist/loop/tool-call.d.ts +41 -0
  266. package/dist/loop/tool-call.js +326 -0
  267. package/dist/loop/turn-step.d.ts +57 -0
  268. package/dist/loop/turn-step.js +298 -0
  269. package/dist/loop/types.d.ts +217 -0
  270. package/dist/loop/types.js +2 -0
  271. package/dist/loop/usage.d.ts +6 -0
  272. package/dist/loop/usage.js +44 -0
  273. package/dist/mcp/auth-tool.d.ts +12 -0
  274. package/dist/mcp/auth-tool.js +92 -0
  275. package/dist/mcp/capability.d.ts +7 -0
  276. package/dist/mcp/capability.js +91 -0
  277. package/dist/mcp/config-loader.d.ts +28 -0
  278. package/dist/mcp/config-loader.js +115 -0
  279. package/dist/mcp/filter.d.ts +18 -0
  280. package/dist/mcp/filter.js +35 -0
  281. package/dist/mcp/index.d.ts +23 -0
  282. package/dist/mcp/index.js +13 -0
  283. package/dist/mcp/manager.d.ts +51 -0
  284. package/dist/mcp/manager.js +412 -0
  285. package/dist/mcp/mock-transport.d.ts +40 -0
  286. package/dist/mcp/mock-transport.js +68 -0
  287. package/dist/mcp/oauth/callback-server.d.ts +14 -0
  288. package/dist/mcp/oauth/callback-server.js +122 -0
  289. package/dist/mcp/oauth/index.d.ts +9 -0
  290. package/dist/mcp/oauth/index.js +5 -0
  291. package/dist/mcp/oauth/provider.d.ts +39 -0
  292. package/dist/mcp/oauth/provider.js +121 -0
  293. package/dist/mcp/oauth/service.d.ts +34 -0
  294. package/dist/mcp/oauth/service.js +130 -0
  295. package/dist/mcp/oauth/store.d.ts +40 -0
  296. package/dist/mcp/oauth/store.js +134 -0
  297. package/dist/mcp/output.d.ts +12 -0
  298. package/dist/mcp/output.js +110 -0
  299. package/dist/mcp/provider.d.ts +7 -0
  300. package/dist/mcp/provider.js +56 -0
  301. package/dist/mcp/sdk-transport.d.ts +25 -0
  302. package/dist/mcp/sdk-transport.js +228 -0
  303. package/dist/mcp/server.d.ts +77 -0
  304. package/dist/mcp/server.js +120 -0
  305. package/dist/mcp/tool-naming.d.ts +4 -0
  306. package/dist/mcp/tool-naming.js +26 -0
  307. package/dist/mcp/types.d.ts +75 -0
  308. package/dist/mcp/types.js +2 -0
  309. package/dist/net/index.d.ts +3 -0
  310. package/dist/net/index.js +2 -0
  311. package/dist/net/proxy.d.ts +16 -0
  312. package/dist/net/proxy.js +42 -0
  313. package/dist/permission/auto-approver/index.d.ts +3 -0
  314. package/dist/permission/auto-approver/index.js +3 -0
  315. package/dist/permission/auto-approver/llm-auto-approver.d.ts +53 -0
  316. package/dist/permission/auto-approver/llm-auto-approver.js +122 -0
  317. package/dist/permission/auto-approver/prompts-data.d.ts +9 -0
  318. package/dist/permission/auto-approver/prompts-data.js +155 -0
  319. package/dist/permission/auto-approver/prompts.d.ts +18 -0
  320. package/dist/permission/auto-approver/prompts.js +40 -0
  321. package/dist/permission/auto-approver/transcript.d.ts +22 -0
  322. package/dist/permission/auto-approver/transcript.js +75 -0
  323. package/dist/permission/auto-approver/xml.d.ts +5 -0
  324. package/dist/permission/auto-approver/xml.js +25 -0
  325. package/dist/permission/index.d.ts +7 -0
  326. package/dist/permission/index.js +5 -0
  327. package/dist/permission/manager.d.ts +74 -0
  328. package/dist/permission/manager.js +162 -0
  329. package/dist/permission/matches-rule.d.ts +27 -0
  330. package/dist/permission/matches-rule.js +54 -0
  331. package/dist/permission/policies.d.ts +14 -0
  332. package/dist/permission/policies.js +233 -0
  333. package/dist/permission/types.d.ts +84 -0
  334. package/dist/permission/types.js +2 -0
  335. package/dist/plugins/archive.d.ts +3 -0
  336. package/dist/plugins/archive.js +58 -0
  337. package/dist/plugins/github-resolver.d.ts +13 -0
  338. package/dist/plugins/github-resolver.js +20 -0
  339. package/dist/plugins/hooks.d.ts +28 -0
  340. package/dist/plugins/hooks.js +296 -0
  341. package/dist/plugins/index.d.ts +23 -0
  342. package/dist/plugins/index.js +23 -0
  343. package/dist/plugins/injector.d.ts +11 -0
  344. package/dist/plugins/injector.js +32 -0
  345. package/dist/plugins/manager.d.ts +37 -0
  346. package/dist/plugins/manager.js +330 -0
  347. package/dist/plugins/manifest.d.ts +9 -0
  348. package/dist/plugins/manifest.js +234 -0
  349. package/dist/plugins/marketplace.d.ts +85 -0
  350. package/dist/plugins/marketplace.js +205 -0
  351. package/dist/plugins/source.d.ts +23 -0
  352. package/dist/plugins/source.js +87 -0
  353. package/dist/plugins/store.d.ts +20 -0
  354. package/dist/plugins/store.js +30 -0
  355. package/dist/plugins/types.d.ts +118 -0
  356. package/dist/plugins/types.js +5 -0
  357. package/dist/protocol/index.d.ts +4 -0
  358. package/dist/protocol/index.js +2 -0
  359. package/dist/protocol/tool-schema.d.ts +6 -0
  360. package/dist/protocol/tool-schema.js +2 -0
  361. package/dist/store/blob-store.d.ts +45 -0
  362. package/dist/store/blob-store.js +120 -0
  363. package/dist/store/catalog-store.d.ts +32 -0
  364. package/dist/store/catalog-store.js +73 -0
  365. package/dist/store/disk-store.d.ts +58 -0
  366. package/dist/store/disk-store.js +369 -0
  367. package/dist/store/index.d.ts +23 -0
  368. package/dist/store/index.js +15 -0
  369. package/dist/store/lock.d.ts +86 -0
  370. package/dist/store/lock.js +104 -0
  371. package/dist/store/log-store.d.ts +89 -0
  372. package/dist/store/log-store.js +296 -0
  373. package/dist/store/migrate.d.ts +26 -0
  374. package/dist/store/migrate.js +32 -0
  375. package/dist/store/origin.d.ts +89 -0
  376. package/dist/store/origin.js +16 -0
  377. package/dist/store/pg.d.ts +90 -0
  378. package/dist/store/pg.js +344 -0
  379. package/dist/store/redacting-store.d.ts +21 -0
  380. package/dist/store/redacting-store.js +46 -0
  381. package/dist/store/redis.d.ts +89 -0
  382. package/dist/store/redis.js +370 -0
  383. package/dist/store/repository.d.ts +150 -0
  384. package/dist/store/repository.js +508 -0
  385. package/dist/store/session-catalog.d.ts +32 -0
  386. package/dist/store/session-catalog.js +117 -0
  387. package/dist/store/storage.d.ts +27 -0
  388. package/dist/store/storage.js +54 -0
  389. package/dist/store/store.d.ts +262 -0
  390. package/dist/store/store.js +129 -0
  391. package/dist/store/workdir-key.d.ts +4 -0
  392. package/dist/store/workdir-key.js +28 -0
  393. package/dist/tool/access.d.ts +37 -0
  394. package/dist/tool/access.js +79 -0
  395. package/dist/tool/ask.d.ts +22 -0
  396. package/dist/tool/ask.js +38 -0
  397. package/dist/tool/background.d.ts +109 -0
  398. package/dist/tool/background.js +39 -0
  399. package/dist/tool/builtin/ask-user-question.d.ts +2 -0
  400. package/dist/tool/builtin/ask-user-question.js +175 -0
  401. package/dist/tool/builtin/bash.d.ts +2 -0
  402. package/dist/tool/builtin/bash.js +407 -0
  403. package/dist/tool/builtin/edit.d.ts +2 -0
  404. package/dist/tool/builtin/edit.js +202 -0
  405. package/dist/tool/builtin/glob.d.ts +3 -0
  406. package/dist/tool/builtin/glob.js +260 -0
  407. package/dist/tool/builtin/grep.d.ts +2 -0
  408. package/dist/tool/builtin/grep.js +574 -0
  409. package/dist/tool/builtin/line-endings.d.ts +10 -0
  410. package/dist/tool/builtin/line-endings.js +41 -0
  411. package/dist/tool/builtin/read.d.ts +28 -0
  412. package/dist/tool/builtin/read.js +498 -0
  413. package/dist/tool/builtin/write.d.ts +2 -0
  414. package/dist/tool/builtin/write.js +179 -0
  415. package/dist/tool/define.d.ts +46 -0
  416. package/dist/tool/define.js +45 -0
  417. package/dist/tool/file-freshness.d.ts +81 -0
  418. package/dist/tool/file-freshness.js +67 -0
  419. package/dist/tool/filesystem-tools.d.ts +16 -0
  420. package/dist/tool/filesystem-tools.js +19 -0
  421. package/dist/tool/git-context.d.ts +20 -0
  422. package/dist/tool/git-context.js +114 -0
  423. package/dist/tool/index.d.ts +37 -0
  424. package/dist/tool/index.js +34 -0
  425. package/dist/tool/machine-base.d.ts +138 -0
  426. package/dist/tool/machine-base.js +388 -0
  427. package/dist/tool/machine-local.d.ts +35 -0
  428. package/dist/tool/machine-local.js +316 -0
  429. package/dist/tool/machine-null.d.ts +36 -0
  430. package/dist/tool/machine-null.js +64 -0
  431. package/dist/tool/machine-ssh.d.ts +86 -0
  432. package/dist/tool/machine-ssh.js +576 -0
  433. package/dist/tool/machine.d.ts +333 -0
  434. package/dist/tool/machine.js +15 -0
  435. package/dist/tool/policies/path-access.d.ts +48 -0
  436. package/dist/tool/policies/path-access.js +186 -0
  437. package/dist/tool/policies/sensitive.d.ts +3 -0
  438. package/dist/tool/policies/sensitive.js +60 -0
  439. package/dist/tool/questions.d.ts +40 -0
  440. package/dist/tool/questions.js +8 -0
  441. package/dist/tool/search/activation.d.ts +13 -0
  442. package/dist/tool/search/activation.js +31 -0
  443. package/dist/tool/search/deferral.d.ts +37 -0
  444. package/dist/tool/search/deferral.js +128 -0
  445. package/dist/tool/search/search-tool.d.ts +9 -0
  446. package/dist/tool/search/search-tool.js +62 -0
  447. package/dist/tool/shell-env.d.ts +9 -0
  448. package/dist/tool/shell-env.js +34 -0
  449. package/dist/tool/support/bash-destructive.d.ts +24 -0
  450. package/dist/tool/support/bash-destructive.js +63 -0
  451. package/dist/tool/support/bash-paths.d.ts +7 -0
  452. package/dist/tool/support/bash-paths.js +247 -0
  453. package/dist/tool/support/bash-read-only.d.ts +8 -0
  454. package/dist/tool/support/bash-read-only.js +165 -0
  455. package/dist/tool/support/bash-rule-match.d.ts +20 -0
  456. package/dist/tool/support/bash-rule-match.js +191 -0
  457. package/dist/tool/support/file-type.d.ts +10 -0
  458. package/dist/tool/support/file-type.js +149 -0
  459. package/dist/tool/support/git-worktree.d.ts +10 -0
  460. package/dist/tool/support/git-worktree.js +63 -0
  461. package/dist/tool/support/image-compress.d.ts +69 -0
  462. package/dist/tool/support/image-compress.js +265 -0
  463. package/dist/tool/support/machine-ops.d.ts +34 -0
  464. package/dist/tool/support/machine-ops.js +34 -0
  465. package/dist/tool/support/path-glob-match.d.ts +12 -0
  466. package/dist/tool/support/path-glob-match.js +84 -0
  467. package/dist/tool/support/result-builder.d.ts +27 -0
  468. package/dist/tool/support/result-builder.js +108 -0
  469. package/dist/tool/support/rg-locator.d.ts +20 -0
  470. package/dist/tool/support/rg-locator.js +42 -0
  471. package/dist/tool/support/ripgrep-run.d.ts +65 -0
  472. package/dist/tool/support/ripgrep-run.js +40 -0
  473. package/dist/tool/support/rule-match.d.ts +6 -0
  474. package/dist/tool/support/rule-match.js +23 -0
  475. package/dist/tool/support/tool-path.d.ts +8 -0
  476. package/dist/tool/support/tool-path.js +28 -0
  477. package/dist/tool/support/workspace.d.ts +5 -0
  478. package/dist/tool/support/workspace.js +2 -0
  479. package/dist/tool/types.d.ts +131 -0
  480. package/dist/tool/types.js +2 -0
  481. package/dist/tool/web/fetch-url.d.ts +4 -0
  482. package/dist/tool/web/fetch-url.js +61 -0
  483. package/dist/tool/web/index.d.ts +11 -0
  484. package/dist/tool/web/index.js +7 -0
  485. package/dist/tool/web/providers/direct-fetch.d.ts +33 -0
  486. package/dist/tool/web/providers/direct-fetch.js +198 -0
  487. package/dist/tool/web/providers/firecrawl.d.ts +16 -0
  488. package/dist/tool/web/providers/firecrawl.js +59 -0
  489. package/dist/tool/web/providers/tavily.d.ts +14 -0
  490. package/dist/tool/web/providers/tavily.js +43 -0
  491. package/dist/tool/web/types.d.ts +41 -0
  492. package/dist/tool/web/types.js +7 -0
  493. package/dist/tool/web/web-search.d.ts +4 -0
  494. package/dist/tool/web/web-search.js +68 -0
  495. package/dist/tool/workspace-spec.d.ts +74 -0
  496. package/dist/tool/workspace-spec.js +177 -0
  497. package/dist/tracing/bridge.d.ts +7 -0
  498. package/dist/tracing/bridge.js +171 -0
  499. package/dist/tracing/index.d.ts +9 -0
  500. package/dist/tracing/index.js +5 -0
  501. package/dist/tracing/otel.d.ts +38 -0
  502. package/dist/tracing/otel.js +221 -0
  503. package/dist/tracing/processor.d.ts +47 -0
  504. package/dist/tracing/processor.js +94 -0
  505. package/dist/tracing/spans.d.ts +94 -0
  506. package/dist/tracing/spans.js +56 -0
  507. package/dist/ui/ai-sdk.d.ts +114 -0
  508. package/dist/ui/ai-sdk.js +175 -0
  509. package/dist/ui/index.d.ts +2 -0
  510. package/dist/ui/index.js +2 -0
  511. package/package.json +101 -0
@@ -0,0 +1,48 @@
1
+ import type { AgentRecord, SessionStore } from "../store/store.ts";
2
+ import type { AgentEvent, AgentEventInput, AgentEventListener, EventSink, WorkflowProgressEvent } from "./events.ts";
3
+ export type EventPublicationMode = "immediate" | "committed";
4
+ /**
5
+ * The one event publication boundary for a Session.
6
+ *
7
+ * `immediate` keeps the local/TUI latency profile: a projectable record is emitted before its
8
+ * append settles. `committed` serializes live-only events and record appends through one queue;
9
+ * a projectable record becomes visible only after the store assigned its sequence. Therefore
10
+ * Projection, RunHandle and transports all see the same ordered, committed stream.
11
+ */
12
+ export declare class SessionEventPublisher implements EventSink {
13
+ readonly sessionId: string;
14
+ readonly mode: EventPublicationMode;
15
+ readonly store?: SessionStore;
16
+ private readonly sink;
17
+ private tail;
18
+ constructor(sessionId: string, sink: EventSink, innerStore: SessionStore | undefined, mode?: EventPublicationMode);
19
+ emit(input: AgentEventInput): Promise<void>;
20
+ subscribe(listener: AgentEventListener): () => void;
21
+ child(addressSegment: string): EventSink;
22
+ flush(): Promise<void>;
23
+ appendRecord(inner: SessionStore, input: AgentRecord): Promise<string>;
24
+ private emitSafely;
25
+ private enqueue;
26
+ }
27
+ /** Lossless durable-record projection shared by publication and managed `events.list()`. */
28
+ export declare function agentEventFromRecord(record: AgentRecord, sessionId: string): AgentEvent | undefined;
29
+ /**
30
+ * Does this event reach the session log, so that a reader can find it again later?
31
+ *
32
+ * Two kinds do: projections of durable records (`message.appended`, `usage.updated`, ...) and
33
+ * the lifecycle events the publisher journals as `event.lifecycle`. Everything else — token
34
+ * deltas, retries, warnings — exists only on the live channel. A transport that hands out
35
+ * resume cursors must hand out only the durable kind: a cursor naming a delta points at
36
+ * nothing a re-read of the log can locate.
37
+ */
38
+ export declare function isDurableAgentEvent(event: AgentEvent): boolean;
39
+ export interface WorkflowRecordProjection {
40
+ readonly runId: string;
41
+ readonly toolCallId?: string;
42
+ readonly progress: WorkflowProgressEvent;
43
+ }
44
+ /** Pure workflow-journal projection shared by historical seeding and live publication. */
45
+ export declare function workflowProgressFromRecord(record: Extract<AgentRecord, {
46
+ type: "custom";
47
+ }>): WorkflowRecordProjection | undefined;
48
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1,404 @@
1
+ import { customMessage, DEFAULT_ADDRESS } from "../store/store.js";
2
+ import { newAgentEventId, normalizeAgentEvent } from "./events.js";
3
+ /**
4
+ * The one event publication boundary for a Session.
5
+ *
6
+ * `immediate` keeps the local/TUI latency profile: a projectable record is emitted before its
7
+ * append settles. `committed` serializes live-only events and record appends through one queue;
8
+ * a projectable record becomes visible only after the store assigned its sequence. Therefore
9
+ * Projection, RunHandle and transports all see the same ordered, committed stream.
10
+ */
11
+ export class SessionEventPublisher {
12
+ sessionId;
13
+ mode;
14
+ store;
15
+ sink;
16
+ tail = Promise.resolve();
17
+ constructor(sessionId, sink, innerStore, mode = "immediate") {
18
+ this.sessionId = sessionId;
19
+ this.sink = sink;
20
+ this.mode = mode;
21
+ this.store = innerStore === undefined ? undefined : new PublishingSessionStore(innerStore, this);
22
+ }
23
+ emit(input) {
24
+ const event = normalizeAgentEvent(input);
25
+ if (this.store !== undefined && isPersistedLifecycleEvent(event)) {
26
+ const write = this.store.appendRecord({
27
+ type: "event.lifecycle",
28
+ eventId: event.eventId,
29
+ time: Date.now(),
30
+ address: event.address,
31
+ event: lifecycleBody(event),
32
+ }).then(() => undefined);
33
+ // Most emitters do not await. A refused write — a fenced store telling a stale holder to
34
+ // stop — must reach a caller that awaits, and must not take the process down for one
35
+ // that does not: the run's own history writes fail the same way, and those are awaited.
36
+ write.catch(() => undefined);
37
+ return write;
38
+ }
39
+ if (this.mode === "immediate")
40
+ return this.emitSafely(event);
41
+ return this.enqueue(() => this.emitSafely(event));
42
+ }
43
+ subscribe(listener) {
44
+ return this.sink.subscribe(listener);
45
+ }
46
+ child(addressSegment) {
47
+ return new PublisherAddressProxy(this, addressSegment);
48
+ }
49
+ async flush() {
50
+ await this.tail;
51
+ }
52
+ appendRecord(inner, input) {
53
+ // Stamp before projection so immediate delivery and the eventually stored record have the
54
+ // same timestamp as well as the same eventId (stores normally stamp time internally).
55
+ const stamped = input.time === undefined ? { ...input, time: Date.now() } : input;
56
+ const eventId = projectableEventBody(stamped) === undefined ? undefined : stamped.eventId ?? newAgentEventId();
57
+ const record = eventId === undefined ? stamped : { ...stamped, eventId };
58
+ const event = agentEventFromRecord(record, this.sessionId);
59
+ if (this.mode === "immediate") {
60
+ if (event !== undefined)
61
+ void this.emitSafely(event);
62
+ // Preserve one session-wide append order even for third-party stores that do not
63
+ // serialize concurrent callers themselves. Live publication still bypasses this queue.
64
+ return this.enqueue(() => inner.appendRecord(record));
65
+ }
66
+ return this.enqueue(async () => {
67
+ const sequence = await inner.appendRecord(record);
68
+ if (event !== undefined)
69
+ await this.emitSafely(event);
70
+ return sequence;
71
+ });
72
+ }
73
+ emitSafely(event) {
74
+ // A broken observer must never turn a successful durable append into a failed write.
75
+ return Promise.resolve(this.sink.emit(event)).catch(() => undefined);
76
+ }
77
+ enqueue(operation) {
78
+ const task = this.tail.then(operation, operation);
79
+ this.tail = task.then(() => undefined, () => undefined);
80
+ return task;
81
+ }
82
+ }
83
+ class PublisherAddressProxy {
84
+ parent;
85
+ segment;
86
+ constructor(parent, segment) {
87
+ this.parent = parent;
88
+ this.segment = segment;
89
+ }
90
+ emit(event) {
91
+ const address = event.address && event.address !== this.segment
92
+ ? `${this.segment}/${event.address}`
93
+ : this.segment;
94
+ return this.parent.emit({ ...event, address });
95
+ }
96
+ subscribe(listener) {
97
+ return this.parent.subscribe(listener);
98
+ }
99
+ child(addressSegment) {
100
+ return new PublisherAddressProxy(this.parent, `${this.segment}/${addressSegment}`);
101
+ }
102
+ }
103
+ class PublishingSessionStore {
104
+ inner;
105
+ publisher;
106
+ listStateKeys;
107
+ rewrite;
108
+ storageDir;
109
+ constructor(inner, publisher) {
110
+ this.inner = inner;
111
+ this.publisher = publisher;
112
+ if (inner.listStateKeys !== undefined)
113
+ this.listStateKeys = () => inner.listStateKeys();
114
+ if (inner.rewrite !== undefined)
115
+ this.rewrite = (address) => inner.rewrite(address);
116
+ if (inner.storageDir !== undefined)
117
+ this.storageDir = () => inner.storageDir();
118
+ }
119
+ appendRecord(record) {
120
+ return this.publisher.appendRecord(this.inner, record);
121
+ }
122
+ readRecords(filter) {
123
+ return this.inner.readRecords(filter);
124
+ }
125
+ readRecordPage(options) {
126
+ return this.inner.readRecordPage(options);
127
+ }
128
+ putState(key, value) {
129
+ return this.inner.putState(key, value);
130
+ }
131
+ getState(key) {
132
+ return this.inner.getState(key);
133
+ }
134
+ deleteState(key) {
135
+ return this.inner.deleteState(key);
136
+ }
137
+ async flush() {
138
+ await this.publisher.flush();
139
+ await this.inner.flush?.();
140
+ }
141
+ async close() {
142
+ await this.publisher.flush();
143
+ await this.inner.close?.();
144
+ }
145
+ }
146
+ /** Lossless durable-record projection shared by publication and managed `events.list()`. */
147
+ export function agentEventFromRecord(record, sessionId) {
148
+ if (record.eventId === undefined)
149
+ return undefined;
150
+ const body = projectableEventBody(record);
151
+ if (body === undefined)
152
+ return undefined;
153
+ return normalizeAgentEvent({
154
+ ...body,
155
+ eventId: record.eventId,
156
+ address: record.address ?? DEFAULT_ADDRESS,
157
+ sessionId,
158
+ });
159
+ }
160
+ function projectableEventBody(record) {
161
+ switch (record.type) {
162
+ case "context.append_message":
163
+ return { type: "message.appended", message: record.message, origin: record.origin };
164
+ case "custom_message":
165
+ return { type: "message.appended", message: customMessage(record.content, record.time), origin: record.origin };
166
+ case "context.replace":
167
+ return { type: "history.replaced", messages: record.messages, origins: record.origins };
168
+ case "context.apply_compaction":
169
+ return {
170
+ type: "history.compacted",
171
+ cutoff: record.cutoff,
172
+ summary: record.summary,
173
+ summaryTimestamp: record.summaryTimestamp,
174
+ };
175
+ case "usage.record":
176
+ return record.total === undefined ? undefined : { type: "usage.updated", usage: record.total };
177
+ case "agent.handoff":
178
+ return {
179
+ type: "agent.handoff",
180
+ from: record.from,
181
+ to: record.to,
182
+ handoffId: record.handoffId,
183
+ fromAddress: record.address ?? DEFAULT_ADDRESS,
184
+ toAddress: record.toAddress,
185
+ };
186
+ case "guardrail.blocked":
187
+ return {
188
+ type: "guardrail.blocked",
189
+ stage: record.stage,
190
+ guardrail: record.guardrail,
191
+ agent: record.agent,
192
+ turnId: record.turnId,
193
+ step: record.step,
194
+ stepId: record.stepId,
195
+ message: record.message,
196
+ };
197
+ case "event.lifecycle":
198
+ return record.event;
199
+ case "custom":
200
+ {
201
+ const projected = workflowProgressFromRecord(record);
202
+ return projected === undefined
203
+ ? undefined
204
+ : {
205
+ type: "workflow.progress",
206
+ runId: projected.runId,
207
+ ...(projected.toolCallId !== undefined ? { toolCallId: projected.toolCallId } : {}),
208
+ progress: projected.progress,
209
+ };
210
+ }
211
+ // The durable half of a delivery receipt. Projecting it means a client that reconnects and
212
+ // replays history sees "this was accepted" even if the run that consumes it never started —
213
+ // which is the whole point of journaling acceptance separately from processing.
214
+ //
215
+ // `channel` here is the delivery's INTENT, not the outcome: acceptance can precede
216
+ // processing by an arbitrary gap, so whether an `auto` delivery ends up steering a running
217
+ // turn or starting a fresh one isn't known yet. The outcome is carried by the events the
218
+ // run itself emits (`steer.queued` / `turn.started`).
219
+ case "inbox.received":
220
+ return {
221
+ type: "delivery.accepted",
222
+ deliveryId: record.origin.deliveryId,
223
+ source: record.origin.source,
224
+ channel: record.mode === "follow_up" ? "follow_up" : record.mode === "steer" ? "steering" : "turn",
225
+ };
226
+ case "metadata":
227
+ case "permission.record_approval":
228
+ case "permission.set_mode":
229
+ case "config.update":
230
+ case "agent.handoff.accepted":
231
+ return undefined;
232
+ default: {
233
+ const exhaustive = record;
234
+ return exhaustive;
235
+ }
236
+ }
237
+ }
238
+ /**
239
+ * Does this event reach the session log, so that a reader can find it again later?
240
+ *
241
+ * Two kinds do: projections of durable records (`message.appended`, `usage.updated`, ...) and
242
+ * the lifecycle events the publisher journals as `event.lifecycle`. Everything else — token
243
+ * deltas, retries, warnings — exists only on the live channel. A transport that hands out
244
+ * resume cursors must hand out only the durable kind: a cursor naming a delta points at
245
+ * nothing a re-read of the log can locate.
246
+ */
247
+ export function isDurableAgentEvent(event) {
248
+ if (isPersistedLifecycleEvent(event))
249
+ return true;
250
+ switch (event.type) {
251
+ case "message.appended":
252
+ case "history.replaced":
253
+ case "history.compacted":
254
+ case "usage.updated":
255
+ case "agent.handoff":
256
+ case "guardrail.blocked":
257
+ case "workflow.progress":
258
+ case "delivery.accepted":
259
+ return true;
260
+ default:
261
+ return false;
262
+ }
263
+ }
264
+ function isPersistedLifecycleEvent(event) {
265
+ switch (event.type) {
266
+ case "agent.started":
267
+ case "agent.ended":
268
+ case "turn.started":
269
+ case "turn.ended":
270
+ case "turn.step.started":
271
+ case "turn.paused":
272
+ case "steer.queued":
273
+ case "tool.detachable":
274
+ case "tool.suspended":
275
+ return true;
276
+ default:
277
+ return false;
278
+ }
279
+ }
280
+ function lifecycleBody(event) {
281
+ switch (event.type) {
282
+ case "agent.started":
283
+ return { type: event.type, agent: event.agent, ...(event.parentToolCallId !== undefined ? { parentToolCallId: event.parentToolCallId } : {}) };
284
+ case "agent.ended":
285
+ return { type: event.type, agent: event.agent };
286
+ case "turn.started":
287
+ return { type: event.type, turnId: event.turnId, ...(event.origin !== undefined ? { origin: event.origin } : {}) };
288
+ case "turn.ended":
289
+ return { type: event.type, turnId: event.turnId, reason: event.reason, ...(event.error !== undefined ? { error: event.error } : {}), ...(event.contextWindow !== undefined ? { contextWindow: event.contextWindow } : {}) };
290
+ case "turn.step.started":
291
+ return { type: event.type, turnId: event.turnId, step: event.step, stepId: event.stepId };
292
+ case "turn.paused":
293
+ return { type: event.type, pending: event.pending };
294
+ case "steer.queued":
295
+ return { type: event.type, steerId: event.steerId, channel: event.channel, origin: event.origin, message: event.message };
296
+ case "tool.detachable":
297
+ return { type: event.type, toolCallId: event.toolCallId, toolName: event.toolName };
298
+ case "tool.suspended":
299
+ return { type: event.type, toolCallId: event.toolCallId, toolName: event.toolName, ...(event.request !== undefined ? { request: event.request } : {}) };
300
+ }
301
+ }
302
+ /** Pure workflow-journal projection shared by historical seeding and live publication. */
303
+ export function workflowProgressFromRecord(record) {
304
+ const address = record.address ?? "";
305
+ if (record.name !== "wf_journal" || !address.startsWith("workflow:"))
306
+ return undefined;
307
+ if (typeof record.data !== "object" || record.data === null)
308
+ return undefined;
309
+ const entry = record.data;
310
+ const runId = address.slice("workflow:".length);
311
+ const toolCallId = typeof entry["parentToolCallId"] === "string" ? entry["parentToolCallId"] : undefined;
312
+ switch (entry["type"]) {
313
+ case "run":
314
+ if (typeof entry["name"] !== "string")
315
+ return undefined;
316
+ return {
317
+ runId,
318
+ ...(toolCallId !== undefined ? { toolCallId } : {}),
319
+ progress: { type: "started", name: entry["name"] },
320
+ };
321
+ case "phase":
322
+ if (typeof entry["index"] !== "number" || typeof entry["title"] !== "string")
323
+ return undefined;
324
+ return {
325
+ runId,
326
+ ...(toolCallId !== undefined ? { toolCallId } : {}),
327
+ progress: {
328
+ type: "phase",
329
+ index: entry["index"],
330
+ title: entry["title"],
331
+ kind: entry["kind"] === "child" ? "child" : "normal",
332
+ },
333
+ };
334
+ case "queued":
335
+ case "started":
336
+ case "result":
337
+ case "error": {
338
+ if (typeof entry["index"] !== "number")
339
+ return undefined;
340
+ const state = entry["type"] === "queued"
341
+ ? "queued"
342
+ : entry["type"] === "started"
343
+ ? "running"
344
+ : entry["type"] === "result"
345
+ ? "done"
346
+ : "error";
347
+ const agent = {
348
+ index: entry["index"],
349
+ label: String(entry["label"] ?? ""),
350
+ ...(typeof entry["phase"] === "string" ? { phase: entry["phase"] } : {}),
351
+ ...(typeof entry["agentId"] === "string" && entry["agentId"].length > 0 ? { agentId: entry["agentId"] } : {}),
352
+ ...(typeof entry["address"] === "string" && entry["address"].length > 0 ? { address: entry["address"] } : {}),
353
+ state,
354
+ ...(state === "error" ? { error: String(entry["error"] ?? "") } : {}),
355
+ ...(state === "done" ? { resultPreview: preview(entry["result"]) } : {}),
356
+ };
357
+ return {
358
+ runId,
359
+ ...(toolCallId !== undefined ? { toolCallId } : {}),
360
+ progress: { type: "agent", record: agent },
361
+ };
362
+ }
363
+ case "log":
364
+ if (typeof entry["message"] !== "string")
365
+ return undefined;
366
+ return {
367
+ runId,
368
+ ...(toolCallId !== undefined ? { toolCallId } : {}),
369
+ progress: { type: "log", message: entry["message"] },
370
+ };
371
+ case "outcome": {
372
+ const status = entry["status"];
373
+ if (status !== "completed" && status !== "failed" && status !== "aborted")
374
+ return undefined;
375
+ return {
376
+ runId,
377
+ ...(toolCallId !== undefined ? { toolCallId } : {}),
378
+ progress: {
379
+ type: "outcome",
380
+ status,
381
+ ok: entry["ok"] === true,
382
+ ...(typeof entry["error"] === "string" ? { error: entry["error"] } : {}),
383
+ },
384
+ };
385
+ }
386
+ default:
387
+ return undefined;
388
+ }
389
+ }
390
+ function preview(value) {
391
+ let rendered;
392
+ if (typeof value === "string")
393
+ rendered = value;
394
+ else {
395
+ try {
396
+ rendered = JSON.stringify(value) ?? String(value);
397
+ }
398
+ catch {
399
+ rendered = String(value);
400
+ }
401
+ }
402
+ return rendered.length > 400 ? `${rendered.slice(0, 400)}…` : rendered;
403
+ }
404
+ //# sourceMappingURL=publisher.js.map
@@ -0,0 +1,11 @@
1
+ import { type RedactOptions } from "../logging/redact.ts";
2
+ import type { AgentEventInput, AgentEventListener, EventSink } from "./events.ts";
3
+ export declare class RedactingSink implements EventSink {
4
+ private readonly inner;
5
+ private readonly options;
6
+ constructor(inner: EventSink, options?: RedactOptions);
7
+ emit(event: AgentEventInput): void | Promise<void>;
8
+ subscribe(listener: AgentEventListener): () => void;
9
+ child(addressSegment: string): EventSink;
10
+ }
11
+ //# sourceMappingURL=redacting-sink.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { redactDeep } from "../logging/redact.js";
2
+ const ENVELOPE_KEYS = new Set(["eventId", "address", "sessionId", "type"]);
3
+ export class RedactingSink {
4
+ inner;
5
+ options;
6
+ constructor(inner, options = {}) {
7
+ this.inner = inner;
8
+ this.options = options;
9
+ }
10
+ emit(event) {
11
+ return this.inner.emit(redactEvent(event, this.options));
12
+ }
13
+ subscribe(listener) {
14
+ return this.inner.subscribe(listener);
15
+ }
16
+ child(addressSegment) {
17
+ return new RedactingSink(this.inner.child(addressSegment), this.options);
18
+ }
19
+ }
20
+ function redactEvent(event, options) {
21
+ const envelope = {};
22
+ const body = {};
23
+ for (const [key, value] of Object.entries(event)) {
24
+ if (ENVELOPE_KEYS.has(key))
25
+ envelope[key] = value;
26
+ else
27
+ body[key] = value;
28
+ }
29
+ return { ...redactDeep(body, options), ...envelope };
30
+ }
31
+ //# sourceMappingURL=redacting-sink.js.map
package/dist/home.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The directory name the framework keeps host-level state under.
3
+ *
4
+ * One constant because it is written from two unrelated layers — MCP OAuth
5
+ * credentials (`mcp/oauth/store.ts`) and background bash logs
6
+ * (`tool/builtin/bash.ts`) — and each used to spell it out inline. It was
7
+ * `.agent-framework`, a name this project has not gone by for some time.
8
+ *
9
+ * There is no fallback to the old directory: anything under it is either
10
+ * disposable (task logs) or re-obtainable (an OAuth token is re-granted by
11
+ * authenticating again).
12
+ */
13
+ export declare const OPERON_HOME_DIRNAME = ".operon";
14
+ /** `~/.operon` on the machine this process runs on. */
15
+ export declare function operonHomeDir(): string;
16
+ //# sourceMappingURL=home.d.ts.map
package/dist/home.js ADDED
@@ -0,0 +1,20 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
3
+ /**
4
+ * The directory name the framework keeps host-level state under.
5
+ *
6
+ * One constant because it is written from two unrelated layers — MCP OAuth
7
+ * credentials (`mcp/oauth/store.ts`) and background bash logs
8
+ * (`tool/builtin/bash.ts`) — and each used to spell it out inline. It was
9
+ * `.agent-framework`, a name this project has not gone by for some time.
10
+ *
11
+ * There is no fallback to the old directory: anything under it is either
12
+ * disposable (task logs) or re-obtainable (an OAuth token is re-granted by
13
+ * authenticating again).
14
+ */
15
+ export const OPERON_HOME_DIRNAME = ".operon";
16
+ /** `~/.operon` on the machine this process runs on. */
17
+ export function operonHomeDir() {
18
+ return join(homedir(), OPERON_HOME_DIRNAME);
19
+ }
20
+ //# sourceMappingURL=home.js.map
@@ -0,0 +1,22 @@
1
+ export * as protocol from "./protocol/index.ts";
2
+ export type { Message, UserMessage, AssistantMessage, ToolResultMessage, ToolCall, TextContent, ImageContent, Usage, Context, Model, Api, KnownApi, Provider, KnownProvider, ThinkingLevel, ToolSchema, PiTool, AssistantMessageEvent, AssistantMessageEventStream, } from "./protocol/index.ts";
3
+ export * from "./llm/index.ts";
4
+ export * from "./tool/index.ts";
5
+ export * from "./loop/index.ts";
6
+ export * from "./permission/index.ts";
7
+ export * from "./events/index.ts";
8
+ export * from "./store/index.ts";
9
+ export * from "./logging/index.ts";
10
+ export * from "./net/index.ts";
11
+ export * from "./tracing/index.ts";
12
+ export * from "./agent/index.ts";
13
+ export * from "./capabilities/index.ts";
14
+ export * from "./config/index.ts";
15
+ export * from "./commands/index.ts";
16
+ export { loadMarketplace, parseMarketplace, loadMarketplaceEntryDetails, parseGithubMarketplaceSource, materializeGithubRepo, } from "./plugins/marketplace.ts";
17
+ export type { Marketplace, MarketplaceEntry, LoadMarketplaceOptions, MarketplaceEntryDetails, } from "./plugins/marketplace.ts";
18
+ export { PluginManager, pluginsCapability, parseHooksDocument, hookDefsFromConfig, } from "./plugins/index.ts";
19
+ export type { PluginManagerOptions, SessionStartSkillResolver, PluginSummary, PluginInfo, PluginSource, ParsedPluginHooks, } from "./plugins/index.ts";
20
+ export { mcpServersCapability, McpOAuthService, JsonFileStore, MemoryMcpCredentialStore } from "./mcp/index.ts";
21
+ export type { McpServersCapabilityOptions, McpOAuthServiceOptions, McpCredentialStore } from "./mcp/index.ts";
22
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ export * as protocol from "./protocol/index.js";
2
+ export * from "./llm/index.js";
3
+ export * from "./tool/index.js";
4
+ export * from "./loop/index.js";
5
+ export * from "./permission/index.js";
6
+ export * from "./events/index.js";
7
+ export * from "./store/index.js";
8
+ export * from "./logging/index.js";
9
+ export * from "./net/index.js";
10
+ export * from "./tracing/index.js";
11
+ export * from "./agent/index.js";
12
+ export * from "./capabilities/index.js";
13
+ export * from "./config/index.js";
14
+ export * from "./commands/index.js";
15
+ // Plugin marketplace loader (stateless utility) + the plugin manager/capability, exposed so an
16
+ // embedder (e.g. operon) can run a single global PluginManager and wire it into its harnesses.
17
+ export { loadMarketplace, parseMarketplace, loadMarketplaceEntryDetails, parseGithubMarketplaceSource, materializeGithubRepo, } from "./plugins/marketplace.js";
18
+ export { PluginManager, pluginsCapability, parseHooksDocument, hookDefsFromConfig, } from "./plugins/index.js";
19
+ // The per-workspace MCP capability, exposed so `defaultCapabilities` can build it from
20
+ // workspace + plugin servers (it lives under the ./mcp subtree, not the main capabilities barrel).
21
+ export { mcpServersCapability, McpOAuthService, JsonFileStore, MemoryMcpCredentialStore } from "./mcp/index.js";
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `operon-agents-core/internal` — low-level engine plumbing.
3
+ *
4
+ * NOT part of the stable public API and NOT re-exported from the main `operon-agents-core`
5
+ * (or `operon-agents`) surface. These are implementation internals — the turn/step loop,
6
+ * retry, tool scheduling, the store blob/migration/index machinery, capability
7
+ * assembly, and file-op / shell-rule helpers — exposed on a dedicated subpath for advanced
8
+ * embedders. No stability guarantees; prefer the main surface.
9
+ */
10
+ export { runTurn } from "./loop/run-turn.ts";
11
+ export type { RunTurnInput } from "./loop/run-turn.ts";
12
+ export { executeStep } from "./loop/turn-step.ts";
13
+ export type { ExecuteStepDeps, StepResult, RecordUsageResult } from "./loop/turn-step.ts";
14
+ export { streamWithRetry, DEFAULT_MAX_RETRIES_PER_STEP } from "./llm/retry.ts";
15
+ export type { StreamWithRetryInput, StreamWithRetryResult, StepRetryingEvent, StepResetEvent } from "./llm/retry.ts";
16
+ export { runToolCallBatch, runCalls } from "./loop/tool-call.ts";
17
+ export type { ToolCallStepContext, ToolBatchResult } from "./loop/tool-call.ts";
18
+ export { ToolScheduler } from "./loop/scheduler.ts";
19
+ export type { ToolCallTask } from "./loop/scheduler.ts";
20
+ export { BlobStore, diskBlobIO, isBlobRef, offloadRecord, rehydrateRecord } from "./store/blob-store.ts";
21
+ export type { BlobStoreOptions, BlobIO } from "./store/blob-store.ts";
22
+ export { WIRE_PROTOCOL_VERSION, WIRE_VERSION_KEY, RECORD_MIGRATIONS, migrateRecord } from "./store/migrate.ts";
23
+ export type { RecordMigration } from "./store/migrate.ts";
24
+ export { encodeWorkdirKey, normalizeWorkDir, slugifyWorkDirName } from "./store/workdir-key.ts";
25
+ export { sessionCatalogPath, appendSessionCatalogRecord, readSessionCatalog } from "./store/session-catalog.ts";
26
+ export type { DiskSessionCatalogEntry, DiskSessionCatalogRecord } from "./store/session-catalog.ts";
27
+ export { readTextFile, writeTextFile, decodeText, fileVersionFromInfo, normalizeForCompare, } from "./tool/support/machine-ops.ts";
28
+ export { matchesBashRule, matchWildcardPattern, permissionRuleExtractPrefix, scanShellCommand, singleCommandMatchesRule, stripSafeEnvPrefix, } from "./tool/support/bash-rule-match.ts";
29
+ export { SshProcess, buildSshExecCommand, sshShellQuote } from "./tool/machine-ssh.ts";
30
+ export { setSessionCloseTimeoutsForTest } from "./agent/session.ts";
31
+ export { assembleCapabilities, AssembledCapabilities } from "./capabilities/assembler.ts";
32
+ export type { AssembleCapabilitiesOptions } from "./capabilities/assembler.ts";
33
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `operon-agents-core/internal` — low-level engine plumbing.
3
+ *
4
+ * NOT part of the stable public API and NOT re-exported from the main `operon-agents-core`
5
+ * (or `operon-agents`) surface. These are implementation internals — the turn/step loop,
6
+ * retry, tool scheduling, the store blob/migration/index machinery, capability
7
+ * assembly, and file-op / shell-rule helpers — exposed on a dedicated subpath for advanced
8
+ * embedders. No stability guarantees; prefer the main surface.
9
+ */
10
+ // ── loop: the turn/step engine ───────────────────────────────────────────────
11
+ export { runTurn } from "./loop/run-turn.js";
12
+ export { executeStep } from "./loop/turn-step.js";
13
+ export { streamWithRetry, DEFAULT_MAX_RETRIES_PER_STEP } from "./llm/retry.js";
14
+ export { runToolCallBatch, runCalls } from "./loop/tool-call.js";
15
+ export { ToolScheduler } from "./loop/scheduler.js";
16
+ // ── store: blobs, wire migration, disk catalog ───────────────────────────────
17
+ export { BlobStore, diskBlobIO, isBlobRef, offloadRecord, rehydrateRecord } from "./store/blob-store.js";
18
+ export { WIRE_PROTOCOL_VERSION, WIRE_VERSION_KEY, RECORD_MIGRATIONS, migrateRecord } from "./store/migrate.js";
19
+ export { encodeWorkdirKey, normalizeWorkDir, slugifyWorkDirName } from "./store/workdir-key.js";
20
+ export { sessionCatalogPath, appendSessionCatalogRecord, readSessionCatalog } from "./store/session-catalog.js";
21
+ // ── tool: file-op and shell-rule helpers, SSH transport internals ────────────
22
+ export { readTextFile, writeTextFile, decodeText, fileVersionFromInfo, normalizeForCompare, } from "./tool/support/machine-ops.js";
23
+ export { matchesBashRule, matchWildcardPattern, permissionRuleExtractPrefix, scanShellCommand, singleCommandMatchesRule, stripSafeEnvPrefix, } from "./tool/support/bash-rule-match.js";
24
+ export { SshProcess, buildSshExecCommand, sshShellQuote } from "./tool/machine-ssh.js";
25
+ // ── agent: test-only hooks ────────────────────────────────────────────────────
26
+ export { setSessionCloseTimeoutsForTest } from "./agent/session.js";
27
+ // ── capabilities: the assembler (Runner-internal wiring) ─────────────────────
28
+ export { assembleCapabilities, AssembledCapabilities } from "./capabilities/assembler.js";
29
+ //# sourceMappingURL=internal.js.map