Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat: support tos oss (#255)

baojun-zhang052535e0e1aa
diff --git a/openviking/agfs_manager.py b/openviking/agfs_manager.py
index 6924fb2fd..dd56800f8 100644
--- a/openviking/agfs_manager.py
+++ b/openviking/agfs_manager.py
@@ -163,6 +163,7 @@ class AGFSManager:
"endpoint": self.s3_config.endpoint,
"prefix": self.s3_config.prefix,
"disable_ssl": not self.s3_config.use_ssl,
+ "use_path_style": self.s3_config.use_path_style,
},
}
elif self.backend == "memory":
diff --git a/openviking_cli/utils/config/agfs_config.py b/openviking_cli/utils/config/agfs_config.py
index de7421e1a..ef40abe1f 100644
--- a/openviking_cli/utils/config/agfs_config.py
+++ b/openviking_cli/utils/config/agfs_config.py
@@ -41,6 +41,11 @@ class S3Config(BaseModel):
description="Enable/Disable SSL (HTTPS) for S3 connections. Set to False for local testing without HTTPS.",
)
+ use_path_style: bool = Field(
+ default=True,
+ description="true represent UsePathStyle for MinIO and some S3-compatible services; false represent VirtualHostStyle for TOS and some S3-compatible services.",
+ )
+
model_config = {"extra": "forbid"}
def validate_config(self):
diff --git a/third_party/agfs/agfs-server/config.example.yaml b/third_party/agfs/agfs-server/config.example.yaml
index 9bd02a3db..a91050f5e 100644
--- a/third_party/agfs/agfs-server/config.example.yaml
+++ b/third_party/agfs/agfs-server/config.example.yaml
@@ -149,6 +149,7 @@ plugins:
# access_key_id: key_id
# secret_access_key: secret
# prefix: agfs/ # Optional: all keys will be prefixed with "agfs/"
+# use_path_style: true # Optional: enable path-style addressing (required for MinIO etc.)
#
# # ============================================================================
# # HTTPFS - HTTP File Server (Multiple Instances)
diff --git a/third_party/agfs/agfs-server/pkg/plugins/s3fs/client.go b/third_party/agfs/agfs-server/pkg/plugins/s3fs/client.go
index 9395b858a..ca649542a 100644
--- a/third_party/agfs/agfs-server/pkg/plugins/s3fs/client.go
+++ b/third_party/agfs/agfs-server/pkg/plugins/s3fs/client.go
@@ -34,6 +34,7 @@ type S3Config struct {
Endpoint string // Optional custom endpoint (for S3-compatible services)
Prefix string // Optional prefix for all keys
DisableSSL bool // For testing with local S3
+ UsePathStyle bool // Whether to use path-style addressing (true) or virtual-host-style (false)
}
// NewS3Client creates a new S3 client
@@ -63,11 +64,13 @@ func NewS3Client(cfg S3Config) (*S3Client, error) {
// Create S3 client options
clientOpts := []func(*s3.Options){}
- // Set custom endpoint if provided (for MinIO, LocalStack, etc.)
+ // Set custom endpoint if provided (for MinIO, LocalStack, TOS, etc.)
if cfg.Endpoint != "" {
clientOpts = append(clientOpts, func(o *s3.Options) {
o.BaseEndpoint = aws.String(cfg.Endpoint)
- o.UsePathStyle = true // Required for MinIO and some S3-compatible services
+ // true represent UsePathStyle for MinIO and some S3-compatible services
+ // false represent VirtualHostStyle for TOS and some S3-compatible services
+ o.UsePathStyle = cfg.UsePathStyle
})
}
diff --git a/third_party/agfs/agfs-server/pkg/plugins/s3fs/s3fs.go b/third_party/agfs/agfs-server/pkg/plugins/s3fs/s3fs.go
index 2c675bcdd..b4d1dbea4 100644
--- a/third_party/agfs/agfs-server/pkg/plugins/s3fs/s3fs.go
+++ b/third_party/agfs/agfs-server/pkg/plugins/s3fs/s3fs.go
@@ -519,7 +519,7 @@ func (p *S3FSPlugin) Validate(cfg map[string]interface{}) error {
// Check for unknown parameters
allowedKeys := []string{
"bucket", "region", "access_key_id", "secret_access_key", "endpoint", "prefix", "disable_ssl", "mount_path",
- "cache_enabled", "cache_ttl", "stat_cache_ttl", "cache_max_size",
+ "cache_enabled", "cache_ttl", "stat_cache_ttl", "cache_max_size", "use_path_style",
}
if err := config.ValidateOnlyKnownKeys(cfg, allowedKeys); err != nil {
return err
@@ -542,6 +542,11 @@ func (p *S3FSPlugin) Validate(cfg map[string]interface{}) error {
return err
}
+ // Validate use_path_style (optional boolean)
+ if err := config.ValidateBoolType(cfg, "use_path_style"); err != nil {
+ return err
+ }
+
// Validate cache_enabled (optional boolean)
if err := config.ValidateBoolType(cfg, "cache_enabled"); err != nil {
return err
@@ -562,6 +567,7 @@ func (p *S3FSPlugin) Initialize(config map[string]interface{}) error {
Endpoint: getStringConfig(config, "endpoint", ""),
Prefix: getStringConfig(config, "prefix", ""),
DisableSSL: getBoolConfig(config, "disable_ssl", false),
+ UsePathStyle: getBoolConfig(config, "use_path_style", true),
}
if cfg.Bucket == "" {
@@ -646,6 +652,13 @@ func (p *S3FSPlugin) GetConfigParams() []plugin.ConfigParameter {
Default: "false",
Description: "Disable SSL for S3 connections",
},
+ {
+ Name: "use_path_style",
+ Type: "bool",
+ Required: false,
+ Default: "true",
+ Description: "Whether to use path-style addressing (true) or virtual-host-style (false). Defaults to false for TOS, true for other services.",
+ },
{
Name: "cache_enabled",
Type: "bool",