mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(ocm-cli): workspace repo sync and manager token targeting (#233)
This commit is contained in:
1 parent
e12f319592
commit
a86e4b1238
69 files changed
+4858
-161
No files matched your search
@@ -20,6 +20,9 @@
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"zod": "^4.1.12"
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"dotenv": "^17.2.3"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const OpenCodeTargetStateSchema = z.enum([
|
||||
'missing',
|
||||
'starting',
|
||||
'healthy',
|
||||
'unhealthy',
|
||||
'failed',
|
||||
'stopped',
|
||||
])
|
||||
|
||||
export const OpenCodeTargetSchema = z.object({
|
||||
repoId: z.number(),
|
||||
state: OpenCodeTargetStateSchema,
|
||||
openCodeUrl: z.string().optional(),
|
||||
token: z.string().optional(),
|
||||
startedAt: z.number().optional(),
|
||||
lastUsedAt: z.number().optional(),
|
||||
lastError: z.string().optional(),
|
||||
reused: z.boolean(),
|
||||
})
|
||||
|
||||
export const EnsureOpenCodeTargetRequestSchema = z.object({
|
||||
workspaceId: z.string().optional(),
|
||||
clientId: z.string().optional(),
|
||||
})
|
||||
|
||||
export const EnsureOpenCodeTargetResponseSchema = z.object({
|
||||
repoId: z.number(),
|
||||
state: OpenCodeTargetStateSchema,
|
||||
openCodeUrl: z.string(),
|
||||
headers: z.record(z.string(), z.string()),
|
||||
reused: z.boolean(),
|
||||
})
|
||||
|
||||
export const SyncRepoSessionRequestSchema = z.object({
|
||||
sessionId: z.string(),
|
||||
reason: z.enum(['idle', 'completed', 'stop', 'manual']),
|
||||
})
|
||||
|
||||
export const SyncRepoSessionResponseSchema = z.object({
|
||||
repoId: z.number(),
|
||||
sessionId: z.string(),
|
||||
replayedEvents: z.number(),
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
import { z } from 'zod'
|
||||
import {
|
||||
OpenCodeTargetStateSchema,
|
||||
OpenCodeTargetSchema,
|
||||
EnsureOpenCodeTargetRequestSchema,
|
||||
EnsureOpenCodeTargetResponseSchema,
|
||||
SyncRepoSessionRequestSchema,
|
||||
SyncRepoSessionResponseSchema,
|
||||
} from '../schemas/opencode-target'
|
||||
|
||||
export type OpenCodeTargetState = z.infer<typeof OpenCodeTargetStateSchema>
|
||||
export type OpenCodeTarget = z.infer<typeof OpenCodeTargetSchema>
|
||||
export type EnsureOpenCodeTargetRequest = z.infer<typeof EnsureOpenCodeTargetRequestSchema>
|
||||
export type EnsureOpenCodeTargetResponse = z.infer<typeof EnsureOpenCodeTargetResponseSchema>
|
||||
export type SyncRepoSessionRequest = z.infer<typeof SyncRepoSessionRequestSchema>
|
||||
export type SyncRepoSessionResponse = z.infer<typeof SyncRepoSessionResponseSchema>
|
||||
Reference in new issue
Block a user