feat(cli): unify uwf CAS store with global json-cas store
This resolves issue #573 by moving uwf's CAS directory from ~/.uncaged/workflow/cas/ to the shared ~/.uncaged/json-cas/ location. Changes: - Added getGlobalCasDir() function with UNCAGED_CAS_DIR support - Updated createUwfStore() to use global CAS directory - Added comprehensive test coverage (11 new tests) - Updated all existing tests for environment isolation - Updated documentation (CLAUDE.md, README.md) Benefits: - Cross-tool visibility: json-cas CLI can read uwf-created nodes - Schema sharing: both tools access same schema registry - Future-proofing: enables json-cas render/verbose for uwf data Fixes #573 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,8 @@ const DETAIL_SCHEMA = {
|
|||||||
async function makeUwfStore(storageRoot: string): Promise<UwfStore> {
|
async function makeUwfStore(storageRoot: string): Promise<UwfStore> {
|
||||||
const casDir = join(storageRoot, "cas");
|
const casDir = join(storageRoot, "cas");
|
||||||
await mkdir(casDir, { recursive: true });
|
await mkdir(casDir, { recursive: true });
|
||||||
|
// Set UNCAGED_CAS_DIR to use the test's CAS directory
|
||||||
|
process.env.UNCAGED_CAS_DIR = casDir;
|
||||||
const store = createFsStore(casDir);
|
const store = createFsStore(casDir);
|
||||||
const schemas = await registerUwfSchemas(store);
|
const schemas = await registerUwfSchemas(store);
|
||||||
return { storageRoot, store, schemas };
|
return { storageRoot, store, schemas };
|
||||||
@@ -696,7 +698,7 @@ describe("thread read XML tag isolation", () => {
|
|||||||
agent: "uwf-test",
|
agent: "uwf-test",
|
||||||
startedAtMs: 1000000000000,
|
startedAtMs: 1000000000000,
|
||||||
completedAtMs: 1000000005000,
|
completedAtMs: 1000000005000,
|
||||||
assembledPrompt: null,
|
assembledPrompt: null,
|
||||||
})) as CasRef;
|
})) as CasRef;
|
||||||
steps.push(step);
|
steps.push(step);
|
||||||
prev = step;
|
prev = step;
|
||||||
|
|||||||
@@ -373,7 +373,12 @@ step
|
|||||||
process.stderr.write("invalid --quota: must be a positive integer\n");
|
process.stderr.write("invalid --quota: must be a positive integer\n");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
const markdown = await cmdStepRead(storageRoot, stepHash as CasRef, quota, opts.prompt === true);
|
const markdown = await cmdStepRead(
|
||||||
|
storageRoot,
|
||||||
|
stepHash as CasRef,
|
||||||
|
quota,
|
||||||
|
opts.prompt === true,
|
||||||
|
);
|
||||||
process.stdout.write(markdown.endsWith("\n") ? markdown : `${markdown}\n`);
|
process.stdout.write(markdown.endsWith("\n") ? markdown : `${markdown}\n`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export {
|
export {
|
||||||
generateBootstrapReference as cmdSkillBootstrap,
|
|
||||||
generateAdapterReference as cmdSkillAdapter,
|
generateAdapterReference as cmdSkillAdapter,
|
||||||
generateAuthorReference as cmdSkillAuthor,
|
generateAuthorReference as cmdSkillAuthor,
|
||||||
|
generateBootstrapReference as cmdSkillBootstrap,
|
||||||
generateDeveloperReference as cmdSkillDeveloper,
|
generateDeveloperReference as cmdSkillDeveloper,
|
||||||
generateUserReference as cmdSkillUser,
|
generateUserReference as cmdSkillUser,
|
||||||
} from "@uncaged/workflow-util";
|
} from "@uncaged/workflow-util";
|
||||||
|
|||||||
@@ -311,7 +311,10 @@ export async function cmdStepRead(
|
|||||||
if (promptNode === null) {
|
if (promptNode === null) {
|
||||||
return `# Step ${stepHash}\n\n_Prompt CAS node not found: ${promptRef}_`;
|
return `# Step ${stepHash}\n\n_Prompt CAS node not found: ${promptRef}_`;
|
||||||
}
|
}
|
||||||
const promptText = typeof promptNode.payload === "string" ? promptNode.payload : JSON.stringify(promptNode.payload);
|
const promptText =
|
||||||
|
typeof promptNode.payload === "string"
|
||||||
|
? promptNode.payload
|
||||||
|
: JSON.stringify(promptNode.payload);
|
||||||
return `# Step ${stepHash}\n\n**Role:** ${payload.role}\n**Agent:** ${payload.agent}\n\n## Prompt\n\n${promptText}`;
|
return `# Step ${stepHash}\n\n**Role:** ${payload.role}\n**Agent:** ${payload.agent}\n\n## Prompt\n\n${promptText}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,12 @@ async function runBuiltinWithMessages(
|
|||||||
session.startedAtMs,
|
session.startedAtMs,
|
||||||
);
|
);
|
||||||
|
|
||||||
return { output: stripPreamble(loopResult.finalText), detailHash, sessionId: session.sessionId, assembledPrompt: "" };
|
return {
|
||||||
|
output: stripPreamble(loopResult.finalText),
|
||||||
|
detailHash,
|
||||||
|
sessionId: session.sessionId,
|
||||||
|
assembledPrompt: "",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runBuiltin(ctx: AgentContext): Promise<AgentRunResult> {
|
async function runBuiltin(ctx: AgentContext): Promise<AgentRunResult> {
|
||||||
|
|||||||
@@ -120,7 +120,11 @@ function spawnClaudeResume(
|
|||||||
return spawnClaude(args);
|
return spawnClaude(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processClaudeOutput(stdout: string, store: Store, assembledPrompt: string): Promise<AgentRunResult> {
|
async function processClaudeOutput(
|
||||||
|
stdout: string,
|
||||||
|
store: Store,
|
||||||
|
assembledPrompt: string,
|
||||||
|
): Promise<AgentRunResult> {
|
||||||
const parsed = parseClaudeCodeStreamOutput(stdout);
|
const parsed = parseClaudeCodeStreamOutput(stdout);
|
||||||
|
|
||||||
if (parsed !== null) {
|
if (parsed !== null) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const editNodeViewModel = define.view("editNodeView", editNodeView, (set,
|
|||||||
function start(nodeId: string) {
|
function start(nodeId: string) {
|
||||||
const [nodes] = model.use(nodesModel);
|
const [nodes] = model.use(nodesModel);
|
||||||
const node = nodes.find((n) => n.id === nodeId);
|
const node = nodes.find((n) => n.id === nodeId);
|
||||||
if (!node || node.type !== "role") return;
|
if (node?.type !== "role") return;
|
||||||
set({ node: node as WorkNode<"role"> });
|
set({ node: node as WorkNode<"role"> });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function traverse(
|
|||||||
visited.add(nodeId);
|
visited.add(nodeId);
|
||||||
|
|
||||||
const node = nodeMap.get(nodeId);
|
const node = nodeMap.get(nodeId);
|
||||||
if (!node || node.type !== "role") return;
|
if (node?.type !== "role") return;
|
||||||
|
|
||||||
const roleNode = node as WorkNode<"role">;
|
const roleNode = node as WorkNode<"role">;
|
||||||
const outEdges = outgoingEdges.get(nodeId) ?? [];
|
const outEdges = outgoingEdges.get(nodeId) ?? [];
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe("Protocol types for thread/edge location", () => {
|
|||||||
edgePrompt: "Plan the implementation",
|
edgePrompt: "Plan the implementation",
|
||||||
startedAtMs: Date.now(),
|
startedAtMs: Date.now(),
|
||||||
completedAtMs: Date.now() + 1000,
|
completedAtMs: Date.now() + 1000,
|
||||||
assembledPrompt: null,
|
assembledPrompt: null,
|
||||||
cwd: "/home/user/project",
|
cwd: "/home/user/project",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
export { generateActorReference } from "./actor-reference.js";
|
export { generateActorReference } from "./actor-reference.js";
|
||||||
export { generateBootstrapReference } from "./bootstrap-reference.js";
|
|
||||||
export { generateAdapterReference } from "./adapter-reference.js";
|
export { generateAdapterReference } from "./adapter-reference.js";
|
||||||
export { generateArchitectureReference } from "./architecture-reference.js";
|
export { generateArchitectureReference } from "./architecture-reference.js";
|
||||||
export { generateAuthorReference } from "./author-reference.js";
|
export { generateAuthorReference } from "./author-reference.js";
|
||||||
export { encodeUint64AsCrockford } from "./base32.js";
|
export { encodeUint64AsCrockford } from "./base32.js";
|
||||||
|
export { generateBootstrapReference } from "./bootstrap-reference.js";
|
||||||
export { generateCliReference } from "./cli-reference.js";
|
export { generateCliReference } from "./cli-reference.js";
|
||||||
export { generateDeveloperReference } from "./developer-reference.js";
|
export { generateDeveloperReference } from "./developer-reference.js";
|
||||||
export { env } from "./env.js";
|
export { env } from "./env.js";
|
||||||
|
|||||||
Reference in New Issue
Block a user