mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix: update settings and skills handling with assistant redirect (#220)
* fix: enable swipe-back suspension on more drawer and remove unused variable * refactor(frontend): improve dialog component and settings navigation * fix: disable route swipe suspension in MoreDrawer to prevent unintended navigation * fix(frontend): enable swipe-back suspension on more drawer route * refactor(frontend): improve mobile navigation drawer and tab bar * feat: add schedules service and workspace hook with navigation updates * chore: add workspace hook, schedules library, and tests * fix: prevent MoreDrawer sentinel from undoing navigation * feat: per-agent model selection and UI refinements (#217) * feat: per-agent model selection and UI refinements - Add agentModels store with setAgentModel/getAgentModel - PromptInput uses session model priority and stores agent model on change - useContextUsage derives model from assistant message instead of global - Migrate sub-agent/subtask badges from purple to blue with refined styling - Fix MoreDrawer sentinel to skip history-back on navigation * refactor: improve per-agent model selection and task tool call status indicators * feat: add repo management skill and internal repos API * fix: improve assistant session launcher and UI components * fix: update atomic-json test assertions * refactor: split Assistant Mode instructions between AGENTS.md and assistant.md * loop: todo-header-mobile completed after 3 iterations (#218) * loop: stt-perf-1 completed after 5 iterations * fix: load audio worklet per recording context * fix: canonicalize assistant navigation routes * fix: adjust scroll-up threshold for header visibility * fix: update settings and skills handling with assistant redirect * refactor: simplify context usage indicator and extract token sum helper * feat: add currently selected model row to popover and fix responsive truncate
This commit is contained in:
1 parent
c7291518c8
commit
74cdeb3926
73 files changed
+4073
-632
No files matched your search
@@ -7,6 +7,7 @@ import { createScheduleRoutes } from '../schedules'
|
||||
import { createInternalTokenMiddleware } from '../../auth/internal-token-middleware'
|
||||
import { createInternalNotificationRoutes } from './notifications'
|
||||
import { createInternalSettingsRoutes } from './settings'
|
||||
import { createInternalRepoRoutes } from './repos'
|
||||
|
||||
export function createInternalRoutes(
|
||||
db: Database,
|
||||
@@ -20,6 +21,7 @@ export function createInternalRoutes(
|
||||
app.route('/notifications', createInternalNotificationRoutes(notificationService))
|
||||
app.route('/settings', createInternalSettingsRoutes(settingsService))
|
||||
const repos = new Hono()
|
||||
repos.route('/', createInternalRepoRoutes(db, settingsService))
|
||||
repos.route('/:id/schedules', createScheduleRoutes(scheduleService))
|
||||
app.route('/repos', repos)
|
||||
return app
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Hono } from 'hono'
|
||||
import type { Database } from 'bun:sqlite'
|
||||
import type { SettingsService } from '../../services/settings'
|
||||
import { listRepos } from '../../db/queries'
|
||||
import { logger } from '../../utils/logger'
|
||||
import { getErrorMessage } from '../../utils/error-utils'
|
||||
|
||||
export function createInternalRepoRoutes(db: Database, settingsService: SettingsService) {
|
||||
const app = new Hono()
|
||||
|
||||
app.get('/', (c) => {
|
||||
try {
|
||||
const settings = settingsService.getSettings()
|
||||
const repos = listRepos(db, settings.preferences.repoOrder)
|
||||
return c.json({ repos })
|
||||
} catch (error) {
|
||||
logger.error('Failed to list internal repos:', error)
|
||||
return c.json({ error: getErrorMessage(error) }, 500)
|
||||
}
|
||||
})
|
||||
|
||||
return app
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Hono } from 'hono'
|
||||
import type { ContentfulStatusCode } from 'hono/utils/http-status'
|
||||
import type { Database } from 'bun:sqlite'
|
||||
import type { Repo } from '@opencode-manager/shared/types'
|
||||
import { DiscoverReposRequestSchema, AssistantModeInitRequestSchema } from '@opencode-manager/shared/schemas'
|
||||
import { listRepos, getRepoById, updateLastAccessed, updateRepoConfigName } from '../db/queries'
|
||||
import * as repoService from '../services/repo'
|
||||
@@ -17,7 +18,7 @@ import { createRepoGitRoutes } from './repo-git'
|
||||
import { createScheduleRoutes } from './schedules'
|
||||
import type { GitAuthService } from '../services/git-auth'
|
||||
import { ScheduleService } from '../services/schedules'
|
||||
import { ensureAssistantMode, getAssistantModeStatus } from '../services/assistant-mode'
|
||||
import { ensureAssistantMode, getAssistantModeStatus, getAssistantModeDirectory } from '../services/assistant-mode'
|
||||
import path from 'path'
|
||||
|
||||
async function restartOpenCode(openCodeSupervisor?: OpenCodeSupervisor): Promise<void> {
|
||||
@@ -155,13 +156,36 @@ app.get('/', async (c) => {
|
||||
app.get('/:id', async (c) => {
|
||||
try {
|
||||
const id = parseInt(c.req.param('id'))
|
||||
const repo = getRepoById(database, id)
|
||||
|
||||
let repo: Repo | null
|
||||
let isAssistant = false
|
||||
if (id === 0) {
|
||||
isAssistant = true
|
||||
repo = {
|
||||
id: 0,
|
||||
repoUrl: undefined,
|
||||
localPath: 'assistant',
|
||||
sourcePath: undefined,
|
||||
fullPath: getAssistantModeDirectory(),
|
||||
branch: undefined,
|
||||
defaultBranch: 'main',
|
||||
cloneStatus: 'ready',
|
||||
clonedAt: Date.now(),
|
||||
lastPulled: undefined,
|
||||
lastAccessedAt: undefined,
|
||||
openCodeConfigName: undefined,
|
||||
isWorktree: false,
|
||||
isLocal: false,
|
||||
}
|
||||
} else {
|
||||
repo = getRepoById(database, id)
|
||||
}
|
||||
|
||||
if (!repo) {
|
||||
return c.json({ error: 'Repo not found' }, 404)
|
||||
}
|
||||
|
||||
const currentBranch = await repoService.getCurrentBranch(repo, gitAuthService.getGitEnvironment())
|
||||
const currentBranch = isAssistant ? undefined : await repoService.getCurrentBranch(repo, gitAuthService.getGitEnvironment())
|
||||
|
||||
return c.json({ ...repo, currentBranch })
|
||||
} catch (error: unknown) {
|
||||
@@ -397,7 +421,28 @@ app.get('/', async (c) => {
|
||||
app.get('/:id/assistant-mode', async (c) => {
|
||||
try {
|
||||
const id = parseInt(c.req.param('id'))
|
||||
const repo = getRepoById(database, id)
|
||||
|
||||
let repo: Repo | null
|
||||
if (id === 0) {
|
||||
repo = {
|
||||
id: 0,
|
||||
repoUrl: undefined,
|
||||
localPath: 'assistant',
|
||||
sourcePath: undefined,
|
||||
fullPath: '',
|
||||
branch: undefined,
|
||||
defaultBranch: 'main',
|
||||
cloneStatus: 'ready',
|
||||
clonedAt: Date.now(),
|
||||
lastPulled: undefined,
|
||||
lastAccessedAt: undefined,
|
||||
openCodeConfigName: undefined,
|
||||
isWorktree: false,
|
||||
isLocal: false,
|
||||
}
|
||||
} else {
|
||||
repo = getRepoById(database, id)
|
||||
}
|
||||
|
||||
if (!repo) {
|
||||
return c.json({ error: 'Repo not found' }, 404)
|
||||
@@ -414,7 +459,28 @@ app.get('/', async (c) => {
|
||||
app.post('/:id/assistant-mode', async (c) => {
|
||||
try {
|
||||
const id = parseInt(c.req.param('id'))
|
||||
const repo = getRepoById(database, id)
|
||||
|
||||
let repo: Repo | null
|
||||
if (id === 0) {
|
||||
repo = {
|
||||
id: 0,
|
||||
repoUrl: undefined,
|
||||
localPath: 'assistant',
|
||||
sourcePath: undefined,
|
||||
fullPath: '',
|
||||
branch: undefined,
|
||||
defaultBranch: 'main',
|
||||
cloneStatus: 'ready',
|
||||
clonedAt: Date.now(),
|
||||
lastPulled: undefined,
|
||||
lastAccessedAt: undefined,
|
||||
openCodeConfigName: undefined,
|
||||
isWorktree: false,
|
||||
isLocal: false,
|
||||
}
|
||||
} else {
|
||||
repo = getRepoById(database, id)
|
||||
}
|
||||
|
||||
if (!repo) {
|
||||
return c.json({ error: 'Repo not found' }, 404)
|
||||
|
||||
@@ -1126,8 +1126,9 @@ export function createSettingsRoutes(db: Database, gitAuthService: GitAuthServic
|
||||
if (repoId !== undefined && isNaN(repoId)) {
|
||||
return c.json({ error: 'Invalid repoId' }, 400)
|
||||
}
|
||||
const directory = c.req.query('directory')
|
||||
|
||||
const skills = await listManagedSkills(db, openCodeClient, repoId)
|
||||
const skills = await listManagedSkills(db, openCodeClient, repoId, directory)
|
||||
return c.json(skills)
|
||||
} catch (error) {
|
||||
logger.error('Failed to list skills:', error)
|
||||
|
||||
Reference in new issue
Block a user