feat(schedules): support scheduling jobs for the Assistant workspace (#254)

* feat(schedules): support scheduling jobs for the Assistant workspace

* refactor(schedules): extract assistant repo constants, rename workspace to schedule-target

* feat(navigation): add schedules link to session drawer menu

* fix(schedules): document Assistant repoId=0 in generated schedule-management skill
This commit is contained in:
Chris Scott authored and GitHub committed 2026-06-05 11:16:31 -04:00
1 parent 9479e1f662
commit 70cb62b77b
18 files changed
+402 -115

No files matched your search

+7 -2
View File
@@ -13,6 +13,7 @@ import {
ensureDirectoryExists,
} from './file-operations'
import { OpenCodeConfigSchema } from '@opencode-manager/shared/schemas'
import { ASSISTANT_REPO_ID, ASSISTANT_REPO_PATH } from '@opencode-manager/shared/utils'
import { getReposPath, ENV } from '@opencode-manager/shared/config/env'
import type { Database } from 'bun:sqlite'
import { getOrCreateInternalToken } from './internal-token'
@@ -21,7 +22,7 @@ import { logger } from '../utils/logger'
const ASSISTANT_WARMUP_OPENCODE_TIMEOUT_MS = 90000
const ASSISTANT_MODE_DIR = 'assistant'
const ASSISTANT_MODE_DIR = ASSISTANT_REPO_PATH
const ASSISTANT_MODE_RELATIVE_PATH = 'repos/assistant'
const ASSISTANT_AGENTS_MD_FILENAME = 'AGENTS.md'
const ASSISTANT_OPENCODE_CONFIG_FILENAME = 'opencode.json'
@@ -52,7 +53,7 @@ export function getAssistantModeDirectory(): string {
export function buildAssistantRepo(): Repo {
return {
id: 0,
id: ASSISTANT_REPO_ID,
localPath: ASSISTANT_MODE_DIR,
fullPath: getAssistantModeDirectory(),
defaultBranch: 'main',
@@ -339,6 +340,10 @@ Authorization: Bearer <token>
\`${internalBaseUrl}\`
## Assistant Schedules
Use repo ID \`0\` for the built-in Assistant. For example, use \`/repos/0/schedules\` to list or create schedule jobs that run in the Assistant workspace.
## Endpoints
### GET /schedules/all
+2 -1
View File
@@ -39,6 +39,7 @@ import { sseAggregator, type SSEEvent } from './sse-aggregator'
import { getErrorMessage } from '../utils/error-utils'
import { logger } from '../utils/logger'
import { buildAssistantRepo } from './assistant-mode'
import { ASSISTANT_REPO_ID } from '@opencode-manager/shared/utils'
class ScheduleServiceError extends Error {
status: number
@@ -1056,7 +1057,7 @@ export class ScheduleService {
}
private assertRepo(repoId: number) {
if (repoId === 0) {
if (repoId === ASSISTANT_REPO_ID) {
return { ...buildAssistantRepo(), lastAccessedAt: Date.now(), isLocal: true, currentBranch: undefined }
}
const repo = getRepoById(this.db, repoId)