MCPcopy Index your code
hub / github.com/coder/mux / extractFinishReason

Function extractFinishReason

src/node/services/devToolsMiddleware.ts:32–52  ·  view source on GitHub ↗
(reason: unknown)

Source from the content-addressed store, hash-verified

30}
31
32function extractFinishReason(reason: unknown): string | undefined {
33 if (typeof reason === "string") {
34 return reason;
35 }
36
37 if (!isRecord(reason)) {
38 return undefined;
39 }
40
41 const raw = reason.raw;
42 if (typeof raw === "string" && raw.length > 0) {
43 return raw;
44 }
45
46 const unified = reason.unified;
47 if (typeof unified === "string" && unified.length > 0) {
48 return unified;
49 }
50
51 return undefined;
52}
53
54function extractTokenTotal(value: unknown): number | undefined {
55 if (typeof value === "number") {

Callers 2

extractGenerateOutputFunction · 0.85
collectChunkFunction · 0.85

Calls 1

isRecordFunction · 0.70

Tested by

no test coverage detected