@shipfox/api-workflows 12.7.0 → 13.1.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 (122) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/CHANGELOG.md +24 -0
  3. package/dist/core/errors.d.ts +9 -1
  4. package/dist/core/errors.d.ts.map +1 -1
  5. package/dist/core/errors.js +5 -1
  6. package/dist/core/errors.js.map +1 -1
  7. package/dist/core/job-execution.d.ts.map +1 -1
  8. package/dist/core/job-execution.js +12 -2
  9. package/dist/core/job-execution.js.map +1 -1
  10. package/dist/core/step-config/agent.d.ts.map +1 -1
  11. package/dist/core/step-config/agent.js +9 -1
  12. package/dist/core/step-config/agent.js.map +1 -1
  13. package/dist/db/index.d.ts +1 -1
  14. package/dist/db/index.d.ts.map +1 -1
  15. package/dist/db/index.js +1 -1
  16. package/dist/db/index.js.map +1 -1
  17. package/dist/db/job-listeners.d.ts.map +1 -1
  18. package/dist/db/job-listeners.js +17 -1
  19. package/dist/db/job-listeners.js.map +1 -1
  20. package/dist/db/workflow-runs/job-executions.d.ts +2 -3
  21. package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
  22. package/dist/db/workflow-runs/job-executions.js +48 -20
  23. package/dist/db/workflow-runs/job-executions.js.map +1 -1
  24. package/dist/db/workflow-runs/outbox.d.ts +15 -0
  25. package/dist/db/workflow-runs/outbox.d.ts.map +1 -1
  26. package/dist/db/workflow-runs/outbox.js +35 -1
  27. package/dist/db/workflow-runs/outbox.js.map +1 -1
  28. package/dist/db/workflow-runs/run-graph.d.ts.map +1 -1
  29. package/dist/db/workflow-runs/run-graph.js +12 -0
  30. package/dist/db/workflow-runs/run-graph.js.map +1 -1
  31. package/dist/db/workflow-runs/run-status.d.ts.map +1 -1
  32. package/dist/db/workflow-runs/run-status.js +13 -1
  33. package/dist/db/workflow-runs/run-status.js.map +1 -1
  34. package/dist/db/workflow-runs.d.ts +2 -2
  35. package/dist/db/workflow-runs.d.ts.map +1 -1
  36. package/dist/db/workflow-runs.js +2 -2
  37. package/dist/db/workflow-runs.js.map +1 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +2 -4
  40. package/dist/index.js.map +1 -1
  41. package/dist/presentation/dto/step.d.ts.map +1 -1
  42. package/dist/presentation/dto/step.js +14 -0
  43. package/dist/presentation/dto/step.js.map +1 -1
  44. package/dist/presentation/index.d.ts +1 -1
  45. package/dist/presentation/index.d.ts.map +1 -1
  46. package/dist/presentation/index.js +1 -1
  47. package/dist/presentation/index.js.map +1 -1
  48. package/dist/presentation/routes/agent-runtime-config.d.ts.map +1 -1
  49. package/dist/presentation/routes/agent-runtime-config.js +22 -0
  50. package/dist/presentation/routes/agent-runtime-config.js.map +1 -1
  51. package/dist/presentation/subscribers/index.d.ts +0 -1
  52. package/dist/presentation/subscribers/index.d.ts.map +1 -1
  53. package/dist/presentation/subscribers/index.js +0 -1
  54. package/dist/presentation/subscribers/index.js.map +1 -1
  55. package/dist/temporal/activities/index.d.ts +2 -18
  56. package/dist/temporal/activities/index.d.ts.map +1 -1
  57. package/dist/temporal/activities/index.js +3 -5
  58. package/dist/temporal/activities/index.js.map +1 -1
  59. package/dist/temporal/activities/orchestration-activities.d.ts +5 -14
  60. package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
  61. package/dist/temporal/activities/orchestration-activities.js +13 -34
  62. package/dist/temporal/activities/orchestration-activities.js.map +1 -1
  63. package/dist/temporal/workflows/index.bundle.js +20 -68
  64. package/dist/temporal/workflows/job-execution-orchestration.d.ts +0 -3
  65. package/dist/temporal/workflows/job-execution-orchestration.d.ts.map +1 -1
  66. package/dist/temporal/workflows/job-execution-orchestration.js +17 -41
  67. package/dist/temporal/workflows/job-execution-orchestration.js.map +1 -1
  68. package/dist/temporal/workflows/job-listener-orchestration.d.ts +0 -3
  69. package/dist/temporal/workflows/job-listener-orchestration.d.ts.map +1 -1
  70. package/dist/temporal/workflows/job-listener-orchestration.js +1 -9
  71. package/dist/temporal/workflows/job-listener-orchestration.js.map +1 -1
  72. package/dist/temporal/workflows/run-orchestration.d.ts.map +1 -1
  73. package/dist/temporal/workflows/run-orchestration.js +2 -18
  74. package/dist/temporal/workflows/run-orchestration.js.map +1 -1
  75. package/dist/temporal/workflows/test-env.d.ts +4 -6
  76. package/dist/temporal/workflows/test-env.d.ts.map +1 -1
  77. package/dist/temporal/workflows/test-env.js +13 -24
  78. package/dist/temporal/workflows/test-env.js.map +1 -1
  79. package/dist/tsconfig.test.tsbuildinfo +1 -1
  80. package/package.json +4 -4
  81. package/src/core/errors.ts +17 -2
  82. package/src/core/job-execution.test.ts +54 -0
  83. package/src/core/job-execution.ts +6 -1
  84. package/src/core/step-config/agent.ts +8 -1
  85. package/src/core/step-config/complete-step-dispatch-config.test.ts +37 -0
  86. package/src/db/index.ts +1 -1
  87. package/src/db/job-listeners.test.ts +21 -0
  88. package/src/db/job-listeners.ts +18 -0
  89. package/src/db/workflow-runs/job-executions.test.ts +110 -12
  90. package/src/db/workflow-runs/job-executions.ts +54 -29
  91. package/src/db/workflow-runs/outbox.ts +63 -0
  92. package/src/db/workflow-runs/run-graph.ts +17 -0
  93. package/src/db/workflow-runs/run-status.test.ts +13 -0
  94. package/src/db/workflow-runs/run-status.ts +15 -1
  95. package/src/db/workflow-runs.ts +3 -1
  96. package/src/index.ts +1 -5
  97. package/src/presentation/dto/step.test.ts +8 -0
  98. package/src/presentation/dto/step.ts +9 -0
  99. package/src/presentation/index.ts +0 -1
  100. package/src/presentation/routes/agent-runtime-config.test.ts +84 -2
  101. package/src/presentation/routes/agent-runtime-config.ts +24 -0
  102. package/src/presentation/subscribers/index.ts +0 -1
  103. package/src/temporal/activities/index.ts +2 -8
  104. package/src/temporal/activities/orchestration-activities.test.ts +17 -1
  105. package/src/temporal/activities/orchestration-activities.ts +13 -46
  106. package/src/temporal/workflows/job-execution-orchestration.test.ts +6 -25
  107. package/src/temporal/workflows/job-execution-orchestration.ts +17 -43
  108. package/src/temporal/workflows/job-listener-orchestration-continuation.test.ts +0 -3
  109. package/src/temporal/workflows/job-listener-orchestration.test.ts +9 -12
  110. package/src/temporal/workflows/job-listener-orchestration.ts +0 -8
  111. package/src/temporal/workflows/run-orchestration.test.ts +22 -33
  112. package/src/temporal/workflows/run-orchestration.ts +4 -28
  113. package/src/temporal/workflows/test-env.ts +14 -34
  114. package/test/fixtures/runners-inter-module.ts +0 -3
  115. package/test/helpers/workflow-runs.ts +25 -0
  116. package/tsconfig.build.tsbuildinfo +1 -1
  117. package/dist/presentation/subscribers/on-runner-job-queued.d.ts +0 -3
  118. package/dist/presentation/subscribers/on-runner-job-queued.d.ts.map +0 -1
  119. package/dist/presentation/subscribers/on-runner-job-queued.js +0 -20
  120. package/dist/presentation/subscribers/on-runner-job-queued.js.map +0 -1
  121. package/src/presentation/subscribers/on-runner-job-queued.test.ts +0 -57
  122. package/src/presentation/subscribers/on-runner-job-queued.ts +0 -23
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,uCAAuC,CAAC;AACxF,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAOjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAWpF,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAC,KAAK,aAA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C;IAC/B,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAClC,UAAU,EAAE,2BAA2B,CAAC;CACzC,GAAG,aAAa,CAmDhB"}
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { dirname, resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
- import { RUNNER_JOB_CLAIMED, RUNNER_JOB_LEASE_EXPIRED, RUNNER_JOB_QUEUED } from '@shipfox/api-runners-dto';
3
+ import { RUNNER_JOB_CLAIMED, RUNNER_JOB_LEASE_EXPIRED } from '@shipfox/api-runners-dto';
4
4
  import { WORKFLOWS_JOB_EVENT_DELIVERED, WORKFLOWS_JOB_STEPS_SETTLED, WORKFLOWS_JOB_TERMINATED, WORKFLOWS_STEP_ATTEMPT_TERMINATED, WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, WORKFLOWS_WORKFLOW_RUN_CANCELLED, workflowsEventSchemas } from '@shipfox/api-workflows-dto';
5
5
  import { subscriberFactory } from '@shipfox/node-module';
6
6
  import { db, migrationsPath, workflowsOutbox } from '#db/index.js';
7
7
  import { registerWorkflowsServiceMetrics } from '#metrics/index.js';
8
- import { createWorkflowRoutes, onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from '#presentation/index.js';
8
+ import { createWorkflowRoutes, onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from '#presentation/index.js';
9
9
  import { createWorkflowsInterModulePresentation } from '#presentation/inter-module.js';
10
10
  import { createOrchestrationActivities, WORKFLOWS_TASK_QUEUE } from '#temporal/index.js';
11
11
  export { DefinitionNotFoundError, InterpolationUnresolvableError, isPermanentRunWorkflowError, ProjectMismatchError, runWorkflow, WorkflowRunNotCancellableError } from '#core/index.js';
@@ -49,7 +49,6 @@ export function createWorkflowsModule({ agent, definitions, annotations, auth, i
49
49
  subscriber(WORKFLOWS_STEP_ATTEMPT_TERMINATED, onStepAttemptTerminatedFailureAnnotation(annotations)),
50
50
  subscriber(WORKFLOWS_JOB_TERMINATED, onJobTerminatedFailureAnnotation(annotations)),
51
51
  subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),
52
- subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),
53
52
  subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed)
54
53
  ],
55
54
  workers: [
@@ -60,7 +59,6 @@ export function createWorkflowsModule({ agent, definitions, annotations, auth, i
60
59
  agent,
61
60
  integrations,
62
61
  projects,
63
- runners,
64
62
  secrets
65
63
  }),
66
64
  workflows: []
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {\n RUNNER_JOB_CLAIMED,\n RUNNER_JOB_LEASE_EXPIRED,\n RUNNER_JOB_QUEUED,\n type RunnersEventMap,\n} from '@shipfox/api-runners-dto';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n WORKFLOWS_JOB_EVENT_DELIVERED,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_JOB_TERMINATED,\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED,\n WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n type WorkflowsEventMapDto,\n workflowsEventSchemas,\n} from '@shipfox/api-workflows-dto';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, workflowsOutbox} from '#db/index.js';\nimport {registerWorkflowsServiceMetrics} from '#metrics/index.js';\nimport {\n createWorkflowRoutes,\n onJobEventDelivered,\n onJobStepsSettled,\n onJobTerminatedFailureAnnotation,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onStepAttemptTerminatedFailureAnnotation,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from '#presentation/index.js';\nimport {createWorkflowsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createOrchestrationActivities, WORKFLOWS_TASK_QUEUE} from '#temporal/index.js';\n\nexport type {\n Job,\n JobListenerEvent,\n JobListenerEventDisposition,\n RunWorkflowParams,\n Step,\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/index.js';\nexport {\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n ProjectMismatchError,\n runWorkflow,\n WorkflowRunNotCancellableError,\n} from '#core/index.js';\nexport {\n closeDb,\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n db,\n deliverEventToListener,\n getStepById,\n getStepByIdForJobExecution,\n migrationsPath,\n workflowsOutbox,\n} from '#db/index.js';\nexport {loadRunningLeasedStep} from '#presentation/routes/leased-step.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst workflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<WorkflowsEventMapDto & RunnersEventMap>();\n\nexport function createWorkflowsModule({\n agent,\n definitions,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n}: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n}): ShipfoxModule {\n return {\n name: 'workflows',\n database: {db, migrationsPath, databaseNamespace: 'workflows'},\n routes: createWorkflowRoutes({\n agent,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n metrics: registerWorkflowsServiceMetrics,\n publishers: [\n {name: 'workflows', table: workflowsOutbox, db, eventSchemas: workflowsEventSchemas},\n ],\n subscribers: [\n subscriber(WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, onWorkflowRunAttemptCreated),\n subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),\n subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),\n subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),\n subscriber(\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n onStepAttemptTerminatedFailureAnnotation(annotations),\n ),\n subscriber(WORKFLOWS_JOB_TERMINATED, onJobTerminatedFailureAnnotation(annotations)),\n subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),\n subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),\n subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed),\n ],\n workers: [\n {\n taskQueue: WORKFLOWS_TASK_QUEUE,\n workflowsPath,\n activities: () =>\n createOrchestrationActivities({agent, integrations, projects, runners, secrets}),\n workflows: [],\n },\n ],\n interModulePresentations: [\n createWorkflowsInterModulePresentation({\n agent,\n definitions,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","RUNNER_JOB_CLAIMED","RUNNER_JOB_LEASE_EXPIRED","RUNNER_JOB_QUEUED","WORKFLOWS_JOB_EVENT_DELIVERED","WORKFLOWS_JOB_STEPS_SETTLED","WORKFLOWS_JOB_TERMINATED","WORKFLOWS_STEP_ATTEMPT_TERMINATED","WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED","WORKFLOWS_WORKFLOW_RUN_CANCELLED","workflowsEventSchemas","subscriberFactory","db","migrationsPath","workflowsOutbox","registerWorkflowsServiceMetrics","createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onJobTerminatedFailureAnnotation","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onStepAttemptTerminatedFailureAnnotation","onWorkflowRunAttemptCreated","onWorkflowRunCancelled","createWorkflowsInterModulePresentation","createOrchestrationActivities","WORKFLOWS_TASK_QUEUE","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","ProjectMismatchError","runWorkflow","WorkflowRunNotCancellableError","closeDb","deliverEventToListener","getStepById","getStepByIdForJobExecution","loadRunningLeasedStep","packageRoot","url","workflowsPath","subscriber","createWorkflowsModule","agent","definitions","annotations","auth","integrations","projects","runners","secrets","workspaces","name","database","databaseNamespace","routes","metrics","publishers","table","eventSchemas","subscribers","workers","taskQueue","activities","workflows","interModulePresentations"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAOvC,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,iBAAiB,QAEZ,2BAA2B;AAGlC,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,wBAAwB,EACxBC,iCAAiC,EACjCC,sCAAsC,EACtCC,gCAAgC,EAEhCC,qBAAqB,QAChB,6BAA6B;AAEpC,SAA4BC,iBAAiB,QAA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AC7CkB,WAAWvC,+BAA+Ba;YAC1C0B,WAAWtC,6BAA6Ba;YACxCyB,WACEpC,mCACAgB,yCAAyCwB;YAE3CJ,WAAWrC,0BAA0Ba,iCAAiC4B;YACtEJ,WAAWzC,0BAA0BmB;YACrCsB,WAAWxC,mBAAmBmB;YAC9BqB,WAAW1C,oBAAoBmB;SAChC;QACD2C,SAAS;YACP;gBACEC,WAAWpC;gBACXc;gBACAuB,YAAY,IACVtC,8BAA8B;wBAACkB;wBAAOI;wBAAcC;wBAAUC;wBAASC;oBAAO;gBAChFc,WAAW,EAAE;YACf;SACD;QACDC,0BAA0B;YACxBzC,uCAAuC;gBACrCmB;gBACAC;gBACAG;gBACAC;gBACAC;gBACAC;gBACAC;YACF;SACD;IACH;AACF"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {\n RUNNER_JOB_CLAIMED,\n RUNNER_JOB_LEASE_EXPIRED,\n type RunnersEventMap,\n} from '@shipfox/api-runners-dto';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n WORKFLOWS_JOB_EVENT_DELIVERED,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_JOB_TERMINATED,\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED,\n WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n type WorkflowsEventMapDto,\n workflowsEventSchemas,\n} from '@shipfox/api-workflows-dto';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, workflowsOutbox} from '#db/index.js';\nimport {registerWorkflowsServiceMetrics} from '#metrics/index.js';\nimport {\n createWorkflowRoutes,\n onJobEventDelivered,\n onJobStepsSettled,\n onJobTerminatedFailureAnnotation,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onStepAttemptTerminatedFailureAnnotation,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from '#presentation/index.js';\nimport {createWorkflowsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createOrchestrationActivities, WORKFLOWS_TASK_QUEUE} from '#temporal/index.js';\n\nexport type {\n Job,\n JobListenerEvent,\n JobListenerEventDisposition,\n RunWorkflowParams,\n Step,\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/index.js';\nexport {\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n ProjectMismatchError,\n runWorkflow,\n WorkflowRunNotCancellableError,\n} from '#core/index.js';\nexport {\n closeDb,\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n db,\n deliverEventToListener,\n getStepById,\n getStepByIdForJobExecution,\n migrationsPath,\n workflowsOutbox,\n} from '#db/index.js';\nexport {loadRunningLeasedStep} from '#presentation/routes/leased-step.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst workflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<WorkflowsEventMapDto & RunnersEventMap>();\n\nexport function createWorkflowsModule({\n agent,\n definitions,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n}: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n}): ShipfoxModule {\n return {\n name: 'workflows',\n database: {db, migrationsPath, databaseNamespace: 'workflows'},\n routes: createWorkflowRoutes({\n agent,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n metrics: registerWorkflowsServiceMetrics,\n publishers: [\n {name: 'workflows', table: workflowsOutbox, db, eventSchemas: workflowsEventSchemas},\n ],\n subscribers: [\n subscriber(WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, onWorkflowRunAttemptCreated),\n subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),\n subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),\n subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),\n subscriber(\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n onStepAttemptTerminatedFailureAnnotation(annotations),\n ),\n subscriber(WORKFLOWS_JOB_TERMINATED, onJobTerminatedFailureAnnotation(annotations)),\n subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),\n subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed),\n ],\n workers: [\n {\n taskQueue: WORKFLOWS_TASK_QUEUE,\n workflowsPath,\n activities: () => createOrchestrationActivities({agent, integrations, projects, secrets}),\n workflows: [],\n },\n ],\n interModulePresentations: [\n createWorkflowsInterModulePresentation({\n agent,\n definitions,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","RUNNER_JOB_CLAIMED","RUNNER_JOB_LEASE_EXPIRED","WORKFLOWS_JOB_EVENT_DELIVERED","WORKFLOWS_JOB_STEPS_SETTLED","WORKFLOWS_JOB_TERMINATED","WORKFLOWS_STEP_ATTEMPT_TERMINATED","WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED","WORKFLOWS_WORKFLOW_RUN_CANCELLED","workflowsEventSchemas","subscriberFactory","db","migrationsPath","workflowsOutbox","registerWorkflowsServiceMetrics","createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onJobTerminatedFailureAnnotation","onRunnerJobClaimed","onRunnerJobLeaseExpired","onStepAttemptTerminatedFailureAnnotation","onWorkflowRunAttemptCreated","onWorkflowRunCancelled","createWorkflowsInterModulePresentation","createOrchestrationActivities","WORKFLOWS_TASK_QUEUE","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","ProjectMismatchError","runWorkflow","WorkflowRunNotCancellableError","closeDb","deliverEventToListener","getStepById","getStepByIdForJobExecution","loadRunningLeasedStep","packageRoot","url","workflowsPath","subscriber","createWorkflowsModule","agent","definitions","annotations","auth","integrations","projects","runners","secrets","workspaces","name","database","databaseNamespace","routes","metrics","publishers","table","eventSchemas","subscribers","workers","taskQueue","activities","workflows","interModulePresentations"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAOvC,SACEC,kBAAkB,EAClBC,wBAAwB,QAEnB,2BAA2B;AAGlC,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,wBAAwB,EACxBC,iCAAiC,EACjCC,sCAAsC,EACtCC,gCAAgC,EAEhCC,qBAAqB,QAChB,6BAA6B;AAEpC,SAA4BC,iBAAiB,QAAO,uBAAuB;AAC3E,SAAQC,EAAE,EAAEC,cAAc,EAAEC,eAAe,QAAO,eAAe;AACjE,SAAQC,+BAA+B,QAAO,oBAAoB;AAClE,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,iBAAiB,EACjBC,gCAAgC,EAChCC,kBAAkB,EAClBC,uBAAuB,EACvBC,wCAAwC,EACxCC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBA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;wBAAcC;wBAAUE;oBAAO;gBACvFc,WAAW,EAAE;YACf;SACD;QACDC,0BAA0B;YACxBzC,uCAAuC;gBACrCmB;gBACAC;gBACAG;gBACAC;gBACAC;gBACAC;gBACAC;YACF;SACD;IACH;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,OAAO,EAEZ,KAAK,YAAY,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAoC9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAahG;AA0CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAqB7C;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiBrE;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,GACnB,4BAA4B,CAQ9B"}
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,OAAO,EAEZ,KAAK,YAAY,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAyC9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAiBhG;AA0CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAqB7C;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiBrE;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,GACnB,4BAA4B,CAQ9B"}
@@ -8,6 +8,8 @@ import { toEvaluationTraceDto } from './evaluation-trace.js';
8
8
  function toStepErrorDto(error, category) {
9
9
  if (error === null) return null;
10
10
  const message = typeof error.message === 'string' ? error.message : '';
11
+ const code = typeof error.code === 'string' ? error.code : undefined;
12
+ const managedProviderId = typeof error.managedProviderId === 'string' ? error.managedProviderId : undefined;
11
13
  const exitCode = error.exitCode;
12
14
  const signal = typeof error.signal === 'string' ? error.signal : undefined;
13
15
  const field = typeof error.field === 'string' ? error.field : undefined;
@@ -16,6 +18,12 @@ function toStepErrorDto(error, category) {
16
18
  const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);
17
19
  return {
18
20
  message,
21
+ ...code === undefined ? {} : {
22
+ code
23
+ },
24
+ ...managedProviderId === undefined ? {} : {
25
+ managed_provider_id: managedProviderId
26
+ },
19
27
  ...exitCode === null || typeof exitCode === 'number' ? {
20
28
  exit_code: exitCode
21
29
  } : {},
@@ -45,6 +53,12 @@ export function fromStepErrorDto(error) {
45
53
  if (!error) return null;
46
54
  return {
47
55
  message: error.message,
56
+ ...error.code === undefined ? {} : {
57
+ code: error.code
58
+ },
59
+ ...error.managed_provider_id === undefined ? {} : {
60
+ managedProviderId: error.managed_provider_id
61
+ },
48
62
  ...error.exit_code === null || typeof error.exit_code === 'number' ? {
49
63
  exitCode: error.exit_code
50
64
  } : {},
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/dto/step.ts"],"sourcesContent":["import {\n agentConfigIssueSchema,\n type StepAttemptDetailResponseDto,\n type StepAttemptDto,\n type StepDto,\n type StepErrorCategoryDto,\n type StepErrorDto,\n type StepGateResultDto,\n stepErrorReasonSchema,\n} from '@shipfox/api-workflows-dto';\nimport type {Step, StepAttempt} from '#core/entities/step.js';\nimport {GATE_EVALUATION_ERROR_REASON} from '#core/step-transition/evaluate-gate.js';\nimport {toEvaluationTraceDto} from './evaluation-trace.js';\n\n// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner\n// contract rather than trusting whatever shape the row happens to hold. `category`\n// is not stored on the row; the caller derives it from the step type and passes it\n// in (server-authoritative, never trusted from the runner).\nfunction toStepErrorDto(\n error: Record<string, unknown> | null,\n category: StepErrorCategoryDto,\n): StepErrorDto {\n if (error === null) return null;\n const message = typeof error.message === 'string' ? error.message : '';\n const exitCode = error.exitCode;\n const signal = typeof error.signal === 'string' ? error.signal : undefined;\n const field = typeof error.field === 'string' ? error.field : undefined;\n const source = typeof error.source === 'string' ? error.source : undefined;\n const reason = stepErrorReasonSchema.safeParse(error.reason);\n const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);\n return {\n message,\n ...(exitCode === null || typeof exitCode === 'number' ? {exit_code: exitCode} : {}),\n ...(signal === undefined ? {} : {signal}),\n ...(reason.success ? {reason: reason.data} : {}),\n ...(field === undefined ? {} : {field}),\n ...(source === undefined ? {} : {source}),\n ...(agentConfigIssue.success ? {agent_config_issue: agentConfigIssue.data} : {}),\n category,\n };\n}\n\n// Inverse of toStepErrorDto: reported wire errors land on the domain row in\n// camelCase so the read path renders them back without a special case. `category`\n// is intentionally NOT persisted: the server derives it from the step type on\n// read, so a runner-supplied category is ignored here.\nexport function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null {\n if (!error) return null;\n return {\n message: error.message,\n ...(error.exit_code === null || typeof error.exit_code === 'number'\n ? {exitCode: error.exit_code}\n : {}),\n ...(typeof error.signal === 'string' ? {signal: error.signal} : {}),\n ...(error.reason === undefined ? {} : {reason: error.reason}),\n ...(error.field === undefined ? {} : {field: error.field}),\n ...(error.source === undefined ? {} : {source: error.source}),\n ...(error.agent_config_issue === undefined ? {} : {agentConfigIssue: error.agent_config_issue}),\n };\n}\n\nfunction isIntOrNull(value: unknown): value is number | null {\n return value === null || (typeof value === 'number' && Number.isInteger(value));\n}\n\nfunction toStepGateResultDto(\n gateResult: Record<string, unknown> | null,\n status: string,\n): StepGateResultDto {\n if (gateResult === null) {\n return status === 'running' || status === 'pending' ? {kind: 'not_evaluated'} : {kind: 'none'};\n }\n\n const exitCode = gateResult.exit_code;\n const passed = gateResult.passed;\n const source = gateResult.source;\n const reason = gateResult.reason;\n\n if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'passed', passed, source, exit_code: exitCode};\n }\n\n if (\n passed === false &&\n gateResult.uncheckable === true &&\n typeof reason === 'string' &&\n isIntOrNull(exitCode)\n ) {\n if (reason === GATE_EVALUATION_ERROR_REASON) {\n return {kind: 'evaluation_error', reason, exit_code: exitCode};\n }\n return {kind: 'uncheckable', passed, uncheckable: true, reason, exit_code: exitCode};\n }\n\n if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'failed', passed, source, exit_code: exitCode};\n }\n\n return {kind: 'unknown', data: gateResult};\n}\n\nexport function toStepDto(step: Step): StepDto {\n return {\n id: step.id,\n job_execution_id: step.jobExecutionId,\n key: step.key,\n name: step.name,\n source_location: toStepSourceLocationDto(step.sourceLocation),\n status: step.status,\n status_reason: step.statusReason,\n type: step.type,\n config: step.config,\n evaluation_trace: toEvaluationTraceDto(step.evaluationTrace),\n error: toStepErrorDto(\n step.error,\n step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user',\n ),\n position: step.position,\n current_attempt: step.currentAttempt,\n created_at: step.createdAt.toISOString(),\n updated_at: step.updatedAt.toISOString(),\n };\n}\n\nfunction toStepSourceLocationDto(\n sourceLocation: Step['sourceLocation'],\n): StepDto['source_location'] {\n if (sourceLocation === null) return null;\n return {\n start_line: sourceLocation.startLine,\n end_line: sourceLocation.endLine,\n };\n}\n\nexport function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto {\n return {\n id: attempt.id,\n step_id: attempt.stepId,\n attempt: attempt.attempt,\n execution_order: attempt.executionOrder,\n status: attempt.status,\n exit_code: attempt.exitCode,\n output: attempt.output,\n outputs: attempt.output,\n response: attempt.response,\n error: attempt.error,\n gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),\n restart_feedback: attempt.restartFeedback,\n started_at: attempt.startedAt.toISOString(),\n finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null,\n };\n}\n\nexport function toStepAttemptDetailResponseDto(\n step: Step,\n attempt: StepAttempt,\n): StepAttemptDetailResponseDto {\n return {\n step_id: step.id,\n attempt: attempt.attempt,\n authored_config: step.authoredConfig,\n config: attempt.config,\n evaluation_trace: toEvaluationTraceDto(attempt.evaluationTrace),\n };\n}\n"],"names":["agentConfigIssueSchema","stepErrorReasonSchema","GATE_EVALUATION_ERROR_REASON","toEvaluationTraceDto","toStepErrorDto","error","category","message","exitCode","signal","undefined","field","source","reason","safeParse","agentConfigIssue","exit_code","success","data","agent_config_issue","fromStepErrorDto","isIntOrNull","value","Number","isInteger","toStepGateResultDto","gateResult","status","kind","passed","uncheckable","toStepDto","step","id","job_execution_id","jobExecutionId","key","name","source_location","toStepSourceLocationDto","sourceLocation","status_reason","statusReason","type","config","evaluation_trace","evaluationTrace","position","current_attempt","currentAttempt","created_at","createdAt","toISOString","updated_at","updatedAt","start_line","startLine","end_line","endLine","toStepAttemptDto","attempt","step_id","stepId","execution_order","executionOrder","output","outputs","response","gate_result","restart_feedback","restartFeedback","started_at","startedAt","finished_at","finishedAt","toStepAttemptDetailResponseDto","authored_config","authoredConfig"],"mappings":"AAAA,SACEA,sBAAsB,EAOtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AACpF,SAAQC,oBAAoB,QAAO,wBAAwB;AAE3D,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,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QAC1B9D,OAAOuD,QAAQvD,KAAK;QACpB+D,aAAa3C,oBAAoBmC,QAAQlC,UAAU,EAAEkC,QAAQjC,MAAM;QACnE0C,kBAAkBT,QAAQU,eAAe;QACzCC,YAAYX,QAAQY,SAAS,CAACpB,WAAW;QACzCqB,aAAab,QAAQc,UAAU,GAAGd,QAAQc,UAAU,CAACtB,WAAW,KAAK;IACvE;AACF;AAEA,OAAO,SAASuB,+BACd3C,IAAU,EACV4B,OAAoB;IAEpB,OAAO;QACLC,SAAS7B,KAAKC,EAAE;QAChB2B,SAASA,QAAQA,OAAO;QACxBgB,iBAAiB5C,KAAK6C,cAAc;QACpCjC,QAAQgB,QAAQhB,MAAM;QACtBC,kBAAkB1C,qBAAqByD,QAAQd,eAAe;IAChE;AACF"}
1
+ {"version":3,"sources":["../../../src/presentation/dto/step.ts"],"sourcesContent":["import {\n agentConfigIssueSchema,\n type StepAttemptDetailResponseDto,\n type StepAttemptDto,\n type StepDto,\n type StepErrorCategoryDto,\n type StepErrorDto,\n type StepGateResultDto,\n stepErrorReasonSchema,\n} from '@shipfox/api-workflows-dto';\nimport type {Step, StepAttempt} from '#core/entities/step.js';\nimport {GATE_EVALUATION_ERROR_REASON} from '#core/step-transition/evaluate-gate.js';\nimport {toEvaluationTraceDto} from './evaluation-trace.js';\n\n// Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner\n// contract rather than trusting whatever shape the row happens to hold. `category`\n// is not stored on the row; the caller derives it from the step type and passes it\n// in (server-authoritative, never trusted from the runner).\nfunction toStepErrorDto(\n error: Record<string, unknown> | null,\n category: StepErrorCategoryDto,\n): StepErrorDto {\n if (error === null) return null;\n const message = typeof error.message === 'string' ? error.message : '';\n const code = typeof error.code === 'string' ? error.code : undefined;\n const managedProviderId =\n typeof error.managedProviderId === 'string' ? error.managedProviderId : undefined;\n const exitCode = error.exitCode;\n const signal = typeof error.signal === 'string' ? error.signal : undefined;\n const field = typeof error.field === 'string' ? error.field : undefined;\n const source = typeof error.source === 'string' ? error.source : undefined;\n const reason = stepErrorReasonSchema.safeParse(error.reason);\n const agentConfigIssue = agentConfigIssueSchema.safeParse(error.agentConfigIssue);\n return {\n message,\n ...(code === undefined ? {} : {code}),\n ...(managedProviderId === undefined ? {} : {managed_provider_id: managedProviderId}),\n ...(exitCode === null || typeof exitCode === 'number' ? {exit_code: exitCode} : {}),\n ...(signal === undefined ? {} : {signal}),\n ...(reason.success ? {reason: reason.data} : {}),\n ...(field === undefined ? {} : {field}),\n ...(source === undefined ? {} : {source}),\n ...(agentConfigIssue.success ? {agent_config_issue: agentConfigIssue.data} : {}),\n category,\n };\n}\n\n// Inverse of toStepErrorDto: reported wire errors land on the domain row in\n// camelCase so the read path renders them back without a special case. `category`\n// is intentionally NOT persisted: the server derives it from the step type on\n// read, so a runner-supplied category is ignored here.\nexport function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null {\n if (!error) return null;\n return {\n message: error.message,\n ...(error.code === undefined ? {} : {code: error.code}),\n ...(error.managed_provider_id === undefined\n ? {}\n : {managedProviderId: error.managed_provider_id}),\n ...(error.exit_code === null || typeof error.exit_code === 'number'\n ? {exitCode: error.exit_code}\n : {}),\n ...(typeof error.signal === 'string' ? {signal: error.signal} : {}),\n ...(error.reason === undefined ? {} : {reason: error.reason}),\n ...(error.field === undefined ? {} : {field: error.field}),\n ...(error.source === undefined ? {} : {source: error.source}),\n ...(error.agent_config_issue === undefined ? {} : {agentConfigIssue: error.agent_config_issue}),\n };\n}\n\nfunction isIntOrNull(value: unknown): value is number | null {\n return value === null || (typeof value === 'number' && Number.isInteger(value));\n}\n\nfunction toStepGateResultDto(\n gateResult: Record<string, unknown> | null,\n status: string,\n): StepGateResultDto {\n if (gateResult === null) {\n return status === 'running' || status === 'pending' ? {kind: 'not_evaluated'} : {kind: 'none'};\n }\n\n const exitCode = gateResult.exit_code;\n const passed = gateResult.passed;\n const source = gateResult.source;\n const reason = gateResult.reason;\n\n if (passed === true && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'passed', passed, source, exit_code: exitCode};\n }\n\n if (\n passed === false &&\n gateResult.uncheckable === true &&\n typeof reason === 'string' &&\n isIntOrNull(exitCode)\n ) {\n if (reason === GATE_EVALUATION_ERROR_REASON) {\n return {kind: 'evaluation_error', reason, exit_code: exitCode};\n }\n return {kind: 'uncheckable', passed, uncheckable: true, reason, exit_code: exitCode};\n }\n\n if (passed === false && typeof source === 'string' && isIntOrNull(exitCode)) {\n return {kind: 'failed', passed, source, exit_code: exitCode};\n }\n\n return {kind: 'unknown', data: gateResult};\n}\n\nexport function toStepDto(step: Step): StepDto {\n return {\n id: step.id,\n job_execution_id: step.jobExecutionId,\n key: step.key,\n name: step.name,\n source_location: toStepSourceLocationDto(step.sourceLocation),\n status: step.status,\n status_reason: step.statusReason,\n type: step.type,\n config: step.config,\n evaluation_trace: toEvaluationTraceDto(step.evaluationTrace),\n error: toStepErrorDto(\n step.error,\n step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user',\n ),\n position: step.position,\n current_attempt: step.currentAttempt,\n created_at: step.createdAt.toISOString(),\n updated_at: step.updatedAt.toISOString(),\n };\n}\n\nfunction toStepSourceLocationDto(\n sourceLocation: Step['sourceLocation'],\n): StepDto['source_location'] {\n if (sourceLocation === null) return null;\n return {\n start_line: sourceLocation.startLine,\n end_line: sourceLocation.endLine,\n };\n}\n\nexport function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto {\n return {\n id: attempt.id,\n step_id: attempt.stepId,\n attempt: attempt.attempt,\n execution_order: attempt.executionOrder,\n status: attempt.status,\n exit_code: attempt.exitCode,\n output: attempt.output,\n outputs: attempt.output,\n response: attempt.response,\n error: attempt.error,\n gate_result: toStepGateResultDto(attempt.gateResult, attempt.status),\n restart_feedback: attempt.restartFeedback,\n started_at: attempt.startedAt.toISOString(),\n finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null,\n };\n}\n\nexport function toStepAttemptDetailResponseDto(\n step: Step,\n attempt: StepAttempt,\n): StepAttemptDetailResponseDto {\n return {\n step_id: step.id,\n attempt: attempt.attempt,\n authored_config: step.authoredConfig,\n config: attempt.config,\n evaluation_trace: toEvaluationTraceDto(attempt.evaluationTrace),\n };\n}\n"],"names":["agentConfigIssueSchema","stepErrorReasonSchema","GATE_EVALUATION_ERROR_REASON","toEvaluationTraceDto","toStepErrorDto","error","category","message","code","undefined","managedProviderId","exitCode","signal","field","source","reason","safeParse","agentConfigIssue","managed_provider_id","exit_code","success","data","agent_config_issue","fromStepErrorDto","isIntOrNull","value","Number","isInteger","toStepGateResultDto","gateResult","status","kind","passed","uncheckable","toStepDto","step","id","job_execution_id","jobExecutionId","key","name","source_location","toStepSourceLocationDto","sourceLocation","status_reason","statusReason","type","config","evaluation_trace","evaluationTrace","position","current_attempt","currentAttempt","created_at","createdAt","toISOString","updated_at","updatedAt","start_line","startLine","end_line","endLine","toStepAttemptDto","attempt","step_id","stepId","execution_order","executionOrder","output","outputs","response","gate_result","restart_feedback","restartFeedback","started_at","startedAt","finished_at","finishedAt","toStepAttemptDetailResponseDto","authored_config","authoredConfig"],"mappings":"AAAA,SACEA,sBAAsB,EAOtBC,qBAAqB,QAChB,6BAA6B;AAEpC,SAAQC,4BAA4B,QAAO,yCAAyC;AACpF,SAAQC,oBAAoB,QAAO,wBAAwB;AAE3D,4EAA4E;AAC5E,mFAAmF;AACnF,mFAAmF;AACnF,4DAA4D;AAC5D,SAASC,eACPC,KAAqC,EACrCC,QAA8B;IAE9B,IAAID,UAAU,MAAM,OAAO;IAC3B,MAAME,UAAU,OAAOF,MAAME,OAAO,KAAK,WAAWF,MAAME,OAAO,GAAG;IACpE,MAAMC,OAAO,OAAOH,MAAMG,IAAI,KAAK,WAAWH,MAAMG,IAAI,GAAGC;IAC3D,MAAMC,oBACJ,OAAOL,MAAMK,iBAAiB,KAAK,WAAWL,MAAMK,iBAAiB,GAAGD;IAC1E,MAAME,WAAWN,MAAMM,QAAQ;IAC/B,MAAMC,SAAS,OAAOP,MAAM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,QAAQA,OAAO;QACxBG,iBAAiBH,QAAQI,cAAc;QACvCrC,QAAQiC,QAAQjC,MAAM;QACtBX,WAAW4C,QAAQpD,QAAQ;QAC3ByD,QAAQL,QAAQK,MAAM;QACtBC,SAASN,QAAQK,MAAM;QACvBE,UAAUP,QAAQO,QAAQ;QAC1BjE,OAAO0D,QAAQ1D,KAAK;QACpBkE,aAAa3C,oBAAoBmC,QAAQlC,UAAU,EAAEkC,QAAQjC,MAAM;QACnE0C,kBAAkBT,QAAQU,eAAe;QACzCC,YAAYX,QAAQY,SAAS,CAACpB,WAAW;QACzCqB,aAAab,QAAQc,UAAU,GAAGd,QAAQc,UAAU,CAACtB,WAAW,KAAK;IACvE;AACF;AAEA,OAAO,SAASuB,+BACd3C,IAAU,EACV4B,OAAoB;IAEpB,OAAO;QACLC,SAAS7B,KAAKC,EAAE;QAChB2B,SAASA,QAAQA,OAAO;QACxBgB,iBAAiB5C,KAAK6C,cAAc;QACpCjC,QAAQgB,QAAQhB,MAAM;QACtBC,kBAAkB7C,qBAAqB4D,QAAQd,eAAe;IAChE;AACF"}
@@ -1,3 +1,3 @@
1
1
  export { createWorkflowRoutes } from './routes/index.js';
2
- export { onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled, } from './subscribers/index.js';
2
+ export { onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled, } from './subscribers/index.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,gCAAgC,EAChC,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,wCAAwC,EACxC,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,gCAAgC,EAChC,kBAAkB,EAClB,uBAAuB,EACvB,wCAAwC,EACxC,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { createWorkflowRoutes } from './routes/index.js';
2
- export { onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from './subscribers/index.js';
2
+ export { onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from './subscribers/index.js';
3
3
 
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/presentation/index.ts"],"sourcesContent":["export {createWorkflowRoutes} from './routes/index.js';\nexport {\n onJobEventDelivered,\n onJobStepsSettled,\n onJobTerminatedFailureAnnotation,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onStepAttemptTerminatedFailureAnnotation,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from './subscribers/index.js';\n"],"names":["createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onJobTerminatedFailureAnnotation","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onStepAttemptTerminatedFailureAnnotation","onWorkflowRunAttemptCreated","onWorkflowRunCancelled"],"mappings":"AAAA,SAAQA,oBAAoB,QAAO,oBAAoB;AACvD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,gCAAgC,EAChCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,wCAAwC,EACxCC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBAAyB"}
1
+ {"version":3,"sources":["../../src/presentation/index.ts"],"sourcesContent":["export {createWorkflowRoutes} from './routes/index.js';\nexport {\n onJobEventDelivered,\n onJobStepsSettled,\n onJobTerminatedFailureAnnotation,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onStepAttemptTerminatedFailureAnnotation,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from './subscribers/index.js';\n"],"names":["createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onJobTerminatedFailureAnnotation","onRunnerJobClaimed","onRunnerJobLeaseExpired","onStepAttemptTerminatedFailureAnnotation","onWorkflowRunAttemptCreated","onWorkflowRunCancelled"],"mappings":"AAAA,SAAQA,oBAAoB,QAAO,oBAAoB;AACvD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,gCAAgC,EAChCC,kBAAkB,EAClBC,uBAAuB,EACvBC,wCAAwC,EACxCC,2BAA2B,EAC3BC,sBAAsB,QACjB,yBAAyB"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-runtime-config.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAQpF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,OAAO,EAAE,wBAAwB,CAAC;CACnC,mDAqFA"}
1
+ {"version":3,"file":"agent-runtime-config.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AASpF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,OAAO,EAAE,wBAAwB,CAAC;CACnC,mDA4GA"}
@@ -5,6 +5,7 @@ import { isInterModuleKnownError } from '@shipfox/inter-module';
5
5
  import { captureException } from '@shipfox/node-error-monitoring';
6
6
  import { ClientError, defineRoute } from '@shipfox/node-fastify';
7
7
  import { ZodError } from 'zod';
8
+ import { getStepAttemptDetail } from '#db/index.js';
8
9
  import { loadRunningLeasedStep } from './leased-step.js';
9
10
  export function createAgentRuntimeConfigRoute(params) {
10
11
  return defineRoute({
@@ -30,6 +31,16 @@ export function createAgentRuntimeConfigRoute(params) {
30
31
  status: 409
31
32
  });
32
33
  }
34
+ if (isInterModuleKnownError(agentInterModuleContract.methods.resolveRuntimeCredentials, error) && error.code === 'workspace-providers-disabled') {
35
+ const message = error.details.message ?? 'Workspace provider configuration is disabled';
36
+ throw new ClientError(message, 'workspace-providers-disabled', {
37
+ status: 422,
38
+ details: {
39
+ managed_provider_id: error.details.managed_provider_id,
40
+ message
41
+ }
42
+ });
43
+ }
33
44
  throw error;
34
45
  },
35
46
  handler: async (request, reply)=>{
@@ -57,8 +68,19 @@ export function createAgentRuntimeConfigRoute(params) {
57
68
  }
58
69
  throw error;
59
70
  }
71
+ const stepAttempt = await getStepAttemptDetail({
72
+ stepId,
73
+ attempt
74
+ });
75
+ if (!stepAttempt) {
76
+ throw new ClientError('Step attempt not found', 'step-attempt-not-found', {
77
+ status: 409
78
+ });
79
+ }
60
80
  const runtimeConfig = await params.agent.resolveRuntimeCredentials({
61
81
  workspaceId,
82
+ runId: stepAttempt.workflowRunId,
83
+ stepAttemptId: stepAttempt.attempt.id,
62
84
  harness: agentConfig.harness,
63
85
  provider: agentConfig.provider,
64
86
  model: agentConfig.model,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"sourcesContent":["import {\n agentRuntimeCredentialsResponseSchema,\n type MaterializedAgentStepConfigDto,\n materializedAgentStepConfigSchema,\n} from '@shipfox/api-agent-dto';\nimport {\n type AgentInterModuleClient,\n agentInterModuleContract,\n} from '@shipfox/api-agent-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport {agentRuntimeConfigQuerySchema} from '@shipfox/api-workflows-dto';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {captureException} from '@shipfox/node-error-monitoring';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {ZodError} from 'zod';\nimport {loadRunningLeasedStep} from './leased-step.js';\n\nexport function createAgentRuntimeConfigRoute(params: {\n agent: AgentInterModuleClient;\n runners: RunnersInterModuleClient;\n}) {\n return defineRoute({\n method: 'GET',\n path: '/agent-runtime-config',\n description:\n \"Returns the resolved harness, provider, model, thinking effort, and decrypted provider credential bundle for the runner's currently leased running agent step. The job is identified by the lease token and the step is bound to that job before credentials are returned.\",\n schema: {\n querystring: agentRuntimeConfigQuerySchema,\n response: {\n 200: agentRuntimeCredentialsResponseSchema,\n },\n },\n errorHandler: (error) => {\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-credentials-invalid'\n ) {\n captureException(error);\n throw new ClientError(\n 'Model provider credentials could not be decrypted',\n 'model-provider-credentials-invalid',\n {\n status: 409,\n cause: error,\n },\n );\n }\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-not-configured'\n ) {\n throw new ClientError(\n 'Model provider credentials are not configured',\n 'model-provider-not-configured',\n {\n status: 409,\n },\n );\n }\n throw error;\n },\n handler: async (request, reply) => {\n const {step_id: stepId, attempt} = request.query;\n const {step, workspaceId} = await loadRunningLeasedStep({\n runners: params.runners,\n request,\n stepId,\n attempt,\n });\n\n if (step.type !== 'agent') {\n throw new ClientError('Step is not an agent step', 'step-not-agent', {status: 409});\n }\n\n let agentConfig: MaterializedAgentStepConfigDto;\n try {\n agentConfig = materializedAgentStepConfigSchema.parse(step.config);\n } catch (error) {\n if (error instanceof ZodError) {\n throw new ClientError('Agent step config is invalid', 'agent-step-config-invalid', {\n status: 409,\n cause: error,\n });\n }\n throw error;\n }\n\n const runtimeConfig = await params.agent.resolveRuntimeCredentials({\n workspaceId,\n harness: agentConfig.harness,\n provider: agentConfig.provider,\n model: agentConfig.model,\n thinking: agentConfig.thinking,\n });\n\n reply.header('cache-control', 'no-store');\n return runtimeConfig;\n },\n });\n}\n"],"names":["agentRuntimeCredentialsResponseSchema","materializedAgentStepConfigSchema","agentInterModuleContract","agentRuntimeConfigQuerySchema","isInterModuleKnownError","captureException","ClientError","defineRoute","ZodError","loadRunningLeasedStep","createAgentRuntimeConfigRoute","params","method","path","description","schema","querystring","response","errorHandler","error","methods","resolveRuntimeCredentials","code","status","cause","handler","request","reply","step_id","stepId","attempt","query","step","workspaceId","runners","type","agentConfig","parse","config","runtimeConfig","agent","harness","provider","model","thinking","header"],"mappings":"AAAA,SACEA,qCAAqC,EAErCC,iCAAiC,QAC5B,yBAAyB;AAChC,SAEEC,wBAAwB,QACnB,sCAAsC;AAE7C,SAAQC,6BAA6B,QAAO,6BAA6B;AACzE,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,gBAAgB,QAAO,iCAAiC;AAChE,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,QAAQ,QAAO,MAAM;AAC7B,SAAQC,qBAAqB,QAAO,mBAAmB;AAEvD,OAAO,SAASC,8BAA8BC,MAG7C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KAAK;gBACxBC,UAAUR,YAAYQ,QAAQ;YAChC;YAEAjB,MAAMkB,MAAM,CAAC,iBAAiB;YAC9B,OAAON;QACT;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/presentation/routes/agent-runtime-config.ts"],"sourcesContent":["import {\n agentRuntimeCredentialsResponseSchema,\n type MaterializedAgentStepConfigDto,\n materializedAgentStepConfigSchema,\n} from '@shipfox/api-agent-dto';\nimport {\n type AgentInterModuleClient,\n agentInterModuleContract,\n} from '@shipfox/api-agent-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport {agentRuntimeConfigQuerySchema} from '@shipfox/api-workflows-dto';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {captureException} from '@shipfox/node-error-monitoring';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {ZodError} from 'zod';\nimport {getStepAttemptDetail} from '#db/index.js';\nimport {loadRunningLeasedStep} from './leased-step.js';\n\nexport function createAgentRuntimeConfigRoute(params: {\n agent: AgentInterModuleClient;\n runners: RunnersInterModuleClient;\n}) {\n return defineRoute({\n method: 'GET',\n path: '/agent-runtime-config',\n description:\n \"Returns the resolved harness, provider, model, thinking effort, and decrypted provider credential bundle for the runner's currently leased running agent step. The job is identified by the lease token and the step is bound to that job before credentials are returned.\",\n schema: {\n querystring: agentRuntimeConfigQuerySchema,\n response: {\n 200: agentRuntimeCredentialsResponseSchema,\n },\n },\n errorHandler: (error) => {\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-credentials-invalid'\n ) {\n captureException(error);\n throw new ClientError(\n 'Model provider credentials could not be decrypted',\n 'model-provider-credentials-invalid',\n {\n status: 409,\n cause: error,\n },\n );\n }\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'model-provider-not-configured'\n ) {\n throw new ClientError(\n 'Model provider credentials are not configured',\n 'model-provider-not-configured',\n {\n status: 409,\n },\n );\n }\n if (\n isInterModuleKnownError(\n agentInterModuleContract.methods.resolveRuntimeCredentials,\n error,\n ) &&\n error.code === 'workspace-providers-disabled'\n ) {\n const message = error.details.message ?? 'Workspace provider configuration is disabled';\n throw new ClientError(message, 'workspace-providers-disabled', {\n status: 422,\n details: {\n managed_provider_id: error.details.managed_provider_id,\n message,\n },\n });\n }\n throw error;\n },\n handler: async (request, reply) => {\n const {step_id: stepId, attempt} = request.query;\n const {step, workspaceId} = await loadRunningLeasedStep({\n runners: params.runners,\n request,\n stepId,\n attempt,\n });\n\n if (step.type !== 'agent') {\n throw new ClientError('Step is not an agent step', 'step-not-agent', {status: 409});\n }\n\n let agentConfig: MaterializedAgentStepConfigDto;\n try {\n agentConfig = materializedAgentStepConfigSchema.parse(step.config);\n } catch (error) {\n if (error instanceof ZodError) {\n throw new ClientError('Agent step config is invalid', 'agent-step-config-invalid', {\n status: 409,\n cause: error,\n });\n }\n throw error;\n }\n\n const stepAttempt = await getStepAttemptDetail({stepId, attempt});\n if (!stepAttempt) {\n throw new ClientError('Step attempt not found', 'step-attempt-not-found', {status: 409});\n }\n\n const runtimeConfig = await params.agent.resolveRuntimeCredentials({\n workspaceId,\n runId: stepAttempt.workflowRunId,\n stepAttemptId: stepAttempt.attempt.id,\n harness: agentConfig.harness,\n provider: agentConfig.provider,\n model: agentConfig.model,\n thinking: agentConfig.thinking,\n });\n\n reply.header('cache-control', 'no-store');\n return runtimeConfig;\n },\n });\n}\n"],"names":["agentRuntimeCredentialsResponseSchema","materializedAgentStepConfigSchema","agentInterModuleContract","agentRuntimeConfigQuerySchema","isInterModuleKnownError","captureException","ClientError","defineRoute","ZodError","getStepAttemptDetail","loadRunningLeasedStep","createAgentRuntimeConfigRoute","params","method","path","description","schema","querystring","response","errorHandler","error","methods","resolveRuntimeCredentials","code","status","cause","message","details","managed_provider_id","handler","request","reply","step_id","stepId","attempt","query","step","workspaceId","runners","type","agentConfig","parse","config","stepAttempt","runtimeConfig","agent","runId","workflowRunId","stepAttemptId","id","harness","provider","model","thinking","header"],"mappings":"AAAA,SACEA,qCAAqC,EAErCC,iCAAiC,QAC5B,yBAAyB;AAChC,SAEEC,wBAAwB,QACnB,sCAAsC;AAE7C,SAAQC,6BAA6B,QAAO,6BAA6B;AACzE,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,gBAAgB,QAAO,iCAAiC;AAChE,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,QAAQ,QAAO,MAAM;AAC7B,SAAQC,oBAAoB,QAAO,eAAe;AAClD,SAAQC,qBAAqB,QAAO,mBAAmB;AAEvD,OAAO,SAASC,8BAA8BC,MAG7C;IACC,OAAOL,YAAY;QACjBM,QAAQ;QACRC,MAAM;QACNC,aACE;QACFC,QAAQ;YACNC,aAAad;YACbe,UAAU;gBACR,KAAKlB;YACP;QACF;QACAmB,cAAc,CAACC;YACb,IACEhB,wBACEF,yBAAyBmB,OAAO,CAACC,yBAAyB,EAC1DF,UAEFA,MAAMG,IAAI,KAAK,sCACf;gBACAlB,iBAAiBe;gBACjB,MAAM,IAAId,YACR,qDACA,sCACA;oBACEkB,QAAQ;oBACRC,OAAOL;gBACT;YAEJ;YACA,IACEhB,wBACEF,yBAAyBmB,OAAO,CAACC,yBAAyB,EAC1DF,UAEFA,MAAMG,IAAI,KAAK,iCACf;gBACA,MAAM,IAAIjB,YACR,iDACA,iCACA;oBACEkB,QAAQ;gBACV;YAEJ;YACA,IACEpB,wBACEF,yBAAyBmB,OAAO,CAACC,yBAAyB,EAC1DF,UAEFA,MAAMG,IAAI,KAAK,gCACf;gBACA,MAAMG,UAAUN,MAAMO,OAAO,CAACD,OAAO,IAAI;gBACzC,MAAM,IAAIpB,YAAYoB,SAAS,gCAAgC;oBAC7DF,QAAQ;oBACRG,SAAS;wBACPC,qBAAqBR,MAAMO,OAAO,CAACC,mBAAmB;wBACtDF;oBACF;gBACF;YACF;YACA,MAAMN;QACR;QACAS,SAAS,OAAOC,SAASC;YACvB,MAAM,EAACC,SAASC,MAAM,EAAEC,OAAO,EAAC,GAAGJ,QAAQK,KAAK;YAChD,MAAM,EAACC,IAAI,EAAEC,WAAW,EAAC,GAAG,MAAM3B,sBAAsB;gBACtD4B,SAAS1B,OAAO0B,OAAO;gBACvBR;gBACAG;gBACAC;YACF;YAEA,IAAIE,KAAKG,IAAI,KAAK,SAAS;gBACzB,MAAM,IAAIjC,YAAY,6BAA6B,kBAAkB;oBAACkB,QAAQ;gBAAG;YACnF;YAEA,IAAIgB;YACJ,IAAI;gBACFA,cAAcvC,kCAAkCwC,KAAK,CAACL,KAAKM,MAAM;YACnE,EAAE,OAAOtB,OAAO;gBACd,IAAIA,iBAAiBZ,UAAU;oBAC7B,MAAM,IAAIF,YAAY,gCAAgC,6BAA6B;wBACjFkB,QAAQ;wBACRC,OAAOL;oBACT;gBACF;gBACA,MAAMA;YACR;YAEA,MAAMuB,cAAc,MAAMlC,qBAAqB;gBAACwB;gBAAQC;YAAO;YAC/D,IAAI,CAACS,aAAa;gBAChB,MAAM,IAAIrC,YAAY,0BAA0B,0BAA0B;oBAACkB,QAAQ;gBAAG;YACxF;YAEA,MAAMoB,gBAAgB,MAAMhC,OAAOiC,KAAK,CAACvB,yBAAyB,CAAC;gBACjEe;gBACAS,OAAOH,YAAYI,aAAa;gBAChCC,eAAeL,YAAYT,OAAO,CAACe,EAAE;gBACrCC,SAASV,YAAYU,OAAO;gBAC5BC,UAAUX,YAAYW,QAAQ;gBAC9BC,OAAOZ,YAAYY,KAAK;gBACxBC,UAAUb,YAAYa,QAAQ;YAChC;YAEAtB,MAAMuB,MAAM,CAAC,iBAAiB;YAC9B,OAAOV;QACT;IACF;AACF"}
@@ -3,7 +3,6 @@ export { onJobEventDelivered } from './on-job-event-delivered.js';
3
3
  export { onJobStepsSettled } from './on-job-steps-settled.js';
4
4
  export { onRunnerJobClaimed } from './on-runner-job-claimed.js';
5
5
  export { onRunnerJobLeaseExpired } from './on-runner-job-lease-expired.js';
6
- export { onRunnerJobQueued } from './on-runner-job-queued.js';
7
6
  export { onWorkflowRunAttemptCreated } from './on-workflow-run-attempt-created.js';
8
7
  export { onWorkflowRunCancelled } from './on-workflow-run-cancelled.js';
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/subscribers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,2BAA2B,EAAC,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/subscribers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAC,2BAA2B,EAAC,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC"}
@@ -3,7 +3,6 @@ export { onJobEventDelivered } from './on-job-event-delivered.js';
3
3
  export { onJobStepsSettled } from './on-job-steps-settled.js';
4
4
  export { onRunnerJobClaimed } from './on-runner-job-claimed.js';
5
5
  export { onRunnerJobLeaseExpired } from './on-runner-job-lease-expired.js';
6
- export { onRunnerJobQueued } from './on-runner-job-queued.js';
7
6
  export { onWorkflowRunAttemptCreated } from './on-workflow-run-attempt-created.js';
8
7
  export { onWorkflowRunCancelled } from './on-workflow-run-cancelled.js';
9
8
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/subscribers/index.ts"],"sourcesContent":["export {\n onJobTerminatedFailureAnnotation,\n onStepAttemptTerminatedFailureAnnotation,\n} from './on-failure-annotations.js';\nexport {onJobEventDelivered} from './on-job-event-delivered.js';\nexport {onJobStepsSettled} from './on-job-steps-settled.js';\nexport {onRunnerJobClaimed} from './on-runner-job-claimed.js';\nexport {onRunnerJobLeaseExpired} from './on-runner-job-lease-expired.js';\nexport {onRunnerJobQueued} from './on-runner-job-queued.js';\nexport {onWorkflowRunAttemptCreated} from './on-workflow-run-attempt-created.js';\nexport {onWorkflowRunCancelled} from './on-workflow-run-cancelled.js';\n"],"names":["onJobTerminatedFailureAnnotation","onStepAttemptTerminatedFailureAnnotation","onJobEventDelivered","onJobStepsSettled","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onWorkflowRunAttemptCreated","onWorkflowRunCancelled"],"mappings":"AAAA,SACEA,gCAAgC,EAChCC,wCAAwC,QACnC,8BAA8B;AACrC,SAAQC,mBAAmB,QAAO,8BAA8B;AAChE,SAAQC,iBAAiB,QAAO,4BAA4B;AAC5D,SAAQC,kBAAkB,QAAO,6BAA6B;AAC9D,SAAQC,uBAAuB,QAAO,mCAAmC;AACzE,SAAQC,iBAAiB,QAAO,4BAA4B;AAC5D,SAAQC,2BAA2B,QAAO,uCAAuC;AACjF,SAAQC,sBAAsB,QAAO,iCAAiC"}
1
+ {"version":3,"sources":["../../../src/presentation/subscribers/index.ts"],"sourcesContent":["export {\n onJobTerminatedFailureAnnotation,\n onStepAttemptTerminatedFailureAnnotation,\n} from './on-failure-annotations.js';\nexport {onJobEventDelivered} from './on-job-event-delivered.js';\nexport {onJobStepsSettled} from './on-job-steps-settled.js';\nexport {onRunnerJobClaimed} from './on-runner-job-claimed.js';\nexport {onRunnerJobLeaseExpired} from './on-runner-job-lease-expired.js';\nexport {onWorkflowRunAttemptCreated} from './on-workflow-run-attempt-created.js';\nexport {onWorkflowRunCancelled} from './on-workflow-run-cancelled.js';\n"],"names":["onJobTerminatedFailureAnnotation","onStepAttemptTerminatedFailureAnnotation","onJobEventDelivered","onJobStepsSettled","onRunnerJobClaimed","onRunnerJobLeaseExpired","onWorkflowRunAttemptCreated","onWorkflowRunCancelled"],"mappings":"AAAA,SACEA,gCAAgC,EAChCC,wCAAwC,QACnC,8BAA8B;AACrC,SAAQC,mBAAmB,QAAO,8BAA8B;AAChE,SAAQC,iBAAiB,QAAO,4BAA4B;AAC5D,SAAQC,kBAAkB,QAAO,6BAA6B;AAC9D,SAAQC,uBAAuB,QAAO,mCAAmC;AACzE,SAAQC,2BAA2B,QAAO,uCAAuC;AACjF,SAAQC,sBAAsB,QAAO,iCAAiC"}
@@ -1,14 +1,12 @@
1
1
  import type { AgentInterModuleClient } from '@shipfox/api-agent-dto/inter-module';
2
2
  import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto/inter-module';
3
3
  import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
4
- import type { RunnersInterModuleClient } from '@shipfox/api-runners-dto/inter-module';
5
4
  import type { SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
6
- import { activateJobListenerActivity, bulkSetStepStatuses, evaluateJobActivationsActivity, failJobExecutionAsTimedOutActivity, failRunAsTimedOutActivity, loadRunAttemptDag, peekListenerBufferActivity, recordListenerFiringOutcomeActivity, resolveJobListenerActivity, resolveJobStatusFromJobExecutionsActivity, resolveLeaseExpiredJobExecutionActivity, setJobExecutionStatus, setJobStatus, setRunAttemptStatus, settleListenerJobExecutionActivity } from './orchestration-activities.js';
5
+ import { activateJobListenerActivity, bulkSetStepStatuses, evaluateJobActivationsActivity, failJobExecutionAsTimedOutActivity, failRunAsTimedOutActivity, loadRunAttemptDag, peekListenerBufferActivity, queueJobExecutionActivity, recordListenerFiringOutcomeActivity, resolveJobListenerActivity, resolveJobStatusFromJobExecutionsActivity, resolveLeaseExpiredJobExecutionActivity, setJobExecutionStatus, setJobStatus, setRunAttemptStatus, settleListenerJobExecutionActivity } from './orchestration-activities.js';
7
6
  export declare function createOrchestrationActivities(params: {
8
7
  agent: AgentInterModuleClient;
9
8
  integrations: IntegrationsModuleClient;
10
9
  projects: ProjectsModuleClient;
11
- runners: RunnersInterModuleClient;
12
10
  secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;
13
11
  }): {
14
12
  loadRunAttemptDag: typeof loadRunAttemptDag;
@@ -19,18 +17,7 @@ export declare function createOrchestrationActivities(params: {
19
17
  status: Exclude<import("../../core/index.js").JobStatus, 'skipped'>;
20
18
  }>;
21
19
  bulkSetStepStatuses: typeof bulkSetStepStatuses;
22
- cancelRunnerJobsActivity: (params: {
23
- jobIds: string[];
24
- }) => Promise<void>;
25
- enqueueJobExecutionForRunner: (params: {
26
- workspaceId: string;
27
- workflowRunId: string;
28
- jobId: string;
29
- jobExecutionId: string;
30
- runAttemptId: string;
31
- projectId: string;
32
- requiredLabels: string[];
33
- }) => Promise<void>;
20
+ queueJobExecutionActivity: typeof queueJobExecutionActivity;
34
21
  evaluateJobActivationsActivity: typeof evaluateJobActivationsActivity;
35
22
  failJobExecutionAsTimedOutActivity: (activityParams: Parameters<typeof failJobExecutionAsTimedOutActivity>[0]) => Promise<{
36
23
  newVersion: number;
@@ -51,8 +38,5 @@ export declare function createOrchestrationActivities(params: {
51
38
  executionVersion: number;
52
39
  }>;
53
40
  resolveJobStatusFromJobExecutionsActivity: typeof resolveJobStatusFromJobExecutionsActivity;
54
- releaseLeaseActivity: (params: {
55
- jobExecutionId: string;
56
- }) => Promise<void>;
57
41
  };
58
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EAKnB,8BAA8B,EAC9B,kCAAkC,EAClC,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,mCAAmC,EACnC,0BAA0B,EAC1B,yCAAyC,EACzC,uCAAuC,EACvC,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,kCAAkC,EACnC,MAAM,+BAA+B,CAAC;AAEvC,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;CACpE;;;;4CAKiD,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;yDAOvE,UAAU,CAAC,OAAO,kCAAkC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;8DAexD,UAAU,CAAC,OAAO,uCAAuC,CAAC,CAAC,CAAC,CAAC;;;;;;;;EAKlF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EAEnB,8BAA8B,EAC9B,kCAAkC,EAClC,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,yBAAyB,EACzB,mCAAmC,EACnC,0BAA0B,EAC1B,yCAAyC,EACzC,uCAAuC,EACvC,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,kCAAkC,EACnC,MAAM,+BAA+B,CAAC;AAEvC,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;CACpE;;;;4CAKiD,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC;;;;;;;yDAMvE,UAAU,CAAC,OAAO,kCAAkC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;8DAexD,UAAU,CAAC,OAAO,uCAAuC,CAAC,CAAC,CAAC,CAAC;;;;;EAIlF"}
@@ -1,4 +1,4 @@
1
- import { activateJobListenerActivity, bulkSetStepStatuses, createCancelRunnerJobsActivity, createDrainListenerEventsActivity, createEnqueueJobExecutionForRunner, createReleaseLeaseActivity, evaluateJobActivationsActivity, failJobExecutionAsTimedOutActivity, failRunAsTimedOutActivity, loadRunAttemptDag, peekListenerBufferActivity, recordListenerFiringOutcomeActivity, resolveJobListenerActivity, resolveJobStatusFromJobExecutionsActivity, resolveLeaseExpiredJobExecutionActivity, setJobExecutionStatus, setJobStatus, setRunAttemptStatus, settleListenerJobExecutionActivity } from './orchestration-activities.js';
1
+ import { activateJobListenerActivity, bulkSetStepStatuses, createDrainListenerEventsActivity, evaluateJobActivationsActivity, failJobExecutionAsTimedOutActivity, failRunAsTimedOutActivity, loadRunAttemptDag, peekListenerBufferActivity, queueJobExecutionActivity, recordListenerFiringOutcomeActivity, resolveJobListenerActivity, resolveJobStatusFromJobExecutionsActivity, resolveLeaseExpiredJobExecutionActivity, setJobExecutionStatus, setJobStatus, setRunAttemptStatus, settleListenerJobExecutionActivity } from './orchestration-activities.js';
2
2
  export function createOrchestrationActivities(params) {
3
3
  return {
4
4
  loadRunAttemptDag,
@@ -6,8 +6,7 @@ export function createOrchestrationActivities(params) {
6
6
  setJobStatus,
7
7
  setJobExecutionStatus: async (activityParams)=>await setJobExecutionStatus(activityParams, params.secrets),
8
8
  bulkSetStepStatuses,
9
- cancelRunnerJobsActivity: createCancelRunnerJobsActivity(params.runners),
10
- enqueueJobExecutionForRunner: createEnqueueJobExecutionForRunner(params.runners),
9
+ queueJobExecutionActivity,
11
10
  evaluateJobActivationsActivity,
12
11
  failJobExecutionAsTimedOutActivity: async (activityParams)=>await failJobExecutionAsTimedOutActivity(activityParams, params.secrets),
13
12
  failRunAsTimedOutActivity,
@@ -23,8 +22,7 @@ export function createOrchestrationActivities(params) {
23
22
  settleListenerJobExecutionActivity,
24
23
  recordListenerFiringOutcomeActivity,
25
24
  resolveLeaseExpiredJobExecutionActivity: async (activityParams)=>await resolveLeaseExpiredJobExecutionActivity(activityParams, params.secrets),
26
- resolveJobStatusFromJobExecutionsActivity,
27
- releaseLeaseActivity: createReleaseLeaseActivity(params.runners)
25
+ resolveJobStatusFromJobExecutionsActivity
28
26
  };
29
27
  }
30
28
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/temporal/activities/index.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n activateJobListenerActivity,\n bulkSetStepStatuses,\n createCancelRunnerJobsActivity,\n createDrainListenerEventsActivity,\n createEnqueueJobExecutionForRunner,\n createReleaseLeaseActivity,\n evaluateJobActivationsActivity,\n failJobExecutionAsTimedOutActivity,\n failRunAsTimedOutActivity,\n loadRunAttemptDag,\n peekListenerBufferActivity,\n recordListenerFiringOutcomeActivity,\n resolveJobListenerActivity,\n resolveJobStatusFromJobExecutionsActivity,\n resolveLeaseExpiredJobExecutionActivity,\n setJobExecutionStatus,\n setJobStatus,\n setRunAttemptStatus,\n settleListenerJobExecutionActivity,\n} from './orchestration-activities.js';\n\nexport function createOrchestrationActivities(params: {\n agent: AgentInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;\n}) {\n return {\n loadRunAttemptDag,\n setRunAttemptStatus,\n setJobStatus,\n setJobExecutionStatus: async (activityParams: Parameters<typeof setJobExecutionStatus>[0]) =>\n await setJobExecutionStatus(activityParams, params.secrets),\n bulkSetStepStatuses,\n cancelRunnerJobsActivity: createCancelRunnerJobsActivity(params.runners),\n enqueueJobExecutionForRunner: createEnqueueJobExecutionForRunner(params.runners),\n evaluateJobActivationsActivity,\n failJobExecutionAsTimedOutActivity: async (\n activityParams: Parameters<typeof failJobExecutionAsTimedOutActivity>[0],\n ) => await failJobExecutionAsTimedOutActivity(activityParams, params.secrets),\n failRunAsTimedOutActivity,\n activateJobListenerActivity,\n drainListenerEventsActivity: createDrainListenerEventsActivity({\n agent: params.agent,\n integrations: params.integrations,\n projects: params.projects,\n secrets: params.secrets,\n }),\n peekListenerBufferActivity,\n resolveJobListenerActivity,\n settleListenerJobExecutionActivity,\n recordListenerFiringOutcomeActivity,\n resolveLeaseExpiredJobExecutionActivity: async (\n activityParams: Parameters<typeof resolveLeaseExpiredJobExecutionActivity>[0],\n ) => await resolveLeaseExpiredJobExecutionActivity(activityParams, params.secrets),\n resolveJobStatusFromJobExecutionsActivity,\n releaseLeaseActivity: createReleaseLeaseActivity(params.runners),\n };\n}\n"],"names":["activateJobListenerActivity","bulkSetStepStatuses","createCancelRunnerJobsActivity","createDrainListenerEventsActivity","createEnqueueJobExecutionForRunner","createReleaseLeaseActivity","evaluateJobActivationsActivity","failJobExecutionAsTimedOutActivity","failRunAsTimedOutActivity","loadRunAttemptDag","peekListenerBufferActivity","recordListenerFiringOutcomeActivity","resolveJobListenerActivity","resolveJobStatusFromJobExecutionsActivity","resolveLeaseExpiredJobExecutionActivity","setJobExecutionStatus","setJobStatus","setRunAttemptStatus","settleListenerJobExecutionActivity","createOrchestrationActivities","params","activityParams","secrets","cancelRunnerJobsActivity","runners","enqueueJobExecutionForRunner","drainListenerEventsActivity","agent","integrations","projects","releaseLeaseActivity"],"mappings":"AAKA,SACEA,2BAA2B,EAC3BC,mBAAmB,EACnBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,kCAAkC,EAClCC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,kCAAkC,EAClCC,yBAAyB,EACzBC,iBAAiB,EACjBC,0BAA0B,EAC1BC,mCAAmC,EACnCC,0BAA0B,EAC1BC,yCAAyC,EACzCC,uCAAuC,EACvCC,qBAAqB,EACrBC,YAAY,EACZC,mBAAmB,EACnBC,kCAAkC,QAC7B,gCAAgC;AAEvC,OAAO,SAASC,8BAA8BC,MAM7C;IACC,OAAO;QACLX;QACAQ;QACAD;QACAD,uBAAuB,OAAOM,iBAC5B,MAAMN,sBAAsBM,gBAAgBD,OAAOE,OAAO;QAC5DrB;QACAsB,0BAA0BrB,+BAA+BkB,OAAOI,OAAO;QACvEC,8BAA8BrB,mCAAmCgB,OAAOI,OAAO;QAC/ElB;QACAC,oCAAoC,OAClCc,iBACG,MAAMd,mCAAmCc,gBAAgBD,OAAOE,OAAO;QAC5Ed;QACAR;QACA0B,6BAA6BvB,kCAAkC;YAC7DwB,OAAOP,OAAOO,KAAK;YACnBC,cAAcR,OAAOQ,YAAY;YACjCC,UAAUT,OAAOS,QAAQ;YACzBP,SAASF,OAAOE,OAAO;QACzB;QACAZ;QACAE;QACAM;QACAP;QACAG,yCAAyC,OACvCO,iBACG,MAAMP,wCAAwCO,gBAAgBD,OAAOE,OAAO;QACjFT;QACAiB,sBAAsBzB,2BAA2Be,OAAOI,OAAO;IACjE;AACF"}
1
+ {"version":3,"sources":["../../../src/temporal/activities/index.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n activateJobListenerActivity,\n bulkSetStepStatuses,\n createDrainListenerEventsActivity,\n evaluateJobActivationsActivity,\n failJobExecutionAsTimedOutActivity,\n failRunAsTimedOutActivity,\n loadRunAttemptDag,\n peekListenerBufferActivity,\n queueJobExecutionActivity,\n recordListenerFiringOutcomeActivity,\n resolveJobListenerActivity,\n resolveJobStatusFromJobExecutionsActivity,\n resolveLeaseExpiredJobExecutionActivity,\n setJobExecutionStatus,\n setJobStatus,\n setRunAttemptStatus,\n settleListenerJobExecutionActivity,\n} from './orchestration-activities.js';\n\nexport function createOrchestrationActivities(params: {\n agent: AgentInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n secrets: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;\n}) {\n return {\n loadRunAttemptDag,\n setRunAttemptStatus,\n setJobStatus,\n setJobExecutionStatus: async (activityParams: Parameters<typeof setJobExecutionStatus>[0]) =>\n await setJobExecutionStatus(activityParams, params.secrets),\n bulkSetStepStatuses,\n queueJobExecutionActivity,\n evaluateJobActivationsActivity,\n failJobExecutionAsTimedOutActivity: async (\n activityParams: Parameters<typeof failJobExecutionAsTimedOutActivity>[0],\n ) => await failJobExecutionAsTimedOutActivity(activityParams, params.secrets),\n failRunAsTimedOutActivity,\n activateJobListenerActivity,\n drainListenerEventsActivity: createDrainListenerEventsActivity({\n agent: params.agent,\n integrations: params.integrations,\n projects: params.projects,\n secrets: params.secrets,\n }),\n peekListenerBufferActivity,\n resolveJobListenerActivity,\n settleListenerJobExecutionActivity,\n recordListenerFiringOutcomeActivity,\n resolveLeaseExpiredJobExecutionActivity: async (\n activityParams: Parameters<typeof resolveLeaseExpiredJobExecutionActivity>[0],\n ) => await resolveLeaseExpiredJobExecutionActivity(activityParams, params.secrets),\n resolveJobStatusFromJobExecutionsActivity,\n };\n}\n"],"names":["activateJobListenerActivity","bulkSetStepStatuses","createDrainListenerEventsActivity","evaluateJobActivationsActivity","failJobExecutionAsTimedOutActivity","failRunAsTimedOutActivity","loadRunAttemptDag","peekListenerBufferActivity","queueJobExecutionActivity","recordListenerFiringOutcomeActivity","resolveJobListenerActivity","resolveJobStatusFromJobExecutionsActivity","resolveLeaseExpiredJobExecutionActivity","setJobExecutionStatus","setJobStatus","setRunAttemptStatus","settleListenerJobExecutionActivity","createOrchestrationActivities","params","activityParams","secrets","drainListenerEventsActivity","agent","integrations","projects"],"mappings":"AAIA,SACEA,2BAA2B,EAC3BC,mBAAmB,EACnBC,iCAAiC,EACjCC,8BAA8B,EAC9BC,kCAAkC,EAClCC,yBAAyB,EACzBC,iBAAiB,EACjBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,mCAAmC,EACnCC,0BAA0B,EAC1BC,yCAAyC,EACzCC,uCAAuC,EACvCC,qBAAqB,EACrBC,YAAY,EACZC,mBAAmB,EACnBC,kCAAkC,QAC7B,gCAAgC;AAEvC,OAAO,SAASC,8BAA8BC,MAK7C;IACC,OAAO;QACLZ;QACAS;QACAD;QACAD,uBAAuB,OAAOM,iBAC5B,MAAMN,sBAAsBM,gBAAgBD,OAAOE,OAAO;QAC5DnB;QACAO;QACAL;QACAC,oCAAoC,OAClCe,iBACG,MAAMf,mCAAmCe,gBAAgBD,OAAOE,OAAO;QAC5Ef;QACAL;QACAqB,6BAA6BnB,kCAAkC;YAC7DoB,OAAOJ,OAAOI,KAAK;YACnBC,cAAcL,OAAOK,YAAY;YACjCC,UAAUN,OAAOM,QAAQ;YACzBJ,SAASF,OAAOE,OAAO;QACzB;QACAb;QACAG;QACAM;QACAP;QACAG,yCAAyC,OACvCO,iBACG,MAAMP,wCAAwCO,gBAAgBD,OAAOE,OAAO;QACjFT;IACF;AACF"}
@@ -1,7 +1,6 @@
1
1
  import type { AgentInterModuleClient } from '@shipfox/api-agent-dto/inter-module';
2
2
  import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto/inter-module';
3
3
  import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
4
- import { type RunnersInterModuleClient } from '@shipfox/api-runners-dto/inter-module';
5
4
  import type { SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
6
5
  import type { JobStatus, JobStatusReason, ResolutionReason } from '#core/entities/job.js';
7
6
  import type { PersistedEvaluationTraceEntry, StepStatus } from '#core/entities/step.js';
@@ -75,21 +74,13 @@ export declare function resolveLeaseExpiredJobExecutionActivity(params: {
75
74
  status: RuntimeCompletionStatus;
76
75
  executionVersion: number;
77
76
  }>;
78
- export declare function createReleaseLeaseActivity(runners: RunnersInterModuleClient): (params: {
79
- jobExecutionId: string;
80
- }) => Promise<void>;
81
- export declare function createEnqueueJobExecutionForRunner(runners: RunnersInterModuleClient): (params: {
82
- workspaceId: string;
83
- workflowRunId: string;
77
+ export declare function queueJobExecutionActivity(params: {
84
78
  jobId: string;
85
79
  jobExecutionId: string;
86
- runAttemptId: string;
87
- projectId: string;
88
- requiredLabels: string[];
89
- }) => Promise<void>;
90
- export declare function createCancelRunnerJobsActivity(runners: RunnersInterModuleClient): (params: {
91
- jobIds: string[];
92
- }) => Promise<void>;
80
+ }): Promise<{
81
+ newVersion: number;
82
+ status: Exclude<JobStatus, 'skipped'>;
83
+ }>;
93
84
  export declare function failJobExecutionAsTimedOutActivity(params: {
94
85
  jobExecutionId: string;
95
86
  runAttemptId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-activities.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/orchestration-activities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAIpF,OAAO,KAAK,EAAC,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACxF,OAAO,KAAK,EAAC,6BAA6B,EAAE,UAAU,EAAC,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAEtE,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACf,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAIL,KAAK,4BAA4B,EAQjC,KAAK,qBAAqB,EAS3B,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,MAAO,SAAQ,cAAc;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IAC/B,MAAM,EAAE,SAAS,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,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MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;CACzB,6DAEA;AAED,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,YAAY,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC5C,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;CACpE,YAC2D;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,+DAGF;AAED,wBAAsB,0BAA0B,CAAC,MAAM,EAAE;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,sDAEvE;AAED,wBAAsB,0BAA0B,CAAC,MAAM,EAAE;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;CAC1B;;;GAEA;AAED,wBAAsB,kCAAkC,CAAC,MAAM,EAAE;IAC/D,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAC;CAChC,iBAEA;AAQD,wBAAgB,mCAAmC,CAAC,MAAM,EAAE;IAC1D,OAAO,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;CAC/C,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhB"}
1
+ {"version":3,"file":"orchestration-activities.d.ts","sourceRoot":"","sources":["../../../src/temporal/activities/orchestration-activities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC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B,yCAAyC,CAAC,MAAM,EAAE;IACtE,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC;IAAC,MAAM,EAAE,uBAAuB,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC,CAEjE;AAED,wBAAsB,2BAA2B,CAAC,MAAM,EAAE;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;CACzB,6DAEA;AAED,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,YAAY,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAC5C,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;CACpE,YAC2D;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,+DAGF;AAED,wBAAsB,0BAA0B,CAAC,MAAM,EAAE;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,sDAEvE;AAED,wBAAsB,0BAA0B,CAAC,MAAM,EAAE;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;CAC1B;;;GAEA;AAED,wBAAsB,kCAAkC,CAAC,MAAM,EAAE;IAC/D,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAC;CAChC,iBAEA;AAQD,wBAAgB,mCAAmC,CAAC,MAAM,EAAE;IAC1D,OAAO,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;CAC/C,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhB"}
@@ -1,9 +1,7 @@
1
- import { runnersInterModuleContract } from '@shipfox/api-runners-dto/inter-module';
2
- import { isInterModuleKnownError } from '@shipfox/inter-module';
3
1
  import { ApplicationFailure } from '@temporalio/common';
4
2
  import { defaultJobConditionTrace } from '#core/condition-trace.js';
5
3
  import { JobNotFoundError } from '#core/errors.js';
6
- import { activateJobListener, bulkUpdateStepStatuses, drainListenerEventsIntoExecution, evaluateJobActivations, failJobExecutionAsTimedOut, failWorkflowRunAsTimedOut, getJobExecutionsByWorkflowRunAttemptId, getJobsByWorkflowRunAttemptId, getWorkflowRunAttemptById, getWorkflowRunByAttemptId, peekListenerBuffer, resolveJobExecutionAfterLeaseExpiry, resolveJobListener, resolveJobStatusFromJobExecutions, settleListenerJobExecution, updateJobExecutionStatus, updateJobStatus, updateWorkflowRunStatus } from '#db/index.js';
4
+ import { activateJobListener, bulkUpdateStepStatuses, drainListenerEventsIntoExecution, evaluateJobActivations, failJobExecutionAsTimedOut, failWorkflowRunAsTimedOut, getJobExecutionsByWorkflowRunAttemptId, getJobsByWorkflowRunAttemptId, getWorkflowRunAttemptById, getWorkflowRunByAttemptId, peekListenerBuffer, queueJobExecution, resolveJobExecutionAfterLeaseExpiry, resolveJobListener, resolveJobStatusFromJobExecutions, settleListenerJobExecution, updateJobExecutionStatus, updateJobStatus, updateWorkflowRunStatus } from '#db/index.js';
7
5
  import { recordWorkflowListenerExecution } from '#metrics/instance.js';
8
6
  export async function loadRunAttemptDag(runAttemptId) {
9
7
  const run = await getWorkflowRunByAttemptId(runAttemptId);
@@ -115,40 +113,21 @@ export async function resolveLeaseExpiredJobExecutionActivity(params, secrets) {
115
113
  throw err;
116
114
  }
117
115
  }
118
- // Best-effort lease cleanup on job finalization. Idempotent: deleting an
119
- // already-released (or already-reaped) lease is a no-op. The workflow wraps the
120
- // call so a persistent failure never blocks the DAG result.
121
- export function createReleaseLeaseActivity(runners) {
122
- return async function releaseLeaseActivity(params) {
123
- await runners.releaseJobExecution({
116
+ export async function queueJobExecutionActivity(params) {
117
+ try {
118
+ const execution = await queueJobExecution({
124
119
  jobExecutionId: params.jobExecutionId
125
120
  });
126
- };
127
- }
128
- export function createEnqueueJobExecutionForRunner(runners) {
129
- return async function enqueueJobExecutionForRunner(params) {
130
- try {
131
- await runners.enqueueJobExecution({
132
- workspaceId: params.workspaceId,
133
- workflowRunId: params.workflowRunId,
134
- workflowRunAttemptId: params.runAttemptId,
135
- jobId: params.jobId,
136
- jobExecutionId: params.jobExecutionId,
137
- projectId: params.projectId,
138
- requiredLabels: params.requiredLabels
139
- });
140
- } catch (err) {
141
- if (isInterModuleKnownError(runnersInterModuleContract.methods.enqueueJobExecution, err)) {
142
- throw ApplicationFailure.nonRetryable(err.message, err.name);
143
- }
144
- throw err;
121
+ return {
122
+ newVersion: execution.version,
123
+ status: execution.status
124
+ };
125
+ } catch (err) {
126
+ if (err instanceof JobNotFoundError) {
127
+ throw ApplicationFailure.nonRetryable(err.message, err.name);
145
128
  }
146
- };
147
- }
148
- export function createCancelRunnerJobsActivity(runners) {
149
- return async function cancelRunnerJobsActivity(params) {
150
- await runners.cancelJobs(params);
151
- };
129
+ throw err;
130
+ }
152
131
  }
153
132
  export async function failJobExecutionAsTimedOutActivity(params, secrets) {
154
133
  const jobExecution = await failJobExecutionAsTimedOut({