@shipfox/api-definitions 7.1.0 → 9.0.1
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.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +71 -0
- package/dist/config.d.ts +0 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -14
- package/dist/config.js.map +1 -1
- package/dist/core/entities/integration-context.d.ts +12 -1
- package/dist/core/entities/integration-context.d.ts.map +1 -1
- package/dist/core/entities/integration-context.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/integrations.d.ts +1 -1
- package/dist/core/integrations.d.ts.map +1 -1
- package/dist/core/integrations.js +1 -1
- package/dist/core/integrations.js.map +1 -1
- package/dist/core/parse-definition.d.ts +3 -3
- package/dist/core/parse-definition.d.ts.map +1 -1
- package/dist/core/parse-definition.js.map +1 -1
- package/dist/core/sync-definitions.d.ts +3 -0
- package/dist/core/sync-definitions.d.ts.map +1 -1
- package/dist/core/sync-definitions.js +11 -5
- package/dist/core/sync-definitions.js.map +1 -1
- package/dist/core/validate-definition.d.ts +3 -3
- package/dist/core/validate-definition.d.ts.map +1 -1
- package/dist/core/validate-definition.js +3 -3
- package/dist/core/validate-definition.js.map +1 -1
- package/dist/core/workflow-model/normalize-agent-integrations.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-agent-integrations.js.map +1 -1
- package/dist/core/workflow-model/normalize-jobs.d.ts +2 -2
- package/dist/core/workflow-model/normalize-jobs.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-jobs.js +9 -11
- package/dist/core/workflow-model/normalize-jobs.js.map +1 -1
- package/dist/core/workflow-model/normalize-workflow-document.d.ts +3 -3
- package/dist/core/workflow-model/normalize-workflow-document.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-workflow-document.js +2 -4
- package/dist/core/workflow-model/normalize-workflow-document.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/presentation/routes/create-definition.d.ts +4 -2
- package/dist/presentation/routes/create-definition.d.ts.map +1 -1
- package/dist/presentation/routes/create-definition.js +5 -1
- package/dist/presentation/routes/create-definition.js.map +1 -1
- package/dist/presentation/routes/get-definition.d.ts +1 -1
- package/dist/presentation/routes/get-definition.d.ts.map +1 -1
- package/dist/presentation/routes/get-definition.js.map +1 -1
- package/dist/presentation/routes/index.js +2 -2
- package/dist/presentation/routes/index.js.map +1 -1
- package/dist/presentation/routes/list-definitions.d.ts +1 -1
- package/dist/presentation/routes/list-definitions.d.ts.map +1 -1
- package/dist/presentation/routes/list-definitions.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +1 -1
- package/dist/presentation/routes/project-access.d.ts.map +1 -1
- package/dist/presentation/routes/project-access.js.map +1 -1
- package/dist/presentation/routes/validate-definition.d.ts +2 -1
- package/dist/presentation/routes/validate-definition.d.ts.map +1 -1
- package/dist/presentation/routes/validate-definition.js +26 -22
- package/dist/presentation/routes/validate-definition.js.map +1 -1
- package/dist/temporal/activities/sync-activities.d.ts +3 -2
- package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
- package/dist/temporal/activities/sync-activities.js +4 -3
- package/dist/temporal/activities/sync-activities.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +23 -24
- package/src/config.ts +1 -19
- package/src/core/entities/integration-context.ts +13 -5
- package/src/core/index.ts +4 -1
- package/src/core/integrations.ts +1 -1
- package/src/core/parse-definition.test.ts +6 -1
- package/src/core/parse-definition.ts +3 -3
- package/src/core/sync-definitions.test.ts +12 -8
- package/src/core/sync-definitions.ts +15 -8
- package/src/core/validate-definition.test.ts +18 -4
- package/src/core/validate-definition.ts +5 -6
- package/src/core/workflow-model/normalize-agent-integrations.ts +7 -1
- package/src/core/workflow-model/normalize-jobs.ts +22 -23
- package/src/core/workflow-model/normalize-workflow-document.test.ts +37 -18
- package/src/core/workflow-model/normalize-workflow-document.ts +4 -9
- package/src/db/definitions.test.ts +2 -1
- package/src/db/schema/definitions.test.ts +2 -1
- package/src/index.ts +8 -5
- package/src/presentation/dto/definition.test.ts +2 -1
- package/src/presentation/routes/create-definition.test.ts +10 -3
- package/src/presentation/routes/create-definition.ts +7 -3
- package/src/presentation/routes/get-definition.test.ts +1 -1
- package/src/presentation/routes/get-definition.ts +1 -1
- package/src/presentation/routes/index.test.ts +6 -2
- package/src/presentation/routes/index.ts +2 -2
- package/src/presentation/routes/list-definitions.test.ts +1 -1
- package/src/presentation/routes/list-definitions.ts +1 -1
- package/src/presentation/routes/project-access.ts +1 -1
- package/src/presentation/routes/validate-definition.test.ts +8 -2
- package/src/presentation/routes/validate-definition.ts +27 -22
- package/src/temporal/activities/sync-activities.test.ts +17 -14
- package/src/temporal/activities/sync-activities.ts +10 -2
- package/test/agent-validation-catalog.ts +26 -0
- package/test/factories/definition.ts +2 -1
- package/test/published/workflow-source-bundle.mjs +17 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
|
|
2
|
-
Successfully compiled: 72 files with swc (
|
|
3
|
-
2026-07-
|
|
2
|
+
Successfully compiled: 72 files with swc (559.82ms)
|
|
3
|
+
2026-07-23T14:12:10.236Z [INFO] asset workflow-bundle-2e2f2f4d6c035dc8e198.js 3.18 MiB [emitted] [immutable] (name: main)
|
|
4
4
|
orphan modules 33.5 KiB [orphan] 21 modules
|
|
5
5
|
runtime modules 1.13 KiB 5 modules
|
|
6
6
|
modules by path ../../../node_modules/.pnpm/ 970 KiB 196 modules
|
|
@@ -14,6 +14,6 @@ optional modules 30 bytes [optional]
|
|
|
14
14
|
__temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
15
15
|
__temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
16
16
|
../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
|
|
17
|
-
webpack 5.107.2 compiled successfully in
|
|
18
|
-
2026-07-
|
|
17
|
+
webpack 5.107.2 compiled successfully in 4788 ms
|
|
18
|
+
2026-07-23T14:12:10.242Z [INFO] Workflow bundle created { size: '3.18MB' }
|
|
19
19
|
/home/runner/work/shipfox/shipfox/libs/api/definitions/dist/temporal/workflows/index.js: 3332889 bytes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# @shipfox/api-definitions
|
|
2
2
|
|
|
3
|
+
## 9.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 475ce59: Republishes all public packages after restoring release authorization.
|
|
8
|
+
- Updated dependencies [8436596]
|
|
9
|
+
- Updated dependencies [475ce59]
|
|
10
|
+
- Updated dependencies [154e03f]
|
|
11
|
+
- @shipfox/api-secrets-dto@9.0.1
|
|
12
|
+
- @shipfox/runner-labels@0.1.2
|
|
13
|
+
- @shipfox/expression@1.1.4
|
|
14
|
+
- @shipfox/workflow-document@2.1.2
|
|
15
|
+
- @shipfox/api-agent-dto@9.0.1
|
|
16
|
+
- @shipfox/api-auth-context@9.0.1
|
|
17
|
+
- @shipfox/api-definitions-dto@9.0.1
|
|
18
|
+
- @shipfox/api-integration-core-dto@9.0.1
|
|
19
|
+
- @shipfox/api-projects-dto@9.0.1
|
|
20
|
+
- @shipfox/config@1.2.3
|
|
21
|
+
- @shipfox/inter-module@0.2.1
|
|
22
|
+
- @shipfox/node-drizzle@0.3.3
|
|
23
|
+
- @shipfox/node-error-monitoring@0.2.1
|
|
24
|
+
- @shipfox/node-fastify@0.3.1
|
|
25
|
+
- @shipfox/node-module@1.0.0
|
|
26
|
+
- @shipfox/node-opentelemetry@0.6.1
|
|
27
|
+
- @shipfox/node-outbox@0.2.5
|
|
28
|
+
- @shipfox/node-postgres@0.4.3
|
|
29
|
+
- @shipfox/node-temporal@0.4.1
|
|
30
|
+
|
|
31
|
+
## 9.0.0
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- a9f9c57: Decouples Definitions and Workflows tests from peer implementation packages and databases.
|
|
36
|
+
- c279061: Improves release verification with owner-defined packed contracts, discovery-driven artifact checks, and an early publication preflight.
|
|
37
|
+
- Updated dependencies [46aa52f]
|
|
38
|
+
- Updated dependencies [02974d6]
|
|
39
|
+
- Updated dependencies [4a6d124]
|
|
40
|
+
- @shipfox/api-agent-dto@9.0.0
|
|
41
|
+
- @shipfox/api-integration-core-dto@9.0.0
|
|
42
|
+
- @shipfox/api-secrets-dto@9.0.0
|
|
43
|
+
- @shipfox/api-auth-context@9.0.0
|
|
44
|
+
- @shipfox/api-definitions-dto@6.0.0
|
|
45
|
+
- @shipfox/api-projects-dto@8.0.0
|
|
46
|
+
- @shipfox/config@1.2.2
|
|
47
|
+
- @shipfox/inter-module@0.2.0
|
|
48
|
+
- @shipfox/runner-labels@0.1.1
|
|
49
|
+
- @shipfox/expression@1.1.3
|
|
50
|
+
- @shipfox/node-drizzle@0.3.2
|
|
51
|
+
- @shipfox/node-error-monitoring@0.2.0
|
|
52
|
+
- @shipfox/node-fastify@0.3.0
|
|
53
|
+
- @shipfox/node-module@0.5.0
|
|
54
|
+
- @shipfox/node-opentelemetry@0.6.0
|
|
55
|
+
- @shipfox/node-outbox@0.2.4
|
|
56
|
+
- @shipfox/node-postgres@0.4.2
|
|
57
|
+
- @shipfox/node-temporal@0.4.0
|
|
58
|
+
- @shipfox/workflow-document@2.1.1
|
|
59
|
+
|
|
60
|
+
## 8.0.0
|
|
61
|
+
|
|
62
|
+
### Major Changes
|
|
63
|
+
|
|
64
|
+
- de559bb: Moves Agent validation policy behind a versioned inter-module catalog and injects it into Definitions normalization.
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [de559bb]
|
|
69
|
+
- Updated dependencies [7f227c6]
|
|
70
|
+
- @shipfox/api-agent-dto@8.0.0
|
|
71
|
+
- @shipfox/api-integration-core-dto@8.0.0
|
|
72
|
+
- @shipfox/api-projects-dto@8.0.0
|
|
73
|
+
|
|
3
74
|
## 7.1.0
|
|
4
75
|
|
|
5
76
|
### 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
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
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 {
|
|
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
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts"],"sourcesContent":["import {
|
|
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,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
type IntegrationProviderKind = string;
|
|
2
|
+
type IntegrationCapability = 'source_control' | 'agent_tools';
|
|
3
|
+
interface AgentToolSelectionCatalog {
|
|
4
|
+
readonly selectors: readonly AgentToolSelector[];
|
|
5
|
+
}
|
|
6
|
+
interface AgentToolSelector {
|
|
7
|
+
readonly token: string;
|
|
8
|
+
readonly kind: 'family' | 'family_wildcard' | 'method' | 'standalone';
|
|
9
|
+
readonly sensitivity: 'read' | 'write';
|
|
10
|
+
readonly sensitive: boolean;
|
|
11
|
+
}
|
|
2
12
|
export interface IntegrationValidationContext {
|
|
3
13
|
readonly agentToolSelectionCatalogs: ReadonlyMap<IntegrationProviderKind, AgentToolSelectionCatalog>;
|
|
4
14
|
readonly workspaceConnectionSnapshot: ReadonlyMap<string, {
|
|
@@ -8,4 +18,5 @@ export interface IntegrationValidationContext {
|
|
|
8
18
|
}>;
|
|
9
19
|
readonly defaultConnectionSlug?: string | undefined;
|
|
10
20
|
}
|
|
21
|
+
export {};
|
|
11
22
|
//# sourceMappingURL=integration-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-context.d.ts","sourceRoot":"","sources":["../../../src/core/entities/integration-context.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"integration-context.d.ts","sourceRoot":"","sources":["../../../src/core/entities/integration-context.ts"],"names":[],"mappings":"AAAA,KAAK,uBAAuB,GAAG,MAAM,CAAC;AACtC,KAAK,qBAAqB,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE9D,UAAU,yBAAyB;IACjC,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD;AAED,UAAU,iBAAiB;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,GAAG,YAAY,CAAC;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,0BAA0B,EAAE,WAAW,CAC9C,uBAAuB,EACvB,yBAAyB,CAC1B,CAAC;IACF,QAAQ,CAAC,2BAA2B,EAAE,WAAW,CAC/C,MAAM,EACN;QACE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;QAC3C,QAAQ,CAAC,YAAY,EAAE,SAAS,qBAAqB,EAAE,CAAC;KACzD,CACF,CAAC;IACF,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/integration-context.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/integration-context.ts"],"sourcesContent":["type IntegrationProviderKind = string;\ntype IntegrationCapability = 'source_control' | 'agent_tools';\n\ninterface AgentToolSelectionCatalog {\n readonly selectors: readonly AgentToolSelector[];\n}\n\ninterface AgentToolSelector {\n readonly token: string;\n readonly kind: 'family' | 'family_wildcard' | 'method' | 'standalone';\n readonly sensitivity: 'read' | 'write';\n readonly sensitive: boolean;\n}\n\nexport interface IntegrationValidationContext {\n readonly agentToolSelectionCatalogs: ReadonlyMap<\n IntegrationProviderKind,\n AgentToolSelectionCatalog\n >;\n readonly workspaceConnectionSnapshot: ReadonlyMap<\n string,\n {\n readonly id: string;\n readonly provider: IntegrationProviderKind;\n readonly capabilities: readonly IntegrationCapability[];\n }\n >;\n readonly defaultConnectionSlug?: string | undefined;\n}\n"],"names":[],"mappings":"AAcA,WAcC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,qBAAqB,CAAC;AACzC,OAAO,
|
|
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"}
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export type * from './entities/index.js';\nexport {DefinitionParseError
|
|
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,
|
|
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,
|
|
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 {
|
|
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
|
-
|
|
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,
|
|
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 {
|
|
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,9 +1,11 @@
|
|
|
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';
|
|
4
5
|
import type { DefinitionsSourceControl } from './integrations.js';
|
|
5
6
|
export declare const WORKFLOW_PREFIX = ".shipfox/workflows/";
|
|
6
7
|
export declare const MAX_WORKFLOW_FILES = 100;
|
|
8
|
+
export declare const MAX_WORKFLOW_FILE_BYTES = 1000000;
|
|
7
9
|
export declare const FILE_FETCH_CONCURRENCY = 4;
|
|
8
10
|
export declare const UNRESOLVED_SYNC_REF = "__unresolved__";
|
|
9
11
|
export interface SyncSourceContext {
|
|
@@ -32,6 +34,7 @@ export interface FetchAndParseWorkflowsParams extends SyncSourceContext {
|
|
|
32
34
|
ref: string;
|
|
33
35
|
paths: string[];
|
|
34
36
|
onProgress?: ((path: string) => void) | undefined;
|
|
37
|
+
agentValidationCatalog: AgentValidationCatalog;
|
|
35
38
|
loadIntegrationValidationContext?: (() => Promise<IntegrationValidationContext>) | undefined;
|
|
36
39
|
}
|
|
37
40
|
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":"
|
|
1
|
+
{"version":3,"file":"sync-definitions.d.ts","sourceRoot":"","sources":["../../src/core/sync-definitions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAIhF,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,uBAAuB,UAAY,CAAC;AACjD,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,yBAAyB,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA6B,SAAQ,iBAAiB;IACrE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAClD,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,gCAAgC,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,4BAA4B,CAAC,CAAC,GAAG,SAAS,CAAC;CAC9F;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,cAAc,EAAE,CAAC,CAkD3B;AA6BD,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CA+B7E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { integrationsInterModuleContract
|
|
2
|
+
import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto/inter-module';
|
|
3
3
|
import { isInterModuleKnownError } from '@shipfox/inter-module';
|
|
4
4
|
import { boundedMap } from '@shipfox/node-module';
|
|
5
5
|
import { DefinitionParseError, DefinitionSyncPermanentError } from './errors.js';
|
|
@@ -7,6 +7,7 @@ import { hasAgentStepIntegrations } from './has-agent-step-integrations.js';
|
|
|
7
7
|
import { parseDefinition } from './parse-definition.js';
|
|
8
8
|
export const WORKFLOW_PREFIX = '.shipfox/workflows/';
|
|
9
9
|
export const MAX_WORKFLOW_FILES = 100;
|
|
10
|
+
export const MAX_WORKFLOW_FILE_BYTES = 1_000_000;
|
|
10
11
|
export const FILE_FETCH_CONCURRENCY = 4;
|
|
11
12
|
export const UNRESOLVED_SYNC_REF = '__unresolved__';
|
|
12
13
|
export async function resolveSyncSource(params) {
|
|
@@ -49,13 +50,14 @@ export async function fetchAndParseWorkflows(params) {
|
|
|
49
50
|
ref: params.ref,
|
|
50
51
|
path
|
|
51
52
|
});
|
|
52
|
-
if (Buffer.byteLength(snapshot.content, 'utf8') >
|
|
53
|
-
throw new DefinitionSyncPermanentError('content-too-large', `Workflow file is larger than ${
|
|
53
|
+
if (Buffer.byteLength(snapshot.content, 'utf8') > MAX_WORKFLOW_FILE_BYTES) {
|
|
54
|
+
throw new DefinitionSyncPermanentError('content-too-large', `Workflow file is larger than ${MAX_WORKFLOW_FILE_BYTES} bytes: ${snapshot.path}`);
|
|
54
55
|
}
|
|
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
|
|
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,U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,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,UAAUb,OAAe;IAChC,OAAO/C,WAAW,UAAU8E,MAAM,CAAC/B,SAAS,QAAQgC,MAAM,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 {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 MAX_WORKFLOW_FILE_BYTES = 1_000_000;\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_WORKFLOW_FILE_BYTES) {\n throw new DefinitionSyncPermanentError(\n 'content-too-large',\n `Workflow file is larger than ${MAX_WORKFLOW_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","integrationsInterModuleContract","isInterModuleKnownError","boundedMap","DefinitionParseError","DefinitionSyncPermanentError","hasAgentStepIntegrations","parseDefinition","WORKFLOW_PREFIX","MAX_WORKFLOW_FILES","MAX_WORKFLOW_FILE_BYTES","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,+BAA+B,QAAO,iDAAiD;AAC/F,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,0BAA0B,UAAU;AACjD,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,OAAOS,UAAU,CAACC,aAAa;IAAA;AAC9C;AAMA,OAAO,eAAeC,sBACpBZ,MAAmC;IAEnC,MAAMa,OAAO,MAAMb,OAAOE,aAAa,CAACY,SAAS,CAAC;QAChDV,aAAaJ,OAAOI,WAAW;QAC/BC,cAAcL,OAAOM,kBAAkB;QACvCC,sBAAs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
|
|
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
|
-
|
|
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,
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-agent-integrations.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-agent-integrations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-agent-integrations.d.ts","sourceRoot":"","sources":["../../../src/core/workflow-model/normalize-agent-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAUpF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,YAAY,EAAE,SAAS,+BAA+B,EAAE,GAAG,SAAS,CAAC;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,4BAA4B,EAAE,CAAC;IACvC,4BAA4B,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;CACzE,GAAG,SAAS,4BAA4B,EAAE,GAAG,SAAS,CAQtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/workflow-model/normalize-agent-integrations.ts"],"sourcesContent":["import type {AgentToolSelector} from '@shipfox/api-integration-core-dto';\nimport type {WorkflowDocumentStepIntegration} from '@shipfox/workflow-document';\nimport type {IntegrationValidationContext} from '../entities/integration-context.js';\nimport type {WorkflowModelStepIntegration} from '../entities/workflow-model.js';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {issue} from './validation-issue.js';\n\nexport function normalizeAgentIntegrations(params: {\n integrations: readonly WorkflowDocumentStepIntegration[] | undefined;\n sourceName: string;\n stepIndex: number;\n issues: WorkflowModelValidationIssue[];\n integrationValidationContext?: IntegrationValidationContext | undefined;\n}): readonly WorkflowModelStepIntegration[] | undefined {\n if (params.integrations === undefined) return undefined;\n\n return params.integrations.map((integration, integrationIndex) => {\n const normalized = normalizeIntegration(integration);\n validateIntegration({...params, integration, normalized, integrationIndex});\n return normalized;\n });\n}\n\nfunction normalizeIntegration(\n integration: WorkflowDocumentStepIntegration,\n): WorkflowModelStepIntegration {\n return {\n ...(integration.connection === undefined ? {} : {connection: integration.connection}),\n include: dedupe(integration.include),\n ...(integration.exclude === undefined ? {} : {exclude: dedupe(integration.exclude)}),\n allowWrite: integration.allow_write ?? false,\n };\n}\n\nfunction validateIntegration(params: {\n integration: WorkflowDocumentStepIntegration;\n normalized: WorkflowModelStepIntegration;\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n issues: WorkflowModelValidationIssue[];\n integrationValidationContext?: IntegrationValidationContext | undefined;\n}): void {\n const context = params.integrationValidationContext;\n if (context === undefined) return;\n\n const connectionSlug = params.normalized.connection ?? context.defaultConnectionSlug;\n if (connectionSlug === undefined) {\n params.issues.push(\n issue({\n code: 'missing-connection-for-integration',\n message: 'Agent step integration requires a connection or a default source connection.',\n path: integrationPath(params),\n details: {integrationIndex: params.integrationIndex},\n }),\n );\n return;\n }\n\n const connection = context.workspaceConnectionSnapshot.get(connectionSlug);\n if (connection === undefined) {\n params.issues.push(\n issue({\n code: 'integration-connection-not-found',\n message: `Integration connection \"${connectionSlug}\" was not found in the workspace.`,\n path: integrationConnectionPath(params),\n details: {\n connection: connectionSlug,\n integrationIndex: params.integrationIndex,\n },\n }),\n );\n return;\n }\n\n const catalog = context.agentToolSelectionCatalogs.get(connection.provider);\n if (catalog === undefined || !connection.capabilities.includes('agent_tools')) {\n params.issues.push(\n issue({\n code: 'integration-connection-not-capable',\n message: `Integration connection \"${connectionSlug}\" does not support agent tools.`,\n path: integrationConnectionPath(params),\n details: {\n connection: connectionSlug,\n provider: connection.provider,\n capabilities: connection.capabilities,\n integrationIndex: params.integrationIndex,\n },\n }),\n );\n return;\n }\n\n const selectorsByToken = new Map(catalog.selectors.map((selector) => [selector.token, selector]));\n validateSelection({\n ...params,\n field: 'include',\n tokens: params.integration.include,\n selectorsByToken,\n });\n if (params.integration.exclude !== undefined) {\n validateSelection({\n ...params,\n field: 'exclude',\n tokens: params.integration.exclude,\n selectorsByToken,\n });\n }\n validateWriteSelection({...params, selectorsByToken});\n}\n\nfunction validateSelection(params: {\n field: 'include' | 'exclude';\n tokens: readonly string[];\n selectorsByToken: ReadonlyMap<string, AgentToolSelector>;\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n issues: WorkflowModelValidationIssue[];\n}): void {\n params.tokens.forEach((token, tokenIndex) => {\n if (params.selectorsByToken.has(token)) return;\n\n const code = classifyUnknownSelection(token, params.selectorsByToken);\n params.issues.push(\n issue({\n code,\n message:\n code === 'unknown-integration-method'\n ? `Unknown integration tool method: ${token}.`\n : `Unknown integration tool: ${token}.`,\n path: [...integrationPath(params), params.field, tokenIndex],\n details: {token},\n }),\n );\n });\n}\n\nfunction validateWriteSelection(params: {\n integration: WorkflowDocumentStepIntegration;\n normalized: WorkflowModelStepIntegration;\n selectorsByToken: ReadonlyMap<string, AgentToolSelector>;\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n issues: WorkflowModelValidationIssue[];\n}): void {\n if (params.normalized.allowWrite) return;\n\n const writeTokens = dedupe(\n params.integration.include.filter(\n (token) => params.selectorsByToken.get(token)?.sensitivity === 'write',\n ),\n );\n if (writeTokens.length === 0) return;\n\n params.issues.push(\n issue({\n code: 'integration-write-not-allowed',\n message: `Integration selection includes write-capable tools but allow_write is not true: ${writeTokens.join(', ')}.`,\n path: [...integrationPath(params), 'include'],\n details: {tokens: writeTokens},\n }),\n );\n}\n\nfunction classifyUnknownSelection(\n token: string,\n selectorsByToken: ReadonlyMap<string, AgentToolSelector>,\n): 'unknown-integration-method' | 'unknown-integration-tool' {\n const dotIndex = token.indexOf('.');\n if (dotIndex < 1) return 'unknown-integration-tool';\n\n const family = token.slice(0, dotIndex);\n return selectorsByToken.get(family)?.kind === 'family'\n ? 'unknown-integration-method'\n : 'unknown-integration-tool';\n}\n\nfunction integrationConnectionPath(params: {\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n integration: WorkflowDocumentStepIntegration;\n}): readonly (string | number)[] {\n const path = integrationPath(params);\n if (params.integration.connection === undefined) return path;\n return [...path, 'connection'];\n}\n\nfunction integrationPath(params: {\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n}): readonly (string | number)[] {\n return [\n 'jobs',\n params.sourceName,\n 'steps',\n params.stepIndex,\n 'integrations',\n params.integrationIndex,\n ];\n}\n\nfunction dedupe(values: readonly string[]): readonly string[] {\n return [...new Set(values)];\n}\n"],"names":["issue","normalizeAgentIntegrations","params","integrations","undefined","map","integration","integrationIndex","normalized","normalizeIntegration","validateIntegration","connection","include","dedupe","exclude","allowWrite","allow_write","context","integrationValidationContext","connectionSlug","defaultConnectionSlug","issues","push","code","message","path","integrationPath","details","workspaceConnectionSnapshot","get","integrationConnectionPath","catalog","agentToolSelectionCatalogs","provider","capabilities","includes","selectorsByToken","Map","selectors","selector","token","validateSelection","field","tokens","validateWriteSelection","forEach","tokenIndex","has","classifyUnknownSelection","writeTokens","filter","sensitivity","length","join","dotIndex","indexOf","family","slice","kind","sourceName","stepIndex","values","Set"],"mappings":"AAKA,SAAQA,KAAK,QAAO,wBAAwB;AAE5C,OAAO,SAASC,2BAA2BC,MAM1C;IACC,IAAIA,OAAOC,YAAY,KAAKC,WAAW,OAAOA;IAE9C,O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YAC5DnB,SAAS;gBAACa;YAAK;QACjB;IAEJ;AACF;AAEA,SAASI,uBAAuB1C,MAQ/B;IACC,IAAIA,OAAOM,UAAU,CAACO,UAAU,EAAE;IAElC,MAAMkC,cAAcpC,OAClBX,OAAOI,WAAW,CAACM,OAAO,CAACsC,MAAM,CAC/B,CAACV,QAAUtC,OAAOkC,gBAAgB,CAACP,GAAG,CAACW,QAAQW,gBAAgB;IAGnE,IAAIF,YAAYG,MAAM,KAAK,GAAG;IAE9BlD,OAAOmB,MAAM,CAACC,IAAI,CAChBtB,MAAM;QACJuB,MAAM;QACNC,SAAS,CAAC,gFAAgF,EAAEyB,YAAYI,IAAI,CAAC,MAAM,CAAC,CAAC;QACrH5B,MAAM;eAAIC,gBAAgBxB;YAAS;SAAU;QAC7CyB,SAAS;YAACgB,QAAQM;QAAW;IAC/B;AAEJ;AAEA,SAASD,yBACPR,KAAa,EACbJ,gBAAwD;IAExD,MAAMkB,WAAWd,MAAMe,OAAO,CAAC;IAC/B,IAAID,WAAW,GAAG,OAAO;IAEzB,MAAME,SAAShB,MAAMiB,KAAK,CAAC,GAAGH;IAC9B,OAAOlB,iBAAiBP,GAAG,CAAC2B,SAASE,SAAS,WAC1C,+BACA;AACN;AAEA,SAAS5B,0BAA0B5B,MAKlC;IACC,MAAMuB,OAAOC,gBAAgBxB;IAC7B,IAAIA,OAAOI,WAAW,CAACK,UAAU,KAAKP,WAAW,OAAOqB;IACxD,OAAO;WAAIA;QAAM;KAAa;AAChC;AAEA,SAASC,gBAAgBxB,MAIxB;IACC,OAAO;QACL;QACAA,OAAOyD,UAAU;QACjB;QACAzD,OAAO0D,SAAS;QAChB;QACA1D,OAAOK,gBAAgB;KACxB;AACH;AAEA,SAASM,OAAOgD,MAAyB;IACvC,OAAO;WAAI,IAAIC,IAAID;KAAQ;AAC7B"}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/workflow-model/normalize-agent-integrations.ts"],"sourcesContent":["import type {WorkflowDocumentStepIntegration} from '@shipfox/workflow-document';\nimport type {IntegrationValidationContext} from '../entities/integration-context.js';\nimport type {WorkflowModelStepIntegration} from '../entities/workflow-model.js';\nimport type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';\nimport {issue} from './validation-issue.js';\n\ninterface AgentToolSelector {\n readonly token: string;\n readonly kind: 'family' | 'family_wildcard' | 'method' | 'standalone';\n readonly sensitivity: 'read' | 'write';\n readonly sensitive: boolean;\n}\n\nexport function normalizeAgentIntegrations(params: {\n integrations: readonly WorkflowDocumentStepIntegration[] | undefined;\n sourceName: string;\n stepIndex: number;\n issues: WorkflowModelValidationIssue[];\n integrationValidationContext?: IntegrationValidationContext | undefined;\n}): readonly WorkflowModelStepIntegration[] | undefined {\n if (params.integrations === undefined) return undefined;\n\n return params.integrations.map((integration, integrationIndex) => {\n const normalized = normalizeIntegration(integration);\n validateIntegration({...params, integration, normalized, integrationIndex});\n return normalized;\n });\n}\n\nfunction normalizeIntegration(\n integration: WorkflowDocumentStepIntegration,\n): WorkflowModelStepIntegration {\n return {\n ...(integration.connection === undefined ? {} : {connection: integration.connection}),\n include: dedupe(integration.include),\n ...(integration.exclude === undefined ? {} : {exclude: dedupe(integration.exclude)}),\n allowWrite: integration.allow_write ?? false,\n };\n}\n\nfunction validateIntegration(params: {\n integration: WorkflowDocumentStepIntegration;\n normalized: WorkflowModelStepIntegration;\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n issues: WorkflowModelValidationIssue[];\n integrationValidationContext?: IntegrationValidationContext | undefined;\n}): void {\n const context = params.integrationValidationContext;\n if (context === undefined) return;\n\n const connectionSlug = params.normalized.connection ?? context.defaultConnectionSlug;\n if (connectionSlug === undefined) {\n params.issues.push(\n issue({\n code: 'missing-connection-for-integration',\n message: 'Agent step integration requires a connection or a default source connection.',\n path: integrationPath(params),\n details: {integrationIndex: params.integrationIndex},\n }),\n );\n return;\n }\n\n const connection = context.workspaceConnectionSnapshot.get(connectionSlug);\n if (connection === undefined) {\n params.issues.push(\n issue({\n code: 'integration-connection-not-found',\n message: `Integration connection \"${connectionSlug}\" was not found in the workspace.`,\n path: integrationConnectionPath(params),\n details: {\n connection: connectionSlug,\n integrationIndex: params.integrationIndex,\n },\n }),\n );\n return;\n }\n\n const catalog = context.agentToolSelectionCatalogs.get(connection.provider);\n if (catalog === undefined || !connection.capabilities.includes('agent_tools')) {\n params.issues.push(\n issue({\n code: 'integration-connection-not-capable',\n message: `Integration connection \"${connectionSlug}\" does not support agent tools.`,\n path: integrationConnectionPath(params),\n details: {\n connection: connectionSlug,\n provider: connection.provider,\n capabilities: connection.capabilities,\n integrationIndex: params.integrationIndex,\n },\n }),\n );\n return;\n }\n\n const selectorsByToken = new Map(catalog.selectors.map((selector) => [selector.token, selector]));\n validateSelection({\n ...params,\n field: 'include',\n tokens: params.integration.include,\n selectorsByToken,\n });\n if (params.integration.exclude !== undefined) {\n validateSelection({\n ...params,\n field: 'exclude',\n tokens: params.integration.exclude,\n selectorsByToken,\n });\n }\n validateWriteSelection({...params, selectorsByToken});\n}\n\nfunction validateSelection(params: {\n field: 'include' | 'exclude';\n tokens: readonly string[];\n selectorsByToken: ReadonlyMap<string, AgentToolSelector>;\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n issues: WorkflowModelValidationIssue[];\n}): void {\n params.tokens.forEach((token, tokenIndex) => {\n if (params.selectorsByToken.has(token)) return;\n\n const code = classifyUnknownSelection(token, params.selectorsByToken);\n params.issues.push(\n issue({\n code,\n message:\n code === 'unknown-integration-method'\n ? `Unknown integration tool method: ${token}.`\n : `Unknown integration tool: ${token}.`,\n path: [...integrationPath(params), params.field, tokenIndex],\n details: {token},\n }),\n );\n });\n}\n\nfunction validateWriteSelection(params: {\n integration: WorkflowDocumentStepIntegration;\n normalized: WorkflowModelStepIntegration;\n selectorsByToken: ReadonlyMap<string, AgentToolSelector>;\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n issues: WorkflowModelValidationIssue[];\n}): void {\n if (params.normalized.allowWrite) return;\n\n const writeTokens = dedupe(\n params.integration.include.filter(\n (token) => params.selectorsByToken.get(token)?.sensitivity === 'write',\n ),\n );\n if (writeTokens.length === 0) return;\n\n params.issues.push(\n issue({\n code: 'integration-write-not-allowed',\n message: `Integration selection includes write-capable tools but allow_write is not true: ${writeTokens.join(', ')}.`,\n path: [...integrationPath(params), 'include'],\n details: {tokens: writeTokens},\n }),\n );\n}\n\nfunction classifyUnknownSelection(\n token: string,\n selectorsByToken: ReadonlyMap<string, AgentToolSelector>,\n): 'unknown-integration-method' | 'unknown-integration-tool' {\n const dotIndex = token.indexOf('.');\n if (dotIndex < 1) return 'unknown-integration-tool';\n\n const family = token.slice(0, dotIndex);\n return selectorsByToken.get(family)?.kind === 'family'\n ? 'unknown-integration-method'\n : 'unknown-integration-tool';\n}\n\nfunction integrationConnectionPath(params: {\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n integration: WorkflowDocumentStepIntegration;\n}): readonly (string | number)[] {\n const path = integrationPath(params);\n if (params.integration.connection === undefined) return path;\n return [...path, 'connection'];\n}\n\nfunction integrationPath(params: {\n sourceName: string;\n stepIndex: number;\n integrationIndex: number;\n}): readonly (string | number)[] {\n return [\n 'jobs',\n params.sourceName,\n 'steps',\n params.stepIndex,\n 'integrations',\n params.integrationIndex,\n ];\n}\n\nfunction dedupe(values: readonly string[]): readonly string[] {\n return [...new Set(values)];\n}\n"],"names":["issue","normalizeAgentIntegrations","params","integrations","undefined","map","integration","integrationIndex","normalized","normalizeIntegration","validateIntegration","connection","include","dedupe","exclude","allowWrite","allow_write","context","integrationValidationContext","connectionSlug","defaultConnectionSlug","issues","push","code","message","path","integrationPath","details","workspaceConnectionSnapshot","get","integrationConnectionPath","catalog","agentToolSelectionCatalogs","provider","capabilities","includes","selectorsByToken","Map","selectors","selector","token","validateSelection","field","tokens","validateWriteSelection","forEach","tokenIndex","has","classifyUnknownSelection","writeTokens","filter","sensitivity","length","join","dotIndex","indexOf","family","slice","kind","sourceName","stepIndex","values","Set"],"mappings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