Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.1 KB
Raw Blame
import { AGENT_SIGNAL_SOURCE_TYPES } from '@lobechat/agent-signal/source';

import type { SourceRenderer } from '../types';
import { createBaseSource } from './shared';

export const runtimeAfterStepRenderer = {
  render(input) {
    return {
      ...createBaseSource(input),
      payload: {
        agentId: typeof input.payload.agentId === 'string' ? input.payload.agentId : undefined,
        operationId: String(input.payload.operationId ?? input.sourceId),
        serializedContext:
          typeof input.payload.serializedContext === 'string'
            ? input.payload.serializedContext
            : undefined,
        stepIndex: typeof input.payload.stepIndex === 'number' ? input.payload.stepIndex : 0,
        topicId: typeof input.payload.topicId === 'string' ? input.payload.topicId : undefined,
        turnCount:
          typeof input.payload.turnCount === 'number' ? input.payload.turnCount : undefined,
      },
      sourceType: AGENT_SIGNAL_SOURCE_TYPES.runtimeAfterStep,
    };
  },
  sourceType: AGENT_SIGNAL_SOURCE_TYPES.runtimeAfterStep,
} satisfies SourceRenderer;