@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,2863 @@
1
+ import { z } from 'zod';
2
+ import type { ToolResult } from '../../models/index.js';
3
+ import { JsonValueSchema, type DeepReadonly } from '../../util/json.js';
4
+ import type { CanonicalDefinition, WorkflowDefinition } from './definition.js';
5
+ /**
6
+ * The constraint owner a workflow's root requires (`requires` in its creation): the root is held
7
+ * until this plugin is mounted and has repaired what a crash left, so nothing runs it without the
8
+ * workflow's authority, and no follow-up a crash missed is skipped.
9
+ */
10
+ export declare const WORKFLOWS_OWNER = "lagent:workflows";
11
+ /** Whether a thread was created as a workflow's root: what every reader of its instance checks first. */
12
+ export declare const requiresWorkflows: (summary: {
13
+ readonly requires: readonly string[];
14
+ }) => boolean;
15
+ /** The one protocol tool: its result, concluding the turn, is a candidate answer for an assignment. */
16
+ export declare const SUBMIT_TOOL = "submit_workflow_output";
17
+ /**
18
+ * What an input of an attempt was bound to at entry: the instance's input, one accepted result
19
+ * revision (one participant's output in it, or the whole result) with the decision it carried then,
20
+ * or evidence a provider acquired, whose value the entry records beside it. `null` in its place is
21
+ * an optional binding with nothing to bind.
22
+ */
23
+ declare const CitationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
24
+ kind: z.ZodLiteral<"input">;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ kind: z.ZodLiteral<"evidence">;
27
+ provider: z.ZodString;
28
+ immutable: z.ZodBoolean;
29
+ detail: z.ZodJSONSchema;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ kind: z.ZodLiteral<"result">;
32
+ result: z.ZodString;
33
+ participant: z.ZodNullable<z.ZodString>;
34
+ decision: z.ZodNullable<z.ZodString>;
35
+ mode: z.ZodEnum<{
36
+ current: "current";
37
+ historical: "historical";
38
+ }>;
39
+ }, z.core.$strict>], "kind">;
40
+ export type Citation = z.output<typeof CitationSchema>;
41
+ /** A citation as a public result hands it out: a copy, since the recorded one is the fold's. */
42
+ export declare const copyCitation: (citation: DeepReadonly<Citation> | null) => Citation | null;
43
+ /**
44
+ * What an instance runs on besides its definition, resolved and pinned at its opening: each
45
+ * participant's configuration, `null` for the conversation participant, which runs on the
46
+ * conversation's own, and complete for an isolated one (agent, route, environment and defining
47
+ * installations, exactly as its conversation is created on them); each check provider's pin, by
48
+ * the participant whose assignments list it; and each evidence provider's pin.
49
+ */
50
+ declare const PinsSchema: z.ZodObject<{
51
+ participants: z.ZodRecord<z.ZodString, z.ZodObject<{
52
+ configuration: z.ZodNullable<z.ZodObject<{
53
+ agent: z.ZodString;
54
+ route: z.ZodObject<{
55
+ provider: z.ZodString;
56
+ model: z.ZodString;
57
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
58
+ low: "low";
59
+ high: "high";
60
+ none: "none";
61
+ medium: "medium";
62
+ max: "max";
63
+ }>>;
64
+ }, z.core.$strip>;
65
+ environment: z.ZodObject<{
66
+ cwd: z.ZodString;
67
+ read_roots: z.ZodArray<z.ZodString>;
68
+ }, z.core.$strip>;
69
+ installations: z.ZodArray<z.ZodObject<{
70
+ installation_id: z.ZodString;
71
+ preset_id: z.ZodString;
72
+ config: z.ZodJSONSchema;
73
+ lifetime: z.ZodEnum<{
74
+ defining: "defining";
75
+ configurable: "configurable";
76
+ }>;
77
+ }, z.core.$strict>>;
78
+ }, z.core.$strict>>;
79
+ checks: z.ZodRecord<z.ZodString, z.ZodObject<{
80
+ config: z.ZodJSONSchema;
81
+ }, z.core.$strict>>;
82
+ }, z.core.$strict>>;
83
+ evidence: z.ZodRecord<z.ZodString, z.ZodObject<{
84
+ config: z.ZodJSONSchema;
85
+ }, z.core.$strict>>;
86
+ }, z.core.$strict>;
87
+ export type Pins = z.output<typeof PinsSchema>;
88
+ export type ParticipantPin = Pins['participants'][string];
89
+ /**
90
+ * One assignment an entry opens, by where it runs. The conversation participant's runs on the root
91
+ * and is activated by the claim of a root input: the host's first, or its transition's scheduling
92
+ * input. An isolated participant's runs as one delegation task on its child, on the participant
93
+ * generation it was pinned to; its activation is that task's input, whose id is the task's. What
94
+ * the entry records of it (child, lifetime, generation, checks) is its contract while it is open:
95
+ * an edit of the definition to those applies from the next entry.
96
+ */
97
+ declare const AssignmentEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
98
+ context: z.ZodLiteral<"conversation">;
99
+ id: z.ZodString;
100
+ participant: z.ZodString;
101
+ activation: z.ZodString;
102
+ }, z.core.$strict>, z.ZodObject<{
103
+ context: z.ZodLiteral<"isolated">;
104
+ id: z.ZodString;
105
+ participant: z.ZodString;
106
+ thread: z.ZodString;
107
+ task: z.ZodString;
108
+ generation: z.ZodNumber;
109
+ lifetime: z.ZodEnum<{
110
+ attempt: "attempt";
111
+ instance: "instance";
112
+ }>;
113
+ checks: z.ZodArray<z.ZodString>;
114
+ }, z.core.$strict>], "context">;
115
+ export type AssignmentEntry = z.output<typeof AssignmentEntrySchema>;
116
+ /**
117
+ * What an isolated participant's child shows of one task: it `accepted` a submission (the child's
118
+ * `tool/result` row) at a completed ending (its `turn/end` row), carrying the submitted output; or
119
+ * it `ended` without that, as delegations settled the task (failed, stopped, or completed with a
120
+ * reply that submitted nothing), with what delegations says of it, the task's latest submission,
121
+ * and its latest prose as a partial report, both unaccepted; or, beside a sibling that ended, it is
122
+ * still `unfinished`, with its latest submission and prose as of then, unaccepted too. Or the task
123
+ * was never opened: delegations `refused` its start for good, for this child as asked (a
124
+ * conversation it will not continue, say), which ends the assignment as an ending does.
125
+ */
126
+ declare const ObservedOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
127
+ kind: z.ZodLiteral<"accepted">;
128
+ submission: z.ZodNumber;
129
+ ending: z.ZodNumber;
130
+ output: z.ZodJSONSchema;
131
+ }, z.core.$strict>, z.ZodObject<{
132
+ kind: z.ZodLiteral<"ended">;
133
+ settlement: z.ZodEnum<{
134
+ completed: "completed";
135
+ failed: "failed";
136
+ stopped: "stopped";
137
+ }>;
138
+ detail: z.ZodString;
139
+ candidate: z.ZodNullable<z.ZodObject<{
140
+ submission: z.ZodNumber;
141
+ output: z.ZodJSONSchema;
142
+ }, z.core.$strict>>;
143
+ report: z.ZodNullable<z.ZodString>;
144
+ }, z.core.$strict>, z.ZodObject<{
145
+ kind: z.ZodLiteral<"refused">;
146
+ detail: z.ZodString;
147
+ }, z.core.$strict>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"unfinished">;
149
+ candidate: z.ZodNullable<z.ZodObject<{
150
+ submission: z.ZodNumber;
151
+ output: z.ZodJSONSchema;
152
+ }, z.core.$strict>>;
153
+ report: z.ZodNullable<z.ZodString>;
154
+ }, z.core.$strict>], "kind">;
155
+ export type ObservedOutcome = z.output<typeof ObservedOutcomeSchema>;
156
+ /** One task's facts as an observation carries them: the assignment, and the child, task and generation they are from. */
157
+ declare const ObservationSchema: z.ZodObject<{
158
+ assignment: z.ZodString;
159
+ thread: z.ZodString;
160
+ task: z.ZodString;
161
+ generation: z.ZodNumber;
162
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
163
+ kind: z.ZodLiteral<"accepted">;
164
+ submission: z.ZodNumber;
165
+ ending: z.ZodNumber;
166
+ output: z.ZodJSONSchema;
167
+ }, z.core.$strict>, z.ZodObject<{
168
+ kind: z.ZodLiteral<"ended">;
169
+ settlement: z.ZodEnum<{
170
+ completed: "completed";
171
+ failed: "failed";
172
+ stopped: "stopped";
173
+ }>;
174
+ detail: z.ZodString;
175
+ candidate: z.ZodNullable<z.ZodObject<{
176
+ submission: z.ZodNumber;
177
+ output: z.ZodJSONSchema;
178
+ }, z.core.$strict>>;
179
+ report: z.ZodNullable<z.ZodString>;
180
+ }, z.core.$strict>, z.ZodObject<{
181
+ kind: z.ZodLiteral<"refused">;
182
+ detail: z.ZodString;
183
+ }, z.core.$strict>, z.ZodObject<{
184
+ kind: z.ZodLiteral<"unfinished">;
185
+ candidate: z.ZodNullable<z.ZodObject<{
186
+ submission: z.ZodNumber;
187
+ output: z.ZodJSONSchema;
188
+ }, z.core.$strict>>;
189
+ report: z.ZodNullable<z.ZodString>;
190
+ }, z.core.$strict>], "kind">;
191
+ }, z.core.$strict>;
192
+ export type Observation = z.output<typeof ObservationSchema>;
193
+ /** What made a transition: the opening, an accepted result routed automatically, or a host decision. */
194
+ declare const CauseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
195
+ kind: z.ZodLiteral<"opening">;
196
+ }, z.core.$strict>, z.ZodObject<{
197
+ kind: z.ZodLiteral<"routed">;
198
+ result: z.ZodString;
199
+ }, z.core.$strict>, z.ZodObject<{
200
+ kind: z.ZodLiteral<"decision">;
201
+ decision: z.ZodString;
202
+ }, z.core.$strict>], "kind">;
203
+ export type TransitionCause = z.output<typeof CauseSchema>;
204
+ /**
205
+ * What the journal keeps of a workflow instance, on its root thread, as `ext` rows of this plugin.
206
+ * Everything else is derived from these and core's rows: activation from the claim of an
207
+ * assignment's activation input, acceptance from the turn ending that accepts its submission,
208
+ * results, staleness, counts, routing and pending decisions from all of them. No row records a
209
+ * pending decision or an acceptance.
210
+ *
211
+ * - `opened` rides in the root's creation write: the definition's id, its readable canonical copy
212
+ * as started, for audit and display only (execution always takes the definition registered under
213
+ * the id now), the instance's input, the host's first input id and the pins of what it runs on.
214
+ * - `entered` opens an attempt, atomically: what it retires, every input bound with its citation,
215
+ * the value of each evidence input, and its assignments, each with where it runs and what
216
+ * activates it. One row, so a failed entry writes nothing.
217
+ * - `observed` brings isolated participants' facts to the root, whose fold cannot read their
218
+ * children's rows: a task accepted a submission at a completed ending, or settled without one,
219
+ * or its start was refused for good, and, beside one that ended, what each unfinished sibling
220
+ * shows then. Evidence carried across,
221
+ * recomputed from the retained children inside the root's write, never an acceptance of its own;
222
+ * one acceptance or ending per task. One row per write, so a recovery opened by it sees all of it.
223
+ * - `stopped` is a person's Stop of the instance's current attempt, written in the root's cancel
224
+ * write beside delegations' stop of its tasks: the attempt and what each open isolated
225
+ * assignment's child showed inside that write, recomputed from the retained child. An acceptance
226
+ * it carries happened before the Stop and stands; any other open isolated assignment is
227
+ * superseded and the attempt recovers (cause `stop`), the root's own assignment with it. Its row is
228
+ * the Stop's boundary: a transition owed by a result ready before it, entering isolated work after
229
+ * it, recovers at its entry.
230
+ * - `completed` ends the instance through a `$complete` edge.
231
+ * - `decided` records a host decision on a pending gate, exhaustion or recovery, with the persistent
232
+ * participants it restarts; it shares its write with the transition it selects.
233
+ * - `cancel-requested` admits a cancellation, closing assignment authority; `cancelled` is its
234
+ * terminal row, written once cleanup is established.
235
+ */
236
+ declare const InstanceRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
237
+ op: z.ZodLiteral<"opened">;
238
+ definition: z.ZodString;
239
+ canonical: z.ZodType<CanonicalDefinition>;
240
+ input: z.ZodJSONSchema;
241
+ input_id: z.ZodString;
242
+ pins: z.ZodObject<{
243
+ participants: z.ZodRecord<z.ZodString, z.ZodObject<{
244
+ configuration: z.ZodNullable<z.ZodObject<{
245
+ agent: z.ZodString;
246
+ route: z.ZodObject<{
247
+ provider: z.ZodString;
248
+ model: z.ZodString;
249
+ thinking_effort: z.ZodNullable<z.ZodEnum<{
250
+ low: "low";
251
+ high: "high";
252
+ none: "none";
253
+ medium: "medium";
254
+ max: "max";
255
+ }>>;
256
+ }, z.core.$strip>;
257
+ environment: z.ZodObject<{
258
+ cwd: z.ZodString;
259
+ read_roots: z.ZodArray<z.ZodString>;
260
+ }, z.core.$strip>;
261
+ installations: z.ZodArray<z.ZodObject<{
262
+ installation_id: z.ZodString;
263
+ preset_id: z.ZodString;
264
+ config: z.ZodJSONSchema;
265
+ lifetime: z.ZodEnum<{
266
+ defining: "defining";
267
+ configurable: "configurable";
268
+ }>;
269
+ }, z.core.$strict>>;
270
+ }, z.core.$strict>>;
271
+ checks: z.ZodRecord<z.ZodString, z.ZodObject<{
272
+ config: z.ZodJSONSchema;
273
+ }, z.core.$strict>>;
274
+ }, z.core.$strict>>;
275
+ evidence: z.ZodRecord<z.ZodString, z.ZodObject<{
276
+ config: z.ZodJSONSchema;
277
+ }, z.core.$strict>>;
278
+ }, z.core.$strict>;
279
+ }, z.core.$strict>, z.ZodObject<{
280
+ op: z.ZodLiteral<"entered">;
281
+ transition: z.ZodString;
282
+ cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
283
+ kind: z.ZodLiteral<"opening">;
284
+ }, z.core.$strict>, z.ZodObject<{
285
+ kind: z.ZodLiteral<"routed">;
286
+ result: z.ZodString;
287
+ }, z.core.$strict>, z.ZodObject<{
288
+ kind: z.ZodLiteral<"decision">;
289
+ decision: z.ZodString;
290
+ }, z.core.$strict>], "kind">;
291
+ step: z.ZodString;
292
+ attempt: z.ZodString;
293
+ ordinal: z.ZodNumber;
294
+ retires: z.ZodArray<z.ZodString>;
295
+ inputs: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
296
+ kind: z.ZodLiteral<"input">;
297
+ }, z.core.$strict>, z.ZodObject<{
298
+ kind: z.ZodLiteral<"evidence">;
299
+ provider: z.ZodString;
300
+ immutable: z.ZodBoolean;
301
+ detail: z.ZodJSONSchema;
302
+ }, z.core.$strict>, z.ZodObject<{
303
+ kind: z.ZodLiteral<"result">;
304
+ result: z.ZodString;
305
+ participant: z.ZodNullable<z.ZodString>;
306
+ decision: z.ZodNullable<z.ZodString>;
307
+ mode: z.ZodEnum<{
308
+ current: "current";
309
+ historical: "historical";
310
+ }>;
311
+ }, z.core.$strict>], "kind">>>;
312
+ evidence: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
313
+ assignments: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
314
+ context: z.ZodLiteral<"conversation">;
315
+ id: z.ZodString;
316
+ participant: z.ZodString;
317
+ activation: z.ZodString;
318
+ }, z.core.$strict>, z.ZodObject<{
319
+ context: z.ZodLiteral<"isolated">;
320
+ id: z.ZodString;
321
+ participant: z.ZodString;
322
+ thread: z.ZodString;
323
+ task: z.ZodString;
324
+ generation: z.ZodNumber;
325
+ lifetime: z.ZodEnum<{
326
+ attempt: "attempt";
327
+ instance: "instance";
328
+ }>;
329
+ checks: z.ZodArray<z.ZodString>;
330
+ }, z.core.$strict>], "context">>;
331
+ }, z.core.$strict>, z.ZodObject<{
332
+ op: z.ZodLiteral<"observed">;
333
+ observations: z.ZodArray<z.ZodObject<{
334
+ assignment: z.ZodString;
335
+ thread: z.ZodString;
336
+ task: z.ZodString;
337
+ generation: z.ZodNumber;
338
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
339
+ kind: z.ZodLiteral<"accepted">;
340
+ submission: z.ZodNumber;
341
+ ending: z.ZodNumber;
342
+ output: z.ZodJSONSchema;
343
+ }, z.core.$strict>, z.ZodObject<{
344
+ kind: z.ZodLiteral<"ended">;
345
+ settlement: z.ZodEnum<{
346
+ completed: "completed";
347
+ failed: "failed";
348
+ stopped: "stopped";
349
+ }>;
350
+ detail: z.ZodString;
351
+ candidate: z.ZodNullable<z.ZodObject<{
352
+ submission: z.ZodNumber;
353
+ output: z.ZodJSONSchema;
354
+ }, z.core.$strict>>;
355
+ report: z.ZodNullable<z.ZodString>;
356
+ }, z.core.$strict>, z.ZodObject<{
357
+ kind: z.ZodLiteral<"refused">;
358
+ detail: z.ZodString;
359
+ }, z.core.$strict>, z.ZodObject<{
360
+ kind: z.ZodLiteral<"unfinished">;
361
+ candidate: z.ZodNullable<z.ZodObject<{
362
+ submission: z.ZodNumber;
363
+ output: z.ZodJSONSchema;
364
+ }, z.core.$strict>>;
365
+ report: z.ZodNullable<z.ZodString>;
366
+ }, z.core.$strict>], "kind">;
367
+ }, z.core.$strict>>;
368
+ }, z.core.$strict>, z.ZodObject<{
369
+ op: z.ZodLiteral<"stopped">;
370
+ attempt: z.ZodString;
371
+ reason: z.ZodString;
372
+ observations: z.ZodArray<z.ZodObject<{
373
+ assignment: z.ZodString;
374
+ thread: z.ZodString;
375
+ task: z.ZodString;
376
+ generation: z.ZodNumber;
377
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
378
+ kind: z.ZodLiteral<"accepted">;
379
+ submission: z.ZodNumber;
380
+ ending: z.ZodNumber;
381
+ output: z.ZodJSONSchema;
382
+ }, z.core.$strict>, z.ZodObject<{
383
+ kind: z.ZodLiteral<"ended">;
384
+ settlement: z.ZodEnum<{
385
+ completed: "completed";
386
+ failed: "failed";
387
+ stopped: "stopped";
388
+ }>;
389
+ detail: z.ZodString;
390
+ candidate: z.ZodNullable<z.ZodObject<{
391
+ submission: z.ZodNumber;
392
+ output: z.ZodJSONSchema;
393
+ }, z.core.$strict>>;
394
+ report: z.ZodNullable<z.ZodString>;
395
+ }, z.core.$strict>, z.ZodObject<{
396
+ kind: z.ZodLiteral<"refused">;
397
+ detail: z.ZodString;
398
+ }, z.core.$strict>, z.ZodObject<{
399
+ kind: z.ZodLiteral<"unfinished">;
400
+ candidate: z.ZodNullable<z.ZodObject<{
401
+ submission: z.ZodNumber;
402
+ output: z.ZodJSONSchema;
403
+ }, z.core.$strict>>;
404
+ report: z.ZodNullable<z.ZodString>;
405
+ }, z.core.$strict>], "kind">;
406
+ }, z.core.$strict>>;
407
+ }, z.core.$strict>, z.ZodObject<{
408
+ op: z.ZodLiteral<"completed">;
409
+ transition: z.ZodString;
410
+ cause: z.ZodDiscriminatedUnion<[z.ZodObject<{
411
+ kind: z.ZodLiteral<"opening">;
412
+ }, z.core.$strict>, z.ZodObject<{
413
+ kind: z.ZodLiteral<"routed">;
414
+ result: z.ZodString;
415
+ }, z.core.$strict>, z.ZodObject<{
416
+ kind: z.ZodLiteral<"decision">;
417
+ decision: z.ZodString;
418
+ }, z.core.$strict>], "kind">;
419
+ }, z.core.$strict>, z.ZodObject<{
420
+ op: z.ZodLiteral<"decided">;
421
+ decision: z.ZodString;
422
+ operation_id: z.ZodString;
423
+ actor: z.ZodString;
424
+ attempt: z.ZodString;
425
+ reason: z.ZodEnum<{
426
+ gate: "gate";
427
+ exhaustion: "exhaustion";
428
+ recovery: "recovery";
429
+ }>;
430
+ result: z.ZodNullable<z.ZodString>;
431
+ verdict: z.ZodEnum<{
432
+ approve: "approve";
433
+ revise: "revise";
434
+ }>;
435
+ option: z.ZodNullable<z.ZodString>;
436
+ feedback: z.ZodNullable<z.ZodString>;
437
+ restart: z.ZodArray<z.ZodString>;
438
+ }, z.core.$strict>, z.ZodObject<{
439
+ op: z.ZodLiteral<"cancel-requested">;
440
+ operation_id: z.ZodString;
441
+ actor: z.ZodString;
442
+ reason: z.ZodString;
443
+ }, z.core.$strict>, z.ZodObject<{
444
+ op: z.ZodLiteral<"cancelled">;
445
+ operation_id: z.ZodString;
446
+ }, z.core.$strict>], "op">;
447
+ export type InstanceRow = z.output<typeof InstanceRowSchema>;
448
+ export type InstanceRowInput = z.input<typeof InstanceRowSchema>;
449
+ export type Opened = Extract<InstanceRow, {
450
+ op: 'opened';
451
+ }>;
452
+ export type Entered = Extract<InstanceRow, {
453
+ op: 'entered';
454
+ }>;
455
+ export type Decided = Extract<InstanceRow, {
456
+ op: 'decided';
457
+ }>;
458
+ /**
459
+ * Declared policy state: entering, observing, stopping, deciding, completing and cancelling change
460
+ * what a thread's workflow authority allows, so one landing while a call is authorized, on the root
461
+ * or on a thread under it, decides that call again.
462
+ */
463
+ export declare const instanceRow: {
464
+ record: (value: {
465
+ op: "decided";
466
+ decision: string;
467
+ operation_id: string;
468
+ actor: string;
469
+ attempt: string;
470
+ reason: "gate" | "exhaustion" | "recovery";
471
+ result: string | null;
472
+ verdict: "approve" | "revise";
473
+ option: string | null;
474
+ feedback: string | null;
475
+ restart: string[];
476
+ } | {
477
+ op: "opened";
478
+ definition: string;
479
+ canonical: unknown;
480
+ input: z.core.util.JSONType;
481
+ input_id: string;
482
+ pins: {
483
+ participants: Record<string, {
484
+ configuration: {
485
+ agent: string;
486
+ route: {
487
+ provider: string;
488
+ model: string;
489
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
490
+ };
491
+ environment: {
492
+ cwd: string;
493
+ read_roots: string[];
494
+ };
495
+ installations: {
496
+ installation_id: string;
497
+ preset_id: string;
498
+ config: z.core.util.JSONType;
499
+ lifetime: "defining" | "configurable";
500
+ }[];
501
+ } | null;
502
+ checks: Record<string, {
503
+ config: z.core.util.JSONType;
504
+ }>;
505
+ }>;
506
+ evidence: Record<string, {
507
+ config: z.core.util.JSONType;
508
+ }>;
509
+ };
510
+ } | {
511
+ op: "entered";
512
+ transition: string;
513
+ cause: {
514
+ kind: "opening";
515
+ } | {
516
+ kind: "routed";
517
+ result: string;
518
+ } | {
519
+ kind: "decision";
520
+ decision: string;
521
+ };
522
+ step: string;
523
+ attempt: string;
524
+ ordinal: number;
525
+ retires: string[];
526
+ inputs: Record<string, {
527
+ kind: "input";
528
+ } | {
529
+ kind: "evidence";
530
+ provider: string;
531
+ immutable: boolean;
532
+ detail: z.core.util.JSONType;
533
+ } | {
534
+ kind: "result";
535
+ result: string;
536
+ participant: string | null;
537
+ decision: string | null;
538
+ mode: "current" | "historical";
539
+ } | null>;
540
+ evidence: Record<string, z.core.util.JSONType>;
541
+ assignments: ({
542
+ context: "conversation";
543
+ id: string;
544
+ participant: string;
545
+ activation: string;
546
+ } | {
547
+ context: "isolated";
548
+ id: string;
549
+ participant: string;
550
+ thread: string;
551
+ task: string;
552
+ generation: number;
553
+ lifetime: "attempt" | "instance";
554
+ checks: string[];
555
+ })[];
556
+ } | {
557
+ op: "observed";
558
+ observations: {
559
+ assignment: string;
560
+ thread: string;
561
+ task: string;
562
+ generation: number;
563
+ outcome: {
564
+ kind: "accepted";
565
+ submission: number;
566
+ ending: number;
567
+ output: z.core.util.JSONType;
568
+ } | {
569
+ kind: "ended";
570
+ settlement: "completed" | "failed" | "stopped";
571
+ detail: string;
572
+ candidate: {
573
+ submission: number;
574
+ output: z.core.util.JSONType;
575
+ } | null;
576
+ report: string | null;
577
+ } | {
578
+ kind: "refused";
579
+ detail: string;
580
+ } | {
581
+ kind: "unfinished";
582
+ candidate: {
583
+ submission: number;
584
+ output: z.core.util.JSONType;
585
+ } | null;
586
+ report: string | null;
587
+ };
588
+ }[];
589
+ } | {
590
+ op: "stopped";
591
+ attempt: string;
592
+ reason: string;
593
+ observations: {
594
+ assignment: string;
595
+ thread: string;
596
+ task: string;
597
+ generation: number;
598
+ outcome: {
599
+ kind: "accepted";
600
+ submission: number;
601
+ ending: number;
602
+ output: z.core.util.JSONType;
603
+ } | {
604
+ kind: "ended";
605
+ settlement: "completed" | "failed" | "stopped";
606
+ detail: string;
607
+ candidate: {
608
+ submission: number;
609
+ output: z.core.util.JSONType;
610
+ } | null;
611
+ report: string | null;
612
+ } | {
613
+ kind: "refused";
614
+ detail: string;
615
+ } | {
616
+ kind: "unfinished";
617
+ candidate: {
618
+ submission: number;
619
+ output: z.core.util.JSONType;
620
+ } | null;
621
+ report: string | null;
622
+ };
623
+ }[];
624
+ } | {
625
+ op: "completed";
626
+ transition: string;
627
+ cause: {
628
+ kind: "opening";
629
+ } | {
630
+ kind: "routed";
631
+ result: string;
632
+ } | {
633
+ kind: "decision";
634
+ decision: string;
635
+ };
636
+ } | {
637
+ op: "cancel-requested";
638
+ operation_id: string;
639
+ actor: string;
640
+ reason: string;
641
+ } | {
642
+ op: "cancelled";
643
+ operation_id: string;
644
+ }) => import("../../models/index.js").ExtensionRecord;
645
+ parse: (value: {
646
+ op: "decided";
647
+ decision: string;
648
+ operation_id: string;
649
+ actor: string;
650
+ attempt: string;
651
+ reason: "gate" | "exhaustion" | "recovery";
652
+ result: string | null;
653
+ verdict: "approve" | "revise";
654
+ option: string | null;
655
+ feedback: string | null;
656
+ restart: string[];
657
+ } | {
658
+ op: "opened";
659
+ definition: string;
660
+ canonical: unknown;
661
+ input: z.core.util.JSONType;
662
+ input_id: string;
663
+ pins: {
664
+ participants: Record<string, {
665
+ configuration: {
666
+ agent: string;
667
+ route: {
668
+ provider: string;
669
+ model: string;
670
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
671
+ };
672
+ environment: {
673
+ cwd: string;
674
+ read_roots: string[];
675
+ };
676
+ installations: {
677
+ installation_id: string;
678
+ preset_id: string;
679
+ config: z.core.util.JSONType;
680
+ lifetime: "defining" | "configurable";
681
+ }[];
682
+ } | null;
683
+ checks: Record<string, {
684
+ config: z.core.util.JSONType;
685
+ }>;
686
+ }>;
687
+ evidence: Record<string, {
688
+ config: z.core.util.JSONType;
689
+ }>;
690
+ };
691
+ } | {
692
+ op: "entered";
693
+ transition: string;
694
+ cause: {
695
+ kind: "opening";
696
+ } | {
697
+ kind: "routed";
698
+ result: string;
699
+ } | {
700
+ kind: "decision";
701
+ decision: string;
702
+ };
703
+ step: string;
704
+ attempt: string;
705
+ ordinal: number;
706
+ retires: string[];
707
+ inputs: Record<string, {
708
+ kind: "input";
709
+ } | {
710
+ kind: "evidence";
711
+ provider: string;
712
+ immutable: boolean;
713
+ detail: z.core.util.JSONType;
714
+ } | {
715
+ kind: "result";
716
+ result: string;
717
+ participant: string | null;
718
+ decision: string | null;
719
+ mode: "current" | "historical";
720
+ } | null>;
721
+ evidence: Record<string, z.core.util.JSONType>;
722
+ assignments: ({
723
+ context: "conversation";
724
+ id: string;
725
+ participant: string;
726
+ activation: string;
727
+ } | {
728
+ context: "isolated";
729
+ id: string;
730
+ participant: string;
731
+ thread: string;
732
+ task: string;
733
+ generation: number;
734
+ lifetime: "attempt" | "instance";
735
+ checks: string[];
736
+ })[];
737
+ } | {
738
+ op: "observed";
739
+ observations: {
740
+ assignment: string;
741
+ thread: string;
742
+ task: string;
743
+ generation: number;
744
+ outcome: {
745
+ kind: "accepted";
746
+ submission: number;
747
+ ending: number;
748
+ output: z.core.util.JSONType;
749
+ } | {
750
+ kind: "ended";
751
+ settlement: "completed" | "failed" | "stopped";
752
+ detail: string;
753
+ candidate: {
754
+ submission: number;
755
+ output: z.core.util.JSONType;
756
+ } | null;
757
+ report: string | null;
758
+ } | {
759
+ kind: "refused";
760
+ detail: string;
761
+ } | {
762
+ kind: "unfinished";
763
+ candidate: {
764
+ submission: number;
765
+ output: z.core.util.JSONType;
766
+ } | null;
767
+ report: string | null;
768
+ };
769
+ }[];
770
+ } | {
771
+ op: "stopped";
772
+ attempt: string;
773
+ reason: string;
774
+ observations: {
775
+ assignment: string;
776
+ thread: string;
777
+ task: string;
778
+ generation: number;
779
+ outcome: {
780
+ kind: "accepted";
781
+ submission: number;
782
+ ending: number;
783
+ output: z.core.util.JSONType;
784
+ } | {
785
+ kind: "ended";
786
+ settlement: "completed" | "failed" | "stopped";
787
+ detail: string;
788
+ candidate: {
789
+ submission: number;
790
+ output: z.core.util.JSONType;
791
+ } | null;
792
+ report: string | null;
793
+ } | {
794
+ kind: "refused";
795
+ detail: string;
796
+ } | {
797
+ kind: "unfinished";
798
+ candidate: {
799
+ submission: number;
800
+ output: z.core.util.JSONType;
801
+ } | null;
802
+ report: string | null;
803
+ };
804
+ }[];
805
+ } | {
806
+ op: "completed";
807
+ transition: string;
808
+ cause: {
809
+ kind: "opening";
810
+ } | {
811
+ kind: "routed";
812
+ result: string;
813
+ } | {
814
+ kind: "decision";
815
+ decision: string;
816
+ };
817
+ } | {
818
+ op: "cancel-requested";
819
+ operation_id: string;
820
+ actor: string;
821
+ reason: string;
822
+ } | {
823
+ op: "cancelled";
824
+ operation_id: string;
825
+ }) => {
826
+ op: "decided";
827
+ decision: string;
828
+ operation_id: string;
829
+ actor: string;
830
+ attempt: string;
831
+ reason: "gate" | "exhaustion" | "recovery";
832
+ result: string | null;
833
+ verdict: "approve" | "revise";
834
+ option: string | null;
835
+ feedback: string | null;
836
+ restart: string[];
837
+ } | {
838
+ op: "opened";
839
+ definition: string;
840
+ canonical: CanonicalDefinition;
841
+ input: z.core.util.JSONType;
842
+ input_id: string;
843
+ pins: {
844
+ participants: Record<string, {
845
+ configuration: {
846
+ agent: string;
847
+ route: {
848
+ provider: string;
849
+ model: string;
850
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
851
+ };
852
+ environment: {
853
+ cwd: string;
854
+ read_roots: string[];
855
+ };
856
+ installations: {
857
+ installation_id: string;
858
+ preset_id: string;
859
+ config: z.core.util.JSONType;
860
+ lifetime: "defining" | "configurable";
861
+ }[];
862
+ } | null;
863
+ checks: Record<string, {
864
+ config: z.core.util.JSONType;
865
+ }>;
866
+ }>;
867
+ evidence: Record<string, {
868
+ config: z.core.util.JSONType;
869
+ }>;
870
+ };
871
+ } | {
872
+ op: "entered";
873
+ transition: string;
874
+ cause: {
875
+ kind: "opening";
876
+ } | {
877
+ kind: "routed";
878
+ result: string;
879
+ } | {
880
+ kind: "decision";
881
+ decision: string;
882
+ };
883
+ step: string;
884
+ attempt: string;
885
+ ordinal: number;
886
+ retires: string[];
887
+ inputs: Record<string, {
888
+ kind: "input";
889
+ } | {
890
+ kind: "evidence";
891
+ provider: string;
892
+ immutable: boolean;
893
+ detail: z.core.util.JSONType;
894
+ } | {
895
+ kind: "result";
896
+ result: string;
897
+ participant: string | null;
898
+ decision: string | null;
899
+ mode: "current" | "historical";
900
+ } | null>;
901
+ evidence: Record<string, z.core.util.JSONType>;
902
+ assignments: ({
903
+ context: "conversation";
904
+ id: string;
905
+ participant: string;
906
+ activation: string;
907
+ } | {
908
+ context: "isolated";
909
+ id: string;
910
+ participant: string;
911
+ thread: string;
912
+ task: string;
913
+ generation: number;
914
+ lifetime: "attempt" | "instance";
915
+ checks: string[];
916
+ })[];
917
+ } | {
918
+ op: "observed";
919
+ observations: {
920
+ assignment: string;
921
+ thread: string;
922
+ task: string;
923
+ generation: number;
924
+ outcome: {
925
+ kind: "accepted";
926
+ submission: number;
927
+ ending: number;
928
+ output: z.core.util.JSONType;
929
+ } | {
930
+ kind: "ended";
931
+ settlement: "completed" | "failed" | "stopped";
932
+ detail: string;
933
+ candidate: {
934
+ submission: number;
935
+ output: z.core.util.JSONType;
936
+ } | null;
937
+ report: string | null;
938
+ } | {
939
+ kind: "refused";
940
+ detail: string;
941
+ } | {
942
+ kind: "unfinished";
943
+ candidate: {
944
+ submission: number;
945
+ output: z.core.util.JSONType;
946
+ } | null;
947
+ report: string | null;
948
+ };
949
+ }[];
950
+ } | {
951
+ op: "stopped";
952
+ attempt: string;
953
+ reason: string;
954
+ observations: {
955
+ assignment: string;
956
+ thread: string;
957
+ task: string;
958
+ generation: number;
959
+ outcome: {
960
+ kind: "accepted";
961
+ submission: number;
962
+ ending: number;
963
+ output: z.core.util.JSONType;
964
+ } | {
965
+ kind: "ended";
966
+ settlement: "completed" | "failed" | "stopped";
967
+ detail: string;
968
+ candidate: {
969
+ submission: number;
970
+ output: z.core.util.JSONType;
971
+ } | null;
972
+ report: string | null;
973
+ } | {
974
+ kind: "refused";
975
+ detail: string;
976
+ } | {
977
+ kind: "unfinished";
978
+ candidate: {
979
+ submission: number;
980
+ output: z.core.util.JSONType;
981
+ } | null;
982
+ report: string | null;
983
+ };
984
+ }[];
985
+ } | {
986
+ op: "completed";
987
+ transition: string;
988
+ cause: {
989
+ kind: "opening";
990
+ } | {
991
+ kind: "routed";
992
+ result: string;
993
+ } | {
994
+ kind: "decision";
995
+ decision: string;
996
+ };
997
+ } | {
998
+ op: "cancel-requested";
999
+ operation_id: string;
1000
+ actor: string;
1001
+ reason: string;
1002
+ } | {
1003
+ op: "cancelled";
1004
+ operation_id: string;
1005
+ };
1006
+ entry: (value: {
1007
+ op: "decided";
1008
+ decision: string;
1009
+ operation_id: string;
1010
+ actor: string;
1011
+ attempt: string;
1012
+ reason: "gate" | "exhaustion" | "recovery";
1013
+ result: string | null;
1014
+ verdict: "approve" | "revise";
1015
+ option: string | null;
1016
+ feedback: string | null;
1017
+ restart: string[];
1018
+ } | {
1019
+ op: "opened";
1020
+ definition: string;
1021
+ canonical: unknown;
1022
+ input: z.core.util.JSONType;
1023
+ input_id: string;
1024
+ pins: {
1025
+ participants: Record<string, {
1026
+ configuration: {
1027
+ agent: string;
1028
+ route: {
1029
+ provider: string;
1030
+ model: string;
1031
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
1032
+ };
1033
+ environment: {
1034
+ cwd: string;
1035
+ read_roots: string[];
1036
+ };
1037
+ installations: {
1038
+ installation_id: string;
1039
+ preset_id: string;
1040
+ config: z.core.util.JSONType;
1041
+ lifetime: "defining" | "configurable";
1042
+ }[];
1043
+ } | null;
1044
+ checks: Record<string, {
1045
+ config: z.core.util.JSONType;
1046
+ }>;
1047
+ }>;
1048
+ evidence: Record<string, {
1049
+ config: z.core.util.JSONType;
1050
+ }>;
1051
+ };
1052
+ } | {
1053
+ op: "entered";
1054
+ transition: string;
1055
+ cause: {
1056
+ kind: "opening";
1057
+ } | {
1058
+ kind: "routed";
1059
+ result: string;
1060
+ } | {
1061
+ kind: "decision";
1062
+ decision: string;
1063
+ };
1064
+ step: string;
1065
+ attempt: string;
1066
+ ordinal: number;
1067
+ retires: string[];
1068
+ inputs: Record<string, {
1069
+ kind: "input";
1070
+ } | {
1071
+ kind: "evidence";
1072
+ provider: string;
1073
+ immutable: boolean;
1074
+ detail: z.core.util.JSONType;
1075
+ } | {
1076
+ kind: "result";
1077
+ result: string;
1078
+ participant: string | null;
1079
+ decision: string | null;
1080
+ mode: "current" | "historical";
1081
+ } | null>;
1082
+ evidence: Record<string, z.core.util.JSONType>;
1083
+ assignments: ({
1084
+ context: "conversation";
1085
+ id: string;
1086
+ participant: string;
1087
+ activation: string;
1088
+ } | {
1089
+ context: "isolated";
1090
+ id: string;
1091
+ participant: string;
1092
+ thread: string;
1093
+ task: string;
1094
+ generation: number;
1095
+ lifetime: "attempt" | "instance";
1096
+ checks: string[];
1097
+ })[];
1098
+ } | {
1099
+ op: "observed";
1100
+ observations: {
1101
+ assignment: string;
1102
+ thread: string;
1103
+ task: string;
1104
+ generation: number;
1105
+ outcome: {
1106
+ kind: "accepted";
1107
+ submission: number;
1108
+ ending: number;
1109
+ output: z.core.util.JSONType;
1110
+ } | {
1111
+ kind: "ended";
1112
+ settlement: "completed" | "failed" | "stopped";
1113
+ detail: string;
1114
+ candidate: {
1115
+ submission: number;
1116
+ output: z.core.util.JSONType;
1117
+ } | null;
1118
+ report: string | null;
1119
+ } | {
1120
+ kind: "refused";
1121
+ detail: string;
1122
+ } | {
1123
+ kind: "unfinished";
1124
+ candidate: {
1125
+ submission: number;
1126
+ output: z.core.util.JSONType;
1127
+ } | null;
1128
+ report: string | null;
1129
+ };
1130
+ }[];
1131
+ } | {
1132
+ op: "stopped";
1133
+ attempt: string;
1134
+ reason: string;
1135
+ observations: {
1136
+ assignment: string;
1137
+ thread: string;
1138
+ task: string;
1139
+ generation: number;
1140
+ outcome: {
1141
+ kind: "accepted";
1142
+ submission: number;
1143
+ ending: number;
1144
+ output: z.core.util.JSONType;
1145
+ } | {
1146
+ kind: "ended";
1147
+ settlement: "completed" | "failed" | "stopped";
1148
+ detail: string;
1149
+ candidate: {
1150
+ submission: number;
1151
+ output: z.core.util.JSONType;
1152
+ } | null;
1153
+ report: string | null;
1154
+ } | {
1155
+ kind: "refused";
1156
+ detail: string;
1157
+ } | {
1158
+ kind: "unfinished";
1159
+ candidate: {
1160
+ submission: number;
1161
+ output: z.core.util.JSONType;
1162
+ } | null;
1163
+ report: string | null;
1164
+ };
1165
+ }[];
1166
+ } | {
1167
+ op: "completed";
1168
+ transition: string;
1169
+ cause: {
1170
+ kind: "opening";
1171
+ } | {
1172
+ kind: "routed";
1173
+ result: string;
1174
+ } | {
1175
+ kind: "decision";
1176
+ decision: string;
1177
+ };
1178
+ } | {
1179
+ op: "cancel-requested";
1180
+ operation_id: string;
1181
+ actor: string;
1182
+ reason: string;
1183
+ } | {
1184
+ op: "cancelled";
1185
+ operation_id: string;
1186
+ }, options: import("../../plugin.js").AppendOptions) => {
1187
+ type: "ext";
1188
+ data: {
1189
+ plugin: string;
1190
+ instance_id: string;
1191
+ kind: string;
1192
+ version: number;
1193
+ data: z.core.util.JSONType;
1194
+ };
1195
+ options: import("../../plugin.js").AppendOptions;
1196
+ };
1197
+ append(journal: import("../../plugin.js").PluginJournal, value: {
1198
+ op: "decided";
1199
+ decision: string;
1200
+ operation_id: string;
1201
+ actor: string;
1202
+ attempt: string;
1203
+ reason: "gate" | "exhaustion" | "recovery";
1204
+ result: string | null;
1205
+ verdict: "approve" | "revise";
1206
+ option: string | null;
1207
+ feedback: string | null;
1208
+ restart: string[];
1209
+ } | {
1210
+ op: "opened";
1211
+ definition: string;
1212
+ canonical: unknown;
1213
+ input: z.core.util.JSONType;
1214
+ input_id: string;
1215
+ pins: {
1216
+ participants: Record<string, {
1217
+ configuration: {
1218
+ agent: string;
1219
+ route: {
1220
+ provider: string;
1221
+ model: string;
1222
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
1223
+ };
1224
+ environment: {
1225
+ cwd: string;
1226
+ read_roots: string[];
1227
+ };
1228
+ installations: {
1229
+ installation_id: string;
1230
+ preset_id: string;
1231
+ config: z.core.util.JSONType;
1232
+ lifetime: "defining" | "configurable";
1233
+ }[];
1234
+ } | null;
1235
+ checks: Record<string, {
1236
+ config: z.core.util.JSONType;
1237
+ }>;
1238
+ }>;
1239
+ evidence: Record<string, {
1240
+ config: z.core.util.JSONType;
1241
+ }>;
1242
+ };
1243
+ } | {
1244
+ op: "entered";
1245
+ transition: string;
1246
+ cause: {
1247
+ kind: "opening";
1248
+ } | {
1249
+ kind: "routed";
1250
+ result: string;
1251
+ } | {
1252
+ kind: "decision";
1253
+ decision: string;
1254
+ };
1255
+ step: string;
1256
+ attempt: string;
1257
+ ordinal: number;
1258
+ retires: string[];
1259
+ inputs: Record<string, {
1260
+ kind: "input";
1261
+ } | {
1262
+ kind: "evidence";
1263
+ provider: string;
1264
+ immutable: boolean;
1265
+ detail: z.core.util.JSONType;
1266
+ } | {
1267
+ kind: "result";
1268
+ result: string;
1269
+ participant: string | null;
1270
+ decision: string | null;
1271
+ mode: "current" | "historical";
1272
+ } | null>;
1273
+ evidence: Record<string, z.core.util.JSONType>;
1274
+ assignments: ({
1275
+ context: "conversation";
1276
+ id: string;
1277
+ participant: string;
1278
+ activation: string;
1279
+ } | {
1280
+ context: "isolated";
1281
+ id: string;
1282
+ participant: string;
1283
+ thread: string;
1284
+ task: string;
1285
+ generation: number;
1286
+ lifetime: "attempt" | "instance";
1287
+ checks: string[];
1288
+ })[];
1289
+ } | {
1290
+ op: "observed";
1291
+ observations: {
1292
+ assignment: string;
1293
+ thread: string;
1294
+ task: string;
1295
+ generation: number;
1296
+ outcome: {
1297
+ kind: "accepted";
1298
+ submission: number;
1299
+ ending: number;
1300
+ output: z.core.util.JSONType;
1301
+ } | {
1302
+ kind: "ended";
1303
+ settlement: "completed" | "failed" | "stopped";
1304
+ detail: string;
1305
+ candidate: {
1306
+ submission: number;
1307
+ output: z.core.util.JSONType;
1308
+ } | null;
1309
+ report: string | null;
1310
+ } | {
1311
+ kind: "refused";
1312
+ detail: string;
1313
+ } | {
1314
+ kind: "unfinished";
1315
+ candidate: {
1316
+ submission: number;
1317
+ output: z.core.util.JSONType;
1318
+ } | null;
1319
+ report: string | null;
1320
+ };
1321
+ }[];
1322
+ } | {
1323
+ op: "stopped";
1324
+ attempt: string;
1325
+ reason: string;
1326
+ observations: {
1327
+ assignment: string;
1328
+ thread: string;
1329
+ task: string;
1330
+ generation: number;
1331
+ outcome: {
1332
+ kind: "accepted";
1333
+ submission: number;
1334
+ ending: number;
1335
+ output: z.core.util.JSONType;
1336
+ } | {
1337
+ kind: "ended";
1338
+ settlement: "completed" | "failed" | "stopped";
1339
+ detail: string;
1340
+ candidate: {
1341
+ submission: number;
1342
+ output: z.core.util.JSONType;
1343
+ } | null;
1344
+ report: string | null;
1345
+ } | {
1346
+ kind: "refused";
1347
+ detail: string;
1348
+ } | {
1349
+ kind: "unfinished";
1350
+ candidate: {
1351
+ submission: number;
1352
+ output: z.core.util.JSONType;
1353
+ } | null;
1354
+ report: string | null;
1355
+ };
1356
+ }[];
1357
+ } | {
1358
+ op: "completed";
1359
+ transition: string;
1360
+ cause: {
1361
+ kind: "opening";
1362
+ } | {
1363
+ kind: "routed";
1364
+ result: string;
1365
+ } | {
1366
+ kind: "decision";
1367
+ decision: string;
1368
+ };
1369
+ } | {
1370
+ op: "cancel-requested";
1371
+ operation_id: string;
1372
+ actor: string;
1373
+ reason: string;
1374
+ } | {
1375
+ op: "cancelled";
1376
+ operation_id: string;
1377
+ }, options: import("../../plugin.js").AppendOptions): Promise<import("../../models/index.js").JournalEvent<"ext">>;
1378
+ read(event: import("../../models/index.js").JournalEvent): {
1379
+ op: "decided";
1380
+ decision: string;
1381
+ operation_id: string;
1382
+ actor: string;
1383
+ attempt: string;
1384
+ reason: "gate" | "exhaustion" | "recovery";
1385
+ result: string | null;
1386
+ verdict: "approve" | "revise";
1387
+ option: string | null;
1388
+ feedback: string | null;
1389
+ restart: string[];
1390
+ } | {
1391
+ op: "opened";
1392
+ definition: string;
1393
+ canonical: CanonicalDefinition;
1394
+ input: z.core.util.JSONType;
1395
+ input_id: string;
1396
+ pins: {
1397
+ participants: Record<string, {
1398
+ configuration: {
1399
+ agent: string;
1400
+ route: {
1401
+ provider: string;
1402
+ model: string;
1403
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
1404
+ };
1405
+ environment: {
1406
+ cwd: string;
1407
+ read_roots: string[];
1408
+ };
1409
+ installations: {
1410
+ installation_id: string;
1411
+ preset_id: string;
1412
+ config: z.core.util.JSONType;
1413
+ lifetime: "defining" | "configurable";
1414
+ }[];
1415
+ } | null;
1416
+ checks: Record<string, {
1417
+ config: z.core.util.JSONType;
1418
+ }>;
1419
+ }>;
1420
+ evidence: Record<string, {
1421
+ config: z.core.util.JSONType;
1422
+ }>;
1423
+ };
1424
+ } | {
1425
+ op: "entered";
1426
+ transition: string;
1427
+ cause: {
1428
+ kind: "opening";
1429
+ } | {
1430
+ kind: "routed";
1431
+ result: string;
1432
+ } | {
1433
+ kind: "decision";
1434
+ decision: string;
1435
+ };
1436
+ step: string;
1437
+ attempt: string;
1438
+ ordinal: number;
1439
+ retires: string[];
1440
+ inputs: Record<string, {
1441
+ kind: "input";
1442
+ } | {
1443
+ kind: "evidence";
1444
+ provider: string;
1445
+ immutable: boolean;
1446
+ detail: z.core.util.JSONType;
1447
+ } | {
1448
+ kind: "result";
1449
+ result: string;
1450
+ participant: string | null;
1451
+ decision: string | null;
1452
+ mode: "current" | "historical";
1453
+ } | null>;
1454
+ evidence: Record<string, z.core.util.JSONType>;
1455
+ assignments: ({
1456
+ context: "conversation";
1457
+ id: string;
1458
+ participant: string;
1459
+ activation: string;
1460
+ } | {
1461
+ context: "isolated";
1462
+ id: string;
1463
+ participant: string;
1464
+ thread: string;
1465
+ task: string;
1466
+ generation: number;
1467
+ lifetime: "attempt" | "instance";
1468
+ checks: string[];
1469
+ })[];
1470
+ } | {
1471
+ op: "observed";
1472
+ observations: {
1473
+ assignment: string;
1474
+ thread: string;
1475
+ task: string;
1476
+ generation: number;
1477
+ outcome: {
1478
+ kind: "accepted";
1479
+ submission: number;
1480
+ ending: number;
1481
+ output: z.core.util.JSONType;
1482
+ } | {
1483
+ kind: "ended";
1484
+ settlement: "completed" | "failed" | "stopped";
1485
+ detail: string;
1486
+ candidate: {
1487
+ submission: number;
1488
+ output: z.core.util.JSONType;
1489
+ } | null;
1490
+ report: string | null;
1491
+ } | {
1492
+ kind: "refused";
1493
+ detail: string;
1494
+ } | {
1495
+ kind: "unfinished";
1496
+ candidate: {
1497
+ submission: number;
1498
+ output: z.core.util.JSONType;
1499
+ } | null;
1500
+ report: string | null;
1501
+ };
1502
+ }[];
1503
+ } | {
1504
+ op: "stopped";
1505
+ attempt: string;
1506
+ reason: string;
1507
+ observations: {
1508
+ assignment: string;
1509
+ thread: string;
1510
+ task: string;
1511
+ generation: number;
1512
+ outcome: {
1513
+ kind: "accepted";
1514
+ submission: number;
1515
+ ending: number;
1516
+ output: z.core.util.JSONType;
1517
+ } | {
1518
+ kind: "ended";
1519
+ settlement: "completed" | "failed" | "stopped";
1520
+ detail: string;
1521
+ candidate: {
1522
+ submission: number;
1523
+ output: z.core.util.JSONType;
1524
+ } | null;
1525
+ report: string | null;
1526
+ } | {
1527
+ kind: "refused";
1528
+ detail: string;
1529
+ } | {
1530
+ kind: "unfinished";
1531
+ candidate: {
1532
+ submission: number;
1533
+ output: z.core.util.JSONType;
1534
+ } | null;
1535
+ report: string | null;
1536
+ };
1537
+ }[];
1538
+ } | {
1539
+ op: "completed";
1540
+ transition: string;
1541
+ cause: {
1542
+ kind: "opening";
1543
+ } | {
1544
+ kind: "routed";
1545
+ result: string;
1546
+ } | {
1547
+ kind: "decision";
1548
+ decision: string;
1549
+ };
1550
+ } | {
1551
+ op: "cancel-requested";
1552
+ operation_id: string;
1553
+ actor: string;
1554
+ reason: string;
1555
+ } | {
1556
+ op: "cancelled";
1557
+ operation_id: string;
1558
+ } | undefined;
1559
+ contribution(message: {
1560
+ role?: import("../../models/index.js").InputRole;
1561
+ content: string | readonly import("../../llm/content.js").ContentPartInput[];
1562
+ }, value: {
1563
+ op: "decided";
1564
+ decision: string;
1565
+ operation_id: string;
1566
+ actor: string;
1567
+ attempt: string;
1568
+ reason: "gate" | "exhaustion" | "recovery";
1569
+ result: string | null;
1570
+ verdict: "approve" | "revise";
1571
+ option: string | null;
1572
+ feedback: string | null;
1573
+ restart: string[];
1574
+ } | {
1575
+ op: "opened";
1576
+ definition: string;
1577
+ canonical: unknown;
1578
+ input: z.core.util.JSONType;
1579
+ input_id: string;
1580
+ pins: {
1581
+ participants: Record<string, {
1582
+ configuration: {
1583
+ agent: string;
1584
+ route: {
1585
+ provider: string;
1586
+ model: string;
1587
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
1588
+ };
1589
+ environment: {
1590
+ cwd: string;
1591
+ read_roots: string[];
1592
+ };
1593
+ installations: {
1594
+ installation_id: string;
1595
+ preset_id: string;
1596
+ config: z.core.util.JSONType;
1597
+ lifetime: "defining" | "configurable";
1598
+ }[];
1599
+ } | null;
1600
+ checks: Record<string, {
1601
+ config: z.core.util.JSONType;
1602
+ }>;
1603
+ }>;
1604
+ evidence: Record<string, {
1605
+ config: z.core.util.JSONType;
1606
+ }>;
1607
+ };
1608
+ } | {
1609
+ op: "entered";
1610
+ transition: string;
1611
+ cause: {
1612
+ kind: "opening";
1613
+ } | {
1614
+ kind: "routed";
1615
+ result: string;
1616
+ } | {
1617
+ kind: "decision";
1618
+ decision: string;
1619
+ };
1620
+ step: string;
1621
+ attempt: string;
1622
+ ordinal: number;
1623
+ retires: string[];
1624
+ inputs: Record<string, {
1625
+ kind: "input";
1626
+ } | {
1627
+ kind: "evidence";
1628
+ provider: string;
1629
+ immutable: boolean;
1630
+ detail: z.core.util.JSONType;
1631
+ } | {
1632
+ kind: "result";
1633
+ result: string;
1634
+ participant: string | null;
1635
+ decision: string | null;
1636
+ mode: "current" | "historical";
1637
+ } | null>;
1638
+ evidence: Record<string, z.core.util.JSONType>;
1639
+ assignments: ({
1640
+ context: "conversation";
1641
+ id: string;
1642
+ participant: string;
1643
+ activation: string;
1644
+ } | {
1645
+ context: "isolated";
1646
+ id: string;
1647
+ participant: string;
1648
+ thread: string;
1649
+ task: string;
1650
+ generation: number;
1651
+ lifetime: "attempt" | "instance";
1652
+ checks: string[];
1653
+ })[];
1654
+ } | {
1655
+ op: "observed";
1656
+ observations: {
1657
+ assignment: string;
1658
+ thread: string;
1659
+ task: string;
1660
+ generation: number;
1661
+ outcome: {
1662
+ kind: "accepted";
1663
+ submission: number;
1664
+ ending: number;
1665
+ output: z.core.util.JSONType;
1666
+ } | {
1667
+ kind: "ended";
1668
+ settlement: "completed" | "failed" | "stopped";
1669
+ detail: string;
1670
+ candidate: {
1671
+ submission: number;
1672
+ output: z.core.util.JSONType;
1673
+ } | null;
1674
+ report: string | null;
1675
+ } | {
1676
+ kind: "refused";
1677
+ detail: string;
1678
+ } | {
1679
+ kind: "unfinished";
1680
+ candidate: {
1681
+ submission: number;
1682
+ output: z.core.util.JSONType;
1683
+ } | null;
1684
+ report: string | null;
1685
+ };
1686
+ }[];
1687
+ } | {
1688
+ op: "stopped";
1689
+ attempt: string;
1690
+ reason: string;
1691
+ observations: {
1692
+ assignment: string;
1693
+ thread: string;
1694
+ task: string;
1695
+ generation: number;
1696
+ outcome: {
1697
+ kind: "accepted";
1698
+ submission: number;
1699
+ ending: number;
1700
+ output: z.core.util.JSONType;
1701
+ } | {
1702
+ kind: "ended";
1703
+ settlement: "completed" | "failed" | "stopped";
1704
+ detail: string;
1705
+ candidate: {
1706
+ submission: number;
1707
+ output: z.core.util.JSONType;
1708
+ } | null;
1709
+ report: string | null;
1710
+ } | {
1711
+ kind: "refused";
1712
+ detail: string;
1713
+ } | {
1714
+ kind: "unfinished";
1715
+ candidate: {
1716
+ submission: number;
1717
+ output: z.core.util.JSONType;
1718
+ } | null;
1719
+ report: string | null;
1720
+ };
1721
+ }[];
1722
+ } | {
1723
+ op: "completed";
1724
+ transition: string;
1725
+ cause: {
1726
+ kind: "opening";
1727
+ } | {
1728
+ kind: "routed";
1729
+ result: string;
1730
+ } | {
1731
+ kind: "decision";
1732
+ decision: string;
1733
+ };
1734
+ } | {
1735
+ op: "cancel-requested";
1736
+ operation_id: string;
1737
+ actor: string;
1738
+ reason: string;
1739
+ } | {
1740
+ op: "cancelled";
1741
+ operation_id: string;
1742
+ }, options?: {
1743
+ sourceSeqs?: readonly import("../../models/index.js").Seq[];
1744
+ }): import("../../models/index.js").StepContribution;
1745
+ matchesSource(record: DeepReadonly<import("../../models/index.js").ExtensionRecord>): boolean;
1746
+ rejection(reason: string, value: {
1747
+ op: "decided";
1748
+ decision: string;
1749
+ operation_id: string;
1750
+ actor: string;
1751
+ attempt: string;
1752
+ reason: "gate" | "exhaustion" | "recovery";
1753
+ result: string | null;
1754
+ verdict: "approve" | "revise";
1755
+ option: string | null;
1756
+ feedback: string | null;
1757
+ restart: string[];
1758
+ } | {
1759
+ op: "opened";
1760
+ definition: string;
1761
+ canonical: unknown;
1762
+ input: z.core.util.JSONType;
1763
+ input_id: string;
1764
+ pins: {
1765
+ participants: Record<string, {
1766
+ configuration: {
1767
+ agent: string;
1768
+ route: {
1769
+ provider: string;
1770
+ model: string;
1771
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
1772
+ };
1773
+ environment: {
1774
+ cwd: string;
1775
+ read_roots: string[];
1776
+ };
1777
+ installations: {
1778
+ installation_id: string;
1779
+ preset_id: string;
1780
+ config: z.core.util.JSONType;
1781
+ lifetime: "defining" | "configurable";
1782
+ }[];
1783
+ } | null;
1784
+ checks: Record<string, {
1785
+ config: z.core.util.JSONType;
1786
+ }>;
1787
+ }>;
1788
+ evidence: Record<string, {
1789
+ config: z.core.util.JSONType;
1790
+ }>;
1791
+ };
1792
+ } | {
1793
+ op: "entered";
1794
+ transition: string;
1795
+ cause: {
1796
+ kind: "opening";
1797
+ } | {
1798
+ kind: "routed";
1799
+ result: string;
1800
+ } | {
1801
+ kind: "decision";
1802
+ decision: string;
1803
+ };
1804
+ step: string;
1805
+ attempt: string;
1806
+ ordinal: number;
1807
+ retires: string[];
1808
+ inputs: Record<string, {
1809
+ kind: "input";
1810
+ } | {
1811
+ kind: "evidence";
1812
+ provider: string;
1813
+ immutable: boolean;
1814
+ detail: z.core.util.JSONType;
1815
+ } | {
1816
+ kind: "result";
1817
+ result: string;
1818
+ participant: string | null;
1819
+ decision: string | null;
1820
+ mode: "current" | "historical";
1821
+ } | null>;
1822
+ evidence: Record<string, z.core.util.JSONType>;
1823
+ assignments: ({
1824
+ context: "conversation";
1825
+ id: string;
1826
+ participant: string;
1827
+ activation: string;
1828
+ } | {
1829
+ context: "isolated";
1830
+ id: string;
1831
+ participant: string;
1832
+ thread: string;
1833
+ task: string;
1834
+ generation: number;
1835
+ lifetime: "attempt" | "instance";
1836
+ checks: string[];
1837
+ })[];
1838
+ } | {
1839
+ op: "observed";
1840
+ observations: {
1841
+ assignment: string;
1842
+ thread: string;
1843
+ task: string;
1844
+ generation: number;
1845
+ outcome: {
1846
+ kind: "accepted";
1847
+ submission: number;
1848
+ ending: number;
1849
+ output: z.core.util.JSONType;
1850
+ } | {
1851
+ kind: "ended";
1852
+ settlement: "completed" | "failed" | "stopped";
1853
+ detail: string;
1854
+ candidate: {
1855
+ submission: number;
1856
+ output: z.core.util.JSONType;
1857
+ } | null;
1858
+ report: string | null;
1859
+ } | {
1860
+ kind: "refused";
1861
+ detail: string;
1862
+ } | {
1863
+ kind: "unfinished";
1864
+ candidate: {
1865
+ submission: number;
1866
+ output: z.core.util.JSONType;
1867
+ } | null;
1868
+ report: string | null;
1869
+ };
1870
+ }[];
1871
+ } | {
1872
+ op: "stopped";
1873
+ attempt: string;
1874
+ reason: string;
1875
+ observations: {
1876
+ assignment: string;
1877
+ thread: string;
1878
+ task: string;
1879
+ generation: number;
1880
+ outcome: {
1881
+ kind: "accepted";
1882
+ submission: number;
1883
+ ending: number;
1884
+ output: z.core.util.JSONType;
1885
+ } | {
1886
+ kind: "ended";
1887
+ settlement: "completed" | "failed" | "stopped";
1888
+ detail: string;
1889
+ candidate: {
1890
+ submission: number;
1891
+ output: z.core.util.JSONType;
1892
+ } | null;
1893
+ report: string | null;
1894
+ } | {
1895
+ kind: "refused";
1896
+ detail: string;
1897
+ } | {
1898
+ kind: "unfinished";
1899
+ candidate: {
1900
+ submission: number;
1901
+ output: z.core.util.JSONType;
1902
+ } | null;
1903
+ report: string | null;
1904
+ };
1905
+ }[];
1906
+ } | {
1907
+ op: "completed";
1908
+ transition: string;
1909
+ cause: {
1910
+ kind: "opening";
1911
+ } | {
1912
+ kind: "routed";
1913
+ result: string;
1914
+ } | {
1915
+ kind: "decision";
1916
+ decision: string;
1917
+ };
1918
+ } | {
1919
+ op: "cancel-requested";
1920
+ operation_id: string;
1921
+ actor: string;
1922
+ reason: string;
1923
+ } | {
1924
+ op: "cancelled";
1925
+ operation_id: string;
1926
+ }): {
1927
+ decision: "reject";
1928
+ reason: string;
1929
+ source: import("../../models/index.js").ExtensionRecord;
1930
+ };
1931
+ readContribution: (event: import("../../models/index.js").JournalEvent) => {
1932
+ op: "decided";
1933
+ decision: string;
1934
+ operation_id: string;
1935
+ actor: string;
1936
+ attempt: string;
1937
+ reason: "gate" | "exhaustion" | "recovery";
1938
+ result: string | null;
1939
+ verdict: "approve" | "revise";
1940
+ option: string | null;
1941
+ feedback: string | null;
1942
+ restart: string[];
1943
+ } | {
1944
+ op: "opened";
1945
+ definition: string;
1946
+ canonical: CanonicalDefinition;
1947
+ input: z.core.util.JSONType;
1948
+ input_id: string;
1949
+ pins: {
1950
+ participants: Record<string, {
1951
+ configuration: {
1952
+ agent: string;
1953
+ route: {
1954
+ provider: string;
1955
+ model: string;
1956
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
1957
+ };
1958
+ environment: {
1959
+ cwd: string;
1960
+ read_roots: string[];
1961
+ };
1962
+ installations: {
1963
+ installation_id: string;
1964
+ preset_id: string;
1965
+ config: z.core.util.JSONType;
1966
+ lifetime: "defining" | "configurable";
1967
+ }[];
1968
+ } | null;
1969
+ checks: Record<string, {
1970
+ config: z.core.util.JSONType;
1971
+ }>;
1972
+ }>;
1973
+ evidence: Record<string, {
1974
+ config: z.core.util.JSONType;
1975
+ }>;
1976
+ };
1977
+ } | {
1978
+ op: "entered";
1979
+ transition: string;
1980
+ cause: {
1981
+ kind: "opening";
1982
+ } | {
1983
+ kind: "routed";
1984
+ result: string;
1985
+ } | {
1986
+ kind: "decision";
1987
+ decision: string;
1988
+ };
1989
+ step: string;
1990
+ attempt: string;
1991
+ ordinal: number;
1992
+ retires: string[];
1993
+ inputs: Record<string, {
1994
+ kind: "input";
1995
+ } | {
1996
+ kind: "evidence";
1997
+ provider: string;
1998
+ immutable: boolean;
1999
+ detail: z.core.util.JSONType;
2000
+ } | {
2001
+ kind: "result";
2002
+ result: string;
2003
+ participant: string | null;
2004
+ decision: string | null;
2005
+ mode: "current" | "historical";
2006
+ } | null>;
2007
+ evidence: Record<string, z.core.util.JSONType>;
2008
+ assignments: ({
2009
+ context: "conversation";
2010
+ id: string;
2011
+ participant: string;
2012
+ activation: string;
2013
+ } | {
2014
+ context: "isolated";
2015
+ id: string;
2016
+ participant: string;
2017
+ thread: string;
2018
+ task: string;
2019
+ generation: number;
2020
+ lifetime: "attempt" | "instance";
2021
+ checks: string[];
2022
+ })[];
2023
+ } | {
2024
+ op: "observed";
2025
+ observations: {
2026
+ assignment: string;
2027
+ thread: string;
2028
+ task: string;
2029
+ generation: number;
2030
+ outcome: {
2031
+ kind: "accepted";
2032
+ submission: number;
2033
+ ending: number;
2034
+ output: z.core.util.JSONType;
2035
+ } | {
2036
+ kind: "ended";
2037
+ settlement: "completed" | "failed" | "stopped";
2038
+ detail: string;
2039
+ candidate: {
2040
+ submission: number;
2041
+ output: z.core.util.JSONType;
2042
+ } | null;
2043
+ report: string | null;
2044
+ } | {
2045
+ kind: "refused";
2046
+ detail: string;
2047
+ } | {
2048
+ kind: "unfinished";
2049
+ candidate: {
2050
+ submission: number;
2051
+ output: z.core.util.JSONType;
2052
+ } | null;
2053
+ report: string | null;
2054
+ };
2055
+ }[];
2056
+ } | {
2057
+ op: "stopped";
2058
+ attempt: string;
2059
+ reason: string;
2060
+ observations: {
2061
+ assignment: string;
2062
+ thread: string;
2063
+ task: string;
2064
+ generation: number;
2065
+ outcome: {
2066
+ kind: "accepted";
2067
+ submission: number;
2068
+ ending: number;
2069
+ output: z.core.util.JSONType;
2070
+ } | {
2071
+ kind: "ended";
2072
+ settlement: "completed" | "failed" | "stopped";
2073
+ detail: string;
2074
+ candidate: {
2075
+ submission: number;
2076
+ output: z.core.util.JSONType;
2077
+ } | null;
2078
+ report: string | null;
2079
+ } | {
2080
+ kind: "refused";
2081
+ detail: string;
2082
+ } | {
2083
+ kind: "unfinished";
2084
+ candidate: {
2085
+ submission: number;
2086
+ output: z.core.util.JSONType;
2087
+ } | null;
2088
+ report: string | null;
2089
+ };
2090
+ }[];
2091
+ } | {
2092
+ op: "completed";
2093
+ transition: string;
2094
+ cause: {
2095
+ kind: "opening";
2096
+ } | {
2097
+ kind: "routed";
2098
+ result: string;
2099
+ } | {
2100
+ kind: "decision";
2101
+ decision: string;
2102
+ };
2103
+ } | {
2104
+ op: "cancel-requested";
2105
+ operation_id: string;
2106
+ actor: string;
2107
+ reason: string;
2108
+ } | {
2109
+ op: "cancelled";
2110
+ operation_id: string;
2111
+ } | undefined;
2112
+ readSource: (source: DeepReadonly<import("../../models/index.js").ExtensionRecord> | null) => {
2113
+ op: "decided";
2114
+ decision: string;
2115
+ operation_id: string;
2116
+ actor: string;
2117
+ attempt: string;
2118
+ reason: "gate" | "exhaustion" | "recovery";
2119
+ result: string | null;
2120
+ verdict: "approve" | "revise";
2121
+ option: string | null;
2122
+ feedback: string | null;
2123
+ restart: string[];
2124
+ } | {
2125
+ op: "opened";
2126
+ definition: string;
2127
+ canonical: CanonicalDefinition;
2128
+ input: z.core.util.JSONType;
2129
+ input_id: string;
2130
+ pins: {
2131
+ participants: Record<string, {
2132
+ configuration: {
2133
+ agent: string;
2134
+ route: {
2135
+ provider: string;
2136
+ model: string;
2137
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
2138
+ };
2139
+ environment: {
2140
+ cwd: string;
2141
+ read_roots: string[];
2142
+ };
2143
+ installations: {
2144
+ installation_id: string;
2145
+ preset_id: string;
2146
+ config: z.core.util.JSONType;
2147
+ lifetime: "defining" | "configurable";
2148
+ }[];
2149
+ } | null;
2150
+ checks: Record<string, {
2151
+ config: z.core.util.JSONType;
2152
+ }>;
2153
+ }>;
2154
+ evidence: Record<string, {
2155
+ config: z.core.util.JSONType;
2156
+ }>;
2157
+ };
2158
+ } | {
2159
+ op: "entered";
2160
+ transition: string;
2161
+ cause: {
2162
+ kind: "opening";
2163
+ } | {
2164
+ kind: "routed";
2165
+ result: string;
2166
+ } | {
2167
+ kind: "decision";
2168
+ decision: string;
2169
+ };
2170
+ step: string;
2171
+ attempt: string;
2172
+ ordinal: number;
2173
+ retires: string[];
2174
+ inputs: Record<string, {
2175
+ kind: "input";
2176
+ } | {
2177
+ kind: "evidence";
2178
+ provider: string;
2179
+ immutable: boolean;
2180
+ detail: z.core.util.JSONType;
2181
+ } | {
2182
+ kind: "result";
2183
+ result: string;
2184
+ participant: string | null;
2185
+ decision: string | null;
2186
+ mode: "current" | "historical";
2187
+ } | null>;
2188
+ evidence: Record<string, z.core.util.JSONType>;
2189
+ assignments: ({
2190
+ context: "conversation";
2191
+ id: string;
2192
+ participant: string;
2193
+ activation: string;
2194
+ } | {
2195
+ context: "isolated";
2196
+ id: string;
2197
+ participant: string;
2198
+ thread: string;
2199
+ task: string;
2200
+ generation: number;
2201
+ lifetime: "attempt" | "instance";
2202
+ checks: string[];
2203
+ })[];
2204
+ } | {
2205
+ op: "observed";
2206
+ observations: {
2207
+ assignment: string;
2208
+ thread: string;
2209
+ task: string;
2210
+ generation: number;
2211
+ outcome: {
2212
+ kind: "accepted";
2213
+ submission: number;
2214
+ ending: number;
2215
+ output: z.core.util.JSONType;
2216
+ } | {
2217
+ kind: "ended";
2218
+ settlement: "completed" | "failed" | "stopped";
2219
+ detail: string;
2220
+ candidate: {
2221
+ submission: number;
2222
+ output: z.core.util.JSONType;
2223
+ } | null;
2224
+ report: string | null;
2225
+ } | {
2226
+ kind: "refused";
2227
+ detail: string;
2228
+ } | {
2229
+ kind: "unfinished";
2230
+ candidate: {
2231
+ submission: number;
2232
+ output: z.core.util.JSONType;
2233
+ } | null;
2234
+ report: string | null;
2235
+ };
2236
+ }[];
2237
+ } | {
2238
+ op: "stopped";
2239
+ attempt: string;
2240
+ reason: string;
2241
+ observations: {
2242
+ assignment: string;
2243
+ thread: string;
2244
+ task: string;
2245
+ generation: number;
2246
+ outcome: {
2247
+ kind: "accepted";
2248
+ submission: number;
2249
+ ending: number;
2250
+ output: z.core.util.JSONType;
2251
+ } | {
2252
+ kind: "ended";
2253
+ settlement: "completed" | "failed" | "stopped";
2254
+ detail: string;
2255
+ candidate: {
2256
+ submission: number;
2257
+ output: z.core.util.JSONType;
2258
+ } | null;
2259
+ report: string | null;
2260
+ } | {
2261
+ kind: "refused";
2262
+ detail: string;
2263
+ } | {
2264
+ kind: "unfinished";
2265
+ candidate: {
2266
+ submission: number;
2267
+ output: z.core.util.JSONType;
2268
+ } | null;
2269
+ report: string | null;
2270
+ };
2271
+ }[];
2272
+ } | {
2273
+ op: "completed";
2274
+ transition: string;
2275
+ cause: {
2276
+ kind: "opening";
2277
+ } | {
2278
+ kind: "routed";
2279
+ result: string;
2280
+ } | {
2281
+ kind: "decision";
2282
+ decision: string;
2283
+ };
2284
+ } | {
2285
+ op: "cancel-requested";
2286
+ operation_id: string;
2287
+ actor: string;
2288
+ reason: string;
2289
+ } | {
2290
+ op: "cancelled";
2291
+ operation_id: string;
2292
+ } | undefined;
2293
+ told: import("../../plugin.js").PluginProjection<import("../../kit/extension.js").ToldNotices<{
2294
+ op: "decided";
2295
+ decision: string;
2296
+ operation_id: string;
2297
+ actor: string;
2298
+ attempt: string;
2299
+ reason: "gate" | "exhaustion" | "recovery";
2300
+ result: string | null;
2301
+ verdict: "approve" | "revise";
2302
+ option: string | null;
2303
+ feedback: string | null;
2304
+ restart: string[];
2305
+ } | {
2306
+ op: "opened";
2307
+ definition: string;
2308
+ canonical: CanonicalDefinition;
2309
+ input: z.core.util.JSONType;
2310
+ input_id: string;
2311
+ pins: {
2312
+ participants: Record<string, {
2313
+ configuration: {
2314
+ agent: string;
2315
+ route: {
2316
+ provider: string;
2317
+ model: string;
2318
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
2319
+ };
2320
+ environment: {
2321
+ cwd: string;
2322
+ read_roots: string[];
2323
+ };
2324
+ installations: {
2325
+ installation_id: string;
2326
+ preset_id: string;
2327
+ config: z.core.util.JSONType;
2328
+ lifetime: "defining" | "configurable";
2329
+ }[];
2330
+ } | null;
2331
+ checks: Record<string, {
2332
+ config: z.core.util.JSONType;
2333
+ }>;
2334
+ }>;
2335
+ evidence: Record<string, {
2336
+ config: z.core.util.JSONType;
2337
+ }>;
2338
+ };
2339
+ } | {
2340
+ op: "entered";
2341
+ transition: string;
2342
+ cause: {
2343
+ kind: "opening";
2344
+ } | {
2345
+ kind: "routed";
2346
+ result: string;
2347
+ } | {
2348
+ kind: "decision";
2349
+ decision: string;
2350
+ };
2351
+ step: string;
2352
+ attempt: string;
2353
+ ordinal: number;
2354
+ retires: string[];
2355
+ inputs: Record<string, {
2356
+ kind: "input";
2357
+ } | {
2358
+ kind: "evidence";
2359
+ provider: string;
2360
+ immutable: boolean;
2361
+ detail: z.core.util.JSONType;
2362
+ } | {
2363
+ kind: "result";
2364
+ result: string;
2365
+ participant: string | null;
2366
+ decision: string | null;
2367
+ mode: "current" | "historical";
2368
+ } | null>;
2369
+ evidence: Record<string, z.core.util.JSONType>;
2370
+ assignments: ({
2371
+ context: "conversation";
2372
+ id: string;
2373
+ participant: string;
2374
+ activation: string;
2375
+ } | {
2376
+ context: "isolated";
2377
+ id: string;
2378
+ participant: string;
2379
+ thread: string;
2380
+ task: string;
2381
+ generation: number;
2382
+ lifetime: "attempt" | "instance";
2383
+ checks: string[];
2384
+ })[];
2385
+ } | {
2386
+ op: "observed";
2387
+ observations: {
2388
+ assignment: string;
2389
+ thread: string;
2390
+ task: string;
2391
+ generation: number;
2392
+ outcome: {
2393
+ kind: "accepted";
2394
+ submission: number;
2395
+ ending: number;
2396
+ output: z.core.util.JSONType;
2397
+ } | {
2398
+ kind: "ended";
2399
+ settlement: "completed" | "failed" | "stopped";
2400
+ detail: string;
2401
+ candidate: {
2402
+ submission: number;
2403
+ output: z.core.util.JSONType;
2404
+ } | null;
2405
+ report: string | null;
2406
+ } | {
2407
+ kind: "refused";
2408
+ detail: string;
2409
+ } | {
2410
+ kind: "unfinished";
2411
+ candidate: {
2412
+ submission: number;
2413
+ output: z.core.util.JSONType;
2414
+ } | null;
2415
+ report: string | null;
2416
+ };
2417
+ }[];
2418
+ } | {
2419
+ op: "stopped";
2420
+ attempt: string;
2421
+ reason: string;
2422
+ observations: {
2423
+ assignment: string;
2424
+ thread: string;
2425
+ task: string;
2426
+ generation: number;
2427
+ outcome: {
2428
+ kind: "accepted";
2429
+ submission: number;
2430
+ ending: number;
2431
+ output: z.core.util.JSONType;
2432
+ } | {
2433
+ kind: "ended";
2434
+ settlement: "completed" | "failed" | "stopped";
2435
+ detail: string;
2436
+ candidate: {
2437
+ submission: number;
2438
+ output: z.core.util.JSONType;
2439
+ } | null;
2440
+ report: string | null;
2441
+ } | {
2442
+ kind: "refused";
2443
+ detail: string;
2444
+ } | {
2445
+ kind: "unfinished";
2446
+ candidate: {
2447
+ submission: number;
2448
+ output: z.core.util.JSONType;
2449
+ } | null;
2450
+ report: string | null;
2451
+ };
2452
+ }[];
2453
+ } | {
2454
+ op: "completed";
2455
+ transition: string;
2456
+ cause: {
2457
+ kind: "opening";
2458
+ } | {
2459
+ kind: "routed";
2460
+ result: string;
2461
+ } | {
2462
+ kind: "decision";
2463
+ decision: string;
2464
+ };
2465
+ } | {
2466
+ op: "cancel-requested";
2467
+ operation_id: string;
2468
+ actor: string;
2469
+ reason: string;
2470
+ } | {
2471
+ op: "cancelled";
2472
+ operation_id: string;
2473
+ }>>;
2474
+ projection<State>(fold: {
2475
+ key: string;
2476
+ init(): State;
2477
+ apply(state: State, value: {
2478
+ op: "decided";
2479
+ decision: string;
2480
+ operation_id: string;
2481
+ actor: string;
2482
+ attempt: string;
2483
+ reason: "gate" | "exhaustion" | "recovery";
2484
+ result: string | null;
2485
+ verdict: "approve" | "revise";
2486
+ option: string | null;
2487
+ feedback: string | null;
2488
+ restart: string[];
2489
+ } | {
2490
+ op: "opened";
2491
+ definition: string;
2492
+ canonical: CanonicalDefinition;
2493
+ input: z.core.util.JSONType;
2494
+ input_id: string;
2495
+ pins: {
2496
+ participants: Record<string, {
2497
+ configuration: {
2498
+ agent: string;
2499
+ route: {
2500
+ provider: string;
2501
+ model: string;
2502
+ thinking_effort: "low" | "high" | "none" | "medium" | "max" | null;
2503
+ };
2504
+ environment: {
2505
+ cwd: string;
2506
+ read_roots: string[];
2507
+ };
2508
+ installations: {
2509
+ installation_id: string;
2510
+ preset_id: string;
2511
+ config: z.core.util.JSONType;
2512
+ lifetime: "defining" | "configurable";
2513
+ }[];
2514
+ } | null;
2515
+ checks: Record<string, {
2516
+ config: z.core.util.JSONType;
2517
+ }>;
2518
+ }>;
2519
+ evidence: Record<string, {
2520
+ config: z.core.util.JSONType;
2521
+ }>;
2522
+ };
2523
+ } | {
2524
+ op: "entered";
2525
+ transition: string;
2526
+ cause: {
2527
+ kind: "opening";
2528
+ } | {
2529
+ kind: "routed";
2530
+ result: string;
2531
+ } | {
2532
+ kind: "decision";
2533
+ decision: string;
2534
+ };
2535
+ step: string;
2536
+ attempt: string;
2537
+ ordinal: number;
2538
+ retires: string[];
2539
+ inputs: Record<string, {
2540
+ kind: "input";
2541
+ } | {
2542
+ kind: "evidence";
2543
+ provider: string;
2544
+ immutable: boolean;
2545
+ detail: z.core.util.JSONType;
2546
+ } | {
2547
+ kind: "result";
2548
+ result: string;
2549
+ participant: string | null;
2550
+ decision: string | null;
2551
+ mode: "current" | "historical";
2552
+ } | null>;
2553
+ evidence: Record<string, z.core.util.JSONType>;
2554
+ assignments: ({
2555
+ context: "conversation";
2556
+ id: string;
2557
+ participant: string;
2558
+ activation: string;
2559
+ } | {
2560
+ context: "isolated";
2561
+ id: string;
2562
+ participant: string;
2563
+ thread: string;
2564
+ task: string;
2565
+ generation: number;
2566
+ lifetime: "attempt" | "instance";
2567
+ checks: string[];
2568
+ })[];
2569
+ } | {
2570
+ op: "observed";
2571
+ observations: {
2572
+ assignment: string;
2573
+ thread: string;
2574
+ task: string;
2575
+ generation: number;
2576
+ outcome: {
2577
+ kind: "accepted";
2578
+ submission: number;
2579
+ ending: number;
2580
+ output: z.core.util.JSONType;
2581
+ } | {
2582
+ kind: "ended";
2583
+ settlement: "completed" | "failed" | "stopped";
2584
+ detail: string;
2585
+ candidate: {
2586
+ submission: number;
2587
+ output: z.core.util.JSONType;
2588
+ } | null;
2589
+ report: string | null;
2590
+ } | {
2591
+ kind: "refused";
2592
+ detail: string;
2593
+ } | {
2594
+ kind: "unfinished";
2595
+ candidate: {
2596
+ submission: number;
2597
+ output: z.core.util.JSONType;
2598
+ } | null;
2599
+ report: string | null;
2600
+ };
2601
+ }[];
2602
+ } | {
2603
+ op: "stopped";
2604
+ attempt: string;
2605
+ reason: string;
2606
+ observations: {
2607
+ assignment: string;
2608
+ thread: string;
2609
+ task: string;
2610
+ generation: number;
2611
+ outcome: {
2612
+ kind: "accepted";
2613
+ submission: number;
2614
+ ending: number;
2615
+ output: z.core.util.JSONType;
2616
+ } | {
2617
+ kind: "ended";
2618
+ settlement: "completed" | "failed" | "stopped";
2619
+ detail: string;
2620
+ candidate: {
2621
+ submission: number;
2622
+ output: z.core.util.JSONType;
2623
+ } | null;
2624
+ report: string | null;
2625
+ } | {
2626
+ kind: "refused";
2627
+ detail: string;
2628
+ } | {
2629
+ kind: "unfinished";
2630
+ candidate: {
2631
+ submission: number;
2632
+ output: z.core.util.JSONType;
2633
+ } | null;
2634
+ report: string | null;
2635
+ };
2636
+ }[];
2637
+ } | {
2638
+ op: "completed";
2639
+ transition: string;
2640
+ cause: {
2641
+ kind: "opening";
2642
+ } | {
2643
+ kind: "routed";
2644
+ result: string;
2645
+ } | {
2646
+ kind: "decision";
2647
+ decision: string;
2648
+ };
2649
+ } | {
2650
+ op: "cancel-requested";
2651
+ operation_id: string;
2652
+ actor: string;
2653
+ reason: string;
2654
+ } | {
2655
+ op: "cancelled";
2656
+ operation_id: string;
2657
+ }, event: import("../../models/index.js").JournalEvent<"ext">): State;
2658
+ onFork?: "inherit" | "reset";
2659
+ }): import("../../plugin.js").PluginProjection<State>;
2660
+ };
2661
+ /** The `opened` row of an instance of `definition`: its id and readable copy, `input`, the host's first input id and its pins. */
2662
+ export declare function openedRow(definition: WorkflowDefinition, input: z.input<typeof JsonValueSchema>, inputId: string, pins: Pins): Opened;
2663
+ /** What a submission's result carries: the assignment it answers and the output, as submitted and validated. */
2664
+ declare const SubmissionSchema: z.ZodObject<{
2665
+ assignment: z.ZodString;
2666
+ output: z.ZodJSONSchema;
2667
+ }, z.core.$strict>;
2668
+ export type Submission = z.output<typeof SubmissionSchema>;
2669
+ /** The metadata a submission's result records, read back by {@link readSubmission}. */
2670
+ export declare const submissionMetadata: (submission: Submission) => Record<string, unknown>;
2671
+ /**
2672
+ * The submission `result` records: a successful result of {@link SUBMIT_TOOL} that concluded its
2673
+ * turn, so core's stop checks judge it as the answer; `undefined` for any other result.
2674
+ */
2675
+ export declare function readSubmission(result: ToolResult): Submission | undefined;
2676
+ /**
2677
+ * The source of the one submission reminder an assignment gets per epoch: its activation, or the
2678
+ * person's latest input since (`epoch`, that row's seq). The stop check sends a root reply back
2679
+ * with it once per epoch and abstains once it is spent, so prose never advances the workflow.
2680
+ */
2681
+ export declare const submissionReminder: {
2682
+ record: (value: {
2683
+ assignment: string;
2684
+ epoch: number;
2685
+ }) => import("../../models/index.js").ExtensionRecord;
2686
+ parse: (value: {
2687
+ assignment: string;
2688
+ epoch: number;
2689
+ }) => {
2690
+ assignment: string;
2691
+ epoch: number;
2692
+ };
2693
+ entry: (value: {
2694
+ assignment: string;
2695
+ epoch: number;
2696
+ }, options: import("../../plugin.js").AppendOptions) => {
2697
+ type: "ext";
2698
+ data: {
2699
+ plugin: string;
2700
+ instance_id: string;
2701
+ kind: string;
2702
+ version: number;
2703
+ data: z.core.util.JSONType;
2704
+ };
2705
+ options: import("../../plugin.js").AppendOptions;
2706
+ };
2707
+ append(journal: import("../../plugin.js").PluginJournal, value: {
2708
+ assignment: string;
2709
+ epoch: number;
2710
+ }, options: import("../../plugin.js").AppendOptions): Promise<import("../../models/index.js").JournalEvent<"ext">>;
2711
+ read(event: import("../../models/index.js").JournalEvent): {
2712
+ assignment: string;
2713
+ epoch: number;
2714
+ } | undefined;
2715
+ contribution(message: {
2716
+ role?: import("../../models/index.js").InputRole;
2717
+ content: string | readonly import("../../llm/content.js").ContentPartInput[];
2718
+ }, value: {
2719
+ assignment: string;
2720
+ epoch: number;
2721
+ }, options?: {
2722
+ sourceSeqs?: readonly import("../../models/index.js").Seq[];
2723
+ }): import("../../models/index.js").StepContribution;
2724
+ matchesSource(record: DeepReadonly<import("../../models/index.js").ExtensionRecord>): boolean;
2725
+ rejection(reason: string, value: {
2726
+ assignment: string;
2727
+ epoch: number;
2728
+ }): {
2729
+ decision: "reject";
2730
+ reason: string;
2731
+ source: import("../../models/index.js").ExtensionRecord;
2732
+ };
2733
+ readContribution: (event: import("../../models/index.js").JournalEvent) => {
2734
+ assignment: string;
2735
+ epoch: number;
2736
+ } | undefined;
2737
+ readSource: (source: DeepReadonly<import("../../models/index.js").ExtensionRecord> | null) => {
2738
+ assignment: string;
2739
+ epoch: number;
2740
+ } | undefined;
2741
+ told: import("../../plugin.js").PluginProjection<import("../../kit/extension.js").ToldNotices<{
2742
+ assignment: string;
2743
+ epoch: number;
2744
+ }>>;
2745
+ projection<State>(fold: {
2746
+ key: string;
2747
+ init(): State;
2748
+ apply(state: State, value: {
2749
+ assignment: string;
2750
+ epoch: number;
2751
+ }, event: import("../../models/index.js").JournalEvent<"ext">): State;
2752
+ onFork?: "inherit" | "reset";
2753
+ }): import("../../plugin.js").PluginProjection<State>;
2754
+ };
2755
+ /** The attempt that is `step`'s `ordinal`th entry. */
2756
+ export declare const attemptId: (instance: string, step: string, ordinal: number) => string;
2757
+ export declare const assignmentId: (attempt: string, participant: string) => string;
2758
+ /** The conversation generation `participant` runs on: 1, then one more for each restart a decision recorded. */
2759
+ export declare const generationOf: (generations: ReadonlyMap<string, number>, participant: string) => number;
2760
+ /** An attempt's result: an attempt produces at most one. */
2761
+ export declare const resultId: (attempt: string) => string;
2762
+ /** A decision is pending on one attempt for one reason. */
2763
+ export declare const decisionId: (attempt: string, reason: "gate" | "exhaustion" | "recovery") => string;
2764
+ /** The transition a cause makes: each cause makes at most one. */
2765
+ export declare function transitionId(instance: string, cause: TransitionCause): string;
2766
+ /**
2767
+ * The input a transition is written with: the scheduling input of the root assignment it opens,
2768
+ * whose claim activates it, or else the notice telling the root what happened.
2769
+ */
2770
+ export declare const schedulingInputId: (transition: string) => string;
2771
+ /**
2772
+ * The source of the input a transition is written with: the root assignment it schedules, or `null`
2773
+ * for a notice of a transition that gives the root none; and the host decision that made it, if
2774
+ * one did. An identity apart from the assignment's presentation, so a short scheduling input never
2775
+ * counts as the detailed presentation.
2776
+ */
2777
+ export declare const transitionNotice: {
2778
+ record: (value: {
2779
+ transition: string;
2780
+ assignment: string | null;
2781
+ decision: string | null;
2782
+ }) => import("../../models/index.js").ExtensionRecord;
2783
+ parse: (value: {
2784
+ transition: string;
2785
+ assignment: string | null;
2786
+ decision: string | null;
2787
+ }) => {
2788
+ transition: string;
2789
+ assignment: string | null;
2790
+ decision: string | null;
2791
+ };
2792
+ entry: (value: {
2793
+ transition: string;
2794
+ assignment: string | null;
2795
+ decision: string | null;
2796
+ }, options: import("../../plugin.js").AppendOptions) => {
2797
+ type: "ext";
2798
+ data: {
2799
+ plugin: string;
2800
+ instance_id: string;
2801
+ kind: string;
2802
+ version: number;
2803
+ data: z.core.util.JSONType;
2804
+ };
2805
+ options: import("../../plugin.js").AppendOptions;
2806
+ };
2807
+ append(journal: import("../../plugin.js").PluginJournal, value: {
2808
+ transition: string;
2809
+ assignment: string | null;
2810
+ decision: string | null;
2811
+ }, options: import("../../plugin.js").AppendOptions): Promise<import("../../models/index.js").JournalEvent<"ext">>;
2812
+ read(event: import("../../models/index.js").JournalEvent): {
2813
+ transition: string;
2814
+ assignment: string | null;
2815
+ decision: string | null;
2816
+ } | undefined;
2817
+ contribution(message: {
2818
+ role?: import("../../models/index.js").InputRole;
2819
+ content: string | readonly import("../../llm/content.js").ContentPartInput[];
2820
+ }, value: {
2821
+ transition: string;
2822
+ assignment: string | null;
2823
+ decision: string | null;
2824
+ }, options?: {
2825
+ sourceSeqs?: readonly import("../../models/index.js").Seq[];
2826
+ }): import("../../models/index.js").StepContribution;
2827
+ matchesSource(record: DeepReadonly<import("../../models/index.js").ExtensionRecord>): boolean;
2828
+ rejection(reason: string, value: {
2829
+ transition: string;
2830
+ assignment: string | null;
2831
+ decision: string | null;
2832
+ }): {
2833
+ decision: "reject";
2834
+ reason: string;
2835
+ source: import("../../models/index.js").ExtensionRecord;
2836
+ };
2837
+ readContribution: (event: import("../../models/index.js").JournalEvent) => {
2838
+ transition: string;
2839
+ assignment: string | null;
2840
+ decision: string | null;
2841
+ } | undefined;
2842
+ readSource: (source: DeepReadonly<import("../../models/index.js").ExtensionRecord> | null) => {
2843
+ transition: string;
2844
+ assignment: string | null;
2845
+ decision: string | null;
2846
+ } | undefined;
2847
+ told: import("../../plugin.js").PluginProjection<import("../../kit/extension.js").ToldNotices<{
2848
+ transition: string;
2849
+ assignment: string | null;
2850
+ decision: string | null;
2851
+ }>>;
2852
+ projection<State>(fold: {
2853
+ key: string;
2854
+ init(): State;
2855
+ apply(state: State, value: {
2856
+ transition: string;
2857
+ assignment: string | null;
2858
+ decision: string | null;
2859
+ }, event: import("../../models/index.js").JournalEvent<"ext">): State;
2860
+ onFork?: "inherit" | "reset";
2861
+ }): import("../../plugin.js").PluginProjection<State>;
2862
+ };
2863
+ export {};