Runtime Commands and Execution Semantics
This page documents the operational command surface of the current SOP-Lang Pipeline runtime. Each command listed below links to a detailed chapter with syntax, examples, and interaction patterns.
Command Catalog
def/define: lightweight JavaScript-backed command definitions using function bodies.prompt: block command for multi-line prompt declarations terminated byend.form: block command parsed into structured field specifications and exposed asFormobjects.new/lookup: creation and retrieval of custom type instances.overwrite: controlled mutation of simple assign-derived values and aliases.best: retry-and-score loop command (retries,scoreCommand,workCommand,args...) for selecting best result.currentDocIdandimport: current document context and script import behavior.
Conditional Execution Details
Conditional execution with ? is accepted both as a prefix and as a suffix on command names (for example ?cmd and cmd?). For member calls, conditional form is supported as object.?method. Guarded commands execute only when all direct inputs are defined and non-empty.
Forced execution with ! is accepted both as prefix and suffix on command names (for example !cmd and cmd!). A forced command is evaluated on every build pass even when dependency clocks did not change. This replaces prior hardcoded always-recompute exceptions and makes polling semantics explicit in script code.
Member Access and Chain Aliases
Dot-notation variable references such as $item.field are preprocessed into internal chain-alias variables. This allows field-style access inside commands while keeping dependencies explicit in the graph.
Built-In Custom Type Runtime
Document: document metadata and structural operations for titles, commands, and paragraph text/commands.Table: table row insertion and merge semantics with computed columns and row identifiers.Set: container operations plus macro-driven mapping and jsdef-based filtering/reduction semantics.Workflow,Chat,Form: orchestration entities for interactive workflows and conversation handling.Folder: filesystem-aware helper object for absolute-path resolution and change detection withfolder.newer.
@doc new Document "doc1"
doc.setChapterTitle 1 "Title for chapter 1"
@t1 new Table "c1" "c2" "c3" "c4: math c2 * c3"
@rowsSet new Set world0 world1 world2
@agentWorkflow new Workflow "OnboardingAgent"
@chat new Chat history context mainAgent
Execution Model Notes
Runtime execution is graph-based and clock-driven: variables are recomputed when dependency clocks indicate stale outputs. Aliases, macro expansions, object methods such as folder.newer, and commands such as import are integrated into this same build cycle.