@shipfox/api-definitions 8.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/api-definitions",
3
3
  "license": "MIT",
4
- "version": "8.0.0",
4
+ "version": "9.0.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -11,10 +11,6 @@
11
11
  "type": "module",
12
12
  "main": "dist/index.js",
13
13
  "types": "dist/index.d.ts",
14
- "imports": {
15
- "#test/*": "./test/*",
16
- "#*": "./dist/*"
17
- },
18
14
  "exports": {
19
15
  ".": {
20
16
  "types": "./dist/index.d.ts",
@@ -30,25 +26,28 @@
30
26
  "js-yaml": "^4.1.0",
31
27
  "yaml": "^2.8.3",
32
28
  "zod": "^4.4.3",
33
- "@shipfox/api-agent-dto": "8.0.0",
34
- "@shipfox/api-auth-context": "7.1.0",
35
- "@shipfox/api-definitions-dto": "6.0.0",
36
- "@shipfox/api-integration-core-dto": "8.0.0",
37
- "@shipfox/api-projects-dto": "8.0.0",
38
- "@shipfox/api-secrets-dto": "6.0.0",
39
- "@shipfox/config": "1.2.2",
40
- "@shipfox/expression": "1.1.3",
41
- "@shipfox/inter-module": "0.2.0",
42
- "@shipfox/node-drizzle": "0.3.2",
43
- "@shipfox/node-fastify": "0.3.0",
44
- "@shipfox/node-error-monitoring": "0.2.0",
45
- "@shipfox/node-module": "0.5.0",
46
- "@shipfox/node-opentelemetry": "0.6.0",
47
- "@shipfox/node-outbox": "0.2.4",
48
- "@shipfox/node-postgres": "0.4.2",
49
- "@shipfox/node-temporal": "0.4.0",
50
- "@shipfox/runner-labels": "0.1.1",
51
- "@shipfox/workflow-document": "2.1.1"
29
+ "@shipfox/api-agent-dto": "9.0.1",
30
+ "@shipfox/api-auth-context": "9.0.1",
31
+ "@shipfox/api-definitions-dto": "9.0.1",
32
+ "@shipfox/api-integration-core-dto": "9.0.1",
33
+ "@shipfox/api-projects-dto": "9.0.1",
34
+ "@shipfox/api-secrets-dto": "9.0.1",
35
+ "@shipfox/config": "1.2.3",
36
+ "@shipfox/expression": "1.1.4",
37
+ "@shipfox/inter-module": "0.2.1",
38
+ "@shipfox/node-drizzle": "0.3.3",
39
+ "@shipfox/node-fastify": "0.3.1",
40
+ "@shipfox/node-error-monitoring": "0.2.1",
41
+ "@shipfox/node-module": "1.0.0",
42
+ "@shipfox/node-opentelemetry": "0.6.1",
43
+ "@shipfox/node-outbox": "0.2.5",
44
+ "@shipfox/node-postgres": "0.4.3",
45
+ "@shipfox/node-temporal": "0.4.1",
46
+ "@shipfox/runner-labels": "0.1.2",
47
+ "@shipfox/workflow-document": "2.1.2"
48
+ },
49
+ "imports": {
50
+ "#*": "./dist/*"
52
51
  },
53
52
  "scripts": {
54
53
  "build": "shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js",
@@ -1,8 +1,16 @@
1
- import type {
2
- AgentToolSelectionCatalog,
3
- IntegrationCapability,
4
- IntegrationProviderKind,
5
- } from '@shipfox/api-integration-core-dto';
1
+ type IntegrationProviderKind = string;
2
+ type IntegrationCapability = 'source_control' | 'agent_tools';
3
+
4
+ interface AgentToolSelectionCatalog {
5
+ readonly selectors: readonly AgentToolSelector[];
6
+ }
7
+
8
+ interface AgentToolSelector {
9
+ readonly token: string;
10
+ readonly kind: 'family' | 'family_wildcard' | 'method' | 'standalone';
11
+ readonly sensitivity: 'read' | 'write';
12
+ readonly sensitive: boolean;
13
+ }
6
14
 
7
15
  export interface IntegrationValidationContext {
8
16
  readonly agentToolSelectionCatalogs: ReadonlyMap<
@@ -1,10 +1,10 @@
1
- import type {IntegrationSourceControlService} from '@shipfox/api-integration-core';
2
1
  import {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';
3
2
  import {createInterModuleKnownError} from '@shipfox/inter-module';
4
3
  import {LOWERCASE_SHA256_HEX_RE} from '@shipfox/regex';
5
4
  import {agentValidationCatalog} from '#test/agent-validation-catalog.js';
6
5
  import type {IntegrationValidationContext} from './entities/integration-context.js';
7
6
  import {DefinitionSyncPermanentError} from './errors.js';
7
+ import type {DefinitionsSourceControl} from './integrations.js';
8
8
  import {
9
9
  classifySyncFailure,
10
10
  discoverWorkflowFiles,
@@ -69,11 +69,9 @@ const integrationValidationContext = {
69
69
  } satisfies IntegrationValidationContext;
70
70
 
71
71
  function sourceControl(
72
- overrides: Partial<IntegrationSourceControlService> = {},
73
- ): IntegrationSourceControlService {
72
+ overrides: Partial<DefinitionsSourceControl> = {},
73
+ ): DefinitionsSourceControl {
74
74
  return {
75
- getConnection: vi.fn(),
76
- listRepositories: vi.fn(),
77
75
  resolveRepository: vi.fn(() =>
78
76
  Promise.resolve({
79
77
  connection: {
@@ -108,7 +106,6 @@ function sourceControl(
108
106
  fetchFile: vi.fn(() =>
109
107
  Promise.resolve({path: '.shipfox/workflows/ci.yml', ref: 'main', content: validYaml}),
110
108
  ),
111
- createCheckoutSpec: vi.fn(),
112
109
  ...overrides,
113
110
  };
114
111
  }
@@ -1,6 +1,5 @@
1
1
  import {createHash} from 'node:crypto';
2
2
  import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';
3
- import {MAX_REPOSITORY_FILE_BYTES} from '@shipfox/api-integration-core-dto';
4
3
  import {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';
5
4
  import {isInterModuleKnownError} from '@shipfox/inter-module';
6
5
  import {boundedMap} from '@shipfox/node-module';
@@ -14,6 +13,7 @@ import {parseDefinition} from './parse-definition.js';
14
13
 
15
14
  export const WORKFLOW_PREFIX = '.shipfox/workflows/';
16
15
  export const MAX_WORKFLOW_FILES = 100;
16
+ export const MAX_WORKFLOW_FILE_BYTES = 1_000_000;
17
17
  export const FILE_FETCH_CONCURRENCY = 4;
18
18
  export const UNRESOLVED_SYNC_REF = '__unresolved__';
19
19
 
@@ -104,10 +104,10 @@ export async function fetchAndParseWorkflows(
104
104
  path,
105
105
  });
106
106
 
107
- if (Buffer.byteLength(snapshot.content, 'utf8') > MAX_REPOSITORY_FILE_BYTES) {
107
+ if (Buffer.byteLength(snapshot.content, 'utf8') > MAX_WORKFLOW_FILE_BYTES) {
108
108
  throw new DefinitionSyncPermanentError(
109
109
  'content-too-large',
110
- `Workflow file is larger than ${MAX_REPOSITORY_FILE_BYTES} bytes: ${snapshot.path}`,
110
+ `Workflow file is larger than ${MAX_WORKFLOW_FILE_BYTES} bytes: ${snapshot.path}`,
111
111
  );
112
112
  }
113
113
 
@@ -1,10 +1,16 @@
1
- import type {AgentToolSelector} from '@shipfox/api-integration-core-dto';
2
1
  import type {WorkflowDocumentStepIntegration} from '@shipfox/workflow-document';
3
2
  import type {IntegrationValidationContext} from '../entities/integration-context.js';
4
3
  import type {WorkflowModelStepIntegration} from '../entities/workflow-model.js';
5
4
  import type {WorkflowModelValidationIssue} from './invalid-workflow-model-error.js';
6
5
  import {issue} from './validation-issue.js';
7
6
 
7
+ interface AgentToolSelector {
8
+ readonly token: string;
9
+ readonly kind: 'family' | 'family_wildcard' | 'method' | 'standalone';
10
+ readonly sensitivity: 'read' | 'write';
11
+ readonly sensitive: boolean;
12
+ }
13
+
8
14
  export function normalizeAgentIntegrations(params: {
9
15
  integrations: readonly WorkflowDocumentStepIntegration[] | undefined;
10
16
  sourceName: string;
package/src/index.ts CHANGED
@@ -62,7 +62,7 @@ export function createDefinitionsModule({
62
62
 
63
63
  return {
64
64
  name: 'definitions',
65
- database: {db, migrationsPath},
65
+ database: {db, migrationsPath, databaseNamespace: 'definitions'},
66
66
  routes: createDefinitionRoutes({projects, agent, integrations}),
67
67
  publishers: [
68
68
  {name: 'definitions', table: definitionsOutbox, db, eventSchemas: definitionsEventSchemas},
@@ -1,9 +1,9 @@
1
- import type {IntegrationSourceControlService} from '@shipfox/api-integration-core';
2
1
  import {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';
3
2
  import {createInterModuleKnownError} from '@shipfox/inter-module';
4
3
  import {isErrorReported} from '@shipfox/node-error-monitoring';
5
4
  import {ApplicationFailure} from '@temporalio/common';
6
5
  import {sql} from 'drizzle-orm';
6
+ import type {DefinitionsSourceControl} from '#core/integrations.js';
7
7
  import {db, definitionSyncStates} from '#db/index.js';
8
8
  import {workflowDefinitions} from '#db/schema/definitions.js';
9
9
  import {agentValidationCatalog} from '#test/agent-validation-catalog.js';
@@ -27,11 +27,9 @@ jobs:
27
27
  `;
28
28
 
29
29
  function sourceControl(
30
- overrides: Partial<IntegrationSourceControlService> = {},
31
- ): IntegrationSourceControlService {
30
+ overrides: Partial<DefinitionsSourceControl> = {},
31
+ ): DefinitionsSourceControl {
32
32
  return {
33
- getConnection: vi.fn(),
34
- listRepositories: vi.fn(),
35
33
  resolveRepository: vi.fn(() =>
36
34
  Promise.resolve({
37
35
  connection: {
@@ -66,7 +64,6 @@ function sourceControl(
66
64
  fetchFile: vi.fn(() =>
67
65
  Promise.resolve({path: '.shipfox/workflows/ci.yml', ref: 'main', content: validYaml}),
68
66
  ),
69
- createCheckoutSpec: vi.fn(),
70
67
  ...overrides,
71
68
  };
72
69
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  DEFAULT_HARNESS_TOOL_DEPLOYMENT_CONFIG,
3
- getModelProviderEntry,
4
3
  listEnabledHarnessTools,
5
4
  listHarnessDescriptors,
5
+ MODEL_PROVIDER_CATALOG_SEED,
6
6
  MODEL_PROVIDER_IDS,
7
7
  } from '@shipfox/api-agent-dto';
8
8
  import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';
@@ -11,7 +11,8 @@ export const agentValidationCatalog: AgentValidationCatalog = {
11
11
  version: 1,
12
12
  providers: MODEL_PROVIDER_IDS.map((id) => ({
13
13
  id,
14
- support_status: getModelProviderEntry(id)?.support_status ?? 'unsupported',
14
+ support_status:
15
+ MODEL_PROVIDER_CATALOG_SEED.find((entry) => entry.id === id)?.support_status ?? 'unsupported',
15
16
  })),
16
17
  harnesses: listHarnessDescriptors().map((harness) => ({
17
18
  id: harness.id,
@@ -0,0 +1,17 @@
1
+ delete process.env.NODE_ENV;
2
+
3
+ const {createRequire} = await import('node:module');
4
+ const {fileURLToPath} = await import('node:url');
5
+ const {dirname, join} = await import('node:path');
6
+ const temporalRequire = createRequire(import.meta.resolve('@shipfox/node-temporal'));
7
+ const {bundleWorkflowCode} = await import(temporalRequire.resolve('@temporalio/worker'));
8
+ const packageEntryPoint = fileURLToPath(import.meta.resolve('@shipfox/api-definitions'));
9
+ const workflowsPath = join(
10
+ dirname(dirname(packageEntryPoint)),
11
+ 'dist',
12
+ 'temporal',
13
+ 'workflows',
14
+ 'index.js',
15
+ );
16
+
17
+ await bundleWorkflowCode({workflowsPath});