cli/pkg/framework/framework.go
Snider 6d65b70e0c Add streaming API to pkg/io and optimize agentic context gathering (#313)
* feat(io): add streaming API to Medium interface and optimize agentic context

- Added ReadStream and WriteStream to io.Medium interface.
- Implemented streaming methods in local and mock mediums.
- Updated pkg/agentic/context.go to use streaming I/O with LimitReader.
- Added 5000-byte truncation limit for all AI context file reads to reduce memory usage.
- Documented when to use streaming vs full-file APIs in io.Medium.

* feat(io): optimize streaming API and fix PR feedback

- Fixed resource leak in agentic context by using defer for closing file streams.
- Improved truncation logic in agentic context to handle multibyte characters correctly by checking byte length before string conversion.
- Added comprehensive documentation to ReadStream and WriteStream in local medium.
- Added unit tests for ReadStream and WriteStream in local medium.
- Applied formatting and fixed auto-merge CI configuration.

* feat(io): add streaming API and fix CI failures (syntax fix)

- Introduced ReadStream and WriteStream to io.Medium interface.
- Implemented streaming methods in local and mock mediums.
- Optimized agentic context with streaming reads and truncation logic.
- Fixed syntax error in local client tests by overwriting the file.
- Fixed auto-merge CI by adding checkout and repository context.
- Applied formatting fixes.
2026-02-05 11:00:49 +00:00

72 lines
2.1 KiB
Go

// Package framework provides the Core DI/service framework.
// Import this package for cleaner access to the framework types.
//
// Usage:
//
// import "github.com/host-uk/core/pkg/framework"
//
// app, _ := framework.New(
// framework.WithServiceLock(),
// )
package framework
import (
"github.com/host-uk/core/pkg/framework/core"
)
// Re-export core types for cleaner imports
type (
Core = core.Core
Option = core.Option
Message = core.Message
Query = core.Query
Task = core.Task
QueryHandler = core.QueryHandler
TaskHandler = core.TaskHandler
Startable = core.Startable
Stoppable = core.Stoppable
Config = core.Config
Display = core.Display
WindowOption = core.WindowOption
Features = core.Features
Contract = core.Contract
Error = core.Error
ServiceRuntime[T any] = core.ServiceRuntime[T]
Runtime = core.Runtime
ServiceFactory = core.ServiceFactory
)
// Re-export core functions
var (
New = core.New
WithService = core.WithService
WithName = core.WithName
WithApp = core.WithApp
WithAssets = core.WithAssets
WithServiceLock = core.WithServiceLock
App = core.App
E = core.E
NewRuntime = core.NewRuntime
NewWithFactories = core.NewWithFactories
)
// NewServiceRuntime creates a new ServiceRuntime for a service.
func NewServiceRuntime[T any](c *Core, opts T) *ServiceRuntime[T] {
return core.NewServiceRuntime(c, opts)
}
// ServiceFor retrieves a typed service from the core container by name.
func ServiceFor[T any](c *Core, name string) (T, error) {
return core.ServiceFor[T](c, name)
}
// MustServiceFor retrieves a typed service or panics if not found.
func MustServiceFor[T any](c *Core, name string) T {
return core.MustServiceFor[T](c, name)
}
// Action types
type (
ActionServiceStartup = core.ActionServiceStartup
ActionServiceShutdown = core.ActionServiceShutdown
)