OpenClaw plugin that manages long-lived interactive Claude Code processes per OpenClaw session. Process manager + session-mapping persistence + bridge WebSocket server skeleton. Will be rewritten to follow the contractor-agent HTTP model-provider pattern (register as `synthesis-claude-bridge` provider, receive /v1/chat/completions, dispatch to channel notification on the bound Claude process). See parent repo's STATUS.md for the punch list.
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import type { OpenClawPluginApi } from 'openclaw/plugin-sdk/core'
|
|
import type { ProcessManager } from './process-manager.js'
|
|
import type { SessionMapping } from './session-mapping.js'
|
|
import type { SynthesisConfig } from './config.js'
|
|
|
|
interface CliDeps {
|
|
processManager: ProcessManager
|
|
mapping: SessionMapping
|
|
config: SynthesisConfig
|
|
}
|
|
|
|
/**
|
|
* `openclaw synthesis ...` admin commands. Used to inspect & poke the running
|
|
* pool from outside (helpful for testing without a real channel inbound).
|
|
*
|
|
* Subcommands (planned):
|
|
* list — show live processes + mapping
|
|
* push <session> <text> — fake an inbound message
|
|
* kill <session> — terminate a process (mapping preserved)
|
|
* forget <session> — drop mapping entirely (next msg = new claude session)
|
|
*/
|
|
export function registerCli(api: OpenClawPluginApi, deps: CliDeps): void {
|
|
// The exact API shape for command registration depends on the OpenClaw
|
|
// plugin-sdk version. Two common forms seen in existing plugins:
|
|
//
|
|
// api.commands?.register('synthesis', { describe, handler })
|
|
// api.cli?.command('synthesis', sub => sub.command('list', '...', () => {...}))
|
|
//
|
|
// Both are stubbed below — pick whichever the loaded SDK exposes when
|
|
// wiring this for real.
|
|
|
|
const _ = { api, deps }
|
|
// TODO: wire actual command registration once the surrounding plugin
|
|
// patterns are confirmed (see contractor-agent/commands/register-cli.ts
|
|
// for the canonical example in this codebase).
|
|
void _
|
|
}
|