Files
archie/.okf/codebase/internal/agentexec/worker.md
T
sam 7c34bdae5a okf: scaffold knowledge bundle and MCP server config
Adds a harvested .okf/ knowledge bundle (codebase concepts + starter
architecture/services/rules scaffolding) and .mcp.json pointing at the
shared okf MCP service (http://localhost:8765/archie-core/), which
serves multiple projects' bundles from a single process.
2026-07-22 04:36:50 +10:00

1.1 KiB

description, resource, tags, timestamp, title, type
description resource tags timestamp title type
Source module internal/agentexec/worker.go (185 lines). internal/agentexec/worker.go
go
source
2026-07-21T18:36:22Z worker.go Module

Module worker.go

Path: internal/agentexec/worker.go
Lines: 185

Snippet Preview

package agentexec

import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io"
	"log/slog"
	"strings"

	"github.com/samcharles93/archie-core/internal/skill"
)

const maxProtocolBytes = 8 << 20

// DefaultRunnerFactory creates an InProcessRunner backed by the ai-sdk runtime.
func DefaultRunnerFactory(providers map[string]Provider, log *slog.Logger) Runner {
	return NewInProcessRunner(NewRuntime(providers), log)
}

// ServeOne decodes and executes exactly one invocation.
func ServeOne(ctx context.Context, in io.Reader, out io.Writer, log *slog.Logger) error {
	return serveOne(ctx, in, out, func(invocation Invocation) Runner {
		return DefaultRunnerFactory(invocation.Providers, log)
	})
}

func serveOne(ctx context.Context, in io.Reader, out io.Writer, newRunner func(Invocation) Runner) error {
	var invocation Invocation