@shipfox/api-agent 6.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/core/custom-model-provider-config-service.d.ts.map +1 -1
- package/dist/core/custom-model-provider-config-service.js +17 -1
- package/dist/core/custom-model-provider-config-service.js.map +1 -1
- package/dist/core/model-provider-config-service.d.ts.map +1 -1
- package/dist/core/model-provider-config-service.js +17 -1
- package/dist/core/model-provider-config-service.js.map +1 -1
- package/dist/core/validation-catalog.d.ts +4 -0
- package/dist/core/validation-catalog.d.ts.map +1 -0
- package/dist/core/validation-catalog.js +23 -0
- package/dist/core/validation-catalog.js.map +1 -0
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +2 -0
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +7 -16
- package/src/core/custom-model-provider-config-service.ts +13 -1
- package/src/core/model-provider-config-service.ts +13 -1
- package/src/core/validation-catalog.ts +27 -0
- package/src/presentation/inter-module.ts +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-agent",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -42,29 +42,20 @@
|
|
|
42
42
|
"@opentelemetry/api": "^1.9.1",
|
|
43
43
|
"drizzle-orm": "^0.45.2",
|
|
44
44
|
"zod": "^4.4.3",
|
|
45
|
-
"@shipfox/
|
|
46
|
-
"@shipfox/api-
|
|
45
|
+
"@shipfox/node-error-monitoring": "0.2.0",
|
|
46
|
+
"@shipfox/api-agent-dto": "8.0.0",
|
|
47
|
+
"@shipfox/api-auth-context": "7.1.0",
|
|
47
48
|
"@shipfox/api-secrets-dto": "6.0.0",
|
|
48
49
|
"@shipfox/inter-module": "0.2.0",
|
|
49
50
|
"@shipfox/config": "1.2.2",
|
|
50
51
|
"@shipfox/node-drizzle": "0.3.2",
|
|
51
52
|
"@shipfox/node-egress-guard": "0.1.1",
|
|
52
|
-
"@shipfox/node-fastify": "0.
|
|
53
|
-
"@shipfox/node-module": "0.
|
|
54
|
-
"@shipfox/node-opentelemetry": "0.
|
|
53
|
+
"@shipfox/node-fastify": "0.3.0",
|
|
54
|
+
"@shipfox/node-module": "0.5.0",
|
|
55
|
+
"@shipfox/node-opentelemetry": "0.6.0",
|
|
55
56
|
"@shipfox/node-postgres": "0.4.2",
|
|
56
57
|
"@shipfox/redact": "0.2.3"
|
|
57
58
|
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"@types/pg": "^8.15.5",
|
|
60
|
-
"drizzle-kit": "^0.31.10",
|
|
61
|
-
"@shipfox/biome": "1.8.2",
|
|
62
|
-
"@shipfox/depcruise": "1.0.2",
|
|
63
|
-
"@shipfox/swc": "1.2.6",
|
|
64
|
-
"@shipfox/ts-config": "1.3.8",
|
|
65
|
-
"@shipfox/typescript": "1.1.7",
|
|
66
|
-
"@shipfox/vitest": "1.2.3"
|
|
67
|
-
},
|
|
68
59
|
"scripts": {
|
|
69
60
|
"build": "shipfox-swc",
|
|
70
61
|
"check": "shipfox-biome-check",
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
type UpdateCustomModelProviderHeaderRequestDto,
|
|
12
12
|
} from '@shipfox/api-agent-dto';
|
|
13
13
|
import {assertEgressAllowed} from '@shipfox/node-egress-guard';
|
|
14
|
+
import {reportError} from '@shipfox/node-error-monitoring';
|
|
15
|
+
import {logger} from '@shipfox/node-opentelemetry';
|
|
14
16
|
import {
|
|
15
17
|
deleteModelProviderConfig,
|
|
16
18
|
getModelProviderConfig,
|
|
@@ -235,7 +237,17 @@ export async function updateCustomModelProviderConfig(
|
|
|
235
237
|
namespace,
|
|
236
238
|
existingSecrets,
|
|
237
239
|
attemptedSecrets: newSecretCredentials,
|
|
238
|
-
}).catch(() =>
|
|
240
|
+
}).catch((rollbackError) => {
|
|
241
|
+
logger().error(
|
|
242
|
+
{err: rollbackError, workspaceId: params.workspaceId, providerId: params.providerId},
|
|
243
|
+
'Failed to roll back custom model provider secrets',
|
|
244
|
+
);
|
|
245
|
+
reportError(rollbackError, {
|
|
246
|
+
boundary: 'agent.cleanup',
|
|
247
|
+
operation: 'rollback-secret-update',
|
|
248
|
+
extra: {workspaceId: params.workspaceId, providerId: params.providerId},
|
|
249
|
+
});
|
|
250
|
+
});
|
|
239
251
|
throw error;
|
|
240
252
|
}
|
|
241
253
|
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
modelProviderCredentialKeysMatch,
|
|
6
6
|
type SupportedModelProviderId,
|
|
7
7
|
} from '@shipfox/api-agent-dto';
|
|
8
|
+
import {reportError} from '@shipfox/node-error-monitoring';
|
|
9
|
+
import {logger} from '@shipfox/node-opentelemetry';
|
|
8
10
|
import {
|
|
9
11
|
deleteModelProviderConfig as deleteModelProviderConfigRow,
|
|
10
12
|
getModelProviderConfig,
|
|
@@ -108,7 +110,17 @@ export async function testAndSaveModelProviderConfig(
|
|
|
108
110
|
workspaceId: params.workspaceId,
|
|
109
111
|
namespace,
|
|
110
112
|
expectedKeys: Object.keys(values),
|
|
111
|
-
}).catch(() =>
|
|
113
|
+
}).catch((error) => {
|
|
114
|
+
logger().error(
|
|
115
|
+
{err: error, workspaceId: params.workspaceId, providerId: params.providerId},
|
|
116
|
+
'Failed to prune stale model provider secrets',
|
|
117
|
+
);
|
|
118
|
+
reportError(error, {
|
|
119
|
+
boundary: 'agent.cleanup',
|
|
120
|
+
operation: 'prune-stale-secrets',
|
|
121
|
+
extra: {workspaceId: params.workspaceId, providerId: params.providerId},
|
|
122
|
+
});
|
|
123
|
+
});
|
|
112
124
|
|
|
113
125
|
return config;
|
|
114
126
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getModelProviderEntry,
|
|
3
|
+
listEnabledHarnessTools,
|
|
4
|
+
listHarnessDescriptors,
|
|
5
|
+
MODEL_PROVIDER_IDS,
|
|
6
|
+
} from '@shipfox/api-agent-dto';
|
|
7
|
+
import type {AgentValidationCatalog} from '@shipfox/api-agent-dto/inter-module';
|
|
8
|
+
import {harnessToolDeploymentConfig} from '#config.js';
|
|
9
|
+
|
|
10
|
+
/** Produces the versioned, JSON-safe policy snapshot consumed by Definitions. */
|
|
11
|
+
export function getAgentValidationCatalog(): AgentValidationCatalog {
|
|
12
|
+
return {
|
|
13
|
+
version: 1,
|
|
14
|
+
providers: MODEL_PROVIDER_IDS.map((id) => ({
|
|
15
|
+
id,
|
|
16
|
+
support_status: getModelProviderEntry(id)?.support_status ?? 'unsupported',
|
|
17
|
+
})),
|
|
18
|
+
harnesses: listHarnessDescriptors().map((harness) => ({
|
|
19
|
+
id: harness.id,
|
|
20
|
+
supported_provider_ids: [...harness.supportedProviderIds],
|
|
21
|
+
thinking_levels: [...harness.thinkingLevels],
|
|
22
|
+
effective_tools: listEnabledHarnessTools(harness.id, harnessToolDeploymentConfig).map(
|
|
23
|
+
(tool) => tool.name,
|
|
24
|
+
),
|
|
25
|
+
})),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -16,12 +16,14 @@ import {
|
|
|
16
16
|
import {resolveAgentConfig} from '#core/resolve-agent-config.js';
|
|
17
17
|
import {resolveRuntimeCredentials} from '#core/resolve-runtime-credentials.js';
|
|
18
18
|
import type {AgentSecretsClient} from '#core/secrets-client.js';
|
|
19
|
+
import {getAgentValidationCatalog} from '#core/validation-catalog.js';
|
|
19
20
|
import {createWorkspaceAgentDefaultsResolver} from '#core/workspace-agent-defaults-resolver.js';
|
|
20
21
|
|
|
21
22
|
export function createAgentInterModulePresentation(params: {
|
|
22
23
|
secrets: AgentSecretsClient;
|
|
23
24
|
}): InterModulePresentation<typeof agentInterModuleContract> {
|
|
24
25
|
return defineInterModulePresentation(agentInterModuleContract, {
|
|
26
|
+
getValidationCatalog: () => getAgentValidationCatalog(),
|
|
25
27
|
resolveAgentConfig: async ({workspaceId, config}) => {
|
|
26
28
|
try {
|
|
27
29
|
const resolve =
|