MCPcopy Index your code
hub / github.com/simstudioai/sim / materializeField

Function materializeField

apps/sim/lib/logs/log-views.ts:136–158  ·  view source on GitHub ↗

* Resolve a span field that may be inline OR a large-value ref/manifest. Falls * back to the ref `preview` (or a placeholder) when the value is unavailable or * exceeds caps — never throws.

(value: unknown, ctx: LogViewContext)

Source from the content-addressed store, hash-verified

134 * exceeds caps — never throws.
135 */
136async function materializeField(value: unknown, ctx: LogViewContext): Promise<unknown> {
137 if (isLargeArrayManifest(value)) {
138 try {
139 return await materializeLargeArrayManifest(value, ctx)
140 } catch {
141 return value.preview ?? '[large array unavailable]'
142 }
143 }
144 if (isLargeValueRef(value)) {
145 try {
146 const materialized = await materializeLargeValueRef(value, {
147 ...ctx,
148 maxBytes: ctx.maxBytes ?? SINGLE_REF_MAX_BYTES,
149 })
150 return materialized === undefined
151 ? (value.preview ?? '[large value unavailable]')
152 : materialized
153 } catch {
154 return value.preview ?? '[large value unavailable]'
155 }
156 }
157 return value
158}
159
160// ---------------------------------------------------------------------------
161// Grep (single execution): stream large refs chunk-by-chunk, release each.

Callers 1

fullSpanFunction · 0.85

Calls 4

isLargeArrayManifestFunction · 0.90
isLargeValueRefFunction · 0.90
materializeLargeValueRefFunction · 0.90

Tested by

no test coverage detected