For the complete documentation index, see llms.txt. This page is also available as Markdown.

📜LLM Guide

A rule sheet to paste into an LLM's context window so it generates correct vcon-js 0.5.2 code.

Paste this page into a model's context when it writes code against vcon-js 0.5.2.

Spec target: draft-ietf-vcon-vcon-core, syntax "vcon": "0.4.0". Library version 0.5.2. Field rules: field reference.

Rules

Output that breaks these is not a valid vCon.

  1. Syntax parameter. Vcon.buildNew() sets vcon: "0.4.0". Do not override it.

  2. Field names. amended, never appended. critical, never must_support or must_understand. mediatype, never mimetype. Use addCriticalExtension(name) to write critical[].

  3. Attachments use purpose. There is no type field on attachments, including the lawful basis attachment: purpose: 'lawful_basis'. Always pass start; the core schema requires it and addAttachment does not fill it in.

  4. Analysis requires vendor. Use schema to name the body format. Never write schema_version.

  5. Structured bodies. Pass objects and arrays as the value. addAnalysis serializes an object or array body to a string and sets encoding: 'json' for you. addAttachment stores the body as given, so pass encoding: 'json' with an object body.

  6. External media needs url and content_hash. The hash is sha512-<base64url> of the file bytes. Compute it with createHash('sha512').update(bytes).digest('base64url') from node:crypto. Never write a placeholder hash into output.

  7. Timestamps are RFC 3339 with timezone. Use new Date().toISOString() or an explicit offset.

  8. Do not emit empty group: [] or redacted: {}.

  9. Transcripts are analysis, not attachments. Use type: 'wtf_transcription' for the WTF extension.

  10. There is no signing in the library. Do not call vcon.sign() or read vcon.signatures. Version 0.5.2 removed Signature, signature, signatures, and payload from the types.

API at a glance

Vcon: buildNew(), buildFromJson(json), addParty(party) (returns void), addDialog(dialog), addAttachment(params), addAnalysis(params), addTag(key, value), getTag(key), tags, addExtension(name), addCriticalExtension(name), hasExtension(name), isCriticalExtension(name), findPartyIndex(by, val), findDialog(by, val), findAttachmentByPurpose(purpose), findAnalysisByType(type), toJson(), toDict().

Party: identifiers tel, sip, mailto, stir, did. Descriptive name, role, type, org, dept, validation, civicaddress, timezone, meta.

Dialog: type is 'recording' | 'text' | 'transfer' | 'incomplete' | 'recording-set'. Required type and start. Inline: addInlineData(body, mediatype, { encoding, filename }). External: addExternalData(url, mediatype, { filename, content_hash }). Checks: isText, isRecording, isAudio, isVideo, isEmail, isInlineData, isExternalData, validate().

Attachment: purpose required, party and dialog default to 0. Attachment.VALID_ENCODINGS is ['base64url', 'json', 'none'].

Analysis is a type. Pass a plain object to addAnalysis() with type and vendor. dialog is optional because an analysis may key off attachment.

Party indices. addParty returns nothing. Use vcon.parties.length - 1 or vcon.findPartyIndex('name', 'Alice').

Canonical example

Common bugs in generated code

  • const idx = vcon.addParty(...). addParty returns void. Use vcon.parties.length - 1.

  • vcon.addAttachment({ type: 'lawful_basis', ... }). Attachments have no type. Use purpose: 'lawful_basis'.

  • vcon.addAttachment({ type: 'transcript', ... }). Transcripts live in analysis[]. Use addAnalysis.

  • appended: {...} or must_support: [...]. Use amended and critical[].

  • start: '2026-05-18 14:00:00' with no timezone. Use .toISOString().

  • External media without content_hash, or with a made-up hash.

  • Importing Signature or calling a signing method. Removed in 0.5.2.

  • Mutating an Attachment after vcon.addAttachment(att) and expecting the vCon to change. The vCon holds a copy.

Extension shapes

vcon-js has no per-extension helpers. Build the attachment or analysis yourself from the page for that extension: Lawful Basis, WTF Transcription, and the rest of the Extensions section. Only provenance on dialog and analysis is typed.

See also

Last updated

Was this helpful?