@wildo-ai/saas-backend-lib 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts +14 -3
  2. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  3. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +115 -22
  4. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  5. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts +3 -1
  6. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  7. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js +8 -3
  8. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  9. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts +11 -0
  10. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  11. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js +11 -2
  12. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js.map +1 -1
  13. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +1 -0
  14. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  15. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +6 -1
  16. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  17. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js +16 -0
  19. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js.map +1 -1
  20. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts +20 -6
  21. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  22. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +88 -32
  23. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  24. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts +3 -1
  25. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  26. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js +32 -7
  27. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js.map +1 -1
  28. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts +8 -5
  29. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  30. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.js.map +1 -1
  31. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +31 -0
  32. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +127 -5
  34. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  35. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts +71 -1
  36. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  37. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +62 -2
  38. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  39. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +21 -0
  40. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  41. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +126 -4
  42. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  43. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts +3 -26
  44. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  45. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js +3 -68
  46. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js.map +1 -1
  47. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  48. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +4 -2
  49. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  50. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +6 -6
  51. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  52. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +38 -0
  53. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  54. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +40 -0
  55. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  56. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +20 -0
  57. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  58. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +28 -0
  59. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  60. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +12 -0
  61. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -0
  62. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +118 -0
  63. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -0
  64. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  65. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +8 -5
  66. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  67. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  68. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +14 -0
  69. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  70. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  71. package/dist/esm/config/custom/application-config-controller.backend.service.js +7 -1
  72. package/dist/esm/config/custom/application-config-controller.backend.service.js.map +1 -1
  73. package/dist/esm/config/models/app-config.backend.schemas.d.ts +4 -0
  74. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  75. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +10 -1
  76. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  77. package/dist/esm/config/services/app-configuration.backend.utils.js +13 -2
  78. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  79. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts +2 -2
  80. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js +2 -2
  81. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js.map +1 -1
  82. package/dist/esm/databases/models/filter.backend.schemas.js +2 -2
  83. package/dist/esm/databases/models/filter.backend.schemas.js.map +1 -1
  84. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  85. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js +20 -1
  86. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js.map +1 -1
  87. package/dist/esm/databases/services/redis.service.d.ts +27 -0
  88. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  89. package/dist/esm/databases/services/redis.service.js +29 -0
  90. package/dist/esm/databases/services/redis.service.js.map +1 -1
  91. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  92. package/dist/esm/errors/services/error-handler.backend.service.js +5 -0
  93. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  94. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts +41 -0
  95. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -0
  96. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js +40 -0
  97. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js.map +1 -0
  98. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts +64 -0
  99. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -0
  100. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js +193 -0
  101. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js.map +1 -0
  102. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +13 -2
  103. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  104. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +8 -2
  105. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  106. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  107. package/dist/esm/external-data/external-data-transform.backend.js +7 -1
  108. package/dist/esm/external-data/external-data-transform.backend.js.map +1 -1
  109. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts +2 -0
  110. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  111. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js +13 -0
  112. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js.map +1 -1
  113. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +14 -0
  114. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  115. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +6 -0
  116. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  117. package/dist/esm/files/controllers/file.controller.d.ts +24 -1
  118. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  119. package/dist/esm/files/controllers/file.controller.js +66 -2
  120. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  121. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts +17 -0
  122. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -0
  123. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js +1 -0
  124. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -0
  125. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +5 -1
  126. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  127. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +42 -3
  128. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  129. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts +18 -0
  130. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  131. package/dist/esm/files/services/file-operation-handler.backend.service.js +36 -28
  132. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  133. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +163 -0
  134. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -0
  135. package/dist/esm/files/services/file-upload-grant.backend.service.js +442 -0
  136. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -0
  137. package/dist/esm/files/services/files.backend.service.d.ts +19 -0
  138. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  139. package/dist/esm/files/services/files.backend.service.js +78 -15
  140. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  141. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  142. package/dist/esm/files/utils/file-uploader.utils.js +12 -0
  143. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  144. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +5 -5
  145. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  146. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +79 -0
  147. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  148. package/dist/esm/flows-actors/services/agents.backend.service.js +319 -42
  149. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  150. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +151 -41
  151. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  152. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +300 -139
  153. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  154. package/dist/esm/index.d.ts +4 -1
  155. package/dist/esm/index.d.ts.map +1 -1
  156. package/dist/esm/index.js +14 -1
  157. package/dist/esm/index.js.map +1 -1
  158. package/dist/esm/inject/models/container.d.ts.map +1 -1
  159. package/dist/esm/inject/models/container.js +4 -0
  160. package/dist/esm/inject/models/container.js.map +1 -1
  161. package/dist/esm/inject/models/service-types.d.ts +3 -0
  162. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  163. package/dist/esm/inject/models/service-types.js +2 -0
  164. package/dist/esm/inject/models/service-types.js.map +1 -1
  165. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  166. package/dist/esm/mcp/controllers/mcp.controller.js +12 -4
  167. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  168. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts +34 -0
  169. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  170. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js +42 -0
  171. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  172. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +29 -1
  173. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  174. package/dist/esm/mcp/services/mcp-server.backend.service.js +131 -3
  175. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  176. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts +64 -2
  177. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  178. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +130 -6
  179. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  180. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +9 -0
  181. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  182. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +11 -36
  183. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  184. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  185. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +9 -7
  186. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  187. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts +5 -5
  188. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  189. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js +14 -13
  190. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js.map +1 -1
  191. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts +2 -1
  192. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  193. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +2 -2
  194. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  195. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  196. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +9 -7
  197. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  198. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  199. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js +4 -1
  200. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js.map +1 -1
  201. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  202. package/dist/esm/requests/service/websocket.service.js +56 -7
  203. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  204. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  205. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +2 -0
  206. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  207. package/dist/esm/resources/services/resource-id.backend.service.js +3 -3
  208. package/dist/esm/resources/services/resource-id.backend.service.js.map +1 -1
  209. package/dist/esm/resources/services/resources-registry.backend.service.js +1 -1
  210. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  211. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  212. package/dist/esm/runtime/services/execution-context-creator.backend.service.js +13 -7
  213. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  214. package/dist/esm/runtime/services/start-application.backend.service.d.ts +28 -0
  215. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  216. package/dist/esm/runtime/services/start-application.backend.service.js +82 -0
  217. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  218. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts +3 -23
  219. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  220. package/dist/esm/security/authentications/models/jwt.backend.schemas.js +20 -45
  221. package/dist/esm/security/authentications/models/jwt.backend.schemas.js.map +1 -1
  222. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts +9 -1
  223. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  224. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +9 -1
  225. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  226. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  227. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js +5 -3
  228. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js.map +1 -1
  229. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +25 -1
  230. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  231. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +55 -4
  232. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  233. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  234. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js +24 -1
  235. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js.map +1 -1
  236. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts +117 -0
  237. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -0
  238. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js +104 -0
  239. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js.map +1 -0
  240. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +101 -6
  241. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  242. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +210 -30
  243. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  244. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts +18 -1
  245. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  246. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js +110 -74
  247. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js.map +1 -1
  248. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts +22 -0
  249. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -0
  250. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js +22 -0
  251. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js.map +1 -0
  252. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts +17 -3
  253. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  254. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js +12 -0
  255. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js.map +1 -1
  256. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +20 -0
  257. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  258. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +58 -5
  259. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  260. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  261. package/dist/esm/security/jwt/services/jwt.backend.service.js +1 -18
  262. package/dist/esm/security/jwt/services/jwt.backend.service.js.map +1 -1
  263. package/dist/tsconfig.build.tsbuildinfo +1 -1
  264. package/package.json +15 -9
  265. package/dist/esm/.builder.pid +0 -9
@@ -27,11 +27,19 @@ import { BackendProviderRegistryBackendService } from '../../external-providers/
27
27
  import { PromptCompilerBackendService } from './prompt-compiler.backend.service.js';
28
28
  import { FlowsActors_Agent_Status, isImageAgentConfiguration, isCodingAgentConfiguration, PromptIR_TrustLevel, PromptIR_ContextSourceKind, ErrorType, ErrorCustomMessageReference, isWildoBackendError, AgentCallOutcome, AgentTraceabilityLevel, StructuredGenerationExecutionMode, } from '@wildo-ai/saas-models';
29
29
  import { MetaWorkflowStructuredGenerationPlanKind } from '@wildo-ai/saas-models/meta-workflows';
30
- import { APPLICATION_ENVIRONMENT, LLMProvider_ExecutionTransportKind, LLMProvider_ExecutionTransportMetadataSchema, LLMProvider_UsageSchema, LLMProvider_StructuredGenerationFailureKind, LLMProvider_StructuredGenerationFailureSchema, ExternalProvider_ExchangeProtocol_Kind, ExternalProvider_RateLimitConfigurationSchema, LLMProvider_OperationKey, LLMProvider_MessageRole, AgentClientProtocol_AuthMode, AgentClientProtocol_PermissionCeiling, AgentClientProtocol_WorkingDirectoryPolicy, agentClientProtocolPermissionCeilingRank, AgentClientProtocol_HostConfigurationInheritance, CodingAgent_UsageSchema, AgentClientProtocol_ExecutionTransportMetadataSchema, } from '@wildo-ai/external-connectors-models';
30
+ import { APPLICATION_ENVIRONMENT, LLMProvider_ExecutionTransportKind, LLMProvider_ExecutionTransportMetadataSchema, LLMProvider_UsageSchema, LLMProvider_StructuredGenerationFailureKind, LLMProvider_StructuredGenerationFailureSchema, ExternalProvider_ExchangeProtocol_Kind, ExternalProvider_RateLimitConfigurationSchema, LLMProvider_OperationKey, LLMProvider_MessageRole, AgentClientProtocol_AuthMode, AgentClientProtocol_PermissionCeiling, AgentClientProtocol_WorkingDirectoryPolicy, agentClientProtocolPermissionCeilingRank, AgentClientProtocol_HostConfigurationInheritance, CodingAgent_UsageSchema, AgentClientProtocol_ExecutionTransportMetadataSchema, CodingAgent_EndOfTurnClassification, CodingAgent_StopReason, } from '@wildo-ai/external-connectors-models';
31
31
  import { generateText, streamText, generateObject, generateImage, NoObjectGeneratedError, tool, stepCountIs } from 'ai';
32
- import { runACPCodingSession } from '../../flows-actors/utils/acp-session-runner.backend.utils.js';
32
+ import { startACPAgentSession, } from '../../flows-actors/utils/acp-session-runner.backend.utils.js';
33
33
  import { resolveTrustedWorkingDirectory } from '../../flows-actors/utils/bounded-subprocess.backend.utils.js';
34
34
  import { DEFAULT_MAX_STRUCTURED_DATA_FIELD_ALLOWED, planStructuredGenerationShape, } from '../../flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js';
35
+ /** The ladder phases a live coding session transitions through. */
36
+ export var CodingSessionLadderPhase;
37
+ (function (CodingSessionLadderPhase) {
38
+ /** A turn is executing. */
39
+ CodingSessionLadderPhase["RUNNING"] = "running";
40
+ /** The session parked on a question and is waiting for an operator answer. */
41
+ CodingSessionLadderPhase["AWAITING_INPUT"] = "awaiting_input";
42
+ })(CodingSessionLadderPhase || (CodingSessionLadderPhase = {}));
35
43
  /** True when an execution result carries a CODING transport rather than an LLM one. */
36
44
  function isAgentClientProtocolTransport(transport) {
37
45
  return transport?.protocolKind === ExternalProvider_ExchangeProtocol_Kind.AGENT_CLIENT_PROTOCOL;
@@ -586,7 +594,17 @@ let AgentsBackendService = class AgentsBackendService {
586
594
  ...(code ? { code } : {}),
587
595
  };
588
596
  }
589
- return { message: typeof error === 'string' ? error : 'Unknown agent invocation error' };
597
+ // A non-Error, non-string throw still carries information — a JSON-RPC error object, a refusal
598
+ // shape. Serialize it (bounded) rather than replacing it with a sentence that says nothing.
599
+ if (typeof error === 'string')
600
+ return { message: error };
601
+ try {
602
+ const serialized = JSON.stringify(error);
603
+ if (serialized && serialized !== '{}')
604
+ return { message: `Non-Error thrown: ${serialized.slice(0, 500)}` };
605
+ }
606
+ catch { /* circular or hostile — fall through to the sentinel */ }
607
+ return { message: 'Unknown agent invocation error' };
590
608
  }
591
609
  /**
592
610
  * Normalize executor outputs to the shared transport-neutral LLM contract.
@@ -1190,65 +1208,133 @@ let AgentsBackendService = class AgentsBackendService {
1190
1208
  const sessionMetaExtensions = this.resolveAgentClientProtocolSessionMeta(execution);
1191
1209
  return limiter.schedule({ id: jobId }, async () => {
1192
1210
  const env = this.buildAgentClientProtocolEnvironment(execution);
1193
- const sessionResult = await runACPCodingSession({
1211
+ // DELIVER the model, through the channel THIS agent's provider declares.
1212
+ //
1213
+ // Until 2026-09-03 `requestedModel` was checked against the transport's
1214
+ // declared set and written into the transport metadata — and never reached
1215
+ // the spawned agent, so under HOST_MANAGED auth every session ran at the
1216
+ // OPERATOR's personal default model (measured: Opus, during a 529-overload
1217
+ // storm the agent definitions' declared model would have avoided).
1218
+ //
1219
+ // The first fix wrote `ANTHROPIC_MODEL` unconditionally from this
1220
+ // agent-NEUTRAL service, which is correct for exactly one adapter and a
1221
+ // silent no-op for every other: the same false result, one agent later.
1222
+ // So the channel is declared by the provider that knows its agent, and a
1223
+ // provider that declares none cannot have a model selected at all —
1224
+ // refused here rather than started with the choice quietly dropped.
1225
+ const modelDelivery = acpProfile.modelDelivery;
1226
+ let modelSelection;
1227
+ if (modelDelivery?.channel === 'environment-variable') {
1228
+ env[modelDelivery.environmentVariableName] = requestedModel;
1229
+ }
1230
+ else if (modelDelivery?.channel === 'session-config-option') {
1231
+ // Set over ACP after the session opens; the runner fails the session if
1232
+ // the agent rejects it, before any prompt reaches the workspace.
1233
+ modelSelection = { configId: modelDelivery.configId, model: requestedModel };
1234
+ }
1235
+ else {
1236
+ throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {
1237
+ customMessageReference: ErrorCustomMessageReference.CONFIGURATION,
1238
+ context: {
1239
+ providerRef: execution.providerRef,
1240
+ executionProfileRef: execution.executionProfileRef,
1241
+ requestedModel,
1242
+ message: 'ACP provider declares no model-delivery channel, so the selected model cannot reach the '
1243
+ + 'agent and the session is refused rather than run at the agent\'s own default.',
1244
+ },
1245
+ });
1246
+ }
1247
+ // A run that ANSWERS a parked session resumes it by id via `session/load`
1248
+ // instead of starting a fresh task; the input's prompt is then the answer.
1249
+ const continuationOfSessionId = request.input
1250
+ ?.continuationOfSessionId;
1251
+ // (4) Open the live session, then drive it turn-by-turn.
1252
+ const agentSession = await startACPAgentSession({
1194
1253
  // The application may override how the agent is started, but normally
1195
1254
  // inherits it: the provider owns the package and its pinned version.
1196
1255
  command: acpExecutionProfile.command ?? acpProfile.agentCommand,
1197
1256
  args: acpExecutionProfile.command ? acpExecutionProfile.args : acpProfile.agentArgs,
1198
1257
  cwd: workingDirectory,
1199
1258
  env,
1200
- prompt,
1201
1259
  supportedProtocolVersions: acpProfile.supportedProtocolVersions,
1202
1260
  // The invocation may request LESS autonomy than the profile allows; it
1203
1261
  // can never request more. Clamped by rank rather than by trusting the
1204
1262
  // request, so an input carrying a higher ceiling is lowered, not obeyed.
1205
1263
  permissionCeiling: this.resolveEffectivePermissionCeiling(acpExecutionProfile, request),
1264
+ // Agent-vocabulary mode ids from the provider contract. Absent is fine —
1265
+ // the ceiling is enforced by answering permission requests, never by the
1266
+ // agent's mode — but a map hardcoded in the runner silently matched
1267
+ // nothing for any agent but the one it was written for.
1268
+ ...(acpProfile.sessionModeIdsByPermissionCeiling?.[this.resolveEffectivePermissionCeiling(acpExecutionProfile, request)]
1269
+ ? {
1270
+ preferredSessionModeIds: acpProfile.sessionModeIdsByPermissionCeiling[this.resolveEffectivePermissionCeiling(acpExecutionProfile, request)],
1271
+ }
1272
+ : {}),
1273
+ ...(modelSelection ? { modelSelection } : {}),
1206
1274
  ...(hostContext?.isPermittedCodingLocation
1207
1275
  ? { isPermittedLocation: hostContext.isPermittedCodingLocation }
1208
1276
  : {}),
1209
1277
  ...(sessionMetaExtensions ? { sessionMetaExtensions } : {}),
1210
- ...(acpExecutionProfile.turnTimeoutMs !== undefined ? { turnTimeoutMs: acpExecutionProfile.turnTimeoutMs } : {}),
1211
1278
  ...(acpExecutionProfile.maximumRecordedEventBytes !== undefined
1212
1279
  ? { maxRecordedEventBytes: acpExecutionProfile.maximumRecordedEventBytes }
1213
1280
  : {}),
1214
1281
  ...(hostContext?.onCodingSessionEvent ? { onEvent: hostContext.onCodingSessionEvent } : {}),
1215
- ...(hostContext?.codingSessionAbortSignal ? { abortSignal: hostContext.codingSessionAbortSignal } : {}),
1282
+ ...(continuationOfSessionId ? { resumeSessionId: continuationOfSessionId } : {}),
1216
1283
  });
1217
- // (4) Result normalisation into the published contract.
1218
- const output = {
1219
- finalMessage: sessionResult.finalMessage,
1220
- stopReason: sessionResult.stopReason,
1221
- ...(sessionResult.rawStopReason ? { rawStopReason: sessionResult.rawStopReason } : {}),
1222
- // Always emitted, including zero: absence would be indistinguishable
1223
- // from "no denials", and under the strictest ceiling that is exactly the
1224
- // distinction an operator needs.
1225
- deniedPermissionCount: sessionResult.deniedPermissionCount,
1226
- // Copied because the Zod-inferred output type is mutable while the runner's surface is
1227
- // readonly; the runner must not hand out a reference a consumer could edit.
1228
- permissionDecisions: sessionResult.permissionDecisions.map((decision) => ({
1229
- ...decision,
1230
- locations: [...decision.locations],
1231
- offeredOptionKinds: [...decision.offeredOptionKinds],
1232
- })),
1233
- ...(sessionResult.reportedFileLocations.length > 0
1234
- ? { reportedFileLocations: [...sessionResult.reportedFileLocations] }
1235
- : {}),
1236
- };
1237
- return {
1238
- output,
1239
- transport: {
1240
- protocolKind: ExternalProvider_ExchangeProtocol_Kind.AGENT_CLIENT_PROTOCOL,
1241
- providerRef: execution.providerRef,
1242
- executionProfileRef: execution.executionProfileRef,
1243
- model: requestedModel,
1244
- negotiatedProtocolVersion: sessionResult.negotiatedProtocolVersion,
1245
- ...(sessionResult.agentName ? { agentName: sessionResult.agentName } : {}),
1246
- ...(sessionResult.agentVersion ? { agentVersion: sessionResult.agentVersion } : {}),
1247
- ...(sessionResult.sessionModeId ? { sessionModeId: sessionResult.sessionModeId } : {}),
1248
- sessionId: sessionResult.sessionId,
1249
- },
1250
- ...(sessionResult.usage ? { usage: sessionResult.usage } : {}),
1251
- };
1284
+ try {
1285
+ const ladder = await this.driveCodingTurnLadder({
1286
+ session: agentSession,
1287
+ firstPrompt: prompt,
1288
+ maxAutoContinuations: acpExecutionProfile.maxAutoContinuations,
1289
+ awaitingInputTtlMs: acpExecutionProfile.awaitingInputTtlMs,
1290
+ ...(acpExecutionProfile.turnTimeoutMs !== undefined ? { turnTimeoutMs: acpExecutionProfile.turnTimeoutMs } : {}),
1291
+ ...(hostContext?.codingSessionAbortSignal ? { abortSignal: hostContext.codingSessionAbortSignal } : {}),
1292
+ ...(hostContext?.classifyCodingTurnEnd ? { classify: hostContext.classifyCodingTurnEnd } : {}),
1293
+ ...(hostContext?.onCodingSessionStateChange ? { onStateChange: hostContext.onCodingSessionStateChange } : {}),
1294
+ });
1295
+ // (5) Result normalisation into the published contract.
1296
+ const output = {
1297
+ finalMessage: ladder.finalMessage,
1298
+ stopReason: ladder.stopReason,
1299
+ ...(ladder.rawStopReason ? { rawStopReason: ladder.rawStopReason } : {}),
1300
+ // Always emitted, including zero: absence would be indistinguishable
1301
+ // from "no denials", and under the strictest ceiling that is exactly the
1302
+ // distinction an operator needs.
1303
+ deniedPermissionCount: ladder.deniedPermissionCount,
1304
+ permissionDecisions: ladder.permissionDecisions,
1305
+ ...(ladder.reportedFileLocations.length > 0
1306
+ ? { reportedFileLocations: ladder.reportedFileLocations }
1307
+ : {}),
1308
+ // Absent means one turn — the single-turn shape every pre-ladder
1309
+ // consumer already assumes.
1310
+ ...(ladder.turnCount > 1 ? { turnCount: ladder.turnCount } : {}),
1311
+ ...(ladder.continuations.length > 0 ? { continuations: ladder.continuations } : {}),
1312
+ // Present ONLY when the run parked on a question — the field that stops
1313
+ // a suspended turn being read as a completed result.
1314
+ ...(ladder.suspension ? { suspension: ladder.suspension } : {}),
1315
+ };
1316
+ return {
1317
+ output,
1318
+ transport: {
1319
+ protocolKind: ExternalProvider_ExchangeProtocol_Kind.AGENT_CLIENT_PROTOCOL,
1320
+ providerRef: execution.providerRef,
1321
+ executionProfileRef: execution.executionProfileRef,
1322
+ model: requestedModel,
1323
+ negotiatedProtocolVersion: agentSession.negotiatedProtocolVersion,
1324
+ ...(agentSession.agentName ? { agentName: agentSession.agentName } : {}),
1325
+ ...(agentSession.agentVersion ? { agentVersion: agentSession.agentVersion } : {}),
1326
+ ...(agentSession.sessionModeId ? { sessionModeId: agentSession.sessionModeId } : {}),
1327
+ sessionId: agentSession.sessionId,
1328
+ },
1329
+ ...(ladder.usage ? { usage: ladder.usage } : {}),
1330
+ };
1331
+ }
1332
+ finally {
1333
+ // Closes on completion AND on park: a parked session is answered by a
1334
+ // fresh invocation that resumes it via `session/load`, never by holding
1335
+ // this child alive across the HTTP call that returned the question.
1336
+ agentSession.close();
1337
+ }
1252
1338
  });
1253
1339
  }
1254
1340
  extractCLITextOutput(output) {
@@ -1504,6 +1590,197 @@ let AgentsBackendService = class AgentsBackendService {
1504
1590
  * adapter translates the abort into the TIMEOUT failure kind the retry policy already understands.
1505
1591
  */
1506
1592
  static STRUCTURED_GENERATION_DEADLINE_MS = 900_000;
1593
+ /**
1594
+ * The one prompt sent to auto-continue a coding agent past a self-imposed
1595
+ * pause. Named here rather than improvised at the call site so a run's
1596
+ * continuations are all identical and auditable, and so the wording — which
1597
+ * tells the agent to keep working AND to stop only when genuinely done or
1598
+ * genuinely blocked — lives in exactly one place.
1599
+ */
1600
+ static CODING_AUTO_CONTINUE_PROMPT = 'Continue with the task. Do not stop to ask whether to proceed — keep going until the task is '
1601
+ + 'genuinely complete. Only stop if you have finished, or if you need a decision or input that '
1602
+ + 'only the operator can provide, in which case state the specific question plainly.';
1603
+ /** Characters of an end-of-turn message kept on a continuation record for audit. */
1604
+ static CONTINUATION_MESSAGE_TAIL_CHARS = 500;
1605
+ /**
1606
+ * Drive a coding session turn-by-turn: continue a self-imposed pause, park a
1607
+ * genuine question, settle on completion — bounded by the profile's
1608
+ * continuation budget.
1609
+ *
1610
+ * The MECHANISM lives here; the JUDGMENT (`classify`) is the host's. The whole
1611
+ * loop fails toward settlement: any terminal stop reason, an exhausted budget,
1612
+ * or a classifier that is absent or throws all end the run with what the agent
1613
+ * has produced rather than hanging. A `NEEDS_INPUT` classification is the only
1614
+ * path that returns a `suspension`, and the caller must not read that as a
1615
+ * completed result.
1616
+ */
1617
+ async driveCodingTurnLadder(params) {
1618
+ const { session } = params;
1619
+ const reportedFileLocations = [];
1620
+ // Copied into the OUTPUT's mutable element shape here: the runner hands out
1621
+ // readonly records, and the published contract's field is mutable.
1622
+ const permissionDecisions = [];
1623
+ const continuations = [];
1624
+ let usage;
1625
+ let deniedPermissionCount = 0;
1626
+ let turnIndex = 0;
1627
+ let autoContinuesUsed = 0;
1628
+ let prompt = params.firstPrompt;
1629
+ const emitState = (state) => {
1630
+ try {
1631
+ params.onStateChange?.(state);
1632
+ }
1633
+ catch {
1634
+ // A live-relay sink must never fail the run it observes.
1635
+ }
1636
+ };
1637
+ // eslint-disable-next-line no-constant-condition
1638
+ while (true) {
1639
+ turnIndex += 1;
1640
+ emitState({ phase: CodingSessionLadderPhase.RUNNING, turnIndex });
1641
+ const turn = await session.promptTurn(prompt, {
1642
+ ...(params.turnTimeoutMs !== undefined ? { turnTimeoutMs: params.turnTimeoutMs } : {}),
1643
+ ...(params.abortSignal ? { abortSignal: params.abortSignal } : {}),
1644
+ });
1645
+ // Aggregate every turn's evidence, whatever the ladder decides next.
1646
+ for (const path of turn.reportedFileLocations) {
1647
+ if (!reportedFileLocations.includes(path))
1648
+ reportedFileLocations.push(path);
1649
+ }
1650
+ for (const decision of turn.permissionDecisions) {
1651
+ permissionDecisions.push({
1652
+ ...decision,
1653
+ locations: [...decision.locations],
1654
+ offeredOptionKinds: [...decision.offeredOptionKinds],
1655
+ });
1656
+ }
1657
+ deniedPermissionCount += turn.deniedPermissionCount;
1658
+ usage = this.mergeCodingUsage(usage, turn.usage);
1659
+ const settle = (suspension) => ({
1660
+ finalMessage: turn.finalMessage,
1661
+ stopReason: turn.stopReason,
1662
+ ...(turn.rawStopReason ? { rawStopReason: turn.rawStopReason } : {}),
1663
+ usage,
1664
+ reportedFileLocations,
1665
+ deniedPermissionCount,
1666
+ permissionDecisions,
1667
+ turnCount: turnIndex,
1668
+ continuations,
1669
+ ...(suspension ? { suspension } : {}),
1670
+ });
1671
+ // A non-voluntary stop (cancelled, max_tokens, refusal, or a reason this
1672
+ // version does not recognise) is terminal: there is nothing to continue.
1673
+ if (turn.stopReason !== CodingAgent_StopReason.END_TURN) {
1674
+ return settle();
1675
+ }
1676
+ // END_TURN: decide what it meant. No classifier → treat as complete AND
1677
+ // record nothing (the pre-ladder behaviour, preserved for every caller
1678
+ // that supplies none — a plain single turn carries no continuations).
1679
+ if (!params.classify) {
1680
+ return settle();
1681
+ }
1682
+ const classification = await this.classifyCodingTurnEndSafely(params.classify, turn.finalMessage, turnIndex);
1683
+ // A boundary is recorded only when the classifier was actually consulted,
1684
+ // so `continuations` is the audit trail of judgments, never a per-run
1685
+ // artefact that pollutes the single-turn shape.
1686
+ continuations.push({
1687
+ turnIndex,
1688
+ classification,
1689
+ agentMessageTail: turn.finalMessage.slice(-AgentsBackendService_1.CONTINUATION_MESSAGE_TAIL_CHARS),
1690
+ });
1691
+ if (classification === CodingAgent_EndOfTurnClassification.NEEDS_INPUT) {
1692
+ const suspension = {
1693
+ sessionId: session.sessionId,
1694
+ question: turn.finalMessage,
1695
+ turnIndex,
1696
+ // Answerable across the child's death only if the agent persists sessions.
1697
+ resumable: session.capabilities.loadSession,
1698
+ parkedUntil: new Date(Date.now() + params.awaitingInputTtlMs).toISOString(),
1699
+ };
1700
+ emitState({ phase: CodingSessionLadderPhase.AWAITING_INPUT, turnIndex, question: turn.finalMessage });
1701
+ return settle(suspension);
1702
+ }
1703
+ const isSelfPause = classification === CodingAgent_EndOfTurnClassification.SELF_PAUSE;
1704
+ if (!isSelfPause || autoContinuesUsed >= params.maxAutoContinuations) {
1705
+ // TASK_COMPLETE, CLASSIFIER_UNAVAILABLE, or a self-pause past the budget:
1706
+ // settle with what the agent last produced.
1707
+ return settle();
1708
+ }
1709
+ autoContinuesUsed += 1;
1710
+ prompt = AgentsBackendService_1.CODING_AUTO_CONTINUE_PROMPT;
1711
+ }
1712
+ }
1713
+ /**
1714
+ * Run the host's end-of-turn classifier, mapping every failure to
1715
+ * `CLASSIFIER_UNAVAILABLE` so the ladder can settle rather than hang.
1716
+ *
1717
+ * The whole point of a separate method: the fail-open contract is one place,
1718
+ * and an unexpected classifier value (a host returning a string outside the
1719
+ * enum) degrades the same way a throw does.
1720
+ */
1721
+ async classifyCodingTurnEndSafely(classify, finalMessage, turnIndex) {
1722
+ try {
1723
+ const result = await classify({ finalMessage, turnIndex });
1724
+ if (Object.values(CodingAgent_EndOfTurnClassification).includes(result)) {
1725
+ return result;
1726
+ }
1727
+ this.logger.warn('Coding turn-end classifier returned an unrecognised value; treating the turn as complete', {
1728
+ turnIndex,
1729
+ received: String(result),
1730
+ });
1731
+ return CodingAgent_EndOfTurnClassification.CLASSIFIER_UNAVAILABLE;
1732
+ }
1733
+ catch (error) {
1734
+ // Fail OPEN. An auxiliary judgment must never make the autonomous lane hang
1735
+ // or discard a mutated workspace; the failure is recorded, not laundered.
1736
+ this.logger.warn('Coding turn-end classifier failed; treating the turn as complete', {
1737
+ turnIndex,
1738
+ // A WildoBackendError does not pass `instanceof Error`, and String() on it is
1739
+ // "[object Object]" — which is exactly what this warn printed while the classifier was
1740
+ // refusing every call over a missing config bound (2026-09-04). Bounded JSON names it.
1741
+ error: error instanceof Error
1742
+ ? error.message
1743
+ : (() => { try {
1744
+ return JSON.stringify(error)?.slice(0, 600) ?? String(error);
1745
+ }
1746
+ catch {
1747
+ return String(error);
1748
+ } })(),
1749
+ });
1750
+ return CodingAgent_EndOfTurnClassification.CLASSIFIER_UNAVAILABLE;
1751
+ }
1752
+ }
1753
+ /**
1754
+ * Combine per-turn usage into a session total: token counts and cost SUM
1755
+ * across turns; the context-window pair is a snapshot, so the latest turn's
1756
+ * value wins. Absence stays absence — a field nobody reported must not read as
1757
+ * zero, per the usage contract.
1758
+ */
1759
+ mergeCodingUsage(accumulated, turn) {
1760
+ if (!turn)
1761
+ return accumulated;
1762
+ if (!accumulated)
1763
+ return turn;
1764
+ const merged = { ...accumulated };
1765
+ for (const key of ['inputTokens', 'outputTokens', 'cachedReadTokens', 'cachedWriteTokens', 'totalTokens']) {
1766
+ const a = accumulated[key];
1767
+ const b = turn[key];
1768
+ if (a !== undefined || b !== undefined)
1769
+ merged[key] = (a ?? 0) + (b ?? 0);
1770
+ }
1771
+ // The context window is a level, not a flow: the newest reading is current.
1772
+ if (turn.contextUsed !== undefined)
1773
+ merged.contextUsed = turn.contextUsed;
1774
+ if (turn.contextWindowSize !== undefined)
1775
+ merged.contextWindowSize = turn.contextWindowSize;
1776
+ if (turn.cost || accumulated.cost) {
1777
+ merged.cost = {
1778
+ amount: (accumulated.cost?.amount ?? 0) + (turn.cost?.amount ?? 0),
1779
+ currency: turn.cost?.currency ?? accumulated.cost?.currency ?? 'USD',
1780
+ };
1781
+ }
1782
+ return merged;
1783
+ }
1507
1784
  buildBaseOptions(config) {
1508
1785
  const baseOptions = {
1509
1786
  temperature: config.temperature,