MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / extractPausedInteraction

Function extractPausedInteraction

apps/cli/src/tooling.ts:259–286  ·  view source on GitHub ↗
(structured: unknown)

Source from the content-addressed store, hash-verified

257}
258
259export const extractPausedInteraction = (structured: unknown): PausedInteraction | undefined => {
260 if (!isRecord(structured) || !isRecord(structured.interaction)) {
261 return undefined;
262 }
263
264 const interaction = structured.interaction;
265 if (
266 (interaction.kind !== "url" && interaction.kind !== "form") ||
267 typeof interaction.message !== "string"
268 ) {
269 return undefined;
270 }
271
272 const base: PausedInteraction = {
273 kind: interaction.kind,
274 message: interaction.message,
275 };
276
277 if (interaction.kind === "url" && typeof interaction.url === "string") {
278 return { ...base, url: interaction.url };
279 }
280
281 if (interaction.kind === "form" && isRecord(interaction.requestedSchema)) {
282 return { ...base, requestedSchema: interaction.requestedSchema };
283 }
284
285 return base;
286};
287
288const schemaExample = (schema: unknown, depth = 0): unknown => {
289 if (!isRecord(schema) || depth > 4) return {};

Callers 2

executeCodeFunction · 0.90
tools-cli.test.tsFile · 0.90

Calls 1

isRecordFunction · 0.70

Tested by

no test coverage detected