@crewx/sdk 0.9.0-rc.18 → 0.9.0-rc.180

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 (372) hide show
  1. package/README.md +1 -1
  2. package/dist/account/auth-client.d.ts +61 -0
  3. package/dist/account/auth-json-v2.d.ts +1 -0
  4. package/dist/account/auth-json.d.ts +30 -0
  5. package/dist/account/config.d.ts +37 -0
  6. package/dist/account/env-bootstrap.d.ts +11 -0
  7. package/dist/account/errors.d.ts +24 -0
  8. package/dist/account/index.d.ts +12 -0
  9. package/dist/account/index.js +2 -0
  10. package/dist/account/session-manager.d.ts +47 -0
  11. package/dist/activity-log/builder.d.ts +59 -6
  12. package/dist/agent/agent-list-view.d.ts +19 -0
  13. package/dist/agent-interceptor/chain.d.ts +25 -0
  14. package/dist/agent-interceptor/index.d.ts +6 -0
  15. package/dist/agent-interceptor/model-runner.d.ts +19 -0
  16. package/dist/agent-interceptor/program-runner.d.ts +13 -0
  17. package/dist/agent-interceptor/protocol.d.ts +68 -0
  18. package/dist/agent-interceptor/run-stop.d.ts +3 -0
  19. package/dist/agent-interceptor/schema.d.ts +267 -0
  20. package/dist/agent-interceptor/types.d.ts +88 -0
  21. package/dist/app/app-files/args.d.ts +12 -0
  22. package/dist/app/app-files/errors.d.ts +6 -0
  23. package/dist/app/app-files/index.d.ts +34 -0
  24. package/dist/app/app-files/lock.d.ts +26 -0
  25. package/dist/app/app-files/root.d.ts +22 -0
  26. package/dist/app/app-files/store.d.ts +47 -0
  27. package/dist/app/app-files/write.child.d.ts +1 -0
  28. package/dist/app/app.d.ts +167 -0
  29. package/dist/app/backend-env.d.ts +3 -0
  30. package/dist/app/content-media-types.d.ts +2 -0
  31. package/dist/app/context.d.ts +2 -0
  32. package/dist/app/entry.d.ts +9 -0
  33. package/dist/app/frame.d.ts +55 -0
  34. package/dist/app/index.d.ts +20 -0
  35. package/dist/app/index.js +13 -0
  36. package/dist/app/job-bridge.child.d.ts +1 -0
  37. package/dist/app/job-bridge.d.ts +67 -0
  38. package/dist/app/job-bridge.drain.child.d.ts +1 -0
  39. package/dist/app/job-bridge.example.d.ts +11 -0
  40. package/dist/app/job-contract.d.ts +40 -0
  41. package/dist/app/job-wire.d.ts +149 -0
  42. package/dist/app/protocol.d.ts +9 -0
  43. package/dist/app/runtime.d.ts +23 -0
  44. package/dist/app/schedule-contract.d.ts +59 -0
  45. package/dist/app/tool-mode.d.ts +3 -0
  46. package/dist/app-artifact-policy/check.d.ts +2 -0
  47. package/dist/app-artifact-policy/contract.d.ts +54 -0
  48. package/dist/app-artifact-policy/helper.d.ts +15 -0
  49. package/dist/app-artifact-policy/index.d.ts +3 -0
  50. package/dist/app-artifact-policy/index.js +18 -0
  51. package/dist/app-artifact-policy/paths.d.ts +24 -0
  52. package/dist/app-artifact-policy/scan.d.ts +47 -0
  53. package/dist/app-ui/index.d.ts +83 -0
  54. package/dist/app-ui/index.js +1 -0
  55. package/dist/boxing/box.types.d.ts +4 -0
  56. package/dist/config/canonicalize-agent-options.d.ts +18 -0
  57. package/dist/config/default-agent-models.d.ts +11 -0
  58. package/dist/config/global-settings.d.ts +33 -0
  59. package/dist/config/migrate-grok-mode.d.ts +6 -0
  60. package/dist/config/model-compat.d.ts +31 -0
  61. package/dist/config/models.generated.d.ts +37 -0
  62. package/dist/config/models.remote.d.ts +1 -0
  63. package/dist/config/overdrive.d.ts +7 -0
  64. package/dist/config/pricing.d.ts +6 -3
  65. package/dist/config/pricing.generated.d.ts +4 -0
  66. package/dist/config/pricing.types.d.ts +4 -0
  67. package/dist/config/timeout.config.d.ts +4 -0
  68. package/dist/config/wi-boards.d.ts +19 -0
  69. package/dist/context-budget/continuity.d.ts +63 -0
  70. package/dist/context-budget/index.d.ts +142 -0
  71. package/dist/conversation/index.d.ts +1 -1
  72. package/dist/conversation/sqlite-provider.d.ts +6 -3
  73. package/dist/conversation/to-template-messages.d.ts +9 -0
  74. package/dist/conversation/types.d.ts +58 -1
  75. package/dist/desktop/command-runner.d.ts +4 -0
  76. package/dist/desktop/default-adapters.d.ts +4 -0
  77. package/dist/desktop/global-install.d.ts +19 -0
  78. package/dist/desktop/index.d.ts +3 -0
  79. package/dist/desktop/index.js +3 -0
  80. package/dist/desktop/install.d.ts +5 -0
  81. package/dist/desktop/lnk.d.ts +22 -0
  82. package/dist/desktop/manifest.d.ts +21 -0
  83. package/dist/desktop/types.d.ts +67 -0
  84. package/dist/desktop/version.d.ts +1 -0
  85. package/dist/desktop/windows-paths.d.ts +21 -0
  86. package/dist/desktop/wrapper.d.ts +18 -0
  87. package/dist/esm/account/index.js +2 -0
  88. package/dist/esm/app/index.js +13 -0
  89. package/dist/esm/app-artifact-policy/index.js +18 -0
  90. package/dist/esm/desktop/index.js +3 -0
  91. package/dist/esm/index.js +1304 -224
  92. package/dist/esm/node/index.js +2 -0
  93. package/dist/esm/plugins/index.js +531 -214
  94. package/dist/esm/process/index.js +1 -0
  95. package/dist/esm/publish/index.js +2 -0
  96. package/dist/esm/repository/index.js +777 -207
  97. package/dist/esm/skills/index.js +2 -0
  98. package/dist/esm/testing/index.js +1 -1
  99. package/dist/events/types.d.ts +28 -0
  100. package/dist/facade/Crewx.d.ts +70 -5
  101. package/dist/facade/task-ticket.d.ts +14 -0
  102. package/dist/highlight/thread-highlight-prompt.d.ts +2 -0
  103. package/dist/highlight/thread-highlighter.d.ts +326 -0
  104. package/dist/index.browser.d.ts +25 -1
  105. package/dist/index.browser.js +6 -2
  106. package/dist/index.d.ts +164 -17
  107. package/dist/index.js +1304 -224
  108. package/dist/internal/console-decoder.d.ts +38 -0
  109. package/dist/internal/windows-spawn.d.ts +10 -0
  110. package/dist/layout/types.d.ts +18 -1
  111. package/dist/lifecycle/process-lease.d.ts +80 -0
  112. package/dist/lifecycle/process-owner.d.ts +20 -0
  113. package/dist/lifecycle/task-heartbeat.d.ts +41 -0
  114. package/dist/lifecycle/task-stop.d.ts +108 -0
  115. package/dist/lifecycle/update-admission.d.ts +45 -0
  116. package/dist/local-server/base-url.d.ts +18 -0
  117. package/dist/local-server/index.d.ts +8 -0
  118. package/dist/local-server/opencode.d.ts +8 -0
  119. package/dist/local-server/probe.d.ts +3 -0
  120. package/dist/local-server/runtime.d.ts +26 -0
  121. package/dist/local-server/types.d.ts +43 -0
  122. package/dist/mcp-app/agent-access.d.ts +26 -0
  123. package/dist/mcp-app/app-handoff.d.ts +109 -0
  124. package/dist/mcp-app/app-icon-read.d.ts +7 -0
  125. package/dist/mcp-app/app-job-bridge.d.ts +30 -0
  126. package/dist/mcp-app/app-job-bridge.example.d.ts +36 -0
  127. package/dist/mcp-app/app-job.d.ts +168 -0
  128. package/dist/mcp-app/app-schedule.d.ts +85 -0
  129. package/dist/mcp-app/apps-context.d.ts +32 -0
  130. package/dist/mcp-app/bundle-provenance.d.ts +3 -0
  131. package/dist/mcp-app/candidate-registration.d.ts +4 -0
  132. package/dist/mcp-app/card-handler.d.ts +7 -0
  133. package/dist/mcp-app/catalog.d.ts +7 -0
  134. package/dist/mcp-app/content-channel.d.ts +86 -0
  135. package/dist/mcp-app/content-declarations.d.ts +31 -0
  136. package/dist/mcp-app/dev-checks.d.ts +31 -0
  137. package/dist/mcp-app/diagnostic-reason.d.ts +3 -0
  138. package/dist/mcp-app/discovery.d.ts +164 -0
  139. package/dist/mcp-app/errors.d.ts +7 -0
  140. package/dist/mcp-app/index.d.ts +45 -0
  141. package/dist/mcp-app/installed-app-ref.d.ts +25 -0
  142. package/dist/mcp-app/model-context.d.ts +29 -0
  143. package/dist/mcp-app/node-app-discovery-fs.d.ts +23 -0
  144. package/dist/mcp-app/product-bundle-assets.d.ts +27 -0
  145. package/dist/mcp-app/product-bundle-loader.d.ts +53 -0
  146. package/dist/mcp-app/projection.d.ts +14 -0
  147. package/dist/mcp-app/prompt-cards.d.ts +28 -0
  148. package/dist/mcp-app/registry.d.ts +28 -0
  149. package/dist/mcp-app/skill-backend.d.ts +141 -0
  150. package/dist/mcp-app/state-set.d.ts +9 -0
  151. package/dist/mcp-app/types.d.ts +501 -0
  152. package/dist/mcp-app/workspace-app-assets.d.ts +42 -0
  153. package/dist/mcp-app/workspace-app-scan-cache.d.ts +27 -0
  154. package/dist/mcp-app/workspace-snapshot.d.ts +80 -0
  155. package/dist/migrations/0011_far_black_tarantula.sql +1 -0
  156. package/dist/migrations/0012_blue_turbo.sql +23 -0
  157. package/dist/migrations/0013_hesitant_adam_destine.sql +15 -0
  158. package/dist/migrations/0014_organic_mongu.sql +73 -0
  159. package/dist/migrations/0015_panoramic_gorilla_man.sql +71 -0
  160. package/dist/migrations/0016_fuzzy_hemingway.sql +14 -0
  161. package/dist/migrations/0017_project_stage_sdk_migration.sql +29 -0
  162. package/dist/migrations/0018_bored_jackal.sql +33 -0
  163. package/dist/migrations/0019_backfill_task_thread_ids.sql +74 -0
  164. package/dist/migrations/0020_useful_iron_lad.sql +55 -0
  165. package/dist/migrations/0021_dashing_peter_quill.sql +51 -0
  166. package/dist/migrations/0022_wandering_bucky.sql +1 -0
  167. package/dist/migrations/0023_red_payback.sql +1 -0
  168. package/dist/migrations/0024_storage_metadata.sql +262 -0
  169. package/dist/migrations/0025_task_heartbeat.sql +8 -0
  170. package/dist/migrations/0025_thread_app_instance_ledger.sql +2 -0
  171. package/dist/migrations/0026_mcp_action_source.sql +47 -0
  172. package/dist/migrations/0027_task_stop_scope_cleanup.sql +5 -0
  173. package/dist/migrations/0027_ui_instance_active_unique.sql +2 -0
  174. package/dist/migrations/0029_nice_rhino.sql +1 -0
  175. package/dist/migrations/0031_petite_arclight.sql +6 -0
  176. package/dist/migrations/0032_ui_instance_opened_by.sql +1 -0
  177. package/dist/migrations/0033_thread_creator_boundary_guard.sql +38 -0
  178. package/dist/migrations/0034_keen_fallen_one.sql +36 -0
  179. package/dist/migrations/0035_request_log_daily.sql +11 -0
  180. package/dist/migrations/0036_ui_definition_archive.sql +8 -0
  181. package/dist/migrations/0037_ui_instance_agent_open_request.sql +1 -0
  182. package/dist/migrations/0038_task_rating.sql +3 -0
  183. package/dist/migrations/0039_aspiring_purifiers.sql +9 -0
  184. package/dist/migrations/0040_task_provider_inputs.sql +53 -0
  185. package/dist/migrations/0041_tranquil_vivisector.sql +54 -0
  186. package/dist/migrations/0042_breezy_blue_shield.sql +31 -0
  187. package/dist/migrations/0043_nervous_darkstar.sql +1 -0
  188. package/dist/migrations/0044_military_galactus.sql +8 -0
  189. package/dist/migrations/0045_task_pid_started_at.sql +1 -0
  190. package/dist/migrations/0046_acoustic_karnak.sql +49 -0
  191. package/dist/migrations/0047_doc_sync_connect_requests.sql +18 -0
  192. package/dist/migrations/meta/0011_snapshot.json +1342 -0
  193. package/dist/migrations/meta/0012_snapshot.json +1494 -0
  194. package/dist/migrations/meta/0013_snapshot.json +1592 -0
  195. package/dist/migrations/meta/0014_snapshot.json +1975 -0
  196. package/dist/migrations/meta/0015_snapshot.json +2315 -0
  197. package/dist/migrations/meta/0016_snapshot.json +2419 -0
  198. package/dist/migrations/meta/0017_snapshot.json +2419 -0
  199. package/dist/migrations/meta/0018_snapshot.json +2570 -0
  200. package/dist/migrations/meta/0020_snapshot.json +2895 -0
  201. package/dist/migrations/meta/0021_snapshot.json +3031 -0
  202. package/dist/migrations/meta/0022_snapshot.json +3039 -0
  203. package/dist/migrations/meta/0023_snapshot.json +3047 -0
  204. package/dist/migrations/meta/0029_snapshot.json +3206 -0
  205. package/dist/migrations/meta/0031_snapshot.json +3251 -0
  206. package/dist/migrations/meta/0034_snapshot.json +3473 -0
  207. package/dist/migrations/meta/0035_snapshot.json +3547 -0
  208. package/dist/migrations/meta/0036_snapshot.json +3591 -0
  209. package/dist/migrations/meta/0037_snapshot.json +3598 -0
  210. package/dist/migrations/meta/0038_snapshot.json +3626 -0
  211. package/dist/migrations/meta/0039_snapshot.json +3684 -0
  212. package/dist/migrations/meta/0040_snapshot.json +3759 -0
  213. package/dist/migrations/meta/0041_snapshot.json +4156 -0
  214. package/dist/migrations/meta/0042_snapshot.json +4383 -0
  215. package/dist/migrations/meta/0043_snapshot.json +4390 -0
  216. package/dist/migrations/meta/0044_snapshot.json +4435 -0
  217. package/dist/migrations/meta/0045_snapshot.json +4442 -0
  218. package/dist/migrations/meta/0046_snapshot.json +4733 -0
  219. package/dist/migrations/meta/0047_snapshot.json +4832 -0
  220. package/dist/migrations/meta/_journal.json +259 -0
  221. package/dist/node/index.d.ts +1 -0
  222. package/dist/node/index.js +2 -0
  223. package/dist/paths.d.ts +1 -0
  224. package/dist/plugin/types.d.ts +1 -0
  225. package/dist/plugins/index.d.ts +1 -1
  226. package/dist/plugins/index.js +531 -214
  227. package/dist/plugins/sqlite-tracing.d.ts +46 -0
  228. package/dist/process/index.d.ts +2 -0
  229. package/dist/process/index.js +1 -0
  230. package/dist/process/process-control.d.ts +74 -0
  231. package/dist/prompt/tag-names.d.ts +22 -0
  232. package/dist/provider/acp/connection.d.ts +6 -0
  233. package/dist/provider/acp/meta.d.ts +11 -0
  234. package/dist/provider/bridge.d.ts +12 -2
  235. package/dist/provider/classify-task-error.d.ts +2 -0
  236. package/dist/provider/claude-agent-env.d.ts +1 -0
  237. package/dist/provider/cli/adapter.types.d.ts +23 -2
  238. package/dist/provider/cli/adapters/agent-call.util.d.ts +1 -1
  239. package/dist/provider/cli/adapters/cli-knob.util.d.ts +7 -0
  240. package/dist/provider/cli/adapters/codex-item.d.ts +1 -0
  241. package/dist/provider/cli/adapters/event-timestamp.util.d.ts +1 -0
  242. package/dist/provider/cli/adapters/grok.d.ts +2 -0
  243. package/dist/provider/cli/adapters/index.d.ts +5 -0
  244. package/dist/provider/cli/index.d.ts +3 -2
  245. package/dist/provider/cli/meta.d.ts +5 -0
  246. package/dist/provider/cli/protocol-envelope.d.ts +3 -0
  247. package/dist/provider/errors.d.ts +5 -1
  248. package/dist/provider/idle-watchdog.d.ts +19 -0
  249. package/dist/provider/models.d.ts +17 -12
  250. package/dist/provider/order.d.ts +1 -1
  251. package/dist/provider/parse-usage.d.ts +6 -0
  252. package/dist/provider/provider-selection.d.ts +8 -0
  253. package/dist/provider/redact-technical-message.d.ts +1 -0
  254. package/dist/provider/task-error.types.d.ts +17 -0
  255. package/dist/provider-account/accounts.d.ts +15 -0
  256. package/dist/provider-account/index.d.ts +5 -0
  257. package/dist/provider-account/registry.d.ts +30 -0
  258. package/dist/provider-account/types.d.ts +40 -0
  259. package/dist/publish/constants.d.ts +6 -0
  260. package/dist/publish/errors.d.ts +7 -0
  261. package/dist/publish/index.d.ts +55 -0
  262. package/dist/publish/index.js +2 -0
  263. package/dist/publish/manifest.d.ts +47 -0
  264. package/dist/publish/marketplace-api.constants.d.ts +1 -0
  265. package/dist/publish/pack.d.ts +6 -0
  266. package/dist/publish/scan.d.ts +10 -0
  267. package/dist/publish/secrets.d.ts +6 -0
  268. package/dist/publish/upload.d.ts +19 -0
  269. package/dist/remote/execution-profile.d.ts +9 -0
  270. package/dist/remote/index.d.ts +1 -0
  271. package/dist/remote/types.d.ts +28 -0
  272. package/dist/repository/agent-send-history.repository.d.ts +23 -0
  273. package/dist/repository/agent-suggestion.repository.d.ts +34 -0
  274. package/dist/repository/base-sqlite-repository.d.ts +1 -0
  275. package/dist/repository/common-code.repository.d.ts +45 -0
  276. package/dist/repository/db.d.ts +13 -1
  277. package/dist/repository/index.d.ts +62 -6
  278. package/dist/repository/index.js +777 -207
  279. package/dist/repository/logs-db.d.ts +12 -0
  280. package/dist/repository/notification.repository.d.ts +58 -0
  281. package/dist/repository/project.repository.d.ts +90 -0
  282. package/dist/repository/public-task-answer.d.ts +24 -0
  283. package/dist/repository/request-log-mover.d.ts +70 -0
  284. package/dist/repository/request-log.repository.d.ts +7 -3
  285. package/dist/repository/run-columns.d.ts +10 -0
  286. package/dist/repository/run-history.repository.d.ts +112 -0
  287. package/dist/repository/schedule-run.repository.d.ts +103 -0
  288. package/dist/repository/sidebar-tab.repository.d.ts +86 -0
  289. package/dist/repository/storage-metadata.repository.d.ts +64 -0
  290. package/dist/repository/task-log-migration.d.ts +74 -0
  291. package/dist/repository/task-log.repository.d.ts +47 -0
  292. package/dist/repository/task-status.d.ts +21 -0
  293. package/dist/repository/task.repository.d.ts +318 -8
  294. package/dist/repository/thread-history.repository.d.ts +193 -0
  295. package/dist/repository/thread-origin-verdict.d.ts +27 -0
  296. package/dist/repository/thread-title.types.d.ts +29 -0
  297. package/dist/repository/thread.repository.d.ts +134 -5
  298. package/dist/repository/usage-backfill.d.ts +62 -0
  299. package/dist/repository/usage-from-logs.d.ts +21 -0
  300. package/dist/repository/workflow-anchor-kinds.d.ts +4 -0
  301. package/dist/repository/workspace.repository.d.ts +3 -0
  302. package/dist/schema/agent-send-history.d.ts +85 -0
  303. package/dist/schema/agent-suggestions.d.ts +199 -0
  304. package/dist/schema/common-codes.d.ts +216 -0
  305. package/dist/schema/doc-sync-connect-requests.d.ts +140 -0
  306. package/dist/schema/doc-sync-links.d.ts +481 -0
  307. package/dist/schema/index.d.ts +20 -0
  308. package/dist/schema/notifications.d.ts +303 -0
  309. package/dist/schema/projects.d.ts +610 -0
  310. package/dist/schema/request-log-daily.d.ts +151 -0
  311. package/dist/schema/run-column-backfill.d.ts +81 -0
  312. package/dist/schema/schedule-runs.d.ts +451 -0
  313. package/dist/schema/sidebar-tabs.d.ts +466 -0
  314. package/dist/schema/storage-metadata.d.ts +181 -0
  315. package/dist/schema/task-log-events.d.ts +119 -0
  316. package/dist/schema/task-provider-inputs.d.ts +100 -0
  317. package/dist/schema/tasks.d.ts +1172 -1
  318. package/dist/schema/thread-creator-unverified.d.ts +45 -0
  319. package/dist/schema/thread-history.d.ts +734 -0
  320. package/dist/schema/threads.d.ts +59 -0
  321. package/dist/schema/ui-action-receipts.d.ts +358 -0
  322. package/dist/schema/ui-definition-archive.d.ts +63 -0
  323. package/dist/schema/ui-instance-repins.d.ts +222 -0
  324. package/dist/schema/ui-instances.d.ts +324 -0
  325. package/dist/schema/workspaces.d.ts +17 -0
  326. package/dist/skills/index.d.ts +15 -0
  327. package/dist/skills/index.js +2 -0
  328. package/dist/skills/types.d.ts +18 -0
  329. package/dist/task-log/anchor-child-tasks.d.ts +7 -0
  330. package/dist/task-log/delegation-trailer.d.ts +34 -0
  331. package/dist/template/engine.d.ts +2 -2
  332. package/dist/template/helpers/exec.browser.d.ts +4 -3
  333. package/dist/template/helpers/exec.d.ts +4 -3
  334. package/dist/template/helpers/format-conversation.d.ts +1 -0
  335. package/dist/template/types.d.ts +20 -0
  336. package/dist/testing/index.js +1 -1
  337. package/dist/types/index.d.ts +1611 -3
  338. package/dist/types/task-log.types.d.ts +6 -1
  339. package/dist/ui-card/index.d.ts +2 -0
  340. package/dist/ui-card/legacy-card-parser.d.ts +11 -0
  341. package/dist/ui-instance/definition.d.ts +6 -0
  342. package/dist/ui-instance/errors.d.ts +18 -0
  343. package/dist/ui-instance/index.d.ts +11 -0
  344. package/dist/ui-instance/json.d.ts +19 -0
  345. package/dist/ui-instance/lineage.d.ts +24 -0
  346. package/dist/ui-instance/runtime.d.ts +19 -0
  347. package/dist/ui-instance/store.d.ts +213 -0
  348. package/dist/ui-instance/types.d.ts +344 -0
  349. package/dist/ui-plugin/app-icon.d.ts +50 -0
  350. package/dist/ui-plugin/app-manifest.d.ts +64 -0
  351. package/dist/ui-plugin/csp.d.ts +28 -0
  352. package/dist/ui-plugin/index.d.ts +8 -0
  353. package/dist/ui-plugin/limits.d.ts +27 -0
  354. package/dist/ui-plugin/manifest.d.ts +3 -0
  355. package/dist/ui-plugin/types.d.ts +220 -0
  356. package/dist/ui-plugin/validator.d.ts +18 -0
  357. package/dist/utils/crewx-executable.d.ts +76 -0
  358. package/dist/utils/crewx-home.d.ts +1 -0
  359. package/dist/utils/env-defaults.d.ts +3 -0
  360. package/dist/utils/id.d.ts +1 -1
  361. package/dist/utils/local-identity.d.ts +2 -0
  362. package/dist/utils/runner-env.d.ts +3 -0
  363. package/dist/utils/timestamp.d.ts +1 -0
  364. package/dist/utils/workspace.d.ts +1 -0
  365. package/dist/wi/create.d.ts +48 -0
  366. package/dist/wi/select.d.ts +20 -0
  367. package/package.json +68 -3
  368. package/templates/agents/default.yaml +303 -128
  369. package/templates/documents/crewx-manual.md +138 -138
  370. package/templates/documents/crewx-quick-guide.md +8 -7
  371. package/templates/workflows/wi-default-flow.yaml +65 -0
  372. package/templates/workflows/wi-plan-flow.yaml +140 -0
@@ -0,0 +1,74 @@
1
+ export type TaskLogMigrationMode = 'dry-run' | 'apply' | 'verify';
2
+ export declare const TASK_LOG_MIGRATION_TERMINAL_STATUSES: readonly ["success", "failed", "completed"];
3
+ export declare const TASK_LOG_MIGRATION_MIN_FREE_SPACE_BYTES: number;
4
+ export declare const TASK_LOG_MIGRATION_EVENT_ROW_BYTES = 256;
5
+ export type TaskLogVerificationIssueKind = 'malformed-blob' | 'mixed-source' | 'seq-gap' | 'duplicate-seq' | 'orphan-event' | 'count-mismatch' | 'source-invariant' | 'invalid-event';
6
+ export type TaskLogMigrationFailureKind = 'malformed' | 'mixed-source' | 'metadata' | 'invalid-source';
7
+ export interface TaskLogMigrationOptions {
8
+ mode: TaskLogMigrationMode;
9
+ dbPath?: string;
10
+ batchTasks?: number;
11
+ backupPath?: string;
12
+ }
13
+ export interface TaskLogMigrationFailure {
14
+ taskId: string;
15
+ reason: string;
16
+ kind?: TaskLogMigrationFailureKind;
17
+ }
18
+ export interface TaskLogVerificationIssue {
19
+ taskId: string | null;
20
+ kind: TaskLogVerificationIssueKind;
21
+ reason: string;
22
+ expected?: number;
23
+ actual?: number;
24
+ seq?: number;
25
+ }
26
+ export interface TaskLogVerificationReport {
27
+ checkedTasks: number;
28
+ eventSourceTasks: number;
29
+ blobSourceTasks: number;
30
+ eventCount: number;
31
+ orphanEventCount: number;
32
+ failedTasks: number;
33
+ issues: TaskLogVerificationIssue[];
34
+ }
35
+ export interface TaskLogMigrationReport {
36
+ mode: TaskLogMigrationMode;
37
+ ok: boolean;
38
+ dbPath: string;
39
+ backupPath?: string;
40
+ backupMethod?: 'sqlite-online-backup';
41
+ blockedReason?: string;
42
+ activeTaskCount: number;
43
+ taskCount: number;
44
+ candidateTaskCount: number;
45
+ eligibleTaskCount: number;
46
+ statusCounts: Record<string, number>;
47
+ deferredTaskCount: number;
48
+ deferredStatusCounts: Record<string, number>;
49
+ entryCount: number;
50
+ sourceBytes: number;
51
+ estimatedFreeSpaceBytes: number;
52
+ requiredFreeSpaceBytes: number;
53
+ availableFreeSpaceBytes: number;
54
+ minimumFreeSpaceReserveBytes: number;
55
+ freeSpaceGatePassed: boolean;
56
+ migratedTasks: number;
57
+ migratedEntries: number;
58
+ skippedTasks: number;
59
+ failedTasks: number;
60
+ malformedRows: TaskLogMigrationFailure[];
61
+ failures: TaskLogMigrationFailure[];
62
+ logicalSourceBytesRemoved: number;
63
+ warnings: string[];
64
+ remainingTaskCount: number;
65
+ verification?: TaskLogVerificationReport;
66
+ }
67
+ export declare function resolveTaskLogMigrationDbPath(dbPath?: string): string;
68
+ export declare function hasSufficientTaskLogMigrationFreeSpace(availableFreeSpaceBytes: number, estimatedFreeSpaceBytes: number): boolean;
69
+ export interface TaskLogWalCheckpointConnection {
70
+ pragma(pragma: string): unknown;
71
+ }
72
+ export declare function tryCheckpointTaskLogWal(db: TaskLogWalCheckpointConnection): string | undefined;
73
+ export declare function runTaskLogMigration(options: TaskLogMigrationOptions): Promise<TaskLogMigrationReport>;
74
+ export declare function taskLogBackupName(backupPath: string): string;
@@ -0,0 +1,47 @@
1
+ import { BaseSqliteRepository } from './base-sqlite-repository.js';
2
+ export type TaskLogStorage = 'blob' | 'events';
3
+ export interface TaskLogEntry {
4
+ timestamp: string;
5
+ level: string;
6
+ message: string;
7
+ }
8
+ export type RawTaskLogEntry = TaskLogEntry;
9
+ export type TaskLogRawEntry = TaskLogEntry;
10
+ export interface TaskLogState {
11
+ taskId: string;
12
+ source: TaskLogStorage;
13
+ revision: number;
14
+ lastSeq: number;
15
+ }
16
+ export type TaskLogReadEntry = TaskLogEntry & {
17
+ readonly seq: number;
18
+ };
19
+ export interface TaskLogReadResult extends TaskLogState {
20
+ entries: TaskLogReadEntry[];
21
+ }
22
+ export interface TaskLogRepositoryContract {
23
+ appendLog(taskId: string, entry: TaskLogEntry): TaskLogState;
24
+ appendLogs(taskId: string, entries: readonly TaskLogEntry[]): TaskLogState;
25
+ readLogs(taskId: string): TaskLogReadResult | undefined;
26
+ readLogsTail(taskId: string, limit: number): TaskLogReadResult | undefined;
27
+ getLogState(taskId: string): TaskLogState | undefined;
28
+ }
29
+ export declare class TaskLogRepository extends BaseSqliteRepository implements TaskLogRepositoryContract {
30
+ private readonly dbPath?;
31
+ constructor(opts?: {
32
+ dbPath?: string;
33
+ dbRoot?: string;
34
+ });
35
+ resolveDbPath(): string;
36
+ private openHandle;
37
+ private findStateRow;
38
+ private findStateRowInTransaction;
39
+ private requireStateRowInTransaction;
40
+ appendLog(taskId: string, entry: TaskLogEntry): TaskLogState;
41
+ appendLogs(taskId: string, entries: readonly TaskLogEntry[]): TaskLogState;
42
+ getLogState(taskId: string): TaskLogState | undefined;
43
+ readLogs(taskId: string): TaskLogReadResult | undefined;
44
+ readLogsTail(taskId: string, limit: number): TaskLogReadResult | undefined;
45
+ readTail(taskId: string, limit: number): TaskLogReadResult | undefined;
46
+ private readLogsInternal;
47
+ }
@@ -0,0 +1,21 @@
1
+ export type TaskStatus = 'pending' | 'running' | 'paused' | 'success' | 'failed' | 'stopped';
2
+ export declare const TASK_TERMINAL_STATUSES: readonly ["success", "failed", "stopped"];
3
+ export declare const TASK_TERMINAL_STORED_STATUSES: readonly ["success", "completed", "done", "failed", "error", "stopped", "runner_lost"];
4
+ export declare function storedTaskStatusesFor(statuses: readonly string[]): string[];
5
+ export type TaskTerminalStatus = (typeof TASK_TERMINAL_STATUSES)[number];
6
+ export type TaskTerminalReason = 'user_stop' | 'runner_lost' | 'launch_failed';
7
+ export declare const LEGACY_TASK_TERMINAL_ERROR_PATTERNS: {
8
+ readonly stopped: RegExp;
9
+ readonly runnerLost: RegExp;
10
+ };
11
+ export interface TaskStatusInput {
12
+ status: string;
13
+ error?: string | null;
14
+ metadata?: string | null;
15
+ }
16
+ export declare function readTaskTerminalReason(row: TaskStatusInput): TaskTerminalReason | undefined;
17
+ export declare function normalizeTaskStatus(row: TaskStatusInput): TaskStatus;
18
+ export declare function normalizeTaskRow<T extends TaskStatusInput>(row: T): Omit<T, 'status'> & {
19
+ status: TaskStatus;
20
+ };
21
+ export declare function isTaskRetryableByDefault(row: TaskStatusInput): boolean;
@@ -1,21 +1,127 @@
1
1
  import { BaseSqliteRepository } from './base-sqlite-repository.js';
2
+ import type { DrizzleDb } from './db.js';
3
+ import { RepositoryError } from './errors.js';
2
4
  import { tasks } from '../schema/index.js';
3
- export type TaskRow = typeof tasks.$inferSelect;
5
+ import { type WorkflowAnchorTaskKind } from './workflow-anchor-kinds.js';
6
+ import { type ProcessControlOptions } from '../process/process-control.js';
7
+ import type { TaskLogEntry, TaskLogReadResult, TaskLogState } from './task-log.repository.js';
8
+ import { type TaskStatus, type TaskTerminalReason } from './task-status.js';
9
+ import { type StopTaskOptions, type StopTaskGenerationForInstructionOptions, type StopTaskResult } from '../lifecycle/task-stop.js';
10
+ export { TASK_HEARTBEAT_HARD_STALE_MS, TASK_HEARTBEAT_INTERVAL_MS, TASK_HEARTBEAT_STALE_MS, resolveTaskHeartbeatHardStaleMs, resolveTaskHeartbeatIntervalMs, resolveTaskHeartbeatStaleMs, } from '../lifecycle/task-heartbeat.js';
11
+ type RawTaskRow = Omit<typeof tasks.$inferSelect, 'security_key'>;
12
+ export type TaskRow = Omit<RawTaskRow, 'status'> & {
13
+ status: TaskStatus;
14
+ };
15
+ export interface ProviderInputRecord {
16
+ runEpoch: number;
17
+ input: string;
18
+ keyWrapSkipped: boolean;
19
+ recordedAt: string;
20
+ }
21
+ export interface ProviderInputEpochEntry {
22
+ runEpoch: number;
23
+ available: boolean;
24
+ reason?: 'absent' | 'pruned';
25
+ keyWrapSkipped?: true;
26
+ }
4
27
  export type NewTask = typeof tasks.$inferInsert;
5
- export type TaskListRow = Pick<TaskRow, 'id' | 'thread_id' | 'agent_id' | 'status' | 'parent_task_id' | 'started_at' | 'completed_at' | 'duration_ms' | 'input_tokens' | 'output_tokens' | 'cost_usd' | 'error'>;
28
+ type TaskActorKind = NonNullable<NewTask['actor_kind']>;
29
+ export type TaskKillStatus = 'terminated' | 'not_found' | 'failed' | 'not_running';
30
+ export interface TaskKillResult {
31
+ status: TaskKillStatus;
32
+ killed: boolean;
33
+ pid?: number;
34
+ error?: string;
35
+ }
36
+ export interface TaskStopRequestResult {
37
+ accepted: boolean;
38
+ status: string | null;
39
+ runEpoch: number;
40
+ alreadyRequestedAt?: string;
41
+ }
42
+ export type TaskStopOrigin = 'http' | 'cli' | 'instruction' | 'workflow' | 'internal';
43
+ export interface TaskStopRequestContext {
44
+ origin?: TaskStopOrigin;
45
+ at?: string;
46
+ callerPid?: number;
47
+ callerTaskId?: string;
48
+ }
49
+ export type TaskStopMethod = 'cooperative' | 'forced';
50
+ export interface FinalizeTaskStopOptions {
51
+ id: string;
52
+ runEpoch: number;
53
+ completedAt?: string;
54
+ method: TaskStopMethod;
55
+ error?: string;
56
+ terminalReason?: TaskTerminalReason;
57
+ durationMs?: number | null;
58
+ }
59
+ export interface FinalizeTaskForHostShutdownOptions {
60
+ id: string;
61
+ expectedRunEpoch: number;
62
+ workspaceId?: string | null;
63
+ completedAt?: string;
64
+ }
65
+ export type FinalizeTaskForHostShutdownOutcome = 'settled' | 'not_running' | 'epoch_mismatch' | 'workspace_mismatch';
66
+ export type TaskListRow = Pick<TaskRow, 'id' | 'thread_id' | 'agent_id' | 'status' | 'parent_task_id' | 'started_at' | 'completed_at' | 'duration_ms' | 'input_tokens' | 'output_tokens' | 'cost_usd' | 'error' | 'rating' | 'rated_at'> & {
67
+ terminalReason: TaskTerminalReason | null;
68
+ };
69
+ export type TaskActivityLogRow = Pick<TaskRow, 'id' | 'thread_id' | 'agent_id' | 'parent_task_id' | 'started_at' | 'completed_at'>;
70
+ export type FindTasksByThreadOptions = {
71
+ projection: 'activity-log';
72
+ };
73
+ export interface WorkflowCardRow {
74
+ taskId: string;
75
+ workflowRunId?: string;
76
+ raw?: string;
77
+ }
78
+ export interface WorkflowParentTaskRow {
79
+ id: string;
80
+ agent_id: string;
81
+ thread_id: string | null;
82
+ workspace_id: string | null;
83
+ platform: string | null;
84
+ status: string;
85
+ error: string | null;
86
+ completed_at: string | null;
87
+ duration_ms: number | null;
88
+ started_at: string;
89
+ metadata: string | null;
90
+ }
91
+ export { WORKFLOW_ANCHOR_TASK_KINDS, isWorkflowAnchorTaskKind } from './workflow-anchor-kinds.js';
92
+ export type { WorkflowAnchorTaskKind } from './workflow-anchor-kinds.js';
93
+ export type WorkflowParentTaskKind = WorkflowAnchorTaskKind;
94
+ export interface WorkflowParentTaskLookup {
95
+ workspaceId: string;
96
+ workflowRunId: string;
97
+ kind: WorkflowParentTaskKind;
98
+ }
99
+ export interface AgentProviderUsageRow {
100
+ provider: string;
101
+ inputTokens: number;
102
+ outputTokens: number;
103
+ cachedInputTokens: number;
104
+ totalTokens: number;
105
+ costUsd: number;
106
+ totalTasks: number;
107
+ unavailableTaskCount: number;
108
+ }
6
109
  export interface AgentUsageRow {
7
110
  agentId: string;
8
111
  workspaceId: string | null;
9
112
  totalTasks: number;
113
+ unavailableTaskCount?: number;
10
114
  inputTokens: number;
11
115
  outputTokens: number;
12
116
  cachedInputTokens: number;
13
117
  costUsd: number;
14
118
  totalTokens: number;
119
+ providers: AgentProviderUsageRow[];
15
120
  }
16
121
  export interface TrendRow {
17
122
  date: string;
18
123
  agentId: string;
124
+ unavailableTaskCount?: number;
19
125
  inputTokens: number;
20
126
  outputTokens: number;
21
127
  cachedInputTokens: number;
@@ -25,6 +131,7 @@ export interface TrendRow {
25
131
  export interface ProviderUsageRow {
26
132
  provider: string;
27
133
  totalTasks: number;
134
+ unavailableTaskCount?: number;
28
135
  inputTokens: number;
29
136
  outputTokens: number;
30
137
  cachedInputTokens: number;
@@ -37,6 +144,7 @@ export interface ModelUsageRow {
37
144
  model: string;
38
145
  provider: string;
39
146
  totalTasks: number;
147
+ unavailableTaskCount?: number;
40
148
  inputTokens: number;
41
149
  outputTokens: number;
42
150
  cachedInputTokens: number;
@@ -52,20 +160,84 @@ export interface ReportTaskRow {
52
160
  status: string;
53
161
  error: string | null;
54
162
  exitCode: number | null;
163
+ terminalReason: TaskTerminalReason | null;
164
+ }
165
+ export interface DelegationEdge {
166
+ callerAgentId: string | null;
167
+ agentId: string;
168
+ taskCount: number;
169
+ totalTokens: number;
170
+ outputTokens: number;
171
+ }
172
+ export interface DelegationMatrixResult {
173
+ edges: DelegationEdge[];
174
+ truncated: boolean;
175
+ }
176
+ export type TaskEvidenceRow = Pick<TaskRow, 'id' | 'agent_id' | 'status' | 'prompt' | 'started_at' | 'completed_at' | 'thread_id'> & {
177
+ terminalReason: TaskTerminalReason | null;
178
+ };
179
+ export interface ThreadChainTurn {
180
+ id: string;
181
+ agentId: string;
182
+ status: string;
183
+ prompt: string;
184
+ startedAt: string;
185
+ completedAt: string | null;
55
186
  }
187
+ export interface ThreadChain {
188
+ threadId: string;
189
+ targetAgentTurnCount: number;
190
+ turns: ThreadChainTurn[];
191
+ }
192
+ export declare const CANONICAL_USER_STOP_ERROR = "Stopped by user";
193
+ export declare const HOST_SHUTDOWN_TERMINAL_ERROR = "Stopped by app shutdown";
194
+ type TaskUsageColumns = Pick<TaskRow, 'input_tokens' | 'output_tokens' | 'cached_input_tokens' | 'cost_usd'>;
195
+ export declare function mergeTerminalReason(metadataJson: string | null | undefined, reason: TaskTerminalReason): string;
196
+ export declare function hasRecordedUsage(task: TaskUsageColumns): boolean;
56
197
  export declare const PID_NULL_REAP_GRACE_MS: number;
198
+ export declare const PENDING_ADOPT_GRACE_MS: number;
199
+ export declare const DEFAULT_TASK_REAPER_TICK_INTERVAL_MS: number;
200
+ export interface ReapOrphanedTasksOptions {
201
+ tickIntervalMs?: number;
202
+ }
57
203
  export declare class TaskRepository extends BaseSqliteRepository {
58
204
  private readonly dbPath?;
205
+ private readonly clock;
206
+ private readonly taskLogRepository;
207
+ private readonly processControl;
208
+ private lastReaperTickAt?;
209
+ private orphanReapInFlight?;
59
210
  private readonly pidNullObservedSince;
60
211
  constructor(opts?: {
61
212
  dbPath?: string;
62
213
  dbRoot?: string;
214
+ clock?: () => number;
215
+ processControl?: ProcessControlOptions;
63
216
  });
64
217
  resolveDbPath(): string;
65
218
  private openHandle;
219
+ heartbeatTask(opts: {
220
+ id: string;
221
+ runEpoch: number;
222
+ }): boolean;
223
+ requestTaskStop(opts: {
224
+ id: string;
225
+ requestedAt: string;
226
+ origin?: TaskStopOrigin;
227
+ callerPid?: number;
228
+ callerTaskId?: string;
229
+ }): TaskStopRequestResult;
230
+ private requestTaskStopForInstruction;
231
+ finalizeTaskStop(opts: FinalizeTaskStopOptions): boolean;
232
+ finalizeTaskForHostShutdown(opts: FinalizeTaskForHostShutdownOptions): FinalizeTaskForHostShutdownOutcome;
233
+ stopTask(id: string, options?: StopTaskOptions): Promise<StopTaskResult>;
234
+ stopTaskGenerationForInstruction(options: StopTaskGenerationForInstructionOptions): Promise<StopTaskResult>;
66
235
  startTask(opts: {
67
236
  id: string;
68
237
  agentId: string;
238
+ actorKind?: TaskActorKind | null;
239
+ actorId?: string | null;
240
+ userId?: string | null;
69
241
  prompt: string;
70
242
  mode: string;
71
243
  status: string;
@@ -77,13 +249,38 @@ export declare class TaskRepository extends BaseSqliteRepository {
77
249
  command?: string | null;
78
250
  metadata?: string | null;
79
251
  workspaceId?: string | null;
252
+ cwd?: string | null;
253
+ projectId?: string | null;
80
254
  platform?: string | null;
81
255
  crewxVersion?: string | null;
82
256
  threadId?: string | null;
83
257
  model?: string | null;
84
258
  renderedPrompt?: string | null;
259
+ securityKey?: string | null;
85
260
  codingAgentCommand?: string | null;
86
261
  }): void;
262
+ recordTaskPid(opts: {
263
+ id: string;
264
+ runEpoch: number;
265
+ pid: number;
266
+ }): boolean;
267
+ updateTaskOwnership(opts: {
268
+ id: string;
269
+ runEpoch: number;
270
+ ownership: 'runner' | 'caller';
271
+ providerPid?: number | null;
272
+ runtime?: {
273
+ model?: string | null;
274
+ renderedPrompt?: string | null;
275
+ securityKey?: string | null;
276
+ codingAgentCommand?: string | null;
277
+ metadata?: Record<string, unknown>;
278
+ };
279
+ }): boolean;
280
+ adoptPendingTask(id: string): boolean;
281
+ failPendingTask(id: string, error: string, completedAt?: string): boolean;
282
+ stopPendingTask(id: string, error?: string, completedAt?: string, stopRequest?: TaskStopRequestContext): boolean;
283
+ listTasksByProjectId(projectId: string): TaskRow[];
87
284
  finishTask(opts: {
88
285
  id: string;
89
286
  status: string;
@@ -98,20 +295,49 @@ export declare class TaskRepository extends BaseSqliteRepository {
98
295
  costUsd?: number;
99
296
  model?: string | null;
100
297
  runEpoch?: number | null;
298
+ partialResultRecovered?: boolean;
299
+ }): void;
300
+ updateTaskLifecycle(opts: {
301
+ id: string;
302
+ status: TaskStatus;
303
+ error: string | null;
304
+ completedAt: string | null;
305
+ durationMs: number | null;
306
+ workspaceId: string;
307
+ terminalReason?: TaskTerminalReason;
101
308
  }): void;
102
309
  appendLog(taskId: string, entry: {
103
310
  timestamp: string;
104
311
  level: string;
105
312
  message: string;
106
313
  }): void;
314
+ appendLogs(taskId: string, entries: readonly TaskLogEntry[]): void;
315
+ readLogs(taskId: string): TaskLogReadResult | undefined;
316
+ readLogsTail(taskId: string, limit: number): TaskLogReadResult | undefined;
317
+ getLogState(taskId: string): TaskLogState | undefined;
107
318
  getRunningTasks(): TaskRow[];
319
+ getActiveTasks(): TaskRow[];
108
320
  getAllTasks(): TaskRow[];
321
+ readTaskSecurityKey(id: string): string | null;
322
+ recordProviderInput(opts: {
323
+ id: string;
324
+ runEpoch: number;
325
+ input: string;
326
+ keyWrapSkipped: boolean;
327
+ interceptedRequest?: boolean;
328
+ recordedAt?: string;
329
+ }): boolean;
330
+ listProviderInputEpochs(id: string, opts?: {
331
+ archivedRunEpochs?: ReadonlySet<number>;
332
+ }): ProviderInputEpochEntry[];
333
+ readProviderInput(id: string, runEpoch: number): ProviderInputRecord | undefined;
109
334
  getTask(id: string): TaskRow | undefined;
110
- killTask(id: string): {
111
- killed: boolean;
112
- pid?: number;
113
- };
114
- reapOrphanedTasks(): number;
335
+ killTask(id: string): Promise<TaskKillResult>;
336
+ reapOrphanedTasks(options?: ReapOrphanedTasksOptions): Promise<number>;
337
+ private runOrphanReaperPass;
338
+ private judgeRecordedTargets;
339
+ private terminateRecordedProcesses;
340
+ reapRunningWorkflowTasks(graceMs?: number): number;
115
341
  findTaskStatus(taskId: string, workspaceId?: string): TaskRow | undefined;
116
342
  findChildTasks(parentTaskId: string, workspaceId?: string): TaskRow[];
117
343
  getWorkspaceUsageSummary(workspaceId?: string): Array<{
@@ -126,7 +352,14 @@ export declare class TaskRepository extends BaseSqliteRepository {
126
352
  outputTokens: number;
127
353
  costUsd: number;
128
354
  };
355
+ findTasksByThread(threadId: string, workspaceId: string | undefined, options: FindTasksByThreadOptions): TaskActivityLogRow[];
129
356
  findTasksByThread(threadId: string, workspaceId?: string): TaskRow[];
357
+ private parseWorkflowCardMetadata;
358
+ private extractThreadIdFromCommand;
359
+ findRunningWorkflowParentTasks(): WorkflowParentTaskRow[];
360
+ findWorkflowParentTasksByWorkspace(workspaceId: string): WorkflowParentTaskRow[];
361
+ findWorkflowParentTask(opts: WorkflowParentTaskLookup): WorkflowParentTaskRow | undefined;
362
+ batchFetchWorkflowCards(threadIds: string[], workspaceId?: string): Map<string, WorkflowCardRow>;
130
363
  findAllTasks(params: {
131
364
  workspaceId?: string;
132
365
  agentId?: string;
@@ -147,9 +380,86 @@ export declare class TaskRepository extends BaseSqliteRepository {
147
380
  getAgentUsage(from: string, to: string, workspace?: string): AgentUsageRow[];
148
381
  getAgentUsageTrendRaw(from: string, to: string, workspace?: string): TrendRow[];
149
382
  findTaskForStop(taskId: string, workspaceId: string): TaskRow | undefined;
150
- markTaskFailed(taskId: string, error: string, workspaceId?: string): void;
383
+ findLatestTaskByMetadata(opts: {
384
+ agentId: string;
385
+ workspaceId: string;
386
+ metaKey: string;
387
+ metaValue: string;
388
+ }): {
389
+ id: string;
390
+ thread_id: string | null;
391
+ status: string;
392
+ result: string | null;
393
+ error: string | null;
394
+ started_at: string;
395
+ completed_at: string | null;
396
+ metadata: string | null;
397
+ } | null;
398
+ markTaskFailed(taskId: string, error: string, workspaceId?: string, status?: TaskStatus, terminalReason?: TaskTerminalReason): void;
151
399
  findTasksByPromptHint(hint: string, workspaceId?: string): TaskRow[];
152
400
  getProviderUsage(from: string, to: string, workspace?: string): ProviderUsageRow[];
153
401
  getModelUsage(from: string, to: string, workspace?: string): ModelUsageRow[];
154
402
  getTasksForReport(from: string, to: string, workspace?: string): ReportTaskRow[];
403
+ getDelegationMatrix(from: string, to: string, workspace?: string): DelegationMatrixResult;
404
+ findTaskEvidence(params: {
405
+ workspaceId?: string;
406
+ agents?: string[];
407
+ statuses?: string[];
408
+ from?: string;
409
+ to?: string;
410
+ limit?: number;
411
+ order?: 'ASC' | 'DESC';
412
+ }): TaskEvidenceRow[];
413
+ findThreadChains(params: {
414
+ targetAgentId: string;
415
+ workspaceId?: string;
416
+ from?: string;
417
+ to?: string;
418
+ maxThreads?: number;
419
+ maxTurnsPerThread?: number;
420
+ }): ThreadChain[];
421
+ }
422
+ export declare const TASK_RATINGS: readonly ["up", "down"];
423
+ export type TaskRating = (typeof TASK_RATINGS)[number];
424
+ export declare const RATED_TASK_EXCERPT_MAX_CHARS = 1000;
425
+ export declare const RATED_TASK_LIST_MAX_LIMIT = 200;
426
+ export type TaskRatingErrorCode = 'TASK_NOT_FOUND' | 'TASK_RATING_NOT_TERMINAL';
427
+ export declare class TaskRatingError extends RepositoryError {
428
+ readonly stableCode: TaskRatingErrorCode;
429
+ readonly taskId: string;
430
+ constructor(stableCode: TaskRatingErrorCode, taskId: string);
431
+ }
432
+ export interface SetTaskRatingInput {
433
+ workspaceId: string;
434
+ taskId: string;
435
+ rating: TaskRating | null;
436
+ now?: string;
437
+ }
438
+ export interface SetTaskRatingResult {
439
+ taskId: string;
440
+ rating: TaskRating | null;
441
+ ratedAt: string | null;
442
+ changed: boolean;
443
+ }
444
+ export declare function setTaskRating(db: DrizzleDb, input: SetTaskRatingInput): SetTaskRatingResult;
445
+ export interface ListRatedTasksInput {
446
+ workspaceId: string;
447
+ agentId?: string;
448
+ sinceIso?: string;
449
+ limit: number;
450
+ }
451
+ export interface RatedTaskRow {
452
+ taskId: string;
453
+ agentId: string;
454
+ threadId: string | null;
455
+ status: TaskStatus;
456
+ rating: TaskRating;
457
+ ratedAt: string;
458
+ promptExcerpt: string | null;
459
+ resultExcerpt: string | null;
155
460
  }
461
+ export declare function buildRatedTasksQuery(input: ListRatedTasksInput): import("drizzle-orm").SQL<unknown>;
462
+ export declare function listRatedTasks(db: DrizzleDb, input: ListRatedTasksInput): RatedTaskRow[];
463
+ export type CountRatedTasksInput = Omit<ListRatedTasksInput, 'limit'>;
464
+ export declare function buildRatedTasksCountQuery(input: CountRatedTasksInput): import("drizzle-orm").SQL<unknown>;
465
+ export declare function countRatedTasks(db: DrizzleDb, input: CountRatedTasksInput): number;