Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(frontend): keep agent editor dependency loading alive for contributors
vicfeia57e97c4e1f8
diff --git a/frontend/src/stores/editorResources.ts b/frontend/src/stores/editorResources.tsindex 5041ff3e8..080f204c8 100644--- a/frontend/src/stores/editorResources.ts+++ b/frontend/src/stores/editorResources.ts@@ -15,6 +15,7 @@ import { listMCPServices, type MCPService } from '@/api/mcp-service'import { listSkillCatalog, listSkills, type SkillCatalogItem, type SkillInfo } from '@/api/skill'import { getAgentTypePresets, getPlaceholders, type AgentTypePreset, type PlaceholdersResponse } from '@/api/agent'import { getTenantRetrievalConfig } from '@/api/retrieval'+import { isStorageConfigDenied } from './storageEngineAccess'const CACHE_TTL_MS = 60_000@@ -87,7 +88,15 @@ export const useEditorResourcesStore = defineStore('editorResources', () => {async function ensureStorageEngine(force = false): Promise<void> {return runOnce('storageEngine', force, async () => {const [configRes, statusRes] = await Promise.all([- getStorageEngineConfig(),+ // The config endpoint is admin-only (it carries integration secrets),+ // while every creator — Contributors included — needs the status list+ // to pick a usable provider. A permission rejection on the config+ // call must therefore degrade to "no admin config", not break the+ // whole editor dependency chain (#2991).+ getStorageEngineConfig().catch((error: unknown) => {+ if (isStorageConfigDenied(error)) return null+ throw error+ }),getStorageEngineStatus(),])storageConfig.value = configRes?.data ?? nulldiff --git a/frontend/src/stores/storageEngineAccess.test.ts b/frontend/src/stores/storageEngineAccess.test.tsnew file mode 100644index 000000000..a0d8329bc--- /dev/null+++ b/frontend/src/stores/storageEngineAccess.test.ts@@ -0,0 +1,26 @@+import assert from 'node:assert/strict'+import test from 'node:test'++import { isStorageConfigDenied } from './storageEngineAccess.ts'++/** Mirrors withHttpStatus in utils/request.ts: rejected values carry a+ * non-enumerable `status` property on the payload. */+function rejectedWithStatus(status: number, message = 'forbidden'): unknown {+ const payload: Record<string, unknown> = { message }+ Object.defineProperty(payload, 'status', { value: status, enumerable: false })+ return payload+}++test('isStorageConfigDenied accepts permission rejections', () => {+ assert.equal(isStorageConfigDenied(rejectedWithStatus(403)), true)+ assert.equal(isStorageConfigDenied(rejectedWithStatus(401)), true)+})++test('isStorageConfigDenied rejects other failures so they stay fatal', () => {+ assert.equal(isStorageConfigDenied(rejectedWithStatus(500)), false)+ assert.equal(isStorageConfigDenied(rejectedWithStatus(404)), false)+ assert.equal(isStorageConfigDenied(new Error('network down')), false)+ assert.equal(isStorageConfigDenied(null), false)+ assert.equal(isStorageConfigDenied(undefined), false)+ assert.equal(isStorageConfigDenied('403'), false)+})diff --git a/frontend/src/stores/storageEngineAccess.ts b/frontend/src/stores/storageEngineAccess.tsnew file mode 100644index 000000000..4f8a3df55--- /dev/null+++ b/frontend/src/stores/storageEngineAccess.ts@@ -0,0 +1,18 @@+/**+ * Whether a storage-engine config request was rejected for permissions.+ *+ * The tenant KV key `storage-engine-config` is admin-only (it carries+ * integration secrets), while every agent creator — Contributors included —+ * needs the Viewer-safe status list to pick a usable provider. The store's+ * ensureStorageEngine therefore downgrades a permission rejection on the+ * config call to "no admin config" instead of failing the whole editor+ * dependency chain (#2991).+ *+ * The rejected value carries a non-enumerable `status` property (see+ * `withHttpStatus` in utils/request.ts); only 401/403 mean "this caller+ * may not read the admin-only config". Anything else stays fatal.+ */+export function isStorageConfigDenied(error: unknown): boolean {+ const status = (error as { status?: unknown } | null | undefined)?.status+ return status === 401 || status === 403+}