mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(settings): add manager logs viewer (#344)
* feat(settings): add manager logs viewer with backend log capture * style(settings): polish logs viewer layout for mobile and full-height output
This commit is contained in:
1 parent
4862d9c5cb
commit
94e3e1917d
28 files changed
+2123
-39
No files matched your search
@@ -58,6 +58,14 @@ export const DEFAULTS = {
|
||||
LOG_LEVEL: 'info',
|
||||
},
|
||||
|
||||
LOGS: {
|
||||
BUFFER_CAPACITY: 2000,
|
||||
MAX_ENTRY_LENGTH: 4000,
|
||||
DEFAULT_PAGE_SIZE: 500,
|
||||
MAX_PAGE_SIZE: 1000,
|
||||
POLL_INTERVAL_MS: 3000,
|
||||
},
|
||||
|
||||
SSE: {
|
||||
RECONNECT_DELAY_MS: 1000,
|
||||
MAX_RECONNECT_DELAY_MS: 30000,
|
||||
|
||||
@@ -11,3 +11,4 @@ export * from './schedule'
|
||||
export * from './skills'
|
||||
export * from './internal-assistant'
|
||||
export * from './session-pins'
|
||||
export * from './logs'
|
||||
@@ -0,0 +1,37 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const MANAGER_LOG_LEVELS = ['debug', 'info', 'warn', 'error'] as const
|
||||
export const MANAGER_LOG_SOURCES = ['manager', 'opencode'] as const
|
||||
|
||||
export const ManagerLogLevelSchema = z.enum(MANAGER_LOG_LEVELS)
|
||||
export const ManagerLogSourceSchema = z.enum(MANAGER_LOG_SOURCES)
|
||||
|
||||
export const ManagerLogEntrySchema = z.object({
|
||||
seq: z.number().int().positive(),
|
||||
timestamp: z.string(),
|
||||
level: ManagerLogLevelSchema,
|
||||
source: ManagerLogSourceSchema,
|
||||
message: z.string(),
|
||||
})
|
||||
|
||||
export const ManagerLogQuerySchema = z.object({
|
||||
afterSeq: z.coerce.number().int().nonnegative().optional(),
|
||||
limit: z.coerce.number().int().positive().optional(),
|
||||
level: ManagerLogLevelSchema.optional(),
|
||||
source: ManagerLogSourceSchema.optional(),
|
||||
})
|
||||
|
||||
export const ManagerLogsResponseSchema = z.object({
|
||||
entries: z.array(ManagerLogEntrySchema),
|
||||
instanceId: z.string().min(1),
|
||||
latestSeq: z.number().int().nonnegative(),
|
||||
oldestSeq: z.number().int().nonnegative(),
|
||||
dropped: z.number().int().nonnegative(),
|
||||
capacity: z.number().int().positive(),
|
||||
})
|
||||
|
||||
export type ManagerLogLevel = z.infer<typeof ManagerLogLevelSchema>
|
||||
export type ManagerLogSource = z.infer<typeof ManagerLogSourceSchema>
|
||||
export type ManagerLogEntry = z.infer<typeof ManagerLogEntrySchema>
|
||||
export type ManagerLogQuery = z.infer<typeof ManagerLogQuerySchema>
|
||||
export type ManagerLogsResponse = z.infer<typeof ManagerLogsResponseSchema>
|
||||
Reference in new issue
Block a user