MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / notifyRuntimeNodeAgentBridgeEvent

Function notifyRuntimeNodeAgentBridgeEvent

projects/runtime-node/src/agents.ts:442–462  ·  view source on GitHub ↗
(server: RuntimeServer, method: string, params: unknown)

Source from the content-addressed store, hash-verified

440}
441
442export function notifyRuntimeNodeAgentBridgeEvent(server: RuntimeServer, method: string, params: unknown): void {
443 const record = asRecord(params)
444 const providerId = optionalString(record.providerId)
445 const threadId = threadIdFromValue(params)
446 const turnId = turnIdFromValue(params)
447 if (providerId && threadId && turnId && method === "agent/turn/started") {
448 createOrUpdateServerProtocolTurnRuntime(server, { providerId, threadId, turnId, status: "running" })
449 } else if (providerId && threadId && (method === "agent/turn/completed" || method === "agent/turn/failed")) {
450 const targetTurnId = turnId ?? latestServerProtocolTurnRuntime(server, providerId, threadId)?.nativeId
451 if (targetTurnId) {
452 createOrUpdateServerProtocolTurnRuntime(server, {
453 providerId,
454 threadId,
455 turnId: targetTurnId,
456 status: method === "agent/turn/completed" ? "completed" : "failed",
457 error: typeof record.error === "string" ? record.error : undefined,
458 })
459 }
460 }
461 server.notify(method, params)
462}
463
464export function registerRuntimeNodeServerProtocolAgentBridge(
465 bridge: RuntimeNodeServerProtocolAgentBridge,

Callers 3

onNotificationFunction · 0.90
onNotificationFunction · 0.90

Calls 7

threadIdFromValueFunction · 0.85
turnIdFromValueFunction · 0.85
notifyMethod · 0.80
asRecordFunction · 0.70
optionalStringFunction · 0.70

Tested by

no test coverage detected