@shipfox/api-definitions 6.0.0 → 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 (94) hide show
  1. package/.turbo/turbo-build.log +11 -13
  2. package/CHANGELOG.md +27 -0
  3. package/dist/config.d.ts +0 -4
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +1 -14
  6. package/dist/config.js.map +1 -1
  7. package/dist/core/index.d.ts +1 -1
  8. package/dist/core/index.d.ts.map +1 -1
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/core/integrations.d.ts +1 -1
  11. package/dist/core/integrations.d.ts.map +1 -1
  12. package/dist/core/integrations.js +1 -1
  13. package/dist/core/integrations.js.map +1 -1
  14. package/dist/core/parse-definition.d.ts +3 -3
  15. package/dist/core/parse-definition.d.ts.map +1 -1
  16. package/dist/core/parse-definition.js.map +1 -1
  17. package/dist/core/sync-definitions.d.ts +2 -0
  18. package/dist/core/sync-definitions.d.ts.map +1 -1
  19. package/dist/core/sync-definitions.js +9 -3
  20. package/dist/core/sync-definitions.js.map +1 -1
  21. package/dist/core/validate-definition.d.ts +3 -3
  22. package/dist/core/validate-definition.d.ts.map +1 -1
  23. package/dist/core/validate-definition.js +3 -3
  24. package/dist/core/validate-definition.js.map +1 -1
  25. package/dist/core/workflow-model/normalize-jobs.d.ts +2 -2
  26. package/dist/core/workflow-model/normalize-jobs.d.ts.map +1 -1
  27. package/dist/core/workflow-model/normalize-jobs.js +9 -11
  28. package/dist/core/workflow-model/normalize-jobs.js.map +1 -1
  29. package/dist/core/workflow-model/normalize-workflow-document.d.ts +3 -3
  30. package/dist/core/workflow-model/normalize-workflow-document.d.ts.map +1 -1
  31. package/dist/core/workflow-model/normalize-workflow-document.js +2 -4
  32. package/dist/core/workflow-model/normalize-workflow-document.js.map +1 -1
  33. package/dist/index.d.ts +5 -3
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +3 -2
  36. package/dist/index.js.map +1 -1
  37. package/dist/presentation/routes/create-definition.d.ts +4 -2
  38. package/dist/presentation/routes/create-definition.d.ts.map +1 -1
  39. package/dist/presentation/routes/create-definition.js +5 -1
  40. package/dist/presentation/routes/create-definition.js.map +1 -1
  41. package/dist/presentation/routes/get-definition.d.ts +1 -1
  42. package/dist/presentation/routes/get-definition.d.ts.map +1 -1
  43. package/dist/presentation/routes/get-definition.js.map +1 -1
  44. package/dist/presentation/routes/index.js +2 -2
  45. package/dist/presentation/routes/index.js.map +1 -1
  46. package/dist/presentation/routes/list-definitions.d.ts +1 -1
  47. package/dist/presentation/routes/list-definitions.d.ts.map +1 -1
  48. package/dist/presentation/routes/list-definitions.js.map +1 -1
  49. package/dist/presentation/routes/project-access.d.ts +1 -1
  50. package/dist/presentation/routes/project-access.d.ts.map +1 -1
  51. package/dist/presentation/routes/project-access.js.map +1 -1
  52. package/dist/presentation/routes/validate-definition.d.ts +2 -1
  53. package/dist/presentation/routes/validate-definition.d.ts.map +1 -1
  54. package/dist/presentation/routes/validate-definition.js +26 -22
  55. package/dist/presentation/routes/validate-definition.js.map +1 -1
  56. package/dist/temporal/activities/sync-activities.d.ts +3 -2
  57. package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
  58. package/dist/temporal/activities/sync-activities.js +8 -7
  59. package/dist/temporal/activities/sync-activities.js.map +1 -1
  60. package/dist/temporal/workflows/index.bundle.js +17195 -3337
  61. package/dist/tsconfig.test.tsbuildinfo +1 -1
  62. package/package.json +10 -28
  63. package/src/config.ts +1 -19
  64. package/src/core/index.ts +4 -1
  65. package/src/core/integrations.ts +1 -1
  66. package/src/core/parse-definition.test.ts +6 -1
  67. package/src/core/parse-definition.ts +3 -3
  68. package/src/core/sync-definitions.test.ts +9 -2
  69. package/src/core/sync-definitions.ts +13 -6
  70. package/src/core/validate-definition.test.ts +18 -4
  71. package/src/core/validate-definition.ts +5 -6
  72. package/src/core/workflow-model/normalize-jobs.ts +22 -23
  73. package/src/core/workflow-model/normalize-workflow-document.test.ts +37 -18
  74. package/src/core/workflow-model/normalize-workflow-document.ts +4 -9
  75. package/src/db/definitions.test.ts +2 -1
  76. package/src/db/schema/definitions.test.ts +2 -1
  77. package/src/index.ts +7 -4
  78. package/src/presentation/dto/definition.test.ts +2 -1
  79. package/src/presentation/routes/create-definition.test.ts +10 -3
  80. package/src/presentation/routes/create-definition.ts +7 -3
  81. package/src/presentation/routes/get-definition.test.ts +1 -1
  82. package/src/presentation/routes/get-definition.ts +1 -1
  83. package/src/presentation/routes/index.test.ts +6 -2
  84. package/src/presentation/routes/index.ts +2 -2
  85. package/src/presentation/routes/list-definitions.test.ts +1 -1
  86. package/src/presentation/routes/list-definitions.ts +1 -1
  87. package/src/presentation/routes/project-access.ts +1 -1
  88. package/src/presentation/routes/validate-definition.test.ts +8 -2
  89. package/src/presentation/routes/validate-definition.ts +27 -22
  90. package/src/temporal/activities/sync-activities.test.ts +19 -8
  91. package/src/temporal/activities/sync-activities.ts +16 -6
  92. package/test/agent-validation-catalog.ts +25 -0
  93. package/test/factories/definition.ts +2 -1
  94. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,21 +1,19 @@
1
1
  $ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
2
- Successfully compiled: 72 files with swc (669.81ms)
3
- 2026-07-21T08:11:36.825Z [INFO] asset workflow-bundle-5046e0cf40917a545f36.js 1.46 MiB [emitted] [immutable] (name: main)
4
- runtime modules 670 bytes 3 modules
5
- modules by path ../../../node_modules/.pnpm/ 424 KiB
6
- modules by path ../../../node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporal...(truncated) 155 KiB 34 modules
7
- modules by path ../../../node_modules/.pnpm/@temporalio+workflow@1.18.1/node_modules/@tempor...(truncated) 201 KiB 26 modules
8
- modules by path ../../../node_modules/.pnpm/nexus-rpc@0.0.2/node_modules/nexus-rpc/lib/ 22.3 KiB 13 modules
9
- + 2 modules
10
- modules by path ./dist/ 4.33 KiB
2
+ Successfully compiled: 72 files with swc (648.06ms)
3
+ 2026-07-22T14:53:26.245Z [INFO] asset workflow-bundle-2e2f2f4d6c035dc8e198.js 3.18 MiB [emitted] [immutable] (name: main)
4
+ orphan modules 33.5 KiB [orphan] 21 modules
5
+ runtime modules 1.13 KiB 5 modules
6
+ modules by path ../../../node_modules/.pnpm/ 970 KiB 196 modules
7
+ modules by path ./dist/ 4.72 KiB
11
8
  modules by path ./dist/temporal/workflows/*.js 3.28 KiB
12
9
  ./dist/temporal/workflows/index.js 64 bytes [built] [code generated]
13
10
  ./dist/temporal/workflows/definition-sync.js 3.22 KiB [built] [code generated]
14
- ./dist/temporal/workflows/index-autogenerated-entrypoint.cjs 530 bytes [built] [code generated]
11
+ ./dist/temporal/workflows/index-autogenerated-entrypoint.cjs 936 bytes [built] [code generated]
15
12
  ./dist/core/entities/sync-state.js 543 bytes [built] [code generated]
16
13
  optional modules 30 bytes [optional]
17
14
  __temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
18
15
  __temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
19
- webpack 5.107.2 compiled successfully in 4575 ms
20
- 2026-07-21T08:11:36.846Z [INFO] Workflow bundle created { size: '1.46MB' }
21
- /home/runner/work/shipfox/shipfox/libs/api/definitions/dist/temporal/workflows/index.js: 1528210 bytes
16
+ ../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
17
+ webpack 5.107.2 compiled successfully in 8316 ms
18
+ 2026-07-22T14:53:26.264Z [INFO] Workflow bundle created { size: '3.18MB' }
19
+ /home/runner/work/shipfox/shipfox/libs/api/definitions/dist/temporal/workflows/index.js: 3332889 bytes
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @shipfox/api-definitions
2
2
 
3
+ ## 8.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - de559bb: Moves Agent validation policy behind a versioned inter-module catalog and injects it into Definitions normalization.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [de559bb]
12
+ - Updated dependencies [7f227c6]
13
+ - @shipfox/api-agent-dto@8.0.0
14
+ - @shipfox/api-integration-core-dto@8.0.0
15
+ - @shipfox/api-projects-dto@8.0.0
16
+
17
+ ## 7.1.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [ac42c96]
22
+ - Updated dependencies [6ce08c0]
23
+ - @shipfox/node-error-monitoring@0.2.0
24
+ - @shipfox/node-fastify@0.3.0
25
+ - @shipfox/node-module@0.5.0
26
+ - @shipfox/node-temporal@0.4.0
27
+ - @shipfox/node-opentelemetry@0.6.0
28
+ - @shipfox/api-auth-context@7.1.0
29
+
3
30
  ## 6.0.0
4
31
 
5
32
  ### Patch Changes
package/dist/config.d.ts CHANGED
@@ -1,10 +1,6 @@
1
- import { type HarnessToolDeploymentConfig } from '@shipfox/api-agent-dto';
2
1
  export declare const config: Readonly<{
3
2
  DEFINITION_DEFAULT_RUNNER_LABEL: string;
4
- AGENT_PI_ENABLED_TOOL_PACKAGES: string;
5
- AGENT_PI_WEB_SEARCH_ENABLED: boolean;
6
3
  } & import("@shipfox/config").CleanedEnvAccessors>;
7
4
  export declare function parseDefinitionDefaultRunnerLabels(value: string): readonly string[];
8
5
  export declare const definitionDefaultRunnerLabels: readonly string[];
9
- export declare const definitionHarnessToolDeploymentConfig: HarnessToolDeploymentConfig;
10
6
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,wBAAwB,CAAC;AAIhC,eAAO,MAAM,MAAM;;;;kDAajB,CAAC;AAEH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAiBnF;AAED,eAAO,MAAM,6BAA6B,mBAEzC,CAAC;AAEF,eAAO,MAAM,qCAAqC,EAAE,2BAIhD,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;kDAKjB,CAAC;AAEH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAiBnF;AAED,eAAO,MAAM,6BAA6B,mBAEzC,CAAC"}
package/dist/config.js CHANGED
@@ -1,18 +1,9 @@
1
- import { buildHarnessToolDeploymentConfig } from '@shipfox/api-agent-dto';
2
- import { bool, createConfig, str } from '@shipfox/config';
1
+ import { createConfig, str } from '@shipfox/config';
3
2
  import { findInvalidLabels, MAX_RUNNER_LABELS, parseLabelList } from '@shipfox/runner-labels';
4
3
  export const config = createConfig({
5
4
  DEFINITION_DEFAULT_RUNNER_LABEL: str({
6
5
  desc: 'Default runner label(s) applied to workflow jobs that do not declare a "runner" at the job or workflow level. Set it to a comma-separated list, for example ubuntu-latest or ubuntu-latest,node-22. Leave it empty to require every workflow job to declare runner labels explicitly; with no value set, a job without a runner fails definition validation.',
7
6
  default: ''
8
- }),
9
- AGENT_PI_ENABLED_TOOL_PACKAGES: str({
10
- desc: 'Comma-separated optional Pi tool packages enabled for this deployment. Defaults to pi-web-access so Pi web access is available. Set it to an empty value to enable only Pi built-in tools. Accepted values: pi-web-access.',
11
- default: 'pi-web-access'
12
- }),
13
- AGENT_PI_WEB_SEARCH_ENABLED: bool({
14
- desc: 'Enables Pi web search tools when pi-web-access is enabled. Set it to false to disable web_search and get_search_content while keeping fetch_content available.',
15
- default: true
16
7
  })
17
8
  });
18
9
  export function parseDefinitionDefaultRunnerLabels(value) {
@@ -27,9 +18,5 @@ export function parseDefinitionDefaultRunnerLabels(value) {
27
18
  return labels;
28
19
  }
29
20
  export const definitionDefaultRunnerLabels = parseDefinitionDefaultRunnerLabels(config.DEFINITION_DEFAULT_RUNNER_LABEL);
30
- export const definitionHarnessToolDeploymentConfig = buildHarnessToolDeploymentConfig({
31
- piEnabledToolPackages: config.AGENT_PI_ENABLED_TOOL_PACKAGES,
32
- piWebSearchEnabled: config.AGENT_PI_WEB_SEARCH_ENABLED
33
- });
34
21
 
35
22
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts"],"sourcesContent":["import {\n buildHarnessToolDeploymentConfig,\n type HarnessToolDeploymentConfig,\n} from '@shipfox/api-agent-dto';\nimport {bool, createConfig, str} from '@shipfox/config';\nimport {findInvalidLabels, MAX_RUNNER_LABELS, parseLabelList} from '@shipfox/runner-labels';\n\nexport const config = createConfig({\n DEFINITION_DEFAULT_RUNNER_LABEL: str({\n desc: 'Default runner label(s) applied to workflow jobs that do not declare a \"runner\" at the job or workflow level. Set it to a comma-separated list, for example ubuntu-latest or ubuntu-latest,node-22. Leave it empty to require every workflow job to declare runner labels explicitly; with no value set, a job without a runner fails definition validation.',\n default: '',\n }),\n AGENT_PI_ENABLED_TOOL_PACKAGES: str({\n desc: 'Comma-separated optional Pi tool packages enabled for this deployment. Defaults to pi-web-access so Pi web access is available. Set it to an empty value to enable only Pi built-in tools. Accepted values: pi-web-access.',\n default: 'pi-web-access',\n }),\n AGENT_PI_WEB_SEARCH_ENABLED: bool({\n desc: 'Enables Pi web search tools when pi-web-access is enabled. Set it to false to disable web_search and get_search_content while keeping fetch_content available.',\n default: true,\n }),\n});\n\nexport function parseDefinitionDefaultRunnerLabels(value: string): readonly string[] {\n const labels = parseLabelList(value);\n const invalid = findInvalidLabels(labels);\n\n if (invalid.length > 0) {\n throw new Error(\n `DEFINITION_DEFAULT_RUNNER_LABEL contains invalid runner label(s): ${invalid.join(', ')}`,\n );\n }\n\n if (labels.length > MAX_RUNNER_LABELS) {\n throw new Error(\n `DEFINITION_DEFAULT_RUNNER_LABEL contains ${labels.length} runner labels; the maximum is ${MAX_RUNNER_LABELS}`,\n );\n }\n\n return labels;\n}\n\nexport const definitionDefaultRunnerLabels = parseDefinitionDefaultRunnerLabels(\n config.DEFINITION_DEFAULT_RUNNER_LABEL,\n);\n\nexport const definitionHarnessToolDeploymentConfig: HarnessToolDeploymentConfig =\n buildHarnessToolDeploymentConfig({\n piEnabledToolPackages: config.AGENT_PI_ENABLED_TOOL_PACKAGES,\n piWebSearchEnabled: config.AGENT_PI_WEB_SEARCH_ENABLED,\n });\n"],"names":["buildHarnessToolDeploymentConfig","bool","createConfig","str","findInvalidLabels","MAX_RUNNER_LABELS","parseLabelList","config","DEFINITION_DEFAULT_RUNNER_LABEL","desc","default","AGENT_PI_ENABLED_TOOL_PACKAGES","AGENT_PI_WEB_SEARCH_ENABLED","parseDefinitionDefaultRunnerLabels","value","labels","invalid","length","Error","join","definitionDefaultRunnerLabels","definitionHarnessToolDeploymentConfig","piEnabledToolPackages","piWebSearchEnabled"],"mappings":"AAAA,SACEA,gCAAgC,QAE3B,yBAAyB;AAChC,SAAQC,IAAI,EAAEC,YAAY,EAAEC,GAAG,QAAO,kBAAkB;AACxD,SAAQC,iBAAiB,EAAEC,iBAAiB,EAAEC,cAAc,QAAO,yBAAyB;AAE5F,OAAO,MAAMC,SAASL,aAAa;IACjCM,iCAAiCL,IAAI;QACnCM,MAAM;QACNC,SAAS;IACX;IACAC,gCAAgCR,IAAI;QAClCM,MAAM;QACNC,SAAS;IACX;IACAE,6BAA6BX,KAAK;QAChCQ,MAAM;QACNC,SAAS;IACX;AACF,GAAG;AAEH,OAAO,SAASG,mCAAmCC,KAAa;IAC9D,MAAMC,SAAST,eAAeQ;IAC9B,MAAME,UAAUZ,kBAAkBW;IAElC,IAAIC,QAAQC,MAAM,GAAG,GAAG;QACtB,MAAM,IAAIC,MACR,CAAC,kEAAkE,EAAEF,QAAQG,IAAI,CAAC,OAAO;IAE7F;IAEA,IAAIJ,OAAOE,MAAM,GAAGZ,mBAAmB;QACrC,MAAM,IAAIa,MACR,CAAC,yCAAyC,EAAEH,OAAOE,MAAM,CAAC,+BAA+B,EAAEZ,mBAAmB;IAElH;IAEA,OAAOU;AACT;AAEA,OAAO,MAAMK,gCAAgCP,mCAC3CN,OAAOC,+BAA+B,EACtC;AAEF,OAAO,MAAMa,wCACXrB,iCAAiC;IAC/BsB,uBAAuBf,OAAOI,8BAA8B;IAC5DY,oBAAoBhB,OAAOK,2BAA2B;AACxD,GAAG"}
1
+ {"version":3,"sources":["../src/config.ts"],"sourcesContent":["import {createConfig, str} from '@shipfox/config';\nimport {findInvalidLabels, MAX_RUNNER_LABELS, parseLabelList} from '@shipfox/runner-labels';\n\nexport const config = createConfig({\n DEFINITION_DEFAULT_RUNNER_LABEL: str({\n desc: 'Default runner label(s) applied to workflow jobs that do not declare a \"runner\" at the job or workflow level. Set it to a comma-separated list, for example ubuntu-latest or ubuntu-latest,node-22. Leave it empty to require every workflow job to declare runner labels explicitly; with no value set, a job without a runner fails definition validation.',\n default: '',\n }),\n});\n\nexport function parseDefinitionDefaultRunnerLabels(value: string): readonly string[] {\n const labels = parseLabelList(value);\n const invalid = findInvalidLabels(labels);\n\n if (invalid.length > 0) {\n throw new Error(\n `DEFINITION_DEFAULT_RUNNER_LABEL contains invalid runner label(s): ${invalid.join(', ')}`,\n );\n }\n\n if (labels.length > MAX_RUNNER_LABELS) {\n throw new Error(\n `DEFINITION_DEFAULT_RUNNER_LABEL contains ${labels.length} runner labels; the maximum is ${MAX_RUNNER_LABELS}`,\n );\n }\n\n return labels;\n}\n\nexport const definitionDefaultRunnerLabels = parseDefinitionDefaultRunnerLabels(\n config.DEFINITION_DEFAULT_RUNNER_LABEL,\n);\n"],"names":["createConfig","str","findInvalidLabels","MAX_RUNNER_LABELS","parseLabelList","config","DEFINITION_DEFAULT_RUNNER_LABEL","desc","default","parseDefinitionDefaultRunnerLabels","value","labels","invalid","length","Error","join","definitionDefaultRunnerLabels"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,GAAG,QAAO,kBAAkB;AAClD,SAAQC,iBAAiB,EAAEC,iBAAiB,EAAEC,cAAc,QAAO,yBAAyB;AAE5F,OAAO,MAAMC,SAASL,aAAa;IACjCM,iCAAiCL,IAAI;QACnCM,MAAM;QACNC,SAAS;IACX;AACF,GAAG;AAEH,OAAO,SAASC,mCAAmCC,KAAa;IAC9D,MAAMC,SAASP,eAAeM;IAC9B,MAAME,UAAUV,kBAAkBS;IAElC,IAAIC,QAAQC,MAAM,GAAG,GAAG;QACtB,MAAM,IAAIC,MACR,CAAC,kEAAkE,EAAEF,QAAQG,IAAI,CAAC,OAAO;IAE7F;IAEA,IAAIJ,OAAOE,MAAM,GAAGV,mBAAmB;QACrC,MAAM,IAAIW,MACR,CAAC,yCAAyC,EAAEH,OAAOE,MAAM,CAAC,+BAA+B,EAAEV,mBAAmB;IAElH;IAEA,OAAOQ;AACT;AAEA,OAAO,MAAMK,gCAAgCP,mCAC3CJ,OAAOC,+BAA+B,EACtC"}
@@ -1,5 +1,5 @@
1
1
  export type * from './entities/index.js';
2
- export { DefinitionParseError, DefinitionSyncPermanentError } from './errors.js';
2
+ export { DefinitionParseError, DefinitionSyncPermanentError, } from './errors.js';
3
3
  export { parseDefinition } from './parse-definition.js';
4
4
  export { classifySyncFailure, type DiscoverWorkflowFilesParams, discoverWorkflowFiles, type FetchAndParseWorkflowsParams, FILE_FETCH_CONCURRENCY, fetchAndParseWorkflows, MAX_WORKFLOW_FILES, type ParsedWorkflow, type ResolvedSyncSource, resolveSyncSource, type SyncFailureClassification, type SyncSourceContext, UNRESOLVED_SYNC_REF, WORKFLOW_PREFIX, } from './sync-definitions.js';
5
5
  export { DEFAULT_RUN_TIMEOUT_MS } from './workflow-model/constants.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,qBAAqB,CAAC;AACzC,OAAO,EAAC,oBAAoB,EAAE,4BAA4B,EAAC,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,KAAK,2BAA2B,EAChC,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,sBAAsB,EAAC,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAC,mBAAmB,EAAC,MAAM,2CAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,qBAAqB,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,KAAK,2BAA2B,EAChC,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,sBAAsB,EAAC,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAC,mBAAmB,EAAC,MAAM,2CAA2C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export type * from './entities/index.js';\nexport {DefinitionParseError, DefinitionSyncPermanentError} from './errors.js';\nexport {parseDefinition} from './parse-definition.js';\nexport {\n classifySyncFailure,\n type DiscoverWorkflowFilesParams,\n discoverWorkflowFiles,\n type FetchAndParseWorkflowsParams,\n FILE_FETCH_CONCURRENCY,\n fetchAndParseWorkflows,\n MAX_WORKFLOW_FILES,\n type ParsedWorkflow,\n type ResolvedSyncSource,\n resolveSyncSource,\n type SyncFailureClassification,\n type SyncSourceContext,\n UNRESOLVED_SYNC_REF,\n WORKFLOW_PREFIX,\n} from './sync-definitions.js';\nexport {DEFAULT_RUN_TIMEOUT_MS} from './workflow-model/constants.js';\nexport {normalizeWorkflowDocument} from './workflow-model/index.js';\nexport {DEFAULT_JOB_CHECKOUT} from './workflow-model/normalize-job-checkout.js';\nexport {DEFAULT_JOB_SUCCESS} from './workflow-model/normalize-job-success.js';\n"],"names":["DefinitionParseError","DefinitionSyncPermanentError","parseDefinition","classifySyncFailure","discoverWorkflowFiles","FILE_FETCH_CONCURRENCY","fetchAndParseWorkflows","MAX_WORKFLOW_FILES","resolveSyncSource","UNRESOLVED_SYNC_REF","WORKFLOW_PREFIX","DEFAULT_RUN_TIMEOUT_MS","normalizeWorkflowDocument","DEFAULT_JOB_CHECKOUT","DEFAULT_JOB_SUCCESS"],"mappings":"AACA,SAAQA,oBAAoB,EAAEC,4BAA4B,QAAO,cAAc;AAC/E,SAAQC,eAAe,QAAO,wBAAwB;AACtD,SACEC,mBAAmB,EAEnBC,qBAAqB,EAErBC,sBAAsB,EACtBC,sBAAsB,EACtBC,kBAAkB,EAGlBC,iBAAiB,EAGjBC,mBAAmB,EACnBC,eAAe,QACV,wBAAwB;AAC/B,SAAQC,sBAAsB,QAAO,gCAAgC;AACrE,SAAQC,yBAAyB,QAAO,4BAA4B;AACpE,SAAQC,oBAAoB,QAAO,6CAA6C;AAChF,SAAQC,mBAAmB,QAAO,4CAA4C"}
1
+ {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export type * from './entities/index.js';\nexport {\n DefinitionParseError,\n DefinitionSyncPermanentError,\n} from './errors.js';\nexport {parseDefinition} from './parse-definition.js';\nexport {\n classifySyncFailure,\n type DiscoverWorkflowFilesParams,\n discoverWorkflowFiles,\n type FetchAndParseWorkflowsParams,\n FILE_FETCH_CONCURRENCY,\n fetchAndParseWorkflows,\n MAX_WORKFLOW_FILES,\n type ParsedWorkflow,\n type ResolvedSyncSource,\n resolveSyncSource,\n type SyncFailureClassification,\n type SyncSourceContext,\n UNRESOLVED_SYNC_REF,\n WORKFLOW_PREFIX,\n} from './sync-definitions.js';\nexport {DEFAULT_RUN_TIMEOUT_MS} from './workflow-model/constants.js';\nexport {normalizeWorkflowDocument} from './workflow-model/index.js';\nexport {DEFAULT_JOB_CHECKOUT} from './workflow-model/normalize-job-checkout.js';\nexport {DEFAULT_JOB_SUCCESS} from './workflow-model/normalize-job-success.js';\n"],"names":["DefinitionParseError","DefinitionSyncPermanentError","parseDefinition","classifySyncFailure","discoverWorkflowFiles","FILE_FETCH_CONCURRENCY","fetchAndParseWorkflows","MAX_WORKFLOW_FILES","resolveSyncSource","UNRESOLVED_SYNC_REF","WORKFLOW_PREFIX","DEFAULT_RUN_TIMEOUT_MS","normalizeWorkflowDocument","DEFAULT_JOB_CHECKOUT","DEFAULT_JOB_SUCCESS"],"mappings":"AACA,SACEA,oBAAoB,EACpBC,4BAA4B,QACvB,cAAc;AACrB,SAAQC,eAAe,QAAO,wBAAwB;AACtD,SACEC,mBAAmB,EAEnBC,qBAAqB,EAErBC,sBAAsB,EACtBC,sBAAsB,EACtBC,kBAAkB,EAGlBC,iBAAiB,EAGjBC,mBAAmB,EACnBC,eAAe,QACV,wBAAwB;AAC/B,SAAQC,sBAAsB,QAAO,gCAAgC;AACrE,SAAQC,yBAAyB,QAAO,4BAA4B;AACpE,SAAQC,oBAAoB,QAAO,6CAA6C;AAChF,SAAQC,mBAAmB,QAAO,4CAA4C"}
@@ -1,4 +1,4 @@
1
- import { type IntegrationsModuleClient, integrationsInterModuleContract } from '@shipfox/api-integration-core-dto';
1
+ import { type IntegrationsModuleClient, integrationsInterModuleContract } from '@shipfox/api-integration-core-dto/inter-module';
2
2
  export type DefinitionsSourceControl = {
3
3
  resolveRepository: IntegrationsModuleClient['resolveSourceRepository'];
4
4
  listFiles: IntegrationsModuleClient['listSourceFiles'];
@@ -1 +1 @@
1
- {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/core/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,+BAA+B,EAChC,MAAM,mCAAmC,CAAC;AAE3C,MAAM,MAAM,wBAAwB,GAAG;IACrC,iBAAiB,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;IACvE,SAAS,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;IACvD,SAAS,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;CACxD,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,wBAAwB,GACrC,wBAAwB,CAM1B;AAED,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,wBAAwB,EACtC,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM;;;;;;;;;;;;;;;GAY5B;AAED,OAAO,EAAC,+BAA+B,EAAC,CAAC"}
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/core/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,+BAA+B,EAChC,MAAM,gDAAgD,CAAC;AAExD,MAAM,MAAM,wBAAwB,GAAG;IACrC,iBAAiB,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;IACvE,SAAS,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;IACvD,SAAS,EAAE,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;CACxD,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,wBAAwB,GACrC,wBAAwB,CAM1B;AAED,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,wBAAwB,EACtC,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM;;;;;;;;;;;;;;;GAY5B;AAED,OAAO,EAAC,+BAA+B,EAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto';
1
+ import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto/inter-module';
2
2
  export function createDefinitionsSourceControl(integrations) {
3
3
  return {
4
4
  resolveRepository: integrations.resolveSourceRepository,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/integrations.ts"],"sourcesContent":["import {\n type IntegrationsModuleClient,\n integrationsInterModuleContract,\n} from '@shipfox/api-integration-core-dto';\n\nexport type DefinitionsSourceControl = {\n resolveRepository: IntegrationsModuleClient['resolveSourceRepository'];\n listFiles: IntegrationsModuleClient['listSourceFiles'];\n fetchFile: IntegrationsModuleClient['fetchSourceFile'];\n};\n\nexport function createDefinitionsSourceControl(\n integrations: IntegrationsModuleClient,\n): DefinitionsSourceControl {\n return {\n resolveRepository: integrations.resolveSourceRepository,\n listFiles: integrations.listSourceFiles,\n fetchFile: integrations.fetchSourceFile,\n };\n}\n\nexport async function loadIntegrationValidationContext(\n integrations: IntegrationsModuleClient,\n workspaceId: string,\n defaultConnectionId: string,\n) {\n const context = await integrations.getAgentToolsContext({workspaceId, defaultConnectionId});\n return {\n agentToolSelectionCatalogs: new Map(\n context.selectionCatalogs.map(({provider, selectors}) => [provider, {selectors}]),\n ),\n workspaceConnectionSnapshot: new Map(\n context.workspaceConnections.map(({slug, ...connection}) => [slug, connection]),\n ),\n defaultConnectionSlug: context.defaultConnection?.slug,\n };\n}\n\nexport {integrationsInterModuleContract};\n"],"names":["integrationsInterModuleContract","createDefinitionsSourceControl","integrations","resolveRepository","resolveSourceRepository","listFiles","listSourceFiles","fetchFile","fetchSourceFile","loadIntegrationValidationContext","workspaceId","defaultConnectionId","context","getAgentToolsContext","agentToolSelectionCatalogs","Map","selectionCatalogs","map","provider","selectors","workspaceConnectionSnapshot","workspaceConnections","slug","connection","defaultConnectionSlug","defaultConnection"],"mappings":"AAAA,SAEEA,+BAA+B,QAC1B,oCAAoC;AAQ3C,OAAO,SAASC,+BACdC,YAAsC;IAEtC,OAAO;QACLC,mBAAmBD,aAAaE,uBAAuB;QACvDC,WAAWH,aAAaI,eAAe;QACvCC,WAAWL,aAAaM,eAAe;IACzC;AACF;AAEA,OAAO,eAAeC,iCACpBP,YAAsC,EACtCQ,WAAmB,EACnBC,mBAA2B;IAE3B,MAAMC,UAAU,MAAMV,aAAaW,oBAAoB,CAAC;QAACH;QAAaC;IAAmB;IACzF,OAAO;QACLG,4BAA4B,IAAIC,IAC9BH,QAAQI,iBAAiB,CAACC,GAAG,CAAC,CAAC,EAACC,QAAQ,EAAEC,SAAS,EAAC,GAAK;gBAACD;gBAAU;oBAACC;gBAAS;aAAE;QAElFC,6BAA6B,IAAIL,IAC/BH,QAAQS,oBAAoB,CAACJ,GAAG,CAAC,CAAC,EAACK,IAAI,EAAE,GAAGC,YAAW,GAAK;gBAACD;gBAAMC;aAAW;QAEhFC,uBAAuBZ,QAAQa,iBAAiB,EAAEH;IACpD;AACF;AAEA,SAAQtB,+BAA+B,GAAE"}
1
+ {"version":3,"sources":["../../src/core/integrations.ts"],"sourcesContent":["import {\n type IntegrationsModuleClient,\n integrationsInterModuleContract,\n} from '@shipfox/api-integration-core-dto/inter-module';\n\nexport type DefinitionsSourceControl = {\n resolveRepository: IntegrationsModuleClient['resolveSourceRepository'];\n listFiles: IntegrationsModuleClient['listSourceFiles'];\n fetchFile: IntegrationsModuleClient['fetchSourceFile'];\n};\n\nexport function createDefinitionsSourceControl(\n integrations: IntegrationsModuleClient,\n): DefinitionsSourceControl {\n return {\n resolveRepository: integrations.resolveSourceRepository,\n listFiles: integrations.listSourceFiles,\n fetchFile: integrations.fetchSourceFile,\n };\n}\n\nexport async function loadIntegrationValidationContext(\n integrations: IntegrationsModuleClient,\n workspaceId: string,\n defaultConnectionId: string,\n) {\n const context = await integrations.getAgentToolsContext({workspaceId, defaultConnectionId});\n return {\n agentToolSelectionCatalogs: new Map(\n context.selectionCatalogs.map(({provider, selectors}) => [provider, {selectors}]),\n ),\n workspaceConnectionSnapshot: new Map(\n context.workspaceConnections.map(({slug, ...connection}) => [slug, connection]),\n ),\n defaultConnectionSlug: context.defaultConnection?.slug,\n };\n}\n\nexport {integrationsInterModuleContract};\n"],"names":["integrationsInterModuleContract","createDefinitionsSourceControl","integrations","resolveRepository","resolveSourceRepository","listFiles","listSourceFiles","fetchFile","fetchSourceFile","loadIntegrationValidationContext","workspaceId","defaultConnectionId","context","getAgentToolsContext","agentToolSelectionCatalogs","Map","selectionCatalogs","map","provider","selectors","workspaceConnectionSnapshot","workspaceConnections","slug","connection","defaultConnectionSlug","defaultConnection"],"mappings":"AAAA,SAEEA,+BAA+B,QAC1B,iDAAiD;AAQxD,OAAO,SAASC,+BACdC,YAAsC;IAEtC,OAAO;QACLC,mBAAmBD,aAAaE,uBAAuB;QACvDC,WAAWH,aAAaI,eAAe;QACvCC,WAAWL,aAAaM,eAAe;IACzC;AACF;AAEA,OAAO,eAAeC,iCACpBP,YAAsC,EACtCQ,WAAmB,EACnBC,mBAA2B;IAE3B,MAAMC,UAAU,MAAMV,aAAaW,oBAAoB,CAAC;QAACH;QAAaC;IAAmB;IACzF,OAAO;QACLG,4BAA4B,IAAIC,IAC9BH,QAAQI,iBAAiB,CAACC,GAAG,CAAC,CAAC,EAACC,QAAQ,EAAEC,SAAS,EAAC,GAAK;gBAACD;gBAAU;oBAACC;gBAAS;aAAE;QAElFC,6BAA6B,IAAIL,IAC/BH,QAAQS,oBAAoB,CAACJ,GAAG,CAAC,CAAC,EAACK,IAAI,EAAE,GAAGC,YAAW,GAAK;gBAACD;gBAAMC;aAAW;QAEhFC,uBAAuBZ,QAAQa,iBAAiB,EAAEH;IACpD;AACF;AAEA,SAAQtB,+BAA+B,GAAE"}
@@ -1,9 +1,9 @@
1
- import type { HarnessToolDeploymentConfig } from '@shipfox/api-agent-dto';
1
+ import type { AgentValidationCatalog } from '@shipfox/api-agent-dto/inter-module';
2
2
  import type { IntegrationValidationContext } from './entities/integration-context.js';
3
3
  import type { WorkflowDefinitionPayload } from './entities/workflow-definition.js';
4
- export declare function parseDefinition(yamlString: string, options?: {
4
+ export declare function parseDefinition(yamlString: string, options: {
5
5
  defaultRunnerLabels?: readonly string[];
6
- harnessToolDeploymentConfig?: HarnessToolDeploymentConfig;
6
+ agentValidationCatalog: AgentValidationCatalog;
7
7
  integrationValidationContext?: IntegrationValidationContext;
8
8
  }): WorkflowDefinitionPayload;
9
9
  //# sourceMappingURL=parse-definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-definition.d.ts","sourceRoot":"","sources":["../../src/core/parse-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAIjF,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;IAC1D,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;CAC7D,GACA,yBAAyB,CAc3B"}
1
+ {"version":3,"file":"parse-definition.d.ts","sourceRoot":"","sources":["../../src/core/parse-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAIjF,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE;IACP,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;CAC7D,GACA,yBAAyB,CAc3B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/parse-definition.ts"],"sourcesContent":["import type {HarnessToolDeploymentConfig} from '@shipfox/api-agent-dto';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {DefinitionParseError} from './errors.js';\nimport {validateDefinition} from './validate-definition.js';\n\nexport function parseDefinition(\n yamlString: string,\n options?: {\n defaultRunnerLabels?: readonly string[];\n harnessToolDeploymentConfig?: HarnessToolDeploymentConfig;\n integrationValidationContext?: IntegrationValidationContext;\n },\n): WorkflowDefinitionPayload {\n const result = validateDefinition(yamlString, options);\n\n if (!result.valid) {\n throw new DefinitionParseError(\n result.errors[0]?.message ?? 'Invalid definition',\n result.errors,\n );\n }\n\n return {\n ...result.definition,\n sourceSnapshot: {content: yamlString, format: 'yaml'},\n };\n}\n"],"names":["DefinitionParseError","validateDefinition","parseDefinition","yamlString","options","result","valid","errors","message","definition","sourceSnapshot","content","format"],"mappings":"AAGA,SAAQA,oBAAoB,QAAO,cAAc;AACjD,SAAQC,kBAAkB,QAAO,2BAA2B;AAE5D,OAAO,SAASC,gBACdC,UAAkB,EAClBC,OAIC;IAED,MAAMC,SAASJ,mBAAmBE,YAAYC;IAE9C,IAAI,CAACC,OAAOC,KAAK,EAAE;QACjB,MAAM,IAAIN,qBACRK,OAAOE,MAAM,CAAC,EAAE,EAAEC,WAAW,sBAC7BH,OAAOE,MAAM;IAEjB;IAEA,OAAO;QACL,GAAGF,OAAOI,UAAU;QACpBC,gBAAgB;YAACC,SAASR;YAAYS,QAAQ;QAAM;IACtD;AACF"}
1
+ {"version":3,"sources":["../../src/core/parse-definition.ts"],"sourcesContent":["import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {DefinitionParseError} from './errors.js';\nimport {validateDefinition} from './validate-definition.js';\n\nexport function parseDefinition(\n yamlString: string,\n options: {\n defaultRunnerLabels?: readonly string[];\n agentValidationCatalog: AgentValidationCatalog;\n integrationValidationContext?: IntegrationValidationContext;\n },\n): WorkflowDefinitionPayload {\n const result = validateDefinition(yamlString, options);\n\n if (!result.valid) {\n throw new DefinitionParseError(\n result.errors[0]?.message ?? 'Invalid definition',\n result.errors,\n );\n }\n\n return {\n ...result.definition,\n sourceSnapshot: {content: yamlString, format: 'yaml'},\n };\n}\n"],"names":["DefinitionParseError","validateDefinition","parseDefinition","yamlString","options","result","valid","errors","message","definition","sourceSnapshot","content","format"],"mappings":"AAGA,SAAQA,oBAAoB,QAAO,cAAc;AACjD,SAAQC,kBAAkB,QAAO,2BAA2B;AAE5D,OAAO,SAASC,gBACdC,UAAkB,EAClBC,OAIC;IAED,MAAMC,SAASJ,mBAAmBE,YAAYC;IAE9C,IAAI,CAACC,OAAOC,KAAK,EAAE;QACjB,MAAM,IAAIN,qBACRK,OAAOE,MAAM,CAAC,EAAE,EAAEC,WAAW,sBAC7BH,OAAOE,MAAM;IAEjB;IAEA,OAAO;QACL,GAAGF,OAAOI,UAAU;QACpBC,gBAAgB;YAACC,SAASR;YAAYS,QAAQ;QAAM;IACtD;AACF"}
@@ -1,3 +1,4 @@
1
+ import type { AgentValidationCatalog } from '@shipfox/api-agent-dto/inter-module';
1
2
  import type { IntegrationValidationContext } from './entities/integration-context.js';
2
3
  import type { DefinitionSyncErrorCode } from './entities/sync-state.js';
3
4
  import type { WorkflowDefinitionPayload } from './entities/workflow-definition.js';
@@ -32,6 +33,7 @@ export interface FetchAndParseWorkflowsParams extends SyncSourceContext {
32
33
  ref: string;
33
34
  paths: string[];
34
35
  onProgress?: ((path: string) => void) | undefined;
36
+ agentValidationCatalog: AgentValidationCatalog;
35
37
  loadIntegrationValidationContext?: (() => Promise<IntegrationValidationContext>) | undefined;
36
38
  }
37
39
  export declare function fetchAndParseWorkflows(params: FetchAndParseWorkflowsParams): Promise<ParsedWorkflow[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"sync-definitions.d.ts","sourceRoot":"","sources":["../../src/core/sync-definitions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAGjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAGhE,eAAO,MAAM,eAAe,wBAAwB,CAAC;AACrD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,aAAa,EAAE,wBAAwB,CAAC;CACzC;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAO9F;AAED,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC,CA2B5B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,yBAA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@
1
1
  import { createHash } from 'node:crypto';
2
- import { integrationsInterModuleContract, MAX_REPOSITORY_FILE_BYTES } from '@shipfox/api-integration-core-dto';
2
+ import { MAX_REPOSITORY_FILE_BYTES } from '@shipfox/api-integration-core-dto';
3
+ import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto/inter-module';
3
4
  import { isInterModuleKnownError } from '@shipfox/inter-module';
4
5
  import { boundedMap } from '@shipfox/node-module';
5
6
  import { DefinitionParseError, DefinitionSyncPermanentError } from './errors.js';
@@ -55,7 +56,8 @@ export async function fetchAndParseWorkflows(params) {
55
56
  return {
56
57
  ...parseWorkflowSnapshot({
57
58
  path: snapshot.path,
58
- content: snapshot.content
59
+ content: snapshot.content,
60
+ agentValidationCatalog: params.agentValidationCatalog
59
61
  }),
60
62
  rawContent: snapshot.content
61
63
  };
@@ -69,12 +71,16 @@ export async function fetchAndParseWorkflows(params) {
69
71
  return parsed.map((entry)=>parseWorkflowSnapshot({
70
72
  path: entry.path,
71
73
  content: entry.rawContent,
74
+ agentValidationCatalog: params.agentValidationCatalog,
72
75
  integrationValidationContext
73
76
  }));
74
77
  }
75
78
  function parseWorkflowSnapshot(params) {
76
79
  try {
77
- const definition = params.integrationValidationContext === undefined ? parseDefinition(params.content) : parseDefinition(params.content, {
80
+ const definition = params.integrationValidationContext === undefined ? parseDefinition(params.content, {
81
+ agentValidationCatalog: params.agentValidationCatalog
82
+ }) : parseDefinition(params.content, {
83
+ agentValidationCatalog: params.agentValidationCatalog,
78
84
  integrationValidationContext: params.integrationValidationContext
79
85
  });
80
86
  const contentHash = sha256Hex(params.content);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/sync-definitions.ts"],"sourcesContent":["import {createHash} from 'node:crypto';\nimport {\n integrationsInterModuleContract,\n MAX_REPOSITORY_FILE_BYTES,\n} from '@shipfox/api-integration-core-dto';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {boundedMap} from '@shipfox/node-module';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {DefinitionSyncErrorCode} from './entities/sync-state.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {DefinitionParseError, DefinitionSyncPermanentError} from './errors.js';\nimport {hasAgentStepIntegrations} from './has-agent-step-integrations.js';\nimport type {DefinitionsSourceControl} from './integrations.js';\nimport {parseDefinition} from './parse-definition.js';\n\nexport const WORKFLOW_PREFIX = '.shipfox/workflows/';\nexport const MAX_WORKFLOW_FILES = 100;\nexport const FILE_FETCH_CONCURRENCY = 4;\nexport const UNRESOLVED_SYNC_REF = '__unresolved__';\n\nexport interface SyncSourceContext {\n workspaceId: string;\n sourceConnectionId: string;\n sourceExternalRepositoryId: string;\n sourceControl: DefinitionsSourceControl;\n}\n\nexport interface ResolvedSyncSource {\n ref: string;\n}\n\nexport async function resolveSyncSource(params: SyncSourceContext): Promise<ResolvedSyncSource> {\n const source = await params.sourceControl.resolveRepository({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n });\n return {ref: source.repository.defaultBranch};\n}\n\nexport interface DiscoverWorkflowFilesParams extends SyncSourceContext {\n ref: string;\n}\n\nexport async function discoverWorkflowFiles(\n params: DiscoverWorkflowFilesParams,\n): Promise<{paths: string[]}> {\n const page = await params.sourceControl.listFiles({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n prefix: WORKFLOW_PREFIX,\n limit: MAX_WORKFLOW_FILES,\n });\n if (page.nextCursor) {\n throw new DefinitionSyncPermanentError(\n 'too-many-files',\n `More than ${MAX_WORKFLOW_FILES} workflow files were found`,\n );\n }\n\n const paths = page.files\n .filter((file) => file.path.endsWith('.yml') || file.path.endsWith('.yaml'))\n .map((file) => file.path);\n if (paths.length === 0) {\n throw new DefinitionSyncPermanentError(\n 'no-workflow-files',\n `No workflow files were found under ${WORKFLOW_PREFIX}`,\n );\n }\n\n return {paths};\n}\n\nexport interface ParsedWorkflow {\n path: string;\n name: string;\n definition: WorkflowDefinitionPayload;\n contentHash: string;\n}\n\nexport interface FetchAndParseWorkflowsParams extends SyncSourceContext {\n ref: string;\n paths: string[];\n onProgress?: ((path: string) => void) | undefined;\n loadIntegrationValidationContext?: (() => Promise<IntegrationValidationContext>) | undefined;\n}\n\nexport async function fetchAndParseWorkflows(\n params: FetchAndParseWorkflowsParams,\n): Promise<ParsedWorkflow[]> {\n const parsed = await boundedMap(\n params.paths,\n FILE_FETCH_CONCURRENCY,\n async (path) => {\n params.onProgress?.(path);\n\n const snapshot = await params.sourceControl.fetchFile({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n path,\n });\n\n if (Buffer.byteLength(snapshot.content, 'utf8') > MAX_REPOSITORY_FILE_BYTES) {\n throw new DefinitionSyncPermanentError(\n 'content-too-large',\n `Workflow file is larger than ${MAX_REPOSITORY_FILE_BYTES} bytes: ${snapshot.path}`,\n );\n }\n\n return {\n ...parseWorkflowSnapshot({path: snapshot.path, content: snapshot.content}),\n rawContent: snapshot.content,\n };\n },\n {stopOnError: true},\n );\n\n if (\n !params.loadIntegrationValidationContext ||\n !parsed.some((entry) => hasAgentStepIntegrations(entry.definition.document))\n ) {\n return parsed.map(({rawContent: _rawContent, ...entry}) => entry);\n }\n\n const integrationValidationContext = await params.loadIntegrationValidationContext();\n return parsed.map((entry) =>\n parseWorkflowSnapshot({\n path: entry.path,\n content: entry.rawContent,\n integrationValidationContext,\n }),\n );\n}\n\nfunction parseWorkflowSnapshot(params: {\n path: string;\n content: string;\n integrationValidationContext?: IntegrationValidationContext | undefined;\n}): ParsedWorkflow {\n try {\n const definition =\n params.integrationValidationContext === undefined\n ? parseDefinition(params.content)\n : parseDefinition(params.content, {\n integrationValidationContext: params.integrationValidationContext,\n });\n const contentHash = sha256Hex(params.content);\n return {path: params.path, name: definition.document.name, definition, contentHash};\n } catch (error) {\n if (error instanceof DefinitionParseError) {\n throw new DefinitionSyncPermanentError(\n 'invalid-definition',\n `Invalid workflow definition at ${params.path}: ${error.message}`,\n );\n }\n throw error;\n }\n}\n\nexport interface SyncFailureClassification {\n code: DefinitionSyncErrorCode;\n message: string;\n retryable: boolean;\n}\n\nexport function classifySyncFailure(error: unknown): SyncFailureClassification {\n if (error instanceof DefinitionSyncPermanentError) {\n return {code: error.code, message: error.message, retryable: false};\n }\n const methods = [\n integrationsInterModuleContract.methods.resolveSourceRepository,\n integrationsInterModuleContract.methods.listSourceFiles,\n integrationsInterModuleContract.methods.fetchSourceFile,\n ] as const;\n for (const method of methods) {\n if (!isInterModuleKnownError(method, error)) continue;\n if (\n error.code === 'connection-not-found' ||\n error.code === 'connection-inactive' ||\n error.code === 'connection-workspace-mismatch'\n ) {\n return {code: 'connection-unavailable', message: error.message, retryable: false};\n }\n if (error.code === 'provider-failure') {\n return {\n code: providerErrorCode(error.details.reason),\n message: error.message,\n retryable: isProviderReasonRetryable(error.details.reason),\n };\n }\n }\n return {\n code: 'unknown',\n message: error instanceof Error ? error.message : String(error),\n retryable: true,\n };\n}\n\nfunction isProviderReasonRetryable(reason: string): boolean {\n return reason === 'rate-limited' || reason === 'timeout' || reason === 'provider-unavailable';\n}\n\nfunction providerErrorCode(reason: string): DefinitionSyncErrorCode {\n if (reason === 'repository-not-found') return 'provider-repository-not-found';\n if (reason === 'file-not-found') return 'provider-file-not-found';\n if (reason === 'access-denied') return 'provider-access-denied';\n if (reason === 'rate-limited') return 'provider-rate-limited';\n if (reason === 'timeout') return 'provider-timeout';\n if (reason === 'provider-unavailable') return 'provider-unavailable';\n if (reason === 'malformed-provider-response') return 'provider-malformed-response';\n if (reason === 'content-too-large') return 'content-too-large';\n if (reason === 'too-many-files') return 'too-many-files';\n return 'unknown';\n}\n\nfunction sha256Hex(content: string): string {\n return createHash('sha256').update(content, 'utf8').digest('hex');\n}\n"],"names":["createHash","integrationsInterModuleContract","MAX_REPOSITORY_FILE_BYTES","isInterModuleKnownError","boundedMap","DefinitionParseError","DefinitionSyncPermanentError","hasAgentStepIntegrations","parseDefinition","WORKFLOW_PREFIX","MAX_WORKFLOW_FILES","FILE_FETCH_CONCURRENCY","UNRESOLVED_SYNC_REF","resolveSyncSource","params","source","sourceControl","resolveRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","ref","repository","defaultBranch","discoverWorkflowFiles","page","listFiles","prefix","limit","nextCursor","paths","files","filter","file","path","endsWith","map","length","fetchAndParseWorkflows","parsed","onProgress","snapshot","fetchFile","Buffer","byteLength","content","parseWorkflowSnapshot","rawContent","stopOnError","loadIntegrationValidationContext","some","entry","definition","document","_rawContent","integrationValidationContext","undefined","contentHash","sha256Hex","name","error","message","classifySyncFailure","code","retryable","methods","resolveSourceRepository","listSourceFiles","fetchSourceFile","method","providerErrorCode","details","reason","isProviderReasonRetryable","Error","String","update","digest"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAc;AACvC,SACEC,+BAA+B,EAC/BC,yBAAyB,QACpB,oCAAoC;AAC3C,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,UAAU,QAAO,uBAAuB;AAIhD,SAAQC,oBAAoB,EAAEC,4BAA4B,QAAO,cAAc;AAC/E,SAAQC,wBAAwB,QAAO,mCAAmC;AAE1E,SAAQC,eAAe,QAAO,wBAAwB;AAEtD,OAAO,MAAMC,kBAAkB,sBAAsB;AACrD,OAAO,MAAMC,qBAAqB,IAAI;AACtC,OAAO,MAAMC,yBAAyB,EAAE;AACxC,OAAO,MAAMC,sBAAsB,iBAAiB;AAapD,OAAO,eAAeC,kBAAkBC,MAAyB;IAC/D,MAAMC,SAAS,MAAMD,OAAOE,aAAa,CAACC,iBAAiB,CAAC;QAC1DC,aAAaJ,OAAOI,WAAW;QAC/BC,cAAcL,OAAOM,kBAAkB;QACvCC,sBAAsBP,OAAOQ,0BAA0B;IACzD;IACA,OAAO;QAACC,KAAKR,OA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M,CAAC;AAC7D"}
1
+ {"version":3,"sources":["../../src/core/sync-definitions.ts"],"sourcesContent":["import {createHash} from 'node:crypto';\nimport type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {MAX_REPOSITORY_FILE_BYTES} from '@shipfox/api-integration-core-dto';\nimport {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {boundedMap} from '@shipfox/node-module';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {DefinitionSyncErrorCode} from './entities/sync-state.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {DefinitionParseError, DefinitionSyncPermanentError} from './errors.js';\nimport {hasAgentStepIntegrations} from './has-agent-step-integrations.js';\nimport type {DefinitionsSourceControl} from './integrations.js';\nimport {parseDefinition} from './parse-definition.js';\n\nexport const WORKFLOW_PREFIX = '.shipfox/workflows/';\nexport const MAX_WORKFLOW_FILES = 100;\nexport const FILE_FETCH_CONCURRENCY = 4;\nexport const UNRESOLVED_SYNC_REF = '__unresolved__';\n\nexport interface SyncSourceContext {\n workspaceId: string;\n sourceConnectionId: string;\n sourceExternalRepositoryId: string;\n sourceControl: DefinitionsSourceControl;\n}\n\nexport interface ResolvedSyncSource {\n ref: string;\n}\n\nexport async function resolveSyncSource(params: SyncSourceContext): Promise<ResolvedSyncSource> {\n const source = await params.sourceControl.resolveRepository({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n });\n return {ref: source.repository.defaultBranch};\n}\n\nexport interface DiscoverWorkflowFilesParams extends SyncSourceContext {\n ref: string;\n}\n\nexport async function discoverWorkflowFiles(\n params: DiscoverWorkflowFilesParams,\n): Promise<{paths: string[]}> {\n const page = await params.sourceControl.listFiles({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n prefix: WORKFLOW_PREFIX,\n limit: MAX_WORKFLOW_FILES,\n });\n if (page.nextCursor) {\n throw new DefinitionSyncPermanentError(\n 'too-many-files',\n `More than ${MAX_WORKFLOW_FILES} workflow files were found`,\n );\n }\n\n const paths = page.files\n .filter((file) => file.path.endsWith('.yml') || file.path.endsWith('.yaml'))\n .map((file) => file.path);\n if (paths.length === 0) {\n throw new DefinitionSyncPermanentError(\n 'no-workflow-files',\n `No workflow files were found under ${WORKFLOW_PREFIX}`,\n );\n }\n\n return {paths};\n}\n\nexport interface ParsedWorkflow {\n path: string;\n name: string;\n definition: WorkflowDefinitionPayload;\n contentHash: string;\n}\n\nexport interface FetchAndParseWorkflowsParams extends SyncSourceContext {\n ref: string;\n paths: string[];\n onProgress?: ((path: string) => void) | undefined;\n agentValidationCatalog: AgentValidationCatalog;\n loadIntegrationValidationContext?: (() => Promise<IntegrationValidationContext>) | undefined;\n}\n\nexport async function fetchAndParseWorkflows(\n params: FetchAndParseWorkflowsParams,\n): Promise<ParsedWorkflow[]> {\n const parsed = await boundedMap(\n params.paths,\n FILE_FETCH_CONCURRENCY,\n async (path) => {\n params.onProgress?.(path);\n\n const snapshot = await params.sourceControl.fetchFile({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n ref: params.ref,\n path,\n });\n\n if (Buffer.byteLength(snapshot.content, 'utf8') > MAX_REPOSITORY_FILE_BYTES) {\n throw new DefinitionSyncPermanentError(\n 'content-too-large',\n `Workflow file is larger than ${MAX_REPOSITORY_FILE_BYTES} bytes: ${snapshot.path}`,\n );\n }\n\n return {\n ...parseWorkflowSnapshot({\n path: snapshot.path,\n content: snapshot.content,\n agentValidationCatalog: params.agentValidationCatalog,\n }),\n rawContent: snapshot.content,\n };\n },\n {stopOnError: true},\n );\n\n if (\n !params.loadIntegrationValidationContext ||\n !parsed.some((entry) => hasAgentStepIntegrations(entry.definition.document))\n ) {\n return parsed.map(({rawContent: _rawContent, ...entry}) => entry);\n }\n\n const integrationValidationContext = await params.loadIntegrationValidationContext();\n return parsed.map((entry) =>\n parseWorkflowSnapshot({\n path: entry.path,\n content: entry.rawContent,\n agentValidationCatalog: params.agentValidationCatalog,\n integrationValidationContext,\n }),\n );\n}\n\nfunction parseWorkflowSnapshot(params: {\n path: string;\n content: string;\n integrationValidationContext?: IntegrationValidationContext | undefined;\n agentValidationCatalog: AgentValidationCatalog;\n}): ParsedWorkflow {\n try {\n const definition =\n params.integrationValidationContext === undefined\n ? parseDefinition(params.content, {agentValidationCatalog: params.agentValidationCatalog})\n : parseDefinition(params.content, {\n agentValidationCatalog: params.agentValidationCatalog,\n integrationValidationContext: params.integrationValidationContext,\n });\n const contentHash = sha256Hex(params.content);\n return {path: params.path, name: definition.document.name, definition, contentHash};\n } catch (error) {\n if (error instanceof DefinitionParseError) {\n throw new DefinitionSyncPermanentError(\n 'invalid-definition',\n `Invalid workflow definition at ${params.path}: ${error.message}`,\n );\n }\n throw error;\n }\n}\n\nexport interface SyncFailureClassification {\n code: DefinitionSyncErrorCode;\n message: string;\n retryable: boolean;\n}\n\nexport function classifySyncFailure(error: unknown): SyncFailureClassification {\n if (error instanceof DefinitionSyncPermanentError) {\n return {code: error.code, message: error.message, retryable: false};\n }\n const methods = [\n integrationsInterModuleContract.methods.resolveSourceRepository,\n integrationsInterModuleContract.methods.listSourceFiles,\n integrationsInterModuleContract.methods.fetchSourceFile,\n ] as const;\n for (const method of methods) {\n if (!isInterModuleKnownError(method, error)) continue;\n if (\n error.code === 'connection-not-found' ||\n error.code === 'connection-inactive' ||\n error.code === 'connection-workspace-mismatch'\n ) {\n return {code: 'connection-unavailable', message: error.message, retryable: false};\n }\n if (error.code === 'provider-failure') {\n return {\n code: providerErrorCode(error.details.reason),\n message: error.message,\n retryable: isProviderReasonRetryable(error.details.reason),\n };\n }\n }\n return {\n code: 'unknown',\n message: error instanceof Error ? error.message : String(error),\n retryable: true,\n };\n}\n\nfunction isProviderReasonRetryable(reason: string): boolean {\n return reason === 'rate-limited' || reason === 'timeout' || reason === 'provider-unavailable';\n}\n\nfunction providerErrorCode(reason: string): DefinitionSyncErrorCode {\n if (reason === 'repository-not-found') return 'provider-repository-not-found';\n if (reason === 'file-not-found') return 'provider-file-not-found';\n if (reason === 'access-denied') return 'provider-access-denied';\n if (reason === 'rate-limited') return 'provider-rate-limited';\n if (reason === 'timeout') return 'provider-timeout';\n if (reason === 'provider-unavailable') return 'provider-unavailable';\n if (reason === 'malformed-provider-response') return 'provider-malformed-response';\n if (reason === 'content-too-large') return 'content-too-large';\n if (reason === 'too-many-files') return 'too-many-files';\n return 'unknown';\n}\n\nfunction sha256Hex(content: string): string {\n return createHash('sha256').update(content, 'utf8').digest('hex');\n}\n"],"names":["createHash","MAX_REPOSITORY_FILE_BYTES","integrationsInterModuleContract","isInterModuleKnownError","boundedMap","DefinitionParseError","DefinitionSyncPermanentError","hasAgentStepIntegrations","parseDefinition","WORKFLOW_PREFIX","MAX_WORKFLOW_FILES","FILE_FETCH_CONCURRENCY","UNRESOLVED_SYNC_REF","resolveSyncSource","params","source","sourceControl","resolveRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","ref","repository","defaultBranch","discoverWorkflowFiles","page","listFiles","prefix","limit","nextCursor","paths","files","filter","file","path","endsWith","map","length","fetchAndParseWorkflows","parsed","onProgress","snapshot","fetchFile","Buffer","byteLength","content","parseWorkflowSnapshot","agentValidationCatalog","rawContent","stopOnError","loadIntegrationValidationContext","some","entry","definition","document","_rawContent","integrationValidationContext","undefined","contentHash","sha256Hex","name","error","message","classifySyncFailure","code","retryable","methods","resolveSourceRepository","listSourceFiles","fetchSourceFile","method","providerErrorCode","details","reason","isProviderReasonRetryable","Error","String","update","digest"],"mappings":"AAAA,SAAQA,UAAU,QAAO,cAAc;AAEvC,SAAQC,yBAAyB,QAAO,oCAAoC;AAC5E,SAAQC,+BAA+B,QAAO,iDAAiD;AAC/F,SAAQC,uBAAuB,QAAO,wB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AAWS,0BAA0Bb,MAAMW,OAAO,CAACC,MAAM;YAC3D;QACF;IACF;IACA,OAAO;QACLT,MAAM;QACNF,SAASD,iBAAiBc,QAAQd,MAAMC,OAAO,GAAGc,OAAOf;QACzDI,WAAW;IACb;AACF;AAEA,SAASS,0BAA0BD,MAAc;IAC/C,OAAOA,WAAW,kBAAkBA,WAAW,aAAaA,WAAW;AACzE;AAEA,SAASF,kBAAkBE,MAAc;IACvC,IAAIA,WAAW,wBAAwB,OAAO;IAC9C,IAAIA,WAAW,kBAAkB,OAAO;IACxC,IAAIA,WAAW,iBAAiB,OAAO;IACvC,IAAIA,WAAW,gBAAgB,OAAO;IACtC,IAAIA,WAAW,WAAW,OAAO;IACjC,IAAIA,WAAW,wBAAwB,OAAO;IAC9C,IAAIA,WAAW,+BAA+B,OAAO;IACrD,IAAIA,WAAW,qBAAqB,OAAO;IAC3C,IAAIA,WAAW,kBAAkB,OAAO;IACxC,OAAO;AACT;AAEA,SAASd,UAAUd,OAAe;IAChC,OAAO/C,WAAW,UAAU+E,MAAM,CAAChC,SAAS,QAAQiC,MAAM,CAAC;AAC7D"}
@@ -1,4 +1,4 @@
1
- import type { HarnessToolDeploymentConfig } from '@shipfox/api-agent-dto';
1
+ import type { AgentValidationCatalog } from '@shipfox/api-agent-dto/inter-module';
2
2
  import type { IntegrationValidationContext } from './entities/integration-context.js';
3
3
  import type { WorkflowDefinitionPayload } from './entities/workflow-definition.js';
4
4
  export type ValidationError = {
@@ -12,9 +12,9 @@ export type ValidationResult = {
12
12
  valid: false;
13
13
  errors: ValidationError[];
14
14
  };
15
- export declare function validateDefinition(yamlContent: string, options?: {
15
+ export declare function validateDefinition(yamlContent: string, options: {
16
16
  defaultRunnerLabels?: readonly string[];
17
- harnessToolDeploymentConfig?: HarnessToolDeploymentConfig;
17
+ agentValidationCatalog: AgentValidationCatalog;
18
18
  integrationValidationContext?: IntegrationValidationContext;
19
19
  }): ValidationResult;
20
20
  //# sourceMappingURL=validate-definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-definition.d.ts","sourceRoot":"","sources":["../../src/core/validate-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,wBAAwB,CAAC;AAGxE,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAIjF,MAAM,MAAM,eAAe,GAAG;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GACxB;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,yBAAyB,CAAA;CAAC,GACpD;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAC,CAAC;AAE9C,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE;IACP,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;IAC1D,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;CACxD,GACL,gBAAgB,CAclB"}
1
+ {"version":3,"file":"validate-definition.d.ts","sourceRoot":"","sources":["../../src/core/validate-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAGhF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AACpF,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAIjF,MAAM,MAAM,eAAe,GAAG;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GACxB;IAAC,KAAK,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,yBAAyB,CAAA;CAAC,GACpD;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAC,CAAC;AAE9C,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IACP,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;CAC7D,GACA,gBAAgB,CAalB"}
@@ -1,13 +1,13 @@
1
1
  import { InvalidWorkflowDocumentError } from '@shipfox/workflow-document';
2
- import { definitionDefaultRunnerLabels, definitionHarnessToolDeploymentConfig } from '../config.js';
2
+ import { definitionDefaultRunnerLabels } from '../config.js';
3
3
  import { InvalidWorkflowModelError, normalizeWorkflowDocument } from './workflow-model/index.js';
4
4
  import { InvalidWorkflowYamlError, parseWorkflowYamlWithLocations } from './workflow-yaml/index.js';
5
- export function validateDefinition(yamlContent, options = {}) {
5
+ export function validateDefinition(yamlContent, options) {
6
6
  try {
7
7
  const { document, stepSourceLocations } = parseWorkflowYamlWithLocations(yamlContent);
8
8
  const model = normalizeWorkflowDocument(document, {
9
9
  defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,
10
- harnessToolDeploymentConfig: options.harnessToolDeploymentConfig ?? definitionHarnessToolDeploymentConfig,
10
+ agentValidationCatalog: options.agentValidationCatalog,
11
11
  integrationValidationContext: options.integrationValidationContext,
12
12
  stepSourceLocations
13
13
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/validate-definition.ts"],"sourcesContent":["import type {HarnessToolDeploymentConfig} from '@shipfox/api-agent-dto';\nimport {InvalidWorkflowDocumentError} from '@shipfox/workflow-document';\nimport {definitionDefaultRunnerLabels, definitionHarnessToolDeploymentConfig} from '../config.js';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {InvalidWorkflowModelError, normalizeWorkflowDocument} from './workflow-model/index.js';\nimport {InvalidWorkflowYamlError, parseWorkflowYamlWithLocations} from './workflow-yaml/index.js';\n\nexport type ValidationError = {message: string; path?: string | undefined};\n\nexport type ValidationResult =\n | {valid: true; definition: WorkflowDefinitionPayload}\n | {valid: false; errors: ValidationError[]};\n\nexport function validateDefinition(\n yamlContent: string,\n options: {\n defaultRunnerLabels?: readonly string[];\n harnessToolDeploymentConfig?: HarnessToolDeploymentConfig;\n integrationValidationContext?: IntegrationValidationContext;\n } = {},\n): ValidationResult {\n try {\n const {document, stepSourceLocations} = parseWorkflowYamlWithLocations(yamlContent);\n const model = normalizeWorkflowDocument(document, {\n defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,\n harnessToolDeploymentConfig:\n options.harnessToolDeploymentConfig ?? definitionHarnessToolDeploymentConfig,\n integrationValidationContext: options.integrationValidationContext,\n stepSourceLocations,\n });\n return {valid: true, definition: {document, model}};\n } catch (error) {\n return {valid: false, errors: validationErrorsFor(error)};\n }\n}\n\nfunction validationErrorsFor(error: unknown): ValidationError[] {\n if (error instanceof InvalidWorkflowYamlError) {\n return [\n validationError({\n message: error.message,\n path:\n error.location === undefined\n ? undefined\n : `${error.location.line}:${error.location.column}`,\n }),\n ];\n }\n\n if (error instanceof InvalidWorkflowDocumentError) {\n return error.validationError.issues.map((issue) =>\n validationError({\n message: issue.message,\n path: issue.path.join('.') || undefined,\n }),\n );\n }\n\n if (error instanceof InvalidWorkflowModelError) {\n return error.issues.map((issue) =>\n validationError({message: issue.message, path: issue.path.join('.')}),\n );\n }\n\n throw error;\n}\n\nfunction validationError(params: {message: string; path?: string | undefined}): ValidationError {\n if (params.path === undefined) return {message: params.message};\n return {message: params.message, path: params.path};\n}\n"],"names":["InvalidWorkflowDocumentError","definitionDefaultRunnerLabels","definitionHarnessToolDeploymentConfig","InvalidWorkflowModelError","normalizeWorkflowDocument","InvalidWorkflowYamlError","parseWorkflowYamlWithLocations","validateDefinition","yamlContent","options","document","stepSourceLocations","model","defaultRunnerLabels","harnessToolDeploymentConfig","integrationValidationContext","valid","definition","error","errors","validationErrorsFor","validationError","message","path","location","undefined","line","column","issues","map","issue","join","params"],"mappings":"AACA,SAAQA,4BAA4B,QAAO,6BAA6B;AACxE,SAAQC,6BAA6B,EAAEC,qCAAqC,QAAO,eAAe;AAGlG,SAAQC,yBAAyB,EAAEC,yBAAyB,QAAO,4BAA4B;AAC/F,SAAQC,wBAAwB,EAAEC,8BAA8B,QAAO,2BAA2B;AAQlG,OAAO,SAASC,mBACdC,WAAmB,EACnBC,UAII,CAAC,CAAC;IAEN,IAAI;QACF,MAAM,EAACC,QAAQ,EAAEC,mBAAmB,EAAC,GAAGL,+BAA+BE;QACvE,MAAMI,QAAQR,0BAA0BM,UAAU;YAChDG,qBAAqBJ,QAAQI,mBAAmB,IAAIZ;YACpDa,6BACEL,QAAQK,2BAA2B,IAAIZ;YACzCa,8BAA8BN,QAAQM,4BAA4B;YAClEJ;QACF;QACA,OAAO;YAACK,OAAO;YAAMC,YAAY;gBAACP;gBAAUE;YAAK;QAAC;IACpD,EAAE,OAAOM,OAAO;QACd,OAAO;YAACF,OAAO;YAAOG,QAAQC,oBAAoBF;QAAM;IAC1D;AACF;AAEA,SAASE,oBAAoBF,KAAc;IACzC,IAAIA,iBAAiBb,0BAA0B;QAC7C,OAAO;YACLgB,gBAAgB;gBACdC,SAASJ,MAAMI,OAAO;gBACtBC,MACEL,MAAMM,QAAQ,KAAKC,YACfA,YACA,GAAGP,MAAMM,QAAQ,CAACE,IAAI,CAAC,CAAC,EAAER,MAAMM,QAAQ,CAACG,MAAM,EAAE;YACzD;SACD;IACH;IAEA,IAAIT,iBAAiBlB,8BAA8B;QACjD,OAAOkB,MAAMG,eAAe,CAACO,MAAM,CAACC,GAAG,CAAC,CAACC,QACvCT,gBAAgB;gBACdC,SAASQ,MAAMR,OAAO;gBACtBC,MAAMO,MAAMP,IAAI,CAACQ,IAAI,CAAC,QAAQN;YAChC;IAEJ;IAEA,IAAIP,iBAAiBf,2BAA2B;QAC9C,OAAOe,MAAMU,MAAM,CAACC,GAAG,CAAC,CAACC,QACvBT,gBAAgB;gBAACC,SAASQ,MAAMR,OAAO;gBAAEC,MAAMO,MAAMP,IAAI,CAACQ,IAAI,CAAC;YAAI;IAEvE;IAEA,MAAMb;AACR;AAEA,SAASG,gBAAgBW,MAAoD;IAC3E,IAAIA,OAAOT,IAAI,KAAKE,WAAW,OAAO;QAACH,SAASU,OAAOV,OAAO;IAAA;IAC9D,OAAO;QAACA,SAASU,OAAOV,OAAO;QAAEC,MAAMS,OAAOT,IAAI;IAAA;AACpD"}
1
+ {"version":3,"sources":["../../src/core/validate-definition.ts"],"sourcesContent":["import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';\nimport {InvalidWorkflowDocumentError} from '@shipfox/workflow-document';\nimport {definitionDefaultRunnerLabels} from '../config.js';\nimport type {IntegrationValidationContext} from './entities/integration-context.js';\nimport type {WorkflowDefinitionPayload} from './entities/workflow-definition.js';\nimport {InvalidWorkflowModelError, normalizeWorkflowDocument} from './workflow-model/index.js';\nimport {InvalidWorkflowYamlError, parseWorkflowYamlWithLocations} from './workflow-yaml/index.js';\n\nexport type ValidationError = {message: string; path?: string | undefined};\n\nexport type ValidationResult =\n | {valid: true; definition: WorkflowDefinitionPayload}\n | {valid: false; errors: ValidationError[]};\n\nexport function validateDefinition(\n yamlContent: string,\n options: {\n defaultRunnerLabels?: readonly string[];\n agentValidationCatalog: AgentValidationCatalog;\n integrationValidationContext?: IntegrationValidationContext;\n },\n): ValidationResult {\n try {\n const {document, stepSourceLocations} = parseWorkflowYamlWithLocations(yamlContent);\n const model = normalizeWorkflowDocument(document, {\n defaultRunnerLabels: options.defaultRunnerLabels ?? definitionDefaultRunnerLabels,\n agentValidationCatalog: options.agentValidationCatalog,\n integrationValidationContext: options.integrationValidationContext,\n stepSourceLocations,\n });\n return {valid: true, definition: {document, model}};\n } catch (error) {\n return {valid: false, errors: validationErrorsFor(error)};\n }\n}\n\nfunction validationErrorsFor(error: unknown): ValidationError[] {\n if (error instanceof InvalidWorkflowYamlError) {\n return [\n validationError({\n message: error.message,\n path:\n error.location === undefined\n ? undefined\n : `${error.location.line}:${error.location.column}`,\n }),\n ];\n }\n\n if (error instanceof InvalidWorkflowDocumentError) {\n return error.validationError.issues.map((issue) =>\n validationError({\n message: issue.message,\n path: issue.path.join('.') || undefined,\n }),\n );\n }\n\n if (error instanceof InvalidWorkflowModelError) {\n return error.issues.map((issue) =>\n validationError({message: issue.message, path: issue.path.join('.')}),\n );\n }\n\n throw error;\n}\n\nfunction validationError(params: {message: string; path?: string | undefined}): ValidationError {\n if (params.path === undefined) return {message: params.message};\n return {message: params.message, path: params.path};\n}\n"],"names":["InvalidWorkflowDocumentError","definitionDefaultRunnerLabels","InvalidWorkflowModelError","normalizeWorkflowDocument","InvalidWorkflowYamlError","parseWorkflowYamlWithLocations","validateDefinition","yamlContent","options","document","stepSourceLocations","model","defaultRunnerLabels","agentValidationCatalog","integrationValidationContext","valid","definition","error","errors","validationErrorsFor","validationError","message","path","location","undefined","line","column","issues","map","issue","join","params"],"mappings":"AACA,SAAQA,4BAA4B,QAAO,6BAA6B;AACxE,SAAQC,6BAA6B,QAAO,eAAe;AAG3D,SAAQC,yBAAyB,EAAEC,yBAAyB,QAAO,4BAA4B;AAC/F,SAAQC,wBAAwB,EAAEC,8BAA8B,QAAO,2BAA2B;AAQlG,OAAO,SAASC,mBACdC,WAAmB,EACnBC,OAIC;IAED,IAAI;QACF,MAAM,EAACC,QAAQ,EAAEC,mBAAmB,EAAC,GAAGL,+BAA+BE;QACvE,MAAMI,QAAQR,0BAA0BM,UAAU;YAChDG,qBAAqBJ,QAAQI,mBAAmB,IAAIX;YACpDY,wBAAwBL,QAAQK,sBAAsB;YACtDC,8BAA8BN,QAAQM,4BAA4B;YAClEJ;QACF;QACA,OAAO;YAACK,OAAO;YAAMC,YAAY;gBAACP;gBAAUE;YAAK;QAAC;IACpD,EAAE,OAAOM,OAAO;QACd,OAAO;YAACF,OAAO;YAAOG,QAAQC,oBAAoBF;QAAM;IAC1D;AACF;AAEA,SAASE,oBAAoBF,KAAc;IACzC,IAAIA,iBAAiBb,0BAA0B;QAC7C,OAAO;YACLgB,gBAAgB;gBACdC,SAASJ,MAAMI,OAAO;gBACtBC,MACEL,MAAMM,QAAQ,KAAKC,YACfA,YACA,GAAGP,MAAMM,QAAQ,CAACE,IAAI,CAAC,CAAC,EAAER,MAAMM,QAAQ,CAACG,MAAM,EAAE;YACzD;SACD;IACH;IAEA,IAAIT,iBAAiBjB,8BAA8B;QACjD,OAAOiB,MAAMG,eAAe,CAACO,MAAM,CAACC,GAAG,CAAC,CAACC,QACvCT,gBAAgB;gBACdC,SAASQ,MAAMR,OAAO;gBACtBC,MAAMO,MAAMP,IAAI,CAACQ,IAAI,CAAC,QAAQN;YAChC;IAEJ;IAEA,IAAIP,iBAAiBf,2BAA2B;QAC9C,OAAOe,MAAMU,MAAM,CAACC,GAAG,CAAC,CAACC,QACvBT,gBAAgB;gBAACC,SAASQ,MAAMR,OAAO;gBAAEC,MAAMO,MAAMP,IAAI,CAACQ,IAAI,CAAC;YAAI;IAEvE;IAEA,MAAMb;AACR;AAEA,SAASG,gBAAgBW,MAAoD;IAC3E,IAAIA,OAAOT,IAAI,KAAKE,WAAW,OAAO;QAACH,SAASU,OAAOV,OAAO;IAAA;IAC9D,OAAO;QAACA,SAASU,OAAOV,OAAO;QAAEC,MAAMS,OAAOT,IAAI;IAAA;AACpD"}
@@ -1,11 +1,11 @@
1
- import { type HarnessToolDeploymentConfig } from '@shipfox/api-agent-dto';
1
+ import type { AgentValidationCatalog } from '@shipfox/api-agent-dto/inter-module';
2
2
  import type { WorkflowDocument } from '@shipfox/workflow-document';
3
3
  import type { IntegrationValidationContext } from '../entities/integration-context.js';
4
4
  import type { WorkflowModelJob, WorkflowStepSourceLocationMap } from '../entities/workflow-model.js';
5
5
  import type { WorkflowModelValidationIssue } from './invalid-workflow-model-error.js';
6
6
  export interface NormalizeContext {
7
7
  readonly defaultRunnerLabels: readonly string[];
8
- readonly harnessToolDeploymentConfig: HarnessToolDeploymentConfig;
8
+ readonly agentValidationCatalog: AgentValidationCatalog;
9
9
  readonly integrationValidationContext?: IntegrationValidationContext | undefined;
10
10
  }
11
11
  export declare function normalizeJobs(document: WorkflowDocument, jobIdBySourceName: ReadonlyMap<string, string>, issues: WorkflowModelValidationIssue[], stepSourceLocations: WorkflowStepSourceLocationMap | undefined, context: NormalizeContext): readonly WorkflowModelJob[];
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-jobs.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EAEjC,MAAM,wBAAwB,CAAC;AAgBhC,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAIV,gBAAgB,EAIhB,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAepF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,2BAA2B,EAAE,2BAA2B,CAAC;IAClE,QAAQ,CAAC,4BAA4B,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;CAClF;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,4BAA4B,EAAE,EACtC,mBAAmB,EAAE,6BAA6B,GAAG,SAAS,EAC9D,OAAO,EAAE,gBAAgB,GACxB,SAAS,gBAAgB,EAAE,CA6D7B"}
1
+ {"version":3,"file":"normalize-jobs.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAgBhF,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAIV,gBAAgB,EAIhB,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAepF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IACxD,QAAQ,CAAC,4BAA4B,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;CAClF;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,4BAA4B,EAAE,EACtC,mBAAmB,EAAE,6BAA6B,GAAG,SAAS,EAC9D,OAAO,EAAE,gBAAgB,GACxB,SAAS,gBAAgB,EAAE,CA6D7B"}
@@ -1,4 +1,3 @@
1
- import { agentThinkingByHarness, getHarnessDescriptor, getModelProviderEntry, listEnabledHarnessTools } from '@shipfox/api-agent-dto';
2
1
  import { buildTypedRootsEnvironment } from '@shipfox/expression';
3
2
  import { canonicalizeLabels, findInvalidLabels, MAX_RUNNER_LABEL_LENGTH, MAX_RUNNER_LABELS, RUNNER_LABEL_PATTERN } from '@shipfox/runner-labels';
4
3
  import { normalizeAgentIntegrations } from './normalize-agent-integrations.js';
@@ -645,7 +644,7 @@ function normalizeAgentStep(params) {
645
644
  stepIndex: params.stepIndex,
646
645
  issues: params.issues,
647
646
  validateLiteralProvider: providerTemplate === undefined,
648
- harnessToolDeploymentConfig: params.context.harnessToolDeploymentConfig
647
+ agentValidationCatalog: params.context.agentValidationCatalog
649
648
  });
650
649
  const integrations = normalizeAgentIntegrations({
651
650
  integrations: params.step.integrations,
@@ -693,7 +692,7 @@ function validateAgentStep(params) {
693
692
  if (!params.validateLiteralProvider) return;
694
693
  const providerId = params.step.provider;
695
694
  if (providerId === undefined) return;
696
- const provider = getModelProviderEntry(providerId);
695
+ const provider = params.agentValidationCatalog.providers.find((entry)=>entry.id === providerId);
697
696
  const harness = params.step.harness;
698
697
  if (provider === undefined && harness === 'pi') return;
699
698
  if (provider === undefined || provider.support_status !== 'supported') {
@@ -714,11 +713,11 @@ function validateAgentStep(params) {
714
713
  return;
715
714
  }
716
715
  if (harness === undefined) return;
717
- const descriptor = getHarnessDescriptor(harness);
718
- if (descriptor.supportedProviderIds.includes(providerId)) return;
716
+ const descriptor = params.agentValidationCatalog.harnesses.find((entry)=>entry.id === harness);
717
+ if (descriptor?.supported_provider_ids.includes(providerId)) return;
719
718
  params.issues.push(issue({
720
719
  code: 'harness-provider-incompatible',
721
- message: `Harness "${harness}" does not support provider: ${providerId}. Supported providers: ${descriptor.supportedProviderIds.join(', ')}.`,
720
+ message: `Harness "${harness}" does not support provider: ${providerId}. Supported providers: ${descriptor?.supported_provider_ids.join(', ') ?? ''}.`,
722
721
  path: [
723
722
  'jobs',
724
723
  params.sourceName,
@@ -729,7 +728,7 @@ function validateAgentStep(params) {
729
728
  details: {
730
729
  harness,
731
730
  provider: providerId,
732
- supportedProviders: descriptor.supportedProviderIds
731
+ supportedProviders: descriptor?.supported_provider_ids ?? []
733
732
  }
734
733
  }));
735
734
  }
@@ -753,7 +752,7 @@ function validateHarnessTools(params) {
753
752
  }));
754
753
  return;
755
754
  }
756
- const supportedTools = listEnabledHarnessTools(harness, params.harnessToolDeploymentConfig).map((tool)=>tool.name);
755
+ const supportedTools = params.agentValidationCatalog.harnesses.find((entry)=>entry.id === harness)?.effective_tools ?? [];
757
756
  const supportedToolSet = new Set(supportedTools);
758
757
  tools.forEach((tool, toolIndex)=>{
759
758
  if (supportedToolSet.has(tool)) return;
@@ -779,9 +778,8 @@ function validateHarnessTools(params) {
779
778
  function validateHarnessThinking(params) {
780
779
  const { harness, thinking } = params.step;
781
780
  if (harness === undefined || thinking === undefined) return;
782
- const thinkingSchema = agentThinkingByHarness[harness];
783
- if (thinkingSchema.safeParse(thinking).success) return;
784
- const supportedLevels = thinkingSchema.options;
781
+ const supportedLevels = params.agentValidationCatalog.harnesses.find((entry)=>entry.id === harness)?.thinking_levels ?? [];
782
+ if (supportedLevels.includes(thinking)) return;
785
783
  params.issues.push(issue({
786
784
  code: 'harness-thinking-incompatible',
787
785
  message: `Harness "${harness}" does not support thinking: ${thinking}. Supported levels: ${supportedLevels.join(', ')}.`,