refactor: extract wrapAgentAsAdapter to util-agent, support childThread in RoleFn (#222)

This commit is contained in:
2026-05-13 02:37:32 +00:00
parent 1f4bd3f431
commit ec4599a230
16 changed files with 55 additions and 41 deletions
@@ -84,7 +84,8 @@ async function advanceOneRound<M extends RoleMeta>(
const adapter = adapterForRole(binding, next);
const roleFn = adapter(roleDef.systemPrompt, roleDef.schema as z.ZodType<Record<string, unknown>>);
const meta = await roleFn(modCtx as unknown as ThreadContext, runtime);
const result = await roleFn(modCtx as unknown as ThreadContext, runtime);
const meta = result.meta;
const refsFromMeta = resolveExtractedRefs(
roleDef as unknown as RoleDefinition<Record<string, unknown>>,
@@ -110,7 +111,7 @@ async function advanceOneRound<M extends RoleMeta>(
contentHash: step.contentHash,
meta: step.meta,
refs: step.refs,
childThread: null,
childThread: result.childThread,
},
step,
};
+1
View File
@@ -20,6 +20,7 @@ export type {
Result,
RoleDefinition,
RoleFn,
RoleResult,
RoleMeta,
RoleOutput,
RoleStep,
+1
View File
@@ -24,6 +24,7 @@ export type {
Result,
RoleDefinition,
RoleFn,
RoleResult,
RoleMeta,
RoleOutput,
RoleStep,
+1
View File
@@ -0,0 +1 @@
/home/azureuser/repos/workflow/packages/workflow-runtime