refactor: unify env vars (UWF_HOME, OCAS_HOME) + env only in CLI (#37)
CI / check (pull_request) Failing after 3m6s

Breaking changes:
- UWF_STORAGE_ROOT → UWF_HOME
- WORKFLOW_STORAGE_ROOT removed (no fallback)
- OCAS_DIR → OCAS_HOME (aligned with ocas CLI)

Library functions no longer read process.env:
- util-agent/storage.ts: resolveStorageRoot(override), getGlobalCasDir(override)
- agent-hermes: isResumeDisabled(flag) pure function, CLI reads env
- agent-claude-code: CLI reads CLAUDE_MODEL and passes to agent

Fixes #37
This commit is contained in:
2026-06-04 05:12:05 +00:00
parent 84bdd81317
commit 6b7636b088
45 changed files with 394 additions and 333 deletions
+23 -3
View File
@@ -50,10 +50,19 @@ Agent CLIs call `createAgent(...)` and invoke the returned function as `main()`.
### Context
```typescript
function buildContext(threadId: ThreadId, role: string): Promise<AgentContext>
function buildContext(
threadId: ThreadId,
role: string,
edgePrompt: string,
storageRoot: string,
casDir: string,
): Promise<AgentContext>
function buildContextWithMeta(
threadId: ThreadId,
role: string,
edgePrompt: string,
storageRoot: string,
casDir: string,
): Promise<AgentContext & { meta: BuildContextMeta }>
type AgentContext = ModeratorContext & {
@@ -64,6 +73,8 @@ type AgentContext = ModeratorContext & {
outputFormatInstruction: string;
edgePrompt: string;
isFirstVisit: boolean;
storageRoot: string;
casDir: string;
};
type BuildContextMeta = {
@@ -99,6 +110,8 @@ function extract(
rawOutput: string,
outputSchema: CasRef,
config: WorkflowConfig,
storageRoot: string,
casDir: string,
): Promise<ExtractResult>
type ResolvedLlmProvider = { baseUrl: string; apiKey: string; model: string };
@@ -120,11 +133,18 @@ type FrontmatterFastPathResult = { body: string; outputHash: CasRef };
### Session cache
```typescript
function getCachedSessionId(threadId: ThreadId, role: string): Promise<string | null>
function getCachedSessionId(
agentName: string,
threadId: ThreadId,
role: string,
storageRoot: string,
): Promise<string | null>
function setCachedSessionId(
agentName: string,
threadId: ThreadId,
role: string,
sessionId: string,
storageRoot: string,
): Promise<void>
```
@@ -133,7 +153,7 @@ function setCachedSessionId(
```typescript
function getConfigPath(storageRoot: string): string
function getEnvPath(storageRoot: string): string
function resolveStorageRoot(): string
function resolveStorageRoot(override: string | null): string
function loadWorkflowConfig(storageRoot: string): Promise<WorkflowConfig>
```