runtime.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package entities
  2. import (
  3. "time"
  4. )
  5. const (
  6. PLUGIN_RUNTIME_TYPE_LOCAL = "local"
  7. PLUGIN_RUNTIME_TYPE_AWS_LAMBDA = "aws_lambda"
  8. )
  9. type PluginRuntime struct {
  10. Info PluginRuntimeInfo `json:"info"`
  11. State PluginRuntimeState `json:"state"`
  12. Config PluginConfiguration `json:"config"`
  13. Connector PluginConnector `json:"-"`
  14. }
  15. type PluginRuntimeInfo struct {
  16. Type string `json:"type"`
  17. ID string `json:"id"`
  18. Restart bool `json:"restart"`
  19. }
  20. type PluginRuntimeState struct {
  21. Restarts int `json:"restarts"`
  22. Active bool `json:"active"`
  23. RelativePath string `json:"relative_path"`
  24. ActiveAt *time.Time `json:"active_at"`
  25. DeadAt *time.Time `json:"dead_at"`
  26. Verified bool `json:"verified"`
  27. }
  28. type PluginConfiguration struct {
  29. Version string `json:"version"`
  30. Author string `json:"author"`
  31. Name string `json:"name"`
  32. Datetime int64 `json:"datetime"`
  33. Resource PluginConfigurationResource `json:"resource"`
  34. }
  35. type PluginConfigurationResource struct {
  36. Memory int64 `json:"memory"`
  37. Storage int64 `json:"storage"`
  38. Permission PluginConfigurationPermission `json:"permission"`
  39. }
  40. type PluginExtension struct {
  41. Tool bool `json:"tool"`
  42. Model bool `json:"model"`
  43. }
  44. type PluginConfigurationPermission struct {
  45. Model PluginConfigurationPermissionModel `json:"model"`
  46. Tool PluginConfigurationPermissionTool `json:"tool"`
  47. }
  48. type PluginConfigurationPermissionModel struct {
  49. Enabled bool `json:"enabled"`
  50. LLM bool `json:"llm"`
  51. TextEmbedding bool `json:"text_embedding"`
  52. Rerank bool `json:"rerank"`
  53. TTS bool `json:"tts"`
  54. STT bool `json:"stt"`
  55. }
  56. type PluginConfigurationPermissionTool struct {
  57. Enabled bool `json:"enabled"`
  58. }
  59. type PluginConnector interface {
  60. OnMessage(func([]byte))
  61. Read([]byte) int
  62. Write([]byte) int
  63. }