{"version":3,"file":"action.cjs","names":["snowflake","executeSnowflakeTool"],"sources":["../src/action.ts"],"sourcesContent":["import type { AppAction } from \"@keystrokehq/keystroke/app\";\nimport { z } from \"zod\";\n\nimport { snowflake } from \"./app\";\nimport { executeSnowflakeTool } from \"./execute\";\n\n/** Bind one gateway tool to a typed app action; the call's output is parsed against `def.output`. */\nexport function action<TInput extends z.ZodType, TOutput extends z.ZodType>(\n  tool: string,\n  def: {\n    slug: string;\n    name: string;\n    description: string;\n    input: TInput;\n    output: TOutput;\n  },\n): AppAction<TInput, TOutput, typeof snowflake.credential> {\n  return snowflake.action({\n    slug: def.slug,\n    name: def.name,\n    description: def.description,\n    input: def.input,\n    output: def.output,\n    async run(input) {\n      return def.output.parse(await executeSnowflakeTool(tool, input as Record<string, unknown>));\n    },\n  });\n}\n"],"mappings":";;;;;AAOA,SAAgB,OACd,MACA,KAOyD;CACzD,OAAOA,YAAAA,UAAU,OAAO;EACtB,MAAM,IAAI;EACV,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,OAAO,IAAI;EACX,QAAQ,IAAI;EACZ,MAAM,IAAI,OAAO;GACf,OAAO,IAAI,OAAO,MAAM,MAAMC,gBAAAA,qBAAqB,MAAM,KAAgC,CAAC;EAC5F;CACF,CAAC;AACH"}