@cat-factory/app 0.176.0 → 0.178.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/README.md +28 -1
- package/app/components/environments/steps/EnvPickStep.vue +3 -0
- package/app/components/layout/IntegrationBackTitle.vue +11 -8
- package/app/components/layout/IntegrationsHub.vue +21 -55
- package/app/components/layout/ModelProvidersHub.vue +250 -0
- package/app/components/panels/inspector/ServiceValidationConfig.vue +99 -1
- package/app/components/settings/ComposeEnvironmentSetupSection.vue +102 -0
- package/app/components/settings/InfrastructureWindow.vue +11 -1
- package/app/composables/api/validationChecks.ts +8 -0
- package/app/composables/useIntegrationBack.ts +5 -2
- package/app/composables/useNavContributions.ts +1 -1
- package/app/modular/nav-contributions.spec.ts +11 -3
- package/app/modular/nav-contributions.ts +35 -16
- package/app/pages/index.vue +4 -0
- package/app/stores/ui/modals.ts +32 -6
- package/app/stores/validationChecks.ts +17 -2
- package/app/types/validationChecks.ts +3 -0
- package/app/utils/validationDetection.spec.ts +51 -0
- package/app/utils/validationDetection.ts +67 -0
- package/i18n/locales/de.json +103 -24
- package/i18n/locales/en.json +103 -24
- package/i18n/locales/es.json +103 -24
- package/i18n/locales/fr.json +103 -24
- package/i18n/locales/he.json +103 -24
- package/i18n/locales/it.json +103 -24
- package/i18n/locales/ja.json +103 -24
- package/i18n/locales/pl.json +103 -24
- package/i18n/locales/tr.json +103 -24
- package/i18n/locales/uk.json +103 -24
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ hoc where it can be avoided:
|
|
|
86
86
|
it**, and marking an item does one of two distinguishable things:
|
|
87
87
|
- **Reached another way** — a shortcut whose surface a basic destination also opens, so
|
|
88
88
|
nothing is lost (the Merge / Service-best-practices palette entries into Workspace
|
|
89
|
-
settings, the local-models knob the
|
|
89
|
+
settings, the local-models knob the Model providers hub already offers).
|
|
90
90
|
- **Out of the tier** — the sole route, hidden on purpose, so the capability is _absent_
|
|
91
91
|
from basic mode and the tier switch is the way to it (Sandbox, Kaizen, repo bootstrap,
|
|
92
92
|
and the deployment-wide operator + reports rollups).
|
|
@@ -153,9 +153,36 @@ example ships in [`deploy/frontend`](../../deploy/frontend) (the `acme:security`
|
|
|
153
153
|
by every VCS provider), `vcs` (the GitLab personal-access-token connect),
|
|
154
154
|
`bootstrap`, `documents`, `tasks`, `requirements` (review), `scenarios`
|
|
155
155
|
(acceptance), and `fragments` (the prompt-fragment library).
|
|
156
|
+
- **Model providers** — `ModelProvidersHub.vue`, the sibling hub for the ENGINES
|
|
157
|
+
(OpenRouter, vendor keys, personal subscriptions, own-machine runners). Kept out
|
|
158
|
+
of the Integrations hub on purpose: an integration is optional context in or
|
|
159
|
+
output out, while a provider is what executes the work, so a deployment with none
|
|
160
|
+
connected runs nothing at all. **A new provider-shaped connection belongs here,
|
|
161
|
+
never in `IntegrationsHub.vue`.** Both hubs, plus the user-scoped `PersonalSetupModal`,
|
|
162
|
+
share the `IntegrationBackTitle` Back control, which returns to whichever hub set
|
|
163
|
+
its came-from marker (`ui.cameFrom{Integrations,ModelProviders,Personal}`) — a panel
|
|
164
|
+
reachable from more than one hub must not hard-code its return.
|
|
156
165
|
- **Auth** (`components/auth`) — `AuthGate` / `LoginScreen` / `UserMenu`; the app
|
|
157
166
|
is gated when the backend requires sign-in.
|
|
158
167
|
|
|
168
|
+
## Where a surface lives
|
|
169
|
+
|
|
170
|
+
Two placements are load-bearing enough to state, because putting a new one in the
|
|
171
|
+
wrong place is invisible until a user cannot find it:
|
|
172
|
+
|
|
173
|
+
- **The sidebar section is a claim about what the destination IS.** `models` is the
|
|
174
|
+
engines, `integrations` the optional systems, `infrastructure` where agent
|
|
175
|
+
containers and test environments run, `configuration` workspace/account settings.
|
|
176
|
+
`nav-contributions.spec.ts` pins the section order and each section's membership.
|
|
177
|
+
- **A flow that edits ONE entity's config is a section of the window that owns that
|
|
178
|
+
config, not a sibling nav entry.** The guided Docker Compose environment setup
|
|
179
|
+
(`ComposeEnvironmentSetupSection.vue` → `EnvironmentSetupWizard.vue`) lives inside
|
|
180
|
+
Infrastructure → Test environments for exactly this reason: it writes a service's
|
|
181
|
+
Compose recipe plus the workspace's Compose handler, both configured in that tab.
|
|
182
|
+
It also carries a full "how it works / when you need this / when you can skip it"
|
|
183
|
+
explanation there rather than a one-line hint, since the decision to run it has to
|
|
184
|
+
be made before opening a five-minute wizard.
|
|
185
|
+
|
|
159
186
|
## Develop & test
|
|
160
187
|
|
|
161
188
|
```bash
|
|
@@ -18,6 +18,9 @@ const { t } = useI18n()
|
|
|
18
18
|
<template>
|
|
19
19
|
<section class="space-y-3" data-testid="env-setup-step-pick">
|
|
20
20
|
<p class="text-sm text-slate-400">{{ t('environmentWizard.pick.intro') }}</p>
|
|
21
|
+
<!-- The one-service scope caveat, stated on the step that asks for the service: nothing
|
|
22
|
+
here changes any other service, and running it twice just re-edits this one's recipe. -->
|
|
23
|
+
<p class="text-xs leading-relaxed text-slate-500">{{ t('environmentWizard.pick.scope') }}</p>
|
|
21
24
|
<p v-if="!store.serviceFrames.length" class="text-sm text-slate-500">
|
|
22
25
|
{{ t('environmentWizard.pick.empty') }}
|
|
23
26
|
</p>
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
// Title content for an integration sub-panel's modal header. Renders the panel
|
|
3
3
|
// title with a leading "back" control that returns to the hub the panel was reached
|
|
4
|
-
// from — the workspace Integrations hub (`ui.cameFromIntegrations`)
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// from — the workspace Integrations hub (`ui.cameFromIntegrations`), the Model providers
|
|
5
|
+
// hub (`ui.cameFromModelProviders`) or the user-scoped "My setup" hub
|
|
6
|
+
// (`ui.cameFromPersonal`) — shown only when there is one. Panels opened from the command
|
|
7
|
+
// bar, sidebar, a banner or an inspector link don't grow a dead Back.
|
|
7
8
|
// Dropped into a UModal's #title slot, so it inherits the modal's title styling; it
|
|
8
9
|
// emits `back` and the host panel closes itself + reopens the right hub.
|
|
9
10
|
defineProps<{ title?: string }>()
|
|
10
11
|
const emit = defineEmits<{ back: [] }>()
|
|
11
12
|
const { t } = useI18n()
|
|
12
13
|
const ui = useUiStore()
|
|
13
|
-
const cameFromHub = computed(
|
|
14
|
-
|
|
15
|
-
ui.cameFromPersonal
|
|
16
|
-
? t('layout.integrationBack.backToMySetup')
|
|
17
|
-
: t('layout.integrationBack.backToIntegrations'),
|
|
14
|
+
const cameFromHub = computed(
|
|
15
|
+
() => ui.cameFromIntegrations || ui.cameFromModelProviders || ui.cameFromPersonal,
|
|
18
16
|
)
|
|
17
|
+
const backLabel = computed(() => {
|
|
18
|
+
if (ui.cameFromPersonal) return t('layout.integrationBack.backToMySetup')
|
|
19
|
+
if (ui.cameFromModelProviders) return t('layout.integrationBack.backToModelProviders')
|
|
20
|
+
return t('layout.integrationBack.backToIntegrations')
|
|
21
|
+
})
|
|
19
22
|
</script>
|
|
20
23
|
|
|
21
24
|
<template>
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { showOverrideField } from '~/utils/uiMode'
|
|
3
3
|
|
|
4
|
-
// The Integrations hub: a single modal that lists
|
|
5
|
-
// enable or link in
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// The Integrations hub: a single modal that lists the OPTIONAL external systems the WORKSPACE
|
|
5
|
+
// can enable or link in — the ones that feed a run its context (source control, documents,
|
|
6
|
+
// trackers) or receive its output (chat, observability). Each row reuses the existing
|
|
7
|
+
// per-integration panel handlers on the `ui` store (so the integrations themselves are
|
|
8
|
+
// unchanged); opening one closes the hub and reveals that integration's own panel/modal.
|
|
8
9
|
//
|
|
9
10
|
// Sections gate on the same `available` probes the navbar used, so a system that the backend
|
|
10
11
|
// has turned off simply doesn't appear here.
|
|
11
12
|
//
|
|
12
|
-
// Scope split
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
13
|
+
// Scope split 1 — MODEL PROVIDERS are NOT integrations here. They are the engines the
|
|
14
|
+
// harnesses run on (with none connected nothing runs at all), so they have their own
|
|
15
|
+
// top-level hub, `ModelProvidersHub.vue`. Keeping them out is the point: an integration is
|
|
16
|
+
// something a deployment can live without, and burying the one mandatory connection among a
|
|
17
|
+
// dozen optional ones is what made this hub confusing.
|
|
18
|
+
//
|
|
19
|
+
// Scope split 2 — per-USER connections (a personal GitHub token, own-machine runners, personal
|
|
20
|
+
// subscriptions) live in the "My setup" hub (UserMenu → My setup), NOT here, keeping this hub
|
|
21
|
+
// workspace-scoped. When auth is disabled there is no UserMenu to host them, so a "Personal
|
|
22
|
+
// (only you)" group falls back into this hub so the workspace-adjacent ones stay reachable
|
|
23
|
+
// (the model-shaped ones fall back into the Model providers hub instead).
|
|
16
24
|
const { t } = useI18n()
|
|
17
25
|
const ui = useUiStore()
|
|
18
26
|
const auth = useAuthStore()
|
|
@@ -25,8 +33,6 @@ const releaseHealth = useReleaseHealthStore()
|
|
|
25
33
|
const packageRegistries = usePackageRegistriesStore()
|
|
26
34
|
const publicApiKeys = usePublicApiKeysStore()
|
|
27
35
|
const userSecrets = useUserSecretsStore()
|
|
28
|
-
const apiKeys = useApiKeysStore()
|
|
29
|
-
const workspace = useWorkspaceStore()
|
|
30
36
|
const uiMode = useUiModeStore()
|
|
31
37
|
|
|
32
38
|
// True when the per-user "My setup" hub is reachable (UserMenu renders only when signed in).
|
|
@@ -57,8 +63,6 @@ watch(
|
|
|
57
63
|
void packageRegistries.ensureLoaded().catch(() => {})
|
|
58
64
|
void publicApiKeys.ensureLoaded().catch(() => {})
|
|
59
65
|
void userSecrets.load().catch(() => {})
|
|
60
|
-
// Drives the OpenRouter row's "Key connected" badge.
|
|
61
|
-
if (workspace.workspaceId) void apiKeys.load(workspace.workspaceId).catch(() => {})
|
|
62
66
|
}
|
|
63
67
|
},
|
|
64
68
|
// Lazy v-if mount: the hub mounts with `integrationsOpen` already true → load immediately.
|
|
@@ -114,42 +118,9 @@ function go(fn: () => void) {
|
|
|
114
118
|
const groups = computed<IntegrationGroup[]>(() => {
|
|
115
119
|
const out: IntegrationGroup[] = []
|
|
116
120
|
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
out.push({
|
|
121
|
-
title: t('layout.integrationsHub.groups.models'),
|
|
122
|
-
items: [
|
|
123
|
-
{
|
|
124
|
-
key: 'openrouter',
|
|
125
|
-
icon: 'i-lucide-waypoints',
|
|
126
|
-
label: 'OpenRouter',
|
|
127
|
-
description: t('layout.integrationsHub.items.openrouter.description'),
|
|
128
|
-
status: openRouterKeyConnected
|
|
129
|
-
? t('layout.integrationsHub.status.keyConnected')
|
|
130
|
-
: undefined,
|
|
131
|
-
connected: openRouterKeyConnected,
|
|
132
|
-
recommended: true,
|
|
133
|
-
onClick: () => go(ui.openOpenRouter),
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
key: 'vendors',
|
|
137
|
-
icon: 'i-lucide-key-round',
|
|
138
|
-
label: t('layout.integrationsHub.items.vendors.label'),
|
|
139
|
-
description: t('layout.integrationsHub.items.vendors.description'),
|
|
140
|
-
onClick: () => go(ui.openVendorCredentials),
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
// Personal (individual-usage) subscriptions are per-USER, so they live in My setup —
|
|
144
|
-
// but this hub is where people look first when connecting "their Claude plan". A quiet
|
|
145
|
-
// pointer link keeps them findable without a workspace-scoped row competing here.
|
|
146
|
-
footerLink: {
|
|
147
|
-
key: 'personal-subs',
|
|
148
|
-
icon: 'i-lucide-user',
|
|
149
|
-
label: t('layout.integrationsHub.items.personalSubs.label'),
|
|
150
|
-
onClick: () => go(() => ui.openVendorCredentials('personal')),
|
|
151
|
-
},
|
|
152
|
-
})
|
|
121
|
+
// NOTE: model providers (OpenRouter, vendor keys, personal subscriptions, local runners)
|
|
122
|
+
// are NOT listed here — they have their own top-level hub (`ModelProvidersHub.vue`, SideBar
|
|
123
|
+
// → "Model providers"). See the scope split at the top of this file.
|
|
153
124
|
|
|
154
125
|
// --- Source control --------------------------------------------------------
|
|
155
126
|
const code: IntegrationItem[] = []
|
|
@@ -338,6 +309,8 @@ const groups = computed<IntegrationGroup[]>(() => {
|
|
|
338
309
|
// --- Personal (only you) — fallback when there is no UserMenu to host "My setup" -------
|
|
339
310
|
// Per-user connections normally live in the My-setup hub; with auth disabled they fold in
|
|
340
311
|
// here so they stay reachable. (The badge reflects the signed-in user's stored secret.)
|
|
312
|
+
// Only the source-control one: the per-user MODEL connections are listed unconditionally
|
|
313
|
+
// in the Model providers hub, so they need no fallback.
|
|
341
314
|
if (!personalHubReachable.value) {
|
|
342
315
|
const pat = !!userSecrets.statusFor('github_pat')
|
|
343
316
|
out.push({
|
|
@@ -352,13 +325,6 @@ const groups = computed<IntegrationGroup[]>(() => {
|
|
|
352
325
|
connected: pat,
|
|
353
326
|
onClick: () => go(ui.openUserSecrets),
|
|
354
327
|
},
|
|
355
|
-
{
|
|
356
|
-
key: 'local-runners',
|
|
357
|
-
icon: 'i-lucide-server',
|
|
358
|
-
label: t('layout.integrationsHub.items.localRunners.label'),
|
|
359
|
-
description: t('layout.integrationsHub.items.localRunners.description'),
|
|
360
|
-
onClick: () => go(ui.openLocalModels),
|
|
361
|
-
},
|
|
362
328
|
],
|
|
363
329
|
})
|
|
364
330
|
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// The Model providers hub: where the ENGINES the harnesses run on are connected.
|
|
3
|
+
//
|
|
4
|
+
// Split out of the Integrations hub deliberately. Both are technically "external systems we
|
|
5
|
+
// hold a credential for", but they answer different questions: an integration is an OPTIONAL
|
|
6
|
+
// system that feeds a run context or receives its output (source control, trackers, documents,
|
|
7
|
+
// chat, observability), while a model provider is what actually executes the work — with none
|
|
8
|
+
// connected, nothing runs at all. Listing the providers among a dozen optional connectors
|
|
9
|
+
// buried the one connection every deployment must make.
|
|
10
|
+
//
|
|
11
|
+
// Rows reuse the existing per-provider panel handlers on the `ui` store via
|
|
12
|
+
// `ui.openFromModelProviders(...)`, so opening one closes this hub and gives that panel a
|
|
13
|
+
// "Back to Model providers" control (IntegrationBackTitle). Layout mirrors the Integrations
|
|
14
|
+
// hub row-for-row so the two read as siblings.
|
|
15
|
+
const { t } = useI18n()
|
|
16
|
+
const ui = useUiStore()
|
|
17
|
+
const apiKeys = useApiKeysStore()
|
|
18
|
+
const localModels = useLocalModelsStore()
|
|
19
|
+
const personalSubs = usePersonalSubscriptionsStore()
|
|
20
|
+
const workspace = useWorkspaceStore()
|
|
21
|
+
|
|
22
|
+
const open = computed({
|
|
23
|
+
get: () => ui.modelProvidersOpen,
|
|
24
|
+
set: (v: boolean) => (v ? ui.openModelProviders() : ui.closeModelProviders()),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Free-text filter over the rows (label + description), matching the Integrations hub.
|
|
28
|
+
// Declared before the `immediate` watch below, which resets it on open.
|
|
29
|
+
const query = ref('')
|
|
30
|
+
|
|
31
|
+
// Load the cheap status reads each time the hub opens so every badge is accurate.
|
|
32
|
+
watch(
|
|
33
|
+
() => ui.modelProvidersOpen,
|
|
34
|
+
(isOpen) => {
|
|
35
|
+
if (!isOpen) return
|
|
36
|
+
query.value = ''
|
|
37
|
+
if (workspace.workspaceId) void apiKeys.load(workspace.workspaceId).catch(() => {})
|
|
38
|
+
void localModels.load().catch(() => {})
|
|
39
|
+
void personalSubs.load().catch(() => {})
|
|
40
|
+
},
|
|
41
|
+
// Lazy v-if mount: the hub mounts with `modelProvidersOpen` already true → load immediately.
|
|
42
|
+
{ immediate: true },
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
/** One provider row. `connected` drives the green badge; `status` is its line. */
|
|
46
|
+
interface ProviderItem {
|
|
47
|
+
key: string
|
|
48
|
+
icon: string
|
|
49
|
+
label: string
|
|
50
|
+
description: string
|
|
51
|
+
status?: string
|
|
52
|
+
connected?: boolean
|
|
53
|
+
/** Tags the fastest path to a working deployment while nothing is connected yet. */
|
|
54
|
+
recommended?: boolean
|
|
55
|
+
onClick: () => void
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface ProviderGroup {
|
|
59
|
+
title: string
|
|
60
|
+
/** Rendered under the group's rows — the scope caveat for the personal group. */
|
|
61
|
+
note?: string
|
|
62
|
+
items: ProviderItem[]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function go(fn: () => void) {
|
|
66
|
+
ui.openFromModelProviders(fn)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const groups = computed<ProviderGroup[]>(() => {
|
|
70
|
+
const openRouterKeyConnected = apiKeys.configuredProviders.has('openrouter')
|
|
71
|
+
const runnerCount = localModels.endpoints.length
|
|
72
|
+
const subCount = personalSubs.subscriptions.length
|
|
73
|
+
|
|
74
|
+
return [
|
|
75
|
+
// --- Workspace-wide providers ------------------------------------------
|
|
76
|
+
// An OpenRouter key is the fastest path to 300+ models, so it leads.
|
|
77
|
+
{
|
|
78
|
+
title: t('layout.modelProvidersHub.groups.workspace'),
|
|
79
|
+
items: [
|
|
80
|
+
{
|
|
81
|
+
key: 'openrouter',
|
|
82
|
+
icon: 'i-lucide-waypoints',
|
|
83
|
+
label: 'OpenRouter',
|
|
84
|
+
description: t('layout.modelProvidersHub.items.openrouter.description'),
|
|
85
|
+
status: openRouterKeyConnected
|
|
86
|
+
? t('layout.modelProvidersHub.status.keyConnected')
|
|
87
|
+
: undefined,
|
|
88
|
+
connected: openRouterKeyConnected,
|
|
89
|
+
recommended: true,
|
|
90
|
+
onClick: () => go(ui.openOpenRouter),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: 'vendors',
|
|
94
|
+
icon: 'i-lucide-key-round',
|
|
95
|
+
label: t('layout.modelProvidersHub.items.vendors.label'),
|
|
96
|
+
description: t('layout.modelProvidersHub.items.vendors.description'),
|
|
97
|
+
onClick: () => go(ui.openVendorCredentials),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
// --- Personal (per-user) providers -------------------------------------
|
|
102
|
+
// These live on the user, not the workspace, and are also reachable from "My setup".
|
|
103
|
+
// They are listed here as full rows rather than a pointer link because this hub is
|
|
104
|
+
// scoped by TOPIC (what runs the work) rather than by ownership — "where do I put my
|
|
105
|
+
// Claude plan" is the single most common reason to open it.
|
|
106
|
+
{
|
|
107
|
+
title: t('layout.modelProvidersHub.groups.personal'),
|
|
108
|
+
note: t('layout.modelProvidersHub.groups.personalNote'),
|
|
109
|
+
items: [
|
|
110
|
+
{
|
|
111
|
+
key: 'personal-subs',
|
|
112
|
+
icon: 'i-lucide-user',
|
|
113
|
+
label: t('layout.modelProvidersHub.items.personalSubs.label'),
|
|
114
|
+
description: t('layout.modelProvidersHub.items.personalSubs.description'),
|
|
115
|
+
status: subCount
|
|
116
|
+
? t('layout.modelProvidersHub.status.connectedCount', { count: subCount }, subCount)
|
|
117
|
+
: undefined,
|
|
118
|
+
connected: subCount > 0,
|
|
119
|
+
onClick: () => go(() => ui.openVendorCredentials('personal')),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: 'local-runners',
|
|
123
|
+
icon: 'i-lucide-server',
|
|
124
|
+
label: t('layout.modelProvidersHub.items.localRunners.label'),
|
|
125
|
+
description: t('layout.modelProvidersHub.items.localRunners.description'),
|
|
126
|
+
status: runnerCount
|
|
127
|
+
? t(
|
|
128
|
+
'layout.modelProvidersHub.status.connectedCount',
|
|
129
|
+
{ count: runnerCount },
|
|
130
|
+
runnerCount,
|
|
131
|
+
)
|
|
132
|
+
: undefined,
|
|
133
|
+
connected: runnerCount > 0,
|
|
134
|
+
onClick: () => go(ui.openLocalModels),
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
// Connected rows first, then idle — a stable rank so each group reads "what's live" top-down.
|
|
142
|
+
function stateRank(item: ProviderItem): number {
|
|
143
|
+
return item.connected ? 0 : 1
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const allItems = computed(() => groups.value.flatMap((g) => g.items))
|
|
147
|
+
const anyConnected = computed(() => allItems.value.some((i) => i.connected))
|
|
148
|
+
|
|
149
|
+
function matches(text: string, q: string): boolean {
|
|
150
|
+
return text.toLowerCase().includes(q)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const filteredGroups = computed<ProviderGroup[]>(() => {
|
|
154
|
+
const q = query.value.trim().toLowerCase()
|
|
155
|
+
return groups.value
|
|
156
|
+
.map((g) => ({
|
|
157
|
+
...g,
|
|
158
|
+
items: (q ? g.items.filter((i) => matches(i.label, q) || matches(i.description, q)) : g.items)
|
|
159
|
+
.slice()
|
|
160
|
+
.sort((a, b) => stateRank(a) - stateRank(b)),
|
|
161
|
+
}))
|
|
162
|
+
.filter((g) => g.items.length)
|
|
163
|
+
})
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<template>
|
|
167
|
+
<UModal
|
|
168
|
+
v-model:open="open"
|
|
169
|
+
:title="t('layout.modelProvidersHub.title')"
|
|
170
|
+
:ui="{ content: 'max-w-xl' }"
|
|
171
|
+
>
|
|
172
|
+
<template #body>
|
|
173
|
+
<div class="space-y-5" data-testid="model-providers-hub">
|
|
174
|
+
<p class="text-xs text-slate-400">
|
|
175
|
+
{{ t('layout.modelProvidersHub.intro') }}
|
|
176
|
+
</p>
|
|
177
|
+
|
|
178
|
+
<!-- Nothing connected at all is a hard stop, not a nudge: no provider means no agent
|
|
179
|
+
step can run. Say so plainly rather than showing an empty list of options. -->
|
|
180
|
+
<div
|
|
181
|
+
v-if="!anyConnected"
|
|
182
|
+
class="rounded-lg border border-primary-500/40 bg-primary-500/10 p-3"
|
|
183
|
+
>
|
|
184
|
+
<div class="mb-1.5 flex items-center gap-2 text-sm font-medium text-primary-200">
|
|
185
|
+
<UIcon name="i-lucide-rocket" class="h-4 w-4 shrink-0" />
|
|
186
|
+
<span>{{ t('layout.modelProvidersHub.getStarted.title') }}</span>
|
|
187
|
+
</div>
|
|
188
|
+
<p class="text-xs text-slate-300">
|
|
189
|
+
{{ t('layout.modelProvidersHub.getStarted.body') }}
|
|
190
|
+
</p>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<UInput
|
|
194
|
+
v-model="query"
|
|
195
|
+
icon="i-lucide-search"
|
|
196
|
+
size="sm"
|
|
197
|
+
:placeholder="t('layout.modelProvidersHub.searchPlaceholder')"
|
|
198
|
+
class="w-full"
|
|
199
|
+
/>
|
|
200
|
+
|
|
201
|
+
<p v-if="!filteredGroups.length" class="px-1 py-6 text-center text-sm text-slate-500">
|
|
202
|
+
{{ t('layout.modelProvidersHub.noMatches', { query }) }}
|
|
203
|
+
</p>
|
|
204
|
+
|
|
205
|
+
<section v-for="group in filteredGroups" :key="group.title">
|
|
206
|
+
<h3 class="mb-2 px-1 text-[11px] font-semibold uppercase tracking-wide text-slate-400">
|
|
207
|
+
{{ group.title }}
|
|
208
|
+
</h3>
|
|
209
|
+
<div class="space-y-1.5">
|
|
210
|
+
<button
|
|
211
|
+
v-for="item in group.items"
|
|
212
|
+
:key="item.key"
|
|
213
|
+
type="button"
|
|
214
|
+
class="flex w-full items-center gap-3 rounded-lg border border-slate-800 bg-slate-900/50 px-3 py-2.5 text-start transition hover:border-slate-700 hover:bg-slate-900"
|
|
215
|
+
:data-testid="`model-provider-${item.key}`"
|
|
216
|
+
@click="item.onClick()"
|
|
217
|
+
>
|
|
218
|
+
<UIcon :name="item.icon" class="h-5 w-5 shrink-0 text-slate-300" />
|
|
219
|
+
<div class="min-w-0 flex-1">
|
|
220
|
+
<div class="flex items-center gap-2">
|
|
221
|
+
<span class="truncate text-sm font-medium text-slate-100">{{ item.label }}</span>
|
|
222
|
+
<UBadge v-if="item.connected" color="success" variant="subtle" size="sm">
|
|
223
|
+
{{ item.status || t('layout.modelProvidersHub.status.connected') }}
|
|
224
|
+
</UBadge>
|
|
225
|
+
<span v-else class="text-[11px] text-slate-500">{{
|
|
226
|
+
t('layout.modelProvidersHub.status.notConnected')
|
|
227
|
+
}}</span>
|
|
228
|
+
<UBadge
|
|
229
|
+
v-if="!anyConnected && item.recommended"
|
|
230
|
+
color="primary"
|
|
231
|
+
variant="subtle"
|
|
232
|
+
size="sm"
|
|
233
|
+
>
|
|
234
|
+
{{ t('layout.modelProvidersHub.status.recommended') }}
|
|
235
|
+
</UBadge>
|
|
236
|
+
</div>
|
|
237
|
+
<p class="truncate text-xs text-slate-400">{{ item.description }}</p>
|
|
238
|
+
</div>
|
|
239
|
+
<UIcon
|
|
240
|
+
name="i-lucide-chevron-right"
|
|
241
|
+
class="h-4 w-4 shrink-0 text-slate-500 rtl:-scale-x-100"
|
|
242
|
+
/>
|
|
243
|
+
</button>
|
|
244
|
+
</div>
|
|
245
|
+
<p v-if="group.note" class="mt-1.5 px-1 text-[11px] text-slate-500">{{ group.note }}</p>
|
|
246
|
+
</section>
|
|
247
|
+
</div>
|
|
248
|
+
</template>
|
|
249
|
+
</UModal>
|
|
250
|
+
</template>
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
VALIDATION_MAX_ATTEMPTS_CEILING,
|
|
8
8
|
VALIDATION_MAX_CHECKS,
|
|
9
9
|
type ValidationCheck,
|
|
10
|
+
type ValidationEcosystem,
|
|
10
11
|
} from '~/types/validationChecks'
|
|
12
|
+
import { mergeDetectedChecks } from '~/utils/validationDetection'
|
|
11
13
|
|
|
12
14
|
// Per-service (frame) PRE-PR VALIDATION CHECKS: the shell commands the executor-harness runs
|
|
13
15
|
// against the checkout after the coder settles and BEFORE the PR opens. A failing command's
|
|
@@ -18,10 +20,11 @@ const props = defineProps<{ block: Block }>()
|
|
|
18
20
|
|
|
19
21
|
const store = useValidationChecksStore()
|
|
20
22
|
const toast = useToast()
|
|
21
|
-
const { t } = useI18n()
|
|
23
|
+
const { t, te } = useI18n()
|
|
22
24
|
const { confirmAction, toastDone } = useConfirmAction()
|
|
23
25
|
|
|
24
26
|
const busy = ref(false)
|
|
27
|
+
const detecting = ref(false)
|
|
25
28
|
const rows = ref<ValidationCheck[]>([])
|
|
26
29
|
const maxAttempts = ref(VALIDATION_DEFAULT_MAX_ATTEMPTS)
|
|
27
30
|
|
|
@@ -64,6 +67,88 @@ function notifyError(title: string, e: unknown) {
|
|
|
64
67
|
})
|
|
65
68
|
}
|
|
66
69
|
|
|
70
|
+
// Ecosystem label KEYS, exhaustive over the contracts `ValidationEcosystem` union: a new
|
|
71
|
+
// backend detector fails THIS typecheck until it is mapped (the key is assembled at runtime,
|
|
72
|
+
// so the typed-message-keys check cannot see the `t()` lookup — the map's exhaustiveness is
|
|
73
|
+
// the drift guard, same pattern as `ENV_TEST_STAGE_KEYS`).
|
|
74
|
+
const ECOSYSTEM_KEYS: Record<ValidationEcosystem, string> = {
|
|
75
|
+
node: 'inspector.validationChecks.ecosystem.node',
|
|
76
|
+
python: 'inspector.validationChecks.ecosystem.python',
|
|
77
|
+
go: 'inspector.validationChecks.ecosystem.go',
|
|
78
|
+
rust: 'inspector.validationChecks.ecosystem.rust',
|
|
79
|
+
maven: 'inspector.validationChecks.ecosystem.maven',
|
|
80
|
+
gradle: 'inspector.validationChecks.ecosystem.gradle',
|
|
81
|
+
dotnet: 'inspector.validationChecks.ecosystem.dotnet',
|
|
82
|
+
ruby: 'inspector.validationChecks.ecosystem.ruby',
|
|
83
|
+
php: 'inspector.validationChecks.ecosystem.php',
|
|
84
|
+
elixir: 'inspector.validationChecks.ecosystem.elixir',
|
|
85
|
+
make: 'inspector.validationChecks.ecosystem.make',
|
|
86
|
+
just: 'inspector.validationChecks.ecosystem.just',
|
|
87
|
+
task: 'inspector.validationChecks.ecosystem.task',
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function ecosystemLabel(id: ValidationEcosystem): string {
|
|
91
|
+
const key = ECOSYSTEM_KEYS[id]
|
|
92
|
+
// `te`-guarded so a locale missing the key shows the raw id, never a raw message key.
|
|
93
|
+
return te(key) ? t(key) : id
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Fill the rows from what the service's repo declares. The suggestion is NOT saved — it
|
|
98
|
+
* lands in the same unsaved rows the operator edits by hand, so Detect is always reversible
|
|
99
|
+
* by walking away from the panel.
|
|
100
|
+
*/
|
|
101
|
+
async function detect() {
|
|
102
|
+
detecting.value = true
|
|
103
|
+
try {
|
|
104
|
+
const result = await store.detect(props.block.id)
|
|
105
|
+
if (result.status !== 'ok') {
|
|
106
|
+
// The backend distinguishes "no repo linked" from "the repo could not be read"; say
|
|
107
|
+
// which, because they send the operator to different places.
|
|
108
|
+
toast.add({
|
|
109
|
+
title: t(`inspector.validationChecks.detect.${result.status}`),
|
|
110
|
+
icon: 'i-lucide-triangle-alert',
|
|
111
|
+
color: 'warning',
|
|
112
|
+
})
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
const merged = mergeDetectedChecks(rows.value, result.checks, VALIDATION_MAX_CHECKS)
|
|
116
|
+
rows.value = merged.rows
|
|
117
|
+
if (merged.added === 0) {
|
|
118
|
+
toast.add({
|
|
119
|
+
title: t('inspector.validationChecks.detect.nothingNew'),
|
|
120
|
+
description:
|
|
121
|
+
result.checks.length > 0
|
|
122
|
+
? t('inspector.validationChecks.detect.alreadyPresent')
|
|
123
|
+
: t('inspector.validationChecks.detect.unrecognised'),
|
|
124
|
+
icon: 'i-lucide-info',
|
|
125
|
+
color: 'neutral',
|
|
126
|
+
})
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
const names = result.ecosystems.map(ecosystemLabel).join(', ')
|
|
130
|
+
toast.add({
|
|
131
|
+
title: t('inspector.validationChecks.detect.added', { count: merged.added }, merged.added),
|
|
132
|
+
// Name what was recognised AND what was left out: a cap that silently swallowed a
|
|
133
|
+
// suggestion reads as "that is everything your repo has".
|
|
134
|
+
description: [
|
|
135
|
+
names ? t('inspector.validationChecks.detect.found', { ecosystems: names }) : '',
|
|
136
|
+
merged.dropped > 0 || result.truncated
|
|
137
|
+
? t('inspector.validationChecks.detect.capped', { max: VALIDATION_MAX_CHECKS })
|
|
138
|
+
: '',
|
|
139
|
+
]
|
|
140
|
+
.filter(Boolean)
|
|
141
|
+
.join(' '),
|
|
142
|
+
icon: 'i-lucide-wand-sparkles',
|
|
143
|
+
color: 'success',
|
|
144
|
+
})
|
|
145
|
+
} catch (e) {
|
|
146
|
+
notifyError(t('inspector.validationChecks.detect.failed'), e)
|
|
147
|
+
} finally {
|
|
148
|
+
detecting.value = false
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
67
152
|
async function save() {
|
|
68
153
|
busy.value = true
|
|
69
154
|
try {
|
|
@@ -179,6 +264,19 @@ async function clear() {
|
|
|
179
264
|
/>
|
|
180
265
|
</UFormField>
|
|
181
266
|
<div class="flex gap-2">
|
|
267
|
+
<UButton
|
|
268
|
+
color="neutral"
|
|
269
|
+
variant="soft"
|
|
270
|
+
size="xs"
|
|
271
|
+
icon="i-lucide-wand-sparkles"
|
|
272
|
+
:loading="detecting"
|
|
273
|
+
:disabled="!canAdd"
|
|
274
|
+
:title="t('inspector.validationChecks.detect.hint')"
|
|
275
|
+
data-testid="validation-detect"
|
|
276
|
+
@click="detect"
|
|
277
|
+
>
|
|
278
|
+
{{ t('inspector.validationChecks.detect.action') }}
|
|
279
|
+
</UButton>
|
|
182
280
|
<UButton
|
|
183
281
|
color="neutral"
|
|
184
282
|
variant="soft"
|