Expand description
WebAssembly bindings for the AgentScript parser.
This module provides JavaScript-accessible functions for parsing AgentScript source code and working with the resulting AST.
§Example (JavaScript)
import init, { parse_agent, parse_agent_to_json, serialize_agent } from './sf_agentscript.js';
await init();
// Parse to JS object
const ast = parse_agent(source);
console.log(ast.config.agent_name);
// Or parse to JSON string
const json = parse_agent_to_json(source);
// Serialize AST back to source
const regenerated = serialize_agent(ast);Functions§
- init
- Initialize panic hook for better error messages in the browser console.
- normalize_
agent - Parse AgentScript source, then serialize it back.
- parse_
agent - Parse AgentScript source code and return the AST as a JavaScript object.
- parse_
agent_ to_ json - Parse AgentScript source code and return the AST as a JSON string.
- serialize_
agent - Serialize an AST back to AgentScript source code.
- validate_
agent - Validate AgentScript source code without returning the full AST.
- validate_
agent_ semantic - Validate AgentScript source code and return structured errors and warnings.
- version
- Get the version of the parser.