devchain-cli 0.22.0 → 0.23.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 (241) hide show
  1. package/dist/drizzle/0077_familiar_morbius.sql +6 -0
  2. package/dist/drizzle/0078_preserve_legacy_connection_ownership.sql +180 -0
  3. package/dist/drizzle/0079_premium_forgotten_one.sql +18 -0
  4. package/dist/drizzle/0080_lethal_thunderbolt_ross.sql +49 -0
  5. package/dist/drizzle/0081_early_kronos.sql +58 -0
  6. package/dist/drizzle/0082_huge_black_queen.sql +14 -0
  7. package/dist/drizzle/meta/0077_snapshot.json +6957 -0
  8. package/dist/drizzle/meta/0078_snapshot.json +6957 -0
  9. package/dist/drizzle/meta/0079_snapshot.json +7093 -0
  10. package/dist/drizzle/meta/0080_snapshot.json +7241 -0
  11. package/dist/drizzle/meta/0081_snapshot.json +7482 -0
  12. package/dist/drizzle/meta/0082_snapshot.json +7571 -0
  13. package/dist/drizzle/meta/_journal.json +42 -0
  14. package/dist/node_modules/@devchain/shared/tsconfig.tsbuildinfo +1 -1
  15. package/dist/server/common/errors/error-types.d.ts +7 -0
  16. package/dist/server/common/errors/error-types.js +7 -1
  17. package/dist/server/common/errors/error-types.js.map +1 -1
  18. package/dist/server/modules/epic-time/controllers/agent-time-buffer.controller.d.ts +8 -0
  19. package/dist/server/modules/epic-time/controllers/agent-time-buffer.controller.js +67 -0
  20. package/dist/server/modules/epic-time/controllers/agent-time-buffer.controller.js.map +1 -0
  21. package/dist/server/modules/epic-time/controllers/external-estimate-log.controller.d.ts +12 -0
  22. package/dist/server/modules/epic-time/controllers/external-estimate-log.controller.js +322 -0
  23. package/dist/server/modules/epic-time/controllers/external-estimate-log.controller.js.map +1 -0
  24. package/dist/server/modules/epic-time/epic-time.module.js +14 -4
  25. package/dist/server/modules/epic-time/epic-time.module.js.map +1 -1
  26. package/dist/server/modules/epic-time/models/epic-time-daily-allocator.d.ts +30 -0
  27. package/dist/server/modules/epic-time/models/epic-time-daily-allocator.js +125 -0
  28. package/dist/server/modules/epic-time/models/epic-time-daily-allocator.js.map +1 -0
  29. package/dist/server/modules/epic-time/models/epic-time-local-day.d.ts +9 -0
  30. package/dist/server/modules/epic-time/models/epic-time-local-day.js +164 -0
  31. package/dist/server/modules/epic-time/models/epic-time-local-day.js.map +1 -0
  32. package/dist/server/modules/epic-time/models/epic-time.models.d.ts +138 -0
  33. package/dist/server/modules/epic-time/models/epic-time.models.js +2 -0
  34. package/dist/server/modules/epic-time/models/epic-time.models.js.map +1 -1
  35. package/dist/server/modules/epic-time/services/agent-time-accounting.service.d.ts +1 -0
  36. package/dist/server/modules/epic-time/services/agent-time-accounting.service.js +31 -8
  37. package/dist/server/modules/epic-time/services/agent-time-accounting.service.js.map +1 -1
  38. package/dist/server/modules/epic-time/services/epic-estimate-logging.service.d.ts +37 -0
  39. package/dist/server/modules/epic-time/services/epic-estimate-logging.service.js +716 -0
  40. package/dist/server/modules/epic-time/services/epic-estimate-logging.service.js.map +1 -0
  41. package/dist/server/modules/epic-time/services/epic-time.service.d.ts +12 -3
  42. package/dist/server/modules/epic-time/services/epic-time.service.js +155 -69
  43. package/dist/server/modules/epic-time/services/epic-time.service.js.map +1 -1
  44. package/dist/server/modules/epic-time/services/epic-time.store.d.ts +29 -3
  45. package/dist/server/modules/epic-time/services/epic-time.store.js +524 -40
  46. package/dist/server/modules/epic-time/services/epic-time.store.js.map +1 -1
  47. package/dist/server/modules/epics/controllers/epics.controller.d.ts +10 -1
  48. package/dist/server/modules/epics/controllers/epics.controller.js +108 -2
  49. package/dist/server/modules/epics/controllers/epics.controller.js.map +1 -1
  50. package/dist/server/modules/epics/epics.module.js +8 -2
  51. package/dist/server/modules/epics/epics.module.js.map +1 -1
  52. package/dist/server/modules/epics/models/epic-relations.models.d.ts +34 -0
  53. package/dist/server/modules/epics/models/epic-relations.models.js +16 -0
  54. package/dist/server/modules/epics/models/epic-relations.models.js.map +1 -0
  55. package/dist/server/modules/epics/services/epic-relation-target-resolver.d.ts +8 -0
  56. package/dist/server/modules/epics/services/epic-relation-target-resolver.js +37 -0
  57. package/dist/server/modules/epics/services/epic-relation-target-resolver.js.map +1 -0
  58. package/dist/server/modules/epics/services/epic-relations.service.d.ts +52 -0
  59. package/dist/server/modules/epics/services/epic-relations.service.js +135 -0
  60. package/dist/server/modules/epics/services/epic-relations.service.js.map +1 -0
  61. package/dist/server/modules/epics/services/epics.service.d.ts +9 -2
  62. package/dist/server/modules/epics/services/epics.service.js +115 -11
  63. package/dist/server/modules/epics/services/epics.service.js.map +1 -1
  64. package/dist/server/modules/events/catalog/broadcast-registry.js +16 -0
  65. package/dist/server/modules/events/catalog/broadcast-registry.js.map +1 -1
  66. package/dist/server/modules/events/catalog/epic.relations.invalidated.d.ts +12 -0
  67. package/dist/server/modules/events/catalog/epic.relations.invalidated.js +13 -0
  68. package/dist/server/modules/events/catalog/epic.relations.invalidated.js.map +1 -0
  69. package/dist/server/modules/events/catalog/epic.time.scope.invalidated.d.ts +12 -0
  70. package/dist/server/modules/events/catalog/epic.time.scope.invalidated.js +13 -0
  71. package/dist/server/modules/events/catalog/epic.time.scope.invalidated.js.map +1 -0
  72. package/dist/server/modules/events/catalog/index.d.ts +27 -4
  73. package/dist/server/modules/events/catalog/index.js +6 -0
  74. package/dist/server/modules/events/catalog/index.js.map +1 -1
  75. package/dist/server/modules/events/catalog/integration.connection.created.d.ts +4 -1
  76. package/dist/server/modules/events/catalog/integration.connection.created.js +5 -2
  77. package/dist/server/modules/events/catalog/integration.connection.created.js.map +1 -1
  78. package/dist/server/modules/events/catalog/integration.connection.deleted.d.ts +4 -1
  79. package/dist/server/modules/events/catalog/integration.connection.deleted.js +5 -2
  80. package/dist/server/modules/events/catalog/integration.connection.deleted.js.map +1 -1
  81. package/dist/server/modules/events/catalog/integration.connection.legacy.d.ts +85 -0
  82. package/dist/server/modules/events/catalog/integration.connection.legacy.js +41 -0
  83. package/dist/server/modules/events/catalog/integration.connection.legacy.js.map +1 -0
  84. package/dist/server/modules/events/catalog/integration.connection.updated.d.ts +4 -1
  85. package/dist/server/modules/events/catalog/integration.connection.updated.js +5 -2
  86. package/dist/server/modules/events/catalog/integration.connection.updated.js.map +1 -1
  87. package/dist/server/modules/events/services/committed-event-replay.d.ts +10 -0
  88. package/dist/server/modules/events/services/committed-event-replay.js +30 -0
  89. package/dist/server/modules/events/services/committed-event-replay.js.map +1 -0
  90. package/dist/server/modules/events/services/committed-event.store.d.ts +1 -0
  91. package/dist/server/modules/events/services/committed-event.store.js +12 -7
  92. package/dist/server/modules/events/services/committed-event.store.js.map +1 -1
  93. package/dist/server/modules/events/services/durable-event-registry.service.d.ts +9 -2
  94. package/dist/server/modules/events/services/durable-event-registry.service.js.map +1 -1
  95. package/dist/server/modules/external-integrations/adapters/clickup-external-task.provider.d.ts +7 -0
  96. package/dist/server/modules/external-integrations/adapters/clickup-external-task.provider.js +158 -50
  97. package/dist/server/modules/external-integrations/adapters/clickup-external-task.provider.js.map +1 -1
  98. package/dist/server/modules/external-integrations/adapters/jira-external-task.provider.d.ts +4 -0
  99. package/dist/server/modules/external-integrations/adapters/jira-external-task.provider.js +73 -33
  100. package/dist/server/modules/external-integrations/adapters/jira-external-task.provider.js.map +1 -1
  101. package/dist/server/modules/external-integrations/connections/integration-connections.controller.d.ts +6 -3
  102. package/dist/server/modules/external-integrations/connections/integration-connections.controller.js +67 -12
  103. package/dist/server/modules/external-integrations/connections/integration-connections.controller.js.map +1 -1
  104. package/dist/server/modules/external-integrations/connections/integration-connections.service.d.ts +35 -3
  105. package/dist/server/modules/external-integrations/connections/integration-connections.service.js +178 -17
  106. package/dist/server/modules/external-integrations/connections/integration-connections.service.js.map +1 -1
  107. package/dist/server/modules/external-integrations/connections/managed-subtask-sync.controller.d.ts +6 -3
  108. package/dist/server/modules/external-integrations/connections/managed-subtask-sync.controller.js +51 -11
  109. package/dist/server/modules/external-integrations/connections/managed-subtask-sync.controller.js.map +1 -1
  110. package/dist/server/modules/external-integrations/external-integrations.module.js +6 -1
  111. package/dist/server/modules/external-integrations/external-integrations.module.js.map +1 -1
  112. package/dist/server/modules/external-integrations/models/external-edit-session.models.d.ts +1 -0
  113. package/dist/server/modules/external-integrations/models/external-provider.models.d.ts +6 -2
  114. package/dist/server/modules/external-integrations/models/external-provider.models.js +2 -3
  115. package/dist/server/modules/external-integrations/models/external-provider.models.js.map +1 -1
  116. package/dist/server/modules/external-integrations/models/external-time-mutation.models.d.ts +33 -2
  117. package/dist/server/modules/external-integrations/models/external-time-mutation.models.js +14 -0
  118. package/dist/server/modules/external-integrations/models/external-time-mutation.models.js.map +1 -1
  119. package/dist/server/modules/external-integrations/my-work/external-edit-session.service.d.ts +10 -9
  120. package/dist/server/modules/external-integrations/my-work/external-edit-session.service.js +81 -46
  121. package/dist/server/modules/external-integrations/my-work/external-edit-session.service.js.map +1 -1
  122. package/dist/server/modules/external-integrations/my-work/external-my-work.controller.d.ts +22 -20
  123. package/dist/server/modules/external-integrations/my-work/external-my-work.controller.js +136 -64
  124. package/dist/server/modules/external-integrations/my-work/external-my-work.controller.js.map +1 -1
  125. package/dist/server/modules/external-integrations/my-work/external-my-work.openapi.d.ts +7 -0
  126. package/dist/server/modules/external-integrations/my-work/external-my-work.openapi.js +289 -4
  127. package/dist/server/modules/external-integrations/my-work/external-my-work.openapi.js.map +1 -1
  128. package/dist/server/modules/external-integrations/my-work/external-my-work.service.d.ts +12 -7
  129. package/dist/server/modules/external-integrations/my-work/external-my-work.service.js +114 -54
  130. package/dist/server/modules/external-integrations/my-work/external-my-work.service.js.map +1 -1
  131. package/dist/server/modules/external-integrations/my-work/external-time-mutation.service.d.ts +19 -6
  132. package/dist/server/modules/external-integrations/my-work/external-time-mutation.service.js +346 -46
  133. package/dist/server/modules/external-integrations/my-work/external-time-mutation.service.js.map +1 -1
  134. package/dist/server/modules/external-integrations/sessions/external-edit-session.store.d.ts +2 -1
  135. package/dist/server/modules/external-integrations/sessions/external-edit-session.store.js +3 -2
  136. package/dist/server/modules/external-integrations/sessions/external-edit-session.store.js.map +1 -1
  137. package/dist/server/modules/external-integrations/sessions/external-time-mutation.store.d.ts +6 -1
  138. package/dist/server/modules/external-integrations/sessions/external-time-mutation.store.js +19 -0
  139. package/dist/server/modules/external-integrations/sessions/external-time-mutation.store.js.map +1 -1
  140. package/dist/server/modules/external-integrations/sessions/provider-operation-gate.d.ts +15 -2
  141. package/dist/server/modules/external-integrations/sessions/provider-operation-gate.js +33 -6
  142. package/dist/server/modules/external-integrations/sessions/provider-operation-gate.js.map +1 -1
  143. package/dist/server/modules/external-integrations/subscribers/external-subtask-sync.subscriber.d.ts +13 -6
  144. package/dist/server/modules/external-integrations/subscribers/external-subtask-sync.subscriber.js +212 -75
  145. package/dist/server/modules/external-integrations/subscribers/external-subtask-sync.subscriber.js.map +1 -1
  146. package/dist/server/modules/external-integrations/subscribers/managed-subtask-content.d.ts +13 -4
  147. package/dist/server/modules/external-integrations/subscribers/managed-subtask-content.js +98 -0
  148. package/dist/server/modules/external-integrations/subscribers/managed-subtask-content.js.map +1 -1
  149. package/dist/server/modules/external-integrations/subscribers/managed-subtask-sync-health.service.d.ts +10 -4
  150. package/dist/server/modules/external-integrations/subscribers/managed-subtask-sync-health.service.js +57 -18
  151. package/dist/server/modules/external-integrations/subscribers/managed-subtask-sync-health.service.js.map +1 -1
  152. package/dist/server/modules/mcp/dtos/mcp.dto.d.ts +139 -0
  153. package/dist/server/modules/mcp/dtos/mcp.dto.js +41 -1
  154. package/dist/server/modules/mcp/dtos/mcp.dto.js.map +1 -1
  155. package/dist/server/modules/mcp/services/handlers/epic-context.d.ts +2 -0
  156. package/dist/server/modules/mcp/services/handlers/epic-tools.d.ts +4 -0
  157. package/dist/server/modules/mcp/services/handlers/epic-tools.js +275 -0
  158. package/dist/server/modules/mcp/services/handlers/epic-tools.js.map +1 -1
  159. package/dist/server/modules/mcp/services/mcp-tool-binding.registry.d.ts +2 -1
  160. package/dist/server/modules/mcp/services/mcp-tool-binding.registry.js +13 -8
  161. package/dist/server/modules/mcp/services/mcp-tool-binding.registry.js.map +1 -1
  162. package/dist/server/modules/mcp/services/testing/mcp-tool-binding-registry.fixture.d.ts +1 -1
  163. package/dist/server/modules/mcp/services/testing/mcp-tool-binding-registry.fixture.js +1 -1
  164. package/dist/server/modules/mcp/services/testing/mcp-tool-binding-registry.fixture.js.map +1 -1
  165. package/dist/server/modules/mcp/tool-descriptors/binding-types.d.ts +2 -0
  166. package/dist/server/modules/mcp/tool-descriptors/binding-types.js.map +1 -1
  167. package/dist/server/modules/mcp/tool-descriptors/epic.bindings.js +6 -0
  168. package/dist/server/modules/mcp/tool-descriptors/epic.bindings.js.map +1 -1
  169. package/dist/server/modules/mcp/tool-descriptors/epic.metadata.js +132 -0
  170. package/dist/server/modules/mcp/tool-descriptors/epic.metadata.js.map +1 -1
  171. package/dist/server/modules/projects/controllers/projects.controller.js +1 -4
  172. package/dist/server/modules/projects/controllers/projects.controller.js.map +1 -1
  173. package/dist/server/modules/projects/projects.module.js +2 -0
  174. package/dist/server/modules/projects/projects.module.js.map +1 -1
  175. package/dist/server/modules/projects/services/projects.service.d.ts +4 -1
  176. package/dist/server/modules/projects/services/projects.service.js +23 -2
  177. package/dist/server/modules/projects/services/projects.service.js.map +1 -1
  178. package/dist/server/modules/providers/adapters/claude.adapter.d.ts +4 -2
  179. package/dist/server/modules/providers/adapters/claude.adapter.js +31 -0
  180. package/dist/server/modules/providers/adapters/claude.adapter.js.map +1 -1
  181. package/dist/server/modules/providers/services/provider-mcp-ensure.service.d.ts +7 -0
  182. package/dist/server/modules/providers/services/provider-mcp-ensure.service.js +69 -4
  183. package/dist/server/modules/providers/services/provider-mcp-ensure.service.js.map +1 -1
  184. package/dist/server/modules/session-reader/data/pricing.json +452 -56
  185. package/dist/server/modules/session-reader/services/session-reader.service.d.ts +2 -0
  186. package/dist/server/modules/session-reader/services/session-reader.service.js +85 -9
  187. package/dist/server/modules/session-reader/services/session-reader.service.js.map +1 -1
  188. package/dist/server/modules/session-reader/services/transcript-path-validator.service.js +8 -2
  189. package/dist/server/modules/session-reader/services/transcript-path-validator.service.js.map +1 -1
  190. package/dist/server/modules/session-reader/services/transcript-watcher.service.js +44 -17
  191. package/dist/server/modules/session-reader/services/transcript-watcher.service.js.map +1 -1
  192. package/dist/server/modules/sessions/services/session-runtime/__test-utils__/pipeline-harness.d.ts +1 -0
  193. package/dist/server/modules/sessions/services/session-runtime/__test-utils__/pipeline-harness.js +1 -0
  194. package/dist/server/modules/sessions/services/session-runtime/__test-utils__/pipeline-harness.js.map +1 -1
  195. package/dist/server/modules/sessions/services/session-runtime/session-launch-pipeline.service.js +11 -1
  196. package/dist/server/modules/sessions/services/session-runtime/session-launch-pipeline.service.js.map +1 -1
  197. package/dist/server/modules/sessions/utils/claude-config.d.ts +4 -1
  198. package/dist/server/modules/sessions/utils/claude-config.js +265 -60
  199. package/dist/server/modules/sessions/utils/claude-config.js.map +1 -1
  200. package/dist/server/modules/storage/db/schema.d.ts +1109 -98
  201. package/dist/server/modules/storage/db/schema.js +141 -3
  202. package/dist/server/modules/storage/db/schema.js.map +1 -1
  203. package/dist/server/modules/storage/db/sqlite-json.d.ts +1 -0
  204. package/dist/server/modules/storage/db/sqlite-json.js +4 -0
  205. package/dist/server/modules/storage/db/sqlite-json.js.map +1 -1
  206. package/dist/server/modules/storage/interfaces/storage.interface.d.ts +58 -10
  207. package/dist/server/modules/storage/interfaces/storage.interface.js.map +1 -1
  208. package/dist/server/modules/storage/local/delegates/epic.delegate.d.ts +30 -5
  209. package/dist/server/modules/storage/local/delegates/epic.delegate.js +718 -14
  210. package/dist/server/modules/storage/local/delegates/epic.delegate.js.map +1 -1
  211. package/dist/server/modules/storage/local/delegates/external-estimate-log.delegate.d.ts +52 -0
  212. package/dist/server/modules/storage/local/delegates/external-estimate-log.delegate.js +659 -0
  213. package/dist/server/modules/storage/local/delegates/external-estimate-log.delegate.js.map +1 -0
  214. package/dist/server/modules/storage/local/delegates/external-managed-subtask.delegate.d.ts +2 -1
  215. package/dist/server/modules/storage/local/delegates/external-managed-subtask.delegate.js +17 -4
  216. package/dist/server/modules/storage/local/delegates/external-managed-subtask.delegate.js.map +1 -1
  217. package/dist/server/modules/storage/local/delegates/integration.delegate.d.ts +23 -8
  218. package/dist/server/modules/storage/local/delegates/integration.delegate.js +238 -52
  219. package/dist/server/modules/storage/local/delegates/integration.delegate.js.map +1 -1
  220. package/dist/server/modules/storage/local/delegates/project.delegate.d.ts +2 -0
  221. package/dist/server/modules/storage/local/delegates/project.delegate.js +180 -130
  222. package/dist/server/modules/storage/local/delegates/project.delegate.js.map +1 -1
  223. package/dist/server/modules/storage/local/local-storage.service.d.ts +45 -10
  224. package/dist/server/modules/storage/local/local-storage.service.js +99 -15
  225. package/dist/server/modules/storage/local/local-storage.service.js.map +1 -1
  226. package/dist/server/modules/storage/models/domain.models.d.ts +170 -0
  227. package/dist/server/modules/storage/models/domain.models.js +9 -0
  228. package/dist/server/modules/storage/models/domain.models.js.map +1 -1
  229. package/dist/server/templates/teams-dev.json +311 -301
  230. package/dist/server/tsconfig.tsbuildinfo +1 -1
  231. package/dist/server/ui/assets/{ExternalRichEditor-DMtnZIMZ.js → ExternalRichEditor-BG9SopK8.js} +1 -1
  232. package/dist/server/ui/assets/{ReviewDetailPage-BmyiM5IR.js → ReviewDetailPage-DNo7Qx3m.js} +1 -1
  233. package/dist/server/ui/assets/{ReviewsPage-CQ87BMwT.js → ReviewsPage-Cay-IObR.js} +1 -1
  234. package/dist/server/ui/assets/index-C1Fdqua-.js +1197 -0
  235. package/dist/server/ui/assets/index-CV8ydm7w.css +32 -0
  236. package/dist/server/ui/assets/{useReviewSubscription-DjbEUzt4.js → useReviewSubscription-sAAfh4k9.js} +1 -1
  237. package/dist/server/ui/index.html +2 -2
  238. package/dist/templates/teams-dev.json +311 -301
  239. package/package.json +19 -2
  240. package/dist/server/ui/assets/index-BX6Yze-A.js +0 -1177
  241. package/dist/server/ui/assets/index-qoQEv_u4.css +0 -32
@@ -42,3 +42,10 @@ export declare class UnsupportedProviderError extends AppError {
42
42
  readonly providerName: string;
43
43
  constructor(providerName: string, supportedProviders: string[]);
44
44
  }
45
+ export interface RelationRouteEffectFacts {
46
+ sourceEpicId: string;
47
+ targetEpicId: string;
48
+ }
49
+ export declare class RelationConfirmationRequiredError extends AppError {
50
+ constructor(currentEffect: RelationRouteEffectFacts);
51
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedProviderError = exports.TeamMemberCapReachedError = exports.PasteNotConfirmedError = exports.TimeoutError = exports.BusyError = exports.IOError = exports.StorageError = exports.OptimisticLockError = exports.ForbiddenError = exports.ConflictError = exports.ValidationError = exports.NotFoundError = exports.AppError = void 0;
3
+ exports.RelationConfirmationRequiredError = exports.UnsupportedProviderError = exports.TeamMemberCapReachedError = exports.PasteNotConfirmedError = exports.TimeoutError = exports.BusyError = exports.IOError = exports.StorageError = exports.OptimisticLockError = exports.ForbiddenError = exports.ConflictError = exports.ValidationError = exports.NotFoundError = exports.AppError = void 0;
4
4
  class AppError extends Error {
5
5
  code;
6
6
  statusCode;
@@ -97,4 +97,10 @@ class UnsupportedProviderError extends AppError {
97
97
  }
98
98
  }
99
99
  exports.UnsupportedProviderError = UnsupportedProviderError;
100
+ class RelationConfirmationRequiredError extends AppError {
101
+ constructor(currentEffect) {
102
+ super('This change displaces an active relation time route. Confirm the current route effect and retry with the accepted facts, or delete the displaced Related pair explicitly and retry.', 'relation_confirmation_required', 409, { currentEffect });
103
+ }
104
+ }
105
+ exports.RelationConfirmationRequiredError = RelationConfirmationRequiredError;
100
106
  //# sourceMappingURL=error-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-types.js","sourceRoot":"","sources":["../../../src/common/errors/error-types.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAS,SAAQ,KAAK;IAGf;IACA;IACA;IAJlB,YACE,OAAe,EACC,IAAY,EACZ,aAAqB,GAAG,EACxB,O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qB,EAAE,GAAG,EAAE;YAC3F,WAAW;YACX,GAAG,OAAO;SACX,CAAC,CAAC;QANa,gBAAW,GAAX,WAAW,CAAQ;IAOrC,CAAC;CACF;AAVD,wDAUC;AAED,MAAa,yBAA0B,SAAQ,QAAQ;IACrD,YAAY,UAAkB,EAAE,mBAA2B;QACzD,KAAK,CAAC,uBAAuB,EAAE,yBAAyB,EAAE,GAAG,EAAE;YAC7D,UAAU;YACV,mBAAmB;SACpB,CAAC,CAAC;IACL,CAAC;CACF;AAPD,8DAOC;AAED,MAAa,wBAAyB,SAAQ,QAAQ;IAElC;IADlB,YACkB,YAAoB,EACpC,kBAA4B;QAE5B,KAAK,CACH,yBAAyB,YAAY,0BAA0B,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC9F,sBAAsB,EACtB,GAAG,EACH,EAAE,YAAY,EAAE,kBAAkB,EAAE,CACrC,CAAC;QARc,iBAAY,GAAZ,YAAY,CAAQ;IAStC,CAAC;CACF;AAZD,4DAYC;AAOD,MAAa,iCAAkC,SAAQ,QAAQ;IAC7D,YAAY,aAAuC;QACjD,KAAK,CACH,qLAAqL,EACrL,gCAAgC,EAChC,GAAG,EACH,EAAE,aAAa,EAAE,CAClB,CAAC;IACJ,CAAC;CACF;AATD,8EASC"}
@@ -0,0 +1,8 @@
1
+ import type { AgentTimeBufferAssignmentResult, AgentTimeBufferSnapshot } from '../models/epic-time.models';
2
+ import { EpicTimeService } from '../services/epic-time.service';
3
+ export declare class AgentTimeBufferController {
4
+ private readonly epicTimeService;
5
+ constructor(epicTimeService: EpicTimeService);
6
+ getAgentTimeBuffers(projectId: string | undefined): AgentTimeBufferSnapshot;
7
+ assignAgentTimeBuffer(agentId: string, body: unknown): Promise<AgentTimeBufferAssignmentResult>;
8
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AgentTimeBufferController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const zod_1 = require("zod");
18
+ const epic_time_service_1 = require("../services/epic-time.service");
19
+ const ProjectIdSchema = zod_1.z.string().uuid();
20
+ const AgentIdSchema = zod_1.z.string().min(1);
21
+ const SnapshotTokenSchema = zod_1.z.string().regex(/^[0-9a-f]{64}$/);
22
+ const AssignAgentTimeBufferSchema = zod_1.z
23
+ .object({
24
+ projectId: ProjectIdSchema,
25
+ targetEpicId: zod_1.z.string().uuid(),
26
+ capturedAt: zod_1.z.string().datetime(),
27
+ snapshotToken: SnapshotTokenSchema,
28
+ })
29
+ .strict();
30
+ let AgentTimeBufferController = class AgentTimeBufferController {
31
+ epicTimeService;
32
+ constructor(epicTimeService) {
33
+ this.epicTimeService = epicTimeService;
34
+ }
35
+ getAgentTimeBuffers(projectId) {
36
+ return this.epicTimeService.getAgentTimeBuffers(ProjectIdSchema.parse(projectId));
37
+ }
38
+ assignAgentTimeBuffer(agentId, body) {
39
+ const parsed = AssignAgentTimeBufferSchema.parse(body);
40
+ return this.epicTimeService.assignAgentTimeBuffer({
41
+ agentId: AgentIdSchema.parse(agentId),
42
+ ...parsed,
43
+ });
44
+ }
45
+ };
46
+ exports.AgentTimeBufferController = AgentTimeBufferController;
47
+ __decorate([
48
+ (0, common_1.Get)(),
49
+ __param(0, (0, common_1.Query)('projectId')),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [Object]),
52
+ __metadata("design:returntype", Object)
53
+ ], AgentTimeBufferController.prototype, "getAgentTimeBuffers", null);
54
+ __decorate([
55
+ (0, common_1.Post)(':agentId/assign'),
56
+ (0, common_1.HttpCode)(common_1.HttpStatus.OK),
57
+ __param(0, (0, common_1.Param)('agentId')),
58
+ __param(1, (0, common_1.Body)()),
59
+ __metadata("design:type", Function),
60
+ __metadata("design:paramtypes", [String, Object]),
61
+ __metadata("design:returntype", Promise)
62
+ ], AgentTimeBufferController.prototype, "assignAgentTimeBuffer", null);
63
+ exports.AgentTimeBufferController = AgentTimeBufferController = __decorate([
64
+ (0, common_1.Controller)('api/agent-time-buffers'),
65
+ __metadata("design:paramtypes", [epic_time_service_1.EpicTimeService])
66
+ ], AgentTimeBufferController);
67
+ //# sourceMappingURL=agent-time-buffer.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-time-buffer.controller.js","sourceRoot":"","sources":["../../../../src/modules/epic-time/controllers/agent-time-buffer.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiG;AACjG,6BAAwB;AAKxB,qEAAgE;AAEhE,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,aAAa,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACxC,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAC/D,MAAM,2BAA2B,GAAG,OAAC;KAClC,MAAM,CAAC;IACN,SAAS,EAAE,eAAe;IAC1B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,aAAa,EAAE,mBAAmB;CACnC,CAAC;KACD,MAAM,EAAE,CAAC;AAGL,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACP;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAGjE,mBAAmB,CAAqB,SAA6B;QACnE,OAAO,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACpF,CAAC;IAID,qBAAqB,CACD,OAAe,EACzB,IAAa;QAErB,MAAM,MAAM,GAAG,2BAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC;YAChD,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;YACrC,GAAG,MAAM;SACV,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApBY,8DAAyB;AAIpC;IADC,IAAA,YAAG,GAAE;IACe,WAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;;;;oEAEtC;AAID;IAFC,IAAA,aAAI,EAAC,iBAAiB,CAAC;IACvB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IAErB,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;sEAOR;oCAnBU,yBAAyB;IADrC,IAAA,mBAAU,EAAC,wBAAwB,CAAC;qCAEW,mCAAe;GADlD,yBAAyB,CAoBrC"}
@@ -0,0 +1,12 @@
1
+ import type { ExternalEstimateCreateTimeEntryResponse, ExternalEstimateLogStateView, ExternalEstimateResolveOperationResponse } from '../models/epic-time.models';
2
+ import { EpicEstimateLoggingService } from '../services/epic-estimate-logging.service';
3
+ export declare class ExternalEstimateLogController {
4
+ private readonly estimateLogging;
5
+ constructor(estimateLogging: EpicEstimateLoggingService);
6
+ getEstimateLogState(providerValue: string, taskIdValue: string, epochValue: unknown, queryValue: unknown): Promise<ExternalEstimateLogStateView>;
7
+ setLoggedEstimate(providerValue: string, taskIdValue: string, epochValue: unknown, body: unknown, projectIdValue: unknown): Promise<ExternalEstimateLogStateView>;
8
+ createEstimateTimeEntry(providerValue: string, taskIdValue: string, epochValue: unknown, idempotencyKeyValue: unknown, body: unknown, projectIdValue: unknown): Promise<ExternalEstimateCreateTimeEntryResponse>;
9
+ resolveEstimateOperation(providerValue: string, taskIdValue: string, operationIdValue: string, epochValue: unknown, idempotencyKeyValue: unknown, body: unknown, projectIdValue: unknown): Promise<ExternalEstimateResolveOperationResponse>;
10
+ private parseTaskPath;
11
+ private parseProjectId;
12
+ }
@@ -0,0 +1,322 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ExternalEstimateLogController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const swagger_1 = require("@nestjs/swagger");
18
+ const zod_1 = require("zod");
19
+ const integration_admission_guard_1 = require("../../../common/guards/integration-admission.guard");
20
+ const error_types_1 = require("../../../common/errors/error-types");
21
+ const request_validation_1 = require("../../external-integrations/request-validation");
22
+ const external_time_mutation_models_1 = require("../../external-integrations/models/external-time-mutation.models");
23
+ const external_my_work_openapi_1 = require("../../external-integrations/my-work/external-my-work.openapi");
24
+ const epic_estimate_logging_service_1 = require("../services/epic-estimate-logging.service");
25
+ const providerSchema = zod_1.z.enum(external_my_work_openapi_1.INTEGRATION_PROVIDER_IDS);
26
+ const projectIdSchema = zod_1.z.string().uuid('projectId must be a valid UUID.');
27
+ const scopeKeySchema = zod_1.z.string().trim().min(1).max(256);
28
+ const remoteTaskIdSchema = zod_1.z.string().trim().min(1).max(external_my_work_openapi_1.MAX_REMOTE_TASK_ID_LENGTH);
29
+ const stateQuerySchema = zod_1.z
30
+ .object({
31
+ projectId: projectIdSchema,
32
+ scopeKey: scopeKeySchema,
33
+ })
34
+ .strict();
35
+ const connectionEpochHeaderSchema = zod_1.z
36
+ .string()
37
+ .trim()
38
+ .regex(/^\d{1,10}$/, 'Invalid connection epoch')
39
+ .transform(Number);
40
+ const idempotencyKeyHeaderSchema = zod_1.z
41
+ .string()
42
+ .trim()
43
+ .regex(external_time_mutation_models_1.TIME_OPERATION_ID_PATTERN, 'Invalid idempotency key')
44
+ .max(external_time_mutation_models_1.MAX_TIME_OPERATION_ID_LENGTH);
45
+ const operationIdPathSchema = zod_1.z.string().trim().min(1).max(external_time_mutation_models_1.MAX_TIME_OPERATION_ID_LENGTH);
46
+ const timeZoneSchema = zod_1.z.string().trim().min(1).max(128);
47
+ const nonnegativeIntegerSchema = zod_1.z.number().int().min(0);
48
+ const dailySnapshotSchema = zod_1.z
49
+ .array(zod_1.z
50
+ .object({
51
+ activityDate: zod_1.z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Invalid activity date'),
52
+ minutes: nonnegativeIntegerSchema,
53
+ })
54
+ .strict())
55
+ .max(3_660);
56
+ const createInputSchema = zod_1.z
57
+ .object({
58
+ scopeKey: scopeKeySchema,
59
+ requestKey: zod_1.z.string().uuid('requestKey must be a fresh UUID.'),
60
+ timeZone: timeZoneSchema,
61
+ estimateTotalMinutes: nonnegativeIntegerSchema,
62
+ expectedRevision: nonnegativeIntegerSchema,
63
+ dailySnapshot: dailySnapshotSchema,
64
+ })
65
+ .strict();
66
+ const setInputSchema = zod_1.z
67
+ .object({
68
+ scopeKey: scopeKeySchema,
69
+ loggedMinutes: nonnegativeIntegerSchema,
70
+ expectedRevision: nonnegativeIntegerSchema,
71
+ timeZone: timeZoneSchema,
72
+ })
73
+ .strict();
74
+ const resolveInputSchema = zod_1.z
75
+ .object({
76
+ scopeKey: scopeKeySchema,
77
+ action: zod_1.z.enum(['verify', 'logged', 'not_logged']),
78
+ expectedRevision: nonnegativeIntegerSchema,
79
+ })
80
+ .strict();
81
+ function parseOrThrow(schema, value) {
82
+ return (0, request_validation_1.parseOrThrow)(schema, value, 'Invalid estimate request.');
83
+ }
84
+ function toStateView(snapshot) {
85
+ const stored = snapshot.state;
86
+ const pending = stored?.pendingOperationId
87
+ ? {
88
+ operationId: stored.pendingOperationId,
89
+ deltaMinutes: stored.pendingDeltaMinutes,
90
+ estimateTotalMinutes: stored.pendingEstimateTotalMinutes,
91
+ startedAt: stored.pendingStartedAt,
92
+ phase: stored.pendingPhase,
93
+ resolution: stored.pendingResolution,
94
+ activityDate: stored.pendingActivityDate,
95
+ }
96
+ : null;
97
+ return {
98
+ initialized: snapshot.initialized,
99
+ revision: snapshot.revision,
100
+ loggedMinutes: snapshot.loggedMinutes,
101
+ aggregationTimeZone: snapshot.aggregationTimeZone,
102
+ days: snapshot.days,
103
+ unallocatedLoggedMinutes: snapshot.unallocatedLoggedMinutes,
104
+ pendingDisposition: snapshot.pendingDisposition,
105
+ canVerify: snapshot.canVerify,
106
+ verifyExpiresAt: snapshot.verifyExpiresAt,
107
+ pending,
108
+ };
109
+ }
110
+ let ExternalEstimateLogController = class ExternalEstimateLogController {
111
+ estimateLogging;
112
+ constructor(estimateLogging) {
113
+ this.estimateLogging = estimateLogging;
114
+ }
115
+ async getEstimateLogState(providerValue, taskIdValue, epochValue, queryValue) {
116
+ const { provider, taskId } = this.parseTaskPath(providerValue, taskIdValue);
117
+ const query = parseOrThrow(stateQuerySchema, queryValue);
118
+ const epoch = parseOrThrow(connectionEpochHeaderSchema, String(epochValue ?? ''));
119
+ return toStateView(await this.estimateLogging.getState({
120
+ projectId: query.projectId,
121
+ provider,
122
+ remoteScopeKey: query.scopeKey,
123
+ remoteTaskId: taskId,
124
+ expectedEpoch: epoch,
125
+ }));
126
+ }
127
+ async setLoggedEstimate(providerValue, taskIdValue, epochValue, body, projectIdValue) {
128
+ const { provider, taskId } = this.parseTaskPath(providerValue, taskIdValue);
129
+ const epoch = parseOrThrow(connectionEpochHeaderSchema, String(epochValue ?? ''));
130
+ const input = parseOrThrow(setInputSchema, body);
131
+ return toStateView(await this.estimateLogging.setLoggedMinutes({
132
+ projectId: this.parseProjectId(projectIdValue),
133
+ provider,
134
+ remoteScopeKey: input.scopeKey,
135
+ remoteTaskId: taskId,
136
+ expectedEpoch: epoch,
137
+ loggedMinutes: input.loggedMinutes,
138
+ expectedRevision: input.expectedRevision,
139
+ timeZone: input.timeZone,
140
+ }));
141
+ }
142
+ async createEstimateTimeEntry(providerValue, taskIdValue, epochValue, idempotencyKeyValue, body, projectIdValue) {
143
+ const { provider, taskId } = this.parseTaskPath(providerValue, taskIdValue);
144
+ const epoch = parseOrThrow(connectionEpochHeaderSchema, String(epochValue ?? ''));
145
+ const input = parseOrThrow(createInputSchema, body);
146
+ const idempotencyKey = parseOrThrow(idempotencyKeyHeaderSchema, String(idempotencyKeyValue ?? ''));
147
+ if (idempotencyKey.toLowerCase() !== input.requestKey.toLowerCase()) {
148
+ throw new error_types_1.ValidationError('The idempotency key must match the request key.', {
149
+ field: 'idempotency-key',
150
+ });
151
+ }
152
+ const result = await this.estimateLogging.createTimeEntry({
153
+ projectId: this.parseProjectId(projectIdValue),
154
+ provider,
155
+ remoteScopeKey: input.scopeKey,
156
+ remoteTaskId: taskId,
157
+ expectedEpoch: epoch,
158
+ requestKey: input.requestKey,
159
+ timeZone: input.timeZone,
160
+ estimateTotalMinutes: input.estimateTotalMinutes,
161
+ expectedRevision: input.expectedRevision,
162
+ dailySnapshot: input.dailySnapshot,
163
+ });
164
+ return {
165
+ outcome: result.outcome,
166
+ entriesLogged: result.entriesLogged,
167
+ minutesLogged: result.minutesLogged,
168
+ hasMore: result.hasMore,
169
+ stoppedReason: result.stoppedReason,
170
+ state: toStateView(result.snapshot),
171
+ };
172
+ }
173
+ async resolveEstimateOperation(providerValue, taskIdValue, operationIdValue, epochValue, idempotencyKeyValue, body, projectIdValue) {
174
+ const { provider, taskId } = this.parseTaskPath(providerValue, taskIdValue);
175
+ const operationId = parseOrThrow(operationIdPathSchema, operationIdValue);
176
+ const epoch = parseOrThrow(connectionEpochHeaderSchema, String(epochValue ?? ''));
177
+ const idempotencyKey = parseOrThrow(idempotencyKeyHeaderSchema, String(idempotencyKeyValue ?? ''));
178
+ if (idempotencyKey !== operationId) {
179
+ throw new error_types_1.ValidationError('The idempotency key must match the resolved operation id.', {
180
+ field: 'idempotency-key',
181
+ });
182
+ }
183
+ const input = parseOrThrow(resolveInputSchema, body);
184
+ const result = await this.estimateLogging.resolveOperation({
185
+ projectId: this.parseProjectId(projectIdValue),
186
+ provider,
187
+ remoteScopeKey: input.scopeKey,
188
+ remoteTaskId: taskId,
189
+ expectedEpoch: epoch,
190
+ operationId,
191
+ action: input.action,
192
+ expectedRevision: input.expectedRevision,
193
+ });
194
+ return { outcome: result.outcome, state: toStateView(result.snapshot) };
195
+ }
196
+ parseTaskPath(providerValue, taskIdValue) {
197
+ return {
198
+ provider: parseOrThrow(providerSchema, providerValue),
199
+ taskId: parseOrThrow(remoteTaskIdSchema, taskIdValue),
200
+ };
201
+ }
202
+ parseProjectId(value) {
203
+ return parseOrThrow(projectIdSchema, value);
204
+ }
205
+ };
206
+ exports.ExternalEstimateLogController = ExternalEstimateLogController;
207
+ __decorate([
208
+ (0, common_1.Get)(':provider/tasks/:taskId/estimate-log-state'),
209
+ (0, swagger_1.ApiOperation)({
210
+ summary: 'Read the durable incremental-estimate checkpoint of a linked remote task',
211
+ description: 'Intentional state-mutating read: an exact pending provider receipt may settle exactly once through tuple checks and compare-and-swap updates before the state returns. Requires the X-DevChain-Connection-Epoch header, validated before state or provider access.',
212
+ }),
213
+ (0, swagger_1.ApiParam)({ name: 'provider', enum: [...external_my_work_openapi_1.INTEGRATION_PROVIDER_IDS] }),
214
+ (0, swagger_1.ApiParam)({ name: 'taskId', type: String }),
215
+ (0, swagger_1.ApiQuery)({ name: 'scopeKey', required: true, type: String }),
216
+ (0, swagger_1.ApiResponse)({
217
+ status: 200,
218
+ description: 'Checkpoint state with a derived disposition and the durable pending operation when one exists',
219
+ schema: external_my_work_openapi_1.ESTIMATE_LOG_STATE_RESPONSE_SCHEMA,
220
+ }),
221
+ __param(0, (0, common_1.Param)('provider')),
222
+ __param(1, (0, common_1.Param)('taskId')),
223
+ __param(2, (0, common_1.Headers)('x-devchain-connection-epoch')),
224
+ __param(3, (0, common_1.Query)()),
225
+ __metadata("design:type", Function),
226
+ __metadata("design:paramtypes", [String, String, Object, Object]),
227
+ __metadata("design:returntype", Promise)
228
+ ], ExternalEstimateLogController.prototype, "getEstimateLogState", null);
229
+ __decorate([
230
+ (0, common_1.Put)(':provider/tasks/:taskId/estimate-log-state'),
231
+ (0, swagger_1.ApiOperation)({
232
+ summary: 'Set the logged estimate checkpoint for bootstrap and correction',
233
+ description: 'Records DevChain submissions and explicit user assumptions. Requires the X-DevChain-Connection-Epoch header and the stored revision.',
234
+ }),
235
+ (0, swagger_1.ApiParam)({ name: 'provider', enum: [...external_my_work_openapi_1.INTEGRATION_PROVIDER_IDS] }),
236
+ (0, swagger_1.ApiParam)({ name: 'taskId', type: String }),
237
+ (0, swagger_1.ApiBody)({ schema: external_my_work_openapi_1.ESTIMATE_LOG_STATE_SET_INPUT_BODY_SCHEMA }),
238
+ (0, swagger_1.ApiResponse)({ status: 200, schema: external_my_work_openapi_1.ESTIMATE_LOG_STATE_RESPONSE_SCHEMA }),
239
+ __param(0, (0, common_1.Param)('provider')),
240
+ __param(1, (0, common_1.Param)('taskId')),
241
+ __param(2, (0, common_1.Headers)('x-devchain-connection-epoch')),
242
+ __param(3, (0, common_1.Body)()),
243
+ __param(4, (0, common_1.Query)('projectId')),
244
+ __metadata("design:type", Function),
245
+ __metadata("design:paramtypes", [String, String, Object, Object, Object]),
246
+ __metadata("design:returntype", Promise)
247
+ ], ExternalEstimateLogController.prototype, "setLoggedEstimate", null);
248
+ __decorate([
249
+ (0, common_1.Post)(':provider/tasks/:taskId/estimate-time-entries'),
250
+ (0, swagger_1.ApiOperation)({
251
+ summary: 'Log only the unlogged dated estimate delta in bounded sequential entries',
252
+ description: 'Requires the X-DevChain-Connection-Epoch precondition header and an Idempotency-Key equal to the body requestKey (one fresh browser UUID per click). Durable state is prepared before each provider entry and settled before the next; at most 10 entries are written per request; a dispatched unknown outcome is never retried automatically and resolves through the estimate resolve route.',
253
+ }),
254
+ (0, swagger_1.ApiParam)({ name: 'provider', enum: [...external_my_work_openapi_1.INTEGRATION_PROVIDER_IDS] }),
255
+ (0, swagger_1.ApiParam)({ name: 'taskId', type: String }),
256
+ (0, swagger_1.ApiBody)({ schema: external_my_work_openapi_1.ESTIMATE_TIME_ENTRY_CREATE_INPUT_BODY_SCHEMA }),
257
+ (0, swagger_1.ApiResponse)({
258
+ status: 200,
259
+ description: 'Bounded dated settlement: logged, partially_logged after a durable prefix, or a receipt-bound unknown outcome',
260
+ schema: external_my_work_openapi_1.ESTIMATE_TIME_ENTRY_CREATE_RESPONSE_SCHEMA,
261
+ }),
262
+ (0, swagger_1.ApiResponse)({ status: 400, description: 'Invalid input or unsupported checkpoint state' }),
263
+ (0, swagger_1.ApiResponse)({
264
+ status: 409,
265
+ description: 'Epoch precondition, revision conflict, idempotency conflict, or busy gate',
266
+ }),
267
+ __param(0, (0, common_1.Param)('provider')),
268
+ __param(1, (0, common_1.Param)('taskId')),
269
+ __param(2, (0, common_1.Headers)('x-devchain-connection-epoch')),
270
+ __param(3, (0, common_1.Headers)('idempotency-key')),
271
+ __param(4, (0, common_1.Body)()),
272
+ __param(5, (0, common_1.Query)('projectId')),
273
+ __metadata("design:type", Function),
274
+ __metadata("design:paramtypes", [String, String, Object, Object, Object, Object]),
275
+ __metadata("design:returntype", Promise)
276
+ ], ExternalEstimateLogController.prototype, "createEstimateTimeEntry", null);
277
+ __decorate([
278
+ (0, common_1.Post)(':provider/tasks/:taskId/estimate-time-operations/:operationId/resolve'),
279
+ (0, swagger_1.ApiOperation)({
280
+ summary: 'Verify or explicitly resolve the pending estimate operation',
281
+ description: 'Requires the X-DevChain-Connection-Epoch precondition header and an Idempotency-Key matching the resolved operation id. Verify needs the pending connection epoch; Mark logged and Mark not logged stay available after receipt loss or connection replacement.',
282
+ }),
283
+ (0, swagger_1.ApiParam)({ name: 'provider', enum: [...external_my_work_openapi_1.INTEGRATION_PROVIDER_IDS] }),
284
+ (0, swagger_1.ApiParam)({ name: 'taskId', type: String }),
285
+ (0, swagger_1.ApiParam)({ name: 'operationId', type: String }),
286
+ (0, swagger_1.ApiBody)({ schema: external_my_work_openapi_1.ESTIMATE_TIME_OPERATION_RESOLVE_INPUT_BODY_SCHEMA }),
287
+ (0, swagger_1.ApiResponse)({
288
+ status: 200,
289
+ description: 'Applied resolution or an unresolved outcome with the current checkpoint state',
290
+ schema: external_my_work_openapi_1.ESTIMATE_TIME_OPERATION_RESOLVE_RESPONSE_SCHEMA,
291
+ }),
292
+ (0, swagger_1.ApiResponse)({ status: 404, description: 'The pending estimate operation was not found' }),
293
+ (0, swagger_1.ApiResponse)({
294
+ status: 409,
295
+ description: 'Epoch precondition, revision conflict, busy operation, or receipt mismatch',
296
+ }),
297
+ __param(0, (0, common_1.Param)('provider')),
298
+ __param(1, (0, common_1.Param)('taskId')),
299
+ __param(2, (0, common_1.Param)('operationId')),
300
+ __param(3, (0, common_1.Headers)('x-devchain-connection-epoch')),
301
+ __param(4, (0, common_1.Headers)('idempotency-key')),
302
+ __param(5, (0, common_1.Body)()),
303
+ __param(6, (0, common_1.Query)('projectId')),
304
+ __metadata("design:type", Function),
305
+ __metadata("design:paramtypes", [String, String, String, Object, Object, Object, Object]),
306
+ __metadata("design:returntype", Promise)
307
+ ], ExternalEstimateLogController.prototype, "resolveEstimateOperation", null);
308
+ exports.ExternalEstimateLogController = ExternalEstimateLogController = __decorate([
309
+ (0, swagger_1.ApiTags)('integrations'),
310
+ (0, common_1.Controller)('api/integrations/my-work'),
311
+ (0, common_1.UseGuards)(integration_admission_guard_1.IntegrationAdmissionGuard),
312
+ (0, swagger_1.ApiQuery)({ name: 'projectId', required: true, type: String }),
313
+ (0, swagger_1.ApiResponse)({ status: 400, description: 'Invalid request, connection, or checkpoint state' }),
314
+ (0, swagger_1.ApiResponse)({ status: 403, description: 'Integration operations are unavailable in this runtime' }),
315
+ (0, swagger_1.ApiResponse)({ status: 404, description: 'The linked task or checkpoint was not found' }),
316
+ (0, swagger_1.ApiResponse)({
317
+ status: 409,
318
+ description: 'Epoch precondition, revision conflict, pending operation, or receipt mismatch',
319
+ }),
320
+ __metadata("design:paramtypes", [epic_estimate_logging_service_1.EpicEstimateLoggingService])
321
+ ], ExternalEstimateLogController);
322
+ //# sourceMappingURL=external-estimate-log.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-estimate-log.controller.js","sourceRoot":"","sources":["../../../../src/modules/epic-time/controllers/external-estimate-log.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoG;AACpG,6CAAkG;AAClG,6BAAwB;AACxB,oGAA+F;AAC/F,oEAAqE;AAErE,uFAAmG;AACnG,oHAG0E;AAC1E,2GASsE;AAOtE,6FAAuF;AAEvF,MAAM,cAAc,GAAG,OAAC,CAAC,IAAI,CAAC,mDAAwB,CAAC,CAAC;AACxD,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAC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I,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7D,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;IAC7F,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;IACnG,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC;IACxF,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,+EAA+E;KAC7F,CAAC;qCAE8C,0DAA0B;GAD7D,6BAA6B,CA0MzC"}
@@ -13,16 +13,26 @@ const events_core_module_1 = require("../events/events-core.module");
13
13
  const agent_time_accounting_service_1 = require("./services/agent-time-accounting.service");
14
14
  const epic_time_store_1 = require("./services/epic-time.store");
15
15
  const epic_time_service_1 = require("./services/epic-time.service");
16
+ const agent_time_buffer_controller_1 = require("./controllers/agent-time-buffer.controller");
16
17
  const epic_time_controller_1 = require("./controllers/epic-time.controller");
18
+ const external_estimate_log_controller_1 = require("./controllers/external-estimate-log.controller");
19
+ const storage_module_1 = require("../storage/storage.module");
20
+ const external_integrations_module_1 = require("../external-integrations/external-integrations.module");
21
+ const epic_estimate_logging_service_1 = require("./services/epic-estimate-logging.service");
17
22
  let EpicTimeModule = class EpicTimeModule {
18
23
  };
19
24
  exports.EpicTimeModule = EpicTimeModule;
20
25
  exports.EpicTimeModule = EpicTimeModule = __decorate([
21
26
  (0, common_1.Module)({
22
- imports: [db_module_1.DbModule, events_core_module_1.EventsCoreModule],
23
- controllers: [epic_time_controller_1.EpicTimeController],
24
- providers: [epic_time_store_1.EpicTimeStore, agent_time_accounting_service_1.AgentTimeAccountingService, epic_time_service_1.EpicTimeService],
25
- exports: [epic_time_store_1.EpicTimeStore, agent_time_accounting_service_1.AgentTimeAccountingService, epic_time_service_1.EpicTimeService],
27
+ imports: [db_module_1.DbModule, events_core_module_1.EventsCoreModule, storage_module_1.StorageModule, external_integrations_module_1.ExternalIntegrationsModule],
28
+ controllers: [epic_time_controller_1.EpicTimeController, agent_time_buffer_controller_1.AgentTimeBufferController, external_estimate_log_controller_1.ExternalEstimateLogController],
29
+ providers: [
30
+ epic_time_store_1.EpicTimeStore,
31
+ agent_time_accounting_service_1.AgentTimeAccountingService,
32
+ epic_time_service_1.EpicTimeService,
33
+ epic_estimate_logging_service_1.EpicEstimateLoggingService,
34
+ ],
35
+ exports: [epic_time_store_1.EpicTimeStore, agent_time_accounting_service_1.AgentTimeAccountingService, epic_time_service_1.EpicTimeService, epic_estimate_logging_service_1.EpicEstimateLoggingService],
26
36
  })
27
37
  ], EpicTimeModule);
28
38
  //# sourceMappingURL=epic-time.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"epic-time.module.js","sourceRoot":"","sources":["../../../src/modules/epic-time/epic-time.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,uDAAmD;AACnD,qEAAgE;AAChE,4FAAsF;AACtF,gEAA2D;AAC3D,oEAA+D;AAC/D,6EAAwE;AAQjE,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAN1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,oBAAQ,EAAE,qCAAgB,CAAC;QACrC,WAAW,EAAE,CAAC,yCAAkB,CAAC;QACjC,SAAS,EAAE,CAAC,+BAAa,EAAE,0DAA0B,EAAE,mCAAe,CAAC;QACvE,OAAO,EAAE,CAAC,+BAAa,EAAE,0DAA0B,EAAE,mCAAe,CAAC;KACtE,CAAC;GACW,cAAc,CAAG"}
1
+ {"version":3,"file":"epic-time.module.js","sourceRoot":"","sources":["../../../src/modules/epic-time/epic-time.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,uDAAmD;AACnD,qEAAgE;AAChE,4FAAsF;AACtF,gEAA2D;AAC3D,oEAA+D;AAC/D,6FAAuF;AACvF,6EAAwE;AACxE,qGAA+F;AAC/F,8DAA0D;AAC1D,wGAAmG;AACnG,4FAAsF;AAa/E,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAX1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,oBAAQ,EAAE,qCAAgB,EAAE,8BAAa,EAAE,yDAA0B,CAAC;QAChF,WAAW,EAAE,CAAC,yCAAkB,EAAE,wDAAyB,EAAE,gEAA6B,CAAC;QAC3F,SAAS,EAAE;YACT,+BAAa;YACb,0DAA0B;YAC1B,mCAAe;YACf,0DAA0B;SAC3B;QACD,OAAO,EAAE,CAAC,+BAAa,EAAE,0DAA0B,EAAE,mCAAe,EAAE,0DAA0B,CAAC;KAClG,CAAC;GACW,cAAc,CAAG"}
@@ -0,0 +1,30 @@
1
+ import type { EpicTimeDailyTotal } from './epic-time.models';
2
+ export type EpicTimeDailyExportStatus = 'ok' | 'zone_rebind_required' | 'real_shrink' | 'stale_capture';
3
+ export interface EpicTimeDailyExportChunk {
4
+ activityDate: string;
5
+ startedAt: string;
6
+ durationMs: number;
7
+ minutes: number;
8
+ }
9
+ export interface EpicTimeDailyExportRebaseline {
10
+ required: boolean;
11
+ reason: 'zone_rebind' | 'dated_deficit' | null;
12
+ }
13
+ export interface EpicTimeDailyExportAllocation {
14
+ status: EpicTimeDailyExportStatus;
15
+ totalNewMinutes: number;
16
+ materializedCredit: EpicTimeDailyTotal[];
17
+ datedDeltas: EpicTimeDailyTotal[];
18
+ entryChunks: EpicTimeDailyExportChunk[];
19
+ rebaseline: EpicTimeDailyExportRebaseline;
20
+ safeZoneRebind: boolean;
21
+ }
22
+ export interface EpicTimeDailyExportAllocatorInput {
23
+ liveByDate: ReadonlyArray<EpicTimeDailyTotal>;
24
+ capturedByDate: ReadonlyArray<EpicTimeDailyTotal>;
25
+ ledgerByDate: ReadonlyArray<EpicTimeDailyTotal>;
26
+ unallocatedCreditMinutes: number;
27
+ storedCanonicalTimeZone: string | null;
28
+ currentCanonicalTimeZone: string;
29
+ }
30
+ export declare function allocateDailyEstimateExport(input: EpicTimeDailyExportAllocatorInput): EpicTimeDailyExportAllocation;