sdk
Сгенерировано из публичного Go-пакета через gomarkdoc.
Путь импорта: github.com/777genius/plugin-kit-ai/sdk
import "github.com/777genius/plugin-kit-ai/sdk"Пакет pluginkitai публикует корневой SDK для сборки runtime-бинарников plugin-kit-ai с типизированными регистраторами Claude, Codex и Gemini.
Оглавление
- Constants
- type App
- func New(cfg Config) *App
- func (a *App) Claude() *claude.Registrar
- func (a *App) Codex() *codex.Registrar
- func (a *App) Gemini() *gemini.Registrar
- func (a *App) Run() int
- func (a *App) RunContext(ctx context.Context) int
- func (a *App) Use(mw Middleware)
- type CapabilityID
- type Config
- type Env
- type Handled
- type IO
- type InvocationContext
- type Logger
- type MaturityLevel
- type Middleware
- type Next
- type NopLogger
- type Result
- type SupportEntry
- func Supported() []SupportEntry
- type SupportStatus
- type TransportMode
Constants
MaxPayloadBytes is the single wire limit for stdin and argv JSON payloads accepted by runtime decoders. Consumers should reference this constant instead of duplicating the number.
const MaxPayloadBytes = runtime.MaxPayloadBytestype App
App управляет middleware, регистрацией обработчиков и диспетчеризацией вызовов.
type App struct {
// содержит скрытые или неэкспортируемые поля
}func New
func New(cfg Config) *AppNew создаёт App с разумными значениями по умолчанию для argv, process I/O, окружения и логирования.
func (*App) Claude
func (a *App) Claude() *claude.RegistrarClaude возвращает регистратор для Claude-специфичных hook-обработчиков.
Example
package main
import (
pluginkitai "github.com/777genius/plugin-kit-ai/sdk"
"github.com/777genius/plugin-kit-ai/sdk/claude"
)
func main() {
app := pluginkitai.New(pluginkitai.Config{Name: "demo"})
app.Claude().OnStop(func(*claude.StopEvent) *claude.Response {
return claude.Allow()
})
_ = app
}func (*App) Codex
func (a *App) Codex() *codex.RegistrarCodex возвращает регистратор для Codex-специфичных обработчиков событий.
Example
package main
import (
pluginkitai "github.com/777genius/plugin-kit-ai/sdk"
"github.com/777genius/plugin-kit-ai/sdk/codex"
)
func main() {
app := pluginkitai.New(pluginkitai.Config{Name: "demo"})
app.Codex().OnNotify(func(*codex.NotifyEvent) *codex.Response {
return codex.Continue()
})
_ = app
}func (*App) Gemini
func (a *App) Gemini() *gemini.RegistrarGemini возвращает регистратор для Gemini-специфичных hook-обработчиков.
Example
package main
import (
pluginkitai "github.com/777genius/plugin-kit-ai/sdk"
"github.com/777genius/plugin-kit-ai/sdk/gemini"
)
func main() {
app := pluginkitai.New(pluginkitai.Config{Name: "demo"})
app.Gemini().OnBeforeTool(func(*gemini.BeforeToolEvent) *gemini.BeforeToolResponse {
return gemini.BeforeToolContinue()
})
_ = app
}func (*App) Run
func (a *App) Run() intRun dispatches the current process invocation with context.Background().
func (*App) RunContext
func (a *App) RunContext(ctx context.Context) intRunContext обрабатывает текущий запуск процесса с переданным context.Context.
func (*App) Use
func (a *App) Use(mw Middleware)Use appends middleware that wraps all subsequent handler dispatch.
type CapabilityID
CapabilityID aliases the normalized cross-platform capability identifier.
type CapabilityID = runtime.CapabilityIDtype Config
Config configures a root SDK app instance before handlers are registered.
type Config struct {
// Name is the human-readable app label used in diagnostics and examples.
Name string
// Args overrides the process argv used to resolve the current invocation.
Args []string
// IO overrides the stdin/stdout/stderr implementation used by Run.
IO IO
// Env overrides environment lookups used during invocation resolution.
Env Env
// Logger overrides structured logging emitted by the runtime engine.
Logger Logger
}type Env
Env aliases the runtime environment reader used by invocation resolution.
type Env = runtime.Envtype Handled
Handled aliases the typed handler result container.
type Handled = runtime.Handledtype IO
IO aliases the runtime I/O contract used by the SDK app host.
type IO = runtime.IOtype InvocationContext
InvocationContext aliases the metadata that accompanies a decoded invocation.
type InvocationContext = runtime.InvocationContexttype Logger
Logger aliases the structured logger interface accepted by the SDK app host.
type Logger = runtime.Loggertype MaturityLevel
MaturityLevel aliases the API maturity enum exposed by support metadata.
type MaturityLevel = runtime.MaturityLeveltype Middleware
Middleware aliases the SDK middleware function signature.
type Middleware = runtime.Middlewaretype Next
Next aliases the middleware continuation function.
type Next = runtime.Nexttype NopLogger
NopLogger aliases the logger implementation that drops all log records.
type NopLogger = runtime.NopLoggertype Result
Result aliases the low-level runtime result written back to the host process.
type Result = runtime.Resulttype SupportEntry
SupportEntry aliases a generated public support-matrix row.
type SupportEntry = runtime.SupportEntryfunc Supported
func Supported() []SupportEntrySupported returns a copy of the generated public support matrix entries.
type SupportStatus
SupportStatus aliases the support-level enum used by generated support entries.
type SupportStatus = runtime.SupportStatustype TransportMode
TransportMode aliases the runtime transport mode enum for supported hooks.
type TransportMode = runtime.TransportMode