Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements. Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate. Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable. Refs: Versioned dependencies U1/U3; feature/dependency-workspace
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
// Package projectscope resolves host retrieval filters using service-provided
|
|
// lifecycle metadata. Stored/client settings never supply an authority mapping.
|
|
package projectscope
|
|
|
|
import (
|
|
"git-ssh.u1680832.nyat.app/weichen/Agent-System-Backend.git/internal/store"
|
|
"git-ssh.u1680832.nyat.app/weichen/Agent-System-Backend.git/pkg/extension"
|
|
core "git-ssh.u1680832.nyat.app/weichen/Agent-System-Core.git"
|
|
"context"
|
|
)
|
|
|
|
func Resolve(ctx context.Context, host extension.Host, p extension.ProjectLifecycle, id core.ID) (core.ID, error) {
|
|
if id == "" {
|
|
return id, nil
|
|
}
|
|
if p.List == nil {
|
|
return "", store.ErrNotFound
|
|
}
|
|
projects, err := p.List(ctx, host)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
for _, project := range projects {
|
|
domainID, _ := project.Settings["rdm.projectId"].(string)
|
|
if project.ID != id && domainID != id {
|
|
continue
|
|
}
|
|
state, _ := project.Settings["rdm.state"].(string)
|
|
if domainID == "" || state != "ready" {
|
|
return "", store.ErrNotFound
|
|
}
|
|
return core.ID(domainID), nil
|
|
}
|
|
return "", store.ErrNotFound
|
|
}
|