@bryanhu/codexly 0.4.0 → 0.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 (208) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/README.md +3 -1
  3. package/README.zh-CN.md +3 -1
  4. package/dist/{chunk-I5XCZA2U.js → chunk-4PA52XB7.js} +874 -54
  5. package/dist/{chunk-6W2NSQP6.js → chunk-AGMOIRX4.js} +1 -1
  6. package/dist/{chunk-3OBVX5TN.js → chunk-RNTA4MFS.js} +9 -1
  7. package/dist/{chunk-63TSFHXS.js → chunk-UAJCHOZK.js} +916 -399
  8. package/dist/{chunk-TGDKFWII.js → chunk-ZSWNUDDK.js} +115 -6
  9. package/dist/cli.js +10 -6
  10. package/dist/client/index.js +35 -5
  11. package/dist/core/index.js +1 -1
  12. package/dist/protocol/index.js +1 -1
  13. package/dist/providers/codex/index.js +3 -3
  14. package/dist/server/index.js +5 -5
  15. package/dist/sqlite-state-worker.js +117 -7
  16. package/dist/web/.vite/manifest.json +254 -128
  17. package/dist/web/.vite/manifest.json.br +0 -0
  18. package/dist/web/.vite/manifest.json.gz +0 -0
  19. package/dist/web/assets/button-group-GolVMDRO.js +1 -0
  20. package/dist/web/assets/button-group-GolVMDRO.js.br +0 -0
  21. package/dist/web/assets/button-group-GolVMDRO.js.gz +0 -0
  22. package/dist/web/assets/check-DufG-ZUa.js +1 -0
  23. package/dist/web/assets/check-DufG-ZUa.js.br +0 -0
  24. package/dist/web/assets/check-DufG-ZUa.js.gz +0 -0
  25. package/dist/web/assets/checkbox-37DlWLBa.js +1 -0
  26. package/dist/web/assets/checkbox-37DlWLBa.js.br +0 -0
  27. package/dist/web/assets/checkbox-37DlWLBa.js.gz +0 -0
  28. package/dist/web/assets/{chunk-BO2N2NFS-D3J36g1Z.js → chunk-BO2N2NFS-C9R62W5i.js} +4 -4
  29. package/dist/web/assets/chunk-BO2N2NFS-C9R62W5i.js.br +0 -0
  30. package/dist/web/assets/chunk-BO2N2NFS-C9R62W5i.js.gz +0 -0
  31. package/dist/web/assets/{code-highlighter-Cl_7OKC4.js → code-highlighter-B_sQt157.js} +1 -1
  32. package/dist/web/assets/code-highlighter-B_sQt157.js.br +0 -0
  33. package/dist/web/assets/code-highlighter-B_sQt157.js.gz +0 -0
  34. package/dist/web/assets/{code-languages-CoeGleQS.js → code-languages-lQDTaxNN.js} +1 -1
  35. package/dist/web/assets/code-languages-lQDTaxNN.js.br +0 -0
  36. package/dist/web/assets/code-languages-lQDTaxNN.js.gz +0 -0
  37. package/dist/web/assets/context-menu-Dag_JnAP.js +1 -0
  38. package/dist/web/assets/context-menu-Dag_JnAP.js.br +0 -0
  39. package/dist/web/assets/context-menu-Dag_JnAP.js.gz +0 -0
  40. package/dist/web/assets/dist-D75B5EEW.js +1 -0
  41. package/dist/web/assets/dist-D75B5EEW.js.br +0 -0
  42. package/dist/web/assets/dist-D75B5EEW.js.gz +0 -0
  43. package/dist/web/assets/dist-rI8Y0b5t.js +1 -0
  44. package/dist/web/assets/dist-rI8Y0b5t.js.br +0 -0
  45. package/dist/web/assets/dist-rI8Y0b5t.js.gz +0 -0
  46. package/dist/web/assets/es2015-Bu8fG2VP.js +41 -0
  47. package/dist/web/assets/es2015-Bu8fG2VP.js.br +0 -0
  48. package/dist/web/assets/es2015-Bu8fG2VP.js.gz +0 -0
  49. package/dist/web/assets/file-code-corner-BfUyC-bF.js +1 -0
  50. package/dist/web/assets/file-code-corner-BfUyC-bF.js.br +1 -0
  51. package/dist/web/assets/file-code-corner-BfUyC-bF.js.gz +0 -0
  52. package/dist/web/assets/file-navigation-view-preference-De4_ih3I.js +1 -0
  53. package/dist/web/assets/file-navigation-view-preference-De4_ih3I.js.br +0 -0
  54. package/dist/web/assets/file-navigation-view-preference-De4_ih3I.js.gz +0 -0
  55. package/dist/web/assets/file-review-dialog-D6itznUk.js +2 -0
  56. package/dist/web/assets/file-review-dialog-D6itznUk.js.br +0 -0
  57. package/dist/web/assets/file-review-dialog-D6itznUk.js.gz +0 -0
  58. package/dist/web/assets/file-tree-CFUaXf_b.js +1 -0
  59. package/dist/web/assets/file-tree-CFUaXf_b.js.br +0 -0
  60. package/dist/web/assets/file-tree-CFUaXf_b.js.gz +0 -0
  61. package/dist/web/assets/git-commit-horizontal-BsjVPZ9W.js +1 -0
  62. package/dist/web/assets/git-commit-horizontal-BsjVPZ9W.js.br +0 -0
  63. package/dist/web/assets/git-commit-horizontal-BsjVPZ9W.js.gz +0 -0
  64. package/dist/web/assets/git-history-panel-DIr_4cfP.js +2 -0
  65. package/dist/web/assets/git-history-panel-DIr_4cfP.js.br +0 -0
  66. package/dist/web/assets/git-history-panel-DIr_4cfP.js.gz +0 -0
  67. package/dist/web/assets/global-settings-dialog-CWeXTy89.js +1 -0
  68. package/dist/web/assets/global-settings-dialog-CWeXTy89.js.br +0 -0
  69. package/dist/web/assets/global-settings-dialog-CWeXTy89.js.gz +0 -0
  70. package/dist/web/assets/{highlighted-body-OFNGDK62-DLuRF1Ir.js → highlighted-body-OFNGDK62-J6vd4AIe.js} +1 -1
  71. package/dist/web/assets/highlighted-body-OFNGDK62-J6vd4AIe.js.br +0 -0
  72. package/dist/web/assets/highlighted-body-OFNGDK62-J6vd4AIe.js.gz +0 -0
  73. package/dist/web/assets/index-CMCPev5S.js +4 -0
  74. package/dist/web/assets/index-CMCPev5S.js.br +0 -0
  75. package/dist/web/assets/index-CMCPev5S.js.gz +0 -0
  76. package/dist/web/assets/index-CcSDzrvO.css +2 -0
  77. package/dist/web/assets/index-CcSDzrvO.css.br +0 -0
  78. package/dist/web/assets/index-CcSDzrvO.css.gz +0 -0
  79. package/dist/web/assets/lazy-message-response-kziUJe0I.js +2 -0
  80. package/dist/web/assets/lazy-message-response-kziUJe0I.js.br +0 -0
  81. package/dist/web/assets/lazy-message-response-kziUJe0I.js.gz +0 -0
  82. package/dist/web/assets/loader-circle-DUyazd0N.js +1 -0
  83. package/dist/web/assets/loader-circle-DUyazd0N.js.br +0 -0
  84. package/dist/web/assets/loader-circle-DUyazd0N.js.gz +0 -0
  85. package/dist/web/assets/mermaid-GHXKKRXX-6KIGYUKQ.js +1 -0
  86. package/dist/web/assets/mermaid-GHXKKRXX-6KIGYUKQ.js.br +0 -0
  87. package/dist/web/assets/mermaid-GHXKKRXX-6KIGYUKQ.js.gz +0 -0
  88. package/dist/web/assets/message-response-BH1WLiOG.js +7 -0
  89. package/dist/web/assets/message-response-BH1WLiOG.js.br +0 -0
  90. package/dist/web/assets/message-response-BH1WLiOG.js.gz +0 -0
  91. package/dist/web/assets/{patch-diff-viewer-7Ar-plzV.js → patch-diff-viewer-BP7d9z00.js} +2 -2
  92. package/dist/web/assets/patch-diff-viewer-BP7d9z00.js.br +0 -0
  93. package/dist/web/assets/patch-diff-viewer-BP7d9z00.js.gz +0 -0
  94. package/dist/web/assets/project-file-popup-page-BqEZEv1s.js +1 -0
  95. package/dist/web/assets/project-file-popup-page-BqEZEv1s.js.br +0 -0
  96. package/dist/web/assets/project-file-popup-page-BqEZEv1s.js.gz +0 -0
  97. package/dist/web/assets/project-source-panel-BkRa6eOs.js +3 -0
  98. package/dist/web/assets/project-source-panel-BkRa6eOs.js.br +0 -0
  99. package/dist/web/assets/project-source-panel-BkRa6eOs.js.gz +0 -0
  100. package/dist/web/assets/prompt-input-controls-5tCLhg2X.js +1 -0
  101. package/dist/web/assets/prompt-input-controls-5tCLhg2X.js.br +0 -0
  102. package/dist/web/assets/prompt-input-controls-5tCLhg2X.js.gz +0 -0
  103. package/dist/web/assets/prompt-reference-token-Dnq6GpIQ.js +1 -0
  104. package/dist/web/assets/prompt-reference-token-Dnq6GpIQ.js.br +3 -0
  105. package/dist/web/assets/prompt-reference-token-Dnq6GpIQ.js.gz +0 -0
  106. package/dist/web/assets/provider-connection-queries-BPczkhUT.js +1 -0
  107. package/dist/web/assets/provider-connection-queries-BPczkhUT.js.br +0 -0
  108. package/dist/web/assets/provider-connection-queries-BPczkhUT.js.gz +0 -0
  109. package/dist/web/assets/{shiki-bundle-UDLEjOL9.js → shiki-bundle-VSjMZiOC.js} +1 -1
  110. package/dist/web/assets/shiki-bundle-VSjMZiOC.js.br +0 -0
  111. package/dist/web/assets/shiki-bundle-VSjMZiOC.js.gz +0 -0
  112. package/dist/web/assets/tooltip-jGsHGylL.js +1 -0
  113. package/dist/web/assets/tooltip-jGsHGylL.js.br +0 -0
  114. package/dist/web/assets/tooltip-jGsHGylL.js.gz +0 -0
  115. package/dist/web/assets/upload-D6X3pnK5.js +1 -0
  116. package/dist/web/assets/upload-D6X3pnK5.js.br +0 -0
  117. package/dist/web/assets/upload-D6X3pnK5.js.gz +0 -0
  118. package/dist/web/assets/useInfiniteQuery-Bs3l5hx7.js +1 -0
  119. package/dist/web/assets/useInfiniteQuery-Bs3l5hx7.js.br +0 -0
  120. package/dist/web/assets/useInfiniteQuery-Bs3l5hx7.js.gz +0 -0
  121. package/dist/web/assets/workbench-inspector-changes-BbHDvE9x.js +2 -0
  122. package/dist/web/assets/workbench-inspector-changes-BbHDvE9x.js.br +0 -0
  123. package/dist/web/assets/workbench-inspector-changes-BbHDvE9x.js.gz +0 -0
  124. package/dist/web/assets/workbench-pet-canvas-DRzsdZ1c.js +1 -0
  125. package/dist/web/assets/workbench-pet-canvas-DRzsdZ1c.js.br +0 -0
  126. package/dist/web/assets/workbench-pet-canvas-DRzsdZ1c.js.gz +0 -0
  127. package/dist/web/assets/workbench-shell-wnOOfeVI.js +15 -0
  128. package/dist/web/assets/workbench-shell-wnOOfeVI.js.br +0 -0
  129. package/dist/web/assets/workbench-shell-wnOOfeVI.js.gz +0 -0
  130. package/dist/web/index.html +12 -8
  131. package/dist/web/index.html.br +0 -0
  132. package/dist/web/index.html.gz +0 -0
  133. package/package.json +1 -1
  134. package/dist/web/assets/button-SdoQawHa.js +0 -1
  135. package/dist/web/assets/button-SdoQawHa.js.br +0 -0
  136. package/dist/web/assets/button-SdoQawHa.js.gz +0 -0
  137. package/dist/web/assets/button-group-cIDkfDF9.js +0 -1
  138. package/dist/web/assets/button-group-cIDkfDF9.js.br +0 -0
  139. package/dist/web/assets/button-group-cIDkfDF9.js.gz +0 -0
  140. package/dist/web/assets/checkbox-BlpFo5_d.js +0 -1
  141. package/dist/web/assets/checkbox-BlpFo5_d.js.br +0 -0
  142. package/dist/web/assets/checkbox-BlpFo5_d.js.gz +0 -0
  143. package/dist/web/assets/chunk-BO2N2NFS-D3J36g1Z.js.br +0 -0
  144. package/dist/web/assets/chunk-BO2N2NFS-D3J36g1Z.js.gz +0 -0
  145. package/dist/web/assets/code-highlighter-Cl_7OKC4.js.br +0 -0
  146. package/dist/web/assets/code-highlighter-Cl_7OKC4.js.gz +0 -0
  147. package/dist/web/assets/code-languages-CoeGleQS.js.br +0 -0
  148. package/dist/web/assets/code-languages-CoeGleQS.js.gz +0 -0
  149. package/dist/web/assets/es2015-B-skuqay.js +0 -41
  150. package/dist/web/assets/es2015-B-skuqay.js.br +0 -0
  151. package/dist/web/assets/es2015-B-skuqay.js.gz +0 -0
  152. package/dist/web/assets/file-DwOQ4CRt.js +0 -1
  153. package/dist/web/assets/file-DwOQ4CRt.js.br +0 -0
  154. package/dist/web/assets/file-DwOQ4CRt.js.gz +0 -0
  155. package/dist/web/assets/file-review-dialog-BmXxZad1.js +0 -2
  156. package/dist/web/assets/file-review-dialog-BmXxZad1.js.br +0 -0
  157. package/dist/web/assets/file-review-dialog-BmXxZad1.js.gz +0 -0
  158. package/dist/web/assets/file-tree-Bl6o98td.js +0 -1
  159. package/dist/web/assets/file-tree-Bl6o98td.js.br +0 -0
  160. package/dist/web/assets/file-tree-Bl6o98td.js.gz +0 -0
  161. package/dist/web/assets/git-commit-horizontal-1BtAo1_y.js +0 -1
  162. package/dist/web/assets/git-commit-horizontal-1BtAo1_y.js.br +0 -0
  163. package/dist/web/assets/git-commit-horizontal-1BtAo1_y.js.gz +0 -0
  164. package/dist/web/assets/git-history-panel-zXprGDsD.js +0 -2
  165. package/dist/web/assets/git-history-panel-zXprGDsD.js.br +0 -0
  166. package/dist/web/assets/git-history-panel-zXprGDsD.js.gz +0 -0
  167. package/dist/web/assets/global-settings-dialog-CQK8OvfF.js +0 -1
  168. package/dist/web/assets/global-settings-dialog-CQK8OvfF.js.br +0 -0
  169. package/dist/web/assets/global-settings-dialog-CQK8OvfF.js.gz +0 -0
  170. package/dist/web/assets/highlighted-body-OFNGDK62-DLuRF1Ir.js.br +0 -0
  171. package/dist/web/assets/highlighted-body-OFNGDK62-DLuRF1Ir.js.gz +0 -0
  172. package/dist/web/assets/index-BQDjXTIj.js +0 -4
  173. package/dist/web/assets/index-BQDjXTIj.js.br +0 -0
  174. package/dist/web/assets/index-BQDjXTIj.js.gz +0 -0
  175. package/dist/web/assets/index-Cg_JyLiC.css +0 -2
  176. package/dist/web/assets/index-Cg_JyLiC.css.br +0 -0
  177. package/dist/web/assets/index-Cg_JyLiC.css.gz +0 -0
  178. package/dist/web/assets/lazy-message-response-BAESsr6y.js +0 -2
  179. package/dist/web/assets/lazy-message-response-BAESsr6y.js.br +0 -0
  180. package/dist/web/assets/lazy-message-response-BAESsr6y.js.gz +0 -0
  181. package/dist/web/assets/mermaid-GHXKKRXX-D80VLkUl.js +0 -1
  182. package/dist/web/assets/mermaid-GHXKKRXX-D80VLkUl.js.br +0 -0
  183. package/dist/web/assets/mermaid-GHXKKRXX-D80VLkUl.js.gz +0 -0
  184. package/dist/web/assets/message-response-ll2GyVvz.js +0 -7
  185. package/dist/web/assets/message-response-ll2GyVvz.js.br +0 -0
  186. package/dist/web/assets/message-response-ll2GyVvz.js.gz +0 -0
  187. package/dist/web/assets/patch-diff-viewer-7Ar-plzV.js.br +0 -0
  188. package/dist/web/assets/patch-diff-viewer-7Ar-plzV.js.gz +0 -0
  189. package/dist/web/assets/prompt-input-controls-t69FYoWk.js +0 -1
  190. package/dist/web/assets/prompt-input-controls-t69FYoWk.js.br +0 -0
  191. package/dist/web/assets/prompt-input-controls-t69FYoWk.js.gz +0 -0
  192. package/dist/web/assets/prompt-reference-token-Cxx6C-IR.js +0 -1
  193. package/dist/web/assets/prompt-reference-token-Cxx6C-IR.js.br +0 -0
  194. package/dist/web/assets/prompt-reference-token-Cxx6C-IR.js.gz +0 -0
  195. package/dist/web/assets/provider-connection-queries-BKyJMJn1.js +0 -1
  196. package/dist/web/assets/provider-connection-queries-BKyJMJn1.js.br +0 -0
  197. package/dist/web/assets/provider-connection-queries-BKyJMJn1.js.gz +0 -0
  198. package/dist/web/assets/shiki-bundle-UDLEjOL9.js.br +0 -0
  199. package/dist/web/assets/shiki-bundle-UDLEjOL9.js.gz +0 -0
  200. package/dist/web/assets/upload-Bbk2LEzM.js +0 -1
  201. package/dist/web/assets/upload-Bbk2LEzM.js.br +0 -0
  202. package/dist/web/assets/upload-Bbk2LEzM.js.gz +0 -0
  203. package/dist/web/assets/workbench-inspector-changes-CumCxeA7.js +0 -1
  204. package/dist/web/assets/workbench-inspector-changes-CumCxeA7.js.br +0 -0
  205. package/dist/web/assets/workbench-inspector-changes-CumCxeA7.js.gz +0 -0
  206. package/dist/web/assets/workbench-shell-D21PPmmO.js +0 -13
  207. package/dist/web/assets/workbench-shell-D21PPmmO.js.br +0 -0
  208. package/dist/web/assets/workbench-shell-D21PPmmO.js.gz +0 -0
@@ -1,16 +1,16 @@
1
1
  import { createRequire } from 'node:module';
2
- import { value_exports } from './chunk-6W2NSQP6.js';
3
- import { require_pino, require_safe_stable_stringify, CodexProtocolMappingError, CodexProviderConnectionError, RpcConnectionClosedError, RpcProtocolError, RpcResponseError, RpcTimeoutError } from './chunk-I5XCZA2U.js';
4
- import { PendingRequestResolutionError } from './chunk-3OBVX5TN.js';
5
- import { AGENT_FILE_EXTENSIONS, AGENT_FILE_MEDIA_TYPES, MAX_AGENT_IMAGES, MAX_AGENT_IMAGE_TOTAL_BYTES, MAX_AGENT_FILE_TOTAL_BYTES, DEFAULT_COMMIT_MESSAGE_MODEL, TEMPORARY_TASK_API_PATH, TEMPORARY_TASK_SCOPE_ID, MAX_AGENT_FILE_BYTES, AccessStatusResponseSchema, PairAccessRequestSchema, HealthResponseSchema, AppInfoResponseSchema, AgentMutationErrorSchema, InstallAppUpdateResponseSchema, InstallAppUpdateRequestSchema, EventStreamMetricsResponseSchema, AgentCapabilitiesSchema, AgentModelPageSchema, AgentGlobalSettingsResponseSchema, AgentGlobalSettingsSchema, MAX_AGENT_IMAGE_BYTES, MAX_AGENT_TEXT_BYTES, AgentProviderConnectionStatusSchema, StartOfficialProviderLoginResponseSchema, StartOfficialProviderLoginRequestSchema, AgentProviderConnectionMutationResponseSchema, CancelProviderLoginRequestSchema, ConfigureCustomProviderResponseSchema, ConfigureCustomProviderRequestSchema, ProjectPageSchema, HostFileListingSchema, HostFileQuerySchema, ProjectDirectoryListingSchema, ProjectDirectoryQuerySchema, ProjectOpenCapabilitiesResponseSchema, OpenProjectResponseSchema, ProjectRootQuerySchema, OpenProjectRequestSchema, ReorderProjectsResponseSchema, ReorderProjectsRequestSchema, AgentSkillPageSchema, AgentProjectDefaultsResponseSchema, AgentProjectDefaultsSchema, AddProjectResponseSchema, AddProjectRequestSchema, RenameProjectResponseSchema, RenameProjectRequestSchema, RemoveProjectResponseSchema, RemoveProjectRequestSchema, AgentTaskPageSchema, UnsubscribeAgentTaskResponseSchema, AgentTaskSnapshotResponseSchema, AgentMcpServerPageSchema, AgentBackgroundTerminalPageSchema, TerminateAgentBackgroundTerminalResponseSchema, PinAgentTaskResponseSchema, PinAgentTaskRequestSchema, RenameAgentTaskResponseSchema, RenameAgentTaskRequestSchema, ArchiveAgentTaskResponseSchema, ArchiveAgentTaskRequestSchema, UnarchiveAgentTaskResponseSchema, UnarchiveAgentTaskRequestSchema, DeleteAgentTaskResponseSchema, DeleteAgentTaskRequestSchema, StartAgentTaskResponseSchema, StartAgentTaskRequestSchema, StartAgentTurnResponseSchema, StartAgentTurnRequestSchema, SteerAgentTurnResponseSchema, SteerAgentTurnRequestSchema, InterruptAgentTurnResponseSchema, InterruptAgentTurnRequestSchema, ResolvePendingRequestResponseSchema, ResolvePendingRequestRequestSchema, AgentQueuedSubmissionPageSchema, AddAgentQueuedSubmissionResponseSchema, AddAgentQueuedSubmissionRequestSchema, UpdateAgentQueuedSubmissionResponseSchema, UpdateAgentQueuedSubmissionRequestSchema, DeleteAgentQueuedSubmissionResponseSchema, ReorderAgentQueuedSubmissionsResponseSchema, ReorderAgentQueuedSubmissionsRequestSchema, StartAgentQueuedSubmissionResponseSchema, StartAgentQueuedSubmissionRequestSchema, AgentProviderConnectionRecordSchema, ProjectGitStatusSchema, ProjectGitStatusQuerySchema, ProjectGitHistoryPageSchema, ProjectGitHistoryQuerySchema, ProjectGitCommitFilesPageSchema, ProjectGitCommitFilesQuerySchema, ProjectGitCommitFileDiffSchema, ProjectGitCommitFileDiffQuerySchema, SwitchProjectBranchRequestSchema, CreateProjectBranchRequestSchema, GenerateCommitMessageResponseSchema, GenerateCommitMessageRequestSchema, CommitProjectChangesResponseSchema, CommitProjectChangesRequestSchema, ProjectFileTreeSchema, ProjectFileTreeQuerySchema, ProjectFileSearchPageSchema, ProjectFileSearchQuerySchema, StopProjectFileSearchResponseSchema, StopProjectFileSearchRequestSchema, ProjectSourceFileQuerySchema, ProjectSourceFileSchema, AgentAttachmentUploadResponseSchema, HostFileKindSchema, ImportHostAttachmentRequestSchema, AgentAttachmentKindSchema, AgentTaskSettingsResponseSchema, AgentTaskSettingsSchema, ReloadAgentMcpServersResponseSchema, ReloadAgentMcpServersRequestSchema, ReviewAgentTaskResponseSchema, ReviewAgentTaskRequestSchema, CompactAgentTaskResponseSchema, CompactAgentTaskRequestSchema, ForkAgentTaskResponseSchema, ForkAgentTaskRequestSchema, UploadAgentFeedbackResponseSchema, UploadAgentFeedbackRequestSchema, OpenAgentTaskAttachmentResponseSchema, OpenAgentTaskAttachmentRequestSchema, UpdateAgentGoalResponseSchema, UpdateAgentGoalRequestSchema, ClearAgentGoalResponseSchema, ProjectGitWorktreePageSchema, ProjectWorktreeMutationResponseSchema, CreateProjectWorktreeRequestSchema, SwitchProjectWorktreeRequestSchema, MAX_EVENT_BATCH_SIZE } from './chunk-TGDKFWII.js';
2
+ import { value_exports } from './chunk-AGMOIRX4.js';
3
+ import { require_pino, require_safe_stable_stringify, CodexProtocolMappingError, CodexProviderConnectionError, RpcConnectionClosedError, RpcProtocolError, RpcResponseError, RpcTimeoutError } from './chunk-4PA52XB7.js';
4
+ import { WorkbenchPetProviderError, PendingRequestResolutionError } from './chunk-RNTA4MFS.js';
5
+ import { AGENT_FILE_EXTENSIONS, AGENT_FILE_MEDIA_TYPES, DEFAULT_COMMIT_MESSAGE_MODEL, TEMPORARY_TASK_API_PATH, TEMPORARY_TASK_SCOPE_ID, MAX_AGENT_FILE_BYTES, AccessStatusResponseSchema, PairAccessRequestSchema, HealthResponseSchema, AppInfoResponseSchema, AgentMutationErrorSchema, InstallAppUpdateResponseSchema, InstallAppUpdateRequestSchema, EventStreamMetricsResponseSchema, AgentCapabilitiesSchema, AgentModelPageSchema, AgentGlobalSettingsResponseSchema, AgentGlobalSettingsSchema, MAX_AGENT_IMAGE_BYTES, MAX_AGENT_TEXT_BYTES, AgentProviderConnectionStatusSchema, StartOfficialProviderLoginResponseSchema, StartOfficialProviderLoginRequestSchema, AgentProviderConnectionMutationResponseSchema, CancelProviderLoginRequestSchema, ConfigureCustomProviderResponseSchema, ConfigureCustomProviderRequestSchema, WorkbenchPetCatalogResponseSchema, WorkbenchPetDownloadResponseSchema, WorkbenchPetDownloadRequestSchema, ProjectPageSchema, HostFileListingSchema, HostFileQuerySchema, ProjectDirectoryListingSchema, ProjectDirectoryQuerySchema, ProjectOpenCapabilitiesResponseSchema, OpenProjectResponseSchema, ProjectRootQuerySchema, OpenProjectRequestSchema, ReorderProjectsResponseSchema, ReorderProjectsRequestSchema, AgentSkillPageSchema, AgentProjectDefaultsResponseSchema, AgentProjectDefaultsSchema, AddProjectResponseSchema, AddProjectRequestSchema, RenameProjectResponseSchema, RenameProjectRequestSchema, RemoveProjectResponseSchema, RemoveProjectRequestSchema, AgentTaskPageSchema, UnsubscribeAgentTaskResponseSchema, AgentTaskSnapshotResponseSchema, AgentMcpServerPageSchema, AgentBackgroundTerminalPageSchema, TerminateAgentBackgroundTerminalResponseSchema, PinAgentTaskResponseSchema, PinAgentTaskRequestSchema, RenameAgentTaskResponseSchema, RenameAgentTaskRequestSchema, ArchiveAgentTaskResponseSchema, ArchiveAgentTaskRequestSchema, UnarchiveAgentTaskResponseSchema, UnarchiveAgentTaskRequestSchema, DeleteAgentTaskResponseSchema, DeleteAgentTaskRequestSchema, StartAgentTaskResponseSchema, StartAgentTaskRequestSchema, StartAgentTurnResponseSchema, StartAgentTurnRequestSchema, SteerAgentTurnResponseSchema, SteerAgentTurnRequestSchema, InterruptAgentTurnResponseSchema, InterruptAgentTurnRequestSchema, ResolvePendingRequestResponseSchema, ResolvePendingRequestRequestSchema, AgentQueuedSubmissionPageSchema, AddAgentQueuedSubmissionResponseSchema, AddAgentQueuedSubmissionRequestSchema, UpdateAgentQueuedSubmissionResponseSchema, UpdateAgentQueuedSubmissionRequestSchema, DeleteAgentQueuedSubmissionResponseSchema, ReorderAgentQueuedSubmissionsResponseSchema, ReorderAgentQueuedSubmissionsRequestSchema, StartAgentQueuedSubmissionResponseSchema, StartAgentQueuedSubmissionRequestSchema, AgentPromptInputSchema, AgentProviderConnectionRecordSchema, MAX_AGENT_IMAGES, MAX_AGENT_IMAGE_TOTAL_BYTES, MAX_AGENT_FILE_TOTAL_BYTES, ProjectGitStatusSchema, ProjectGitStatusQuerySchema, ProjectGitHistoryPageSchema, ProjectGitHistoryQuerySchema, ProjectGitCommitFilesPageSchema, ProjectGitCommitFilesQuerySchema, ProjectGitCommitFileDiffSchema, ProjectGitCommitFileDiffQuerySchema, SwitchProjectBranchRequestSchema, CreateProjectBranchRequestSchema, GenerateCommitMessageResponseSchema, GenerateCommitMessageRequestSchema, CommitProjectChangesResponseSchema, CommitProjectChangesRequestSchema, ProjectFileTreeSchema, ProjectFileTreeQuerySchema, ProjectFileSearchPageSchema, ProjectFileSearchQuerySchema, StopProjectFileSearchResponseSchema, StopProjectFileSearchRequestSchema, ProjectSourceFileQuerySchema, ProjectSourceFileSchema, AgentAttachmentUploadResponseSchema, HostFileKindSchema, ImportHostAttachmentRequestSchema, AgentAttachmentKindSchema, AgentTaskSettingsResponseSchema, AgentTaskSettingsSchema, ReloadAgentMcpServersResponseSchema, ReloadAgentMcpServersRequestSchema, ReviewAgentTaskResponseSchema, ReviewAgentTaskRequestSchema, CompactAgentTaskResponseSchema, CompactAgentTaskRequestSchema, ForkAgentTaskResponseSchema, ForkAgentTaskRequestSchema, UploadAgentFeedbackResponseSchema, UploadAgentFeedbackRequestSchema, OpenAgentTaskAttachmentResponseSchema, OpenAgentTaskAttachmentRequestSchema, UpdateAgentGoalResponseSchema, UpdateAgentGoalRequestSchema, ClearAgentGoalResponseSchema, ProjectGitWorktreePageSchema, ProjectWorktreeMutationResponseSchema, CreateProjectWorktreeRequestSchema, SwitchProjectWorktreeRequestSchema, RenameProjectFileResponseSchema, RenameProjectFileRequestSchema, DeleteProjectFileResponseSchema, DeleteProjectFileRequestSchema, MAX_EVENT_BATCH_SIZE } from './chunk-ZSWNUDDK.js';
6
6
  import { __commonJS, __require, __toESM } from './chunk-K6J42667.js';
7
7
  import { Buffer as Buffer$1 } from 'buffer';
8
- import { Readable, Transform } from 'stream';
9
8
  import { randomBytes, createHash, timingSafeEqual, randomUUID } from 'crypto';
10
9
  import { createWriteStream, constants, createReadStream } from 'fs';
11
- import { mkdtemp, rm, realpath, lstat, stat, readFile, open, mkdir, readdir, access, unlink, readlink } from 'fs/promises';
10
+ import { mkdtemp, rm, realpath, lstat, stat, readFile, open, mkdir, readdir, rename, access, unlink, readlink } from 'fs/promises';
12
11
  import { tmpdir, homedir } from 'os';
13
12
  import { join, isAbsolute, dirname, resolve, relative, sep, basename, extname, normalize, win32, posix } from 'path';
13
+ import { Transform, Readable } from 'stream';
14
14
  import { pipeline } from 'stream/promises';
15
15
  import { TextDecoder as TextDecoder$1 } from 'util';
16
16
  import { spawn } from 'child_process';
@@ -286,41 +286,41 @@ var require_queue = __commonJS({
286
286
  queue.drained = drained;
287
287
  return queue;
288
288
  function push(value) {
289
- var p2 = new Promise(function(resolve7, reject) {
289
+ var p2 = new Promise(function(resolve8, reject) {
290
290
  pushCb(value, function(err, result) {
291
291
  if (err) {
292
292
  reject(err);
293
293
  return;
294
294
  }
295
- resolve7(result);
295
+ resolve8(result);
296
296
  });
297
297
  });
298
298
  p2.catch(noop);
299
299
  return p2;
300
300
  }
301
301
  function unshift(value) {
302
- var p2 = new Promise(function(resolve7, reject) {
302
+ var p2 = new Promise(function(resolve8, reject) {
303
303
  unshiftCb(value, function(err, result) {
304
304
  if (err) {
305
305
  reject(err);
306
306
  return;
307
307
  }
308
- resolve7(result);
308
+ resolve8(result);
309
309
  });
310
310
  });
311
311
  p2.catch(noop);
312
312
  return p2;
313
313
  }
314
314
  function drained() {
315
- var p2 = new Promise(function(resolve7) {
315
+ var p2 = new Promise(function(resolve8) {
316
316
  process.nextTick(function() {
317
317
  if (queue.idle()) {
318
- resolve7();
318
+ resolve8();
319
319
  } else {
320
320
  var previousDrain = queue.drain;
321
321
  queue.drain = function() {
322
322
  if (typeof previousDrain === "function") previousDrain();
323
- resolve7();
323
+ resolve8();
324
324
  queue.drain = previousDrain;
325
325
  };
326
326
  }
@@ -657,8 +657,8 @@ var require_create_promise = __commonJS({
657
657
  reject: null,
658
658
  promise: null
659
659
  };
660
- obj.promise = new Promise((resolve7, reject) => {
661
- obj.resolve = resolve7;
660
+ obj.promise = new Promise((resolve8, reject) => {
661
+ obj.resolve = resolve8;
662
662
  obj.reject = reject;
663
663
  });
664
664
  return obj;
@@ -921,11 +921,11 @@ var require_thenify = __commonJS({
921
921
  return;
922
922
  }
923
923
  debug2("thenify");
924
- return (resolve7, reject) => {
924
+ return (resolve8, reject) => {
925
925
  const p2 = this._loadRegistered();
926
926
  return p2.then(() => {
927
927
  this[kThenifyDoNotWrap] = true;
928
- return resolve7(this._server);
928
+ return resolve8(this._server);
929
929
  }, reject);
930
930
  };
931
931
  }
@@ -1060,12 +1060,12 @@ var require_avvio = __commonJS({
1060
1060
  inherits(Boot, EE);
1061
1061
  if ("asyncDispose" in Symbol) {
1062
1062
  Boot.prototype[Symbol.asyncDispose] = function() {
1063
- return new Promise((resolve7, reject) => {
1063
+ return new Promise((resolve8, reject) => {
1064
1064
  this.close((err) => {
1065
1065
  if (err) {
1066
1066
  return reject(err);
1067
1067
  }
1068
- resolve7();
1068
+ resolve8();
1069
1069
  });
1070
1070
  });
1071
1071
  };
@@ -1212,12 +1212,12 @@ var require_avvio = __commonJS({
1212
1212
  throw new AVV_ERR_CALLBACK_NOT_FN("close", typeof func);
1213
1213
  }
1214
1214
  } else {
1215
- promise = new Promise(function(resolve7, reject) {
1215
+ promise = new Promise(function(resolve8, reject) {
1216
1216
  func = function(err) {
1217
1217
  if (err) {
1218
1218
  return reject(err);
1219
1219
  }
1220
- resolve7();
1220
+ resolve8();
1221
1221
  };
1222
1222
  });
1223
1223
  }
@@ -1237,7 +1237,7 @@ var require_avvio = __commonJS({
1237
1237
  queueMicrotask(this.start.bind(this));
1238
1238
  return;
1239
1239
  }
1240
- return new Promise((resolve7, reject) => {
1240
+ return new Promise((resolve8, reject) => {
1241
1241
  this._readyQ.push(readyPromiseCB);
1242
1242
  this.start();
1243
1243
  const relativeContext = this._current[0].server;
@@ -1245,7 +1245,7 @@ var require_avvio = __commonJS({
1245
1245
  if (err) {
1246
1246
  reject(err);
1247
1247
  } else {
1248
- resolve7(relativeContext);
1248
+ resolve8(relativeContext);
1249
1249
  }
1250
1250
  process.nextTick(done);
1251
1251
  }
@@ -2556,8 +2556,8 @@ var require_promise = __commonJS({
2556
2556
  var { kTestInternals } = require_symbols2();
2557
2557
  function withResolvers() {
2558
2558
  let res, rej;
2559
- const promise = new Promise((resolve7, reject) => {
2560
- res = resolve7;
2559
+ const promise = new Promise((resolve8, reject) => {
2560
+ res = resolve8;
2561
2561
  rej = reject;
2562
2562
  });
2563
2563
  return { promise, resolve: res, reject: rej };
@@ -2655,15 +2655,15 @@ var require_server = __commonJS({
2655
2655
  if (cb === void 0) {
2656
2656
  const listening = listenPromise.call(this, server, listenOptions);
2657
2657
  return listening.then((address) => {
2658
- const { promise, resolve: resolve7 } = PonyPromise.withResolvers();
2658
+ const { promise, resolve: resolve8 } = PonyPromise.withResolvers();
2659
2659
  if (host === "localhost") {
2660
2660
  multipleBindings.call(this, server, httpHandler, options, listenOptions, () => {
2661
2661
  this[kState].listening = true;
2662
- resolve7(address);
2662
+ resolve8(address);
2663
2663
  onListenHookRunner(this);
2664
2664
  });
2665
2665
  } else {
2666
- resolve7(address);
2666
+ resolve8(address);
2667
2667
  onListenHookRunner(this);
2668
2668
  }
2669
2669
  return promise;
@@ -2790,7 +2790,7 @@ var require_server = __commonJS({
2790
2790
  }
2791
2791
  return this.ready().then(() => {
2792
2792
  if (this[kState].aborted) return;
2793
- const { promise, resolve: resolve7, reject } = PonyPromise.withResolvers();
2793
+ const { promise, resolve: resolve8, reject } = PonyPromise.withResolvers();
2794
2794
  const errEventHandler = (err) => {
2795
2795
  cleanup();
2796
2796
  this[kState].listening = false;
@@ -2799,7 +2799,7 @@ var require_server = __commonJS({
2799
2799
  const listeningEventHandler = () => {
2800
2800
  cleanup();
2801
2801
  this[kState].listening = true;
2802
- resolve7(logServerAddress.call(
2802
+ resolve8(logServerAddress.call(
2803
2803
  this,
2804
2804
  server,
2805
2805
  listenOptions.listenTextResolver || defaultResolveServerListeningText
@@ -12196,7 +12196,7 @@ var require_compile = __commonJS({
12196
12196
  const schOrFunc = root.refs[ref];
12197
12197
  if (schOrFunc)
12198
12198
  return schOrFunc;
12199
- let _sch = resolve7.call(this, root, ref);
12199
+ let _sch = resolve8.call(this, root, ref);
12200
12200
  if (_sch === void 0) {
12201
12201
  const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
12202
12202
  const { schemaId } = this.opts;
@@ -12223,7 +12223,7 @@ var require_compile = __commonJS({
12223
12223
  function sameSchemaEnv(s1, s2) {
12224
12224
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
12225
12225
  }
12226
- function resolve7(root, ref) {
12226
+ function resolve8(root, ref) {
12227
12227
  let sch;
12228
12228
  while (typeof (sch = this.refs[ref]) == "string")
12229
12229
  ref = sch;
@@ -12851,7 +12851,7 @@ var require_fast_uri = __commonJS({
12851
12851
  }
12852
12852
  return uri;
12853
12853
  }
12854
- function resolve7(baseURI, relativeURI, options) {
12854
+ function resolve8(baseURI, relativeURI, options) {
12855
12855
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
12856
12856
  const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
12857
12857
  const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
@@ -12862,49 +12862,49 @@ var require_fast_uri = __commonJS({
12862
12862
  schemelessOptions.skipEscape = true;
12863
12863
  return serialize(resolved, schemelessOptions);
12864
12864
  }
12865
- function resolveComponent(base, relative6, options, skipNormalization) {
12865
+ function resolveComponent(base, relative7, options, skipNormalization) {
12866
12866
  const target = {};
12867
12867
  if (!skipNormalization) {
12868
12868
  base = parse(serialize(base, options), options);
12869
- relative6 = parse(serialize(relative6, options), options);
12869
+ relative7 = parse(serialize(relative7, options), options);
12870
12870
  }
12871
12871
  options = options || {};
12872
- if (!options.tolerant && relative6.scheme) {
12873
- target.scheme = relative6.scheme;
12874
- target.userinfo = relative6.userinfo;
12875
- target.host = relative6.host;
12876
- target.port = relative6.port;
12877
- target.path = removeDotSegments(relative6.path || "");
12878
- target.query = relative6.query;
12872
+ if (!options.tolerant && relative7.scheme) {
12873
+ target.scheme = relative7.scheme;
12874
+ target.userinfo = relative7.userinfo;
12875
+ target.host = relative7.host;
12876
+ target.port = relative7.port;
12877
+ target.path = removeDotSegments(relative7.path || "");
12878
+ target.query = relative7.query;
12879
12879
  } else {
12880
- if (relative6.userinfo !== void 0 || relative6.host !== void 0 || relative6.port !== void 0) {
12881
- target.userinfo = relative6.userinfo;
12882
- target.host = relative6.host;
12883
- target.port = relative6.port;
12884
- target.path = removeDotSegments(relative6.path || "");
12885
- target.query = relative6.query;
12880
+ if (relative7.userinfo !== void 0 || relative7.host !== void 0 || relative7.port !== void 0) {
12881
+ target.userinfo = relative7.userinfo;
12882
+ target.host = relative7.host;
12883
+ target.port = relative7.port;
12884
+ target.path = removeDotSegments(relative7.path || "");
12885
+ target.query = relative7.query;
12886
12886
  } else {
12887
- if (!relative6.path) {
12887
+ if (!relative7.path) {
12888
12888
  target.path = base.path;
12889
- if (relative6.query !== void 0) {
12890
- target.query = relative6.query;
12889
+ if (relative7.query !== void 0) {
12890
+ target.query = relative7.query;
12891
12891
  } else {
12892
12892
  target.query = base.query;
12893
12893
  }
12894
12894
  } else {
12895
- if (relative6.path[0] === "/") {
12896
- target.path = removeDotSegments(relative6.path);
12895
+ if (relative7.path[0] === "/") {
12896
+ target.path = removeDotSegments(relative7.path);
12897
12897
  } else {
12898
12898
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
12899
- target.path = "/" + relative6.path;
12899
+ target.path = "/" + relative7.path;
12900
12900
  } else if (!base.path) {
12901
- target.path = relative6.path;
12901
+ target.path = relative7.path;
12902
12902
  } else {
12903
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative6.path;
12903
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative7.path;
12904
12904
  }
12905
12905
  target.path = removeDotSegments(target.path);
12906
12906
  }
12907
- target.query = relative6.query;
12907
+ target.query = relative7.query;
12908
12908
  }
12909
12909
  target.userinfo = base.userinfo;
12910
12910
  target.host = base.host;
@@ -12912,7 +12912,7 @@ var require_fast_uri = __commonJS({
12912
12912
  }
12913
12913
  target.scheme = base.scheme;
12914
12914
  }
12915
- target.fragment = relative6.fragment;
12915
+ target.fragment = relative7.fragment;
12916
12916
  return target;
12917
12917
  }
12918
12918
  function equal(uriA, uriB, options) {
@@ -13135,7 +13135,7 @@ var require_fast_uri = __commonJS({
13135
13135
  var fastUri = {
13136
13136
  SCHEMES,
13137
13137
  normalize: normalize2,
13138
- resolve: resolve7,
13138
+ resolve: resolve8,
13139
13139
  resolveComponent,
13140
13140
  equal,
13141
13141
  serialize,
@@ -18962,7 +18962,7 @@ var require_fast_uri2 = __commonJS({
18962
18962
  }
18963
18963
  return uri;
18964
18964
  }
18965
- function resolve7(baseURI, relativeURI, options) {
18965
+ function resolve8(baseURI, relativeURI, options) {
18966
18966
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
18967
18967
  const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
18968
18968
  const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
@@ -18973,49 +18973,49 @@ var require_fast_uri2 = __commonJS({
18973
18973
  schemelessOptions.skipEscape = true;
18974
18974
  return serialize(resolved, schemelessOptions);
18975
18975
  }
18976
- function resolveComponent(base, relative6, options, skipNormalization) {
18976
+ function resolveComponent(base, relative7, options, skipNormalization) {
18977
18977
  const target = {};
18978
18978
  if (!skipNormalization) {
18979
18979
  base = parse(serialize(base, options), options);
18980
- relative6 = parse(serialize(relative6, options), options);
18980
+ relative7 = parse(serialize(relative7, options), options);
18981
18981
  }
18982
18982
  options = options || {};
18983
- if (!options.tolerant && relative6.scheme) {
18984
- target.scheme = relative6.scheme;
18985
- target.userinfo = relative6.userinfo;
18986
- target.host = relative6.host;
18987
- target.port = relative6.port;
18988
- target.path = removeDotSegments(relative6.path || "");
18989
- target.query = relative6.query;
18983
+ if (!options.tolerant && relative7.scheme) {
18984
+ target.scheme = relative7.scheme;
18985
+ target.userinfo = relative7.userinfo;
18986
+ target.host = relative7.host;
18987
+ target.port = relative7.port;
18988
+ target.path = removeDotSegments(relative7.path || "");
18989
+ target.query = relative7.query;
18990
18990
  } else {
18991
- if (relative6.userinfo !== void 0 || relative6.host !== void 0 || relative6.port !== void 0) {
18992
- target.userinfo = relative6.userinfo;
18993
- target.host = relative6.host;
18994
- target.port = relative6.port;
18995
- target.path = removeDotSegments(relative6.path || "");
18996
- target.query = relative6.query;
18991
+ if (relative7.userinfo !== void 0 || relative7.host !== void 0 || relative7.port !== void 0) {
18992
+ target.userinfo = relative7.userinfo;
18993
+ target.host = relative7.host;
18994
+ target.port = relative7.port;
18995
+ target.path = removeDotSegments(relative7.path || "");
18996
+ target.query = relative7.query;
18997
18997
  } else {
18998
- if (!relative6.path) {
18998
+ if (!relative7.path) {
18999
18999
  target.path = base.path;
19000
- if (relative6.query !== void 0) {
19001
- target.query = relative6.query;
19000
+ if (relative7.query !== void 0) {
19001
+ target.query = relative7.query;
19002
19002
  } else {
19003
19003
  target.query = base.query;
19004
19004
  }
19005
19005
  } else {
19006
- if (relative6.path[0] === "/") {
19007
- target.path = removeDotSegments(relative6.path);
19006
+ if (relative7.path[0] === "/") {
19007
+ target.path = removeDotSegments(relative7.path);
19008
19008
  } else {
19009
19009
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
19010
- target.path = "/" + relative6.path;
19010
+ target.path = "/" + relative7.path;
19011
19011
  } else if (!base.path) {
19012
- target.path = relative6.path;
19012
+ target.path = relative7.path;
19013
19013
  } else {
19014
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative6.path;
19014
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative7.path;
19015
19015
  }
19016
19016
  target.path = removeDotSegments(target.path);
19017
19017
  }
19018
- target.query = relative6.query;
19018
+ target.query = relative7.query;
19019
19019
  }
19020
19020
  target.userinfo = base.userinfo;
19021
19021
  target.host = base.host;
@@ -19023,7 +19023,7 @@ var require_fast_uri2 = __commonJS({
19023
19023
  }
19024
19024
  target.scheme = base.scheme;
19025
19025
  }
19026
- target.fragment = relative6.fragment;
19026
+ target.fragment = relative7.fragment;
19027
19027
  return target;
19028
19028
  }
19029
19029
  function equal(uriA, uriB, options) {
@@ -19245,7 +19245,7 @@ var require_fast_uri2 = __commonJS({
19245
19245
  var fastUri = {
19246
19246
  SCHEMES,
19247
19247
  normalize: normalize2,
19248
- resolve: resolve7,
19248
+ resolve: resolve8,
19249
19249
  resolveComponent,
19250
19250
  equal,
19251
19251
  serialize,
@@ -28587,7 +28587,7 @@ var require_parse_url = __commonJS({
28587
28587
  // node_modules/.pnpm/light-my-request@6.6.0/node_modules/light-my-request/lib/form-data.js
28588
28588
  var require_form_data = __commonJS({
28589
28589
  "node_modules/.pnpm/light-my-request@6.6.0/node_modules/light-my-request/lib/form-data.js"(exports, module) {
28590
- var { randomUUID: randomUUID3 } = __require("crypto");
28590
+ var { randomUUID: randomUUID4 } = __require("crypto");
28591
28591
  var { Readable: Readable3 } = __require("stream");
28592
28592
  var textEncoder;
28593
28593
  function isFormDataLike(payload) {
@@ -28595,7 +28595,7 @@ var require_form_data = __commonJS({
28595
28595
  }
28596
28596
  function formDataToStream(formdata) {
28597
28597
  textEncoder = textEncoder ?? new TextEncoder();
28598
- const boundary = `----formdata-${randomUUID3()}`;
28598
+ const boundary = `----formdata-${randomUUID4()}`;
28599
28599
  const prefix = `--${boundary}\r
28600
28600
  Content-Disposition: form-data`;
28601
28601
  const escape2 = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
@@ -30093,9 +30093,9 @@ var require_light_my_request = __commonJS({
30093
30093
  const res = new Response(req, callback);
30094
30094
  return makeRequest(dispatchFunc, server, req, res);
30095
30095
  } else {
30096
- return new Promise((resolve7, reject) => {
30096
+ return new Promise((resolve8, reject) => {
30097
30097
  const req = new RequestConstructor(options);
30098
- const res = new Response(req, resolve7, reject);
30098
+ const res = new Response(req, resolve8, reject);
30099
30099
  makeRequest(dispatchFunc, server, req, res);
30100
30100
  });
30101
30101
  }
@@ -34473,14 +34473,14 @@ var require_generateId = __commonJS({
34473
34473
  var require_stream_consumer = __commonJS({
34474
34474
  "node_modules/.pnpm/@fastify+multipart@10.1.0/node_modules/@fastify/multipart/lib/stream-consumer.js"(exports, module) {
34475
34475
  module.exports = function streamToNull(stream) {
34476
- return new Promise((resolve7, reject) => {
34476
+ return new Promise((resolve8, reject) => {
34477
34477
  stream.on("data", () => {
34478
34478
  });
34479
34479
  stream.on("close", () => {
34480
- resolve7();
34480
+ resolve8();
34481
34481
  });
34482
34482
  stream.on("end", () => {
34483
- resolve7();
34483
+ resolve8();
34484
34484
  });
34485
34485
  stream.on("error", (error) => {
34486
34486
  reject(error);
@@ -34823,10 +34823,10 @@ var require_multipart2 = __commonJS({
34823
34823
  }
34824
34824
  };
34825
34825
  const parts = () => {
34826
- return new Promise((resolve7, reject) => {
34826
+ return new Promise((resolve8, reject) => {
34827
34827
  handle((val) => {
34828
34828
  if (val instanceof Error) return reject(val);
34829
- resolve7(val);
34829
+ resolve8(val);
34830
34830
  });
34831
34831
  });
34832
34832
  };
@@ -38492,7 +38492,7 @@ var require_parseTokenList = __commonJS({
38492
38492
  // node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js
38493
38493
  var require_depd = __commonJS({
38494
38494
  "node_modules/.pnpm/depd@2.0.0/node_modules/depd/index.js"(exports, module) {
38495
- var relative6 = __require("path").relative;
38495
+ var relative7 = __require("path").relative;
38496
38496
  module.exports = depd;
38497
38497
  var basePath = process.cwd();
38498
38498
  function containsNamespace(str, namespace) {
@@ -38684,7 +38684,7 @@ var require_depd = __commonJS({
38684
38684
  return formatted;
38685
38685
  }
38686
38686
  function formatLocation(callSite) {
38687
- return relative6(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
38687
+ return relative7(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
38688
38688
  }
38689
38689
  function getStack() {
38690
38690
  var limit = Error.stackTraceLimit;
@@ -39213,7 +39213,7 @@ var require_send = __commonJS({
39213
39213
  var extname3 = path.extname;
39214
39214
  var join10 = path.join;
39215
39215
  var normalize2 = path.normalize;
39216
- var resolve7 = path.resolve;
39216
+ var resolve8 = path.resolve;
39217
39217
  var sep5 = path.sep;
39218
39218
  var Readable3 = stream.Readable;
39219
39219
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
@@ -39260,7 +39260,7 @@ var require_send = __commonJS({
39260
39260
  const lastModified = options.lastModified !== void 0 ? Boolean(options.lastModified) : true;
39261
39261
  const maxage = normalizeMaxAge(options.maxAge ?? options.maxage);
39262
39262
  const maxContentRangeChunkSize = options.maxContentRangeChunkSize !== void 0 ? Number(options.maxContentRangeChunkSize) : null;
39263
- const root = options.root ? resolve7(options.root) : null;
39263
+ const root = options.root ? resolve8(options.root) : null;
39264
39264
  const highWaterMark = Number.isSafeInteger(options.highWaterMark) && options.highWaterMark > 0 ? options.highWaterMark : null;
39265
39265
  return {
39266
39266
  acceptRanges,
@@ -39305,7 +39305,7 @@ var require_send = __commonJS({
39305
39305
  return { statusCode: 403 };
39306
39306
  }
39307
39307
  parts = normalize2(path2).split(sep5);
39308
- path2 = resolve7(path2);
39308
+ path2 = resolve8(path2);
39309
39309
  }
39310
39310
  return { path: path2, parts };
39311
39311
  }
@@ -39401,9 +39401,9 @@ var require_send = __commonJS({
39401
39401
  );
39402
39402
  }
39403
39403
  function tryStat(path2) {
39404
- return new Promise((resolve8) => {
39404
+ return new Promise((resolve9) => {
39405
39405
  fs.stat(path2, function onstat(error, stat4) {
39406
- resolve8({ error, stat: stat4 });
39406
+ resolve9({ error, stat: stat4 });
39407
39407
  });
39408
39408
  });
39409
39409
  }
@@ -40490,8 +40490,8 @@ var require_static = __commonJS({
40490
40490
  }
40491
40491
  }
40492
40492
  }
40493
- for (const [dirname6, rootPath] of indexDirs.entries()) {
40494
- const pathname = dirname6 + (dirname6.endsWith("/") ? "" : "/");
40493
+ for (const [dirname7, rootPath] of indexDirs.entries()) {
40494
+ const pathname = dirname7 + (dirname7.endsWith("/") ? "" : "/");
40495
40495
  const file = "/" + pathname.replace(prefix, "");
40496
40496
  setUpHeadAndGet(routeOpts, pathname, file, rootPath);
40497
40497
  if (opts.redirect === true) {
@@ -44663,12 +44663,12 @@ var require_buffer_list = __commonJS({
44663
44663
  return (String )(input);
44664
44664
  }
44665
44665
  var _require = __require("buffer");
44666
- var Buffer9 = _require.Buffer;
44666
+ var Buffer10 = _require.Buffer;
44667
44667
  var _require2 = __require("util");
44668
44668
  var inspect = _require2.inspect;
44669
44669
  var custom = inspect && inspect.custom || "inspect";
44670
44670
  function copyBuffer(src, target, offset) {
44671
- Buffer9.prototype.copy.call(src, target, offset);
44671
+ Buffer10.prototype.copy.call(src, target, offset);
44672
44672
  }
44673
44673
  module.exports = /* @__PURE__ */ (function() {
44674
44674
  function BufferList() {
@@ -44728,8 +44728,8 @@ var require_buffer_list = __commonJS({
44728
44728
  }, {
44729
44729
  key: "concat",
44730
44730
  value: function concat(n) {
44731
- if (this.length === 0) return Buffer9.alloc(0);
44732
- var ret = Buffer9.allocUnsafe(n >>> 0);
44731
+ if (this.length === 0) return Buffer10.alloc(0);
44732
+ var ret = Buffer10.allocUnsafe(n >>> 0);
44733
44733
  var p2 = this.head;
44734
44734
  var i2 = 0;
44735
44735
  while (p2) {
@@ -44793,7 +44793,7 @@ var require_buffer_list = __commonJS({
44793
44793
  }, {
44794
44794
  key: "_getBuffer",
44795
44795
  value: function _getBuffer(n) {
44796
- var ret = Buffer9.allocUnsafe(n);
44796
+ var ret = Buffer10.allocUnsafe(n);
44797
44797
  var p2 = this.head;
44798
44798
  var c3 = 1;
44799
44799
  p2.data.copy(ret);
@@ -45072,14 +45072,14 @@ var require_stream_writable = __commonJS({
45072
45072
  deprecate: require_node3()
45073
45073
  };
45074
45074
  var Stream = require_stream2();
45075
- var Buffer9 = __require("buffer").Buffer;
45075
+ var Buffer10 = __require("buffer").Buffer;
45076
45076
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
45077
45077
  };
45078
45078
  function _uint8ArrayToBuffer(chunk) {
45079
- return Buffer9.from(chunk);
45079
+ return Buffer10.from(chunk);
45080
45080
  }
45081
45081
  function _isUint8Array(obj) {
45082
- return Buffer9.isBuffer(obj) || obj instanceof OurUint8Array;
45082
+ return Buffer10.isBuffer(obj) || obj instanceof OurUint8Array;
45083
45083
  }
45084
45084
  var destroyImpl = require_destroy();
45085
45085
  var _require = require_state();
@@ -45207,7 +45207,7 @@ var require_stream_writable = __commonJS({
45207
45207
  var state = this._writableState;
45208
45208
  var ret = false;
45209
45209
  var isBuf = !state.objectMode && _isUint8Array(chunk);
45210
- if (isBuf && !Buffer9.isBuffer(chunk)) {
45210
+ if (isBuf && !Buffer10.isBuffer(chunk)) {
45211
45211
  chunk = _uint8ArrayToBuffer(chunk);
45212
45212
  }
45213
45213
  if (typeof encoding === "function") {
@@ -45251,7 +45251,7 @@ var require_stream_writable = __commonJS({
45251
45251
  });
45252
45252
  function decodeChunk(state, chunk, encoding) {
45253
45253
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
45254
- chunk = Buffer9.from(chunk, encoding);
45254
+ chunk = Buffer10.from(chunk, encoding);
45255
45255
  }
45256
45256
  return chunk;
45257
45257
  }
@@ -45620,34 +45620,34 @@ var require_stream_duplex = __commonJS({
45620
45620
  var require_safe_buffer = __commonJS({
45621
45621
  "node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports, module) {
45622
45622
  var buffer = __require("buffer");
45623
- var Buffer9 = buffer.Buffer;
45623
+ var Buffer10 = buffer.Buffer;
45624
45624
  function copyProps(src, dst) {
45625
45625
  for (var key in src) {
45626
45626
  dst[key] = src[key];
45627
45627
  }
45628
45628
  }
45629
- if (Buffer9.from && Buffer9.alloc && Buffer9.allocUnsafe && Buffer9.allocUnsafeSlow) {
45629
+ if (Buffer10.from && Buffer10.alloc && Buffer10.allocUnsafe && Buffer10.allocUnsafeSlow) {
45630
45630
  module.exports = buffer;
45631
45631
  } else {
45632
45632
  copyProps(buffer, exports);
45633
45633
  exports.Buffer = SafeBuffer;
45634
45634
  }
45635
45635
  function SafeBuffer(arg, encodingOrOffset, length) {
45636
- return Buffer9(arg, encodingOrOffset, length);
45636
+ return Buffer10(arg, encodingOrOffset, length);
45637
45637
  }
45638
- SafeBuffer.prototype = Object.create(Buffer9.prototype);
45639
- copyProps(Buffer9, SafeBuffer);
45638
+ SafeBuffer.prototype = Object.create(Buffer10.prototype);
45639
+ copyProps(Buffer10, SafeBuffer);
45640
45640
  SafeBuffer.from = function(arg, encodingOrOffset, length) {
45641
45641
  if (typeof arg === "number") {
45642
45642
  throw new TypeError("Argument must not be a number");
45643
45643
  }
45644
- return Buffer9(arg, encodingOrOffset, length);
45644
+ return Buffer10(arg, encodingOrOffset, length);
45645
45645
  };
45646
45646
  SafeBuffer.alloc = function(size, fill, encoding) {
45647
45647
  if (typeof size !== "number") {
45648
45648
  throw new TypeError("Argument must be a number");
45649
45649
  }
45650
- var buf = Buffer9(size);
45650
+ var buf = Buffer10(size);
45651
45651
  if (fill !== void 0) {
45652
45652
  if (typeof encoding === "string") {
45653
45653
  buf.fill(fill, encoding);
@@ -45663,7 +45663,7 @@ var require_safe_buffer = __commonJS({
45663
45663
  if (typeof size !== "number") {
45664
45664
  throw new TypeError("Argument must be a number");
45665
45665
  }
45666
- return Buffer9(size);
45666
+ return Buffer10(size);
45667
45667
  };
45668
45668
  SafeBuffer.allocUnsafeSlow = function(size) {
45669
45669
  if (typeof size !== "number") {
@@ -45677,8 +45677,8 @@ var require_safe_buffer = __commonJS({
45677
45677
  // node_modules/.pnpm/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.js
45678
45678
  var require_string_decoder = __commonJS({
45679
45679
  "node_modules/.pnpm/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.js"(exports) {
45680
- var Buffer9 = require_safe_buffer().Buffer;
45681
- var isEncoding = Buffer9.isEncoding || function(encoding) {
45680
+ var Buffer10 = require_safe_buffer().Buffer;
45681
+ var isEncoding = Buffer10.isEncoding || function(encoding) {
45682
45682
  encoding = "" + encoding;
45683
45683
  switch (encoding && encoding.toLowerCase()) {
45684
45684
  case "hex":
@@ -45726,7 +45726,7 @@ var require_string_decoder = __commonJS({
45726
45726
  }
45727
45727
  function normalizeEncoding(enc) {
45728
45728
  var nenc = _normalizeEncoding(enc);
45729
- if (typeof nenc !== "string" && (Buffer9.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
45729
+ if (typeof nenc !== "string" && (Buffer10.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
45730
45730
  return nenc || enc;
45731
45731
  }
45732
45732
  exports.StringDecoder = StringDecoder;
@@ -45755,7 +45755,7 @@ var require_string_decoder = __commonJS({
45755
45755
  }
45756
45756
  this.lastNeed = 0;
45757
45757
  this.lastTotal = 0;
45758
- this.lastChar = Buffer9.allocUnsafe(nb);
45758
+ this.lastChar = Buffer10.allocUnsafe(nb);
45759
45759
  }
45760
45760
  StringDecoder.prototype.write = function(buf) {
45761
45761
  if (buf.length === 0) return "";
@@ -46041,14 +46041,14 @@ var require_async_iterator = __commonJS({
46041
46041
  };
46042
46042
  }
46043
46043
  function readAndResolve(iter) {
46044
- var resolve7 = iter[kLastResolve];
46045
- if (resolve7 !== null) {
46044
+ var resolve8 = iter[kLastResolve];
46045
+ if (resolve8 !== null) {
46046
46046
  var data = iter[kStream].read();
46047
46047
  if (data !== null) {
46048
46048
  iter[kLastPromise] = null;
46049
46049
  iter[kLastResolve] = null;
46050
46050
  iter[kLastReject] = null;
46051
- resolve7(createIterResult(data, false));
46051
+ resolve8(createIterResult(data, false));
46052
46052
  }
46053
46053
  }
46054
46054
  }
@@ -46056,13 +46056,13 @@ var require_async_iterator = __commonJS({
46056
46056
  process.nextTick(readAndResolve, iter);
46057
46057
  }
46058
46058
  function wrapForNext(lastPromise, iter) {
46059
- return function(resolve7, reject) {
46059
+ return function(resolve8, reject) {
46060
46060
  lastPromise.then(function() {
46061
46061
  if (iter[kEnded]) {
46062
- resolve7(createIterResult(void 0, true));
46062
+ resolve8(createIterResult(void 0, true));
46063
46063
  return;
46064
46064
  }
46065
- iter[kHandlePromise](resolve7, reject);
46065
+ iter[kHandlePromise](resolve8, reject);
46066
46066
  }, reject);
46067
46067
  };
46068
46068
  }
@@ -46082,12 +46082,12 @@ var require_async_iterator = __commonJS({
46082
46082
  return Promise.resolve(createIterResult(void 0, true));
46083
46083
  }
46084
46084
  if (this[kStream].destroyed) {
46085
- return new Promise(function(resolve7, reject) {
46085
+ return new Promise(function(resolve8, reject) {
46086
46086
  process.nextTick(function() {
46087
46087
  if (_this[kError]) {
46088
46088
  reject(_this[kError]);
46089
46089
  } else {
46090
- resolve7(createIterResult(void 0, true));
46090
+ resolve8(createIterResult(void 0, true));
46091
46091
  }
46092
46092
  });
46093
46093
  });
@@ -46110,13 +46110,13 @@ var require_async_iterator = __commonJS({
46110
46110
  return this;
46111
46111
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
46112
46112
  var _this2 = this;
46113
- return new Promise(function(resolve7, reject) {
46113
+ return new Promise(function(resolve8, reject) {
46114
46114
  _this2[kStream].destroy(null, function(err) {
46115
46115
  if (err) {
46116
46116
  reject(err);
46117
46117
  return;
46118
46118
  }
46119
- resolve7(createIterResult(void 0, true));
46119
+ resolve8(createIterResult(void 0, true));
46120
46120
  });
46121
46121
  });
46122
46122
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -46138,15 +46138,15 @@ var require_async_iterator = __commonJS({
46138
46138
  value: stream._readableState.endEmitted,
46139
46139
  writable: true
46140
46140
  }), _defineProperty(_Object$create, kHandlePromise, {
46141
- value: function value(resolve7, reject) {
46141
+ value: function value(resolve8, reject) {
46142
46142
  var data = iterator[kStream].read();
46143
46143
  if (data) {
46144
46144
  iterator[kLastPromise] = null;
46145
46145
  iterator[kLastResolve] = null;
46146
46146
  iterator[kLastReject] = null;
46147
- resolve7(createIterResult(data, false));
46147
+ resolve8(createIterResult(data, false));
46148
46148
  } else {
46149
- iterator[kLastResolve] = resolve7;
46149
+ iterator[kLastResolve] = resolve8;
46150
46150
  iterator[kLastReject] = reject;
46151
46151
  }
46152
46152
  },
@@ -46165,12 +46165,12 @@ var require_async_iterator = __commonJS({
46165
46165
  iterator[kError] = err;
46166
46166
  return;
46167
46167
  }
46168
- var resolve7 = iterator[kLastResolve];
46169
- if (resolve7 !== null) {
46168
+ var resolve8 = iterator[kLastResolve];
46169
+ if (resolve8 !== null) {
46170
46170
  iterator[kLastPromise] = null;
46171
46171
  iterator[kLastResolve] = null;
46172
46172
  iterator[kLastReject] = null;
46173
- resolve7(createIterResult(void 0, true));
46173
+ resolve8(createIterResult(void 0, true));
46174
46174
  }
46175
46175
  iterator[kEnded] = true;
46176
46176
  });
@@ -46184,7 +46184,7 @@ var require_async_iterator = __commonJS({
46184
46184
  // node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js
46185
46185
  var require_from = __commonJS({
46186
46186
  "node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports, module) {
46187
- function asyncGeneratorStep(gen, resolve7, reject, _next, _throw, key, arg) {
46187
+ function asyncGeneratorStep(gen, resolve8, reject, _next, _throw, key, arg) {
46188
46188
  try {
46189
46189
  var info = gen[key](arg);
46190
46190
  var value = info.value;
@@ -46193,7 +46193,7 @@ var require_from = __commonJS({
46193
46193
  return;
46194
46194
  }
46195
46195
  if (info.done) {
46196
- resolve7(value);
46196
+ resolve8(value);
46197
46197
  } else {
46198
46198
  Promise.resolve(value).then(_next, _throw);
46199
46199
  }
@@ -46201,13 +46201,13 @@ var require_from = __commonJS({
46201
46201
  function _asyncToGenerator(fn) {
46202
46202
  return function() {
46203
46203
  var self2 = this, args = arguments;
46204
- return new Promise(function(resolve7, reject) {
46204
+ return new Promise(function(resolve8, reject) {
46205
46205
  var gen = fn.apply(self2, args);
46206
46206
  function _next(value) {
46207
- asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "next", value);
46207
+ asyncGeneratorStep(gen, resolve8, reject, _next, _throw, "next", value);
46208
46208
  }
46209
46209
  function _throw(err) {
46210
- asyncGeneratorStep(gen, resolve7, reject, _next, _throw, "throw", err);
46210
+ asyncGeneratorStep(gen, resolve8, reject, _next, _throw, "throw", err);
46211
46211
  }
46212
46212
  _next(void 0);
46213
46213
  });
@@ -46312,14 +46312,14 @@ var require_stream_readable = __commonJS({
46312
46312
  return emitter.listeners(type).length;
46313
46313
  };
46314
46314
  var Stream = require_stream2();
46315
- var Buffer9 = __require("buffer").Buffer;
46315
+ var Buffer10 = __require("buffer").Buffer;
46316
46316
  var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
46317
46317
  };
46318
46318
  function _uint8ArrayToBuffer(chunk) {
46319
- return Buffer9.from(chunk);
46319
+ return Buffer10.from(chunk);
46320
46320
  }
46321
46321
  function _isUint8Array(obj) {
46322
- return Buffer9.isBuffer(obj) || obj instanceof OurUint8Array;
46322
+ return Buffer10.isBuffer(obj) || obj instanceof OurUint8Array;
46323
46323
  }
46324
46324
  var debugUtil = __require("util");
46325
46325
  var debug2;
@@ -46427,7 +46427,7 @@ var require_stream_readable = __commonJS({
46427
46427
  if (typeof chunk === "string") {
46428
46428
  encoding = encoding || state.defaultEncoding;
46429
46429
  if (encoding !== state.encoding) {
46430
- chunk = Buffer9.from(chunk, encoding);
46430
+ chunk = Buffer10.from(chunk, encoding);
46431
46431
  encoding = "";
46432
46432
  }
46433
46433
  skipChunkCheck = true;
@@ -46452,7 +46452,7 @@ var require_stream_readable = __commonJS({
46452
46452
  if (er) {
46453
46453
  errorOrDestroy(stream, er);
46454
46454
  } else if (state.objectMode || chunk && chunk.length > 0) {
46455
- if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer9.prototype) {
46455
+ if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer10.prototype) {
46456
46456
  chunk = _uint8ArrayToBuffer(chunk);
46457
46457
  }
46458
46458
  if (addToFront) {
@@ -47674,16 +47674,16 @@ var require_websocket2 = __commonJS({
47674
47674
  const clientStream = new Duplexify(client2Server, server2Client);
47675
47675
  const ws = new WebSocket(null, void 0, { isServer: false });
47676
47676
  const head = Buffer.from([]);
47677
- let resolve7, reject;
47677
+ let resolve8, reject;
47678
47678
  const promise = new Promise((_resolve, _reject) => {
47679
- resolve7 = _resolve;
47679
+ resolve8 = _resolve;
47680
47680
  reject = _reject;
47681
47681
  });
47682
47682
  typeof options.onInit === "function" && options.onInit(ws);
47683
47683
  ws.on("open", () => {
47684
47684
  typeof options.onOpen === "function" && options.onOpen(ws);
47685
47685
  clientStream.removeListener("data", onData);
47686
- resolve7(ws);
47686
+ resolve8(ws);
47687
47687
  });
47688
47688
  const onData = (chunk) => {
47689
47689
  if (chunk.toString().includes("HTTP/1.1 101 Switching Protocols")) {
@@ -48180,20 +48180,16 @@ var AttachmentQueueIndex = class {
48180
48180
  this.#attachmentIdsByQueue.delete(key);
48181
48181
  return ids;
48182
48182
  }
48183
+ replace(projectId, queuedSubmissionId, attachmentIds) {
48184
+ const key = queueKey(projectId, queuedSubmissionId);
48185
+ const previous = this.#attachmentIdsByQueue.get(key) ?? /* @__PURE__ */ new Set();
48186
+ const next = new Set(attachmentIds);
48187
+ this.#attachmentIdsByQueue.set(key, next);
48188
+ return [...previous].filter((id) => !next.has(id));
48189
+ }
48183
48190
  hasAttachment(attachmentId) {
48184
48191
  return [...this.#attachmentIdsByQueue.values()].some((ids) => ids.has(attachmentId));
48185
48192
  }
48186
- releaseMissing(projectId, retainedQueueIds) {
48187
- const prefix = `${projectId}\0`;
48188
- const releasedAttachmentIds = [];
48189
- for (const [key, ids] of this.#attachmentIdsByQueue) {
48190
- if (key.startsWith(prefix) && !retainedQueueIds.has(key.slice(prefix.length))) {
48191
- releasedAttachmentIds.push(...ids);
48192
- this.#attachmentIdsByQueue.delete(key);
48193
- }
48194
- }
48195
- return releasedAttachmentIds;
48196
- }
48197
48193
  deleteAttachment(attachmentId) {
48198
48194
  for (const [key, ids] of this.#attachmentIdsByQueue) {
48199
48195
  ids.delete(attachmentId);
@@ -48521,7 +48517,7 @@ var AttachmentStore = class {
48521
48517
  }
48522
48518
  }
48523
48519
  }
48524
- retainQueue(projectId, ids, queuedSubmissionId) {
48520
+ async retainQueue(projectId, ids, queuedSubmissionId, replaceExisting = false) {
48525
48521
  const uniqueIds = [...new Set(ids)];
48526
48522
  for (const id of uniqueIds) {
48527
48523
  const entry = this.#entries.get(id);
@@ -48530,8 +48526,12 @@ var AttachmentStore = class {
48530
48526
  }
48531
48527
  entry.expiresAt = this.#clock() + this.#ttlMs;
48532
48528
  }
48533
- this.#queueIndex.retain(projectId, queuedSubmissionId, uniqueIds);
48534
- return Promise.resolve();
48529
+ if (!replaceExisting) {
48530
+ this.#queueIndex.retain(projectId, queuedSubmissionId, uniqueIds);
48531
+ return;
48532
+ }
48533
+ const removed = this.#queueIndex.replace(projectId, queuedSubmissionId, uniqueIds);
48534
+ await Promise.all(removed.map((attachmentId) => this.#delete(attachmentId)));
48535
48535
  }
48536
48536
  startQueue(projectId, queuedSubmissionId, turnId) {
48537
48537
  for (const attachmentId of this.#queueIndex.take(projectId, queuedSubmissionId)) {
@@ -48543,15 +48543,6 @@ var AttachmentStore = class {
48543
48543
  }
48544
48544
  return Promise.resolve();
48545
48545
  }
48546
- reconcileQueue(projectId, queuedSubmissionIds) {
48547
- const retainedIds = new Set(queuedSubmissionIds);
48548
- for (const attachmentId of this.#queueIndex.releaseMissing(projectId, retainedIds)) {
48549
- const entry = this.#entries.get(attachmentId);
48550
- if (entry?.projectId === projectId) {
48551
- entry.expiresAt = this.#clock() + this.#ttlMs;
48552
- }
48553
- }
48554
- }
48555
48546
  async releaseQueue(projectId, queuedSubmissionId) {
48556
48547
  const attachmentIds = this.#queueIndex.take(projectId, queuedSubmissionId);
48557
48548
  await Promise.all(attachmentIds.map((attachmentId) => this.#delete(attachmentId)));
@@ -53677,27 +53668,27 @@ function pLimit(concurrency) {
53677
53668
  activeCount--;
53678
53669
  resumeNext();
53679
53670
  };
53680
- const run = async (function_, resolve7, arguments_) => {
53671
+ const run = async (function_, resolve8, arguments_) => {
53681
53672
  const result = (async () => function_(...arguments_))();
53682
- resolve7(result);
53673
+ resolve8(result);
53683
53674
  try {
53684
53675
  await result;
53685
53676
  } catch {
53686
53677
  }
53687
53678
  next();
53688
53679
  };
53689
- const enqueue = (function_, resolve7, reject, arguments_) => {
53680
+ const enqueue = (function_, resolve8, reject, arguments_) => {
53690
53681
  const queueItem = { reject };
53691
53682
  new Promise((internalResolve) => {
53692
53683
  queueItem.run = internalResolve;
53693
53684
  queue.enqueue(queueItem);
53694
- }).then(run.bind(void 0, function_, resolve7, arguments_));
53685
+ }).then(run.bind(void 0, function_, resolve8, arguments_));
53695
53686
  if (activeCount < concurrency) {
53696
53687
  resumeNext();
53697
53688
  }
53698
53689
  };
53699
- const generator = (function_, ...arguments_) => new Promise((resolve7, reject) => {
53700
- enqueue(function_, resolve7, reject, arguments_);
53690
+ const generator = (function_, ...arguments_) => new Promise((resolve8, reject) => {
53691
+ enqueue(function_, resolve8, reject, arguments_);
53701
53692
  });
53702
53693
  Object.defineProperties(generator, {
53703
53694
  activeCount: {
@@ -54309,7 +54300,7 @@ function literalPath(path) {
54309
54300
  return `:(literal)${path}`;
54310
54301
  }
54311
54302
  async function executeGit2(repositoryRoot, arguments_, input = "", environment = {}) {
54312
- return new Promise((resolve7, reject) => {
54303
+ return new Promise((resolve8, reject) => {
54313
54304
  const consumesInput = input !== "";
54314
54305
  const child = spawn("git", ["-C", repositoryRoot, ...arguments_], {
54315
54306
  env: { ...createGitEnvironment(), ...environment, GIT_TERMINAL_PROMPT: "0" },
@@ -54331,7 +54322,7 @@ async function executeGit2(repositoryRoot, arguments_, input = "", environment =
54331
54322
  if (error !== void 0) {
54332
54323
  reject(error);
54333
54324
  } else if (result !== void 0) {
54334
- resolve7(result);
54325
+ resolve8(result);
54335
54326
  }
54336
54327
  };
54337
54328
  const collect = (target, chunk) => {
@@ -55564,7 +55555,7 @@ async function generateCommitMessageWithCodex(provider, prompt, settings) {
55564
55555
  let timeout;
55565
55556
  let unsubscribeEvents;
55566
55557
  try {
55567
- const completedTurn = new Promise((resolve7, reject) => {
55558
+ const completedTurn = new Promise((resolve8, reject) => {
55568
55559
  unsubscribeEvents = provider.subscribeEvents(
55569
55560
  (event) => {
55570
55561
  if (event.taskId !== task.id) {
@@ -55574,7 +55565,7 @@ async function generateCommitMessageWithCodex(provider, prompt, settings) {
55574
55565
  completedAssistantMessages.set(event.turnId, event.payload.item.text);
55575
55566
  } else if (event.type === "turn.completed") {
55576
55567
  turnFinished = true;
55577
- resolve7(event.payload.turn);
55568
+ resolve8(event.payload.turn);
55578
55569
  } else if (event.type === "provider.error" && !event.payload.willRetry) {
55579
55570
  reject(new Error(event.payload.message));
55580
55571
  }
@@ -55818,6 +55809,71 @@ async function readProjectFileTree(projectRoot, directoryPath) {
55818
55809
  }
55819
55810
  return { entries, path: directoryPath ?? null };
55820
55811
  }
55812
+ var MAX_PROJECT_FILE_DEPTH = 20;
55813
+ var validFileName = /^(?!\.\.?$)[^/\\]{1,255}$/u;
55814
+ function parseProjectRelativePath(path) {
55815
+ const segments = path.split("/");
55816
+ if (path.startsWith("/") || path.endsWith("/") || path.includes("\\") || /^[A-Za-z]:/u.test(path) || segments.length > MAX_PROJECT_FILE_DEPTH || segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
55817
+ throw new TypeError("Project file path is invalid");
55818
+ }
55819
+ return segments;
55820
+ }
55821
+ function assertPathInsideRoot(rootPath, targetPath) {
55822
+ const pathFromRoot = relative(rootPath, targetPath);
55823
+ if (pathFromRoot === "" || pathFromRoot === ".." || pathFromRoot.startsWith(`..${String.raw`/`}`)) {
55824
+ throw new TypeError("Project file path is outside the project root");
55825
+ }
55826
+ if (pathFromRoot.startsWith("..\\") || resolve(rootPath, pathFromRoot) !== targetPath) {
55827
+ throw new TypeError("Project file path is outside the project root");
55828
+ }
55829
+ }
55830
+ async function resolveProjectFileTarget(projectRoot, path) {
55831
+ const resolvedRoot = await realpath(projectRoot);
55832
+ const segments = parseProjectRelativePath(path);
55833
+ const absolutePath = resolve(resolvedRoot, ...segments);
55834
+ const resolvedParent = await realpath(dirname(absolutePath));
55835
+ assertPathInsideRoot(resolvedRoot, absolutePath);
55836
+ if (resolvedParent !== resolvedRoot) {
55837
+ assertPathInsideRoot(resolvedRoot, resolvedParent);
55838
+ }
55839
+ const stats = await lstat(absolutePath);
55840
+ if (stats.isSymbolicLink()) {
55841
+ throw new TypeError("Project file target must not be a symbolic link");
55842
+ }
55843
+ if (!stats.isFile() && !stats.isDirectory()) {
55844
+ throw new TypeError("Project file target is not a file or directory");
55845
+ }
55846
+ return { absolutePath, resolvedRoot };
55847
+ }
55848
+ async function pathExists2(path) {
55849
+ try {
55850
+ await lstat(path);
55851
+ return true;
55852
+ } catch (error) {
55853
+ if (error.code === "ENOENT") return false;
55854
+ throw error;
55855
+ }
55856
+ }
55857
+ async function renameProjectFile(projectRoot, path, name) {
55858
+ if (!validFileName.test(name) || name.includes("\0") || name.includes("\r") || name.includes("\n")) {
55859
+ throw new TypeError("Project file name is invalid");
55860
+ }
55861
+ const { absolutePath, resolvedRoot } = await resolveProjectFileTarget(projectRoot, path);
55862
+ const targetPath = resolve(dirname(absolutePath), name);
55863
+ assertPathInsideRoot(resolvedRoot, targetPath);
55864
+ if (await pathExists2(targetPath)) {
55865
+ throw new TypeError("Project file rename target already exists");
55866
+ }
55867
+ await rename(absolutePath, targetPath);
55868
+ const separatorIndex = path.lastIndexOf("/");
55869
+ const renamedPath = separatorIndex === -1 ? name : `${path.slice(0, separatorIndex)}/${name}`;
55870
+ return { path: renamedPath };
55871
+ }
55872
+ async function deleteProjectFile(projectRoot, path) {
55873
+ const { absolutePath } = await resolveProjectFileTarget(projectRoot, path);
55874
+ await rm(absolutePath, { recursive: true });
55875
+ return { path, status: "deleted" };
55876
+ }
55821
55877
  var MAX_PROJECT_IMAGE_PREVIEW_BYTES = 20 * 1024 * 1024;
55822
55878
  function isOutsideProject(relativePath) {
55823
55879
  return relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath);
@@ -55956,6 +56012,78 @@ async function readProjectSourceFile(projectRoot, requestedPath, cursor = 0) {
55956
56012
  path: isAbsoluteReference ? resolvedSourcePath : projectRelativePath.split(sep).join("/")
55957
56013
  };
55958
56014
  }
56015
+ function createProviderTurnInputResolver(attachmentStore) {
56016
+ return async (projectId, input, provider, taskId) => {
56017
+ const requestedIds = input.attachments.map((attachment) => attachment.id);
56018
+ if (new Set(requestedIds).size !== requestedIds.length) {
56019
+ throw new MutationHttpError("INVALID_REQUEST", "Duplicate attachments are not allowed", 400);
56020
+ }
56021
+ const attachmentIds = [];
56022
+ const attachments = [];
56023
+ for (const requestedId of requestedIds) {
56024
+ try {
56025
+ const [resolved2] = await attachmentStore.resolve(projectId, [requestedId]);
56026
+ if (resolved2 !== void 0) {
56027
+ attachmentIds.push(requestedId);
56028
+ attachments.push(resolved2);
56029
+ continue;
56030
+ }
56031
+ } catch (error) {
56032
+ if (!(error instanceof AttachmentNotFoundError)) throw error;
56033
+ }
56034
+ const historical = provider === void 0 || taskId === void 0 ? void 0 : await provider.readTaskAttachment(taskId, requestedId);
56035
+ if (historical === void 0) {
56036
+ throw new MutationHttpError(
56037
+ "ATTACHMENT_NOT_FOUND",
56038
+ "Attachment was not found or has expired",
56039
+ 404
56040
+ );
56041
+ }
56042
+ const cloned = await attachmentStore.add(projectId, {
56043
+ content: Readable.from([historical.content]),
56044
+ kind: historical.kind,
56045
+ mediaType: historical.mediaType,
56046
+ name: historical.name
56047
+ });
56048
+ const [resolved] = await attachmentStore.resolve(projectId, [cloned.attachment.id]);
56049
+ if (resolved !== void 0) {
56050
+ attachmentIds.push(cloned.attachment.id);
56051
+ attachments.push(resolved);
56052
+ }
56053
+ }
56054
+ const imageBytes = attachments.reduce(
56055
+ (total, attachment) => total + (attachment.kind === "image" ? attachment.size : 0),
56056
+ 0
56057
+ );
56058
+ const fileBytes = attachments.reduce(
56059
+ (total, attachment) => total + (attachment.kind === "image" ? 0 : attachment.size),
56060
+ 0
56061
+ );
56062
+ const imageCount = attachments.filter((attachment) => attachment.kind === "image").length;
56063
+ if (imageCount > MAX_AGENT_IMAGES || imageBytes > MAX_AGENT_IMAGE_TOTAL_BYTES) {
56064
+ throw new MutationHttpError("INVALID_REQUEST", "Image input limit exceeded", 400);
56065
+ }
56066
+ if (fileBytes > MAX_AGENT_FILE_TOTAL_BYTES) {
56067
+ throw new MutationHttpError("INVALID_REQUEST", "File input limit exceeded", 400);
56068
+ }
56069
+ return {
56070
+ attachmentIds,
56071
+ providerInput: {
56072
+ files: attachments.flatMap(
56073
+ (attachment) => attachment.kind === "file" ? [{ mediaType: attachment.mediaType, name: attachment.name, path: attachment.path }] : []
56074
+ ),
56075
+ images: attachments.flatMap(
56076
+ (attachment) => attachment.kind === "image" ? [{ mediaType: attachment.mediaType, url: attachment.url }] : []
56077
+ ),
56078
+ skills: input.skills,
56079
+ text: input.text,
56080
+ textAttachments: attachments.flatMap(
56081
+ (attachment) => attachment.kind === "text" ? [{ name: attachment.name, text: attachment.text }] : []
56082
+ )
56083
+ }
56084
+ };
56085
+ };
56086
+ }
55959
56087
  var DEFAULT_LAUNCH_CONFIRMATION_MS = 500;
55960
56088
  function readEnvironmentValue(environment, names) {
55961
56089
  for (const name of names) {
@@ -55972,15 +56100,15 @@ function readEnvironmentValue(environment, names) {
55972
56100
  }
55973
56101
  return void 0;
55974
56102
  }
55975
- async function firstExisting(candidates, pathExists2) {
56103
+ async function firstExisting(candidates, pathExists3) {
55976
56104
  for (const candidate of candidates) {
55977
- if (candidate !== void 0 && await pathExists2(candidate)) {
56105
+ if (candidate !== void 0 && await pathExists3(candidate)) {
55978
56106
  return candidate;
55979
56107
  }
55980
56108
  }
55981
56109
  return void 0;
55982
56110
  }
55983
- async function findPathExecutable(command, platform, environment, pathExists2) {
56111
+ async function findPathExecutable(command, platform, environment, pathExists3) {
55984
56112
  const pathValue = readEnvironmentValue(environment, ["PATH"]);
55985
56113
  if (pathValue === void 0) {
55986
56114
  return void 0;
@@ -55989,7 +56117,7 @@ async function findPathExecutable(command, platform, environment, pathExists2) {
55989
56117
  const delimiter = platform === "win32" ? ";" : ":";
55990
56118
  return firstExisting(
55991
56119
  pathValue.split(delimiter).filter(Boolean).map((directory) => pathApi.join(directory, command)),
55992
- pathExists2
56120
+ pathExists3
55993
56121
  );
55994
56122
  }
55995
56123
  function addCommand(commands, app, file, args, options = {}) {
@@ -56009,14 +56137,14 @@ function macAppCandidates(home, appName) {
56009
56137
  ...home === void 0 ? [] : [posix.join(home, "Applications", `${appName}.app`)]
56010
56138
  ];
56011
56139
  }
56012
- async function resolveMacCommands(environment, pathExists2) {
56140
+ async function resolveMacCommands(environment, pathExists3) {
56013
56141
  const commands = /* @__PURE__ */ new Map();
56014
- const open5 = await firstExisting(["/usr/bin/open"], pathExists2);
56142
+ const open5 = await firstExisting(["/usr/bin/open"], pathExists3);
56015
56143
  if (open5 === void 0) {
56016
56144
  return commands;
56017
56145
  }
56018
56146
  const home = readEnvironmentValue(environment, ["HOME"]);
56019
- const resolveApp = (name) => firstExisting(macAppCandidates(home, name), pathExists2);
56147
+ const resolveApp = (name) => firstExisting(macAppCandidates(home, name), pathExists3);
56020
56148
  const addMacApp = async (id, name, kind) => {
56021
56149
  const appPath = await resolveApp(name);
56022
56150
  addCommand(commands, { id, kind, name }, appPath === void 0 ? void 0 : open5, (target) => [
@@ -56043,7 +56171,7 @@ async function resolveMacCommands(environment, pathExists2) {
56043
56171
  );
56044
56172
  const terminalPath = await firstExisting(
56045
56173
  ["/System/Applications/Utilities/Terminal.app", "/Applications/Utilities/Terminal.app"],
56046
- pathExists2
56174
+ pathExists3
56047
56175
  );
56048
56176
  addCommand(
56049
56177
  commands,
@@ -56056,9 +56184,9 @@ async function resolveMacCommands(environment, pathExists2) {
56056
56184
  await addMacApp("android-studio", "Android Studio", "editor");
56057
56185
  return commands;
56058
56186
  }
56059
- async function resolveLinuxCommands(environment, pathExists2) {
56187
+ async function resolveLinuxCommands(environment, pathExists3) {
56060
56188
  const commands = /* @__PURE__ */ new Map();
56061
- const find = (command) => findPathExecutable(command, "linux", environment, pathExists2);
56189
+ const find = (command) => findPathExecutable(command, "linux", environment, pathExists3);
56062
56190
  addCommand(commands, { id: "zed", kind: "editor", name: "Zed" }, await find("zed"), (target) => [
56063
56191
  target.absolutePath
56064
56192
  ]);
@@ -56114,7 +56242,7 @@ async function resolveLinuxCommands(environment, pathExists2) {
56114
56242
  );
56115
56243
  const androidStudio = await firstExisting(
56116
56244
  ["/opt/android-studio/bin/studio.sh", await find("android-studio"), await find("studio.sh")],
56117
- pathExists2
56245
+ pathExists3
56118
56246
  );
56119
56247
  addCommand(
56120
56248
  commands,
@@ -56124,19 +56252,19 @@ async function resolveLinuxCommands(environment, pathExists2) {
56124
56252
  );
56125
56253
  return commands;
56126
56254
  }
56127
- async function resolveWindowsCommands(environment, pathExists2) {
56255
+ async function resolveWindowsCommands(environment, pathExists3) {
56128
56256
  const commands = /* @__PURE__ */ new Map();
56129
56257
  const systemRoot = readEnvironmentValue(environment, ["SystemRoot", "WINDIR"]);
56130
56258
  const localAppData = readEnvironmentValue(environment, ["LOCALAPPDATA"]);
56131
56259
  const programFiles = readEnvironmentValue(environment, ["ProgramFiles"]);
56132
56260
  const programFilesX86 = readEnvironmentValue(environment, ["ProgramFiles(x86)"]);
56133
- const find = (command) => findPathExecutable(command, "win32", environment, pathExists2);
56261
+ const find = (command) => findPathExecutable(command, "win32", environment, pathExists3);
56134
56262
  const zed = await firstExisting(
56135
56263
  [
56136
56264
  localAppData === void 0 ? void 0 : win32.join(localAppData, "Programs", "Zed", "Zed.exe"),
56137
56265
  await find("Zed.exe")
56138
56266
  ],
56139
- pathExists2
56267
+ pathExists3
56140
56268
  );
56141
56269
  addCommand(commands, { id: "zed", kind: "editor", name: "Zed" }, zed, (target) => [
56142
56270
  target.absolutePath
@@ -56146,7 +56274,7 @@ async function resolveWindowsCommands(environment, pathExists2) {
56146
56274
  localAppData === void 0 ? void 0 : win32.join(localAppData, "Programs", "Windsurf", "Windsurf.exe"),
56147
56275
  await find("Windsurf.exe")
56148
56276
  ],
56149
- pathExists2
56277
+ pathExists3
56150
56278
  );
56151
56279
  addCommand(commands, { id: "windsurf", kind: "editor", name: "Windsurf" }, windsurf, (target) => [
56152
56280
  target.absolutePath
@@ -56158,7 +56286,7 @@ async function resolveWindowsCommands(environment, pathExists2) {
56158
56286
  programFilesX86 === void 0 ? void 0 : win32.join(programFilesX86, "Microsoft VS Code", "Code.exe"),
56159
56287
  await find("Code.exe")
56160
56288
  ],
56161
- pathExists2
56289
+ pathExists3
56162
56290
  );
56163
56291
  addCommand(
56164
56292
  commands,
@@ -56171,7 +56299,7 @@ async function resolveWindowsCommands(environment, pathExists2) {
56171
56299
  systemRoot === void 0 ? void 0 : win32.join(systemRoot, "explorer.exe"),
56172
56300
  await find("explorer.exe")
56173
56301
  ],
56174
- pathExists2
56302
+ pathExists3
56175
56303
  );
56176
56304
  addCommand(
56177
56305
  commands,
@@ -56192,7 +56320,7 @@ async function resolveWindowsCommands(environment, pathExists2) {
56192
56320
  localAppData === void 0 ? void 0 : win32.join(localAppData, "Microsoft", "WindowsApps", "wt.exe"),
56193
56321
  await find("wt.exe")
56194
56322
  ],
56195
- pathExists2
56323
+ pathExists3
56196
56324
  );
56197
56325
  addCommand(
56198
56326
  commands,
@@ -56205,7 +56333,7 @@ async function resolveWindowsCommands(environment, pathExists2) {
56205
56333
  readEnvironmentValue(environment, ["COMSPEC"]),
56206
56334
  systemRoot === void 0 ? void 0 : win32.join(systemRoot, "System32", "cmd.exe")
56207
56335
  ],
56208
- pathExists2
56336
+ pathExists3
56209
56337
  );
56210
56338
  addCommand(
56211
56339
  commands,
@@ -56219,7 +56347,7 @@ async function resolveWindowsCommands(environment, pathExists2) {
56219
56347
  programFilesX86 === void 0 ? void 0 : win32.join(programFilesX86, "Android", "Android Studio", "bin", "studio64.exe"),
56220
56348
  await find("studio64.exe")
56221
56349
  ],
56222
- pathExists2
56350
+ pathExists3
56223
56351
  );
56224
56352
  addCommand(
56225
56353
  commands,
@@ -56322,7 +56450,7 @@ async function defaultPathExists(path) {
56322
56450
  }
56323
56451
  }
56324
56452
  function defaultSpawnDetached(file, args, options, launchConfirmationMs) {
56325
- return new Promise((resolve7, reject) => {
56453
+ return new Promise((resolve8, reject) => {
56326
56454
  const { observeEarlyExit, ...spawnOptions } = options;
56327
56455
  const child = spawn(file, [...args], {
56328
56456
  ...spawnOptions,
@@ -56350,20 +56478,20 @@ function defaultSpawnDetached(file, args, options, launchConfirmationMs) {
56350
56478
  if (!observeEarlyExit) {
56351
56479
  settle(() => {
56352
56480
  child.unref();
56353
- resolve7();
56481
+ resolve8();
56354
56482
  });
56355
56483
  return;
56356
56484
  }
56357
56485
  confirmationTimer = setTimeout(() => {
56358
56486
  settle(() => {
56359
56487
  child.unref();
56360
- resolve7();
56488
+ resolve8();
56361
56489
  });
56362
56490
  }, launchConfirmationMs);
56363
56491
  });
56364
56492
  child.once("exit", (exitCode, signal) => {
56365
56493
  if (exitCode === 0) {
56366
- settle(resolve7);
56494
+ settle(resolve8);
56367
56495
  return;
56368
56496
  }
56369
56497
  const reason = signal ? `signal ${signal}` : `code ${String(exitCode)}`;
@@ -56376,17 +56504,17 @@ function defaultSpawnDetached(file, args, options, launchConfirmationMs) {
56376
56504
  function createProjectOpenService(options = {}) {
56377
56505
  const platform = options.platform ?? process.platform;
56378
56506
  const environment = options.environment ?? process.env;
56379
- const pathExists2 = options.pathExists ?? defaultPathExists;
56507
+ const pathExists3 = options.pathExists ?? defaultPathExists;
56380
56508
  const launchConfirmationMs = options.launchConfirmationMs ?? DEFAULT_LAUNCH_CONFIRMATION_MS;
56381
56509
  const spawnDetached = options.spawnDetached ?? ((file, args, spawnOptions) => defaultSpawnDetached(file, args, spawnOptions, launchConfirmationMs));
56382
56510
  const resolveCommands = () => {
56383
56511
  switch (platform) {
56384
56512
  case "darwin":
56385
- return resolveMacCommands(environment, pathExists2);
56513
+ return resolveMacCommands(environment, pathExists3);
56386
56514
  case "linux":
56387
- return resolveLinuxCommands(environment, pathExists2);
56515
+ return resolveLinuxCommands(environment, pathExists3);
56388
56516
  case "win32":
56389
- return resolveWindowsCommands(environment, pathExists2);
56517
+ return resolveWindowsCommands(environment, pathExists3);
56390
56518
  }
56391
56519
  };
56392
56520
  return {
@@ -56412,19 +56540,6 @@ function createProjectOpenService(options = {}) {
56412
56540
  }
56413
56541
  };
56414
56542
  }
56415
- async function reconcileQueuedAttachments(attachmentStore, projectId, taskId, queue) {
56416
- const queuedSubmissionIds = [];
56417
- let cursor;
56418
- do {
56419
- const page = await queue.list(taskId, {
56420
- ...cursor === void 0 ? {} : { cursor },
56421
- limit: 100
56422
- });
56423
- queuedSubmissionIds.push(...page.data.map((submission) => submission.id));
56424
- cursor = page.nextCursor ?? void 0;
56425
- } while (cursor !== void 0);
56426
- attachmentStore.reconcileQueue(projectId, queuedSubmissionIds);
56427
- }
56428
56543
  function createProjectRuntimeContext(options) {
56429
56544
  const eventStream = new AgentEventStream({
56430
56545
  ...options.eventBufferSize === void 0 ? {} : { capacity: options.eventBufferSize },
@@ -56441,14 +56556,12 @@ function createProjectRuntimeContext(options) {
56441
56556
  options.onActivity();
56442
56557
  if (event.type === "turn.completed") {
56443
56558
  void attachmentStore.releaseTurn(scope.id, event.payload.turn.id).catch(onAttachmentReleaseError);
56444
- }
56445
- if (event.type === "queue.changed" && provider.queue !== void 0) {
56446
- void reconcileQueuedAttachments(
56447
- attachmentStore,
56448
- scope.id,
56449
- event.taskId,
56450
- provider.queue
56451
- ).catch(onAttachmentReleaseError);
56559
+ void options.onTurnCompleted?.({
56560
+ eventStream,
56561
+ projectId: scope.id,
56562
+ provider,
56563
+ taskId: event.taskId
56564
+ }).catch(onAttachmentReleaseError);
56452
56565
  }
56453
56566
  if (event.type === "project.git_metadata_changed") {
56454
56567
  invalidateProjectGitBranchCache(event.payload.rootPath);
@@ -56544,8 +56657,8 @@ var ProjectRuntimeLifecycleLock = class {
56544
56657
  async run(projectId, operation) {
56545
56658
  const predecessor = this.#tails.get(projectId) ?? Promise.resolve();
56546
56659
  let release;
56547
- const tail = new Promise((resolve7) => {
56548
- release = resolve7;
56660
+ const tail = new Promise((resolve8) => {
56661
+ release = resolve8;
56549
56662
  });
56550
56663
  this.#tails.set(projectId, tail);
56551
56664
  await predecessor.catch(() => void 0);
@@ -56559,6 +56672,224 @@ var ProjectRuntimeLifecycleLock = class {
56559
56672
  }
56560
56673
  }
56561
56674
  };
56675
+ var TaskQueueBlockedError = class extends Error {
56676
+ constructor() {
56677
+ super("Task queue is blocked by an edited submission");
56678
+ this.name = "TaskQueueBlockedError";
56679
+ }
56680
+ };
56681
+ var TaskQueueItemNotFoundError = class extends Error {
56682
+ constructor() {
56683
+ super("Queued submission was not found");
56684
+ this.name = "TaskQueueItemNotFoundError";
56685
+ }
56686
+ };
56687
+ var PersistentTaskQueue = class {
56688
+ #attachmentStore;
56689
+ #locks = /* @__PURE__ */ new Map();
56690
+ #readTaskSettings;
56691
+ #repository;
56692
+ #resolveProviderInput;
56693
+ constructor(options) {
56694
+ this.#attachmentStore = options.attachmentStore;
56695
+ this.#readTaskSettings = options.readTaskSettings;
56696
+ this.#repository = options.repository;
56697
+ this.#resolveProviderInput = options.resolveProviderInput;
56698
+ }
56699
+ async add(runtime, input, clientUserMessageId) {
56700
+ const { attachmentIds } = await this.#resolveProviderInput(
56701
+ runtime.projectId,
56702
+ input,
56703
+ runtime.provider,
56704
+ runtime.taskId
56705
+ );
56706
+ const storedInput = { ...input, attachments: attachmentIds.map((id) => ({ id })) };
56707
+ const record = await this.#repository.addQueue({
56708
+ clientUserMessageId,
56709
+ id: randomUUID(),
56710
+ input: storedInput,
56711
+ projectId: runtime.projectId,
56712
+ status: "queued",
56713
+ taskId: runtime.taskId
56714
+ });
56715
+ await this.#attachmentStore.retainQueue(runtime.projectId, attachmentIds, record.id);
56716
+ this.#publishChanged(runtime);
56717
+ return this.#mapRecord(record);
56718
+ }
56719
+ async delete(runtime, queuedSubmissionId) {
56720
+ return this.#withTaskLock(runtime, async () => {
56721
+ const deleted = await this.#repository.deleteQueue(
56722
+ runtime.projectId,
56723
+ runtime.taskId,
56724
+ queuedSubmissionId
56725
+ );
56726
+ if (deleted) {
56727
+ await this.#attachmentStore.releaseQueue(runtime.projectId, queuedSubmissionId);
56728
+ this.#publishChanged(runtime);
56729
+ }
56730
+ return deleted;
56731
+ });
56732
+ }
56733
+ async list(runtime) {
56734
+ const records = await this.#repository.listQueue(runtime.projectId, runtime.taskId);
56735
+ return Promise.all(records.map((record) => this.#mapRecord(record)));
56736
+ }
56737
+ async reorder(runtime, queuedSubmissionIds) {
56738
+ await this.#withTaskLock(runtime, async () => {
56739
+ await this.#repository.reorderQueue(runtime.projectId, runtime.taskId, queuedSubmissionIds);
56740
+ this.#publishChanged(runtime);
56741
+ });
56742
+ }
56743
+ async start(runtime, queuedSubmissionId) {
56744
+ const turn = await this.#withTaskLock(
56745
+ runtime,
56746
+ () => this.#startUnlocked(runtime, queuedSubmissionId)
56747
+ );
56748
+ if (turn === void 0) {
56749
+ throw new TaskQueueItemNotFoundError();
56750
+ }
56751
+ return turn;
56752
+ }
56753
+ async startNext(runtime) {
56754
+ await this.#withTaskLock(runtime, async () => {
56755
+ const [first2] = await this.#repository.listQueue(runtime.projectId, runtime.taskId);
56756
+ if (first2?.status !== "queued") return;
56757
+ await this.#startUnlocked(runtime, first2.id);
56758
+ });
56759
+ }
56760
+ async update(runtime, queuedSubmissionId, input, status2) {
56761
+ return this.#withTaskLock(runtime, async () => {
56762
+ const { attachmentIds } = await this.#resolveProviderInput(
56763
+ runtime.projectId,
56764
+ input,
56765
+ runtime.provider,
56766
+ runtime.taskId
56767
+ );
56768
+ const storedInput = { ...input, attachments: attachmentIds.map((id) => ({ id })) };
56769
+ const record = await this.#repository.updateQueue(
56770
+ runtime.projectId,
56771
+ runtime.taskId,
56772
+ queuedSubmissionId,
56773
+ storedInput,
56774
+ status2
56775
+ );
56776
+ if (record === void 0) throw new TaskQueueItemNotFoundError();
56777
+ await this.#attachmentStore.retainQueue(
56778
+ runtime.projectId,
56779
+ attachmentIds,
56780
+ queuedSubmissionId,
56781
+ true
56782
+ );
56783
+ this.#publishChanged(runtime);
56784
+ return this.#mapRecord(record);
56785
+ });
56786
+ }
56787
+ async #mapRecord(record) {
56788
+ const attachments = await Promise.all(
56789
+ record.input.attachments.map(
56790
+ async ({ id }) => (await this.#attachmentStore.read(record.projectId, id)).attachment
56791
+ )
56792
+ );
56793
+ return {
56794
+ attachments,
56795
+ clientUserMessageId: record.clientUserMessageId,
56796
+ id: record.id,
56797
+ skills: record.input.skills,
56798
+ status: record.status,
56799
+ text: record.input.text
56800
+ };
56801
+ }
56802
+ #publishChanged(runtime) {
56803
+ runtime.eventStream.publish({ payload: {}, taskId: runtime.taskId, type: "queue.changed" });
56804
+ }
56805
+ async #startUnlocked(runtime, queuedSubmissionId) {
56806
+ const records = await this.#repository.listQueue(runtime.projectId, runtime.taskId);
56807
+ const selectedIndex = queuedSubmissionId === void 0 ? 0 : records.findIndex((record) => record.id === queuedSubmissionId);
56808
+ if (selectedIndex < 0) return void 0;
56809
+ const editingIndex = records.findIndex((record) => record.status === "editing");
56810
+ if (editingIndex >= 0 && selectedIndex >= editingIndex) throw new TaskQueueBlockedError();
56811
+ const selected = records[selectedIndex];
56812
+ if (selected?.status !== "queued") throw new TaskQueueBlockedError();
56813
+ const task = await runtime.provider.readTask(runtime.taskId);
56814
+ if (task?.turns.some((turn2) => turn2.status === "running") === true) {
56815
+ throw new TaskQueueBlockedError();
56816
+ }
56817
+ const { providerInput } = await this.#resolveProviderInput(
56818
+ runtime.projectId,
56819
+ selected.input,
56820
+ runtime.provider,
56821
+ runtime.taskId
56822
+ );
56823
+ const settings = await this.#readTaskSettings(runtime.projectId, runtime.taskId);
56824
+ const turn = await runtime.provider.startTurn(runtime.taskId, providerInput, settings);
56825
+ await this.#repository.deleteQueue(runtime.projectId, runtime.taskId, selected.id);
56826
+ await this.#attachmentStore.startQueue(runtime.projectId, selected.id, turn.id);
56827
+ this.#publishChanged(runtime);
56828
+ return turn;
56829
+ }
56830
+ async #withTaskLock(runtime, action) {
56831
+ const key = `${runtime.projectId}\0${runtime.taskId}`;
56832
+ const previous = this.#locks.get(key) ?? Promise.resolve();
56833
+ let release;
56834
+ const current = new Promise((resolve8) => {
56835
+ release = resolve8;
56836
+ });
56837
+ const tail = previous.then(() => current);
56838
+ this.#locks.set(key, tail);
56839
+ await previous;
56840
+ try {
56841
+ return await action();
56842
+ } finally {
56843
+ release();
56844
+ if (this.#locks.get(key) === tail) this.#locks.delete(key);
56845
+ }
56846
+ }
56847
+ };
56848
+
56849
+ // packages/server/src/memory-task-queue-repository.ts
56850
+ function createMemoryTaskQueueRepository() {
56851
+ const records = /* @__PURE__ */ new Map();
56852
+ const key = (projectId, taskId) => `${projectId}\0${taskId}`;
56853
+ return {
56854
+ addQueue(record) {
56855
+ const queue = records.get(key(record.projectId, record.taskId)) ?? [];
56856
+ queue.push(record);
56857
+ records.set(key(record.projectId, record.taskId), queue);
56858
+ return Promise.resolve(record);
56859
+ },
56860
+ deleteQueue(projectId, taskId, queuedSubmissionId) {
56861
+ const queue = records.get(key(projectId, taskId)) ?? [];
56862
+ const index = queue.findIndex((record) => record.id === queuedSubmissionId);
56863
+ if (index < 0) return Promise.resolve(false);
56864
+ queue.splice(index, 1);
56865
+ return Promise.resolve(true);
56866
+ },
56867
+ listQueue(projectId, taskId) {
56868
+ return Promise.resolve([...records.get(key(projectId, taskId)) ?? []]);
56869
+ },
56870
+ reorderQueue(projectId, taskId, queuedSubmissionIds) {
56871
+ const queue = records.get(key(projectId, taskId)) ?? [];
56872
+ const byId = new Map(queue.map((record) => [record.id, record]));
56873
+ if (queuedSubmissionIds.length !== queue.length || new Set(queuedSubmissionIds).size !== queue.length || queuedSubmissionIds.some((id) => !byId.has(id))) {
56874
+ throw new Error("Task queue order must contain every queued submission exactly once");
56875
+ }
56876
+ records.set(
56877
+ key(projectId, taskId),
56878
+ queuedSubmissionIds.map((id) => byId.get(id))
56879
+ );
56880
+ return Promise.resolve();
56881
+ },
56882
+ updateQueue(projectId, taskId, queuedSubmissionId, input, status2) {
56883
+ const queue = records.get(key(projectId, taskId)) ?? [];
56884
+ const index = queue.findIndex((record) => record.id === queuedSubmissionId);
56885
+ const current = queue[index];
56886
+ if (current === void 0) return Promise.resolve(void 0);
56887
+ const updated = { ...current, input, status: status2 };
56888
+ queue[index] = updated;
56889
+ return Promise.resolve(updated);
56890
+ }
56891
+ };
56892
+ }
56562
56893
  var ProjectDirectoryBrowserError = class extends Error {
56563
56894
  constructor(message, reason, options) {
56564
56895
  super(message, options);
@@ -57060,6 +57391,106 @@ async function filterProjectFileSearchMatches(projectRoot, page) {
57060
57391
  return { data };
57061
57392
  }
57062
57393
 
57394
+ // packages/server/src/routes/project-file-mutation-routes.ts
57395
+ function mapProjectFileMutationError(error) {
57396
+ if (error instanceof ProjectRootScopeError) {
57397
+ throw new MutationHttpError(
57398
+ error.code === "PROJECT_NOT_FOUND" ? "PROJECT_NOT_FOUND" : "INVALID_REQUEST",
57399
+ error.message,
57400
+ error.code === "PROJECT_NOT_FOUND" ? 404 : 400
57401
+ );
57402
+ }
57403
+ const errorCode = error.code;
57404
+ if (errorCode === "ENOENT") {
57405
+ throw new MutationHttpError("PROJECT_FILE_NOT_FOUND", "Project file was not found", 404);
57406
+ }
57407
+ if (error instanceof TypeError) {
57408
+ const conflict = error.message.includes("already exists");
57409
+ throw new MutationHttpError(
57410
+ conflict ? "PROJECT_FILE_CONFLICT" : "INVALID_REQUEST",
57411
+ conflict ? "A file or directory with that name already exists" : "Project file request is invalid",
57412
+ conflict ? 409 : 400
57413
+ );
57414
+ }
57415
+ throw new MutationHttpError("PROJECT_FILE_MUTATION_FAILED", "Project file mutation failed", 500);
57416
+ }
57417
+ var mutationResponses = {
57418
+ 400: AgentMutationErrorSchema,
57419
+ 404: AgentMutationErrorSchema,
57420
+ 409: AgentMutationErrorSchema,
57421
+ 500: AgentMutationErrorSchema,
57422
+ 503: AgentMutationErrorSchema
57423
+ };
57424
+ function registerProjectFileMutationRoutes(app, context, resolveProjectFileRoot2) {
57425
+ const { deleteProjectFile: deleteProjectFile2, renameProjectFile: renameProjectFile2, runIdempotent } = context;
57426
+ app.post(
57427
+ "/v1/projects/:projectId/files/rename",
57428
+ {
57429
+ schema: {
57430
+ body: RenameProjectFileRequestSchema,
57431
+ headers: IdempotencyHeadersSchema,
57432
+ params: ProjectParamsSchema,
57433
+ querystring: ProjectRootQuerySchema,
57434
+ response: { 200: RenameProjectFileResponseSchema, ...mutationResponses }
57435
+ }
57436
+ },
57437
+ async (request) => runIdempotent(
57438
+ [
57439
+ "rename-project-file",
57440
+ request.params.projectId,
57441
+ request.query.rootPath,
57442
+ request.body.path
57443
+ ],
57444
+ request.headers["idempotency-key"],
57445
+ request.body,
57446
+ async () => {
57447
+ try {
57448
+ const root = await resolveProjectFileRoot2(
57449
+ request.params.projectId,
57450
+ request.query.rootPath
57451
+ );
57452
+ return await renameProjectFile2(root.path, request.body.path, request.body.name);
57453
+ } catch (error) {
57454
+ mapProjectFileMutationError(error);
57455
+ }
57456
+ }
57457
+ )
57458
+ );
57459
+ app.post(
57460
+ "/v1/projects/:projectId/files/delete",
57461
+ {
57462
+ schema: {
57463
+ body: DeleteProjectFileRequestSchema,
57464
+ headers: IdempotencyHeadersSchema,
57465
+ params: ProjectParamsSchema,
57466
+ querystring: ProjectRootQuerySchema,
57467
+ response: { 200: DeleteProjectFileResponseSchema, ...mutationResponses }
57468
+ }
57469
+ },
57470
+ async (request) => runIdempotent(
57471
+ [
57472
+ "delete-project-file",
57473
+ request.params.projectId,
57474
+ request.query.rootPath,
57475
+ request.body.path
57476
+ ],
57477
+ request.headers["idempotency-key"],
57478
+ request.body,
57479
+ async () => {
57480
+ try {
57481
+ const root = await resolveProjectFileRoot2(
57482
+ request.params.projectId,
57483
+ request.query.rootPath
57484
+ );
57485
+ return await deleteProjectFile2(root.path, request.body.path);
57486
+ } catch (error) {
57487
+ mapProjectFileMutationError(error);
57488
+ }
57489
+ }
57490
+ )
57491
+ );
57492
+ }
57493
+
57063
57494
  // packages/server/src/routes/project-file-routes.ts
57064
57495
  async function resolveReadRoot(repository, getProjectContext, projectId, rootPath, reply) {
57065
57496
  try {
@@ -57101,6 +57532,11 @@ function registerProjectFileRoutes(app, context) {
57101
57532
  resolveHostAttachment: resolveHostAttachment2,
57102
57533
  stopProjectFileSearch
57103
57534
  } = context;
57535
+ registerProjectFileMutationRoutes(
57536
+ app,
57537
+ context,
57538
+ (projectId, rootPath) => resolveProjectFileRoot(projectRepository, getProjectContext, projectId, rootPath)
57539
+ );
57104
57540
  app.get(
57105
57541
  "/v1/projects/:projectId/files/tree",
57106
57542
  {
@@ -58437,7 +58873,7 @@ var registerProjectRoutes = (app, context, done) => {
58437
58873
  };
58438
58874
 
58439
58875
  // packages/server/src/routes/provider-connection-routes.ts
58440
- var mutationResponses = {
58876
+ var mutationResponses2 = {
58441
58877
  400: AgentMutationErrorSchema,
58442
58878
  409: AgentMutationErrorSchema,
58443
58879
  502: AgentMutationErrorSchema,
@@ -58456,7 +58892,7 @@ var registerProviderConnectionRoutes = (app, context, done) => {
58456
58892
  schema: {
58457
58893
  body: StartOfficialProviderLoginRequestSchema,
58458
58894
  headers: IdempotencyHeadersSchema,
58459
- response: { 200: StartOfficialProviderLoginResponseSchema, ...mutationResponses }
58895
+ response: { 200: StartOfficialProviderLoginResponseSchema, ...mutationResponses2 }
58460
58896
  }
58461
58897
  },
58462
58898
  (request) => runIdempotent(
@@ -58482,7 +58918,7 @@ var registerProviderConnectionRoutes = (app, context, done) => {
58482
58918
  schema: {
58483
58919
  body: CancelProviderLoginRequestSchema,
58484
58920
  headers: IdempotencyHeadersSchema,
58485
- response: { 200: AgentProviderConnectionMutationResponseSchema, ...mutationResponses }
58921
+ response: { 200: AgentProviderConnectionMutationResponseSchema, ...mutationResponses2 }
58486
58922
  }
58487
58923
  },
58488
58924
  (request) => runIdempotent(
@@ -58498,7 +58934,7 @@ var registerProviderConnectionRoutes = (app, context, done) => {
58498
58934
  schema: {
58499
58935
  body: ConfigureCustomProviderRequestSchema,
58500
58936
  headers: IdempotencyHeadersSchema,
58501
- response: { 200: ConfigureCustomProviderResponseSchema, ...mutationResponses }
58937
+ response: { 200: ConfigureCustomProviderResponseSchema, ...mutationResponses2 }
58502
58938
  }
58503
58939
  },
58504
58940
  (request) => runIdempotent(
@@ -58524,7 +58960,7 @@ var registerProviderConnectionRoutes = (app, context, done) => {
58524
58960
  schema: {
58525
58961
  body: StartOfficialProviderLoginRequestSchema,
58526
58962
  headers: IdempotencyHeadersSchema,
58527
- response: { 200: AgentProviderConnectionMutationResponseSchema, ...mutationResponses }
58963
+ response: { 200: AgentProviderConnectionMutationResponseSchema, ...mutationResponses2 }
58528
58964
  }
58529
58965
  },
58530
58966
  (request) => runIdempotent(
@@ -58536,6 +58972,101 @@ var registerProviderConnectionRoutes = (app, context, done) => {
58536
58972
  );
58537
58973
  done();
58538
58974
  };
58975
+ var PetAssetParamsSchema = {
58976
+ additionalProperties: false,
58977
+ properties: { assetId: { pattern: "^[a-f0-9]{64}$", type: "string" } },
58978
+ required: ["assetId"],
58979
+ type: "object"
58980
+ };
58981
+ var registerPetRoutes = (app, { petProvider, runIdempotent }, done) => {
58982
+ app.get(
58983
+ "/v1/pets",
58984
+ {
58985
+ schema: {
58986
+ response: { 200: WorkbenchPetCatalogResponseSchema, 500: ErrorResponseSchema }
58987
+ }
58988
+ },
58989
+ async (_request, reply) => {
58990
+ try {
58991
+ return { data: await petProvider.listPets() };
58992
+ } catch {
58993
+ return reply.code(500).send({ code: "PET_CATALOG_UNAVAILABLE", message: "Pet catalog is unavailable" });
58994
+ }
58995
+ }
58996
+ );
58997
+ app.get(
58998
+ "/v1/pets/assets/:assetId",
58999
+ {
59000
+ schema: {
59001
+ params: PetAssetParamsSchema,
59002
+ response: {
59003
+ 404: ErrorResponseSchema,
59004
+ 422: ErrorResponseSchema,
59005
+ 500: ErrorResponseSchema
59006
+ }
59007
+ }
59008
+ },
59009
+ async (request, reply) => {
59010
+ try {
59011
+ const asset = await petProvider.openPetAsset(request.params.assetId);
59012
+ if (asset === void 0) {
59013
+ return await reply.code(404).send({ code: "PET_NOT_FOUND", message: "Pet asset not found" });
59014
+ }
59015
+ reply.header("Cache-Control", "private, no-cache").header("Cross-Origin-Resource-Policy", "same-origin").header("ETag", asset.etag).header("X-Content-Type-Options", "nosniff");
59016
+ if (request.headers["if-none-match"] === asset.etag) return await reply.code(304).send();
59017
+ return await reply.type(asset.contentType).send(Buffer$1.from(asset.content));
59018
+ } catch (error) {
59019
+ if (error instanceof WorkbenchPetProviderError && error.code === "invalid") {
59020
+ return await reply.code(422).send({ code: "PET_ASSET_INVALID", message: "Pet asset is invalid" });
59021
+ }
59022
+ return await reply.code(500).send({ code: "PET_ASSET_UNAVAILABLE", message: "Pet asset is unavailable" });
59023
+ }
59024
+ }
59025
+ );
59026
+ app.post(
59027
+ "/v1/pets/downloads",
59028
+ {
59029
+ schema: {
59030
+ body: WorkbenchPetDownloadRequestSchema,
59031
+ headers: IdempotencyHeadersSchema,
59032
+ response: {
59033
+ 200: WorkbenchPetDownloadResponseSchema,
59034
+ 400: AgentMutationErrorSchema,
59035
+ 404: AgentMutationErrorSchema,
59036
+ 409: AgentMutationErrorSchema,
59037
+ 502: AgentMutationErrorSchema,
59038
+ 503: AgentMutationErrorSchema
59039
+ }
59040
+ }
59041
+ },
59042
+ async (request) => runIdempotent(
59043
+ ["download-workbench-pet", request.body.petId],
59044
+ request.headers["idempotency-key"],
59045
+ request.body,
59046
+ async () => {
59047
+ try {
59048
+ return { data: await petProvider.ensurePetAsset(request.body.petId) };
59049
+ } catch (error) {
59050
+ if (error instanceof WorkbenchPetProviderError) {
59051
+ if (error.code === "not_found") {
59052
+ throw new MutationHttpError("PET_NOT_FOUND", "Pet not found", 404);
59053
+ }
59054
+ if (error.code === "invalid") {
59055
+ throw new MutationHttpError("PET_ASSET_INVALID", "Pet cannot be downloaded", 400);
59056
+ }
59057
+ }
59058
+ throw new MutationHttpError(
59059
+ "PET_DOWNLOAD_FAILED",
59060
+ "Pet asset download failed",
59061
+ 502,
59062
+ true
59063
+ );
59064
+ }
59065
+ }
59066
+ )
59067
+ );
59068
+ done();
59069
+ };
58539
59070
 
58540
59071
  // packages/server/src/bing-wallpaper.ts
58541
59072
  var BING_ORIGIN = "https://www.bing.com";
@@ -59683,7 +60214,7 @@ var registerTurnRoutes = (app, context, done) => {
59683
60214
  }
59684
60215
  },
59685
60216
  async (request, reply) => {
59686
- const turn = await runIdempotent(
60217
+ const started = await runIdempotent(
59687
60218
  ["start-turn", request.params.projectId, request.params.taskId],
59688
60219
  request.headers["idempotency-key"],
59689
60220
  request.body,
@@ -59709,7 +60240,8 @@ var registerTurnRoutes = (app, context, done) => {
59709
60240
  request.params.taskId,
59710
60241
  turnOptions
59711
60242
  );
59712
- const turn2 = await context2.provider.startTurn(
60243
+ const checkpoint = context2.eventStream.checkpoint;
60244
+ const turn = await context2.provider.startTurn(
59713
60245
  request.params.taskId,
59714
60246
  providerInput,
59715
60247
  turnOptions
@@ -59717,12 +60249,16 @@ var registerTurnRoutes = (app, context, done) => {
59717
60249
  await attachmentStore.consume(
59718
60250
  request.params.projectId,
59719
60251
  attachmentIds,
59720
- turn2.status === "running" ? turn2.id : void 0
60252
+ turn.status === "running" ? turn.id : void 0
59721
60253
  );
59722
- return turn2;
60254
+ return { checkpoint, turn };
59723
60255
  }
59724
60256
  );
59725
- return reply.code(201).send({ taskId: request.params.taskId, turn });
60257
+ return reply.code(201).send({
60258
+ checkpoint: started.checkpoint,
60259
+ taskId: request.params.taskId,
60260
+ turn: started.turn
60261
+ });
59726
60262
  }
59727
60263
  );
59728
60264
  app.post(
@@ -59907,8 +60443,17 @@ var registerTurnRoutes = (app, context, done) => {
59907
60443
  };
59908
60444
 
59909
60445
  // packages/server/src/routes/queue-routes.ts
60446
+ function toQueueHttpError(error) {
60447
+ if (error instanceof TaskQueueBlockedError) {
60448
+ throw new MutationHttpError("TURN_NOT_RUNNING", error.message, 409);
60449
+ }
60450
+ if (error instanceof TaskQueueItemNotFoundError) {
60451
+ throw new MutationHttpError("TASK_NOT_FOUND", error.message, 404);
60452
+ }
60453
+ throw error;
60454
+ }
59910
60455
  var registerQueueRoutes = (app, context, done) => {
59911
- const { attachmentStore, getProjectContext, resolveProviderTurnInput, runIdempotent } = context;
60456
+ const { getProjectContext, runIdempotent, taskQueue } = context;
59912
60457
  const readQueue = async (params) => {
59913
60458
  const projectContext = await getProjectContext(params.projectId);
59914
60459
  if (projectContext === void 0) {
@@ -59918,10 +60463,12 @@ var registerQueueRoutes = (app, context, done) => {
59918
60463
  if (task?.projectId !== projectContext.scope.id) {
59919
60464
  throw new MutationHttpError("TASK_NOT_FOUND", "Task not found", 404);
59920
60465
  }
59921
- if (projectContext.provider.queue === void 0) {
59922
- throw new MutationHttpError("PROVIDER_ERROR", "Task queue is unavailable", 503);
59923
- }
59924
- return { provider: projectContext.provider, queue: projectContext.provider.queue };
60466
+ return {
60467
+ eventStream: projectContext.eventStream,
60468
+ projectId: params.projectId,
60469
+ provider: projectContext.provider,
60470
+ taskId: params.taskId
60471
+ };
59925
60472
  };
59926
60473
  app.get(
59927
60474
  "/v1/projects/:projectId/tasks/:taskId/queue",
@@ -59933,11 +60480,15 @@ var registerQueueRoutes = (app, context, done) => {
59933
60480
  }
59934
60481
  },
59935
60482
  async (request) => {
59936
- const { queue } = await readQueue(request.params);
59937
- return queue.list(request.params.taskId, {
59938
- ...request.query.cursor === void 0 ? {} : { cursor: request.query.cursor },
59939
- ...request.query.limit === void 0 ? {} : { limit: request.query.limit }
59940
- });
60483
+ const runtime = await readQueue(request.params);
60484
+ const data = await taskQueue.list(runtime);
60485
+ const offset = Number(request.query.cursor ?? "0");
60486
+ const limit = request.query.limit ?? 100;
60487
+ const nextOffset = offset + limit;
60488
+ return {
60489
+ data: data.slice(offset, nextOffset),
60490
+ nextCursor: nextOffset < data.length ? String(nextOffset) : null
60491
+ };
59941
60492
  }
59942
60493
  );
59943
60494
  app.post(
@@ -59956,24 +60507,8 @@ var registerQueueRoutes = (app, context, done) => {
59956
60507
  request.headers["idempotency-key"],
59957
60508
  request.body,
59958
60509
  async () => {
59959
- const { provider, queue } = await readQueue(request.params);
59960
- const { attachmentIds, providerInput } = await resolveProviderTurnInput(
59961
- request.params.projectId,
59962
- request.body.input,
59963
- provider,
59964
- request.params.taskId
59965
- );
59966
- const queuedSubmission2 = await queue.add(
59967
- request.params.taskId,
59968
- providerInput,
59969
- request.body.clientUserMessageId
59970
- );
59971
- await attachmentStore.retainQueue(
59972
- request.params.projectId,
59973
- attachmentIds,
59974
- queuedSubmission2.id
59975
- );
59976
- return queuedSubmission2;
60510
+ const runtime = await readQueue(request.params);
60511
+ return taskQueue.add(runtime, request.body.input, request.body.clientUserMessageId);
59977
60512
  }
59978
60513
  );
59979
60514
  return reply.code(201).send({ queuedSubmission });
@@ -59995,28 +60530,13 @@ var registerQueueRoutes = (app, context, done) => {
59995
60530
  request.headers["idempotency-key"],
59996
60531
  { ...request.body, queuedSubmissionId: request.params.queuedSubmissionId },
59997
60532
  async () => {
59998
- const { provider, queue } = await readQueue(request.params);
59999
- const { attachmentIds, providerInput } = await resolveProviderTurnInput(
60000
- request.params.projectId,
60001
- request.body.input,
60002
- provider,
60003
- request.params.taskId
60004
- );
60005
- const queuedSubmission2 = await queue.update(
60006
- request.params.taskId,
60533
+ const runtime = await readQueue(request.params);
60534
+ return taskQueue.update(
60535
+ runtime,
60007
60536
  request.params.queuedSubmissionId,
60008
- providerInput
60009
- );
60010
- await attachmentStore.releaseQueue(
60011
- request.params.projectId,
60012
- request.params.queuedSubmissionId
60013
- );
60014
- await attachmentStore.retainQueue(
60015
- request.params.projectId,
60016
- attachmentIds,
60017
- queuedSubmission2.id
60537
+ request.body.input,
60538
+ request.body.status
60018
60539
  );
60019
- return queuedSubmission2;
60020
60540
  }
60021
60541
  );
60022
60542
  return { queuedSubmission };
@@ -60037,18 +60557,8 @@ var registerQueueRoutes = (app, context, done) => {
60037
60557
  request.headers["idempotency-key"],
60038
60558
  { queuedSubmissionId: request.params.queuedSubmissionId },
60039
60559
  async () => {
60040
- const { queue } = await readQueue(request.params);
60041
- const deleted2 = await queue.delete(
60042
- request.params.taskId,
60043
- request.params.queuedSubmissionId
60044
- );
60045
- if (deleted2) {
60046
- await attachmentStore.releaseQueue(
60047
- request.params.projectId,
60048
- request.params.queuedSubmissionId
60049
- );
60050
- }
60051
- return deleted2;
60560
+ const runtime = await readQueue(request.params);
60561
+ return taskQueue.delete(runtime, request.params.queuedSubmissionId);
60052
60562
  }
60053
60563
  );
60054
60564
  return { deleted };
@@ -60070,8 +60580,8 @@ var registerQueueRoutes = (app, context, done) => {
60070
60580
  request.headers["idempotency-key"],
60071
60581
  request.body,
60072
60582
  async () => {
60073
- const { queue } = await readQueue(request.params);
60074
- await queue.reorder(request.params.taskId, request.body.queuedSubmissionIds);
60583
+ const runtime = await readQueue(request.params);
60584
+ await taskQueue.reorder(runtime, request.body.queuedSubmissionIds);
60075
60585
  return { status: "reordered" };
60076
60586
  }
60077
60587
  );
@@ -60094,13 +60604,12 @@ var registerQueueRoutes = (app, context, done) => {
60094
60604
  request.headers["idempotency-key"],
60095
60605
  request.body,
60096
60606
  async () => {
60097
- const { queue } = await readQueue(request.params);
60098
- const queuedSubmissionId = request.body.queuedSubmissionId ?? (await queue.list(request.params.taskId)).data[0]?.id;
60099
- const turn2 = await queue.start(request.params.taskId, queuedSubmissionId);
60100
- if (queuedSubmissionId !== void 0) {
60101
- await attachmentStore.startQueue(request.params.projectId, queuedSubmissionId, turn2.id);
60607
+ const runtime = await readQueue(request.params);
60608
+ try {
60609
+ return await taskQueue.start(runtime, request.body.queuedSubmissionId);
60610
+ } catch (error) {
60611
+ toQueueHttpError(error);
60102
60612
  }
60103
- return turn2;
60104
60613
  }
60105
60614
  );
60106
60615
  return reply.code(201).send({ taskId: request.params.taskId, turn });
@@ -60314,7 +60823,9 @@ async function configureServerDelivery(app, options) {
60314
60823
  "X-Content-Type-Options": "nosniff",
60315
60824
  "X-Frame-Options": "DENY"
60316
60825
  });
60317
- if (request.url.startsWith("/v1/")) {
60826
+ if (request.url.startsWith("/v1/pets/assets/")) {
60827
+ reply.header("Cache-Control", "private, no-cache");
60828
+ } else if (request.url.startsWith("/v1/")) {
60318
60829
  reply.header("Cache-Control", "no-store");
60319
60830
  }
60320
60831
  return payload;
@@ -60348,6 +60859,7 @@ async function configureServerDelivery(app, options) {
60348
60859
  retryable: false
60349
60860
  });
60350
60861
  }
60862
+ request.log.error({ err: error }, "Unhandled request error");
60351
60863
  return reply.code(explicitStatusCode).send({
60352
60864
  code: "INTERNAL_ERROR",
60353
60865
  message: "Internal server error",
@@ -60497,86 +61009,7 @@ async function createCodexlyServer(options) {
60497
61009
  const readSourceFile = options.readProjectSourceFile ?? readProjectSourceFile;
60498
61010
  const projectOpenService = options.projectOpenService ?? createProjectOpenService();
60499
61011
  const attachmentStore = new AttachmentStore();
60500
- const resolveProviderTurnInput = async (projectId, input, provider, taskId) => {
60501
- const requestedAttachmentIds = input.attachments.map((attachment) => attachment.id);
60502
- if (new Set(requestedAttachmentIds).size !== requestedAttachmentIds.length) {
60503
- throw new MutationHttpError("INVALID_REQUEST", "Duplicate attachments are not allowed", 400);
60504
- }
60505
- const attachmentIds = [];
60506
- const resolvedAttachments = [];
60507
- for (const requestedId of requestedAttachmentIds) {
60508
- try {
60509
- const [resolved2] = await attachmentStore.resolve(projectId, [requestedId]);
60510
- if (resolved2 !== void 0) {
60511
- attachmentIds.push(requestedId);
60512
- resolvedAttachments.push(resolved2);
60513
- continue;
60514
- }
60515
- } catch (error) {
60516
- if (!(error instanceof AttachmentNotFoundError)) {
60517
- throw error;
60518
- }
60519
- }
60520
- const historical = provider === void 0 || taskId === void 0 ? void 0 : await provider.readTaskAttachment(taskId, requestedId);
60521
- if (historical === void 0) {
60522
- throw new MutationHttpError(
60523
- "ATTACHMENT_NOT_FOUND",
60524
- "Attachment was not found or has expired",
60525
- 404
60526
- );
60527
- }
60528
- const cloned = await attachmentStore.add(projectId, {
60529
- content: Readable.from([historical.content]),
60530
- kind: historical.kind,
60531
- mediaType: historical.mediaType,
60532
- name: historical.name
60533
- });
60534
- const [resolved] = await attachmentStore.resolve(projectId, [cloned.attachment.id]);
60535
- if (resolved !== void 0) {
60536
- attachmentIds.push(cloned.attachment.id);
60537
- resolvedAttachments.push(resolved);
60538
- }
60539
- }
60540
- const imageBytes = resolvedAttachments.reduce(
60541
- (total, attachment) => total + (attachment.kind === "image" ? attachment.size : 0),
60542
- 0
60543
- );
60544
- const fileBytes = resolvedAttachments.reduce(
60545
- (total, attachment) => total + (attachment.kind === "image" ? 0 : attachment.size),
60546
- 0
60547
- );
60548
- const imageCount = resolvedAttachments.filter(
60549
- (attachment) => attachment.kind === "image"
60550
- ).length;
60551
- if (imageCount > MAX_AGENT_IMAGES || imageBytes > MAX_AGENT_IMAGE_TOTAL_BYTES) {
60552
- throw new MutationHttpError("INVALID_REQUEST", "Image input limit exceeded", 400);
60553
- }
60554
- if (fileBytes > MAX_AGENT_FILE_TOTAL_BYTES) {
60555
- throw new MutationHttpError("INVALID_REQUEST", "File input limit exceeded", 400);
60556
- }
60557
- return {
60558
- attachmentIds,
60559
- providerInput: {
60560
- files: resolvedAttachments.flatMap(
60561
- (attachment) => attachment.kind === "file" ? [
60562
- {
60563
- mediaType: attachment.mediaType,
60564
- name: attachment.name,
60565
- path: attachment.path
60566
- }
60567
- ] : []
60568
- ),
60569
- images: resolvedAttachments.flatMap(
60570
- (attachment) => attachment.kind === "image" ? [{ mediaType: attachment.mediaType, url: attachment.url }] : []
60571
- ),
60572
- skills: input.skills,
60573
- text: input.text,
60574
- textAttachments: resolvedAttachments.flatMap(
60575
- (attachment) => attachment.kind === "text" ? [{ name: attachment.name, text: attachment.text }] : []
60576
- )
60577
- }
60578
- };
60579
- };
61012
+ const resolveProviderTurnInput = createProviderTurnInputResolver(attachmentStore);
60580
61013
  const capabilities = await options.provider.getCapabilities();
60581
61014
  const modelCatalogCacheMaxBytes = options.modelCatalogCacheMaxBytes ?? DEFAULT_MODEL_CATALOG_CACHE_MAX_BYTES;
60582
61015
  const modelCatalogCacheTtlMs = options.modelCatalogCacheTtlMs ?? DEFAULT_MODEL_CATALOG_CACHE_TTL_MS;
@@ -60623,6 +61056,7 @@ async function createCodexlyServer(options) {
60623
61056
  onAttachmentReleaseError: (error) => {
60624
61057
  app.log.warn({ error }, "Failed to release turn attachments");
60625
61058
  },
61059
+ onTurnCompleted: (runtime) => taskQueue.startNext(runtime),
60626
61060
  provider: resolved.provider,
60627
61061
  scope: resolved.scope
60628
61062
  });
@@ -60683,6 +61117,7 @@ async function createCodexlyServer(options) {
60683
61117
  defaultOpenAppId: stored?.defaultOpenAppId ?? null,
60684
61118
  fastMode: stored?.fastMode ?? false,
60685
61119
  followUpBehavior: stored?.followUpBehavior ?? "queue",
61120
+ pet: stored?.pet ?? { enabled: false, selectedPetId: null },
60686
61121
  ...effectiveModel
60687
61122
  };
60688
61123
  };
@@ -60725,6 +61160,12 @@ async function createCodexlyServer(options) {
60725
61160
  };
60726
61161
  return effective;
60727
61162
  };
61163
+ const taskQueue = new PersistentTaskQueue({
61164
+ attachmentStore,
61165
+ readTaskSettings: readEffectiveTaskSettings,
61166
+ repository: options.queueRepository ?? createMemoryTaskQueueRepository(),
61167
+ resolveProviderInput: resolveProviderTurnInput
61168
+ });
60728
61169
  const activeGitMutations = /* @__PURE__ */ new Set();
60729
61170
  const taskStartRecoveries = /* @__PURE__ */ new Map();
60730
61171
  const idempotencyCacheSize = options.idempotencyCacheSize ?? DEFAULT_IDEMPOTENCY_CACHE_SIZE;
@@ -60770,12 +61211,15 @@ async function createCodexlyServer(options) {
60770
61211
  projectOpenService,
60771
61212
  projectRepository: options.projectRepository,
60772
61213
  provider: options.provider,
61214
+ petProvider: options.petProvider,
60773
61215
  providerConnectionRepository: options.providerConnectionRepository,
60774
61216
  readAppInfo: options.readAppInfo,
60775
61217
  readEffectiveGlobalSettings,
60776
61218
  readEffectiveProjectDefaults,
60777
61219
  readEffectiveTaskSettings,
60778
61220
  readFileTree,
61221
+ deleteProjectFile: options.deleteProjectFile ?? deleteProjectFile,
61222
+ renameProjectFile: options.renameProjectFile ?? renameProjectFile,
60779
61223
  searchProjectFiles,
60780
61224
  stopProjectFileSearch,
60781
61225
  readHostFileDirectory: options.readHostFileDirectory ?? readHostFileDirectory,
@@ -60795,6 +61239,7 @@ async function createCodexlyServer(options) {
60795
61239
  resolveHostAttachment: options.resolveHostAttachment ?? resolveHostAttachment,
60796
61240
  settingsRepository: options.settingsRepository,
60797
61241
  taskFromSnapshot,
61242
+ taskQueue,
60798
61243
  taskStartRecoveries,
60799
61244
  switchProjectBranch: options.switchProjectBranch ?? switchProjectBranch,
60800
61245
  resolveProjectWorktree: options.resolveProjectWorktree ?? resolveProjectWorktree,
@@ -60807,6 +61252,7 @@ async function createCodexlyServer(options) {
60807
61252
  });
60808
61253
  await app.register(registerRuntimeRoutes, routeContext);
60809
61254
  await app.register(registerProviderConnectionRoutes, routeContext);
61255
+ await app.register(registerPetRoutes, routeContext);
60810
61256
  await app.register(registerProjectRoutes, routeContext);
60811
61257
  await app.register(registerTaskRoutes, routeContext);
60812
61258
  await app.register(registerTurnRoutes, routeContext);
@@ -60905,6 +61351,16 @@ var GLOBAL_SETTINGS_MIGRATIONS = [
60905
61351
  FAST_MODE_SETTING_MIGRATION,
60906
61352
  PRESERVE_LEGACY_GLOBAL_SETTINGS_COLUMNS_MIGRATION
60907
61353
  ];
61354
+ var WORKBENCH_PET_SETTINGS_MIGRATION = {
61355
+ name: "add_workbench_pet_settings",
61356
+ sql: `
61357
+ ALTER TABLE global_settings
61358
+ ADD COLUMN pet_enabled INTEGER NOT NULL DEFAULT 0
61359
+ CHECK (pet_enabled IN (0, 1));
61360
+ ALTER TABLE global_settings ADD COLUMN pet_id TEXT;
61361
+ `,
61362
+ version: 23
61363
+ };
60908
61364
 
60909
61365
  // packages/server/src/sqlite-state-migrations.ts
60910
61366
  var SQLITE_MIGRATIONS = [
@@ -61275,10 +61731,37 @@ var SQLITE_MIGRATIONS = [
61275
61731
  CHECK (fast_mode IN (0, 1));
61276
61732
  `,
61277
61733
  version: 21
61278
- }
61734
+ },
61735
+ {
61736
+ name: "persist_task_queue",
61737
+ sql: `
61738
+ CREATE TABLE task_queue (
61739
+ project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
61740
+ task_id TEXT NOT NULL,
61741
+ id TEXT NOT NULL,
61742
+ client_user_message_id TEXT NOT NULL,
61743
+ input_json TEXT NOT NULL,
61744
+ status TEXT NOT NULL CHECK (status IN ('editing', 'queued')),
61745
+ position INTEGER NOT NULL,
61746
+ updated_at TEXT NOT NULL,
61747
+ PRIMARY KEY (project_id, task_id, id),
61748
+ UNIQUE (project_id, task_id, position)
61749
+ ) STRICT;
61750
+ `,
61751
+ version: 22
61752
+ },
61753
+ WORKBENCH_PET_SETTINGS_MIGRATION
61279
61754
  ];
61280
61755
 
61281
61756
  // packages/server/src/sqlite-state-repository.ts
61757
+ function parseQueueWorkerRecord(record) {
61758
+ const input = JSON.parse(record.inputJson);
61759
+ if (!value_exports.Check(AgentPromptInputSchema, input)) {
61760
+ throw new Error("Persisted task queue input is invalid");
61761
+ }
61762
+ const { inputJson: _inputJson, ...identity } = record;
61763
+ return { ...identity, input };
61764
+ }
61282
61765
  var DEFAULT_SQLITE_REQUEST_TIMEOUT_MS = 1e4;
61283
61766
  var SqliteStateRepository = class _SqliteStateRepository {
61284
61767
  #now;
@@ -61434,6 +61917,40 @@ var SqliteStateRepository = class _SqliteStateRepository {
61434
61917
  setProjectOrder(projectIds) {
61435
61918
  return this.#call("setProjectOrder", { projectIds });
61436
61919
  }
61920
+ async addQueue(record) {
61921
+ const { input, ...metadata } = record;
61922
+ return parseQueueWorkerRecord(
61923
+ await this.#call("addTaskQueueRecord", {
61924
+ ...metadata,
61925
+ inputJson: JSON.stringify(input),
61926
+ updatedAt: this.#now().toISOString()
61927
+ })
61928
+ );
61929
+ }
61930
+ deleteQueue(projectId, taskId, queuedSubmissionId) {
61931
+ return this.#call("deleteTaskQueueRecord", { projectId, queuedSubmissionId, taskId });
61932
+ }
61933
+ async listQueue(projectId, taskId) {
61934
+ const records = await this.#call("listTaskQueueRecords", {
61935
+ projectId,
61936
+ taskId
61937
+ });
61938
+ return records.map(parseQueueWorkerRecord);
61939
+ }
61940
+ reorderQueue(projectId, taskId, queuedSubmissionIds) {
61941
+ return this.#call("reorderTaskQueueRecords", { projectId, queuedSubmissionIds, taskId });
61942
+ }
61943
+ async updateQueue(projectId, taskId, queuedSubmissionId, input, status2) {
61944
+ const record = await this.#call("updateTaskQueueRecord", {
61945
+ inputJson: JSON.stringify(input),
61946
+ projectId,
61947
+ queuedSubmissionId,
61948
+ status: status2,
61949
+ taskId,
61950
+ updatedAt: this.#now().toISOString()
61951
+ });
61952
+ return record === void 0 ? void 0 : parseQueueWorkerRecord(record);
61953
+ }
61437
61954
  readProjectDefaults(projectId) {
61438
61955
  return this.#call("readProjectDefaults", { projectId });
61439
61956
  }