Compare commits

...

19 Commits

Author SHA1 Message Date
4a79011793 Update git remote URL from git.ourworld.tf to git.threefold.info 2025-06-15 16:21:09 +02:00
0b62ac9ecd ... 2025-05-24 10:42:24 +04:00
c9b14730ad ... 2025-05-24 10:33:50 +04:00
2ee8a95a90 ... 2025-05-24 09:52:43 +04:00
8bc1759dcb ... 2025-05-24 09:24:19 +04:00
e60b9f62f1 ... 2025-05-24 07:24:17 +04:00
5d241e9ade ... 2025-05-24 07:09:15 +04:00
b8c8da9e31 ... 2025-05-24 06:56:02 +04:00
55a05a5571 ... 2025-05-23 22:12:17 +04:00
2bfe4161b2 ... 2025-05-23 22:09:57 +04:00
0b1d9907a7 ... 2025-05-23 16:30:10 +04:00
c78761fe20 ... 2025-05-23 16:23:41 +04:00
2e8ec1735a ... 2025-05-23 16:19:07 +04:00
29d0d25a3b ... 2025-05-23 16:10:49 +04:00
3f01074e3f ... 2025-05-23 15:56:35 +04:00
532cda72d3 ... 2025-05-23 15:40:41 +04:00
0e545e56de ... 2025-05-23 15:28:30 +04:00
92b9c356b8 ... 2025-05-23 15:11:03 +04:00
c86165f88c ... 2025-05-23 14:05:09 +04:00
231 changed files with 6630 additions and 5019 deletions

View File

@@ -11,7 +11,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/mycelium_client" "git.threefold.info/herocode/heroagent/pkg/mycelium_client"
) )
type config struct { type config struct {

View File

@@ -8,7 +8,7 @@ import (
"os" "os"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/mycelium_client" "git.threefold.info/herocode/heroagent/pkg/mycelium_client"
) )
func main() { func main() {

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/system/stats" "git.threefold.info/herocode/heroagent/pkg/system/stats"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@@ -77,7 +77,7 @@ func (h *AdminHandler) getProcessStatsJSON(c *fiber.Ctx) error {
if err != nil { if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"success": false, "success": false,
"error": "Failed to get process stats: " + err.Error(), "error": "Failed to get process stats: " + err.Error(),
}) })
} }

View File

@@ -3,7 +3,7 @@ package api
import ( import (
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/sal/executor" "git.threefold.info/herocode/heroagent/pkg/sal/executor"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )

View File

@@ -7,9 +7,9 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/processmanager" "git.threefold.info/herocode/heroagent/pkg/processmanager"
"github.com/freeflowuniverse/heroagent/pkg/processmanager/interfaces" "git.threefold.info/herocode/heroagent/pkg/processmanager/interfaces"
"github.com/freeflowuniverse/heroagent/pkg/processmanager/interfaces/openrpc" "git.threefold.info/herocode/heroagent/pkg/processmanager/interfaces/openrpc"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )

View File

@@ -12,16 +12,16 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/heroagent/api" "git.threefold.info/herocode/heroagent/pkg/heroagent/api"
"github.com/freeflowuniverse/heroagent/pkg/heroagent/handlers" "git.threefold.info/herocode/heroagent/pkg/heroagent/handlers"
"github.com/freeflowuniverse/heroagent/pkg/heroagent/pages" "git.threefold.info/herocode/heroagent/pkg/heroagent/pages"
"github.com/freeflowuniverse/heroagent/pkg/processmanager" "git.threefold.info/herocode/heroagent/pkg/processmanager"
"github.com/freeflowuniverse/heroagent/pkg/sal/executor" "git.threefold.info/herocode/heroagent/pkg/sal/executor"
"github.com/freeflowuniverse/heroagent/pkg/servers/redisserver" "git.threefold.info/herocode/heroagent/pkg/servers/redisserver"
"github.com/freeflowuniverse/heroagent/pkg/system/stats" "git.threefold.info/herocode/heroagent/pkg/system/stats"
// "github.com/freeflowuniverse/heroagent/pkg/vfs/interfaces" // "git.threefold.info/herocode/heroagent/pkg/vfs/interfaces"
// "github.com/freeflowuniverse/heroagent/pkg/vfs/interfaces/mock" // "git.threefold.info/herocode/heroagent/pkg/vfs/interfaces/mock"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/logger" "github.com/gofiber/fiber/v2/middleware/logger"
@@ -239,7 +239,7 @@ func (hl *HeroLauncher) GetUptime() string {
func (hl *HeroLauncher) startProcessManager() error { func (hl *HeroLauncher) startProcessManager() error {
_, filename, _, _ := runtime.Caller(0) _, filename, _, _ := runtime.Caller(0)
projectRoot := filepath.Join(filepath.Dir(filename), "../..") projectRoot := filepath.Join(filepath.Dir(filename), "../..")
processManagerPath := filepath.Join(projectRoot, "cmd/processmanager/main.go") processManagerPath := filepath.Join(projectRoot, "pkg/processmanager/examples/openrpc/main.go")
log.Printf("Starting process manager from: %s", processManagerPath) log.Printf("Starting process manager from: %s", processManagerPath)

View File

@@ -5,7 +5,7 @@ import (
"log" "log"
"strconv" // Added strconv for JobID parsing "strconv" // Added strconv for JobID parsing
"github.com/freeflowuniverse/heroagent/pkg/herojobs" "git.threefold.info/herocode/heroagent/pkg/herojobs"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )

View File

@@ -10,7 +10,7 @@ import (
"net/http/httptest" "net/http/httptest"
"testing" "testing"
"github.com/freeflowuniverse/heroagent/pkg/herojobs" "git.threefold.info/herocode/heroagent/pkg/herojobs"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"

View File

@@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/logger" "git.threefold.info/herocode/heroagent/pkg/logger"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@@ -65,11 +65,11 @@ func NewLogHandler(logPath string) (*LogHandler, error) {
type LogType string type LogType string
const ( const (
LogTypeSystem LogType = "system" LogTypeSystem LogType = "system"
LogTypeService LogType = "service" LogTypeService LogType = "service"
LogTypeJob LogType = "job" LogTypeJob LogType = "job"
LogTypeProcess LogType = "process" LogTypeProcess LogType = "process"
LogTypeAll LogType = "all" // Special type to retrieve logs from all sources LogTypeAll LogType = "all" // Special type to retrieve logs from all sources
) )
// GetLogs renders the logs page with logs content // GetLogs renders the logs page with logs content
@@ -90,9 +90,9 @@ func (h *LogHandler) GetLogs(c *fiber.Ctx) error {
// Create search arguments // Create search arguments
searchArgs := logger.SearchArgs{ searchArgs := logger.SearchArgs{
Category: category, Category: category,
LogType: logItemType, LogType: logItemType,
MaxItems: maxItems, MaxItems: maxItems,
} }
if !fromTime.IsZero() { if !fromTime.IsZero() {
@@ -135,9 +135,9 @@ func (h *LogHandler) GetLogs(c *fiber.Ctx) error {
// Check if the selected logger is properly initialized // Check if the selected logger is properly initialized
if selectedLogger == nil { if selectedLogger == nil {
return c.Render("admin/system/logs", fiber.Map{ return c.Render("admin/system/logs", fiber.Map{
"title": logTypeTitle, "title": logTypeTitle,
"error": "Logger not initialized", "error": "Logger not initialized",
"logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess}, "logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess},
"selectedLogType": logTypeParam, "selectedLogType": logTypeParam,
}) })
} }
@@ -149,14 +149,13 @@ func (h *LogHandler) GetLogs(c *fiber.Ctx) error {
// Handle search error // Handle search error
if err != nil { if err != nil {
return c.Render("admin/system/logs", fiber.Map{ return c.Render("admin/system/logs", fiber.Map{
"title": logTypeTitle, "title": logTypeTitle,
"error": err.Error(), "error": err.Error(),
"logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess}, "logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess},
"selectedLogType": logTypeParam, "selectedLogType": logTypeParam,
}) })
} }
// Calculate total pages // Calculate total pages
totalLogs := len(logs) totalLogs := len(logs)
totalPages := (totalLogs + itemsPerPage - 1) / itemsPerPage totalPages := (totalLogs + itemsPerPage - 1) / itemsPerPage
@@ -196,18 +195,18 @@ func (h *LogHandler) GetLogs(c *fiber.Ctx) error {
} }
return c.Render("admin/system/logs", fiber.Map{ return c.Render("admin/system/logs", fiber.Map{
"title": logTypeTitle, "title": logTypeTitle,
"logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess}, "logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess},
"selectedLogType": logTypeParam, "selectedLogType": logTypeParam,
"logs": formattedLogs, "logs": formattedLogs,
"total": totalLogs, "total": totalLogs,
"showing": len(formattedLogs), "showing": len(formattedLogs),
"page": page, "page": page,
"totalPages": totalPages, "totalPages": totalPages,
"categoryParam": category, "categoryParam": category,
"typeParam": c.Query("type", ""), "typeParam": c.Query("type", ""),
"fromParam": c.Query("from", ""), "fromParam": c.Query("from", ""),
"toParam": c.Query("to", ""), "toParam": c.Query("to", ""),
}) })
} }
@@ -227,9 +226,9 @@ func (h *LogHandler) GetLogsAPI(c *fiber.Ctx) error {
// Create search arguments // Create search arguments
searchArgs := logger.SearchArgs{ searchArgs := logger.SearchArgs{
Category: category, Category: category,
LogType: logItemType, LogType: logItemType,
MaxItems: maxItems, MaxItems: maxItems,
} }
if !fromTime.IsZero() { if !fromTime.IsZero() {
@@ -298,7 +297,7 @@ func (h *LogHandler) GetLogsAPI(c *fiber.Ctx) error {
} }
return c.JSON(fiber.Map{ return c.JSON(fiber.Map{
"logs": response, "logs": response,
"total": len(logs), "total": len(logs),
}) })
} }
@@ -323,9 +322,9 @@ func (h *LogHandler) GetLogsFragment(c *fiber.Ctx) error {
// Create search arguments // Create search arguments
searchArgs := logger.SearchArgs{ searchArgs := logger.SearchArgs{
Category: category, Category: category,
LogType: logItemType, LogType: logItemType,
MaxItems: maxItems, MaxItems: maxItems,
} }
if !fromTime.IsZero() { if !fromTime.IsZero() {
@@ -368,9 +367,9 @@ func (h *LogHandler) GetLogsFragment(c *fiber.Ctx) error {
// Check if the selected logger is properly initialized // Check if the selected logger is properly initialized
if selectedLogger == nil { if selectedLogger == nil {
return c.Render("admin/system/logs_fragment", fiber.Map{ return c.Render("admin/system/logs_fragment", fiber.Map{
"title": logTypeTitle, "title": logTypeTitle,
"error": "Logger not initialized", "error": "Logger not initialized",
"logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess}, "logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess},
"selectedLogType": logTypeParam, "selectedLogType": logTypeParam,
}) })
} }
@@ -382,9 +381,9 @@ func (h *LogHandler) GetLogsFragment(c *fiber.Ctx) error {
// Handle search error // Handle search error
if err != nil { if err != nil {
return c.Render("admin/system/logs_fragment", fiber.Map{ return c.Render("admin/system/logs_fragment", fiber.Map{
"title": logTypeTitle, "title": logTypeTitle,
"error": err.Error(), "error": err.Error(),
"logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess}, "logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess},
"selectedLogType": logTypeParam, "selectedLogType": logTypeParam,
}) })
} }
@@ -429,15 +428,15 @@ func (h *LogHandler) GetLogsFragment(c *fiber.Ctx) error {
// Set layout to empty to disable the layout for fragment responses // Set layout to empty to disable the layout for fragment responses
return c.Render("admin/system/logs_fragment", fiber.Map{ return c.Render("admin/system/logs_fragment", fiber.Map{
"title": logTypeTitle, "title": logTypeTitle,
"logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess}, "logTypes": []LogType{LogTypeAll, LogTypeSystem, LogTypeService, LogTypeJob, LogTypeProcess},
"selectedLogType": logTypeParam, "selectedLogType": logTypeParam,
"logs": formattedLogs, "logs": formattedLogs,
"total": totalLogs, "total": totalLogs,
"showing": len(formattedLogs), "showing": len(formattedLogs),
"page": page, "page": page,
"totalPages": totalPages, "totalPages": totalPages,
"layout": "", // Disable layout for partial template "layout": "", // Disable layout for partial template
}) })
} }

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/system/stats" "git.threefold.info/herocode/heroagent/pkg/system/stats"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@@ -43,8 +43,8 @@ func (h *ProcessHandler) GetProcessStatsJSON(c *fiber.Ctx) error {
// Convert to fiber.Map for JSON response // Convert to fiber.Map for JSON response
response := fiber.Map{ response := fiber.Map{
"total": processData.Total, "total": processData.Total,
"filtered": processData.Filtered, "filtered": processData.Filtered,
"timestamp": time.Now().Unix(), "timestamp": time.Now().Unix(),
} }
@@ -127,8 +127,8 @@ func (h *ProcessHandler) GetProcessesData(c *fiber.Ctx) error {
// Check if StatsManager is properly initialized // Check if StatsManager is properly initialized
if h.statsManager == nil { if h.statsManager == nil {
return c.Render("admin/system/processes_data", fiber.Map{ return c.Render("admin/system/processes_data", fiber.Map{
"error": "System error: Stats manager not initialized", "error": "System error: Stats manager not initialized",
"layout": "", "layout": "",
}) })
} }
@@ -165,8 +165,8 @@ func (h *ProcessHandler) GetProcessesData(c *fiber.Ctx) error {
} }
// For regular requests, render the error within the fragment // For regular requests, render the error within the fragment
return c.Render("admin/system/processes_data", fiber.Map{ return c.Render("admin/system/processes_data", fiber.Map{
"error": "Failed to get process data: " + err.Error(), "error": "Failed to get process data: " + err.Error(),
"layout": "", "layout": "",
}) })
} }
} }
@@ -201,5 +201,3 @@ func (h *ProcessHandler) GetProcessesData(c *fiber.Ctx) error {
// Return only the table HTML content directly to be injected into the processes-table-content div // Return only the table HTML content directly to be injected into the processes-table-content div
return c.Render("admin/system/processes_data", templateData) return c.Render("admin/system/processes_data", templateData)
} }

View File

@@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/processmanager/interfaces" "git.threefold.info/herocode/heroagent/pkg/processmanager/interfaces"
"github.com/freeflowuniverse/heroagent/pkg/processmanager/interfaces/openrpc" "git.threefold.info/herocode/heroagent/pkg/processmanager/interfaces/openrpc"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )

View File

@@ -5,7 +5,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/system/stats" "git.threefold.info/herocode/heroagent/pkg/system/stats"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/shirou/gopsutil/v3/host" "github.com/shirou/gopsutil/v3/host"
) )

View File

@@ -7,8 +7,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/heroagent/handlers" "git.threefold.info/herocode/heroagent/pkg/heroagent/handlers"
"github.com/freeflowuniverse/heroagent/pkg/system/stats" "git.threefold.info/herocode/heroagent/pkg/system/stats"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/shirou/gopsutil/v3/host" "github.com/shirou/gopsutil/v3/host"
) )

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/freeflowuniverse/heroagent/pkg/herojobs" "git.threefold.info/herocode/heroagent/pkg/herojobs"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )

View File

@@ -4,14 +4,14 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/freeflowuniverse/heroagent/pkg/processmanager/interfaces/openrpc" "git.threefold.info/herocode/heroagent/pkg/processmanager/interfaces/openrpc"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
// ServiceHandler handles service-related page routes // ServiceHandler handles service-related page routes
type ServiceHandler struct { type ServiceHandler struct {
client *openrpc.Client client *openrpc.Client
logger *log.Logger logger *log.Logger
} }
// NewServiceHandler creates a new service handler with the provided socket path and secret // NewServiceHandler creates a new service handler with the provided socket path and secret

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/processmanager" "git.threefold.info/herocode/heroagent/pkg/processmanager"
) )
// ProcessDisplayInfo represents information about a process for display purposes // ProcessDisplayInfo represents information about a process for display purposes

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

View File

@@ -35,7 +35,7 @@ Key features:
```go ```go
import ( import (
"fmt" "fmt"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
// Create a new playbook from HeroScript text // Create a new playbook from HeroScript text

View File

@@ -7,7 +7,7 @@ import (
"os/signal" "os/signal"
"syscall" "syscall"
"github.com/freeflowuniverse/heroagent/pkg/handlerfactory/herohandler" "git.threefold.info/herocode/heroagent/pkg/handlerfactory/herohandler"
) )
func main() { func main() {

View File

@@ -8,7 +8,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
func main() { func main() {

View File

@@ -3,8 +3,8 @@ package internal
import ( import (
"fmt" "fmt"
"github.com/freeflowuniverse/heroagent/pkg/handlerfactory" "git.threefold.info/herocode/heroagent/pkg/handlerfactory"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlers" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlers"
) )
// ExampleHandler handles example actions // ExampleHandler handles example actions

View File

@@ -7,7 +7,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/cmd/herohandler/internal" "git.threefold.info/herocode/heroagent/pkg/heroscript/cmd/herohandler/internal"
) )
func main() { func main() {

View File

@@ -10,7 +10,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/handlerfactory/herohandler" "git.threefold.info/herocode/heroagent/pkg/handlerfactory/herohandler"
) )
func main() { func main() {

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
const exampleScript = ` const exampleScript = `

View File

@@ -16,7 +16,7 @@ The VM handler example shows how to:
To run the example: To run the example:
```bash ```bash
cd ~/code/github/freeflowuniverse/heroagent/pkg/handlerfactory/cmd/vmhandler cd ~/code/github/freeflowuniverse/herocode/heroagent/pkg/handlerfactory/cmd/vmhandler
go run . tutorial go run . tutorial
#to run just the server do #to run just the server do
go run . go run .

View File

@@ -6,7 +6,7 @@ import (
"os" "os"
"time" "time"
"github.com/freeflowuniverse/heroagent/pkg/handlerfactory" "git.threefold.info/herocode/heroagent/pkg/handlerfactory"
) )
// runTutorial runs an interactive tutorial demonstrating the VM handler // runTutorial runs an interactive tutorial demonstrating the VM handler

View File

@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/freeflowuniverse/heroagent/pkg/handlerfactory" "git.threefold.info/herocode/heroagent/pkg/handlerfactory"
) )
// VMHandler handles VM-related actions // VMHandler handles VM-related actions

View File

@@ -8,7 +8,7 @@ import (
"path/filepath" "path/filepath"
"syscall" "syscall"
"github.com/freeflowuniverse/heroagent/pkg/handlerfactory" "git.threefold.info/herocode/heroagent/pkg/handlerfactory"
) )
// The tutorial functions are defined in tutorial.go // The tutorial functions are defined in tutorial.go

View File

@@ -30,7 +30,7 @@ The Handler Factory exposes two interfaces for communication:
to get started to get started
```bash ```bash
cd /root/code/github/freeflowuniverse/heroagent/pkg/handlerfactory/herohandler/cmd cd /root/code/github/freeflowuniverse/herocode/heroagent/pkg/handlerfactory/herohandler/cmd
go run . go run .
``` ```

View File

@@ -5,8 +5,8 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/paramsparser" "git.threefold.info/herocode/heroagent/pkg/heroscript/paramsparser"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
// Handler interface defines methods that all handlers must implement // Handler interface defines methods that all handlers must implement

View File

@@ -5,7 +5,7 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
// HandlerFactory manages a collection of handlers // HandlerFactory manages a collection of handlers

View File

@@ -12,7 +12,7 @@ import (
"sync" "sync"
"syscall" "syscall"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
// ANSI color codes for terminal output // ANSI color codes for terminal output
@@ -43,23 +43,23 @@ type TelnetServer struct {
sigCh chan os.Signal sigCh chan os.Signal
onShutdown func() onShutdown func()
// Map to store client preferences (like json formatting) // Map to store client preferences (like json formatting)
clientPrefs map[net.Conn]map[string]bool clientPrefs map[net.Conn]map[string]bool
prefsMutex sync.RWMutex prefsMutex sync.RWMutex
} }
// NewTelnetServer creates a new telnet server // NewTelnetServer creates a new telnet server
func NewTelnetServer(factory *HandlerFactory, secrets ...string) *TelnetServer { func NewTelnetServer(factory *HandlerFactory, secrets ...string) *TelnetServer {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
return &TelnetServer{ return &TelnetServer{
factory: factory, factory: factory,
secrets: secrets, secrets: secrets,
clients: make(map[net.Conn]bool), clients: make(map[net.Conn]bool),
clientPrefs: make(map[net.Conn]map[string]bool), clientPrefs: make(map[net.Conn]map[string]bool),
running: false, running: false,
ctx: ctx, ctx: ctx,
cancel: cancel, cancel: cancel,
sigCh: make(chan os.Signal, 1), sigCh: make(chan os.Signal, 1),
onShutdown: func() {}, onShutdown: func() {},
} }
} }
@@ -466,8 +466,6 @@ func (ts *TelnetServer) addJsonFormat(script string) string {
return strings.Join(lines, "\n") return strings.Join(lines, "\n")
} }
// formatHeroscript formats heroscript with colors for console output only // formatHeroscript formats heroscript with colors for console output only
// This is not used for telnet responses, only for server-side logging // This is not used for telnet responses, only for server-side logging
func formatHeroscript(script string) string { func formatHeroscript(script string) string {

View File

@@ -3,7 +3,7 @@ package handlers
import ( import (
"fmt" "fmt"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/core" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/core"
) )
// AuthHandler handles authentication actions // AuthHandler handles authentication actions

View File

@@ -5,9 +5,9 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/core" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/core"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/paramsparser" "git.threefold.info/herocode/heroagent/pkg/heroscript/paramsparser"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
// BaseHandler provides common functionality for all handlers // BaseHandler provides common functionality for all handlers

View File

@@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/core" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/core"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
// HandlerFactory manages a collection of handlers for processing HeroScript commands // HandlerFactory manages a collection of handlers for processing HeroScript commands

View File

@@ -1,7 +1,7 @@
package herohandler package herohandler
import ( import (
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/core" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/core"
) )
// GetFactory returns the handler factory // GetFactory returns the handler factory

View File

@@ -4,7 +4,7 @@ import (
"log" "log"
"sync" "sync"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/herohandler" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/herohandler"
) )
func main() { func main() {

View File

@@ -4,10 +4,10 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/core" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/core"
// "github.com/freeflowuniverse/heroagent/pkg/handlerfactory/heroscript/handlerfactory/fakehandler" // "git.threefold.info/herocode/heroagent/pkg/handlerfactory/heroscript/handlerfactory/fakehandler"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/processmanagerhandler" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/processmanagerhandler"
) )
// HeroHandler is the main handler factory that manages all registered handlers // HeroHandler is the main handler factory that manages all registered handlers

View File

@@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/playbook" "git.threefold.info/herocode/heroagent/pkg/heroscript/playbook"
) )
func main() { func main() {

View File

@@ -3,8 +3,8 @@ package processmanagerhandler
import ( import (
"fmt" "fmt"
"github.com/freeflowuniverse/heroagent/pkg/heroscript/handlerfactory/core" "git.threefold.info/herocode/heroagent/pkg/heroscript/handlerfactory/core"
"github.com/freeflowuniverse/heroagent/pkg/processmanager" "git.threefold.info/herocode/heroagent/pkg/processmanager"
) )
// ProcessManagerHandler handles process manager-related actions // ProcessManagerHandler handles process manager-related actions

Some files were not shown because too many files have changed in this diff Show More