Ports the OMX OpenClaw module into oh-my-openagent as a first-class integration. This integration allows forwarding internal events (session lifecycle, tool execution) to external gateways (HTTP or command-based). - Added `src/openclaw` directory with implementation: - `dispatcher.ts`: Handles HTTP/Command dispatching with interpolation - `types.ts`: TypeScript definitions - `client.ts`: Main entry point `wakeOpenClaw` - `index.ts`: Public API - Added `src/config/schema/openclaw.ts` for Zod schema validation - Updated `src/config/schema/oh-my-opencode-config.ts` to include `openclaw` config - Added `src/hooks/openclaw-sender/index.ts` to listen for events - Registered the hook in `src/plugin/hooks/create-session-hooks.ts` - Added unit tests in `src/openclaw/__tests__` Events handled: - `session-start` (via `session.created`) - `session-end` (via `session.deleted`) - `session-idle` (via `session.idle`) - `ask-user-question` (via `tool.execute.before` for `ask_user_question`) - `stop` (via `tool.execute.before` for `stop-continuation` command)
72 lines
3.6 KiB
TypeScript
72 lines
3.6 KiB
TypeScript
import { z } from "zod"
|
|
import { AnyMcpNameSchema } from "../../mcp/types"
|
|
import { BuiltinSkillNameSchema } from "./agent-names"
|
|
import { AgentOverridesSchema } from "./agent-overrides"
|
|
import { BabysittingConfigSchema } from "./babysitting"
|
|
import { BackgroundTaskConfigSchema } from "./background-task"
|
|
import { BrowserAutomationConfigSchema } from "./browser-automation"
|
|
import { CategoriesConfigSchema } from "./categories"
|
|
import { ClaudeCodeConfigSchema } from "./claude-code"
|
|
import { CommentCheckerConfigSchema } from "./comment-checker"
|
|
import { BuiltinCommandNameSchema } from "./commands"
|
|
import { ExperimentalConfigSchema } from "./experimental"
|
|
import { GitMasterConfigSchema } from "./git-master"
|
|
import { NotificationConfigSchema } from "./notification"
|
|
import { OpenClawConfigSchema } from "./openclaw"
|
|
import { RalphLoopConfigSchema } from "./ralph-loop"
|
|
import { RuntimeFallbackConfigSchema } from "./runtime-fallback"
|
|
import { SkillsConfigSchema } from "./skills"
|
|
import { SisyphusConfigSchema } from "./sisyphus"
|
|
import { SisyphusAgentConfigSchema } from "./sisyphus-agent"
|
|
import { TmuxConfigSchema } from "./tmux"
|
|
import { StartWorkConfigSchema } from "./start-work"
|
|
import { WebsearchConfigSchema } from "./websearch"
|
|
|
|
export const OhMyOpenCodeConfigSchema = z.object({
|
|
$schema: z.string().optional(),
|
|
/** Enable new task system (default: false) */
|
|
new_task_system_enabled: z.boolean().optional(),
|
|
/** Default agent name for `oh-my-opencode run` (env: OPENCODE_DEFAULT_AGENT) */
|
|
default_run_agent: z.string().optional(),
|
|
disabled_mcps: z.array(AnyMcpNameSchema).optional(),
|
|
disabled_agents: z.array(z.string()).optional(),
|
|
disabled_skills: z.array(BuiltinSkillNameSchema).optional(),
|
|
disabled_hooks: z.array(z.string()).optional(),
|
|
disabled_commands: z.array(BuiltinCommandNameSchema).optional(),
|
|
/** Disable specific tools by name (e.g., ["todowrite", "todoread"]) */
|
|
disabled_tools: z.array(z.string()).optional(),
|
|
/** Enable hashline_edit tool/hook integrations (default: false) */
|
|
hashline_edit: z.boolean().optional(),
|
|
/** Enable model fallback on API errors (default: false). Set to true to enable automatic model switching when model errors occur. */
|
|
model_fallback: z.boolean().optional(),
|
|
agents: AgentOverridesSchema.optional(),
|
|
categories: CategoriesConfigSchema.optional(),
|
|
claude_code: ClaudeCodeConfigSchema.optional(),
|
|
sisyphus_agent: SisyphusAgentConfigSchema.optional(),
|
|
comment_checker: CommentCheckerConfigSchema.optional(),
|
|
experimental: ExperimentalConfigSchema.optional(),
|
|
auto_update: z.boolean().optional(),
|
|
skills: SkillsConfigSchema.optional(),
|
|
ralph_loop: RalphLoopConfigSchema.optional(),
|
|
/**
|
|
* Enable runtime fallback (default: false)
|
|
* Set to false to disable, or use object for advanced config:
|
|
* { "enabled": true, "retry_on_errors": [400, 429], "timeout_seconds": 30 }
|
|
*/
|
|
runtime_fallback: z.union([z.boolean(), RuntimeFallbackConfigSchema]).optional(),
|
|
background_task: BackgroundTaskConfigSchema.optional(),
|
|
notification: NotificationConfigSchema.optional(),
|
|
openclaw: OpenClawConfigSchema.optional(),
|
|
babysitting: BabysittingConfigSchema.optional(),
|
|
git_master: GitMasterConfigSchema.optional(),
|
|
browser_automation_engine: BrowserAutomationConfigSchema.optional(),
|
|
websearch: WebsearchConfigSchema.optional(),
|
|
tmux: TmuxConfigSchema.optional(),
|
|
sisyphus: SisyphusConfigSchema.optional(),
|
|
start_work: StartWorkConfigSchema.optional(),
|
|
/** Migration history to prevent re-applying migrations (e.g., model version upgrades) */
|
|
_migrations: z.array(z.string()).optional(),
|
|
})
|
|
|
|
export type OhMyOpenCodeConfig = z.infer<typeof OhMyOpenCodeConfigSchema>
|