Compare commits

...

2 Commits

Author SHA1 Message Date
Nikhil Sonti
341025d8e9 fix: correct COMPOSE_RESOURCE path for new service depth
The move to src/api/services/ added one directory level, so the
import.meta.dir-relative path to apps/server/resources/openclaw-compose.yml
needed an extra '..'. Without this, setup() would fail with ENOENT
on every first run. Caught by Greptile review on PR #693.
2026-04-13 17:24:59 -07:00
Nikhil Sonti
4599934bb4 refactor: consolidate services under api/services/
Move openclaw/ and terminal/ service modules from src/services/ into
src/api/services/ so all server-side services live in one directory
alongside chat-service, klavis, mcp, and sdk. Update relative imports
in moved files and all callers.
2026-04-13 17:13:51 -07:00
13 changed files with 13 additions and 13 deletions

View File

@@ -15,8 +15,8 @@ import {
OpenClawAgentNotFoundError,
OpenClawInvalidAgentNameError,
OpenClawProtectedAgentError,
} from '../../services/openclaw/errors'
import { getOpenClawService } from '../../services/openclaw/openclaw-service'
} from '../services/openclaw/errors'
import { getOpenClawService } from '../services/openclaw/openclaw-service'
export function createOpenClawRoutes() {
return new Hono()

View File

@@ -4,12 +4,12 @@ import { logger } from '../../lib/logger'
import {
parseTerminalClientMessage,
serializeTerminalServerMessage,
} from '../../services/terminal/terminal-protocol'
} from '../services/terminal/terminal-protocol'
import {
createTerminalSession,
TERMINAL_HOME_DIR,
type TerminalSession,
} from '../../services/terminal/terminal-session'
} from '../services/terminal/terminal-session'
import type { Env } from '../types'
export const TERMINAL_WS_PATH = '/terminal/ws'

View File

@@ -22,7 +22,6 @@ import { initializeOAuth } from '../lib/clients/oauth'
import { getDb } from '../lib/db'
import { logger } from '../lib/logger'
import { Sentry } from '../lib/sentry'
import { getPodmanRuntime } from '../services/openclaw/podman-runtime'
import { createChatRoutes } from './routes/chat'
import { createCreditsRoutes } from './routes/credits'
import { createHealthRoute } from './routes/health'
@@ -43,6 +42,7 @@ import {
connectKlavisProxy,
type KlavisProxyHandle,
} from './services/klavis/strata-proxy'
import { getPodmanRuntime } from './services/openclaw/podman-runtime'
import type { Env, HttpServerConfig } from './types'
import { defaultCorsConfig } from './utils/cors'
import { requireTrustedAppOrigin } from './utils/request-auth'

View File

@@ -13,7 +13,7 @@ import crypto from 'node:crypto'
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { join } from 'node:path'
import { OPENCLAW_CONTAINER_HOME } from '@browseros/shared/constants/openclaw'
import { logger } from '../../lib/logger'
import { logger } from '../../../lib/logger'
const RPC_TIMEOUT_MS = 15_000
const RECONNECT_DELAY_MS = 2_000

View File

@@ -13,8 +13,8 @@ import { mkdir, readFile, writeFile } from 'node:fs/promises'
import { join, resolve } from 'node:path'
import { OPENCLAW_GATEWAY_PORT } from '@browseros/shared/constants/openclaw'
import { DEFAULT_PORTS } from '@browseros/shared/constants/ports'
import { getOpenClawDir } from '../../lib/browseros-dir'
import { logger } from '../../lib/logger'
import { getOpenClawDir } from '../../../lib/browseros-dir'
import { logger } from '../../../lib/logger'
import { ContainerRuntime } from './container-runtime'
import {
OpenClawAgentAlreadyExistsError,
@@ -37,7 +37,7 @@ import { getPodmanRuntime } from './podman-runtime'
const COMPOSE_RESOURCE = resolve(
import.meta.dir,
'../../../resources/openclaw-compose.yml',
'../../../../resources/openclaw-compose.yml',
)
const OPENCLAW_CONFIG_FILE = 'openclaw.json'
const READY_TIMEOUT_MS = 30_000

View File

@@ -2,7 +2,7 @@ import {
OPENCLAW_CONTAINER_HOME,
OPENCLAW_TERMINAL_SHELL,
} from '@browseros/shared/constants/openclaw'
import { logger } from '../../lib/logger'
import { logger } from '../../../lib/logger'
export const TERMINAL_HOME_DIR = OPENCLAW_CONTAINER_HOME
const DEFAULT_COLS = 80

View File

@@ -13,6 +13,7 @@ import fs from 'node:fs'
import path from 'node:path'
import { EXIT_CODES } from '@browseros/shared/constants/exit-codes'
import { createHttpServer } from './api/server'
import { getOpenClawService } from './api/services/openclaw/openclaw-service'
import { CdpBackend } from './browser/backends/cdp'
import { Browser } from './browser/browser'
import type { ServerConfig } from './config'
@@ -30,7 +31,6 @@ import { metrics } from './lib/metrics'
import { isPortInUseError } from './lib/port-binding'
import { Sentry } from './lib/sentry'
import { seedSoulTemplate } from './lib/soul'
import { getOpenClawService } from './services/openclaw/openclaw-service'
import { migrateBuiltinSkills } from './skills/migrate'
import {
startSkillSync,

View File

@@ -7,11 +7,11 @@ import { describe, expect, it } from 'bun:test'
import {
parseTerminalClientMessage,
serializeTerminalServerMessage,
} from '../../../src/services/terminal/terminal-protocol'
} from '../../../src/api/services/terminal/terminal-protocol'
import {
buildTerminalExecCommand,
TERMINAL_HOME_DIR,
} from '../../../src/services/terminal/terminal-session'
} from '../../../src/api/services/terminal/terminal-session'
describe('terminal protocol', () => {
it('parses input messages', () => {