INNER CODE UNIT · TypeScript

webchatContinuationDecision

agentconnect-md/agentconnect · packages/activation-policy/src/index.ts:398

export function webchatContinuationDecision(
  author: WebchatPostAuthorFacts,
  targetAgentId: string
): WebchatContinuationDecision {
  if (author.kind !== 'agent' || author.agentId === undefined) return { activate: false, reason: 'user_post' }
  if (author.agentId === targetAgentId) return { activate: false, reason: 'self' }
  if (!isUsableSourceDepth(author.hopCount)) return { activate: false, reason: 'no_usable_depth' }
  const transition = hopTransition(author.hopCount)
  if (transition.refusal) {
    return {
      activate: false,
      reason: 'hop_limit',
      authorAgentId: author.agentId,
      sourceHopCount: author.hopCount,
      cap: transition.refusal.cap
    }
  }
  return { activate: true, authorAgentId: author.agentId, deliveryHopCount: transition.deliveryHopCount }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…