@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,549 @@
1
+ import { z } from 'zod';
2
+ import { type ExtensionRecord, type Seq } from '../../models/index.js';
3
+ import type { DeepReadonly } from '../../util/json.js';
4
+ /**
5
+ * What the journal keeps of a background command, so that a lagent process that did not start it
6
+ * can still say what it knows: that it was started, by whom and where, and whether and how it
7
+ * ended. Written by the commands plugin as `ext` rows of its own identity.
8
+ *
9
+ * The start row is written while the spawned group is still held at its startup gate, before the
10
+ * command runs, so no command ever runs unlisted; it says the command *may have started*, since the
11
+ * process can die after the row and before the gate opens. The end row is written when the plugin
12
+ * sees the command settle, and carries whether the stop succeeded: a settled wait does not prove
13
+ * the group is gone. A notifying command's natural exit writes its end row in the group of the
14
+ * notice that tells the thread (`commandNotice`).
15
+ */
16
+ declare const CommandRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
17
+ op: z.ZodLiteral<"started">;
18
+ id: z.ZodString;
19
+ call_seq: z.ZodNumber;
20
+ command: z.ZodString;
21
+ cwd: z.ZodString;
22
+ pgid: z.ZodNumber;
23
+ started_at: z.ZodString;
24
+ owner: z.ZodString;
25
+ notify: z.ZodNullable<z.ZodEnum<{
26
+ exit: "exit";
27
+ }>>;
28
+ launch: z.ZodNullable<z.ZodObject<{
29
+ launcher: z.ZodString;
30
+ version: z.ZodString;
31
+ policy: z.ZodString;
32
+ }, z.core.$strict>>;
33
+ }, z.core.$strict>, z.ZodObject<{
34
+ op: z.ZodLiteral<"ended">;
35
+ id: z.ZodString;
36
+ exit_code: z.ZodNullable<z.ZodNumber>;
37
+ exit_signal: z.ZodNullable<z.ZodString>;
38
+ stopped_by: z.ZodNullable<z.ZodEnum<{
39
+ abort: "abort";
40
+ timeout: "timeout";
41
+ stop: "stop";
42
+ }>>;
43
+ stop_failed: z.ZodBoolean;
44
+ stop_reason: z.ZodNullable<z.ZodString>;
45
+ ended_at: z.ZodString;
46
+ }, z.core.$strict>], "op">;
47
+ export type CommandRow = z.output<typeof CommandRowSchema>;
48
+ export type CommandStarted = Extract<CommandRow, {
49
+ op: 'started';
50
+ }>;
51
+ export type CommandEnded = Extract<CommandRow, {
52
+ op: 'ended';
53
+ }>;
54
+ export declare const commandRow: {
55
+ record: (value: {
56
+ op: "started";
57
+ id: string;
58
+ call_seq: number;
59
+ command: string;
60
+ cwd: string;
61
+ pgid: number;
62
+ started_at: string;
63
+ owner: string;
64
+ notify: "exit" | null;
65
+ launch: {
66
+ launcher: string;
67
+ version: string;
68
+ policy: string;
69
+ } | null;
70
+ } | {
71
+ op: "ended";
72
+ id: string;
73
+ exit_code: number | null;
74
+ exit_signal: string | null;
75
+ stopped_by: "abort" | "timeout" | "stop" | null;
76
+ stop_failed: boolean;
77
+ stop_reason: string | null;
78
+ ended_at: string;
79
+ }) => ExtensionRecord;
80
+ parse: (value: {
81
+ op: "started";
82
+ id: string;
83
+ call_seq: number;
84
+ command: string;
85
+ cwd: string;
86
+ pgid: number;
87
+ started_at: string;
88
+ owner: string;
89
+ notify: "exit" | null;
90
+ launch: {
91
+ launcher: string;
92
+ version: string;
93
+ policy: string;
94
+ } | null;
95
+ } | {
96
+ op: "ended";
97
+ id: string;
98
+ exit_code: number | null;
99
+ exit_signal: string | null;
100
+ stopped_by: "abort" | "timeout" | "stop" | null;
101
+ stop_failed: boolean;
102
+ stop_reason: string | null;
103
+ ended_at: string;
104
+ }) => {
105
+ op: "started";
106
+ id: string;
107
+ call_seq: number;
108
+ command: string;
109
+ cwd: string;
110
+ pgid: number;
111
+ started_at: string;
112
+ owner: string;
113
+ notify: "exit" | null;
114
+ launch: {
115
+ launcher: string;
116
+ version: string;
117
+ policy: string;
118
+ } | null;
119
+ } | {
120
+ op: "ended";
121
+ id: string;
122
+ exit_code: number | null;
123
+ exit_signal: string | null;
124
+ stopped_by: "abort" | "timeout" | "stop" | null;
125
+ stop_failed: boolean;
126
+ stop_reason: string | null;
127
+ ended_at: string;
128
+ };
129
+ entry: (value: {
130
+ op: "started";
131
+ id: string;
132
+ call_seq: number;
133
+ command: string;
134
+ cwd: string;
135
+ pgid: number;
136
+ started_at: string;
137
+ owner: string;
138
+ notify: "exit" | null;
139
+ launch: {
140
+ launcher: string;
141
+ version: string;
142
+ policy: string;
143
+ } | null;
144
+ } | {
145
+ op: "ended";
146
+ id: string;
147
+ exit_code: number | null;
148
+ exit_signal: string | null;
149
+ stopped_by: "abort" | "timeout" | "stop" | null;
150
+ stop_failed: boolean;
151
+ stop_reason: string | null;
152
+ ended_at: string;
153
+ }, options: import("../../journal/journal.js").AppendOptions) => {
154
+ type: "ext";
155
+ data: {
156
+ plugin: string;
157
+ instance_id: string;
158
+ kind: string;
159
+ version: number;
160
+ data: z.core.util.JSONType;
161
+ };
162
+ options: import("../../journal/journal.js").AppendOptions;
163
+ };
164
+ append(journal: import("../../journal/journal.js").PluginJournal, value: {
165
+ op: "started";
166
+ id: string;
167
+ call_seq: number;
168
+ command: string;
169
+ cwd: string;
170
+ pgid: number;
171
+ started_at: string;
172
+ owner: string;
173
+ notify: "exit" | null;
174
+ launch: {
175
+ launcher: string;
176
+ version: string;
177
+ policy: string;
178
+ } | null;
179
+ } | {
180
+ op: "ended";
181
+ id: string;
182
+ exit_code: number | null;
183
+ exit_signal: string | null;
184
+ stopped_by: "abort" | "timeout" | "stop" | null;
185
+ stop_failed: boolean;
186
+ stop_reason: string | null;
187
+ ended_at: string;
188
+ }, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../models/index.js").JournalEvent<"ext">>;
189
+ read(event: import("../../models/index.js").JournalEvent): {
190
+ op: "started";
191
+ id: string;
192
+ call_seq: number;
193
+ command: string;
194
+ cwd: string;
195
+ pgid: number;
196
+ started_at: string;
197
+ owner: string;
198
+ notify: "exit" | null;
199
+ launch: {
200
+ launcher: string;
201
+ version: string;
202
+ policy: string;
203
+ } | null;
204
+ } | {
205
+ op: "ended";
206
+ id: string;
207
+ exit_code: number | null;
208
+ exit_signal: string | null;
209
+ stopped_by: "abort" | "timeout" | "stop" | null;
210
+ stop_failed: boolean;
211
+ stop_reason: string | null;
212
+ ended_at: string;
213
+ } | undefined;
214
+ contribution(message: {
215
+ role?: import("../../models/index.js").InputRole;
216
+ content: string | readonly import("../../llm/content.js").ContentPartInput[];
217
+ }, value: {
218
+ op: "started";
219
+ id: string;
220
+ call_seq: number;
221
+ command: string;
222
+ cwd: string;
223
+ pgid: number;
224
+ started_at: string;
225
+ owner: string;
226
+ notify: "exit" | null;
227
+ launch: {
228
+ launcher: string;
229
+ version: string;
230
+ policy: string;
231
+ } | null;
232
+ } | {
233
+ op: "ended";
234
+ id: string;
235
+ exit_code: number | null;
236
+ exit_signal: string | null;
237
+ stopped_by: "abort" | "timeout" | "stop" | null;
238
+ stop_failed: boolean;
239
+ stop_reason: string | null;
240
+ ended_at: string;
241
+ }, options?: {
242
+ sourceSeqs?: readonly Seq[];
243
+ }): import("../../models/index.js").StepContribution;
244
+ matchesSource(record: DeepReadonly<ExtensionRecord>): boolean;
245
+ rejection(reason: string, value: {
246
+ op: "started";
247
+ id: string;
248
+ call_seq: number;
249
+ command: string;
250
+ cwd: string;
251
+ pgid: number;
252
+ started_at: string;
253
+ owner: string;
254
+ notify: "exit" | null;
255
+ launch: {
256
+ launcher: string;
257
+ version: string;
258
+ policy: string;
259
+ } | null;
260
+ } | {
261
+ op: "ended";
262
+ id: string;
263
+ exit_code: number | null;
264
+ exit_signal: string | null;
265
+ stopped_by: "abort" | "timeout" | "stop" | null;
266
+ stop_failed: boolean;
267
+ stop_reason: string | null;
268
+ ended_at: string;
269
+ }): {
270
+ decision: "reject";
271
+ reason: string;
272
+ source: ExtensionRecord;
273
+ };
274
+ readContribution: (event: import("../../models/index.js").JournalEvent) => {
275
+ op: "started";
276
+ id: string;
277
+ call_seq: number;
278
+ command: string;
279
+ cwd: string;
280
+ pgid: number;
281
+ started_at: string;
282
+ owner: string;
283
+ notify: "exit" | null;
284
+ launch: {
285
+ launcher: string;
286
+ version: string;
287
+ policy: string;
288
+ } | null;
289
+ } | {
290
+ op: "ended";
291
+ id: string;
292
+ exit_code: number | null;
293
+ exit_signal: string | null;
294
+ stopped_by: "abort" | "timeout" | "stop" | null;
295
+ stop_failed: boolean;
296
+ stop_reason: string | null;
297
+ ended_at: string;
298
+ } | undefined;
299
+ readSource: (source: DeepReadonly<ExtensionRecord> | null) => {
300
+ op: "started";
301
+ id: string;
302
+ call_seq: number;
303
+ command: string;
304
+ cwd: string;
305
+ pgid: number;
306
+ started_at: string;
307
+ owner: string;
308
+ notify: "exit" | null;
309
+ launch: {
310
+ launcher: string;
311
+ version: string;
312
+ policy: string;
313
+ } | null;
314
+ } | {
315
+ op: "ended";
316
+ id: string;
317
+ exit_code: number | null;
318
+ exit_signal: string | null;
319
+ stopped_by: "abort" | "timeout" | "stop" | null;
320
+ stop_failed: boolean;
321
+ stop_reason: string | null;
322
+ ended_at: string;
323
+ } | undefined;
324
+ told: import("../../journal/projection.js").PluginProjection<import("../../kit/extension.js").ToldNotices<{
325
+ op: "started";
326
+ id: string;
327
+ call_seq: number;
328
+ command: string;
329
+ cwd: string;
330
+ pgid: number;
331
+ started_at: string;
332
+ owner: string;
333
+ notify: "exit" | null;
334
+ launch: {
335
+ launcher: string;
336
+ version: string;
337
+ policy: string;
338
+ } | null;
339
+ } | {
340
+ op: "ended";
341
+ id: string;
342
+ exit_code: number | null;
343
+ exit_signal: string | null;
344
+ stopped_by: "abort" | "timeout" | "stop" | null;
345
+ stop_failed: boolean;
346
+ stop_reason: string | null;
347
+ ended_at: string;
348
+ }>>;
349
+ projection<State>(fold: {
350
+ key: string;
351
+ init(): State;
352
+ apply(state: State, value: {
353
+ op: "started";
354
+ id: string;
355
+ call_seq: number;
356
+ command: string;
357
+ cwd: string;
358
+ pgid: number;
359
+ started_at: string;
360
+ owner: string;
361
+ notify: "exit" | null;
362
+ launch: {
363
+ launcher: string;
364
+ version: string;
365
+ policy: string;
366
+ } | null;
367
+ } | {
368
+ op: "ended";
369
+ id: string;
370
+ exit_code: number | null;
371
+ exit_signal: string | null;
372
+ stopped_by: "abort" | "timeout" | "stop" | null;
373
+ stop_failed: boolean;
374
+ stop_reason: string | null;
375
+ ended_at: string;
376
+ }, event: import("../../models/index.js").JournalEvent<"ext">): State;
377
+ onFork?: "inherit" | "reset";
378
+ }): import("../../journal/projection.js").PluginProjection<State>;
379
+ };
380
+ /** One recorded command: how it started, and how it ended if the plugin saw it end. */
381
+ export type CommandRecord = {
382
+ readonly started: CommandStarted;
383
+ readonly ended: CommandEnded | null;
384
+ };
385
+ /**
386
+ * A thread's recorded commands, by id. Resets at a fork's spawn row: a command describes what its
387
+ * source's execution did, not the conversation a fork continues.
388
+ */
389
+ export declare const commandRecords: import("../../journal/projection.js").PluginProjection<Map<string, CommandRecord>>;
390
+ declare const CommandNoticeSchema: z.ZodObject<{
391
+ id: z.ZodString;
392
+ exit_code: z.ZodNullable<z.ZodNumber>;
393
+ exit_signal: z.ZodNullable<z.ZodString>;
394
+ summary: z.ZodString;
395
+ }, z.core.$strict>;
396
+ export type CommandNotice = z.output<typeof CommandNoticeSchema>;
397
+ /**
398
+ * The source of a command's exit notice: the input the commands plugin queues on the thread that
399
+ * started a command with `notify: "exit"` when it exits on its own. Its `summary` is one bounded
400
+ * line, such as `cmd-42 exited (exit code 0)`, for a host to show collapsed.
401
+ */
402
+ export declare const commandNotice: {
403
+ record: (value: {
404
+ id: string;
405
+ exit_code: number | null;
406
+ exit_signal: string | null;
407
+ summary: string;
408
+ }) => ExtensionRecord;
409
+ parse: (value: {
410
+ id: string;
411
+ exit_code: number | null;
412
+ exit_signal: string | null;
413
+ summary: string;
414
+ }) => {
415
+ id: string;
416
+ exit_code: number | null;
417
+ exit_signal: string | null;
418
+ summary: string;
419
+ };
420
+ entry: (value: {
421
+ id: string;
422
+ exit_code: number | null;
423
+ exit_signal: string | null;
424
+ summary: string;
425
+ }, options: import("../../journal/journal.js").AppendOptions) => {
426
+ type: "ext";
427
+ data: {
428
+ plugin: string;
429
+ instance_id: string;
430
+ kind: string;
431
+ version: number;
432
+ data: z.core.util.JSONType;
433
+ };
434
+ options: import("../../journal/journal.js").AppendOptions;
435
+ };
436
+ append(journal: import("../../journal/journal.js").PluginJournal, value: {
437
+ id: string;
438
+ exit_code: number | null;
439
+ exit_signal: string | null;
440
+ summary: string;
441
+ }, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../models/index.js").JournalEvent<"ext">>;
442
+ read(event: import("../../models/index.js").JournalEvent): {
443
+ id: string;
444
+ exit_code: number | null;
445
+ exit_signal: string | null;
446
+ summary: string;
447
+ } | undefined;
448
+ contribution(message: {
449
+ role?: import("../../models/index.js").InputRole;
450
+ content: string | readonly import("../../llm/content.js").ContentPartInput[];
451
+ }, value: {
452
+ id: string;
453
+ exit_code: number | null;
454
+ exit_signal: string | null;
455
+ summary: string;
456
+ }, options?: {
457
+ sourceSeqs?: readonly Seq[];
458
+ }): import("../../models/index.js").StepContribution;
459
+ matchesSource(record: DeepReadonly<ExtensionRecord>): boolean;
460
+ rejection(reason: string, value: {
461
+ id: string;
462
+ exit_code: number | null;
463
+ exit_signal: string | null;
464
+ summary: string;
465
+ }): {
466
+ decision: "reject";
467
+ reason: string;
468
+ source: ExtensionRecord;
469
+ };
470
+ readContribution: (event: import("../../models/index.js").JournalEvent) => {
471
+ id: string;
472
+ exit_code: number | null;
473
+ exit_signal: string | null;
474
+ summary: string;
475
+ } | undefined;
476
+ readSource: (source: DeepReadonly<ExtensionRecord> | null) => {
477
+ id: string;
478
+ exit_code: number | null;
479
+ exit_signal: string | null;
480
+ summary: string;
481
+ } | undefined;
482
+ told: import("../../journal/projection.js").PluginProjection<import("../../kit/extension.js").ToldNotices<{
483
+ id: string;
484
+ exit_code: number | null;
485
+ exit_signal: string | null;
486
+ summary: string;
487
+ }>>;
488
+ projection<State>(fold: {
489
+ key: string;
490
+ init(): State;
491
+ apply(state: State, value: {
492
+ id: string;
493
+ exit_code: number | null;
494
+ exit_signal: string | null;
495
+ summary: string;
496
+ }, event: import("../../models/index.js").JournalEvent<"ext">): State;
497
+ onFork?: "inherit" | "reset";
498
+ }): import("../../journal/projection.js").PluginProjection<State>;
499
+ };
500
+ /** What a command notice's source carries, when `source` is one; `undefined` for any other. For a host drawing the notice. */
501
+ export declare const readCommandNotice: (source: DeepReadonly<ExtensionRecord> | null) => CommandNotice | undefined;
502
+ /** The foreground command tool's name. */
503
+ export declare const RUN_COMMAND = "run_command";
504
+ /**
505
+ * How a `run_command` call's process group is known to have ended, from its rows alone, on
506
+ * affirmative evidence only: `not-run` while no dispatch attempt of it was allowed, so nothing was
507
+ * launched; once one was, `ended` only when its result carries the tool's own report that the stop
508
+ * succeeded (`stop_failed: false`), `stop-failed` when that report says the stop failed, and
509
+ * `unknown` otherwise: no result yet, a call cut off, or a result written by anything but the tool,
510
+ * such as an error that replaced its report.
511
+ */
512
+ export type ForegroundEnd = 'not-run' | 'ended' | 'stop-failed' | 'unknown';
513
+ /**
514
+ * A thread's `run_command` calls, by the seq of their `tool/call` row, with how each one's process
515
+ * group is known to have ended. A foreground command leaves no record of its own: its call, the
516
+ * dispatch attempt allowed before the tool runs, and its result are the evidence. Resets at a fork's
517
+ * spawn row, as the background records do.
518
+ */
519
+ export declare const foregroundCommands: import("../../journal/projection.js").PluginProjection<Map<number, ForegroundEnd>>;
520
+ /**
521
+ * A command a thread's rows leave without affirmative evidence of its end: a background one with no
522
+ * end row, or a `run_command` call launched with no report of its end from the tool itself; either
523
+ * kind with `stop_failed` when the stop it reported failed to end its process group.
524
+ */
525
+ declare const UnendedCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
526
+ kind: z.ZodLiteral<"background">;
527
+ id: z.ZodString;
528
+ stop_failed: z.ZodBoolean;
529
+ }, z.core.$strict>, z.ZodObject<{
530
+ kind: z.ZodLiteral<"foreground">;
531
+ call_seq: z.ZodNumber;
532
+ stop_failed: z.ZodBoolean;
533
+ }, z.core.$strict>], "kind">;
534
+ export type UnendedCommand = z.output<typeof UnendedCommandSchema>;
535
+ /**
536
+ * What a thread's catalog entry says of its commands: those without an established end, for every
537
+ * thread while the commands plugin is mounted. A thread whose records cannot be read reads
538
+ * `unavailable`, which nothing reads as "none".
539
+ */
540
+ export declare const commandsContribution: import("../../services/contributions.js").ContributionDefinition<({
541
+ kind: "background";
542
+ id: string;
543
+ stop_failed: boolean;
544
+ } | {
545
+ kind: "foreground";
546
+ call_seq: number;
547
+ stop_failed: boolean;
548
+ })[]>;
549
+ export {};