@shipfox/api-server 15.0.0 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 7 files with swc (684.58ms)
2
+ Successfully compiled: 7 files with swc (425.03ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # @shipfox/api-server
2
2
 
3
+ ## 16.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d1fb0a3: Adds the agent session claim and carry-over inter-module methods (`claimSession`, `carryOverSessions`) with the session descriptor (`id`, `key`, `mode`, `segment`), so workflows can resume or fork a session and rerun attempts can carry sessions forward.
8
+
9
+ Session claims are released automatically on step-attempt and job termination, with a stale-claim reap cron as a backstop.
10
+
11
+ The previously required `jobLeaseTokenTtlSeconds` option on `createAgentModule` is removed; pass an optional `workflows` client to enable the job-terminated grace sweep.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [d1fb0a3]
16
+ - Updated dependencies [c1e5dfd]
17
+ - Updated dependencies [870523f]
18
+ - @shipfox/api-agent@16.1.0
19
+ - @shipfox/api-agent-dto@16.1.0
20
+ - @shipfox/api-workflows@16.1.0
21
+ - @shipfox/api-workflows-dto@16.1.0
22
+ - @shipfox/api-definitions@16.1.0
23
+ - @shipfox/api-definitions-dto@16.1.0
24
+ - @shipfox/api-integration-core@16.1.0
25
+ - @shipfox/api-logs@16.1.0
26
+ - @shipfox/api-runners@16.1.0
27
+ - @shipfox/api-triggers@16.1.0
28
+ - @shipfox/api-dispatcher@15.0.0
29
+
30
+ ## 16.0.0
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [9b7cdcc]
35
+ - Updated dependencies [80d0263]
36
+ - Updated dependencies [568c90b]
37
+ - Updated dependencies [03e03c7]
38
+ - Updated dependencies [117edfd]
39
+ - Updated dependencies [8eda9d4]
40
+ - Updated dependencies [64155fb]
41
+ - @shipfox/api-agent@16.0.0
42
+ - @shipfox/api-definitions@16.0.0
43
+ - @shipfox/api-integration-core@16.0.0
44
+ - @shipfox/api-integration-core-dto@16.0.0
45
+ - @shipfox/api-agent-dto@16.0.0
46
+ - @shipfox/api-definitions-dto@16.0.0
47
+ - @shipfox/api-runners@16.0.0
48
+ - @shipfox/api-runners-dto@16.0.0
49
+ - @shipfox/api-logs@16.0.0
50
+ - @shipfox/api-projects@16.0.0
51
+ - @shipfox/api-triggers@16.0.0
52
+ - @shipfox/api-workflows@16.0.0
53
+ - @shipfox/api-workflows-dto@16.0.0
54
+ - @shipfox/api-dispatcher@15.0.0
55
+ - @shipfox/api-workspaces@16.0.0
56
+
3
57
  ## 15.0.0
4
58
 
5
59
  ### Patch Changes
package/dist/modules.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type AuthInterModuleClient } from '@shipfox/api-auth-dto/inter-module';
2
2
  import { type WebhookDeliverySource } from '@shipfox/api-integration-core';
3
3
  import { type SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
4
+ import { type WorkflowsModuleClient } from '@shipfox/api-workflows-dto/inter-module';
4
5
  import { type WorkspacesInterModuleClient } from '@shipfox/api-workspaces-dto/inter-module';
5
6
  import type { ShipfoxModule } from '@shipfox/node-module';
6
7
  export interface DefaultModulesOptions {
@@ -22,6 +23,14 @@ export type DefaultAuthModuleFactory = (options: {
22
23
  */
23
24
  export type DefaultAgentModuleFactory = (options: {
24
25
  secrets: Pick<SecretsInterModuleClient, 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'>;
26
+ /**
27
+ * Optional: the step-attempt-terminated release and the stale-claim reap cron
28
+ * are always registered so composed claim creators get a release backstop;
29
+ * only the job-terminated grace sweep is gated on this client, so a factory
30
+ * built without it stays claim/release-free (as before the session release
31
+ * stack landed).
32
+ */
33
+ workflows?: WorkflowsModuleClient | undefined;
25
34
  }) => ShipfoxModule;
26
35
  export type DefaultRunnersModuleFactory = (options: {
27
36
  auth: AuthInterModule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G,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE;IAC9C,UAAU,EAAE,2BAA2B,CAAC;CACzC,KAAK,aAAa,EAAE,CAAC;AAEtB,wBAAsB,cAAc,CAClC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,aAAa,EAAE,CAAC,CA0J1B"}
package/dist/modules.js CHANGED
@@ -140,7 +140,8 @@ export async function defaultModules(options = {}) {
140
140
  workspaces: workspacesClient
141
141
  }) ?? [];
142
142
  const agentModule = (options.agentModule ?? createAgentModule)({
143
- secrets: createAgentSecretsClient(secretsClient)
143
+ secrets: createAgentSecretsClient(secretsClient),
144
+ workflows: workflowsClient
144
145
  });
145
146
  if (options.agentModule) validateCustomAgentModule(agentModule);
146
147
  const modules = [
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/modules.ts"],"sourcesContent":["import {annotationsModule} from '@shipfox/annotations';\nimport {annotationsInterModuleContract} from '@shipfox/annotations-dto/inter-module';\nimport {createAgentModule} from '@shipfox/api-agent';\nimport {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';\nimport {createAuthModule} from '@shipfox/api-auth';\nimport {config as authConfig} from '@shipfox/api-auth/config';\nimport {\n type AuthInterModuleClient,\n authInterModuleContract,\n} from '@shipfox/api-auth-dto/inter-module';\nimport {createDefinitionsModule} from '@shipfox/api-definitions';\nimport {definitionsInterModuleContract} from '@shipfox/api-definitions-dto/inter-module';\nimport {dispatcherModule} from '@shipfox/api-dispatcher';\nimport {emailChallengesModule} from '@shipfox/api-email-challenges';\nimport {createIntegrationsContext, type WebhookDeliverySource} from '@shipfox/api-integration-core';\nimport {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {createLogsModule} from '@shipfox/api-logs';\nimport {createProjectsModule} from '@shipfox/api-projects';\nimport {projectsInterModuleContract} from '@shipfox/api-projects-dto/inter-module';\nimport {createRunnersModule} from '@shipfox/api-runners';\nimport {runnersInterModuleContract} from '@shipfox/api-runners-dto/inter-module';\nimport {createSecretsModule} from '@shipfox/api-secrets';\nimport {\n type SecretsInterModuleClient,\n secretsInterModuleContract,\n} from '@shipfox/api-secrets-dto/inter-module';\nimport {createTriggersModule} from '@shipfox/api-triggers';\nimport {createWorkflowsModule} from '@shipfox/api-workflows';\nimport {workflowsInterModuleContract} from '@shipfox/api-workflows-dto/inter-module';\nimport {createWorkspacesModule} from '@shipfox/api-workspaces';\nimport {\n type WorkspacesInterModuleClient,\n workspacesInterModuleContract,\n} from '@shipfox/api-workspaces-dto/inter-module';\nimport {reportError} from '@shipfox/node-error-monitoring';\nimport {durationToSeconds} from '@shipfox/node-jwt';\nimport type {ShipfoxModule} from '@shipfox/node-module';\nimport {\n createInMemoryInterModuleTransport,\n registerInterModulePresentations,\n} from '@shipfox/node-module/inter-module';\nimport {logger} from '@shipfox/node-opentelemetry';\n\nexport interface DefaultModulesOptions {\n webhookDeliverySource?: WebhookDeliverySource | undefined;\n authModule?: DefaultAuthModuleFactory | undefined;\n agentModule?: DefaultAgentModuleFactory | undefined;\n runnersModule?: DefaultRunnersModuleFactory | undefined;\n extension?: DefaultModulesExtension | undefined;\n}\n\nexport type DefaultAuthModuleFactory = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule;\n\n/**\n * Builds the Agent module in the standard composition slot. The default\n * factory validates Agent configuration through `createAgentModule`; a custom\n * factory owns equivalent validation when it does not delegate to that\n * factory. Custom modules must preserve the `agent` database namespace and\n * canonical Agent presentation required by the composed clients.\n */\nexport type DefaultAgentModuleFactory = (options: {\n secrets: Pick<SecretsInterModuleClient, 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'>;\n}) => ShipfoxModule;\nexport type DefaultRunnersModuleFactory = (options: {auth: AuthInterModuleClient}) => ShipfoxModule;\nexport type DefaultModulesExtension = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule[];\n\nexport async function defaultModules(\n options: DefaultModulesOptions = {},\n): Promise<ShipfoxModule[]> {\n const interModuleTransport = createInMemoryInterModuleTransport({\n reportInternalError: (error, context) => {\n logger().error(\n {err: error, module: context.module, method: context.method, phase: context.phase},\n 'Inter-module call failed unexpectedly',\n );\n reportError(error, {\n boundary: 'inter-module',\n operation: `${context.module}.${context.method}`,\n tags: {module: context.module, method: context.method, phase: context.phase},\n });\n },\n });\n const workflowsClient = interModuleTransport.createClient(workflowsInterModuleContract);\n const authClient = interModuleTransport.createClient(authInterModuleContract);\n const agentClient = interModuleTransport.createClient(agentInterModuleContract);\n const runnersClient = interModuleTransport.createClient(runnersInterModuleContract);\n const projectsClient = interModuleTransport.createClient(projectsInterModuleContract);\n const definitionsClient = interModuleTransport.createClient(definitionsInterModuleContract);\n const annotationsClient = interModuleTransport.createClient(annotationsInterModuleContract);\n const secretsClient = interModuleTransport.createClient(secretsInterModuleContract);\n const workspacesClient = interModuleTransport.createClient(workspacesInterModuleContract);\n const integrationsClient = interModuleTransport.createClient(integrationsInterModuleContract);\n const integrations = await createIntegrationsContext({\n workspaces: workspacesClient,\n secrets: {\n deleteSecrets: async (params) => (await secretsClient.deleteSecrets(params)).deleted,\n linear: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/linear/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).deleted,\n },\n jira: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/jira/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).deleted,\n },\n slack: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/slack/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).deleted,\n },\n },\n agentTools: {workflows: workflowsClient},\n webhookDeliverySource: options.webhookDeliverySource,\n });\n const projectsModule = createProjectsModule({integrations: integrationsClient, auth: authClient});\n const definitionsModule = createDefinitionsModule({\n projects: projectsClient,\n agent: agentClient,\n integrations: integrationsClient,\n });\n const extensionModules = options.extension?.({workspaces: workspacesClient}) ?? [];\n const agentModule = (options.agentModule ?? createAgentModule)({\n secrets: createAgentSecretsClient(secretsClient),\n });\n if (options.agentModule) validateCustomAgentModule(agentModule);\n\n const modules = [\n emailChallengesModule,\n (options.authModule ?? createAuthModule)({workspaces: workspacesClient}),\n createWorkspacesModule({auth: authClient, projects: projectsClient, runners: runnersClient}),\n createSecretsModule(projectsClient),\n agentModule,\n integrations.module,\n projectsModule,\n definitionsModule,\n createWorkflowsModule({\n annotations: annotationsClient,\n agent: agentClient,\n definitions: definitionsClient,\n auth: authClient,\n projects: projectsClient,\n runners: runnersClient,\n secrets: secretsClient,\n workspaces: workspacesClient,\n integrations: integrationsClient,\n }),\n annotationsModule,\n (options.runnersModule ?? createRunnersModule)({auth: authClient}),\n createLogsModule({\n workflows: workflowsClient,\n jobLeaseTokenTtlSeconds: durationToSeconds(authConfig.AUTH_JOB_LEASE_TOKEN_EXPIRES_IN),\n }),\n createTriggersModule({\n workflows: workflowsClient,\n definitions: definitionsClient,\n projects: projectsClient,\n }),\n dispatcherModule,\n ...extensionModules,\n ];\n registerInterModulePresentations({transport: interModuleTransport, modules});\n interModuleTransport.seal();\n return modules;\n}\n\ntype AgentModuleSecretsClient = Pick<\n SecretsInterModuleClient,\n 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'\n>;\n\nfunction createAgentSecretsClient(\n secretsClient: SecretsInterModuleClient,\n): AgentModuleSecretsClient {\n return {\n deleteSecrets: (input, options) => secretsClient.deleteSecrets(input, options),\n getSecretsByNamespace: (input, options) => secretsClient.getSecretsByNamespace(input, options),\n setSecrets: (input, options) => secretsClient.setSecrets(input, options),\n };\n}\n\nfunction validateCustomAgentModule(module: ShipfoxModule): void {\n const databases = module.database\n ? Array.isArray(module.database)\n ? module.database\n : [module.database]\n : [];\n if (\n !databases.some(({databaseNamespace}) => databaseNamespace === agentInterModuleContract.module)\n ) {\n throw new Error(\n 'Custom agentModule must declare database namespace \"agent\" for the Agent module.',\n );\n }\n\n if (\n !module.interModulePresentations?.some(({contract}) => contract === agentInterModuleContract)\n ) {\n throw new Error('Custom agentModule must present the canonical \"agent\" inter-module contract.');\n }\n}\n"],"names":["annotationsModule","annotationsInterModuleContract","createAgentModule","agentInterModuleContract","createAuthModule","config","authConfig","authInterModuleContract","createDefinitionsModule","definitionsInterModuleContract","dispatcherModule","emailChallengesModule","createIntegrationsContext","integrationsInterModuleContract","createLogsModule","createProjectsModule","projectsInterModuleContract","createRunnersModule","runnersInterModuleContract","createSecretsModule","secretsInterModuleContract","createTriggersModule","createWorkflowsModule","workflowsInterModuleContract","createWorkspacesModule","workspacesInterModuleContract","reportError","durationToSeconds","createInMemoryInterModuleTransport","registerInterModulePresentations","logger","defaultModules","options","interModuleTransport","reportInternalError","error","context","err","module","method","phase","boundary","operation","tags","workflowsClient","createClient","authClient","agentClient","runnersClient","projectsClient","definitionsClient","annotationsClient","secretsClient","workspacesClient","integrationsClient","integrations","workspaces","secrets","deleteSecrets","params","deleted","linear","getSecret","namespace","value","setSecrets","editedBy","secretParams","undefined","jira","slack","agentTools","workflows","webhookDeliverySource","projectsModule","auth","definitionsModule","projects","agent","extensionModules","extension","agentModule","createAgentSecretsClient","validateCustomAgentModule","modules","authModule","runners","annotations","definitions","runnersModule","jobLeaseTokenTtlSeconds","AUTH_JOB_LEASE_TOKEN_EXPIRES_IN","transport","seal","input","getSecretsByNamespace","databases","database","Array","isArray","some","databaseNamespace","Error","interModulePresentations","contract"],"mappings":"AAAA,SAAQA,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,8BAA8B,QAAO,wCAAwC;AACrF,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,wBAAwB,QAAO,sCAAsC;AAC7E,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,UAAUC,UAAU,QAAO,2BAA2B;AAC9D,SAEEC,uBAAuB,QAClB,qCAAqC;AAC5C,SAAQC,uBAAuB,QAAO,2BAA2B;AACjE,SAAQC,8BAA8B,QAAO,4CAA4C;AACzF,SAAQC,gBAAgB,QAAO,0BAA0B;AACzD,SAAQC,qBAAqB,QAAO,gCAAgC;AACpE,SAAQC,yBAAyB,QAAmC,gCAAgC;AACpG,SAAQC,+BAA+B,QAAO,iDAAiD;AAC/F,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,2BAA2B,QAAO,yCAAyC;AACnF,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,0BAA0B,QAAO,wCAAwC;AACjF,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAEEC,0BAA0B,QACrB,wCAAwC;AAC/C,SAAQC,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,qBAAqB,QAAO,yBAAyB;AAC7D,SAAQC,4BAA4B,QAAO,0CAA0C;AACrF,SAAQC,sBAAsB,QAAO,0BAA0B;AAC/D,SAEEC,6BAA6B,QACxB,2CAA2C;AAClD,SAAQ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QAAQ,EAAC,GAAKA,aAAarG,2BACpE;QACA,MAAM,IAAImG,MAAM;IAClB;AACF"}
1
+ {"version":3,"sources":["../src/modules.ts"],"sourcesContent":["import {annotationsModule} from '@shipfox/annotations';\nimport {annotationsInterModuleContract} from '@shipfox/annotations-dto/inter-module';\nimport {createAgentModule} from '@shipfox/api-agent';\nimport {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';\nimport {createAuthModule} from '@shipfox/api-auth';\nimport {config as authConfig} from '@shipfox/api-auth/config';\nimport {\n type AuthInterModuleClient,\n authInterModuleContract,\n} from '@shipfox/api-auth-dto/inter-module';\nimport {createDefinitionsModule} from '@shipfox/api-definitions';\nimport {definitionsInterModuleContract} from '@shipfox/api-definitions-dto/inter-module';\nimport {dispatcherModule} from '@shipfox/api-dispatcher';\nimport {emailChallengesModule} from '@shipfox/api-email-challenges';\nimport {createIntegrationsContext, type WebhookDeliverySource} from '@shipfox/api-integration-core';\nimport {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {createLogsModule} from '@shipfox/api-logs';\nimport {createProjectsModule} from '@shipfox/api-projects';\nimport {projectsInterModuleContract} from '@shipfox/api-projects-dto/inter-module';\nimport {createRunnersModule} from '@shipfox/api-runners';\nimport {runnersInterModuleContract} from '@shipfox/api-runners-dto/inter-module';\nimport {createSecretsModule} from '@shipfox/api-secrets';\nimport {\n type SecretsInterModuleClient,\n secretsInterModuleContract,\n} from '@shipfox/api-secrets-dto/inter-module';\nimport {createTriggersModule} from '@shipfox/api-triggers';\nimport {createWorkflowsModule} from '@shipfox/api-workflows';\nimport {\n type WorkflowsModuleClient,\n workflowsInterModuleContract,\n} from '@shipfox/api-workflows-dto/inter-module';\nimport {createWorkspacesModule} from '@shipfox/api-workspaces';\nimport {\n type WorkspacesInterModuleClient,\n workspacesInterModuleContract,\n} from '@shipfox/api-workspaces-dto/inter-module';\nimport {reportError} from '@shipfox/node-error-monitoring';\nimport {durationToSeconds} from '@shipfox/node-jwt';\nimport type {ShipfoxModule} from '@shipfox/node-module';\nimport {\n createInMemoryInterModuleTransport,\n registerInterModulePresentations,\n} from '@shipfox/node-module/inter-module';\nimport {logger} from '@shipfox/node-opentelemetry';\n\nexport interface DefaultModulesOptions {\n webhookDeliverySource?: WebhookDeliverySource | undefined;\n authModule?: DefaultAuthModuleFactory | undefined;\n agentModule?: DefaultAgentModuleFactory | undefined;\n runnersModule?: DefaultRunnersModuleFactory | undefined;\n extension?: DefaultModulesExtension | undefined;\n}\n\nexport type DefaultAuthModuleFactory = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule;\n\n/**\n * Builds the Agent module in the standard composition slot. The default\n * factory validates Agent configuration through `createAgentModule`; a custom\n * factory owns equivalent validation when it does not delegate to that\n * factory. Custom modules must preserve the `agent` database namespace and\n * canonical Agent presentation required by the composed clients.\n */\nexport type DefaultAgentModuleFactory = (options: {\n secrets: Pick<SecretsInterModuleClient, 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'>;\n /**\n * Optional: the step-attempt-terminated release and the stale-claim reap cron\n * are always registered so composed claim creators get a release backstop;\n * only the job-terminated grace sweep is gated on this client, so a factory\n * built without it stays claim/release-free (as before the session release\n * stack landed).\n */\n workflows?: WorkflowsModuleClient | undefined;\n}) => ShipfoxModule;\nexport type DefaultRunnersModuleFactory = (options: {auth: AuthInterModuleClient}) => ShipfoxModule;\nexport type DefaultModulesExtension = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule[];\n\nexport async function defaultModules(\n options: DefaultModulesOptions = {},\n): Promise<ShipfoxModule[]> {\n const interModuleTransport = createInMemoryInterModuleTransport({\n reportInternalError: (error, context) => {\n logger().error(\n {err: error, module: context.module, method: context.method, phase: context.phase},\n 'Inter-module call failed unexpectedly',\n );\n reportError(error, {\n boundary: 'inter-module',\n operation: `${context.module}.${context.method}`,\n tags: {module: context.module, method: context.method, phase: context.phase},\n });\n },\n });\n const workflowsClient = interModuleTransport.createClient(workflowsInterModuleContract);\n const authClient = interModuleTransport.createClient(authInterModuleContract);\n const agentClient = interModuleTransport.createClient(agentInterModuleContract);\n const runnersClient = interModuleTransport.createClient(runnersInterModuleContract);\n const projectsClient = interModuleTransport.createClient(projectsInterModuleContract);\n const definitionsClient = interModuleTransport.createClient(definitionsInterModuleContract);\n const annotationsClient = interModuleTransport.createClient(annotationsInterModuleContract);\n const secretsClient = interModuleTransport.createClient(secretsInterModuleContract);\n const workspacesClient = interModuleTransport.createClient(workspacesInterModuleContract);\n const integrationsClient = interModuleTransport.createClient(integrationsInterModuleContract);\n const integrations = await createIntegrationsContext({\n workspaces: workspacesClient,\n secrets: {\n deleteSecrets: async (params) => (await secretsClient.deleteSecrets(params)).deleted,\n linear: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/linear/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).deleted,\n },\n jira: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/jira/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).deleted,\n },\n slack: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/slack/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).deleted,\n },\n },\n agentTools: {workflows: workflowsClient},\n webhookDeliverySource: options.webhookDeliverySource,\n });\n const projectsModule = createProjectsModule({integrations: integrationsClient, auth: authClient});\n const definitionsModule = createDefinitionsModule({\n projects: projectsClient,\n agent: agentClient,\n integrations: integrationsClient,\n });\n const extensionModules = options.extension?.({workspaces: workspacesClient}) ?? [];\n const agentModule = (options.agentModule ?? createAgentModule)({\n secrets: createAgentSecretsClient(secretsClient),\n workflows: workflowsClient,\n });\n if (options.agentModule) validateCustomAgentModule(agentModule);\n\n const modules = [\n emailChallengesModule,\n (options.authModule ?? createAuthModule)({workspaces: workspacesClient}),\n createWorkspacesModule({auth: authClient, projects: projectsClient, runners: runnersClient}),\n createSecretsModule(projectsClient),\n agentModule,\n integrations.module,\n projectsModule,\n definitionsModule,\n createWorkflowsModule({\n annotations: annotationsClient,\n agent: agentClient,\n definitions: definitionsClient,\n auth: authClient,\n projects: projectsClient,\n runners: runnersClient,\n secrets: secretsClient,\n workspaces: workspacesClient,\n integrations: integrationsClient,\n }),\n annotationsModule,\n (options.runnersModule ?? createRunnersModule)({auth: authClient}),\n createLogsModule({\n workflows: workflowsClient,\n jobLeaseTokenTtlSeconds: durationToSeconds(authConfig.AUTH_JOB_LEASE_TOKEN_EXPIRES_IN),\n }),\n createTriggersModule({\n workflows: workflowsClient,\n definitions: definitionsClient,\n projects: projectsClient,\n }),\n dispatcherModule,\n ...extensionModules,\n ];\n registerInterModulePresentations({transport: interModuleTransport, modules});\n interModuleTransport.seal();\n return modules;\n}\n\ntype AgentModuleSecretsClient = Pick<\n SecretsInterModuleClient,\n 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'\n>;\n\nfunction createAgentSecretsClient(\n secretsClient: SecretsInterModuleClient,\n): AgentModuleSecretsClient {\n return {\n deleteSecrets: (input, options) => secretsClient.deleteSecrets(input, options),\n getSecretsByNamespace: (input, options) => secretsClient.getSecretsByNamespace(input, options),\n setSecrets: (input, options) => secretsClient.setSecrets(input, options),\n };\n}\n\nfunction validateCustomAgentModule(module: ShipfoxModule): void {\n const databases = module.database\n ? Array.isArray(module.database)\n ? module.database\n : [module.database]\n : [];\n if (\n !databases.some(({databaseNamespace}) => databaseNamespace === agentInterModuleContract.module)\n ) {\n throw new Error(\n 'Custom agentModule must declare database namespace \"agent\" for the Agent module.',\n );\n }\n\n if (\n !module.interModulePresentations?.some(({contract}) => contract === agentInterModuleContract)\n ) {\n throw new Error('Custom agentModule must present the canonical \"agent\" inter-module contract.');\n }\n}\n"],"names":["annotationsModule","annotationsInterModuleContract","createAgentModule","agentInterModuleContract","createAuthModule","config","authConfig","authInterModuleContract","createDefinitionsModule","definitionsInterModuleContract","dispatcherModule","emailChallengesModule","createIntegrationsContext","integrationsInterModuleContract","createLogsModule","createProjectsModule","projectsInterModuleContract","createRunnersModule","runnersInterModuleContract","createSecretsModule","secretsInterModuleContract","createTriggersModule","createWorkflowsModule","workflowsInterModuleContract","createWorkspacesModule","workspacesInterModuleContract","reportError","durationToSeconds","createInMemoryInterModuleTransport","registerInterModulePresentations","logger","defaultModules","options","interModuleTransport","reportInternalError","error","context","err","module","method","phase","boundary","operation","tags","workflowsClient","createClient","authClient","agentClient","runnersClient","projectsClient","definitionsClient","annotationsClient","secretsClient","workspacesClient","integrationsClient","integrations","workspaces","secrets","deleteSecrets","params","deleted","linear","getSecret","namespace","value","setSecrets","editedBy","secretParams","undefined","jira","slack","agentTools","workflows","webhookDeliverySource","projectsModule","auth","definitionsModule","projects","agent","extensionModules","extension","agentModule","createAgentSecretsClient","validateCustomAgentModule","modules","authModule","runners","annotations","definitions","runnersModule","jobLeaseTokenTtlSeconds","AUTH_JOB_LEASE_TOKEN_EXPIRES_IN","transport","seal","input","getSecretsByNamespace","databases","database","Array","isArray","some","databaseNamespace","Error","interModulePresentations","contract"],"mappings":"AAAA,SAAQA,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,8BAA8B,QAAO,wCAAwC;AACrF,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,wBAAwB,QAAO,sCAAsC;AAC7E,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,UAAUC,UAAU,QAAO,2BAA2B;AAC9D,SAEEC,uBAAuB,QAClB,qCAAqC;AAC5C,SAAQC,uBAAuB,QAAO,2BAA2B;AACjE,SAAQC,8BAA8B,QAAO,4CAA4C;AACzF,SAAQC,gBAAgB,QAAO,0BAA0B;AACzD,SAAQC,qBAAqB,QAAO,gCAAgC;AACpE,SAAQC,yBAAyB,QAAmC,gCAAgC;AACpG,SAAQC,+BAA+B,QAAO,iDAAiD;AAC/F,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,2BAA2B,QAAO,yCAAyC;AACnF,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,0BAA0B,QAAO,wCAAwC;AACjF,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAEEC,0BAA0B,QACrB,wCAAwC;AAC/C,SAAQC,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,qBAAqB,QAAO,yBAAyB;AAC7D,SAEEC,4BAA4B,QACvB,0CAA0C;AACjD,SAAQC,sBAAsB,QAAO,0BAA0B;AAC/D,SAEEC,6BAA6B,QACxB,2CAA2C;AAClD,SAAQC,WAAW,QAAO,iCAAiC;AAC3D,SAAQC,iBAAiB,QAAO,oBAAoB;AAEpD,SACEC,kCAAkC,EAClCC,gCAAgC,QAC3B,oCAAoC;AAC3C,SAAQC,MAAM,QAAO,8BAA8B;AAqCnD,OAAO,eAAeC,eACpBC,UAAiC,CAAC,CAAC;IAEnC,MAAMC,uB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