Expand description
WASM Bindings for DX Serializer VS Code Extension
Provides the DxSerializer interface for the VS Code extension with:
to_human: Transform LLM format to human-readable formatto_dense: Transform human-readable format to LLM formatvalidate: Validate content syntax with detailed error infois_saveable: Check if content is complete enough to save- Security limits: max_input_size, max_recursion_depth, max_table_rows
- Token counting: count_tokens, count_tokens_all
§LLM Format (on disk)
config[name=dx,version=0.0.1,title="Enhanced Developing Experience"]
workspace[paths=@/www,@/backend]
editors[items=neovim,zed,vscode,default=neovim]§Human Format (in editor)
name = dx
version = 0.0.1
title = "Enhanced Developing Experience"
[workspace]
paths:
- @/www
- @/backend
[editors]
items:
- neovim
- zed
- vscode
default = neovim§Usage from JavaScript
import init, { DxSerializer } from 'dx_serializer';
await init();
const serializer = new DxSerializer();
// Transform LLM to human (for editor display)
const result = serializer.toHuman('config[name=dx,version=0.0.1]');
if (result.success) {
console.log(result.content);
}
// Transform human to LLM (for disk storage)
const llmResult = serializer.toDense(humanContent);
// Validate content
const validation = serializer.validate(content);
if (!validation.success) {
console.log(`Error at line ${validation.line}: ${validation.error}`);
}Structs§
- AllToken
Counts Result - Result of token counting for all primary models
- DxSerializer
- DX Serializer for VS Code extension
- Serializer
Config - Serializer configuration for the VS Code extension
- Token
Count Result - Result of token counting for a single model
- Transform
Result - Result of a transformation operation
- Validation
Result - Result of a validation operation
Functions§
- smart_
quote - Apply smart quoting to a string value