Promotes the two remaining "deliberately not in scope" components from the harness model to first-class subsystems, and overhauls the docs. Hooks (runtime/types.go, runtime/runtime.go, runtime/hooks_test.go): - New runtime.LifecycleHooks struct on LoopConfig.Hooks with five Go callbacks: OnUserPromptSubmit (may rewrite prompt), OnSessionStart, BeforeToolUse (gating with same shape as PermissionChecker), AfterToolUse (observe), OnStop (with reason: completed/max_turns/error/aborted). - Wired into Run, dispatchTool, executeToolKickoff at all 8 exit points + both tool-execution paths. - 8 tests covering each hook firing. MCP (tools/mcp/, runtime/builder.go, runtime/types.go): - New tools/mcp package using the official github.com/modelcontextprotocol/go-sdk v1.5.0. Stdio and Streamable HTTP transports. - ServerConfig now exposes Headers + HTTPClient for HTTP auth (static bearer, OAuth via oauth2.NewClient, mTLS, custom RoundTripper). Header injection clones requests so SDK retries see clean params. - First-class AgentSpec.MCPServers — BuildRuntime connects each server, registers adapter tools (mcp__<server>__<tool>), stashes clients on Runtime. - New Runtime.Close() releases sessions; idempotent. - 14 tests including end-to-end header propagation through the SDK via httptest.Server. Examples: - support-agent now demonstrates Skills + Permission + LifecycleHooks together. Audit log via AfterToolUse + OnStop, JSONL output. - defer rt.Close() added to all four examples (no-op without MCP, idiomatic). Docs: - README expanded: Why harness, Requirements, Install, Examples table, Configuration (env vars), Non-goals, Testing, expanded Status. Quick Start fixed to use real BuildRuntime API. - developer.md mental-model diagram replaced with two correct ones: composition (how a Runtime is wired) and per-Run sequence (what rt.Run actually does, including hook fan-out and the tool batch loop). - developer.md gains Lifecycle hooks + MCP servers subsections with full snippets, including Streamable HTTP auth and OAuth recipes (clientcredentials + authcode flows via golang.org/x/oauth2). - LICENSE file added (MIT). All 18 packages build and test green.
57 lines
2.3 KiB
AMPL
57 lines
2.3 KiB
AMPL
module github.com/sausheong/harness
|
|
|
|
go 1.25.1
|
|
|
|
require (
|
|
github.com/JohannesKaufmann/html-to-markdown/v2 v2.5.0
|
|
github.com/anthropics/anthropic-sdk-go v1.35.0
|
|
github.com/chromedp/cdproto v0.0.0-20250724212937-08a3db8b4327
|
|
github.com/chromedp/chromedp v0.14.2
|
|
github.com/modelcontextprotocol/go-sdk v1.5.0
|
|
github.com/sashabaranov/go-openai v1.41.2
|
|
github.com/stretchr/testify v1.11.1
|
|
go.opentelemetry.io/otel v1.43.0
|
|
go.opentelemetry.io/otel/trace v1.43.0
|
|
google.golang.org/genai v1.49.0
|
|
)
|
|
|
|
require (
|
|
cloud.google.com/go v0.116.0 // indirect
|
|
cloud.google.com/go/auth v0.9.3 // indirect
|
|
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
|
github.com/JohannesKaufmann/dom v0.2.0 // indirect
|
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
github.com/chromedp/sysutil v1.1.0 // indirect
|
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
github.com/go-json-experiment/json v0.0.0-20250725192818-e39067aee2d2 // indirect
|
|
github.com/gobwas/httphead v0.1.0 // indirect
|
|
github.com/gobwas/pool v0.2.1 // indirect
|
|
github.com/gobwas/ws v1.4.0 // indirect
|
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
|
github.com/google/go-cmp v0.7.0 // indirect
|
|
github.com/google/jsonschema-go v0.4.2 // indirect
|
|
github.com/google/s2a-go v0.1.8 // indirect
|
|
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
|
|
github.com/gorilla/websocket v1.5.3 // indirect
|
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
github.com/segmentio/asm v1.1.3 // indirect
|
|
github.com/segmentio/encoding v0.5.4 // indirect
|
|
github.com/tidwall/gjson v1.18.0 // indirect
|
|
github.com/tidwall/match v1.1.1 // indirect
|
|
github.com/tidwall/pretty v1.2.1 // indirect
|
|
github.com/tidwall/sjson v1.2.5 // indirect
|
|
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
|
|
go.opencensus.io v0.24.0 // indirect
|
|
go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
|
|
golang.org/x/crypto v0.49.0 // indirect
|
|
golang.org/x/net v0.52.0 // indirect
|
|
golang.org/x/oauth2 v0.35.0 // indirect
|
|
golang.org/x/sync v0.20.0 // indirect
|
|
golang.org/x/sys v0.42.0 // indirect
|
|
golang.org/x/text v0.35.0 // indirect
|
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
|
|
google.golang.org/grpc v1.80.0 // indirect
|
|
google.golang.org/protobuf v1.36.11 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
)
|