@earendil-works/pi-durable 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/README.md +287 -82
  3. package/dist/codemode/codemode.d.ts +4 -4
  4. package/dist/codemode/codemode.d.ts.map +1 -1
  5. package/dist/codemode/codemode.js +21 -16
  6. package/dist/codemode/codemode.js.map +1 -1
  7. package/dist/codemode/models.d.ts.map +1 -1
  8. package/dist/codemode/models.js +6 -4
  9. package/dist/codemode/models.js.map +1 -1
  10. package/dist/documents.d.ts +1 -1
  11. package/dist/documents.d.ts.map +1 -1
  12. package/dist/documents.js.map +1 -1
  13. package/dist/env/index.d.ts +12 -10
  14. package/dist/env/index.d.ts.map +1 -1
  15. package/dist/env/index.js.map +1 -1
  16. package/dist/env/node-watch.d.ts +3 -3
  17. package/dist/env/node-watch.d.ts.map +1 -1
  18. package/dist/env/node-watch.js +18 -16
  19. package/dist/env/node-watch.js.map +1 -1
  20. package/dist/env/node.d.ts +2 -2
  21. package/dist/env/node.d.ts.map +1 -1
  22. package/dist/env/node.js +12 -4
  23. package/dist/env/node.js.map +1 -1
  24. package/dist/errors.d.ts +18 -2
  25. package/dist/errors.d.ts.map +1 -1
  26. package/dist/errors.js +26 -3
  27. package/dist/errors.js.map +1 -1
  28. package/dist/harness/agent.d.ts +13 -2
  29. package/dist/harness/agent.d.ts.map +1 -1
  30. package/dist/harness/agent.js +48 -6
  31. package/dist/harness/agent.js.map +1 -1
  32. package/dist/harness/compaction.d.ts +3 -1
  33. package/dist/harness/compaction.d.ts.map +1 -1
  34. package/dist/harness/compaction.js +38 -6
  35. package/dist/harness/compaction.js.map +1 -1
  36. package/dist/harness/context.d.ts +23 -7
  37. package/dist/harness/context.d.ts.map +1 -1
  38. package/dist/harness/context.js +71 -25
  39. package/dist/harness/context.js.map +1 -1
  40. package/dist/harness/define.d.ts +7 -3
  41. package/dist/harness/define.d.ts.map +1 -1
  42. package/dist/harness/define.js +4 -0
  43. package/dist/harness/define.js.map +1 -1
  44. package/dist/harness/generation.d.ts +38 -5
  45. package/dist/harness/generation.d.ts.map +1 -1
  46. package/dist/harness/generation.js +497 -108
  47. package/dist/harness/generation.js.map +1 -1
  48. package/dist/harness/harness.d.ts +7 -2
  49. package/dist/harness/harness.d.ts.map +1 -1
  50. package/dist/harness/harness.js +147 -57
  51. package/dist/harness/harness.js.map +1 -1
  52. package/dist/harness/inbox.d.ts +7 -3
  53. package/dist/harness/inbox.d.ts.map +1 -1
  54. package/dist/harness/inbox.js +7 -4
  55. package/dist/harness/inbox.js.map +1 -1
  56. package/dist/harness/json.d.ts +20 -4
  57. package/dist/harness/json.d.ts.map +1 -1
  58. package/dist/harness/json.js +23 -5
  59. package/dist/harness/json.js.map +1 -1
  60. package/dist/harness/live.d.ts +122 -16
  61. package/dist/harness/live.d.ts.map +1 -1
  62. package/dist/harness/live.js +93 -12
  63. package/dist/harness/live.js.map +1 -1
  64. package/dist/harness/partial-changes.d.ts +54 -0
  65. package/dist/harness/partial-changes.d.ts.map +1 -0
  66. package/dist/harness/partial-changes.js +162 -0
  67. package/dist/harness/partial-changes.js.map +1 -0
  68. package/dist/harness/prompt.d.ts +1 -1
  69. package/dist/harness/prompt.d.ts.map +1 -1
  70. package/dist/harness/prompt.js +1 -1
  71. package/dist/harness/prompt.js.map +1 -1
  72. package/dist/harness/registry-reader.d.ts +11 -0
  73. package/dist/harness/registry-reader.d.ts.map +1 -0
  74. package/dist/harness/registry-reader.js +25 -0
  75. package/dist/harness/registry-reader.js.map +1 -0
  76. package/dist/harness/scheduler.d.ts +86 -14
  77. package/dist/harness/scheduler.d.ts.map +1 -1
  78. package/dist/harness/scheduler.js +1459 -369
  79. package/dist/harness/scheduler.js.map +1 -1
  80. package/dist/harness/submissions.d.ts +23 -11
  81. package/dist/harness/submissions.d.ts.map +1 -1
  82. package/dist/harness/submissions.js +104 -36
  83. package/dist/harness/submissions.js.map +1 -1
  84. package/dist/harness/task-graph.d.ts +28 -8
  85. package/dist/harness/task-graph.d.ts.map +1 -1
  86. package/dist/harness/task-graph.js +85 -36
  87. package/dist/harness/task-graph.js.map +1 -1
  88. package/dist/harness/telemetry.d.ts +307 -0
  89. package/dist/harness/telemetry.d.ts.map +1 -0
  90. package/dist/harness/telemetry.js +136 -0
  91. package/dist/harness/telemetry.js.map +1 -0
  92. package/dist/harness/tool.d.ts +2 -0
  93. package/dist/harness/tool.d.ts.map +1 -1
  94. package/dist/harness/tool.js +223 -61
  95. package/dist/harness/tool.js.map +1 -1
  96. package/dist/harness/transcript.d.ts +72 -0
  97. package/dist/harness/transcript.d.ts.map +1 -0
  98. package/dist/harness/transcript.js +264 -0
  99. package/dist/harness/transcript.js.map +1 -0
  100. package/dist/harness/types.d.ts +302 -48
  101. package/dist/harness/types.d.ts.map +1 -1
  102. package/dist/harness/types.js.map +1 -1
  103. package/dist/harness/util.d.ts +7 -1
  104. package/dist/harness/util.d.ts.map +1 -1
  105. package/dist/harness/util.js +13 -0
  106. package/dist/harness/util.js.map +1 -1
  107. package/dist/harness/view.d.ts +43 -22
  108. package/dist/harness/view.d.ts.map +1 -1
  109. package/dist/harness/view.js +130 -71
  110. package/dist/harness/view.js.map +1 -1
  111. package/dist/index.d.ts +13 -9
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +7 -5
  114. package/dist/index.js.map +1 -1
  115. package/dist/search.d.ts +19 -3
  116. package/dist/search.d.ts.map +1 -1
  117. package/dist/search.js +107 -44
  118. package/dist/search.js.map +1 -1
  119. package/dist/session/cached-storage.d.ts +71 -0
  120. package/dist/session/cached-storage.d.ts.map +1 -0
  121. package/dist/session/cached-storage.js +269 -0
  122. package/dist/session/cached-storage.js.map +1 -0
  123. package/dist/session/conversation-tails.d.ts +33 -0
  124. package/dist/session/conversation-tails.d.ts.map +1 -0
  125. package/dist/session/conversation-tails.js +101 -0
  126. package/dist/session/conversation-tails.js.map +1 -0
  127. package/dist/session/keys.d.ts +68 -0
  128. package/dist/session/keys.d.ts.map +1 -0
  129. package/dist/session/keys.js +161 -0
  130. package/dist/session/keys.js.map +1 -0
  131. package/dist/session/session.d.ts +181 -29
  132. package/dist/session/session.d.ts.map +1 -1
  133. package/dist/session/session.js +1073 -183
  134. package/dist/session/session.js.map +1 -1
  135. package/dist/session/transaction.d.ts +86 -4
  136. package/dist/session/transaction.d.ts.map +1 -1
  137. package/dist/session/transaction.js +250 -38
  138. package/dist/session/transaction.js.map +1 -1
  139. package/dist/session/writer.d.ts +74 -0
  140. package/dist/session/writer.d.ts.map +1 -0
  141. package/dist/session/writer.js +294 -0
  142. package/dist/session/writer.js.map +1 -0
  143. package/dist/storage/indexeddb.d.ts +68 -0
  144. package/dist/storage/indexeddb.d.ts.map +1 -0
  145. package/dist/storage/indexeddb.js +881 -0
  146. package/dist/storage/indexeddb.js.map +1 -0
  147. package/dist/storage/jsonl/storage.d.ts +30 -2
  148. package/dist/storage/jsonl/storage.d.ts.map +1 -1
  149. package/dist/storage/jsonl/storage.js +88 -24
  150. package/dist/storage/jsonl/storage.js.map +1 -1
  151. package/dist/storage/memory.d.ts +7 -2
  152. package/dist/storage/memory.d.ts.map +1 -1
  153. package/dist/storage/memory.js +29 -3
  154. package/dist/storage/memory.js.map +1 -1
  155. package/dist/storage/sqlite/cloudflare.d.ts +2 -51
  156. package/dist/storage/sqlite/cloudflare.d.ts.map +1 -1
  157. package/dist/storage/sqlite/cloudflare.js +2 -133
  158. package/dist/storage/sqlite/cloudflare.js.map +1 -1
  159. package/dist/storage/sqlite/database.d.ts +1 -36
  160. package/dist/storage/sqlite/database.d.ts.map +1 -1
  161. package/dist/storage/sqlite/database.js.map +1 -1
  162. package/dist/storage/sqlite/index.d.ts +1 -1
  163. package/dist/storage/sqlite/index.d.ts.map +1 -1
  164. package/dist/storage/sqlite/index.js.map +1 -1
  165. package/dist/storage/sqlite/migrations.d.ts +2 -5
  166. package/dist/storage/sqlite/migrations.d.ts.map +1 -1
  167. package/dist/storage/sqlite/migrations.js +28 -28
  168. package/dist/storage/sqlite/migrations.js.map +1 -1
  169. package/dist/storage/sqlite/node.d.ts +2 -37
  170. package/dist/storage/sqlite/node.d.ts.map +1 -1
  171. package/dist/storage/sqlite/node.js +3 -174
  172. package/dist/storage/sqlite/node.js.map +1 -1
  173. package/dist/storage/sqlite/schema.d.ts +1 -3
  174. package/dist/storage/sqlite/schema.d.ts.map +1 -1
  175. package/dist/storage/sqlite/schema.js +2 -9
  176. package/dist/storage/sqlite/schema.js.map +1 -1
  177. package/dist/storage/sqlite/storage.d.ts +15 -3
  178. package/dist/storage/sqlite/storage.d.ts.map +1 -1
  179. package/dist/storage/sqlite/storage.js +110 -36
  180. package/dist/storage/sqlite/storage.js.map +1 -1
  181. package/dist/storage/store/commit.d.ts +33 -0
  182. package/dist/storage/store/commit.d.ts.map +1 -0
  183. package/dist/storage/store/commit.js +286 -0
  184. package/dist/storage/store/commit.js.map +1 -0
  185. package/dist/storage/store/documents.d.ts +43 -0
  186. package/dist/storage/store/documents.d.ts.map +1 -0
  187. package/dist/storage/store/documents.js +102 -0
  188. package/dist/storage/store/documents.js.map +1 -0
  189. package/dist/storage/store/index.d.ts +2 -0
  190. package/dist/storage/store/index.d.ts.map +1 -0
  191. package/dist/storage/store/index.js +2 -0
  192. package/dist/storage/store/index.js.map +1 -0
  193. package/dist/storage/store/queries.d.ts +49 -0
  194. package/dist/storage/store/queries.d.ts.map +1 -0
  195. package/dist/storage/store/queries.js +93 -0
  196. package/dist/storage/store/queries.js.map +1 -0
  197. package/dist/storage/store/storage.d.ts +59 -0
  198. package/dist/storage/store/storage.d.ts.map +1 -0
  199. package/dist/storage/store/storage.js +438 -0
  200. package/dist/storage/store/storage.js.map +1 -0
  201. package/dist/storage/store/tables.d.ts +54 -0
  202. package/dist/storage/store/tables.d.ts.map +1 -0
  203. package/dist/storage/store/tables.js +108 -0
  204. package/dist/storage/store/tables.js.map +1 -0
  205. package/dist/testing/commit-writes.d.ts +5 -0
  206. package/dist/testing/commit-writes.d.ts.map +1 -0
  207. package/dist/testing/commit-writes.js +12 -0
  208. package/dist/testing/commit-writes.js.map +1 -0
  209. package/dist/testing/env-conformance.js +7 -7
  210. package/dist/testing/env-conformance.js.map +1 -1
  211. package/dist/testing/index.d.ts +1 -0
  212. package/dist/testing/index.d.ts.map +1 -1
  213. package/dist/testing/index.js +1 -0
  214. package/dist/testing/index.js.map +1 -1
  215. package/dist/testing/storage-benchmark.d.ts.map +1 -1
  216. package/dist/testing/storage-benchmark.js +18 -17
  217. package/dist/testing/storage-benchmark.js.map +1 -1
  218. package/dist/testing/storage-conformance.d.ts.map +1 -1
  219. package/dist/testing/storage-conformance.js +369 -67
  220. package/dist/testing/storage-conformance.js.map +1 -1
  221. package/dist/timers.d.ts +21 -0
  222. package/dist/timers.d.ts.map +1 -0
  223. package/dist/timers.js +72 -0
  224. package/dist/timers.js.map +1 -0
  225. package/dist/tool-search/tool-search.d.ts +6 -12
  226. package/dist/tool-search/tool-search.d.ts.map +1 -1
  227. package/dist/tool-search/tool-search.js +7 -7
  228. package/dist/tool-search/tool-search.js.map +1 -1
  229. package/dist/tools/bash.d.ts +12 -12
  230. package/dist/tools/bash.d.ts.map +1 -1
  231. package/dist/tools/bash.js +16 -15
  232. package/dist/tools/bash.js.map +1 -1
  233. package/dist/tools/edit.d.ts +7 -7
  234. package/dist/tools/edit.d.ts.map +1 -1
  235. package/dist/tools/edit.js +9 -9
  236. package/dist/tools/edit.js.map +1 -1
  237. package/dist/tools/index.d.ts +32 -32
  238. package/dist/tools/read.d.ts +6 -6
  239. package/dist/tools/read.d.ts.map +1 -1
  240. package/dist/tools/read.js +19 -8
  241. package/dist/tools/read.js.map +1 -1
  242. package/dist/tools/write.d.ts +4 -4
  243. package/dist/tools/write.d.ts.map +1 -1
  244. package/dist/tools/write.js +5 -5
  245. package/dist/tools/write.js.map +1 -1
  246. package/dist/types.d.ts +331 -64
  247. package/dist/types.d.ts.map +1 -1
  248. package/dist/types.js.map +1 -1
  249. package/package.json +27 -10
  250. package/dist/harness/events.d.ts +0 -186
  251. package/dist/harness/events.d.ts.map +0 -1
  252. package/dist/harness/events.js +0 -373
  253. package/dist/harness/events.js.map +0 -1
  254. package/dist/session/observation.d.ts +0 -42
  255. package/dist/session/observation.d.ts.map +0 -1
  256. package/dist/session/observation.js +0 -281
  257. package/dist/session/observation.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,KAAK,EACX,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,KAAK,EACL,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EACX,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,IAAI,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,EACT,EAAE,EACF,WAAW,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,6DAA6D;AAC7D,MAAM,MAAM,QAAQ,GAAG;IACtB,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AC;QAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;QACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;QACtC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;KAC/B,EACD,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,GACd,UAAU,CAAC;QAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AttachedReplicatedState, Context, JsonValue } from \"@earendil-works/chord\";\nimport type {\n\tAssistantMessage,\n\tCacheRetention,\n\tMessage,\n\tModels,\n\tModelThinkingLevel,\n\tStatic,\n\tTool,\n\tToolCall,\n\tToolResultMessage,\n\tTransport,\n\tTSchema,\n\tUsage,\n\tUserMessage,\n} from \"@earendil-works/pi-ai\";\nimport type { ExecutionEnv, ShellOutputSkip, ShellOutputWindow } from \"../env/index.ts\";\nimport type {\n\tConversationId,\n\tConversationOwnership,\n\tConversationRecord,\n\tCursor,\n\tDocumentObserver,\n\tDocumentReader,\n\tEntryDraft,\n\tEntryId,\n\tEntryQuery,\n\tEntryRecord,\n\tJsonObject,\n\tPage,\n\tSession,\n\tSubmissionId,\n\tSubmissionRecord,\n\tTask,\n\tTaskId,\n\tTaskOptions,\n\tTaskRecord,\n\tTaskState,\n\tTx,\n\tWatchHandle,\n} from \"../types.ts\";\nimport type { TaskGraph, TaskGraphWatch } from \"./task-graph.ts\";\nimport type { UsageState } from \"./usage.ts\";\nimport type { ConversationView } from \"./view.ts\";\n\n/** Provider and model ID resolved through pi-ai `Models`. */\nexport type ModelRef = {\n\treadonly provider: string;\n\treadonly modelId: string;\n};\n\nexport type UserInput = UserMessage[\"content\"];\n\n/**\n * The entry an input is placed as, instead of `pi.user`: an application kind, and data the transcript shows, such as its\n * author. Its model message is still the input's user message.\n */\nexport type InputEntry = { readonly kind: string; readonly data?: JsonValue };\n\n/** Host submission: user input that may start a run, or a passive entry write. */\nexport type SubmissionDraft = {\n\treadonly requestId?: string;\n} & (\n\t| {\n\t\t\treadonly type: \"input\";\n\t\t\treadonly content: UserInput;\n\t\t\treadonly whenBusy?: \"steer\" | \"followUp\" | \"reject\";\n\t\t\t/** Place the input as this entry; default `pi.user` without data. The kind must not start with `pi.`. */\n\t\t\treadonly entry?: InputEntry;\n\t }\n\t| {\n\t\t\treadonly type: \"write\";\n\t\t\treadonly entry: EntryDraft;\n\t\t\treadonly content?: never;\n\t\t\treadonly whenBusy?: never;\n\t }\n);\n\nexport type InputSubmissionDraft = Extract<SubmissionDraft, { readonly type: \"input\" }>;\n\nexport type SettledSubmissionRecord = SubmissionRecord & {\n\treadonly status: \"done\" | \"unanswered\";\n};\n\n/** Awaitable host object for one durably admitted submission. */\nexport interface Submission {\n\treadonly id: SubmissionId;\n\tstatus(context: Context): Promise<SubmissionRecord>;\n\twait(context: Context): Promise<SettledSubmissionRecord>;\n\tabort(context: Context): Promise<\"aborted\" | \"already_placed\" | \"settled\">;\n}\n\nexport type SettledTask<R> = TaskRecord<JsonValue, JsonValue, R> & {\n\treadonly state: Extract<TaskState<JsonValue, R>, { readonly status: \"terminal\" }>;\n};\n\n/** Erased executable task definition stored in the registry. */\nexport type AnyTask = {\n\treadonly definition: {\n\t\treadonly name: string;\n\t\treadonly version: number;\n\t\treadonly initial: unknown;\n\t\treadonly phases: Readonly<Record<string, unknown>>;\n\t\treadonly abort: unknown;\n\t\treadonly migrate?: unknown;\n\t\treadonly hooks?: object;\n\t};\n};\n\n/** Options of `Conversation.abort()`. */\nexport type ConversationAbortOptions = {\n\t/**\n\t * Cross background boundaries: mark every live task reached ignoring the background flag when the abort is admitted,\n\t * withdraw the queued inputs of every conversation reached, and wait until those tasks are terminal and the\n\t * conversation is ordinarily idle. Background work created afterwards is neither marked nor awaited.\n\t */\n\treadonly background?: boolean;\n};\n\n/** Hook handler map declared by a task definition. */\nexport type HooksOf<K> = K extends Task<infer _I, infer _S, infer _R, infer H> ? H : never;\n\n/**\n * Invocation-bound conversation operations for tasks and tools. Rejects after the invocation ends; passive entries are\n * written with ordinary transaction writes instead.\n */\nexport interface ConversationHandle {\n\treadonly id: ConversationId;\n\tsubmit(submission: InputSubmissionDraft, context: Context): Promise<Submission>;\n\t/** `Conversation.abort()`: withdraw queued inputs, abort the ordinary ownership scope, and wait until it is idle. */\n\tabort(context: Context, options?: ConversationAbortOptions): Promise<void>;\n\t/** Resolve when the conversation's ordinary ownership scope has no live non-background task. */\n\twaitForIdle(context: Context): Promise<void>;\n}\n\n/** Post-tools controls requested by a tool result. */\nexport type ToolControl = {\n\treadonly addTools?: readonly string[];\n\treadonly terminate?: true;\n\treadonly handoff?: string;\n};\n\n/** Remark about a call for the model and the UI, such as truncation or a spill path; never part of the tool's data. */\nexport type ToolDiagnostic = {\n\treadonly severity: \"info\" | \"warn\" | \"error\";\n\treadonly message: string;\n\treadonly code?: string;\n};\n\n/**\n * What a tool returns, on three channels: `output` for the model, `structuredOutput` for programs that call the tool\n * (`executeTool()` callers, code mode scripts), and `details` for UIs.\n */\nexport type ToolExecutionResult<TDetails extends JsonValue = JsonValue> = {\n\t/** For the model. Omitted: the retained `output()` text. */\n\treadonly output?: ToolResultMessage[\"content\"];\n\t/**\n\t * For programs. Required unless `isError` when the tool declares `structuredOutputSchema`, and validated against it;\n\t * not allowed without one, where programs get the output itself (`NestedToolExecutionResult.structuredOutput`).\n\t */\n\treadonly structuredOutput?: JsonValue;\n\treadonly isError?: boolean;\n\t/** Omitted: the last `details()` value becomes the details. */\n\treadonly details?: TDetails;\n\t/** Added after those recorded through `api.diagnostic()`. */\n\treadonly diagnostics?: readonly ToolDiagnostic[];\n\t/** Spend of the execution itself, such as a model call; stored on the result and in `pi.usage.tools`. */\n\treadonly usage?: Usage;\n\treadonly control?: ToolControl;\n};\n\n/**\n * Result of a nested call, as `executeTool()` returns it. Programs read `structuredOutput`; the output for the model\n * is not kept, and `control` does not apply.\n */\nexport type NestedToolExecutionResult = {\n\t/** The nested call's tool task. */\n\treadonly taskId: TaskId;\n\t/**\n\t * The tool's value for programs. A tool with `structuredOutputSchema`: its validated `structuredOutput`, also on an\n\t * error result that has one; absent otherwise, and an error's text is then in an error diagnostic. A tool without:\n\t * its bounded output, success or error, as a string for one text item, an `ImageContent` for one image, `\"\"` for\n\t * none, and the content list otherwise. Absent on an error result the Harness wrote itself (unavailable, invalid,\n\t * blocked, interrupted, aborted); `diagnostics` say what went wrong.\n\t */\n\treadonly structuredOutput?: JsonValue;\n\treadonly isError: boolean;\n\treadonly details?: JsonValue;\n\treadonly diagnostics: readonly ToolDiagnostic[];\n\treadonly usage?: Usage;\n\t/** Execution time of the attempt that produced the result; absent when it never executed. */\n\treadonly durationMs?: number;\n};\n\n/** Whether the tools of one round run at once or one after another in call order. */\nexport type ToolExecutionMode = \"parallel\" | \"sequential\";\n\n/** How many queued items of one mode a boundary places: the first, or all of them. */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/**\n * Operations available to one tool invocation. A plain object, so a wrapper can spread it. Every operation rejects after\n * the invocation ends.\n */\nexport interface ToolExecutionApi<TDetails extends JsonValue = JsonValue> extends DocumentObserver, DocumentReader {\n\treadonly taskId: TaskId;\n\treadonly conversationId: ConversationId;\n\treadonly callId: string;\n\t/** The tool task's phase snapshot. */\n\treadonly registry: RegistrySnapshot;\n\t/** The calling conversation's agent, as the tool task's phase resolved it. */\n\tagent(context: Context): Promise<Agent>;\n\t/** `HarnessOptions.models`: the catalog, credentials, and request transforms generation uses. */\n\treadonly models: Models;\n\t/** Built by `HarnessOptions.env` for this call; `undefined` without an environment. */\n\treadonly env: ExecutionEnv | undefined;\n\t/**\n\t * Append running output; it becomes the result's `output` when the result omits it. `skipped` counts output\n\t * omitted before the chunk, as reported by an environment given `outputWindow` (`ShellOutputInfo.skipped`).\n\t */\n\toutput(chunk: string | Uint8Array, skipped?: ShellOutputSkip): void;\n\t/**\n\t * The tail this call's output keeps and the pace of its progress commits, for `ShellExecOptions.window`; `undefined`\n\t * when the tool keeps the head of its output, which cannot accept skips. A wrapper that replaces `output` and\n\t * transforms text must also replace this with `undefined`, so skipped text cannot bypass its transform.\n\t */\n\treadonly outputWindow: ShellOutputWindow | undefined;\n\t/**\n\t * The output retained so far, as the model will see it when the result omits `output`, and whether earlier output was\n\t * dropped; for a tool that also returns that text in its `structuredOutput`.\n\t */\n\tretainedOutput(): { readonly text: string; readonly truncated: boolean };\n\t/** Record a model-visible remark about this call. */\n\tdiagnostic(diagnostic: ToolDiagnostic): void;\n\t/** Replace running details; the last value becomes the result details when the result omits `details`. */\n\tdetails(value: TDetails, context: Context): Promise<void>;\n\tcommit<T>(change: (tx: Tx) => T | Promise<T>, context: Context): Promise<T>;\n\tmemo<T extends JsonValue>(name: string, context: Context): Promise<T | undefined>;\n\tmemo<T extends JsonValue>(name: string, candidate: T, context: Context): Promise<T>;\n\t/**\n\t * Create a task in one commit. A child task of a tool that is not replay-safe defaults to `abandonOnRestart`: the\n\t * tool never resumes after a restart, so nothing awaits the child then.\n\t */\n\tcreateTask<I, S extends { phase: string }, R, H extends object>(\n\t\ttask: Task<I, S, R, H>,\n\t\tinput: I,\n\t\toptions: Omit<TaskOptions, \"conversationId\">,\n\t\tcontext: Context,\n\t): Promise<TaskId<R>>;\n\tgetTask<R>(id: TaskId<R>, context: Context): Promise<TaskRecord<JsonValue, JsonValue, R> | undefined>;\n\twaitForTask<R>(id: TaskId<R>, context: Context): Promise<SettledTask<R>>;\n\t/** Invocation-bound handle of an existing conversation, such as one this tool created in `commit()`. */\n\tconversation(id: ConversationId, context: Context): Promise<ConversationHandle | undefined>;\n\t/**\n\t * Run tool `name` as a nested call of this one and wait for its result. The nested call is its own `pi.tool` task,\n\t * owned by this call: it resolves the tool among the conversation's tools, validates, runs the `ToolTask` hooks (which\n\t * see `call.parent`), applies output limits and the tool's replay policy, and reports progress in `pi.live.nestedTools`.\n\t * Its result returns here instead of entering the transcript. A call that is blocked, invalid, throws, is interrupted,\n\t * or is aborted returns an `isError` result.\n\t *\n\t * The nested call's key names it within this call; its call ID is `<callId>/<key>`. By default the key is the call's\n\t * position among this invocation's nested calls, `1`, `2`, ... An explicit `key` must be non-empty, without `/`, not\n\t * `__proto__`, and not a positive integer, so it never collides with a default one. A rerun of a replay-safe tool\n\t * that makes a call with a used key, by calling in the same order or by passing the same `key`, gets that nested call\n\t * back, finished or still running, instead of starting another. A nested call a crash interrupted before its result\n\t * committed follows its own replay policy, so this is not exactly-once execution. Reusing a key with another tool or\n\t * other arguments throws. A tool that is not replay-safe never reruns: after a restart, its unfinished nested calls\n\t * are abandoned (`TaskOptions.abandonOnRestart`) before they run again.\n\t *\n\t * `progress: false` commits no running output, details, or diagnostics to the nested call's slot, only its status;\n\t * the result still carries its details and diagnostics, and a schema-less tool's output as `structuredOutput`. An\n\t * interrupted or aborted call's result is built from its slot, so it then has none of them. Either way, programs never\n\t * get the partial output of an interrupted or aborted call.\n\t *\n\t * Nested calls run as soon as they are made, whatever their `executionMode`; the caller decides what runs at once by\n\t * what it awaits. Cancelling `context` stops only the wait; the nested call runs on. When this call settles, nested\n\t * calls it left running are aborted first. A nested result's `usage` is already counted under its tool; a result\n\t * that passes it on counts it again. Rejects, instead of returning a result, once `execute()` has returned, when this\n\t * call is aborted, or when the Harness closes.\n\t */\n\texecuteTool(\n\t\tname: string,\n\t\targs: JsonObject,\n\t\tcontext: Context,\n\t\toptions?: { readonly key?: string; readonly progress?: boolean },\n\t): Promise<NestedToolExecutionResult>;\n}\n\n/**\n * Executable tool registered in a registry. Only pi-ai `Tool` fields enter the transcript. `args` are typed by\n * `parameters`, which the Harness validates them against before `execute()`; `defineTool()` infers both generics.\n */\nexport type ToolRegistration<\n\tTParameters extends TSchema = TSchema,\n\tTDetails extends JsonValue = JsonValue,\n> = Tool<TParameters> & {\n\t/** Whether an interrupted execution may rerun on recovery. Default `unsafe`. */\n\treadonly replay?: \"safe\" | \"unsafe\";\n\t/** Default: the settings' `toolExecution`. One sequential call makes its whole round sequential. */\n\treadonly executionMode?: ToolExecutionMode;\n\t/**\n\t * Repair arguments models commonly get wrong before validation, such as a JSON string where an array belongs. Must be\n\t * pure and must not mutate `args`: it runs again when a call is retried before its intent is recorded. Its result is\n\t * still validated against `parameters`.\n\t */\n\tprepareArguments?(args: unknown): Static<TParameters>;\n\t/**\n\t * Schema of `structuredOutput`, which programs that call the tool receive. Omitted: they receive the result's bounded\n\t * output, success or error, as `NestedToolExecutionResult.structuredOutput` describes.\n\t */\n\treadonly structuredOutputSchema?: TSchema;\n\t/**\n\t * Who may call the tool: the model, other tools through `executeTool()`, or both (default). A code mode tool is\n\t * `[\"model\"]`, so scripts cannot start scripts; tools behind code mode, such as MCP tools, can be `[\"tools\"]`, so the\n\t * model is never offered them.\n\t */\n\treadonly callers?: readonly (\"model\" | \"tools\")[];\n\t/**\n\t * Not offered to the model until loaded: the model gets the tool only when `modelTools` names it, in its array or its\n\t * `add`, which `control.addTools` (from a tool such as `tool_search`) writes. Other tools can call it any time.\n\t */\n\treadonly deferred?: true;\n\treadonly outputLimits?: {\n\t\treadonly maxBytes?: number;\n\t\treadonly maxLines?: number;\n\t\treadonly retain?: \"head\" | \"tail\";\n\t};\n\texecute(\n\t\targs: Static<TParameters>,\n\t\tapi: ToolExecutionApi<TDetails>,\n\t\tcontext: Context,\n\t): Promise<ToolExecutionResult<TDetails>>;\n};\n\n/** Input to system prompt section rendering for one request preparation. */\nexport type PromptInput<Tool extends ToolRegistration = ToolRegistration> = {\n\treadonly conversationId: ConversationId;\n\t/** The request's resolution; `agent.tools` are the tools offered in this request. */\n\treadonly agent: Agent<Tool>;\n\t/** Built by `HarnessOptions.env` for this preparation; `undefined` without an environment. */\n\treadonly env: ExecutionEnv | undefined;\n\t/** Sections already in effect after replaying the active transcript. */\n\treadonly shown: Readonly<Record<string, string>>;\n\t/** Committed document reads. */\n\treadonly read: DocumentReader;\n};\n\n/** One system prompt section; the agent's sections render in order before each request. */\nexport type PromptSection<Tool extends ToolRegistration = ToolRegistration> = {\n\treadonly key: string;\n\trender(input: PromptInput<Tool>, context: Context): string | undefined | Promise<string | undefined>;\n\t/** Default true: wrap the text as `<key>\\n...\\n</key>`. */\n\treadonly tag?: boolean;\n};\n\n/** Built by `hook()`; matches tasks by name. */\nexport type HookRegistration = { readonly task: string; readonly handlers: object };\n\n/** Built by `wrapTool()` and `wrapSection()`; targets a tool name or a section key. Wrappers are pure. */\nexport type Wrap<Tool extends ToolRegistration = ToolRegistration> =\n\t| { readonly tool: string; wrap(tool: Tool): Tool }\n\t| { readonly section: string; wrap(section: PromptSection<Tool>): PromptSection<Tool> };\n\n/** Named bundle of code; installed in a registry and selected by conversations by name. */\nexport interface Extension<Tool extends ToolRegistration = ToolRegistration> {\n\treadonly name: string;\n\treadonly tools?: readonly Tool[];\n\treadonly sections?: readonly PromptSection<Tool>[];\n\treadonly hooks?: readonly HookRegistration[];\n\t/** Apply where this extension is selected, in order. */\n\treadonly wraps?: readonly Wrap<Tool>[];\n\t/** Resolved by name for every task, whichever conversations select this extension. */\n\treadonly tasks?: readonly AnyTask[];\n}\n\n/** Immutable view of one published registry state. */\nexport interface RegistrySnapshot<Tool extends ToolRegistration = ToolRegistration> {\n\tinstalled(): readonly Extension<Tool>[];\n\textension(name: string): Extension<Tool> | undefined;\n\t/** Every installed tool with its extension, in install order. Names may repeat across extensions. */\n\ttools(): readonly { readonly extension: Extension<Tool>; readonly tool: Tool }[];\n\tsections(): readonly { readonly extension: Extension<Tool>; readonly section: PromptSection<Tool> }[];\n\t/** Built-in and installed task definitions. */\n\ttasks(): readonly AnyTask[];\n\ttask(name: string): AnyTask | undefined;\n}\n\n/** Read side of a registry consumed by a Harness. */\nexport interface RegistryReader<Tool extends ToolRegistration = ToolRegistration> {\n\t/** Immutable view of the whole current registry. */\n\tsnapshot(): RegistrySnapshot<Tool>;\n\t/** Called synchronously after every publication; wakes the scheduler to reconsider blocked tasks. */\n\tsubscribe(listener: () => void): () => void;\n}\n\n/** Application-owned registry of extensions. */\nexport interface Registry<Tool extends ToolRegistration = ToolRegistration> extends RegistryReader<Tool> {\n\t/** Install `extension`, or replace the installed extension with its name in place. Publishes at once. */\n\tinstall(extension: Extension<Tool>): void;\n\t/** Remove the installed extension with `extension.name`, whichever object it is. A later install appends. */\n\tuninstall(extension: Extension): void;\n}\n\n/** Stored choices of one conversation; names, not objects. Unset fields follow the host. */\nexport type AgentState = {\n\tmodel?: ModelRef;\n\tthinkingLevel?: ModelThinkingLevel;\n\t/** An array selects exactly these extensions, in order. An object edits the host default selection. */\n\textensions?: string[] | { add?: string[]; remove?: string[] };\n\t/** Filters the selected extensions' tools: the enabled tools. An array enables exactly these, in order. */\n\ttools?: string[] | { remove: string[] };\n\t/**\n\t * Filters the enabled tools the model may call (`callers` includes `model`): the tools offered to it. Never widens:\n\t * other tools can still call the ones it leaves out.\n\t * - Unset: every such tool except deferred ones.\n\t * - An array: exactly these, in order, deferred ones too.\n\t * - An object: every such tool except deferred ones and those in `remove`, in registry order, followed by the\n\t * deferred tools in `add` that are not in `remove`, in `add` order. Names of tools that are not deferred or not\n\t * registered have no effect in `add`.\n\t */\n\tmodelTools?: string[] | { remove?: string[]; add?: string[] };\n\t/** Rendered after every extension section, as the section `instructions`. */\n\tinstructions?: string;\n\t/** Directory within the environment's file system, passed to `HarnessOptions.env`. */\n\tcwd?: string;\n};\n\n/** A change to `pi.agent`: a given field replaces the stored one, `null` clears it, `undefined` changes nothing. */\nexport type AgentChange = {\n\treadonly model?: ModelRef | null;\n\treadonly thinkingLevel?: ModelThinkingLevel | null;\n\treadonly extensions?:\n\t\t| readonly Extension[]\n\t\t| { readonly add?: readonly Extension[]; readonly remove?: readonly Extension[] }\n\t\t| null;\n\treadonly tools?: readonly ToolRegistration[] | { readonly remove: readonly ToolRegistration[] } | null;\n\t/** Replaces the stored filter as a whole; tools loaded with `control.addTools` are in its `add`. */\n\treadonly modelTools?:\n\t\t| readonly ToolRegistration[]\n\t\t| { readonly remove?: readonly ToolRegistration[]; readonly add?: readonly ToolRegistration[] }\n\t\t| null;\n\treadonly instructions?: string | null;\n\treadonly cwd?: string | null;\n};\n\n/** A conversation's agent resolved against a registry snapshot and the settings. */\nexport type Agent<Tool extends ToolRegistration = ToolRegistration> = {\n\treadonly model?: ModelRef;\n\treadonly thinkingLevel: ModelThinkingLevel;\n\treadonly extensions: readonly Extension<Tool>[];\n\t/** The tools a request offers, in order: enabled, callable by the model, and selected by `modelTools`. */\n\treadonly tools: readonly Tool[];\n\t/** The tools nested calls (`executeTool()`) resolve among, in order: enabled and callable by tools. */\n\treadonly callable: readonly Tool[];\n\t/** Enabled deferred tools the model may call and is not offered yet, in registry order: what `tool_search` loads. */\n\treadonly deferred: readonly Tool[];\n\t/** Extension sections, then `instructions` when set. */\n\treadonly sections: readonly PromptSection<Tool>[];\n\treadonly instructions?: string;\n\treadonly cwd?: string;\n};\n\n/**\n * Runs inside the creating commit, after the creation hook and the `agent` change. The conversation creation is already\n * a table write, so table reads here throw `ReadAfterWrite`; document access remains available.\n */\nexport type ConversationInit = (tx: Tx, conversationId: ConversationId) => void | Promise<void>;\n\nexport type ConversationCreateOptions = {\n\treadonly ownership: ConversationOwnership;\n\t/** Applied in the creating commit after the creation hook's copy, before `init`. */\n\treadonly agent?: AgentChange;\n\treadonly init?: ConversationInit;\n};\n\n/** Curated pi-ai request options; absent fields use pi-ai defaults. */\nexport type ConversationStreamOptions = {\n\ttransport?: Transport;\n\ttimeoutMs?: number;\n\t/** Provider/SDK retries inside one request attempt. */\n\tmaxRetries?: number;\n\tmaxRetryDelayMs?: number;\n\theaders?: Record<string, string>;\n\tmetadata?: JsonObject;\n\tcacheRetention?: CacheRetention;\n\tdeferred?: boolean | { window?: \"15m\" | \"1h\" | \"24h\" };\n};\n\n/** Durable generation attempt retries; the JSON shape of pi-ai `RetryPolicy`. */\nexport type ConversationRetryPolicy = {\n\tenabled: boolean;\n\tmaxRetries: number;\n\tbaseDelayMs: number;\n\tmaxAgentDelayMs?: number;\n};\n\n/** Automatic compaction thresholds (spec §8.7); manual compaction ignores `enabled`. */\nexport type CompactionPolicy = {\n\t/** Threshold and overflow compaction. */\n\tenabled: boolean;\n\t/** Room kept free for the answer: generation blocks to compact above `contextWindow - reserveTokens`. */\n\treserveTokens: number;\n\t/** Approximate size of the recent context a summary keeps verbatim. */\n\tkeepRecentTokens: number;\n\t/** Background compaction starts `backgroundTokens` below the blocking threshold; `0` disables it. */\n\tbackgroundTokens: number;\n};\n\n/**\n * How often running progress is committed. Each progress commit is a storage write; a host whose storage is remote can\n * commit less often, so live answers and tool output appear in larger steps.\n */\nexport type ProgressPolicy = {\n\t/** Minimum pause between commits of the answer being generated. */\n\tpartialIntervalMs: number;\n\t/** Minimum pause between commits of running tool output; large commits also pause in proportion to their size. */\n\toutputIntervalMs: number;\n};\n\n/** Why a compaction runs: `compact()`, a threshold in generation preparation, or a context overflow. */\nexport type CompactionReason = \"manual\" | \"threshold\" | \"overflow\";\n\n/**\n * `entryId` of a blocking compaction's summary, or the `submissionId` of a conversation-owned compaction's summary\n * write; both absent when nothing was compacted.\n */\nexport type CompactionResult = { entryId?: EntryId; submissionId?: SubmissionId };\n\n/** Harness-wide run policy. Read at every resolution and never copied; getters are fine. Synchronous: some readers run on the Session line. */\nexport type HarnessSettings = {\n\t/** Default extension selection; absent: every installed extension, in install order. */\n\treadonly extensions?: readonly Extension[];\n\treadonly stream?: ConversationStreamOptions;\n\treadonly retry?: Partial<ConversationRetryPolicy>;\n\treadonly compaction?: Partial<CompactionPolicy>;\n\treadonly progress?: Partial<ProgressPolicy>;\n\treadonly toolExecution?: ToolExecutionMode;\n\treadonly steeringMode?: QueueMode;\n\treadonly followUpMode?: QueueMode;\n\t/**\n\t * How long an idle conversation keeps its last context read in memory, so its next run reads only newer entries.\n\t * Busy conversations always keep it; `0` drops it once the conversation is idle.\n\t */\n\treadonly contextRetentionMs?: number;\n\t/**\n\t * How long a loaded document that no watch or document state observes stays in memory after its last read or write;\n\t * the next access loads it from Storage. Observed documents always stay. Default ten minutes; `0` drops one right\n\t * after use; `Infinity` keeps them. Anything else that is not a number of milliseconds means the default.\n\t */\n\treadonly documentRetentionMs?: number;\n};\n\n/** Resolved settings: every field over its built-in default, object fields merged. */\nexport type Settings = {\n\t/** Absent: every installed extension, in install order. */\n\treadonly extensions?: readonly Extension[];\n\treadonly stream: ConversationStreamOptions;\n\treadonly retry: ConversationRetryPolicy;\n\treadonly compaction: CompactionPolicy;\n\treadonly progress: ProgressPolicy;\n\treadonly toolExecution: ToolExecutionMode;\n\treadonly steeringMode: QueueMode;\n\treadonly followUpMode: QueueMode;\n\treadonly contextRetentionMs: number;\n\treadonly documentRetentionMs: number;\n};\n\n/** What `HarnessOptions.env` builds an environment for. */\nexport type EnvTarget = {\n\treadonly conversationId: ConversationId;\n\t/** The conversation's agent `cwd`. */\n\treadonly cwd?: string;\n\treadonly read: DocumentReader;\n};\n\nexport type HarnessOptions<Tool extends ToolRegistration = ToolRegistration> = {\n\t/** pi-ai model access used by generation. */\n\treadonly models: Models;\n\treadonly registry: RegistryReader<Tool>;\n\treadonly settings?: HarnessSettings;\n\t/** Builds a conversation's environment at each use. Never called on the Session line; may be async. */\n\treadonly env?: (target: EnvTarget, context: Context) => ExecutionEnv | undefined | Promise<ExecutionEnv | undefined>;\n\t/**\n\t * Runs in every commit that creates or forks a conversation, raw `tx.createConversation()` included, after the\n\t * built-in `pi.*` documents and before the conveniences apply `agent` and run `init`. A fork already has its copies.\n\t * Table reads throw `ReadAfterWrite`, as in `init`; a throw fails the creating commit.\n\t */\n\treadonly conversationCreated?: (tx: Tx, conversation: ConversationRecord) => void | Promise<void>;\n\treadonly now?: () => number;\n\t/**\n\t * Receives failures that do not fail the calling operation, such as a throwing hook or listener, and the error that\n\t * fails the Session, once. Its own throw or rejection is dropped.\n\t */\n\treadonly onReport?: (error: unknown) => void;\n};\n\n/** Live task and what the scheduler would do with it under the current registry. */\nexport type TaskInspection = {\n\treadonly record: TaskRecord<JsonValue, JsonValue, JsonValue>;\n\treadonly state: /** An invocation is active. */\n\t\t| { readonly kind: \"running\" }\n\t\t/** The next scheduling pass reserves it; `migrates` when its definition is newer and has `migrate`. */\n\t\t| { readonly kind: \"ready\"; readonly migrates: boolean }\n\t\t/**\n\t\t * Waits for these live tasks: the live part of its `on`, or, when abort-marked, its live ordinary owned work, which\n\t\t * must end before its abort handler starts.\n\t\t */\n\t\t| { readonly kind: \"waiting\"; readonly on: readonly TaskId[] }\n\t\t/** Outcome held until its ordinary owned work drains. */\n\t\t| { readonly kind: \"completing\" }\n\t\t/** No registered definition can take it; aborting it settles it as `orphaned`. */\n\t\t| {\n\t\t\t\treadonly kind: \"blocked\";\n\t\t\t\treadonly reason: \"missing_task\" | \"task_too_old\" | \"migration_failed\";\n\t\t\t\treadonly error?: unknown;\n\t\t };\n};\n\n/** Point-in-time view of live work: unfinished tasks and submissions, read on the Session line. */\nexport type HarnessInspection = {\n\treadonly scheduling: \"paused\" | \"running\" | \"closing\";\n\treadonly tasks: readonly TaskInspection[];\n\t/** Queued and placed submissions, in ID order. */\n\treadonly submissions: readonly SubmissionRecord[];\n};\n\n/** Raw active transcript and derived model context. */\nexport type ContextView = {\n\t/** Newest applicable head marker, if any. */\n\treadonly head: EntryRecord | undefined;\n\t/** Raw active entries: the head marker followed by non-head entries from its head through the tail. */\n\treadonly entries: readonly EntryRecord[];\n\t/** Per entry of `entries`, its model messages after edits and excluded stop reasons, before tool result ordering. */\n\treadonly contributions: readonly (readonly Message[])[];\n\t/** Model context for the next provider request. */\n\treadonly messages: readonly Message[];\n};\n\n/** Stateless handle for one conversation, bound to the Harness that returned it. Compare handles by `id`. */\nexport interface Conversation {\n\treadonly id: ConversationId;\n\n\t/** Resolved with the current registry snapshot and settings. */\n\tagent(context: Context): Promise<Agent>;\n\t/** `configure()` in its own commit. */\n\tconfigure(change: AgentChange, context: Context): Promise<void>;\n\n\t/**\n\t * Durably admit user input or a passive entry write. A busy conversation, or one with queued items, queues input and\n\t * writes that affect model context in `pi.inbox`; `whenBusy: \"reject\"` rejects input with `ConversationBusy` instead\n\t * and writes nothing. A write of only `kind` and `data` (no `model`, `head`, or `edits`) is appended at once,\n\t * even mid-run, as it changes nothing the model sees.\n\t */\n\tsubmit(submission: SubmissionDraft, context: Context): Promise<Submission>;\n\t/**\n\t * Admit a write of a `pi.reset` entry that starts a new context, carrying `handoff` as a user message when given.\n\t * Resolves after admission; while busy, it is placed at the next boundary.\n\t */\n\treset(handoff: string | undefined, context: Context): Promise<void>;\n\t/**\n\t * Admit a manual compaction task and return its ID. It summarizes while the conversation keeps working and places its\n\t * summary through a write submission: at once when idle, otherwise at the next boundary (spec §8.7).\n\t */\n\tcompact(instructions: string | undefined, context: Context): Promise<TaskId<CompactionResult>>;\n\n\t/** Session commit whose `tx.createTask()` defaults to this conversation. */\n\tcommit<T>(change: (tx: Tx) => T | Promise<T>, context: Context): Promise<T>;\n\t/**\n\t * Committed raw active transcript and model context. With `at`, the context as of that visible entry: the same view\n\t * `fork(at)` would start with, without creating a conversation.\n\t */\n\tcontext(context: Context, options?: { readonly at?: EntryId }): Promise<ContextView>;\n\t/** Fork-aware history of this conversation, newest first unless `query.order` is `ascending`. */\n\tentries(\n\t\tquery: Omit<EntryQuery, \"conversationId\">,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<EntryRecord, Cursor>>;\n\tfork(at: EntryId, options: ConversationCreateOptions, context: Context): Promise<Conversation>;\n\t/**\n\t * Withdraw queued inputs (queued writes stay), mark every live non-background task of the ordinary ownership scope,\n\t * signal them, and resolve once the scope is idle. Background subtrees survive unless `background` is set.\n\t */\n\tabort(context: Context, options?: ConversationAbortOptions): Promise<void>;\n\t/**\n\t * Resolve when the ordinary ownership scope has no live non-background task: this conversation and the conversations\n\t * owned, transitively, by its non-background tasks.\n\t */\n\twaitForIdle(context: Context): Promise<void>;\n\t/** The structural view (spec §9.3) as a disposable read-only Chord state. */\n\tviewState(context: Context): Promise<AttachedReplicatedState<ConversationView>>;\n\t/** The structural view as a serialized exact-frame watch with bounded pending frames. */\n\twatch(context: Context): Promise<ConversationWatch>;\n}\n\nexport type ConversationWatch = WatchHandle<ConversationView>;\n\n/** Durable agent harness over one Session. */\nexport interface Harness extends Session {\n\t/**\n\t * Enable task scheduling. Idempotent; throws after close. Calls that ask for progress enable it too:\n\t * `Conversation.submit()`, `Conversation.compact()`, `Conversation.abort()`, `Submission.wait()`, `waitForTask()`,\n\t * `Harness.waitForIdle()`, and `Conversation.waitForIdle()`. Read-only viewers never do.\n\t */\n\tresume(): void;\n\n\t/** Return the reserved root conversation, creating it with `agent` and `init` in one commit when absent. */\n\troot(\n\t\tcontext: Context,\n\t\toptions?: { readonly agent?: AgentChange; readonly init?: ConversationInit },\n\t): Promise<Conversation>;\n\tconversation(id: ConversationId, context: Context): Promise<Conversation | undefined>;\n\tcreateConversation(options: ConversationCreateOptions, context: Context): Promise<Conversation>;\n\n\tgetTask<R>(id: TaskId<R>, context: Context): Promise<TaskRecord<JsonValue, JsonValue, R> | undefined>;\n\t/** Live tasks and unsettled submissions. Writes nothing and runs no task code. */\n\tinspect(context: Context): Promise<HarnessInspection>;\n\t/** Reacquire a submission, for example after reopen. */\n\tsubmission(id: SubmissionId, context: Context): Promise<Submission | undefined>;\n\t/** `not_found` for an unknown submission or one of another conversation than `conversationId`. */\n\tabortSubmission(\n\t\tid: SubmissionId,\n\t\tcontext: Context,\n\t\tconversationId?: ConversationId,\n\t): Promise<\"aborted\" | \"already_placed\" | \"settled\" | \"not_found\">;\n\t/**\n\t * Commit the abort mark, signal and join an active run invocation, and schedule the abort invocation. A task whose\n\t * definition cannot take it settles as `orphaned` instead.\n\t */\n\tabortTask(id: TaskId, context: Context): Promise<\"marked\" | \"terminal\">;\n\t/** Resolve with the terminal receipt; cancelling `context` cancels only this wait. */\n\twaitForTask<R>(id: TaskId<R>, context: Context): Promise<SettledTask<R>>;\n\t/** Resolve when the ordinary ownership scope of every ownerless conversation has no live non-background task. */\n\twaitForIdle(context: Context): Promise<void>;\n\t/** Session total: every conversation's `pi.usage` summed. */\n\tusage(context: Context): Promise<UsageState>;\n\t/** Every live task with its owner edge, status, and owned conversations (spec §9.5), as a disposable Chord state. */\n\ttaskGraph(context: Context): Promise<AttachedReplicatedState<TaskGraph>>;\n\t/** The task graph as a serialized exact-frame watch with bounded pending frames. */\n\twatchTaskGraph(context: Context): Promise<TaskGraphWatch>;\n}\n\n/** What a hook may use: committed reads and the asking task's memos, which hooks and the task share. */\nexport interface HookApi extends DocumentReader {\n\treadonly taskId: TaskId;\n\treadonly conversationId: ConversationId;\n\t/** `HarnessOptions.models`. */\n\treadonly models: Models;\n\tmemo<T extends JsonValue>(name: string, context: Context): Promise<T | undefined>;\n\tmemo<T extends JsonValue>(name: string, candidate: T, context: Context): Promise<T>;\n}\n\nexport type HookResult<T> = T | undefined | Promise<T | undefined>;\n\n/** Hooks of the built-in generation task. */\nexport interface GenerationHooks {\n\t/** Before every request attempt, including recovery; the result is used for that request only. */\n\tbeforeRequest(\n\t\trequest: { readonly messages: readonly Message[] },\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<{ readonly messages: readonly Message[] }>;\n\t/** Every terminal provider message, before classification. */\n\tafterResponse(message: AssistantMessage, api: HookApi, context: Context): void | Promise<void>;\n\t/** A final answer; the first `continue` appends a user message and continues the run. */\n\tonYield(answer: AssistantMessage, api: HookApi, context: Context): HookResult<{ readonly continue: UserInput }>;\n\t/** After every tool of the round is terminal; `results` are the round's result entries in call order. */\n\tafterTools(assistant: EntryId, results: readonly EntryId[], api: HookApi, context: Context): void | Promise<void>;\n}\n\n/** A call as tool hooks see it; `parent` is set for a nested call, one a running tool made through `executeTool()`. */\nexport type ToolHookCall = ToolCall & {\n\treadonly parent?: { readonly taskId: TaskId; readonly callId: string };\n};\n\n/** Hooks of the built-in tool task, for model-issued and nested calls. */\nexport interface ToolHooks {\n\t/** Before intent; the first `block` wins, otherwise `arguments` replace the call's arguments. A throw blocks. */\n\tbeforeTool(\n\t\tcall: ToolHookCall,\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<{ readonly arguments?: JsonObject; readonly block?: string }>;\n\t/** After execution, before the result is committed; replaces the result. */\n\tafterTool(\n\t\tcall: ToolHookCall,\n\t\tresult: ToolExecutionResult,\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<ToolExecutionResult>;\n}\n\n/** Hooks of the built-in compaction task. */\nexport interface CompactionHooks {\n\t/**\n\t * After range selection, before summarizing; the first decision wins. `entries` are the active entries the summary\n\t * replaces, the head marker first, and `messages` their model context, the summarizer's source; `firstKept` is the\n\t * first entry kept verbatim.\n\t */\n\tbeforeCompact(\n\t\tcompaction: {\n\t\t\treadonly reason: CompactionReason;\n\t\t\treadonly entries: readonly EntryRecord[];\n\t\t\treadonly messages: readonly Message[];\n\t\t\treadonly firstKept: EntryId;\n\t\t\treadonly instructions?: string;\n\t\t},\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<{ readonly decline: true } | { readonly summary: string }>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Context, JsonValue, WatchHandle } from \"@earendil-works/chord\";\nimport type {\n\tApi,\n\tAssistantMessage,\n\tCacheRetention,\n\tClientIdentity,\n\tMessage,\n\tModel,\n\tModels,\n\tModelThinkingLevel,\n\tTool,\n\tToolCall,\n\tToolResultMessage,\n\tTransport,\n\tUsage,\n\tUserMessage,\n} from \"@earendil-works/pi-ai\";\nimport type { Static } from \"@earendil-works/pi-schema\";\nimport type { TelemetryContext } from \"@earendil-works/pi-telemetry\";\nimport type { ExecutionEnv, ShellOutputSkip, ShellOutputWindow } from \"../env/index.ts\";\nimport type {\n\tCommitOptions,\n\tConversationId,\n\tConversationOwnership,\n\tConversationRecord,\n\tCursor,\n\tDocumentObserver,\n\tDocumentReader,\n\tEntry,\n\tEntryDraft,\n\tEntryId,\n\tEntryQuery,\n\tEntryRecord,\n\tJsonObject,\n\tObservation,\n\tObserver,\n\tPage,\n\tReport,\n\tSession,\n\tSetTimer,\n\tSubmissionId,\n\tSubmissionRecord,\n\tTask,\n\tTaskId,\n\tTaskOptions,\n\tTaskRecord,\n\tTaskState,\n\tTx,\n\tTypedEntry,\n} from \"../types.ts\";\nimport type { TaskGraph, TaskGraphWatch } from \"./task-graph.ts\";\nimport type { UsageState } from \"./usage.ts\";\nimport type { ConversationView, ConversationWindow } from \"./view.ts\";\n\n/** Provider and model ID resolved through pi-ai `Models`. */\nexport type ModelRef = {\n\treadonly provider: string;\n\treadonly modelId: string;\n};\n\nexport type UserInput = UserMessage[\"content\"];\n\n/**\n * The entry an input is placed as, instead of `pi.user`: an application kind, and data the transcript shows, such as its\n * author. Its model message is still the input's user message.\n */\nexport type InputEntry = { readonly kind: string; readonly data?: JsonValue };\n\n/**\n * Host submission: user input that may start a run, a passive entry write, or a continue: a run without a new user\n * message, for an idle conversation whose context the model still owes an answer (it ends in a user message or tool\n * results, for example after a run that ended without an answer).\n */\nexport type SubmissionDraft = {\n\treadonly requestId?: string;\n} & (\n\t| {\n\t\t\treadonly type: \"input\";\n\t\t\treadonly content: UserInput;\n\t\t\treadonly whenBusy?: \"steer\" | \"followUp\" | \"reject\";\n\t\t\t/**\n\t\t\t * `reject`: an idle conversation (no run) rejects the input with `ConversationIdle` and writes nothing, so the input\n\t\t\t * never starts a run of its own. With `whenBusy: \"steer\"` it steers the current run or is refused; a run that\n\t\t\t * answered and waits for its `afterRun` tasks is still busy, and such an input queues and starts the next run.\n\t\t\t */\n\t\t\treadonly whenIdle?: \"reject\";\n\t\t\t/** Place the input as this entry; default `pi.user` without data. The kind must not start with `pi.`. */\n\t\t\treadonly entry?: InputEntry;\n\t }\n\t| {\n\t\t\treadonly type: \"write\";\n\t\t\treadonly entry: EntryDraft;\n\t\t\treadonly content?: never;\n\t\t\treadonly whenBusy?: never;\n\t\t\treadonly whenIdle?: never;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * Start a run on the context as it is, without a user message. Only when idle: a busy conversation rejects it with\n\t\t\t * `ConversationBusy`, and it never queues. Items kept in `pi.inbox` are placed first and join the run. A context\n\t\t\t * with nothing to answer (empty, or ending in an answer, also a text answer cut off at its output limit) ends the\n\t\t\t * run without a request, `unanswered` with `nothing_to_answer`. A cut-off answer with tool calls is continued:\n\t\t\t * its calls never ran, and the context ends in their error results (`missing_result`).\n\t\t\t */\n\t\t\treadonly type: \"continue\";\n\t\t\treadonly content?: never;\n\t\t\treadonly entry?: never;\n\t\t\treadonly whenBusy?: never;\n\t\t\treadonly whenIdle?: never;\n\t }\n);\n\nexport type InputSubmissionDraft = Extract<SubmissionDraft, { readonly type: \"input\" }>;\n\nexport type SettledSubmissionRecord = SubmissionRecord & {\n\treadonly status: \"done\" | \"unanswered\";\n};\n\n/** Awaitable host object for one durably admitted submission. */\nexport interface Submission {\n\treadonly id: SubmissionId;\n\tstatus(context: Context): Promise<SubmissionRecord>;\n\twait(context: Context): Promise<SettledSubmissionRecord>;\n\tabort(context: Context): Promise<\"aborted\" | \"already_placed\" | \"settled\">;\n}\n\nexport type SettledTask<R> = TaskRecord<JsonValue, JsonValue, R> & {\n\treadonly state: Extract<TaskState<JsonValue, R>, { readonly status: \"terminal\" }>;\n};\n\n/** Erased executable task definition stored in the registry. */\nexport type AnyTask = {\n\treadonly definition: {\n\t\treadonly name: string;\n\t\treadonly version: number;\n\t\treadonly initial: unknown;\n\t\treadonly phases: Readonly<Record<string, unknown>>;\n\t\treadonly abort: unknown;\n\t\treadonly migrate?: unknown;\n\t\treadonly hooks?: object;\n\t};\n};\n\n/** Options of `Conversation.abort()`. */\nexport type ConversationAbortOptions = {\n\t/**\n\t * Cross background boundaries: mark every live task reached ignoring the background flag when the abort is admitted,\n\t * withdraw the queued inputs of every conversation reached, and wait until those tasks are terminal and the\n\t * conversation is ordinarily idle. Background work created afterwards is neither marked nor awaited.\n\t */\n\treadonly background?: boolean;\n};\n\n/** Hook handler map declared by a task definition. */\nexport type HooksOf<K> = K extends Task<infer _I, infer _S, infer _R, infer H> ? H : never;\n\n/**\n * Invocation-bound conversation operations for tasks and tools. Rejects after the invocation ends. `submit` takes any\n * submission, in both forms of `Conversation.submit()`: a subagent's conversation is an ordinary one, so a tool may also\n * continue it, and a task may admit a submission in the same commit as its own writes (`runtime.commit()`); entries\n * the admission appends there carry the task's `byTaskId`. The transaction form also rejects once the invocation is\n * aborted.\n */\nexport interface ConversationHandle {\n\treadonly id: ConversationId;\n\tsubmit(submission: SubmissionDraft, context: Context): Promise<Submission>;\n\tsubmit(tx: Tx, submission: SubmissionDraft): Promise<SubmissionId>;\n\t/** `Conversation.abort()`: withdraw queued inputs, abort the ordinary ownership scope, and wait until it is idle. */\n\tabort(context: Context, options?: ConversationAbortOptions): Promise<void>;\n\t/** Resolve when the conversation's ordinary ownership scope has no live non-background task. */\n\twaitForIdle(context: Context): Promise<void>;\n}\n\n/** Post-tools controls requested by a tool result. */\nexport type ToolControl = {\n\treadonly addTools?: readonly string[];\n\t/** End the run without another model request when every result of the round sets it to `true`; `false` is a no-op. */\n\treadonly terminate?: boolean;\n\t/**\n\t * Start a new context with this text as its user message, as `reset(handoff)` writes, and continue the run there.\n\t * The last handoff in call order wins.\n\t */\n\treadonly handoff?: string;\n};\n\n/** Remark about a call for the model and the UI, such as truncation or a spill path; never part of the tool's data. */\nexport type ToolDiagnostic = {\n\treadonly severity: \"info\" | \"warn\" | \"error\";\n\treadonly message: string;\n\treadonly code?: string;\n};\n\n/**\n * What a tool returns, on three channels: `output` for the model, `structuredOutput` for programs that call the tool\n * (`executeTool()` callers, code mode scripts), and `details` for UIs.\n */\nexport type ToolExecutionResult<TDetails extends JsonValue = JsonValue> = {\n\t/** For the model. Omitted: the retained `output()` text. */\n\treadonly output?: ToolResultMessage[\"content\"];\n\t/**\n\t * For programs. Required unless `isError` when the tool declares `structuredOutputSchema`, and validated against it;\n\t * not allowed without one, where programs get the output itself (`NestedToolExecutionResult.structuredOutput`).\n\t */\n\treadonly structuredOutput?: JsonValue;\n\treadonly isError?: boolean;\n\t/** Omitted: the last `details()` value becomes the details. */\n\treadonly details?: TDetails;\n\t/** Added after those recorded through `api.diagnostic()`. */\n\treadonly diagnostics?: readonly ToolDiagnostic[];\n\t/** Spend of the execution itself, such as a model call; stored on the result and in `pi.usage.tools`. */\n\treadonly usage?: Usage;\n\treadonly control?: ToolControl;\n};\n\n/**\n * Result of a nested call, as `executeTool()` returns it. Programs read `structuredOutput`; the output for the model\n * is not kept, and `control` does not apply.\n */\nexport type NestedToolExecutionResult = {\n\t/** The nested call's tool task. */\n\treadonly taskId: TaskId;\n\t/**\n\t * The tool's value for programs. A tool with `structuredOutputSchema`: its validated `structuredOutput`, also on an\n\t * error result that has one; absent otherwise, and an error's text is then in an error diagnostic. A tool without:\n\t * its bounded output, success or error, as a string for one text item, an `ImageContent` for one image, `\"\"` for\n\t * none, and the content list otherwise. Absent on an error result the Harness wrote itself (unavailable, invalid,\n\t * blocked, interrupted, aborted); `diagnostics` say what went wrong.\n\t */\n\treadonly structuredOutput?: JsonValue;\n\treadonly isError: boolean;\n\treadonly details?: JsonValue;\n\treadonly diagnostics: readonly ToolDiagnostic[];\n\treadonly usage?: Usage;\n\t/** Execution time of the attempt that produced the result; absent when it never executed. */\n\treadonly durationMs?: number;\n};\n\n/** Whether the tools of one round run at once or one after another in call order. */\nexport type ToolExecutionMode = \"parallel\" | \"sequential\";\n\n/** How many queued items of one mode a boundary places: the first, or all of them. */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/**\n * Operations available to one tool invocation. A plain object, so a wrapper can spread it. Every operation rejects after\n * the invocation ends.\n */\nexport interface ToolExecutionApi<TDetails extends JsonValue = JsonValue> extends DocumentObserver, DocumentReader {\n\treadonly taskId: TaskId;\n\treadonly conversationId: ConversationId;\n\treadonly callId: string;\n\t/** The tool task's phase snapshot. */\n\treadonly registry: RegistrySnapshot;\n\t/** The calling conversation's agent, as the tool task's phase resolved it. */\n\tagent(context: Context): Promise<Agent>;\n\t/** The current `HarnessOptions.models`, read at each access: the catalog, credentials, and request transforms. */\n\treadonly models: Models;\n\t/** Built by `HarnessOptions.env` for this call; `undefined` without an environment. */\n\treadonly env: ExecutionEnv | undefined;\n\t/** The Harness clock (`HarnessOptions.now`), for times a rerun after a restart compares against. */\n\tnow(): number;\n\t/**\n\t * Append running output; it becomes the result's `output` when the result omits it. `skipped` counts output\n\t * omitted before the chunk, as reported by an environment given `outputWindow` (`ShellOutputInfo.skipped`).\n\t */\n\toutput(chunk: string | Uint8Array, skipped?: ShellOutputSkip): void;\n\t/**\n\t * The tail this call's output keeps and the pace of its progress commits, for `ShellExecOptions.window`; `undefined`\n\t * when the tool keeps the head of its output, which cannot accept skips. A wrapper that replaces `output` and\n\t * transforms text must also replace this with `undefined`, so skipped text cannot bypass its transform.\n\t */\n\treadonly outputWindow: ShellOutputWindow | undefined;\n\t/**\n\t * The output retained so far, as the model will see it when the result omits `output`, and whether earlier output was\n\t * dropped; for a tool that also returns that text in its `structuredOutput`.\n\t */\n\tretainedOutput(): { readonly text: string; readonly truncated: boolean };\n\t/** Record a model-visible remark about this call. */\n\tdiagnostic(diagnostic: ToolDiagnostic): void;\n\t/** Replace running details; the last value becomes the result details when the result omits `details`. */\n\tdetails(value: TDetails, context: Context): Promise<void>;\n\t/** A commit of this call's task; `options` may defer storing it (`CommitPersistence`). */\n\tcommit<T>(change: (tx: Tx) => T | Promise<T>, context: Context, options?: CommitOptions): Promise<T>;\n\tmemo<T extends JsonValue>(name: string, context: Context): Promise<T | undefined>;\n\tmemo<T extends JsonValue>(name: string, candidate: T, context: Context): Promise<T>;\n\t/**\n\t * Create a task in one commit. A child task of a tool that is not replay-safe defaults to `abandonOnRestart`: the\n\t * tool never resumes after a restart, so nothing awaits the child then.\n\t */\n\tcreateTask<I, S extends { phase: string }, R, H extends object>(\n\t\ttask: Task<I, S, R, H>,\n\t\tinput: I,\n\t\toptions: Omit<TaskOptions, \"conversationId\">,\n\t\tcontext: Context,\n\t): Promise<TaskId<R>>;\n\tgetTask<R>(id: TaskId<R>, context: Context): Promise<TaskRecord<JsonValue, JsonValue, R> | undefined>;\n\twaitForTask<R>(id: TaskId<R>, context: Context): Promise<SettledTask<R>>;\n\t/** Invocation-bound handle of an existing conversation, such as one this tool created in `commit()`. */\n\tconversation(id: ConversationId, context: Context): Promise<ConversationHandle | undefined>;\n\t/**\n\t * Run tool `name` as a nested call of this one and wait for its result. The nested call is its own `pi.tool` task,\n\t * owned by this call: it resolves the tool among the conversation's tools, validates, runs the `ToolTask` hooks (which\n\t * see `call.parent`), applies output limits and the tool's replay policy, and reports progress in `pi.live.nestedTools`.\n\t * Its result returns here instead of entering the transcript. A call that is blocked, invalid, throws, is interrupted,\n\t * or is aborted returns an `isError` result.\n\t *\n\t * The nested call's key names it within this call; its call ID is `<callId>/<key>`. By default the key is the call's\n\t * position among this invocation's nested calls, `1`, `2`, ... An explicit `key` must be non-empty, without `/`, not\n\t * `__proto__`, and not a positive integer, so it never collides with a default one. A rerun of a replay-safe tool\n\t * that makes a call with a used key, by calling in the same order or by passing the same `key`, gets that nested call\n\t * back, finished or still running, instead of starting another. A nested call a crash interrupted before its result\n\t * committed follows its own replay policy, so this is not exactly-once execution. Reusing a key with another tool or\n\t * other arguments throws. A tool that is not replay-safe never reruns: after a restart, its unfinished nested calls\n\t * are abandoned (`TaskOptions.abandonOnRestart`) before they run again.\n\t *\n\t * `progress: false` commits no running output, details, or diagnostics to the nested call's slot, only its status;\n\t * the result still carries its details and diagnostics, and a schema-less tool's output as `structuredOutput`. An\n\t * interrupted or aborted call's result is built from its slot, so it then has none of them. Either way, programs never\n\t * get the partial output of an interrupted or aborted call.\n\t *\n\t * Nested calls run as soon as they are made, whatever their `executionMode`; the caller decides what runs at once by\n\t * what it awaits. Cancelling `context` stops only the wait; the nested call runs on. When this call settles, nested\n\t * calls it left running are aborted first. A nested result's `usage` is already counted under its tool; a result\n\t * that passes it on counts it again. Rejects, instead of returning a result, once `execute()` has returned, when this\n\t * call is aborted, or when the Harness closes.\n\t */\n\texecuteTool(\n\t\tname: string,\n\t\targs: JsonObject,\n\t\tcontext: Context,\n\t\toptions?: { readonly key?: string; readonly progress?: boolean },\n\t): Promise<NestedToolExecutionResult>;\n}\n\n/**\n * The arguments type of a tool with parameter schema `TParameters`: pi-schema's `Static<TParameters>` (the builders'\n * type, TypeBox's for the common TypeBox kinds, else `unknown`), and `any` for `ToolRegistration<any>`.\n */\nexport type ToolArgs<TParameters> = IsAny<TParameters> extends true ? any : Static<TParameters>;\n\n// `0 extends 1 & T` is resolved too early for a `T` constrained to `object`; this form waits for the argument.\ntype IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;\n\n/**\n * Executable tool registered in a registry. Only pi-ai `Tool` fields enter the transcript. `args` are typed by\n * `parameters` (any JSON Schema object; see {@link ToolArgs}), which the Harness validates them against before\n * `execute()`; `defineTool()` infers both generics.\n */\nexport type ToolRegistration<\n\tTParameters extends object = object,\n\tTDetails extends JsonValue = JsonValue,\n> = Tool<TParameters> & {\n\t/** Whether an interrupted execution may rerun on recovery. Default `unsafe`. */\n\treadonly replay?: \"safe\" | \"unsafe\";\n\t/** Default: the settings' `toolExecution`. One sequential call makes its whole round sequential. */\n\treadonly executionMode?: ToolExecutionMode;\n\t/**\n\t * Repair arguments models commonly get wrong before validation, such as a JSON string where an array belongs. Must be\n\t * pure and must not mutate `args`: it runs again when a call is retried before its intent is recorded. Its result is\n\t * still validated against `parameters`.\n\t */\n\tprepareArguments?(args: unknown): ToolArgs<TParameters>;\n\t/**\n\t * Schema of `structuredOutput`, which programs that call the tool receive. Omitted: they receive the result's bounded\n\t * output, success or error, as `NestedToolExecutionResult.structuredOutput` describes.\n\t */\n\treadonly structuredOutputSchema?: object;\n\t/**\n\t * Who may call the tool: the model, other tools through `executeTool()`, or both (default). A code mode tool is\n\t * `[\"model\"]`, so scripts cannot start scripts; tools behind code mode, such as MCP tools, can be `[\"tools\"]`, so the\n\t * model is never offered them.\n\t */\n\treadonly callers?: readonly (\"model\" | \"tools\")[];\n\t/**\n\t * Not offered to the model until loaded: the model gets the tool only when `modelTools` names it, in its array or its\n\t * `add`, which `control.addTools` (from a tool such as `tool_search`) writes. Other tools can call it any time.\n\t */\n\treadonly deferred?: true;\n\treadonly outputLimits?: {\n\t\treadonly maxBytes?: number;\n\t\treadonly maxLines?: number;\n\t\treadonly retain?: \"head\" | \"tail\";\n\t};\n\texecute(\n\t\targs: ToolArgs<TParameters>,\n\t\tapi: ToolExecutionApi<TDetails>,\n\t\tcontext: Context,\n\t): Promise<ToolExecutionResult<TDetails>>;\n};\n\n/** Input to system prompt section rendering for one request preparation. */\nexport type PromptInput<Tool extends ToolRegistration = ToolRegistration> = {\n\treadonly conversationId: ConversationId;\n\t/** The request's resolution; `agent.tools` are the tools offered in this request. */\n\treadonly agent: Agent<Tool>;\n\t/** Built by `HarnessOptions.env` for this preparation; `undefined` without an environment. */\n\treadonly env: ExecutionEnv | undefined;\n\t/** Sections already in effect after replaying the active transcript. */\n\treadonly shown: Readonly<Record<string, string>>;\n\t/** Committed document reads. */\n\treadonly read: DocumentReader;\n};\n\n/** One system prompt section; the agent's sections render in order before each request. */\nexport type PromptSection<Tool extends ToolRegistration = ToolRegistration> = {\n\treadonly key: string;\n\trender(input: PromptInput<Tool>, context: Context): string | undefined | Promise<string | undefined>;\n\t/** Default true: wrap the text as `<key>\\n...\\n</key>`. */\n\treadonly tag?: boolean;\n};\n\n/** Built by `hook()`; matches tasks by name. */\nexport type HookRegistration = { readonly task: string; readonly handlers: object };\n\n/** Built by `wrapTool()` and `wrapSection()`; targets a tool name or a section key. Wrappers are pure. */\nexport type Wrap<Tool extends ToolRegistration = ToolRegistration> =\n\t| { readonly tool: string; wrap(tool: Tool): Tool }\n\t| { readonly section: string; wrap(section: PromptSection<Tool>): PromptSection<Tool> };\n\n/** Named bundle of code; installed in a registry and selected by conversations by name. */\nexport interface Extension<Tool extends ToolRegistration = ToolRegistration> {\n\treadonly name: string;\n\treadonly tools?: readonly Tool[];\n\treadonly sections?: readonly PromptSection<Tool>[];\n\treadonly hooks?: readonly HookRegistration[];\n\t/** Apply where this extension is selected, in order. */\n\treadonly wraps?: readonly Wrap<Tool>[];\n\t/** Resolved by name for every task, whichever conversations select this extension. */\n\treadonly tasks?: readonly AnyTask[];\n}\n\n/** Immutable view of one published registry state. */\nexport interface RegistrySnapshot<Tool extends ToolRegistration = ToolRegistration> {\n\tinstalled(): readonly Extension<Tool>[];\n\textension(name: string): Extension<Tool> | undefined;\n\t/** Every installed tool with its extension, in install order. Names may repeat across extensions. */\n\ttools(): readonly { readonly extension: Extension<Tool>; readonly tool: Tool }[];\n\tsections(): readonly { readonly extension: Extension<Tool>; readonly section: PromptSection<Tool> }[];\n\t/** Built-in and installed task definitions. */\n\ttasks(): readonly AnyTask[];\n\ttask(name: string): AnyTask | undefined;\n}\n\n/** Read side of a registry consumed by a Harness. */\nexport interface RegistryReader<Tool extends ToolRegistration = ToolRegistration> {\n\t/** Immutable view of the whole current registry. */\n\tsnapshot(): RegistrySnapshot<Tool>;\n\t/** Called synchronously after every publication; wakes the scheduler to reconsider blocked tasks. */\n\tsubscribe(listener: () => void): () => void;\n}\n\n/** Application-owned registry of extensions. */\nexport interface Registry<Tool extends ToolRegistration = ToolRegistration> extends RegistryReader<Tool> {\n\t/** Install `extension`, or replace the installed extension with its name in place. Publishes at once. */\n\tinstall(extension: Extension<Tool>): void;\n\t/** Remove the installed extension with `extension.name`, whichever object it is. A later install appends. */\n\tuninstall(extension: Extension): void;\n}\n\n/** Stored choices of one conversation; names, not objects. Unset fields follow the host. */\nexport type AgentState = {\n\tmodel?: ModelRef;\n\tthinkingLevel?: ModelThinkingLevel;\n\t/** An array selects exactly these extensions, in order. An object edits the host default selection. */\n\textensions?: string[] | { add?: string[]; remove?: string[] };\n\t/** Filters the selected extensions' tools: the enabled tools. An array enables exactly these, in order. */\n\ttools?: string[] | { remove: string[] };\n\t/**\n\t * Filters the enabled tools the model may call (`callers` includes `model`): the tools offered to it. Never widens:\n\t * other tools can still call the ones it leaves out.\n\t * - Unset: every such tool except deferred ones.\n\t * - An array: exactly these, in order, deferred ones too.\n\t * - An object: every such tool except deferred ones and those in `remove`, in registry order, followed by the\n\t * deferred tools in `add` that are not in `remove`, in `add` order. Names of tools that are not deferred or not\n\t * registered have no effect in `add`.\n\t */\n\tmodelTools?: string[] | { remove?: string[]; add?: string[] };\n\t/** Rendered after every extension section, as the section `instructions`. */\n\tinstructions?: string;\n\t/** Directory within the environment's file system, passed to `HarnessOptions.env`. */\n\tcwd?: string;\n\t/**\n\t * Tool rounds one run takes at most (`pi.live.run.turns`): the round that reaches it runs its tools, then the run ends\n\t * `unanswered` with `turn_limit`. An integer, `1` or more; unset, no limit. Task-owned children and forks inherit it.\n\t */\n\tmaxTurns?: number;\n};\n\n/** A change to `pi.agent`: a given field replaces the stored one, `null` clears it, `undefined` changes nothing. */\nexport type AgentChange = {\n\treadonly model?: ModelRef | null;\n\treadonly thinkingLevel?: ModelThinkingLevel | null;\n\treadonly extensions?:\n\t\t| readonly Extension[]\n\t\t| { readonly add?: readonly Extension[]; readonly remove?: readonly Extension[] }\n\t\t| null;\n\treadonly tools?: readonly ToolRegistration[] | { readonly remove: readonly ToolRegistration[] } | null;\n\t/** Replaces the stored filter as a whole; tools loaded with `control.addTools` are in its `add`. */\n\treadonly modelTools?:\n\t\t| readonly ToolRegistration[]\n\t\t| { readonly remove?: readonly ToolRegistration[]; readonly add?: readonly ToolRegistration[] }\n\t\t| null;\n\treadonly instructions?: string | null;\n\treadonly cwd?: string | null;\n\t/** `configure()` throws a `RangeError` unless it is an integer `1` or more (or `null`). */\n\treadonly maxTurns?: number | null;\n};\n\n/** A conversation's agent resolved against a registry snapshot and the settings. */\nexport type Agent<Tool extends ToolRegistration = ToolRegistration> = {\n\treadonly model?: ModelRef;\n\treadonly thinkingLevel: ModelThinkingLevel;\n\treadonly extensions: readonly Extension<Tool>[];\n\t/** The tools a request offers, in order: enabled, callable by the model, and selected by `modelTools`. */\n\treadonly tools: readonly Tool[];\n\t/** The tools nested calls (`executeTool()`) resolve among, in order: enabled and callable by tools. */\n\treadonly callable: readonly Tool[];\n\t/** Enabled deferred tools the model may call and is not offered yet, in registry order: what `tool_search` loads. */\n\treadonly deferred: readonly Tool[];\n\t/** Extension sections, then `instructions` when set. */\n\treadonly sections: readonly PromptSection<Tool>[];\n\treadonly instructions?: string;\n\treadonly cwd?: string;\n\t/**\n\t * Tool rounds one run takes at most (`pi.live.run.turns`): the round that reaches it runs its tools, then the run ends\n\t * `unanswered` with `turn_limit`. An integer, `1` or more; unset, no limit. Task-owned children and forks inherit it.\n\t */\n\treadonly maxTurns?: number;\n};\n\n/**\n * Runs inside the creating commit, after the creation hook and the `agent` change. The conversation creation is already\n * a table write, so table reads here throw `ReadAfterWrite`; document access remains available.\n */\nexport type ConversationInit = (tx: Tx, conversationId: ConversationId) => void | Promise<void>;\n\nexport type ConversationCreateOptions = {\n\treadonly ownership: ConversationOwnership;\n\t/** Applied in the creating commit after the creation hook's copy, before `init`. */\n\treadonly agent?: AgentChange;\n\treadonly init?: ConversationInit;\n};\n\n/** Curated pi-ai request options; absent fields use pi-ai defaults. */\nexport type ConversationStreamOptions = {\n\ttransport?: Transport;\n\ttimeoutMs?: number;\n\t/** Provider/SDK retries inside one request attempt. */\n\tmaxRetries?: number;\n\tmaxRetryDelayMs?: number;\n\theaders?: Record<string, string>;\n\tmetadata?: JsonObject;\n\tcacheRetention?: CacheRetention;\n\tdeferred?: boolean | { window?: \"15m\" | \"1h\" | \"24h\" };\n};\n\n/** Durable generation attempt retries; the JSON shape of pi-ai `RetryPolicy`. */\nexport type ConversationRetryPolicy = {\n\tenabled: boolean;\n\tmaxRetries: number;\n\tbaseDelayMs: number;\n\tmaxAgentDelayMs?: number;\n};\n\n/** Automatic compaction thresholds (spec §8.7); manual compaction ignores `enabled`. */\nexport type CompactionPolicy = {\n\t/** Threshold and overflow compaction. */\n\tenabled: boolean;\n\t/** Room kept free for the answer: generation blocks to compact above `contextWindow - reserveTokens`. */\n\treserveTokens: number;\n\t/** Approximate size of the recent context a summary keeps verbatim. */\n\tkeepRecentTokens: number;\n\t/** Background compaction starts `backgroundTokens` below the blocking threshold; `0` disables it. */\n\tbackgroundTokens: number;\n};\n\n/**\n * Harness-wide compaction settings. `modelOverrides` is keyed by exact `\"provider/modelId\"`; each field it sets\n * replaces the harness-wide one for that model, so small- and large-window models can share a harness.\n */\nexport type CompactionSettings = Partial<CompactionPolicy> & {\n\treadonly modelOverrides?: Readonly<Record<string, Partial<CompactionPolicy>>>;\n};\n\n/**\n * How often running progress is committed, and how long it may wait in memory before it is stored. Progress commits are\n * deferred (`CommitPersistence`): watches see each at once, and Storage gets them together, at the run's next phase\n * boundary or after `persistWithinMs`. A host can commit less often, so live answers and tool output appear in larger steps.\n */\nexport type ProgressPolicy = {\n\t/** Minimum pause between commits of the answer being generated. */\n\tpartialIntervalMs: number;\n\t/** Minimum pause between commits of running tool output; large commits also pause in proportion to their size. */\n\toutputIntervalMs: number;\n\t/**\n\t * How long these commits, and other deferred commits without their own `withinMs`, may stay in memory before they are\n\t * stored (`CommitPersistence`); a crash loses at most about this much of an answer or of tool output. Default 1,000;\n\t * `Infinity` stores them only at the next commit that reads or writes their document and at close.\n\t */\n\tpersistWithinMs: number;\n};\n\n/** Why a compaction runs: `compact()`, a threshold in generation preparation, or a context overflow. */\nexport type CompactionReason = \"manual\" | \"threshold\" | \"overflow\";\n\n/**\n * `entryId` of a blocking compaction's summary, or the `submissionId` of a conversation-owned compaction's summary\n * write; both absent when nothing was compacted.\n */\nexport type CompactionResult = { entryId?: EntryId; submissionId?: SubmissionId };\n\n/** Harness-wide run policy. Read at every resolution and never copied; getters are fine. Synchronous: some readers run on the Session line. */\nexport type HarnessSettings = {\n\t/** Default extension selection; absent: every installed extension, in install order. */\n\treadonly extensions?: readonly Extension[];\n\treadonly stream?: ConversationStreamOptions;\n\treadonly retry?: Partial<ConversationRetryPolicy>;\n\treadonly compaction?: CompactionSettings;\n\treadonly progress?: Partial<ProgressPolicy>;\n\treadonly toolExecution?: ToolExecutionMode;\n\treadonly steeringMode?: QueueMode;\n\treadonly followUpMode?: QueueMode;\n\t/**\n\t * How long an idle conversation keeps its last context read in memory, so its next run reads only newer entries.\n\t * Busy conversations always keep it; `0` drops it once the conversation is idle.\n\t */\n\treadonly contextRetentionMs?: number;\n\t/**\n\t * How long a loaded document that no watch observes stays in memory after its last read or write;\n\t * the next access loads it from Storage. Observed documents always stay. Default ten minutes; `0` drops one right\n\t * after use; `Infinity` keeps them. Anything else that is not a number of milliseconds means the default.\n\t */\n\treadonly documentRetentionMs?: number;\n\t/**\n\t * What a run that fails (`model_error`, `no_model`, `interrupted`, `restart_limit`, `nothing_to_answer`,\n\t * `turn_limit`) does with the inputs queued behind it: `keep` leaves them queued until the next input or queued write, `continue` starts the\n\t * next run with them, as an answer would, and `withdraw` settles them `unanswered` with reason `run_failed`. Default\n\t * `keep`.\n\t */\n\treadonly afterFailedRun?: AfterFailedRun;\n\t/**\n\t * How many times in a row a task may be cut off by a crash, eviction, or reset (a close does not count) without\n\t * changing its state before it ends instead of running again: a tool call with an error result, a compaction failed\n\t * into `pi.live.compactionFailure`, a run with `pi.live.runFailure` reason `restart_limit`, any other task `faulted`\n\t * with detail `{ reason: \"restart_limit\" }`. A generation's request or poll the host died during is a failed attempt\n\t * under `retry` first; the limit bounds it only when charging that attempt keeps being cut off. Default 5;\n\t * `Infinity` never ends a task for it.\n\t */\n\treadonly restartLimit?: number;\n};\n\n/**\n * What a failed run does with the inputs queued behind it (`HarnessSettings.afterFailedRun`): a run that ends with\n * `model_error`, `no_model`, `interrupted`, `restart_limit`, `nothing_to_answer`, or `turn_limit`.\n */\nexport type AfterFailedRun = \"keep\" | \"continue\" | \"withdraw\";\n\n/** Resolved settings: every field over its built-in default, object fields merged. */\nexport type Settings = {\n\t/** Absent: every installed extension, in install order. */\n\treadonly extensions?: readonly Extension[];\n\treadonly stream: ConversationStreamOptions;\n\treadonly retry: ConversationRetryPolicy;\n\t/** Harness-wide policy over the defaults; per-model overrides apply where the model is known. */\n\treadonly compaction: CompactionPolicy & Pick<CompactionSettings, \"modelOverrides\">;\n\treadonly progress: ProgressPolicy;\n\treadonly toolExecution: ToolExecutionMode;\n\treadonly steeringMode: QueueMode;\n\treadonly followUpMode: QueueMode;\n\treadonly contextRetentionMs: number;\n\treadonly documentRetentionMs: number;\n\treadonly afterFailedRun: AfterFailedRun;\n\treadonly restartLimit: number;\n};\n\n/** What `HarnessOptions.env` builds an environment for. */\nexport type EnvTarget = {\n\treadonly conversationId: ConversationId;\n\t/** The conversation's agent `cwd`. */\n\treadonly cwd?: string;\n\treadonly read: DocumentReader;\n};\n\nexport type HarnessOptions<Tool extends ToolRegistration = ToolRegistration> = {\n\t/** Host-owned adapter for content-free admission/phase telemetry; propagation and metrics are optional. */\n\treadonly telemetry?: TelemetryContext;\n\t/**\n\t * pi-ai model access used by generation, compaction, hooks and tools: a `Models`, or a function returning the current\n\t * one, called at each use, so a host can replace its model configuration without reopening the Harness.\n\t */\n\treadonly models: Models | (() => Models);\n\t/**\n\t * How model requests identify the app to providers, merged field by field over `DEFAULT_HARNESS_IDENTITY`\n\t * (`{ attribution: PI_ATTRIBUTION }`, provider attribution to pi). It applies to every request through the Harness's\n\t * models, including hooks and tools, and overrides the identity the `Models` was created with; a request's own\n\t * `identity` overrides it. Pass `{ attribution: null }` to send no attribution headers.\n\t */\n\treadonly identity?: ClientIdentity;\n\treadonly registry: RegistryReader<Tool>;\n\t/** Run settings, or a function returning the current ones; read at each use either way. */\n\treadonly settings?: HarnessSettings | (() => HarnessSettings | undefined);\n\t/** Builds a conversation's environment at each use. Never called on the Session line; may be async. */\n\treadonly env?: (target: EnvTarget, context: Context) => ExecutionEnv | undefined | Promise<ExecutionEnv | undefined>;\n\t/**\n\t * Runs in every commit that creates or forks a conversation, raw `tx.createConversation()` included, after the\n\t * built-in `pi.*` documents and before the conveniences apply `agent` and run `init`. A fork already has its copies.\n\t * Table reads throw `ReadAfterWrite`, as in `init`; a throw fails the creating commit.\n\t */\n\treadonly conversationCreated?: (tx: Tx, conversation: ConversationRecord) => void | Promise<void>;\n\t/**\n\t * The Harness clock, epoch milliseconds; default `Date.now`. Sleeping tasks store deadlines on it, so every process\n\t * that opens the same storage must use the same clock.\n\t */\n\treadonly now?: () => number;\n\t/**\n\t * Arms the timers of the Session, the scheduler, and its tasks: pacing progress commits, freeing idle memory\n\t * (`background`), and, without `onWake`, resuming sleeping tasks; and the timers of `TaskRuntime.setTimer()`. The\n\t * Node.js environment, file watcher, and image worker keep their own timers. Default `setTimeout`, with background\n\t * timers unreferenced, or declined in Cloudflare Workers and where they cannot be unreferenced. Tests can pass fake\n\t * timers; a host can keep timers off a process that should hibernate.\n\t */\n\treadonly setTimer?: SetTimer;\n\t/**\n\t * Wakes the process for sleeping tasks instead of a `setTimer` timer. Without it, while scheduling runs, a timer that\n\t * keeps the process alive resumes sleeping tasks when they are due. With it, the Harness arms no timer for them: it\n\t * calls `onWake` after open and whenever `Harness.wake()` changes, and the host arms its own wakeup, such as a\n\t * Durable Object alarm, and calls `resume()` when it fires. Called in a microtask the Session line never waits for,\n\t * after the commit that changed the value was adopted, so a host arms a recovery wakeup before calls that can start\n\t * work. It may call `wake()` and `resume()`, and must not block. A throw is reported, and the value is offered again\n\t * at the next change.\n\t */\n\treadonly onWake?: (wake: Wake) => void;\n\t/**\n\t * Receives failures that do not fail the calling operation, such as a throwing hook or listener, a task that faulted,\n\t * and the error that fails the Session, once: one `Report`, the `error` and what happened (`kind` and the fields of\n\t * its `ReportInfo`). A host can tell a failed Session (`storage_failed`, often a platform reset) from a faulted task\n\t * (`task_faulted`). Its own throw or rejection is dropped.\n\t */\n\treadonly onReport?: (report: Report) => void;\n\t/**\n\t * Open for reading only, as a viewer of a session that another process drives, for example a synced copy on a device\n\t * that only shows it. Open recovers nothing: a `running` task stays as committed. Every commit with writes rejects\n\t * with `ReadOnlySession` before it reaches Storage, and so does `resume()` and every call that enables scheduling;\n\t * the Harness stays usable for reads and watches. `wake()` is always inactive, and `onWake` is never called. Reopen\n\t * without it to write.\n\t */\n\treadonly readOnly?: boolean;\n};\n\n/**\n * When a Session next needs a running process (`Harness.wake()`). `active`: some task can run now or is running, or a\n * reconcile pass such as open's recovery has not landed yet, so a process that dies must be woken again soon, for\n * example by a recovery alarm. `at`: the earliest sleep not yet due,\n * when there is one. Neither: nothing needs a process until new work is submitted. Tasks blocked on a missing or\n * unmigratable definition, `completing` tasks, and waits on live tasks do not count; the work they wait for does.\n */\nexport type Wake = { readonly active: boolean; readonly at?: number };\n\n/** Live task and what the scheduler would do with it under the current registry. */\nexport type TaskInspection = {\n\treadonly record: TaskRecord<JsonValue, JsonValue, JsonValue>;\n\treadonly state: /** An invocation is active. */\n\t\t| { readonly kind: \"running\" }\n\t\t/** The next scheduling pass reserves it; `migrates` when its definition is newer and has `migrate`. */\n\t\t| { readonly kind: \"pending\"; readonly migrates: boolean }\n\t\t/**\n\t\t * Waits for these live tasks: the live part of its `on`, or, when abort-marked, its live ordinary owned work, which\n\t\t * must end before its abort handler starts.\n\t\t */\n\t\t| { readonly kind: \"waiting\"; readonly on: readonly TaskId[] }\n\t\t/** Sleeps until the Harness clock reaches `until`. */\n\t\t| { readonly kind: \"sleeping\"; readonly until: number }\n\t\t/** Outcome held until its ordinary owned work drains. */\n\t\t| { readonly kind: \"completing\" }\n\t\t/** Cannot run here: no registered definition can take it (aborting it settles it as `orphaned`). */\n\t\t| {\n\t\t\t\treadonly kind: \"blocked\";\n\t\t\t\treadonly reason: \"missing_task\" | \"task_too_old\" | \"migration_failed\";\n\t\t\t\treadonly error?: unknown;\n\t\t };\n};\n\n/** Point-in-time view of live work: unfinished tasks and submissions, read on the Session line. */\nexport type HarnessInspection = {\n\treadonly scheduling: \"paused\" | \"running\" | \"closing\";\n\treadonly tasks: readonly TaskInspection[];\n\t/** Queued and placed submissions, in ID order. */\n\treadonly submissions: readonly SubmissionRecord[];\n};\n\n/** Raw active transcript and derived model context. */\nexport type ContextView = {\n\t/** Newest applicable head marker, if any. */\n\treadonly head: EntryRecord | undefined;\n\t/** Raw active entries: the head marker followed by non-head entries from its head through the tail. */\n\treadonly entries: readonly EntryRecord[];\n\t/** Per entry of `entries`, its model messages after edits and excluded stop reasons, before tool result ordering. */\n\treadonly contributions: readonly (readonly Message[])[];\n\t/** Model context for the next provider request. */\n\treadonly messages: readonly Message[];\n};\n\n/** Stateless handle for one conversation, bound to the Harness that returned it. Compare handles by `id`. */\nexport interface Conversation {\n\treadonly id: ConversationId;\n\n\t/** Resolved with the current registry snapshot and settings. */\n\tagent(context: Context): Promise<Agent>;\n\t/** `configure()` in its own commit. */\n\tconfigure(change: AgentChange, context: Context): Promise<void>;\n\n\t/**\n\t * Durably admit user input, a passive entry write, or a continue. A busy conversation, or one with queued items,\n\t * queues input and writes that affect model context in `pi.inbox`; `whenBusy: \"reject\"` rejects input with\n\t * `ConversationBusy` instead and writes nothing. An idle conversation rejects `whenIdle: \"reject\"` input with\n\t * `ConversationIdle` and writes nothing. A write of only `kind` and `data` (no `model`, `head`, or `edits`)\n\t * is appended at once, even mid-run, as it changes nothing the model sees. A continue starts a run on the context as\n\t * it is, after placing queued items; a busy conversation rejects it with `ConversationBusy`, as it never queues.\n\t */\n\tsubmit(submission: SubmissionDraft, context: Context): Promise<Submission>;\n\t/**\n\t * Admit a submission inside the caller's commit `tx` (`Harness.commit()`, `Conversation.commit()`, a task's\n\t * `runtime.commit()`), with the same rules, and return its ID: the admission is stored with that commit, or not at all\n\t * when the callback throws later or the commit fails. Call it before the commit's first table write (`appendEntry()`,\n\t * `createTask()`, `createSubmission()`, another admission): otherwise it throws `ReadAfterWrite`, on every path.\n\t * Documents may be read and written before and after it. A rejection (`ConversationBusy`, `ConversationIdle`) throws\n\t * before any write, so the callback may catch it. Do not call `Submission` or other Harness reads inside the callback:\n\t * they wait for the commit holding the line. Its `pi.durable.submit` span covers the admission only, so its `result`\n\t * is provisional. Throws for a transaction of another Session.\n\t */\n\tsubmit(tx: Tx, submission: SubmissionDraft): Promise<SubmissionId>;\n\t/**\n\t * Admit a write of a `pi.reset` entry that starts a new context, carrying `handoff` as a user message when given.\n\t * Resolves after admission; while busy, it is placed at the next boundary.\n\t */\n\treset(handoff: string | undefined, context: Context): Promise<void>;\n\t/**\n\t * Admit a manual compaction task and return its ID. It summarizes while the conversation keeps working and places its\n\t * summary through a write submission: at once when idle, otherwise at the next boundary (spec §8.7).\n\t */\n\tcompact(instructions: string | undefined, context: Context): Promise<TaskId<CompactionResult>>;\n\n\t/** Session commit whose `tx.createTask()` defaults to this conversation; `options` as for `Session.commit()`. */\n\tcommit<T>(change: (tx: Tx) => T | Promise<T>, context: Context, options?: CommitOptions): Promise<T>;\n\t/**\n\t * Committed raw active transcript and model context. With `at`, the context as of that visible entry: the same view\n\t * `fork(at)` would start with, without creating a conversation.\n\t */\n\tcontext(context: Context, options?: { readonly at?: EntryId }): Promise<ContextView>;\n\t/** Fork-aware history of this conversation, newest first unless `query.order` is `ascending`. */\n\tentries(\n\t\tquery: Omit<EntryQuery, \"conversationId\">,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<EntryRecord, Cursor>>;\n\tfork(at: EntryId, options: ConversationCreateOptions, context: Context): Promise<Conversation>;\n\t/**\n\t * Withdraw queued inputs (queued writes stay), mark every live non-background task of the ordinary ownership scope,\n\t * signal them, and resolve once the scope is idle. Background subtrees survive unless `background` is set.\n\t */\n\tabort(context: Context, options?: ConversationAbortOptions): Promise<void>;\n\t/**\n\t * Resolve when the ordinary ownership scope has no live non-background task: this conversation and the conversations\n\t * owned, transitively, by its non-background tasks.\n\t */\n\twaitForIdle(context: Context): Promise<void>;\n\t/**\n\t * The structural view (spec §9.3) as a serialized watch; commits made while its listener runs arrive folded. Its\n\t * `entries` are a window over the transcript, as `window` says: the newest 50 by default, then appends, dropping the\n\t * oldest past 100. Built on the same mount as `Harness.observeConversation()`.\n\t */\n\twatch(context: Context, window?: ConversationWindow): Promise<ConversationWatch>;\n}\n\nexport type ConversationWatch = WatchHandle<ConversationView>;\n\n/** Durable agent harness over one Session. */\nexport interface Harness extends Session {\n\t/**\n\t * Enable task scheduling. Idempotent; throws after close, and `ReadOnlySession` on a read-only Harness. Calls that\n\t * ask for progress enable it too: `Conversation.submit()`, `Conversation.compact()`, `Conversation.abort()`,\n\t * `Submission.wait()`, `waitForTask()`, `Harness.waitForIdle()`, and `Conversation.waitForIdle()`. Read-only viewers\n\t * never do.\n\t */\n\tresume(): void;\n\t/**\n\t * When this Session next needs a running process, from the scheduler's memory: `active` while some task can run now\n\t * or is running, `at` for the earliest sleep. Answers also while scheduling is paused. A host that wakes the\n\t * process itself, such as a Durable Object alarm, arms from it and calls `resume()` when woken; see\n\t * `HarnessOptions.onWake`.\n\t */\n\twake(): Wake;\n\n\t/** Return the reserved root conversation, creating it with `agent` and `init` in one commit when absent. */\n\troot(\n\t\tcontext: Context,\n\t\toptions?: { readonly agent?: AgentChange; readonly init?: ConversationInit },\n\t): Promise<Conversation>;\n\tconversation(id: ConversationId, context: Context): Promise<Conversation | undefined>;\n\tcreateConversation(options: ConversationCreateOptions, context: Context): Promise<Conversation>;\n\n\tgetTask<R>(id: TaskId<R>, context: Context): Promise<TaskRecord<JsonValue, JsonValue, R> | undefined>;\n\t/** Live tasks and unsettled submissions. Writes nothing and runs no task code. */\n\tinspect(context: Context): Promise<HarnessInspection>;\n\t/** Reacquire a submission, for example after reopen. */\n\tsubmission(id: SubmissionId, context: Context): Promise<Submission | undefined>;\n\t/** `not_found` for an unknown submission or one of another conversation than `conversationId`. */\n\tabortSubmission(\n\t\tid: SubmissionId,\n\t\tcontext: Context,\n\t\tconversationId?: ConversationId,\n\t): Promise<\"aborted\" | \"already_placed\" | \"settled\" | \"not_found\">;\n\t/**\n\t * Commit the abort mark, signal and join an active run invocation, and schedule the abort invocation. A task whose\n\t * definition cannot take it settles as `orphaned` instead.\n\t */\n\tabortTask(id: TaskId, context: Context): Promise<\"marked\" | \"terminal\">;\n\t/** Resolve with the terminal receipt; cancelling `context` cancels only this wait. */\n\twaitForTask<R>(id: TaskId<R>, context: Context): Promise<SettledTask<R>>;\n\t/** Resolve when the ordinary ownership scope of every ownerless conversation has no live non-background task. */\n\twaitForIdle(context: Context): Promise<void>;\n\t/** Session total: every conversation's `pi.usage` summed. */\n\tusage(context: Context): Promise<UsageState>;\n\t/**\n\t * Every live task with its owner edge, status, and owned conversations (spec §9.4), as a serialized watch; commits\n\t * made while its listener runs arrive folded.\n\t */\n\twatchTaskGraph(context: Context): Promise<TaskGraphWatch>;\n\t/**\n\t * Attach a synchronous `Observer` to a conversation's structural view (spec §9.3), atomically on the Session line,\n\t * for adapters: `advance` gets each next revision with its operations as memory adopts the commit, inside Storage's\n\t * `adopt` for a stored one and before it is stored for a deferred one, so it only records it. `window` as for\n\t * `Conversation.watch()`; each observer has its own. `context` governs only the attachment.\n\t */\n\tobserveConversation(\n\t\tid: ConversationId,\n\t\tobserver: Observer<ConversationView>,\n\t\tcontext: Context,\n\t\twindow?: ConversationWindow,\n\t): Promise<Observation<ConversationView>>;\n\t/**\n\t * Attach a synchronous `Observer` to the task graph (spec §9.4), as `observeConversation()` does to a view. A\n\t * `blocked` reason that changes without a commit (a registry change, a failed migration) advances it on the Session\n\t * line outside any commit and `adopt`, with the background context.\n\t */\n\tobserveTaskGraph(observer: Observer<TaskGraph>, context: Context): Promise<Observation<TaskGraph>>;\n}\n\n/**\n * What a hook may use: committed reads and the asking task's memos, which hooks and the task share. Hooks run off the\n * Session line, so reads see what is committed when they run; a hook rerun after a crash may see more.\n */\nexport interface HookApi extends DocumentReader {\n\treadonly taskId: TaskId;\n\treadonly conversationId: ConversationId;\n\t/** The current `HarnessOptions.models`, read at each access. */\n\treadonly models: Models;\n\tmemo<T extends JsonValue>(name: string, context: Context): Promise<T | undefined>;\n\tmemo<T extends JsonValue>(name: string, candidate: T, context: Context): Promise<T>;\n\t/** Committed entry visible from the task's conversation, as `TaskRuntime.entry()`. */\n\tentry(id: EntryId, context: Context): Promise<EntryRecord | undefined>;\n\t/** Undefined when the entry is absent, not visible, or has another kind. */\n\tentry<D extends JsonValue>(token: Entry<D>, id: EntryId, context: Context): Promise<TypedEntry<D> | undefined>;\n\t/** Committed raw history of the task's conversation, as `TaskRuntime.entries()`. */\n\tentries(\n\t\tquery: Omit<EntryQuery, \"conversationId\">,\n\t\tlimit: number,\n\t\tcursor: Cursor | undefined,\n\t\tcontext: Context,\n\t): Promise<Page<EntryRecord, Cursor>>;\n}\n\nexport type HookResult<T> = T | undefined | Promise<T | undefined>;\n\n/** Hooks of the built-in generation task. */\nexport interface GenerationHooks {\n\t/** Before every request attempt, including recovery; the result is used for that request only. */\n\tbeforeRequest(\n\t\trequest: { readonly messages: readonly Message[] },\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<{ readonly messages: readonly Message[] }>;\n\t/**\n\t * After pi-ai builds the provider request body, before it is sent; the result replaces the body for that request only.\n\t * Runs again whenever pi-ai rebuilds the body, such as a retry within one attempt. The body is in the provider API's\n\t * own format (`request.model.api`), so a hook checks the API before changing it.\n\t */\n\tbeforeProviderRequest(\n\t\trequest: { readonly model: Model<Api>; readonly payload: unknown },\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<{ readonly payload: unknown }>;\n\t/** Every terminal provider message, before classification. */\n\tafterResponse(message: AssistantMessage, api: HookApi, context: Context): void | Promise<void>;\n\t/** A final answer; the first `continue` appends a user message and continues the run. */\n\tonYield(answer: AssistantMessage, api: HookApi, context: Context): HookResult<{ readonly continue: UserInput }>;\n\t/** After every tool of the round is terminal; `results` are the round's result entries in call order. */\n\tafterTools(assistant: EntryId, results: readonly EntryId[], api: HookApi, context: Context): void | Promise<void>;\n\t/**\n\t * After a run answered, its answer committed and its inputs settled `done`: a final answer, or a `terminate` round;\n\t * not when an `onYield` continuation is taken, and never after a failure or an abort. The requested tasks of every\n\t * hook are created together as children of the generation, which keeps the run, and the conversation busy, until\n\t * they are terminal; then queued items are placed and the run ends (spec §8.3). A crash before they are created asks\n\t * again; once created, never again for this run.\n\t */\n\tafterRun(run: RunSummary, api: HookApi, context: Context): HookResult<{ readonly tasks: readonly RunEndTask[] }>;\n}\n\n/** How a run ended, for `afterRun` hooks. Read the run's history with `api.entries({ minEntryId: first, maxEntryId: last })`. */\nexport type RunSummary = {\n\t/** A final answer, or a tool round whose every call asked to `terminate`. */\n\treadonly reason: \"answer\" | \"terminate\";\n\t/**\n\t * The run's first entry (`LiveRun.first`): the first one the boundary that started it placed, for a continue the failed\n\t * run's it continues, otherwise its first tool-calling answer; the answer itself for a run that has none of these.\n\t */\n\treadonly first: EntryId;\n\t/** The answer, or the terminating round's tool-calling answer, whose results follow it. */\n\treadonly answer: EntryId;\n\t/** The run's last entry: the answer; for a `terminate` round its newest result, or the reset of its handoff. */\n\treadonly last: EntryId;\n};\n\n/** A task an `afterRun` hook asks for, built by `runEndTask()`. */\nexport type RunEndTask = { readonly task: AnyTask; readonly input: JsonValue };\n\n/** A call as tool hooks see it; `parent` is set for a nested call, one a running tool made through `executeTool()`. */\nexport type ToolHookCall = ToolCall & {\n\treadonly parent?: { readonly taskId: TaskId; readonly callId: string };\n};\n\n/** Hooks of the built-in tool task, for model-issued and nested calls. */\nexport interface ToolHooks {\n\t/** Before intent; the first `block` wins, otherwise `arguments` replace the call's arguments. A throw blocks. */\n\tbeforeTool(\n\t\tcall: ToolHookCall,\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<{ readonly arguments?: JsonObject; readonly block?: string }>;\n\t/**\n\t * Before the result is committed; replaces the result. Runs on every result the tool task writes: an executed\n\t * call's, and the error results the Harness writes itself, told apart by their diagnostic code: a tool that does not\n\t * resolve (`tool_unavailable`), invalid arguments (`invalid_arguments`, with `call.arguments` as the model sent\n\t * them), a block (`blocked`), and, rebuilt from the call's partial output, an interruption (`interrupted`), the\n\t * restart limit (`restart_limit`), and an abort (`aborted`, `abandoned`). Once the task was cut off more than\n\t * `settings.restartLimit` times the hooks no longer run, since they may be what cuts it off, nor in the last attempt\n\t * the scheduler gives an abort handler (restarts at the limit minus one). A result's `structuredOutput` is dropped\n\t * when the Harness wrote it (a nested call a hook turns into a success gets the bounded output as a schema-less tool's\n\t * does), and its `control` applies only to a call that completes (not to an interrupted, cut-off, or aborted one).\n\t * An abort's hooks run inside the abort handler, which cannot be aborted: a slow hook delays `Conversation.abort()`.\n\t */\n\tafterTool(\n\t\tcall: ToolHookCall,\n\t\tresult: ToolExecutionResult,\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<ToolExecutionResult>;\n}\n\n/** Hooks of the built-in compaction task. */\nexport interface CompactionHooks {\n\t/**\n\t * After range selection, before summarizing; the first decision wins. `entries` are the active entries the summary\n\t * replaces, the head marker first, and `messages` their model context, the summarizer's source; `firstKept` is the\n\t * first entry kept verbatim.\n\t */\n\tbeforeCompact(\n\t\tcompaction: {\n\t\t\treadonly reason: CompactionReason;\n\t\t\treadonly entries: readonly EntryRecord[];\n\t\t\treadonly messages: readonly Message[];\n\t\t\treadonly firstKept: EntryId;\n\t\t\treadonly instructions?: string;\n\t\t},\n\t\tapi: HookApi,\n\t\tcontext: Context,\n\t): HookResult<{ readonly decline: true } | { readonly summary: string }>;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { Context } from "@earendil-works/chord";
2
- import type { Cursor, Page } from "../types.ts";
2
+ import type { ConversationId, Cursor, EntryQuery, Page } from "../types.ts";
3
3
  /** Pending waits by key. Each settles once: through `resolve`, `rejectAll`, or cancellation of its context. */
4
4
  export declare class Waiters<K, T> {
5
5
  #private;
@@ -16,4 +16,10 @@ export declare function closedError(session: {
16
16
  readonly error: unknown;
17
17
  } | undefined;
18
18
  }): Error;
19
+ /** `{ extension }` when the extension is known. */
20
+ export declare function optionalExtension(extension: string | undefined): {
21
+ readonly extension?: string;
22
+ };
23
+ /** The scan of conversation `conversationId`'s history that `query` asks for, without fields an untyped caller added. */
24
+ export declare function conversationEntries(conversationId: ConversationId, query: Omit<EntryQuery, "conversationId">): EntryQuery;
19
25
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/harness/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEhD,+GAA+G;AAC/G,qBAAa,OAAO,CAAC,CAAC,EAAE,CAAC;;IAGxB,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBxC;IAED,IAAI,IAAI,CAAC,EAAE,CAEV;IAED,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAI9B;IAED,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI9B;CACD;AAED,qDAAqD;AACrD,wBAAsB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAS7G;AAED,oHAAoH;AACpH,wBAAgB,WAAW,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;CAAE,GAAG,KAAK,CAGzG"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/harness/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE5E,+GAA+G;AAC/G,qBAAa,OAAO,CAAC,CAAC,EAAE,CAAC;;IAGxB,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBxC;IAED,IAAI,IAAI,CAAC,EAAE,CAEV;IAED,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAI9B;IAED,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI9B;CACD;AAED,qDAAqD;AACrD,wBAAsB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAS7G;AAED,oHAAoH;AACpH,wBAAgB,WAAW,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;CAAE,GAAG,KAAK,CAGzG;AAED,mDAAmD;AACnD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAEhG;AAED,yHAAyH;AACzH,wBAAgB,mBAAmB,CAClC,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,GACvC,UAAU,CAOZ"}
@@ -55,4 +55,17 @@ export function closedError(session) {
55
55
  const failure = session.failure;
56
56
  return failure === undefined ? new Error("Harness is closed") : new SessionFailed(failure.error);
57
57
  }
58
+ /** `{ extension }` when the extension is known. */
59
+ export function optionalExtension(extension) {
60
+ return extension === undefined ? {} : { extension };
61
+ }
62
+ /** The scan of conversation `conversationId`'s history that `query` asks for, without fields an untyped caller added. */
63
+ export function conversationEntries(conversationId, query) {
64
+ return {
65
+ conversationId,
66
+ ...(query.minEntryId === undefined ? {} : { minEntryId: query.minEntryId }),
67
+ ...(query.maxEntryId === undefined ? {} : { maxEntryId: query.maxEntryId }),
68
+ ...(query.order === undefined ? {} : { order: query.order }),
69
+ };
70
+ }
58
71
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/harness/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,+GAA+G;AAC/G,MAAM,OAAO,OAAO;IACV,KAAK,GAAG,IAAI,GAAG,EAAmC,CAAC;IAE5D,GAAG,CAAC,GAAM,EAAE,OAAgB;QAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QACnC,IAAI,MAAM,EAAE,OAAO;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,EAAK,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,GAAS,EAAE;gBAC1B,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACnB,IAAI,GAAG,CAAC,IAAI,K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;AACrD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,IAA8D;IAC9F,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,IAAI,MAA0B,CAAC;IAC/B,GAAG,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;IACpB,CAAC,QAAQ,MAAM,KAAK,SAAS,EAAE;IAC/B,OAAO,KAAK,CAAC;AACd,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,WAAW,CAAC,OAAsE;IACjG,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAClG,CAAC","sourcesContent":["import type { Context } from \"@earendil-works/chord\";\nimport { SessionFailed } from \"../errors.ts\";\nimport type { Cursor, Page } from \"../types.ts\";\n\n/** Pending waits by key. Each settles once: through `resolve`, `rejectAll`, or cancellation of its context. */\nexport class Waiters<K, T> {\n\treadonly #sets = new Map<K, Set<PromiseWithResolvers<T>>>();\n\n\tadd(key: K, context: Context): Promise<T> {\n\t\tconst signal = context.abortSignal;\n\t\tif (signal?.aborted) return Promise.reject(signal.reason);\n\t\tconst waiter = Promise.withResolvers<T>();\n\t\tconst set = this.#sets.get(key) ?? new Set();\n\t\tthis.#sets.set(key, set.add(waiter));\n\t\tif (signal !== undefined) {\n\t\t\tconst onAbort = (): void => {\n\t\t\t\tset.delete(waiter);\n\t\t\t\tif (set.size === 0 && this.#sets.get(key) === set) this.#sets.delete(key);\n\t\t\t\twaiter.reject(signal.reason);\n\t\t\t};\n\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tconst detach = (): void => signal.removeEventListener(\"abort\", onAbort);\n\t\t\twaiter.promise.then(detach, detach);\n\t\t}\n\t\treturn waiter.promise;\n\t}\n\n\tkeys(): K[] {\n\t\treturn [...this.#sets.keys()];\n\t}\n\n\tresolve(key: K, value: T): void {\n\t\tconst set = this.#sets.get(key);\n\t\tthis.#sets.delete(key);\n\t\tfor (const waiter of set ?? []) waiter.resolve(value);\n\t}\n\n\trejectAll(error: unknown): void {\n\t\tconst sets = [...this.#sets.values()];\n\t\tthis.#sets.clear();\n\t\tfor (const set of sets) for (const waiter of set) waiter.reject(error);\n\t}\n}\n\n/** Every item of a paginated scan, in page order. */\nexport async function scanAll<T>(scan: (cursor: Cursor | undefined) => Promise<Page<T, Cursor>>): Promise<T[]> {\n\tconst items: T[] = [];\n\tlet cursor: Cursor | undefined;\n\tdo {\n\t\tconst page = await scan(cursor);\n\t\titems.push(...page.items);\n\t\tcursor = page.next;\n\t} while (cursor !== undefined);\n\treturn items;\n}\n\n/** What a closed Harness rejects with: `SessionFailed` with the cause when it closed because the Session failed. */\nexport function closedError(session: { readonly failure: { readonly error: unknown } | undefined }): Error {\n\tconst failure = session.failure;\n\treturn failure === undefined ? new Error(\"Harness is closed\") : new SessionFailed(failure.error);\n}\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/harness/util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,+GAA+G;AAC/G,MAAM,OAAO,OAAO;IACV,KAAK,GAAG,IAAI,GAAG,EAAmC,CAAC;IAE5D,GAAG,CAAC,GAAM,EAAE,OAAgB;QAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QACnC,IAAI,MAAM,EAAE,OAAO;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,EAAK,CAAC;QAC1C,MAAM,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OAAO;QACN,cAAc;QACd,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QAC3E,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QAC3E,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KAC5D,CAAC;AACH,CAAC","sourcesContent":["import type { Context } from \"@earendil-works/chord\";\nimport { SessionFailed } from \"../errors.ts\";\nimport type { ConversationId, Cursor, EntryQuery, Page } from \"../types.ts\";\n\n/** Pending waits by key. Each settles once: through `resolve`, `rejectAll`, or cancellation of its context. */\nexport class Waiters<K, T> {\n\treadonly #sets = new Map<K, Set<PromiseWithResolvers<T>>>();\n\n\tadd(key: K, context: Context): Promise<T> {\n\t\tconst signal = context.abortSignal;\n\t\tif (signal?.aborted) return Promise.reject(signal.reason);\n\t\tconst waiter = Promise.withResolvers<T>();\n\t\tconst set = this.#sets.get(key) ?? new Set();\n\t\tthis.#sets.set(key, set.add(waiter));\n\t\tif (signal !== undefined) {\n\t\t\tconst onAbort = (): void => {\n\t\t\t\tset.delete(waiter);\n\t\t\t\tif (set.size === 0 && this.#sets.get(key) === set) this.#sets.delete(key);\n\t\t\t\twaiter.reject(signal.reason);\n\t\t\t};\n\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tconst detach = (): void => signal.removeEventListener(\"abort\", onAbort);\n\t\t\twaiter.promise.then(detach, detach);\n\t\t}\n\t\treturn waiter.promise;\n\t}\n\n\tkeys(): K[] {\n\t\treturn [...this.#sets.keys()];\n\t}\n\n\tresolve(key: K, value: T): void {\n\t\tconst set = this.#sets.get(key);\n\t\tthis.#sets.delete(key);\n\t\tfor (const waiter of set ?? []) waiter.resolve(value);\n\t}\n\n\trejectAll(error: unknown): void {\n\t\tconst sets = [...this.#sets.values()];\n\t\tthis.#sets.clear();\n\t\tfor (const set of sets) for (const waiter of set) waiter.reject(error);\n\t}\n}\n\n/** Every item of a paginated scan, in page order. */\nexport async function scanAll<T>(scan: (cursor: Cursor | undefined) => Promise<Page<T, Cursor>>): Promise<T[]> {\n\tconst items: T[] = [];\n\tlet cursor: Cursor | undefined;\n\tdo {\n\t\tconst page = await scan(cursor);\n\t\titems.push(...page.items);\n\t\tcursor = page.next;\n\t} while (cursor !== undefined);\n\treturn items;\n}\n\n/** What a closed Harness rejects with: `SessionFailed` with the cause when it closed because the Session failed. */\nexport function closedError(session: { readonly failure: { readonly error: unknown } | undefined }): Error {\n\tconst failure = session.failure;\n\treturn failure === undefined ? new Error(\"Harness is closed\") : new SessionFailed(failure.error);\n}\n\n/** `{ extension }` when the extension is known. */\nexport function optionalExtension(extension: string | undefined): { readonly extension?: string } {\n\treturn extension === undefined ? {} : { extension };\n}\n\n/** The scan of conversation `conversationId`'s history that `query` asks for, without fields an untyped caller added. */\nexport function conversationEntries(\n\tconversationId: ConversationId,\n\tquery: Omit<EntryQuery, \"conversationId\">,\n): EntryQuery {\n\treturn {\n\t\tconversationId,\n\t\t...(query.minEntryId === undefined ? {} : { minEntryId: query.minEntryId }),\n\t\t...(query.maxEntryId === undefined ? {} : { maxEntryId: query.maxEntryId }),\n\t\t...(query.order === undefined ? {} : { order: query.order }),\n\t};\n}\n"]}
@@ -1,45 +1,66 @@
1
- import { type AttachedReplicatedState, type Context } from "@earendil-works/chord";
2
- import { type Op } from "@earendil-works/chord/delta";
1
+ import { type Context, type WatchCall, type WatchEnd, type WatchHandle } from "@earendil-works/chord";
3
2
  import { type SessionImpl } from "../session/session.ts";
4
- import type { CommitPublication, ConversationId, ConversationRecord, EntryRecord, JsonObject, Storage, WatchHandle } from "../types.ts";
5
- /** Structural mount of one conversation's active transcript and built-in documents (spec §9.3). */
3
+ import type { ConversationId, ConversationRecord, EntryId, EntryRecord, JsonObject, Observation, Observer } from "../types.ts";
4
+ /** Structural view of one conversation: a window over its transcript and its built-in documents (spec §9.3). */
6
5
  export type ConversationView = {
7
6
  readonly conversation: ConversationRecord;
8
- /** Raw active entries, as `ContextView.entries`: the head marker, then the non-head entries from its head. */
7
+ /**
8
+ * A window over the transcript, its fork-aware history (`Conversation.entries()`), in entry ID order. Head markers
9
+ * such as compaction summaries sit where they were written; their `head` tells where the entries they summarize end.
10
+ */
9
11
  readonly entries: readonly EntryRecord[];
12
+ /** ID of the entry just before the window; absent when the window starts the transcript. */
13
+ readonly before?: EntryId;
10
14
  /** Built-in conversation documents keyed by kind; absent documents are absent. */
11
15
  readonly docs: Readonly<Record<string, JsonObject>>;
12
16
  };
13
- /** Receives each next revision of a mount, and the Session's close. */
17
+ /**
18
+ * Which entries a view's window holds (spec §9.3). The window holds between `min` and `max` entries: it starts with
19
+ * the newest `min` entries, takes appends, and once it would hold more than `max`, drops its oldest in one splice down
20
+ * to `min`. With `from`, it starts at `from` instead when at most `max` entries are at or after it.
21
+ */
22
+ export type ConversationWindow = {
23
+ /**
24
+ * Where the first value's window starts, inclusive, such as right after the newest entry a client has
25
+ * (`ConversationTranscript.resume`). It selects only that first value: every entry committed after the attachment is
26
+ * appended, whatever its ID. A `from` past the newest entry starts the window empty, with `before` the newest entry.
27
+ */
28
+ readonly from?: EntryId;
29
+ /** Default 50; an integer, at least 1. */
30
+ readonly min?: number;
31
+ /** Default `2 * min`; an integer, at least `min`. */
32
+ readonly max?: number;
33
+ };
34
+ /** Receives each next revision of one observer's window, and the Session's close. */
14
35
  export type ViewObserver = {
15
- advance?(value: ConversationView, ops: readonly Op[], context: Context): void;
16
- /** Every publication, after the mount took it; `ops` are the mount's, possibly none. */
17
- publication?(before: ConversationView, after: ConversationView, ops: readonly Op[], publication: CommitPublication, context: Context): void;
18
- closeSession(failure: {
19
- readonly error: unknown;
20
- } | undefined): void;
36
+ advance(call: WatchCall<ConversationView>, context: Context): void;
37
+ /** The Session closed (`ended`), or failed (`failed`). */
38
+ end(end: WatchEnd): void;
21
39
  };
22
40
  /** The view mounts of a Harness, for adapters built on them. */
23
41
  export declare function conversationViews(harness: object): ConversationViews;
24
42
  /**
25
43
  * The Harness's conversation view mounts: at most one per conversation, built on the Session line by its first
26
- * observer and dropped with its last. Each mount advances from the Session's commit publications, which are durable.
44
+ * observer and dropped with its last. Each mount advances from the Session's commits as memory adopts them, deferred ones
45
+ * (`CommitPersistence`) before they are stored, and hands each observer the next revision of its own window.
27
46
  */
28
47
  export declare class ConversationViews {
29
48
  #private;
30
- constructor(session: SessionImpl, storage: Storage);
49
+ constructor(session: SessionImpl);
31
50
  /** Report an observer's listener error through the Harness. */
32
51
  report(error: unknown): void;
33
- /** A disposable read-only Chord state of the view. */
34
- state(id: ConversationId, context: Context): Promise<AttachedReplicatedState<ConversationView>>;
35
- /** A serialized exact-frame watch of the view; cancelling `context` stops it. */
36
- watch(id: ConversationId, context: Context): Promise<WatchHandle<ConversationView>>;
37
52
  /**
38
- * Register an observer created from the current revision, atomically on the Session line: it sees every later
39
- * publication and nothing earlier. `create` may read committed Storage, still on the line. `release` drops it, and
40
- * the mount with its last observer.
53
+ * Attach a synchronous observer of the view (`Harness.observeConversation()`), behind `guardObserver()`; `context`
54
+ * governs only the attachment.
55
+ */
56
+ observe(id: ConversationId, observer: Observer<ConversationView>, context: Context, window?: ConversationWindow): Promise<Observation<ConversationView>>;
57
+ /** A serialized watch of the view, an observer of its mount; aborting `context` ends it `aborted`. */
58
+ watch(id: ConversationId, context: Context, window?: ConversationWindow): Promise<WatchHandle<ConversationView>>;
59
+ /**
60
+ * Register an observer created from its window's first revision, atomically on the Session line: it sees every later
61
+ * publication and nothing earlier. `release` drops it, and the mount with its last observer.
41
62
  */
42
- attach<O extends ViewObserver>(id: ConversationId, create: (value: ConversationView, release: () => void, storage: Storage) => O | Promise<O>, context: Context): Promise<{
63
+ attach<O extends ViewObserver>(id: ConversationId, window: ConversationWindow | undefined, create: (value: ConversationView, release: () => void) => O, context: Context): Promise<{
43
64
  observer: O;
44
65
  detach: () => void;
45
66
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/harness/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,KAAK,OAAO,EAAmC,MAAM,uBAAuB,CAAC;AAEpH,OAAO,EAAqC,KAAK,EAAE,EAAa,MAAM,6BAA6B,CAAC;AAEpG,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EACX,iBAAiB,EAEjB,cAAc,EACd,kBAAkB,EAElB,WAAW,EACX,UAAU,EACV,OAAO,EACP,WAAW,EACX,MAAM,aAAa,CAAC;AASrB,mGAAmG;AACnG,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAC1C,8GAA8G;IAC9G,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CACpD,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,YAAY,GAAG;IAC1B,OAAO,CAAC,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9E,wFAAwF;IACxF,WAAW,CAAC,CACX,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,SAAS,EAAE,EAAE,EAClB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EAAE,OAAO,GACd,IAAI,CAAC;IACR,YAAY,CAAC,OAA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