MCPcopy Index your code
hub / github.com/anomalyco/opencode / state

Function state

packages/opencode/src/cli/cmd/run/variant.shared.ts:116–137  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

114}
115
116function state(value: unknown): ModelState {
117 if (!isRecord(value)) {
118 return {}
119 }
120
121 const variant = isRecord(value.variant)
122 ? Object.fromEntries(
123 Object.entries(value.variant).flatMap(([key, item]) => {
124 if (typeof item !== "string") {
125 return []
126 }
127
128 return [[key, item] as const]
129 }),
130 )
131 : undefined
132
133 return {
134 ...value,
135 variant,
136 }
137}
138
139function createLayer(fs = AppNodeBuilder.build(FSUtil.node)) {
140 return Layer.fresh(

Callers 13

RunQuestionBodyFunction · 0.70
saveCustomFunction · 0.70
chooseFunction · 0.70
selectFunction · 0.70
submitFunction · 0.70
activeFunction · 0.70
answeredFunction · 0.70
valueFunction · 0.70
hitFunction · 0.70
createLayerFunction · 0.70
RunPermissionBodyFunction · 0.70
runFunction · 0.70

Calls 1

isRecordFunction · 0.90

Tested by

no test coverage detected