Skip to main content

Module wasm

Module wasm 

Source
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 format
  • to_dense: Transform human-readable format to LLM format
  • validate: Validate content syntax with detailed error info
  • is_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§

AllTokenCountsResult
Result of token counting for all primary models
DxSerializer
DX Serializer for VS Code extension
SerializerConfig
Serializer configuration for the VS Code extension
TokenCountResult
Result of token counting for a single model
TransformResult
Result of a transformation operation
ValidationResult
Result of a validation operation

Functions§

smart_quote
Apply smart quoting to a string value