@leuduan/lagent 0.0.0-stage → 0.1.2

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 (327) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +144 -2
  3. package/dist/chunks/2O7ZGEIT.js +1 -0
  4. package/dist/chunks/2OSESBIL.js +1 -0
  5. package/dist/chunks/34KW6VNQ.js +1 -0
  6. package/dist/chunks/37YOGDGY.js +1 -0
  7. package/dist/chunks/3LQHQRIU.js +6 -0
  8. package/dist/chunks/3QCW4WDJ.js +1 -0
  9. package/dist/chunks/4XVRUSCQ.js +1 -0
  10. package/dist/chunks/6ECI2GGV.js +1 -0
  11. package/dist/chunks/74HKUGRR.js +1 -0
  12. package/dist/chunks/ADHERZLW.js +2 -0
  13. package/dist/chunks/AP6Q4EPT.js +36 -0
  14. package/dist/chunks/BM3S37EZ.js +1 -0
  15. package/dist/chunks/C5LYCXJG.js +1 -0
  16. package/dist/chunks/CDQG7RKA.js +1 -0
  17. package/dist/chunks/D7E6EWIE.js +3 -0
  18. package/dist/chunks/DDANMY45.js +3 -0
  19. package/dist/chunks/DRYAN665.js +1 -0
  20. package/dist/chunks/DXFXAYDN.js +17 -0
  21. package/dist/chunks/EGZI4XQX.js +24 -0
  22. package/dist/chunks/ENWFSU27.js +41 -0
  23. package/dist/chunks/G6RXC3AL.js +1 -0
  24. package/dist/chunks/G74AGRAJ.js +15 -0
  25. package/dist/chunks/GQGNVSKB.js +1 -0
  26. package/dist/chunks/IJ2WNMD5.js +7 -0
  27. package/dist/chunks/J5S4URAW.js +1 -0
  28. package/dist/chunks/JPZFKSWT.js +1 -0
  29. package/dist/chunks/KESCTXGO.js +5 -0
  30. package/dist/chunks/L3N4FIEN.js +1 -0
  31. package/dist/chunks/NAOUTU7A.js +4 -0
  32. package/dist/chunks/NDIM7MEW.js +1 -0
  33. package/dist/chunks/O4PPOM5Z.js +2 -0
  34. package/dist/chunks/OVZFGILJ.js +1 -0
  35. package/dist/chunks/P5ZHHOOM.js +6 -0
  36. package/dist/chunks/PUSUPTAT.js +1 -0
  37. package/dist/chunks/QMMLQJBS.js +1 -0
  38. package/dist/chunks/RK3VP2Q4.js +3 -0
  39. package/dist/chunks/SGGMBSBA.js +1 -0
  40. package/dist/chunks/SL2YLB2F.js +1 -0
  41. package/dist/chunks/TOOIB6J2.js +1 -0
  42. package/dist/chunks/TYTQRLTX.js +1 -0
  43. package/dist/chunks/UC3FVVJ2.js +5 -0
  44. package/dist/chunks/UCTEU62F.js +1 -0
  45. package/dist/chunks/UD3VJER6.js +1 -0
  46. package/dist/chunks/UKXMCHHT.js +1 -0
  47. package/dist/chunks/WUUKTSRT.js +7 -0
  48. package/dist/chunks/X65X4KP5.js +7 -0
  49. package/dist/chunks/YIR5MYGU.js +1 -0
  50. package/dist/chunks/YLNJXQ3Z.js +1 -0
  51. package/dist/context.d.ts +101 -0
  52. package/dist/index.d.ts +47 -0
  53. package/dist/index.js +77 -0
  54. package/dist/journal/catalog.d.ts +112 -0
  55. package/dist/journal/forkChain.d.ts +16 -0
  56. package/dist/journal/index.d.ts +15 -0
  57. package/dist/journal/journal.d.ts +475 -0
  58. package/dist/journal/projection.d.ts +87 -0
  59. package/dist/journal/store.d.ts +181 -0
  60. package/dist/kit/claim.d.ts +13 -0
  61. package/dist/kit/drain.d.ts +10 -0
  62. package/dist/kit/extension.d.ts +180 -0
  63. package/dist/kit/grants.d.ts +9 -0
  64. package/dist/kit/modes.d.ts +65 -0
  65. package/dist/kit/retries.d.ts +25 -0
  66. package/dist/kit/scope.d.ts +32 -0
  67. package/dist/kit/service.d.ts +7 -0
  68. package/dist/kit/strategy.d.ts +10 -0
  69. package/dist/kit/timers.d.ts +43 -0
  70. package/dist/kit/tool.d.ts +72 -0
  71. package/dist/llm/client.d.ts +135 -0
  72. package/dist/llm/content.d.ts +52 -0
  73. package/dist/llm/door.d.ts +21 -0
  74. package/dist/llm/door.js +1 -0
  75. package/dist/llm/failure.d.ts +82 -0
  76. package/dist/llm/index.d.ts +16 -0
  77. package/dist/llm/primitives.d.ts +286 -0
  78. package/dist/llm/prompt.d.ts +21 -0
  79. package/dist/llm/provider.d.ts +63 -0
  80. package/dist/llm/readLedger.d.ts +24 -0
  81. package/dist/llm/request.d.ts +58 -0
  82. package/dist/loop/agent.d.ts +134 -0
  83. package/dist/loop/auxiliary.d.ts +54 -0
  84. package/dist/loop/chain.d.ts +46 -0
  85. package/dist/loop/chunks.d.ts +27 -0
  86. package/dist/loop/continuation.d.ts +166 -0
  87. package/dist/loop/decide.d.ts +64 -0
  88. package/dist/loop/errors.d.ts +162 -0
  89. package/dist/loop/forks.d.ts +61 -0
  90. package/dist/loop/holds.d.ts +104 -0
  91. package/dist/loop/hooks.d.ts +241 -0
  92. package/dist/loop/inbox.d.ts +188 -0
  93. package/dist/loop/index.d.ts +37 -0
  94. package/dist/loop/limits.d.ts +14 -0
  95. package/dist/loop/opening.d.ts +42 -0
  96. package/dist/loop/prepare.d.ts +30 -0
  97. package/dist/loop/projections.d.ts +307 -0
  98. package/dist/loop/replace.d.ts +33 -0
  99. package/dist/loop/requests.d.ts +129 -0
  100. package/dist/loop/route.d.ts +53 -0
  101. package/dist/loop/runtime.d.ts +85 -0
  102. package/dist/loop/state.d.ts +70 -0
  103. package/dist/loop/strategy.d.ts +71 -0
  104. package/dist/loop/summary.d.ts +3 -0
  105. package/dist/loop/surface.d.ts +153 -0
  106. package/dist/loop/threadState.d.ts +72 -0
  107. package/dist/loop/tool.d.ts +101 -0
  108. package/dist/loop/toolCalls.d.ts +42 -0
  109. package/dist/loop/wake.d.ts +32 -0
  110. package/dist/models/config/agent.d.ts +18 -0
  111. package/dist/models/config/prompt.d.ts +18 -0
  112. package/dist/models/door.d.ts +12 -0
  113. package/dist/models/door.js +1 -0
  114. package/dist/models/index.d.ts +7 -0
  115. package/dist/models/jsonSchema.d.ts +7 -0
  116. package/dist/models/wire/journal.d.ts +2772 -0
  117. package/dist/models/wire/primitives.d.ts +65 -0
  118. package/dist/plugin.d.ts +53 -0
  119. package/dist/plugin.js +1 -0
  120. package/dist/plugins/agentsMd.d.ts +76 -0
  121. package/dist/plugins/agentsMd.js +1 -0
  122. package/dist/plugins/ask/askQuestion.d.ts +9 -0
  123. package/dist/plugins/ask/index.d.ts +26 -0
  124. package/dist/plugins/ask/index.js +1 -0
  125. package/dist/plugins/ask/service.d.ts +125 -0
  126. package/dist/plugins/commands/background.d.ts +8 -0
  127. package/dist/plugins/commands/foreground.d.ts +4 -0
  128. package/dist/plugins/commands/index.d.ts +40 -0
  129. package/dist/plugins/commands/index.js +1 -0
  130. package/dist/plugins/commands/output.d.ts +115 -0
  131. package/dist/plugins/commands/record.d.ts +549 -0
  132. package/dist/plugins/commands/service.d.ts +314 -0
  133. package/dist/plugins/commands/shell.d.ts +25 -0
  134. package/dist/plugins/compaction/checkpoint.d.ts +91 -0
  135. package/dist/plugins/compaction/config.d.ts +133 -0
  136. package/dist/plugins/compaction/estimate.d.ts +29 -0
  137. package/dist/plugins/compaction/index.d.ts +2 -0
  138. package/dist/plugins/compaction/index.js +7 -0
  139. package/dist/plugins/compaction/log.d.ts +61 -0
  140. package/dist/plugins/compaction/planner.d.ts +207 -0
  141. package/dist/plugins/compaction/preset.d.ts +86 -0
  142. package/dist/plugins/compaction/prune.d.ts +9 -0
  143. package/dist/plugins/compaction/records.d.ts +227 -0
  144. package/dist/plugins/compaction/segments.d.ts +23 -0
  145. package/dist/plugins/compaction/shared.d.ts +14 -0
  146. package/dist/plugins/compaction/summarize.d.ts +13 -0
  147. package/dist/plugins/dateAndBranch.d.ts +47 -0
  148. package/dist/plugins/dateAndBranch.js +1 -0
  149. package/dist/plugins/delegations/answers.d.ts +39 -0
  150. package/dist/plugins/delegations/assignmentKey.d.ts +22 -0
  151. package/dist/plugins/delegations/cleanup.d.ts +161 -0
  152. package/dist/plugins/delegations/constraint.d.ts +76 -0
  153. package/dist/plugins/delegations/index.d.ts +39 -0
  154. package/dist/plugins/delegations/index.js +1 -0
  155. package/dist/plugins/delegations/notices.d.ts +261 -0
  156. package/dist/plugins/delegations/obligations.d.ts +210 -0
  157. package/dist/plugins/delegations/record.d.ts +632 -0
  158. package/dist/plugins/delegations/request.d.ts +381 -0
  159. package/dist/plugins/delegations/role.d.ts +30 -0
  160. package/dist/plugins/delegations/service.d.ts +562 -0
  161. package/dist/plugins/delegations/standing.d.ts +19 -0
  162. package/dist/plugins/delegations/stopCheck.d.ts +21 -0
  163. package/dist/plugins/delegations/testing.d.ts +16 -0
  164. package/dist/plugins/delegations/tools.d.ts +71 -0
  165. package/dist/plugins/delegations/waitBook.d.ts +116 -0
  166. package/dist/plugins/delegations/waits.d.ts +118 -0
  167. package/dist/plugins/diagnostics/digest.d.ts +14 -0
  168. package/dist/plugins/diagnostics/index.d.ts +68 -0
  169. package/dist/plugins/diagnostics/index.js +1 -0
  170. package/dist/plugins/historyRecall/history.d.ts +9 -0
  171. package/dist/plugins/historyRecall/index.d.ts +31 -0
  172. package/dist/plugins/historyRecall/index.js +1 -0
  173. package/dist/plugins/historyRecall/render.d.ts +34 -0
  174. package/dist/plugins/historyRecall/tools.d.ts +4 -0
  175. package/dist/plugins/mcp/catalog.d.ts +36 -0
  176. package/dist/plugins/mcp/config.d.ts +63 -0
  177. package/dist/plugins/mcp/connection.d.ts +53 -0
  178. package/dist/plugins/mcp/errors.d.ts +32 -0
  179. package/dist/plugins/mcp/index.d.ts +33 -0
  180. package/dist/plugins/mcp/index.js +5 -0
  181. package/dist/plugins/mcp/mount.d.ts +98 -0
  182. package/dist/plugins/mcp/names.d.ts +25 -0
  183. package/dist/plugins/mcp/render.d.ts +29 -0
  184. package/dist/plugins/mcp/slots.d.ts +15 -0
  185. package/dist/plugins/mcp/stdio.d.ts +49 -0
  186. package/dist/plugins/mcp/tool.d.ts +41 -0
  187. package/dist/plugins/providers/anthropic.d.ts +175 -0
  188. package/dist/plugins/providers/anthropicMessages.d.ts +65 -0
  189. package/dist/plugins/providers/codex.d.ts +60 -0
  190. package/dist/plugins/providers/codexAuth.d.ts +116 -0
  191. package/dist/plugins/providers/deepseek.d.ts +55 -0
  192. package/dist/plugins/providers/door.d.ts +61 -0
  193. package/dist/plugins/providers/door.js +1 -0
  194. package/dist/plugins/providers/failure.d.ts +23 -0
  195. package/dist/plugins/providers/gateway.d.ts +23 -0
  196. package/dist/plugins/providers/index.d.ts +6 -0
  197. package/dist/plugins/providers/openaiChat.d.ts +62 -0
  198. package/dist/plugins/providers/openaiResponses.d.ts +100 -0
  199. package/dist/plugins/providers/opencodeCopilot.d.ts +23 -0
  200. package/dist/plugins/providers/opencodeGo.d.ts +98 -0
  201. package/dist/plugins/providers/shared.d.ts +104 -0
  202. package/dist/plugins/providers/stream.d.ts +154 -0
  203. package/dist/plugins/routeContext.d.ts +22 -0
  204. package/dist/plugins/routeContext.js +1 -0
  205. package/dist/plugins/schedules/index.d.ts +21 -0
  206. package/dist/plugins/schedules/index.js +5 -0
  207. package/dist/plugins/schedules/record.d.ts +396 -0
  208. package/dist/plugins/schedules/service.d.ts +120 -0
  209. package/dist/plugins/schedules/time.d.ts +26 -0
  210. package/dist/plugins/schedules/tools.d.ts +6 -0
  211. package/dist/plugins/skills/discovery.d.ts +54 -0
  212. package/dist/plugins/skills/index.d.ts +31 -0
  213. package/dist/plugins/skills/index.js +1 -0
  214. package/dist/plugins/skills/tool.d.ts +11 -0
  215. package/dist/plugins/store/durableObject.d.ts +23 -0
  216. package/dist/plugins/store/durableObject.js +1 -0
  217. package/dist/plugins/store/durableObjectConnection.d.ts +27 -0
  218. package/dist/plugins/store/memory.d.ts +29 -0
  219. package/dist/plugins/store/sql.d.ts +59 -0
  220. package/dist/plugins/store/sqlite.d.ts +31 -0
  221. package/dist/plugins/store/sqlite.js +1 -0
  222. package/dist/plugins/subAgents/availableRoutes.d.ts +53 -0
  223. package/dist/plugins/subAgents/fork.d.ts +32 -0
  224. package/dist/plugins/subAgents/index.d.ts +67 -0
  225. package/dist/plugins/subAgents/index.js +1 -0
  226. package/dist/plugins/subAgents/tool.d.ts +38 -0
  227. package/dist/plugins/toolPolicy/index.d.ts +61 -0
  228. package/dist/plugins/toolPolicy/index.js +1 -0
  229. package/dist/plugins/tools/editFiles.d.ts +128 -0
  230. package/dist/plugins/tools/fsRead.d.ts +17 -0
  231. package/dist/plugins/tools/html.d.ts +23 -0
  232. package/dist/plugins/tools/index.d.ts +59 -0
  233. package/dist/plugins/tools/index.js +1 -0
  234. package/dist/plugins/tools/network.d.ts +23 -0
  235. package/dist/plugins/tools/ripgrep.d.ts +20 -0
  236. package/dist/plugins/tools/textEdit.d.ts +67 -0
  237. package/dist/plugins/tools/web.d.ts +32 -0
  238. package/dist/plugins/truncateToolOutput.d.ts +26 -0
  239. package/dist/plugins/truncateToolOutput.js +1 -0
  240. package/dist/plugins/usage/index.d.ts +24 -0
  241. package/dist/plugins/usage/index.js +1 -0
  242. package/dist/plugins/usage/tracker.d.ts +34 -0
  243. package/dist/plugins/verify/facts.d.ts +356 -0
  244. package/dist/plugins/verify/index.d.ts +75 -0
  245. package/dist/plugins/verify/index.js +1 -0
  246. package/dist/plugins/verify/service.d.ts +90 -0
  247. package/dist/plugins/workflows/assignment.d.ts +16 -0
  248. package/dist/plugins/workflows/bindings.d.ts +95 -0
  249. package/dist/plugins/workflows/cleanup.d.ts +38 -0
  250. package/dist/plugins/workflows/definition.d.ts +184 -0
  251. package/dist/plugins/workflows/fold.d.ts +373 -0
  252. package/dist/plugins/workflows/index.d.ts +28 -0
  253. package/dist/plugins/workflows/index.js +6 -0
  254. package/dist/plugins/workflows/observations.d.ts +81 -0
  255. package/dist/plugins/workflows/participants.d.ts +143 -0
  256. package/dist/plugins/workflows/policy.d.ts +112 -0
  257. package/dist/plugins/workflows/providers.d.ts +146 -0
  258. package/dist/plugins/workflows/record.d.ts +2863 -0
  259. package/dist/plugins/workflows/routing.d.ts +116 -0
  260. package/dist/plugins/workflows/schema.d.ts +26 -0
  261. package/dist/plugins/workflows/service.d.ts +477 -0
  262. package/dist/plugins/workflows/submit.d.ts +8 -0
  263. package/dist/plugins/workflows/view.d.ts +103 -0
  264. package/dist/plugins/workflows/work.d.ts +21 -0
  265. package/dist/plugins/workspaceContext.d.ts +38 -0
  266. package/dist/plugins/workspaceContext.js +1 -0
  267. package/dist/presets/agents.d.ts +7 -0
  268. package/dist/presets/base.d.ts +10 -0
  269. package/dist/presets/codex.d.ts +60 -0
  270. package/dist/presets/index.d.ts +4 -0
  271. package/dist/presets/prompts.d.ts +56 -0
  272. package/dist/sandbox/absent.d.ts +32 -0
  273. package/dist/sandbox/client.d.ts +39 -0
  274. package/dist/sandbox/files.d.ts +28 -0
  275. package/dist/sandbox/index.d.ts +49 -0
  276. package/dist/sandbox/index.js +4 -0
  277. package/dist/sandbox/mode.d.ts +57 -0
  278. package/dist/sandbox/policy.d.ts +86 -0
  279. package/dist/sandbox/protocol.d.ts +107 -0
  280. package/dist/sandbox/service.d.ts +143 -0
  281. package/dist/sandbox/worker.d.ts +12 -0
  282. package/dist/sandbox/worker.js +1 -0
  283. package/dist/services/admission.d.ts +174 -0
  284. package/dist/services/agents.d.ts +37 -0
  285. package/dist/services/birth.d.ts +220 -0
  286. package/dist/services/contributions.d.ts +73 -0
  287. package/dist/services/core.d.ts +34 -0
  288. package/dist/services/journal.d.ts +26 -0
  289. package/dist/services/launches.d.ts +104 -0
  290. package/dist/services/llm.d.ts +80 -0
  291. package/dist/services/owner.d.ts +367 -0
  292. package/dist/services/preset.d.ts +154 -0
  293. package/dist/services/presets.d.ts +139 -0
  294. package/dist/services/prompts.d.ts +67 -0
  295. package/dist/services/runEvents.d.ts +79 -0
  296. package/dist/services/thread.d.ts +267 -0
  297. package/dist/services/threadActivation.d.ts +100 -0
  298. package/dist/services/threadDirs.d.ts +38 -0
  299. package/dist/services/threadView.d.ts +92 -0
  300. package/dist/services/threads.d.ts +449 -0
  301. package/dist/services/tools.d.ts +41 -0
  302. package/dist/sys/environment.d.ts +47 -0
  303. package/dist/sys/git.d.ts +60 -0
  304. package/dist/sys/paths.d.ts +56 -0
  305. package/dist/sys/spawn.d.ts +176 -0
  306. package/dist/testing/clock.d.ts +17 -0
  307. package/dist/testing/fakeLlm.d.ts +74 -0
  308. package/dist/testing/fedLlm.d.ts +32 -0
  309. package/dist/testing/helpers.d.ts +344 -0
  310. package/dist/testing/index.d.ts +13 -0
  311. package/dist/testing/index.js +1 -0
  312. package/dist/testing/processes.d.ts +13 -0
  313. package/dist/testing/sandbox.d.ts +71 -0
  314. package/dist/testing/settlement.d.ts +6 -0
  315. package/dist/testing/tmpDirs.d.ts +17 -0
  316. package/dist/util/async.d.ts +8 -0
  317. package/dist/util/diff.d.ts +25 -0
  318. package/dist/util/dispatch.d.ts +8 -0
  319. package/dist/util/errors.d.ts +28 -0
  320. package/dist/util/foldState.d.ts +17 -0
  321. package/dist/util/freeze.d.ts +2 -0
  322. package/dist/util/ids.d.ts +2 -0
  323. package/dist/util/json.d.ts +37 -0
  324. package/dist/util/log.d.ts +6 -0
  325. package/dist/util/text.d.ts +21 -0
  326. package/dist/util/version.d.ts +2 -0
  327. package/package.json +175 -3
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e}from"../../chunks/ENWFSU27.js";import"../../chunks/OVZFGILJ.js";import"../../chunks/JPZFKSWT.js";import"../../chunks/NAOUTU7A.js";import"../../chunks/UKXMCHHT.js";import"../../chunks/WUUKTSRT.js";import"../../chunks/NDIM7MEW.js";import"../../chunks/34KW6VNQ.js";import"../../chunks/PUSUPTAT.js";import"../../chunks/G6RXC3AL.js";import"../../chunks/DXFXAYDN.js";import"../../chunks/YLNJXQ3Z.js";import"../../chunks/DDANMY45.js";import"../../chunks/37YOGDGY.js";import"../../chunks/KESCTXGO.js";import"../../chunks/TYTQRLTX.js";import"../../chunks/D7E6EWIE.js";export{a as READ_ONLY_TOOLS,b as RG_TOOLS,c as WEB_TOOLS,e as builtinTools,d as builtinToolsFor};
@@ -0,0 +1,23 @@
1
+ import type { LookupAddress, LookupAllOptions } from 'node:dns';
2
+ import { type LookupFunction } from 'node:net';
3
+ /** What a refused address is, for the message that names it. */
4
+ type AddressKind = string;
5
+ /**
6
+ * Why an IP address is not on the public internet, or `null` when it is. A zone index (`%eth0`) is
7
+ * ignored; anything that is not an IP address is `null`, for the resolver to judge.
8
+ */
9
+ export declare function privateAddressKind(address: string): AddressKind | null;
10
+ /** Refuses a fetch that would reach a private address, naming the host and what the address is. */
11
+ export declare class PrivateAddressError extends Error {
12
+ readonly name = "PrivateAddressError";
13
+ constructor(host: string, address: string, kind: AddressKind);
14
+ }
15
+ /** Resolves every address of a host, as `dns.lookup` does with `all: true`. */
16
+ export type ResolveAll = (hostname: string, options: LookupAllOptions, callback: (error: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void) => void;
17
+ /**
18
+ * A socket `lookup` that resolves every address of the host and refuses the connection when any of
19
+ * them is private, so a mixed answer cannot pick its way past the check. The socket connects to an
20
+ * address checked here; TLS still verifies the certificate against the host name.
21
+ */
22
+ export declare const refusingLookup: (resolveAll: ResolveAll) => LookupFunction;
23
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { Tool } from '../../loop/index.js';
2
+ import { type SpawnEnvironment } from '../../sys/spawn.js';
3
+ /**
4
+ * What both search tools run: the trusted `rg`, in the host's spawn environment, and how long one
5
+ * search's `rg` may run before what it found so far is returned as partial.
6
+ */
7
+ export type SearchProgram = {
8
+ rg: string;
9
+ environment: SpawnEnvironment;
10
+ timeoutMs: number;
11
+ };
12
+ /** The most matches one search returns. */
13
+ export declare const MAX_RG_RESULTS = 200;
14
+ /** `rg_search`, running the trusted `rg` in the host's environment; its name and description say so. */
15
+ export declare const rgSearchTool: (program: SearchProgram) => Tool;
16
+ /**
17
+ * `rg_files`: `rg --files` lists what the search admits, and the pattern is matched against each
18
+ * listed path, relative to the search directory, so a pattern never lets an ignored file in.
19
+ */
20
+ export declare const rgFilesTool: (program: SearchProgram) => Tool;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The text side of `edit_files`: decoding a file as text and encoding it back exactly as it was
3
+ * kept, and locating a hunk's old text in it.
4
+ *
5
+ * A hunk is matched exactly first, then in the three looser passes Codex's `apply_patch` uses
6
+ * (`codex-rs/apply-patch/src/seek_sequence.rs`): line by line ignoring trailing whitespace, then
7
+ * surrounding whitespace, then also typographic punctuation. Unlike Codex, which takes the first
8
+ * place a pass finds, a pass here decides only when it finds exactly one: a second place fails the
9
+ * hunk as ambiguous, and so does a second exact match.
10
+ *
11
+ * A pass that ignores surrounding whitespace can match lines indented differently from the old text.
12
+ * The new text is then shifted by the same difference, so what replaces the lines sits where they
13
+ * did; see {@link reindent}.
14
+ */
15
+ /** A text file as `edit_files` keeps it: its text, and what it writes back around the text unchanged. */
16
+ export type TextFile = {
17
+ /** Whether the file starts with a UTF-8 byte-order mark, which `text` leaves out. */
18
+ readonly bom: boolean;
19
+ readonly text: string;
20
+ /** The file's line ending, from its first line; `\n` for a file with none. */
21
+ readonly eol: '\n' | '\r\n';
22
+ /** Whether the file ends with a line ending. */
23
+ readonly finalNewline: boolean;
24
+ };
25
+ /** Why a file is not text `edit_files` will edit, or `null` and the file. */
26
+ export declare function decodeText(bytes: Buffer): {
27
+ file: TextFile;
28
+ refusal: null;
29
+ } | {
30
+ file: null;
31
+ refusal: string;
32
+ };
33
+ /** `text` as the file's bytes, with the BOM the file had. */
34
+ export declare function encodeText(file: Pick<TextFile, 'bom'>, text: string): Buffer;
35
+ /** `text` with its line endings made the file's. */
36
+ export declare function withLineEndings(text: string, eol: TextFile['eol']): string;
37
+ /**
38
+ * New text for a file whose old text was `file`, ending in a newline exactly when the old text
39
+ * did: one is added when it had one, and every trailing line ending removed when it had none. An
40
+ * empty file has no ending to keep, so its new text is taken as given.
41
+ */
42
+ export declare function keepFinalNewline(file: TextFile, text: string): string;
43
+ export type Hunk = {
44
+ readonly old_text: string;
45
+ readonly new_text: string;
46
+ };
47
+ /** How a hunk's old text was found, or why it was not. */
48
+ export type HunkMatch = {
49
+ readonly found: true;
50
+ readonly text: string;
51
+ readonly pass: MatchPass;
52
+ /** Whether the new text was shifted to the file's indentation. */
53
+ readonly reindented: boolean;
54
+ } | {
55
+ readonly found: false;
56
+ readonly reason: string;
57
+ };
58
+ export type MatchPass = 'exact' | 'trailing-whitespace' | 'whitespace' | 'punctuation';
59
+ export declare const PASS_WORDING: Record<Exclude<MatchPass, 'exact'>, string>;
60
+ /**
61
+ * `text` with `hunk` applied, in the file's line endings. The old text must be found in exactly
62
+ * one place; when it is found nowhere, the reason shows what was looked for and the lines of the
63
+ * file nearest to it.
64
+ */
65
+ export declare function applyHunk(text: string, hunk: Hunk, eol: TextFile['eol']): HunkMatch;
66
+ /** Codex's normalization: trimmed, with dashes, quotes and odd spaces made ASCII. */
67
+ export declare function normalized(line: string): string;
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What web_fetch may reach: `refuse` keeps it on the public internet, refusing a host that is, or
4
+ * resolves to, a loopback, link-local, private, unique-local, CGNAT, unspecified, multicast or
5
+ * reserved address, in any of its IPv6 forms; `allow` reaches whatever the host can.
6
+ */
7
+ export type PrivateNetwork = 'allow' | 'refuse';
8
+ /** web_fetch, reaching what {@link PrivateNetwork} allows. */
9
+ export declare const webFetchTool: (privateNetwork: PrivateNetwork) => import("../../plugin.js").Tool;
10
+ /**
11
+ * What `web_search` runs on: the Codex login it searches through (`authPath`, with the refresh
12
+ * deadline every client of that login shares), the model the endpoint requires, and how much one
13
+ * search may return (`maxOutputTokens` bounds the text, `responseLength` the number of results).
14
+ */
15
+ export declare const WebSearchConfigSchema: z.ZodObject<{
16
+ authPath: z.ZodString;
17
+ refreshTimeoutMs: z.ZodNumber;
18
+ model: z.ZodString;
19
+ maxOutputTokens: z.ZodNumber;
20
+ responseLength: z.ZodEnum<{
21
+ medium: "medium";
22
+ short: "short";
23
+ long: "long";
24
+ }>;
25
+ }, z.core.$strict>;
26
+ export type WebSearchConfig = z.output<typeof WebSearchConfigSchema>;
27
+ /**
28
+ * web_search, through Codex's search endpoint over the Codex login. The server's text is returned as
29
+ * it is: each result's title and URL, its age and an excerpt. `results`, the same list as data, is
30
+ * kept for the host in `metadata`, opaque, and `null` when the server sent none.
31
+ */
32
+ export declare const webSearchTool: (config: WebSearchConfig) => import("../../plugin.js").Tool;
@@ -0,0 +1,26 @@
1
+ import type { Plugin } from '@leuduan/cordis';
2
+ import { z } from 'zod';
3
+ import type { ToolResult } from '../models/index.js';
4
+ /** Where full outputs go inside a thread's directory. */
5
+ export declare const TOOL_OUTPUTS_DIR = "tool-outputs";
6
+ /** The least limit that holds the longest gap marker and a character each of head and tail. */
7
+ export declare const MIN_TOOL_OUTPUT_LENGTH: number;
8
+ export declare const TruncateToolOutputConfigSchema: z.ZodObject<{
9
+ maxToolOutputLength: z.ZodDefault<z.ZodNumber>;
10
+ }, z.core.$strip>;
11
+ export type TruncateToolOutputConfig = z.input<typeof TruncateToolOutputConfigSchema>;
12
+ /**
13
+ * Caps tool output at a character limit, keeping its head and its tail around a marker that says how
14
+ * much of the middle was cut, and writes the full text to the thread's own directory
15
+ * (`<thread dir>/tool-outputs/`), where file tools can read it back when available. Characters are
16
+ * UTF-16 code units, as `string.length` counts them, and no cut splits a surrogate pair. A tool may opt
17
+ * out by setting `no_truncation: true` in its result metadata. Because this wraps
18
+ * `lagent/tool/execute`, the journal records exactly what the model saw. A call that waits has
19
+ * no output to cap.
20
+ */
21
+ export declare const truncateToolOutput: Plugin.Object<TruncateToolOutputConfig | undefined>;
22
+ /**
23
+ * Truncates `result` to `limit` characters, head and tail with the gap marker between them, writing the
24
+ * full output into `directory` when it was cut. `limit` is at least {@link MIN_TOOL_OUTPUT_LENGTH}.
25
+ */
26
+ export declare function applyTruncation(result: ToolResult, limit: number, directory: string): Promise<ToolResult>;
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e}from"../chunks/3LQHQRIU.js";import"../chunks/YLNJXQ3Z.js";import"../chunks/DDANMY45.js";import"../chunks/37YOGDGY.js";import"../chunks/KESCTXGO.js";import"../chunks/TYTQRLTX.js";import"../chunks/D7E6EWIE.js";export{b as MIN_TOOL_OUTPUT_LENGTH,a as TOOL_OUTPUTS_DIR,c as TruncateToolOutputConfigSchema,e as applyTruncation,d as truncateToolOutput};
@@ -0,0 +1,24 @@
1
+ import { Context, Service } from '@leuduan/cordis';
2
+ import { UsageSnapshot } from './tracker.js';
3
+ export { UsageSnapshot } from './tracker.js';
4
+ export type { UsageSnapshotInit } from './tracker.js';
5
+ declare module '@leuduan/cordis' {
6
+ interface Context {
7
+ /** Model usage totals per thread (optional plugin). */
8
+ usage: UsageService;
9
+ }
10
+ }
11
+ /**
12
+ * Model usage as a fold over each thread's journal. The engine itself counts nothing — without
13
+ * this service mounted, nobody is keeping score. There is no journal-wide total: a thread's spend
14
+ * is a function of its own rows, and a sum over several threads is the host's, over the threads it
15
+ * shows, as a caller-chain rollup is, by joining threads on `origin`.
16
+ */
17
+ export declare class UsageService extends Service {
18
+ static inject: string[];
19
+ constructor(ctx: Context);
20
+ /** Everything one thread has spent so far. */
21
+ thread(threadId: string): UsageSnapshot;
22
+ /** What one thread's most recent completed turn spent. */
23
+ lastTurn(threadId: string): UsageSnapshot;
24
+ }
@@ -0,0 +1 @@
1
+ import{h as _}from"../../chunks/37YOGDGY.js";import"../../chunks/KESCTXGO.js";import"../../chunks/TYTQRLTX.js";import"../../chunks/D7E6EWIE.js";import{Service as a}from"@leuduan/cordis";var n=class e{request_count;input_tokens;output_tokens;cache_read_input_tokens;cache_write_input_tokens;reasoning_output_tokens;constructor(t={}){this.request_count=t.request_count??0,this.input_tokens=t.input_tokens??0,this.output_tokens=t.output_tokens??0,this.cache_read_input_tokens=t.cache_read_input_tokens??0,this.cache_write_input_tokens=t.cache_write_input_tokens??0,this.reasoning_output_tokens=t.reasoning_output_tokens??0,Object.freeze(this)}get totalTokens(){return this.input_tokens+this.output_tokens}get cacheMissInputTokens(){return this.input_tokens-this.cache_read_input_tokens}delta(t){return new e({request_count:this.request_count-t.request_count,input_tokens:this.input_tokens-t.input_tokens,output_tokens:this.output_tokens-t.output_tokens,cache_read_input_tokens:this.cache_read_input_tokens-t.cache_read_input_tokens,cache_write_input_tokens:this.cache_write_input_tokens-t.cache_write_input_tokens,reasoning_output_tokens:this.reasoning_output_tokens-t.reasoning_output_tokens})}plus(t){return new e({request_count:this.request_count+t.request_count,input_tokens:this.input_tokens+t.input_tokens,output_tokens:this.output_tokens+t.output_tokens,cache_read_input_tokens:this.cache_read_input_tokens+t.cache_read_input_tokens,cache_write_input_tokens:this.cache_write_input_tokens+t.cache_write_input_tokens,reasoning_output_tokens:this.reasoning_output_tokens+t.reasoning_output_tokens})}toJSON(){return{request_count:this.request_count,input_tokens:this.input_tokens,output_tokens:this.output_tokens,cache_read_input_tokens:this.cache_read_input_tokens,cache_write_input_tokens:this.cache_write_input_tokens,reasoning_output_tokens:this.reasoning_output_tokens}}},s=()=>({request_count:0,input_tokens:0,output_tokens:0,cache_read_input_tokens:0,cache_write_input_tokens:0,reasoning_output_tokens:0}),u=(e,t)=>{t&&(e.input_tokens+=t.input_tokens,e.output_tokens+=t.output_tokens,e.cache_read_input_tokens+=t.cache_read_input_tokens,e.cache_write_input_tokens+=t.cache_write_input_tokens,e.reasoning_output_tokens+=t.reasoning_output_tokens)};function r(e,t){switch(t.type){case"llm/request":case"auxiliary/request":e.request_count+=1;return;case"assistant/message":u(e,t.data.response.message.usage);return;case"auxiliary/result":u(e,t.data.usage);return;default:return}}var c=()=>({totals:s(),baseline:s(),lastTurn:s()}),o=_({key:"lagent:usage:thread",onFork:"reset",init:c,apply(e,t){return r(e.totals,t),t.type==="turn/start"?e.baseline={...e.totals}:t.type==="turn/end"&&(e.lastTurn=new n(e.totals).delta(new n(e.baseline)).toJSON()),e}}),i=class extends a{static inject=["journal"];constructor(t){super(t,"usage"),t.effect(()=>t.journal.register(o))}thread(t){return new n(this.ctx.journal.state(o,t).totals)}lastTurn(t){return new n(this.ctx.journal.state(o,t).lastTurn)}};export{i as UsageService,n as UsageSnapshot};
@@ -0,0 +1,34 @@
1
+ import type { JournalEvent } from '../../models/index.js';
2
+ export type UsageSnapshotInit = Partial<{
3
+ request_count: number;
4
+ input_tokens: number;
5
+ output_tokens: number;
6
+ cache_read_input_tokens: number;
7
+ cache_write_input_tokens: number;
8
+ reasoning_output_tokens: number;
9
+ }>;
10
+ export declare class UsageSnapshot {
11
+ readonly request_count: number;
12
+ readonly input_tokens: number;
13
+ readonly output_tokens: number;
14
+ readonly cache_read_input_tokens: number;
15
+ readonly cache_write_input_tokens: number;
16
+ readonly reasoning_output_tokens: number;
17
+ constructor(init?: UsageSnapshotInit);
18
+ get totalTokens(): number;
19
+ get cacheMissInputTokens(): number;
20
+ delta(previous: UsageSnapshot): UsageSnapshot;
21
+ /** This and `other` together: how a host sums the threads it shows, since nothing rolls up for it. */
22
+ plus(other: UsageSnapshot): UsageSnapshot;
23
+ toJSON(): Required<UsageSnapshotInit>;
24
+ }
25
+ /** A thread's usage counters as plain data: what the usage fold keeps, and what a snapshot is built from. */
26
+ export type UsageCounters = Required<UsageSnapshotInit>;
27
+ export declare const emptyCounters: () => UsageCounters;
28
+ /**
29
+ * Counts model requests and aggregates token usage from `llm/request` and `assistant/message`, and
30
+ * from the auxiliary calls plugins make beside the conversation, `auxiliary/request` and
31
+ * `auxiliary/result`: a summary that was discarded was still paid for, so every result counts,
32
+ * whatever became of its text. Mutates `counters`; a fold reducer's state is its own to change.
33
+ */
34
+ export declare function countEvent(counters: UsageCounters, event: JournalEvent): void;
@@ -0,0 +1,356 @@
1
+ import { z } from 'zod';
2
+ import { type PluginJournal } from '../../journal/index.js';
3
+ import { type Refusal, type StopVerdict } from '../../loop/index.js';
4
+ import type { Seq } from '../../models/index.js';
5
+ import type { ReadonlyState } from '../../util/foldState.js';
6
+ /** The verify preset's id. */
7
+ export declare const VERIFY_PRESET = "verify";
8
+ /** Times a thread is sent back to verify, since its last change, the person's last message or a requirement's arming, before its answer is rejected. */
9
+ export declare const VERIFY_REMINDERS = 2;
10
+ /** A verification: the command text `run_command` must be given, and the absolute directory it must run in. */
11
+ export type Verification = {
12
+ readonly command: string;
13
+ readonly cwd: string;
14
+ };
15
+ /** What the model is told up front: the verification this conversation finishes with. Neither a change nor a reminder. */
16
+ export declare const notice: {
17
+ record: (value: {
18
+ command: string;
19
+ cwd: string;
20
+ }) => import("../../models/index.js").ExtensionRecord;
21
+ parse: (value: {
22
+ command: string;
23
+ cwd: string;
24
+ }) => {
25
+ command: string;
26
+ cwd: string;
27
+ };
28
+ entry: (value: {
29
+ command: string;
30
+ cwd: string;
31
+ }, options: import("../../journal/journal.js").AppendOptions) => {
32
+ type: "ext";
33
+ data: {
34
+ plugin: string;
35
+ instance_id: string;
36
+ kind: string;
37
+ version: number;
38
+ data: z.core.util.JSONType;
39
+ };
40
+ options: import("../../journal/journal.js").AppendOptions;
41
+ };
42
+ append(journal: PluginJournal, value: {
43
+ command: string;
44
+ cwd: string;
45
+ }, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../models/index.js").JournalEvent<"ext">>;
46
+ read(event: import("../../models/index.js").JournalEvent): {
47
+ command: string;
48
+ cwd: string;
49
+ } | undefined;
50
+ contribution(message: {
51
+ role?: import("../../models/index.js").InputRole;
52
+ content: string | readonly import("../../llm/content.js").ContentPartInput[];
53
+ }, value: {
54
+ command: string;
55
+ cwd: string;
56
+ }, options?: {
57
+ sourceSeqs?: readonly Seq[];
58
+ }): import("../../models/index.js").StepContribution;
59
+ matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../models/index.js").ExtensionRecord>): boolean;
60
+ rejection(reason: string, value: {
61
+ command: string;
62
+ cwd: string;
63
+ }): {
64
+ decision: "reject";
65
+ reason: string;
66
+ source: import("../../models/index.js").ExtensionRecord;
67
+ };
68
+ readContribution: (event: import("../../models/index.js").JournalEvent) => {
69
+ command: string;
70
+ cwd: string;
71
+ } | undefined;
72
+ readSource: (source: import("../../util/json.js").DeepReadonly<import("../../models/index.js").ExtensionRecord> | null) => {
73
+ command: string;
74
+ cwd: string;
75
+ } | undefined;
76
+ told: import("../../journal/projection.js").PluginProjection<import("../../kit/extension.js").ToldNotices<{
77
+ command: string;
78
+ cwd: string;
79
+ }>>;
80
+ projection<State>(fold: {
81
+ key: string;
82
+ init(): State;
83
+ apply(state: State, value: {
84
+ command: string;
85
+ cwd: string;
86
+ }, event: import("../../models/index.js").JournalEvent<"ext">): State;
87
+ onFork?: "inherit" | "reset";
88
+ }): import("../../journal/projection.js").PluginProjection<State>;
89
+ };
90
+ /** An `edit_files` or `run_command` call the model asked for, until its result lands. */
91
+ type TrackedCall = {
92
+ /** A `run_command`'s command, by {@link commandKey}, and the directory it runs in; `null` for an `edit_files` call. */
93
+ readonly run: PlacedRun | null;
94
+ /** Its latest allowed `tool/authorization` row: the moment it may have begun. `null` while it has none. */
95
+ allowedAt: Seq | null;
96
+ };
97
+ /** A `run_command` call as it is placed: its key, and the directory, when the thread's cwd is known. */
98
+ type PlacedRun = {
99
+ readonly key: string;
100
+ readonly cwd: string | null;
101
+ };
102
+ /** What the thread's runs of one command text in one directory came to. */
103
+ type CommandFacts = {
104
+ /** The latest result row of an allowed run, whatever its outcome. */
105
+ resultAt: Seq | null;
106
+ /** The latest result row of an allowed run that did not pass. */
107
+ failedAt: Seq | null;
108
+ /** The latest allowed attempt of a run that passed: everything settled before it is proven. */
109
+ provenAt: Seq | null;
110
+ /** The latest `tool/authorization` row of a call of it, and whether policy denied it. */
111
+ decision: {
112
+ readonly seq: Seq;
113
+ readonly denied: boolean;
114
+ } | null;
115
+ };
116
+ /**
117
+ * What every gate needs of a thread, folded from its rows whatever the gate's verification is: the
118
+ * calls in flight, and what each command run, each other change and the person came to. A gate
119
+ * judges its own verification from these when it is asked, so one fold serves every configuration.
120
+ */
121
+ export type VerifyFacts = {
122
+ /** The thread's cwd, from its spawn row: what a `run_command` without `workdir` runs in. */
123
+ threadCwd: string | null;
124
+ calls: Map<string, TrackedCall>;
125
+ /** The latest row settling a change no verification could be: an `edit_files` result, a background command's start or end. */
126
+ changedAt: Seq | null;
127
+ /** Each command text and directory run, by {@link commandKey}. */
128
+ commands: Map<string, CommandFacts>;
129
+ /** The person's latest message. */
130
+ personAt: Seq | null;
131
+ /**
132
+ * The reminder rows of each verification, by {@link commandKey}, since the last row that starts
133
+ * its count over: the person writing, or a change other than a run of that verification.
134
+ */
135
+ reminders: Map<string, Seq[]>;
136
+ };
137
+ /** A command text and the directory it runs in, as one key; a directory not known never matches a verification. */
138
+ export declare const commandKey: (command: string, cwd: string | null) => string;
139
+ export declare const verifyFacts: import("../../journal/projection.js").PluginProjection<VerifyFacts>;
140
+ /**
141
+ * What a thread's catalog entry says of its changes, for a caller above it whose work it is
142
+ * ({@link delegatedChange}), contributed for every thread while the `verify` service is mounted. A
143
+ * thread whose facts cannot be read reads `unavailable`, which nothing reads as "none".
144
+ */
145
+ export declare const changes: import("../../services/contributions.js").ContributionDefinition<{
146
+ changed_at: number | null;
147
+ }>;
148
+ /** The last change a thread's delegated work made, or why it cannot be read. */
149
+ export type DelegatedChange = {
150
+ readonly at: Seq | null;
151
+ } | {
152
+ readonly unreadable: string;
153
+ };
154
+ /**
155
+ * The last change made by the work `threadId` delegated ({@link lastChange}): each thread
156
+ * its calls started, at any depth, from its facts when it is loaded, else its catalog entry, so it
157
+ * holds across a restart; or why one of them cannot be read, which fails closed. A thread an owner
158
+ * assigned (an assignment origin, such as a workflow's isolated participant) is that owner's work,
159
+ * judged by its own verification, so neither it nor anything under it is the caller's.
160
+ *
161
+ * Row seqs are one journal's, assigned in append order whichever thread a row belongs to, so a
162
+ * descendant's change and the caller's verification attempt compare directly: a change whose row
163
+ * was written before the attempt settled before the verification began.
164
+ */
165
+ export declare function delegatedChange(journal: PluginJournal, threadId: string): DelegatedChange;
166
+ /** What one verification's gate judges from a thread's facts. */
167
+ type Judgment = {
168
+ /** The latest row settling a possible change, the thread's own or its delegated work's: a verification that passed is not one. */
169
+ readonly mutatedAt: Seq | null;
170
+ /** The allowed attempt of the latest verification that passed. */
171
+ readonly provenAt: Seq | null;
172
+ /** Whether policy denied the latest verification attempt since the person last wrote or the requirement armed. */
173
+ readonly denied: boolean;
174
+ /** Reminders since the last change other than a verification run, the person's last message, or the arming. */
175
+ readonly reminders: number;
176
+ };
177
+ /**
178
+ * One verification's judgment of a thread's facts, `delegatedAt` the last change its delegated work
179
+ * made: one starts the count of reminders over as the thread's own change does, which its fold
180
+ * already did for its own.
181
+ */
182
+ export declare function judgment(facts: ReadonlyState<VerifyFacts>, verification: Verification, armedAt: Seq | null, delegatedAt: Seq | null): Judgment;
183
+ /**
184
+ * A verification owed for one assignment, recorded on the thread serving it: the assignment's
185
+ * identity (its owner, id and participant generation, as an assignment origin names them), the
186
+ * input whose claim activates it, and the pinned verification. Its identity is the assignment's.
187
+ */
188
+ declare const RequirementSchema: z.ZodObject<{
189
+ owner: z.ZodString;
190
+ assignment: z.ZodString;
191
+ generation: z.ZodNumber;
192
+ input: z.ZodString;
193
+ command: z.ZodString;
194
+ cwd: z.ZodString;
195
+ }, z.core.$strict>;
196
+ export type RequirementInput = z.input<typeof RequirementSchema>;
197
+ export type Requirement = z.output<typeof RequirementSchema>;
198
+ declare const requirement: {
199
+ record: (value: {
200
+ owner: string;
201
+ assignment: string;
202
+ generation: number;
203
+ input: string;
204
+ command: string;
205
+ cwd: string;
206
+ }) => import("../../models/index.js").ExtensionRecord;
207
+ parse: (value: {
208
+ owner: string;
209
+ assignment: string;
210
+ generation: number;
211
+ input: string;
212
+ command: string;
213
+ cwd: string;
214
+ }) => {
215
+ owner: string;
216
+ assignment: string;
217
+ generation: number;
218
+ input: string;
219
+ command: string;
220
+ cwd: string;
221
+ };
222
+ entry: (value: {
223
+ owner: string;
224
+ assignment: string;
225
+ generation: number;
226
+ input: string;
227
+ command: string;
228
+ cwd: string;
229
+ }, options: import("../../journal/journal.js").AppendOptions) => {
230
+ type: "ext";
231
+ data: {
232
+ plugin: string;
233
+ instance_id: string;
234
+ kind: string;
235
+ version: number;
236
+ data: z.core.util.JSONType;
237
+ };
238
+ options: import("../../journal/journal.js").AppendOptions;
239
+ };
240
+ append(journal: PluginJournal, value: {
241
+ owner: string;
242
+ assignment: string;
243
+ generation: number;
244
+ input: string;
245
+ command: string;
246
+ cwd: string;
247
+ }, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../models/index.js").JournalEvent<"ext">>;
248
+ read(event: import("../../models/index.js").JournalEvent): {
249
+ owner: string;
250
+ assignment: string;
251
+ generation: number;
252
+ input: string;
253
+ command: string;
254
+ cwd: string;
255
+ } | undefined;
256
+ contribution(message: {
257
+ role?: import("../../models/index.js").InputRole;
258
+ content: string | readonly import("../../llm/content.js").ContentPartInput[];
259
+ }, value: {
260
+ owner: string;
261
+ assignment: string;
262
+ generation: number;
263
+ input: string;
264
+ command: string;
265
+ cwd: string;
266
+ }, options?: {
267
+ sourceSeqs?: readonly Seq[];
268
+ }): import("../../models/index.js").StepContribution;
269
+ matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../models/index.js").ExtensionRecord>): boolean;
270
+ rejection(reason: string, value: {
271
+ owner: string;
272
+ assignment: string;
273
+ generation: number;
274
+ input: string;
275
+ command: string;
276
+ cwd: string;
277
+ }): {
278
+ decision: "reject";
279
+ reason: string;
280
+ source: import("../../models/index.js").ExtensionRecord;
281
+ };
282
+ readContribution: (event: import("../../models/index.js").JournalEvent) => {
283
+ owner: string;
284
+ assignment: string;
285
+ generation: number;
286
+ input: string;
287
+ command: string;
288
+ cwd: string;
289
+ } | undefined;
290
+ readSource: (source: import("../../util/json.js").DeepReadonly<import("../../models/index.js").ExtensionRecord> | null) => {
291
+ owner: string;
292
+ assignment: string;
293
+ generation: number;
294
+ input: string;
295
+ command: string;
296
+ cwd: string;
297
+ } | undefined;
298
+ told: import("../../journal/projection.js").PluginProjection<import("../../kit/extension.js").ToldNotices<{
299
+ owner: string;
300
+ assignment: string;
301
+ generation: number;
302
+ input: string;
303
+ command: string;
304
+ cwd: string;
305
+ }>>;
306
+ projection<State>(fold: {
307
+ key: string;
308
+ init(): State;
309
+ apply(state: State, value: {
310
+ owner: string;
311
+ assignment: string;
312
+ generation: number;
313
+ input: string;
314
+ command: string;
315
+ cwd: string;
316
+ }, event: import("../../models/index.js").JournalEvent<"ext">): State;
317
+ onFork?: "inherit" | "reset";
318
+ }): import("../../journal/projection.js").PluginProjection<State>;
319
+ };
320
+ /** `value` validated as a requirement, its directory normalized as a placed run's is. */
321
+ export declare function requirementValue(value: RequirementInput): Requirement;
322
+ /**
323
+ * The rows recording `value` on `threadId`, decided inside its write: one row for a requirement
324
+ * not recorded yet; none for one recorded already exactly so (a replay renews nothing); a refusal
325
+ * for one recorded under its identity otherwise. A thread being opened has none recorded.
326
+ */
327
+ export declare function requirementRows(journal: PluginJournal, threadId: string, opening: boolean, parsed: Requirement): ReturnType<typeof requirement.entry>[] | {
328
+ refuse: Refusal;
329
+ };
330
+ /**
331
+ * The requirement in force on a thread: the one armed last, with the moment it armed, the later of
332
+ * its input's claim and its own row (so one recorded after the claim arms at its row); `null` while
333
+ * none has armed. A participant serves one assignment at a time, so a later arming supersedes every
334
+ * earlier requirement: two of them, pinned to different commands, would otherwise each count the
335
+ * other's runs as changes and never both pass. A requirement lives for the assignment that armed it:
336
+ * a delegation task opened on the thread after it armed, a successor assignment owing no
337
+ * verification included, retires it. Row seqs are one journal's, so the two compare directly.
338
+ */
339
+ export declare function inForce(journal: PluginJournal, threadId: string): {
340
+ verification: Verification;
341
+ at: Seq;
342
+ } | null;
343
+ /**
344
+ * The gate's say on a thread's answer for one verification, `armedAt` the moment its latest
345
+ * requirement armed, if one did, and `delegated` the last change its delegated work made
346
+ * ({@link delegatedChange}). What must be proven is everything settled before the barrier, the
347
+ * later of the last possible change, the thread's own or its delegated work's, and that arming, kept
348
+ * apart: an arming is no change, and a thread that changed nothing still owes its requirement a
349
+ * pass. It holds the answer until a verification whose allowed attempt came after the barrier
350
+ * passed, sending the model back at most {@link VERIFY_REMINDERS} times since the last change other
351
+ * than a verification run, the person's last message or the arming, then rejecting; it rejects at
352
+ * once when policy denied the latest attempt since the person last wrote or the requirement armed,
353
+ * and when the delegated work's changes cannot be read.
354
+ */
355
+ export declare function verdict(facts: ReadonlyState<VerifyFacts>, verification: Verification, armedAt: Seq | null, delegated: DelegatedChange): StopVerdict | undefined;
356
+ export {};