MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / getAssistantDiagnostics

Function getAssistantDiagnostics

src/runtime/agent.ts:374–397  ·  view source on GitHub ↗
(message: any)

Source from the content-addressed store, hash-verified

372}
373
374function getAssistantDiagnostics(message: any): AssistantDiagnostics | null {
375 if (!message || message.role !== "assistant") {
376 return null;
377 }
378
379 const stopReason = message.stopReason ?? "unknown";
380 const errorMessage =
381 message.errorMessage ||
382 (stopReason === "error" || stopReason === "aborted"
383 ? `Request ${stopReason}`
384 : "");
385
386 const content = Array.isArray(message.content) ? message.content : [];
387 const text = content
388 .filter((item: any) => item?.type === "text")
389 .map((item: any) => item.text || "")
390 .join("")
391 .trim();
392 const toolCalls = content.filter(
393 (item: any) => item?.type === "toolCall",
394 ).length;
395
396 return { stopReason, errorMessage, hasText: text.length > 0, toolCalls };
397}
398
399function getLifecycleTrigger(channelId: string): LifecycleTrigger {
400 const platform = detectPlatformFromChannelId(channelId);

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected