Parse

codemode-gatewaysourcetypescript
Path: codemode-gateway/src/parse.tsRelative: src/parse.tsSubproject: codemode-gatewayCategory: codemode-gateway
Lines: 103Bytes: 2,885Imports: 0Exports: 7

Content Preview

  1. /**
  2. * Parse-don't-validate helpers for tool argument parsing.
  3. *
  4. * Each helper throws a plain `Error` with a `"<tool>: <field> ..."` message on
  5. * bad input. The codemode `ToolDispatcher` catches thrown errors and returns
  6. * them to the sandbox as `{ error: message }`, so the user's
  7. * `async () => { await cf.d1_query(...) }` sees a clear, field-specific error
  8. * without any host-side logging.
  9. */
  10. /** Assert `raw` is a plain object and return it as a string-keyed record. */
  11. export function as