@leuduan/lagent 0.1.2 → 44.0.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 (353) hide show
  1. package/README.md +28 -15
  2. package/dist/chunks/{UC3FVVJ2.js → 2GCIWSOA.js} +2 -2
  3. package/dist/chunks/2P47AHNK.js +7 -0
  4. package/dist/chunks/3UMZMPWW.js +1 -0
  5. package/dist/chunks/5IRF47YB.js +1 -0
  6. package/dist/chunks/6DRCKZ2C.js +1 -0
  7. package/dist/chunks/6FRNHMCV.js +1 -0
  8. package/dist/chunks/7LI64H5X.js +17 -0
  9. package/dist/chunks/{SL2YLB2F.js → 7VAPNE3L.js} +1 -1
  10. package/dist/chunks/{BM3S37EZ.js → ASSQZH3F.js} +1 -1
  11. package/dist/chunks/B4FXK5ER.js +77 -0
  12. package/dist/chunks/{37YOGDGY.js → BBCW2FZK.js} +1 -1
  13. package/dist/chunks/BPRCULZH.js +1 -0
  14. package/dist/chunks/CANPZYTH.js +24 -0
  15. package/dist/chunks/CQEVREBT.js +1 -0
  16. package/dist/chunks/CUK7CGC7.js +1 -0
  17. package/dist/chunks/D4PQP5MA.js +3 -0
  18. package/dist/chunks/{CDQG7RKA.js → DDZ7YF26.js} +1 -1
  19. package/dist/chunks/EMRB4KCN.js +6 -0
  20. package/dist/chunks/EPYQ5M3B.js +3 -0
  21. package/dist/chunks/G44LG6VL.js +1 -0
  22. package/dist/chunks/GGSVIIWJ.js +2 -0
  23. package/dist/chunks/IAAEP6VL.js +30 -0
  24. package/dist/chunks/{AP6Q4EPT.js → JCTBX33H.js} +1 -1
  25. package/dist/chunks/JFX2MXBA.js +4 -0
  26. package/dist/chunks/JFZZXVWD.js +15 -0
  27. package/dist/chunks/KUZCL2SH.js +1 -0
  28. package/dist/chunks/MHC6VPB4.js +7 -0
  29. package/dist/chunks/MMNNZCBO.js +5 -0
  30. package/dist/chunks/{C5LYCXJG.js → MNJ4SRF7.js} +1 -1
  31. package/dist/chunks/N6IXG2VL.js +1 -0
  32. package/dist/chunks/OCBPT7KE.js +1 -0
  33. package/dist/chunks/OL5A6ITQ.js +1 -0
  34. package/dist/chunks/Q75FUN7D.js +2 -0
  35. package/dist/chunks/Q7S5LFGN.js +1 -0
  36. package/dist/chunks/RCIHV3KG.js +1 -0
  37. package/dist/chunks/S34ZA2R6.js +1 -0
  38. package/dist/chunks/SS3B5W34.js +12 -0
  39. package/dist/chunks/VYMT4TXD.js +1 -0
  40. package/dist/chunks/W57RW55W.js +1 -0
  41. package/dist/compositions/base.d.ts +11 -0
  42. package/dist/{presets → compositions}/codex.d.ts +12 -6
  43. package/dist/{presets/prompts.d.ts → compositions/codexPrompts.d.ts} +1 -1
  44. package/dist/context.d.ts +18 -10
  45. package/dist/index.d.ts +31 -23
  46. package/dist/index.js +1 -77
  47. package/dist/journal/catalog.d.ts +1 -1
  48. package/dist/journal/journal.d.ts +3 -3
  49. package/dist/journal/projection.d.ts +1 -1
  50. package/dist/journal/store.d.ts +3 -3
  51. package/dist/llm/index.d.ts +19 -13
  52. package/dist/llm/index.js +1 -0
  53. package/dist/llm/provider.d.ts +11 -0
  54. package/dist/loop/agent.d.ts +16 -132
  55. package/dist/loop/authorization.d.ts +41 -0
  56. package/dist/loop/auxiliary.d.ts +7 -3
  57. package/dist/loop/chunks.d.ts +3 -3
  58. package/dist/loop/completion.d.ts +17 -0
  59. package/dist/loop/errors.d.ts +6 -29
  60. package/dist/loop/hooks.d.ts +39 -6
  61. package/dist/loop/index.d.ts +7 -28
  62. package/dist/loop/runner.d.ts +134 -0
  63. package/dist/loop/runtime.d.ts +7 -16
  64. package/dist/loop/strategy.d.ts +12 -3
  65. package/dist/loop/{prepare.d.ts → surfacePrepare.d.ts} +2 -2
  66. package/dist/loop/tool.d.ts +11 -6
  67. package/dist/loop/toolCalls.d.ts +3 -10
  68. package/dist/plugin.d.ts +31 -34
  69. package/dist/plugin.js +1 -1
  70. package/dist/plugins/agentsMd.d.ts +24 -20
  71. package/dist/plugins/agentsMd.js +1 -1
  72. package/dist/plugins/ask/index.d.ts +2 -2
  73. package/dist/plugins/ask/index.js +1 -1
  74. package/dist/plugins/ask/service.d.ts +2 -2
  75. package/dist/plugins/commands/index.d.ts +5 -2
  76. package/dist/plugins/commands/index.js +1 -1
  77. package/dist/plugins/commands/output.d.ts +1 -1
  78. package/dist/plugins/commands/record.d.ts +31 -22
  79. package/dist/plugins/commands/service.d.ts +18 -11
  80. package/dist/plugins/commands/{background.d.ts → tools.d.ts} +2 -0
  81. package/dist/plugins/compaction/checkpoint.d.ts +4 -1
  82. package/dist/plugins/compaction/config.d.ts +3 -3
  83. package/dist/plugins/compaction/estimate.d.ts +9 -1
  84. package/dist/plugins/compaction/index.d.ts +87 -2
  85. package/dist/plugins/compaction/index.js +5 -5
  86. package/dist/plugins/compaction/{records.d.ts → record.d.ts} +36 -36
  87. package/dist/plugins/compaction/{log.d.ts → state.d.ts} +8 -1
  88. package/dist/plugins/dateAndBranch.js +1 -1
  89. package/dist/plugins/delegations/answers.d.ts +1 -1
  90. package/dist/plugins/delegations/assignmentKey.d.ts +1 -1
  91. package/dist/plugins/delegations/cleanup.d.ts +1 -1
  92. package/dist/plugins/delegations/index.js +1 -1
  93. package/dist/plugins/delegations/notices.d.ts +8 -8
  94. package/dist/plugins/delegations/obligations.d.ts +13 -13
  95. package/dist/plugins/delegations/record.d.ts +11 -10
  96. package/dist/plugins/delegations/request.d.ts +8 -5
  97. package/dist/plugins/delegations/role.d.ts +1 -1
  98. package/dist/plugins/delegations/service.d.ts +9 -8
  99. package/dist/plugins/delegations/{waitBook.d.ts → waitResolver.d.ts} +9 -9
  100. package/dist/plugins/diagnostics/digest.d.ts +1 -1
  101. package/dist/plugins/diagnostics/index.d.ts +1 -1
  102. package/dist/plugins/diagnostics/index.js +1 -1
  103. package/dist/plugins/fileTools/config.d.ts +10 -0
  104. package/dist/plugins/{tools → fileTools}/editFiles.d.ts +16 -27
  105. package/dist/plugins/fileTools/gitDiscovery.d.ts +9 -0
  106. package/dist/plugins/fileTools/index.d.ts +18 -0
  107. package/dist/plugins/fileTools/index.js +1 -0
  108. package/dist/plugins/fileTools/tools.d.ts +6 -0
  109. package/dist/plugins/historyRecall/history.d.ts +1 -1
  110. package/dist/plugins/historyRecall/index.js +1 -1
  111. package/dist/plugins/historyRecall/render.d.ts +1 -1
  112. package/dist/plugins/mcp/catalog.d.ts +1 -1
  113. package/dist/plugins/mcp/index.d.ts +2 -2
  114. package/dist/plugins/mcp/index.js +1 -1
  115. package/dist/plugins/mcp/mount.d.ts +2 -2
  116. package/dist/plugins/mcp/render.d.ts +1 -1
  117. package/dist/plugins/mcp/{tool.d.ts → tools.d.ts} +1 -1
  118. package/dist/plugins/{routeContext.d.ts → routeNotice.d.ts} +2 -2
  119. package/dist/plugins/routeNotice.js +1 -0
  120. package/dist/{sandbox → plugins/sandbox}/absent.d.ts +11 -10
  121. package/dist/{sandbox → plugins/sandbox}/index.d.ts +5 -2
  122. package/dist/plugins/sandbox/index.js +4 -0
  123. package/dist/{sandbox → plugins/sandbox}/mode.d.ts +5 -5
  124. package/dist/plugins/sandbox/policy.d.ts +163 -0
  125. package/dist/{sandbox → plugins/sandbox}/service.d.ts +23 -13
  126. package/dist/plugins/schedules/index.js +3 -3
  127. package/dist/plugins/schedules/record.d.ts +18 -18
  128. package/dist/plugins/schedules/service.d.ts +2 -2
  129. package/dist/plugins/skills/discovery.d.ts +38 -9
  130. package/dist/plugins/skills/index.d.ts +1 -1
  131. package/dist/plugins/skills/index.js +1 -1
  132. package/dist/plugins/subAgents/index.js +1 -1
  133. package/dist/plugins/subAgents/{fork.d.ts → tools.d.ts} +36 -1
  134. package/dist/plugins/threadDirs.d.ts +36 -0
  135. package/dist/plugins/threadDirs.js +1 -0
  136. package/dist/plugins/toolPolicy/index.d.ts +2 -2
  137. package/dist/plugins/toolPolicy/index.js +1 -1
  138. package/dist/plugins/truncateToolOutput.d.ts +14 -10
  139. package/dist/plugins/truncateToolOutput.js +6 -1
  140. package/dist/plugins/usage/index.d.ts +4 -2
  141. package/dist/plugins/usage/index.js +1 -1
  142. package/dist/plugins/usage/tracker.d.ts +1 -1
  143. package/dist/plugins/verify/index.d.ts +7 -55
  144. package/dist/plugins/verify/index.js +6 -1
  145. package/dist/plugins/verify/judgement.d.ts +16 -0
  146. package/dist/plugins/verify/record.d.ts +382 -0
  147. package/dist/plugins/verify/service.d.ts +7 -4
  148. package/dist/plugins/verify/state.d.ts +58 -0
  149. package/dist/plugins/webTools/index.d.ts +34 -0
  150. package/dist/plugins/webTools/index.js +1 -0
  151. package/dist/plugins/workflows/assignment.d.ts +6 -2
  152. package/dist/plugins/workflows/cleanup.d.ts +1 -1
  153. package/dist/plugins/workflows/definition.d.ts +2 -2
  154. package/dist/plugins/workflows/{bindings.d.ts → entryPlan.d.ts} +2 -2
  155. package/dist/plugins/workflows/{providers.d.ts → hostBindings.d.ts} +2 -2
  156. package/dist/plugins/workflows/index.d.ts +4 -4
  157. package/dist/plugins/workflows/index.js +10 -5
  158. package/dist/plugins/workflows/observations.d.ts +3 -3
  159. package/dist/plugins/workflows/participantModels.d.ts +28 -0
  160. package/dist/plugins/workflows/participants.d.ts +2 -2
  161. package/dist/plugins/workflows/policy.d.ts +2 -2
  162. package/dist/plugins/workflows/record.d.ts +51 -65
  163. package/dist/plugins/workflows/routing.d.ts +2 -2
  164. package/dist/plugins/workflows/service.d.ts +24 -24
  165. package/dist/plugins/workflows/{fold.d.ts → state.d.ts} +2 -2
  166. package/dist/plugins/workflows/stopCheck.d.ts +13 -0
  167. package/dist/plugins/workflows/tools.d.ts +13 -0
  168. package/dist/plugins/workflows/view.d.ts +2 -2
  169. package/dist/plugins/{workspaceContext.d.ts → workspaceNotice.d.ts} +5 -7
  170. package/dist/plugins/workspaceNotice.js +1 -0
  171. package/dist/{plugins/providers → providers}/anthropic.d.ts +6 -3
  172. package/dist/{plugins/providers → providers}/anthropicMessages.d.ts +2 -1
  173. package/dist/{plugins/providers → providers}/codex.d.ts +14 -3
  174. package/dist/{plugins/providers → providers}/deepseek.d.ts +6 -2
  175. package/dist/{plugins/providers → providers}/failure.d.ts +1 -1
  176. package/dist/{plugins/providers → providers}/gateway.d.ts +2 -1
  177. package/dist/providers/index.d.ts +18 -0
  178. package/dist/providers/index.js +6 -0
  179. package/dist/{plugins/providers → providers}/openaiChat.d.ts +13 -2
  180. package/dist/{plugins/providers → providers}/openaiResponses.d.ts +12 -3
  181. package/dist/{plugins/providers → providers}/opencodeCopilot.d.ts +2 -2
  182. package/dist/{plugins/providers → providers}/opencodeGo.d.ts +18 -7
  183. package/dist/{plugins/providers → providers}/shared.d.ts +9 -1
  184. package/dist/{plugins/providers → providers}/stream.d.ts +4 -2
  185. package/dist/{models/door.d.ts → records/index.d.ts} +8 -7
  186. package/dist/records/index.js +1 -0
  187. package/dist/{models/wire → records}/journal.d.ts +210 -14
  188. package/dist/{models/wire/primitives.d.ts → records/toolResult.d.ts} +1 -1
  189. package/dist/services/agents.d.ts +26 -1
  190. package/dist/services/confinement/files.d.ts +118 -0
  191. package/dist/services/confinement/service.d.ts +219 -0
  192. package/dist/services/core.d.ts +2 -8
  193. package/dist/{kit/extension.d.ts → services/extensionEvents.d.ts} +5 -4
  194. package/dist/services/journal.d.ts +1 -1
  195. package/dist/services/llm.d.ts +4 -2
  196. package/dist/{kit → services}/modes.d.ts +1 -1
  197. package/dist/services/plugins.d.ts +34 -0
  198. package/dist/services/{preset.d.ts → presets/definition.d.ts} +4 -4
  199. package/dist/services/{presets.d.ts → presets/installations.d.ts} +3 -3
  200. package/dist/services/prompts.d.ts +23 -5
  201. package/dist/services/{threadActivation.d.ts → threads/activation.d.ts} +3 -3
  202. package/dist/services/{admission.d.ts → threads/admission.d.ts} +3 -3
  203. package/dist/services/{birth.d.ts → threads/birth.d.ts} +9 -10
  204. package/dist/services/threads/index.d.ts +14 -0
  205. package/dist/services/{runEvents.d.ts → threads/runEvents.d.ts} +2 -2
  206. package/dist/services/{owner.d.ts → threads/runOwner.d.ts} +5 -4
  207. package/dist/services/{threads.d.ts → threads/service.d.ts} +9 -8
  208. package/dist/services/{thread.d.ts → threads/thread.d.ts} +8 -7
  209. package/dist/services/{threadView.d.ts → threads/view.d.ts} +7 -6
  210. package/dist/services/tools.d.ts +79 -2
  211. package/dist/{loop/opening.d.ts → state/birth.d.ts} +22 -2
  212. package/dist/{loop → state}/chain.d.ts +3 -3
  213. package/dist/state/confirmations.d.ts +64 -0
  214. package/dist/{loop → state}/continuation.d.ts +3 -2
  215. package/dist/{loop → state}/decide.d.ts +10 -2
  216. package/dist/state/dispatches.d.ts +54 -0
  217. package/dist/state/errors.d.ts +26 -0
  218. package/dist/{loop → state}/forks.d.ts +1 -1
  219. package/dist/{loop → state}/holds.d.ts +1 -1
  220. package/dist/{loop → state}/inbox.d.ts +2 -2
  221. package/dist/state/index.d.ts +31 -0
  222. package/dist/state/inputs.d.ts +58 -0
  223. package/dist/state/installations.d.ts +28 -0
  224. package/dist/state/prompt.d.ts +13 -0
  225. package/dist/state/recovery.d.ts +7 -0
  226. package/dist/{loop → state}/replace.d.ts +2 -2
  227. package/dist/{loop → state}/requests.d.ts +3 -3
  228. package/dist/{loop → state}/route.d.ts +10 -2
  229. package/dist/state/summary.d.ts +16 -0
  230. package/dist/{loop → state}/surface.d.ts +3 -3
  231. package/dist/state/surfaceRead.d.ts +20 -0
  232. package/dist/{loop/threadState.d.ts → state/thread.d.ts} +12 -11
  233. package/dist/state/turns.d.ts +87 -0
  234. package/dist/state/waits.d.ts +38 -0
  235. package/dist/{loop → state}/wake.d.ts +1 -1
  236. package/dist/stores/durableObject.js +1 -0
  237. package/dist/{plugins/store → stores}/memory.d.ts +2 -2
  238. package/dist/{plugins/store → stores}/sql.d.ts +2 -2
  239. package/dist/stores/sqlite.js +1 -0
  240. package/dist/sys/environment.d.ts +0 -5
  241. package/dist/sys/git.d.ts +0 -13
  242. package/dist/sys/paths.d.ts +0 -47
  243. package/dist/sys/spawn.d.ts +16 -6
  244. package/dist/testing/clock.d.ts +1 -1
  245. package/dist/testing/fakeLlm.d.ts +4 -2
  246. package/dist/testing/fedLlm.d.ts +3 -1
  247. package/dist/testing/helpers.d.ts +31 -13
  248. package/dist/testing/index.js +1 -1
  249. package/dist/testing/settlement.d.ts +1 -1
  250. package/package.json +36 -28
  251. package/dist/chunks/2O7ZGEIT.js +0 -1
  252. package/dist/chunks/2OSESBIL.js +0 -1
  253. package/dist/chunks/3LQHQRIU.js +0 -6
  254. package/dist/chunks/3QCW4WDJ.js +0 -1
  255. package/dist/chunks/4XVRUSCQ.js +0 -1
  256. package/dist/chunks/6ECI2GGV.js +0 -1
  257. package/dist/chunks/74HKUGRR.js +0 -1
  258. package/dist/chunks/ADHERZLW.js +0 -2
  259. package/dist/chunks/D7E6EWIE.js +0 -3
  260. package/dist/chunks/DRYAN665.js +0 -1
  261. package/dist/chunks/DXFXAYDN.js +0 -17
  262. package/dist/chunks/EGZI4XQX.js +0 -24
  263. package/dist/chunks/ENWFSU27.js +0 -41
  264. package/dist/chunks/G6RXC3AL.js +0 -1
  265. package/dist/chunks/G74AGRAJ.js +0 -15
  266. package/dist/chunks/GQGNVSKB.js +0 -1
  267. package/dist/chunks/IJ2WNMD5.js +0 -7
  268. package/dist/chunks/JPZFKSWT.js +0 -1
  269. package/dist/chunks/KESCTXGO.js +0 -5
  270. package/dist/chunks/L3N4FIEN.js +0 -1
  271. package/dist/chunks/NAOUTU7A.js +0 -4
  272. package/dist/chunks/NDIM7MEW.js +0 -1
  273. package/dist/chunks/O4PPOM5Z.js +0 -2
  274. package/dist/chunks/OVZFGILJ.js +0 -1
  275. package/dist/chunks/P5ZHHOOM.js +0 -6
  276. package/dist/chunks/QMMLQJBS.js +0 -1
  277. package/dist/chunks/RK3VP2Q4.js +0 -3
  278. package/dist/chunks/SGGMBSBA.js +0 -1
  279. package/dist/chunks/TOOIB6J2.js +0 -1
  280. package/dist/chunks/TYTQRLTX.js +0 -1
  281. package/dist/chunks/UCTEU62F.js +0 -1
  282. package/dist/chunks/UD3VJER6.js +0 -1
  283. package/dist/chunks/WUUKTSRT.js +0 -7
  284. package/dist/chunks/X65X4KP5.js +0 -7
  285. package/dist/chunks/YIR5MYGU.js +0 -1
  286. package/dist/chunks/YLNJXQ3Z.js +0 -1
  287. package/dist/kit/claim.d.ts +0 -13
  288. package/dist/kit/drain.d.ts +0 -10
  289. package/dist/kit/grants.d.ts +0 -9
  290. package/dist/kit/scope.d.ts +0 -32
  291. package/dist/kit/service.d.ts +0 -7
  292. package/dist/kit/strategy.d.ts +0 -10
  293. package/dist/kit/tool.d.ts +0 -72
  294. package/dist/llm/door.d.ts +0 -21
  295. package/dist/llm/door.js +0 -1
  296. package/dist/loop/projections.d.ts +0 -307
  297. package/dist/loop/state.d.ts +0 -70
  298. package/dist/loop/summary.d.ts +0 -3
  299. package/dist/models/config/agent.d.ts +0 -18
  300. package/dist/models/config/prompt.d.ts +0 -18
  301. package/dist/models/door.js +0 -1
  302. package/dist/models/index.d.ts +0 -7
  303. package/dist/plugins/commands/foreground.d.ts +0 -4
  304. package/dist/plugins/compaction/preset.d.ts +0 -86
  305. package/dist/plugins/compaction/shared.d.ts +0 -14
  306. package/dist/plugins/delegations/testing.d.ts +0 -16
  307. package/dist/plugins/providers/door.d.ts +0 -61
  308. package/dist/plugins/providers/door.js +0 -1
  309. package/dist/plugins/providers/index.d.ts +0 -6
  310. package/dist/plugins/routeContext.js +0 -1
  311. package/dist/plugins/store/durableObject.js +0 -1
  312. package/dist/plugins/store/sqlite.js +0 -1
  313. package/dist/plugins/subAgents/tool.d.ts +0 -38
  314. package/dist/plugins/tools/index.d.ts +0 -59
  315. package/dist/plugins/tools/index.js +0 -1
  316. package/dist/plugins/verify/facts.d.ts +0 -356
  317. package/dist/plugins/workflows/submit.d.ts +0 -8
  318. package/dist/plugins/workspaceContext.js +0 -1
  319. package/dist/presets/agents.d.ts +0 -7
  320. package/dist/presets/base.d.ts +0 -10
  321. package/dist/presets/index.d.ts +0 -4
  322. package/dist/sandbox/index.js +0 -4
  323. package/dist/sandbox/policy.d.ts +0 -86
  324. package/dist/services/launches.d.ts +0 -104
  325. package/dist/services/threadDirs.d.ts +0 -38
  326. package/dist/testing/sandbox.d.ts +0 -71
  327. /package/dist/chunks/{UKXMCHHT.js → FJLU4UH3.js} +0 -0
  328. /package/dist/chunks/{J5S4URAW.js → HK6ZSONF.js} +0 -0
  329. /package/dist/plugins/ask/{askQuestion.d.ts → tools.d.ts} +0 -0
  330. /package/dist/plugins/delegations/{waits.d.ts → waitContracts.d.ts} +0 -0
  331. /package/dist/plugins/{tools → fileTools}/fsRead.d.ts +0 -0
  332. /package/dist/plugins/{tools → fileTools}/ripgrep.d.ts +0 -0
  333. /package/dist/plugins/{tools → fileTools}/textEdit.d.ts +0 -0
  334. /package/dist/{util → plugins/mcp}/version.d.ts +0 -0
  335. /package/dist/{sandbox → plugins/sandbox}/client.d.ts +0 -0
  336. /package/dist/{sandbox → plugins/sandbox}/files.d.ts +0 -0
  337. /package/dist/{sandbox → plugins/sandbox}/protocol.d.ts +0 -0
  338. /package/dist/{sandbox → plugins/sandbox}/worker.d.ts +0 -0
  339. /package/dist/{sandbox → plugins/sandbox}/worker.js +0 -0
  340. /package/dist/plugins/skills/{tool.d.ts → tools.d.ts} +0 -0
  341. /package/dist/plugins/{tools → webTools}/html.d.ts +0 -0
  342. /package/dist/plugins/{tools → webTools}/network.d.ts +0 -0
  343. /package/dist/plugins/{tools → webTools}/web.d.ts +0 -0
  344. /package/dist/plugins/workflows/{work.d.ts → workStatus.d.ts} +0 -0
  345. /package/dist/{plugins/providers → providers}/codexAuth.d.ts +0 -0
  346. /package/dist/services/{contributions.d.ts → catalogContributions.d.ts} +0 -0
  347. /package/dist/{loop → state}/limits.d.ts +0 -0
  348. /package/dist/{plugins/store → stores}/durableObject.d.ts +0 -0
  349. /package/dist/{plugins/store → stores}/durableObjectConnection.d.ts +0 -0
  350. /package/dist/{plugins/store → stores}/sqlite.d.ts +0 -0
  351. /package/dist/{models → util}/jsonSchema.d.ts +0 -0
  352. /package/dist/{kit → util}/retries.d.ts +0 -0
  353. /package/dist/{kit → util}/timers.d.ts +0 -0
@@ -1,21 +0,0 @@
1
- /**
2
- * `@leuduan/lagent/llm`: the model and provider contracts as the package offers them, for a provider
3
- * written outside it and a host that calls a model. Every type the contract mentions, and the values
4
- * a consumer uses; the schemas and helpers the engine uses itself stay inside (`index.ts`).
5
- *
6
- * It depends on `zod` alone, so a provider client built on it works in any harness.
7
- */
8
- export { ContextOverflowError, ProviderUnsupportedError, ResponseInterruptedError, ResponseSettlementError, StreamIdleError, } from './client.js';
9
- export type { LLMClient, ModelCapacity, ModelOption, ResponseSettlementKind, StreamingLLMResponse } from './client.js';
10
- export { contentText } from './content.js';
11
- export { ModelCallError } from './failure.js';
12
- export type { FailureClassification, FailureKind, ModelCallClient, ModelCallHandle } from './failure.js';
13
- export type { DeepReadonly, ReadonlyJsonValue } from '../util/json.js';
14
- export type { ContentPart, ContentPartInput, ContentPartKind } from './content.js';
15
- export { conversationMessage, LLMStreamChunkSchema, messageText, ThinkingEffortSchema } from './primitives.js';
16
- export type { ConversationMessage, JsonObject, LLMStreamChunk, LLMUsage, MalformedToolCall, MessageRole, ModelResponse, ParsedToolCall, ProviderCall, ProviderState, ResponseFinish, ThinkingEffort, ToolCall, ToolSpec, } from './primitives.js';
17
- export { renderPromptBlocks } from './prompt.js';
18
- export type { PromptBlock } from './prompt.js';
19
- export { defaultRoute } from './provider.js';
20
- export type { LLMProvider, ModelRoute } from './provider.js';
21
- export type { ModelRequest, RequestPurpose, ResponseFormat, ToolChoice } from './request.js';
package/dist/llm/door.js DELETED
@@ -1 +0,0 @@
1
- import{b as p,f as d}from"../chunks/TYTQRLTX.js";import{A as l,a as r,b as e,c as o,d as t,e as n,i as m,k as s,t as f,v as a,w as x}from"../chunks/D7E6EWIE.js";export{e as ContextOverflowError,f as LLMStreamChunkSchema,p as ModelCallError,r as ProviderUnsupportedError,n as ResponseInterruptedError,o as ResponseSettlementError,t as StreamIdleError,s as ThinkingEffortSchema,m as contentText,a as conversationMessage,d as defaultRoute,x as messageText,l as renderPromptBlocks};
@@ -1,307 +0,0 @@
1
- import type { InboxTarget, InstallationLifetime, InterruptionPolicy, JournalEvent, QueuedInput, Seq, ThreadEnvironment, ThreadFork, ThreadOrigin, TurnEndReason } from '../models/index.js';
2
- import type { ReadonlyState } from '../util/foldState.js';
3
- import type { DeepReadonly, JsonValue, ReadonlyJsonValue } from '../util/json.js';
4
- import type { ConversationMessage, ModelRoute, ParsedToolCall, PromptBlock, ResponseFinish, ToolCall, ToolSpec } from '../llm/index.js';
5
- import type { Journal } from '../journal/index.js';
6
- import type { Reducer } from './threadState.js';
7
- /**
8
- * Where a thread is in its turns: the highest one opened, how many steps it has taken, how it ended,
9
- * and whether a tool asked it to stop.
10
- *
11
- * `step` counts `step/start` since the last `turn/start`, so it is only meaningful while that turn
12
- * is in flight — a finished turn's count says nothing about the next one. It is folded rather than
13
- * counted in memory so the loop's decision stays a function of the journal across a restart.
14
- * `turnOpen` holds while a turn is in flight — including one whose process died, which the thread
15
- * closes as `interrupted` before it opens another.
16
- *
17
- * A fork continues the turn numbering and inherits `concludedTurn`, so a fork taken after a
18
- * concluding result is not owed a reply either. Everything else here describes the source's
19
- * execution and resets: a fork has no turn in flight and no outcome of its own, even when it was cut
20
- * inside one of its source's turns.
21
- */
22
- export declare const turnBoundary: Reducer<{
23
- lastTurn: number;
24
- step: number;
25
- /** How this thread's own last turn ended; `null` before its first ends, or while one is open. */
26
- lastReason: TurnEndReason | null;
27
- turnOpen: boolean;
28
- /**
29
- * The turn in which a tool result asked for the turn to end, until input arrives. Holds across
30
- * the turn boundary: the concluding result is not a reply the model owes, so nothing happens until
31
- * someone sends something new — but only the turn it landed in is cut short by it.
32
- */
33
- concludedTurn: number | null;
34
- }>;
35
- /** Whether a thread's latest answer has been judged by its stop checks. */
36
- export type AnswerCheck = {
37
- status: 'none';
38
- } | ({
39
- status: 'pending' | 'accepted' | 'rejected';
40
- seq: Seq;
41
- text: string;
42
- } & ({
43
- kind: 'reply';
44
- finish: ResponseFinish;
45
- } | {
46
- kind: 'concluded';
47
- }));
48
- /**
49
- * The conversation's latest answer — a reply with no tool calls, or a result that concluded the
50
- * turn — and whether a stop check has judged it.
51
- *
52
- * An answer is `pending` from the moment it is recorded until its turn ends `completed` (accepted)
53
- * or `rejected`. Every other ending leaves it pending, so a check a crash, an abort or a failing
54
- * listener cut short is still owed; new input supersedes the answer altogether. Folded from rows
55
- * the loop writes anyway, so there is no marker for a crash to fall in front of.
56
- *
57
- * A fork resets it (see `threadState`'s fork table); a fork is never cut where a check is still owed,
58
- * so nothing is lost.
59
- */
60
- export declare const answerCheck: Reducer<AnswerCheck>;
61
- /**
62
- * Calls dispatched and not yet answered, and the row that recorded the dispatch.
63
- *
64
- * Bookkeeping, not truth: what a turn still owes answers for is {@link unansweredToolCalls}, read
65
- * off the conversation. This exists so a re-dispatched call can cite its original `tool/call` rather
66
- * than recording a second one.
67
- */
68
- export declare const dispatchedCalls: Reducer<Map<string, Seq>>;
69
- /** One dispatch attempt of a call: its `tool/authorization` row, and what became of it. */
70
- export type DispatchAttempt = {
71
- /** The `tool/authorization` row: the attempt itself. */
72
- seq: Seq;
73
- /** The `tool/call` row the attempt dispatched. */
74
- call_seq: Seq;
75
- turn: number;
76
- decision: JournalEvent<'tool/authorization'>['data']['decision'];
77
- /** What the tool declared, at this attempt, a re-dispatch may do if the attempt is interrupted. */
78
- policy: InterruptionPolicy;
79
- };
80
- /**
81
- * The latest dispatch attempt of every call that has no result yet, by call id.
82
- *
83
- * An attempt is written immediately before the tool is invoked, so an allowed attempt with no
84
- * result, from a turn that has since closed, of a call that did not suspend, is a call the process
85
- * was cut off in: the tool may have begun. {@link abandonedAttempt} reads that; the policy recorded with the attempt
86
- * decides what a re-dispatch may do. A new `tool/call` under a reused provider id starts a new call
87
- * with no attempt; a result clears the call's attempt.
88
- */
89
- export declare const dispatchAttempts: Reducer<Map<string, DispatchAttempt>>;
90
- /**
91
- * The attempt of `callId` that was abandoned, if any: allowed, so the tool may have begun;
92
- * unanswered; of the `tool/call` row being dispatched now, not of an earlier call that reused the
93
- * provider's id; of a call that is not suspended (`waits`), since a waiting call returned on purpose
94
- * and one whose wait resolved is dispatched again from its recorded value, however often a crash
95
- * cuts that dispatch off; and from a turn before `currentTurn`, so the process that made it is gone —
96
- * every earlier turn is closed before a new one opens. Read before a new attempt is recorded, so the
97
- * judgment is about the attempt that was cut off.
98
- */
99
- export declare function abandonedAttempt(state: ReadonlyMap<string, DispatchAttempt>, waits: ReadonlyMap<Seq, WaitEntry>, callId: string, callSeq: Seq, currentTurn: number): DispatchAttempt | undefined;
100
- /** A call's `wait/declared` row, as the waits fold keeps it. */
101
- export type WaitDeclaration = {
102
- /** The `wait/declared` row. */
103
- readonly seq: Seq;
104
- readonly turn: number;
105
- readonly step: number;
106
- readonly call_id: string;
107
- readonly call_seq: Seq;
108
- readonly owner: string;
109
- readonly dependency: {
110
- readonly [key: string]: ReadonlyJsonValue;
111
- };
112
- readonly deadline_at: number | null;
113
- readonly reason: string;
114
- };
115
- /** One declared wait: its declaration, the value it resolved with, and whether its call was answered. */
116
- export type WaitEntry = {
117
- readonly declaration: WaitDeclaration;
118
- value: {
119
- readonly [key: string]: ReadonlyJsonValue;
120
- } | null;
121
- /** The call's `tool/result` landed: by its dispatch from the value, or by a cancel. */
122
- answered: boolean;
123
- };
124
- /**
125
- * Every wait the thread declared, by `call_seq`, kept after its call is answered, so answer-once can
126
- * report a value recorded before. A fork starts with none: it is never cut with a call unanswered.
127
- */
128
- export declare const waits: Reducer<Map<Seq, WaitEntry>>;
129
- /** Declared, with no value and no answer: what holds the thread, and what its owner still resolves. */
130
- export declare const isUnresolved: (entry: WaitEntry | undefined) => boolean;
131
- /** Declared and unanswered, resolved or not: the waiting call's authority, which a cancel answers. */
132
- export declare const isSuspended: (entry: WaitEntry | undefined) => boolean;
133
- /** The thread's suspended waits, in declaration order. */
134
- export declare const suspendedWaits: (state: ReadonlyMap<Seq, WaitEntry>) => WaitEntry[];
135
- /**
136
- * Tool calls on the last assistant message that have no result yet.
137
- *
138
- * Derived from the conversation, not from `tool/call` rows, because the conversation is what a
139
- * provider validates: a message holding calls must be followed by a result for each one. Calls are
140
- * recorded one row at a time, so a hard kill part-way through that burst leaves a thread with fewer
141
- * `tool/call` rows than the model asked for — nothing "pending", and a conversation nothing could
142
- * answer. Reading the assistant message instead makes the two agree by construction.
143
- */
144
- export declare function unansweredToolCalls(messages: readonly DeepReadonly<ConversationMessage>[]): DeepReadonly<ToolCall>[];
145
- export type ConfirmationState = {
146
- request_id: string;
147
- thread_id: string;
148
- /** The `tool/call` row this request was raised for — the dispatch it belongs to. */
149
- call_seq: Seq | null;
150
- tool_call: ParsedToolCall;
151
- reason: string;
152
- resolution: {
153
- approved: boolean;
154
- rejection_message: string | null;
155
- } | null;
156
- };
157
- /**
158
- * A thread's confirmation requests and their answers, keyed by request id. Thread-scoped: an answer
159
- * is written on the thread that asked, so a thread's confirmations are a function of its own rows.
160
- * A fork starts with none: a fork is never cut with a request still open, and an inherited answer
161
- * belongs to a call the source already finished.
162
- */
163
- export declare const confirmations: Reducer<Map<string, ConfirmationState>>;
164
- /** Requests still waiting on the user on one thread. */
165
- export declare const outstandingConfirmations: (state: ReadonlyMap<string, ReadonlyState<ConfirmationState>>, threadId: string) => ReadonlyState<ConfirmationState>[];
166
- /**
167
- * Calls one thread must not dispatch now, by call id: those waiting on a user's answer, and those
168
- * whose wait has not resolved. Neither is turn-bound: dispatching again before the answer or the
169
- * value would only raise a second request, or declare the wait twice.
170
- */
171
- export declare const parkedCallIds: (confirmationState: ReadonlyMap<string, ReadonlyState<ConfirmationState>>, waitState: ReadonlyMap<Seq, WaitEntry>, threadId: string) => Set<string>;
172
- /**
173
- * How a dispatch was answered, if it was ever asked about. `undefined` means nobody has been asked —
174
- * which is what tells a re-dispatched call to go through authorization again rather than assume.
175
- *
176
- * Matched on the `tool/call` row rather than the provider's call id: two threads, or two turns of
177
- * one thread, may legitimately see the same id, and an approval must not carry across.
178
- */
179
- export declare const approvalFor: (state: Map<string, ConfirmationState>, dispatch: {
180
- threadId: string;
181
- callId: string;
182
- callSeq: Seq | null;
183
- }) => {
184
- approved: boolean;
185
- rejection_message: string | null;
186
- } | undefined;
187
- export type ThreadRecord = {
188
- thread_id: string;
189
- agent_name: string;
190
- metadata: JournalEvent<'thread/spawned'>['data']['metadata'];
191
- /** The source thread and row this thread was forked at; `null` unless it is a fork. */
192
- fork: ThreadFork | null;
193
- origin: ThreadOrigin | null;
194
- environment: ThreadEnvironment;
195
- /** The constraint owners the thread's runs are under. */
196
- requires: readonly string[];
197
- /** The `thread/spawned` row. */
198
- seq: Seq;
199
- };
200
- /**
201
- * A thread's identity, lineage and environment, from its spawn row. A fork's lineage replays its
202
- * source's spawn row first and its own after it, so the fork's record is its own. The set of all
203
- * threads is the journal's catalog, not a fold.
204
- */
205
- export declare const threadRecord: Reducer<ThreadRecord | null>;
206
- /** The thread's latest `confirm/resolved` row, or `null`: what tells a parked caller an answer landed under it. */
207
- export declare const lastAnswer: Reducer<Seq | null>;
208
- /**
209
- * The thread's route: the one its spawn row was born with, replaced by each cause that changed it.
210
- * A lineage fold: a fork, born with none of its own, goes on with the route its inherited rows fold
211
- * to at the cut, which keeps it on the model whose cache holds its history. Nothing else changes it:
212
- * not turns, settlements, cancels or compaction. `null` only before a spawn row, which no thread lacks.
213
- */
214
- export declare const threadRoute: Reducer<ModelRoute | null>;
215
- /**
216
- * The system prompt a thread sends: the latest `thread/prompt` row, or none yet. A fork inherits
217
- * it and never renders its own, so it sends its source's exact prompt.
218
- */
219
- export declare const threadPrompt: Reducer<PromptBlock[] | null>;
220
- /**
221
- * The tool specifications a thread's requests send: the latest `thread/tools` row, or none before
222
- * its first request. Read at a request's seq, what that request sent. A fork inherits it.
223
- */
224
- export declare const threadTools: Reducer<readonly ToolSpec[] | null>;
225
- /**
226
- * Whether a fork has yet to claim the task it was created with. A fork cut at a request inherits a
227
- * conversation that ends on input its source is answering. Created to regenerate that answer, the
228
- * fork owes it; created with a task, it owes only the task. So a task discarded before it was
229
- * claimed — by `cancel()` — leaves the fork with nothing to do, rather than answering its source's
230
- * request. Any input the fork records settles it.
231
- */
232
- export declare const forkTask: Reducer<{
233
- spawnSeq: Seq | null;
234
- unclaimed: boolean;
235
- }>;
236
- export type InboxState = Record<InboxTarget, QueuedInput[]>;
237
- /**
238
- * Input waiting for a turn or a step boundary. Durable, so a crash does not lose a queued message.
239
- * A fork starts with nothing queued: its source's queued input is not the fork's.
240
- */
241
- export declare const inbox: Reducer<InboxState>;
242
- /** Where one input id's life is recorded: the row that queued it, and the step's row that claimed it. */
243
- export type InputRows = {
244
- readonly queuedAt: Seq;
245
- readonly claimedAt: Seq | null;
246
- };
247
- /**
248
- * Every input id this thread was ever handed: the row that queued it and, once a step took it, the
249
- * `input/message` that claimed it. Never forgets: this is what makes `send` with an explicit id
250
- * idempotent across a re-dispatch or a restart, and why a withdrawn or cancelled id stays
251
- * spent. A fork starts over: the ids its source was handed are the source's.
252
- */
253
- export declare const inputs: Reducer<Map<string, InputRows>>;
254
- /**
255
- * How the run that began after a row ended, and what it answered, read from the thread's events
256
- * after that row. A run's outcome, not a delegation task's: an `aborted` turn ends a run, while a
257
- * task stays open across it (the delegations plugin's own fold).
258
- */
259
- export type RunOutcome = {
260
- /** The last turn ending seen for this run, if any. */
261
- reason: TurnEndReason | null;
262
- /**
263
- * The accepted answer: the reply, or the output of the tool result that concluded the turn. Empty
264
- * until the run has answered — a provisional or rejected answer is not one.
265
- */
266
- output: string;
267
- /** Whether the conversation has reached an answer: a complete reply, or a result that concluded the turn. */
268
- answered: boolean;
269
- };
270
- /**
271
- * How the run that began after `fromSeq` ended, and what it answered.
272
- *
273
- * The `answerCheck` reducer folded over the rows after `fromSeq`: the same rule the loop and its stop
274
- * checks read, so an answer is a complete reply with nothing left to call, or a tool result that
275
- * concluded the turn, and it becomes the run's answer only at the `turn/end(completed)` that
276
- * accepted it. A process that died before that ending leaves it unaccepted, and the scan goes on to
277
- * the turn that checks it. Scanning stops at the first turn ending that settles the run, answered or
278
- * failed outright, so a later turn of the same thread is never mistaken for this run's.
279
- */
280
- export declare function outcomeSince(journal: Journal, threadId: string, fromSeq: Seq): RunOutcome;
281
- /** A turn ending after which the run will not produce an answer without new input. */
282
- export declare const isRunFailure: (reason: TurnEndReason | null) => boolean;
283
- /** One installation a thread holds, as its folds read it. */
284
- export type InstallationRecord = {
285
- readonly installationId: string;
286
- readonly presetId: string;
287
- /** The validated configuration, defaults included: exactly what `setup` receives. */
288
- readonly config: JsonValue;
289
- /**
290
- * `defining` for one recorded as such in its thread's spawn row, on this thread or on the one a
291
- * fork inherited it from, which cannot be removed; `configurable` for any other, one applied
292
- * later included.
293
- */
294
- readonly lifetime: InstallationLifetime;
295
- };
296
- /** A thread's installations: the current ones in application order, and every id it ever used. */
297
- export type InstallationsState = {
298
- readonly current: Map<string, InstallationRecord>;
299
- readonly used: Set<string>;
300
- };
301
- /**
302
- * The preset installations that define a thread's plugins. A fork inherits its source's
303
- * installations and reserved ids at the cut: its own spawn row carries none, and the source's spawn
304
- * row, which it folds through lineage, keeps a defining installation defining on every fork.
305
- * Installations never move, so application order is also the order they are restored in.
306
- */
307
- export declare const installations: Reducer<InstallationsState>;
@@ -1,70 +0,0 @@
1
- import type { Journal, PluginJournal } from '../journal/index.js';
2
- import type { ReadonlyState } from '../util/foldState.js';
3
- import type { InboxTarget, Seq } from '../models/index.js';
4
- import { type DecisionView } from './decide.js';
5
- import type { TurnLimits } from './limits.js';
6
- import type { ConversationMessage } from '../llm/index.js';
7
- import type { ConfirmationState } from './projections.js';
8
- import type { ReplacementRefusal, RowRef } from './surface.js';
9
- import { type ThreadState } from './threadState.js';
10
- /**
11
- * A journal view, usable without constructing an execution runtime or activating plugins.
12
- * `sentBack` says a stop check sent back the answer of a turn that opened by answering calls, so
13
- * input waiting for a turn joins it batch by batch (`Inbox.peek`).
14
- */
15
- export declare function decisionView(journal: Journal, threadId: string, target: InboxTarget, step: number, turn: number, sentBack?: boolean): DecisionView;
16
- export declare function hasThreadWork(journal: Journal, threadId: string, limits: TurnLimits): boolean;
17
- /**
18
- * Close a process-interrupted turn from journal state, including when no new execution is needed.
19
- * Decided inside the write, so a turn something else closed meanwhile is not closed twice.
20
- */
21
- export declare function closeInterruptedTurn(journal: Journal, threadId: string, limits: TurnLimits): Promise<void>;
22
- /**
23
- * What became of the input id a thread was handed: `unknown` when it never was; `queued` while it
24
- * waits, for `target`; `claimed` once a step took it; `discarded` when it left the queue unclaimed,
25
- * withdrawn or cleared by a cancel. Each names the row that queued it, and a claim the
26
- * `input/message` that took it. A discarded or claimed id stays spent: it is never queued again.
27
- */
28
- export type InputFate = {
29
- readonly state: 'unknown';
30
- } | {
31
- readonly state: 'queued';
32
- readonly queuedAt: Seq;
33
- readonly target: InboxTarget;
34
- } | {
35
- readonly state: 'claimed';
36
- readonly queuedAt: Seq;
37
- readonly claimedAt: Seq;
38
- } | {
39
- readonly state: 'discarded';
40
- readonly queuedAt: Seq;
41
- };
42
- /**
43
- * The fate of input `id` from a thread's state: the one answer to "what became of input X", read
44
- * inside a write or a contributor from the state the journal folds, or through `ThreadView.input`.
45
- * A fork's own ids only: its source's are the source's.
46
- */
47
- export declare function inputFate(state: ReadonlyState<Pick<ThreadState, 'inputs' | 'inbox'>>, id: string): InputFate;
48
- /**
49
- * Confirmations on one thread whose call has no result yet and was not rejected: still waiting on the
50
- * user, or approved. An approval lasts until the call's result: the call runs at the next turn, and
51
- * one that waits or is cut off runs again on the same approval, against whatever tool answers to its
52
- * name by then.
53
- */
54
- export declare function unfinishedConfirmations(journal: Pick<PluginJournal, 'state'>, threadId: string): ReadonlyState<ConfirmationState>[];
55
- /**
56
- * The first replacement `threadId`'s surface refused, or `null`: a thread that has one carries
57
- * history no execution may continue from, which every entry that executes checks.
58
- */
59
- export declare function refusedReplacement(journal: Pick<Journal, 'state'>, threadId: string): {
60
- readonly row: RowRef;
61
- readonly refusal: ReplacementRefusal;
62
- } | null;
63
- /**
64
- * The last thing the model said on a thread, if anything: the message of the last
65
- * `assistant/message` row on its lineage that the stream did not cut off. Found through the rows
66
- * behind the surface, not by role, so an assistant-role stand-in is never reported as the model's
67
- * last word; a reply a replacement took off the surface is still found, through the rows its
68
- * stand-in replaced.
69
- */
70
- export declare function lastAssistantMessage(journal: Pick<PluginJournal, 'eventAt' | 'state'>, threadId: string): ReadonlyState<ConversationMessage> | null;
@@ -1,3 +0,0 @@
1
- import type { Journal, ThreadSummaryCore } from '../journal/index.js';
2
- import type { TurnLimits } from './limits.js';
3
- export declare function summarizeThread(journal: Journal, threadId: string, limits: TurnLimits): ThreadSummaryCore;
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * One agent: its name and the base of its prompt. Registered programmatically with
4
- * `ctx.agents.register` (usually through `registerAgent`); the name is how threads
5
- * and other agents refer to it.
6
- *
7
- * Strict: an agent says who it is, and nothing else. What it may call is granted to it by name
8
- * (`grantTool`) by the plugins that compose the application; instruction and context sections come
9
- * from plugins through `ctx.prompts`; how callers see it, a description and guidance, belongs to the
10
- * `subAgents` endpoint that offers it. A plugin that needs per-agent configuration keys it by agent
11
- * name in its own config, so a misspelled key is rejected here instead of silently ignored there.
12
- */
13
- export declare const AgentDefinitionSchema: z.ZodObject<{
14
- name: z.ZodString;
15
- basePrompt: z.ZodDefault<z.ZodString>;
16
- }, z.core.$strict>;
17
- export type AgentDefinition = z.infer<typeof AgentDefinitionSchema>;
18
- export type AgentDefinitionInput = z.input<typeof AgentDefinitionSchema>;
@@ -1,18 +0,0 @@
1
- import type { PromptBlock } from '../../llm/index.js';
2
- export type TaggedSection = {
3
- tag: string;
4
- content: string;
5
- };
6
- /**
7
- * A prompt as `ctx.prompts` assembles it: the agent's base prompt, then instruction sections, then
8
- * context sections, so a section's bucket is what decides its position. The rendered result is
9
- * recorded per thread.
10
- */
11
- export type SystemPrompt = {
12
- basePrompt: string;
13
- instructions: TaggedSection[];
14
- contextSections: TaggedSection[];
15
- };
16
- /** The prompt as ordered blocks — the one place its order is decided. */
17
- export declare function systemPromptBlocks(prompt: SystemPrompt): PromptBlock[];
18
- export declare const renderSystemPrompt: (prompt: SystemPrompt) => string;
@@ -1 +0,0 @@
1
- import{a as e}from"../chunks/UKXMCHHT.js";import{f as o,l as t,m as r,q as n,r as s,s as p}from"../chunks/KESCTXGO.js";import"../chunks/TYTQRLTX.js";import"../chunks/D7E6EWIE.js";export{s as isForkSpawn,p as isSurfaceEvent,n as parseJournalEvent,t as queuedInput,r as stepContribution,e as toJsonSchema,o as toolResultMessageContent};
@@ -1,7 +0,0 @@
1
- /** `wire/` is what gets serialized (snake_case); `config/` is what you write by hand (camelCase). */
2
- export * from './config/agent.js';
3
- export * from './config/prompt.js';
4
- export * from './jsonSchema.js';
5
- export * from './wire/journal.js';
6
- export * from './wire/primitives.js';
7
- export type { DeepReadonly, JsonValue, ReadonlyJsonValue } from '../util/json.js';
@@ -1,4 +0,0 @@
1
- import type { Tool } from '../../loop/index.js';
2
- import { type CommandsConfig } from './service.js';
3
- /** `run_command`: one shell command, run to completion under `config`. */
4
- export declare const runCommandTool: (config: CommandsConfig) => Tool;
@@ -1,86 +0,0 @@
1
- /**
2
- * The compaction plugin, a `thread` preset with two placements, which keeps a thread's surface
3
- * within its route's window by the strategy its configuration names. Mounted on the root for an
4
- * agent selector, `mountPreset(root, compaction, config, { agents })`, it serves every thread whose
5
- * agent `agents` selects: each matching activation gets its own strategy, provided in the thread's
6
- * scope, until the mount is disposed. Installed on one thread through the presets service, it
7
- * serves that thread, recorded so a reopen and a fork keep it.
8
- *
9
- * Both strategies act on three triggers: **pressure**, before every model step whose request is
10
- * estimated above `threshold` of the window (a route whose provider declares no window is never
11
- * compacted for pressure, which is reported once per route); **overflow**, when the provider
12
- * refuses a step's request as too long, after which the step is asked again if anything was
13
- * replaced; and **request**, `thread.compact()`, whatever the pressure.
14
- *
15
- * - **`summarize`**, the default. It replaces one span, after the pinned opening and between direct
16
- * developer inputs, with one `user` checkpoint: notes a summary call wrote from the surface
17
- * through the span, the person's latest input copied from its row when the span held it, and a
18
- * footer naming the messages replaced. It measures from the last usage the provider reported on
19
- * the same provider and model plus an estimate of what came since, calibrates its estimates by
20
- * an overflow, and recovers once per overflow sequence: a new turn or a completed reply allows
21
- * another. Three unusable summaries in a row stop pressure compaction until its next
22
- * checkpoint or a change of the thread's configuration; the count is recorded, so a reopen and a
23
- * fork keep it. On request, `options` may say what the summary should `focus` on.
24
- * - **`prune`**. It rewrites old tool results in place, keeping each one's role and call id, to a
25
- * one-line stand-in, `[tool result pruned: <tool>, <n> characters and <k> attachments; message
26
- * <number>]`, the attachments named only when it had some, followed by where to read it back when
27
- * the agent has both `historyRecall` tools; no model is called. A result is pruned when it is an
28
- * original, never a stand-in, outside the `keepRecent` most recent tool results, and estimated at
29
- * `minTokens` or more, images and files included; every such result goes in one atomic group.
30
- * Pressure is estimated by characters, uncalibrated. Nothing eligible is `skipped`, reported once
31
- * per activation, trigger, route and latest replacement on pressure and overflow. It takes no
32
- * request options and ignores any.
33
- *
34
- * Plugins whose notices a replacement took away tell them again at the next model step.
35
- *
36
- * Disposing a root mount stops new dispatches on the threads it serves, live ones included; a
37
- * dispatch already in flight finishes, and may still record its replacement. A mount added later
38
- * reaches activations from then on, not threads already live: they get it at their next activation.
39
- *
40
- * A thread runs one strategy, and a second on it, from another mount of this plugin or any other
41
- * strategy that claims its thread, is refused when the thread activates, naming the one already
42
- * there. To choose per agent, mount this on the root more than once with disjoint selectors and the
43
- * strategy each should run; to choose per thread, mount none on the root and install it on each
44
- * thread instead.
45
- *
46
- * ```ts
47
- * await mountPreset(root, compaction, {}, { agents: ['main'] }) // summarize, with every default
48
- * await mountPreset(root, compaction, { strategy: { kind: 'prune', keepRecent: 4 } }, { agents: ['worker'] })
49
- * ```
50
- */
51
- export declare const compaction: import("../../services/preset.js").Preset<import("zod").ZodObject<{
52
- threshold: import("zod").ZodDefault<import("zod").ZodNumber>;
53
- strategy: import("zod").ZodPrefault<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
54
- kind: import("zod").ZodLiteral<"summarize">;
55
- target: import("zod").ZodDefault<import("zod").ZodNumber>;
56
- tail: import("zod").ZodDefault<import("zod").ZodNumber>;
57
- opening: import("zod").ZodDefault<import("zod").ZodNumber>;
58
- summaryCap: import("zod").ZodDefault<import("zod").ZodNumber>;
59
- summaryFloor: import("zod").ZodDefault<import("zod").ZodNumber>;
60
- reasoningAllowance: import("zod").ZodDefault<import("zod").ZodNumber>;
61
- replyReserve: import("zod").ZodDefault<import("zod").ZodNumber>;
62
- checkpointRatio: import("zod").ZodDefault<import("zod").ZodNumber>;
63
- copiedInputChars: import("zod").ZodDefault<import("zod").ZodNumber>;
64
- boundaryQuoteChars: import("zod").ZodDefault<import("zod").ZodNumber>;
65
- breaker: import("zod").ZodDefault<import("zod").ZodNumber>;
66
- withoutWindow: import("zod").ZodDefault<import("zod").ZodObject<{
67
- tailTokens: import("zod").ZodDefault<import("zod").ZodNumber>;
68
- openingTokens: import("zod").ZodDefault<import("zod").ZodNumber>;
69
- }, import("zod/v4/core").$strict>>;
70
- summarizer: import("zod").ZodDefault<import("zod").ZodObject<{
71
- provider: import("zod").ZodOptional<import("zod").ZodString>;
72
- model: import("zod").ZodOptional<import("zod").ZodString>;
73
- thinkingEffort: import("zod").ZodDefault<import("zod").ZodEnum<{
74
- low: "low";
75
- high: "high";
76
- none: "none";
77
- medium: "medium";
78
- max: "max";
79
- }>>;
80
- }, import("zod/v4/core").$strict>>;
81
- }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
82
- kind: import("zod").ZodLiteral<"prune">;
83
- keepRecent: import("zod").ZodDefault<import("zod").ZodNumber>;
84
- minTokens: import("zod").ZodDefault<import("zod").ZodNumber>;
85
- }, import("zod/v4/core").$strict>], "kind">>;
86
- }, import("zod/v4/core").$strict>>;
@@ -1,14 +0,0 @@
1
- import { type Context } from '@leuduan/cordis';
2
- import type { SurfacePrepareInput } from '../../loop/index.js';
3
- /**
4
- * A reporter that says each condition once for as long as the strategy lives, one activation. `key`
5
- * names the condition (its cause, the route, the latest replacement), so a step that finds it again
6
- * stays quiet.
7
- */
8
- export declare function onceReporter(ctx: Context): (key: string, message: string) => void;
9
- /** Whether the thread's agent has both recall tools granted now, so a stand-in or a footer may point at them. */
10
- export declare function recallGranted(ctx: Context, agentName: string): boolean;
11
- /** What the next request sends ahead of its messages: the recorded prompt and the tools the agent has now. */
12
- export declare function estimateThreadHead(ctx: Context, threadId: string, agentName: string): number;
13
- /** The input a step claims, which the request sends after the surface. */
14
- export declare const estimateClaimed: (prepare: SurfacePrepareInput) => number;
@@ -1,16 +0,0 @@
1
- import type { Context } from '@leuduan/cordis';
2
- import type { ToolReply } from '../../kit/tool.js';
3
- import { type InvocationContext } from '../../loop/index.js';
4
- import type { Seq } from '../../models/index.js';
5
- import type { Thread } from '../../services/thread.js';
6
- import { type DelegationRequest } from './request.js';
7
- /** The caller's `tool/call` row that created `thread`, for tests: off the plugin's door. */
8
- export declare function openingCallSeqOf(thread: Thread): Seq;
9
- /** The task the call that created `thread` opened on it, for tests: off the plugin's door. */
10
- export declare const openingTaskOf: (thread: Thread) => string;
11
- /**
12
- * Runs a delegating call as the loop would, for tests that call `ctx.delegations.delegate` as a
13
- * host: a blocking call's wait is declared on its caller, delegations resolves it, and the call is
14
- * dispatched again with the value, whose reply is returned. Any other reply is returned as it is.
15
- */
16
- export declare function delegateThrough(root: Context, context: InvocationContext, request: DelegationRequest): Promise<ToolReply>;
@@ -1,61 +0,0 @@
1
- /**
2
- * `@leuduan/lagent/providers`: the shipped providers, their configuration types and the Codex login
3
- * helpers a host resolves a credential with. The package's own entry point to this folder is
4
- * `index.ts`, which adds what the package keeps private.
5
- */
6
- import type { LLMProvider } from '../../llm/index.js';
7
- import { type CodexConfig } from './codex.js';
8
- import { type OpenAIChatConfig } from './openaiChat.js';
9
- import { type OpenAIResponsesConfig } from './openaiResponses.js';
10
- import { type DeepSeekResponsesConfig } from './deepseek.js';
11
- import { type OpenCodeGoConfig } from './opencodeGo.js';
12
- /**
13
- * A provider's configuration with its credential named: the host resolves it, from wherever it keeps
14
- * it, and says so even when it has none. A provider without one can still be described, its defaults
15
- * and models read; building a client for it then fails, naming what is missing.
16
- */
17
- type WithCredential<Config> = Config & {
18
- readonly apiKey: string | undefined;
19
- };
20
- /**
21
- * The OpenAI Responses provider, at OpenAI's endpoint unless `baseURL` names another. Building one
22
- * registers nothing, so a host can read its defaults and models first (see `defaultRoute`);
23
- * `registerProvider(ctx, openaiResponsesProvider(config), { retry })` registers it.
24
- */
25
- export declare const openaiResponsesProvider: (config: WithCredential<OpenAIResponsesConfig>) => LLMProvider;
26
- /** DeepSeek's Responses API provider, at DeepSeek's endpoint unless `baseURL` names another. */
27
- export declare const deepseekProvider: (config: WithCredential<DeepSeekResponsesConfig>) => LLMProvider;
28
- /**
29
- * The Codex provider: the same Responses API, reached with the ChatGPT login that `codex login`
30
- * leaves in the file `authPath` names instead of an API key, reread per request and refreshed in
31
- * place when it nears expiry.
32
- */
33
- export declare const codexProvider: (config: CodexConfig & {
34
- readonly authPath: string;
35
- readonly refreshTimeoutMs: number;
36
- }) => LLMProvider;
37
- /**
38
- * The OpenAI Chat Completions provider, and with a `baseURL` any gateway that speaks it. It declares
39
- * no models and no windows of its own: a gateway serves whatever ids its operator configured, so the
40
- * windows it declares are the ones `contextWindows` configures. It replays reasoning text but no
41
- * opaque reasoning state, and provider-executed tools are refused.
42
- */
43
- export declare const openaiChatProvider: (config: WithCredential<OpenAIChatConfig>) => LLMProvider;
44
- /**
45
- * The OpenCode Go gateway (`https://opencode.ai/zen/go/v1`): one subscription key in front of many
46
- * vendors' models, each answering on one protocol: OpenAI Responses, Chat Completions or Anthropic
47
- * Messages, each served by its own client. The host names itself with a
48
- * `User-Agent` in `defaultHeaders`; each request carries its thread as Go's session header.
49
- */
50
- export declare const opencodeGoProvider: (config: WithCredential<OpenCodeGoConfig>) => LLMProvider;
51
- export { CODEX_PROVIDER_NAME } from './codex.js';
52
- export type { CodexConfig } from './codex.js';
53
- export type { OpenAIChatConfig } from './openaiChat.js';
54
- export { codexAuthPath, CodexCredentialError } from './codexAuth.js';
55
- export type { OpenAIResponsesConfig } from './openaiResponses.js';
56
- export { DEEPSEEK_RESPONSES_PROVIDER_NAME } from './deepseek.js';
57
- export { OPENCODE_GO_PROVIDER_NAME } from './opencodeGo.js';
58
- export type { OpenCodeGoConfig } from './opencodeGo.js';
59
- export type { DeepSeekResponsesConfig } from './deepseek.js';
60
- export { OPENCODE_COPILOT_PROVIDER_NAME, opencodeCopilotProvider } from './opencodeCopilot.js';
61
- export type { OpenCodeCopilotConfig } from './opencodeCopilot.js';