Initial commit: Go agentic harness extracted from Felix
This commit is contained in:
commit
1f2c471ff9
89 files changed
+19388
No files matched your search
@@ -0,0 +1,53 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestBuildRuntimeSetsProviderAndStaticPrompt(t *testing.T) {
|
||||
spec := AgentSpec{ID: "a", Name: "A", Model: "anthropic/claude-sonnet-4-5"}
|
||||
deps := RuntimeDeps{ConfigSummary: "Configured channels: cli"}
|
||||
inputs := RuntimeInputs{}
|
||||
|
||||
rt, err := BuildRuntime(deps, inputs, spec)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "anthropic", rt.Provider)
|
||||
require.Equal(t, "claude-sonnet-4-5", rt.Model)
|
||||
require.NotEmpty(t, rt.StaticSystemPrompt)
|
||||
require.Contains(t, rt.StaticSystemPrompt, `"A" agent (id: a)`)
|
||||
require.Contains(t, rt.StaticSystemPrompt, "Configured channels: cli")
|
||||
}
|
||||
|
||||
func TestBuildRuntimeLocalProvider(t *testing.T) {
|
||||
spec := AgentSpec{ID: "x", Name: "X", Model: "local/qwen2.5:3b"}
|
||||
rt, err := BuildRuntime(RuntimeDeps{}, RuntimeInputs{}, spec)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "local", rt.Provider)
|
||||
}
|
||||
|
||||
func TestBuildRuntimeMinimalSpecSafe(t *testing.T) {
|
||||
spec := AgentSpec{ID: "a", Name: "A", Model: "anthropic/claude-sonnet-4-5"}
|
||||
rt, err := BuildRuntime(RuntimeDeps{}, RuntimeInputs{}, spec)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "anthropic", rt.Provider)
|
||||
require.NotEmpty(t, rt.StaticSystemPrompt)
|
||||
}
|
||||
|
||||
func TestBuildRuntimeUsesCallerProvidedMemoryFiles(t *testing.T) {
|
||||
// Caller composes memoryFiles however they want (Felix walks
|
||||
// FELIX.md/AGENTS.md from workspace + $HOME; other consumers may
|
||||
// build it from a wiki dump, a doc index, etc.). Harness only
|
||||
// concatenates it into the static prompt.
|
||||
const sentinel = "MEMFILE_END_TO_END_SENTINEL"
|
||||
deps := RuntimeDeps{
|
||||
MemoryFiles: "\n\n## Project memory: AGENTS.md\n\n" + sentinel,
|
||||
}
|
||||
rt, err := BuildRuntime(deps, RuntimeInputs{}, AgentSpec{
|
||||
ID: "a", Name: "A", Model: "anthropic/claude-sonnet-4-5",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Contains(t, rt.StaticSystemPrompt, sentinel)
|
||||
require.Contains(t, rt.StaticSystemPrompt, "## Project memory:")
|
||||
}
|
||||
Reference in new issue
Block a user