refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s

- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名)
- 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块)
- docreader proto 描述符采用等长替换,保持序列化字节布局有效
- Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像
- 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
runny committed 2026-11-13 20:52:51 +08:00
1 parent 9097ee699d
commit 9058149576
3136 files changed
+18018 -18004

No files matched your search

+7 -7
View File
@@ -10,13 +10,13 @@ import (
"sync"
"time"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/common"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/modelcontext"
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
"github.com/Tencent/WeKnora/internal/types"
agenttools "academy/internal/agent/tools"
"academy/internal/common"
"academy/internal/event"
"academy/internal/logger"
"academy/internal/modelcontext"
"academy/internal/tracing/langfuse"
"academy/internal/types"
"golang.org/x/sync/errgroup"
)
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/tools"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"fmt"
"time"
"github.com/Tencent/WeKnora/internal/agent/hitl"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/hitl"
"academy/internal/event"
"academy/internal/types"
)
// AskRequest raises an ask_user prompt.
+4 -4
View File
@@ -8,10 +8,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/internal/agent/hitl"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/hitl"
"academy/internal/config"
"academy/internal/event"
"academy/internal/types"
)
func askRequest(bus *event.EventBus) AskRequest {
@@ -6,9 +6,9 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/agent/hitl"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/hitl"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+7 -7
View File
@@ -15,11 +15,11 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/agent/hitl"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/hitl"
"academy/internal/agent/policy"
"academy/internal/config"
"academy/internal/event"
"academy/internal/types"
)
// Checker answers per-tool MCP policy questions used during registration and execution.
@@ -183,8 +183,8 @@ func NewGate(cfg *config.Config, checker Checker, broker *hitl.Broker) *Gate {
broker.RegisterKind(types.AgentPromptKindAskUser, types.ValidateAskUserResponse)
broker.RegisterKind(types.AgentPromptKindPageAction, types.ValidatePageActionResponse)
// Default fail-close: if the checker errors, require approval (safer for a
// HITL feature). Set WEKNORA_AGENT_TOOL_APPROVAL_FAIL_OPEN=true to revert.
failClose := !strings.EqualFold(strings.TrimSpace(os.Getenv("WEKNORA_AGENT_TOOL_APPROVAL_FAIL_OPEN")), "true")
// HITL feature). Set ACADEMY_AGENT_TOOL_APPROVAL_FAIL_OPEN=true to revert.
failClose := !strings.EqualFold(strings.TrimSpace(os.Getenv("ACADEMY_AGENT_TOOL_APPROVAL_FAIL_OPEN")), "true")
return &Gate{checker: checker, timeout: timeout, hotWait: hotWait, broker: broker, failClose: failClose}
}
+4 -4
View File
@@ -6,10 +6,10 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/policy"
"academy/internal/config"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"encoding/json"
"time"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/policy"
"academy/internal/logger"
"academy/internal/types"
)
// GrantStore keeps the approvals a user allowed to be remembered.
+4 -4
View File
@@ -3,9 +3,9 @@ package approval
import (
"context"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/policy"
"academy/internal/logger"
"academy/internal/types"
)
// RiskChecker reads and records the risk policy of MCP tools. A Checker that
@@ -78,7 +78,7 @@ func (g *Gate) Action(ctx context.Context, tenantID uint64, serviceID string, to
func (g *Gate) failedAction(ctx context.Context, err error) policy.Action {
// Default fail-close: a transient DB error must NOT silently allow a
// dangerous tool to run. Operators can opt into legacy behaviour via
// WEKNORA_AGENT_TOOL_APPROVAL_FAIL_OPEN=true.
// ACADEMY_AGENT_TOOL_APPROVAL_FAIL_OPEN=true.
if g.failClose {
logger.GetLogger(ctx).Warnf("mcp tool approval check failed (fail-close: requiring approval): %v", err)
return policy.Action{Risk: policy.RiskWrite, Always: true}
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/policy"
"academy/internal/types"
)
type riskChecker struct {
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"fmt"
"time"
"github.com/Tencent/WeKnora/internal/agent/hitl"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/hitl"
"academy/internal/event"
"academy/internal/types"
)
// DefaultPageActionTimeout bounds how long a run waits for the browser. The
+3 -3
View File
@@ -9,9 +9,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/internal/agent/hitl"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/hitl"
"academy/internal/event"
"academy/internal/types"
)
func pageActionRequest(bus *event.EventBus) PageActionRequest {
@@ -8,11 +8,11 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/agent/hitl"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/hitl"
"academy/internal/agent/policy"
"academy/internal/config"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -92,7 +92,7 @@ func grantGate(t *testing.T, answer Decision) (*Gate, *event.EventBus, *[]event.
func grantRequest(bus *event.EventBus, session, grant string) PendingRequest {
return PendingRequest{
TenantID: 7, UserID: "u1", SessionID: session, EventBus: bus,
ServiceName: "WeKnora", MCPToolName: "knowledge.update", RegisteredToolName: "run_operation",
ServiceName: "Academy", MCPToolName: "knowledge.update", RegisteredToolName: "run_operation",
Args: json.RawMessage(`{}`), Grant: grant, GrantScope: "Update a document",
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
type enabledChecker interface {
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"errors"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/application/attachment"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/tools"
"academy/internal/application/attachment"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+4 -4
View File
@@ -4,10 +4,10 @@ import (
"context"
"strings"
"github.com/Tencent/WeKnora/internal/background"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/background"
"academy/internal/logger"
"academy/internal/models/chat"
"academy/internal/types"
)
// BackgroundRun is the run-scoped source of background-work context. The
+5 -5
View File
@@ -6,11 +6,11 @@ import (
"testing"
"time"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/background"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
agenttools "academy/internal/agent/tools"
"academy/internal/background"
"academy/internal/event"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -3,9 +3,9 @@ package agent
import (
"context"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/logger"
"academy/internal/models/chat"
"academy/internal/types"
)
const (
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"strings"
"testing"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
agenttools "academy/internal/agent/tools"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -4,9 +4,9 @@ import (
"context"
"time"
"github.com/Tencent/WeKnora/internal/agent/compaction"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/compaction"
"academy/internal/logger"
"academy/internal/types"
)
// SetContextCheckpointSink enables persisting compaction checkpoints. Nil (the
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"fmt"
"strings"
"github.com/Tencent/WeKnora/internal/agent/collaboration"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/collaboration"
"academy/internal/models/chat"
"academy/internal/types"
)
// SetCollaboration attaches runtime-owned collaboration state to the engine.
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"sync/atomic"
"time"
"github.com/Tencent/WeKnora/internal/logger"
"academy/internal/logger"
"github.com/google/uuid"
)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"gorm.io/gorm"
"gorm.io/gorm/clause"
@@ -7,10 +7,10 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/agent/collaboration"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/collaboration"
agenttools "academy/internal/agent/tools"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+5 -5
View File
@@ -8,12 +8,12 @@ import (
"testing"
"time"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
agenttools "academy/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/agent/collaboration"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/collaboration"
"academy/internal/event"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"testing"
"github.com/Tencent/WeKnora/internal/models/chat"
"academy/internal/models/chat"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"strings"
"testing"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
agenttoken "academy/internal/agent/token"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"strings"
"time"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
agenttoken "academy/internal/agent/token"
"academy/internal/models/chat"
"academy/internal/types"
)
const (
+2 -2
View File
@@ -1,8 +1,8 @@
package compaction
import (
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
"github.com/Tencent/WeKnora/internal/models/chat"
agenttoken "academy/internal/agent/token"
"academy/internal/models/chat"
)
// CutPoint is where the conversation is divided into "summarize this" and
+2 -2
View File
@@ -18,8 +18,8 @@ import (
"fmt"
"strings"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/models/chat"
agenttools "academy/internal/agent/tools"
"academy/internal/models/chat"
)
const (
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/models/chat"
"academy/internal/models/chat"
"github.com/stretchr/testify/assert"
)
@@ -4,8 +4,8 @@ import (
"strings"
"testing"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/models/chat"
agenttools "academy/internal/agent/tools"
"academy/internal/models/chat"
"github.com/stretchr/testify/require"
)
+2 -2
View File
@@ -4,7 +4,7 @@ import (
"regexp"
"strings"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
// Context overflow is worth detecting precisely because the recovery is
@@ -43,7 +43,7 @@ var overflowPatterns = []*regexp.Regexp{
// something else. Bedrock throttling reads "ThrottlingException: Too many
// tokens, please wait before trying again", which matches an overflow pattern
// and is not one. Matched anywhere in the message rather than anchored, since
// WeKnora sees raw provider errors rather than a pre-normalized prefix.
// Academy sees raw provider errors rather than a pre-normalized prefix.
var nonOverflowPatterns = []*regexp.Regexp{
regexp.MustCompile(`(?i)throttling`),
regexp.MustCompile(`(?i)service unavailable`),
+2 -2
View File
@@ -4,11 +4,11 @@ import (
"errors"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
)
// Real error strings from the providers WeKnora talks to. An overflow read as
// Real error strings from the providers Academy talks to. An overflow read as
// a generic failure ends the turn; read as transient it retries the identical
// oversized request until the attempts run out.
func TestIsOverflowError(t *testing.T) {
+2 -2
View File
@@ -3,8 +3,8 @@ package compaction
import (
"strings"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
"github.com/Tencent/WeKnora/internal/models/chat"
agenttoken "academy/internal/agent/token"
"academy/internal/models/chat"
)
// The summary is injected as a `user` message rather than a second `system`
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"sort"
"strings"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
"github.com/Tencent/WeKnora/internal/models/chat"
agenttoken "academy/internal/agent/token"
"academy/internal/models/chat"
)
const (
+1 -1
View File
@@ -11,7 +11,7 @@ package compaction
import (
"time"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
agenttoken "academy/internal/agent/token"
)
// DefaultReserveTokens is the floor on room kept free for the next response.
@@ -8,8 +8,8 @@ import (
"sync/atomic"
"testing"
"github.com/Tencent/WeKnora/internal/models/api"
"github.com/Tencent/WeKnora/internal/models/api/openaicompletions"
"academy/internal/models/api"
"academy/internal/models/api/openaicompletions"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -9,9 +9,9 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/models/api"
"github.com/Tencent/WeKnora/internal/models/api/openaicompletions"
"github.com/Tencent/WeKnora/internal/models/chat"
"academy/internal/models/api"
"academy/internal/models/api/openaicompletions"
"academy/internal/models/chat"
"github.com/stretchr/testify/require"
)
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+7 -7
View File
@@ -11,12 +11,12 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/agent/compaction"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/browserskill"
webfetch "github.com/Tencent/WeKnora/internal/infrastructure/web_fetch"
"github.com/Tencent/WeKnora/internal/models/api"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/compaction"
agenttools "academy/internal/agent/tools"
"academy/internal/browserskill"
webfetch "academy/internal/infrastructure/web_fetch"
"academy/internal/models/api"
"academy/internal/types"
"github.com/google/uuid"
)
@@ -33,7 +33,7 @@ const (
// a round that streams a whole file body inside a write_sandbox_file call
// runs for minutes while emitting continuously, and killing it on elapsed
// time throws away the half-assembled call. The overall ceiling belongs to
// the provider transport (WEKNORA_LLM_STREAM_TIMEOUT_SECONDS).
// the provider transport (ACADEMY_LLM_STREAM_TIMEOUT_SECONDS).
// Can be overridden via AgentConfig.LLMCallTimeout.
defaultLLMStallTimeout = 120 * time.Second
+5 -5
View File
@@ -4,7 +4,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
)
@@ -38,20 +38,20 @@ func TestToolExecutionTimeout(t *testing.T) {
}
t.Run("default budget plus slack", func(t *testing.T) {
t.Setenv("WEKNORA_WEB_FETCH_TIMEOUT", "")
t.Setenv("ACADEMY_WEB_FETCH_TIMEOUT", "")
assert.Equal(t, 35*time.Second, toolExecutionTimeout("web_fetch"))
})
t.Run("go duration", func(t *testing.T) {
t.Setenv("WEKNORA_WEB_FETCH_TIMEOUT", "150s")
t.Setenv("ACADEMY_WEB_FETCH_TIMEOUT", "150s")
assert.Greater(t, toolExecutionTimeout("web_fetch"), 2*time.Minute+30*time.Second)
assert.Equal(t, 2*time.Minute+35*time.Second, toolExecutionTimeout("web_fetch"))
})
t.Run("bare seconds", func(t *testing.T) {
t.Setenv("WEKNORA_WEB_FETCH_TIMEOUT", "180")
t.Setenv("ACADEMY_WEB_FETCH_TIMEOUT", "180")
assert.Equal(t, 185*time.Second, toolExecutionTimeout("web_fetch"))
})
t.Run("invalid falls back", func(t *testing.T) {
t.Setenv("WEKNORA_WEB_FETCH_TIMEOUT", "nope")
t.Setenv("ACADEMY_WEB_FETCH_TIMEOUT", "nope")
assert.Equal(t, 35*time.Second, toolExecutionTimeout("web_fetch"))
})
}
+3 -3
View File
@@ -16,9 +16,9 @@ import (
"fmt"
"strings"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/logger"
"academy/internal/models/chat"
"academy/internal/types"
)
// contextBreakdown attributes context tokens to the kind of content holding
+16 -16
View File
@@ -10,20 +10,20 @@ import (
"sync"
"time"
"github.com/Tencent/WeKnora/internal/agent/collaboration"
"github.com/Tencent/WeKnora/internal/agent/compaction"
"github.com/Tencent/WeKnora/internal/agent/skills"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/common"
appconfig "github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/modelcontext"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/sandbox"
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/collaboration"
"academy/internal/agent/compaction"
"academy/internal/agent/skills"
agenttoken "academy/internal/agent/token"
agenttools "academy/internal/agent/tools"
"academy/internal/common"
appconfig "academy/internal/config"
"academy/internal/event"
"academy/internal/logger"
"academy/internal/modelcontext"
"academy/internal/models/chat"
"academy/internal/sandbox"
"academy/internal/tracing/langfuse"
"academy/internal/types"
)
// langfuseQueryPreview caps the query length we ship as the agent.execute
@@ -168,7 +168,7 @@ func (e *AgentEngine) SetQuestionOrigin(origin *QuestionOriginInfo) {
e.questionOrigin = origin
}
// SetPageContext records the WeKnora page the user has open for this turn;
// SetPageContext records the Academy page the user has open for this turn;
// nil clears it.
func (e *AgentEngine) SetPageContext(page *PageContextInfo) {
e.pageContext = page
@@ -354,7 +354,7 @@ func (e *AgentEngine) deltaStart(messages []chat.Message) int {
}
// contextTokensFromUsage reduces a usage report to the size of the context it
// describes. Cache counters are not added in: WeKnora normalizes PromptTokens
// describes. Cache counters are not added in: Academy normalizes PromptTokens
// to the provider's full input count, with read/write/miss as descriptive
// subsets of it (see types.TokenUsage.SetPromptCacheUsage).
func contextTokensFromUsage(usage types.TokenUsage) int {
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+10 -10
View File
@@ -10,14 +10,14 @@ import (
"sync"
"testing"
"github.com/Tencent/WeKnora/internal/agent/compaction"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/modelcontext"
"github.com/Tencent/WeKnora/internal/models/api"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/sandbox"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/compaction"
agenttools "academy/internal/agent/tools"
"academy/internal/event"
"academy/internal/modelcontext"
"academy/internal/models/api"
"academy/internal/models/chat"
"academy/internal/sandbox"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -126,7 +126,7 @@ func TestStreamLLMSummarySlugSurvivesDocumentCompaction(t *testing.T) {
toolMsg := chat.Message{
Role: "tool",
Content: `<link>[[` + summarySlug + `|Weknora 试错记录.md - Summary]]</link>`,
Content: `<link>[[` + summarySlug + `|Academy 试错记录.md - Summary]]</link>`,
}
result, err := engine.streamLLMToEventBus(context.Background(),
[]chat.Message{toolMsg}, nil, nil)
@@ -160,7 +160,7 @@ func TestStreamMCPAnswerRejectsUnretrievedKnowledgeCitations(t *testing.T) {
engine := newTestEngine(t, model)
engine.knowledgeBasesInfo = []*KnowledgeBaseInfo{{
ID: "faq-kb", Name: "FAQ TEST", Type: "faq", RecentDocs: []RecentDocInfo{
{ChunkID: "faq-1", Title: "什么是 WeKnora?", FAQStandardQuestion: "什么是 WeKnora?"},
{ChunkID: "faq-1", Title: "什么是 Academy?", FAQStandardQuestion: "什么是 Academy?"},
{ChunkID: "faq-2", Title: "如何创建知识库?", FAQStandardQuestion: "如何创建知识库?"},
},
}}
+6 -6
View File
@@ -4,12 +4,12 @@ import (
"context"
"time"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/common"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
agenttools "academy/internal/agent/tools"
"academy/internal/common"
"academy/internal/event"
"academy/internal/logger"
"academy/internal/models/chat"
"academy/internal/types"
)
// streamFinalAnswerToEventBus streams the final answer generation through EventBus
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"slices"
"strings"
"github.com/Tencent/WeKnora/internal/agent/tools"
"academy/internal/agent/tools"
)
// formatGroundingGuidance applies to every agent template, including saved and
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/config"
"academy/internal/agent/tools"
"academy/internal/config"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)
+6 -6
View File
@@ -19,18 +19,18 @@ import (
"sync"
"time"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/config"
"academy/internal/logger"
"academy/internal/types"
"github.com/google/uuid"
"github.com/redis/go-redis/v9"
)
// pubsubChannelBase is the Redis channel prefix used to wake the replica that
// holds a waiter after another replica recorded the answer. The actual
// channel is suffixed with WEKNORA_REDIS_NAMESPACE (when set) so multiple
// channel is suffixed with ACADEMY_REDIS_NAMESPACE (when set) so multiple
// deployments sharing the same Redis don't cross-talk.
const pubsubChannelBase = "weknora:agent_prompt:wake"
const pubsubChannelBase = "academy:agent_prompt:wake"
// instanceID identifies this process for pub/sub wake-up suppression.
var instanceID = uuid.New().String()
@@ -706,7 +706,7 @@ type wakeMessage struct {
}
func pubsubChannel() string {
if ns := strings.TrimSpace(os.Getenv("WEKNORA_REDIS_NAMESPACE")); ns != "" {
if ns := strings.TrimSpace(os.Getenv("ACADEMY_REDIS_NAMESPACE")); ns != "" {
return pubsubChannelBase + ":" + ns
}
return pubsubChannelBase
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -3,7 +3,7 @@ package hitl
import (
"context"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
type delegationKey struct{}
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"context"
"time"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/logger"
"academy/internal/types"
)
// reapBatch bounds how many prompts one sweep handles per rule.
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"sync"
"time"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/types/interfaces"
"academy/internal/types"
"academy/internal/types/interfaces"
)
// Store persists prompts. Production wiring passes the GORM repository; the
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
@@ -6,7 +6,7 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"reflect"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
func TestBuildToolSpanInputKeepsModelAndResolvedArguments(t *testing.T) {
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"testing"
"time"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
agenttools "academy/internal/agent/tools"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+5 -5
View File
@@ -11,11 +11,11 @@ import (
"sync/atomic"
"testing"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
internalmcp "github.com/Tencent/WeKnora/internal/mcp"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/utils"
agenttools "academy/internal/agent/tools"
internalmcp "academy/internal/mcp"
"academy/internal/models/chat"
"academy/internal/types"
"academy/internal/utils"
sdkmcp "github.com/mark3labs/mcp-go/mcp"
sdkserver "github.com/mark3labs/mcp-go/server"
"github.com/stretchr/testify/assert"
+5 -5
View File
@@ -7,11 +7,11 @@ import (
"sync/atomic"
"testing"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/event"
internalmcp "github.com/Tencent/WeKnora/internal/mcp"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/utils"
agenttools "academy/internal/agent/tools"
"academy/internal/event"
internalmcp "academy/internal/mcp"
"academy/internal/types"
"academy/internal/utils"
sdkmcp "github.com/mark3labs/mcp-go/mcp"
sdkserver "github.com/mark3labs/mcp-go/server"
"github.com/stretchr/testify/require"
+10 -10
View File
@@ -8,15 +8,15 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/agent/compaction"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/common"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/modelcontext"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/compaction"
agenttoken "academy/internal/agent/token"
agenttools "academy/internal/agent/tools"
"academy/internal/common"
"academy/internal/event"
"academy/internal/logger"
"academy/internal/modelcontext"
"academy/internal/models/chat"
"academy/internal/types"
)
const (
@@ -691,7 +691,7 @@ func writeQuestionOrigin(sb *strings.Builder, origin *QuestionOriginInfo) {
sb.WriteString(" </question_origin>\n")
}
// writePageContext tells the model which WeKnora page the user is looking at,
// writePageContext tells the model which Academy page the user is looking at,
// so "this document", "this page" or "these issues" need no clarifying
// question. It names what is open; it does not ask for any action.
func writePageContext(sb *strings.Builder, page *PageContextInfo) {
+5 -5
View File
@@ -7,11 +7,11 @@ import (
"testing"
"time"
agenttoken "github.com/Tencent/WeKnora/internal/agent/token"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/modelcontext"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
agenttoken "academy/internal/agent/token"
agenttools "academy/internal/agent/tools"
"academy/internal/modelcontext"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -3,7 +3,7 @@ package operations
import (
"sync"
docs "github.com/Tencent/WeKnora/docs"
docs "academy/docs"
)
var (
+3 -3
View File
@@ -1,4 +1,4 @@
// Package operations is the catalog of WeKnora HTTP API operations an agent
// Package operations is the catalog of Academy HTTP API operations an agent
// may run on behalf of the signed-in user.
//
// The catalog is the allow-list: nothing outside it is reachable. Entries are
@@ -18,8 +18,8 @@ import (
"strings"
"unicode"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/policy"
"academy/internal/types"
)
// Risk classifies an operation by its effect on user data.
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -6,7 +6,7 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -6,7 +6,7 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"sync"
"time"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
const maxResponseBytes = 2 << 20
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -6,7 +6,7 @@ import (
"net/http"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -5,7 +5,7 @@ import (
"net/http"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"strconv"
"strings"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
// Swagger extensions that put an operation in the catalog. They are written
@@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"strings"
"testing"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
agenttools "academy/internal/agent/tools"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+5 -5
View File
@@ -6,11 +6,11 @@ import (
"sync"
"testing"
"github.com/Tencent/WeKnora/internal/agent/collaboration"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/collaboration"
agenttools "academy/internal/agent/tools"
"academy/internal/event"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -8,7 +8,7 @@
// See docs/design/agent-permission-model.md.
package policy
import "github.com/Tencent/WeKnora/internal/types"
import "academy/internal/types"
// Risk classifies an action by its effect on user data.
type Risk string
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
const (
+2 -2
View File
@@ -3,8 +3,8 @@ package policy
import (
"context"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/logger"
"academy/internal/types"
)
// String names v for logs.
+6 -6
View File
@@ -7,12 +7,12 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/agent/skills"
"github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/modelcontext"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/skills"
"academy/internal/agent/tools"
"academy/internal/config"
"academy/internal/modelcontext"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)
+5 -5
View File
@@ -6,10 +6,10 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/agent/skills"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/sandbox"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/skills"
"academy/internal/config"
"academy/internal/sandbox"
"academy/internal/types"
)
// formatDocSummary cleans and truncates document summaries for table display
@@ -425,7 +425,7 @@ func formatToolGuidanceForMode(names []string, skillInstallMode bool, layout san
b.WriteString("For listed skills, run bundled scripts and your own scripts with " +
"shell_exec(skill_name=..., command=...). This selects an installed skill's runtime " +
"or stages host skill resources, and applies scoped credentials; " +
"use $WEKNORA_SKILL_DIR for bundled files.\n")
"use $ACADEMY_SKILL_DIR for bundled files.\n")
b.WriteString("In older instructions, translate execute_skill_script(skill_name, script_path, ...) " +
"to shell_exec(skill_name=..., command=...).\n")
}
+1 -1
View File
@@ -3,7 +3,7 @@ package agent
import (
"testing"
"github.com/Tencent/WeKnora/internal/agent/tools"
"academy/internal/agent/tools"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -3,8 +3,8 @@ package agent
import (
"testing"
"github.com/Tencent/WeKnora/internal/agent/skills"
"github.com/Tencent/WeKnora/internal/sandbox"
"academy/internal/agent/skills"
"academy/internal/sandbox"
"github.com/stretchr/testify/require"
)
@@ -73,7 +73,7 @@ func TestToolGuidanceOmitsHostWorkspaceWithUnsafeRoot(t *testing.T) {
}
func TestArtifactGuidanceUsesConfiguredOutputDirectory(t *testing.T) {
t.Setenv("WEKNORA_SKILL_OUTPUT_DIR", "/workspace/deliverables")
t.Setenv("ACADEMY_SKILL_OUTPUT_DIR", "/workspace/deliverables")
guidance := formatToolGuidance([]string{"shell_exec", "read_file"})
require.Contains(t, guidance, "/workspace/deliverables is the only directory collected for download")
require.NotContains(t, guidance, "/workspace/output is the only directory collected")
+1 -1
View File
@@ -52,7 +52,7 @@ Output format:
// WikiSummaryPrompt generates a summary page for a newly ingested document.
//
// Filename and title are intentionally NOT passed to the LLM: documents
// uploaded to WeKnora often carry filenames that say nothing about the
// uploaded to Academy often carry filenames that say nothing about the
// content (e.g. scanned PDFs named after the scanner model "MX5280.pdf"),
// and feeding such filenames to the model invites hallucinated summaries
// when the actual extracted content is thin. The model must rely solely on
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"strings"
"testing"
agenttools "github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
agenttools "academy/internal/agent/tools"
"academy/internal/models/chat"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+4 -4
View File
@@ -5,10 +5,10 @@ import (
"fmt"
"time"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/event"
"academy/internal/logger"
"academy/internal/models/chat"
"academy/internal/types"
)
// Resume continues a run that was suspended on a prompt, now answered. It
+5 -5
View File
@@ -5,11 +5,11 @@ import (
"encoding/json"
"testing"
"github.com/Tencent/WeKnora/internal/agent/approval"
"github.com/Tencent/WeKnora/internal/agent/policy"
"github.com/Tencent/WeKnora/internal/agent/tools"
"github.com/Tencent/WeKnora/internal/event"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/agent/approval"
"academy/internal/agent/policy"
"academy/internal/agent/tools"
"academy/internal/event"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/models/api"
"academy/internal/models/api"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -57,7 +57,7 @@ func (e *MissingSkillEnvError) Error() string {
// This is the second layer of reserved-name protection. Task 2's write-time
// blacklist is the first, but a value written before that blacklist existed
// would still be in the database, and letting it land on
// WEKNORA_SKILL_OUTPUT_DIR would silently redirect the turn's artifacts to a
// ACADEMY_SKILL_OUTPUT_DIR would silently redirect the turn's artifacts to a
// directory nobody drains. Skipping existing keys makes that impossible
// regardless of what is stored.
func ApplyResolvedEnv(env, resolved map[string]string) {
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"errors"
"testing"
"github.com/Tencent/WeKnora/internal/sandbox"
"academy/internal/sandbox"
"github.com/stretchr/testify/require"
)
+10 -10
View File
@@ -7,33 +7,33 @@ import (
"strings"
"sync"
"github.com/Tencent/WeKnora/internal/sandbox"
"academy/internal/sandbox"
)
// artifactOutputEnvVar is the name of the environment variable that WeKnora
// artifactOutputEnvVar is the name of the environment variable that Academy
// injects into every skill script execution. The value points to the
// convention-driven directory where the script should drop artifacts the user
// will be able to download after the turn completes.
//
// The name is stable across releases; skills reference it via os.getenv(...)
// so they never hard-code the path.
const artifactOutputEnvVar = "WEKNORA_SKILL_OUTPUT_DIR"
const artifactOutputEnvVar = "ACADEMY_SKILL_OUTPUT_DIR"
// sessionInputEnvVar points skill scripts at user-uploaded files restored into
// the current session's Cube. Inputs are separate from generated artifacts.
const sessionInputEnvVar = "WEKNORA_SESSION_INPUT_DIR"
const sessionInputEnvVar = "ACADEMY_SESSION_INPUT_DIR"
// artifactHistoryEnvVar is the name of the environment variable that points
// to the root artifact output directory (/workspace/output). Skill scripts
// can use this to self-discover artifacts from prior runs when they need to
// chain without LLM mediation.
const artifactHistoryEnvVar = "WEKNORA_SKILL_HISTORY_ROOT"
const artifactHistoryEnvVar = "ACADEMY_SKILL_HISTORY_ROOT"
// skillDirEnvVar points a script at its own directory inside the sandbox
// image. Installed skills run with /workspace as WorkDir, so this is how a
// script reaches the data and helpers that were installed beside it. The
// install-time verification pass exports the same name.
const skillDirEnvVar = "WEKNORA_SKILL_DIR"
const skillDirEnvVar = "ACADEMY_SKILL_DIR"
// nodePathEnvVar carries the skill's own node_modules. pythonPathEnvVar is
// never injected — a skill's Python packages arrive through its venv
@@ -45,7 +45,7 @@ const nodePathEnvVar = "NODE_PATH"
// InjectedSandboxEnvVars is every name skill environment preparation writes into the sandbox
// environment. The skill-env declaration blacklist must reject these so a
// stored value cannot redirect artifacts, the skill directory, or the session
// input tree. Credential names such as WEKNORA_API_KEY are not in this list.
// input tree. Credential names such as ACADEMY_API_KEY are not in this list.
func InjectedSandboxEnvVars() []string {
return []string{
artifactOutputEnvVar,
@@ -58,7 +58,7 @@ func InjectedSandboxEnvVars() []string {
}
// defaultArtifactOutputDir is used when neither the environment variable
// (WEKNORA_SKILL_OUTPUT_DIR) nor the ExecuteConfig.Env has an override.
// (ACADEMY_SKILL_OUTPUT_DIR) nor the ExecuteConfig.Env has an override.
// /workspace/output sits inside the base sandbox image's writable tree and
// is guaranteed to survive across Execute calls for the same session (Cube
// SessionBoundManager keeps the MicroVM alive between calls).
@@ -70,7 +70,7 @@ const defaultArtifactOutputDir = "/workspace/output"
// draining artifacts after Execute returns.
//
// Resolution order (first usable wins):
// 1. WEKNORA_SKILL_OUTPUT_DIR from the host environment (ops override), when
// 1. ACADEMY_SKILL_OUTPUT_DIR from the host environment (ops override), when
// it names a directory inside the session workspace.
// 2. defaultArtifactOutputDir.
//
@@ -310,7 +310,7 @@ func (m *Manager) ListSkillFiles(ctx context.Context, skillName string) ([]strin
// SandboxSkillDir reports where a skill lives inside the sandbox image, and
// whether that path means anything to say out loud.
//
// Only an installed skill has one. A host skill is uploaded from the WeKnora
// Only an installed skill has one. A host skill is uploaded from the Academy
// machine for the session, so its original base path names a directory that no
// sandbox shell command can reach — telling the model about it would be worse
// than saying nothing.
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/Tencent/WeKnora/internal/sandbox"
"academy/internal/sandbox"
)
// PrepareShellEnvironment attaches an allowed, installed skill's runtime to
@@ -5,8 +5,8 @@ import (
"strings"
"testing"
"github.com/Tencent/WeKnora/internal/sandbox"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/sandbox"
"academy/internal/types"
"github.com/stretchr/testify/require"
)
@@ -23,7 +23,7 @@ func TestShellEnvironmentSelectsOnlyAllowedInstalledSkills(t *testing.T) {
require.NoError(t, err)
require.Contains(t, wrapped, sandbox.ShellQuote(command))
require.Contains(t, wrapped, "/pdf/.venv/bin")
require.Contains(t, wrapped, "/pdf/.weknora/bin")
require.Contains(t, wrapped, "/pdf/.academy/bin")
require.Contains(t, wrapped, "--noprofile --norc")
require.Equal(t, "caller", actual["TOKEN"])
require.Equal(t, "/workspace/custom", actual["PYTHONPATH"],
@@ -49,7 +49,7 @@ func (h hostLayoutManager) SessionWorkspaceLayout(context.Context, string) (sand
}
func TestPrepareShellEnvironmentOnHostUsesLocalSkillsAndWorkspace(t *testing.T) {
root := "/Users/dev/.weknora/skills"
root := "/Users/dev/.academy/skills"
rows := []*types.TenantSkillEntity{{Name: "pdf", Status: types.SkillStatusReady, Enabled: true}}
m := NewManager(&ManagerConfig{Enabled: true}, hostLayoutManager{root: "/Users/dev/My Project"}).
WithSkillsRoot(root).
@@ -58,10 +58,10 @@ func TestPrepareShellEnvironmentOnHostUsesLocalSkillsAndWorkspace(t *testing.T)
cmd, env, err := m.PrepareShellEnvironment(context.Background(), "s1", "pdf", "python3 run.py", nil)
require.NoError(t, err)
require.Contains(t, cmd, root+"/pdf/.venv/bin")
require.Equal(t, root+"/pdf", env["WEKNORA_SKILL_DIR"])
require.Equal(t, "/Users/dev/My Project", env["WEKNORA_SKILL_OUTPUT_DIR"])
require.Equal(t, "/Users/dev/My Project", env["WEKNORA_SKILL_HISTORY_ROOT"])
_, hasInput := env["WEKNORA_SESSION_INPUT_DIR"]
require.Equal(t, root+"/pdf", env["ACADEMY_SKILL_DIR"])
require.Equal(t, "/Users/dev/My Project", env["ACADEMY_SKILL_OUTPUT_DIR"])
require.Equal(t, "/Users/dev/My Project", env["ACADEMY_SKILL_HISTORY_ROOT"])
_, hasInput := env["ACADEMY_SESSION_INPUT_DIR"]
require.False(t, hasInput)
}
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"sort"
"strings"
"github.com/Tencent/WeKnora/internal/sandbox"
"academy/internal/sandbox"
)
const (
Loaded 100 of 3136 files, more files were not shown because too many files have changed in this diff. Show more