@shipfox/api-workflows 7.0.2 → 8.0.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 (117) hide show
  1. package/.turbo/turbo-build.log +15 -15
  2. package/CHANGELOG.md +32 -0
  3. package/dist/core/agent-defaults.d.ts +2 -1
  4. package/dist/core/agent-defaults.d.ts.map +1 -1
  5. package/dist/core/agent-defaults.js.map +1 -1
  6. package/dist/core/agent-tools.d.ts +3 -2
  7. package/dist/core/agent-tools.d.ts.map +1 -1
  8. package/dist/core/agent-tools.js.map +1 -1
  9. package/dist/core/checkout.d.ts +2 -2
  10. package/dist/core/checkout.d.ts.map +1 -1
  11. package/dist/core/checkout.js.map +1 -1
  12. package/dist/core/entities/step.d.ts +2 -1
  13. package/dist/core/entities/step.d.ts.map +1 -1
  14. package/dist/core/entities/step.js.map +1 -1
  15. package/dist/core/run-workflow.d.ts +2 -2
  16. package/dist/core/run-workflow.d.ts.map +1 -1
  17. package/dist/core/run-workflow.js.map +1 -1
  18. package/dist/core/step-config/agent.d.ts +1 -1
  19. package/dist/core/step-config/agent.d.ts.map +1 -1
  20. package/dist/core/step-config/agent.js.map +1 -1
  21. package/dist/db/job-listeners.d.ts +2 -2
  22. package/dist/db/job-listeners.d.ts.map +1 -1
  23. package/dist/db/job-listeners.js.map +1 -1
  24. package/dist/db/workflow-runs/run-create.d.ts +2 -2
  25. package/dist/db/workflow-runs/run-create.d.ts.map +1 -1
  26. package/dist/db/workflow-runs/run-create.js.map +1 -1
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/presentation/inter-module.d.ts +2 -2
  31. package/dist/presentation/inter-module.d.ts.map +1 -1
  32. package/dist/presentation/inter-module.js +2 -1
  33. package/dist/presentation/inter-module.js.map +1 -1
  34. package/dist/presentation/routes/cancel-run.d.ts +1 -1
  35. package/dist/presentation/routes/cancel-run.d.ts.map +1 -1
  36. package/dist/presentation/routes/cancel-run.js.map +1 -1
  37. package/dist/presentation/routes/checkout-token.d.ts +2 -2
  38. package/dist/presentation/routes/checkout-token.d.ts.map +1 -1
  39. package/dist/presentation/routes/checkout-token.js +1 -1
  40. package/dist/presentation/routes/checkout-token.js.map +1 -1
  41. package/dist/presentation/routes/get-run-aggregates.d.ts +1 -1
  42. package/dist/presentation/routes/get-run-aggregates.d.ts.map +1 -1
  43. package/dist/presentation/routes/get-run-aggregates.js.map +1 -1
  44. package/dist/presentation/routes/get-run.d.ts +1 -1
  45. package/dist/presentation/routes/get-run.d.ts.map +1 -1
  46. package/dist/presentation/routes/get-run.js.map +1 -1
  47. package/dist/presentation/routes/index.d.ts +2 -2
  48. package/dist/presentation/routes/index.d.ts.map +1 -1
  49. package/dist/presentation/routes/index.js.map +1 -1
  50. package/dist/presentation/routes/list-run-attempts.d.ts +1 -1
  51. package/dist/presentation/routes/list-run-attempts.d.ts.map +1 -1
  52. package/dist/presentation/routes/list-run-attempts.js.map +1 -1
  53. package/dist/presentation/routes/list-runs.d.ts +1 -1
  54. package/dist/presentation/routes/list-runs.d.ts.map +1 -1
  55. package/dist/presentation/routes/list-runs.js.map +1 -1
  56. package/dist/presentation/routes/project-access.d.ts +1 -1
  57. package/dist/presentation/routes/project-access.d.ts.map +1 -1
  58. package/dist/presentation/routes/project-access.js.map +1 -1
  59. package/dist/presentation/routes/require-accessible-run.d.ts +1 -1
  60. package/dist/presentation/routes/require-accessible-run.d.ts.map +1 -1
  61. package/dist/presentation/routes/require-accessible-run.js.map +1 -1
  62. package/dist/presentation/routes/rerun-run.d.ts +1 -1
  63. package/dist/presentation/routes/rerun-run.d.ts.map +1 -1
  64. package/dist/presentation/routes/rerun-run.js.map +1 -1
  65. package/dist/temporal/activities/index.d.ts +2 -2
  66. package/dist/temporal/activities/index.d.ts.map +1 -1
  67. package/dist/temporal/activities/index.js.map +1 -1
  68. package/dist/temporal/activities/orchestration-activities.d.ts +2 -2
  69. package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
  70. package/dist/temporal/activities/orchestration-activities.js.map +1 -1
  71. package/dist/temporal/workflows/index.bundle.js +17212 -3354
  72. package/dist/tsconfig.test.tsbuildinfo +1 -1
  73. package/package.json +15 -15
  74. package/src/core/agent-defaults.ts +2 -1
  75. package/src/core/agent-tool-capability-warning.test.ts +1 -1
  76. package/src/core/agent-tools.ts +2 -2
  77. package/src/core/checkout.test.ts +2 -2
  78. package/src/core/checkout.ts +2 -2
  79. package/src/core/entities/step.ts +1 -2
  80. package/src/core/run-workflow.test.ts +2 -0
  81. package/src/core/run-workflow.ts +2 -2
  82. package/src/core/step-config/agent.ts +1 -1
  83. package/src/core/step-config/materialize-workflow-model.test.ts +11 -2
  84. package/src/db/job-listeners.ts +2 -2
  85. package/src/db/workflow-runs/run-create.test.ts +11 -2
  86. package/src/db/workflow-runs/run-create.ts +2 -2
  87. package/src/index.ts +2 -2
  88. package/src/presentation/inter-module.ts +4 -7
  89. package/src/presentation/routes/agent-runtime-config.test.ts +2 -35
  90. package/src/presentation/routes/cancel-run.test.ts +1 -1
  91. package/src/presentation/routes/cancel-run.ts +1 -1
  92. package/src/presentation/routes/checkout-token.test.ts +4 -37
  93. package/src/presentation/routes/checkout-token.ts +2 -2
  94. package/src/presentation/routes/get-run-aggregates.test.ts +1 -1
  95. package/src/presentation/routes/get-run-aggregates.ts +1 -1
  96. package/src/presentation/routes/get-run.test.ts +1 -1
  97. package/src/presentation/routes/get-run.ts +1 -1
  98. package/src/presentation/routes/get-step-secrets.test.ts +2 -2
  99. package/src/presentation/routes/index.test.ts +3 -3
  100. package/src/presentation/routes/index.ts +2 -2
  101. package/src/presentation/routes/list-run-attempts.test.ts +1 -1
  102. package/src/presentation/routes/list-run-attempts.ts +1 -1
  103. package/src/presentation/routes/list-runs.test.ts +1 -1
  104. package/src/presentation/routes/list-runs.ts +1 -1
  105. package/src/presentation/routes/next-step.test.ts +9 -57
  106. package/src/presentation/routes/project-access.ts +1 -1
  107. package/src/presentation/routes/report-step.test.ts +2 -3
  108. package/src/presentation/routes/require-accessible-run.ts +1 -1
  109. package/src/presentation/routes/rerun-run.test.ts +1 -1
  110. package/src/presentation/routes/rerun-run.ts +1 -1
  111. package/src/temporal/activities/index.ts +2 -2
  112. package/src/temporal/activities/orchestration-activities.ts +2 -2
  113. package/test/fixtures/agent-inter-module.ts +31 -1
  114. package/test/fixtures/auth-inter-module.ts +2 -13
  115. package/test/fixtures/lease-token.ts +43 -29
  116. package/test/fixtures/projects-inter-module.ts +1 -1
  117. package/tsconfig.build.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/api-workflows",
3
3
  "license": "MIT",
4
- "version": "7.0.2",
4
+ "version": "8.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -26,29 +26,29 @@
26
26
  "@temporalio/workflow": "1.18.1",
27
27
  "drizzle-orm": "^0.45.2",
28
28
  "zod": "^4.4.3",
29
- "@shipfox/api-auth-context": "6.0.0",
30
- "@shipfox/api-auth-dto": "6.0.0",
31
- "@shipfox/api-agent-dto": "6.0.0",
29
+ "@shipfox/api-auth-context": "7.1.0",
30
+ "@shipfox/api-auth-dto": "7.1.0",
31
+ "@shipfox/api-agent-dto": "8.0.0",
32
32
  "@shipfox/annotations-dto": "6.0.0",
33
33
  "@shipfox/api-definitions-dto": "6.0.0",
34
- "@shipfox/api-projects-dto": "6.0.0",
35
- "@shipfox/api-integration-core-dto": "6.0.0",
36
- "@shipfox/api-projects": "6.0.0",
37
- "@shipfox/api-runners": "7.0.2",
34
+ "@shipfox/api-projects-dto": "8.0.0",
35
+ "@shipfox/api-integration-core-dto": "8.0.0",
36
+ "@shipfox/api-runners": "8.0.0",
38
37
  "@shipfox/api-runners-dto": "7.0.1",
39
38
  "@shipfox/api-secrets-dto": "6.0.0",
40
- "@shipfox/api-workflows-dto": "6.0.0",
39
+ "@shipfox/api-workflows-dto": "8.0.0",
41
40
  "@shipfox/inter-module": "0.2.0",
42
41
  "@shipfox/expression": "1.1.3",
43
42
  "@shipfox/node-drizzle": "0.3.2",
44
- "@shipfox/node-error-monitoring": "0.1.3",
45
- "@shipfox/node-fastify": "0.2.4",
46
- "@shipfox/node-module": "0.4.0",
47
- "@shipfox/node-opentelemetry": "0.5.2",
43
+ "@shipfox/node-error-monitoring": "0.2.0",
44
+ "@shipfox/node-fastify": "0.3.0",
45
+ "@shipfox/node-module": "0.5.0",
46
+ "@shipfox/node-opentelemetry": "0.6.0",
48
47
  "@shipfox/node-outbox": "0.2.4",
49
48
  "@shipfox/node-postgres": "0.4.2",
50
- "@shipfox/node-temporal": "0.3.2",
51
- "@shipfox/runner-labels": "0.1.1"
49
+ "@shipfox/node-temporal": "0.4.0",
50
+ "@shipfox/runner-labels": "0.1.1",
51
+ "@shipfox/workflow-document": "2.1.1"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js",
@@ -1,5 +1,6 @@
1
- import type {AgentThinking, Harness, ModelProviderRef} from '@shipfox/api-agent-dto';
1
+ import type {ModelProviderRef} from '@shipfox/api-agent-dto';
2
2
  import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';
3
+ import type {AgentThinking, Harness} from '@shipfox/workflow-document';
3
4
 
4
5
  export interface AgentDefaultsInput {
5
6
  readonly harness?: Harness | undefined;
@@ -1,5 +1,5 @@
1
1
  import type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';
2
- import type {JobLeaseTokenClaims} from '@shipfox/api-auth';
2
+ import type {JobLeaseTokenClaims} from '@shipfox/api-auth-dto';
3
3
  import {sql} from 'drizzle-orm';
4
4
  import {db} from '#db/db.js';
5
5
  import {runnersTestClient} from '#test/fixtures/runners-inter-module.js';
@@ -7,9 +7,9 @@ import type {
7
7
  AgentToolCatalogEntry,
8
8
  AgentToolCatalogMethod,
9
9
  IntegrationProviderKind,
10
- IntegrationsModuleClient,
11
10
  } from '@shipfox/api-integration-core-dto';
12
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
11
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
12
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
13
13
  import {AgentIntegrationMaterializationError} from './errors.js';
14
14
 
15
15
  type WorkflowModelJob = WorkflowModel['jobs'][number];
@@ -1,5 +1,5 @@
1
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
2
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
3
3
  import * as workflowRuns from '#db/workflow-runs.js';
4
4
  import {jobFactory} from '#test/factories/job.js';
5
5
  import {projectFactory} from '#test/factories/project.js';
@@ -1,5 +1,5 @@
1
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
2
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
3
3
  import {getJobById, getWorkflowRunByAttemptId} from '#db/workflow-runs.js';
4
4
  import {
5
5
  CheckoutIntentUnresolvedError,
@@ -1,7 +1,5 @@
1
1
  import type {
2
2
  AgentIntegrationMcpServerConfigDto,
3
- AgentThinking,
4
- Harness,
5
3
  MaterializedAgentIntegrationConfigDto,
6
4
  } from '@shipfox/api-agent-dto';
7
5
  import type {
@@ -10,6 +8,7 @@ import type {
10
8
  ResolvedField,
11
9
  WorkflowExpression,
12
10
  } from '@shipfox/expression';
11
+ import type {AgentThinking, Harness} from '@shipfox/workflow-document';
13
12
  import type {InterpolationUnresolvableField} from '../errors.js';
14
13
 
15
14
  export type StepStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';
@@ -2,6 +2,7 @@ import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';
2
2
  import type {WorkflowDefinition} from '@shipfox/api-definitions';
3
3
  import {createWorkflowModelSnapshot} from '@shipfox/api-definitions-dto';
4
4
  import type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';
5
+ import {agentValidationCatalog} from '#test/fixtures/agent-inter-module.js';
5
6
  import {workflowModel} from '#test/index.js';
6
7
  import type {TriggerPayload} from './entities/workflow-run.js';
7
8
  import {DefinitionNotFoundError, ProjectMismatchError} from './errors.js';
@@ -87,6 +88,7 @@ describe('runWorkflow', () => {
87
88
  let workspaceId: string;
88
89
  let projectId: string;
89
90
  const agent: AgentInterModuleClient = {
91
+ getValidationCatalog: vi.fn().mockResolvedValue(agentValidationCatalog),
90
92
  resolveAgentConfig: mockResolveAgentConfig,
91
93
  resolveRuntimeCredentials: vi.fn(),
92
94
  };
@@ -1,8 +1,8 @@
1
1
  import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';
2
2
  import {workflowModelFromSnapshot} from '@shipfox/api-definitions-dto';
3
3
  import type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';
4
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
5
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
4
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
5
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
6
6
  import type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';
7
7
  import {createWorkflowRun} from '#db/workflow-runs.js';
8
8
  import {createAgentDefaultsResolver} from './agent-defaults.js';
@@ -4,13 +4,13 @@ import {
4
4
  AGENT_INTEGRATION_MCP_SERVER_NAME,
5
5
  AGENT_INTEGRATION_MCP_TRANSPORT,
6
6
  type AgentIntegrationMcpServerConfigDto,
7
- type AgentThinking,
8
7
  type MaterializedAgentIntegrationConfigDto,
9
8
  } from '@shipfox/api-agent-dto';
10
9
  import {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';
11
10
  import type {WorkflowModel} from '@shipfox/api-definitions-dto';
12
11
  import type {ResolvedField, SiteResolvedField} from '@shipfox/expression';
13
12
  import {isInterModuleKnownError} from '@shipfox/inter-module';
13
+ import type {AgentThinking} from '@shipfox/workflow-document';
14
14
  import type {AgentDefaultsResolver, ResolvedAgentDefaults} from '#core/agent-defaults.js';
15
15
  import {
16
16
  type AgentToolMaterializationContext,
@@ -1,13 +1,16 @@
1
1
  import {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';
2
2
  import {
3
3
  DEFAULT_JOB_CHECKOUT,
4
- normalizeWorkflowDocument,
4
+ normalizeWorkflowDocument as normalizeWorkflowDocumentImpl,
5
5
  type WorkflowModel,
6
6
  } from '@shipfox/api-definitions';
7
7
  import {createInterModuleKnownError} from '@shipfox/inter-module';
8
8
  import type {AgentDefaultsResolver} from '#core/agent-defaults.js';
9
9
  import {AgentConfigUnresolvableError, InterpolationUnresolvableError} from '#core/errors.js';
10
- import {resolveTestAgentDefaults} from '#test/fixtures/agent-inter-module.js';
10
+ import {
11
+ agentValidationCatalog,
12
+ resolveTestAgentDefaults,
13
+ } from '#test/fixtures/agent-inter-module.js';
11
14
  import {workflowModel} from '#test/index.js';
12
15
  import {
13
16
  materializeJobRunner,
@@ -26,6 +29,12 @@ function materializeWorkflowModel(
26
29
  return materializeWorkflowModelImpl({resolveAgentDefaults: resolveTestAgentDefaults, ...params});
27
30
  }
28
31
 
32
+ function normalizeWorkflowDocument(
33
+ document: Parameters<typeof normalizeWorkflowDocumentImpl>[0],
34
+ ): ReturnType<typeof normalizeWorkflowDocumentImpl> {
35
+ return normalizeWorkflowDocumentImpl(document, {agentValidationCatalog});
36
+ }
37
+
29
38
  function expression(source: string): TestWorkflowExpression {
30
39
  return {language: 'cel', check: 'typed', source: source as TestWorkflowExpression['source']};
31
40
  }
@@ -1,7 +1,7 @@
1
1
  import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';
2
2
  import {readPersistedWorkflowModel} from '@shipfox/api-definitions-dto';
3
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
4
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
3
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
4
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
5
5
  import {
6
6
  WORKFLOWS_JOB_ACTIVATED,
7
7
  type WorkflowsJobActivatedEventDto,
@@ -1,10 +1,13 @@
1
- import {normalizeWorkflowDocument} from '@shipfox/api-definitions';
1
+ import {normalizeWorkflowDocument as normalizeWorkflowDocumentImpl} from '@shipfox/api-definitions';
2
2
  import {WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED} from '@shipfox/api-workflows-dto';
3
3
  import {and, eq, sql} from 'drizzle-orm';
4
4
  import type {AgentDefaultsResolver} from '#core/agent-defaults.js';
5
5
  import {InterpolationUnresolvableError} from '#core/errors.js';
6
6
  import {nextStepForJob, recordStepResult} from '#core/job-execution.js';
7
- import {resolveTestAgentDefaults} from '#test/fixtures/agent-inter-module.js';
7
+ import {
8
+ agentValidationCatalog,
9
+ resolveTestAgentDefaults,
10
+ } from '#test/fixtures/agent-inter-module.js';
8
11
  import {createTestSecretsClient} from '#test/fixtures/secrets-inter-module.js';
9
12
  import {buildModel, expression, shellRef, template} from '#test/helpers/workflow-runs.js';
10
13
  import {db} from '../db.js';
@@ -23,6 +26,12 @@ import {
23
26
  updateJobExecutionStatus,
24
27
  } from '../workflow-runs.js';
25
28
 
29
+ function normalizeWorkflowDocument(
30
+ document: Parameters<typeof normalizeWorkflowDocumentImpl>[0],
31
+ ): ReturnType<typeof normalizeWorkflowDocumentImpl> {
32
+ return normalizeWorkflowDocumentImpl(document, {agentValidationCatalog});
33
+ }
34
+
26
35
  describe('workflow run queries', () => {
27
36
  let workspaceId: string;
28
37
  let projectId: string;
@@ -1,6 +1,6 @@
1
1
  import {createWorkflowModelSnapshot, type WorkflowModel} from '@shipfox/api-definitions-dto';
2
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
3
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
2
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
3
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
4
4
  import type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';
5
5
  import {analyzeContextKeyAccess, type ResolvedFieldSegment} from '@shipfox/expression';
6
6
  import {logger} from '@shipfox/node-opentelemetry';
package/src/index.ts CHANGED
@@ -4,8 +4,8 @@ import type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-
4
4
  import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';
5
5
  import type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';
6
6
  import type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';
7
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
8
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
7
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
8
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
9
9
  import {
10
10
  RUNNER_JOB_CLAIMED,
11
11
  RUNNER_JOB_LEASE_EXPIRED,
@@ -1,12 +1,8 @@
1
- import {
2
- DEFAULT_HARNESS,
3
- harnessSchema,
4
- materializedAgentStepConfigSchema,
5
- } from '@shipfox/api-agent-dto';
1
+ import {materializedAgentStepConfigSchema} from '@shipfox/api-agent-dto';
6
2
  import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';
7
3
  import type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';
8
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
9
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
4
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
5
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
10
6
  import type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';
11
7
  import type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';
12
8
  import {workflowsInterModuleContract} from '@shipfox/api-workflows-dto/inter-module';
@@ -15,6 +11,7 @@ import {
15
11
  defineInterModulePresentation,
16
12
  type InterModulePresentation,
17
13
  } from '@shipfox/inter-module';
14
+ import {DEFAULT_HARNESS, harnessSchema} from '@shipfox/workflow-document';
18
15
  import {InvalidJobRunnerLabelsError} from '#core/errors.js';
19
16
  import {
20
17
  AgentConfigUnresolvableError,
@@ -5,7 +5,6 @@ import {
5
5
  } from '@shipfox/api-agent';
6
6
  import {resolveRuntimeCredentials} from '@shipfox/api-agent/core/resolve-runtime-credentials';
7
7
  import {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';
8
- import {createLeaseTokenAuthMethod} from '@shipfox/api-auth';
9
8
  import type {WorkflowModel} from '@shipfox/api-definitions-dto';
10
9
  import {secretsInterModuleContract} from '@shipfox/api-secrets-dto/inter-module';
11
10
  import {createInterModuleKnownError} from '@shipfox/inter-module';
@@ -26,7 +25,7 @@ import {insertRunningJobLease, mintActiveLeaseToken} from '#test/fixtures/active
26
25
  import {resolveTestAgentDefaults} from '#test/fixtures/agent-inter-module.js';
27
26
  import {annotationsTestClient} from '#test/fixtures/annotations-inter-module.js';
28
27
  import {workflowsTestAuthClient} from '#test/fixtures/auth-inter-module.js';
29
- import {mintLeaseToken} from '#test/fixtures/lease-token.js';
28
+ import {fakeLeaseTokenAuthMethod, mintLeaseToken} from '#test/fixtures/lease-token.js';
30
29
  import {projectsTestClient} from '#test/fixtures/projects-inter-module.js';
31
30
  import {runnersTestClient} from '#test/fixtures/runners-inter-module.js';
32
31
  import {createTestSecretsClient} from '#test/fixtures/secrets-inter-module.js';
@@ -56,7 +55,7 @@ describe('GET /runs/jobs/current/agent-runtime-config', () => {
56
55
 
57
56
  beforeAll(async () => {
58
57
  app = await createApp({
59
- auth: [createLeaseTokenAuthMethod()],
58
+ auth: [fakeLeaseTokenAuthMethod],
60
59
  routes: [
61
60
  createLeaseTokenRouteGroup({
62
61
  agent: agentTestClient,
@@ -91,38 +90,6 @@ describe('GET /runs/jobs/current/agent-runtime-config', () => {
91
90
  expect(res.statusCode).toBe(401);
92
91
  expect(res.json().code).toBe('unauthorized');
93
92
  });
94
-
95
- test('rejects an expired token', async () => {
96
- const token = await mintLeaseToken({
97
- jobId: crypto.randomUUID(),
98
- jobExecutionId: crypto.randomUUID(),
99
- expiresIn: '-1s',
100
- });
101
-
102
- const res = await app.inject({
103
- method: 'GET',
104
- url: runtimeConfigUrl(crypto.randomUUID(), 1),
105
- headers: {authorization: `Bearer ${token}`},
106
- });
107
-
108
- expect(res.statusCode).toBe(401);
109
- });
110
-
111
- test('rejects a token with the wrong audience', async () => {
112
- const token = await mintLeaseToken({
113
- jobId: crypto.randomUUID(),
114
- jobExecutionId: crypto.randomUUID(),
115
- audience: 'user-session',
116
- });
117
-
118
- const res = await app.inject({
119
- method: 'GET',
120
- url: runtimeConfigUrl(crypto.randomUUID(), 1),
121
- headers: {authorization: `Bearer ${token}`},
122
- });
123
-
124
- expect(res.statusCode).toBe(401);
125
- });
126
93
  });
127
94
 
128
95
  test('returns decrypted runtime credentials for a running leased agent step', async () => {
@@ -1,5 +1,5 @@
1
1
  import {buildUserContext, setUserContext} from '@shipfox/api-auth-context';
2
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
3
3
  import {ClientError} from '@shipfox/node-fastify';
4
4
  import type {FastifyInstance} from 'fastify';
5
5
  import Fastify from 'fastify';
@@ -1,4 +1,4 @@
1
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
2
2
  import {workflowRunDtoSchema} from '@shipfox/api-workflows-dto';
3
3
  import {ClientError, defineRoute} from '@shipfox/node-fastify';
4
4
  import {z} from 'zod';
@@ -1,13 +1,12 @@
1
- import {createLeaseTokenAuthMethod} from '@shipfox/api-auth';
2
- import {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto';
3
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
4
3
  import {createInterModuleKnownError} from '@shipfox/inter-module';
5
4
  import {closeApp, createApp, type FastifyInstance} from '@shipfox/node-fastify';
6
5
  import {createCapturingLogger} from '@shipfox/node-log/test';
7
6
  import {jobFactory} from '#test/factories/job.js';
8
7
  import {projectFactory} from '#test/factories/project.js';
9
8
  import {mintActiveLeaseToken} from '#test/fixtures/active-lease-token.js';
10
- import {mintLeaseToken} from '#test/fixtures/lease-token.js';
9
+ import {fakeLeaseTokenAuthMethod, mintLeaseToken} from '#test/fixtures/lease-token.js';
11
10
  import {runnersTestClient} from '#test/fixtures/runners-inter-module.js';
12
11
  import {createLeaseTokenRouteGroup} from './index.js';
13
12
 
@@ -29,7 +28,7 @@ describe('POST /runs/jobs/current/checkout-token', () => {
29
28
 
30
29
  beforeAll(async () => {
31
30
  app = await createApp({
32
- auth: [createLeaseTokenAuthMethod()],
31
+ auth: [fakeLeaseTokenAuthMethod],
33
32
  routes: [
34
33
  createLeaseTokenRouteGroup({
35
34
  agent: {} as never,
@@ -64,38 +63,6 @@ describe('POST /runs/jobs/current/checkout-token', () => {
64
63
  expect(res.statusCode).toBe(401);
65
64
  expect(res.json().code).toBe('unauthorized');
66
65
  });
67
-
68
- test('rejects an expired token', async () => {
69
- const token = await mintLeaseToken({
70
- jobId: crypto.randomUUID(),
71
- jobExecutionId: crypto.randomUUID(),
72
- expiresIn: '-1s',
73
- });
74
-
75
- const res = await app.inject({
76
- method: 'POST',
77
- url: URL,
78
- headers: {authorization: `Bearer ${token}`},
79
- });
80
-
81
- expect(res.statusCode).toBe(401);
82
- });
83
-
84
- test('rejects a token with the wrong audience', async () => {
85
- const token = await mintLeaseToken({
86
- jobId: crypto.randomUUID(),
87
- jobExecutionId: crypto.randomUUID(),
88
- audience: 'user-session',
89
- });
90
-
91
- const res = await app.inject({
92
- method: 'POST',
93
- url: URL,
94
- headers: {authorization: `Bearer ${token}`},
95
- });
96
-
97
- expect(res.statusCode).toBe(401);
98
- });
99
66
  });
100
67
 
101
68
  test('returns basic auth for a GitHub-style spec with credentials', async () => {
@@ -2,8 +2,8 @@ import {requireLeasedJobContext} from '@shipfox/api-auth-context';
2
2
  import {
3
3
  type IntegrationsModuleClient,
4
4
  integrationsInterModuleContract,
5
- } from '@shipfox/api-integration-core-dto';
6
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
5
+ } from '@shipfox/api-integration-core-dto/inter-module';
6
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
7
7
  import type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';
8
8
  import {checkoutTokenResponseSchema} from '@shipfox/api-workflows-dto';
9
9
  import {isInterModuleKnownError} from '@shipfox/inter-module';
@@ -1,5 +1,5 @@
1
1
  import {buildUserContext, setUserContext} from '@shipfox/api-auth-context';
2
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
3
3
  import type {FastifyInstance} from 'fastify';
4
4
  import Fastify from 'fastify';
5
5
  import {serializerCompiler, validatorCompiler} from 'fastify-type-provider-zod';
@@ -1,4 +1,4 @@
1
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
2
2
  import {
3
3
  workflowRunAggregatesQuerySchema,
4
4
  workflowRunAggregatesResponseSchema,
@@ -1,5 +1,5 @@
1
1
  import {buildUserContext, setUserContext} from '@shipfox/api-auth-context';
2
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
3
3
  import {ClientError} from '@shipfox/node-fastify';
4
4
  import {eq} from 'drizzle-orm';
5
5
  import type {FastifyInstance} from 'fastify';
@@ -1,4 +1,4 @@
1
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
2
2
  import {workflowRunDetailResponseSchema} from '@shipfox/api-workflows-dto';
3
3
  import {ClientError, defineRoute} from '@shipfox/node-fastify';
4
4
  import {z} from 'zod';
@@ -1,4 +1,3 @@
1
- import {createLeaseTokenAuthMethod} from '@shipfox/api-auth';
2
1
  import {closeApp, createApp, type FastifyInstance} from '@shipfox/node-fastify';
3
2
  import {createCapturingLogger} from '@shipfox/node-log/test';
4
3
  import {eq} from 'drizzle-orm';
@@ -17,6 +16,7 @@ import {mintActiveLeaseToken} from '#test/fixtures/active-lease-token.js';
17
16
  import {agentTestClient} from '#test/fixtures/agent-inter-module.js';
18
17
  import {annotationsTestClient} from '#test/fixtures/annotations-inter-module.js';
19
18
  import {workflowsTestAuthClient} from '#test/fixtures/auth-inter-module.js';
19
+ import {fakeLeaseTokenAuthMethod} from '#test/fixtures/lease-token.js';
20
20
  import {projectsTestClient} from '#test/fixtures/projects-inter-module.js';
21
21
  import {runnersTestClient} from '#test/fixtures/runners-inter-module.js';
22
22
  import {createTestSecretsClient} from '#test/fixtures/secrets-inter-module.js';
@@ -31,7 +31,7 @@ describe('GET /runs/jobs/current/steps/:stepId/secrets', () => {
31
31
 
32
32
  beforeAll(async () => {
33
33
  app = await createApp({
34
- auth: [createLeaseTokenAuthMethod()],
34
+ auth: [fakeLeaseTokenAuthMethod],
35
35
  routes: [
36
36
  createLeaseTokenRouteGroup({
37
37
  agent: agentTestClient,
@@ -1,4 +1,3 @@
1
- import {createLeaseTokenAuthMethod} from '@shipfox/api-auth';
2
1
  import {
3
2
  AUTH_LEASED_JOB,
4
3
  AUTH_USER,
@@ -10,6 +9,7 @@ import type {FastifyRequest} from 'fastify';
10
9
  import {agentTestClient} from '#test/fixtures/agent-inter-module.js';
11
10
  import {annotationsTestClient} from '#test/fixtures/annotations-inter-module.js';
12
11
  import {workflowsTestAuthClient} from '#test/fixtures/auth-inter-module.js';
12
+ import {fakeLeaseTokenAuthMethod} from '#test/fixtures/lease-token.js';
13
13
  import {projectsTestClient} from '#test/fixtures/projects-inter-module.js';
14
14
  import {runnersTestClient} from '#test/fixtures/runners-inter-module.js';
15
15
  import {createTestSecretsClient} from '#test/fixtures/secrets-inter-module.js';
@@ -50,7 +50,7 @@ describe('workflow route auth', () => {
50
50
 
51
51
  test('rejects API-key-only requests', async () => {
52
52
  const app = await createApp({
53
- auth: [fakeUserAuth, createLeaseTokenAuthMethod()],
53
+ auth: [fakeUserAuth, fakeLeaseTokenAuthMethod],
54
54
  routes: workflowRoutes,
55
55
  swagger: false,
56
56
  });
@@ -71,7 +71,7 @@ describe('workflow route auth', () => {
71
71
 
72
72
  test('step routes reject requests without a lease token', async () => {
73
73
  const app = await createApp({
74
- auth: [fakeUserAuth, createLeaseTokenAuthMethod()],
74
+ auth: [fakeUserAuth, fakeLeaseTokenAuthMethod],
75
75
  routes: workflowRoutes,
76
76
  swagger: false,
77
77
  });
@@ -2,8 +2,8 @@ import type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-
2
2
  import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';
3
3
  import {AUTH_LEASED_JOB, AUTH_USER} from '@shipfox/api-auth-context';
4
4
  import type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';
5
- import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
6
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
5
+ import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';
6
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
7
7
  import type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';
8
8
  import type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';
9
9
  import type {RouteGroup} from '@shipfox/node-fastify';
@@ -1,5 +1,5 @@
1
1
  import {buildUserContext, setUserContext} from '@shipfox/api-auth-context';
2
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
3
3
  import {ClientError} from '@shipfox/node-fastify';
4
4
  import type {FastifyInstance} from 'fastify';
5
5
  import Fastify from 'fastify';
@@ -1,4 +1,4 @@
1
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
2
2
  import {workflowRunAttemptsResponseSchema} from '@shipfox/api-workflows-dto';
3
3
  import {defineRoute} from '@shipfox/node-fastify';
4
4
  import {z} from 'zod';
@@ -1,5 +1,5 @@
1
1
  import {buildUserContext, setUserContext} from '@shipfox/api-auth-context';
2
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
2
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
3
3
  import {encodeTimestampIdCursor} from '@shipfox/node-drizzle';
4
4
  import {eq} from 'drizzle-orm';
5
5
  import type {FastifyInstance} from 'fastify';
@@ -1,4 +1,4 @@
1
- import type {ProjectsModuleClient} from '@shipfox/api-projects-dto';
1
+ import type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';
2
2
  import {
3
3
  workflowRunListQuerySchema,
4
4
  workflowRunListResponseSchema,