@shipfox/client-agent 4.0.0 → 5.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 +14 -0
- package/dist/feature.d.ts +11 -0
- package/dist/feature.d.ts.map +1 -1
- package/dist/feature.js +14 -0
- package/dist/feature.js.map +1 -1
- package/dist/hooks/api/model-providers.d.ts +6 -1
- package/dist/hooks/api/model-providers.d.ts.map +1 -1
- package/dist/hooks/api/model-providers.js +15 -12
- package/dist/hooks/api/model-providers.js.map +1 -1
- package/dist/routes/agents-settings.d.ts +5 -0
- package/dist/routes/agents-settings.d.ts.map +1 -0
- package/dist/routes/agents-settings.js +21 -0
- package/dist/routes/agents-settings.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/feature.ts +14 -0
- package/src/hooks/api/model-providers.ts +31 -8
- package/src/routes/agents-settings.tsx +14 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/client-agent",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"@swc/helpers": "^0.5.17",
|
|
33
33
|
"@tanstack/react-form": "^1.32.0",
|
|
34
34
|
"@tanstack/react-query": "^5.101.0",
|
|
35
|
-
"@shipfox/api-agent-dto": "
|
|
35
|
+
"@shipfox/api-agent-dto": "8.0.0",
|
|
36
|
+
"@shipfox/client-shell": "5.0.0",
|
|
36
37
|
"@shipfox/client-api": "4.0.0",
|
|
37
|
-
"@shipfox/client-shell": "4.0.0",
|
|
38
38
|
"@shipfox/client-ui": "4.0.0",
|
|
39
39
|
"@shipfox/react-ui": "0.3.5"
|
|
40
40
|
},
|
package/src/feature.ts
CHANGED
|
@@ -8,5 +8,19 @@ export const agentFeature = defineClientFeature({
|
|
|
8
8
|
parent: 'workspaceLayout',
|
|
9
9
|
impl: '@shipfox/client-agent/routes/model-provider',
|
|
10
10
|
},
|
|
11
|
+
{
|
|
12
|
+
path: '/workspaces/$wid/settings/agents',
|
|
13
|
+
parent: 'workspaceSettings',
|
|
14
|
+
impl: '@shipfox/client-agent/routes/agents-settings',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
settingsSections: [
|
|
18
|
+
{
|
|
19
|
+
id: 'settings.agents',
|
|
20
|
+
pathSegment: 'agents',
|
|
21
|
+
label: 'Agents',
|
|
22
|
+
icon: 'robot2Line',
|
|
23
|
+
order: 400,
|
|
24
|
+
},
|
|
11
25
|
],
|
|
12
26
|
});
|
|
@@ -18,7 +18,13 @@ import type {
|
|
|
18
18
|
UpdateModelProviderDefaultModelBodyDto,
|
|
19
19
|
} from '@shipfox/api-agent-dto';
|
|
20
20
|
import {apiRequest} from '@shipfox/client-api';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
type FetchQueryOptions,
|
|
23
|
+
queryOptions,
|
|
24
|
+
useMutation,
|
|
25
|
+
useQuery,
|
|
26
|
+
useQueryClient,
|
|
27
|
+
} from '@tanstack/react-query';
|
|
22
28
|
|
|
23
29
|
export const modelProviderQueryKeys = {
|
|
24
30
|
all: ['model-providers'] as const,
|
|
@@ -27,6 +33,17 @@ export const modelProviderQueryKeys = {
|
|
|
27
33
|
[...modelProviderQueryKeys.all, 'configs', workspaceId] as const,
|
|
28
34
|
};
|
|
29
35
|
|
|
36
|
+
type ModelProviderConfigsQueryKey =
|
|
37
|
+
| ReturnType<typeof modelProviderQueryKeys.configs>
|
|
38
|
+
| readonly ['model-providers', 'configs'];
|
|
39
|
+
|
|
40
|
+
type ModelProviderConfigsQueryOptions = FetchQueryOptions<
|
|
41
|
+
ListModelProviderConfigsResponseDto,
|
|
42
|
+
Error,
|
|
43
|
+
ListModelProviderConfigsResponseDto,
|
|
44
|
+
ModelProviderConfigsQueryKey
|
|
45
|
+
>;
|
|
46
|
+
|
|
30
47
|
export async function getModelProviderCatalog({signal}: {signal?: AbortSignal} = {}) {
|
|
31
48
|
return await apiRequest<ModelProviderCatalogResponseDto>('/agent/model-provider-catalog', {
|
|
32
49
|
signal,
|
|
@@ -46,6 +63,18 @@ export async function listModelProviderConfigs({
|
|
|
46
63
|
);
|
|
47
64
|
}
|
|
48
65
|
|
|
66
|
+
export function modelProviderConfigsQueryOptions(
|
|
67
|
+
workspaceId: string | undefined,
|
|
68
|
+
): ModelProviderConfigsQueryOptions {
|
|
69
|
+
return queryOptions({
|
|
70
|
+
queryKey: workspaceId
|
|
71
|
+
? modelProviderQueryKeys.configs(workspaceId)
|
|
72
|
+
: ([...modelProviderQueryKeys.all, 'configs'] as const),
|
|
73
|
+
enabled: Boolean(workspaceId),
|
|
74
|
+
queryFn: ({signal}) => listModelProviderConfigs({workspaceId: workspaceId ?? '', signal}),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
49
78
|
export async function upsertModelProviderConfig({
|
|
50
79
|
workspaceId,
|
|
51
80
|
providerId,
|
|
@@ -179,13 +208,7 @@ export function useModelProviderCatalogQuery() {
|
|
|
179
208
|
}
|
|
180
209
|
|
|
181
210
|
export function useModelProviderConfigsQuery(workspaceId: string | undefined) {
|
|
182
|
-
return useQuery(
|
|
183
|
-
queryKey: workspaceId
|
|
184
|
-
? modelProviderQueryKeys.configs(workspaceId)
|
|
185
|
-
: [...modelProviderQueryKeys.all, 'configs'],
|
|
186
|
-
enabled: Boolean(workspaceId),
|
|
187
|
-
queryFn: ({signal}) => listModelProviderConfigs({workspaceId: workspaceId ?? '', signal}),
|
|
188
|
-
});
|
|
211
|
+
return useQuery(modelProviderConfigsQueryOptions(workspaceId));
|
|
189
212
|
}
|
|
190
213
|
|
|
191
214
|
export function useUpsertModelProviderConfigMutation() {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {defineRoute, useActiveWorkspace} from '@shipfox/client-shell/runtime';
|
|
2
|
+
import {WorkspaceHarnessesSection, WorkspaceModelProvidersSection} from '#index.js';
|
|
3
|
+
|
|
4
|
+
export default defineRoute({
|
|
5
|
+
component: () => {
|
|
6
|
+
const workspace = useActiveWorkspace();
|
|
7
|
+
return (
|
|
8
|
+
<div className="flex flex-col gap-32">
|
|
9
|
+
<WorkspaceHarnessesSection workspaceId={workspace.id} />
|
|
10
|
+
<WorkspaceModelProvidersSection workspaceId={workspace.id} />
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
},
|
|
14
|
+
});
|