mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-06-23 18:06:10 +08:00
- Removed `examples/plugin/main.go` and `internal/pluginhost/loader_plugin.go` after migrating to a more modular system. - Introduced `streamBridge` in `internal/pluginhost/stream_bridge.go` for efficient stream handling and communication. - Added examples of `thinking` plugins written in both Rust and Go under `examples/plugin/thinking`. - Enhanced test coverage for plugin host system changes, including stream chunk translation and thinking logic. - Improved API compatibility and ensured backward-compatible upgrades for plugin execution.
72 lines
2.2 KiB
Go
72 lines
2.2 KiB
Go
package pluginabi
|
|
|
|
import "encoding/json"
|
|
|
|
const (
|
|
ABIVersion uint32 = 1
|
|
SchemaVersion uint32 = 1
|
|
)
|
|
|
|
const (
|
|
MethodPluginRegister = "plugin.register"
|
|
MethodPluginReconfigure = "plugin.reconfigure"
|
|
MethodPluginShutdown = "plugin.shutdown"
|
|
|
|
MethodModelRegister = "model.register"
|
|
MethodModelStatic = "model.static"
|
|
MethodModelForAuth = "model.for_auth"
|
|
|
|
MethodAuthIdentifier = "auth.identifier"
|
|
MethodAuthParse = "auth.parse"
|
|
MethodAuthLoginStart = "auth.login.start"
|
|
MethodAuthLoginPoll = "auth.login.poll"
|
|
MethodAuthRefresh = "auth.refresh"
|
|
|
|
MethodFrontendAuthIdentifier = "frontend_auth.identifier"
|
|
MethodFrontendAuthAuthenticate = "frontend_auth.authenticate"
|
|
|
|
MethodExecutorIdentifier = "executor.identifier"
|
|
MethodExecutorExecute = "executor.execute"
|
|
MethodExecutorExecuteStream = "executor.execute_stream"
|
|
MethodExecutorCountTokens = "executor.count_tokens"
|
|
MethodExecutorHTTPRequest = "executor.http_request"
|
|
|
|
MethodRequestTranslate = "request.translate"
|
|
MethodRequestNormalize = "request.normalize"
|
|
|
|
MethodResponseTranslate = "response.translate"
|
|
MethodResponseNormalizeBefore = "response.normalize_before"
|
|
MethodResponseNormalizeAfter = "response.normalize_after"
|
|
|
|
MethodThinkingIdentifier = "thinking.identifier"
|
|
MethodThinkingApply = "thinking.apply"
|
|
|
|
MethodUsageHandle = "usage.handle"
|
|
|
|
MethodCommandLineRegister = "command_line.register"
|
|
MethodCommandLineExecute = "command_line.execute"
|
|
|
|
MethodManagementRegister = "management.register"
|
|
MethodManagementHandle = "management.handle"
|
|
|
|
MethodHostHTTPDo = "host.http.do"
|
|
MethodHostHTTPDoStream = "host.http.do_stream"
|
|
MethodHostHTTPStreamRead = "host.http.stream_read"
|
|
MethodHostHTTPStreamClose = "host.http.stream_close"
|
|
MethodHostStreamEmit = "host.stream.emit"
|
|
MethodHostStreamClose = "host.stream.close"
|
|
MethodHostLog = "host.log"
|
|
)
|
|
|
|
type Envelope struct {
|
|
OK bool `json:"ok"`
|
|
Result json.RawMessage `json:"result,omitempty"`
|
|
Error *Error `json:"error,omitempty"`
|
|
}
|
|
|
|
type Error struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
Retryable bool `json:"retryable,omitempty"`
|
|
}
|