@cat-factory/app 0.26.2 → 0.26.3
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.
|
@@ -30,6 +30,7 @@ const RECOMMENDED_SLUGS = [
|
|
|
30
30
|
'openai/gpt-5.5',
|
|
31
31
|
'google/gemini-3-pro',
|
|
32
32
|
'deepseek/deepseek-chat',
|
|
33
|
+
'moonshotai/kimi-k2.7-code',
|
|
33
34
|
]
|
|
34
35
|
|
|
35
36
|
// Whether the workspace/user has an OpenRouter key connected at any reachable scope.
|
|
@@ -105,18 +106,35 @@ async function connectKey() {
|
|
|
105
106
|
if (!keyValue.value.trim() || !workspace.workspaceId) return
|
|
106
107
|
connectingKey.value = true
|
|
107
108
|
try {
|
|
109
|
+
const scope = keyScope.value
|
|
108
110
|
const input = {
|
|
109
111
|
provider: 'openrouter' as const,
|
|
110
112
|
label: keyLabel.value.trim() || 'openrouter key',
|
|
111
113
|
key: keyValue.value.trim(),
|
|
112
114
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
// The save endpoint stores the key WITHOUT validating it, so a wrong/expired key
|
|
116
|
+
// would otherwise be reported as "connected". Probe OpenRouter with the freshly
|
|
117
|
+
// stored key and only announce success when it's actually reachable; on rejection
|
|
118
|
+
// roll the key back so `keyConnected` stays false and the form remains for a retry.
|
|
119
|
+
const created =
|
|
120
|
+
scope === 'workspace' ? await apiKeys.addWorkspaceKey(input) : await apiKeys.addUserKey(input)
|
|
121
|
+
const result = await store.refresh(workspace.workspaceId)
|
|
122
|
+
if (!result.reachable) {
|
|
123
|
+
if (created) {
|
|
124
|
+
if (scope === 'workspace') await apiKeys.removeWorkspaceKey(created.id).catch(() => {})
|
|
125
|
+
else await apiKeys.removeUserKey(created.id).catch(() => {})
|
|
126
|
+
}
|
|
127
|
+
toast.add({
|
|
128
|
+
title: 'Could not connect key',
|
|
129
|
+
description: store.refreshError ?? 'OpenRouter rejected the key.',
|
|
130
|
+
icon: 'i-lucide-triangle-alert',
|
|
131
|
+
color: 'error',
|
|
132
|
+
})
|
|
133
|
+
return
|
|
134
|
+
}
|
|
115
135
|
keyValue.value = ''
|
|
116
136
|
keyLabel.value = ''
|
|
117
137
|
toast.add({ title: 'OpenRouter key connected', icon: 'i-lucide-check', color: 'success' })
|
|
118
|
-
// Now that a key exists, load the live catalog automatically.
|
|
119
|
-
await refresh()
|
|
120
138
|
} catch (e) {
|
|
121
139
|
toast.add({
|
|
122
140
|
title: 'Could not connect key',
|
package/app/stores/apiKeys.ts
CHANGED
|
@@ -39,6 +39,7 @@ export const useApiKeysStore = defineStore('apiKeys', () => {
|
|
|
39
39
|
if (!workspaceId.value) return
|
|
40
40
|
const created = await api.addWorkspaceApiKey(workspaceId.value, input)
|
|
41
41
|
workspaceKeys.value = [...workspaceKeys.value, created]
|
|
42
|
+
return created
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
async function removeWorkspaceKey(id: string) {
|
|
@@ -50,6 +51,7 @@ export const useApiKeysStore = defineStore('apiKeys', () => {
|
|
|
50
51
|
async function addUserKey(input: AddApiKeyInput) {
|
|
51
52
|
const created = await api.addMyApiKey(input)
|
|
52
53
|
userKeys.value = [...userKeys.value, created]
|
|
54
|
+
return created
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
async function removeUserKey(id: string) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/app",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.3",
|
|
4
4
|
"description": "Reusable Nuxt layer for the Agent Architecture Board SPA (components, stores, composables, pages). Consume it from a thin deployment app via `extends: ['@cat-factory/app']` and point it at your backend with NUXT_PUBLIC_API_BASE. See deploy/frontend for an example.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|