INNER CODE UNIT · TypeScript

isUsableSourceDepth

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

export function isUsableSourceDepth(value: number | undefined): value is number {
  return value !== undefined && Number.isInteger(value) && value >= 0
}

/**
 * The §4.1 trusted hop transition: ONE +1 per agent-to-agent delivery, against
 * the SAME `MAX_AGENT_CALL_HOPS` cap an internal call spends — so a mention
 * chain, a `messageAgent` chain, and a webchat continuation all consume the
 * one budget at the same rate. `refusal` is set when the edge must not run;
 * the caller records the message transcript-only and logs the refusal.
 */
export function hopTransition(sourceHopCount: number): {
  deliveryHopCount: number
  refusal?: { reason: 'hop_limit'; cap: number }
} {
  const deliveryHopCount = sourceHopCount + 1
  if (hasReachedAgentCallHopLimit(deliveryHopCount)) {
    return { deliveryHopCount, refusal: { reason: 'hop_limit', cap: MAX_AGENT_CALL_HOPS } }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…