feat(#194): Phase 2 — Engine layer Merkle call stack wiring
- Protocol: AgentFnResult = string | { output, childThread }, RoleOutput.childThread,
ThreadContext.bundleHash for parent state lookup
- Runtime: create-workflow normalizes AgentFnResult, propagates childThread in RoleOutput
- Engine: ExecuteThreadOptions.parentStateHash, appendStateForStep writes childThread,
putStartNode uses parentStateHash
- workflowAsAgent: reads parent head state from threads.json, passes parentStateHash
to child, returns { output, childThread: rootHash }
- Integration test: 4 cases verifying bidirectional Merkle links (306 lines)
Phase 2 of #194 (Merkle Call Stack). Closes #196.
小橘 <xiaoju@shazhou.work>
This commit is contained in:
@@ -17,6 +17,7 @@ describe("buildAgentPrompt", () => {
|
||||
const ctx: AgentContext = {
|
||||
start: startTask("fix the bug"),
|
||||
depth: 0,
|
||||
bundleHash: "TESTHASH00001",
|
||||
steps: [],
|
||||
threadId: "01TEST000000000000000000TR",
|
||||
currentRole: { name: START, systemPrompt: "You are an agent." },
|
||||
@@ -33,6 +34,7 @@ describe("buildAgentPrompt", () => {
|
||||
const ctx: AgentContext = {
|
||||
start: startTask("user task"),
|
||||
depth: 0,
|
||||
bundleHash: "TESTHASH00001",
|
||||
threadId: "01TEST000000000000000000TR",
|
||||
currentRole: { name: "coder", systemPrompt: "Be helpful." },
|
||||
steps: [
|
||||
@@ -61,6 +63,7 @@ describe("buildAgentPrompt", () => {
|
||||
const ctx: AgentContext = {
|
||||
start: startTask("first message full: task content here"),
|
||||
depth: 0,
|
||||
bundleHash: "TESTHASH00001",
|
||||
threadId: "01TEST000000000000000000TR",
|
||||
currentRole: { name: "coder", systemPrompt: "System." },
|
||||
steps: [
|
||||
@@ -99,6 +102,7 @@ describe("buildAgentPrompt", () => {
|
||||
const ctx: AgentContext = {
|
||||
start: startTask("start"),
|
||||
depth: 0,
|
||||
bundleHash: "TESTHASH00001",
|
||||
threadId: "01TEST000000000000000000TR",
|
||||
currentRole: { name: "c", systemPrompt: "S" },
|
||||
steps: [
|
||||
|
||||
Reference in New Issue
Block a user