mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-08-28 10:50:04 +02:00
- Implement agent-acp step type for spawning external ACP agent subprocesses via Agent Communication Protocol - Add ACPExecutor with validation, field rendering, and subprocess lifecycle management - Integrate agent-acp field rendering in StepDispatcher (batch and sequential modes) - Add run_agent() utility function for workflows to execute ACP agents from steps and JS context - Add osmedeus agent CLI command for interactive agent execution with --agent, --cwd, --timeout, --stdin, and --list flags - Add /osm/api/agent/chat/completions REST endpoint with OpenAI-compatible chat format and concurrency control - Support agent selection via: built-in names (claude-code, codex, opencode, gemini) or custom acp_config.command - Add step-level configuration: cwd, allowed_paths, acp_config (command, args, env, write_enabled) - Add comprehensive E2E tests for agent-acp workflows (basic, minimal, config, codex variants) - Add test workflows in test/testdata/workflows/agent-and-llm/ - Update AGENTS.md documentation with agent-acp examples, CLI usage, and API endpoints
32 lines
893 B
Go
32 lines
893 B
Go
package functions
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
)
|
|
|
|
// RunAgentFuncType is the signature for the ACP agent runner function.
|
|
// It spawns an ACP agent subprocess and returns (stdout, stderr, error).
|
|
// This is set by the executor package to avoid circular imports.
|
|
type RunAgentFuncType func(ctx context.Context, prompt, agentName string) (string, string, error)
|
|
|
|
var (
|
|
runAgentFunc RunAgentFuncType
|
|
runAgentFuncMu sync.RWMutex
|
|
)
|
|
|
|
// RegisterRunAgentFunc registers the ACP agent runner function.
|
|
// Called by packages that have access to the executor (e.g., CLI init).
|
|
func RegisterRunAgentFunc(fn RunAgentFuncType) {
|
|
runAgentFuncMu.Lock()
|
|
defer runAgentFuncMu.Unlock()
|
|
runAgentFunc = fn
|
|
}
|
|
|
|
// GetRunAgentFunc returns the registered ACP agent runner function, or nil.
|
|
func GetRunAgentFunc() RunAgentFuncType {
|
|
runAgentFuncMu.RLock()
|
|
defer runAgentFuncMu.RUnlock()
|
|
return runAgentFunc
|
|
}
|