From f5d0f0c27e9c444f346f1825e125b6a35ad0b5d0 Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Thu, 24 Sep 2026 11:48:35 -0400 Subject: [PATCH] refactor(opencode): reload config in place and drop v1 compatibility shims Route config/skill/AGENTS.md changes through the OpenCode location reload API instead of a full server restart, stop auto-resuming interrupted sessions, remove the restart coordinator and v1 MCP/version shims, and pin support to OpenCode >=2.0.15 <3.0.0. Adds integration-ready retries, service-mode launch, ocm-cli repo proxy, and new frontend form/MCP helpers. --- README.md | 2 +- backend/src/index.ts | 5 - backend/src/routes/health.ts | 8 +- backend/src/routes/internal/assistant.ts | 7 +- backend/src/routes/mcp-oauth-proxy.ts | 51 +- backend/src/routes/oauth.test.ts | 132 +- backend/src/routes/oauth.ts | 108 +- backend/src/routes/opencode-config.ts | 1 + backend/src/routes/opencode-proxy.ts | 9 +- backend/src/routes/providers.test.ts | 62 +- backend/src/routes/providers.ts | 14 +- backend/src/routes/settings.test.ts | 52 +- backend/src/routes/settings.ts | 177 +- backend/src/services/assistant-mode.ts | 12 +- backend/src/services/notification.ts | 5 +- backend/src/services/opencode-config-apply.ts | 55 +- backend/src/services/opencode-installer.ts | 91 +- .../services/opencode-manager-tool-plugin.ts | 14 +- .../opencode-restart-coordinator.test.ts | 145 - .../services/opencode-restart-coordinator.ts | 44 - backend/src/services/opencode-restart.ts | 85 +- backend/src/services/opencode-service-mode.ts | 31 + .../src/services/opencode-single-server.ts | 109 +- backend/src/services/opencode/client.ts | 6 +- .../services/opencode/integration-ready.ts | 45 + .../src/services/opencode/plugin-registry.ts | 2 +- backend/src/services/opencode/upstream.ts | 9 +- backend/src/services/schedules.ts | 20 +- backend/src/services/sse-aggregator.ts | 64 +- backend/src/utils/route-helpers.ts | 10 +- backend/src/utils/version-utils.ts | 17 - backend/test/helpers/opencode-binary.ts | 112 +- backend/test/helpers/stub-opencode-client.ts | 1 + backend/test/index.test.ts | 15 +- .../opencode-config-reload.test.ts | 352 + .../opencode-service-resume.test.ts | 187 + .../provider-credential-refresh.test.ts | 117 + .../test/routes/internal-assistant.test.ts | 23 +- .../routes/internal-opencode-config.test.ts | 10 +- backend/test/routes/mcp-oauth-proxy.test.ts | 56 +- backend/test/routes/opencode-proxy.test.ts | 15 +- backend/test/routes/settings.test.ts | 296 +- .../test/scripts/docker-entrypoint.test.ts | 84 +- .../services/opencode-config-apply.test.ts | 81 +- .../test/services/opencode-installer.test.ts | 98 +- .../test/services/opencode-restart.test.ts | 191 +- .../services/opencode-single-server.test.ts | 124 +- backend/test/services/opencode/client.test.ts | 32 + .../opencode/integration-ready.test.ts | 98 + .../test/services/opencode/upstream.test.ts | 18 +- backend/test/services/sse-aggregator.test.ts | 85 +- backend/test/shared/opencode-contract.test.ts | 111 +- backend/test/shared/opencode-mcp.test.ts | 240 +- docs/configuration/environment.md | 2 + docs/development/setup.md | 2 +- docs/features/assistant-internal-api.md | 2 +- docs/features/mcp.md | 112 +- docs/features/server-health.md | 6 +- docs/getting-started/installation.md | 4 +- docs/index.md | 2 +- docs/ocm-cli.md | 19 +- frontend/package-lock.json | 7483 ----------------- frontend/src/api/mcp.ts | 49 +- frontend/src/api/oauth.ts | 30 +- frontend/src/api/opencode.ts | 240 +- frontend/src/api/opencodeApi.ts | 14 +- frontend/src/api/providers.test.ts | 85 +- frontend/src/api/providers.ts | 48 +- frontend/src/api/settings.ts | 22 +- frontend/src/api/types.ts | 7 - frontend/src/api/types/settings.ts | 6 + .../src/components/message/FileToolRender.tsx | 2 +- .../src/components/message/MessagePart.tsx | 2 +- .../components/message/MessageThread.test.tsx | 40 + .../src/components/message/MessageThread.tsx | 16 +- .../message/PromptInput.command.test.tsx | 1 - .../message/PromptInput.mention.test.tsx | 1 - .../message/PromptInput.stt.test.tsx | 1 - .../src/components/message/PromptInput.tsx | 10 +- .../message/StepFileChanges.test.tsx | 44 + .../components/message/StepFileChanges.tsx | 68 + .../src/components/message/ToolCallPart.tsx | 9 +- .../components/model/ApiKeyDialog.test.tsx | 57 +- .../src/components/model/ApiKeyDialog.tsx | 20 +- .../src/components/model/ModelQuickSelect.tsx | 10 +- .../components/model/ModelSelectDialog.tsx | 515 -- .../src/components/repo/RepoMcpDialog.tsx | 8 +- .../src/components/repo/RepoMcpServerList.tsx | 41 +- .../components/session/FormPrompt.test.tsx | 105 + .../src/components/session/FormPrompt.tsx | 37 +- .../session/SessionSendErrorBanner.test.tsx | 12 - .../settings/AddMcpServerDialog.test.tsx | 38 +- .../settings/AddMcpServerDialog.tsx | 34 +- .../components/settings/McpManager.test.tsx | 110 + .../src/components/settings/McpManager.tsx | 38 +- .../src/components/settings/McpServerCard.tsx | 48 +- .../components/settings/McpStatusBadge.tsx | 34 + .../settings/OAuthAuthorizeDialog.tsx | 41 +- .../settings/OpenCodeConfigManager.test.tsx | 4 +- .../settings/OpenCodeConfigManager.tsx | 4 +- .../components/settings/ProviderAuthField.tsx | 127 +- .../settings/ProviderSettings.test.tsx | 1 - .../settings/RestartServerDialog.test.tsx | 2 +- .../settings/RestartServerDialog.tsx | 2 +- .../src/components/ui/external-field-card.tsx | 32 + .../components/ui/route-error-boundary.tsx | 12 +- frontend/src/contexts/EventContext.test.tsx | 102 + frontend/src/contexts/EventContext.tsx | 20 +- frontend/src/hooks/useAutoPlayLastResponse.ts | 5 +- frontend/src/hooks/useCommandHandler.ts | 2 +- frontend/src/hooks/useContextUsage.ts | 17 +- frontend/src/hooks/useModelSelection.test.tsx | 107 +- frontend/src/hooks/useModelSelection.ts | 28 +- frontend/src/hooks/useOpenCode.ts | 20 +- .../hooks/useOpenCodeServerActions.test.ts | 18 + .../src/hooks/useOpenCodeServerActions.ts | 24 +- frontend/src/hooks/useProviders.ts | 15 + frontend/src/hooks/useSSE.test.tsx | 129 +- frontend/src/hooks/useSSE.ts | 45 +- frontend/src/hooks/useSendPrompt.test.ts | 11 +- frontend/src/hooks/useServerHealth.ts | 2 +- .../src/hooks/useSessionTranscript.test.tsx | 464 +- frontend/src/hooks/useSessionTranscript.ts | 147 +- frontend/src/hooks/useVariants.ts | 10 +- frontend/src/lib/exportSession.ts | 16 +- frontend/src/lib/formFields.test.ts | 150 + frontend/src/lib/formFields.ts | 123 + frontend/src/lib/mcp.ts | 4 + frontend/src/lib/oauthFields.test.ts | 82 - frontend/src/lib/oauthFields.ts | 73 - frontend/src/lib/opencode-errors.test.ts | 41 +- frontend/src/lib/opencode-errors.ts | 42 - .../__tests__/openCodeEventStream.test.ts | 15 + .../openCodeEventStream.ts | 2 +- .../applySessionEvent.test.ts | 87 + .../session-projection/applySessionEvent.ts | 128 +- .../src/lib/session-projection/fixtures.ts | 49 +- frontend/src/lib/session-projection/index.ts | 5 +- .../SessionDetail.assistant-loading.test.tsx | 10 - .../SessionDetail.contentVersion.test.ts | 83 +- .../__tests__/SessionDetail.export.test.tsx | 4 - .../SessionDetail.form-prompt.test.tsx | 7 - .../__tests__/SessionDetail.polling.test.tsx | 7 - .../SessionDetail.scroll-floating.test.tsx | 7 - frontend/src/pages/sessionContentVersion.ts | 92 +- frontend/src/stores/sendErrorStore.test.ts | 38 +- frontend/src/stores/sendErrorStore.ts | 35 +- ocm-cli/README.md | 27 +- ocm-cli/bin/ocm.ts | 34 +- ocm-cli/package.json | 2 +- ocm-cli/src/move-progress.ts | 4 +- ocm-cli/src/repo-proxy.ts | 60 + ocm-cli/src/session-move.ts | 10 +- ocm-cli/src/tui-plugin.ts | 15 +- ocm-cli/src/warp.ts | 3 +- ocm-cli/test/move-progress.test.ts | 8 +- ocm-cli/test/repo-proxy.test.ts | 84 + ocm-cli/test/session-move.test.ts | 6 +- ocm-cli/test/tui-plugin.test.ts | 21 + scripts/docker-entrypoint.sh | 28 +- scripts/setup-dev.sh | 9 +- shared/src/config/env.ts | 1 + shared/src/opencode/content.ts | 40 + shared/src/opencode/index.ts | 50 +- shared/src/opencode/mcp.ts | 194 +- shared/src/opencode/release.ts | 59 +- shared/src/schemas/auth.ts | 101 +- shared/src/schemas/opencode-target.ts | 45 - shared/src/schemas/settings.ts | 1 + shared/src/schemas/sse.ts | 2 +- shared/src/types/opencode-target.ts | 16 - 171 files changed, 5046 insertions(+), 11437 deletions(-) delete mode 100644 backend/src/services/opencode-restart-coordinator.test.ts delete mode 100644 backend/src/services/opencode-restart-coordinator.ts create mode 100644 backend/src/services/opencode-service-mode.ts create mode 100644 backend/src/services/opencode/integration-ready.ts delete mode 100644 backend/src/utils/version-utils.ts create mode 100644 backend/test/integration/opencode-config-reload.test.ts create mode 100644 backend/test/integration/opencode-service-resume.test.ts create mode 100644 backend/test/integration/provider-credential-refresh.test.ts create mode 100644 backend/test/services/opencode/integration-ready.test.ts delete mode 100644 frontend/package-lock.json create mode 100644 frontend/src/components/message/StepFileChanges.test.tsx create mode 100644 frontend/src/components/message/StepFileChanges.tsx delete mode 100644 frontend/src/components/model/ModelSelectDialog.tsx create mode 100644 frontend/src/components/settings/McpManager.test.tsx create mode 100644 frontend/src/components/settings/McpStatusBadge.tsx create mode 100644 frontend/src/components/ui/external-field-card.tsx create mode 100644 frontend/src/hooks/useOpenCodeServerActions.test.ts create mode 100644 frontend/src/hooks/useProviders.ts create mode 100644 frontend/src/lib/formFields.test.ts create mode 100644 frontend/src/lib/formFields.ts create mode 100644 frontend/src/lib/mcp.ts delete mode 100644 frontend/src/lib/oauthFields.test.ts delete mode 100644 frontend/src/lib/oauthFields.ts create mode 100644 ocm-cli/src/repo-proxy.ts create mode 100644 ocm-cli/test/repo-proxy.test.ts mode change 100755 => 100644 scripts/setup-dev.sh create mode 100644 shared/src/opencode/content.ts delete mode 100644 shared/src/schemas/opencode-target.ts delete mode 100644 shared/src/types/opencode-target.ts diff --git a/README.md b/README.md index 4892ae06..922f02f5 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ ## Requirements -OpenCode Manager requires **OpenCode 2.0.0 or newer** (bundled 2.0.15). OpenCode 1.x is not supported. If you are upgrading from OpenCode 1.x, see the [v1 → v2 migration guide](https://opencode.ai/v2/docs/migrate-v1). +OpenCode Manager requires **OpenCode 2.x at 2.0.15 or newer** (bundled 2.0.15). OpenCode 1.x and 3.x are not supported. If you are upgrading from OpenCode 1.x, see the [v1 → v2 migration guide](https://opencode.ai/v2/docs/migrate-v1). On first start, OpenCode 2 migrates V1 session history in the background, so older sessions can be missing or incomplete until it finishes; progress is reported by OpenCode at `GET /api/experimental/migration/v1`. ## Quick Start diff --git a/backend/src/index.ts b/backend/src/index.ts index 14b12765..88cfe0f1 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -58,8 +58,6 @@ import { getOpenCodeImportStatus, syncOpenCodeImport } from './services/opencode import { readOpenCodeConfigFile, foldLegacyConfigJsonSource, withOpenCodeConfigLock } from './services/opencode-config-file' import { seedOpenCodeConfigFile } from './services/opencode-config-apply' import { OpenCodeSupervisor } from './services/opencode-supervisor' -import { OpenCodeRestartCoordinator } from './services/opencode-restart-coordinator' -import { setOpenCodeRestartCoordinator } from './services/opencode-restart' import { logger } from './utils/logger' import { getWorkspacePath, @@ -257,9 +255,6 @@ sseAggregator.setScheduledSessionsResolver( () => scheduleService.getActiveRunSessions(), ) -const openCodeRestartCoordinator = new OpenCodeRestartCoordinator(sseAggregator) -setOpenCodeRestartCoordinator(openCodeRestartCoordinator) - void scheduleRunnerInstance.start() const settingsService = new SettingsService(db) diff --git a/backend/src/routes/health.ts b/backend/src/routes/health.ts index ed7e7c2a..1bd7a4f9 100644 --- a/backend/src/routes/health.ts +++ b/backend/src/routes/health.ts @@ -3,7 +3,7 @@ import type { Database } from 'bun:sqlite' import { readFile } from 'fs/promises' import { opencodeServerManager } from '../services/opencode-single-server' import type { OpenCodeSupervisor } from '../services/opencode-supervisor' -import { compareVersions } from '../utils/version-utils' +import { compareOpenCodeVersions, normalizeOpenCodeVersion, parseOpenCodeVersion } from '@opencode-manager/shared/opencode' import { githubFetch } from '../utils/github' import { logger } from '../utils/logger' import { SandboxRuntimeService } from '../services/sandbox/runtime' @@ -179,8 +179,10 @@ export function createHealthRoutes(db: Database, openCodeSupervisor?: OpenCodeSu }) } - const latestVersion = latestRelease.tagName.replace(/^v/, '') - const isUpdateAvailable = compareVersions(currentVersion, latestVersion) < 0 + const latestVersion = normalizeOpenCodeVersion(latestRelease.tagName) + const isUpdateAvailable = parseOpenCodeVersion(currentVersion) !== null + && parseOpenCodeVersion(latestVersion) !== null + && compareOpenCodeVersions(currentVersion, latestVersion) < 0 return c.json({ currentVersion, diff --git a/backend/src/routes/internal/assistant.ts b/backend/src/routes/internal/assistant.ts index 9712226c..a3ce1bd0 100644 --- a/backend/src/routes/internal/assistant.ts +++ b/backend/src/routes/internal/assistant.ts @@ -1,5 +1,7 @@ import { Hono } from 'hono' import type { OpenCodeClient } from '../../services/opencode/client' +import { reloadOpenCodeConfig } from '../../services/opencode-restart' +import { ConfigReloadError } from '../../services/opencode-single-server' import { logger } from '../../utils/logger' import { TokenBucketRateLimiter } from '../../utils/rate-limit' @@ -16,9 +18,12 @@ export function createInternalAssistantRoutes(openCodeClient: OpenCodeClient) { } try { - await openCodeClient.api.location.reload() + await reloadOpenCodeConfig(openCodeClient) } catch (error) { logger.error('Failed to reload assistant workspace:', error) + if (error instanceof ConfigReloadError) { + return c.json({ error: error.message, validationIssues: error.validationIssues }, 400) + } return c.json({ error: 'Failed to reload assistant workspace' }, 502) } diff --git a/backend/src/routes/mcp-oauth-proxy.ts b/backend/src/routes/mcp-oauth-proxy.ts index 238464d9..bece0375 100644 --- a/backend/src/routes/mcp-oauth-proxy.ts +++ b/backend/src/routes/mcp-oauth-proxy.ts @@ -6,10 +6,11 @@ import { z } from 'zod' import { MCP_OAUTH_CALLBACK_PATH, mcpOAuthRedirectUri, - mcpServerConfigFromConfig, + mcpServersFromConfig, openCodeLocation, } from '@opencode-manager/shared/opencode' -import type { V2McpServerConfig } from '@opencode-manager/shared/opencode' +import type { McpServerConfig } from '@opencode-manager/shared/opencode' +import { ENV } from '@opencode-manager/shared/config/env' import type { OpenCodeClient } from '../services/opencode/client' import { storeMcpOAuthFlow, consumeMcpOAuthFlow, getMcpOAuthFlowByAttempt } from '../services/mcp-oauth-state' import { logger } from '../utils/logger' @@ -23,13 +24,21 @@ const DirectoryQuerySchema = z.object({ directory: z.string().optional(), }) +function firstHeaderValue(c: Context, name: string): string | undefined { + const value = c.req.header(name)?.split(',')[0]?.trim() + return value || undefined +} + +function forwardedScheme(c: Context): 'http' | 'https' | undefined { + const proto = firstHeaderValue(c, 'x-forwarded-proto')?.toLowerCase() + return proto === 'http' || proto === 'https' ? proto : undefined +} + function requestOrigin(c: Context): string { - const host = c.req.header('host') - const forwardedProto = c.req.header('x-forwarded-proto') - if (forwardedProto && host) { - return `${forwardedProto}://${host}` - } - return c.req.header('origin') || `http://${host ?? 'localhost:5003'}` + const host = firstHeaderValue(c, 'x-forwarded-host') ?? c.req.header('host') ?? 'localhost:5003' + const scheme = forwardedScheme(c) + if (scheme) return `${scheme}://${host}` + return c.req.header('origin') || `http://${host}` } function escapeHtml(unsafe: string): string { @@ -76,29 +85,31 @@ function probeLoopbackPort(): Promise { } export function createMcpOauthProxyRoutes(openCodeClient: OpenCodeClient, requireAuth?: MiddlewareHandler) { + if (ENV.OPENCODE.LEGACY_PUBLIC_URL) { + logger.warn('OPENCODE_PUBLIC_URL is set but no longer used; MCP OAuth redirects are derived from X-Forwarded-Proto/X-Forwarded-Host, Origin, or Host') + } + const app = new Hono() const api = openCodeClient.api - const location = (directory: string | undefined) => (directory ? openCodeLocation(directory) : undefined) - const findServer = async (serverName: string, directory: string | undefined) => { - const servers = (await api.mcp.list(location(directory))).data + const servers = (await api.mcp.list(openCodeLocation(directory))).data return servers.find((server) => server.name === serverName) } const readServerConfig = async (serverName: string, directory: string | undefined) => { - const entries = await api.config.get(location(directory)) - let config: V2McpServerConfig | undefined + const entries = await api.config.get(openCodeLocation(directory)) + let config: McpServerConfig | undefined for (const entry of entries) { if (entry.type !== 'document') continue - config = mcpServerConfigFromConfig(entry.info.mcp, serverName) ?? config + config = mcpServersFromConfig(entry.info.mcp)[serverName] ?? config } return config } const cancelAttempt = async (integrationID: string, attemptID: string, directory: string | undefined) => { try { - await api.integration.oauth.cancel({ integrationID, attemptID, ...location(directory) }) + await api.integration.oauth.cancel({ integrationID, attemptID, ...openCodeLocation(directory) }) } catch (error) { logger.warn(`Failed to cancel MCP OAuth attempt ${attemptID}:`, error) } @@ -117,7 +128,7 @@ export function createMcpOauthProxyRoutes(openCodeClient: OpenCodeClient, requir await api.mcp.add({ server: server.name, - ...location(directory), + ...openCodeLocation(directory), config: { ...v2Config, oauth: { @@ -153,7 +164,7 @@ export function createMcpOauthProxyRoutes(openCodeClient: OpenCodeClient, requir const callbackPort = await reserveCallbackPort(server, requestOrigin(c), directory) - const integration = (await api.integration.get({ integrationID: server.integrationID, ...location(directory) })).data + const integration = (await api.integration.get({ integrationID: server.integrationID, ...openCodeLocation(directory) })).data const method = integration.methods.find((candidate) => candidate.type === 'oauth') if (!method) { return c.json({ error: 'OAuth method not found for this MCP server' }, 400) @@ -163,7 +174,7 @@ export function createMcpOauthProxyRoutes(openCodeClient: OpenCodeClient, requir await api.integration.oauth.connect({ integrationID: server.integrationID, methodID: method.id, - ...location(directory), + ...openCodeLocation(directory), }) ).data @@ -200,7 +211,7 @@ export function createMcpOauthProxyRoutes(openCodeClient: OpenCodeClient, requir await api.integration.oauth.status({ integrationID: flow.integrationID, attemptID: flow.attemptID, - ...location(flow.directory), + ...openCodeLocation(flow.directory), }) ).data @@ -277,7 +288,7 @@ export function createMcpOauthProxyRoutes(openCodeClient: OpenCodeClient, requir return c.json({ success: true }) } - const integration = (await api.integration.get({ integrationID: server.integrationID, ...location(directory) })).data + const integration = (await api.integration.get({ integrationID: server.integrationID, ...openCodeLocation(directory) })).data for (const connection of integration.connections) { if (connection.type === 'credential') { await api.credential.remove({ credentialID: connection.id }) diff --git a/backend/src/routes/oauth.test.ts b/backend/src/routes/oauth.test.ts index 2eaa0317..ed2ceefd 100644 --- a/backend/src/routes/oauth.test.ts +++ b/backend/src/routes/oauth.test.ts @@ -5,20 +5,10 @@ import { createStubOpenCodeClient } from '../../test/helpers/stub-opencode-clien import { FetchOpenCodeClient } from '../services/opencode/client' import { resolveOpenCode2Binary, startOpenCodeServe } from '../../test/helpers/opencode-binary' import { buildOpenCodeBasicAuth, ClientError } from '@opencode-manager/shared/opencode' -import type { IntegrationInfo, IntegrationMethod } from '@opencode-manager/shared/opencode' -import type { OAuthAttemptStatus, OAuthAuthorizeResponse, ProviderAuthMethod } from '@opencode-manager/shared/schemas' +import type { IntegrationInfo, IntegrationKeyMethod, IntegrationMethod, IntegrationOAuthMethod } from '@opencode-manager/shared/opencode' +import type { OAuthAttemptStatus, OAuthAuthorizeResponse } from '@opencode-manager/shared/schemas' import type { OpenCodeClient } from '../services/opencode/client' -const restartMock = vi.hoisted(() => ({ - restartOpenCode: vi.fn(async () => ({ resumedSessionIDs: [] })), - reloadOpenCodeConfig: vi.fn(async () => ({ resumedSessionIDs: [] })), -})) - -vi.mock('../services/opencode-restart', () => ({ - restartOpenCode: restartMock.restartOpenCode, - reloadOpenCodeConfig: restartMock.reloadOpenCodeConfig, -})) - const LOCATION = { directory: '/tmp/repo' } function taggedError(tag: string, message: string): Error { @@ -101,7 +91,7 @@ describe('oauth routes /auth-methods', () => { const envMethod: IntegrationMethod = { type: 'env', names: ['ANTHROPIC_API_KEY'] } - it('normalizes V2 methods, forms, and conditions for every integration', async () => { + it('passes V2 methods and forms through for every integration', async () => { const client = createStubOpenCodeClient() vi.mocked(client.api.integration.list).mockResolvedValueOnce({ location: LOCATION, @@ -118,51 +108,10 @@ describe('oauth routes /auth-methods', () => { expect(res.status).toBe(200) const data = (await res.json()) as { providers: Record } expect(data.providers).toEqual({ - 'github-copilot': [ - { - id: 'device', - type: 'oauth', - label: 'Login with GitHub Copilot', - fields: [ - { - type: 'select', - key: 'deploymentType', - message: 'Select GitHub deployment type', - options: [ - { label: 'GitHub.com', value: 'github.com' }, - { label: 'GitHub Enterprise', value: 'enterprise' }, - ], - required: true, - }, - { - type: 'text', - key: 'enterpriseUrl', - message: 'Enter your GitHub Enterprise URL or domain', - placeholder: 'company.ghe.com or https://company.ghe.com', - required: true, - when: [{ key: 'deploymentType', op: 'eq', value: 'enterprise' }], - }, - ], - }, - { id: 'env', type: 'env', label: 'ANTHROPIC_API_KEY' }, - ], - azure: [ - { - id: 'key', - type: 'key', - label: 'API key', - fields: [ - { - type: 'text', - key: 'resourceName', - message: 'Enter Azure Resource Name', - required: true, - }, - ], - }, - ], - opencode: [{ id: 'device', type: 'oauth', label: 'OpenCode Console account', fields: [] }], - digitalocean: [{ id: 'browser', type: 'command', label: 'Login with DigitalOcean' }], + 'github-copilot': [oauthMethod, envMethod], + azure: [keyMethod], + opencode: [hiddenFieldMethod], + digitalocean: [commandMethod], }) }) @@ -199,8 +148,6 @@ describe('oauth routes /:id/oauth/authorize', () => { methodID: 'device', answer: { deploymentType: 'github.com' }, }) - expect(restartMock.restartOpenCode).not.toHaveBeenCalled() - expect(restartMock.reloadOpenCodeConfig).not.toHaveBeenCalled() }) it('returns 400 on an invalid body', async () => { @@ -227,19 +174,40 @@ describe('oauth routes /:id/oauth/authorize', () => { }) }) - it('returns 404 when the integration is gone', async () => { + it('retries once after a loading integration becomes available', async () => { const client = createStubOpenCodeClient() - vi.mocked(client.api.integration.oauth.connect).mockRejectedValueOnce( - taggedError('IntegrationNotFoundError', 'Integration not found: github-copilot'), - ) + const connect = vi.mocked(client.api.integration.oauth.connect) + connect.mockRejectedValueOnce(taggedError('IntegrationNotFoundError', 'Integration not found: github-copilot')) const res = await authorizeRequest(createOAuthApp(client)) - expect(res.status).toBe(404) - expect(await res.json()).toEqual({ - error: 'Integration not found: github-copilot', - code: 'IntegrationNotFoundError', - }) + expect(res.status).toBe(200) + expect(((await res.json()) as OAuthAuthorizeResponse).attemptID).toBe('con_stub') + expect(connect).toHaveBeenCalledTimes(2) + expect(vi.mocked(client.api.integration.get)).toHaveBeenCalledWith({ integrationID: 'github-copilot' }) + }) + + it('returns 404 when the integration is gone', async () => { + vi.useFakeTimers() + try { + const client = createStubOpenCodeClient() + const notFound = taggedError('IntegrationNotFoundError', 'Integration not found: github-copilot') + vi.mocked(client.api.integration.oauth.connect).mockRejectedValue(notFound) + vi.mocked(client.api.integration.get).mockRejectedValue(notFound) + + const pending = authorizeRequest(createOAuthApp(client)) + await vi.runAllTimersAsync() + const res = await pending + + expect(res.status).toBe(404) + expect(await res.json()).toEqual({ + error: 'Integration not found: github-copilot', + code: 'IntegrationNotFoundError', + }) + expect(vi.mocked(client.api.integration.oauth.connect)).toHaveBeenCalledTimes(1) + } finally { + vi.useRealTimers() + } }) }) @@ -291,7 +259,7 @@ describe('oauth routes /:id/oauth/:attemptID', () => { }) describe('oauth routes /:id/oauth/callback', () => { - it('completes the V2 attempt with the pasted code without restarting', async () => { + it('completes the V2 attempt with the pasted code', async () => { const client = createStubOpenCodeClient() const complete = vi.mocked(client.api.integration.oauth.complete) @@ -307,8 +275,6 @@ describe('oauth routes /:id/oauth/callback', () => { attemptID: 'con_stub', code: 'pasted-code', }) - expect(restartMock.restartOpenCode).not.toHaveBeenCalled() - expect(restartMock.reloadOpenCodeConfig).not.toHaveBeenCalled() }) it('returns 400 on an invalid body', async () => { @@ -352,7 +318,7 @@ describe('oauth routes /:id/oauth/callback', () => { }) describe('oauth routes /:id/oauth/:attemptID delete', () => { - it('cancels the V2 attempt without restarting', async () => { + it('cancels the V2 attempt', async () => { const client = createStubOpenCodeClient() const cancel = vi.mocked(client.api.integration.oauth.cancel) @@ -361,7 +327,6 @@ describe('oauth routes /:id/oauth/:attemptID delete', () => { expect(res.status).toBe(200) expect(await res.json()).toEqual({ success: true }) expect(cancel).toHaveBeenCalledWith({ integrationID: 'github-copilot', attemptID: 'con_stub' }) - expect(restartMock.restartOpenCode).not.toHaveBeenCalled() }) it('returns 502 when the upstream is unreachable', async () => { @@ -391,12 +356,21 @@ describe.skipIf(!openCodeBinary)('oauth routes against a real OpenCode 2 server' const methodsResponse = await app.request('/oauth/auth-methods') expect(methodsResponse.status).toBe(200) const { providers } = (await methodsResponse.json()) as { - providers: Record + providers: Record } - const device = providers['github-copilot']?.find((method) => method.id === 'device') - expect(device?.fields?.map((field) => field.key)).toEqual(['deploymentType', 'enterpriseUrl']) - expect(providers.opencode?.map((method) => method.id)).toEqual(['key', 'env', 'device']) - expect(providers.azure?.find((method) => method.type === 'key')?.fields?.map((field) => field.key)).toEqual(['resourceName']) + const device = providers['github-copilot']?.find( + (method): method is IntegrationOAuthMethod => method.type === 'oauth' && method.id === 'device', + ) + expect(device?.form?.map((field) => field.key)).toEqual(['deploymentType', 'enterpriseUrl']) + expect( + providers.opencode?.map((method) => + method.type === 'oauth' || method.type === 'command' ? method.id : method.type, + ), + ).toEqual(['key', 'env', 'device']) + const azureKey = providers.azure?.find( + (method): method is IntegrationKeyMethod => method.type === 'key', + ) + expect(azureKey?.form?.map((field) => field.key)).toEqual(['resourceName']) const authorizeResponse = await app.request('/oauth/github-copilot/oauth/authorize', { method: 'POST', diff --git a/backend/src/routes/oauth.ts b/backend/src/routes/oauth.ts index 27164fcc..9af60b6a 100644 --- a/backend/src/routes/oauth.ts +++ b/backend/src/routes/oauth.ts @@ -4,98 +4,10 @@ import { OAuthAuthorizeRequestSchema, OAuthCallbackRequestSchema, } from '../../../shared/src/schemas/auth' -import type { ProviderAuthMethod } from '../../../shared/src/schemas/auth' -import type { FormField, IntegrationMethod } from '@opencode-manager/shared/opencode' import type { OpenCodeClient } from '../services/opencode/client' +import { runWhenIntegrationReady } from '../services/opencode/integration-ready' import { handleOpenCodeError } from '../utils/route-helpers' -function finiteNumber(value: number | string | undefined): number | undefined { - return typeof value === 'number' && Number.isFinite(value) ? value : undefined -} - -function promptField(field: FormField) { - const message = field.title ?? field.description ?? field.key - - if (field.type === 'external') { - return { type: 'external' as const, key: field.key, message, url: field.url } - } - - const condition = field.when?.map((when) => ({ key: when.key, op: when.op, value: when.value })) - - if (field.type === 'string' && field.options) { - return { - type: 'select' as const, - key: field.key, - message, - options: field.options.map(({ label, value }) => ({ label, value })), - required: field.required, - default: field.default, - when: condition, - } - } - - if (field.type === 'string') { - return { - type: 'text' as const, - key: field.key, - message, - placeholder: field.placeholder, - required: field.required, - default: field.default, - when: condition, - } - } - - if (field.type === 'boolean') { - return { type: 'boolean' as const, key: field.key, message, required: field.required, default: field.default, when: condition } - } - - if (field.type === 'multiselect') { - return { - type: 'multiselect' as const, - key: field.key, - message, - options: field.options.map(({ label, value }) => ({ label, value })), - required: field.required, - default: field.default, - when: condition, - } - } - - return { - type: 'number' as const, - key: field.key, - message, - minimum: finiteNumber(field.minimum), - maximum: finiteNumber(field.maximum), - required: field.required, - default: finiteNumber(field.default), - when: condition, - } -} - -function providerAuthMethod(method: IntegrationMethod): ProviderAuthMethod { - if (method.type === 'env') { - return { id: 'env', type: 'env', label: method.names.join(', ') } - } - - const fields = method.type === 'oauth' || method.type === 'key' - ? method.form - ?.filter((field) => field.type === 'external' || !field.hidden) - .map(promptField) - : undefined - - if (method.type === 'command') { - return { id: method.id, type: 'command', label: method.label, fields } - } - - if (method.type === 'oauth') { - return { id: method.id, type: 'oauth', label: method.label, fields } - } - - return { id: 'key', type: 'key', label: method.label ?? 'API key', fields } -} - export function createOAuthRoutes(openCodeClient: OpenCodeClient) { const app = new Hono() @@ -103,10 +15,7 @@ export function createOAuthRoutes(openCodeClient: OpenCodeClient) { try { const integrations = await openCodeClient.api.integration.list() const providers = Object.fromEntries( - integrations.data.map((integration) => [ - integration.id, - integration.methods.map(providerAuthMethod), - ]), + integrations.data.map((integration) => [integration.id, integration.methods]), ) return c.json({ providers }) } catch (error) { @@ -119,11 +28,14 @@ export function createOAuthRoutes(openCodeClient: OpenCodeClient) { const body = await c.req.json() const validated = OAuthAuthorizeRequestSchema.parse(body) - const attempt = await openCodeClient.api.integration.oauth.connect({ - integrationID: c.req.param('id'), - methodID: validated.methodID, - answer: validated.answer, - }) + const integrationID = c.req.param('id') + const attempt = await runWhenIntegrationReady(openCodeClient.api, { integrationID }, () => + openCodeClient.api.integration.oauth.connect({ + integrationID, + methodID: validated.methodID, + answer: validated.answer, + }), + ) return c.json({ attemptID: attempt.data.attemptID, diff --git a/backend/src/routes/opencode-config.ts b/backend/src/routes/opencode-config.ts index f79e39ef..760bbe06 100644 --- a/backend/src/routes/opencode-config.ts +++ b/backend/src/routes/opencode-config.ts @@ -66,6 +66,7 @@ export function createOpenCodeConfigRoutes(settingsService: SettingsService, ope source: parsed.data.source, expectedRevision: parsed.data.expectedRevision, settingsService, + openCodeClient, }) const { status, body: responseBody } = toOpenCodeConfigApplyResponse(result) return c.json(responseBody, status) diff --git a/backend/src/routes/opencode-proxy.ts b/backend/src/routes/opencode-proxy.ts index 6886768b..983b9c2b 100644 --- a/backend/src/routes/opencode-proxy.ts +++ b/backend/src/routes/opencode-proxy.ts @@ -5,7 +5,7 @@ import { buildOpenCodeBasicAuth } from '@opencode-manager/shared/opencode' import { createInternalTokenMiddleware } from '../auth/internal-token-middleware' import type { SettingsService } from '../services/settings' import { opencodeServerManager } from '../services/opencode-single-server' -import { getOpenCodeUpstreamBaseUrl } from '../services/opencode/upstream' +import { getOpenCodeUpstreamBaseUrl, withDefaultOpenCodeDirectory } from '../services/opencode/upstream' import { getRepoById } from '../db/queries' const HOP_BY_HOP_HEADERS = new Set([ @@ -23,7 +23,7 @@ const HOP_BY_HOP_HEADERS = new Set([ 'authorization', ]) -export interface ProxyRequestParts { +interface ProxyRequestParts { method: string path: string headers: Record @@ -84,13 +84,14 @@ export function createOpenCodeProxyRoutes(db: Database, settingsService: Setting const url = new URL(c.req.url) const hasBody = c.req.method !== 'GET' && c.req.method !== 'HEAD' - const headers: Record = {} + const forwardedHeaders: Record = {} c.req.raw.headers.forEach((value, key) => { const lowerKey = key.toLowerCase() if (!HOP_BY_HOP_HEADERS.has(lowerKey)) { - headers[key] = value + forwardedHeaders[key] = value } }) + const headers = withDefaultOpenCodeDirectory(forwardedHeaders) headers['Authorization'] = buildOpenCodeBasicAuth(settingsService.getOpenCodeServerPassword()) diff --git a/backend/src/routes/providers.test.ts b/backend/src/routes/providers.test.ts index c431a2d6..51f5db6d 100644 --- a/backend/src/routes/providers.test.ts +++ b/backend/src/routes/providers.test.ts @@ -24,16 +24,6 @@ vi.mock('../services/opencode-model-state', async (importOriginal) => { } }) -const restartMock = vi.hoisted(() => ({ - restartOpenCode: vi.fn(async () => ({ resumedSessionIDs: [] })), - reloadOpenCodeConfig: vi.fn(async () => ({ resumedSessionIDs: [] })), -})) - -vi.mock('../services/opencode-restart', () => ({ - restartOpenCode: restartMock.restartOpenCode, - reloadOpenCodeConfig: restartMock.reloadOpenCodeConfig, -})) - const LOCATION = { directory: '/tmp/repo' } function integrationFixture(overrides: Partial = {}): IntegrationInfo { @@ -265,7 +255,7 @@ describe('providers routes', () => { }) } - it('connects the key through V2 integrations without restarting the server', async () => { + it('connects the key through V2 integrations', async () => { const client = createStubOpenCodeClient() const connectKey = vi.mocked(client.api.integration.connect.key) @@ -274,8 +264,6 @@ describe('providers routes', () => { expect(res.status).toBe(200) expect(await res.json()).toEqual({ success: true }) expect(connectKey).toHaveBeenCalledWith({ integrationID: 'anthropic', key: 'sk-test' }) - expect(restartMock.restartOpenCode).not.toHaveBeenCalled() - expect(restartMock.reloadOpenCodeConfig).not.toHaveBeenCalled() }) it('forwards the form answer for key methods that declare required fields', async () => { @@ -294,7 +282,6 @@ describe('providers routes', () => { key: 'az-test', answer: { resourceName: 'my-models' }, }) - expect(restartMock.restartOpenCode).not.toHaveBeenCalled() }) it('returns 400 on an invalid body', async () => { @@ -306,19 +293,40 @@ describe('providers routes', () => { expect(vi.mocked(client.api.integration.connect.key)).not.toHaveBeenCalled() }) - it('returns 404 for a missing integration', async () => { + it('retries once after a loading integration becomes available', async () => { const client = createStubOpenCodeClient() - vi.mocked(client.api.integration.connect.key).mockRejectedValueOnce( - taggedError('IntegrationNotFoundError', 'Integration not found: nope'), - ) + const connectKey = vi.mocked(client.api.integration.connect.key) + connectKey.mockRejectedValueOnce(taggedError('IntegrationNotFoundError', 'Integration not found: anthropic')) - const res = await connectRequest(createCredentialApp(client), 'nope') + const res = await connectRequest(createCredentialApp(client)) - expect(res.status).toBe(404) - expect(await res.json()).toEqual({ - error: 'Integration not found: nope', - code: 'IntegrationNotFoundError', - }) + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ success: true }) + expect(connectKey).toHaveBeenCalledTimes(2) + expect(vi.mocked(client.api.integration.get)).toHaveBeenCalledWith({ integrationID: 'anthropic' }) + }) + + it('returns 404 for a missing integration', async () => { + vi.useFakeTimers() + try { + const client = createStubOpenCodeClient() + const notFound = taggedError('IntegrationNotFoundError', 'Integration not found: nope') + vi.mocked(client.api.integration.connect.key).mockRejectedValue(notFound) + vi.mocked(client.api.integration.get).mockRejectedValue(notFound) + + const pending = connectRequest(createCredentialApp(client), 'nope') + await vi.runAllTimersAsync() + const res = await pending + + expect(res.status).toBe(404) + expect(await res.json()).toEqual({ + error: 'Integration not found: nope', + code: 'IntegrationNotFoundError', + }) + expect(vi.mocked(client.api.integration.connect.key)).toHaveBeenCalledTimes(1) + } finally { + vi.useRealTimers() + } }) it('returns 502 when the key is rejected', async () => { @@ -338,7 +346,7 @@ describe('providers routes', () => { }) describe('DELETE /:id/credentials', () => { - it('removes every credential connection of the integration without restarting the server', async () => { + it('removes every credential connection of the integration', async () => { const client = createStubOpenCodeClient() vi.mocked(client.api.integration.get).mockResolvedValueOnce({ location: LOCATION, @@ -355,8 +363,6 @@ describe('providers routes', () => { expect(remove).toHaveBeenCalledTimes(2) expect(remove).toHaveBeenCalledWith({ credentialID: 'cred_1' }) expect(remove).toHaveBeenCalledWith({ credentialID: 'cred_2' }) - expect(restartMock.restartOpenCode).not.toHaveBeenCalled() - expect(restartMock.reloadOpenCodeConfig).not.toHaveBeenCalled() }) it('removes nothing when the integration has no credential connection', async () => { @@ -392,7 +398,7 @@ describe('providers routes', () => { const openCodeBinary = resolveOpenCode2Binary() describe.skipIf(!openCodeBinary)('providers routes against a real OpenCode 2 server', () => { - it('connects an anthropic key and reports the credential without restarting', async () => { + it('connects an anthropic key and reports the credential', async () => { const serve = await startOpenCodeServe() try { const client = new FetchOpenCodeClient({ diff --git a/backend/src/routes/providers.ts b/backend/src/routes/providers.ts index 7f03995c..fb6bd57e 100644 --- a/backend/src/routes/providers.ts +++ b/backend/src/routes/providers.ts @@ -5,6 +5,7 @@ import { logger } from '../utils/logger' import { handleOpenCodeError } from '../utils/route-helpers' import type { IntegrationInfo } from '@opencode-manager/shared/opencode' import type { OpenCodeClient } from '../services/opencode/client' +import { runWhenIntegrationReady } from '../services/opencode/integration-ready' import { addRecentModel, ModelSelectionSchema, @@ -91,11 +92,14 @@ export function createProvidersRoutes(openCodeClient: OpenCodeClient) { const body = await c.req.json() const validated = SetCredentialRequestSchema.parse(body) - await openCodeClient.api.integration.connect.key({ - integrationID: c.req.param('id'), - key: validated.apiKey, - ...(validated.answer ? { answer: validated.answer } : {}), - }) + const integrationID = c.req.param('id') + await runWhenIntegrationReady(openCodeClient.api, { integrationID }, () => + openCodeClient.api.integration.connect.key({ + integrationID, + key: validated.apiKey, + ...(validated.answer ? { answer: validated.answer } : {}), + }), + ) return c.json({ success: true }) } catch (error) { diff --git a/backend/src/routes/settings.test.ts b/backend/src/routes/settings.test.ts index 453d0380..53d59de3 100644 --- a/backend/src/routes/settings.test.ts +++ b/backend/src/routes/settings.test.ts @@ -11,8 +11,8 @@ import { opencodeServerManager } from '../services/opencode-single-server' import type { GitAuthService } from '../services/git-auth' import type { OpenCodeSupervisor } from '../services/opencode-supervisor' import { createStubOpenCodeClient } from '../../test/helpers/stub-opencode-client' -import type { OpenCodeRestartCoordinator, ResumableSession } from '../services/opencode-restart-coordinator' -import { setOpenCodeRestartCoordinator } from '../services/opencode-restart' +import type { ActiveUserSession } from '../services/opencode-restart' +import { sseAggregator } from '../services/sse-aggregator' interface TestUserPreferenceRow { preferences: string @@ -453,7 +453,7 @@ describe('settings routes — opencode model discovery', () => { }) }) -describe('settings routes — restart coordinator wiring', () => { +describe('settings routes — active session reporting', () => { let db: Database let app: Hono @@ -463,52 +463,46 @@ describe('settings routes — restart coordinator wiring', () => { afterEach(() => { db.close() - setOpenCodeRestartCoordinator(null) + vi.restoreAllMocks() }) - it('GET /opencode-active-sessions returns count and sessions from coordinator', async () => { - const fakeCoordinator = { - captureResumableSessions: vi.fn(() => [{ - sessionID: 's1', - directory: '/a', - } satisfies ResumableSession]), - runWithResume: vi.fn(), - } as unknown as OpenCodeRestartCoordinator - setOpenCodeRestartCoordinator(fakeCoordinator) + function stubActiveSessions(active: Record, subagents: string[] = [], scheduled: string[] = []): void { + vi.spyOn(sseAggregator, 'getActiveSessions').mockReturnValue(active) + vi.spyOn(sseAggregator, 'isSubagentSession').mockImplementation((id: string) => subagents.includes(id)) + vi.spyOn(sseAggregator, 'getScheduledSessionIds').mockReturnValue(new Set(scheduled)) + } + + it('GET /opencode-active-sessions returns active user sessions excluding subagent and scheduled sessions', async () => { + stubActiveSessions({ '/a': ['s1', 'sub1', 'sched1'] }, ['sub1'], ['sched1']) app = createTestApp(db) const res = await app.request('/settings/opencode-active-sessions') expect(res.status).toBe(200) - const body = (await res.json()) as { count: number; sessions: ResumableSession[] } + const body = (await res.json()) as { count: number; sessions: ActiveUserSession[] } expect(body.count).toBe(1) expect(body.sessions).toEqual([{ sessionID: 's1', directory: '/a' }]) - expect(fakeCoordinator.captureResumableSessions).toHaveBeenCalledTimes(1) }) - it('GET /opencode-active-sessions returns empty when no coordinator', async () => { - setOpenCodeRestartCoordinator(null) + it('GET /opencode-active-sessions returns empty when nothing is active', async () => { + stubActiveSessions({}) app = createTestApp(db) const res = await app.request('/settings/opencode-active-sessions') expect(res.status).toBe(200) - const body = (await res.json()) as { count: number; sessions: ResumableSession[] } + const body = (await res.json()) as { count: number; sessions: ActiveUserSession[] } expect(body.count).toBe(0) expect(body.sessions).toEqual([]) }) - it('POST /opencode-restart routes through coordinator.runWithResume and returns resumedSessions', async () => { - const runWithResume = vi.fn().mockResolvedValue({ healthy: true, resumedSessionIDs: ['s1'] }) - const fakeCoordinator = { - captureResumableSessions: vi.fn(() => []), - runWithResume, - } as unknown as OpenCodeRestartCoordinator - setOpenCodeRestartCoordinator(fakeCoordinator) + it('POST /opencode-restart returns the sessions interrupted by the restart', async () => { + stubActiveSessions({ '/a': ['s1'] }) + const restart = vi.fn().mockResolvedValue({ healthy: true }) - app = createTestApp(db) + app = createTestApp(db, { restart } as unknown as OpenCodeSupervisor) const res = await app.request('/settings/opencode-restart', { method: 'POST' }) expect(res.status).toBe(200) - const body = (await res.json()) as { success: boolean; resumedSessions: string[] } + const body = (await res.json()) as { success: boolean; interruptedSessions: string[] } expect(body.success).toBe(true) - expect(body.resumedSessions).toEqual(['s1']) - expect(runWithResume).toHaveBeenCalledTimes(1) + expect(body.interruptedSessions).toEqual(['s1']) + expect(restart).toHaveBeenCalledWith('settings_restart') }) }) diff --git a/backend/src/routes/settings.ts b/backend/src/routes/settings.ts index ecf9e854..9af2b22c 100644 --- a/backend/src/routes/settings.ts +++ b/backend/src/routes/settings.ts @@ -6,14 +6,14 @@ import type { Database } from 'bun:sqlite' import { SettingsService } from '../services/settings' import { writeFileContent, readFileContent, fileExists } from '../services/file-operations' import { archiveBrokenOpenCodeConfigFile, deleteOpenCodeConfigFile } from '../services/opencode-config-file' -import { restoreLastKnownGoodOpenCodeConfig } from '../services/opencode-config-apply' +import { reloadOpenCodeOrMarkRestartPending, restoreLastKnownGoodOpenCodeConfig } from '../services/opencode-config-apply' import { createOpenCodeConfigRoutes } from './opencode-config' import type { OpenCodeClient } from '../services/opencode/client' import { getAgentsMdPath } from '@opencode-manager/shared/config/env' -import { openCodeLocation } from '@opencode-manager/shared/opencode' import { UserPreferencesSchema, type SandboxPreferences, + type UserPreferences, } from '../types/settings' import type { GitCredential } from '@opencode-manager/shared' import { @@ -22,7 +22,6 @@ import { SkillScopeSchema, InstallSkillFromGithubRequestSchema, InstallSkillUploadRequestSchema, - type SkillScope, } from '@opencode-manager/shared' import { logger } from '../utils/logger' import { @@ -34,12 +33,11 @@ import { sseAggregator } from '../services/sse-aggregator' import type { OpenCodeSupervisor } from '../services/opencode-supervisor' import { detectSandboxCapability } from '../services/sandbox/capability' import { getProcessIdentityAttestationError } from '../services/opencode/process-identity' -import { restartOpenCode, reloadOpenCodeConfig, getOpenCodeRestartCoordinator } from '../services/opencode-restart' +import { restartOpenCode, reloadOpenCodeConfig, assertValidOpenCodeConfig, listActiveUserSessions } from '../services/opencode-restart' import type { GitAuthService } from '../services/git-auth' import { DEFAULT_AGENTS_MD } from '../constants' import { validateSSHPrivateKey } from '../utils/ssh-validation' import { encryptSecret } from '../utils/crypto' -import { compareVersions, isValidVersion } from '../utils/version-utils' import { getImportedSessionDirectories, getOpenCodeImportStatus, OpenCodeImportProtectionError, syncOpenCodeImport } from '../services/opencode-import' import { relinkReposFromSessionDirectories } from '../services/repo' import { @@ -59,18 +57,14 @@ import { deleteOpenCodeDirectoryFile, } from '../services/opencode-directory-files' import { parseUploadManifest, readUploadedManifestFiles, UploadValidationError } from './upload-utils' -import { getRepoById } from '../db/queries' import { installOpenCodeVersion, latestOpenCodeVersion, listOpenCodeVersions } from '../services/opencode-installer' -import { OPENCODE_MIN_VERSION, isSupportedOpenCodeVersion } from '@opencode-manager/shared/opencode' - -async function restartOpenCodeSafe(openCodeSupervisor: OpenCodeSupervisor | undefined, context: string): Promise { - try { - await restartOpenCode(openCodeSupervisor) - logger.info(`Restarted OpenCode server after ${context}`) - } catch (restartError) { - logger.warn(`Failed to restart OpenCode server after ${context}:`, restartError) - } -} +import { + compareOpenCodeVersions, + describeUnsupportedOpenCodeVersion, + isStableOpenCodeVersion, + isSupportedOpenCodeVersion, + normalizeOpenCodeVersion, +} from '@opencode-manager/shared/opencode' async function installVerifiedOpenCodeVersion( version: string, @@ -93,42 +87,8 @@ async function installVerifiedOpenCodeVersion( return installedVersion } -async function dispatchSkillReload( - db: Database, - openCodeClient: OpenCodeClient, - openCodeSupervisor: OpenCodeSupervisor | undefined, - repoId: number, -): Promise { - const repo = getRepoById(db, repoId) - if (!repo) { - logger.warn(`Cannot dispatch skill reload: repo ${repoId} not found`) - return - } - - await restartOpenCodeSafe(openCodeSupervisor, 'skill install') - - try { - await openCodeClient.api.skill.list(openCodeLocation(repo.fullPath)) - logger.info(`Dispatched skill reload for project ${repo.fullPath}`) - } catch (dispatchError) { - logger.warn('Failed to dispatch skill reload:', dispatchError) - } -} - -async function reloadAfterSkillInstall( - db: Database, - openCodeClient: OpenCodeClient, - openCodeSupervisor: OpenCodeSupervisor | undefined, - scope: SkillScope, - repoId: number | undefined, -): Promise { - if (scope === 'project' && repoId !== undefined) { - await dispatchSkillReload(db, openCodeClient, openCodeSupervisor, repoId) - return false - } - - opencodeServerManager.markRestartPending() - return true +async function reloadOpenCodeForChange(openCodeClient: OpenCodeClient): Promise<{ restartRequired: boolean }> { + return { restartRequired: await reloadOpenCodeOrMarkRestartPending(openCodeClient) === 'restart_pending' } } const OPENCODE_DIRECTORY_UPLOAD_ERROR_STATUS: ReadonlyArray = [ @@ -195,6 +155,27 @@ function sandboxEnforcementChanged( return (previous?.enabled ?? false) !== next.enabled } +function preferenceChanged(previous: unknown, next: unknown): boolean { + return next !== undefined && JSON.stringify(previous) !== JSON.stringify(next) +} + +function listOpenCodeRestartReasons(previous: UserPreferences, next: Partial): string[] { + return [ + sandboxEnforcementChanged(previous.sandbox, next.sandbox) && 'sandbox', + preferenceChanged(previous.gitCredentials ?? [], next.gitCredentials) && 'git credentials', + preferenceChanged(previous.gitIdentity ?? {}, next.gitIdentity) && 'git identity', + preferenceChanged(previous.serverEnvVars ?? [], next.serverEnvVars) && 'server environment variables', + preferenceChanged(previous.disabledDefaultServerEnvVars ?? [], next.disabledDefaultServerEnvVars) && 'default server environment variables', + ].filter((reason): reason is string => typeof reason === 'string') +} + +function markOpenCodeRestartPendingFor(reasons: string[]): boolean { + if (reasons.length === 0) return false + logger.info(`${reasons.join(', ')} changed, marking OpenCode server restart as pending`) + opencodeServerManager.markRestartPending() + return true +} + function parseOptionalRepoId(value: string | undefined): number | undefined { if (value === undefined) return undefined const parsed = parseInt(value, 10) @@ -320,25 +301,9 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const settings = settingsService.updateSettings(validated.preferences, userId) - const sandboxChanged = sandboxEnforcementChanged(currentSettings.preferences.sandbox, validated.preferences.sandbox) - - const credentialsChanged = validated.preferences.gitCredentials !== undefined && - JSON.stringify(currentSettings.preferences.gitCredentials || []) !== JSON.stringify(validated.preferences.gitCredentials) - - const identityChanged = validated.preferences.gitIdentity !== undefined && - JSON.stringify(currentSettings.preferences.gitIdentity || {}) !== JSON.stringify(validated.preferences.gitIdentity) - - const restartReasons = [ - sandboxChanged && 'sandbox', - credentialsChanged && 'git credentials', - identityChanged && 'git identity', - ].filter((reason): reason is string => typeof reason === 'string') - - const restartRequired = restartReasons.length > 0 - if (restartRequired) { - logger.info(`${restartReasons.join(', ')} changed, marking OpenCode server restart as pending`) - opencodeServerManager.markRestartPending() - } + const restartRequired = markOpenCodeRestartPendingFor( + listOpenCodeRestartReasons(currentSettings.preferences, validated.preferences), + ) return c.json(restartRequired ? { ...settings, restartRequired: true } : settings) } catch (error) { @@ -359,13 +324,11 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const currentSettings = settingsService.getSettings(userId) const settings = settingsService.resetSettings(userId) - const sandboxChanged = sandboxEnforcementChanged(currentSettings.preferences.sandbox, settings.preferences.sandbox) - if (sandboxChanged) { - logger.info('Sandbox enforcement changed, marking OpenCode server restart as pending') - opencodeServerManager.markRestartPending() - } + const restartRequired = markOpenCodeRestartPendingFor( + listOpenCodeRestartReasons(currentSettings.preferences, settings.preferences), + ) - return c.json(sandboxChanged ? { ...settings, restartRequired: true } : settings) + return c.json(restartRequired ? { ...settings, restartRequired: true } : settings) } catch (error) { logger.error('Failed to reset settings:', error) return c.json({ error: 'Failed to reset settings' }, 500) @@ -379,11 +342,11 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic try { logger.info('Manual OpenCode server restart requested') opencodeServerManager.clearStartupError() - const { resumedSessionIDs } = await restartOpenCode(openCodeSupervisor) + const { interruptedSessionIDs } = await restartOpenCode(openCodeSupervisor) return c.json({ success: true, message: 'OpenCode server restarted successfully', - resumedSessions: resumedSessionIDs, + interruptedSessions: interruptedSessionIDs, }) } catch (error) { logger.error('Failed to restart OpenCode server:', error) @@ -471,11 +434,10 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic app.post('/opencode-reload', async (c) => { try { logger.info('OpenCode configuration reload requested') - const { resumedSessionIDs } = await reloadOpenCodeConfig(openCodeSupervisor) + await reloadOpenCodeConfig(openCodeClient) return c.json({ success: true, - message: 'OpenCode server restarted with the current configuration', - resumedSessions: resumedSessionIDs, + message: 'OpenCode configuration reloaded', }) } catch (error) { logger.error('Failed to reload OpenCode config:', error) @@ -508,9 +470,10 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic logger.info('Rolled back to the previous working config') try { - await reloadOpenCodeConfig(openCodeSupervisor) + await assertValidOpenCodeConfig() + await restartOpenCode(openCodeSupervisor) } catch (reloadError) { - logger.error('Rollback config reload failed, attempting restart:', reloadError) + logger.error('Rollback config restart failed, attempting restart without the config file:', reloadError) await archiveBrokenOpenCodeConfigFile() const deleted = await deleteOpenCodeConfigFile() @@ -536,7 +499,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic return c.json({ success: true, - message: 'Server reloaded with the previous working config', + message: 'Server restarted with the previous working config', }) } catch (error) { logger.error('Failed to rollback OpenCode config:', error) @@ -552,7 +515,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const latestVersion = await latestOpenCodeVersion() logger.info(`Latest OpenCode version: ${latestVersion}`) - if (oldVersion && compareVersions(latestVersion, oldVersion) <= 0) { + if (oldVersion && isSupportedOpenCodeVersion(oldVersion) && compareOpenCodeVersions(latestVersion, oldVersion) <= 0) { logger.info('OpenCode is already up to date or version unchanged') return c.json({ success: true, @@ -663,12 +626,12 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const body = await c.req.json() const { version } = z.object({ version: z.string().min(1) }).parse(body) - requestedVersion = version.replace(/^v/, '').trim() - if (!isValidVersion(requestedVersion)) { + requestedVersion = normalizeOpenCodeVersion(version) + if (!isStableOpenCodeVersion(requestedVersion)) { return c.json({ error: 'Invalid version format. Must be in MAJOR.MINOR.PATCH format (e.g., 2.0.15)' }, 400) } if (!isSupportedOpenCodeVersion(requestedVersion)) { - return c.json({ error: `OpenCode ${OPENCODE_MIN_VERSION} or newer is required` }, 400) + return c.json({ error: describeUnsupportedOpenCodeVersion(requestedVersion) }, 400) } } catch (error) { logger.error('Failed to parse OpenCode version install request:', error) @@ -853,10 +816,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic await writeFileContent(agentsMdPath, content) logger.info(`Updated AGENTS.md at: ${agentsMdPath}`) - await restartOpenCode(openCodeSupervisor) - logger.info('Restarted OpenCode server after AGENTS.md update') - - return c.json({ success: true }) + return c.json({ success: true, ...await reloadOpenCodeForChange(openCodeClient) }) } catch (error) { logger.error('Failed to update AGENTS.md:', error) if (error instanceof z.ZodError) { @@ -898,9 +858,8 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const files = await readUploadedManifestFiles(formData, markdownManifest) const result = await installOpenCodeDirectoryFiles(kind, files) - opencodeServerManager.markRestartPending() - return c.json({ ...result, restartRequired: true }) + return c.json({ ...result, ...await reloadOpenCodeForChange(openCodeClient) }) } catch (error) { logger.error('Failed to install OpenCode directory files:', error) @@ -960,9 +919,8 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic .parse(body) const result = await updateOpenCodeDirectoryFile(kind, relativePath, content) - opencodeServerManager.markRestartPending() - return c.json({ ...result, restartRequired: true }) + return c.json({ ...result, ...await reloadOpenCodeForChange(openCodeClient) }) } catch (error) { return handleOpenCodeDirectoryFileError(c, error, 'update') } @@ -974,9 +932,8 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const relativePath = z.string().min(1).parse(c.req.query('relativePath')) await deleteOpenCodeDirectoryFile(kind, relativePath) - opencodeServerManager.markRestartPending() - return c.json({ kind, relativePath, restartRequired: true }) + return c.json({ kind, relativePath, ...await reloadOpenCodeForChange(openCodeClient) }) } catch (error) { return handleOpenCodeDirectoryFileError(c, error, 'delete') } @@ -996,9 +953,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const result = await installSkillFromGithubTree(db, validated) - const restartRequired = await reloadAfterSkillInstall(db, openCodeClient, openCodeSupervisor, validated.scope, validated.repoId) - - return c.json({ ...result, restartRequired }) + return c.json({ ...result, ...await reloadOpenCodeForChange(openCodeClient) }) } if (contentType.includes('multipart/form-data')) { @@ -1032,9 +987,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const result = await installSkillFromUploadedFiles(db, uploadRequest, files) - const restartRequired = await reloadAfterSkillInstall(db, openCodeClient, openCodeSupervisor, uploadRequest.scope, uploadRequest.repoId) - - return c.json({ ...result, restartRequired }) + return c.json({ ...result, ...await reloadOpenCodeForChange(openCodeClient) }) } return c.json({ error: 'Unsupported content type. Use application/json or multipart/form-data' }, 400) @@ -1097,9 +1050,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const skill = await createSkill(db, validated) - opencodeServerManager.markRestartPending() - - return c.json({ ...skill, restartRequired: true }) + return c.json({ ...skill, ...await reloadOpenCodeForChange(openCodeClient) }) } catch (error) { logger.error('Failed to create skill:', error) if (error instanceof z.ZodError) { @@ -1126,9 +1077,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic const skill = await updateSkill(db, openCodeClient, name, scope, validated, repoId) - opencodeServerManager.markRestartPending() - - return c.json({ ...skill, restartRequired: true }) + return c.json({ ...skill, ...await reloadOpenCodeForChange(openCodeClient) }) } catch (error) { logger.error('Failed to update skill:', error) if (error instanceof z.ZodError) { @@ -1159,9 +1108,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic await deleteSkill(db, name, scope, repoId) - opencodeServerManager.markRestartPending() - - return c.json({ success: true, restartRequired: true }) + return c.json({ success: true, ...await reloadOpenCodeForChange(openCodeClient) }) } catch (error) { logger.error('Failed to delete skill:', error) if (error instanceof z.ZodError) { @@ -1369,7 +1316,7 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic }) app.get('/opencode-active-sessions', (c) => { - const sessions = getOpenCodeRestartCoordinator()?.captureResumableSessions() ?? [] + const sessions = listActiveUserSessions() return c.json({ count: sessions.length, sessions }) }) diff --git a/backend/src/services/assistant-mode.ts b/backend/src/services/assistant-mode.ts index 3c90b983..39042190 100644 --- a/backend/src/services/assistant-mode.ts +++ b/backend/src/services/assistant-mode.ts @@ -691,9 +691,9 @@ Returns the updated settings object with the same structure as GET. ### POST /assistant/reload -Reload the OpenCode server configuration, rebuilding every loaded location. Use this after editing \`.opencode/agents/assistant.md\` or \`opencode.json\` so changes take effect on the next message. +Reload the OpenCode configuration without restarting the server, rebuilding every loaded location. OpenCode re-reads \`opencode.json\`/\`opencode.jsonc\`, agents, commands, skills, plugins, and \`AGENTS.md\`; running sessions, including this one, keep running. Use this after editing \`.opencode/agents/assistant.md\` or other workspace files so changes take effect on the next message. Returns \`400\` with \`validationIssues\` when the OpenCode configuration is invalid. -**Note:** Always confirm with the user before reloading, as it re-bootstraps the workspace. +**Note:** Always confirm with the user before reloading. **Rate Limiting:** 5 requests per minute per token. Returns \`429 Too Many Requests\` with \`Retry-After\` header when exceeded. @@ -775,17 +775,21 @@ For a raw edit, send a string with the exact source name from \`sources\`. Never \`\`\` **Response:** -Returns the refreshed merged configuration and source files. Adds \`restartRequired: true\` for semantic configuration changes, except changes limited to \`mcp\`, which are saved without it; to make an MCP change take effect immediately, tell the user to reconnect or reload the server from Settings → MCP. Comment-only changes do not require a restart. Saving never silently drops unsupported fields. +Returns the refreshed merged configuration and source files. A semantic change is applied automatically: the Manager reloads OpenCode without restarting the server, so agents, permissions, providers, models, and plugins take effect on the next message and running sessions keep running. Changes limited to \`mcp\` are saved without a reload; to make an MCP change take effect immediately, tell the user to reconnect the server from Settings → MCP. Comment-only changes do nothing. Saving never silently drops unsupported fields. + +The response adds \`restartRequired: true\` only when the automatic reload failed, for example because the OpenCode server is unavailable. Returns \`400\` for invalid configuration and \`409\` for a stale revision. When the response contains \`restartRequired: true\`, tell the user to restart the OpenCode server from Settings. Never attempt the restart yourself: it would terminate your own session. +Only changes to how the OpenCode process is launched need a user restart from Settings: server environment variables, Git credentials and identity, sandbox enforcement, rotating the manager token, the server password, and installing or upgrading the OpenCode version. You cannot make these changes through this API. + ## Safety - The settings PATCH endpoint rejects any attempt to modify credentials, API keys, or other sensitive settings; guide the user to the full UI for Git, TTS, and STT credentials - PUT /opencode-config patches changed global settings, including \`plugin\`, \`mcp\`, and \`provider\` entries; change only the keys the user explicitly asked for and never add plugins, MCP servers, or provider credentials the user did not request -- The settings PATCH endpoint does NOT trigger OpenCode reload or restart +- The settings PATCH endpoint does NOT trigger an OpenCode reload or restart ` } diff --git a/backend/src/services/notification.ts b/backend/src/services/notification.ts index f43f70eb..6843c9ce 100644 --- a/backend/src/services/notification.ts +++ b/backend/src/services/notification.ts @@ -23,6 +23,7 @@ import { import type { Repo } from "../types/repo"; import { getReposPath } from "@opencode-manager/shared/config/env"; import { ASSISTANT_REPO_ID } from "@opencode-manager/shared/utils"; +import { sessionIDFromEvent } from "@opencode-manager/shared/opencode"; import { resolveProjectId } from "./project-id-resolver"; import path from "path"; @@ -74,9 +75,7 @@ function resolveEventSessionId(event: SSEEvent): string | undefined { if (event.type === NotificationEventType.FORM_CREATED) { return event.data.form.sessionID; } - return "sessionID" in event.data && typeof event.data.sessionID === "string" - ? event.data.sessionID - : undefined; + return sessionIDFromEvent(event); } export function buildNotificationUrl( diff --git a/backend/src/services/opencode-config-apply.ts b/backend/src/services/opencode-config-apply.ts index c4b0e154..91b238a9 100644 --- a/backend/src/services/opencode-config-apply.ts +++ b/backend/src/services/opencode-config-apply.ts @@ -13,19 +13,28 @@ import { withOpenCodeConfigLock, } from './opencode-config-file' import { opencodeServerManager } from './opencode-single-server' +import { reloadOpenCodeConfig } from './opencode-restart' +import type { OpenCodeClient } from './opencode/client' import type { SettingsService } from './settings' +import { logger } from '../utils/logger' + +export type OpenCodeReloadOutcome = 'reloaded' | 'restart_pending' export type ApplyOpenCodeConfigResult = - | { status: 'restart_pending'; config: OpenCodeConfigFile } | { status: 'applied'; config: OpenCodeConfigFile } + | { status: 'reloaded'; config: OpenCodeConfigFile } + | { status: 'restart_pending'; config: OpenCodeConfigFile } export interface ApplyOpenCodeConfigInput { content: Record | string source?: OpenCodeConfigSourceName expectedRevision?: string settingsService: SettingsService + openCodeClient: OpenCodeClient } +const MCP_CONFIG_KEY = 'mcp' + export async function captureLastKnownGoodOpenCodeConfig(settingsService: SettingsService): Promise { const previous = await readOpenCodeConfigFile() if (previous?.isValid) { @@ -66,26 +75,33 @@ export function toOpenCodeConfigApplyResponse( } } -function requiresOpenCodeRestart(previous: OpenCodeConfigFile | null, next: OpenCodeConfigFile): boolean { +export async function reloadOpenCodeOrMarkRestartPending(openCodeClient: OpenCodeClient): Promise { + try { + await reloadOpenCodeConfig(openCodeClient) + return 'reloaded' + } catch (error) { + logger.warn('OpenCode configuration reload failed, marking a server restart as pending:', error) + opencodeServerManager.markRestartPending() + return 'restart_pending' + } +} + +function listChangedTopLevelKeys(previous: Record, next: Record): string[] { + const keys = new Set([...Object.keys(previous), ...Object.keys(next)]) + return [...keys].filter((key) => !isDeepStrictEqual(previous[key], next[key])) +} + +function requiresOpenCodeReload(previous: OpenCodeConfigFile | null, next: OpenCodeConfigFile): boolean { if (previous?.isValid !== next.isValid) { return true } - - const previousContent = previous?.content ?? {} - const keys = new Set([...Object.keys(previousContent), ...Object.keys(next.content)]) - for (const key of keys) { - if (!isDeepStrictEqual(previousContent[key], next.content[key]) && key !== 'mcp') { - return true - } - } - - return false + return listChangedTopLevelKeys(previous?.content ?? {}, next.content).some((key) => key !== MCP_CONFIG_KEY) } export async function applyOpenCodeConfigUpdate( input: ApplyOpenCodeConfigInput, ): Promise { - return withOpenCodeConfigLock(async () => { + const { reloadRequired, config } = await withOpenCodeConfigLock(async () => { const { content, source, expectedRevision, settingsService } = input const snapshot = await readOpenCodeConfigSnapshot() @@ -103,11 +119,12 @@ export async function applyOpenCodeConfigUpdate( } } - if (requiresOpenCodeRestart(previous, next)) { - opencodeServerManager.markRestartPending() - return { status: 'restart_pending', config: next } - } - - return { status: 'applied', config: next } + return { reloadRequired: requiresOpenCodeReload(previous, next), config: next } }) + + if (!reloadRequired) { + return { status: 'applied', config } + } + + return { status: await reloadOpenCodeOrMarkRestartPending(input.openCodeClient), config } } diff --git a/backend/src/services/opencode-installer.ts b/backend/src/services/opencode-installer.ts index 156b8692..b7e7451c 100644 --- a/backend/src/services/opencode-installer.ts +++ b/backend/src/services/opencode-installer.ts @@ -1,20 +1,26 @@ import { spawnSync } from 'child_process' -import { promises as fs, readdirSync } from 'fs' +import { createWriteStream, promises as fs, readdirSync } from 'fs' import os from 'os' import path from 'path' +import { Readable } from 'stream' +import { pipeline } from 'stream/promises' +import type { ReadableStream as WebReadableStream } from 'stream/web' import { - OPENCODE_MIN_VERSION, buildOpenCodeReleaseAsset, + compareOpenCodeVersions, + describeUnsupportedOpenCodeVersion, + isStableOpenCodeVersion, isSupportedOpenCodeVersion, + normalizeOpenCodeVersion, + parseOpenCodeVersionOutput, } from '@opencode-manager/shared/opencode' import { mkdirSafe } from '../utils/fs-safe' -import { compareVersions } from '../utils/version-utils' import { getOpenCodeHome } from './opencode-home' const OPENCODE_REGISTRY_URL = 'https://registry.npmjs.org/@opencode/cli' -const OPENCODE_STABLE_VERSION_PATTERN = /^\d+\.\d+\.\d+$/ +const OPENCODE_REGISTRY_LATEST_URL = `${OPENCODE_REGISTRY_URL}/latest` +const OPENCODE_VERSION_CACHE_TTL_MS = 5 * 60 * 1000 const OPENCODE_MUSL_LOADER_PREFIX = 'ld-musl-' -const OPENCODE_VERSION_PATTERN = /(\d+\.\d+\.\d+)/ export interface OpenCodeInstallTarget { platform: NodeJS.Platform @@ -33,12 +39,27 @@ export interface InstallOpenCodeOptions { target?: OpenCodeInstallTarget } +export interface OpenCodeRegistryOptions { + fetch?: typeof fetch + now?: () => number +} + interface OpenCodeRegistry { - 'dist-tags'?: Record versions?: Record time?: Record } +interface OpenCodeRegistryLatest { + version?: unknown +} + +interface CachedOpenCodeReleases { + releases: OpenCodeRelease[] + fetchedAt: number +} + +let cachedOpenCodeReleases: CachedOpenCodeReleases | null = null + export function resolveOpenCodeBinaryPath(homeDirectory: string): string { return path.join(homeDirectory, '.opencode', 'bin', 'opencode') } @@ -59,42 +80,62 @@ function hasMuslLoader(): boolean { } } -async function fetchOpenCodeRegistry(fetchFn: typeof fetch): Promise { - const response = await fetchFn(OPENCODE_REGISTRY_URL) +function isInstallableOpenCodeVersion(version: string): boolean { + return isStableOpenCodeVersion(version) && isSupportedOpenCodeVersion(version) +} + +async function fetchOpenCodeRegistryJson(fetchFn: typeof fetch, url: string): Promise { + const response = await fetchFn(url) if (!response.ok) { throw new Error(`Failed to fetch OpenCode releases: registry responded with HTTP ${response.status}`) } - return await response.json() as OpenCodeRegistry + return await response.json() as T } -export async function listOpenCodeVersions(fetchFn: typeof fetch = fetch): Promise { - const registry = await fetchOpenCodeRegistry(fetchFn) +export function clearOpenCodeVersionCache(): void { + cachedOpenCodeReleases = null +} + +export async function listOpenCodeVersions(options: OpenCodeRegistryOptions = {}): Promise { + const now = (options.now ?? Date.now)() + if (cachedOpenCodeReleases && now - cachedOpenCodeReleases.fetchedAt < OPENCODE_VERSION_CACHE_TTL_MS) { + return cachedOpenCodeReleases.releases + } + + const registry = await fetchOpenCodeRegistryJson(options.fetch ?? fetch, OPENCODE_REGISTRY_URL) const publishedTimes = registry.time ?? {} - return Object.keys(registry.versions ?? {}) - .filter((version) => OPENCODE_STABLE_VERSION_PATTERN.test(version) && isSupportedOpenCodeVersion(version)) + const releases = Object.keys(registry.versions ?? {}) + .filter(isInstallableOpenCodeVersion) .map((version) => ({ version, publishedAt: typeof publishedTimes[version] === 'string' ? publishedTimes[version] as string : null, })) - .sort((left, right) => compareVersions(right.version, left.version)) + .sort((left, right) => compareOpenCodeVersions(right.version, left.version)) + + cachedOpenCodeReleases = { releases, fetchedAt: now } + return releases } -export async function latestOpenCodeVersion(fetchFn: typeof fetch = fetch): Promise { - const registry = await fetchOpenCodeRegistry(fetchFn) - const latest = registry['dist-tags']?.latest - if (typeof latest !== 'string' || !isSupportedOpenCodeVersion(latest)) { - throw new Error(`OpenCode registry latest release is not a supported version: ${String(latest)}`) +export async function latestOpenCodeVersion(options: OpenCodeRegistryOptions = {}): Promise { + const latest = await fetchOpenCodeRegistryJson(options.fetch ?? fetch, OPENCODE_REGISTRY_LATEST_URL) + if (typeof latest.version !== 'string' || !isInstallableOpenCodeVersion(latest.version)) { + throw new Error(`OpenCode registry latest release is not a supported version: ${String(latest.version)}`) } - return latest.trim().replace(/^v/, '') + return normalizeOpenCodeVersion(latest.version) +} + +async function downloadToFile(response: Response, filePath: string): Promise { + if (!response.body) throw new Error('OpenCode download returned an empty body') + await pipeline(Readable.fromWeb(response.body as WebReadableStream), createWriteStream(filePath)) } export async function installOpenCodeVersion( version: string, options: InstallOpenCodeOptions = {}, ): Promise { - const requestedVersion = version.trim().replace(/^v/, '') - if (!isSupportedOpenCodeVersion(requestedVersion)) { - throw new Error(`OpenCode ${OPENCODE_MIN_VERSION} or newer is required; refusing to install ${version}`) + const requestedVersion = normalizeOpenCodeVersion(version) + if (!isInstallableOpenCodeVersion(requestedVersion)) { + throw new Error(`${describeUnsupportedOpenCodeVersion(version)}; refusing to install it`) } const fetchFn = options.fetch ?? fetch @@ -109,7 +150,7 @@ export async function installOpenCodeVersion( if (!response.ok) { throw new Error(`Failed to download OpenCode ${requestedVersion} from ${asset.url}: HTTP ${response.status}`) } - await fs.writeFile(archivePath, new Uint8Array(await response.arrayBuffer())) + await downloadToFile(response, archivePath) const extraction = asset.archive === 'zip' ? spawnSync('unzip', ['-o', archivePath, '-d', stagingDirectory], { encoding: 'utf8' }) @@ -125,7 +166,7 @@ export async function installOpenCodeVersion( await fs.chmod(stagedBinaryPath, 0o755) const probe = spawnSync(stagedBinaryPath, ['--version'], { encoding: 'utf8' }) - const detectedVersion = `${probe.stdout ?? ''}${probe.stderr ?? ''}`.match(OPENCODE_VERSION_PATTERN)?.[1] + const detectedVersion = parseOpenCodeVersionOutput(`${probe.stdout ?? ''}${probe.stderr ?? ''}`) if (detectedVersion !== requestedVersion) { throw new Error(`Downloaded OpenCode binary reports ${detectedVersion ?? 'no version'}; expected ${requestedVersion}`) } diff --git a/backend/src/services/opencode-manager-tool-plugin.ts b/backend/src/services/opencode-manager-tool-plugin.ts index baf4d977..b1786bf1 100644 --- a/backend/src/services/opencode-manager-tool-plugin.ts +++ b/backend/src/services/opencode-manager-tool-plugin.ts @@ -3,7 +3,7 @@ import { ASSISTANT_NOTIFICATION_LIMITS } from '@opencode-manager/shared/schemas' export const MANAGER_TOOL_NAME = 'ocm' -export const MANAGER_TOOL_REQUEST_TIMEOUT_MS = 15000 +const MANAGER_TOOL_REQUEST_TIMEOUT_MS = 15000 export const MANAGER_TOOL_ALLOWED_ROUTES = [ 'GET /settings', @@ -30,11 +30,11 @@ export const MANAGER_TOOL_ALLOWED_ROUTES = [ 'POST /repos/*/schedules/*/runs/*/cancel', ] as const -export const MANAGER_TOOL_ALLOWED_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] as const +const MANAGER_TOOL_ALLOWED_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] as const -export const MANAGER_TOOL_ACTION_NAMES = ['send_notification', 'request'] as const +const MANAGER_TOOL_ACTION_NAMES = ['send_notification', 'request'] as const -export const ManagerToolNotificationParamsSchema = z +const ManagerToolNotificationParamsSchema = z .object({ title: z.string().min(1).max(ASSISTANT_NOTIFICATION_LIMITS.TITLE_MAX).describe('The notification title.'), body: z.string().min(1).max(ASSISTANT_NOTIFICATION_LIMITS.BODY_MAX).describe('The notification body.'), @@ -45,7 +45,7 @@ export const ManagerToolNotificationParamsSchema = z .strict() .describe('Send a push notification to every device the user has registered.') -export const ManagerToolRequestParamsSchema = z +const ManagerToolRequestParamsSchema = z .object({ method: z.enum(MANAGER_TOOL_ALLOWED_METHODS).describe('The HTTP method for the internal API route.'), path: z.string().min(1).max(500).describe('The internal API route path, such as /settings or /repos/0/schedules. Query strings are allowed.'), @@ -80,7 +80,7 @@ function requiredKeysOf(schema: z.ZodType): string[] { return jsonSchema.required ?? [] } -export function buildManagerToolInputJsonSchema(): Record { +function buildManagerToolInputJsonSchema(): Record { const jsonSchema: Record = z.toJSONSchema( z .object({ @@ -95,7 +95,7 @@ export function buildManagerToolInputJsonSchema(): Record { return jsonSchema } -export function buildManagerToolActionRequiredKeys(): Record { +function buildManagerToolActionRequiredKeys(): Record { return Object.fromEntries(MANAGER_TOOL_ACTION_NAMES.map((name) => [name, requiredKeysOf(MANAGER_TOOL_ACTION_PARAMS_SCHEMAS[name])])) } diff --git a/backend/src/services/opencode-restart-coordinator.test.ts b/backend/src/services/opencode-restart-coordinator.test.ts deleted file mode 100644 index 118d2c28..00000000 --- a/backend/src/services/opencode-restart-coordinator.test.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' -import { OpenCodeRestartCoordinator, type ActiveSessionsProvider } from './opencode-restart-coordinator' - -vi.mock('../utils/logger', () => ({ - logger: { - info: vi.fn(), - warn: vi.fn(), - error: vi.fn(), - }, -})) - -function createFakeActiveSessionsProvider(overrides: Partial = {}): ActiveSessionsProvider { - return { - getActiveSessions: vi.fn(() => ({})), - isSubagentSession: vi.fn(() => false), - getScheduledSessionIds: vi.fn(() => new Set()), - ...overrides, - } -} - -describe('OpenCodeRestartCoordinator', () => { - let activeSessions: ActiveSessionsProvider - let coordinator: OpenCodeRestartCoordinator - - beforeEach(() => { - activeSessions = createFakeActiveSessionsProvider() - coordinator = new OpenCodeRestartCoordinator(activeSessions) - }) - - describe('captureResumableSessions', () => { - it('excludes subagent sessions', () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({ - '/a': ['s1', 'sub1'], - '/b': ['s2'], - }) - vi.mocked(activeSessions.isSubagentSession).mockImplementation((id: string) => id === 'sub1') - - const result = coordinator.captureResumableSessions() - - expect(result).toEqual([ - { sessionID: 's1', directory: '/a' }, - { sessionID: 's2', directory: '/b' }, - ]) - }) - - it('returns empty array when no active sessions', () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({}) - - const result = coordinator.captureResumableSessions() - - expect(result).toEqual([]) - }) - - it('filters out only subagent sessions, keeps all others', () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({ - '/x': ['a1', 'a2', 'sub_x'], - }) - vi.mocked(activeSessions.isSubagentSession).mockImplementation((id: string) => id.startsWith('sub_')) - - const result = coordinator.captureResumableSessions() - - expect(result).toEqual([ - { sessionID: 'a1', directory: '/x' }, - { sessionID: 'a2', directory: '/x' }, - ]) - }) - - it('excludes scheduled sessions', () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({ - '/a': ['s1', 'sched1'], - }) - vi.mocked(activeSessions.getScheduledSessionIds).mockReturnValue(new Set(['sched1'])) - - const result = coordinator.captureResumableSessions() - - expect(result).toEqual([{ sessionID: 's1', directory: '/a' }]) - }) - - it('excludes both subagent and scheduled sessions simultaneously', () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({ - '/p': ['manual', 'sub', 'sched'], - }) - vi.mocked(activeSessions.isSubagentSession).mockImplementation((id: string) => id === 'sub') - vi.mocked(activeSessions.getScheduledSessionIds).mockReturnValue(new Set(['sched'])) - - const result = coordinator.captureResumableSessions() - - expect(result).toEqual([{ sessionID: 'manual', directory: '/p' }]) - }) - }) - - describe('runWithResume', () => { - it('restarts and reports the captured running sessions without any api calls', async () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({ - '/a': ['s1'], - '/b': ['s2'], - }) - - const restart = vi.fn(async () => true) - - const result = await coordinator.runWithResume(restart) - - expect(restart).toHaveBeenCalledOnce() - expect(result).toEqual({ healthy: true, resumedSessionIDs: ['s1', 's2'] }) - }) - - it('reports no resumed sessions when the restart returns unhealthy', async () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({ - '/a': ['s1'], - }) - - const restart = vi.fn(async () => false) - - const result = await coordinator.runWithResume(restart) - - expect(restart).toHaveBeenCalledOnce() - expect(result).toEqual({ healthy: false, resumedSessionIDs: [] }) - }) - - it('with no active sessions performs restart only', async () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({}) - - const restart = vi.fn(async () => true) - - const result = await coordinator.runWithResume(restart) - - expect(restart).toHaveBeenCalledOnce() - expect(result).toEqual({ healthy: true, resumedSessionIDs: [] }) - }) - - it('does not report subagent or scheduled sessions', async () => { - vi.mocked(activeSessions.getActiveSessions).mockReturnValue({ - '/a': ['manual1', 'sub1', 'sched1'], - }) - vi.mocked(activeSessions.isSubagentSession).mockImplementation((id: string) => id === 'sub1') - vi.mocked(activeSessions.getScheduledSessionIds).mockReturnValue(new Set(['sched1'])) - - const restart = vi.fn(async () => true) - - const result = await coordinator.runWithResume(restart) - - expect(result).toEqual({ healthy: true, resumedSessionIDs: ['manual1'] }) - }) - }) -}) diff --git a/backend/src/services/opencode-restart-coordinator.ts b/backend/src/services/opencode-restart-coordinator.ts deleted file mode 100644 index c91f489b..00000000 --- a/backend/src/services/opencode-restart-coordinator.ts +++ /dev/null @@ -1,44 +0,0 @@ -export interface ActiveSessionsProvider { - getActiveSessions(): Record - isSubagentSession(sessionId: string): boolean - getScheduledSessionIds(): Set -} - -export interface ResumableSession { - sessionID: string - directory: string -} - -export interface RestartWithResumeResult { - healthy: boolean - resumedSessionIDs: string[] -} - -export class OpenCodeRestartCoordinator { - constructor(private readonly activeSessions: ActiveSessionsProvider) {} - - captureResumableSessions(): ResumableSession[] { - const active = this.activeSessions.getActiveSessions() - const scheduled = this.activeSessions.getScheduledSessionIds() - const sessions: ResumableSession[] = [] - - for (const [directory, sessionIDs] of Object.entries(active)) { - for (const sessionID of sessionIDs) { - if (!this.activeSessions.isSubagentSession(sessionID) && !scheduled.has(sessionID)) { - sessions.push({ sessionID, directory }) - } - } - } - - return sessions - } - - async runWithResume(restart: () => Promise): Promise { - const sessions = this.captureResumableSessions() - const healthy = await restart() - return { - healthy, - resumedSessionIDs: healthy ? sessions.map((session) => session.sessionID) : [], - } - } -} diff --git a/backend/src/services/opencode-restart.ts b/backend/src/services/opencode-restart.ts index 7458f461..ef0c16af 100644 --- a/backend/src/services/opencode-restart.ts +++ b/backend/src/services/opencode-restart.ts @@ -1,21 +1,31 @@ import { opencodeServerManager, ConfigReloadError } from './opencode-single-server' import { readOpenCodeConfigFile } from './opencode-config-file' +import { sseAggregator } from './sse-aggregator' +import type { OpenCodeClient } from './opencode/client' import type { OpenCodeOperationReason, OpenCodeSupervisor } from './opencode-supervisor' -import type { OpenCodeRestartCoordinator } from './opencode-restart-coordinator' -let restartCoordinator: OpenCodeRestartCoordinator | null = null - -/** - * Registers the process-wide restart coordinator so every restart path can - * abort and resume in-flight sessions consistently. Passing null disables - * resume (used by tests and pre-initialization paths). - */ -export function setOpenCodeRestartCoordinator(coordinator: OpenCodeRestartCoordinator | null): void { - restartCoordinator = coordinator +export interface ActiveSessionsSource { + getActiveSessions(): Record + isSubagentSession(sessionId: string): boolean + getScheduledSessionIds(): Set } -export function getOpenCodeRestartCoordinator(): OpenCodeRestartCoordinator | null { - return restartCoordinator +export interface ActiveUserSession { + sessionID: string + directory: string +} + +export interface OpenCodeRestartResult { + interruptedSessionIDs: string[] +} + +export function listActiveUserSessions(source: ActiveSessionsSource = sseAggregator): ActiveUserSession[] { + const scheduled = source.getScheduledSessionIds() + return Object.entries(source.getActiveSessions()).flatMap(([directory, sessionIDs]) => + sessionIDs + .filter((sessionID) => !source.isSubagentSession(sessionID) && !scheduled.has(sessionID)) + .map((sessionID) => ({ sessionID, directory })), + ) } function restartFailureError(): Error { @@ -23,55 +33,28 @@ function restartFailureError(): Error { return new Error(startupError ?? 'OpenCode server restart did not complete successfully') } -async function performRestart(supervisor: OpenCodeSupervisor | undefined, reason: OpenCodeOperationReason): Promise { +async function restartServer(supervisor: OpenCodeSupervisor | undefined, reason: OpenCodeOperationReason): Promise { if (supervisor) { return (await supervisor.restart(reason)).healthy } opencodeServerManager.clearStartupError() await opencodeServerManager.restart() - const healthy = await opencodeServerManager.checkHealth() - if (!healthy) { - throw restartFailureError() - } - return healthy + return opencodeServerManager.checkHealth() } -/** - * The single entry point for restarting the OpenCode server. Every restart - * trigger (manual restart, version upgrade/install, workspace config change, - * restart-sensitive config saves) routes through here so that interrupted user - * sessions are aborted and resumed uniformly when a coordinator is registered. - * A full process restart drops in-flight sessions; resuming re-issues a - * "continue" prompt once the server is healthy again. - */ export async function restartOpenCode( supervisor?: OpenCodeSupervisor, reason: OpenCodeOperationReason = 'settings_restart', -): Promise<{ resumedSessionIDs: string[] }> { - if (restartCoordinator) { - const result = await restartCoordinator.runWithResume(() => performRestart(supervisor, reason)) - if (!result.healthy) { - throw restartFailureError() - } - return { resumedSessionIDs: result.resumedSessionIDs } +): Promise { + const interruptedSessionIDs = listActiveUserSessions().map((session) => session.sessionID) + const healthy = await restartServer(supervisor, reason) + if (!healthy) { + throw restartFailureError() } - if (supervisor) { - const status = await supervisor.restart(reason) - if (!status.healthy) { - throw restartFailureError() - } - } else { - opencodeServerManager.clearStartupError() - await opencodeServerManager.restart() - const healthy = await opencodeServerManager.checkHealth() - if (!healthy) { - throw restartFailureError() - } - } - return { resumedSessionIDs: [] } + return { interruptedSessionIDs } } -export async function reloadOpenCodeConfig(supervisor?: OpenCodeSupervisor): Promise<{ resumedSessionIDs: string[] }> { +export async function assertValidOpenCodeConfig(): Promise { const config = await readOpenCodeConfigFile() if (!config) { throw new ConfigReloadError('No OpenCode global configuration files found') @@ -79,5 +62,9 @@ export async function reloadOpenCodeConfig(supervisor?: OpenCodeSupervisor): Pro if (!config.isValid) { throw new ConfigReloadError('OpenCode global configuration is invalid', config.validationIssues) } - return restartOpenCode(supervisor, 'settings_reload') +} + +export async function reloadOpenCodeConfig(openCodeClient: OpenCodeClient): Promise { + await assertValidOpenCodeConfig() + await openCodeClient.api.location.reload() } diff --git a/backend/src/services/opencode-service-mode.ts b/backend/src/services/opencode-service-mode.ts new file mode 100644 index 00000000..7179c45f --- /dev/null +++ b/backend/src/services/opencode-service-mode.ts @@ -0,0 +1,31 @@ +import path from 'path' +import { promises as fs } from 'fs' +import { writeFileAtomic } from '../utils/fs-safe' + +const OPENCODE_APP_DIRECTORY = 'opencode' +const OPENCODE_SERVICE_FILENAME = 'service.json' + +export const OPENCODE_SERVICE_SERVE_ARGS = ['serve', '--service'] as const + +export type OpenCodeServiceEnv = { + XDG_CONFIG_HOME: string + XDG_STATE_HOME: string + OPENCODE_CONFIG_DIR?: string +} + +function resolveOpenCodeGlobalConfigDirectory(env: OpenCodeServiceEnv): string { + return env.OPENCODE_CONFIG_DIR || path.join(env.XDG_CONFIG_HOME, OPENCODE_APP_DIRECTORY) +} + +export function getOpenCodeServiceSettingsPath(env: OpenCodeServiceEnv): string { + return path.join(resolveOpenCodeGlobalConfigDirectory(env), OPENCODE_SERVICE_FILENAME) +} + +export function getOpenCodeServiceRegistrationPath(env: OpenCodeServiceEnv): string { + return path.join(env.XDG_STATE_HOME, OPENCODE_APP_DIRECTORY, OPENCODE_SERVICE_FILENAME) +} + +export async function prepareOpenCodeServiceLaunch(env: OpenCodeServiceEnv, password: string): Promise { + await fs.rm(getOpenCodeServiceRegistrationPath(env), { force: true }) + await writeFileAtomic(getOpenCodeServiceSettingsPath(env), `${JSON.stringify({ password }, null, 2)}\n`, { mode: 0o600 }) +} diff --git a/backend/src/services/opencode-single-server.ts b/backend/src/services/opencode-single-server.ts index fb2df50d..f5cf3f87 100644 --- a/backend/src/services/opencode-single-server.ts +++ b/backend/src/services/opencode-single-server.ts @@ -16,7 +16,12 @@ import { } from '../utils/ssh-key-manager' import { decryptSecret } from '../utils/crypto' import { BLOCKED_SERVER_ENV_KEYS, DEFAULT_SERVER_ENV_VARS } from '@opencode-manager/shared' -import { OPENCODE_MIN_VERSION, isSupportedOpenCodeVersion } from '@opencode-manager/shared/opencode' +import { + OPENCODE_PINNED_VERSION, + describeUnsupportedOpenCodeVersion, + isSupportedOpenCodeVersion, + parseOpenCodeVersionOutput, +} from '@opencode-manager/shared/opencode' import { resolveOpenCodeBinaryPath } from './opencode-installer' import { SettingsService } from './settings' import { @@ -39,11 +44,13 @@ import { SandboxRuntimeService } from './sandbox/runtime' import { CredentialProvider } from './credential-provider' import { mkdirSafe, writeFileAtomic } from '../utils/fs-safe' import { createProcessLogForwarder } from '../utils/log-buffer' +import { OPENCODE_SERVICE_SERVE_ARGS, prepareOpenCodeServiceLaunch } from './opencode-service-mode' const MAX_STDERR_SIZE = 10240 const STARTUP_HEALTH_TIMEOUT_MS = 30000 -const PROCESS_EXIT_GRACE_MS = 2000 +const PROCESS_SIGTERM_GRACE_MS = 10000 +const PROCESS_SIGKILL_CONFIRM_MS = 2000 const PROCESS_EXIT_POLL_MS = 50 const CHILD_STATE_MARKER_REFRESH_MS = 60000 @@ -350,9 +357,9 @@ class OpenCodeServerManager { ) } try { - await this.terminateAttestedPredecessor(PROCESS_EXIT_GRACE_MS) + await this.terminateAttestedPredecessor() if (existingProcesses.length > 0) { - await this.terminatePortOwners(existingProcesses, PROCESS_EXIT_GRACE_MS) + await this.terminatePortOwners(existingProcesses) } } catch (cleanupError) { this.failNonRecoverable( @@ -442,10 +449,10 @@ class OpenCodeServerManager { } let replacingExistingServer = false if (sandboxEnforced) { - await this.terminateAttestedPredecessor(PROCESS_EXIT_GRACE_MS) + await this.terminateAttestedPredecessor() if (existingProcesses.length > 0) { logger.warn('Sandbox enforcement enabled: killing existing OpenCode server to guarantee a sandboxed startup') - await this.terminatePortOwners(existingProcesses, PROCESS_EXIT_GRACE_MS) + await this.terminatePortOwners(existingProcesses) replacingExistingServer = true } } else if (existingProcesses.length > 0) { @@ -454,7 +461,7 @@ class OpenCodeServerManager { if (healthy) { if (isDevelopment) { logger.warn('Development mode: Killing existing server for hot reload') - await this.terminatePortOwners(existingProcesses, PROCESS_EXIT_GRACE_MS) + await this.terminatePortOwners(existingProcesses) replacingExistingServer = true } else { const childState = await readChildStateMarker() @@ -470,17 +477,17 @@ class OpenCodeServerManager { return } logger.warn(`Existing OpenCode server on port ${openCodeServerPort} is not attested as a matching unenforced child; terminating it to guarantee consistent sandbox enforcement`) - await this.terminatePortOwners(existingProcesses, PROCESS_EXIT_GRACE_MS) + await this.terminatePortOwners(existingProcesses) replacingExistingServer = true } } else { logger.warn('Killing unhealthy OpenCode server') - await this.terminatePortOwners(existingProcesses, PROCESS_EXIT_GRACE_MS) + await this.terminatePortOwners(existingProcesses) replacingExistingServer = true } } - await this.reconcileExitedChildMarker(PROCESS_EXIT_GRACE_MS) + await this.reconcileExitedChildMarker() const openCodeServerDirectory = getOpenCodeServerDirectory() const openCodeConfigPath = getOpenCodeConfigPath() @@ -538,7 +545,7 @@ class OpenCodeServerManager { await this.fetchVersion() if (this.version && !this.isVersionSupported()) { this.failNonRecoverable( - `OpenCode ${this.version} is not supported; OpenCode Manager requires OpenCode ${OPENCODE_MIN_VERSION} or newer. Install a 2.x version from Settings → OpenCode.`, + `${describeUnsupportedOpenCodeVersion(this.version)}. Install a supported version from Settings → OpenCode.`, ) } await this.resetAgentTmpDirectory() @@ -566,6 +573,7 @@ class OpenCodeServerManager { const microsandboxEnv = resolveManagerMicrosandboxEnv() const cleanEnv = { ...process.env } + delete cleanEnv.OPENCODE_PASSWORD delete cleanEnv.OPENCODE_SERVER_PASSWORD delete cleanEnv.OPENCODE_RUN_ID delete cleanEnv.OPENCODE_PROCESS_ROLE @@ -574,33 +582,43 @@ class OpenCodeServerManager { delete cleanEnv.OPENCODE_CONFIG delete userEnvVars.OPENCODE_CONFIG + const serverEnv = { + ...cleanEnv, + ...userEnvVars, + ...microsandboxEnv, + ...gitEnv, + ...gitIdentityEnv, + ...(this.db + ? { + OCM_INTERNAL_API_URL: `http://localhost:${ENV.SERVER.PORT}/api/internal`, + OCM_INTERNAL_TOKEN: getOrCreateInternalToken(this.db), + } + : {}), + OCM_SANDBOX_ENFORCED: sandboxEnforced ? 'true' : 'false', + GIT_SSH_COMMAND: gitSshCommand, + XDG_DATA_HOME: getOpenCodeStateHome(), + XDG_STATE_HOME: getOpenCodeStateHome(), + XDG_CONFIG_HOME: getOpenCodeConfigHome(), + TMPDIR: getOpenCodeTmpHome(), + } + + try { + await prepareOpenCodeServiceLaunch(serverEnv, password) + } catch (error) { + const message = `Failed to prepare the OpenCode service settings: ${error instanceof Error ? error.message : String(error)}` + this.lastStartupError = message + logger.error(message) + throw new Error(message) + } + this.serverProcess = spawn( openCodeExecutable, - ['serve', '--port', openCodeServerPort.toString(), '--hostname', openCodeServerHost], + [...OPENCODE_SERVICE_SERVE_ARGS, '--port', openCodeServerPort.toString(), '--hostname', openCodeServerHost], { cwd: openCodeServerDirectory, detached: !isDevelopment, stdio: isDevelopment ? 'inherit' : ['ignore', 'pipe', 'pipe'], - env: { - ...cleanEnv, - ...userEnvVars, - ...microsandboxEnv, - ...gitEnv, - ...gitIdentityEnv, - ...(this.db - ? { - OCM_INTERNAL_API_URL: `http://localhost:${ENV.SERVER.PORT}/api/internal`, - OCM_INTERNAL_TOKEN: getOrCreateInternalToken(this.db), - } - : {}), - OCM_SANDBOX_ENFORCED: sandboxEnforced ? 'true' : 'false', - GIT_SSH_COMMAND: gitSshCommand, - XDG_DATA_HOME: getOpenCodeStateHome(), - XDG_STATE_HOME: getOpenCodeStateHome(), - XDG_CONFIG_HOME: getOpenCodeConfigHome(), - TMPDIR: getOpenCodeTmpHome(), - OPENCODE_SERVER_PASSWORD: password, - } + env: serverEnv, } ) @@ -731,7 +749,7 @@ class OpenCodeServerManager { try { if (!this.serverPid) { - await this.reconcileExitedChildMarker(PROCESS_EXIT_GRACE_MS) + await this.reconcileExitedChildMarker() return } @@ -768,7 +786,6 @@ class OpenCodeServerManager { await this.terminateAndConfirm( pid, groupTarget, - PROCESS_EXIT_GRACE_MS, 'OpenCode server', 'retained live processes after SIGTERM and SIGKILL; refusing to complete the stop while host-executed processes may survive', ) @@ -828,7 +845,7 @@ class OpenCodeServerManager { } getMinVersion(): string { - return OPENCODE_MIN_VERSION + return OPENCODE_PINNED_VERSION } isVersionSupported(): boolean { @@ -896,9 +913,9 @@ class OpenCodeServerManager { try { const executable = resolveOpenCodeExecutable() ?? 'opencode' const result = spawnSync(executable, ['--version'], { encoding: 'utf8' }) - const match = `${result.stdout ?? ''}${result.stderr ?? ''}`.match(/(\d+\.\d+\.\d+)/) - if (match && match[1]) { - this.version = match[1] + const version = parseOpenCodeVersionOutput(`${result.stdout ?? ''}${result.stderr ?? ''}`) + if (version) { + this.version = version return this.version } } catch (error) { @@ -946,15 +963,14 @@ class OpenCodeServerManager { private async terminateAndConfirm( pid: number, groupTarget: number | null, - graceMs: number, context: string, failurePhrase: string, ): Promise { this.signalProcessOrGroup(pid, groupTarget, 'SIGTERM') - const exited = await this.waitForProcessOrGroupExit(pid, groupTarget, graceMs) + const exited = await this.waitForProcessOrGroupExit(pid, groupTarget, PROCESS_SIGTERM_GRACE_MS) if (exited) return this.signalProcessOrGroup(pid, groupTarget, 'SIGKILL') - const killed = await this.waitForProcessOrGroupExit(pid, groupTarget, graceMs) + const killed = await this.waitForProcessOrGroupExit(pid, groupTarget, PROCESS_SIGKILL_CONFIRM_MS) if (!killed) { const message = `${context} (PID ${pid}${groupTarget !== null ? `, process group ${groupTarget}` : ''}) ${failurePhrase}` this.lastStartupError = message @@ -963,7 +979,7 @@ class OpenCodeServerManager { } } - private async terminatePortOwners(processes: Array<{pid: number}>, graceMs: number): Promise { + private async terminatePortOwners(processes: Array<{pid: number}>): Promise { const targets = processes.map((proc) => { const pgid = readProcessGroupId(proc.pid) return { pid: proc.pid, groupTarget: pgid !== null && pgid === proc.pid ? proc.pid : null } @@ -973,7 +989,7 @@ class OpenCodeServerManager { } const survivors: number[] = [] for (const target of targets) { - const exited = await this.waitForProcessOrGroupExit(target.pid, target.groupTarget, graceMs) + const exited = await this.waitForProcessOrGroupExit(target.pid, target.groupTarget, PROCESS_SIGKILL_CONFIRM_MS) if (!exited) { survivors.push(target.pid) } @@ -1015,7 +1031,7 @@ class OpenCodeServerManager { return { pid, groupTarget, pidAttested, groupAttested } } - private async terminateAttestedPredecessor(graceMs: number): Promise { + private async terminateAttestedPredecessor(): Promise { const marker = await readChildStateMarker() if (marker === null) return const target = this.resolveAttestedProcessTarget(marker) @@ -1035,13 +1051,12 @@ class OpenCodeServerManager { await this.terminateAndConfirm( target.pid, target.groupTarget, - graceMs, 'Previous OpenCode server process', 'retained live processes after SIGTERM and SIGKILL; refusing to start an enforced server while host-executed processes may survive', ) } - private async reconcileExitedChildMarker(graceMs: number): Promise { + private async reconcileExitedChildMarker(): Promise { this.isHealthy = false this.stopChildStateMarkerRefresh() const marker = await readChildStateMarker() @@ -1054,7 +1069,6 @@ class OpenCodeServerManager { await this.terminateAndConfirm( target.pid, target.groupTarget, - graceMs, 'OpenCode server', 'retained live processes after SIGTERM and SIGKILL; refusing to complete the stop while host-executed processes may survive', ) @@ -1076,7 +1090,6 @@ class OpenCodeServerManager { await this.terminateAndConfirm( target.pid, target.groupTarget, - graceMs, 'Previous OpenCode server process group', 'retained live processes after SIGTERM and SIGKILL; refusing to replace the child state marker while host-executed processes may survive', ) diff --git a/backend/src/services/opencode/client.ts b/backend/src/services/opencode/client.ts index 0d7c4f29..35c2c2b3 100644 --- a/backend/src/services/opencode/client.ts +++ b/backend/src/services/opencode/client.ts @@ -2,7 +2,7 @@ import { logger } from '../../utils/logger' import { ENV } from '@opencode-manager/shared/config/env' import { createOpenCodeApi, type OpenCodeApi } from '@opencode-manager/shared/opencode' import { getOpenCodeBasicAuthHeader, type OpenCodePasswordResolver } from './auth' -import { getOpenCodeUpstreamBaseUrl } from './upstream' +import { getOpenCodeUpstreamBaseUrl, withDefaultOpenCodeDirectory } from './upstream' export interface OpenCodeClient { readonly api: OpenCodeApi @@ -45,7 +45,7 @@ export class FetchOpenCodeClient implements OpenCodeClient { } private async fetchWithResolvedAuth(input: Parameters[0], init?: Parameters[1]): Promise { - const headers = new Headers(init?.headers) + const headers = new Headers(withDefaultOpenCodeDirectory(Object.fromEntries(new Headers(init?.headers)))) const basicAuth = await this.getBasicAuth() if (basicAuth) { @@ -58,7 +58,7 @@ export class FetchOpenCodeClient implements OpenCodeClient { private async request(req: { method: string; path: string; body?: string; headers?: Record }): Promise { const url = new URL(this.resolveBaseUrl() + req.path) - const headers: Record = { ...(req.headers ?? {}) } + const headers: Record = withDefaultOpenCodeDirectory({ ...(req.headers ?? {}) }) const basicAuth = await this.getBasicAuth() diff --git a/backend/src/services/opencode/integration-ready.ts b/backend/src/services/opencode/integration-ready.ts new file mode 100644 index 00000000..ab1c787a --- /dev/null +++ b/backend/src/services/opencode/integration-ready.ts @@ -0,0 +1,45 @@ +import { isIntegrationNotFoundError, type OpenCodeApi } from '@opencode-manager/shared/opencode' + +export const INTEGRATION_READY_POLL_INTERVAL_MS = 100 +export const INTEGRATION_READY_TIMEOUT_MS = 2000 + +export type IntegrationTarget = Parameters[0] + +type IntegrationReader = Pick + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)) +} + +async function isIntegrationAvailable(api: IntegrationReader, target: IntegrationTarget): Promise { + try { + await api.integration.get(target) + return true + } catch (error) { + return isIntegrationNotFoundError(error) ? false : undefined + } +} + +async function waitForIntegration(api: IntegrationReader, target: IntegrationTarget): Promise { + const deadline = Date.now() + INTEGRATION_READY_TIMEOUT_MS + while (Date.now() < deadline) { + await delay(INTEGRATION_READY_POLL_INTERVAL_MS) + const available = await isIntegrationAvailable(api, target) + if (available !== false) return available === true + } + return false +} + +export async function runWhenIntegrationReady( + api: IntegrationReader, + target: IntegrationTarget, + action: () => Promise, +): Promise { + try { + return await action() + } catch (error) { + if (!isIntegrationNotFoundError(error)) throw error + if (!(await waitForIntegration(api, target))) throw error + return await action() + } +} diff --git a/backend/src/services/opencode/plugin-registry.ts b/backend/src/services/opencode/plugin-registry.ts index f7e9c73f..cbd8ca66 100644 --- a/backend/src/services/opencode/plugin-registry.ts +++ b/backend/src/services/opencode/plugin-registry.ts @@ -6,7 +6,7 @@ import { buildManagerToolPluginSource } from '../opencode-manager-tool-plugin' import { buildSandboxPluginSource } from '../opencode-sandbox-plugin' import { ensureSandboxShellShim } from '../sandbox/shell-shim' -export const MANAGED_OPENCODE_PLUGIN_IDS = { +const MANAGED_OPENCODE_PLUGIN_IDS = { ghEnv: 'ocm.gh-env', manager: 'ocm.manager', sandbox: 'ocm.sandbox', diff --git a/backend/src/services/opencode/upstream.ts b/backend/src/services/opencode/upstream.ts index 63e4ed00..f5a8a201 100644 --- a/backend/src/services/opencode/upstream.ts +++ b/backend/src/services/opencode/upstream.ts @@ -1,4 +1,6 @@ -import { ENV } from '@opencode-manager/shared/config/env' +import { ENV, getWorkspacePath } from '@opencode-manager/shared/config/env' + +export const OPENCODE_DIRECTORY_HEADER = 'x-opencode-directory' function formatOpenCodeHostForUrl(host: string): string { if (host.startsWith('[') && host.endsWith(']')) return host @@ -10,3 +12,8 @@ export function getOpenCodeUpstreamBaseUrl(hostOverride?: string | (() => string const normalizedHost = configuredHost === '0.0.0.0' ? '127.0.0.1' : configuredHost return `http://${formatOpenCodeHostForUrl(normalizedHost)}:${ENV.OPENCODE.PORT}` } + +export function withDefaultOpenCodeDirectory(headers: Record): Record { + const hasDirectory = Object.keys(headers).some((key) => key.toLowerCase() === OPENCODE_DIRECTORY_HEADER) + return hasDirectory ? headers : { ...headers, [OPENCODE_DIRECTORY_HEADER]: encodeURIComponent(getWorkspacePath()) } +} diff --git a/backend/src/services/schedules.ts b/backend/src/services/schedules.ts index 85cb2e58..494484cb 100644 --- a/backend/src/services/schedules.ts +++ b/backend/src/services/schedules.ts @@ -7,7 +7,7 @@ import { type ScheduleRunTriggerSource, type UpdateScheduleJobRequest, } from '@opencode-manager/shared/types' -import { openCodeLocation, type SessionMessageAssistant, type SessionMessageInfo } from '@opencode-manager/shared/opencode' +import { assistantText, openCodeLocation, sessionIDFromEvent, type SessionMessageAssistant, type SessionMessageInfo } from '@opencode-manager/shared/opencode' import { buildSchedulePermissionRuleset } from '@opencode-manager/shared/schemas' import { getRepoById } from '../db/queries' import type { ScheduleJobWithRepo } from '../db/schedules' @@ -84,14 +84,6 @@ function buildSessionTitle(job: ScheduleJob): string { type SkillAttachment = { id: string } -function extractAssistantMessageText(content: SessionMessageAssistant['content'] | undefined): string { - return (content ?? []) - .filter((part) => part.type === 'text') - .map((part) => part.text.replace(/[\s\S]*?<\/think>\s*/g, '').trim()) - .filter(Boolean) - .join('\n\n') -} - function buildRunLog(input: { job: ScheduleJob triggerSource: ScheduleRunTriggerSource @@ -169,16 +161,12 @@ function getAssistantMessageState(messages: SessionMessageInfo[]): { } return { - responseText: extractAssistantMessageText(assistantMessage.content) || null, + responseText: assistantText(assistantMessage.content, { stripThink: true }) || null, errorText: assistantMessage.error?.message ?? null, completed: Boolean(assistantMessage.time.completed), } } -function getSessionEventId(event: SSEEvent): string | null { - return 'sessionID' in event.data && typeof event.data.sessionID === 'string' ? event.data.sessionID : null -} - function getSessionErrorText(event: SSEEvent): string | null { if (event.type !== 'session.execution.failed') { return null @@ -211,7 +199,7 @@ function createSessionMonitor(directory: string, sessionId: string): SessionMoni return } - if (getSessionEventId(event) !== sessionId) { + if (sessionIDFromEvent(event) !== sessionId) { return } @@ -516,7 +504,7 @@ export class ScheduleService { title: sessionTitle, agent: job.agentSlug ?? undefined, model: { providerID: model.providerID, id: model.id, variant: model.variant }, - location: { directory: runDirectory }, + ...openCodeLocation(runDirectory), permissions: buildSchedulePermissionRuleset(job.permissionConfig), }) } catch (error) { diff --git a/backend/src/services/sse-aggregator.ts b/backend/src/services/sse-aggregator.ts index 4ca978df..7bd8539f 100644 --- a/backend/src/services/sse-aggregator.ts +++ b/backend/src/services/sse-aggregator.ts @@ -1,8 +1,7 @@ import { EventSource } from 'eventsource' import { logger } from '../utils/logger' import { DEFAULTS } from '@opencode-manager/shared/config' -import type { SSEEventEnvelope } from '@opencode-manager/shared' -import type { OpenCodeApi, V2Event } from '@opencode-manager/shared/opencode' +import { openCodeLocation, type OpenCodeApi, type V2Event } from '@opencode-manager/shared/opencode' import { getOpenCodeBasicAuthHeader, type OpenCodePasswordResolver } from './opencode/auth' import { getOpenCodeUpstreamBaseUrl } from './opencode/upstream' import { encodeSSEFrame } from '../utils/sse-frame' @@ -34,6 +33,11 @@ export interface ScheduledSessionRef { type ReplayEventType = 'permission.asked' | 'form.created' | 'session.status' const { RECONNECT_DELAY_MS, MAX_RECONNECT_DELAY_MS } = DEFAULTS.SSE +const MULTILINE_PATTERN = /[\r\n]/ + +function serializeEnvelope(directory: string | null, payloadJson: string): string { + return '{"directory":' + JSON.stringify(directory) + ',"payload":' + payloadJson + '}' +} class SSEAggregator { private static instance: SSEAggregator @@ -187,30 +191,14 @@ class SSEAggregator { )) } - private async replayPendingActionsForAllClients(): Promise { - const fetcher = this.pendingActionsFetcher - if (!fetcher) return - - const tasks: Promise[] = [] - this.clients.forEach((client) => { - const directories = Array.from(client.directories) - if (directories.length === 0) return - tasks.push(this.replayPendingActionsForClient(client.id, directories)) - }) - - if (tasks.length === 0) return - logger.info(`replay: replaying pending actions to ${tasks.length} client(s) after upstream reconnect`) - await Promise.allSettled(tasks) - } - private async replayPendingActionsForDirectory( clientId: string, directory: string, fetcher: PendingActionsFetcher, ): Promise { const [permissionsResult, formsResult] = await Promise.allSettled([ - fetcher.api.permission.request.list({ location: { directory } }), - fetcher.api.form.list({ location: { directory } }), + fetcher.api.permission.request.list(openCodeLocation(directory)), + fetcher.api.form.list(openCodeLocation(directory)), ]) if (permissionsResult.status === 'rejected') { @@ -237,9 +225,8 @@ class SSEAggregator { if (!client || !client.directories.has(directory)) return for (const event of events) { - const envelope: SSEEventEnvelope = { directory, payload: event } try { - client.callback('message', JSON.stringify(envelope)) + client.callback('message', serializeEnvelope(directory, JSON.stringify(event))) } catch (error) { logger.error(`replay: failed to deliver ${event.type} to client ${clientId}:`, error) return @@ -273,8 +260,12 @@ class SSEAggregator { replayed++ } - for (const sessionID of runningIDs) { - const directory = tracked.get(sessionID) ?? await this.resolveSessionDirectory(fetcher, sessionID) + const runningDirectories = await Promise.all(runningIDs.map(async (sessionID) => ({ + sessionID, + directory: tracked.get(sessionID) ?? await this.resolveSessionDirectory(fetcher, sessionID), + }))) + + for (const { sessionID, directory } of runningDirectories) { if (!directory) continue this.deliverEvent(directory, this.buildReplayEvent('session.status', directory, { sessionID, status: { type: 'busy' } })) replayed++ @@ -378,7 +369,6 @@ class SSEAggregator { this.everConnected = true this.broadcastResync() if (wasConnectedBefore) { - void this.replayPendingActionsForAllClients() void this.replaySessionStatusesForTrackedDirectories() } } @@ -409,17 +399,23 @@ class SSEAggregator { return } - const directory = event?.location?.directory - if (!event?.type || !directory) return + if (!event?.type) return + + const payloadJson = MULTILINE_PATTERN.test(data) ? JSON.stringify(event) : data + const directory = event.location?.directory try { - this.deliverEvent(directory, event) + if (directory) { + this.deliverEvent(directory, event, payloadJson) + } else { + this.writeEnvelopeToClients(this.clients.keys(), null, payloadJson) + } } catch (error) { logger.error(`SSE failed to handle ${event.type} event:`, error) } } - private deliverEvent(directory: string, event: SSEEvent): void { + private deliverEvent(directory: string, event: SSEEvent, payloadJson?: string): void { this.handleEvent(directory, event) this.eventListeners.forEach(listener => { @@ -429,11 +425,15 @@ class SSEAggregator { const subscriberIds = this.directoryClients.get(directory) if (!subscriberIds || subscriberIds.size === 0) return - const envelope: SSEEventEnvelope = { directory, payload: event } - const frame = encodeSSEFrame('message', JSON.stringify(envelope)) - for (const clientId of subscriberIds) { + this.writeEnvelopeToClients(subscriberIds, directory, payloadJson ?? JSON.stringify(event)) + } + + private writeEnvelopeToClients(clientIds: Iterable, directory: string | null, payloadJson: string): void { + let frame: Uint8Array | null = null + for (const clientId of clientIds) { const client = this.clients.get(clientId) if (!client) continue + frame ??= encodeSSEFrame('message', serializeEnvelope(directory, payloadJson)) try { client.writeFrame(frame) } catch (error) { diff --git a/backend/src/utils/route-helpers.ts b/backend/src/utils/route-helpers.ts index dea2bdc7..ca99710b 100644 --- a/backend/src/utils/route-helpers.ts +++ b/backend/src/utils/route-helpers.ts @@ -1,6 +1,6 @@ import type { Context } from 'hono' import type { ContentfulStatusCode } from 'hono/utils/http-status' -import { ClientError } from '@opencode-manager/shared/opencode' +import { ClientError, openCodeErrorStatus } from '@opencode-manager/shared/opencode' import { isOAuthErrorCode, type OAuthErrorCode } from '@opencode-manager/shared/schemas' import { getErrorMessage } from './error-utils' import { logger } from './logger' @@ -43,12 +43,6 @@ export function handleServiceError( return c.json({ error: getErrorMessage(error) }, 500) } -const NOT_FOUND_OPENCODE_ERROR_TAGS = new Set([ - 'IntegrationNotFoundError', - 'IntegrationAttemptNotFoundError', - 'IntegrationMethodNotFoundError', -]) - export interface OpenCodeErrorPayload { error: string code?: OAuthErrorCode @@ -65,7 +59,7 @@ export function mapOpenCodeError(error: unknown, fallback: string): OpenCodeErro const tag = (error as { _tag?: unknown })._tag if (typeof tag === 'string') { return { - status: NOT_FOUND_OPENCODE_ERROR_TAGS.has(tag) ? 404 : 502, + status: openCodeErrorStatus(error) === 404 ? 404 : 502, payload: { error: error.message || fallback, ...(isOAuthErrorCode(tag) ? { code: tag } : {}), diff --git a/backend/src/utils/version-utils.ts b/backend/src/utils/version-utils.ts deleted file mode 100644 index 67375a1a..00000000 --- a/backend/src/utils/version-utils.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function compareVersions(v1: string, v2: string): number { - const parts1 = v1.replace(/^v/, '').split('.').map(Number) - const parts2 = v2.replace(/^v/, '').split('.').map(Number) - - for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) { - const p1 = parts1[i] ?? 0 - const p2 = parts2[i] ?? 0 - if (p1 > p2) return 1 - if (p1 < p2) return -1 - } - return 0 -} - -export function isValidVersion(version: string): boolean { - const semverRegex = /^\d+\.\d+\.\d+$/ - return semverRegex.test(version) -} diff --git a/backend/test/helpers/opencode-binary.ts b/backend/test/helpers/opencode-binary.ts index e7d458d2..16b8a209 100644 --- a/backend/test/helpers/opencode-binary.ts +++ b/backend/test/helpers/opencode-binary.ts @@ -7,12 +7,13 @@ import { randomBytes } from 'crypto' import os from 'os' import path from 'path' import { buildOpenCodeBasicAuth, isSupportedOpenCodeVersion } from '@opencode-manager/shared/opencode' +import { OPENCODE_SERVICE_SERVE_ARGS, prepareOpenCodeServiceLaunch } from '../../src/services/opencode-service-mode' const VERSION_TIMEOUT_MS = 5000 const SERVE_READY_TIMEOUT_MS = 60000 const SERVE_POLL_INTERVAL_MS = 250 const RUN_TIMEOUT_MS = 90000 -const STOP_TIMEOUT_MS = 5000 +const STOP_TIMEOUT_MS = 10000 const OPENCODE_BINARY_CANDIDATES = ['opencode', '/usr/local/bin/opencode', '/opt/opencode/bin/opencode'] @@ -25,8 +26,12 @@ export type OpenCodeRunResult = { export type OpenCodeServe = { baseUrl: string password: string + port: number homeDirectory: string configHome: string + directories: OpenCodeServeDirectories + readOutput: () => string + terminate: () => Promise stop: () => Promise } @@ -113,59 +118,108 @@ async function waitForServerInfo(baseUrl: string, password: string, child: Retur throw new Error(`OpenCode server did not become ready: ${readStderr()}`) } -export async function startOpenCodeServe(options: { env?: NodeJS.ProcessEnv } = {}): Promise { +export type OpenCodeServeDirectories = { + root: string + homeDirectory: string + configHome: string + dataHome: string + stateHome: string + cacheHome: string +} + +export type OpenCodeServeOptions = { + env?: NodeJS.ProcessEnv + service?: boolean + directories?: OpenCodeServeDirectories + password?: string + port?: number +} + +export async function createOpenCodeServeDirectories(env: NodeJS.ProcessEnv = {}): Promise { + const root = await mkdtemp(path.join(os.tmpdir(), 'ocm-opencode-serve-')) + const directories: OpenCodeServeDirectories = { + root, + homeDirectory: env.HOME ?? path.join(root, 'home'), + configHome: env.XDG_CONFIG_HOME ?? path.join(root, 'config'), + dataHome: env.XDG_DATA_HOME ?? path.join(root, 'data'), + stateHome: env.XDG_STATE_HOME ?? path.join(root, 'state'), + cacheHome: env.XDG_CACHE_HOME ?? path.join(root, 'cache'), + } + for (const directory of [directories.homeDirectory, directories.configHome, directories.dataHome, directories.stateHome, directories.cacheHome]) { + await mkdir(directory, { recursive: true }) + } + return directories +} + +export async function startOpenCodeServe(options: OpenCodeServeOptions = {}): Promise { const binary = resolveOpenCode2Binary() if (!binary) throw new Error('no OpenCode 2 binary is available for the binary-backed test') - const root = await mkdtemp(path.join(os.tmpdir(), 'ocm-opencode-serve-')) - const password = randomBytes(24).toString('base64url') - const homeDirectory = options.env?.HOME ?? path.join(root, 'home') - const configHome = options.env?.XDG_CONFIG_HOME ?? path.join(root, 'config') + const ownsDirectories = options.directories === undefined + const directories = options.directories ?? await createOpenCodeServeDirectories(options.env) + const password = options.password ?? randomBytes(24).toString('base64url') const env: NodeJS.ProcessEnv = { ...process.env, - HOME: homeDirectory, - XDG_CONFIG_HOME: configHome, - XDG_DATA_HOME: path.join(root, 'data'), - XDG_STATE_HOME: path.join(root, 'state'), - XDG_CACHE_HOME: path.join(root, 'cache'), OPENCODE_DISABLE_MODELS_FETCH: '1', ...options.env, + HOME: directories.homeDirectory, + XDG_CONFIG_HOME: directories.configHome, + XDG_DATA_HOME: directories.dataHome, + XDG_STATE_HOME: directories.stateHome, + XDG_CACHE_HOME: directories.cacheHome, OPENCODE_SERVER_PASSWORD: password, } - for (const directory of new Set([env.HOME, env.XDG_CONFIG_HOME, env.XDG_DATA_HOME, env.XDG_STATE_HOME, env.XDG_CACHE_HOME])) { - if (typeof directory === 'string' && directory.length > 0) await mkdir(directory, { recursive: true }) + if (options.service) { + await prepareOpenCodeServiceLaunch({ XDG_CONFIG_HOME: directories.configHome, XDG_STATE_HOME: directories.stateHome, OPENCODE_CONFIG_DIR: env.OPENCODE_CONFIG_DIR }, password) } - const port = await getFreePort() - const child = spawn(binary, ['serve', '--port', String(port), '--hostname', '127.0.0.1'], { + const port = options.port ?? await getFreePort() + const args = options.service + ? [...OPENCODE_SERVICE_SERVE_ARGS, '--port', String(port), '--hostname', '127.0.0.1'] + : ['serve', '--port', String(port), '--hostname', '127.0.0.1'] + const child = spawn(binary, args, { stdio: ['ignore', 'pipe', 'pipe'], env, }) - let stderr = '' - child.stderr?.on('data', (chunk: Buffer) => { - stderr += chunk.toString() - }) + let output = '' + const appendOutput = (chunk: Buffer) => { + output += chunk.toString() + } + child.stdout?.on('data', appendOutput) + child.stderr?.on('data', appendOutput) + + const removeOwnedDirectories = async () => { + if (ownsDirectories) await rm(directories.root, { recursive: true, force: true }) + } const baseUrl = `http://127.0.0.1:${port}` try { - await waitForServerInfo(baseUrl, password, child, () => stderr) + await waitForServerInfo(baseUrl, password, child, () => output) } catch (error) { child.kill('SIGKILL') - await rm(root, { recursive: true, force: true }) + await removeOwnedDirectories() throw error } + const terminate = async (): Promise => { + if (child.exitCode === null && child.signalCode === null) { + child.kill('SIGTERM') + await Promise.race([once(child, 'close'), delay(STOP_TIMEOUT_MS)]) + if (child.exitCode === null && child.signalCode === null) child.kill('SIGKILL') + } + } + return { baseUrl, password, - homeDirectory, - configHome, + port, + homeDirectory: directories.homeDirectory, + configHome: directories.configHome, + directories, + readOutput: () => output, + terminate, stop: async () => { - if (child.exitCode === null && child.signalCode === null) { - child.kill('SIGTERM') - await Promise.race([once(child, 'close'), delay(STOP_TIMEOUT_MS)]) - if (child.exitCode === null && child.signalCode === null) child.kill('SIGKILL') - } - await rm(root, { recursive: true, force: true }) + await terminate() + await removeOwnedDirectories() }, } } diff --git a/backend/test/helpers/stub-opencode-client.ts b/backend/test/helpers/stub-opencode-client.ts index c486bdab..89268a2e 100644 --- a/backend/test/helpers/stub-opencode-client.ts +++ b/backend/test/helpers/stub-opencode-client.ts @@ -9,6 +9,7 @@ export function createStubOpenCodeClient(overrides: Partial = {} info: vi.fn(async () => ({ version: '2.0.15', pid: 1234, urls: [], paths: { tmp: '/tmp' } })), }, location: { + reload: vi.fn(async () => undefined), get: vi.fn(async () => ({ directory: '/tmp/repo', project: { id: 'commit-A', directory: '/tmp/repo', canonical: '/tmp/repo' }, diff --git a/backend/test/index.test.ts b/backend/test/index.test.ts index b3ee4b97..aedaadfa 100644 --- a/backend/test/index.test.ts +++ b/backend/test/index.test.ts @@ -10,9 +10,9 @@ vi.mock('@hono/node-server', () => ({ })) const supervisorMock = vi.hoisted(() => ({ - start: vi.fn().mockResolvedValue({ healthy: true, port: 5551, state: 'running', resumedSessionIDs: [] }), + start: vi.fn().mockResolvedValue({ healthy: true, port: 5551, state: 'running' }), stop: vi.fn().mockResolvedValue(undefined), - restart: vi.fn().mockResolvedValue({ healthy: true, resumedSessionIDs: [] }), + restart: vi.fn().mockResolvedValue({ healthy: true }), getLastStartupError: vi.fn().mockReturnValue(null), })) @@ -102,7 +102,7 @@ const serverManagerMock = vi.hoisted(() => ({ getVersion: vi.fn().mockReturnValue('1.2.27'), fetchVersion: vi.fn().mockResolvedValue('1.2.27'), setDatabase: vi.fn(), - start: vi.fn().mockResolvedValue({ healthy: true, port: 5551, state: 'running', resumedSessionIDs: [] }), + start: vi.fn().mockResolvedValue({ healthy: true, port: 5551, state: 'running' }), stop: vi.fn().mockResolvedValue(undefined), getEffectiveServerHost: vi.fn().mockReturnValue('127.0.0.1'), getLastStartupError: vi.fn().mockReturnValue(null), @@ -121,15 +121,6 @@ vi.mock('../src/services/opencode-single-server', async (importOriginal) => { } }) -const restartCoordinatorMock = vi.hoisted(() => ({ - runWithResume: vi.fn(), - captureResumableSessions: vi.fn().mockReturnValue([]), -})) - -vi.mock('../src/services/opencode-restart-coordinator', () => ({ - OpenCodeRestartCoordinator: vi.fn().mockImplementation(() => restartCoordinatorMock), -})) - vi.mock('../src/services/git-auth', () => ({ GitAuthService: vi.fn().mockImplementation(() => ({ initialize: vi.fn().mockResolvedValue(undefined), diff --git a/backend/test/integration/opencode-config-reload.test.ts b/backend/test/integration/opencode-config-reload.test.ts new file mode 100644 index 00000000..8b9304ee --- /dev/null +++ b/backend/test/integration/opencode-config-reload.test.ts @@ -0,0 +1,352 @@ +import { describe, it, expect, beforeAll, afterAll } from 'vitest' +import { createServer } from 'http' +import type { IncomingMessage, Server, ServerResponse } from 'http' +import type { AddressInfo } from 'net' +import { mkdir, rm, writeFile } from 'fs/promises' +import path from 'path' +import { buildOpenCodeBasicAuth } from '@opencode-manager/shared/opencode' +import { FetchOpenCodeClient } from '../../src/services/opencode/client' +import { OPENCODE_DIRECTORY_HEADER } from '../../src/services/opencode/upstream' +import { + createOpenCodeServeDirectories, + resolveOpenCode2Binary, + startOpenCodeServe, +} from '../helpers/opencode-binary' +import type { OpenCodeServe, OpenCodeServeDirectories } from '../helpers/opencode-binary' + +const OPENCODE_BIN = resolveOpenCode2Binary() +const POLL_INTERVAL_MS = 250 +const WAIT_TIMEOUT_MS = 30000 +const WATCHER_SETTLE_MS = 1500 +const MOCK_MODEL_CAPABILITIES = { tools: true, input: ['text'], output: ['text'] } +const GLOBAL_AGENTS_MARKER = 'GLOBAL_AGENTS_MARKER_7781' + +type CompletionRequest = { headers: IncomingMessage['headers']; body: { model?: string; tools?: Array<{ function?: { name?: string } }> } } + +type MockLlm = { + port: number + requests: CompletionRequest[] + hold: (enabled: boolean) => void + releaseHeld: () => void + heldCount: () => number + close: () => Promise +} + +const CHUNK_BASE = { id: 'chatcmpl-reload', object: 'chat.completion.chunk', created: 1, model: 'mock-model' } + +function writeChunk(res: ServerResponse, delta: Record, finishReason: string | null): void { + res.write(`data: ${JSON.stringify({ ...CHUNK_BASE, choices: [{ index: 0, delta, finish_reason: finishReason }] })}\n\n`) +} + +function finishCompletion(res: ServerResponse): void { + writeChunk(res, { content: 'done' }, 'stop') + res.write('data: [DONE]\n\n') + res.end() +} + +async function startMockLlm(): Promise { + const requests: CompletionRequest[] = [] + const held = new Set() + let holding = false + const server: Server = createServer((req, res) => { + if (req.method !== 'POST' || !req.url?.endsWith('/chat/completions')) { + res.writeHead(404) + res.end() + return + } + let raw = '' + req.on('data', (chunk: Buffer) => { + raw += chunk.toString() + }) + req.on('end', () => { + const body = JSON.parse(raw) as CompletionRequest['body'] + requests.push({ headers: req.headers, body }) + res.writeHead(200, { 'content-type': 'text/event-stream', 'cache-control': 'no-cache' }) + writeChunk(res, { role: 'assistant', content: 'partial ' }, null) + if (holding && body.tools) { + held.add(res) + res.on('close', () => held.delete(res)) + return + } + finishCompletion(res) + }) + }) + await new Promise((resolve) => server.listen(0, '127.0.0.1', () => resolve())) + return { + port: (server.address() as AddressInfo).port, + requests, + hold: (enabled) => { + holding = enabled + }, + releaseHeld: () => { + for (const res of held) finishCompletion(res) + held.clear() + }, + heldCount: () => held.size, + close: async () => { + server.closeAllConnections() + await new Promise((resolve) => server.close(() => resolve())) + }, + } +} + +function delay(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)) +} + +async function waitFor(description: string, probe: () => Promise): Promise { + const deadline = Date.now() + WAIT_TIMEOUT_MS + while (Date.now() < deadline) { + const value = await probe() + if (value !== undefined) return value + await delay(POLL_INTERVAL_MS) + } + throw new Error(`Timed out waiting for ${description}`) +} + +function mockProvider(port: number, pathSuffix: string, models: Record, settings: Record = {}) { + return { + package: '@opencode/ai/providers/openai-compatible', + name: `Mock ${pathSuffix}`, + settings: { baseURL: `http://127.0.0.1:${port}/${pathSuffix}`, apiKey: 'mock-key', ...settings }, + models, + } +} + +function buildBaseConfig(port: number): Record { + return { + providers: { + mock: mockProvider(port, 'v1', { 'mock-model': { name: 'Mock Model', capabilities: MOCK_MODEL_CAPABILITIES } }), + }, + model: 'mock/mock-model', + permissions: [{ action: '*', resource: '*', effect: 'allow' }], + } +} + +function buildReloadedConfig(port: number, pluginDirectory: string): Record { + return { + providers: { + mock: mockProvider( + port, + 'v1', + { + 'mock-model': { name: 'Mock Model', capabilities: MOCK_MODEL_CAPABILITIES }, + 'mock-alt': { name: 'Mock Alt', capabilities: MOCK_MODEL_CAPABILITIES }, + }, + { headers: { 'x-reload-probe': 'applied' } }, + ), + custom: mockProvider(port, 'v2', { 'custom-model': { name: 'Custom Model', capabilities: MOCK_MODEL_CAPABILITIES } }), + }, + model: 'mock/mock-alt', + agents: { reviewer: { description: 'Reviews changes', prompt: 'You review changes.' } }, + permissions: [ + { action: '*', resource: '*', effect: 'allow' }, + { action: 'webfetch', resource: '*', effect: 'deny' }, + ], + plugins: [pluginDirectory], + } +} + +const PROBE_PLUGIN_SOURCE = `export default { + id: 'probe.plugin', + async setup(ctx) { + await ctx.tool.transform(function (editor) { + editor.add({ + name: 'probe_tool', + description: 'Reload probe tool', + input: { type: 'object', properties: {} }, + options: { codemode: false }, + execute: async function () { + return { content: 'probe' } + }, + }) + }) + }, +} +` + +async function writeProbePlugin(directory: string): Promise { + await mkdir(directory, { recursive: true }) + await writeFile(path.join(directory, 'package.json'), JSON.stringify({ name: 'probe-plugin', version: '1.0.0', type: 'module', main: 'index.js' })) + await writeFile(path.join(directory, 'index.js'), PROBE_PLUGIN_SOURCE) +} + +async function writeConfigDirectoryFiles(configDirectory: string, projectDirectory: string): Promise { + await mkdir(path.join(configDirectory, 'agents'), { recursive: true }) + await writeFile(path.join(configDirectory, 'agents', 'mdagent.md'), '---\ndescription: Markdown agent\n---\nYou are a markdown agent.\n') + await mkdir(path.join(configDirectory, 'commands'), { recursive: true }) + await writeFile(path.join(configDirectory, 'commands', 'mdcmd.md'), '---\ndescription: Markdown command\n---\nRun the markdown command.\n') + await mkdir(path.join(configDirectory, 'skills', 'globalskill'), { recursive: true }) + await writeFile(path.join(configDirectory, 'skills', 'globalskill', 'SKILL.md'), '---\nname: globalskill\ndescription: Global skill\n---\nGlobal skill body.\n') + await writeFile(path.join(configDirectory, 'AGENTS.md'), `${GLOBAL_AGENTS_MARKER}\n`) + await mkdir(path.join(projectDirectory, '.opencode', 'skills', 'projectskill'), { recursive: true }) + await writeFile(path.join(projectDirectory, '.opencode', 'skills', 'projectskill', 'SKILL.md'), '---\nname: projectskill\ndescription: Project skill\n---\nProject skill body.\n') +} + +describe.skipIf(OPENCODE_BIN === null)('OpenCode 2 location reload applies configuration changes without a restart', () => { + let directories: OpenCodeServeDirectories + let serve: OpenCodeServe + let llm: MockLlm + let client: FetchOpenCodeClient + let workspace: string + let otherLocation: string + let configDirectory: string + let pluginDirectory: string + + async function requestJson(directory: string, pathname: string, init: RequestInit = {}): Promise { + const response = await fetch(`${serve.baseUrl}${pathname}`, { + ...init, + headers: { + Authorization: buildOpenCodeBasicAuth(serve.password), + 'content-type': 'application/json', + [OPENCODE_DIRECTORY_HEADER]: encodeURIComponent(directory), + }, + }) + const text = await response.text() + if (!response.ok) throw new Error(`${init.method ?? 'GET'} ${pathname} failed with ${response.status}: ${text}`) + return (text ? JSON.parse(text) : undefined) as T + } + + async function listIds(directory: string, pathname: string): Promise { + const body = await requestJson<{ data: Array<{ id?: string; name?: string }> }>(directory, pathname) + return body.data.map((entry) => entry.id ?? entry.name ?? '') + } + + async function readLoadedAgents(directory: string): Promise { + return waitFor(`agents to load in ${directory}`, async () => { + const agents = await listIds(directory, '/api/agent') + return agents.length > 0 ? agents : undefined + }) + } + + async function reloadWorkspaceLocation(): Promise { + await client.api.location.reload({ headers: { [OPENCODE_DIRECTORY_HEADER]: encodeURIComponent(workspace) } }) + } + + async function promptAndCaptureToolRequest(directory: string): Promise<{ sessionID: string; request: CompletionRequest }> { + const session = await requestJson<{ data: { id: string } }>(directory, '/api/session', { + method: 'POST', + body: JSON.stringify({ location: { directory } }), + }) + const firstRequest = llm.requests.length + await requestJson(directory, `/api/session/${session.data.id}/prompt`, { + method: 'POST', + body: JSON.stringify({ text: 'hello' }), + }) + const request = await waitFor('a completion request that offers tools', async () => + llm.requests.slice(firstRequest).find((candidate) => candidate.body.tools !== undefined), + ) + return { sessionID: session.data.id, request } + } + + function toolNames(request: CompletionRequest): string[] { + return (request.body.tools ?? []).map((tool) => tool.function?.name ?? '') + } + + beforeAll(async () => { + directories = await createOpenCodeServeDirectories() + workspace = path.join(directories.root, 'workspace') + otherLocation = path.join(directories.root, 'other-repo') + configDirectory = path.join(directories.configHome, 'opencode') + pluginDirectory = path.join(directories.root, 'probe-plugin') + await mkdir(workspace, { recursive: true }) + await mkdir(otherLocation, { recursive: true }) + await mkdir(configDirectory, { recursive: true }) + await writeProbePlugin(pluginDirectory) + llm = await startMockLlm() + await writeFile(path.join(configDirectory, 'opencode.json'), JSON.stringify(buildBaseConfig(llm.port))) + serve = await startOpenCodeServe({ directories, env: { OPENCODE_DISABLE_FILEWATCHER: '1' } }) + client = new FetchOpenCodeClient({ baseUrl: serve.baseUrl, basicAuth: buildOpenCodeBasicAuth(serve.password) }) + }, 120000) + + afterAll(async () => { + llm?.releaseHeld() + if (serve) await serve.terminate() + await llm?.close() + if (directories) await rm(directories.root, { recursive: true, force: true }) + }) + + it('applies agents, permissions, providers, models, plugins, and config directory files to every loaded location', async () => { + try { + expect(await readLoadedAgents(workspace)).not.toContain('reviewer') + expect(await readLoadedAgents(otherLocation)).not.toContain('reviewer') + const baseline = await promptAndCaptureToolRequest(workspace) + expect(toolNames(baseline.request)).toContain('webfetch') + expect(toolNames(baseline.request)).not.toContain('probe_tool') + + await writeFile(path.join(configDirectory, 'opencode.json'), JSON.stringify(buildReloadedConfig(llm.port, pluginDirectory))) + await writeConfigDirectoryFiles(configDirectory, otherLocation) + await delay(WATCHER_SETTLE_MS) + expect(await listIds(workspace, '/api/agent')).not.toContain('reviewer') + + await reloadWorkspaceLocation() + + const workspaceAgents = await waitFor('the reloaded workspace agents', async () => { + const agents = await listIds(workspace, '/api/agent') + return agents.includes('reviewer') ? agents : undefined + }) + expect(workspaceAgents).toEqual(expect.arrayContaining(['reviewer', 'mdagent'])) + + const otherAgents = await waitFor('the other location to see the reloaded agents', async () => { + const agents = await listIds(otherLocation, '/api/agent') + return agents.includes('reviewer') ? agents : undefined + }) + expect(otherAgents).toEqual(expect.arrayContaining(['reviewer', 'mdagent'])) + + const plugins = await requestJson<{ data: Array<{ id: string; state: { status: string } }> }>(workspace, '/api/plugin') + expect(plugins.data.find((plugin) => plugin.id === 'probe.plugin')?.state.status).toBe('active') + + const models = JSON.stringify(await requestJson(workspace, '/api/model')) + expect(models).toContain('"providerID":"custom"') + const defaultModel = await requestJson<{ data: { id: string; providerID: string } }>(workspace, '/api/model/default') + expect(defaultModel.data).toMatchObject({ id: 'mock-alt', providerID: 'mock' }) + + expect(JSON.stringify(await requestJson(workspace, '/api/command'))).toContain('mdcmd') + expect(JSON.stringify(await requestJson(workspace, '/api/skill'))).toContain('globalskill') + expect(JSON.stringify(await requestJson(otherLocation, '/api/skill'))).toContain('projectskill') + + const reloaded = await promptAndCaptureToolRequest(workspace) + expect(toolNames(reloaded.request)).toContain('probe_tool') + expect(toolNames(reloaded.request)).not.toContain('webfetch') + expect(reloaded.request.body.model).toBe('mock-alt') + expect(reloaded.request.headers['x-reload-probe']).toBe('applied') + expect(JSON.stringify(reloaded.request.body)).toContain(GLOBAL_AGENTS_MARKER) + } catch (error) { + throw new Error(`${error instanceof Error ? error.message : String(error)}\n${serve.readOutput()}`, { cause: error }) + } + }, 180000) + + it('keeps an in-flight session running across a location reload', async () => { + try { + llm.hold(true) + const { sessionID } = await promptAndCaptureToolRequest(workspace) + await waitFor('the held completion', async () => (llm.heldCount() > 0 ? true : undefined)) + + await reloadWorkspaceLocation() + await delay(WATCHER_SETTLE_MS) + + const active = await requestJson<{ data: Record }>(workspace, '/api/session/active') + expect(Object.keys(active.data)).toContain(sessionID) + expect(llm.heldCount()).toBe(1) + + llm.hold(false) + llm.releaseHeld() + + const messages = await waitFor('the session to finish its held turn', async () => { + const body = await requestJson<{ data: Array<{ type: string; outcome?: string; content?: Array<{ text?: string }> }> }>( + workspace, + `/api/session/${sessionID}/message`, + ) + return body.data.some((message) => message.type === 'idle') ? body.data : undefined + }) + expect(messages.find((message) => message.type === 'idle')?.outcome).toBe('succeeded') + const assistantText = messages.filter((message) => message.type === 'assistant').flatMap((message) => message.content ?? []).map((part) => part.text).join('') + expect(assistantText).toBe('partial done') + } catch (error) { + throw new Error(`${error instanceof Error ? error.message : String(error)}\n${serve.readOutput()}`, { cause: error }) + } finally { + llm.hold(false) + llm.releaseHeld() + } + }, 120000) +}) diff --git a/backend/test/integration/opencode-service-resume.test.ts b/backend/test/integration/opencode-service-resume.test.ts new file mode 100644 index 00000000..b04b0f8f --- /dev/null +++ b/backend/test/integration/opencode-service-resume.test.ts @@ -0,0 +1,187 @@ +import { describe, it, expect } from 'vitest' +import { createServer } from 'http' +import type { IncomingMessage, ServerResponse } from 'http' +import type { AddressInfo } from 'net' +import { mkdir, readFile, rm, writeFile } from 'fs/promises' +import path from 'path' +import { buildOpenCodeBasicAuth } from '@opencode-manager/shared/opencode' +import { + createOpenCodeServeDirectories, + resolveOpenCode2Binary, + startOpenCodeServe, +} from '../helpers/opencode-binary' +import type { OpenCodeServe } from '../helpers/opencode-binary' +import { getOpenCodeServiceRegistrationPath } from '../../src/services/opencode-service-mode' + +const OPENCODE_BIN = resolveOpenCode2Binary() +const RESTART_CONTINUE_TEXT = 'The server restarted while you were working. Continue from where you left off without repeating completed work.' +const POLL_INTERVAL_MS = 250 +const WAIT_TIMEOUT_MS = 60000 + +type MockLlm = { + port: number + requestBodies: string[] + respondFromNowOn: () => void + close: () => Promise +} + +function writeCompletion(res: ServerResponse): void { + res.writeHead(200, { 'content-type': 'text/event-stream', 'cache-control': 'no-cache' }) + const base = { id: 'chatcmpl-resume', object: 'chat.completion.chunk', created: 1, model: 'mock-model' } + res.write(`data: ${JSON.stringify({ ...base, choices: [{ index: 0, delta: { role: 'assistant', content: '' }, finish_reason: null }] })}\n\n`) + res.write(`data: ${JSON.stringify({ ...base, choices: [{ index: 0, delta: { content: 'resumed' }, finish_reason: null }] })}\n\n`) + res.write(`data: ${JSON.stringify({ ...base, choices: [{ index: 0, delta: {}, finish_reason: 'stop' }] })}\n\n`) + res.write('data: [DONE]\n\n') + res.end() +} + +function holdCompletionOpen(res: ServerResponse): void { + res.writeHead(200, { 'content-type': 'text/event-stream', 'cache-control': 'no-cache' }) + const base = { id: 'chatcmpl-held', object: 'chat.completion.chunk', created: 1, model: 'mock-model' } + res.write(`data: ${JSON.stringify({ ...base, choices: [{ index: 0, delta: { role: 'assistant', content: '' }, finish_reason: null }] })}\n\n`) +} + +async function startHoldingMockLlm(): Promise { + const requestBodies: string[] = [] + const openResponses = new Set() + let holding = true + const server = createServer((req: IncomingMessage, res: ServerResponse) => { + if (req.method === 'GET' && req.url?.endsWith('/models')) { + res.writeHead(200, { 'content-type': 'application/json' }) + res.end(JSON.stringify({ object: 'list', data: [{ id: 'mock-model', object: 'model' }] })) + return + } + if (req.method !== 'POST' || !req.url?.endsWith('/chat/completions')) { + res.writeHead(404) + res.end() + return + } + let body = '' + req.on('data', (chunk: Buffer) => { + body += chunk.toString() + }) + req.on('end', () => { + requestBodies.push(body) + if (holding) { + openResponses.add(res) + res.on('close', () => openResponses.delete(res)) + holdCompletionOpen(res) + return + } + writeCompletion(res) + }) + }) + await new Promise((resolve) => server.listen(0, '127.0.0.1', () => resolve())) + return { + port: (server.address() as AddressInfo).port, + requestBodies, + respondFromNowOn: () => { + holding = false + }, + close: async () => { + for (const res of openResponses) res.destroy() + server.closeAllConnections() + await new Promise((resolve) => server.close(() => resolve())) + }, + } +} + +async function waitFor(description: string, probe: () => Promise): Promise { + const deadline = Date.now() + WAIT_TIMEOUT_MS + while (Date.now() < deadline) { + const value = await probe() + if (value !== undefined) return value + await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS)) + } + throw new Error(`Timed out waiting for ${description}`) +} + +async function requestJson(serve: OpenCodeServe, pathname: string, init: RequestInit = {}): Promise { + const response = await fetch(`${serve.baseUrl}${pathname}`, { + ...init, + headers: { + Authorization: buildOpenCodeBasicAuth(serve.password), + 'content-type': 'application/json', + ...init.headers, + }, + }) + const text = await response.text() + if (!response.ok) throw new Error(`${init.method ?? 'GET'} ${pathname} failed with ${response.status}: ${text}`) + return (text ? JSON.parse(text) : undefined) as T +} + +async function readActiveSessionIDs(serve: OpenCodeServe): Promise { + const body = await requestJson<{ data: Record }>(serve, '/api/session/active') + return Object.keys(body.data) +} + +describe.skipIf(OPENCODE_BIN === null)('OpenCode 2 service mode resumes sessions interrupted by a graceful restart', () => { + it('re-drives a session that was active at SIGTERM once the service restarts on the same state', async () => { + const directories = await createOpenCodeServeDirectories() + const repoPath = path.join(directories.root, 'repo') + await mkdir(repoPath, { recursive: true }) + await mkdir(path.join(directories.configHome, 'opencode'), { recursive: true }) + const llm = await startHoldingMockLlm() + await writeFile( + path.join(directories.configHome, 'opencode', 'opencode.json'), + JSON.stringify({ + providers: { + mock: { + package: '@opencode/ai/providers/openai-compatible', + name: 'Mock', + settings: { baseURL: `http://127.0.0.1:${llm.port}/v1`, apiKey: 'mock-key' }, + models: { 'mock-model': { name: 'Mock Model' } }, + }, + }, + model: 'mock/mock-model', + permissions: [{ action: '*', resource: '*', effect: 'allow' }], + }), + ) + + let serve: OpenCodeServe | null = null + try { + serve = await startOpenCodeServe({ service: true, directories }) + const firstServe = serve + const registration = JSON.parse(await readFile(getOpenCodeServiceRegistrationPath({ XDG_CONFIG_HOME: directories.configHome, XDG_STATE_HOME: directories.stateHome }), 'utf8')) as { password: string } + expect(registration.password).toBe(firstServe.password) + + const session = await requestJson<{ data: { id: string } }>(firstServe, '/api/session', { + method: 'POST', + body: JSON.stringify({ location: { directory: repoPath } }), + }) + const sessionID = session.data.id + await requestJson(firstServe, `/api/session/${sessionID}/prompt`, { + method: 'POST', + body: JSON.stringify({ text: 'Start a long task' }), + }) + + await waitFor('the first LLM request', async () => (llm.requestBodies.length >= 1 ? true : undefined)) + await waitFor('the session to be active', async () => ((await readActiveSessionIDs(firstServe)).includes(sessionID) ? true : undefined)) + + const heldRequestCount = llm.requestBodies.length + llm.respondFromNowOn() + await firstServe.terminate() + serve = null + + serve = await startOpenCodeServe({ service: true, directories, port: firstServe.port, password: firstServe.password }) + const secondServe = serve + + const resumedRequest = await waitFor('a resumed LLM request', async () => + llm.requestBodies.slice(heldRequestCount).find((body) => body.includes(RESTART_CONTINUE_TEXT)), + ) + expect(resumedRequest).toContain(RESTART_CONTINUE_TEXT) + + const messages = await waitFor('the synthetic continue message', async () => { + const text = JSON.stringify(await requestJson(secondServe, `/api/session/${sessionID}/message`)) + return text.includes(RESTART_CONTINUE_TEXT) ? text : undefined + }) + expect(messages).toContain(RESTART_CONTINUE_TEXT) + } catch (error) { + throw new Error(`${error instanceof Error ? error.message : String(error)}\n${serve?.readOutput() ?? ''}`, { cause: error }) + } finally { + if (serve) await serve.terminate() + await llm.close() + await rm(directories.root, { recursive: true, force: true }) + } + }, 180000) +}) diff --git a/backend/test/integration/provider-credential-refresh.test.ts b/backend/test/integration/provider-credential-refresh.test.ts new file mode 100644 index 00000000..3cb57fbf --- /dev/null +++ b/backend/test/integration/provider-credential-refresh.test.ts @@ -0,0 +1,117 @@ +import { describe, it, expect, vi } from 'vitest' +import { buildOpenCodeBasicAuth } from '@opencode-manager/shared/opencode' +import { createProvidersRoutes } from '../../src/routes/providers' +import { FetchOpenCodeClient } from '../../src/services/opencode/client' +import { resolveOpenCode2Binary, startOpenCodeServe } from '../helpers/opencode-binary' +import type { OpenCodeServe } from '../helpers/opencode-binary' + +vi.mock('../../src/utils/logger', () => ({ + logger: { + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + debug: vi.fn(), + }, +})) + +const PROVIDER_ID = 'anthropic' +const EVENT_TIMEOUT_MS = 30000 + +type EventStream = { + types: string[] + waitFor: (type: string, fromIndex?: number) => Promise + close: () => void +} + +async function openEventStream(serve: OpenCodeServe): Promise { + const controller = new AbortController() + const response = await fetch(`${serve.baseUrl}/api/event`, { + headers: { Authorization: buildOpenCodeBasicAuth(serve.password), Accept: 'text/event-stream' }, + signal: controller.signal, + }) + if (!response.ok || !response.body) throw new Error(`event stream failed with status ${response.status}`) + + const types: string[] = [] + const listeners = new Set<() => void>() + const reader = response.body.getReader() + const decoder = new TextDecoder() + + void (async () => { + let buffer = '' + try { + while (true) { + const { value, done } = await reader.read() + if (done) return + buffer += decoder.decode(value, { stream: true }) + const lines = buffer.split('\n') + buffer = lines.pop() ?? '' + for (const line of lines) { + if (!line.startsWith('data:')) continue + const event = JSON.parse(line.slice(5)) as { type: string } + types.push(event.type) + for (const listener of listeners) listener() + } + } + } catch { + return + } + })() + + const waitFor = (type: string, fromIndex = 0) => new Promise((resolve, reject) => { + const check = () => { + if (!types.slice(fromIndex).includes(type)) return false + listeners.delete(listener) + clearTimeout(timer) + resolve() + return true + } + const listener = () => { + check() + } + const timer = setTimeout(() => { + listeners.delete(listener) + reject(new Error(`event ${type} was not emitted; received ${types.slice(fromIndex).join(', ')}`)) + }, EVENT_TIMEOUT_MS) + listeners.add(listener) + check() + }) + + return { types, waitFor, close: () => controller.abort() } +} + +describe.skipIf(!resolveOpenCode2Binary())('provider credential refresh against a real OpenCode 2 server', () => { + it('lists the provider and its models after a key is connected immediately after server start', async () => { + const serve = await startOpenCodeServe({ env: { ANTHROPIC_API_KEY: '' } }) + const events = await openEventStream(serve) + try { + const client = new FetchOpenCodeClient({ + baseUrl: serve.baseUrl, + basicAuth: buildOpenCodeBasicAuth(serve.password), + }) + const app = createProvidersRoutes(client) + + const eventIndex = events.types.length + const connectResponse = await app.request(`/${PROVIDER_ID}/credentials`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ apiKey: 'sk-ant-e2e-test-key' }), + }) + expect(connectResponse.status).toBe(200) + + const providersAfter = (await client.api.provider.list()).data.map((provider) => provider.id) + const modelsAfter = (await client.api.model.list()).data.filter((model) => model.providerID === PROVIDER_ID) + expect(providersAfter).toContain(PROVIDER_ID) + expect(modelsAfter.length).toBeGreaterThan(0) + + const statusAfter = await app.request(`/${PROVIDER_ID}/credentials/status`) + expect(await statusAfter.json()).toEqual({ hasCredentials: true }) + + await events.waitFor('credential.updated', eventIndex) + await events.waitFor('provider.updated', eventIndex) + await events.waitFor('model.updated', eventIndex) + } finally { + events.close() + await serve.stop() + } + }, 120000) +}) diff --git a/backend/test/routes/internal-assistant.test.ts b/backend/test/routes/internal-assistant.test.ts index b6fcdb36..e28172ac 100644 --- a/backend/test/routes/internal-assistant.test.ts +++ b/backend/test/routes/internal-assistant.test.ts @@ -11,6 +11,13 @@ import { migrate } from '../../src/db/migration-runner' import type { OpenCodeClient } from '../../src/services/opencode/client' import type { ScheduleWorktreeManager } from '../../src/services/schedule-worktree' +const readOpenCodeConfigFileMock = vi.hoisted(() => vi.fn()) + +vi.mock('../../src/services/opencode-config-file', async (importOriginal) => ({ + ...await importOriginal(), + readOpenCodeConfigFile: readOpenCodeConfigFileMock, +})) + describe('internal/assistant routes', () => { let db: Database let scheduleService: ScheduleService @@ -24,6 +31,7 @@ describe('internal/assistant routes', () => { db = new Database(':memory:') migrate(db, allMigrations) + readOpenCodeConfigFileMock.mockReset().mockResolvedValue({ isValid: true }) reloadMock = vi.fn().mockResolvedValue(undefined) const openCodeClient = { api: { location: { reload: reloadMock } }, @@ -54,7 +62,7 @@ describe('internal/assistant routes', () => { expect(body.success).toBe(true) }) - it('reloads every loaded location without a directory argument', async () => { + it('reloads OpenCode through the shared location reload without a directory argument', async () => { await app.request('/api/internal/assistant/reload', { method: 'POST', headers: { authorization: `Bearer ${token}` }, @@ -107,4 +115,17 @@ describe('internal/assistant routes', () => { expect(body.error).toBe('Failed to reload assistant workspace') }) + it('returns 400 without reloading when the OpenCode config is invalid', async () => { + const validationIssues = [{ path: 'model', message: 'Invalid model' }] + readOpenCodeConfigFileMock.mockResolvedValue({ isValid: false, validationIssues }) + const res = await app.request('/api/internal/assistant/reload', { + method: 'POST', + headers: { authorization: `Bearer ${token}` }, + }) + expect(res.status).toBe(400) + const body = await res.json() as { error: string; validationIssues: unknown } + expect(body).toEqual({ error: 'OpenCode global configuration is invalid', validationIssues }) + expect(reloadMock).not.toHaveBeenCalled() + }) + }) diff --git a/backend/test/routes/internal-opencode-config.test.ts b/backend/test/routes/internal-opencode-config.test.ts index 5f40b61b..5358c5fe 100644 --- a/backend/test/routes/internal-opencode-config.test.ts +++ b/backend/test/routes/internal-opencode-config.test.ts @@ -23,6 +23,7 @@ describe('internal/opencode-config routes', () => { let ws: Awaited> let configGetMock: ReturnType let forwardRawMock: ReturnType + let locationReloadMock: ReturnType function configPath(name: string): string { return path.join(ws.workspacePath, '.config/opencode', name) @@ -38,8 +39,9 @@ describe('internal/opencode-config routes', () => { migrate(db, allMigrations) configGetMock = vi.fn(() => Promise.resolve([])) forwardRawMock = vi.fn(() => Promise.resolve(new Response('{}'))) + locationReloadMock = vi.fn(() => Promise.resolve()) const openCodeClient = { - api: { config: { get: configGetMock } }, + api: { config: { get: configGetMock }, location: { reload: locationReloadMock } }, forwardRaw: forwardRawMock, } as unknown as OpenCodeClient const stubWorktreeManager = { prepare: () => Promise.resolve(null), finalize: () => Promise.resolve({ commitHash: null }) } as unknown as ScheduleWorktreeManager @@ -91,7 +93,7 @@ describe('internal/opencode-config routes', () => { expect(body.revision).toMatch(/^[a-f0-9]{64}$/) }) - it('PUT /api/internal/opencode-config writes the file, reports restartRequired, and never calls the OpenCode API', async () => { + it('PUT /api/internal/opencode-config writes the file and applies it through a location reload without a restart', async () => { await writeOpenCodeConfigFile(OPENCODE_CONFIG_SEED, 'opencode.jsonc') const res = await app.request('/api/internal/opencode-config', { @@ -102,8 +104,9 @@ describe('internal/opencode-config routes', () => { expect(res.status).toBe(200) const body = await res.json() as { restartRequired?: boolean; content: Record } - expect(body.restartRequired).toBe(true) + expect(body.restartRequired).toBeUndefined() expect(body.content).toEqual({ $schema: 'https://opencode.ai/config.json', plugin: ['x'] }) + expect(locationReloadMock).toHaveBeenCalledTimes(1) expect(configGetMock).not.toHaveBeenCalled() expect(forwardRawMock).not.toHaveBeenCalled() @@ -124,6 +127,7 @@ describe('internal/opencode-config routes', () => { expect(res.status).toBe(200) const body = await res.json() as { restartRequired?: boolean } expect(body.restartRequired).toBeUndefined() + expect(locationReloadMock).not.toHaveBeenCalled() await expect(readFile(configPath('opencode.json'), 'utf8')).resolves.toBe(commented) }) diff --git a/backend/test/routes/mcp-oauth-proxy.test.ts b/backend/test/routes/mcp-oauth-proxy.test.ts index 613fb0f7..df7c2dc1 100644 --- a/backend/test/routes/mcp-oauth-proxy.test.ts +++ b/backend/test/routes/mcp-oauth-proxy.test.ts @@ -93,10 +93,11 @@ function createApp(client: OpenCodeClient = createClient(), requireAuth?: Middle async function startFlow( app: ReturnType, body: Record = {}, + headers: Record = {}, ): Promise { return app.request('/start', { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json', ...headers }, body: JSON.stringify({ serverName: SERVER_NAME, ...body }), }) } @@ -324,6 +325,59 @@ describe('mcp oauth proxy routes', () => { expect(api.mcp.list).toHaveBeenCalledTimes(1) }) + describe('redirect origin', () => { + const remoteServerApi = () => createApi({ + config: { + get: vi.fn(async () => [ + { + type: 'document' as const, + path: '/tmp/repo/opencode.json', + info: { + mcp: { servers: { [SERVER_NAME]: { type: 'remote' as const, url: 'https://mcp.example.com' } } }, + }, + }, + ]), + }, + }) + + const redirectUriFor = async (headers: Record) => { + const api = remoteServerApi() + const res = await startFlow(createApp(createClient(api)), {}, headers) + expect(res.status).toBe(200) + const [input] = (api.mcp.add as ReturnType).mock.calls[0] as [ + { config: { oauth: { redirect_uri: string } } }, + ] + return input.config.oauth.redirect_uri + } + + it('prefers the first X-Forwarded-Proto value with X-Forwarded-Host over Origin', async () => { + expect( + await redirectUriFor({ + 'X-Forwarded-Proto': 'https, http', + 'X-Forwarded-Host': 'manager.example.com, proxy.internal', + Host: 'localhost:5003', + Origin: 'http://ignored.example.com', + }), + ).toBe(`https://manager.example.com${CALLBACK_PATH}`) + }) + + it('uses X-Forwarded-Proto with the Host header when no forwarded host is sent', async () => { + expect(await redirectUriFor({ 'X-Forwarded-Proto': 'https', Host: 'manager.example.com' })).toBe( + `https://manager.example.com${CALLBACK_PATH}`, + ) + }) + + it('ignores an unsupported X-Forwarded-Proto and falls back to Origin', async () => { + expect( + await redirectUriFor({ 'X-Forwarded-Proto': 'javascript', Origin: 'https://origin.example.com' }), + ).toBe(`https://origin.example.com${CALLBACK_PATH}`) + }) + + it('falls back to http on the host without forwarded headers or Origin', async () => { + expect(await redirectUriFor({ Host: 'manager.local:5003' })).toBe(`http://manager.local:5003${CALLBACK_PATH}`) + }) + }) + it('ignores config entries that are not remote OAuth servers', async () => { const api = createApi({ config: { diff --git a/backend/test/routes/opencode-proxy.test.ts b/backend/test/routes/opencode-proxy.test.ts index ce219f10..a336d6e5 100644 --- a/backend/test/routes/opencode-proxy.test.ts +++ b/backend/test/routes/opencode-proxy.test.ts @@ -9,6 +9,7 @@ import { Hono } from 'hono' import { serve } from '@hono/node-server' import type { Database } from 'bun:sqlite' import { buildOpenCodeBasicAuth } from '@opencode-manager/shared/opencode' +import { getWorkspacePath } from '@opencode-manager/shared/config/env' import { createOpenCodeProxyRoutes } from '../../src/routes/opencode-proxy' import type { SettingsService } from '../../src/services/settings' import { OpenCodeSupervisor } from '../../src/services/opencode-supervisor' @@ -36,7 +37,8 @@ vi.mock('../../src/db/queries', () => ({ const upstreamBaseUrl = vi.hoisted(() => ({ value: 'http://127.0.0.1:5551' })) -vi.mock('../../src/services/opencode/upstream', () => ({ +vi.mock('../../src/services/opencode/upstream', async (importOriginal) => ({ + ...await importOriginal(), getOpenCodeUpstreamBaseUrl: () => upstreamBaseUrl.value, })) @@ -204,6 +206,17 @@ describe('opencode-proxy routes', () => { expect(fetchHeaders['x-opencode-workspace']).toBe('my-workspace') }) + it('defaults x-opencode-directory to the workspace when the caller sends no location', async () => { + const upstreamFetch = upstreamOk() + + await app.request('/api/opencode-proxy/doc', { + headers: { Authorization: 'Bearer test-internal-token' }, + }) + + const fetchHeaders = (upstreamFetch.mock.calls[0] as [string, RequestInit])[1].headers as Record + expect(fetchHeaders['x-opencode-directory']).toBe(encodeURIComponent(getWorkspacePath())) + }) + it('returns 501 for WebSocket upgrade requests', async () => { const res = await app.request('/api/opencode-proxy/ws', { headers: { diff --git a/backend/test/routes/settings.test.ts b/backend/test/routes/settings.test.ts index 247c6e78..b11024d4 100644 --- a/backend/test/routes/settings.test.ts +++ b/backend/test/routes/settings.test.ts @@ -291,12 +291,13 @@ vi.mock('@opencode-manager/shared/config/env', () => ({ })) import { createSettingsRoutes } from '../../src/routes/settings' +import { clearOpenCodeVersionCache } from '../../src/services/opencode-installer' import { getImportedSessionDirectories, getOpenCodeImportStatus, OpenCodeImportProtectionError, syncOpenCodeImport } from '../../src/services/opencode-import' import { relinkReposFromSessionDirectories } from '../../src/services/repo' import { opencodeServerManager } from '../../src/services/opencode-single-server' import { detectSandboxCapability } from '../../src/services/sandbox/capability' import { forceProcessAttestation } from '../../src/services/opencode/process-identity' -import { setOpenCodeRestartCoordinator } from '../../src/services/opencode-restart' +import { sseAggregator } from '../../src/services/sse-aggregator' import { createRepo } from '../../src/db/queries' import type { OpenCodeClient } from '../../src/services/opencode/client' @@ -428,6 +429,7 @@ describe('Settings Routes - OpenCode Upgrade', () => { source: undefined, expectedRevision: undefined, settingsService: expect.anything(), + openCodeClient: expect.anything(), }) }) @@ -455,6 +457,7 @@ describe('Settings Routes - OpenCode Upgrade', () => { source: undefined, expectedRevision: undefined, settingsService: expect.anything(), + openCodeClient: expect.anything(), }) }) @@ -531,7 +534,7 @@ describe('Settings Routes - OpenCode Upgrade', () => { const json = await res.json() as Record expect(res.status).toBe(200) - expect(json).toEqual({ success: true, message: 'Server reloaded with the previous working config' }) + expect(json).toEqual({ success: true, message: 'Server restarted with the previous working config' }) expect(mockRestoreOpenCodeConfigSnapshot).toHaveBeenCalledWith('{"theme":"dark"}') expect(mockClearStartupError).toHaveBeenCalled() expect(mockRestart).toHaveBeenCalled() @@ -753,6 +756,20 @@ describe('Settings Routes - OpenCode Upgrade', () => { expect(mockRestart).not.toHaveBeenCalled() }) + it('should replace an unsupported newer major with the latest supported release', async () => { + mockGetVersion.mockReturnValueOnce('3.0.0') + mockLatestOpenCodeVersion.mockResolvedValueOnce('2.0.15') + mockFetchVersion.mockResolvedValueOnce('2.0.15') + mockInstallOpenCodeVersion.mockResolvedValueOnce('/home/node/.opencode/bin/opencode') + + const res = await settingsApp.fetch(new Request('http://localhost/opencode-upgrade', { method: 'POST' })) + const json = await res.json() as Record + + expect(res.status).toBe(200) + expect(json.upgraded).toBe(true) + expect(mockInstallOpenCodeVersion).toHaveBeenCalledWith('2.0.15') + }) + it('should restart directly after a successful upgrade', async () => { mockGetVersion.mockReturnValueOnce('2.0.14') mockLatestOpenCodeVersion.mockResolvedValueOnce('2.0.15') @@ -1037,7 +1054,31 @@ describe('Settings Routes - OpenCode Upgrade', () => { const json = await res.json() as Record expect(res.status).toBe(400) - expect(json.error).toBe('OpenCode 2.0.0 or newer is required') + expect(json.error).toBe('OpenCode 1.18.32 is not supported; OpenCode Manager requires OpenCode >=2.0.15 <3.0.0') + expect(mockInstallOpenCodeVersion).not.toHaveBeenCalled() + }) + + it.each(['2.0.14', '3.0.0'])('should reject %s outside the supported range before installing anything', async (version) => { + const res = await settingsApp.fetch(new Request('http://localhost/opencode-install-version', { + method: 'POST', + body: JSON.stringify({ version }), + headers: { 'Content-Type': 'application/json' } + })) + const json = await res.json() as Record + + expect(res.status).toBe(400) + expect(json.error).toBe(`OpenCode ${version} is not supported; OpenCode Manager requires OpenCode >=2.0.15 <3.0.0`) + expect(mockInstallOpenCodeVersion).not.toHaveBeenCalled() + }) + + it('should reject a prerelease version before installing anything', async () => { + const res = await settingsApp.fetch(new Request('http://localhost/opencode-install-version', { + method: 'POST', + body: JSON.stringify({ version: '2.1.0-beta.1' }), + headers: { 'Content-Type': 'application/json' } + })) + + expect(res.status).toBe(400) expect(mockInstallOpenCodeVersion).not.toHaveBeenCalled() }) }) @@ -1123,35 +1164,38 @@ describe('Settings Routes - OpenCode Upgrade', () => { isValid: true, updatedAt: 1, } + let openCodeClient: ReturnType + let app: ReturnType + let supervisor: { restart: ReturnType } beforeEach(() => { vi.clearAllMocks() - setOpenCodeRestartCoordinator(null) mockReadOpenCodeConfigFile.mockReset() mockRestart.mockReset() - mockClearStartupError.mockReset() - mockRestart.mockResolvedValue(undefined) - mockClearStartupError.mockReturnValue(undefined) + openCodeClient = createStubOpenCodeClient() + supervisor = { restart: vi.fn().mockResolvedValue({ healthy: true }) } + app = createSettingsRoutes( + testDb, + { getGitEnvironment: vi.fn().mockReturnValue({}) } as any, + openCodeClient, + supervisor as any, + ) }) - it('should return success and restart the server when the config is valid', async () => { + it('reloads the OpenCode configuration without restarting the server when the config is valid', async () => { mockReadOpenCodeConfigFile.mockResolvedValueOnce(validConfigFile) - const req = new Request('http://localhost/opencode-reload', { - method: 'POST' - }) - const res = await settingsApp.fetch(req) + const res = await app.fetch(new Request('http://localhost/opencode-reload', { method: 'POST' })) const json = await res.json() as Record expect(res.status).toBe(200) - expect(json.success).toBe(true) - expect(json.message).toBe('OpenCode server restarted with the current configuration') - expect(json.resumedSessions).toEqual([]) - expect(mockRestart).toHaveBeenCalledTimes(1) - expect(mockClearStartupError).toHaveBeenCalled() + expect(json).toEqual({ success: true, message: 'OpenCode configuration reloaded' }) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(supervisor.restart).not.toHaveBeenCalled() + expect(mockRestart).not.toHaveBeenCalled() }) - it('should propagate validationIssues and not restart when the config is invalid', async () => { + it('should propagate validationIssues and not reload when the config is invalid', async () => { const validationIssues = [ { path: 'command.review', message: 'Invalid field' }, { path: 'agent.temperature', message: 'Temperature out of range' } @@ -1159,92 +1203,39 @@ describe('Settings Routes - OpenCode Upgrade', () => { mockReadOpenCodeConfigFile.mockResolvedValueOnce({ ...validConfigFile, isValid: false, validationIssues }) - const req = new Request('http://localhost/opencode-reload', { - method: 'POST' - }) - const res = await settingsApp.fetch(req) + const res = await app.fetch(new Request('http://localhost/opencode-reload', { method: 'POST' })) const json = await res.json() as Record expect(res.status).toBe(500) expect(json.error).toBe('OpenCode global configuration is invalid') expect(json.details).toBe('command.review: Invalid field; agent.temperature: Temperature out of range') expect(json.validationIssues).toEqual(validationIssues) - expect(mockRestart).not.toHaveBeenCalled() + expect(openCodeClient.api.location.reload).not.toHaveBeenCalled() }) - it('should return 500 and not restart when every global config source is absent', async () => { + it('should return 500 and not reload when every global config source is absent', async () => { mockReadOpenCodeConfigFile.mockResolvedValueOnce(null) - const req = new Request('http://localhost/opencode-reload', { - method: 'POST' - }) - const res = await settingsApp.fetch(req) + const res = await app.fetch(new Request('http://localhost/opencode-reload', { method: 'POST' })) const json = await res.json() as Record expect(res.status).toBe(500) expect(json.error).toBe('No OpenCode global configuration files found') expect(json.details).toBe('No OpenCode global configuration files found') - expect(mockRestart).not.toHaveBeenCalled() + expect(openCodeClient.api.location.reload).not.toHaveBeenCalled() }) - it('should return generic error when the restart fails', async () => { + it('should return a generic error when the location reload fails', async () => { mockReadOpenCodeConfigFile.mockResolvedValueOnce(validConfigFile) - mockRestart.mockRejectedValueOnce(new Error('Some other error')) + vi.mocked(openCodeClient.api.location.reload).mockRejectedValueOnce(new Error('Some other error')) - const req = new Request('http://localhost/opencode-reload', { - method: 'POST' - }) - const res = await settingsApp.fetch(req) + const res = await app.fetch(new Request('http://localhost/opencode-reload', { method: 'POST' })) const json = await res.json() as Record expect(res.status).toBe(500) expect(json.error).toBe('Failed to reload OpenCode configuration') expect(json.details).toBe('Some other error') - }) - - it('returns 500 with the startup failure reason when a supervisor restart is unhealthy', async () => { - mockReadOpenCodeConfigFile.mockResolvedValueOnce(validConfigFile) - mockGetLastStartupError.mockReturnValue('OpenCode restart failed after recovery') - const unhealthySupervisor = { - restart: vi.fn().mockResolvedValue({ healthy: false }), - } - const app = createSettingsRoutes( - testDb, - { getGitEnvironment: vi.fn().mockReturnValue({}) } as any, - createStubOpenCodeClient(), - unhealthySupervisor as any, - ) - - const req = new Request('http://localhost/opencode-reload', { method: 'POST' }) - const res = await app.fetch(req) - const json = await res.json() as Record - - expect(res.status).toBe(500) - expect(json.success).toBeUndefined() - expect(json.error).toBe('Failed to reload OpenCode configuration') - expect(json.details).toBe('OpenCode restart failed after recovery') - expect(unhealthySupervisor.restart).toHaveBeenCalledWith('settings_reload') - }) - - it('returns success when a supervisor restart is healthy', async () => { - mockReadOpenCodeConfigFile.mockResolvedValueOnce(validConfigFile) - const healthySupervisor = { - restart: vi.fn().mockResolvedValue({ healthy: true }), - } - const app = createSettingsRoutes( - testDb, - { getGitEnvironment: vi.fn().mockReturnValue({}) } as any, - createStubOpenCodeClient(), - healthySupervisor as any, - ) - - const req = new Request('http://localhost/opencode-reload', { method: 'POST' }) - const res = await app.fetch(req) - const json = await res.json() as Record - - expect(res.status).toBe(200) - expect(json.success).toBe(true) - expect(healthySupervisor.restart).toHaveBeenCalledWith('settings_reload') + expect(supervisor.restart).not.toHaveBeenCalled() }) }) @@ -1299,7 +1290,7 @@ describe('Settings Routes - OpenCode Upgrade', () => { expect(res.status).toBe(200) expect(json.success).toBe(true) expect(json.message).toBe('OpenCode server restarted successfully') - expect(json.resumedSessions).toEqual([]) + expect(json.interruptedSessions).toEqual([]) }) it('returns 500 when a manager restart fails without a supervisor', async () => { @@ -1448,6 +1439,25 @@ describe('Settings Routes - OpenCode Upgrade', () => { expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) }) + it.each([ + ['server environment variables', { serverEnvVars: [] }, { serverEnvVars: [{ key: 'FOO', value: 'bar' }] }], + ['disabled default server environment variables', { disabledDefaultServerEnvVars: [] }, { disabledDefaultServerEnvVars: ['NODE_OPTIONS'] }], + ])('requires a restart when the %s change', async (_label, previous, next) => { + mockGetSettings.mockReturnValue({ preferences: previous, updatedAt: 1 }) + mockUpdateSettings.mockReturnValue({ preferences: next, updatedAt: 2 }) + + const res = await settingsApp.fetch(new Request('http://localhost/', { + method: 'PATCH', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ preferences: next }), + })) + const json = await res.json() as Record + + expect(res.status).toBe(200) + expect(json.restartRequired).toBe(true) + expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + }) + it('does not require a restart when git credentials are resubmitted unchanged', async () => { const credential = { id: 'cred-1', name: 'gh', host: 'github.com', type: 'pat', token: 'same-token' } mockGetSettings.mockReturnValue({ @@ -1699,9 +1709,10 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan db = new Database(':memory:') migrate(db, allMigrations) supervisor = { - restart: vi.fn().mockResolvedValue({ healthy: true, resumedSessionIDs: [] }), + restart: vi.fn().mockResolvedValue({ healthy: true }), } openCodeClient = createStubOpenCodeClient() + mockReadOpenCodeConfigFile.mockReset().mockResolvedValue({ isValid: true }) app = createSettingsRoutes( db, { getGitEnvironment: vi.fn().mockReturnValue({}) } as any, @@ -1710,6 +1721,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan ) fetchMock = vi.fn() vi.stubGlobal('fetch', fetchMock) + clearOpenCodeVersionCache() mockGetVersion.mockReturnValue('2.0.15') mockFetchVersion.mockResolvedValue('2.0.15') mockInstallOpenCodeVersion.mockReset() @@ -1724,7 +1736,6 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan }) afterEach(() => { - setOpenCodeRestartCoordinator(null) db.close() vi.unstubAllGlobals() }) @@ -1736,12 +1747,13 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan '1.18.32': {}, '2.0.14': {}, '2.0.15': {}, + '2.0.16': {}, '2.1.0-beta.1': {}, '3.0.0': {}, }, time: { - '2.0.14': '2026-01-01T00:00:00Z', '2.0.15': '2026-01-02T00:00:00Z', + '2.0.16': '2026-01-03T00:00:00Z', }, }), { status: 200 })) @@ -1751,12 +1763,22 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(res.status).toBe(200) expect(json.currentVersion).toBe('2.0.15') expect(json.versions).toEqual([ + { version: '2.0.16', tag: 'v2.0.16', name: 'v2.0.16', publishedAt: '2026-01-03T00:00:00Z' }, { version: '2.0.15', tag: 'v2.0.15', name: 'v2.0.15', publishedAt: '2026-01-02T00:00:00Z' }, - { version: '2.0.14', tag: 'v2.0.14', name: 'v2.0.14', publishedAt: '2026-01-01T00:00:00Z' }, ]) expect(fetchMock).toHaveBeenCalledWith('https://registry.npmjs.org/@opencode/cli') }) + it('serves repeated requests from the installer cache', async () => { + fetchMock.mockImplementation(async () => new Response(JSON.stringify({ versions: { '2.0.15': {} }, time: {} }), { status: 200 })) + + await app.request(new Request('http://localhost/opencode-versions')) + const res = await app.request(new Request('http://localhost/opencode-versions')) + + expect(res.status).toBe(200) + expect(fetchMock).toHaveBeenCalledTimes(1) + }) + it('returns 500 when the registry request fails', async () => { fetchMock.mockResolvedValue(new Response('unavailable', { status: 503 })) @@ -1795,7 +1817,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan mockGetVersion.mockReturnValue('2.0.14') mockFetchVersion.mockResolvedValue('2.0.15') mockInstallOpenCodeVersion.mockRejectedValueOnce(new Error('download failed')) - supervisor.restart.mockResolvedValue({ healthy: false, resumedSessionIDs: [] }) + supervisor.restart.mockResolvedValue({ healthy: false }) const res = await app.request(new Request('http://localhost/opencode-install-version', { method: 'POST', @@ -1866,7 +1888,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(await res.json()).toEqual({ error: 'Invalid request', details: expect.any(Array) }) }) - it('updates a directory file and marks a restart pending', async () => { + it('updates a directory file and reloads OpenCode', async () => { mockUpdateOpenCodeDirectoryFile.mockResolvedValue({ kind: 'commands', name: 'review', @@ -1884,10 +1906,11 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan kind: 'commands', name: 'review', relativePath: 'review.md', - restartRequired: true, + restartRequired: false, }) expect(mockUpdateOpenCodeDirectoryFile).toHaveBeenCalledWith('commands', 'review.md', 'Updated') - expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() }) it('returns 400 when updating a directory file with an invalid body', async () => { @@ -1902,7 +1925,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(mockUpdateOpenCodeDirectoryFile).not.toHaveBeenCalled() }) - it('deletes a directory file and marks a restart pending', async () => { + it('deletes a directory file and reloads OpenCode', async () => { mockDeleteOpenCodeDirectoryFile.mockResolvedValue(undefined) const res = await app.request(new Request('http://localhost/opencode-directory-files?kind=agents&relativePath=assistant.md', { @@ -1910,9 +1933,10 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan })) expect(res.status).toBe(200) - expect(await res.json()).toEqual({ kind: 'agents', relativePath: 'assistant.md', restartRequired: true }) + expect(await res.json()).toEqual({ kind: 'agents', relativePath: 'assistant.md', restartRequired: false }) expect(mockDeleteOpenCodeDirectoryFile).toHaveBeenCalledWith('agents', 'assistant.md') - expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() }) it('returns 400 when installing directory files without multipart form data', async () => { @@ -1926,7 +1950,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(await res.json()).toEqual({ error: 'Unsupported content type. Use multipart/form-data' }) }) - it('installs uploaded directory files and marks a restart pending', async () => { + it('installs uploaded directory files and reloads OpenCode', async () => { mockInstallOpenCodeDirectoryFiles.mockResolvedValue({ kind: 'agents', filesInstalled: ['assistant.md'] }) const formData = new FormData() @@ -1943,12 +1967,28 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(await res.json()).toEqual({ kind: 'agents', filesInstalled: ['assistant.md'], - restartRequired: true, + restartRequired: false, }) expect(mockInstallOpenCodeDirectoryFiles).toHaveBeenCalledWith('agents', [ { relativePath: 'assistant.md', content: expect.any(Buffer) }, ]) - expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() + }) + }) + + describe('PUT /agents-md', () => { + it('writes AGENTS.md and reloads OpenCode without restarting the server', async () => { + const res = await app.request(new Request('http://localhost/agents-md', { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ content: '# Rules' }), + })) + + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ success: true, restartRequired: false }) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(supervisor.restart).not.toHaveBeenCalled() }) }) @@ -2005,7 +2045,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(await res.json()).toEqual({ error: 'Skill not found' }) }) - it('creates a skill and marks a restart pending', async () => { + it('creates a skill and reloads OpenCode', async () => { mockCreateSkill.mockResolvedValue({ name: 'review', description: 'Review changes', @@ -2027,9 +2067,10 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan body: 'body', scope: 'global', location: '/tmp/review', - restartRequired: true, + restartRequired: false, }) - expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() }) it('returns 409 when creating a skill that already exists', async () => { @@ -2045,7 +2086,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(await res.json()).toEqual({ error: 'Skill already exists' }) }) - it('updates a skill and marks a restart pending', async () => { + it('updates a skill and reloads OpenCode', async () => { mockUpdateSkill.mockResolvedValue({ name: 'review', description: 'Updated', @@ -2067,20 +2108,34 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan body: 'body', scope: 'global', location: '/tmp/review', - restartRequired: true, + restartRequired: false, }) - expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() }) - it('deletes a skill and marks a restart pending', async () => { + it('deletes a skill and reloads OpenCode', async () => { mockDeleteSkill.mockResolvedValue(undefined) const res = await app.request(new Request('http://localhost/skills/review?scope=global', { method: 'DELETE' })) expect(res.status).toBe(200) - expect(await res.json()).toEqual({ success: true, restartRequired: true }) + expect(await res.json()).toEqual({ success: true, restartRequired: false }) expect(mockDeleteSkill).toHaveBeenCalledWith(db, 'review', 'global', undefined) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() + }) + + it('marks a restart pending when reloading OpenCode after a skill change fails', async () => { + mockDeleteSkill.mockResolvedValue(undefined) + vi.mocked(openCodeClient.api.location.reload).mockRejectedValueOnce(new Error('OpenCode server unavailable')) + + const res = await app.request(new Request('http://localhost/skills/review?scope=global', { method: 'DELETE' })) + + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ success: true, restartRequired: true }) expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + expect(supervisor.restart).not.toHaveBeenCalled() }) it('returns 400 when installing a project skill without a repoId', async () => { @@ -2094,7 +2149,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(await res.json()).toEqual({ error: 'repoId is required for project scope' }) }) - it('installs a global skill from a GitHub tree and marks a restart pending', async () => { + it('installs a global skill from a GitHub tree and reloads OpenCode', async () => { mockInstallSkillFromGithubTree.mockResolvedValue({ skill: { name: 'review', description: 'Review', body: 'body', scope: 'global', location: '/tmp/review' }, overwritten: false, @@ -2114,12 +2169,13 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan overwritten: false, sourceType: 'github', filesInstalled: ['SKILL.md'], - restartRequired: true, + restartRequired: false, }) - expect(opencodeServerManager.markRestartPending).toHaveBeenCalledTimes(1) + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) + expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() }) - it('reloads a project skill without restarting the whole server', async () => { + it('reloads OpenCode for a project skill without restarting the server', async () => { const repo = createRepo(db, { localPath: 'project-repo', defaultBranch: 'main', cloneStatus: 'ready', clonedAt: Date.now(), isLocal: true }) mockInstallSkillFromGithubTree.mockResolvedValue({ skill: { name: 'review', description: 'Review', body: 'body', scope: 'project', location: '/tmp/review', repoId: repo.id }, @@ -2143,8 +2199,8 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan restartRequired: false, }) expect(opencodeServerManager.markRestartPending).not.toHaveBeenCalled() - expect(supervisor.restart).toHaveBeenCalledTimes(1) - expect(openCodeClient.api.skill.list).toHaveBeenCalledWith({ location: { directory: repo.fullPath } }) + expect(supervisor.restart).not.toHaveBeenCalled() + expect(openCodeClient.api.location.reload).toHaveBeenCalledTimes(1) expect(mockInstallSkillFromGithubTree).toHaveBeenCalledWith(db, expect.objectContaining({ scope: 'project', repoId: repo.id })) }) @@ -2172,7 +2228,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan overwritten: false, sourceType: 'upload', filesInstalled: ['SKILL.md'], - restartRequired: true, + restartRequired: false, }) expect(mockInstallSkillFromUploadedFiles).toHaveBeenCalledWith( db, @@ -2323,7 +2379,7 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan it('restores the previous password state when the restart fails', async () => { mockGetStoredOpenCodeServerPasswordState.mockReturnValue({ source: 'db' }) - supervisor.restart.mockResolvedValue({ healthy: false, resumedSessionIDs: [] }) + supervisor.restart.mockResolvedValue({ healthy: false }) const res = await app.request(new Request('http://localhost/opencode-server-auth', { method: 'PATCH', @@ -2366,18 +2422,20 @@ describe('Settings Routes - versions, directory files, skills, MCP and maintenan expect(await res.json()).toEqual({ error: 'Failed to get manager token' }) }) - it('returns resumable sessions from the restart coordinator', async () => { - setOpenCodeRestartCoordinator({ - captureResumableSessions: vi.fn().mockReturnValue([{ id: 'session-1' }]), - } as any) + it('returns active user sessions from the SSE aggregator', async () => { + const activeSpy = vi.spyOn(sseAggregator, 'getActiveSessions').mockReturnValue({ '/repo': ['session-1'] }) - const res = await app.request(new Request('http://localhost/opencode-active-sessions')) + try { + const res = await app.request(new Request('http://localhost/opencode-active-sessions')) - expect(res.status).toBe(200) - expect(await res.json()).toEqual({ count: 1, sessions: [{ id: 'session-1' }] }) + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ count: 1, sessions: [{ sessionID: 'session-1', directory: '/repo' }] }) + } finally { + activeSpy.mockRestore() + } }) - it('returns an empty session list without a restart coordinator', async () => { + it('returns an empty session list when no session is active', async () => { const res = await app.request(new Request('http://localhost/opencode-active-sessions')) expect(res.status).toBe(200) diff --git a/backend/test/scripts/docker-entrypoint.test.ts b/backend/test/scripts/docker-entrypoint.test.ts index b0ae9c10..865a06f2 100644 --- a/backend/test/scripts/docker-entrypoint.test.ts +++ b/backend/test/scripts/docker-entrypoint.test.ts @@ -23,15 +23,17 @@ const extractShellFunction = (name: string) => { return match[0] } -const extractMinOpenCodeVersion = () => { - const match = readFileSync(entrypointPath, 'utf-8').match(/^MIN_OPENCODE_VERSION="[^"]+"$/m) - if (!match) throw new Error('MIN_OPENCODE_VERSION not found in docker-entrypoint.sh') +const extractSupportedFloor = () => { + const match = readFileSync(entrypointPath, 'utf-8').match(/^OPENCODE_SUPPORTED_FLOOR="[^"]+"$/m) + if (!match) throw new Error('OPENCODE_SUPPORTED_FLOOR not found in docker-entrypoint.sh') return match[0] } const installPrelude = () => [ - extractMinOpenCodeVersion(), + extractSupportedFloor(), extractShellFunction('version_gte'), + extractShellFunction('is_supported_opencode_version'), + extractShellFunction('supported_opencode_range'), extractShellFunction('read_opencode_version'), extractShellFunction('opencode_arch_suffix'), extractShellFunction('install_opencode'), @@ -235,16 +237,6 @@ describe('install_opencode', () => { expect(curlLog()).toHaveLength(0) }) - it('refuses to download an OPENCODE_BUNDLED_VERSION below the supported minimum', () => { - stubInstallTools() - const res = runOpenCodeSection(`${installPrelude()}\ninstall_opencode`, { - OPENCODE_BUNDLED_VERSION: '1.0.136', - }) - expect(res.status).not.toBe(0) - expect(res.stderr).toContain('below the minimum supported') - expect(curlLog()).toHaveLength(0) - }) - it('refuses to download a malformed OPENCODE_BUNDLED_VERSION', () => { stubInstallTools() const res = runOpenCodeSection(`${installPrelude()}\ninstall_opencode`, { @@ -266,16 +258,6 @@ describe('install_opencode', () => { expect(urls).not.toContain('/releases/latest/download/') }) - it('refuses a 1.x OPENCODE_BUNDLED_VERSION override below the minimum', () => { - stubInstallTools() - const res = runOpenCodeSection(`${installPrelude()}\ninstall_opencode`, { - OPENCODE_BUNDLED_VERSION: '1.22.0', - }) - expect(res.status).not.toBe(0) - expect(res.stderr).toContain('below the minimum supported') - expect(curlLog()).toHaveLength(0) - }) - it('reinstalls the bundled verified version when opencode is missing', () => { stubInstallTools() const res = runOpenCodeSection(`${installPrelude()}\n${extractOpenCodeInstallSection()}`) @@ -291,7 +273,7 @@ describe('install_opencode', () => { writeStub('opencode', `echo "opencode version 1.0.0"`) const res = runOpenCodeSection(`${installPrelude()}\n${extractOpenCodeInstallSection()}`) expect(res.status).toBe(0) - expect(res.stdout).toContain('below minimum required version') + expect(res.stdout).toContain('OpenCode version 1.0.0 is outside the supported range >=2.0.15 <3.0.0') const urls = curlLog().join(' ') expect(urls).toMatch(/https:\/\/opencode\.ai\/files\/bin\/2\.0\.15\/opencode-linux-(x64|arm64)\.tar\.gz/) expect(urls).not.toContain('/releases/latest/download/') @@ -348,30 +330,46 @@ echo "opencode version 2.0.15"`) expect(curlLog()).toHaveLength(0) }) - it('retains a persisted home binary older than the bundled version but above the minimum', () => { + it.each(['2.0.0', '2.0.14', '3.0.0', '3.2.1', '1.0.0'])( + 'replaces a persisted home binary %s outside the supported range with the bundled version', + (version) => { + stubInstallTools() + mkdirSync(join(stubDir, 'home/.opencode/bin'), { recursive: true }) + writeBinary(join(stubDir, 'home/.opencode/bin'), version) + const res = runOpenCodeSection(`${installPrelude()}\n${extractOpenCodeInstallSection()}`) + expect(res.status).toBe(0) + expect(res.stdout).not.toContain('retaining it') + expect(res.stdout).toContain(`Persisted OpenCode ${version} is outside the supported range >=2.0.15 <3.0.0`) + expect(res.stdout).toContain('Installing OpenCode 2.0.15...') + expect(existsSync(homeBinPath())).toBe(true) + const urls = curlLog().join(' ') + expect(urls).toMatch(/https:\/\/opencode\.ai\/files\/bin\/2\.0\.15\/opencode-linux-(x64|arm64)\.tar\.gz/) + }, + ) + + it('falls back to the bundled binary on PATH after removing a persisted 3.x binary', () => { mkdirSync(join(stubDir, 'home/.opencode/bin'), { recursive: true }) - writeBinary(join(stubDir, 'home/.opencode/bin'), '2.0.0') - const res = runOpenCodeSection(`${installPrelude()}\n${extractOpenCodeInstallSection()}`) + writeBinary(join(stubDir, 'home/.opencode/bin'), '3.0.0') + mkdirSync(join(stubDir, 'bundled'), { recursive: true }) + writeBinary(join(stubDir, 'bundled'), '2.0.15') + const res = runOpenCodeSection(`${installPrelude()}\n${extractOpenCodeInstallSection()}`, { + PATH: bundledFirstPath(), + }) expect(res.status).toBe(0) - expect(res.stdout).toContain('retaining it') - expect(existsSync(homeBinPath())).toBe(true) - expect(res.stdout).toContain('OpenCode is installed (version: 2.0.0)') + expect(existsSync(homeBinPath())).toBe(false) + expect(res.stdout).toContain('OpenCode is installed (version: 2.0.15)') + expect(res.stdout).toContain('within the supported range >=2.0.15 <3.0.0') expect(curlLog()).toHaveLength(0) }) - it('replaces a persisted home binary below the minimum version with the bundled version', () => { - stubInstallTools() + it('treats every persisted binary as unsupported when the bundled version is unknown', () => { mkdirSync(join(stubDir, 'home/.opencode/bin'), { recursive: true }) - writeBinary(join(stubDir, 'home/.opencode/bin'), '1.0.0') - const res = runOpenCodeSection(`${installPrelude()}\n${extractOpenCodeInstallSection()}`) + writeBinary(join(stubDir, 'home/.opencode/bin'), '2.0.15') + const res = runOpenCodeSection(`${installPrelude()}\nreconcile_persisted_opencode`, { + OPENCODE_BUNDLED_VERSION: '', + }) expect(res.status).toBe(0) - expect(res.stdout).not.toContain('retaining it') - expect(res.stdout).toContain('below the minimum supported 2.0.0') - expect(res.stdout).toContain('Installing OpenCode 2.0.15...') - expect(existsSync(homeBinPath())).toBe(true) - const urls = curlLog().join(' ') - expect(urls).toMatch(/https:\/\/opencode\.ai\/files\/bin\/2\.0\.15\/opencode-linux-(x64|arm64)\.tar\.gz/) - expect(urls).not.toContain('/releases/latest/download/') + expect(existsSync(homeBinPath())).toBe(false) }) it('removes a malformed persisted home binary and selects the bundled binary without downloading', () => { @@ -398,7 +396,7 @@ echo "opencode version 2.0.15"`) `${installPrelude()}\nreconcile_persisted_opencode\nif [ -e "$HOME/.opencode/bin/opencode" ]; then echo "PERSISTED_PRESENT"; else echo "PERSISTED_REMOVED"; fi\n${extractOpenCodeInstallSection()}` ) expect(res.status).toBe(0) - expect(res.stdout).toContain('below the minimum supported 2.0.0') + expect(res.stdout).toContain('Persisted OpenCode 1.18.16 is outside the supported range >=2.0.15 <3.0.0') expect(res.stdout).toContain('PERSISTED_REMOVED') expect(res.stdout).not.toContain('PERSISTED_PRESENT') expect(existsSync(homeBinPath())).toBe(true) diff --git a/backend/test/services/opencode-config-apply.test.ts b/backend/test/services/opencode-config-apply.test.ts index 8bb73848..82a55d29 100644 --- a/backend/test/services/opencode-config-apply.test.ts +++ b/backend/test/services/opencode-config-apply.test.ts @@ -30,9 +30,11 @@ vi.mock('../../src/services/opencode-single-server', () => ({ markRestartPending: markRestartPendingMock, clearStartupError: clearStartupErrorMock, }, + ConfigReloadError: class ConfigReloadError extends Error {}, })) import { migrate } from '../../src/db/migration-runner' +import type { OpenCodeClient } from '../../src/services/opencode/client' import { allMigrations } from '../../src/db/migrations' import { SettingsService } from '../../src/services/settings' import { @@ -62,6 +64,9 @@ function parseSnapshot(snapshot: string): { version: number; sources: Array<{ na return JSON.parse(snapshot) as { version: number; sources: Array<{ name: string; rawContent: string }> } } +const locationReloadMock = vi.hoisted(() => vi.fn<() => Promise>()) +const openCodeClient = { api: { location: { reload: locationReloadMock } } } as unknown as OpenCodeClient + describe('opencode-config-apply', () => { let workDir: string let db: Database @@ -73,6 +78,7 @@ describe('opencode-config-apply', () => { beforeEach(async () => { vi.clearAllMocks() + locationReloadMock.mockReset().mockResolvedValue(undefined) workDir = await mkdtemp(path.join(tmpdir(), 'opencode-config-apply-')) paths.config = path.join(workDir, 'opencode.json') paths.configDir = workDir @@ -93,20 +99,36 @@ describe('opencode-config-apply', () => { it.each([ ['theme', { theme: 'light' }], ['model', { model: 'a/b' }], - ['mcp', { mcp: { local: { type: 'local' } } }], - ['agent', { agent: { build: { model: 'a/b' } } }], - ['plugin', { plugin: ['x'] }], - ['provider', { provider: { example: { npm: 'y' } } }], - ])('marks a restart pending for a semantic %s change without patching the live server', async (_field, change) => { + ['agents', { agents: { reviewer: { description: 'Reviews' } } }], + ['permissions', { permissions: [{ action: 'webfetch', resource: '*', effect: 'deny' }] }], + ['plugins', { plugins: ['/plugins/probe'] }], + ['providers', { providers: { example: { package: 'y' } } }], + ])('reloads OpenCode without a restart for a semantic %s change', async (_field, change) => { await writeFile(sourcePath('opencode.json'), '{"theme":"dark"}', 'utf8') const result = expectStatus(await applyOpenCodeConfigUpdate({ content: change, settingsService, + openCodeClient, + }), 'reloaded') + + expect(locationReloadMock).toHaveBeenCalledTimes(1) + expect(markRestartPendingMock).not.toHaveBeenCalled() + expect(result.config.content).toEqual(change) + }) + + it('marks a restart pending when the reload fails', async () => { + await writeFile(sourcePath('opencode.json'), '{"theme":"dark"}', 'utf8') + locationReloadMock.mockRejectedValue(new Error('OpenCode server unavailable')) + + const result = expectStatus(await applyOpenCodeConfigUpdate({ + content: { theme: 'light' }, + settingsService, + openCodeClient, }), 'restart_pending') + expect(result.config.content).toEqual({ theme: 'light' }) expect(markRestartPendingMock).toHaveBeenCalledTimes(1) - expect(result.config.content).toEqual(change) }) it('applies a comment-only edit without marking a restart pending', async () => { @@ -117,11 +139,13 @@ describe('opencode-config-apply', () => { content: commented, source: 'opencode.json', settingsService, + openCodeClient, }), 'applied') expect(result.config.rawContent).toBe(commented) await expect(readFile(sourcePath('opencode.json'), 'utf8')).resolves.toBe(commented) expect(markRestartPendingMock).not.toHaveBeenCalled() + expect(locationReloadMock).not.toHaveBeenCalled() }) it('writes a raw string to the explicitly requested source verbatim', async () => { @@ -132,7 +156,8 @@ describe('opencode-config-apply', () => { content: submitted, source: 'opencode.jsonc', settingsService, - }), 'restart_pending') + openCodeClient, + }), 'reloaded') await expect(readFile(sourcePath('opencode.jsonc'), 'utf8')).resolves.toBe(submitted) await expect(readFile(sourcePath('opencode.json'), 'utf8')).resolves.toBe('{"model":"a/b"}') @@ -148,6 +173,7 @@ describe('opencode-config-apply', () => { content: { theme: 'system' }, expectedRevision: initial.revision, settingsService, + openCodeClient, })).rejects.toBeInstanceOf(OpenCodeConfigConflictError) expect(settingsService.getLastKnownGoodConfig()).toBe('sentinel') @@ -162,6 +188,7 @@ describe('opencode-config-apply', () => { await applyOpenCodeConfigUpdate({ content: { theme: 'light' }, settingsService, + openCodeClient, }) const lastGood = settingsService.getLastKnownGoodConfig() @@ -178,6 +205,7 @@ describe('opencode-config-apply', () => { await expect(applyOpenCodeConfigUpdate({ content: { theme: 'light' }, settingsService, + openCodeClient, })).rejects.toBeInstanceOf(OpenCodeConfigSourceInvalidError) expect(settingsService.getLastKnownGoodConfig()).toBe('sentinel') @@ -193,6 +221,7 @@ describe('opencode-config-apply', () => { content: '{"model": 5}', source: 'opencode.json', settingsService, + openCodeClient, })).rejects.toBeInstanceOf(ZodError) await expect(readFile(sourcePath('opencode.json'), 'utf8')).resolves.toBe(previous) @@ -211,6 +240,7 @@ describe('opencode-config-apply', () => { await expect(applyOpenCodeConfigUpdate({ content: { model: 'a/b', theme: 'light' }, settingsService, + openCodeClient, })).rejects.toThrow('database write failed') expect(await readFile(sourcePath('opencode.json'), 'utf8')).toBe(lower) @@ -218,7 +248,7 @@ describe('opencode-config-apply', () => { expect(markRestartPendingMock).not.toHaveBeenCalled() }) - it('requires a restart after repairing an invalid source even when merged values are unchanged', async () => { + it('reloads after repairing an invalid source even when merged values are unchanged', async () => { await writeFile(sourcePath('opencode.json'), '{"model":123}') await writeFile(sourcePath('opencode.jsonc'), '{"model":"a/b"}') @@ -226,10 +256,12 @@ describe('opencode-config-apply', () => { content: '{}', source: 'opencode.json', settingsService, + openCodeClient, }) - expect(result.status).toBe('restart_pending') - expect(markRestartPendingMock).toHaveBeenCalledOnce() + expect(result.status).toBe('reloaded') + expect(locationReloadMock).toHaveBeenCalledOnce() + expect(markRestartPendingMock).not.toHaveBeenCalled() }) it('preserves unknown fields sent back with the merged content', async () => { @@ -240,7 +272,8 @@ describe('opencode-config-apply', () => { const result = expectStatus(await applyOpenCodeConfigUpdate({ content: { ...current!.content, theme: 'light' }, settingsService, - }), 'restart_pending') + openCodeClient, + }), 'reloaded') expect(result.config.content).toEqual({ theme: 'light', customTool: { enabled: true } }) const onDisk = JSON.parse(await readFile(sourcePath('opencode.json'), 'utf8')) as Record @@ -290,50 +323,44 @@ describe('opencode-config-apply', () => { expect(clearStartupErrorMock).not.toHaveBeenCalled() }) - it('applies an mcp-only change without marking a restart pending', async () => { + it('applies an mcp-only change without reloading or marking a restart pending', async () => { await writeFile(sourcePath('opencode.json'), '{"theme":"dark"}', 'utf8') const result = expectStatus(await applyOpenCodeConfigUpdate({ content: { theme: 'dark', mcp: { local: { type: 'local' } } }, settingsService, + openCodeClient, }), 'applied') expect(result.config.content).toEqual({ theme: 'dark', mcp: { local: { type: 'local' } } }) expect(markRestartPendingMock).not.toHaveBeenCalled() + expect(locationReloadMock).not.toHaveBeenCalled() }) - it('requires a restart when mcp changes alongside another key', async () => { + it('reloads when mcp changes alongside another key', async () => { await writeFile(sourcePath('opencode.json'), '{"theme":"dark"}', 'utf8') const result = expectStatus(await applyOpenCodeConfigUpdate({ content: { theme: 'light', mcp: { local: { type: 'local' } } }, settingsService, - }), 'restart_pending') + openCodeClient, + }), 'reloaded') expect(result.config.content).toEqual({ theme: 'light', mcp: { local: { type: 'local' } } }) - expect(markRestartPendingMock).toHaveBeenCalledTimes(1) + expect(locationReloadMock).toHaveBeenCalledTimes(1) }) - it('requires a restart for a theme-only change', async () => { - await writeFile(sourcePath('opencode.json'), '{"theme":"dark"}', 'utf8') - - expectStatus(await applyOpenCodeConfigUpdate({ - content: { theme: 'light' }, - settingsService, - }), 'restart_pending') - - expect(markRestartPendingMock).toHaveBeenCalledTimes(1) - }) - - it('applies an unchanged content edit without marking a restart pending', async () => { + it('applies an unchanged content edit without reloading or marking a restart pending', async () => { await writeFile(sourcePath('opencode.json'), '{"theme":"dark"}', 'utf8') expectStatus(await applyOpenCodeConfigUpdate({ content: { theme: 'dark' }, settingsService, + openCodeClient, }), 'applied') expect(markRestartPendingMock).not.toHaveBeenCalled() + expect(locationReloadMock).not.toHaveBeenCalled() }) it('seeds a minimal opencode.jsonc snapshot and removes every other source', async () => { diff --git a/backend/test/services/opencode-installer.test.ts b/backend/test/services/opencode-installer.test.ts index c9c49feb..51b0ccef 100644 --- a/backend/test/services/opencode-installer.test.ts +++ b/backend/test/services/opencode-installer.test.ts @@ -4,6 +4,7 @@ import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writ import { tmpdir } from 'os' import { join } from 'path' import { + clearOpenCodeVersionCache, installOpenCodeVersion, latestOpenCodeVersion, listOpenCodeVersions, @@ -104,6 +105,7 @@ let workDirectory: string beforeEach(() => { workDirectory = mkdtempSync(join(tmpdir(), 'opencode-installer-')) + clearOpenCodeVersionCache() }) afterEach(() => { @@ -176,18 +178,21 @@ describe('installOpenCodeVersion', () => { const { calls, fetchFn } = createFetch(null) await expect(installOpenCodeVersion('1.18.32', { fetch: fetchFn, homeDirectory, target: linuxTarget })) - .rejects.toThrow(/2\.0\.0 or newer/) + .rejects.toThrow('OpenCode 1.18.32 is not supported; OpenCode Manager requires OpenCode >=2.0.15 <3.0.0') expect(calls).toEqual([]) }) - it('rejects a version outside the supported 2.x line before downloading anything', async () => { - const homeDirectory = join(workDirectory, 'home') - const { calls, fetchFn } = createFetch(null) + it.each(['2.0.14', '3.0.0', '2.1.0-beta.1', '2.0.15; rm -rf /'])( + 'rejects %s outside the supported stable range before downloading anything', + async (version) => { + const homeDirectory = join(workDirectory, 'home') + const { calls, fetchFn } = createFetch(null) - await expect(installOpenCodeVersion('3.0.0', { fetch: fetchFn, homeDirectory, target: linuxTarget })) - .rejects.toThrow(/2\.0\.0 or newer/) - expect(calls).toEqual([]) - }) + await expect(installOpenCodeVersion(version, { fetch: fetchFn, homeDirectory, target: linuxTarget })) + .rejects.toThrow(/requires OpenCode >=2\.0\.15 <3\.0\.0/) + expect(calls).toEqual([]) + }, + ) it('fails and leaves no binary behind when the download is not available', async () => { const homeDirectory = join(workDirectory, 'home') @@ -200,7 +205,7 @@ describe('installOpenCodeVersion', () => { it('fails and leaves no binary behind when the archive reports a different version', async () => { const homeDirectory = join(workDirectory, 'home') - const archivePath = createArchive(workDirectory, '2.0.14') + const archivePath = createArchive(workDirectory, '2.0.16') const { fetchFn } = createFetch(archivePath) await expect(installOpenCodeVersion('2.0.15', { fetch: fetchFn, homeDirectory, target: linuxTarget })) @@ -235,62 +240,101 @@ describe('installOpenCodeVersion', () => { describe('listOpenCodeVersions', () => { const registryPayload = { - 'dist-tags': { latest: '2.0.15' }, versions: { '1.18.32': {}, '2.0.0': {}, + '2.0.14': {}, '2.0.15': {}, + '2.0.16': {}, '2.1.0-beta.1': {}, '3.0.0': {}, 'not-a-version': {}, }, time: { - '2.0.0': '2026-01-01T00:00:00.000Z', '2.0.15': '2026-02-01T00:00:00.000Z', + '2.0.16': '2026-03-01T00:00:00.000Z', }, } - it('lists only supported stable 2.x releases, newest first', async () => { + it('lists only supported stable releases within the pinned major, newest first', async () => { const { calls, fetchFn } = createRegistryFetch(registryPayload) - const versions = await listOpenCodeVersions(fetchFn) + const versions = await listOpenCodeVersions({ fetch: fetchFn }) expect(versions).toEqual([ + { version: '2.0.16', publishedAt: '2026-03-01T00:00:00.000Z' }, { version: '2.0.15', publishedAt: '2026-02-01T00:00:00.000Z' }, - { version: '2.0.0', publishedAt: '2026-01-01T00:00:00.000Z' }, ]) expect(calls).toEqual(['https://registry.npmjs.org/@opencode/cli']) }) it('reports a null publishedAt when the registry has no timestamp for a version', async () => { const { fetchFn } = createRegistryFetch({ - versions: { '2.0.3': {} }, + versions: { '2.0.20': {} }, time: {}, }) - await expect(listOpenCodeVersions(fetchFn)).resolves.toEqual([ - { version: '2.0.3', publishedAt: null }, + await expect(listOpenCodeVersions({ fetch: fetchFn })).resolves.toEqual([ + { version: '2.0.20', publishedAt: null }, ]) }) - it('throws when the registry request fails', async () => { - const { fetchFn } = createRegistryFetch({}, 500) + it('serves the cached list within five minutes without refetching', async () => { + const { calls, fetchFn } = createRegistryFetch(registryPayload) + let now = 1_000_000 - await expect(listOpenCodeVersions(fetchFn)).rejects.toThrow(/500/) + const first = await listOpenCodeVersions({ fetch: fetchFn, now: () => now }) + now += 5 * 60 * 1000 - 1 + const second = await listOpenCodeVersions({ fetch: fetchFn, now: () => now }) + + expect(second).toEqual(first) + expect(calls).toHaveLength(1) + }) + + it('refreshes the list once the five minute cache expires', async () => { + const stale = createRegistryFetch(registryPayload) + const fresh = createRegistryFetch({ versions: { '2.0.17': {} }, time: {} }) + let now = 1_000_000 + + await listOpenCodeVersions({ fetch: stale.fetchFn, now: () => now }) + now += 5 * 60 * 1000 + const refreshed = await listOpenCodeVersions({ fetch: fresh.fetchFn, now: () => now }) + + expect(refreshed).toEqual([{ version: '2.0.17', publishedAt: null }]) + expect(stale.calls).toHaveLength(1) + expect(fresh.calls).toHaveLength(1) + }) + + it('does not cache a failed registry request', async () => { + const failing = createRegistryFetch({}, 500) + const working = createRegistryFetch(registryPayload) + + await expect(listOpenCodeVersions({ fetch: failing.fetchFn })).rejects.toThrow(/500/) + await expect(listOpenCodeVersions({ fetch: working.fetchFn })).resolves.toHaveLength(2) + expect(working.calls).toHaveLength(1) }) }) describe('latestOpenCodeVersion', () => { - it('reads the registry latest dist-tag', async () => { - const { calls, fetchFn } = createRegistryFetch({ 'dist-tags': { latest: '2.0.15' } }) + it('reads the registry latest release document', async () => { + const { calls, fetchFn } = createRegistryFetch({ name: '@opencode/cli', version: '2.0.15' }) - await expect(latestOpenCodeVersion(fetchFn)).resolves.toBe('2.0.15') - expect(calls).toEqual(['https://registry.npmjs.org/@opencode/cli']) + await expect(latestOpenCodeVersion({ fetch: fetchFn })).resolves.toBe('2.0.15') + expect(calls).toEqual(['https://registry.npmjs.org/@opencode/cli/latest']) }) - it('throws when the registry latest tag is not a supported version', async () => { - const { fetchFn } = createRegistryFetch({ 'dist-tags': { latest: '1.18.32' } }) + it.each(['1.18.32', '2.0.14', '3.0.0', '2.1.0-beta.1'])( + 'throws when the registry latest release %s is outside the supported range', + async (version) => { + const { fetchFn } = createRegistryFetch({ version }) - await expect(latestOpenCodeVersion(fetchFn)).rejects.toThrow(/1\.18\.32/) + await expect(latestOpenCodeVersion({ fetch: fetchFn })).rejects.toThrow(version) + }, + ) + + it('throws when the latest request fails', async () => { + const { fetchFn } = createRegistryFetch({}, 502) + + await expect(latestOpenCodeVersion({ fetch: fetchFn })).rejects.toThrow(/502/) }) }) diff --git a/backend/test/services/opencode-restart.test.ts b/backend/test/services/opencode-restart.test.ts index 313356d8..01171ddf 100644 --- a/backend/test/services/opencode-restart.test.ts +++ b/backend/test/services/opencode-restart.test.ts @@ -1,4 +1,4 @@ -import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' +import { describe, it, expect, vi, beforeEach } from 'vitest' const managerMock = vi.hoisted(() => ({ getLastStartupError: vi.fn<() => string | null>(() => null), @@ -11,6 +11,12 @@ const configFileMock = vi.hoisted(() => ({ readOpenCodeConfigFile: vi.fn(), })) +const aggregatorMock = vi.hoisted(() => ({ + getActiveSessions: vi.fn<() => Record>(() => ({})), + isSubagentSession: vi.fn<(sessionId: string) => boolean>(() => false), + getScheduledSessionIds: vi.fn<() => Set>(() => new Set()), +})) + vi.mock('../../src/services/opencode-single-server', () => ({ opencodeServerManager: managerMock, ConfigReloadError: class ConfigReloadError extends Error { @@ -26,13 +32,17 @@ vi.mock('../../src/services/opencode-single-server', () => ({ vi.mock('../../src/services/opencode-config-file', () => configFileMock) +vi.mock('../../src/services/sse-aggregator', () => ({ + sseAggregator: aggregatorMock, +})) + import { + listActiveUserSessions, reloadOpenCodeConfig, restartOpenCode, - setOpenCodeRestartCoordinator, } from '../../src/services/opencode-restart' -import type { OpenCodeRestartCoordinator } from '../../src/services/opencode-restart-coordinator' import type { OpenCodeSupervisor } from '../../src/services/opencode-supervisor' +import type { OpenCodeClient } from '../../src/services/opencode/client' function createSupervisor(healthy: boolean): OpenCodeSupervisor { return { @@ -40,69 +50,80 @@ function createSupervisor(healthy: boolean): OpenCodeSupervisor { } as unknown as OpenCodeSupervisor } -function createCoordinator(healthy: boolean, resumedSessionIDs: string[] = []): OpenCodeRestartCoordinator { - return { - runWithResume: vi.fn(async (restart: () => Promise) => ({ - healthy: healthy ?? (await restart()), - resumedSessionIDs, - })), - } as unknown as OpenCodeRestartCoordinator +function resetAggregator(): void { + aggregatorMock.getActiveSessions.mockReset().mockReturnValue({}) + aggregatorMock.isSubagentSession.mockReset().mockReturnValue(false) + aggregatorMock.getScheduledSessionIds.mockReset().mockReturnValue(new Set()) } -function createInvokingCoordinator(resumedSessionIDs: string[] = []): OpenCodeRestartCoordinator { - return { - runWithResume: vi.fn(async (restart: () => Promise) => ({ - healthy: await restart(), - resumedSessionIDs, - })), - } as unknown as OpenCodeRestartCoordinator -} +describe('listActiveUserSessions', () => { + beforeEach(resetAggregator) + + it('returns every active session with its directory', () => { + aggregatorMock.getActiveSessions.mockReturnValue({ '/a': ['s1', 's2'], '/b': ['s3'] }) + + expect(listActiveUserSessions()).toEqual([ + { sessionID: 's1', directory: '/a' }, + { sessionID: 's2', directory: '/a' }, + { sessionID: 's3', directory: '/b' }, + ]) + }) + + it('excludes subagent and scheduled sessions', () => { + aggregatorMock.getActiveSessions.mockReturnValue({ '/a': ['manual', 'sub', 'sched'] }) + aggregatorMock.isSubagentSession.mockImplementation((id: string) => id === 'sub') + aggregatorMock.getScheduledSessionIds.mockReturnValue(new Set(['sched'])) + + expect(listActiveUserSessions()).toEqual([{ sessionID: 'manual', directory: '/a' }]) + }) + + it('reads from an explicitly provided source', () => { + const source = { + getActiveSessions: () => ({ '/x': ['s9'] }), + isSubagentSession: () => false, + getScheduledSessionIds: () => new Set(), + } + + expect(listActiveUserSessions(source)).toEqual([{ sessionID: 's9', directory: '/x' }]) + expect(aggregatorMock.getActiveSessions).not.toHaveBeenCalled() + }) +}) describe('restartOpenCode', () => { beforeEach(() => { vi.clearAllMocks() - setOpenCodeRestartCoordinator(null) + resetAggregator() + managerMock.getLastStartupError.mockReturnValue(null) }) - afterEach(() => { - setOpenCodeRestartCoordinator(null) + it('returns the user sessions that were active when the restart began', async () => { + aggregatorMock.getActiveSessions.mockReturnValue({ '/a': ['session-1', 'sub-1'], '/b': ['session-2'] }) + aggregatorMock.isSubagentSession.mockImplementation((id: string) => id === 'sub-1') + const supervisor = createSupervisor(true) + vi.mocked(supervisor.restart).mockImplementation(async () => { + aggregatorMock.getActiveSessions.mockReturnValue({}) + return { healthy: true } as Awaited> + }) + + const result = await restartOpenCode(supervisor) + + expect(result).toEqual({ interruptedSessionIDs: ['session-1', 'session-2'] }) + expect(supervisor.restart).toHaveBeenCalledWith('settings_restart') }) - it('throws with the startup failure reason when the coordinator reports an unhealthy restart', async () => { - managerMock.getLastStartupError.mockReturnValue('OpenCode version 1.18.15 does not support sandboxed bash tool rewriting') - setOpenCodeRestartCoordinator(createCoordinator(false)) - - await expect(restartOpenCode(createSupervisor(true))).rejects.toThrow( - 'OpenCode version 1.18.15 does not support sandboxed bash tool rewriting', - ) - }) - - it('preserves resumed session IDs only when the coordinator reports a healthy restart', async () => { - setOpenCodeRestartCoordinator(createCoordinator(true, ['session-1', 'session-2'])) - - const result = await restartOpenCode(createSupervisor(true)) - - expect(result).toEqual({ resumedSessionIDs: ['session-1', 'session-2'] }) - }) - - it('throws with the startup failure reason when the supervisor restart is unhealthy without a coordinator', async () => { + it('throws with the startup failure reason when the supervisor restart is unhealthy', async () => { managerMock.getLastStartupError.mockReturnValue('OpenCode server failed to become healthy') await expect(restartOpenCode(createSupervisor(false))).rejects.toThrow('OpenCode server failed to become healthy') }) - it('returns without resumed sessions when the supervisor restart is healthy without a coordinator', async () => { - const supervisor = createSupervisor(true) + it('returns no interrupted sessions when nothing was active', async () => { + const result = await restartOpenCode(createSupervisor(true)) - const result = await restartOpenCode(supervisor) - - expect(result).toEqual({ resumedSessionIDs: [] }) - expect(supervisor.restart).toHaveBeenCalledWith('settings_restart') + expect(result).toEqual({ interruptedSessionIDs: [] }) }) it('uses a generic failure message when no startup error is recorded', async () => { - managerMock.getLastStartupError.mockReturnValue(null) - await expect(restartOpenCode(createSupervisor(false))).rejects.toThrow( 'OpenCode server restart did not complete successfully', ) @@ -117,83 +138,51 @@ describe('restartOpenCode', () => { }) describe('reloadOpenCodeConfig', () => { + const locationReload = vi.fn<() => Promise>() + const openCodeClient = { api: { location: { reload: locationReload } } } as unknown as OpenCodeClient + beforeEach(() => { vi.clearAllMocks() - managerMock.getLastStartupError.mockReset().mockReturnValue(null) - managerMock.clearStartupError.mockReset() - managerMock.restart.mockReset() - managerMock.checkHealth.mockReset() + resetAggregator() + locationReload.mockReset().mockResolvedValue(undefined) configFileMock.readOpenCodeConfigFile.mockReset() - setOpenCodeRestartCoordinator(null) }) - afterEach(() => { - setOpenCodeRestartCoordinator(null) - }) - - it('throws a ConfigReloadError without restarting when every global source is absent', async () => { + it('throws a ConfigReloadError without reloading when every global source is absent', async () => { configFileMock.readOpenCodeConfigFile.mockResolvedValue(null) - const supervisor = createSupervisor(true) - await expect(reloadOpenCodeConfig(supervisor)).rejects.toMatchObject({ + await expect(reloadOpenCodeConfig(openCodeClient)).rejects.toMatchObject({ name: 'ConfigReloadError', message: 'No OpenCode global configuration files found', }) - expect(supervisor.restart).not.toHaveBeenCalled() - expect(managerMock.restart).not.toHaveBeenCalled() + expect(locationReload).not.toHaveBeenCalled() }) - it('throws a ConfigReloadError with validation issues without restarting when the config is invalid', async () => { + it('throws a ConfigReloadError with validation issues without reloading when the config is invalid', async () => { const validationIssues = [{ path: 'model', message: 'Invalid model' }] configFileMock.readOpenCodeConfigFile.mockResolvedValue({ isValid: false, validationIssues }) - const supervisor = createSupervisor(true) - await expect(reloadOpenCodeConfig(supervisor)).rejects.toMatchObject({ + await expect(reloadOpenCodeConfig(openCodeClient)).rejects.toMatchObject({ name: 'ConfigReloadError', message: 'OpenCode global configuration is invalid', validationIssues, }) - expect(supervisor.restart).not.toHaveBeenCalled() + expect(locationReload).not.toHaveBeenCalled() + }) + + it('reloads the OpenCode location for a valid config without restarting the server', async () => { + configFileMock.readOpenCodeConfigFile.mockResolvedValue({ isValid: true }) + + await reloadOpenCodeConfig(openCodeClient) + + expect(locationReload).toHaveBeenCalledTimes(1) expect(managerMock.restart).not.toHaveBeenCalled() }) - it('delegates a valid config to the supervisor restart path with the settings_reload reason', async () => { + it('propagates a location reload failure', async () => { configFileMock.readOpenCodeConfigFile.mockResolvedValue({ isValid: true }) - const supervisor = createSupervisor(true) + locationReload.mockRejectedValue(new Error('OpenCode server unavailable')) - const result = await reloadOpenCodeConfig(supervisor) - - expect(supervisor.restart).toHaveBeenCalledWith('settings_reload') - expect(result).toEqual({ resumedSessionIDs: [] }) - }) - - it('returns the resumed session IDs produced by the coordinator on a valid reload', async () => { - configFileMock.readOpenCodeConfigFile.mockResolvedValue({ isValid: true }) - const supervisor = createSupervisor(true) - setOpenCodeRestartCoordinator(createInvokingCoordinator(['session-1', 'session-2'])) - - const result = await reloadOpenCodeConfig(supervisor) - - expect(supervisor.restart).toHaveBeenCalledWith('settings_reload') - expect(result).toEqual({ resumedSessionIDs: ['session-1', 'session-2'] }) - }) - - it('restarts the manager directly without a coordinator', async () => { - configFileMock.readOpenCodeConfigFile.mockResolvedValue({ isValid: true }) - managerMock.checkHealth.mockResolvedValue(true) - - await reloadOpenCodeConfig() - - expect(managerMock.clearStartupError).toHaveBeenCalled() - expect(managerMock.restart).toHaveBeenCalledTimes(1) - expect(managerMock.checkHealth).toHaveBeenCalled() - }) - - it('throws when the manager restart leaves the server unhealthy without a coordinator', async () => { - configFileMock.readOpenCodeConfigFile.mockResolvedValue({ isValid: true }) - managerMock.checkHealth.mockResolvedValue(false) - managerMock.getLastStartupError.mockReturnValue('reload did not restore health') - - await expect(reloadOpenCodeConfig()).rejects.toThrow('reload did not restore health') + await expect(reloadOpenCodeConfig(openCodeClient)).rejects.toThrow('OpenCode server unavailable') }) }) diff --git a/backend/test/services/opencode-single-server.test.ts b/backend/test/services/opencode-single-server.test.ts index 38bd6bfa..ae7fbd39 100644 --- a/backend/test/services/opencode-single-server.test.ts +++ b/backend/test/services/opencode-single-server.test.ts @@ -157,6 +157,20 @@ const mkdirMock = fs.mkdir as any const readFileMock = fs.readFile as any const readdirMock = fs.readdir as any const rmMock = fs.rm as any +const writeFileMock = fs.writeFile as any +const renameMock = fs.rename as any + +const SERVICE_SETTINGS_PATH = '/test/workspace/.config/opencode/service.json' +const SERVICE_REGISTRATION_PATH = '/test/workspace/.opencode/state/opencode/service.json' + +function readWrittenServiceSettings(): Record { + const rename = [...renameMock.mock.calls].reverse().find((call: unknown[]) => call[1] === SERVICE_SETTINGS_PATH) as [string, string] | undefined + if (!rename) throw new Error('the OpenCode service settings file was not written') + const write = [...writeFileMock.mock.calls].reverse().find((call: unknown[]) => call[0] === rename[0]) as [string, string, { mode: number }] | undefined + if (!write) throw new Error('the OpenCode service settings temp file was not written') + expect(write[2].mode).toBe(0o600) + return JSON.parse(write[1]) as Record +} const execSyncMock = execSync as any const childSpawnSyncMock = spawnSync as any const readdirSyncMock = readdirSync as any @@ -231,6 +245,18 @@ describe('OpenCodeServerManager - server auth', () => { } } + async function runPastTerminationGrace(operation: () => Promise): Promise { + vi.useFakeTimers({ toFake: ['setTimeout', 'Date'] }) + try { + const pending = operation() + pending.catch(() => {}) + await vi.advanceTimersByTimeAsync(15000) + return await pending + } finally { + vi.useRealTimers() + } + } + it('rebuilds the client with env password when no DB password is stored', async () => { setOpenCodeEnv({ host: '127.0.0.1', password: 'envpassword123' }) const { opencodeServerManager } = await import('../../src/services/opencode-single-server') @@ -284,7 +310,8 @@ describe('OpenCodeServerManager - server auth', () => { const spawnEnv = (spawnMock.mock.calls[0] as unknown as [string, string[], { env: Record }])[2].env const managedPassword = readStoredEncryptedSecret(passwordDb, 'opencode_server_managed_password') expect(managedPassword).toMatch(/^[A-Za-z0-9_-]{43}$/) - expect(spawnEnv.OPENCODE_SERVER_PASSWORD).toBe(managedPassword) + expect(readWrittenServiceSettings()).toEqual({ password: managedPassword }) + expect(spawnEnv).not.toHaveProperty('OPENCODE_SERVER_PASSWORD') expect(spawnEnv).not.toHaveProperty('OPENCODE_SERVER_USERNAME') expect(createOpenCodeClientMock).toHaveBeenCalledWith(managedPassword, '0.0.0.0') expect(manager.getLastStartupError()).toBeNull() @@ -297,7 +324,8 @@ describe('OpenCodeServerManager - server auth', () => { await OpenCodeServerManager.getInstance().start() const spawnEnv = (spawnMock.mock.calls[0] as unknown as [string, string[], { env: Record }])[2].env - expect(spawnEnv.OPENCODE_SERVER_PASSWORD).toBe('envpassword123') + expect(readWrittenServiceSettings()).toEqual({ password: 'envpassword123' }) + expect(spawnEnv).not.toHaveProperty('OPENCODE_SERVER_PASSWORD') expect(spawnEnv).not.toHaveProperty('OPENCODE_SERVER_USERNAME') }) @@ -319,14 +347,14 @@ describe('OpenCodeServerManager - server auth', () => { expect(spawnMock).toHaveBeenCalledWith( 'opencode', - ['serve', '--port', '5551', '--hostname', '0.0.0.0'], + ['serve', '--service', '--port', '5551', '--hostname', '0.0.0.0'], expect.objectContaining({ env: expect.objectContaining({ OCM_SANDBOX_ENFORCED: 'true', - OPENCODE_SERVER_PASSWORD: 'envpassword123', }), }) ) + expect(readWrittenServiceSettings()).toEqual({ password: 'envpassword123' }) }) it('uses the managed password for an enforced server bound to an external host', async () => { @@ -347,7 +375,8 @@ describe('OpenCodeServerManager - server auth', () => { await manager.start() const spawnEnv = (spawnMock.mock.calls[0] as unknown as [string, string[], { env: Record }])[2].env - expect(spawnEnv.OPENCODE_SERVER_PASSWORD).toBe(readStoredEncryptedSecret(passwordDb, 'opencode_server_managed_password')) + expect(readWrittenServiceSettings()).toEqual({ password: readStoredEncryptedSecret(passwordDb, 'opencode_server_managed_password') }) + expect(spawnEnv).not.toHaveProperty('OPENCODE_SERVER_PASSWORD') expect(spawnEnv).not.toHaveProperty('OPENCODE_SERVER_USERNAME') }) @@ -601,6 +630,81 @@ describe('OpenCodeServerManager - server auth', () => { } }) + it('delivers only the managed password through the service settings file and drops inherited and user-supplied password env vars', async () => { + setOpenCodeEnv({ host: '127.0.0.1', password: 'envpassword123' }) + const { OpenCodeServerManager } = await import('../../src/services/opencode-single-server') + const manager = OpenCodeServerManager.getInstance() + manager.setDatabase(createPreferencesDb({ + serverEnvVars: [ + { key: 'OPENCODE_PASSWORD', value: 'user-stray-password' }, + { key: 'OPENCODE_SERVER_PASSWORD', value: 'user-server-password' }, + ], + })) + process.env.OPENCODE_PASSWORD = 'inherited-stray-password' + try { + await manager.start() + + const env = (spawnMock.mock.calls[0] as unknown as [unknown, unknown, { env: Record }])[2].env + expect(env).not.toHaveProperty('OPENCODE_PASSWORD') + expect(env).not.toHaveProperty('OPENCODE_SERVER_PASSWORD') + expect(readWrittenServiceSettings()).toEqual({ password: 'envpassword123' }) + } finally { + delete process.env.OPENCODE_PASSWORD + } + }) + + it('spawns OpenCode in service mode after clearing a stale service registration and persisting the managed password', async () => { + setOpenCodeEnv({ host: '127.0.0.1', password: 'envpassword123' }) + const { OpenCodeServerManager } = await import('../../src/services/opencode-single-server') + + await OpenCodeServerManager.getInstance().start() + + const [, args, options] = spawnMock.mock.calls[0] as unknown as [string, string[], { env: Record }] + expect(args).toEqual(['serve', '--service', '--port', '5551', '--hostname', '127.0.0.1']) + expect(options.env.XDG_CONFIG_HOME).toBe('/test/workspace/.config') + expect(options.env.XDG_STATE_HOME).toBe('/test/workspace/.opencode/state') + expect(readWrittenServiceSettings()).toEqual({ password: 'envpassword123' }) + expect(rmMock).toHaveBeenCalledWith(SERVICE_REGISTRATION_PATH, { force: true }) + const spawnOrder = spawnMock.mock.invocationCallOrder[0] ?? 0 + const registrationRemovalIndex = rmMock.mock.calls.findIndex((call: unknown[]) => call[0] === SERVICE_REGISTRATION_PATH) + const settingsWriteIndex = renameMock.mock.calls.findIndex((call: unknown[]) => call[1] === SERVICE_SETTINGS_PATH) + expect(rmMock.mock.invocationCallOrder[registrationRemovalIndex]).toBeLessThan(spawnOrder) + expect(renameMock.mock.invocationCallOrder[settingsWriteIndex]).toBeLessThan(spawnOrder) + }) + + it('writes the service settings into a user-supplied OPENCODE_CONFIG_DIR because OpenCode reads them from its global config directory', async () => { + setOpenCodeEnv({ host: '127.0.0.1', password: 'envpassword123' }) + const { OpenCodeServerManager } = await import('../../src/services/opencode-single-server') + const manager = OpenCodeServerManager.getInstance() + manager.setDatabase(createPreferencesDb({ + serverEnvVars: [{ key: 'OPENCODE_CONFIG_DIR', value: '/tmp/user-config-dir' }], + })) + + await manager.start() + + const env = (spawnMock.mock.calls[0] as unknown as [unknown, unknown, { env: Record }])[2].env + expect(env.OPENCODE_CONFIG_DIR).toBe('/tmp/user-config-dir') + expect(renameMock).toHaveBeenCalledWith(expect.any(String), '/tmp/user-config-dir/service.json') + expect(renameMock).not.toHaveBeenCalledWith(expect.any(String), SERVICE_SETTINGS_PATH) + }) + + it('refuses to spawn when the service settings cannot be written', async () => { + setOpenCodeEnv({ host: '127.0.0.1', password: 'envpassword123' }) + renameMock.mockImplementation(async (_from: string, to: string) => { + if (to === SERVICE_SETTINGS_PATH) throw new Error('read-only config home') + }) + const { OpenCodeServerManager } = await import('../../src/services/opencode-single-server') + const manager = OpenCodeServerManager.getInstance() + + try { + await expect(manager.start()).rejects.toThrow('Failed to prepare the OpenCode service settings: read-only config home') + expect(spawnMock).not.toHaveBeenCalled() + expect(manager.getLastStartupError()).toContain('read-only config home') + } finally { + renameMock.mockReset() + } + }) + it('honors a user-supplied HOME serverEnvVars entry while enforced', async () => { sandboxRuntimeServiceMock.SandboxRuntimeService.mockImplementation(() => ({ isEnabled: () => true, @@ -1125,7 +1229,7 @@ describe('OpenCodeServerManager - server auth', () => { const rmMock = fs.rm as unknown as ReturnType rmMock.mockClear() - await expect(manager.stop()).rejects.toThrow('refusing to complete the stop') + await expect(runPastTerminationGrace(() => manager.stop())).rejects.toThrow('refusing to complete the stop') expect(rmMock).not.toHaveBeenCalledWith( '/test/workspace/.opencode/state/opencode-server-child.json', { force: true }, @@ -1198,7 +1302,7 @@ describe('OpenCodeServerManager - server auth', () => { const rmMock = fs.rm as unknown as ReturnType rmMock.mockClear() - await expect(manager.stop()).rejects.toThrow('refusing to complete the stop') + await expect(runPastTerminationGrace(() => manager.stop())).rejects.toThrow('refusing to complete the stop') expect(killSpy).toHaveBeenCalledWith(-1234, 'SIGTERM') expect(killSpy).toHaveBeenCalledWith(-1234, 'SIGKILL') expect(rmMock).not.toHaveBeenCalledWith( @@ -1242,7 +1346,7 @@ describe('OpenCodeServerManager - server auth', () => { const rmMock = fs.rm as unknown as ReturnType rmMock.mockClear() - await expect(manager.restart()).rejects.toThrow('refusing to complete the stop') + await expect(runPastTerminationGrace(() => manager.restart())).rejects.toThrow('refusing to complete the stop') expect(rmMock).not.toHaveBeenCalledWith( '/test/workspace/.opencode/state/opencode-server-child.json', { force: true }, @@ -1840,7 +1944,7 @@ describe('OpenCodeServerManager - server auth', () => { const manager = OpenCodeServerManager.getInstance() manager.setDatabase(createPasswordDb(null)) - await expect(manager.start()).rejects.toThrow('refusing to start an enforced server') + await expect(runPastTerminationGrace(() => manager.start())).rejects.toThrow('refusing to start an enforced server') expect(manager.getLastStartupError()).toContain('9999') expect(spawnMock).not.toHaveBeenCalled() } finally { @@ -2711,7 +2815,7 @@ describe('OpenCodeServerManager - server auth', () => { await expect(manager.start()).rejects.toThrow('OpenCode 1.18.32 is not supported') expect(spawnMock).not.toHaveBeenCalled() - expect(manager.getLastStartupError()).toContain('requires OpenCode 2.0.0 or newer') + expect(manager.getLastStartupError()).toContain('requires OpenCode >=2.0.15 <3.0.0') expect(manager.isLastStartupErrorNonRecoverable()).toBe(true) }) diff --git a/backend/test/services/opencode/client.test.ts b/backend/test/services/opencode/client.test.ts index 13e72787..0587efbb 100644 --- a/backend/test/services/opencode/client.test.ts +++ b/backend/test/services/opencode/client.test.ts @@ -34,6 +34,7 @@ vi.mock('../../../src/utils/logger', () => ({ import { createOpenCodeClient, FetchOpenCodeClient } from '../../../src/services/opencode/client' import { ENV } from '@opencode-manager/shared/config/env' +import { openCodeLocation } from '@opencode-manager/shared/opencode' describe('OpenCodeClient', () => { const baseUrl = 'http://127.0.0.1:5551' @@ -72,6 +73,22 @@ describe('OpenCodeClient', () => { expect((capturedInit?.headers as Record)['host']).toBeUndefined() expect((capturedInit?.headers as Record)['connection']).toBeUndefined() expect((capturedInit?.headers as Record)['authorization']).toBeUndefined() + expect((capturedInit?.headers as Record)['x-opencode-directory']).toBe(encodeURIComponent('/test/workspace')) + }) + + it('keeps a caller-supplied x-opencode-directory header', async () => { + let capturedInit: RequestInit | undefined + const fetchFn = async (_: URL | Request | string, init?: RequestInit) => { + capturedInit = init + return new Response(JSON.stringify({}), { status: 200 }) + } + const client = new FetchOpenCodeClient({ baseUrl, basicAuth: '', fetchFn: fetchFn as unknown as typeof fetch }) + + await client.forwardRaw(new Request('http://localhost:5003/api/opencode/api/config', { + headers: { 'X-OpenCode-Directory': '%2Frepo%2Fb' }, + })) + + expect((capturedInit?.headers as Record)['x-opencode-directory']).toBe('%2Frepo%2Fb') }) it('should read body for POST but not for GET/HEAD', async () => { @@ -221,6 +238,21 @@ describe('OpenCodeClient', () => { ]) }) + it('scopes location-less requests to the workspace and leaves explicit locations to the query', async () => { + const captured: Array<{ url: string; directory: string | null }> = [] + const fetchFn = async (input: URL | Request | string, init?: RequestInit) => { + captured.push({ url: input.toString(), directory: new Headers(init?.headers).get('x-opencode-directory') }) + return new Response(JSON.stringify({ data: [] }), { status: 200, headers: { 'Content-Type': 'application/json' } }) + } + const client = new FetchOpenCodeClient({ baseUrl, basicAuth: '', fetchFn: fetchFn as unknown as typeof fetch }) + + await client.api.integration.list().catch(() => undefined) + await client.api.skill.list(openCodeLocation('/repo/a')).catch(() => undefined) + + expect(captured[0]).toEqual({ url: `${baseUrl}/api/integration`, directory: encodeURIComponent('/test/workspace') }) + expect(captured[1]?.url).toBe(`${baseUrl}/api/skill?location%5Bdirectory%5D=%2Frepo%2Fa`) + }) + it('fails the info probe when the upstream answers 401', async () => { const fetchFn = async () => new Response(JSON.stringify({ error: 'unauthorized' }), { status: 401 }) const client = new FetchOpenCodeClient({ baseUrl, basicAuth: '', fetchFn: fetchFn as unknown as typeof fetch }) diff --git a/backend/test/services/opencode/integration-ready.test.ts b/backend/test/services/opencode/integration-ready.test.ts new file mode 100644 index 00000000..d90d30f6 --- /dev/null +++ b/backend/test/services/opencode/integration-ready.test.ts @@ -0,0 +1,98 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { + INTEGRATION_READY_POLL_INTERVAL_MS, + INTEGRATION_READY_TIMEOUT_MS, + runWhenIntegrationReady, +} from '../../../src/services/opencode/integration-ready' +import { createStubOpenCodeClient } from '../../helpers/stub-opencode-client' + +const TARGET = { integrationID: 'anthropic', location: { directory: '/tmp/repo' } } + +function taggedError(tag: string, message: string): Error { + return Object.assign(new Error(message), { _tag: tag }) +} + +function notFound(): Error { + return taggedError('IntegrationNotFoundError', 'Integration not found: anthropic') +} + +describe('runWhenIntegrationReady', () => { + beforeEach(() => { + vi.useFakeTimers() + }) + + afterEach(() => { + vi.useRealTimers() + }) + + it('returns the first result without polling', async () => { + const { api } = createStubOpenCodeClient() + const action = vi.fn(async () => 'connected') + + await expect(runWhenIntegrationReady(api, TARGET, action)).resolves.toBe('connected') + + expect(action).toHaveBeenCalledTimes(1) + expect(vi.mocked(api.integration.get)).not.toHaveBeenCalled() + }) + + it('waits for a loading integration and retries once', async () => { + const { api } = createStubOpenCodeClient() + const get = vi.mocked(api.integration.get) + get.mockRejectedValueOnce(notFound()).mockRejectedValueOnce(notFound()) + const action = vi.fn<() => Promise>() + .mockRejectedValueOnce(notFound()) + .mockResolvedValueOnce('connected') + + const result = runWhenIntegrationReady(api, TARGET, action) + await vi.advanceTimersByTimeAsync(INTEGRATION_READY_POLL_INTERVAL_MS * 3) + + await expect(result).resolves.toBe('connected') + expect(get).toHaveBeenCalledTimes(3) + expect(get).toHaveBeenCalledWith(TARGET) + expect(action).toHaveBeenCalledTimes(2) + }) + + it('returns the original error when the integration never appears', async () => { + const { api } = createStubOpenCodeClient() + const get = vi.mocked(api.integration.get) + get.mockRejectedValue(notFound()) + const original = notFound() + const action = vi.fn<() => Promise>().mockRejectedValue(original) + + const result = runWhenIntegrationReady(api, TARGET, action) + const assertion = expect(result).rejects.toBe(original) + await vi.advanceTimersByTimeAsync(INTEGRATION_READY_TIMEOUT_MS + INTEGRATION_READY_POLL_INTERVAL_MS) + + await assertion + expect(action).toHaveBeenCalledTimes(1) + expect(get.mock.calls.length).toBeGreaterThanOrEqual(INTEGRATION_READY_TIMEOUT_MS / INTEGRATION_READY_POLL_INTERVAL_MS - 1) + expect(get.mock.calls.length).toBeLessThanOrEqual(INTEGRATION_READY_TIMEOUT_MS / INTEGRATION_READY_POLL_INTERVAL_MS) + }) + + it('stops polling and returns the original error when the lookup fails differently', async () => { + const { api } = createStubOpenCodeClient() + const get = vi.mocked(api.integration.get) + get.mockRejectedValue(taggedError('ServiceUnavailableError', 'down')) + const original = notFound() + const action = vi.fn<() => Promise>().mockRejectedValue(original) + + const result = runWhenIntegrationReady(api, TARGET, action) + const assertion = expect(result).rejects.toBe(original) + await vi.advanceTimersByTimeAsync(INTEGRATION_READY_POLL_INTERVAL_MS) + + await assertion + expect(get).toHaveBeenCalledTimes(1) + expect(action).toHaveBeenCalledTimes(1) + }) + + it('does not retry other errors', async () => { + const { api } = createStubOpenCodeClient() + const original = taggedError('InvalidRequestError', 'Missing required form field: account') + const action = vi.fn<() => Promise>().mockRejectedValue(original) + + await expect(runWhenIntegrationReady(api, TARGET, action)).rejects.toBe(original) + + expect(action).toHaveBeenCalledTimes(1) + expect(vi.mocked(api.integration.get)).not.toHaveBeenCalled() + }) +}) diff --git a/backend/test/services/opencode/upstream.test.ts b/backend/test/services/opencode/upstream.test.ts index b822c79c..83e032bd 100644 --- a/backend/test/services/opencode/upstream.test.ts +++ b/backend/test/services/opencode/upstream.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect, afterEach } from 'vitest' -import { ENV } from '@opencode-manager/shared/config/env' -import { getOpenCodeUpstreamBaseUrl } from '../../../src/services/opencode/upstream' +import { ENV, getWorkspacePath } from '@opencode-manager/shared/config/env' +import { getOpenCodeUpstreamBaseUrl, withDefaultOpenCodeDirectory } from '../../../src/services/opencode/upstream' const originalHost = ENV.OPENCODE.HOST @@ -44,3 +44,17 @@ describe('getOpenCodeUpstreamBaseUrl', () => { expect(getOpenCodeUpstreamBaseUrl(() => '10.0.0.5')).toBe(`http://10.0.0.5:${ENV.OPENCODE.PORT}`) }) }) + +describe('withDefaultOpenCodeDirectory', () => { + it('scopes a request without a directory header to the workspace', () => { + expect(withDefaultOpenCodeDirectory({ accept: 'application/json' })).toEqual({ + accept: 'application/json', + 'x-opencode-directory': encodeURIComponent(getWorkspacePath()), + }) + }) + + it('keeps a caller-supplied directory header regardless of its case', () => { + const headers = { 'X-OpenCode-Directory': '%2Frepo' } + expect(withDefaultOpenCodeDirectory(headers)).toBe(headers) + }) +}) diff --git a/backend/test/services/sse-aggregator.test.ts b/backend/test/services/sse-aggregator.test.ts index 9d5d5aad..edb400d5 100644 --- a/backend/test/services/sse-aggregator.test.ts +++ b/backend/test/services/sse-aggregator.test.ts @@ -53,7 +53,7 @@ function rawEvent(input: RawEventInput): string { }) } -function parseFrame(frame: string): { directory?: string; payload: { id?: string; type: string; data: Record } } { +function parseFrame(frame: string): { directory: string | null; payload: { id?: string; type: string; data: Record } } { return JSON.parse(frame.replace(/^event: message\ndata: /, '').trim()) } @@ -142,16 +142,46 @@ describe('SSEAggregator raw V2 event handling', () => { }) }) - it('drops events without a location directory', () => { - const client = createCapturingClient() - sseAggregator.addClient('drop-a', client.callback, client.writeFrame, ['/r']) + it('delivers events without a location directory to every connected client with a null directory', () => { + const subscribed = createCapturingClient() + const unsubscribed = createCapturingClient() + sseAggregator.addClient('global-a', subscribed.callback, subscribed.writeFrame, ['/r']) + sseAggregator.addClient('global-b', unsubscribed.callback, unsubscribed.writeFrame, []) - emitRawEvent({ type: 'server.connected', data: {} }) + emitRawEvent({ id: 'evt_global', type: 'server.connected', data: {} }) - expect(client.frames).toHaveLength(0) + const expected = { + directory: null, + payload: { id: 'evt_global', created: 1, type: 'server.connected', data: {} }, + } + expect(subscribed.frames.map(parseFrame)).toEqual([expected]) + expect(unsubscribed.frames.map(parseFrame)).toEqual([expected]) expect(sseAggregator.getActiveSessions()).toEqual({}) }) + it('embeds the raw upstream payload in the client envelope without re-serializing it', () => { + const client = createCapturingClient() + sseAggregator.addClient('raw-a', client.callback, client.writeFrame, ['/r']) + const raw = '{"type":"session.idle","id":"evt_raw","created":7,"location":{"directory":"/r"},"data":{"sessionID":"ses_1","extra":{"b":2,"a":1}}}' + + ;(sseAggregator as unknown as { handleUpstreamMessage(data: string): void }).handleUpstreamMessage(raw) + + expect(client.frames).toEqual([`event: message\ndata: {"directory":"/r","payload":${raw}}\n\n`]) + expect(parseFrame(client.frames[0]!)).toEqual({ directory: '/r', payload: JSON.parse(raw) }) + }) + + it('re-serializes a multi-line upstream payload so the client frame stays a single data line', () => { + const client = createCapturingClient() + sseAggregator.addClient('raw-b', client.callback, client.writeFrame, ['/r']) + const event = { type: 'session.idle', id: 'evt_ml', created: 3, location: { directory: '/r' }, data: { sessionID: 'ses_1' } } + + ;(sseAggregator as unknown as { handleUpstreamMessage(data: string): void }).handleUpstreamMessage(JSON.stringify(event, null, 2)) + + expect(client.frames).toHaveLength(1) + expect(client.frames[0]!.split('\n').filter(line => line.startsWith('data: '))).toHaveLength(1) + expect(parseFrame(client.frames[0]!)).toEqual({ directory: '/r', payload: event }) + }) + it('marks a session idle on session.idle and on terminal execution events', () => { emitRawEvent({ type: 'session.status', location: { directory: '/r' }, data: { sessionID: 'ses_1', status: { type: 'busy' } } }) emitRawEvent({ type: 'session.execution.started', location: { directory: '/r' }, data: { sessionID: 'ses_2' } }) @@ -415,6 +445,49 @@ describe('SSEAggregator session status replay on upstream reconnect', () => { expect(statuses[0]?.payload.data).toEqual({ sessionID: 'ses-new', status: { type: 'busy' } }) }) + it('resolves untracked running session directories concurrently', async () => { + const api = makeApi({ active: { 'ses-x': { type: 'running' }, 'ses-y': { type: 'running' } } }) + const pending: Array<() => void> = [] + vi.mocked(api.session.get).mockImplementation((input) => new Promise((resolve) => { + const sessionID = (input as { sessionID: string }).sessionID + pending.push(() => resolve({ location: { directory: `/repo/${sessionID}` } } as unknown as Awaited>)) + })) + sseAggregator.setPendingActionsFetcher({ api }) + + const client = createCapturingClient() + sseAggregator.addClient('status-5', client.callback, client.writeFrame, ['/repo/ses-x', '/repo/ses-y']) + + const replay = (sseAggregator as unknown as { replaySessionStatusesForTrackedDirectories(): Promise }).replaySessionStatusesForTrackedDirectories() + await flushReplay() + + expect(api.session.get).toHaveBeenCalledTimes(2) + pending.forEach(resolve => resolve()) + await replay + + expect(client.frames.map(parseFrame).map(p => p.directory).sort()).toEqual(['/repo/ses-x', '/repo/ses-y']) + }) + + it('does not replay pending actions to already connected clients on upstream reconnect', async () => { + const fetcher = makeFetcher({ + permissions: { '/repo/a': [{ id: 'perm-1', sessionID: 'ses-a', action: 'shell', resources: ['ls'] }] }, + }) + sseAggregator.setPendingActionsFetcher(fetcher) + const client = createCapturingClient() + sseAggregator.addClient('status-6', client.callback, client.writeFrame, ['/repo/a']) + await flushReplay() + vi.mocked(fetcher.api.permission.request.list).mockClear() + vi.mocked(fetcher.api.form.list).mockClear() + + ;(sseAggregator as unknown as { handleUpstreamOpen(wasConnectedBefore: boolean): void }).handleUpstreamOpen(true) + await flushReplay() + + expect(fetcher.api.permission.request.list).not.toHaveBeenCalled() + expect(fetcher.api.form.list).not.toHaveBeenCalled() + expect(fetcher.api.session.active).toHaveBeenCalledTimes(1) + expect(client.events.filter(event => event.event === 'resync')).toHaveLength(1) + expect(client.events.filter(event => event.event === 'message')).toHaveLength(1) + }) + it('does nothing when no api is configured', async () => { const client = createCapturingClient() sseAggregator.addClient('status-4', client.callback, client.writeFrame, ['/repo/a']) diff --git a/backend/test/shared/opencode-contract.test.ts b/backend/test/shared/opencode-contract.test.ts index 2852c0ba..3c7e22b5 100644 --- a/backend/test/shared/opencode-contract.test.ts +++ b/backend/test/shared/opencode-contract.test.ts @@ -1,15 +1,25 @@ +import { readFileSync } from 'fs' +import { join } from 'path' import { describe, expect, it } from 'vitest' import { - OPENCODE_MIN_VERSION, OPENCODE_PINNED_VERSION, OPENCODE_SERVER_USERNAME, + OPENCODE_SUPPORTED_VERSION_RANGE, buildOpenCodeBasicAuth, buildOpenCodeReleaseAsset, + compareOpenCodeVersions, createOpenCodeApi, + describeUnsupportedOpenCodeVersion, + isStableOpenCodeVersion, isSupportedOpenCodeVersion, + normalizeOpenCodeVersion, openCodeLocation, + parseOpenCodeVersion, + parseOpenCodeVersionOutput, } from '@opencode-manager/shared/opencode' +const REPO_ROOT = join(__dirname, '..', '..', '..') + interface CapturedRequest { url: string method: string @@ -35,48 +45,113 @@ function createFetchSpy() { describe('OpenCode v2 contract', () => { describe('version policy', () => { - it('pins the client version and the fixed V2 server username', () => { - expect(OPENCODE_MIN_VERSION).toBe('2.0.0') + it('pins the client version, derives the floor from it and fixes the V2 server username', () => { expect(OPENCODE_PINNED_VERSION).toBe('2.0.15') + expect(OPENCODE_SUPPORTED_VERSION_RANGE).toBe('>=2.0.15 <3.0.0') expect(OPENCODE_SERVER_USERNAME).toBe('opencode') }) - it('accepts v2 releases at or above the minimum and rejects other majors', () => { + it('accepts releases of the pinned major at or above the pin and rejects everything else', () => { expect(isSupportedOpenCodeVersion('1.18.32')).toBe(false) - expect(isSupportedOpenCodeVersion('2.0.0')).toBe(true) + expect(isSupportedOpenCodeVersion('2.0.0')).toBe(false) + expect(isSupportedOpenCodeVersion('2.0.14')).toBe(false) expect(isSupportedOpenCodeVersion('2.0.15')).toBe(true) + expect(isSupportedOpenCodeVersion('2.0.16')).toBe(true) expect(isSupportedOpenCodeVersion('2.1.0')).toBe(true) - expect(isSupportedOpenCodeVersion('v2.0.0')).toBe(true) + expect(isSupportedOpenCodeVersion('v2.0.15')).toBe(true) + expect(isSupportedOpenCodeVersion(' v2.0.15 ')).toBe(true) expect(isSupportedOpenCodeVersion('3.0.0')).toBe(false) + expect(isSupportedOpenCodeVersion('3.1.0')).toBe(false) expect(isSupportedOpenCodeVersion('not-a-version')).toBe(false) }) - it('rejects prereleases of the minimum version', () => { - expect(isSupportedOpenCodeVersion('2.0.0-alpha.1')).toBe(false) - expect(isSupportedOpenCodeVersion('2.0.0-alpha')).toBe(false) - expect(isSupportedOpenCodeVersion('2.0.0-rc.1+build.5')).toBe(false) - expect(isSupportedOpenCodeVersion('2.0.0-0')).toBe(false) + it('rejects prereleases of the pinned version', () => { + expect(isSupportedOpenCodeVersion('2.0.15-alpha.1')).toBe(false) + expect(isSupportedOpenCodeVersion('2.0.15-alpha')).toBe(false) + expect(isSupportedOpenCodeVersion('2.0.15-rc.1+build.5')).toBe(false) + expect(isSupportedOpenCodeVersion('2.0.15-0')).toBe(false) }) - it('accepts prereleases of higher numeric cores', () => { + it('accepts prereleases of higher numeric cores within the pinned major', () => { expect(isSupportedOpenCodeVersion('2.1.0-beta.1')).toBe(true) - expect(isSupportedOpenCodeVersion('2.0.1-rc.2')).toBe(true) + expect(isSupportedOpenCodeVersion('2.0.16-rc.2')).toBe(true) + expect(isSupportedOpenCodeVersion('3.0.0-beta.1')).toBe(false) }) it('ignores build metadata for precedence', () => { - expect(isSupportedOpenCodeVersion('2.0.0+build')).toBe(true) - expect(isSupportedOpenCodeVersion('2.0.0+2.0.0')).toBe(true) + expect(isSupportedOpenCodeVersion('2.0.15+build')).toBe(true) + expect(isSupportedOpenCodeVersion('2.0.15+2.0.0')).toBe(true) }) it('rejects malformed and incomplete versions', () => { expect(isSupportedOpenCodeVersion('2garbage')).toBe(false) expect(isSupportedOpenCodeVersion('2')).toBe(false) expect(isSupportedOpenCodeVersion('2.0')).toBe(false) - expect(isSupportedOpenCodeVersion('2.0.0.1')).toBe(false) - expect(isSupportedOpenCodeVersion('02.0.0')).toBe(false) - expect(isSupportedOpenCodeVersion('2.0.0-alpha..1')).toBe(false) + expect(isSupportedOpenCodeVersion('2.0.15.1')).toBe(false) + expect(isSupportedOpenCodeVersion('02.0.15')).toBe(false) + expect(isSupportedOpenCodeVersion('2.0.15-alpha..1')).toBe(false) expect(isSupportedOpenCodeVersion('')).toBe(false) }) + + it('describes the supported range for unsupported versions', () => { + expect(describeUnsupportedOpenCodeVersion('3.0.0')).toBe( + 'OpenCode 3.0.0 is not supported; OpenCode Manager requires OpenCode >=2.0.15 <3.0.0', + ) + }) + }) + + describe('version parsing', () => { + it('normalizes surrounding whitespace and a leading v', () => { + expect(normalizeOpenCodeVersion(' v2.0.15\n')).toBe('2.0.15') + expect(normalizeOpenCodeVersion('2.0.15')).toBe('2.0.15') + }) + + it('parses version components and prerelease identifiers', () => { + expect(parseOpenCodeVersion('v2.1.3-beta.4')).toEqual({ major: 2, minor: 1, patch: 3, prerelease: ['beta', 4] }) + expect(parseOpenCodeVersion('2.1')).toBeNull() + }) + + it('identifies stable MAJOR.MINOR.PATCH versions', () => { + expect(isStableOpenCodeVersion('v2.0.15')).toBe(true) + expect(isStableOpenCodeVersion('2.1.0-beta.1')).toBe(false) + expect(isStableOpenCodeVersion('2.0.15; cat /etc/passwd')).toBe(false) + }) + + it('orders versions by semver precedence', () => { + expect(compareOpenCodeVersions('2.0.15', '2.0.14')).toBeGreaterThan(0) + expect(compareOpenCodeVersions('v2.0.15', '2.0.15')).toBe(0) + expect(compareOpenCodeVersions('2.0.9', '2.0.10')).toBeLessThan(0) + expect(compareOpenCodeVersions('2.1.0-beta.1', '2.1.0')).toBeLessThan(0) + expect(() => compareOpenCodeVersions('invalid', '2.0.15')).toThrow(/invalid/) + }) + + it('extracts the version from opencode --version output', () => { + expect(parseOpenCodeVersionOutput('2.0.15\n')).toBe('2.0.15') + expect(parseOpenCodeVersionOutput('opencode v2.0.15\n')).toBe('2.0.15') + expect(parseOpenCodeVersionOutput('opencode 2.1.0-beta.1 (linux-x64)')).toBe('2.1.0-beta.1') + expect(parseOpenCodeVersionOutput('version 2.0.15.')).toBe('2.0.15') + expect(parseOpenCodeVersionOutput('warning: something\nopencode 2.0.15')).toBe('2.0.15') + expect(parseOpenCodeVersionOutput('no version here')).toBeNull() + expect(parseOpenCodeVersionOutput('')).toBeNull() + }) + }) + + describe('pinned version sources', () => { + it('keeps the Dockerfile OPENCODE_VERSION default in sync with the pin', () => { + const dockerfile = readFileSync(join(REPO_ROOT, 'Dockerfile'), 'utf8') + expect(dockerfile).toMatch(new RegExp(`^ARG OPENCODE_VERSION=${OPENCODE_PINNED_VERSION.replace(/\./g, '\\.')}$`, 'm')) + expect(dockerfile).toMatch(/^ENV OPENCODE_BUNDLED_VERSION=\$\{OPENCODE_VERSION\}$/m) + }) + + it('makes the shell scripts derive the pin from the Dockerfile or the bundled version instead of hardcoding it', () => { + const entrypoint = readFileSync(join(REPO_ROOT, 'scripts', 'docker-entrypoint.sh'), 'utf8') + const setupDev = readFileSync(join(REPO_ROOT, 'scripts', 'setup-dev.sh'), 'utf8') + expect(entrypoint).toContain('OPENCODE_SUPPORTED_FLOOR="${OPENCODE_BUNDLED_VERSION:-}"') + expect(setupDev).toContain("sed -n 's/^ARG OPENCODE_VERSION=//p' \"$REPO_ROOT/Dockerfile\"") + for (const script of [entrypoint, setupDev]) { + expect(script).not.toMatch(/(? { diff --git a/backend/test/shared/opencode-mcp.test.ts b/backend/test/shared/opencode-mcp.test.ts index e62e39e8..72e2c78a 100644 --- a/backend/test/shared/opencode-mcp.test.ts +++ b/backend/test/shared/opencode-mcp.test.ts @@ -1,231 +1,49 @@ import { describe, expect, it } from 'vitest' import { MCP_OAUTH_CALLBACK_PATH, - fromV2McpServerConfig, - mcpServerConfigFromConfig, + mcpOAuthRedirectUri, mcpServersFromConfig, mcpStatusByName, - toV2McpServerConfig, - type McpServer, } from '@opencode-manager/shared/opencode' +import type { McpServer } from '@opencode-manager/shared/opencode' -describe('toV2McpServerConfig', () => { - it('converts a local server with environment and timeout', () => { - expect( - toV2McpServerConfig({ - type: 'local', - enabled: true, - command: ['npx', 'server-filesystem', '/tmp'], - environment: { API_KEY: 'secret' }, - timeout: 5000, - }), - ).toEqual({ - type: 'local', - command: ['npx', 'server-filesystem', '/tmp'], - environment: { API_KEY: 'secret' }, - disabled: false, - timeout: { catalog: 5000, execution: 5000 }, - }) - }) - - it('omits disabled when enabled is undefined', () => { - expect(toV2McpServerConfig({ type: 'local', command: ['npx', 'server'] })).toEqual({ - type: 'local', - command: ['npx', 'server'], - }) - }) - - it('inverts enabled into disabled', () => { - expect(toV2McpServerConfig({ type: 'local', command: ['npx', 'server'], enabled: false })).toEqual({ - type: 'local', - command: ['npx', 'server'], - disabled: true, - }) - }) - - it('keeps a remote server without OAuth unchanged', () => { - expect( - toV2McpServerConfig({ - type: 'remote', - url: 'https://mcp.example.com', - headers: { Authorization: 'Bearer token' }, - }), - ).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - headers: { Authorization: 'Bearer token' }, - }) - }) - - it('writes the Manager callback for OAuth servers', () => { - expect( - toV2McpServerConfig({ type: 'remote', url: 'https://mcp.example.com', oauth: true }, 'http://localhost:5003'), - ).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - oauth: { - redirect_uri: `http://localhost:5003${MCP_OAUTH_CALLBACK_PATH}`, - }, - }) - }) - - it('converts OAuth client fields and keeps the Manager callback', () => { - expect( - toV2McpServerConfig( - { - type: 'remote', - url: 'https://mcp.example.com', - oauth: { clientId: 'client-1', clientSecret: 'secret-1', scope: 'read write' }, - }, - 'https://manager.example.com', - ), - ).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - oauth: { - client_id: 'client-1', - client_secret: 'secret-1', - scope: 'read write', - redirect_uri: `https://manager.example.com${MCP_OAUTH_CALLBACK_PATH}`, - }, - }) - }) - - it('keeps OAuth disabled as false', () => { - expect( - toV2McpServerConfig({ type: 'remote', url: 'https://mcp.example.com', oauth: false }, 'http://localhost:5003'), - ).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - oauth: false, - }) - }) - - it('omits the callback when no origin is supplied', () => { - expect(toV2McpServerConfig({ type: 'remote', url: 'https://mcp.example.com', oauth: true })).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - oauth: {}, - }) - }) -}) - -describe('fromV2McpServerConfig', () => { - it('converts a native local server back to the form model', () => { - expect( - fromV2McpServerConfig({ - type: 'local', - command: ['npx', 'server'], - environment: { API_KEY: 'secret' }, - disabled: false, - timeout: { catalog: 5000, execution: 9000 }, - }), - ).toEqual({ - type: 'local', - enabled: true, - command: ['npx', 'server'], - environment: { API_KEY: 'secret' }, - timeout: 5000, - }) - }) - - it('inverts disabled into enabled', () => { - expect(fromV2McpServerConfig({ type: 'local', command: ['npx', 'server'], disabled: true })).toEqual({ - type: 'local', - enabled: false, - command: ['npx', 'server'], - }) - }) - - it('omits enabled when the native config omits disabled', () => { - expect(fromV2McpServerConfig({ type: 'local', command: ['npx', 'server'] })).toEqual({ - type: 'local', - command: ['npx', 'server'], - }) - }) - - it('converts a native remote OAuth server back to the form model', () => { - expect( - fromV2McpServerConfig({ - type: 'remote', - url: 'https://mcp.example.com', - oauth: { client_id: 'client-1', client_secret: 'secret-1', scope: 'read' }, - }), - ).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - oauth: { clientId: 'client-1', clientSecret: 'secret-1', scope: 'read' }, - }) - }) - - it('keeps OAuth disabled as false', () => { - expect(fromV2McpServerConfig({ type: 'remote', url: 'https://mcp.example.com', oauth: false })).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - oauth: false, - }) - }) - - it('falls back to the execution timeout when catalog is absent', () => { - expect( - fromV2McpServerConfig({ type: 'remote', url: 'https://mcp.example.com', timeout: { execution: 9000 } }), - ).toEqual({ - type: 'remote', - url: 'https://mcp.example.com', - timeout: 9000, - }) +describe('mcpOAuthRedirectUri', () => { + it('builds the Manager callback on the given origin', () => { + expect(mcpOAuthRedirectUri('https://manager.example.com')).toBe( + `https://manager.example.com${MCP_OAUTH_CALLBACK_PATH}`, + ) }) }) describe('mcpServersFromConfig', () => { - it('reads native servers and keeps legacy entries', () => { - expect( - mcpServersFromConfig({ - servers: { - native: { type: 'remote', url: 'https://native.example.com', disabled: true }, - }, - legacy: { type: 'local', command: ['npx', 'legacy'], enabled: false }, - }), - ).toEqual({ - native: { type: 'remote', url: 'https://native.example.com', enabled: false }, - legacy: { type: 'local', command: ['npx', 'legacy'], enabled: false }, - }) + it('returns native servers as-is so every V2 field survives', () => { + const remote = { + type: 'remote', + url: 'https://native.example.com', + oauth: { client_id: 'client', redirect_uri: `https://manager.example.com${MCP_OAUTH_CALLBACK_PATH}` }, + disabled: true, + codemode: true, + protocol: 'auto', + timeout: { startup: 1000, catalog: 2000, execution: 3000 }, + } + const local = { type: 'local', command: ['npx', 'server'], cwd: '/tmp', environment: { KEY: 'value' } } + + expect(mcpServersFromConfig({ servers: { remote, local } })).toEqual({ remote, local }) }) - it('ignores timeout entries and non-server values', () => { - expect(mcpServersFromConfig({ timeout: { catalog: 5000 }, broken: 'nope' })).toEqual({}) + it('ignores legacy flat entries, the timeout section, and invalid servers', () => { + expect( + mcpServersFromConfig({ + timeout: { catalog: 5000 }, + legacy: { type: 'local', command: ['npx', 'legacy'], enabled: false }, + servers: { broken: 'nope', untyped: { url: 'https://example.com' } }, + }), + ).toEqual({}) }) it('returns an empty map for a missing config', () => { expect(mcpServersFromConfig(undefined)).toEqual({}) - }) -}) - -describe('mcpServerConfigFromConfig', () => { - it('returns the native entry as-is so unknown fields survive', () => { - const native = { - type: 'remote', - url: 'https://native.example.com', - oauth: { redirect_uri: 'https://manager.example.com/api/mcp-oauth-proxy/callback' }, - protocol: 'auto', - } - - expect(mcpServerConfigFromConfig({ servers: { native } }, 'native')).toEqual(native) - }) - - it('converts a legacy entry to the native shape', () => { - expect( - mcpServerConfigFromConfig({ legacy: { type: 'local', command: ['npx', 'legacy'], timeout: 5000 } }, 'legacy'), - ).toEqual({ - type: 'local', - command: ['npx', 'legacy'], - timeout: { catalog: 5000, execution: 5000 }, - }) - }) - - it('returns undefined for unknown servers and missing config', () => { - expect(mcpServerConfigFromConfig({ servers: {} }, 'missing')).toBeUndefined() - expect(mcpServerConfigFromConfig(undefined, 'missing')).toBeUndefined() + expect(mcpServersFromConfig({ servers: [] })).toEqual({}) }) }) diff --git a/docs/configuration/environment.md b/docs/configuration/environment.md index f9d0f9ce..0300a054 100644 --- a/docs/configuration/environment.md +++ b/docs/configuration/environment.md @@ -99,6 +99,8 @@ When configured, users can enable push notifications in Settings → Notificatio | `OPENCODE_HEALTH_FAILURE_THRESHOLD` | Failed health checks before recovery starts | `2` | | `OPENCODE_SERVER_PASSWORD` | Basic Auth password for the managed OpenCode server. OpenCode 2 always requires one: when unset, OpenCode Manager generates and persists a password (override it any time via Settings → OpenCode → Server Auth). DB-stored passwords override this env var. | auto-generated | +> **Upgrade note:** `OPENCODE_PUBLIC_URL` is no longer used. MCP OAuth redirects now point at the Manager's `/api/mcp-oauth-proxy/callback`, built from the request: the scheme comes from `X-Forwarded-Proto` (first value, `http` or `https` only), then the `Origin` header, then `http`; the host comes from `X-Forwarded-Host` when present, otherwise `Host`. Behind a reverse proxy, forward `X-Forwarded-Proto` and `X-Forwarded-Host` (or preserve `Host`) and remove `OPENCODE_PUBLIC_URL`; the Manager logs a warning at startup while it is still set. + ## OpenCode Import | Variable | Description | Default | diff --git a/docs/development/setup.md b/docs/development/setup.md index 92b37d9a..1f84d40c 100644 --- a/docs/development/setup.md +++ b/docs/development/setup.md @@ -6,7 +6,7 @@ Guide for setting up a local development environment. - [pnpm](https://pnpm.io/installation) - Package manager (required for workspaces) - [Bun](https://bun.sh) - Backend runtime -- [OpenCode TUI](https://opencode.ai) 2.0.0 or newer - `curl -fsSL https://opencode.ai/v2/install | bash` +- [OpenCode TUI](https://opencode.ai) 2.x, 2.0.15 or newer - `curl -fsSL https://opencode.ai/v2/install | bash` ## Installation diff --git a/docs/features/assistant-internal-api.md b/docs/features/assistant-internal-api.md index d790fd02..6e7dc648 100644 --- a/docs/features/assistant-internal-api.md +++ b/docs/features/assistant-internal-api.md @@ -266,7 +266,7 @@ Read the merged configuration first, change only the keys the user asked for, an ``` **Response:** -Returns the refreshed `OpenCodeConfigFile`. Adds `restartRequired: true` when the change needs an OpenCode server restart. +Returns the refreshed `OpenCodeConfigFile`. Semantic changes are applied with an OpenCode location reload, without a restart. Adds `restartRequired: true` only when that reload fails. **Status Codes:** - `200`: Configuration written diff --git a/docs/features/mcp.md b/docs/features/mcp.md index c992efec..42134304 100644 --- a/docs/features/mcp.md +++ b/docs/features/mcp.md @@ -25,18 +25,27 @@ Local servers run as processes on your machine: ```json { - "name": "filesystem", - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"] + "mcp": { + "servers": { + "filesystem": { + "type": "local", + "command": [ + "npx", + "-y", + "@modelcontextprotocol/server-filesystem", + "/workspace" + ] + } + } + } } ``` | Field | Description | |-------|-------------| -| `name` | Unique identifier | -| `command` | Executable to run | -| `args` | Command arguments | -| `env` | Environment variables (optional) | +| Name (key under `mcp.servers`) | Unique identifier | +| `command` | Executable and its arguments, as one array | +| `environment` | Environment variables (optional) | ### Remote Servers (HTTP) @@ -49,20 +58,26 @@ Remote servers are accessed over HTTP/SSE: ```json { - "name": "remote-tools", - "url": "https://mcp.example.com/sse" + "mcp": { + "servers": { + "remote-tools": { + "type": "remote", + "url": "https://mcp.example.com/sse" + } + } + } } ``` | Field | Description | |-------|-------------| -| `name` | Unique identifier | -| `url` | Server SSE endpoint | +| Name (key under `mcp.servers`) | Unique identifier | +| `url` | Server endpoint | | `headers` | HTTP headers (optional) | ## Server Templates -Pre-built configurations for common MCP servers: +Pre-built configurations for common MCP servers, in the OpenCode 2 `mcp.servers` shape the Manager writes: ### Filesystem @@ -70,9 +85,19 @@ Access local files and directories: ```json { - "name": "filesystem", - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"] + "mcp": { + "servers": { + "filesystem": { + "type": "local", + "command": [ + "npx", + "-y", + "@modelcontextprotocol/server-filesystem", + "/path/to/dir" + ] + } + } + } } ``` @@ -82,11 +107,20 @@ Interact with GitHub repositories: ```json { - "name": "github", - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-github"], - "env": { - "GITHUB_TOKEN": "your-token-here" + "mcp": { + "servers": { + "github": { + "type": "local", + "command": [ + "npx", + "-y", + "@modelcontextprotocol/server-github" + ], + "environment": { + "GITHUB_TOKEN": "your-token-here" + } + } + } } } ``` @@ -97,11 +131,20 @@ Query PostgreSQL databases: ```json { - "name": "postgres", - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-postgres"], - "env": { - "DATABASE_URL": "postgres://user:pass@host:5432/db" + "mcp": { + "servers": { + "postgres": { + "type": "local", + "command": [ + "npx", + "-y", + "@modelcontextprotocol/server-postgres" + ], + "environment": { + "DATABASE_URL": "postgres://user:pass@host:5432/db" + } + } + } } } ``` @@ -112,11 +155,20 @@ Web search capabilities: ```json { - "name": "brave-search", - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-brave-search"], - "env": { - "BRAVE_API_KEY": "your-api-key" + "mcp": { + "servers": { + "brave-search": { + "type": "local", + "command": [ + "npx", + "-y", + "@modelcontextprotocol/server-brave-search" + ], + "environment": { + "BRAVE_API_KEY": "your-api-key" + } + } + } } } ``` diff --git a/docs/features/server-health.md b/docs/features/server-health.md index 1b510500..28e4647c 100644 --- a/docs/features/server-health.md +++ b/docs/features/server-health.md @@ -18,7 +18,7 @@ OpenCode Manager runs a supervised OpenCode server process to handle agent sessi The panel also displays: -- **OpenCode version** — The installed version of the OpenCode server (e.g., `v2.0.15`). OpenCode Manager requires OpenCode 2.0.0 or newer; a 1.x binary fails to start. +- **OpenCode version** — The installed version of the OpenCode server (e.g., `v2.0.15`). OpenCode Manager requires OpenCode 2.x at 2.0.15 or newer; a 1.x, 3.x, or older 2.x binary fails to start. - **Manager version** — The current OpenCode Manager version (e.g., `v0.14.5`) ## Health Monitoring @@ -42,7 +42,7 @@ Health monitoring is configured through environment variables: ## Configuration Recovery -The on-disk global configuration files in `.config/opencode/` are the source of truth. OpenCode 2 reads the two recognized sources in order — `opencode.json`, then `opencode.jsonc` — with later files overriding matching keys from earlier ones. The Manager reads and edits the same set: saves patch only the changed paths into the preferred existing source (`opencode.jsonc` > `opencode.json`), preserving comments and untouched keys, and a fresh installation is seeded with `opencode.jsonc`. The schema accepts both the V1-compatible keys the Manager writes and native OpenCode 2 fields, so a V2-native config is not flagged invalid. A legacy `config.json`, which OpenCode 2 ignores, is folded into the lowest-precedence source it does not override and archived on startup. When a source exists at boot but fails validation, the Manager logs a warning and starts with the files unchanged — an invalid config is never automatically replaced or rolled back during boot. +The on-disk global configuration files in `.config/opencode/` are the source of truth. OpenCode 2 reads the two recognized sources in order — `opencode.json`, then `opencode.jsonc` — with later files overriding matching keys from earlier ones. The Manager reads and edits the same set: saves patch only the changed paths into the preferred existing source (`opencode.jsonc` > `opencode.json`), preserving comments and untouched keys, and a fresh installation is seeded with `opencode.jsonc`. The schema accepts both V1-compatible keys and native OpenCode 2 fields, so a V2-native config is not flagged invalid. MCP servers are always written in the native OpenCode 2 shape under `mcp.servers.` — `type` (`local` with `command`, optional `cwd` and `environment`; or `remote` with `url`, optional `headers` and `oauth` using `client_id`, `client_secret`, `scope`, and `redirect_uri`), plus optional `disabled` and `timeout` (`startup`, `catalog`, `execution` in milliseconds). Legacy flat `mcp.` entries are never written; OpenCode 2 still normalizes them on load, so they appear in Settings → MCP from the running server's status but must be moved under `mcp.servers` to be edited or removed from the Manager. A legacy `config.json`, which OpenCode 2 ignores, is folded into the lowest-precedence source it does not override and archived on startup. When a source exists at boot but fails validation, the Manager logs a warning and starts with the files unchanged — an invalid config is never automatically replaced or rolled back during boot. The health-watch ladder is the only automatic repair path. When the supervised OpenCode server fails repeated health checks, recovery runs these actions in order until the server is healthy: @@ -88,6 +88,6 @@ Besides the explicit **Restart** button, the server is automatically restarted w - **Config import completes** — Importing a standalone OpenCode config into the workspace - **Version upgrade** — After installing a new OpenCode version -Saving the OpenCode configuration never restarts the server on its own. Any change to the merged configuration is written to disk and flagged as **restart required**; the server keeps running on the previous configuration until you restart it. Two exceptions do not set the flag: comment-only edits, and changes limited to the `mcp` section, which the Settings UI applies to the running server directly. Saving a provider credential, or completing a provider OAuth flow, applies to the running server immediately without a restart, because OpenCode 2 stores credentials in its database and broadcasts the change. +Saving the OpenCode configuration never restarts the server. A change to the merged configuration is written to disk and applied immediately with an OpenCode location reload, which re-reads the configuration, agents, commands, skills, plugins, and `AGENTS.md` for every loaded location without interrupting running sessions. Comment-only edits do nothing, and changes limited to the `mcp` section are applied by the Settings UI through the MCP API. The change is flagged as **restart required** only when the reload fails, for example because the server is unavailable. Changes to how the server process is launched still need a restart: server environment variables, Git credentials and identity, sandbox enforcement, manager token rotation, the server password, and OpenCode version installs. Saving a provider credential, or completing a provider OAuth flow, applies to the running server immediately without a restart, because OpenCode 2 stores credentials in its database and broadcasts the change. A save is rejected with `409` when the files changed since you loaded them (stale revision), or when it would remove a value that is defined only in a lower-priority source file — removing it from the preferred file would leave the inherited value in effect. diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 5501e93d..d294d374 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -21,7 +21,7 @@ Open [http://localhost:5003](http://localhost:5003) in your browser. The container automatically: -- Installs OpenCode 2 if not present (bundled 2.0.15; 2.0.0 or newer required) +- Installs OpenCode 2 if not present (bundled 2.0.15; 2.x at 2.0.15 or newer required) - Builds and serves the frontend - Creates persistent volumes for the workspace, database, and OpenCode binary - Configures health checks and auto-restart @@ -67,7 +67,7 @@ For contributors who want to develop locally instead of using Docker. - [pnpm](https://pnpm.io/installation) - Package manager (required for workspaces) - [Bun](https://bun.sh) - Backend runtime -- [OpenCode TUI](https://opencode.ai) 2.0.0 or newer - `curl -fsSL https://opencode.ai/v2/install | bash` +- [OpenCode TUI](https://opencode.ai) 2.x, 2.0.15 or newer - `curl -fsSL https://opencode.ai/v2/install | bash` - [Node.js 24+](https://nodejs.org/en/about/previous-releases) ### Setup diff --git a/docs/index.md b/docs/index.md index 229e4b87..8e29a68b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,7 +13,7 @@ Mobile-first web interface for [OpenCode](https://opencode.ai) AI agents. Manage

!!! warning "Requires OpenCode 2" - OpenCode Manager requires **OpenCode 2.0.0 or newer** (bundled 2.0.15). OpenCode 1.x is not supported. If you are upgrading from OpenCode 1.x, see the [v1 → v2 migration guide](https://opencode.ai/v2/docs/migrate-v1). + OpenCode Manager requires **OpenCode 2.x at 2.0.15 or newer** (bundled 2.0.15). OpenCode 1.x and 3.x are not supported. If you are upgrading from OpenCode 1.x, see the [v1 → v2 migration guide](https://opencode.ai/v2/docs/migrate-v1). ## Quick Start diff --git a/docs/ocm-cli.md b/docs/ocm-cli.md index 2d5f62ee..e24f9db6 100644 --- a/docs/ocm-cli.md +++ b/docs/ocm-cli.md @@ -11,6 +11,20 @@ 5. **List repos** — `ocm list` to see repos configured on the Manager 6. **Attach** — `ocm use ` to start an OpenCode session attached to that repo +## Compatibility + +| ocm | OpenCode Manager | Local OpenCode | +|---|---|---| +| 0.3.x | >= 0.19.0 | >= 2.0.15, < 3 | + +ocm 0.3.0 requires a local OpenCode 2 client (>= 2.0.15, same major), is configured through the OpenCode 2 `cli.json` `plugins` list, attaches through the repo-scoped Manager route `/api/opencode-proxy/repos/:repoId`, and moves sessions with OpenCode 2 session export/import. When the Manager does not serve the repo-scoped route (it answers `404`), `ocm` and `/ocm-move` stop before attaching or pushing with: + +```text +OpenCode Manager at is too old for ocm 0.3.0; upgrade the Manager to >= 0.19.0 +``` + +Keep ocm 0.2.x for OpenCode Manager < 0.19.0 and OpenCode 1.x. + ## Architecture Overview | Component | Where it runs | Role | @@ -119,6 +133,8 @@ OPENCODE_PASSWORD= \ opencode --server https://manager.example.com/api/opencode-proxy/repos/42 ``` +`OPENCODE_PASSWORD` is set only on this local `opencode` client invocation that `ocm` execs, from the stored Manager token; you do not need to export it yourself. Never put `OPENCODE_PASSWORD` in the OpenCode Manager server environment: the Manager strips it from its own env because it would override the Manager-managed OpenCode server password. + The repo-scoped proxy mount pins the request location to the repo directory, so the child TUI can run from any local working directory. The child takes over the terminal (`stdio: inherit`); closing the TUI exits `ocm` but leaves the Manager-side session @@ -134,7 +150,7 @@ When the TUI plugin is installed, these internal child-process variables add a ` ### TUI `/ocm-move` -When the TUI plugin entry is installed, `/ocm-move` is available in local OpenCode sessions. It checks that the matching Manager repo has not diverged, pushes the local git state with the fast bundle + working-tree patch path, exports the active session through the local OpenCode 2 server (`session.export`), rewrites local repo directories and file attachment URIs to the Manager repo directory, imports the session through the Manager proxy (`session.import`), and sends a synthetic reminder (`session.synthetic`) to the remote session (best-effort, never fails the move). The local session is retained. When multiple Manager repos match, a select dialog lets you pick the destination. A confirmation dialog gates the move before any push. On success you can choose to warp — exit the local TUI and attach to the moved session on the Manager immediately — or keep the local copy with the previous toast behavior. +When the TUI plugin entry is installed, `/ocm-move` is available in local OpenCode sessions. It checks that the matching Manager repo has not diverged, pushes the local git state with the fast bundle + working-tree patch path, exports the active session through the local OpenCode 2 server (`session.export`), rewrites local repo directories and file attachment URIs to the Manager repo directory, imports the session's messages through the Manager proxy (`session.import`), and sends a synthetic reminder (`session.synthetic`) to the remote session (best-effort, never fails the move). The local session is retained. When multiple Manager repos match, a select dialog lets you pick the destination. A confirmation dialog gates the move before any push. On success you can choose to warp — exit the local TUI and attach to the moved session on the Manager immediately — or keep the local copy with the previous toast behavior. - `--force` skips the dirty-working-tree check on `pull` and the safety bail on `push`. - `--create` (on `push`) creates a new Manager repo when no `origin` match is found. @@ -149,6 +165,7 @@ The CLI's environment and token inputs: | Variable | Description | |---|---| | `OPENCODE_MANAGER_URL` | Manager base URL (e.g., `https://manager.example.com`). Not currently consumed by the CLI — use `ocm login`. | +| `OPENCODE_PASSWORD` | Set by `ocm` on the local `opencode` child only (value = Manager token). Client-side only; never set it in the Manager server environment, which strips it. | | `OCM_REMOTE_MANAGER_URL` | Internal child-process context set by `ocm attach`; controls the remote TUI indicator. Not a login setting. | | `OCM_REMOTE_REPO_NAME` | Internal child-process context set by `ocm attach`; labels the remote TUI indicator. Not a login setting. | | `OCM_TOKEN` | Read-only override for the stored token; takes priority over the platform token store. `ocm login` never writes it, and `ocm logout` cannot remove it. Because the manager URL still comes from `state.json`, CI must run `ocm login` first, so this override does not yet avoid writing a token to disk. | diff --git a/frontend/package-lock.json b/frontend/package-lock.json deleted file mode 100644 index 032f1f43..00000000 --- a/frontend/package-lock.json +++ /dev/null @@ -1,7483 +0,0 @@ -{ - "name": "frontend", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "frontend", - "dependencies": { - "@hookform/resolvers": "^5.2.2", - "@monaco-editor/react": "^4.7.0", - "@radix-ui/react-checkbox": "^1.3.3", - "@radix-ui/react-dialog": "^1.1.15", - "@radix-ui/react-dropdown-menu": "^2.1.16", - "@radix-ui/react-label": "^2.1.7", - "@radix-ui/react-select": "^2.2.6", - "@radix-ui/react-slider": "^1.3.6", - "@radix-ui/react-slot": "^1.2.3", - "@radix-ui/react-switch": "^1.2.6", - "@radix-ui/react-tabs": "^1.1.13", - "@tailwindcss/vite": "^4.1.14", - "@tanstack/react-query": "^5.90.5", - "axios": "^1.12.2", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", - "cmdk": "^1.1.1", - "date-fns": "^4.1.0", - "diff": "^8.0.2", - "highlight.js": "^11.11.1", - "lucide-react": "^0.546.0", - "react": "^19.1.1", - "react-dom": "^19.1.1", - "react-hook-form": "^7.65.0", - "react-markdown": "^10.1.0", - "react-router-dom": "^7.9.4", - "rehype-highlight": "^7.0.2", - "rehype-raw": "^7.0.0", - "remark-gfm": "^4.0.1", - "sonner": "^2.0.7", - "strip-json-comments": "^5.0.3", - "tailwind-merge": "^3.3.1", - "zod": "^4.1.12", - "zustand": "^5.0.8" - }, - "devDependencies": { - "@eslint/js": "^9.36.0", - "@types/node": "^24.8.1", - "@types/react": "^19.2.2", - "@types/react-dom": "^19.2.2", - "@vitejs/plugin-react": "^5.0.4", - "autoprefixer": "^10.4.21", - "eslint": "^9.39.1", - "eslint-plugin-react-hooks": "^5.2.0", - "eslint-plugin-react-refresh": "^0.4.22", - "globals": "^16.4.0", - "openapi-typescript": "^7.10.1", - "postcss": "^8.5.6", - "tailwindcss": "^4.1.14", - "typescript": "~5.9.3", - "typescript-eslint": "^8.45.0", - "vite": "^7.1.7" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", - "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.27.1", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", - "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", - "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.5", - "@babel/helper-compilation-targets": "^7.27.2", - "@babel/helper-module-transforms": "^7.28.3", - "@babel/helpers": "^7.28.4", - "@babel/parser": "^7.28.5", - "@babel/template": "^7.27.2", - "@babel/traverse": "^7.28.5", - "@babel/types": "^7.28.5", - "@jridgewell/remapping": "^2.3.5", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", - "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.28.5", - "@babel/types": "^7.28.5", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", - "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.27.2", - "@babel/helper-validator-option": "^7.27.1", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", - "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.27.1", - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.28.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", - "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.27.1", - "@babel/helper-validator-identifier": "^7.27.1", - "@babel/traverse": "^7.28.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", - "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", - "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", - "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.5" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", - "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", - "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.27.2", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", - "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/parser": "^7.27.2", - "@babel/types": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", - "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.5", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.28.5", - "@babel/template": "^7.27.2", - "@babel/types": "^7.28.5", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", - "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", - "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.12.2", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", - "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/config-array": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", - "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/object-schema": "^2.1.7", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/config-helpers": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", - "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.17.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", - "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.1", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/eslintrc/node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "9.39.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", - "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - } - }, - "node_modules/@eslint/object-schema": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", - "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", - "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.17.0", - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@floating-ui/core": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.3.tgz", - "integrity": "sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==", - "license": "MIT", - "dependencies": { - "@floating-ui/utils": "^0.2.10" - } - }, - "node_modules/@floating-ui/dom": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.4.tgz", - "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", - "license": "MIT", - "dependencies": { - "@floating-ui/core": "^1.7.3", - "@floating-ui/utils": "^0.2.10" - } - }, - "node_modules/@floating-ui/react-dom": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.6.tgz", - "integrity": "sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw==", - "license": "MIT", - "dependencies": { - "@floating-ui/dom": "^1.7.4" - }, - "peerDependencies": { - "react": ">=16.8.0", - "react-dom": ">=16.8.0" - } - }, - "node_modules/@floating-ui/utils": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.10.tgz", - "integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==", - "license": "MIT" - }, - "node_modules/@hookform/resolvers": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-5.2.2.tgz", - "integrity": "sha512-A/IxlMLShx3KjV/HeTcTfaMxdwy690+L/ZADoeaTltLx+CVuzkeVIPuybK3jrRfw7YZnmdKsVVHAlEPIAEUNlA==", - "license": "MIT", - "dependencies": { - "@standard-schema/utils": "^0.3.0" - }, - "peerDependencies": { - "react-hook-form": "^7.55.0" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.7", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", - "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.4.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", - "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@monaco-editor/loader": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.7.0.tgz", - "integrity": "sha512-gIwR1HrJrrx+vfyOhYmCZ0/JcWqG5kbfG7+d3f/C1LXk2EvzAbHSg3MQ5lO2sMlo9izoAZ04shohfKLVT6crVA==", - "license": "MIT", - "dependencies": { - "state-local": "^1.0.6" - } - }, - "node_modules/@monaco-editor/react": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.7.0.tgz", - "integrity": "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA==", - "license": "MIT", - "dependencies": { - "@monaco-editor/loader": "^1.5.0" - }, - "peerDependencies": { - "monaco-editor": ">= 0.25.0 < 1", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, - "node_modules/@radix-ui/number": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.1.tgz", - "integrity": "sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==", - "license": "MIT" - }, - "node_modules/@radix-ui/primitive": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz", - "integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==", - "license": "MIT" - }, - "node_modules/@radix-ui/react-arrow": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz", - "integrity": "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-primitive": "2.1.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-checkbox": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.3.3.tgz", - "integrity": "sha512-wBbpv+NQftHDdG86Qc0pIyXk5IR3tM8Vd0nWLKDcX8nNn4nXFOFwsKuqw2okA/1D/mpaAkmuyndrPJTYDNZtFw==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-presence": "1.1.5", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-controllable-state": "1.2.2", - "@radix-ui/react-use-previous": "1.1.1", - "@radix-ui/react-use-size": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-collection": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.7.tgz", - "integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-slot": "1.2.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", - "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-compose-refs": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz", - "integrity": "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-context": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", - "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dialog": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.15.tgz", - "integrity": "sha512-TCglVRtzlffRNxRMEyR36DGBLJpeusFcgMVD9PZEzAKnUs1lKCgX5u9BmC2Yg+LL9MgZDugFFs1Vl+Jp4t/PGw==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-dismissable-layer": "1.1.11", - "@radix-ui/react-focus-guards": "1.1.3", - "@radix-ui/react-focus-scope": "1.1.7", - "@radix-ui/react-id": "1.1.1", - "@radix-ui/react-portal": "1.1.9", - "@radix-ui/react-presence": "1.1.5", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-slot": "1.2.3", - "@radix-ui/react-use-controllable-state": "1.2.2", - "aria-hidden": "^1.2.4", - "react-remove-scroll": "^2.6.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", - "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-direction": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.1.tgz", - "integrity": "sha512-1UEWRX6jnOA2y4H5WczZ44gOOjTEmlqv1uNW4GAJEO5+bauCBhv8snY65Iw5/VOS/ghKN9gr2KjnLKxrsvoMVw==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dismissable-layer": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz", - "integrity": "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-callback-ref": "1.1.1", - "@radix-ui/react-use-escape-keydown": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-dropdown-menu": { - "version": "2.1.16", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.16.tgz", - "integrity": "sha512-1PLGQEynI/3OX/ftV54COn+3Sud/Mn8vALg2rWnBLnRaGtJDduNW/22XjlGgPdpcIbiQxjKtb7BkcjP00nqfJw==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-id": "1.1.1", - "@radix-ui/react-menu": "2.1.16", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-controllable-state": "1.2.2" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-focus-guards": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz", - "integrity": "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-focus-scope": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.7.tgz", - "integrity": "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-callback-ref": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-id": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz", - "integrity": "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-use-layout-effect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-label": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.1.8.tgz", - "integrity": "sha512-FmXs37I6hSBVDlO4y764TNz1rLgKwjJMQ0EGte6F3Cb3f4bIuHB/iLa/8I9VKkmOy+gNHq8rql3j686ACVV21A==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-primitive": "2.1.4" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-label/node_modules/@radix-ui/react-primitive": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.4.tgz", - "integrity": "sha512-9hQc4+GNVtJAIEPEqlYqW5RiYdrr8ea5XQ0ZOnD6fgru+83kqT15mq2OCcbe8KnjRZl5vF3ks69AKz3kh1jrhg==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-slot": "1.2.4" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-menu": { - "version": "2.1.16", - "resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.16.tgz", - "integrity": "sha512-72F2T+PLlphrqLcAotYPp0uJMr5SjP5SL01wfEspJbru5Zs5vQaSHb4VB3ZMJPimgHHCHG7gMOeOB9H3Hdmtxg==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-collection": "1.1.7", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-direction": "1.1.1", - "@radix-ui/react-dismissable-layer": "1.1.11", - "@radix-ui/react-focus-guards": "1.1.3", - "@radix-ui/react-focus-scope": "1.1.7", - "@radix-ui/react-id": "1.1.1", - "@radix-ui/react-popper": "1.2.8", - "@radix-ui/react-portal": "1.1.9", - "@radix-ui/react-presence": "1.1.5", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-roving-focus": "1.1.11", - "@radix-ui/react-slot": "1.2.3", - "@radix-ui/react-use-callback-ref": "1.1.1", - "aria-hidden": "^1.2.4", - "react-remove-scroll": "^2.6.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", - "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-popper": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz", - "integrity": "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==", - "license": "MIT", - "dependencies": { - "@floating-ui/react-dom": "^2.0.0", - "@radix-ui/react-arrow": "1.1.7", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-callback-ref": "1.1.1", - "@radix-ui/react-use-layout-effect": "1.1.1", - "@radix-ui/react-use-rect": "1.1.1", - "@radix-ui/react-use-size": "1.1.1", - "@radix-ui/rect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-portal": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.9.tgz", - "integrity": "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-layout-effect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-presence": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz", - "integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-use-layout-effect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-primitive": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", - "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-slot": "1.2.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", - "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-roving-focus": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.11.tgz", - "integrity": "sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-collection": "1.1.7", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-direction": "1.1.1", - "@radix-ui/react-id": "1.1.1", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-callback-ref": "1.1.1", - "@radix-ui/react-use-controllable-state": "1.2.2" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-select": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.2.6.tgz", - "integrity": "sha512-I30RydO+bnn2PQztvo25tswPH+wFBjehVGtmagkU78yMdwTwVf12wnAOF+AeP8S2N8xD+5UPbGhkUfPyvT+mwQ==", - "license": "MIT", - "dependencies": { - "@radix-ui/number": "1.1.1", - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-collection": "1.1.7", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-direction": "1.1.1", - "@radix-ui/react-dismissable-layer": "1.1.11", - "@radix-ui/react-focus-guards": "1.1.3", - "@radix-ui/react-focus-scope": "1.1.7", - "@radix-ui/react-id": "1.1.1", - "@radix-ui/react-popper": "1.2.8", - "@radix-ui/react-portal": "1.1.9", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-slot": "1.2.3", - "@radix-ui/react-use-callback-ref": "1.1.1", - "@radix-ui/react-use-controllable-state": "1.2.2", - "@radix-ui/react-use-layout-effect": "1.1.1", - "@radix-ui/react-use-previous": "1.1.1", - "@radix-ui/react-visually-hidden": "1.2.3", - "aria-hidden": "^1.2.4", - "react-remove-scroll": "^2.6.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-slot": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", - "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-slider": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slider/-/react-slider-1.3.6.tgz", - "integrity": "sha512-JPYb1GuM1bxfjMRlNLE+BcmBC8onfCi60Blk7OBqi2MLTFdS+8401U4uFjnwkOr49BLmXxLC6JHkvAsx5OJvHw==", - "license": "MIT", - "dependencies": { - "@radix-ui/number": "1.1.1", - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-collection": "1.1.7", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-direction": "1.1.1", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-controllable-state": "1.2.2", - "@radix-ui/react-use-layout-effect": "1.1.1", - "@radix-ui/react-use-previous": "1.1.1", - "@radix-ui/react-use-size": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-slot": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.4.tgz", - "integrity": "sha512-Jl+bCv8HxKnlTLVrcDE8zTMJ09R9/ukw4qBs/oZClOfoQk/cOTbDn+NceXfV7j09YPVQUryJPHurafcSg6EVKA==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.2" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-switch": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@radix-ui/react-switch/-/react-switch-1.2.6.tgz", - "integrity": "sha512-bByzr1+ep1zk4VubeEVViV592vu2lHE2BZY5OnzehZqOOgogN80+mNtCqPkhn2gklJqOpxWgPoYTSnhBCqpOXQ==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-compose-refs": "1.1.2", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-use-controllable-state": "1.2.2", - "@radix-ui/react-use-previous": "1.1.1", - "@radix-ui/react-use-size": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-tabs": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.1.13.tgz", - "integrity": "sha512-7xdcatg7/U+7+Udyoj2zodtI9H/IIopqo+YOIcZOq1nJwXWBZ9p8xiu5llXlekDbZkca79a/fozEYQXIA4sW6A==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.3", - "@radix-ui/react-context": "1.1.2", - "@radix-ui/react-direction": "1.1.1", - "@radix-ui/react-id": "1.1.1", - "@radix-ui/react-presence": "1.1.5", - "@radix-ui/react-primitive": "2.1.3", - "@radix-ui/react-roving-focus": "1.1.11", - "@radix-ui/react-use-controllable-state": "1.2.2" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-callback-ref": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz", - "integrity": "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-controllable-state": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz", - "integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-use-effect-event": "0.0.2", - "@radix-ui/react-use-layout-effect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-effect-event": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.2.tgz", - "integrity": "sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-use-layout-effect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-escape-keydown": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.1.tgz", - "integrity": "sha512-Il0+boE7w/XebUHyBjroE+DbByORGR9KKmITzbR7MyQ4akpORYP/ZmbhAr0DG7RmmBqoOnZdy2QlvajJ2QA59g==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-use-callback-ref": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-layout-effect": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz", - "integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-previous": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.1.tgz", - "integrity": "sha512-2dHfToCj/pzca2Ck724OZ5L0EVrr3eHRNsG/b3xQJLA2hZpVCS99bLAX+hm1IHXDEnzU6by5z/5MIY794/a8NQ==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-rect": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.1.tgz", - "integrity": "sha512-QTYuDesS0VtuHNNvMh+CjlKJ4LJickCMUAqjlE3+j8w+RlRpwyX3apEQKGFzbZGdo7XNG1tXa+bQqIE7HIXT2w==", - "license": "MIT", - "dependencies": { - "@radix-ui/rect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-use-size": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.1.tgz", - "integrity": "sha512-ewrXRDTAqAXlkl6t/fkXWNAhFX9I+CkKlw6zjEwk86RSPKwZr3xpBRso655aqYafwtnbpHLj6toFzmd6xdVptQ==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-use-layout-effect": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-visually-hidden": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.2.3.tgz", - "integrity": "sha512-pzJq12tEaaIhqjbzpCuv/OypJY/BPavOofm+dbab+MHLajy277+1lLm6JFcGgF5eskJ6mquGirhXY2GD/8u8Ug==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-primitive": "2.1.3" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/rect": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.1.tgz", - "integrity": "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==", - "license": "MIT" - }, - "node_modules/@redocly/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-EDtsGZS964mf9zAUXAl9Ew16eYbeyAFWhsPr0fX6oaJxgd8rApYlPBf0joyhnUHz88WxrigyFtTaqqzXNzPgqw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@redocly/ajv/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/@redocly/config": { - "version": "0.22.2", - "resolved": "https://registry.npmjs.org/@redocly/config/-/config-0.22.2.tgz", - "integrity": "sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@redocly/openapi-core": { - "version": "1.34.5", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.5.tgz", - "integrity": "sha512-0EbE8LRbkogtcCXU7liAyC00n9uNG9hJ+eMyHFdUsy9lB/WGqnEBgwjA9q2cyzAVcdTkQqTBBU1XePNnN3OijA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@redocly/ajv": "^8.11.2", - "@redocly/config": "^0.22.0", - "colorette": "^1.2.0", - "https-proxy-agent": "^7.0.5", - "js-levenshtein": "^1.1.6", - "js-yaml": "^4.1.0", - "minimatch": "^5.0.1", - "pluralize": "^8.0.0", - "yaml-ast-parser": "0.0.43" - }, - "engines": { - "node": ">=18.17.0", - "npm": ">=9.5.0" - } - }, - "node_modules/@redocly/openapi-core/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@redocly/openapi-core/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-beta.47", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.47.tgz", - "integrity": "sha512-8QagwMH3kNCuzD8EWL8R2YPW5e4OrHNSAHRFDdmFqEwEaD/KcNKjVoumo+gP2vW5eKB2UPbM6vTYiGZX0ixLnw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", - "integrity": "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz", - "integrity": "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz", - "integrity": "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz", - "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz", - "integrity": "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz", - "integrity": "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz", - "integrity": "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz", - "integrity": "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz", - "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz", - "integrity": "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz", - "integrity": "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz", - "integrity": "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz", - "integrity": "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz", - "integrity": "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz", - "integrity": "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz", - "integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz", - "integrity": "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz", - "integrity": "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz", - "integrity": "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz", - "integrity": "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz", - "integrity": "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", - "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@standard-schema/utils": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", - "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", - "license": "MIT" - }, - "node_modules/@tailwindcss/node": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.17.tgz", - "integrity": "sha512-csIkHIgLb3JisEFQ0vxr2Y57GUNYh447C8xzwj89U/8fdW8LhProdxvnVH6U8M2Y73QKiTIH+LWbK3V2BBZsAg==", - "license": "MIT", - "dependencies": { - "@jridgewell/remapping": "^2.3.4", - "enhanced-resolve": "^5.18.3", - "jiti": "^2.6.1", - "lightningcss": "1.30.2", - "magic-string": "^0.30.21", - "source-map-js": "^1.2.1", - "tailwindcss": "4.1.17" - } - }, - "node_modules/@tailwindcss/oxide": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.17.tgz", - "integrity": "sha512-F0F7d01fmkQhsTjXezGBLdrl1KresJTcI3DB8EkScCldyKp3Msz4hub4uyYaVnk88BAS1g5DQjjF6F5qczheLA==", - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "optionalDependencies": { - "@tailwindcss/oxide-android-arm64": "4.1.17", - "@tailwindcss/oxide-darwin-arm64": "4.1.17", - "@tailwindcss/oxide-darwin-x64": "4.1.17", - "@tailwindcss/oxide-freebsd-x64": "4.1.17", - "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.17", - "@tailwindcss/oxide-linux-arm64-gnu": "4.1.17", - "@tailwindcss/oxide-linux-arm64-musl": "4.1.17", - "@tailwindcss/oxide-linux-x64-gnu": "4.1.17", - "@tailwindcss/oxide-linux-x64-musl": "4.1.17", - "@tailwindcss/oxide-wasm32-wasi": "4.1.17", - "@tailwindcss/oxide-win32-arm64-msvc": "4.1.17", - "@tailwindcss/oxide-win32-x64-msvc": "4.1.17" - } - }, - "node_modules/@tailwindcss/oxide-android-arm64": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.1.17.tgz", - "integrity": "sha512-BMqpkJHgOZ5z78qqiGE6ZIRExyaHyuxjgrJ6eBO5+hfrfGkuya0lYfw8fRHG77gdTjWkNWEEm+qeG2cDMxArLQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-darwin-arm64": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.17.tgz", - "integrity": "sha512-EquyumkQweUBNk1zGEU/wfZo2qkp/nQKRZM8bUYO0J+Lums5+wl2CcG1f9BgAjn/u9pJzdYddHWBiFXJTcxmOg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-darwin-x64": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.1.17.tgz", - "integrity": "sha512-gdhEPLzke2Pog8s12oADwYu0IAw04Y2tlmgVzIN0+046ytcgx8uZmCzEg4VcQh+AHKiS7xaL8kGo/QTiNEGRog==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-freebsd-x64": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.1.17.tgz", - "integrity": "sha512-hxGS81KskMxML9DXsaXT1H0DyA+ZBIbyG/sSAjWNe2EDl7TkPOBI42GBV3u38itzGUOmFfCzk1iAjDXds8Oh0g==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.1.17.tgz", - "integrity": "sha512-k7jWk5E3ldAdw0cNglhjSgv501u7yrMf8oeZ0cElhxU6Y2o7f8yqelOp3fhf7evjIS6ujTI3U8pKUXV2I4iXHQ==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.1.17.tgz", - "integrity": "sha512-HVDOm/mxK6+TbARwdW17WrgDYEGzmoYayrCgmLEw7FxTPLcp/glBisuyWkFz/jb7ZfiAXAXUACfyItn+nTgsdQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-linux-arm64-musl": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.1.17.tgz", - "integrity": "sha512-HvZLfGr42i5anKtIeQzxdkw/wPqIbpeZqe7vd3V9vI3RQxe3xU1fLjss0TjyhxWcBaipk7NYwSrwTwK1hJARMg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-linux-x64-gnu": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.1.17.tgz", - "integrity": "sha512-M3XZuORCGB7VPOEDH+nzpJ21XPvK5PyjlkSFkFziNHGLc5d6g3di2McAAblmaSUNl8IOmzYwLx9NsE7bplNkwQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-linux-x64-musl": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.1.17.tgz", - "integrity": "sha512-k7f+pf9eXLEey4pBlw+8dgfJHY4PZ5qOUFDyNf7SI6lHjQ9Zt7+NcscjpwdCEbYi6FI5c2KDTDWyf2iHcCSyyQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-wasm32-wasi": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.1.17.tgz", - "integrity": "sha512-cEytGqSSoy7zK4JRWiTCx43FsKP/zGr0CsuMawhH67ONlH+T79VteQeJQRO/X7L0juEUA8ZyuYikcRBf0vsxhg==", - "bundleDependencies": [ - "@napi-rs/wasm-runtime", - "@emnapi/core", - "@emnapi/runtime", - "@tybys/wasm-util", - "@emnapi/wasi-threads", - "tslib" - ], - "cpu": [ - "wasm32" - ], - "license": "MIT", - "optional": true, - "dependencies": { - "@emnapi/core": "^1.6.0", - "@emnapi/runtime": "^1.6.0", - "@emnapi/wasi-threads": "^1.1.0", - "@napi-rs/wasm-runtime": "^1.0.7", - "@tybys/wasm-util": "^0.10.1", - "tslib": "^2.4.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.17.tgz", - "integrity": "sha512-JU5AHr7gKbZlOGvMdb4722/0aYbU+tN6lv1kONx0JK2cGsh7g148zVWLM0IKR3NeKLv+L90chBVYcJ8uJWbC9A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/oxide-win32-x64-msvc": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.1.17.tgz", - "integrity": "sha512-SKWM4waLuqx0IH+FMDUw6R66Hu4OuTALFgnleKbqhgGU30DY20NORZMZUKgLRjQXNN2TLzKvh48QXTig4h4bGw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@tailwindcss/vite": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.1.17.tgz", - "integrity": "sha512-4+9w8ZHOiGnpcGI6z1TVVfWaX/koK7fKeSYF3qlYg2xpBtbteP2ddBxiarL+HVgfSJGeK5RIxRQmKm4rTJJAwA==", - "license": "MIT", - "dependencies": { - "@tailwindcss/node": "4.1.17", - "@tailwindcss/oxide": "4.1.17", - "tailwindcss": "4.1.17" - }, - "peerDependencies": { - "vite": "^5.2.0 || ^6 || ^7" - } - }, - "node_modules/@tanstack/query-core": { - "version": "5.90.11", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.90.11.tgz", - "integrity": "sha512-f9z/nXhCgWDF4lHqgIE30jxLe4sYv15QodfdPDKYAk7nAEjNcndy4dHz3ezhdUaR23BpWa4I2EH4/DZ0//Uf8A==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - } - }, - "node_modules/@tanstack/react-query": { - "version": "5.90.11", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.11.tgz", - "integrity": "sha512-3uyzz01D1fkTLXuxF3JfoJoHQMU2fxsfJwE+6N5hHy0dVNoZOvwKP8Z2k7k1KDeD54N20apcJnG75TBAStIrBA==", - "license": "MIT", - "dependencies": { - "@tanstack/query-core": "5.90.11" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - }, - "peerDependencies": { - "react": "^18 || ^19" - } - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", - "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", - "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.2" - } - }, - "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", - "license": "MIT", - "dependencies": { - "@types/ms": "*" - } - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "license": "MIT" - }, - "node_modules/@types/estree-jsx": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", - "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", - "license": "MIT", - "dependencies": { - "@types/estree": "*" - } - }, - "node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/mdast": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", - "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", - "license": "MIT", - "dependencies": { - "@types/unist": "*" - } - }, - "node_modules/@types/ms": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", - "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "24.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", - "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", - "devOptional": true, - "license": "MIT", - "peer": true, - "dependencies": { - "undici-types": "~7.16.0" - } - }, - "node_modules/@types/react": { - "version": "19.2.7", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", - "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", - "license": "MIT", - "peer": true, - "dependencies": { - "csstype": "^3.2.2" - } - }, - "node_modules/@types/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", - "devOptional": true, - "license": "MIT", - "peer": true, - "peerDependencies": { - "@types/react": "^19.2.0" - } - }, - "node_modules/@types/trusted-types": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", - "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", - "license": "MIT", - "optional": true - }, - "node_modules/@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "license": "MIT" - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.0.tgz", - "integrity": "sha512-XxXP5tL1txl13YFtrECECQYeZjBZad4fyd3cFV4a19LkAY/bIp9fev3US4S5fDVV2JaYFiKAZ/GRTOLer+mbyQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.48.0", - "@typescript-eslint/type-utils": "8.48.0", - "@typescript-eslint/utils": "8.48.0", - "@typescript-eslint/visitor-keys": "8.48.0", - "graphemer": "^1.4.0", - "ignore": "^7.0.0", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.48.0", - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.0.tgz", - "integrity": "sha512-jCzKdm/QK0Kg4V4IK/oMlRZlY+QOcdjv89U2NgKHZk1CYTj82/RVSx1mV/0gqCVMJ/DA+Zf/S4NBWNF8GQ+eqQ==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@typescript-eslint/scope-manager": "8.48.0", - "@typescript-eslint/types": "8.48.0", - "@typescript-eslint/typescript-estree": "8.48.0", - "@typescript-eslint/visitor-keys": "8.48.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/project-service": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.0.tgz", - "integrity": "sha512-Ne4CTZyRh1BecBf84siv42wv5vQvVmgtk8AuiEffKTUo3DrBaGYZueJSxxBZ8fjk/N3DrgChH4TOdIOwOwiqqw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.48.0", - "@typescript-eslint/types": "^8.48.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.48.0.tgz", - "integrity": "sha512-uGSSsbrtJrLduti0Q1Q9+BF1/iFKaxGoQwjWOIVNJv0o6omrdyR8ct37m4xIl5Zzpkp69Kkmvom7QFTtue89YQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.48.0", - "@typescript-eslint/visitor-keys": "8.48.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.0.tgz", - "integrity": "sha512-WNebjBdFdyu10sR1M4OXTt2OkMd5KWIL+LLfeH9KhgP+jzfDV/LI3eXzwJ1s9+Yc0Kzo2fQCdY/OpdusCMmh6w==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.48.0.tgz", - "integrity": "sha512-zbeVaVqeXhhab6QNEKfK96Xyc7UQuoFWERhEnj3mLVnUWrQnv15cJNseUni7f3g557gm0e46LZ6IJ4NJVOgOpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.48.0", - "@typescript-eslint/typescript-estree": "8.48.0", - "@typescript-eslint/utils": "8.48.0", - "debug": "^4.3.4", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.0.tgz", - "integrity": "sha512-cQMcGQQH7kwKoVswD1xdOytxQR60MWKM1di26xSUtxehaDs/32Zpqsu5WJlXTtTTqyAVK8R7hvsUnIXRS+bjvA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.0.tgz", - "integrity": "sha512-ljHab1CSO4rGrQIAyizUS6UGHHCiAYhbfcIZ1zVJr5nMryxlXMVWS3duFPSKvSUbFPwkXMFk1k0EMIjub4sRRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/project-service": "8.48.0", - "@typescript-eslint/tsconfig-utils": "8.48.0", - "@typescript-eslint/types": "8.48.0", - "@typescript-eslint/visitor-keys": "8.48.0", - "debug": "^4.3.4", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.48.0.tgz", - "integrity": "sha512-yTJO1XuGxCsSfIVt1+1UrLHtue8xz16V8apzPYI06W0HbEbEWHxHXgZaAgavIkoh+GeV6hKKd5jm0sS6OYxWXQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.48.0", - "@typescript-eslint/types": "8.48.0", - "@typescript-eslint/typescript-estree": "8.48.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.48.0.tgz", - "integrity": "sha512-T0XJMaRPOH3+LBbAfzR2jalckP1MSG/L9eUtY0DEzUyVaXJ/t6zN0nR7co5kz0Jko/nkSYCBRkz1djvjajVTTg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.48.0", - "eslint-visitor-keys": "^4.2.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", - "license": "ISC" - }, - "node_modules/@vitejs/plugin-react": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.1.tgz", - "integrity": "sha512-WQfkSw0QbQ5aJ2CHYw23ZGkqnRwqKHD/KYsMeTkZzPT4Jcf0DcBxBtwMJxnu6E7oxw5+JC6ZAiePgh28uJ1HBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.28.5", - "@babel/plugin-transform-react-jsx-self": "^7.27.1", - "@babel/plugin-transform-react-jsx-source": "^7.27.1", - "@rolldown/pluginutils": "1.0.0-beta.47", - "@types/babel__core": "^7.20.5", - "react-refresh": "^0.18.0" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" - } - }, - "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "dev": true, - "license": "MIT", - "peer": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/agent-base": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", - "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, - "node_modules/aria-hidden": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", - "integrity": "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==", - "license": "MIT", - "dependencies": { - "tslib": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "license": "MIT" - }, - "node_modules/autoprefixer": { - "version": "10.4.22", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.22.tgz", - "integrity": "sha512-ARe0v/t9gO28Bznv6GgqARmVqcWOV3mfgUPn9becPHMiD3o9BwlRgaeccZnwTpZ7Zwqrm+c1sUSsMxIzQzc8Xg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/autoprefixer" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "browserslist": "^4.27.0", - "caniuse-lite": "^1.0.30001754", - "fraction.js": "^5.3.4", - "normalize-range": "^0.1.2", - "picocolors": "^1.1.1", - "postcss-value-parser": "^4.2.0" - }, - "bin": { - "autoprefixer": "bin/autoprefixer" - }, - "engines": { - "node": "^10 || ^12 || >=14" - }, - "peerDependencies": { - "postcss": "^8.1.0" - } - }, - "node_modules/axios": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz", - "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.4", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/bail": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", - "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/baseline-browser-mapping": { - "version": "2.8.32", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.32.tgz", - "integrity": "sha512-OPz5aBThlyLFgxyhdwf/s2+8ab3OvT7AdTNvKHBwpXomIYeXqpUUuT8LrdtxZSsWJ4R4CU1un4XGh5Ez3nlTpw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.js" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/browserslist": { - "version": "4.28.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.0.tgz", - "integrity": "sha512-tbydkR/CxfMwelN0vwdP/pLkDwyAASZ+VfWm4EOwlB6SWhx1sYnWLqo8N5j0rAzPfzfRaxt0mM/4wPU/Su84RQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "peer": true, - "dependencies": { - "baseline-browser-mapping": "^2.8.25", - "caniuse-lite": "^1.0.30001754", - "electron-to-chromium": "^1.5.249", - "node-releases": "^2.0.27", - "update-browserslist-db": "^1.1.4" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001757", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001757.tgz", - "integrity": "sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/ccount": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", - "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/change-case": { - "version": "5.4.4", - "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", - "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", - "dev": true, - "license": "MIT" - }, - "node_modules/character-entities": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", - "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities-html4": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", - "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-entities-legacy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", - "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/character-reference-invalid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", - "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/class-variance-authority": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz", - "integrity": "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==", - "license": "Apache-2.0", - "dependencies": { - "clsx": "^2.1.1" - }, - "funding": { - "url": "https://polar.sh/cva" - } - }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/cmdk": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/cmdk/-/cmdk-1.1.1.tgz", - "integrity": "sha512-Vsv7kFaXm+ptHDMZ7izaRsP70GgrW9NBNGswt9OZaVBLlE0SNpDq8eu/VGXyF9r7M0azK3Wy7OlYXsuyYLFzHg==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "^1.1.1", - "@radix-ui/react-dialog": "^1.1.6", - "@radix-ui/react-id": "^1.1.0", - "@radix-ui/react-primitive": "^2.0.2" - }, - "peerDependencies": { - "react": "^18 || ^19 || ^19.0.0-rc", - "react-dom": "^18 || ^19 || ^19.0.0-rc" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", - "dev": true, - "license": "MIT" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/comma-separated-tokens": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", - "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/cookie": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", - "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "license": "MIT" - }, - "node_modules/date-fns": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", - "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/kossnocorp" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decode-named-character-reference": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz", - "integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==", - "license": "MIT", - "dependencies": { - "character-entities": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/dequal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", - "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/detect-libc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", - "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "license": "Apache-2.0", - "engines": { - "node": ">=8" - } - }, - "node_modules/detect-node-es": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", - "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==", - "license": "MIT" - }, - "node_modules/devlop": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", - "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", - "license": "MIT", - "dependencies": { - "dequal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/diff": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.2.tgz", - "integrity": "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/dompurify": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.7.tgz", - "integrity": "sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==", - "license": "(MPL-2.0 OR Apache-2.0)", - "optionalDependencies": { - "@types/trusted-types": "^2.0.7" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.5.262", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.262.tgz", - "integrity": "sha512-NlAsMteRHek05jRUxUR0a5jpjYq9ykk6+kO0yRaMi5moe7u0fVIOeQ3Y30A8dIiWFBNUoQGi1ljb1i5VtS9WQQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/enhanced-resolve": { - "version": "5.18.3", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz", - "integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==", - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/entities": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", - "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-set-tostringtag": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", - "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "9.39.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", - "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.8.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.1", - "@eslint/config-helpers": "^0.4.2", - "@eslint/core": "^0.17.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.39.1", - "@eslint/plugin-kit": "^0.4.1", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.2", - "@types/estree": "^1.0.6", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.4.0", - "eslint-visitor-keys": "^4.2.1", - "espree": "^10.4.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-react-hooks": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz", - "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" - } - }, - "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.24.tgz", - "integrity": "sha512-nLHIW7TEq3aLrEYWpVaJ1dRgFR+wLDPN8e8FpYAql/bMV2oBEfC37K0gLEGgv9fy66juNShSMV8OkTqzltcG/w==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "eslint": ">=8.40" - } - }, - "node_modules/eslint-scope": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", - "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", - "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.15.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estree-util-is-identifier-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", - "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "license": "MIT" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", - "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", - "dev": true, - "license": "ISC" - }, - "node_modules/follow-redirects": { - "version": "1.15.11", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", - "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/form-data": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", - "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "es-set-tostringtag": "^2.1.0", - "hasown": "^2.0.2", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/fraction.js": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", - "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/rawify" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-nonce": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz", - "integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/globals": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", - "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "license": "ISC" - }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "license": "MIT", - "dependencies": { - "has-symbols": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/hast-util-from-parse5": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.3.tgz", - "integrity": "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "devlop": "^1.0.0", - "hastscript": "^9.0.0", - "property-information": "^7.0.0", - "vfile": "^6.0.0", - "vfile-location": "^5.0.0", - "web-namespaces": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-is-element": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", - "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-parse-selector": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", - "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-raw": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.1.0.tgz", - "integrity": "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "@ungap/structured-clone": "^1.0.0", - "hast-util-from-parse5": "^8.0.0", - "hast-util-to-parse5": "^8.0.0", - "html-void-elements": "^3.0.0", - "mdast-util-to-hast": "^13.0.0", - "parse5": "^7.0.0", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0", - "web-namespaces": "^2.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-jsx-runtime": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", - "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "comma-separated-tokens": "^2.0.0", - "devlop": "^1.0.0", - "estree-util-is-identifier-name": "^3.0.0", - "hast-util-whitespace": "^3.0.0", - "mdast-util-mdx-expression": "^2.0.0", - "mdast-util-mdx-jsx": "^3.0.0", - "mdast-util-mdxjs-esm": "^2.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "style-to-js": "^1.0.0", - "unist-util-position": "^5.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-parse5": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.0.tgz", - "integrity": "sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "comma-separated-tokens": "^2.0.0", - "devlop": "^1.0.0", - "property-information": "^6.0.0", - "space-separated-tokens": "^2.0.0", - "web-namespaces": "^2.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-to-parse5/node_modules/property-information": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", - "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/hast-util-to-text": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz", - "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "hast-util-is-element": "^3.0.0", - "unist-util-find-after": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hast-util-whitespace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", - "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/hastscript": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz", - "integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "comma-separated-tokens": "^2.0.0", - "hast-util-parse-selector": "^4.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/highlight.js": { - "version": "11.11.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.11.1.tgz", - "integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/html-url-attributes": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", - "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/html-void-elements": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", - "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/https-proxy-agent": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", - "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", - "dev": true, - "license": "MIT", - "dependencies": { - "agent-base": "^7.1.2", - "debug": "4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/index-to-position": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", - "integrity": "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/inline-style-parser": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", - "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", - "license": "MIT" - }, - "node_modules/is-alphabetical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", - "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-alphanumerical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", - "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", - "license": "MIT", - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-decimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", - "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-hexadecimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", - "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-plain-obj": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", - "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/jiti": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", - "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", - "license": "MIT", - "bin": { - "jiti": "lib/jiti-cli.mjs" - } - }, - "node_modules/js-levenshtein": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", - "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lightningcss": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.2.tgz", - "integrity": "sha512-utfs7Pr5uJyyvDETitgsaqSyjCb2qNRAtuqUeWIAKztsOYdcACf2KtARYXg2pSvhkt+9NfoaNY7fxjl6nuMjIQ==", - "license": "MPL-2.0", - "dependencies": { - "detect-libc": "^2.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-android-arm64": "1.30.2", - "lightningcss-darwin-arm64": "1.30.2", - "lightningcss-darwin-x64": "1.30.2", - "lightningcss-freebsd-x64": "1.30.2", - "lightningcss-linux-arm-gnueabihf": "1.30.2", - "lightningcss-linux-arm64-gnu": "1.30.2", - "lightningcss-linux-arm64-musl": "1.30.2", - "lightningcss-linux-x64-gnu": "1.30.2", - "lightningcss-linux-x64-musl": "1.30.2", - "lightningcss-win32-arm64-msvc": "1.30.2", - "lightningcss-win32-x64-msvc": "1.30.2" - } - }, - "node_modules/lightningcss-android-arm64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.30.2.tgz", - "integrity": "sha512-BH9sEdOCahSgmkVhBLeU7Hc9DWeZ1Eb6wNS6Da8igvUwAe0sqROHddIlvU06q3WyXVEOYDZ6ykBZQnjTbmo4+A==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.2.tgz", - "integrity": "sha512-ylTcDJBN3Hp21TdhRT5zBOIi73P6/W0qwvlFEk22fkdXchtNTOU4Qc37SkzV+EKYxLouZ6M4LG9NfZ1qkhhBWA==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.2.tgz", - "integrity": "sha512-oBZgKchomuDYxr7ilwLcyms6BCyLn0z8J0+ZZmfpjwg9fRVZIR5/GMXd7r9RH94iDhld3UmSjBM6nXWM2TfZTQ==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.2.tgz", - "integrity": "sha512-c2bH6xTrf4BDpK8MoGG4Bd6zAMZDAXS569UxCAGcA7IKbHNMlhGQ89eRmvpIUGfKWNVdbhSbkQaWhEoMGmGslA==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.2.tgz", - "integrity": "sha512-eVdpxh4wYcm0PofJIZVuYuLiqBIakQ9uFZmipf6LF/HRj5Bgm0eb3qL/mr1smyXIS1twwOxNWndd8z0E374hiA==", - "cpu": [ - "arm" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.2.tgz", - "integrity": "sha512-UK65WJAbwIJbiBFXpxrbTNArtfuznvxAJw4Q2ZGlU8kPeDIWEX1dg3rn2veBVUylA2Ezg89ktszWbaQnxD/e3A==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.2.tgz", - "integrity": "sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.2.tgz", - "integrity": "sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.2.tgz", - "integrity": "sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.2.tgz", - "integrity": "sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==", - "cpu": [ - "arm64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.30.2", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.2.tgz", - "integrity": "sha512-5g1yc73p+iAkid5phb4oVFMB45417DkRevRbt/El/gKXJk4jid+vPFF/AXbxn05Aky8PapwzZrdJShv5C0avjw==", - "cpu": [ - "x64" - ], - "license": "MPL-2.0", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/longest-streak": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", - "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/lowlight": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-3.3.0.tgz", - "integrity": "sha512-0JNhgFoPvP6U6lE/UdVsSq99tn6DhjjpAj5MxG49ewd2mOBVtwWYIT8ClyABhq198aXXODMU6Ox8DrGy/CpTZQ==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "devlop": "^1.0.0", - "highlight.js": "~11.11.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/lucide-react": { - "version": "0.546.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.546.0.tgz", - "integrity": "sha512-Z94u6fKT43lKeYHiVyvyR8fT7pwCzDu7RyMPpTvh054+xahSgj4HFQ+NmflvzdXsoAjYGdCguGaFKYuvq0ThCQ==", - "license": "ISC", - "peerDependencies": { - "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, - "node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/markdown-table": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", - "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/marked": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-14.0.0.tgz", - "integrity": "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==", - "license": "MIT", - "bin": { - "marked": "bin/marked.js" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/mdast-util-find-and-replace": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", - "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "escape-string-regexp": "^5.0.0", - "unist-util-is": "^6.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mdast-util-from-markdown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", - "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "decode-named-character-reference": "^1.0.0", - "devlop": "^1.0.0", - "mdast-util-to-string": "^4.0.0", - "micromark": "^4.0.0", - "micromark-util-decode-numeric-character-reference": "^2.0.0", - "micromark-util-decode-string": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unist-util-stringify-position": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", - "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", - "license": "MIT", - "dependencies": { - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-gfm-autolink-literal": "^2.0.0", - "mdast-util-gfm-footnote": "^2.0.0", - "mdast-util-gfm-strikethrough": "^2.0.0", - "mdast-util-gfm-table": "^2.0.0", - "mdast-util-gfm-task-list-item": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-autolink-literal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", - "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "ccount": "^2.0.0", - "devlop": "^1.0.0", - "mdast-util-find-and-replace": "^3.0.0", - "micromark-util-character": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-footnote": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", - "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "devlop": "^1.1.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-strikethrough": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", - "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-table": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", - "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "markdown-table": "^3.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-gfm-task-list-item": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", - "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-mdx-expression": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", - "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-mdx-jsx": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", - "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "ccount": "^2.0.0", - "devlop": "^1.1.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0", - "parse-entities": "^4.0.0", - "stringify-entities": "^4.0.0", - "unist-util-stringify-position": "^4.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-mdxjs-esm": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", - "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", - "license": "MIT", - "dependencies": { - "@types/estree-jsx": "^1.0.0", - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-phrasing": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", - "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-hast": { - "version": "13.2.1", - "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", - "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "@ungap/structured-clone": "^1.0.0", - "devlop": "^1.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "trim-lines": "^3.0.0", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-markdown": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", - "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "@types/unist": "^3.0.0", - "longest-streak": "^3.0.0", - "mdast-util-phrasing": "^4.0.0", - "mdast-util-to-string": "^4.0.0", - "micromark-util-classify-character": "^2.0.0", - "micromark-util-decode-string": "^2.0.0", - "unist-util-visit": "^5.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/mdast-util-to-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", - "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", - "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/debug": "^4.0.0", - "debug": "^4.0.0", - "decode-named-character-reference": "^1.0.0", - "devlop": "^1.0.0", - "micromark-core-commonmark": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-combine-extensions": "^2.0.0", - "micromark-util-decode-numeric-character-reference": "^2.0.0", - "micromark-util-encode": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-resolve-all": "^2.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "micromark-util-subtokenize": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-core-commonmark": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", - "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "devlop": "^1.0.0", - "micromark-factory-destination": "^2.0.0", - "micromark-factory-label": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-factory-title": "^2.0.0", - "micromark-factory-whitespace": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-classify-character": "^2.0.0", - "micromark-util-html-tag-name": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-resolve-all": "^2.0.0", - "micromark-util-subtokenize": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-extension-gfm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", - "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", - "license": "MIT", - "dependencies": { - "micromark-extension-gfm-autolink-literal": "^2.0.0", - "micromark-extension-gfm-footnote": "^2.0.0", - "micromark-extension-gfm-strikethrough": "^2.0.0", - "micromark-extension-gfm-table": "^2.0.0", - "micromark-extension-gfm-tagfilter": "^2.0.0", - "micromark-extension-gfm-task-list-item": "^2.0.0", - "micromark-util-combine-extensions": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-autolink-literal": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", - "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-footnote": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", - "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-core-commonmark": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-normalize-identifier": "^2.0.0", - "micromark-util-sanitize-uri": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-strikethrough": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", - "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-classify-character": "^2.0.0", - "micromark-util-resolve-all": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-table": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", - "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-tagfilter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", - "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", - "license": "MIT", - "dependencies": { - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-gfm-task-list-item": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", - "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-factory-destination": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", - "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-label": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", - "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-space": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", - "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-title": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", - "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-factory-whitespace": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", - "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-character": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", - "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-chunked": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", - "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-classify-character": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", - "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-combine-extensions": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", - "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-chunked": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-decode-numeric-character-reference": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", - "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-decode-string": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", - "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "decode-named-character-reference": "^1.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-decode-numeric-character-reference": "^2.0.0", - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-encode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", - "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-html-tag-name": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", - "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-normalize-identifier": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", - "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-resolve-all": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", - "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-sanitize-uri": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", - "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "micromark-util-character": "^2.0.0", - "micromark-util-encode": "^2.0.0", - "micromark-util-symbol": "^2.0.0" - } - }, - "node_modules/micromark-util-subtokenize": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", - "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "devlop": "^1.0.0", - "micromark-util-chunked": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-util-symbol": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", - "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/micromark-util-types": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", - "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT" - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/monaco-editor": { - "version": "0.55.1", - "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.55.1.tgz", - "integrity": "sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A==", - "license": "MIT", - "peer": true, - "dependencies": { - "dompurify": "3.2.7", - "marked": "14.0.0" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/normalize-range": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", - "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/openapi-typescript": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-7.10.1.tgz", - "integrity": "sha512-rBcU8bjKGGZQT4K2ekSTY2Q5veOQbVG/lTKZ49DeCyT9z62hM2Vj/LLHjDHC9W7LJG8YMHcdXpRZDqC1ojB/lw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@redocly/openapi-core": "^1.34.5", - "ansi-colors": "^4.1.3", - "change-case": "^5.4.4", - "parse-json": "^8.3.0", - "supports-color": "^10.2.2", - "yargs-parser": "^21.1.1" - }, - "bin": { - "openapi-typescript": "bin/cli.js" - }, - "peerDependencies": { - "typescript": "^5.x" - } - }, - "node_modules/openapi-typescript/node_modules/supports-color": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", - "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "dev": true, - "license": "MIT", - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-entities": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", - "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", - "license": "MIT", - "dependencies": { - "@types/unist": "^2.0.0", - "character-entities-legacy": "^3.0.0", - "character-reference-invalid": "^2.0.0", - "decode-named-character-reference": "^1.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0", - "is-hexadecimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/parse-entities/node_modules/@types/unist": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", - "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", - "license": "MIT" - }, - "node_modules/parse-json": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", - "integrity": "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.26.2", - "index-to-position": "^1.1.0", - "type-fest": "^4.39.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/parse5": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", - "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", - "license": "MIT", - "dependencies": { - "entities": "^6.0.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "peer": true, - "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "license": "MIT" - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/react": { - "version": "19.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz", - "integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "19.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.0.tgz", - "integrity": "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "scheduler": "^0.27.0" - }, - "peerDependencies": { - "react": "^19.2.0" - } - }, - "node_modules/react-hook-form": { - "version": "7.67.0", - "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.67.0.tgz", - "integrity": "sha512-E55EOwKJHHIT/I6J9DmQbCWToAYSw9nN5R57MZw9rMtjh+YQreMDxRLfdjfxQbiJ3/qbg3Z02wGzBX4M+5fMtQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/react-hook-form" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17 || ^18 || ^19" - } - }, - "node_modules/react-markdown": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz", - "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "devlop": "^1.0.0", - "hast-util-to-jsx-runtime": "^2.0.0", - "html-url-attributes": "^3.0.0", - "mdast-util-to-hast": "^13.0.0", - "remark-parse": "^11.0.0", - "remark-rehype": "^11.0.0", - "unified": "^11.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - }, - "peerDependencies": { - "@types/react": ">=18", - "react": ">=18" - } - }, - "node_modules/react-refresh": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", - "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-remove-scroll": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.7.2.tgz", - "integrity": "sha512-Iqb9NjCCTt6Hf+vOdNIZGdTiH1QSqr27H/Ek9sv/a97gfueI/5h1s3yRi1nngzMUaOOToin5dI1dXKdXiF+u0Q==", - "license": "MIT", - "dependencies": { - "react-remove-scroll-bar": "^2.3.7", - "react-style-singleton": "^2.2.3", - "tslib": "^2.1.0", - "use-callback-ref": "^1.3.3", - "use-sidecar": "^1.1.3" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/react-remove-scroll-bar": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.8.tgz", - "integrity": "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==", - "license": "MIT", - "dependencies": { - "react-style-singleton": "^2.2.2", - "tslib": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/react-router": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.9.6.tgz", - "integrity": "sha512-Y1tUp8clYRXpfPITyuifmSoE2vncSME18uVLgaqyxh9H35JWpIfzHo+9y3Fzh5odk/jxPW29IgLgzcdwxGqyNA==", - "license": "MIT", - "dependencies": { - "cookie": "^1.0.1", - "set-cookie-parser": "^2.6.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/react-router-dom": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.9.6.tgz", - "integrity": "sha512-2MkC2XSXq6HjGcihnx1s0DBWQETI4mlis4Ux7YTLvP67xnGxCvq+BcCQSO81qQHVUTM1V53tl4iVVaY5sReCOA==", - "license": "MIT", - "dependencies": { - "react-router": "7.9.6" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - } - }, - "node_modules/react-style-singleton": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.3.tgz", - "integrity": "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==", - "license": "MIT", - "dependencies": { - "get-nonce": "^1.0.0", - "tslib": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/rehype-highlight": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/rehype-highlight/-/rehype-highlight-7.0.2.tgz", - "integrity": "sha512-k158pK7wdC2qL3M5NcZROZ2tR/l7zOzjxXd5VGdcfIyoijjQqpHd3JKtYSBDpDZ38UI2WJWuFAtkMDxmx5kstA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-to-text": "^4.0.0", - "lowlight": "^3.0.0", - "unist-util-visit": "^5.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/rehype-raw": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", - "integrity": "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "hast-util-raw": "^9.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-gfm": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", - "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-gfm": "^3.0.0", - "micromark-extension-gfm": "^3.0.0", - "remark-parse": "^11.0.0", - "remark-stringify": "^11.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-parse": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", - "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-from-markdown": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-rehype": { - "version": "11.1.2", - "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", - "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/mdast": "^4.0.0", - "mdast-util-to-hast": "^13.0.0", - "unified": "^11.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/remark-stringify": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", - "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", - "license": "MIT", - "dependencies": { - "@types/mdast": "^4.0.0", - "mdast-util-to-markdown": "^2.0.0", - "unified": "^11.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/rollup": { - "version": "4.53.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.3.tgz", - "integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==", - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.53.3", - "@rollup/rollup-android-arm64": "4.53.3", - "@rollup/rollup-darwin-arm64": "4.53.3", - "@rollup/rollup-darwin-x64": "4.53.3", - "@rollup/rollup-freebsd-arm64": "4.53.3", - "@rollup/rollup-freebsd-x64": "4.53.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", - "@rollup/rollup-linux-arm-musleabihf": "4.53.3", - "@rollup/rollup-linux-arm64-gnu": "4.53.3", - "@rollup/rollup-linux-arm64-musl": "4.53.3", - "@rollup/rollup-linux-loong64-gnu": "4.53.3", - "@rollup/rollup-linux-ppc64-gnu": "4.53.3", - "@rollup/rollup-linux-riscv64-gnu": "4.53.3", - "@rollup/rollup-linux-riscv64-musl": "4.53.3", - "@rollup/rollup-linux-s390x-gnu": "4.53.3", - "@rollup/rollup-linux-x64-gnu": "4.53.3", - "@rollup/rollup-linux-x64-musl": "4.53.3", - "@rollup/rollup-openharmony-arm64": "4.53.3", - "@rollup/rollup-win32-arm64-msvc": "4.53.3", - "@rollup/rollup-win32-ia32-msvc": "4.53.3", - "@rollup/rollup-win32-x64-gnu": "4.53.3", - "@rollup/rollup-win32-x64-msvc": "4.53.3", - "fsevents": "~2.3.2" - } - }, - "node_modules/scheduler": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/set-cookie-parser": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", - "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", - "license": "MIT" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/sonner": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz", - "integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==", - "license": "MIT", - "peerDependencies": { - "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", - "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/space-separated-tokens": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", - "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/state-local": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz", - "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==", - "license": "MIT" - }, - "node_modules/stringify-entities": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", - "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", - "license": "MIT", - "dependencies": { - "character-entities-html4": "^2.0.0", - "character-entities-legacy": "^3.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/strip-json-comments": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.3.tgz", - "integrity": "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==", - "license": "MIT", - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/style-to-js": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", - "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", - "license": "MIT", - "dependencies": { - "style-to-object": "1.0.14" - } - }, - "node_modules/style-to-object": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", - "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", - "license": "MIT", - "dependencies": { - "inline-style-parser": "0.2.7" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tailwind-merge": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.4.0.tgz", - "integrity": "sha512-uSaO4gnW+b3Y2aWoWfFpX62vn2sR3skfhbjsEnaBI81WD1wBLlHZe5sWf0AqjksNdYTbGBEd0UasQMT3SNV15g==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/dcastil" - } - }, - "node_modules/tailwindcss": { - "version": "4.1.17", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.17.tgz", - "integrity": "sha512-j9Ee2YjuQqYT9bbRTfTZht9W/ytp5H+jJpZKiYdP/bpnXARAuELt9ofP0lPnmHjbga7SNQIxdTAXCmtKVYjN+Q==", - "license": "MIT" - }, - "node_modules/tapable": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", - "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", - "license": "MIT", - "engines": { - "node": ">=6" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.3" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/trim-lines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", - "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/trough": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", - "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/ts-api-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", - "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/typescript-eslint": { - "version": "8.48.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.48.0.tgz", - "integrity": "sha512-fcKOvQD9GUn3Xw63EgiDqhvWJ5jsyZUaekl3KVpGsDJnN46WJTe3jWxtQP9lMZm1LJNkFLlTaWAxK2vUQR+cqw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/eslint-plugin": "8.48.0", - "@typescript-eslint/parser": "8.48.0", - "@typescript-eslint/typescript-estree": "8.48.0", - "@typescript-eslint/utils": "8.48.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", - "devOptional": true, - "license": "MIT" - }, - "node_modules/unified": { - "version": "11.0.5", - "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", - "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "bail": "^2.0.0", - "devlop": "^1.0.0", - "extend": "^3.0.0", - "is-plain-obj": "^4.0.0", - "trough": "^2.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-find-after": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", - "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-is": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", - "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-position": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", - "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-stringify-position": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", - "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", - "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0", - "unist-util-visit-parents": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/unist-util-visit-parents": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", - "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-is": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.4.tgz", - "integrity": "sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/use-callback-ref": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", - "integrity": "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg==", - "license": "MIT", - "dependencies": { - "tslib": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/use-sidecar": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.3.tgz", - "integrity": "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ==", - "license": "MIT", - "dependencies": { - "detect-node-es": "^1.1.0", - "tslib": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/vfile": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", - "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-location": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz", - "integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "vfile": "^6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vfile-message": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", - "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", - "license": "MIT", - "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-stringify-position": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/vite": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.4.tgz", - "integrity": "sha512-NL8jTlbo0Tn4dUEXEsUg8KeyG/Lkmc4Fnzb8JXN/Ykm9G4HNImjtABMJgkQoVjOBN/j2WAwDTRytdqJbZsah7w==", - "license": "MIT", - "peer": true, - "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.5.0", - "picomatch": "^4.0.3", - "postcss": "^8.5.6", - "rollup": "^4.43.0", - "tinyglobby": "^0.2.15" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "lightningcss": "^1.21.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/web-namespaces": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", - "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, - "node_modules/yaml-ast-parser": { - "version": "0.0.43", - "resolved": "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz", - "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/zod": { - "version": "4.1.13", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.13.tgz", - "integrity": "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, - "node_modules/zustand": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.9.tgz", - "integrity": "sha512-ALBtUj0AfjJt3uNRQoL1tL2tMvj6Gp/6e39dnfT6uzpelGru8v1tPOGBzayOWbPJvujM8JojDk3E1LxeFisBNg==", - "license": "MIT", - "engines": { - "node": ">=12.20.0" - }, - "peerDependencies": { - "@types/react": ">=18.0.0", - "immer": ">=9.0.6", - "react": ">=18.0.0", - "use-sync-external-store": ">=1.2.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "immer": { - "optional": true - }, - "react": { - "optional": true - }, - "use-sync-external-store": { - "optional": true - } - } - }, - "node_modules/zwitch": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", - "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - } - } -} diff --git a/frontend/src/api/mcp.ts b/frontend/src/api/mcp.ts index 54501e18..cee66fd4 100644 --- a/frontend/src/api/mcp.ts +++ b/frontend/src/api/mcp.ts @@ -1,58 +1,41 @@ import { API_BASE_URL } from '@/config' import { fetchWrapper } from './fetchWrapper' -import { openCodeApi, toFetchError } from './opencodeApi' -import { isMcpServerNotFoundError } from '@opencode-manager/shared/opencode' +import { callOpenCode } from './opencodeApi' import { + isMcpServerNotFoundError, mcpStatusByName, - toV2McpServerConfig, + openCodeLocation, type McpServerConfig, type McpStatusMap, } from '@opencode-manager/shared/opencode' -export type { McpServerConfig, McpStatus, McpStatusMap } from '@opencode-manager/shared/opencode' +export type { McpServerConfig, McpStatus } from '@opencode-manager/shared/opencode' export interface McpAuthStartResponse { authorizationUrl: string flowId: string } -export type McpOAuthFlowStatus = +type McpOAuthFlowStatus = | { status: 'pending' } | { status: 'completed'; serverName: string } | { status: 'failed'; error: string } | { status: 'unknown' } -function locationInput(directory?: string) { - return directory ? { location: { directory } } : undefined -} - -async function requestV2(operation: () => Promise): Promise { - try { - return await operation() - } catch (error) { - throw toFetchError(error) - } -} - export const mcpApi = { async getStatus(directory?: string): Promise { - const { data } = await requestV2(() => openCodeApi.mcp.list(locationInput(directory))) + const { data } = await callOpenCode((api) => api.mcp.list(openCodeLocation(directory))) return mcpStatusByName(data) }, async addServer(name: string, config: McpServerConfig): Promise { - await requestV2(() => - openCodeApi.mcp.add({ - server: name, - config: toV2McpServerConfig(config, window.location.origin), - }), - ) + await callOpenCode((api) => api.mcp.add({ server: name, config })) }, async removeServer(name: string): Promise { - await requestV2(async () => { + await callOpenCode(async (api) => { try { - await openCodeApi.mcp.remove({ server: name }) + await api.mcp.remove({ server: name }) } catch (error) { if (!isMcpServerNotFoundError(error)) throw error } @@ -60,21 +43,11 @@ export const mcpApi = { }, async connect(name: string, directory?: string): Promise { - await requestV2(() => - openCodeApi.mcp.connect({ - server: name, - ...(directory ? { location: { directory } } : {}), - }), - ) + await callOpenCode((api) => api.mcp.connect({ server: name, ...openCodeLocation(directory) })) }, async disconnect(name: string, directory?: string): Promise { - await requestV2(() => - openCodeApi.mcp.disconnect({ - server: name, - ...(directory ? { location: { directory } } : {}), - }), - ) + await callOpenCode((api) => api.mcp.disconnect({ server: name, ...openCodeLocation(directory) })) }, async startAuth(name: string, directory?: string): Promise { diff --git a/frontend/src/api/oauth.ts b/frontend/src/api/oauth.ts index 0756bc21..5546b79b 100644 --- a/frontend/src/api/oauth.ts +++ b/frontend/src/api/oauth.ts @@ -1,25 +1,23 @@ import { API_BASE_URL } from "@/config" -import type { - OAuthAttemptStatus, - OAuthAuthorizeResponse, - PromptAnswer, - ProviderAuthMethods, -} from "@opencode-manager/shared/schemas" +import type { FormAnswer, IntegrationMethod } from "@opencode-manager/shared/opencode" +import type { OAuthAttemptStatus, OAuthAuthorizeResponse } from "@opencode-manager/shared/schemas" import { fetchWrapper, fetchWrapperVoid } from "./fetchWrapper" export type { - OAuthAttemptStatus, - OAuthAuthorizeResponse, - PromptAnswer, - PromptAnswerValue, - PromptCondition, - PromptField, - ProviderAuthMethod, - ProviderAuthMethods, -} from "@opencode-manager/shared/schemas" + FormAnswer, + FormField, + FormValue, + IntegrationKeyMethod, + IntegrationMethod, + IntegrationOAuthMethod, +} from "@opencode-manager/shared/opencode" + +export type { OAuthAuthorizeResponse } from "@opencode-manager/shared/schemas" + +type ProviderAuthMethods = Record export const oauthApi = { - authorize: async (providerId: string, methodID: string, answer?: PromptAnswer): Promise => + authorize: async (providerId: string, methodID: string, answer?: FormAnswer): Promise => fetchWrapper(`${API_BASE_URL}/api/oauth/${providerId}/oauth/authorize`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, diff --git a/frontend/src/api/opencode.ts b/frontend/src/api/opencode.ts index b1062e07..c8b89ef8 100644 --- a/frontend/src/api/opencode.ts +++ b/frontend/src/api/opencode.ts @@ -1,9 +1,12 @@ -import { openCodeApi, toFetchError } from './opencodeApi' +import { openCodeLocation } from '@opencode-manager/shared/opencode' +import { callOpenCode } from './opencodeApi' import type { + AgentInfo, CommandInfo, FormAnswer, FormInfo, ModelRef, + OpenCodeApi, PermissionRequest, PromptMention, SessionInboxCompaction, @@ -31,6 +34,8 @@ export interface PromptSkillInput { mention?: PromptMention } +export type ActiveSessions = Awaited> + export interface SessionPage { items: SessionInfo[] nextCursor?: string @@ -94,104 +99,76 @@ export function parseModelRef(model: string): ModelRef | undefined { } export async function listSessionPage(input: SessionPageInput): Promise { - try { - const { data, cursor } = await openCodeApi.session.list({ + const { data, cursor } = await callOpenCode((api) => + api.session.list({ directory: input.directory, parentID: 'null', limit: input.limit, order: input.order, search: input.search, cursor: input.cursor, - }) - return { items: data, nextCursor: cursor.next ?? undefined } - } catch (error) { - throw toFetchError(error) - } + }), + ) + return { items: data, nextCursor: cursor.next ?? undefined } } export async function getSession(sessionID: string): Promise { - try { - return await openCodeApi.session.get({ sessionID }) - } catch (error) { - throw toFetchError(error) - } + return callOpenCode((api) => api.session.get({ sessionID })) } export async function createSession(input: CreateSessionInput): Promise { const model = input.model ? parseModelRef(input.model) : undefined - try { - return await openCodeApi.session.create({ + return callOpenCode((api) => + api.session.create({ ...(input.title !== undefined ? { title: input.title } : {}), ...(input.agent !== undefined ? { agent: input.agent } : {}), ...(model ? { model } : {}), - ...(input.directory ? { location: { directory: input.directory } } : {}), - }) - } catch (error) { - throw toFetchError(error) - } + ...openCodeLocation(input.directory), + }), + ) } export async function deleteSession(sessionID: string): Promise { - try { - await openCodeApi.session.remove({ sessionID }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.remove({ sessionID })) } export async function renameSession(sessionID: string, title: string): Promise { - try { - await openCodeApi.session.update({ sessionID, title }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.update({ sessionID, title })) } export async function forkSession(sessionID: string, before?: string): Promise { - try { - return await openCodeApi.session.fork({ + return callOpenCode((api) => + api.session.fork({ sessionID, ...(before ? { before } : {}), - }) - } catch (error) { - throw toFetchError(error) - } + }), + ) } export async function switchSessionModel(sessionID: string, model: ModelRef): Promise { - try { - await openCodeApi.session.switchModel({ sessionID, model }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.switchModel({ sessionID, model })) } export async function switchSessionAgent(sessionID: string, agent: string): Promise { - try { - await openCodeApi.session.switchAgent({ sessionID, agent }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.switchAgent({ sessionID, agent })) } export async function sendPrompt(input: SendPromptInput): Promise { - try { - return await openCodeApi.session.prompt({ + return callOpenCode((api) => + api.session.prompt({ sessionID: input.sessionID, text: input.text, ...(input.files ? { files: input.files } : {}), ...(input.agents ? { agents: input.agents } : {}), ...(input.skills ? { skills: input.skills } : {}), ...(input.delivery ? { delivery: input.delivery } : {}), - }) - } catch (error) { - throw toFetchError(error) - } + }), + ) } export async function runCommand(input: RunCommandInput): Promise { - try { - await openCodeApi.session.command({ + await callOpenCode((api) => + api.session.command({ sessionID: input.sessionID, name: input.name, text: input.text, @@ -199,86 +176,55 @@ export async function runCommand(input: RunCommandInput): Promise { ...(input.agents ? { agents: input.agents } : {}), ...(input.skills ? { skills: input.skills } : {}), ...(input.delivery ? { delivery: input.delivery } : {}), - }) - } catch (error) { - throw toFetchError(error) - } + }), + ) } export async function runShell(sessionID: string, command: string): Promise { - try { - await openCodeApi.session.shell({ sessionID, command }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.shell({ sessionID, command })) } export async function interruptSession(sessionID: string): Promise { - try { - await openCodeApi.session.interrupt({ sessionID }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.interrupt({ sessionID })) } export async function stageRevert(sessionID: string, messageID: string): Promise { - try { - return await openCodeApi.session.revert.stage({ sessionID, messageID }) - } catch (error) { - throw toFetchError(error) - } + return callOpenCode((api) => api.session.revert.stage({ sessionID, messageID })) } export async function commitRevert(sessionID: string): Promise { - try { - await openCodeApi.session.revert.commit({ sessionID }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.revert.commit({ sessionID })) } export async function clearRevert(sessionID: string): Promise { - try { - await openCodeApi.session.revert.clear({ sessionID }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.revert.clear({ sessionID })) } export async function compactSession(sessionID: string): Promise { - try { - return await openCodeApi.session.compact({ sessionID }) - } catch (error) { - throw toFetchError(error) - } + return callOpenCode((api) => api.session.compact({ sessionID })) } export async function activateSkill(sessionID: string, id: string): Promise { - try { - await openCodeApi.session.skill({ sessionID, id }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.skill({ sessionID, id })) +} + +export async function listActiveSessions(): Promise { + return callOpenCode((api) => api.session.active()) +} + +export async function listAgents(directory?: string): Promise { + const { data } = await callOpenCode((api) => api.agent.list(openCodeLocation(directory))) + return data } export async function listCommands(directory?: string): Promise { - try { - const { data } = await openCodeApi.command.list( - directory ? { location: { directory } } : undefined, - ) - return data - } catch (error) { - throw toFetchError(error) - } + const { data } = await callOpenCode((api) => api.command.list(openCodeLocation(directory))) + return data } export async function listPendingPermissions(directory: string): Promise { - try { - const { data } = await openCodeApi.permission.request.list({ location: { directory } }) - return data - } catch (error) { - throw toFetchError(error) - } + const { data } = await callOpenCode((api) => api.permission.request.list(openCodeLocation(directory))) + return data } export async function replyPermission( @@ -287,87 +233,65 @@ export async function replyPermission( decision: 'once' | 'always' | 'reject', message?: string, ): Promise { - try { - await openCodeApi.permission.reply({ + await callOpenCode((api) => + api.permission.reply({ sessionID, requestID, decision, ...(message ? { message } : {}), - }) - } catch (error) { - throw toFetchError(error) - } + }), + ) } export async function listPendingForms(directory: string): Promise { - try { - const { data } = await openCodeApi.form.list({ location: { directory } }) - return data - } catch (error) { - throw toFetchError(error) - } + const { data } = await callOpenCode((api) => api.form.list(openCodeLocation(directory))) + return data } export async function replyForm(sessionID: string, formID: string, answer: FormAnswer): Promise { - try { - await openCodeApi.session.form.reply({ sessionID, formID, answer }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.form.reply({ sessionID, formID, answer })) } export async function cancelForm(sessionID: string, formID: string): Promise { - try { - await openCodeApi.session.form.cancel({ sessionID, formID }) - } catch (error) { - throw toFetchError(error) - } + await callOpenCode((api) => api.session.form.cancel({ sessionID, formID })) } export async function findFiles(input: FindFilesInput): Promise { - try { - const { data } = await openCodeApi.file.find({ - ...(input.directory ? { location: { directory: input.directory } } : {}), + const { data } = await callOpenCode((api) => + api.file.find({ + ...openCodeLocation(input.directory), query: input.query, type: 'file', limit: input.limit, - }) - return data.map((entry) => entry.path) - } catch (error) { - throw toFetchError(error) - } + }), + ) + return data.map((entry) => entry.path) } export async function listSessionMessages( sessionID: string, input: SessionMessagesInput = {}, ): Promise { - try { - const { data, cursor } = await openCodeApi.message.list({ + const { data, cursor } = await callOpenCode((api) => + api.message.list({ sessionID, ...(input.limit === undefined ? {} : { limit: input.limit }), ...(input.cursor === undefined ? { order: 'desc' as const } : { cursor: input.cursor }), - }) - return { messages: [...data].reverse(), nextCursor: cursor.next ?? undefined } - } catch (error) { - throw toFetchError(error) - } + }), + ) + return { messages: [...data].reverse(), nextCursor: cursor.next ?? undefined } } export async function readSessionSnapshot(sessionID: string): Promise { - try { - const [page, pending, active] = await Promise.all([ - listSessionMessages(sessionID), - openCodeApi.session.inbox.list({ sessionID }), - openCodeApi.session.active(), - ]) - return { - messages: page.messages, - nextCursor: page.nextCursor, - pending, - status: active[sessionID] ? 'busy' : 'idle', - } - } catch (error) { - throw toFetchError(error) + const [page, pending, active] = await Promise.all([ + listSessionMessages(sessionID), + callOpenCode((api) => api.session.inbox.list({ sessionID })), + listActiveSessions(), + ]) + return { + messages: page.messages, + nextCursor: page.nextCursor, + pending, + status: active[sessionID] ? 'busy' : 'idle', } } diff --git a/frontend/src/api/opencodeApi.ts b/frontend/src/api/opencodeApi.ts index 731a30cd..e590c5f1 100644 --- a/frontend/src/api/opencodeApi.ts +++ b/frontend/src/api/opencodeApi.ts @@ -1,13 +1,13 @@ -import { ClientError, createOpenCodeApi, openCodeErrorStatus } from '@opencode-manager/shared/opencode' +import { ClientError, createOpenCodeApi, openCodeErrorStatus, type OpenCodeApi } from '@opencode-manager/shared/opencode' import { FetchError } from '@opencode-manager/shared' import { OPENCODE_API_ENDPOINT } from '@/config' -export const openCodeApi = createOpenCodeApi({ +const openCodeApi = createOpenCodeApi({ baseUrl: new URL(OPENCODE_API_ENDPOINT, window.location.origin).toString(), fetch: (input, init) => fetch(input, { ...init, credentials: 'include' }), }) -export function toFetchError(error: unknown): FetchError { +function toFetchError(error: unknown): FetchError { if (error instanceof FetchError) { return error } @@ -24,3 +24,11 @@ export function toFetchError(error: unknown): FetchError { return new FetchError('Request failed', status ?? 0) } + +export async function callOpenCode(operation: (api: OpenCodeApi) => Promise): Promise { + try { + return await operation(openCodeApi) + } catch (error) { + throw toFetchError(error) + } +} diff --git a/frontend/src/api/providers.test.ts b/frontend/src/api/providers.test.ts index a2919e85..85271f1e 100644 --- a/frontend/src/api/providers.test.ts +++ b/frontend/src/api/providers.test.ts @@ -1,14 +1,14 @@ import { describe, it, expect, vi, beforeEach } from 'vitest' -import { getProviders, getProvidersWithModels, providerCredentialsApi } from './providers' +import { getOpenCodeConfigModel, getProviders, getProvidersWithModels, providerCredentialsApi } from './providers' import { API_BASE_URL } from '@/config' import { makeOpenCodeConfigFile } from '@/test/fixtures/opencode-config' -const { mockGetOpenCodeConfig, mockFetchWrapper, mockProviderList, mockModelList, mockModelDefault } = vi.hoisted(() => ({ +const { mockGetOpenCodeConfig, mockFetchWrapper, mockProviderList, mockModelList, mockConfigGet } = vi.hoisted(() => ({ mockGetOpenCodeConfig: vi.fn(), mockFetchWrapper: vi.fn(), mockProviderList: vi.fn(), mockModelList: vi.fn(), - mockModelDefault: vi.fn(), + mockConfigGet: vi.fn(), })) vi.mock('./settings', () => ({ @@ -22,10 +22,12 @@ vi.mock('./fetchWrapper', () => ({ })) vi.mock('./opencodeApi', () => ({ - openCodeApi: { - provider: { list: mockProviderList }, - model: { list: mockModelList, default: mockModelDefault }, - }, + callOpenCode: (operation: (api: unknown) => Promise) => + operation({ + provider: { list: mockProviderList }, + model: { list: mockModelList }, + config: { get: mockConfigGet }, + }), })) const config = makeOpenCodeConfigFile({ @@ -63,10 +65,9 @@ describe('getProviders', () => { vi.clearAllMocks() mockProviderList.mockResolvedValue({ location: { directory: '/repo' }, data: [] }) mockModelList.mockResolvedValue({ location: { directory: '/repo' }, data: [] }) - mockModelDefault.mockResolvedValue({ location: { directory: '/repo' }, data: null }) }) - it('maps V2 providers, models, and the default into the UI shape', async () => { + it('maps V2 providers and models into the UI shape', async () => { mockProviderList.mockResolvedValue({ location: { directory: '/repo' }, data: [ @@ -104,27 +105,9 @@ describe('getProviders', () => { }, ], }) - mockModelDefault.mockResolvedValue({ - location: { directory: '/repo' }, - data: { - id: 'claude-sonnet-4', - modelID: 'claude-sonnet-4-20250514', - providerID: 'anthropic', - name: 'Claude Sonnet 4', - capabilities: { tools: true, input: ['text'], output: ['text'] }, - variants: [], - time: { released: 0 }, - cost: [], - status: 'active', - enabled: true, - limit: { context: 200000, output: 64000 }, - }, - }) - const result = await getProviders('/repo') expect(result.connected).toEqual(['anthropic']) - expect(result.default).toEqual({ anthropic: 'claude-sonnet-4' }) expect(result.providers).toHaveLength(1) expect(result.providers[0].models['claude-sonnet-4']).toMatchObject({ key: 'claude-sonnet-4', @@ -145,18 +128,60 @@ describe('getProviders', () => { await expect(getProviders('/repo')).resolves.toEqual({ providers: [], connected: [], - default: {}, + models: [], }) }) }) +describe('getOpenCodeConfigModel', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('reads a string config model for the directory', async () => { + mockConfigGet.mockResolvedValue([{ type: 'document', info: { model: 'anthropic/claude-sonnet-4' } }]) + + await expect(getOpenCodeConfigModel('/repo')).resolves.toBe('anthropic/claude-sonnet-4') + expect(mockConfigGet).toHaveBeenCalledWith({ location: { directory: '/repo' } }) + }) + + it('formats an object config model as provider/model', async () => { + mockConfigGet.mockResolvedValue([ + { type: 'document', info: { model: { providerID: 'openai', model: 'gpt-4o', variant: 'high' } } }, + ]) + + await expect(getOpenCodeConfigModel()).resolves.toBe('openai/gpt-4o') + expect(mockConfigGet).toHaveBeenCalledWith(undefined) + }) + + it('uses the last document that sets a model', async () => { + mockConfigGet.mockResolvedValue([ + { type: 'document', info: { model: 'anthropic/claude-sonnet-4' } }, + { type: 'document', info: { model: { providerID: 'openai', model: 'gpt-4o' } } }, + { type: 'document', info: {} }, + ]) + + await expect(getOpenCodeConfigModel('/repo')).resolves.toBe('openai/gpt-4o') + }) + + it('returns null when no document sets a model', async () => { + mockConfigGet.mockResolvedValue([{ type: 'document', info: {} }]) + + await expect(getOpenCodeConfigModel('/repo')).resolves.toBeNull() + }) + + it('returns null when the config read fails', async () => { + mockConfigGet.mockRejectedValue(new Error('upstream down')) + + await expect(getOpenCodeConfigModel('/repo')).resolves.toBeNull() + }) +}) + describe('getProvidersWithModels', () => { beforeEach(() => { vi.clearAllMocks() - mockFetchWrapper.mockResolvedValue({ all: [], connected: [], default: {} }) mockProviderList.mockResolvedValue({ location: { directory: '/repo' }, data: [] }) mockModelList.mockResolvedValue({ location: { directory: '/repo' }, data: [] }) - mockModelDefault.mockResolvedValue({ location: { directory: '/repo' }, data: null }) }) it('uses the supplied config instead of re-reading it', async () => { diff --git a/frontend/src/api/providers.ts b/frontend/src/api/providers.ts index 99f18cff..21f7aade 100644 --- a/frontend/src/api/providers.ts +++ b/frontend/src/api/providers.ts @@ -1,9 +1,9 @@ import { API_BASE_URL } from "@/config"; import { settingsApi } from "./settings"; import { fetchWrapper } from "./fetchWrapper"; -import { openCodeApi } from "./opencodeApi"; -import type { ModelInfo } from "@opencode-manager/shared/opencode"; -import type { CredentialListResponse, CredentialStatusResponse, PromptAnswer } from "@opencode-manager/shared/schemas"; +import { callOpenCode } from "./opencodeApi"; +import { openCodeLocation, type ConfigEntry, type FormAnswer, type ModelInfo } from "@opencode-manager/shared/opencode"; +import type { CredentialListResponse, CredentialStatusResponse } from "@opencode-manager/shared/schemas"; import type { OpenCodeConfigFile } from "./types/settings"; export type ProviderSource = "configured" | "local" | "builtin"; @@ -106,7 +106,7 @@ function classifyProviderSource(providerId: string, isFromConfig: boolean): Prov export interface ProvidersResult { providers: Provider[]; connected: string[]; - default: Record; + models: ModelInfo[]; } const MODEL_MODALITIES = ["text", "audio", "image", "video", "pdf"] as const; @@ -150,12 +150,10 @@ function mapModelInfo(model: ModelInfo): Model { export async function getProviders(directory?: string): Promise { try { - const location = directory ? { location: { directory } } : undefined; - const [providerResult, modelResult, defaultResult] = await Promise.all([ - openCodeApi.provider.list(location), - openCodeApi.model.list(location), - openCodeApi.model.default(location), - ]); + const location = openCodeLocation(directory); + const [providerResult, modelResult] = await callOpenCode((api) => + Promise.all([api.provider.list(location), api.model.list(location)]), + ); const connected = providerResult.data.map((provider) => provider.id); const connectedSet = new Set(connected); @@ -176,14 +174,28 @@ export async function getProviders(directory?: string): Promise }; }); - const defaultModel: Record = {}; - if (defaultResult.data) { - defaultModel[defaultResult.data.providerID] = defaultResult.data.id; - } - - return { providers, connected, default: defaultModel }; + return { providers, connected, models: modelResult.data }; } catch { - return { providers: [], connected: [], default: {} }; + return { providers: [], connected: [], models: [] }; + } +} + +type ConfigDocumentModel = Extract["info"]["model"]; + +function formatConfigModel(model: NonNullable): string { + return typeof model === "string" ? model : `${model.providerID}/${model.model}`; +} + +export async function getOpenCodeConfigModel(directory?: string): Promise { + try { + const entries = await callOpenCode((api) => api.config.get(openCodeLocation(directory))); + const model = entries.reduce( + (current, entry) => (entry.type === "document" && entry.info.model ? entry.info.model : current), + undefined, + ); + return model ? formatConfigModel(model) : null; + } catch { + return null; } } @@ -354,7 +366,7 @@ export const providerCredentialsApi = { return hasCredentials; }, - set: async (providerId: string, apiKey: string, answer?: PromptAnswer): Promise => { + set: async (providerId: string, apiKey: string, answer?: FormAnswer): Promise => { await fetchWrapper(`${API_BASE_URL}/api/providers/${providerId}/credentials`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, diff --git a/frontend/src/api/settings.ts b/frontend/src/api/settings.ts index c402e895..69db2348 100644 --- a/frontend/src/api/settings.ts +++ b/frontend/src/api/settings.ts @@ -13,9 +13,10 @@ import type { InstallSkillFromGithubRequest, InstallSkillResponse, OpenCodeDirectoryFileInfo, + OpenCodeRestartResponse, } from './types/settings' import { API_BASE_URL } from '@/config' -import { fetchWrapper, FetchError } from './fetchWrapper' +import { fetchWrapper } from './fetchWrapper' const DEFAULT_USER_ID = 'default' @@ -85,7 +86,7 @@ export const settingsApi = { }) }, - restartOpenCodeServer: async (): Promise<{ success: boolean; message: string; details?: string }> => { + restartOpenCodeServer: async (): Promise => { return fetchWrapper(`${API_BASE_URL}/api/settings/opencode-restart`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -96,23 +97,6 @@ export const settingsApi = { return fetchWrapper(`${API_BASE_URL}/api/settings/opencode-active-sessions`) }, - reloadOpenCodeConfig: async (): Promise<{ success: boolean; message: string; details?: string }> => { - try { - return fetchWrapper(`${API_BASE_URL}/api/settings/opencode-reload`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - }) - } catch (error) { - if (error instanceof FetchError && error.statusCode === 404) { - return fetchWrapper(`${API_BASE_URL}/api/settings/opencode-restart`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - }) - } - throw error - } - }, - rollbackOpenCodeConfig: async (): Promise<{ success: boolean; message: string; fallback?: boolean }> => { return fetchWrapper(`${API_BASE_URL}/api/settings/opencode-rollback`, { method: 'POST', diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts index 626190ee..faedfe9c 100644 --- a/frontend/src/api/types.ts +++ b/frontend/src/api/types.ts @@ -22,13 +22,6 @@ import type { SessionInfo } from '@opencode-manager/shared/opencode' export type Session = SessionInfo export type PermissionResponse = 'once' | 'always' | 'reject' -export type { FormAnswer, FormField, FormInfo, PermissionRequest } from '@opencode-manager/shared/opencode' - -export type ContentPart = - | { type: 'text', content: string } - | { type: 'file', path: string, name: string } - | { type: 'image', id: string, filename: string, mime: string, dataUrl: string } - export interface FileAttachmentInfo { path: string name: string diff --git a/frontend/src/api/types/settings.ts b/frontend/src/api/types/settings.ts index 7b668f74..ef96b98f 100644 --- a/frontend/src/api/types/settings.ts +++ b/frontend/src/api/types/settings.ts @@ -109,6 +109,12 @@ export interface OpenCodeConfigSaveResponse extends OpenCodeConfigFile { restartRequired?: boolean } +export interface OpenCodeRestartResponse { + success: boolean + message: string + interruptedSessions: string[] +} + export interface OpenCodeImportStatus { configSourcePath: string | null configSourcePaths: string[] diff --git a/frontend/src/components/message/FileToolRender.tsx b/frontend/src/components/message/FileToolRender.tsx index 00b2b19f..a4300f5e 100644 --- a/frontend/src/components/message/FileToolRender.tsx +++ b/frontend/src/components/message/FileToolRender.tsx @@ -70,7 +70,7 @@ interface FileToolRenderProps { onFileClick?: (filePath: string, lineNumber?: number) => void } -export function FileToolRender({ part, filediff, filePath, content, toolName, onFileClick }: FileToolRenderProps) { +function FileToolRender({ part, filediff, filePath, content, toolName, onFileClick }: FileToolRenderProps) { const { preferences } = useSettings() const isReadTool = toolName === 'Read' const isEditTool = toolName === 'Edit' diff --git a/frontend/src/components/message/MessagePart.tsx b/frontend/src/components/message/MessagePart.tsx index 6a809b28..dd8f074a 100644 --- a/frontend/src/components/message/MessagePart.tsx +++ b/frontend/src/components/message/MessagePart.tsx @@ -4,7 +4,7 @@ import { TextPart } from './TextPart' import { ToolCallPart } from './ToolCallPart' import { useSettings } from '@/hooks/useSettings' -export type AssistantContentPart = SessionMessageAssistant['content'][number] +type AssistantContentPart = SessionMessageAssistant['content'][number] interface MessagePartProps { part: AssistantContentPart diff --git a/frontend/src/components/message/MessageThread.test.tsx b/frontend/src/components/message/MessageThread.test.tsx index e244d9a4..660b2aad 100644 --- a/frontend/src/components/message/MessageThread.test.tsx +++ b/frontend/src/components/message/MessageThread.test.tsx @@ -385,6 +385,46 @@ describe('MessageThread', () => { expect(screen.getByText('QUEUED')).toBeInTheDocument() }) + it('renders step file changes from the assistant snapshot and opens clicked files', () => { + setupSettings({ simpleChatMode: false, showReasoning: false }) + const onFileClick = vi.fn() + + render( + , + ) + + expect(screen.getByText('File Changes (1 file)')).toBeInTheDocument() + fireEvent.click(screen.getByText('app/src/a.ts')) + expect(onFileClick).toHaveBeenCalledWith('/workspace/repos/app/src/a.ts') + }) + + it('hides step file changes in simple chat mode', () => { + setupSettings({ simpleChatMode: true, showReasoning: false }) + + render( + , + ) + + expect(screen.queryByText(/File Changes/)).not.toBeInTheDocument() + }) + it('shows the empty state when there are no messages or pending prompts', () => { setupSettings({ simpleChatMode: false, showReasoning: false }) diff --git a/frontend/src/components/message/MessageThread.tsx b/frontend/src/components/message/MessageThread.tsx index 2d7b6078..517e24c6 100644 --- a/frontend/src/components/message/MessageThread.tsx +++ b/frontend/src/components/message/MessageThread.tsx @@ -1,5 +1,6 @@ import { memo, useCallback, useMemo, useState } from 'react' import { Pencil, Loader2, Volume2, VolumeX } from 'lucide-react' +import { assistantText } from '@opencode-manager/shared/opencode' import type { PromptAgentAttachment, PromptFileAttachment, @@ -15,6 +16,7 @@ import type { import { MessagePart } from './MessagePart' import { MessageError } from './MessageError' import { RetryPart } from './RetryPart' +import { StepFileChanges } from './StepFileChanges' import { UserMessageActionButtons } from './UserMessageActionButtons' import { EditableUserMessage, ClickableUserMessage } from './EditableUserMessage' import { useSettings } from '@/hooks/useSettings' @@ -26,11 +28,7 @@ function getMessageText(message: SessionMessageInfo): string { case 'user': return message.text case 'assistant': - return message.content - .filter((part) => part.type === 'text') - .map((part) => part.text) - .join('\n\n') - .trim() + return assistantText(message.content).trim() case 'synthetic': case 'system': case 'skill': @@ -57,6 +55,7 @@ function hasRenderableContent( case 'user': return message.text.trim().length > 0 || (message.files?.length ?? 0) > 0 case 'assistant': + if (!simpleChatMode && (message.snapshot?.files?.length ?? 0) > 0) return true return message.content.some((part) => { if (part.type === 'text') return part.text.trim().length > 0 if (part.type === 'reasoning') return !simpleChatMode && showReasoning && part.text.trim().length > 0 @@ -439,6 +438,13 @@ const MessageRow = memo(function MessageRow({ /> ))} + {!simpleChatMode && message.snapshot?.files && ( + + )} {message.retry && } {message.error && } diff --git a/frontend/src/components/message/PromptInput.command.test.tsx b/frontend/src/components/message/PromptInput.command.test.tsx index 80333fee..21a985b7 100644 --- a/frontend/src/components/message/PromptInput.command.test.tsx +++ b/frontend/src/components/message/PromptInput.command.test.tsx @@ -38,7 +38,6 @@ vi.mock('@/hooks/useOpenCode', async () => { return { ...actual, useAgents: () => ({ data: mocks.agents }), - useOpenCodeClient: () => null, } }) diff --git a/frontend/src/components/message/PromptInput.mention.test.tsx b/frontend/src/components/message/PromptInput.mention.test.tsx index fcbac23a..9b9f3ab0 100644 --- a/frontend/src/components/message/PromptInput.mention.test.tsx +++ b/frontend/src/components/message/PromptInput.mention.test.tsx @@ -40,7 +40,6 @@ vi.mock('@/hooks/useOpenCode', async () => { return { ...actual, useAgents: () => ({ data: mocks.agents }), - useOpenCodeClient: () => null, } }) diff --git a/frontend/src/components/message/PromptInput.stt.test.tsx b/frontend/src/components/message/PromptInput.stt.test.tsx index 813c13b8..833555c6 100644 --- a/frontend/src/components/message/PromptInput.stt.test.tsx +++ b/frontend/src/components/message/PromptInput.stt.test.tsx @@ -44,7 +44,6 @@ vi.mock('@/hooks/useOpenCode', () => ({ useSendPrompt: () => ({ mutate: mocks.useSendPromptMutate, isPending: mocks.sendPromptPending() }), useInterruptSession: () => ({ mutate: vi.fn() }), useSendShell: () => ({ mutate: vi.fn(), isPending: false }), - useOpenCodeClient: () => ({}), useAgents: () => ({ data: [] }), })) diff --git a/frontend/src/components/message/PromptInput.tsx b/frontend/src/components/message/PromptInput.tsx index ecafbd99..3b0d670a 100644 --- a/frontend/src/components/message/PromptInput.tsx +++ b/frontend/src/components/message/PromptInput.tsx @@ -29,8 +29,8 @@ import { VoiceStatusOverlay, type VoiceStatusOverlayState } from './VoiceStatusO import { detectMentionTrigger, parsePromptToInput, getFilename, filterAgentsByQuery } from '@/lib/promptParser' import { randomId } from '@/lib/utils' import { showToast } from '@/lib/toast' -import { formatModelName, getProviders } from '@/api/providers' -import { useQuery } from '@tanstack/react-query' +import { formatModelName } from '@/api/providers' +import { useProviders } from '@/hooks/useProviders' import type { CommandInfo, ModelRef } from '@opencode-manager/shared/opencode' @@ -1042,11 +1042,7 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read) const appliedSessionModelRef = useRef(undefined) - const { data: providersData } = useQuery({ - queryKey: ['opencode', 'providers', directory], - queryFn: () => getProviders(directory), - staleTime: 30000, - }) + const { data: providersData } = useProviders(directory) const { model, modelString, setModel: setStoredModel, restoreSessionModel } = useModelSelection(directory) const setStoreVariant = useModelStore((state) => state.setVariant) diff --git a/frontend/src/components/message/StepFileChanges.test.tsx b/frontend/src/components/message/StepFileChanges.test.tsx new file mode 100644 index 00000000..7c2aee64 --- /dev/null +++ b/frontend/src/components/message/StepFileChanges.test.tsx @@ -0,0 +1,44 @@ +import { describe, it, expect, vi } from 'vitest' +import { render, screen, fireEvent } from '@testing-library/react' +import { StepFileChanges } from './StepFileChanges' + +describe('StepFileChanges', () => { + it('renders the file count and relative paths', () => { + render( + , + ) + + expect(screen.getByText('File Changes (2 files)')).toBeInTheDocument() + expect(screen.getByText('app/src/a.ts')).toBeInTheDocument() + expect(screen.getByText('app/src/b.ts')).toBeInTheDocument() + expect(screen.getByText('01234567')).toBeInTheDocument() + }) + + it('calls onFileClick with the original path', () => { + const onFileClick = vi.fn() + render() + + fireEvent.click(screen.getByText('app/src/a.ts')) + + expect(onFileClick).toHaveBeenCalledWith('/workspace/repos/app/src/a.ts') + }) + + it('collapses long lists and expands on demand', () => { + const files = ['a.ts', 'b.ts', 'c.ts', 'd.ts', 'e.ts'] + render() + + expect(screen.queryByText('d.ts')).not.toBeInTheDocument() + fireEvent.click(screen.getByText('+2 more files')) + expect(screen.getByText('e.ts')).toBeInTheDocument() + expect(screen.getByText('Show less')).toBeInTheDocument() + }) + + it('renders nothing when there are no files', () => { + const { container } = render() + + expect(container).toBeEmptyDOMElement() + }) +}) diff --git a/frontend/src/components/message/StepFileChanges.tsx b/frontend/src/components/message/StepFileChanges.tsx new file mode 100644 index 00000000..0861e53c --- /dev/null +++ b/frontend/src/components/message/StepFileChanges.tsx @@ -0,0 +1,68 @@ +import { useState } from 'react' +import { ChevronDown, ChevronUp } from 'lucide-react' +import { getRelativePath } from './FileToolRender' + +interface StepFileChangesProps { + files: string[] + snapshot?: string + onFileClick?: (filePath: string) => void +} + +const INITIAL_FILES_SHOWN = 3 + +function fileNoun(count: number): string { + return count === 1 ? 'file' : 'files' +} + +export function StepFileChanges({ files, snapshot, onFileClick }: StepFileChangesProps) { + const [expanded, setExpanded] = useState(false) + + if (files.length === 0) return null + + const hasMoreFiles = files.length > INITIAL_FILES_SHOWN + const displayedFiles = expanded ? files : files.slice(0, INITIAL_FILES_SHOWN) + const hiddenCount = files.length - INITIAL_FILES_SHOWN + + return ( +
+ + +
+ {displayedFiles.map((file) => ( + + ))} + + {hasMoreFiles && ( + + )} +
+
+ ) +} diff --git a/frontend/src/components/message/ToolCallPart.tsx b/frontend/src/components/message/ToolCallPart.tsx index 478270bd..b1559d92 100644 --- a/frontend/src/components/message/ToolCallPart.tsx +++ b/frontend/src/components/message/ToolCallPart.tsx @@ -1,6 +1,6 @@ import { useState, useRef, useEffect, useMemo, memo } from 'react' import { unwrapSandboxExecCommand } from '@opencode-manager/shared/utils' -import type { SessionMessageAssistantTool } from '@opencode-manager/shared/opencode' +import { toolContentText, type SessionMessageAssistantTool } from '@opencode-manager/shared/opencode' import { useSettings } from '@/hooks/useSettings' import { useUserBash } from '@/stores/userBashStore' import { useSessionStatusForSession } from '@/stores/sessionStatusStore' @@ -55,12 +55,7 @@ function toolMetadata(part: SessionMessageAssistantTool): Record entry.type === 'text') - .map((entry) => entry.text) - .join('\n\n') + return toolContentText(part.state.status === 'running' ? undefined : part.state.content) } function getSubagentSessionId(part: SessionMessageAssistantTool): string | undefined { diff --git a/frontend/src/components/model/ApiKeyDialog.test.tsx b/frontend/src/components/model/ApiKeyDialog.test.tsx index dcfe100f..282082d8 100644 --- a/frontend/src/components/model/ApiKeyDialog.test.tsx +++ b/frontend/src/components/model/ApiKeyDialog.test.tsx @@ -44,21 +44,20 @@ describe('ApiKeyDialog', () => { vi.mocked(oauthApi.getAuthMethods).mockResolvedValue({ azure: [ { - id: 'key', type: 'key', label: 'API key', - fields: [ + form: [ { - type: 'text', key: 'resourceName', - message: 'Enter Azure Resource Name', + type: 'string', + title: 'Enter Azure Resource Name', placeholder: 'e.g. my-models', required: true, }, ], }, ], - anthropic: [{ id: 'key', type: 'key', label: 'API key' }], + anthropic: [{ type: 'key', label: 'API key' }], }) }) @@ -120,4 +119,52 @@ describe('ApiKeyDialog', () => { ).toBeInTheDocument() expect(onSuccess).not.toHaveBeenCalled() }) + + it('keeps Connect enabled while a conditional required field is hidden and renders external fields', async () => { + const user = userEvent.setup() + vi.mocked(oauthApi.getAuthMethods).mockResolvedValue({ + azure: [ + { + type: 'key', + label: 'API key', + form: [ + { + key: 'deploymentType', + type: 'string', + title: 'Deployment', + required: true, + default: 'github.com', + options: [ + { value: 'github.com', label: 'GitHub.com' }, + { value: 'enterprise', label: 'GitHub Enterprise' }, + ], + }, + { + key: 'enterpriseUrl', + type: 'string', + title: 'Enterprise URL', + required: true, + when: [{ key: 'deploymentType', op: 'eq', value: 'enterprise' }], + }, + { + key: 'docs', + type: 'external', + url: 'https://example.com/docs', + title: 'Read the docs', + }, + ], + }, + ], + }) + renderDialog(azureProvider) + + await user.type(await screen.findByLabelText('API Key'), 'az-test') + + expect(screen.queryByLabelText('Enterprise URL')).not.toBeInTheDocument() + expect(screen.getByRole('button', { name: 'Connect' })).toBeEnabled() + + const link = screen.getByRole('link', { name: /Read the docs/ }) + expect(link).toHaveAttribute('href', 'https://example.com/docs') + expect(link).toHaveAttribute('rel', 'noopener noreferrer') + }) }) diff --git a/frontend/src/components/model/ApiKeyDialog.tsx b/frontend/src/components/model/ApiKeyDialog.tsx index ad99bb5a..d702f3ef 100644 --- a/frontend/src/components/model/ApiKeyDialog.tsx +++ b/frontend/src/components/model/ApiKeyDialog.tsx @@ -14,8 +14,8 @@ import { Label } from "@/components/ui/label"; import { Loader2, Key, ExternalLink } from "lucide-react"; import { providerCredentialsApi } from "@/api/providers"; import type { ProviderWithModels } from "@/api/providers"; -import { oauthApi, type PromptAnswer, type PromptAnswerValue } from "@/api/oauth"; -import { buildAnswer, defaultAnswer, hasMissingAnswers, setAnswerValue, visibleFields } from "@/lib/oauthFields"; +import { oauthApi, type FormAnswer, type FormValue, type IntegrationKeyMethod } from "@/api/oauth"; +import { buildAnswer, hasMissingAnswers, methodIdentifier, resolveAnswers, setAnswerValue, visibleFields } from "@/lib/formFields"; import { mapOAuthError } from "@/lib/oauthErrors"; import { ProviderAuthField } from "@/components/settings/ProviderAuthField"; @@ -35,7 +35,7 @@ export function ApiKeyDialog({ mode = 'add', }: ApiKeyDialogProps) { const [apiKey, setApiKey] = useState(""); - const [answers, setAnswers] = useState>({}); + const [answers, setAnswers] = useState>({}); const [isSubmitting, setIsSubmitting] = useState(false); const [error, setError] = useState(null); @@ -46,23 +46,23 @@ export function ApiKeyDialog({ }); const keyMethod = useMemo( - () => (provider ? authMethods?.[provider.id]?.find((method) => method.type === 'key') : undefined), + () => (provider ? authMethods?.[provider.id]?.find((method): method is IntegrationKeyMethod => method.type === 'key') : undefined), [authMethods, provider], ); const answer = useMemo( - () => (keyMethod ? { ...defaultAnswer(keyMethod), ...answers[keyMethod.id] } : {}), + () => resolveAnswers(keyMethod?.form, keyMethod ? answers[methodIdentifier(keyMethod)] : undefined), [keyMethod, answers], ); const fields = useMemo( - () => (keyMethod ? visibleFields(keyMethod, answer) : []), + () => (keyMethod ? visibleFields(keyMethod.form ?? [], answer) : []), [keyMethod, answer], ); - const canSubmit = apiKey.trim().length > 0 && (!keyMethod || !hasMissingAnswers(keyMethod, answer)); + const canSubmit = apiKey.trim().length > 0 && (!keyMethod || !hasMissingAnswers(keyMethod.form ?? [], answer)); - const handleAnswerChange = useCallback((methodID: string, key: string, value: PromptAnswerValue | undefined) => { + const handleAnswerChange = useCallback((methodID: string, key: string, value: FormValue | undefined) => { setAnswers((prev) => setAnswerValue(prev, methodID, key, value)); }, []); @@ -73,7 +73,7 @@ export function ApiKeyDialog({ setError(null); try { - const requestAnswer = keyMethod && fields.length > 0 ? buildAnswer(keyMethod, answer) : undefined; + const requestAnswer = keyMethod && fields.length > 0 ? buildAnswer(keyMethod.form ?? [], answer) : undefined; await providerCredentialsApi.set(provider.id, apiKey.trim(), requestAnswer); setApiKey(""); setAnswers({}); @@ -142,7 +142,7 @@ export function ApiKeyDialog({ field={field} value={answer[field.key]} disabled={isSubmitting} - onChange={(value) => handleAnswerChange(keyMethod.id, field.key, value)} + onChange={(value) => handleAnswerChange(methodIdentifier(keyMethod), field.key, value)} /> ))} diff --git a/frontend/src/components/model/ModelQuickSelect.tsx b/frontend/src/components/model/ModelQuickSelect.tsx index 7872309c..1bbc6cc9 100644 --- a/frontend/src/components/model/ModelQuickSelect.tsx +++ b/frontend/src/components/model/ModelQuickSelect.tsx @@ -2,8 +2,8 @@ import { useCallback, useDeferredValue, useEffect, useLayoutEffect, useMemo, use import { Check, ChevronDown, ChevronLeft, ChevronRight, Clock, Search, Star, Trash2, X } from 'lucide-react' import { useModelSelection } from '@/hooks/useModelSelection' import { useVariants } from '@/hooks/useVariants' -import { formatModelName, formatProviderName, getProviders } from '@/api/providers' -import { useQuery } from '@tanstack/react-query' +import { formatModelName, formatProviderName } from '@/api/providers' +import { useProviders } from '@/hooks/useProviders' import { BottomSheet } from '@/components/ui/bottom-sheet' import { DropdownMenu, @@ -192,11 +192,7 @@ export function ModelQuickSelect({ const { model, modelString, recentModels, favoriteModels, setModel, toggleFavorite, removeRecentModel } = useModelSelection(directory) const { availableVariants, currentVariant, setVariant, clearVariant, hasVariants } = useVariants(directory) - const { data: providersData } = useQuery({ - queryKey: ['opencode', 'providers', directory], - queryFn: () => getProviders(directory), - staleTime: 30000, - }) + const { data: providersData } = useProviders(directory) const providers = providersData?.providers ?? EMPTY_PROVIDERS diff --git a/frontend/src/components/model/ModelSelectDialog.tsx b/frontend/src/components/model/ModelSelectDialog.tsx deleted file mode 100644 index 6a355a5c..00000000 --- a/frontend/src/components/model/ModelSelectDialog.tsx +++ /dev/null @@ -1,515 +0,0 @@ -import { useState, useEffect, useMemo, useCallback, memo } from "react"; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Badge } from "@/components/ui/badge"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; -import { Clock, Loader2, Search, Check, Star } from "lucide-react"; -import { - formatModelName, - formatProviderName, -} from "@/api/providers"; -import { useProvidersWithModels } from "@/hooks/useProvidersWithModels"; -import { useModelSelection } from "@/hooks/useModelSelection"; -import type { Model, ProviderWithModels } from "@/api/providers"; - -interface ModelSelectDialogProps { - open: boolean; - onOpenChange: (open: boolean) => void; - directory?: string; -} - -interface FlatModel { - model: Model; - provider: ProviderWithModels; - modelKey: string; -} - -interface SearchInputProps { - onSearch: (query: string) => void; - initialValue?: string; -} - -function SearchInput({ onSearch, initialValue = "" }: SearchInputProps) { - const [value, setValue] = useState(initialValue); - - useEffect(() => { - const timer = setTimeout(() => onSearch(value), 150); - return () => clearTimeout(timer); - }, [value, onSearch]); - - useEffect(() => { - setValue(initialValue); - }, [initialValue]); - - return ( -
-
- - setValue(e.target.value)} - className="pl-10 md:text-sm" - autoComplete="off" - name="model-select" - /> -
-
- ); -} - -interface ModelCardProps { - model: Model; - provider: ProviderWithModels; - modelKey: string; - isSelected: boolean; - isFavorite: boolean; - onSelect: (providerId: string, modelId: string) => void; - onToggleFavorite: (providerId: string, modelId: string) => void; -} - -const ModelCard = memo(function ModelCard({ - model, - provider, - isSelected, - isFavorite, - onSelect, - onToggleFavorite, -}: ModelCardProps) { - const capabilities = useMemo(() => { - const caps = []; - if (model.reasoning) caps.push("Reasoning"); - if (model.tool_call) caps.push("Tools"); - if (model.attachment) caps.push("Files"); - return caps; - }, [model.reasoning, model.tool_call, model.attachment]); - - const statusBadge = useMemo(() => { - if (model.experimental) return Experimental; - if (model.status === "alpha") return Alpha; - if (model.status === "beta") return Beta; - return null; - }, [model.experimental, model.status]); - - return ( -
onSelect(provider.id, model.key || model.id)} - > -
-
-
-

- {formatModelName(model)} -

-
-

- {formatProviderName(provider)} -

-
-
- - {isSelected && } -
-
- -
- {model.id} -
- - {capabilities.length > 0 && ( -
- {capabilities.slice(0, 2).map((cap) => ( - - {cap} - - ))} - {capabilities.length > 2 && ( - - +{capabilities.length - 2} - - )} -
- )} - - {statusBadge &&
{statusBadge}
} - -
- {model.limit?.context && ( -
- Context: - - {model.limit.context >= 1000000 - ? `${(model.limit.context / 1000000).toFixed(1)}M` - : model.limit.context.toLocaleString() - } tokens - -
- )} - {model.cost && ( -
- Cost: - ${model.cost.input.toFixed(4)}/1K -
- )} -
-
- ); -}); - -interface ModelGridProps { - models: FlatModel[]; - currentModel: string; - favoriteModelKeys: Set; - onSelect: (providerId: string, modelId: string) => void; - onToggleFavorite: (providerId: string, modelId: string) => void; - loading: boolean; - favoriteModels?: FlatModel[]; - recentModels?: FlatModel[]; - showRecent?: boolean; -} - -const ModelGrid = memo(function ModelGrid({ - models, - currentModel, - favoriteModelKeys, - onSelect, - onToggleFavorite, - loading, - favoriteModels = [], - recentModels = [], - showRecent = false, -}: ModelGridProps) { - if (loading) { - return ( -
- -
- ); - } - - if (models.length === 0 && (!showRecent || (favoriteModels.length === 0 && recentModels.length === 0))) { - return ( -
- No models found -
- ); - } - - return ( -
- {showRecent && favoriteModels.length > 0 && ( -
-

- - Favorite Models -

-
- {favoriteModels.map(({ model, provider, modelKey }) => ( - - ))} -
-
- )} - - {showRecent && recentModels.length > 0 && ( -
-

- - Recent Models -

-
- {recentModels.map(({ model, provider, modelKey }) => ( - - ))} -
-
- )} - - {models.length > 0 && ( -
- {showRecent && (favoriteModels.length > 0 || recentModels.length > 0) && ( -

- All Models -

- )} -
- {models.map(({ model, provider, modelKey }) => ( - - ))} -
-
- )} -
- ); -}); - -interface ProviderSidebarProps { - providers: ProviderWithModels[]; - selectedProvider: string; - onSelect: (providerId: string) => void; -} - -const ProviderSidebar = memo(function ProviderSidebar({ - providers, - selectedProvider, - onSelect, -}: ProviderSidebarProps) { - return ( -
-
- - - {providers.length > 0 && ( -
- {providers.map((provider) => ( - - ))} -
- )} -
-
- ); -}); - -export function ModelSelectDialog({ - open, - onOpenChange, - directory, -}: ModelSelectDialogProps) { - const [searchQuery, setSearchQuery] = useState(""); - const [selectedProvider, setSelectedProvider] = useState(""); - - const { modelString, setModel, toggleFavorite, recentModels, favoriteModels } = useModelSelection(directory); - const currentModel = modelString || ""; - - const { data: allProviders, isLoading: loading } = useProvidersWithModels({ - enabled: open, - directory, - keyParts: [directory], - }); - - const connectedProviders = useMemo(() => { - return allProviders.filter(p => p.isConnected); - }, [allProviders]); - - const selectableProviders = connectedProviders.length > 0 ? connectedProviders : allProviders; - - useEffect(() => { - if (open) { - setSelectedProvider(""); - } - }, [open]); - - const flatModels = useMemo((): FlatModel[] => { - return selectableProviders.flatMap((provider) => - provider.models.map((model) => ({ - model, - provider, - modelKey: `${provider.id}/${model.key || model.id}`, - })) - ); - }, [selectableProviders]); - - const favoriteFlatModels = useMemo((): FlatModel[] => { - return favoriteModels - .map((favorite) => flatModels.find((fm) => fm.modelKey === `${favorite.providerID}/${favorite.modelID}`)) - .filter((fm): fm is FlatModel => fm !== undefined) - .slice(0, 6); - }, [favoriteModels, flatModels]); - - const favoriteModelKeys = useMemo(() => { - return new Set(favoriteModels.map((favorite) => `${favorite.providerID}/${favorite.modelID}`)); - }, [favoriteModels]); - - const recentFlatModels = useMemo((): FlatModel[] => { - return recentModels - .filter((recent) => !favoriteModels.some((favorite) => favorite.providerID === recent.providerID && favorite.modelID === recent.modelID)) - .map((recent) => flatModels.find((fm) => fm.modelKey === `${recent.providerID}/${recent.modelID}`)) - .filter((fm): fm is FlatModel => fm !== undefined) - .slice(0, 6); - }, [recentModels, favoriteModels, flatModels]); - - const filteredModels = useMemo(() => { - const search = searchQuery.toLowerCase(); - let filtered = flatModels; - - if (selectedProvider) { - filtered = filtered.filter((item) => item.provider.id === selectedProvider); - } - - if (search) { - filtered = filtered.filter((item) => - item.model.name.toLowerCase().includes(search) || - (item.model.key || item.model.id).toLowerCase().includes(search) || - item.provider.name.toLowerCase().includes(search) - ); - } - - if (!selectedProvider && !search) { - filtered = filtered.filter((item) => - !favoriteFlatModels.some((favorite) => favorite.modelKey === item.modelKey) && - !recentFlatModels.some((recent) => recent.modelKey === item.modelKey) - ); - } - - return filtered; - }, [flatModels, favoriteFlatModels, recentFlatModels, selectedProvider, searchQuery]); - - const selectedProviderData = useMemo( - () => selectableProviders.find(p => p.id === selectedProvider), - [selectableProviders, selectedProvider] - ); - - const handleProviderSelect = useCallback((providerId: string) => { - setSelectedProvider(providerId); - setSearchQuery(""); - }, []); - - const handleSearch = useCallback((query: string) => { - setSearchQuery(query); - }, []); - - const handleModelSelect = useCallback((providerId: string, modelId: string) => { - setModel({ providerID: providerId, modelID: modelId }); - onOpenChange(false); - }, [setModel, onOpenChange]); - - const handleFavoriteToggle = useCallback((providerId: string, modelId: string) => { - toggleFavorite({ providerID: providerId, modelID: modelId }); - }, [toggleFavorite]); - - const searchResetKey = selectedProvider; - - return ( - - - - - {selectedProvider && selectedProviderData ? `Select Model - ${selectedProviderData.name}` : 'Select Model'} - - - -
- - -
-
- -
- - - -
- -
- - {currentModel && ( -
-

- Current:{' '} - - - {currentModel} - -

-
- )} -
-
-
-
- ); -} diff --git a/frontend/src/components/repo/RepoMcpDialog.tsx b/frontend/src/components/repo/RepoMcpDialog.tsx index 1fa534e0..af7cbb8f 100644 --- a/frontend/src/components/repo/RepoMcpDialog.tsx +++ b/frontend/src/components/repo/RepoMcpDialog.tsx @@ -7,6 +7,7 @@ import { mcpApi, type McpStatus, type McpAuthStartResponse } from '@/api/mcp' import { useMutation, useQueryClient } from '@tanstack/react-query' import { invalidateSessionCaches } from '@/lib/queryInvalidation' import { showToast } from '@/lib/toast' +import { formatMcpServerName } from '@/lib/mcp' interface RepoMcpDialogProps { open: boolean @@ -98,11 +99,6 @@ export function RepoMcpDialog({ open, onOpenChange, directory }: RepoMcpDialogPr } }, [open, directory, fetchStatus]) - const getDisplayName = (serverId: string): string => { - const name = serverId.replace(/[-_]/g, ' ') - return name.charAt(0).toUpperCase() + name.slice(1) - } - if (!directory) return null return ( @@ -137,7 +133,7 @@ export function RepoMcpDialog({ open, onOpenChange, directory }: RepoMcpDialogPr onCancel={() => setRemoveAuthConfirmServer(null)} title="Remove Authentication" description="This will remove the OAuth credentials for this MCP server at this location. You will need to re-authenticate to use this server here again." - itemName={removeAuthConfirmServer ? getDisplayName(removeAuthConfirmServer) : ''} + itemName={removeAuthConfirmServer ? formatMcpServerName(removeAuthConfirmServer) : ''} isDeleting={removeAuthMutation.isPending} /> diff --git a/frontend/src/components/repo/RepoMcpServerList.tsx b/frontend/src/components/repo/RepoMcpServerList.tsx index 9ed3f8b8..79faa862 100644 --- a/frontend/src/components/repo/RepoMcpServerList.tsx +++ b/frontend/src/components/repo/RepoMcpServerList.tsx @@ -1,11 +1,11 @@ import { Switch } from '@/components/ui/switch' import { Button } from '@/components/ui/button' -import { Badge } from '@/components/ui/badge' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu' import { DropdownMenuSeparator } from '@/components/ui/dropdown-menu' import { Loader2, XCircle, AlertCircle, Plug, Shield, Key, RefreshCw, ChevronDown } from 'lucide-react' import type { McpStatus } from '@/api/mcp' - +import { formatMcpServerName } from '@/lib/mcp' +import { McpStatusBadge } from '@/components/settings/McpStatusBadge' interface RepoMcpServerListProps { hasFetchedStatus: boolean @@ -34,39 +34,6 @@ export function RepoMcpServerList({ onAuthClick, onRemoveAuthClick, }: RepoMcpServerListProps) { - const getDisplayName = (serverId: string): string => { - const name = serverId.replace(/[-_]/g, ' ') - return name.charAt(0).toUpperCase() + name.slice(1) - } - - const getStatusBadge = (status?: McpStatus) => { - if (!status) return null - - switch (status.status) { - case 'connected': - return Connected - case 'pending': - return Connecting - case 'disabled': - return Disabled - case 'failed': - return ( - - - Failed - - ) - case 'needs_auth': - return ( - - Needs Auth - - ) - default: - return Unknown - } - } - return (
{hasFetchedStatus && serverIds.length === 0 ? ( @@ -99,7 +66,7 @@ export function RepoMcpServerList({

- {getDisplayName(serverId)} + {formatMcpServerName(serverId)}

{(showAuthButton || connectedWithOAuth) ? ( @@ -153,7 +120,7 @@ export function RepoMcpServerList({ ) : ( - getStatusBadge(status) + status && )}
{failed && status.status === 'failed' && ( diff --git a/frontend/src/components/session/FormPrompt.test.tsx b/frontend/src/components/session/FormPrompt.test.tsx index e6aeb161..0a976055 100644 --- a/frontend/src/components/session/FormPrompt.test.tsx +++ b/frontend/src/components/session/FormPrompt.test.tsx @@ -507,4 +507,109 @@ describe('FormPrompt', () => { expect(screen.getByRole('button', { name: 'Dismiss' })).toBeInTheDocument() }) }) + + describe('conditional and external fields', () => { + const conditionalForm: FormInfo = { + id: 'form-conditional', + sessionID: 'session-1', + title: 'Configure', + fields: [ + { + key: 'deploymentType', + title: 'Deployment', + type: 'string', + options: [ + { value: 'github.com', label: 'GitHub.com' }, + { value: 'enterprise', label: 'GitHub Enterprise' }, + ], + default: 'github.com', + }, + { + key: 'enterpriseUrl', + title: 'Enterprise URL', + type: 'string', + required: true, + when: [{ key: 'deploymentType', op: 'eq', value: 'enterprise' }], + }, + ], + } + + it('submits while a conditional required field stays hidden', async () => { + const onReply = vi.fn().mockResolvedValue(undefined) + render() + + expect(screen.queryByLabelText(/Enterprise URL/)).not.toBeInTheDocument() + const submit = screen.getByRole('button', { name: 'Submit' }) + expect(submit).toBeEnabled() + + await userEvent.click(submit) + await waitFor(() => + expect(onReply).toHaveBeenCalledWith('form-conditional', { deploymentType: 'github.com' }), + ) + }) + + it('reveals and requires the conditional field once its condition matches', async () => { + const onReply = vi.fn().mockResolvedValue(undefined) + render() + + await userEvent.click(screen.getByText('GitHub Enterprise')) + + const submit = screen.getByRole('button', { name: 'Submit' }) + expect(submit).toBeDisabled() + + await userEvent.type(screen.getByLabelText(/Enterprise URL/), 'company.ghe.com') + expect(submit).toBeEnabled() + + await userEvent.click(submit) + await waitFor(() => + expect(onReply).toHaveBeenCalledWith('form-conditional', { + deploymentType: 'enterprise', + enterpriseUrl: 'company.ghe.com', + }), + ) + }) + + it('renders an external field as a link card', () => { + const form: FormInfo = { + id: 'form-external', + sessionID: 'session-1', + title: 'Approve', + fields: [ + { + key: 'approve', + type: 'external', + url: 'https://example.com/approve', + title: 'Approve access', + description: 'Do it in the provider dashboard', + }, + ], + } + render() + + const link = screen.getByRole('link', { name: /Approve access/ }) + expect(link).toHaveAttribute('href', 'https://example.com/approve') + expect(link).toHaveAttribute('target', '_blank') + expect(link).toHaveAttribute('rel', 'noopener noreferrer') + expect(screen.getByText('Do it in the provider dashboard')).toBeInTheDocument() + }) + + it('does not render an external field with a non-http url', () => { + const form: FormInfo = { + id: 'form-external-unsafe', + sessionID: 'session-1', + title: 'Approve', + fields: [ + { + key: 'approve', + type: 'external', + url: 'javascript:alert(1)', + title: 'Approve access', + }, + ], + } + render() + + expect(screen.queryByRole('link', { name: /Approve access/ })).not.toBeInTheDocument() + }) + }) }) diff --git a/frontend/src/components/session/FormPrompt.tsx b/frontend/src/components/session/FormPrompt.tsx index 87af8f06..981eed6a 100644 --- a/frontend/src/components/session/FormPrompt.tsx +++ b/frontend/src/components/session/FormPrompt.tsx @@ -2,7 +2,9 @@ import { useEffect, useId, useRef, useState, type ReactNode } from 'react' import { X, ChevronDown, ChevronUp, Check, Loader2 } from 'lucide-react' import { Button } from '@/components/ui/button' import { Textarea } from '@/components/ui/textarea' +import { ExternalFieldCard } from '@/components/ui/external-field-card' import type { FormAnswer, FormField, FormInfo } from '@opencode-manager/shared/opencode' +import { buildAnswer, hasMissingAnswers, visibleFields } from '@/lib/formFields' import { cn } from '@/lib/utils' import { showToast } from '@/lib/toast' @@ -66,8 +68,8 @@ interface FormPromptProps { } export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptProps) { - const fields = form.fields.filter(isAnswerableField) - const [state, setState] = useState(() => buildInitialState(fields)) + const candidateFields = form.fields.filter(isAnswerableField) + const [state, setState] = useState(() => buildInitialState(candidateFields)) const { answer, customValues, customDrafts } = state const [expandedCustom, setExpandedCustom] = useState(null) const [isMinimized, setIsMinimized] = useState(false) @@ -119,26 +121,15 @@ export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptPr return value } - const isFieldAnswered = (field: AnswerableFormField): boolean => { + const effectiveAnswers: FormAnswer = {} + for (const field of candidateFields) { const value = getEffectiveAnswer(field) - if (field.type === 'boolean') return typeof value === 'boolean' - if (field.type === 'multiselect') return Array.isArray(value) && value.length > 0 - return value !== undefined && value !== '' + if (value !== undefined) effectiveAnswers[field.key] = value } - const canSubmit = fields.every((field) => field.required !== true || isFieldAnswered(field)) - - const buildSubmission = (): FormAnswer => { - const result: FormAnswer = {} - for (const field of fields) { - const value = getEffectiveAnswer(field) - if (value === undefined) continue - if (typeof value === 'string' && value === '') continue - if (Array.isArray(value) && value.length === 0) continue - result[field.key] = value - } - return result - } + const renderFields = visibleFields(form.fields, effectiveAnswers) + const canSubmit = !hasMissingAnswers(form.fields, effectiveAnswers) + const buildSubmission = (): FormAnswer => buildAnswer(form.fields, effectiveAnswers) const handleMinimize = () => { setIsMinimized(true) @@ -338,7 +329,13 @@ export function FormPrompt({ form, onReply, onCancel, onMinimize }: FormPromptPr {!isMinimized && (
- {fields.map((field) => renderField(field))} + {renderFields.map((field) => + field.type === 'external' ? ( + + ) : ( + renderField(field) + ), + )}
)} diff --git a/frontend/src/components/session/SessionSendErrorBanner.test.tsx b/frontend/src/components/session/SessionSendErrorBanner.test.tsx index 5718220b..42b1340c 100644 --- a/frontend/src/components/session/SessionSendErrorBanner.test.tsx +++ b/frontend/src/components/session/SessionSendErrorBanner.test.tsx @@ -111,18 +111,6 @@ describe('SessionSendErrorBanner', () => { expect(screen.getByText('Connection Failed')).toBeInTheDocument() }) - it('renders a session-kind error even while disconnected', () => { - useSendErrorStore.getState().setQueuedPrompt('test-session', 'queued message') - useSendErrorStore.getState().failQueuedPrompt({ - sessionID: 'test-session', - title: 'Session error', - message: 'Server reported failure', - }) - - render() - expect(screen.getByText('Session error')).toBeInTheDocument() - }) - it('renders a previously hidden network error after reconnecting', () => { useSendErrorStore.getState().setError({ sessionID: 'test-session', diff --git a/frontend/src/components/settings/AddMcpServerDialog.test.tsx b/frontend/src/components/settings/AddMcpServerDialog.test.tsx index 08e0c605..426c5804 100644 --- a/frontend/src/components/settings/AddMcpServerDialog.test.tsx +++ b/frontend/src/components/settings/AddMcpServerDialog.test.tsx @@ -1,4 +1,4 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' +import { describe, it, expect, vi, beforeAll, beforeEach } from 'vitest' import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' @@ -42,6 +42,13 @@ function renderDialog(onUpdate: (content: Record) => Promise { + beforeAll(() => { + Element.prototype.hasPointerCapture ??= () => false + Element.prototype.setPointerCapture ??= () => {} + Element.prototype.releasePointerCapture ??= () => {} + Element.prototype.scrollIntoView ??= () => {} + }) + beforeEach(() => { vi.clearAllMocks() mockGetOpenCodeConfig.mockResolvedValue(config) @@ -74,6 +81,35 @@ describe('AddMcpServerDialog', () => { expect(mockAddServerAsync).toHaveBeenCalledTimes(1) }) + it('writes a remote server with V2 OAuth keys and the Manager callback', async () => { + const onUpdate = vi.fn<(content: Record) => Promise>().mockResolvedValue(undefined) + const user = userEvent.setup() + renderDialog(onUpdate) + + await user.type(screen.getByLabelText('Server ID'), 'remote-tools') + await user.click(screen.getByRole('combobox')) + await user.click(screen.getByRole('option', { name: 'Remote (HTTP)' })) + await user.type(screen.getByLabelText('Server URL'), 'https://mcp.example.com') + await user.click(screen.getByLabelText('Enable OAuth')) + await user.type(screen.getByLabelText('Client ID'), 'client-1') + await user.type(screen.getByLabelText('Timeout (ms)'), '9000') + await user.click(screen.getByRole('button', { name: 'Add MCP Server' })) + + await waitFor(() => expect(onUpdate).toHaveBeenCalledTimes(1)) + const serverConfig = { + type: 'remote', + url: 'https://mcp.example.com', + oauth: { + client_id: 'client-1', + redirect_uri: `${window.location.origin}/api/mcp-oauth-proxy/callback`, + }, + disabled: false, + timeout: { catalog: 9000, execution: 9000 }, + } + expect(onUpdate).toHaveBeenCalledWith({ mcp: { servers: { 'remote-tools': serverConfig } } }) + expect(mockAddServerAsync).toHaveBeenCalledWith({ name: 'remote-tools', config: serverConfig }) + }) + it('passes only the merged content to onUpdate', async () => { const fetched = makeOpenCodeConfigFile({ revision: 'rev-B' }) mockGetOpenCodeConfig.mockResolvedValue(fetched) diff --git a/frontend/src/components/settings/AddMcpServerDialog.tsx b/frontend/src/components/settings/AddMcpServerDialog.tsx index 848bedab..25811313 100644 --- a/frontend/src/components/settings/AddMcpServerDialog.tsx +++ b/frontend/src/components/settings/AddMcpServerDialog.tsx @@ -8,7 +8,11 @@ import { Loader2 } from 'lucide-react' import { Switch } from '@/components/ui/switch' import { useMcpServers } from '@/hooks/useMcpServers' import { settingsApi } from '@/api/settings' -import { toV2McpServerConfig, type McpServerConfig, type V2McpServerConfig } from '@opencode-manager/shared/opencode' +import { + mcpOAuthRedirectUri, + type McpServerConfig, + type McpTimeoutConfig, +} from '@opencode-manager/shared/opencode' import { useMutation, useQueryClient } from '@tanstack/react-query' interface AddMcpServerDialogProps { @@ -38,13 +42,17 @@ export function AddMcpServerDialog({ open, onOpenChange, onUpdate }: AddMcpServe const queryClient = useQueryClient() const { addServerAsync, isAddingServer } = useMcpServers() - const parseTimeout = (): number | undefined => { + const buildTimeout = (): McpTimeoutConfig | undefined => { const parsed = parseInt(timeout) - return Number.isFinite(parsed) ? parsed : undefined + return Number.isFinite(parsed) ? { catalog: parsed, execution: parsed } : undefined } const buildMcpServerConfig = (): McpServerConfig => { - const parsedTimeout = parseTimeout() + const timeoutConfig = buildTimeout() + const shared = { + disabled: !enabled, + ...(timeoutConfig ? { timeout: timeoutConfig } : {}), + } if (serverType === 'local') { const commandArray = command.split(' ').filter((arg) => arg.trim()) @@ -60,10 +68,9 @@ export function AddMcpServerDialog({ open, onOpenChange, onUpdate }: AddMcpServe return { type: 'local', - enabled, command: commandArray, ...(Object.keys(environmentVariables).length > 0 ? { environment: environmentVariables } : {}), - ...(parsedTimeout === undefined ? {} : { timeout: parsedTimeout }), + ...shared, } } @@ -73,18 +80,18 @@ export function AddMcpServerDialog({ open, onOpenChange, onUpdate }: AddMcpServe return { type: 'remote', - enabled, url: url.trim(), ...(oauthEnabled ? { oauth: { - ...(oauthClientId.trim() ? { clientId: oauthClientId.trim() } : {}), - ...(oauthClientSecret.trim() ? { clientSecret: oauthClientSecret.trim() } : {}), + ...(oauthClientId.trim() ? { client_id: oauthClientId.trim() } : {}), + ...(oauthClientSecret.trim() ? { client_secret: oauthClientSecret.trim() } : {}), ...(oauthScope.trim() ? { scope: oauthScope.trim() } : {}), + redirect_uri: mcpOAuthRedirectUri(window.location.origin), }, } : {}), - ...(parsedTimeout === undefined ? {} : { timeout: parsedTimeout }), + ...shared, } } @@ -93,15 +100,12 @@ export function AddMcpServerDialog({ open, onOpenChange, onUpdate }: AddMcpServe const config = await settingsApi.getOpenCodeConfig() const mcpServerConfig = buildMcpServerConfig() const mcp = (config.content.mcp as Record | undefined) ?? {} - const servers = { ...(mcp.servers as Record | undefined) } - - servers[serverId] = toV2McpServerConfig(mcpServerConfig, window.location.origin) await onUpdate({ ...config.content, mcp: { ...mcp, - servers, + servers: { ...(mcp.servers as Record | undefined), [serverId]: mcpServerConfig }, }, }) @@ -325,7 +329,7 @@ export function AddMcpServerDialog({ open, onOpenChange, onUpdate }: AddMcpServe className="bg-background border-border" />

- Timeout in milliseconds for fetching tools (default: 5000) + Timeout in milliseconds for listing and calling tools

diff --git a/frontend/src/components/settings/McpManager.test.tsx b/frontend/src/components/settings/McpManager.test.tsx new file mode 100644 index 00000000..e2104c8d --- /dev/null +++ b/frontend/src/components/settings/McpManager.test.tsx @@ -0,0 +1,110 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { render, screen, waitFor } from '@testing-library/react' +import userEvent from '@testing-library/user-event' +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import { FetchError } from '@opencode-manager/shared' +import { McpManager } from './McpManager' + +const { mockRemoveServer, mockToastError, mockStatus } = vi.hoisted(() => ({ + mockRemoveServer: vi.fn(), + mockToastError: vi.fn(), + mockStatus: { + configured: { status: 'connected' as const }, + 'legacy-server': { status: 'disabled' as const }, + }, +})) + +vi.mock('@/hooks/useMcpServers', () => ({ + useMcpServers: () => ({ + status: mockStatus, + isLoading: false, + refetch: vi.fn(), + connect: vi.fn(), + disconnect: vi.fn(), + removeAuthAsync: vi.fn(), + isRemovingAuth: false, + addServerAsync: vi.fn(), + isAddingServer: false, + }), +})) + +vi.mock('@/api/mcp', () => ({ + mcpApi: { removeServer: mockRemoveServer, startAuth: vi.fn(), getStatus: vi.fn() }, +})) + +vi.mock('@/lib/toast', () => ({ + showToast: { success: vi.fn(), error: mockToastError, info: vi.fn(), loading: vi.fn(), warning: vi.fn(), dismiss: vi.fn() }, +})) + +const config = { + content: { + mcp: { + servers: { + configured: { type: 'local', command: ['npx', 'server'] }, + }, + }, + }, +} + +function renderManager(onUpdate: (content: Record) => Promise) { + const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } }) + return render( + + + , + ) +} + +async function deleteServer(user: ReturnType, displayName: string) { + await user.click(screen.getByLabelText(`Actions for ${displayName}`)) + await user.click(screen.getByText('Delete Server')) + await user.click(screen.getByRole('button', { name: 'Delete' })) +} + +describe('McpManager', () => { + beforeEach(() => { + vi.clearAllMocks() + mockRemoveServer.mockResolvedValue(undefined) + }) + + it('lists servers reported by the running server that are not in mcp.servers', () => { + renderManager(vi.fn()) + + expect(screen.getByText('Configured')).toBeInTheDocument() + expect(screen.getByText('Legacy server')).toBeInTheDocument() + }) + + it('removes only the mcp.servers entry when deleting a configured server', async () => { + const onUpdate = vi.fn<(content: Record) => Promise>().mockResolvedValue(undefined) + const user = userEvent.setup() + renderManager(onUpdate) + + await deleteServer(user, 'Configured') + + await waitFor(() => expect(mockRemoveServer).toHaveBeenCalledWith('configured')) + expect(onUpdate).toHaveBeenCalledWith({ mcp: { servers: {} } }) + }) + + it('skips the config update for a server that is not in mcp.servers', async () => { + const onUpdate = vi.fn<(content: Record) => Promise>().mockResolvedValue(undefined) + const user = userEvent.setup() + renderManager(onUpdate) + + await deleteServer(user, 'Legacy server') + + await waitFor(() => expect(mockRemoveServer).toHaveBeenCalledWith('legacy-server')) + expect(onUpdate).not.toHaveBeenCalled() + }) + + it('surfaces the shadowed-removal message from the backend', async () => { + const message = 'Cannot remove mcp.servers.configured: defined in opencode.json, not in opencode.jsonc' + const onUpdate = vi.fn<(content: Record) => Promise>().mockRejectedValue(new FetchError(message, 409)) + const user = userEvent.setup() + renderManager(onUpdate) + + await deleteServer(user, 'Configured') + + await waitFor(() => expect(mockToastError).toHaveBeenCalledWith(message)) + expect(mockRemoveServer).not.toHaveBeenCalled() + }) +}) diff --git a/frontend/src/components/settings/McpManager.tsx b/frontend/src/components/settings/McpManager.tsx index fdf48086..81d3313f 100644 --- a/frontend/src/components/settings/McpManager.tsx +++ b/frontend/src/components/settings/McpManager.tsx @@ -14,6 +14,8 @@ import type { McpAuthStartResponse } from '@/api/mcp' import { mcpApi } from '@/api/mcp' import { mcpServersFromConfig } from '@opencode-manager/shared/opencode' import { showToast } from '@/lib/toast' +import { getOpenCodeApiErrorMessage } from '@/lib/opencode-errors' +import { formatMcpServerName } from '@/lib/mcp' interface McpManagerProps { config: { @@ -24,16 +26,9 @@ interface McpManagerProps { function withoutMcpServer(mcp: unknown, serverId: string): Record { const current = (mcp && typeof mcp === 'object' ? mcp : {}) as Record - const next: Record = { ...current } - delete next[serverId] - - if (current.servers && typeof current.servers === 'object') { - const servers = { ...(current.servers as Record) } - delete servers[serverId] - next.servers = servers - } - - return next + const servers = { ...(current.servers as Record | undefined) } + delete servers[serverId] + return { ...current, servers } } export function McpManager({ config, onUpdate }: McpManagerProps) { @@ -55,10 +50,14 @@ export function McpManager({ config, onUpdate }: McpManagerProps) { } = useMcpServers() const mcpServers = useMemo(() => mcpServersFromConfig(config?.content?.mcp), [config]) + const serverIds = useMemo( + () => [...new Set([...Object.keys(mcpServers), ...Object.keys(mcpStatus ?? {})])], + [mcpServers, mcpStatus], + ) const deleteServerMutation = useMutation({ mutationFn: async (serverId: string) => { - if (config) { + if (config && mcpServers[serverId]) { await onUpdate({ ...config.content, mcp: withoutMcpServer(config.content.mcp, serverId), @@ -72,8 +71,8 @@ export function McpManager({ config, onUpdate }: McpManagerProps) { await refetchStatus() setDeleteConfirmServer(null) }, - onError: () => { - showToast.error('Failed to delete MCP server') + onError: (error) => { + showToast.error(getOpenCodeApiErrorMessage(error, 'Failed to delete MCP server')) }, }) @@ -199,11 +198,11 @@ export function McpManager({ config, onUpdate }: McpManagerProps) { - {Object.entries(mcpServers).map(([serverId, serverConfig]) => { + {serverIds.map((serverId) => { const status = mcpStatus?.[serverId] const isConnected = status?.status === 'connected' const errorMessage = getErrorMessage(serverId) @@ -212,7 +211,7 @@ export function McpManager({ config, onUpdate }: McpManagerProps) { setRemoveAuthConfirmServer(null)} title="Remove Authentication" description="This will remove the OAuth credentials for this MCP server. You will need to re-authenticate to use this server again." - itemName={mcpServers[removeAuthConfirmServer || ''] ? getDisplayName(removeAuthConfirmServer || '') : ''} + itemName={removeAuthConfirmServer ? formatMcpServerName(removeAuthConfirmServer) : ''} isDeleting={isRemovingAuth} />
) - - function getDisplayName(serverId: string): string { - const name = serverId.replace(/[-_]/g, ' ') - return name.charAt(0).toUpperCase() + name.slice(1) - } } diff --git a/frontend/src/components/settings/McpServerCard.tsx b/frontend/src/components/settings/McpServerCard.tsx index 85570b1f..d7a80a08 100644 --- a/frontend/src/components/settings/McpServerCard.tsx +++ b/frontend/src/components/settings/McpServerCard.tsx @@ -2,12 +2,14 @@ import { Badge } from '@/components/ui/badge' import { Switch } from '@/components/ui/switch' import { Button } from '@/components/ui/button' import { SettingsListRow, type SettingsListRowAction } from '@/components/ui/settings-list' -import { XCircle, AlertCircle, Key, Shield, Trash2, RefreshCw } from 'lucide-react' +import { XCircle, Key, Shield, Trash2, RefreshCw } from 'lucide-react' import type { McpStatus, McpServerConfig } from '@/api/mcp' +import { formatMcpServerName } from '@/lib/mcp' +import { McpStatusBadge } from './McpStatusBadge' interface McpServerCardProps { serverId: string - serverConfig: McpServerConfig + serverConfig?: McpServerConfig status?: McpStatus isConnected: boolean errorMessage: string | null @@ -20,40 +22,8 @@ interface McpServerCardProps { onDeleteServer: (serverId: string, serverName: string) => void } -function getStatusBadge(status: McpStatus) { - switch (status.status) { - case 'connected': - return Connected - case 'pending': - return Connecting - case 'disabled': - return Disabled - case 'failed': - return ( - - - Failed - - ) - case 'needs_auth': - return ( - - - Auth Required - - ) - default: - return Unknown - } -} - -function getServerDisplayName(serverId: string): string { - const name = serverId.replace(/[-_]/g, ' ') - return name.charAt(0).toUpperCase() + name.slice(1) -} - -function getServerDescription(serverConfig: McpServerConfig): string { - if (serverConfig.type === 'local' && serverConfig.command) { +function getServerDescription(serverConfig: McpServerConfig | undefined): string { + if (serverConfig?.type === 'local') { const command = serverConfig.command.join(' ') if (command.includes('filesystem')) return 'File system access' if (command.includes('git')) return 'Git repository operations' @@ -66,7 +36,7 @@ function getServerDescription(serverConfig: McpServerConfig): string { if (command.includes('fetch')) return 'HTTP requests' if (command.includes('memory')) return 'Persistent memory' return `Local command: ${command}` - } else if (serverConfig.type === 'remote' && serverConfig.url) { + } else if (serverConfig?.type === 'remote') { return `Remote server: ${serverConfig.url}` } return 'MCP server' @@ -90,7 +60,7 @@ export function McpServerCard({ const isOAuthServer = !!status?.integrationID const connectedWithOAuth = isOAuthServer && isConnected const showAuthButton = needsAuth || (isOAuthServer && status?.status === 'failed') - const displayName = getServerDisplayName(serverId) + const displayName = formatMcpServerName(serverId) const actions: SettingsListRowAction[] = [] if (showAuthButton && onAuthenticate) { @@ -114,7 +84,7 @@ export function McpServerCard({ )} - {status ? getStatusBadge(status) : ( + {status ? : ( Loading... )} diff --git a/frontend/src/components/settings/McpStatusBadge.tsx b/frontend/src/components/settings/McpStatusBadge.tsx new file mode 100644 index 00000000..cbb51b35 --- /dev/null +++ b/frontend/src/components/settings/McpStatusBadge.tsx @@ -0,0 +1,34 @@ +import { Badge } from '@/components/ui/badge' +import { AlertCircle, Key } from 'lucide-react' +import type { McpStatus } from '@/api/mcp' + +interface McpStatusBadgeProps { + status: McpStatus +} + +export function McpStatusBadge({ status }: McpStatusBadgeProps) { + switch (status.status) { + case 'connected': + return Connected + case 'pending': + return Connecting + case 'disabled': + return Disabled + case 'failed': + return ( + + + Failed + + ) + case 'needs_auth': + return ( + + + Auth Required + + ) + default: + return Unknown + } +} diff --git a/frontend/src/components/settings/OAuthAuthorizeDialog.tsx b/frontend/src/components/settings/OAuthAuthorizeDialog.tsx index 0cffce05..5cc1ae73 100644 --- a/frontend/src/components/settings/OAuthAuthorizeDialog.tsx +++ b/frontend/src/components/settings/OAuthAuthorizeDialog.tsx @@ -5,25 +5,26 @@ import { Badge } from '@/components/ui/badge' import { ExternalLink } from 'lucide-react' import { oauthApi, + type FormAnswer, + type FormValue, + type IntegrationMethod, + type IntegrationOAuthMethod, type OAuthAuthorizeResponse, - type PromptAnswer, - type PromptAnswerValue, - type ProviderAuthMethod, } from '@/api/oauth' -import { buildAnswer, defaultAnswer, hasFields, hasMissingAnswers, setAnswerValue, visibleFields } from '@/lib/oauthFields' +import { buildAnswer, hasFields, hasMissingAnswers, resolveAnswers, setAnswerValue, visibleFields } from '@/lib/formFields' import { mapOAuthError } from '@/lib/oauthErrors' import { ProviderAuthField } from './ProviderAuthField' interface OAuthAuthorizeDialogProps { providerId: string providerName: string - methods: ProviderAuthMethod[] + methods: IntegrationMethod[] open: boolean onOpenChange: (open: boolean) => void onSuccess: (response: OAuthAuthorizeResponse, methodID: string) => void } -function isBrowserLocalMethod(method: ProviderAuthMethod): boolean { +function isBrowserLocalMethod(method: IntegrationOAuthMethod): boolean { return method.label.toLowerCase().includes('browser') } @@ -38,29 +39,29 @@ export function OAuthAuthorizeDialog({ const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState(null) const [selectedMethodID, setSelectedMethodID] = useState(null) - const [answers, setAnswers] = useState>({}) + const [answers, setAnswers] = useState>({}) const [autoStarted, setAutoStarted] = useState(false) const oauthMethods = useMemo(() => { return methods - .filter((method) => method.type === 'oauth') + .filter((method): method is IntegrationOAuthMethod => method.type === 'oauth') .filter((method) => !(providerId === 'openai' && isBrowserLocalMethod(method))) }, [methods, providerId]) const getAnswer = useCallback( - (method: ProviderAuthMethod) => ({ ...defaultAnswer(method), ...answers[method.id] }), + (method: IntegrationOAuthMethod) => resolveAnswers(method.form, answers[method.id]), [answers], ) - const handleAnswerChange = useCallback((methodID: string, key: string, value: PromptAnswerValue | undefined) => { + const handleAnswerChange = useCallback((methodID: string, key: string, value: FormValue | undefined) => { setAnswers((prev) => setAnswerValue(prev, methodID, key, value)) }, []) - const handleAuthorize = useCallback(async (method: ProviderAuthMethod) => { + const handleAuthorize = useCallback(async (method: IntegrationOAuthMethod) => { const answer = getAnswer(method) - const fields = visibleFields(method, answer) + const fields = visibleFields(method.form ?? [], answer) - if (hasMissingAnswers(method, answer)) { + if (hasMissingAnswers(method.form ?? [], answer)) { setError('Please complete all required authentication fields') setSelectedMethodID(method.id) return @@ -74,7 +75,7 @@ export function OAuthAuthorizeDialog({ const response = await oauthApi.authorize( providerId, method.id, - fields.length > 0 ? buildAnswer(method, answer) : undefined, + fields.length > 0 ? buildAnswer(method.form ?? [], answer) : undefined, ) onSuccess(response, method.id) } catch (err) { @@ -89,17 +90,17 @@ export function OAuthAuthorizeDialog({ const method = oauthMethods[0] setAutoStarted(true) setSelectedMethodID(method.id) - if (!hasFields(method)) { + if (!hasFields(method.form)) { void handleAuthorize(method) } } }, [open, oauthMethods, autoStarted, isLoading, handleAuthorize]) - const handleMethodSelection = (method: ProviderAuthMethod) => { + const handleMethodSelection = (method: IntegrationOAuthMethod) => { setError(null) setSelectedMethodID(method.id) - if (!hasFields(method)) { + if (!hasFields(method.form)) { void handleAuthorize(method) } } @@ -131,8 +132,8 @@ export function OAuthAuthorizeDialog({ {oauthMethods.map((method) => { const isBrowserLocal = isBrowserLocalMethod(method) const answer = getAnswer(method) - const fields = visibleFields(method, answer) - const canSubmit = !hasMissingAnswers(method, answer) + const fields = visibleFields(method.form ?? [], answer) + const canSubmit = !hasMissingAnswers(method.form ?? [], answer) return (
@@ -155,7 +156,7 @@ export function OAuthAuthorizeDialog({ )}
- {selectedMethodID === method.id && hasFields(method) && ( + {selectedMethodID === method.id && hasFields(method.form) && (
{fields.map((field) => ( { const { showToast } = await import('@/lib/toast') await waitFor(() => expect(showToast.success).toHaveBeenCalledWith('Configuration updated')) - expect(showToast.success).not.toHaveBeenCalledWith('Configuration saved. Restart the server to apply changes.') + expect(showToast.success).not.toHaveBeenCalledWith('Configuration saved, but OpenCode could not reload it. Restart the server to apply changes.') }) it('asks for a restart after a semantic structured change', async () => { @@ -505,7 +505,7 @@ describe('OpenCodeConfigManager', () => { const { showToast } = await import('@/lib/toast') await waitFor(() => { - expect(showToast.success).toHaveBeenCalledWith('Configuration saved. Restart the server to apply changes.') + expect(showToast.success).toHaveBeenCalledWith('Configuration saved, but OpenCode could not reload it. Restart the server to apply changes.') }) }) diff --git a/frontend/src/components/settings/OpenCodeConfigManager.tsx b/frontend/src/components/settings/OpenCodeConfigManager.tsx index 21d9e2d4..a86a487c 100644 --- a/frontend/src/components/settings/OpenCodeConfigManager.tsx +++ b/frontend/src/components/settings/OpenCodeConfigManager.tsx @@ -160,7 +160,7 @@ export function OpenCodeConfigManager() { const applyOpenCodeConfigSave = (result: OpenCodeConfigSaveResponse) => { queryClient.setQueryData(OPEN_CODE_CONFIG_QUERY_KEY, result) if (result.restartRequired) { - showToast.success('Configuration saved. Restart the server to apply changes.') + showToast.success('Configuration saved, but OpenCode could not reload it. Restart the server to apply changes.') } else { showToast.success('Configuration updated') } @@ -210,7 +210,7 @@ export function OpenCodeConfigManager() {

- Configuration changes are saved but require a server restart to take effect. + Some saved changes require a server restart to take effect.