SutraFlow Architecture

Version 2.1.8 · how it works, what each file does, deployment and features · User guide · Administration Guide

What SutraFlow is

SutraFlow is an integration designer and engine. People draw Sutras (integration processes) in a browser studio, and the engine runs them: REST and SOAP services, file and database jobs, queues, email, cloud apps, scripts, AI steps and skills for AI assistants. One Node.js program holds the studio, the engine and the gateway; the same program runs headless in production, alone or as a cluster on PostgreSQL.

Words used on this page

TermMeaning
SutraOne process: steps (activities) joined by connections, stored as a JSON document with nodes and edges.
Activity, paletteA step type (HTTP request, Write file, AI prompt) and the group it belongs to in the studio.
TriggerThe first activity: what starts a run (REST request, timer, file, mailbox, queue, channel, MCP skill, Start for manual runs).
Run, taskOne execution of a Sutra, and one execution of one step within it. Both are database rows.
ProjectA group of Sutras with shared connections, schemas, Project variables and logging. The unit of release.
Connection (resource)Reusable settings for an outside system: HTTP, SOAP, database, bus, email, AI provider, MCP server and more.
Project properties{{gv.NAME}}: administrator-managed values per project, overridable per environment by the deployment config and read-only to Sutras.
Sutra variables{{vars.name}}: values within one run.
Engine propertiesServer-level settings readable by every Sutra and changeable only by administrators.
PackageA .sutra file: a release of a whole project, with a checksum, deployed unchanged to test and production.
Studio, engine, gatewayThe browser application; the step runner; the listener for deployed services.

Version 2.1.8: 142 activities in 22 palettes, 25 connection types, 60 samples, 276 admin API routes, 59 tables.

The running server

One SutraFlow server (Node.js 24)Browserstudio, user guidesutra CLI, CIpackages, Bearer tokenAPI callersREST, SOAPAI assistantsMCP toolsAdmin API :4800studio, runs, resourcesPackagescheck, deploy, rollbackGateway :8080 / :8443REST, SOAP, TLS, policiesMCP endpoint/mcp, Sutras as skillsEngineworker slots claim taskscheckpoint after each stepactivities from palettesTimers and listenersleader engine onlyCluster beatheartbeat, lease, recoveryHousekeepingold runs deletedMetrics, traces, logsOutside systemsHTTP, SOAP, databases,bus, email, apps, AIStorageSQLite or PostgreSQLSutras, runs, tasks,vault, engines, leasesMonitoringPrometheus, OTLP, logssame listenerstart run
One SutraFlow server: who talks to it, what runs inside, and what it talks to.

Everything runs in one Node.js 24 process written in TypeScript. Its parts:

  • Admin API (Fastify, port 4800, 127.0.0.1 by default) serves the studio, the user guide, this page, and every editing and operations route. People sign in with a session cookie; automation and AI assistants use Authorization: Bearer with the admin token, a system account's API token or a person's own API token.
  • Gateway (ports 8080 and 8443) serves only what is deployed: REST paths, SOAP services with their WSDL, and MCP endpoints. It is separate from the admin port so the studio never has to face the internet.
  • Engine runs steps in worker slots (SUTRA_WORKERS, set by the machine size by default). Slots take tasks from the database. Sutras tuned to run in memory go to a second engine in the same process whose runs live in a private in-memory database and are written to the database in one transaction when they end.
  • Timers and listeners start runs from schedules, folders, mailboxes, queues and Drive. In a cluster they run on the leader only, so nothing starts twice.
  • Cluster beat writes this engine's heartbeat, holds or watches the leader lease, recovers dead engines' steps, and reloads routes after deploys elsewhere.
  • Memory tables keep small reference data (rates, codes, routing, reusable values) in each engine: an LRU JavaScript Map per table inside the Node.js process. Each table, project and engine has row and byte quotas. Refresh creates a replacement off to the side and swaps it only after its query, keys and quotas pass, preserving the last good copy on failure. Failsafe tables schedule on the leader and use mem_rows/mem_meta versioning; memory-only tables schedule on every engine.
  • Storage is SQLite in the data folder, or PostgreSQL for several machines. Sutras, runs, tasks, the vault, settings and cluster state all live there.

Ports and addresses

AddressWhat answers
:4800/Studio (studio mode only)
:4800/api/...Admin API
:4800/health, /readyLiveness and readiness
:4800/metricsPrometheus metrics
:4800/adminAdmin Console (also on headless engines)
:4800/mcp/studioThe studio MCP server for AI assistants that build Sutras (API tokens only)
:4800/guide, /admin-guide, /architectureUser guide, Administration Guide and this page
:8080, :8443Gateway: deployed REST and SOAP services, /mcp and MCP server paths, ACME challenges

The engine: workers, stages and guarantees

The engine is the part of every SutraFlow process (studio or headless) that runs Sutras. This section is the overview; the sections after it go into its files (Inside the engine), one run in detail (How a run works) and several engines (Clusters).

Engine and workers

  • An engine has a number of worker slots (Steps at once, SUTRA_WORKERS; by machine size, 4 to 32). A slot runs one step at a time; it is not a thread or a process. Steps are asynchronous JavaScript, so a slot waiting for a database or an HTTP answer costs no CPU.
  • The scheduler (engine/scheduler.ts) fills free slots: it claims due tasks from the shared tasks table in batches, by Sutra priority and then age, with one atomic statement per batch. PostgreSQL SKIP LOCKED lets several engines claim at once without waiting for each other; LISTEN/NOTIFY wakes idle engines when work arrives, and polling remains the fallback.
  • Each engine process has two engines: the durable one, whose runs and steps live in the shared database, and an in-memory one (in the same process, its own SQLite in memory) for Sutras tuned in memory: faster, but their open runs are lost at a restart, they cannot wait, and limited connections refuse them.

The stages of a step

StageWhat happensCodeKept in the database
1. StartA trigger, the Run API, Test, a channel, Call Sutra or an MCP/agent call starts a run: the run row (with a copy of the Sutra) and one pending task for the starter, in one transaction. A Sutra over its Runs at once starts the run as queued.engine.ts startRunruns, tasks
2. QueueThe task is pending with a not-before time (now, or later for retries and timers). A committed insert notifies the engines.queue-notify.tstasks.status = pending
3. ClaimA free slot claims it: status running, owner = this engine, claim number + 1. The claim number fences everything that follows: an engine that lost the task cannot write its result.scheduler.ts, run-store.tstasks.owner, tasks.claim
4. AdmissionIf the step (or a connection behind its connections) has a connection limit, places are taken for all of them at once, or the task goes back to pending with a waiting reason and a growing pause, without using an attempt.connection-limits.tsconnection_permits, connection_waits
5. PrepareSettings are resolved (templates, formulas, Project and Engine properties, secrets), the Input mapping is evaluated, and the step runs as its project (a connection of another project is refused).executor.ts, mapping.ts-
6. ExecuteThe activity runs within its time limit, with an abort signal; loops and streamed batches run here. A finished step gives its connection places back at once and wakes waiting steps.the activity (palettes/, connectors/)-
7. CheckpointIn one fenced transaction: the step output, the task done, and the next tasks inserted. A crash before this commit means the step will run again; after it, nothing is lost.transitions.tsrun_outputs, tasks
8. RouteThe output leaves on one port; each connection carries a live or a skip token by its condition; merges wait for every branch that can still arrive; dead paths are removed.router.tsruns.state
9. WaitA step may return a wait (approval, ask a person, Call Sutra, timer, agent tool): the task is waiting and holds nothing; a decision, a child run or the timer resumes it.waits.ts, operator.tstasks.status = waiting, tasks.wait
10. FinishWhen no task is pending, running, paused or waiting, the run is settled: done, or failed when a failure had no error path. Reply callbacks and metrics are completed.run-store.tsruns.status

Retries, errors and recovery

  • A failed attempt with retries left goes back to pending with a doubling pause; then the step's error output, the Sutra's Error handler, or a failed run, in that order. A failed run can be resubmitted from the failed step.
  • Every engine heartbeats every 5 seconds. An engine silent for three beats is dead: the leader puts its running steps back in the queue (cluster.ts recoverOrphans), where another engine claims them with a new claim number. Drain hands an engine's steps back on purpose.
  • Connection places of a dead engine lapse with its claims; its listener leases expire within two minutes.

Guarantees

  • Durable progress: what a step produced is committed together with the next tasks; a restart resumes from the database, with no replay log anywhere else.
  • At least once for a step's effects: a step interrupted before its checkpoint runs again. Outside effects should be idempotent (run id or business key).
  • Fencing: only the current claim can write a step's result, so a recovered step and a slow original never both commit.
  • Once per cluster for timers and listeners: they run on the leader only, with a lease in the database.
  • Limits hold across engines: connection places are counted in the shared database, never in one process.

Limits

LimitDefaultSet in
Steps at once, per engineby machine size (4 to 32)Engine tuning; SUTRA_WORKERS
Steps per run10,000Engine tuning; SUTRA_MAX_STEPS
Step time limit2 minutes (AI 10 minutes)The step's Settings
Run time limit, runs at once, priority, retriesnoneSutra tuning
Work on one connection at onceno limitThe connection's Maximum concurrent activities
Reply wait for callers60 secondsEngine tuning; SUTRA_REPLY_TIMEOUT_MS
Call Sutra depth10 levelsFixed
Loop on a step1,000 items (at most 10,000)The step's Settings

Inside the engine

server/src/engineengine.tspublic facade and lifecyclestart, drain, compose servicesscheduler.tspoll, claim, dispatchbounded worker slotsexecutor.tsmap and run activitylimits, loops, cancellationoperator.tscancel, approve, debugresubmit, promote, timeoutwaits.tsreply and finish waiterscross-engine completiontransitions.tsfenced transition helpersstate, logs, cancel opentypes.tsSutra, activity, contextresult and shared contractsstate.tspure state/output helpersinitial and compact valuesrun-store.tsruns, outputs, fencingstale owner changes nothingPostgreSQLruns and tasks: truthpg.Pool transactionsadvisory per-run locksqueue-notify.tsLISTEN sutraflow_queuereconnect and coalescePeriodic pollalways remains enabledSQLite uses this pathasync querieswake hintcorrectness fallback
Inside the engine. The facade composes focused services; PostgreSQL is both the durable queue and the source of wake-up hints.

The 2.0 engine is split by responsibility so a change to queueing, graph routing, an activity, an operator command or a database transition can be reviewed without reading the whole runner. engine.ts is the public façade and composition root; it does not expose the internal services to callers.

FileResponsibilityDoes not decide
engine.tsRegisters activities, starts and drains the durable and in-memory engines, starts runs, composes the services, and orchestrates complete and fail.How a task is claimed, how graph tokens move, or how an activity implementation runs.
scheduler.tsPolls and wakes the queue, atomically claims due tasks by priority in batches, observes the worker limit, and dispatches each claim.Business routing or step results.
executor.tsBuilds the mapping context, resolves variables and secrets, enforces abort and time limits, executes loops and streamed emits, and hands the result to complete or fail.Durable transition SQL.
transitions.tsShared atomic helpers for fenced updates, state and log changes, run/output commits, cancellation of open tasks, and routing scope.Which activity to execute.
run-store.tsLoads runs and separately stored outputs, owns the claim fence, derives final status atomically, and persists ended in-memory runs. An old owner receives StaleStep and cannot change the row.Scheduling or graph-routing policy.
router.tsEvaluates connection conditions, sends live and skip tokens, joins branches and eliminates dead paths before scheduling the next activity.Activity execution or durable fencing primitives.
waits.tsKeeps process-local reply and finish callbacks, notifies live views, and checks the durable run row when another engine completes it.The durable status itself.
operator.tsImplements cancel, approval decisions, resubmit, debug controls, queued-run promotion and run-time limits.Normal activity execution.
state.tsPure run-state and output helpers: initial variables, output parsing, compact streamed output and API/history views.I/O or database ownership.
types.tsContracts shared by the engine, palettes and studio: Sutras, nodes, edges, activity fields, execution context and step results.Runtime behavior.
queue-notify.tsOwns the PostgreSQL listener connection, reconnects after failure and turns notifications into coalesced scheduler wakes.Queue correctness; notifications are hints only.

The internal queue bus

The engine bus is deliberately a durable database queue with a fast wake-up signal, not a second message broker. The tasks table is the source of truth. Starting or routing a run inserts a pending task in the same transaction as the run checkpoint. PostgreSQL transactions use the main-thread pg.Pool; each transaction keeps one checked-out connection and takes the appropriate advisory per-run lock. The claim counter is increased every time a task is claimed and is included in every completion fence.

  1. A transaction commits a new pending task. A database trigger calls pg_notify('sutraflow_queue', '') only after that transaction commits.
  2. Every worker engine has one dedicated LISTEN sutraflow_queue connection. A notification coalesces into scheduler.wake(); it does not carry the task or assign it to an engine.
  3. Free slots race through the atomic claim statement. PostgreSQL SKIP LOCKED lets engines take different rows instead of waiting behind one claim.
  4. Periodic polling always continues. It covers a lost notification, listener reconnect, work that becomes due after a retry delay, and SQLite, which has no LISTEN/NOTIFY.

This design keeps one recovery model: after a restart or network interruption the engine reads durable rows and needs no replay log held by another service. Notifications reduce idle latency and database polling traffic without being trusted for delivery. Set SUTRA_PG_NOTIFY=0 to test or operate with polling alone.

How a run works

Triggerrequest, timer, file,queue, MCP, channelStart runrun row andfirst taskClaim taskpending to runningowner = this engineRun activitysettings, mapping,loop, time limitCheckpointoutput and next tasksin one transactionRun finishesdone, failedor cancellednext stepswaitsreply stepWaitingapproval, timer, sub-Sutra, remote replyRetryback to pending,not before a delayError outputor the Sutra'sError handlerReplyto the REST, SOAPor MCP caller
A run from trigger to finish. Every step is a task row; the checkpoint stores its output and the next tasks together.
  1. Start. A trigger (or a test run, the Run API, a channel, Call Sutra, an MCP call) calls startRun. It inserts the run row, which keeps a copy of the Sutra document it started with, and one pending task for the trigger step. Redeploying never changes a run in flight.
  2. Queue. A deployed Sutra tuned with Runs at once starts extra runs as queued; they move to running, oldest first, when one of its runs ends (and the leader checks on each beat).
  3. Claim. A free worker slot claims the next due task, highest Sutra priority first, with one atomic statement: update tasks set status='running', owner=? where id = (select ... where status='pending' and not_before <= now order by priority desc, id limit 1) and status='pending' returning *. Two engines can never claim the same task.
  4. Run the activity. The engine resolves the step's settings (templates, formulas, Project and Engine properties, secrets) and its Input mapping, then calls the activity's execute with a context (logging, secrets, abort signal, time limit). Loop settings run it once per item of a list, or again while a condition holds, and collect the results.
  5. Checkpoint. In one transaction the engine stores the step's output, marks the task done, and inserts tasks for the next steps. A crash before the commit leaves the durable task unfinished; the activity may therefore run again after recovery. A crash after the commit finds the completed transition and its next tasks. The claim fence makes the durable transition apply once even if an old worker returns late. Nothing required for continuation is kept only in memory between steps.
  6. Route. The step's result names a port (out, error, ok, problems, approved, rejected...). Each connection from that port carries a live token or a skip token according to its condition. A merge waits for a token on every incoming connection.
  7. Finish. When no tasks remain the run is done; a failure with no error path fails the run; End and stop options (this branch, Sutra success, Sutra error) finish early. The run's status, duration and steps go to metrics, traces and logs.

Task states

pendingrunningdonewaitingfailedpauseddebug runcancelledclaimedfinishedwaitsno retries leftresumed (approval, timer, reply)retry latercancel
Task states. Only rows change: a waiting task costs nothing, and a restart picks up where the rows say.

Connections, conditions and merges

Get orderoutput: amountApprovalShipLog orderSend replymerge: waits forevery incoming lineOrder > 1000 (when)otherwisealwaysskip token
Connections with conditions. A branch that is not taken sends a skip token, so the merge step still fires once.

A connection can have a name (shown on the canvas) and a rule: always (the default), when a formula is true, or otherwise (when no when connection from the same output was taken). A condition uses the routing scope: input, earlier nodes, Local vars, Project gv, Engine ev, trigger and now. The transition inspector builds a browsable Condition data tree from that same scope; clicking a field inserts its path. Its {x} shortcut inserts a Project or Engine property and it warns when a referenced Project property is absent; for example {input.amount} > {gv.LIMIT}. Branches that are not taken send skip tokens downstream, so merges never wait forever (dead-path elimination).

Waiting without holding anything

A step can return a wait instead of an output. The task becomes waiting with its wait details and costs nothing while it waits:

  • Approval: a person decides in the studio (Runs, Approvals) or through the API; the task resumes on approved or rejected.
  • Wait / timers: the task returns to pending with a not-before time.
  • Call Sutra: a child run starts; the parent task waits until the child finishes and receives what its Return step sent.
  • Replies across engines: a gateway caller waits on the engine that took the request even when another engine runs the reply step; the waiting engine polls the run row.

Errors, retries and the Error handler

Step settings give retries with a delay and a time limit. A failed attempt with retries left goes back to pending with a not-before time. When retries are spent, the step's error output is taken if it is connected; otherwise the Sutra's Error handler (an activity with no input) receives the error with the step name and message; otherwise the run fails. A failed run can be resubmitted: a new run starts with the same trigger input and the old run is marked resubmitted.

Test and debug runs

A test run uses the draft, not the deployed version. A debug run pauses before each step (paused tasks) and continues one step at a time, so input and output can be checked in the studio.

Data, mapping and expressions

Every step sees the same data: trigger (what started the run), input (the previous step's output), nodes.<Step name> (any earlier step), vars (Local variables), gv (Project properties), ev (Engine properties), secret (vault, server side only, masked in history), run, and inside loops item, index and iteration.

  • Templates (template.ts): {{input.name | upper}} inside text; a field that is only one template keeps the typed value (object, list, number).
  • Formulas (expr.ts): a value starting with =, such as =concat({input.first}, ' ', {input.last}). Parsed into a tree and evaluated by the engine; there is no eval.
  • Structured mapping (mapping.ts): the Activity Input tree from a shared schema or from paths, with For-Each on repeating nodes, where, group by, sort and conditions.
  • Shapes before running (design.ts, schemas.ts): each activity's output hint, schemas and earlier steps give the mapper a tree to drag from before any run exists.

Typed JSON/XML mapping

Map JSON Data and Map XML Data are focused activity definitions over the same structured mapping engine as legacy Map data and Render JSON/XML. Mapping creates an object; rendering creates text. Existing generic activity identifiers remain valid.

Targets come from project-scoped JSON Schema/XSD references or a MappingValue containing path declarations, rules and optional typed definitions. Definitions carry scalar/object type, required/repeating flags, item bounds, description and object-element namespace URI. Attributes use @_name; list markers use [] in declarations and normalized paths in rules. XML has exactly one non-repeating element root. Namespace declarations become @_xmlns attributes on objects; qualified object names declare the corresponding prefix.

designSchemas and validateDoc use the same static checks: malformed formulas, unmapped required targets, invalid XML target names/root and contradictory cardinalities are errors; stale target rules and references absent from known source shapes are warnings. Hidden mapping fields in value-mode renderers are not checked. Output coercion retains legacy behavior unless typed definitions or a new typed activity opt into strict value checks. Type failures follow ordinary engine error routing.

Whole-result preview is a project-authorized, CSRF-protected POST endpoint. It resolves only the selected project's schema, evaluates expressions against supplied sample scope and serializes the result; it does not dispatch activities, write business data, call connectors, or create runs. Scope is capped at 256 KB and preview text at 1 MB. The editor debounces edits and discards stale replies, and labels the test-run source as possibly stale. Sample-to-schema inference is capped at 128 KB; XML DTD/entities are rejected. Generated XSD is a proposal and does not preserve source namespace bindings.

Instance validation is separate from mapping shape: schema-validation.ts reuses AJV for JSON Schema drafts 07/2019-09/2020-12 and xmllint-wasm (libxml2) for XSD 1.0. Runtime checks patterns, enums, ranges, conditional JSON rules and XML namespaces/order/choice/groups/cardinality even when the designer tree approximates them. XSD 1.1 is unsupported. Dependencies are preloaded from same-project XSD resources only; no network/host filesystem resolution. DTD/entities are rejected. Limits: 4 MB XML, 32 schema files / 1 MB schema text, four active validators / 64 waiting. Each WASM instance has a 32 MB linear-memory ceiling, excluding worker JavaScript overhead.

The shared boundary protects typed mapping, parse/render, Validate fields, structured local/FTP/SFTP files, outbound HTTP bodies/replies, received HTTP responses and opt-in REST/SOAP ingress. File reads validate JSON/XML only when strictValidation === true, a default-off checkbox shared by local/remote read, list and trigger fields; selecting a schema alone does not enable read validation. Strict reads require a matching JSON Schema/XSD. File writes with selected contracts are checked before creation/truncation; HTTP business requests before sending. Ordinary failures use engine error routing, Validate fields uses its invalid port, ingress rejects before run creation, and file triggers retain readError payloads. CSV streaming and schema-free behavior are unchanged. SOAP validates the namespace-preserved operation, not the full envelope or a prefix-stripped reconstruction. XML tree display is a separate bounded read-only view.

Certification evidence and exact executed checks are recorded in docs/benchmarks/release-2.0.7-verification.md. The functional mapping tests are not an industry certificate, XML standards-conformance claim, throughput benchmark or long-duration soak.

test/validation-samples.test.ts executes the bundled samples, checks every node description and schema reference, preserves edited schemas across reimport, exercises strict file-read on/off/missing/wrong-kind cases, and drives real local REST/SOAP listeners plus the sample HTTP client. Invalid ingress is checked against the durable run counter to prove that no run starts; invalid client data must not create a server run. The XML sample renders the normalized parsed object against its schema before revalidating XML text, restoring the declared namespace rather than guessing it from prefix-stripped data.

2.0.9 design integrity: shared Output, mapping and transition browsers derive observed fields from the explicit test session instead of projecting run values onto a different schema. Historical production outputs are not auto-loaded as samples; edits and schema reloads clear previews. Arrays show counts and complete small scalar lists. Activity sources and generated process documentation identify user names and activity types; documentation resolves named schema kinds/roots and connection kinds without resolving credentials.

POST /api/schemas/:id/impact requires Design permission on the schema's owning project. It analyzes a proposed definition using a request-local tree resolver injected into designSchemas; there is no temporary database update or process-global cache swap. The report compares shapes and new diagnostics for directly referencing saved drafts, not runtime compatibility, deployed snapshots or transitive schema dependencies. Both editors share a report UI with stale-response cancellation. npm run test:samples combines catalogue-wide static consistency checks with executable mapping and validation fixtures; real external-service gates remain separate.

Protected ingress verifies authentication and scopes before returning schema diagnostics. Authorized invalid requests receive REST 400 with error details or a SOAP Client fault; missing credentials return 401 and insufficient scopes 403 without schema details. Dedicated JWT-protected REST/SOAP tests verify the response distinctions and the unchanged durable run count.

Strict boundaries and MongoDB

The optional activity validateStart hook runs before durable run creation. Manual start, REST, SOAP and WebSocket implement it so Test/Debug, Run API and direct engine calls cannot bypass their enabled ingress contracts. Execution validates again. contracts.ts centralizes project ownership, schema existence/kind, compilation and actual-value validation without coercion or sample substitution. SOAP object admission validates its namespace-aware XML representation with the real XSD backend.

Call Sutra validates input and, when configured to wait, its resumed child result. Return and internal channel activities have explicit strict controls. Local/remote file triggers reject invalid parsed events before downstream processing; a file-trigger failure can still have a failed run record. A selected descriptive schema with validation Off is not an enforcement promise. The schema-field inventory is a review gate, not proof of every activity's runtime behavior.

MongoDB metadata is separated from runtime resource lookup to avoid registry initialization cycles. The official driver uses a vault-backed URI, verified TLS, small resource-revision-keyed pools, operation budgets, abort signals and explicit shutdown. Public durable values use canonical Extended JSON rather than storing BSON instances or losing Int64/decimal precision. Cursor readers close in finally blocks and fail at the documented output ceiling rather than silently truncate.

The MongoDB palette exposes List Collections, insert, find/find-one/count/distinct, update/update-many/replace/upsert/find-one-and-update, delete and aggregation. Array filters select nested array members. A mapped collection-input override takes precedence over the General collection name; invalid overrides fail. Strict insert validates the complete batch before a write, but a later database error can leave partial writes. Update validation concerns the modifier/replacement request, not an inferred final document. Collection validators remain authoritative. Unrestricted commands, server JavaScript, durable change-stream/wait, transactions, GridFS and bulk activity implementations are not exposed.

Credential slots use a separate reference-resolution scope: Secret GV/EV properties provide their encrypted-vault reference, avoiding a second lookup of decrypted plaintext as a name. Normal runtime expressions retain secret-value semantics, with project and engine secret values registered for history masking. Get Properties excludes secret values. Inline entry is available in connection and Secret property editors; only references are stored in resource/project JSON, and existing permissions are unchanged. The eye reveals only freshly entered text; no stored-value reveal API is added.

Separate host/username/password and complete-URI modes coexist with legacy configurations. X.509 options use a client certificate/private key, optional private CA, verified TLS and $external; no user provisioning or automatic privilege grant occurs. Non-TLS is allowed only for direct loopback development. M0-baseline aggregation remains read-only/no-spill; General MongoDB requires explicit disk/output-stage flags and server authorization. X.509 and General-profile writes require separate live deployment certification, not an inference from password-based M0 tests.

Verification on 24 October 2026: 424 regression checks passed, 27 optional checks skipped; seven live Atlas M0 checks passed on MongoDB 8.0.34 with isolated seeded collections and cleanup. The local resolver refused SRV lookup, so live tests used a process-only alternate resolver; system DNS was unchanged. Driver-only transaction/change-stream/GridFS probes do not certify activities. See docs/releases/2.0.10-verification.md for exact scope, commands and limitations. This is functional regression evidence, not vendor certification or throughput benchmarking.

Services: REST, SOAP and MCP

CallerREST, SOAPor MCPTLScertificate,client certificatesFirewalldeny wins,allow listRoute matchmethod and path,SOAP action, /mcpAPI policyapp key or token,scopes, plan limitStart rundeployed version,traceparent keptReply stepor a timeoutand a 504response, 403, 401, 429, or a SOAP fault
A request to a deployed service. The caller waits until the Sutra's reply step answers, on any engine; every request is written to the request log.

When a Sutra with a REST service, SOAP service or MCP skill trigger is deployed, rebuildRoutes resolves its General settings against the current Project and Engine properties, then adds its path to the gateway's route table on every engine. A request is matched (method and path with parameters, SOAP action, MCP endpoint), checked against the service's API policy, and starts a run of the deployed version with the request as trigger input. The gateway then waits for the run's reply step (HTTP response, SOAP reply, Reply to AI) up to SUTRA_REPLY_TIMEOUT_MS.

FileBoundary
gateway.tsListener lifecycle, deployed route tables and the small top-level dispatcher.
rest.tsREST body decoding and response serialization.
soap.tsSOAP envelopes, faults, XML rendering and WSDL generation.
mcp-handler.tsStreamable HTTP sessions, JSON-RPC validation, tool listing and tool calls.
oauth-handler.tsOAuth client-credentials token requests and responses.
websocket.tsUpgrade policy, connection ownership, ordered messages and cross-engine delivery.
agents.tsChat, OpenAI-compatible, MCP-agent and A2A surfaces.
apps.tsApps, keys, tokens, distributed quotas, firewall, traffic log and OpenAPI.

The request hot path does not wait on the synchronous PostgreSQL bridge: app/key lookup, token validation, replay protection, distributed rate limits, firewall reads, WebSocket registration, agent job polling and request logging use asyncdb.ts. Independent requests can therefore have database work in flight together. Administrative lists and infrequent housekeeping retain q/tx until their migration is useful.

  • TLS (tls.ts): self-signed for testing, uploaded certificates, or Let's Encrypt with automatic renewal; a client CA turns on mutual TLS for services whose policy asks for it.
  • SOAP: the gateway publishes a WSDL for each SOAP service and wraps errors as SOAP faults; WS-Security headers are checked by policy. A policy may encrypt authenticated replies and faults for the verified X.509 caller certificate or a configured recipient certificate.
  • MCP (mcp.ts): JSON-RPC over Streamable HTTP (protocol versions 2025-06-18, 2025-03-26 and 2024-11-05). tools/list returns every deployed MCP skill of that endpoint with its input schema; tools/call starts the Sutra and returns the Reply to AI content. An MCP server connection groups skills under their own path, such as /mcp/orders.
  • Tracing: a caller's W3C traceparent continues into the run's trace.

Gateway TLS and the ACME lifecycle

ACME is used only for the gateway's Let's Encrypt certificate mode. Its purpose is to prove control of the configured public names, obtain a browser-trusted certificate and replace it before expiry without an administrator copying certificate files. Self-signed and uploaded-certificate modes do not call ACME. SutraFlow supports the HTTP-01 challenge; wildcard certificates, which require DNS-01, are outside this path.

  1. Operator call. web/admin/Server.tsx first saves the TLS domains, contact email, staging choice and agreement through PUT /api/server/tls, then calls POST /api/server/tls/acme. The route requires the Server permission. api.ts switches the TLS mode to acme and starts requestAcme(reloadTls) without holding the HTTP request open for the whole issuance.
  2. Account and order. gateway/tls.ts takes the acme-certificate database lease, renewed while the order runs, so only one engine issues or renews the shared certificate. It decrypts the saved acmeAccountKey, or generates and encrypts one on first use, chooses the Let's Encrypt staging or production directory, and creates a fresh certificate private key and CSR containing all configured names. The maintained ACME client uses Node's native cryptography and @peculiar/x509; the removed node-forge compatibility export is neither installed nor called.
  3. HTTP-01 proof. For each authorisation the ACME client gives tls.ts a token and key authorisation. It is stored briefly in acme_challenges with the issuing engine and an expiry. Before normal gateway routing, every gateway.ts answers /.well-known/acme-challenge/<token> from that shared table. Public port 80 may therefore reach any healthy gateway node, but must reach the HTTP listener unchanged. The token is removed after validation and expired rows are cleaned before an order.
  4. Install. After Let's Encrypt validates every name, tls.ts saves the returned chain and matching private key through the encrypted settings store, records success or the error for the Admin Console, reloads its HTTPS context and raises the cluster generation. Every other engine reloads the shared certificate on its next heartbeat. Replacing the secure context does not deliberately drop existing connections.
  5. Renew. index.ts starts the renewal timer at boot. It checks after ten seconds and every twelve hours; in ACME mode, a missing certificate or one with fewer than 30 days left calls the same requestAcme(reloadTls) path. Failure leaves the current certificate in place and the next check retries.

The ACME account key and installed private key are encrypted with the server master key in shared settings. Challenge rows contain public key authorisations, not private keys, and expire after 15 minutes. An issuance lease expires if its engine disappears; an in-flight ACME order itself is not transferable, so a later request or renewal check starts a new order after the lease expires. The certificate expiry alert remains the operational backstop for failed renewal.

Apps, plans, firewall and the request log

Before routing, the gateway checks its firewall (deny wins; an allow list admits only its addresses). An API security policy with Gateway apps accepts an app's key (X-API-Key, or Authorization: Bearer sfk_...) or an access token from POST /oauth/token (OAuth2 client credentials, an hour, signed with a key kept in settings). The app must hold the scopes the policy requires; its plan is then counted in gw_usage in one transaction, so every engine of a cluster shares the count, and a full window answers 429 with Retry-After; answers carry X-RateLimit-* headers. Every request is written to gw_requests when it ends, for the Traffic page (timeline, p50/p95/p99, busiest and slowest services, apps) and the request log; housekeeping deletes entries after the chosen number of days. OpenAPI 3.1 is generated from the deployed REST services, their path parameters, body schemas and security, for the console and, when chosen, at /openapi.json on the gateway.

OAuth: connections, sign-in and tokens

Connect accountan administrator,studio or consoleStart address/api/oauth/:id/startsigned state, 10 minProvider sign-inthe account ownerallows the scopesCallback/api/oauth/callbackcode + state checkedToken endpointcode + client secretfrom the vaultDatabasesettings oauth:<id>AES-256-GCMSigning in (once per server)Every callA stepDrive, Sheets, YouTube,SharePoint, DropboxaccessToken()reads the tokens,decryptsStill valid?more than a minuteleft: use itRefreshrefresh token + secret;one at a timeSavenew access tokenencryptedProvider APIBearer access token(streamed for files)
An OAuth connection. Above: signing in, once per server. Below: every call a step makes; the access token is refreshed shortly before it expires, and the tokens live encrypted in the shared database, so every engine of a cluster uses the same sign-in.

SutraFlow uses OAuth 2.0 in five places. They share the standard, not the code: each is where its job is.

UseSutraFlow isWhere
OAuth connections: Google, Microsoft, Dropbox, Facebook, Twitch, customa client of the provider, acting for an account that signed inconnectors/oauth.ts
Outbound security profile OAuth client credentials: calls to APIs as a machinea client with its own ID and secret, no personsecurity/outbound.ts
Gateway apps: POST /oauth/token for the apps that call your servicesthe authorization server (it issues short tokens to apps)gateway/apps.ts
API security policies: JWT and token introspection on incoming callsa resource server (it checks tokens others issued)security/inbound.ts, security/hmac.ts
Single sign-on for people (OpenID Connect or SAML 2.0)a client/service provider of the identity provider; people get a SutraFlow sessionsso.ts, saml-sso.ts

OAuth connections step by step

  1. The connection (resource kind oauthApp) holds the service, the client ID, the name of the vault secret with the client secret, and the scopes. A release carries it without any secret value or token.
  2. Start. GET /api/oauth/:id/start (permission Connections) returns the provider's authorization address with response_type=code, the scopes, the redirect address (<this server>/api/oauth/callback) and a state: the connection id, the redirect address, an expiry 10 minutes ahead and a random part, signed with HMAC-SHA256 under a key kept in settings (oauthStateKey). Provider extras are added: Google access_type=offline and prompt=consent (to get a refresh token), Dropbox token_access_type=offline, Twitch force_verify. A Microsoft connection with a tenant signs in at that tenant instead of common.
  3. Consent happens at the provider; SutraFlow never sees the password.
  4. Callback. GET /api/oauth/callback (open: the browser comes back from the provider) checks the state's signature and expiry, then posts the code, the redirect address, the client ID and the client secret (read from the vault at that moment) to the token endpoint.
  5. Storage. The access token and the refresh token are encrypted with the master key (AES-256-GCM, as vault secrets) and saved in settings under oauth:<connection id> with the expiry and scopes. All engines read the same row, so one sign-in serves the whole cluster; tokens never leave the server, and a different server signs in on its own.
  6. Use. Every call goes through accessToken(): a token with more than a minute left is used as it is; otherwise the refresh token is exchanged for a new access token (one refresh at a time per engine; the refresh token is kept when the provider does not send a new one) and saved. apiCall adds Authorization: Bearer; streamCall does the same for streamed uploads and downloads.
  7. Without a person. A connection can name a refresh token secret: on first use the server takes the refresh token from its vault (set by a pipeline) and signs in with it; sutra connect runs the start and waits for the callback from the command line.

Per service

ServiceSign-in and token addressesWhat SutraFlow addsScopes the steps useSet up at
Google (Drive, Sheets, Docs, YouTube)accounts.google.com/o/oauth2/v2/auth, oauth2.googleapis.com/tokenaccess_type=offline, prompt=consent, include_granted_scopes.../auth/drive (or drive.readonly, drive.file), spreadsheets, documents, youtube.upload, youtube.readonly, yt-analytics.readonlyGoogle Cloud console: APIs enabled, consent screen (Internal or External with test users), a Web application client with the redirect URI
Microsoft (SharePoint, OneDrive)login.microsoftonline.com/<tenant or common>/oauth2/v2.0/authorize and /tokenthe connection's Tenant in both addressesFiles.Read.All, Sites.Read.All, offline_access, User.Read (Files.ReadWrite.All to write)Microsoft Entra ID: app registration, Web redirect URI, client secret (its Value), delegated Graph permissions, admin consent
Dropboxwww.dropbox.com/oauth2/authorize, api.dropboxapi.com/oauth2/tokentoken_access_type=offlinefiles.metadata.read, files.content.read, files.content.writeDropbox App Console: scoped access, permissions, redirect URI; App key and App secret
Facebook Pageswww.facebook.com/v19.0/dialog/oauth, graph.facebook.com/v19.0/oauth/access_tokennothing (no refresh token: sign in again after about 60 days)pages_show_list, pages_read_engagement, pages_manage_postsMeta for Developers: an app with Facebook Login for Business, valid redirect URIs; App ID and App secret
Twitchid.twitch.tv/oauth2/authorize, id.twitch.tv/oauth2/tokenforce_verify=true; the client ID on every API calluser:read:email, channel:manage:broadcast, clips:edit and othersTwitch developer console: a Confidential application with the redirect URL
Customthe connection's Authorization URL and Token URLnothingthe provider'sthe provider's developer portal

The step-by-step set-up of each, with the screens to open and the fields to fill, is in the user guide: OAuth connections step by step.

Design points: the client secret stays a vault secret read only when exchanging codes; the signed, expiring state stops forged or replayed callbacks; tokens are encrypted at rest and keyed by the connection, so two projects never share an account by accident; and the database is the one place every engine looks, so a leader change or a restarted engine needs no new sign-in.

Timers, listeners and channels

Triggers that are not requests are started by the leader engine:

  • Timers (scheduler.ts): cron expressions or intervals, with Project and Engine properties resolved when schedules are rebuilt.
  • Listeners (listeners.ts): folder watchers (File trigger), mailbox polling (Email trigger), queue and topic subscriptions (Service Bus), Drive and chat polling. General settings use the same property resolver as normal activities.
  • Broker acknowledgement and deduplication (connectors/bus.ts): auto mode lets the broker settle on receipt; client mode acknowledges only after run success; explicit mode records Confirm message's confirm, requeue or reject decision. Before starting a protected delivery it writes bus_messages with a reserved run id, keyed by Kafka topic/partition/offset or RabbitMQ/AMQP message id. A new leader that receives the same delivery consults that run: completed is acknowledged, failed/cancelled removes the reservation for retry, and an active/waiting RabbitMQ or AMQP copy is held without starting a duplicate while Kafka pauses that partition. A run that ends without an explicit decision follows the trigger's failure rule.
  • Broker protocols: Kafka uses KafkaJS and supports system or private CA trust, SASL plain/SCRAM and optional mutual TLS. RabbitMQ uses AMQP 0-9-1 over amqp or amqps. ActiveMQ/Artemis uses AMQP 1.0 over TCP or TLS. All three can use a private CA and an optional client certificate whose private key and passphrase remain vault secrets; certificate verification cannot be disabled. ActiveMQ resources use a container-id prefix and unique stable role suffixes, so publishers and listeners never contend for one client id. Java applications may use OpenWire/JMS against the same ActiveMQ destination; Classic needs transport.transformer=jms on its AMQP connector for body-level interoperability. Broker JVM/Erlang runtimes are server prerequisites, not SutraFlow client dependencies.
  • Channels (channels.ts): Send to channel starts every deployed Sutra of the project whose Channel trigger listens on that name. It reads deployments from the database, so it works the same on one engine or many.

When the leader stops or dies, another engine takes the lease and starts the timers and listeners itself. Kafka always supplies a stable offset identity; an external RabbitMQ or AMQP publisher must set a unique message id to receive the same duplicate-run protection. Requeue releases a delivery; reject asks the broker to dead-letter or discard it according to broker configuration. A configured delivery-count ceiling changes a requeue into reject. Broker delivery and outside activity effects remain at-least-once boundaries, so downstream idempotency keys are still required where an acknowledgement can be lost.

Storage

Engine hot pathclaim, transition, settleasyncdb.tspg.Pool or local storeAdmin and controlAPI, packages, clusterq and txdb.tsSQLite backendnode:sqlite, WAL fileCaller waitsAtomics.wait on aSharedArrayBufferpgworker.tsworker threadpg or PGlitePostgreSQLpool + advisory locksSQLite / PGlitePostgreSQL poolPostgreSQL compatibilitySQLitestatementanswer
Two storage entry points share one schema: asynchronous engine transactions and the synchronous compatibility path.

The default backend is SQLite built into Node (node:sqlite), in data/sutra.db, with WAL and a busy timeout. The administrative and low-frequency paths use q and tx in db.ts. With PostgreSQL those compatibility calls go through pgworker.ts, whose worker thread owns a connection while the caller waits on a SharedArrayBuffer.

The engine hot path is different: asyncdb.ts gives claim, complete, fail and settle truly asynchronous calls. On PostgreSQL it uses a main-thread pg.Pool, lets many independent runs have database work in flight, carries one pooled connection through each transaction, and discards a broken checked-out connection. SQLite and PGlite implement the same asynchronous interface over their existing connection. Advisory locks are keyed by run or queue operation, so transitions of one run are ordered while different runs proceed concurrently. The tests run the suite on SQLite and again on PGlite, with focused tests against a real PostgreSQL server.

Tables

TableHoldsColumns
flowsSutra drafts: the document being edited and its latest version number.id, name, doc, version, updated_at, project_id, folder
flow_versionsPublished, unchangeable versions of each Sutra.flow_id, version, doc, note, created_at
deploymentsWhich version of each Sutra is deployed, and whether it is enabled.flow_id, version, enabled, deployed_at, tuning
runsOne row per run: the Sutra document it started with, status, trigger input, state (outputs, variables, branch tokens, logs) and times.id, flow_id, flow_name, version, doc, status, source, trigger_node, input, state, error, steps, started_at, finished_at, started_by, project_id, debug, stage, client, priority
tasksOne row per step execution: status, attempt, not-before time, owner engine and claim number (counted up at each claim, for fencing), input, output, port, wait details, error and duration. The work queue.id, run_id, node_id, input, status, attempt, not_before, phase, port, output, error, ms, wait, started_at, finished_at, released, owner, priority, queued_at, claim
connection_permitsOne row per place in use on a limited connection (Maximum concurrent activities). kind task: a durable step, valid while its claim (task, owner, claim) is running. kind lease: a listener poll or background job, valid until expires_at and renewed while held. Ended claims and expired leases are removed at the next admission.resource_id, task_id, owner, claim, kind, holder, project, since, expires_at
connection_waitsSteps waiting for a limited connection: the connection, the reason shown in the Admin Console, since when, and how many times it was checked (the pause between checks grows to 5 s). Removed when the step runs or leaves the queue.task_id, resource_id, reason, since, checks
connection_usageSamples of each limited connection (in use, waiting, limit) taken by the leader every 30 s for the Admin Console graphs; kept 7 days.at, resource_id, active, waiting, limit_n
replay_guardSignatures of HMAC-signed requests seen recently, so a replay to any engine is refused; each row expires after twice the allowed age.k, expires_at
sso_statesOne-time SAML browser or API-client sign-in requests: random state, request id, callback and return path, shared by every engine and paired with a signed client cookie; removed when used or expired.state, protocol, request_id, redirect_uri, return_to, expires_at
approval_votesEach approver's decision on an approval: the step's task, the username, approved or not, the comment, when, and whether an administrator decided on behalf of the approvers.task_id, username, approved, comment, at, on_behalf
ws_connectionsOpen WebSocket connections of every engine: id, engine, service path, Sutra, caller. Lets a step on one engine reach a connection held by another.id, engine_id, path, flow_id, subject, opened_at
ws_outboxMessages for WebSocket connections held by another engine, waiting a fraction of a second for that engine to deliver them.id, engine_id, connection_id, path, item, created_at
run_outputsThe output of each step of a run, one row per step name (a later pass of a loop replaces it), read by the steps after it. Kept apart from the run state so a step writes only its own output.run_id, name, out
payloadsLarge parts of a run's input (over 256 KB: a broker message body, a file's content), stored once; the run's data carries a reference to them and each step gets the whole value back.id, run_id, size, data, created_at
resourcesConnections, security profiles, API policies, AI providers and MCP servers (secret names only).id, kind, name, config, updated_at, folder, project_id
secretsThe vault: encrypted values with their IV and tag.name, iv, tag, data, updated_at, project_id
settingsServer settings and policies, gateway and TLS settings, Engine properties, the deploy generation.key, value
file_listener_stateOne row per deployed file trigger after its first folder baseline, shared by leaders so a takeover does not baseline the folder again.flow_id, node_id
file_listener_filesThe last durably handled size and modification time of each path for a file trigger, shared across leader changes.flow_id, node_id, path, size, mtime
bus_messagesDurable queue/topic delivery identities and their reserved run: Kafka offset or RabbitMQ/AMQP message id, used to avoid starting a second run after redelivery or leader takeover.flow_id, node_id, message_key, run_id, status, updated_at
projectsProjects with their variables, logging and deployment config.id, name, description, config, updated_at, owner, restricted
schemasShared schemas and WSDLs of each project.id, project_id, name, kind, root, text, updated_at, folder
mem_rowsThe database copy of memory tables kept with a failsafe: key, row, expiry, and the version of the change that wrote it (a removed row keeps its key with no row).store_id, k, value, expires_at, version
mem_metaPer memory table: the latest change version and when it was last loaded from its source, so engines pick up each other's changes.store_id, version, loaded_at, reload_at
countersCounter activity values per project.project_id, name, value, updated_at
package_deploymentsPackage history per project: version, checksum, who deployed it, the report and the package itself (for rollback).id, seq, project_id, name, version, checksum, deployed_at, deployed_by, report, package
enginesEngines of the cluster: host, process, mode, version, heartbeat, workers, active steps, draining.id, host, pid, mode, version, started_at, heartbeat_at, workers, active, draining, drain_requested, can_lead, memory, restart_requested
leasesCluster-wide locks with an expiry: the leader lease and the deploy-folder lock.name, holder, expires_at
acme_challengesShort-lived HTTP-01 tokens and public key authorisations for a Let's Encrypt order, shared so any gateway engine can answer the challenge.token, key_authorization, engine_id, expires_at
usersPeople and system accounts: password hash, name, email, disabled, must change password, failed sign-ins, lock, sessions valid after, last sign-in.username, hash, role, created_at, kind, display_name, email, disabled, must_change, failed, locked_until, sessions_after, last_login, updated_at, idp_subject
rolesBuilt-in and custom roles with their permissions.id, name, description, perms, builtin, updated_at
grantsWhich role each account holds, for all projects (empty project) or one project.username, role_id, project_id
api_tokensAPI tokens of system accounts: hash, name, expiry and last use. Token values are never stored.id, username, name, hash, created_at, expires_at, last_used
auditAudit log: time, actor, address, action, target, project, status, outcome and safe details.id, at, actor, actor_kind, ip, action, method, path, target, project_id, status, outcome, details, project_name, sutra_id, sutra_name, environment, engine
alert_channelsWhere alerts go: email (an SMTP connection and addresses), webhook (address and signing secret name), or a Sutra.id, name, kind, config, enabled, updated_at
alert_rulesWhat to watch: kind, settings, severity, channels, on or off, tell when resolved, reminder minutes.id, name, kind, params, severity, channels, enabled, notify_resolved, repeat_min, updated_at
alertsAlerts: rule, severity, state (firing, acknowledged, resolved), message and details, times, who acknowledged, what was sent where.id, rule_id, rule_name, severity, state, message, details, started_at, last_seen_at, last_notified_at, resolved_at, ack_by, ack_at, notified
gw_plansGateway plans: requests per minute, hour and day, and a monthly quota.id, name, description, per_minute, per_hour, per_day, per_month, updated_at
gw_appsGateway apps: name, contact, scopes, plan, disabled.id, name, description, contact, plan_id, scopes, disabled, created_at, updated_at
gw_keysAPI keys of gateway apps: hash, name, expiry and last use. Key values are never stored.id, app_id, name, hash, created_at, expires_at, last_used
gw_usageRequests per app in the current minute, hour, day and month windows, shared by every engine.app_id, win, n, expires
foldersExplorer folders of a project kept while nothing is in them, per area (sutras, resources, schemas, wsdl); each item keeps its own folder in a folder column.project_id, area, path
ai_sessionsOne row per conversation of an AI memory store: running summary, last turn number, counts, and which run holds it.store_id, session, project_id, summary, summary_upto, last_seq, turns, tokens, lock_run, lock_until, created_at, updated_at
ai_memoryTurns of AI conversations kept in the built-in memory store (role, text or sealed text, tokens).store_id, session, seq, role, name, content, tokens, at
ai_knowledgePassages of built-in knowledge bases with their source, details and vector.kb_id, id, source, chunk, text, meta, vector, at
ai_session_queueRuns waiting for a conversation, in arrival order; the first one holds it.seq, store_id, session, run_id, at
git_accountsGit accounts of each person: provider, host, login, encrypted token, author name and email.id, username, provider, host, label, login, token, author_name, author_email, created_at, last_used
git_workspacesProjects connected to Git: the working copy folder, remote, branch, team or personal, owner, trusted.id, project_id, owner, kind, dir, remote_url, branch, account_id, trusted, source_project_id, created_at, updated_at
git_idsPer workspace, repository ids of Sutras, connections and schemas against the ids of its project here.workspace_id, kind, repo_id, local_id
agent_conversationsConversations of published agents: the agent, the owner (a hash of the caller), when it began, its last message, when it expires and how many messages; no message text. Expired ones are cleared with their memory in Agent conversations.id, agent, project_id, owner, created_at, last_at, expires_at, messages
kb_adminServer knowledge bases (Knowledge admin): who may search each (every project or granted projects) and its MCP search tool (server, tool name, description, area).kb_id, access, mcp_server, mcp_tool, mcp_description, mcp_area, updated_at, updated_by
kb_grantsGrants of server knowledge bases: the project, the area (a folder of sources; empty for the whole base) and whether it may change the area. Grants made by a "Sutra of a project" source are marked with that source.kb_id, project_id, area, can_write, created_at, created_by
kb_sourcesManaged knowledge sources: what each reads (folder, SFTP/FTP, SharePoint, Google Drive, web pages, database query, HTTP API, or Sutras of a project), its connection and settings, the area it writes, its schedule, whether it is paused or exported as a Sutra, and when it runs next.id, kb_id, name, description, kind, connection_id, config, area, schedule, enabled, exported_project, exported_flow, next_at, requested, created_at, updated_at, updated_by
kb_source_itemsWhat each managed source last added: the item (file, row key, address) and its fingerprint, so a sync makes vectors only for new and changed items and removes the items gone from the source.source_id, item, hash, at
kb_sync_runsSyncs of managed knowledge sources (the last 50 per source): when, who asked, the status, and how many items were found, added, changed, unchanged, removed and failed, with notes.id, source_id, kb_id, engine, started_at, finished_at, status, found, added, changed, unchanged, removed, failed, error, started_by, notes
ai_agent_stateProgress of an AI agent step in a run (tool steps, tokens, the tool it waits for), removed when the step finishes.run_id, node_id, state, updated_at
gw_requestsThe gateway request log: time, engine, method, path, service, app, caller, status, time taken, sizes, address, run and error.id, at, engine, kind, method, path, route, flow_id, project_id, app_id, caller, status, ms, bytes_in, bytes_out, ip, run_id, error
guard_cacheAnswers the AI guard keeps for repeated questions: per Sutra and per person (a hash of the question and of the caller), with the time they expire.flow_id, question, person, answer, expires_at

Clusters: several engines

Load balancerhealth check: /readyengine-1gateway, workersengine-2 (leader)timers, listeners,recovery, housekeepingengine-3gateway, workersStudioSUTRA_WORKERS=0PostgreSQLtasks, engines, leases,deploy generationOne live claim owns a task.Its claim number fences the commit.Dead engine (3 missed beats): theleader puts its steps back to pending.
A cluster. Every engine serves requests and runs steps; one engine leads for work that must happen once.

Engines that share one database form a cluster. No engine talks to another directly; the database is the only meeting point.

  • Work sharing. Every engine claims tasks with the atomic update above, so only one live claim owns a task at a time. A crash can make the activity execute again, so activities that call outside systems should use an idempotency key when the system supports one; the fenced database checkpoint itself applies once.
  • Heartbeat. Each engine updates its engines row every SUTRA_HEARTBEAT_MS with its active steps and draining flag. An engine silent for three beats is dead.
  • Leader. One engine holds the leader lease (renewed each beat, valid for three). It runs timers, listeners, recovery and housekeeping. If it stops renewing, another engine takes the lease.
  • Recovery. The leader puts tasks owned by dead engines back to pending. A new claim increases the task's claim number; a late completion from the former owner fails its fence and changes nothing.
  • Queue/topic takeover. Only the leader owns broker consumers. bus_messages binds a protected broker identity to its reserved run before that run starts. A replacement leader therefore follows the existing durable run instead of starting a duplicate. It acknowledges a completed run and clears a failed/cancelled reservation so retry can create a new run. An active/waiting duplicate is held unacknowledged on RabbitMQ/AMQP with an extra delivery slot; Kafka pauses only that partition and checks again. Settlement still occurs only at the configured on-receipt, run-success or explicit-confirmation boundary.
  • Deploy propagation. A deploy, connection or project change raises a generation number in settings; every engine compares it on each beat and reloads its routes (and the leader its timers and listeners).
  • Locks. The leases table also gives short cluster-wide locks, such as the deploy-folder lock so replicas starting together deploy a package once.
  • Studio in a cluster. A studio with SUTRA_WORKERS=0 edits and deploys; the engines run.

Leader failure, switch and return

Leader healthyrenews lease each beatowns timers/listenersLeader disappearsno heartbeat or leaserenewal reaches databaseLease expiresafter three beatsanother engine may take itNew leaderrecovers running tasksrebuilds one-only workOld leader returnsreads authoritative leasestops leader-only workDurable state survives the switchtasks, fencing claims and file-listener checkpoints are shared in PostgreSQLDuring a database outage, engines cannot durably claim or checkpoint new work.Heartbeat and LISTEN reconnect; polling resumes from the stored rows when PostgreSQL returns.
Leader failover and recovery. The database lease, not a process memory flag, decides who leads.
  1. Normal operation. The leader renews the database lease on every beat. Only it owns timers, folder/mailbox/Drive/broker listeners, orphan recovery, run promotion, alerts and housekeeping. All engines can serve gateway requests and execute claimed tasks.
  2. Failure detection. If the process, host or network path disappears, it cannot renew the lease or heartbeat. Existing database rows do not disappear. After three heartbeat intervals the lease is eligible for takeover and the engine is considered dead.
  3. Takeover. Exactly one eligible engine updates the lease. Its becameLeader hook rebuilds timers and listeners and begins one-only maintenance. It resets running tasks owned by dead engines to pending; the next owner gets a higher claim number. Folder-trigger checkpoints in file_listener_state and file_listener_files let the new leader distinguish the first baseline from files that arrived, changed or failed under the old leader.
  4. Former leader returns. On its next successful heartbeat it reads and tries to renew the authoritative lease. If another engine owns a valid lease, its lostLeader hook stops timers and listeners. It remains a normal engine: its gateway can serve requests and its worker slots can claim ordinary tasks, but it does not run leader-only work. It may lead again only after the current lease is released or expires and it wins a later database update.

What happens during other failures

  • Activity error or timeout. The executor aborts at the limit. The task retries after its configured delay, routes through its connected error output, invokes the Sutra Error handler, or fails the run in that order.
  • Engine dies while an activity runs. Its uncommitted transition is absent. The leader requeues the task after the heartbeat threshold; the activity can run again, while fencing prevents the old claim from committing later.
  • PostgreSQL is unavailable. No engine can safely claim, start or checkpoint durable work. Heartbeat errors are contained rather than terminating the process; broken pool clients are discarded, the notification listener reconnects, and periodic polling resumes from the durable queue after the database returns. A process keeps its last local leader state while the answer is unknown, but it cannot acquire or prove a new lease without PostgreSQL.
  • Notification is lost. Nothing is lost from the queue. The next periodic poll sees the pending row.
  • Graceful drain. Readiness turns off and leadership is released immediately. Current steps get the drain window; unfinished claims return to pending for another engine.

The guarantee is durable at-least-once activity execution with exactly-once fenced state transitions, not exactly-once effects in an outside system. This is why request IDs, object keys or other idempotency controls should be passed to external APIs for non-repeatable operations.

Releases and deployment

Buildstudio, CLI, or aRelease SutraPackage fileSutras, connections,schemas, sha256Checkactivities, secrets,paths, skill namesDeploy to test+ test deploymentconfigApprovalperson orpipeline gateDeploy to prod+ prod deploymentconfigsutra deploy --serverremote engine, admin tokenDeploy folder at startSUTRA_DEPLOY_DIR, containersRoll backthe previous package, kept in historyif needed
A release. One package travels unchanged from test to production; each environment brings its own deployment config.

Project packages

A release is a project package (packages.ts): a JSON file with format sutraflow-package v1 holding every deployed Sutra at its version, the project's connections (secret names, never values), shared schemas and WSDLs, Project properties and logging, a manifest and a sha256 checksum. The manifest includes Sutras, secrets, activity types and each Memory table's key, database/driver, referenced source objects, queries, schedule/time zone, limits and failsafe. Preflight rejects missing Memory-table dependencies and invalid configuration before deployment.

  • Check: the server knows every activity type, the secrets exist in its vault, and API paths and MCP skill names are not used by another project.
  • Deploy: Sutras are matched by name and created or updated as new versions (unchanged documents are left alone); Sutras not in the package are undeployed unless kept. Each deployment is stored in package_deployments with its report.
  • Roll back: deploys the package before the latest one, or a chosen one from history.
  • Test: deploys into a throw-away server and runs the package's Sutras.
  • Import: a new project from chosen Sutras of a package, as drafts by default (no address clashes, missing secrets only warn), not recorded as a deployment. Copy builds a package of chosen Sutras of a project on the same server and imports it the same way.

The sutra command

CommandDoes
sutra package --project Shop --version 1.4.0Writes Shop-1.4.0.sutra
sutra check Shop-1.4.0.sutraChecks it against the target server
sutra deploy Shop-1.4.0.sutra [--ops prod.json] [--keep-others]Deploys it
sutra test Shop-1.4.0.sutraTests it on a throw-away server
sutra history --project ShopLists deployments
sutra rollback --project ShopGoes back to the previous package
sutra secret set NAMEStores a vault secret
sutra statusEngines, leader and work in the cluster

With --server and --token (or SUTRA_SERVER and SUTRA_ADMIN_TOKEN) the CLI talks to a running studio or engine; without them it works on the local data folder, which is how container images are prepared.

Release Sutras

The Release palette makes a release itself a Sutra: Build package, Check package, Deploy package and Roll back, on this server or on a remote engine whose admin token comes from the vault. The Release pipeline sample builds, checks, deploys to a test copy, waits for approval and deploys to production. Release activities are off until an administrator allows them in Admin Console → Server → Runtime.

Deployment strategies

StrategyHowWhen
One SutraPublish a version and deploy it in the studioDevelopment and quick fixes on one server
Whole projectPackage, check, deploy (studio, CLI or a Release Sutra)Test and production: the same file everywhere
Headless engineSUTRA_MODE=engine; only the automation API, with the tokenProduction servers without the studio
Container imagePackages in /deploy, deployed at start; a failing package stops the startDocker and Kubernetes
ClusterPostgreSQL, several engines, a load balancer on /readyHigh availability and more throughput

Headless engines

With SUTRA_MODE=engine the designer is not served and its API is closed. The engine keeps the Admin Console at /admin for its users, and the API the console and automation need: packages, deployed Sutras and their versions, runs, approvals, secrets, engines, access and audit, for signed-in users and API tokens. There is no first-start page; the first administrator is added on the server with sutra user add. Health, readiness and metrics stay available.

Admin Console on headless engines

The console (web/admin, server/src/console.ts) is for what is deployed. Operators see the overview, start and stop deployed Sutras (their triggers stop starting runs while they stay deployed), look into runs and resubmit them, decide approvals, deploy an earlier version or roll a project back to an earlier package, and drain any engine: the request is stored on the engine's row and that engine drains on its next heartbeat. Administrators manage users, system accounts with their API tokens, roles, and read the audit log. Every page shows only the projects the signed-in account may see, and every action is checked again by the server.

Docker

The Dockerfile builds in one stage and runs in a slim Node 24 image as the node user under tini, with a health check on /ready. Defaults: headless mode, data in /data, packages from /deploy, admin on 0.0.0.0, JSON logs. docker-compose.yml runs one server; docker-compose.cluster.yml runs PostgreSQL, a studio and two engines with a shared SUTRA_MASTER_KEY and a 45-second stop grace period.

Installing and upgrading

This section is how the installer works inside. To install or upgrade a server, follow the Administration Guide (The web installer, Silent installation, Upgrading), which has every page with its picture.

The installer (server/src/install) runs before any settings exist, so it is a program of its own, started by the launcher (sutraflow install or upgrade): server.ts serves the pages of web/install, cli.ts the same steps silently from a JSON file, and both call core.ts. Each install step that needs SutraFlow's own code (tables, the administrator, migrations, backups) runs in a child process (task.ts) with the target's settings, so the installer never opens a database with its own.

GuardHow
Only this machineListens on 127.0.0.1; the Host header must name this machine (no DNS rebinding)
Only this browserA one-time token in the address, compared in constant time, on every request
Only oncedata/install.lock after an install; --reset removes it
Nothing half doneEvery answer is checked before anything changes: ports free, database reachable, pgvector, passwords strong
No secrets in filesSilent configs and saved answers take passwords as {"env"} or {"file"}; the database password goes to SUTRA_DB_PASSWORD, apart from the address

An upgrade

  1. Snapshot: row counts and checksums of every table, read only.
  2. Stop the studio and the engine beside it through the launcher (graceful drain; 2.1.2 stops both, and remembers whether the engine ran).
  3. Backup: the data folder, settings, and pg_dump read back with pg_restore --list, or SutraFlow's own copy of the database.
  4. Program files free: every program file is opened for writing; one held without sharing stops here, named with its holder from the Windows Restart Manager.
  5. Move the old runtime into the backup; copy the new one in. A folder in use (a web server, terminal or Explorer in it) cannot be renamed on Windows, so it is copied into the backup and updated in place. The data folder, settings and a site's own .htaccess/web.config stay.
  6. New settings with defaults; the new version's migrations; compare with the snapshot.
  7. Start what ran before and check that it answers the new version.

Any failure runs the way back: stop, remove the new runtime, move the old one back, restore the data folder, settings and database (a PostgreSQL restore waits at most a minute for locks and reports when it could not restore), and start the old version. Every step is reported to the page or terminal and written to data/logs/installer.log.

Start and stop

Start order

  1. Open storage and create missing tables.
  2. Register every activity; connect the variable hooks; load deployment config files.
  3. Deploy packages from SUTRA_DEPLOY_DIR under the deploy-folder lock (skipped when the checksum is already deployed). A package that fails stops the start.
  4. Start the engine worker slots and the cluster beat; the leader starts timers and listeners.
  5. Build the gateway routes, start the gateway listeners and certificate renewal.
  6. Start the admin API. /ready now answers 200.

Graceful stop

Stop signalSIGTERM ordrain APINot ready/ready answers 503Leave leadershiptimers, listenersstop hereDrain stepsup toSUTRA_DRAIN_MSHand backunfinished stepsto pendingClosegateway, pools,flush traces
A graceful stop (SIGTERM, docker stop, or POST /api/engine/drain).

On SIGTERM, Ctrl+C or POST /api/engine/drain: readiness turns off so load balancers stop sending requests; the engine leaves leadership and stops timers and listeners; running steps get up to SUTRA_DRAIN_MS to finish, and the rest go back to pending for another engine; the gateway closes after its waiting callers have their replies; database and bus pools close; traces are flushed.

Monitoring

SignalWhereDetails
Health/health, /readyLiveness, and readiness (storage, packages, gateway, not draining)
Metrics/metricssutra_runs_started_total, sutra_runs_finished_total, sutra_run_duration_seconds, sutra_steps_total, sutra_step_duration_seconds, sutra_step_retries_total, sutra_gateway_requests_total, sutra_gateway_request_duration_seconds, plus gauges for tasks and engines. Labelled by engine; scrape every engine.
TracesOTLP/HTTP to OTEL_EXPORTER_OTLP_ENDPOINTOne trace per run, one span per step, trace id from the run id, caller traceparent continued
LogsProject log files; standard outputRotation per project; SUTRA_LOG_FORMAT=json for log collectors
Engine statusGET /api/engine/status, sutra statusEngines, heartbeats, leader, active steps, draining
Run historyStudio Runs, /api/runsEvery step's input, output, error and duration; the stage (design or runtime) and client; resubmit; retention by SUTRA_RUN_RETENTION_DAYS, design runs by SUTRA_DESIGN_RUN_RETENTION_DAYS

Alerts

The cluster leader checks every enabled rule every six heartbeats (30 seconds by default), so a cluster alerts once however many engines it has. A check reads the database: failed or slow runs in a window, the gateway request log for error rate and p95 latency, engine heartbeats, pending steps older than a limit, waiting approvals, the gateway certificate, and the listeners of the leader. When a rule's condition holds and it has no open alert, an alert opens and every channel of the rule is told; while it holds, the alert is updated and, unless acknowledged, a reminder goes out every chosen number of minutes; when it clears, the alert resolves and the channels are told if the rule says so. Deliveries are recorded on the alert with their result. Channels: email through an SMTP connection; a webhook with a JSON body (event, text, alert) signed with an HMAC of a vault secret in X-Sutra-Signature; or a deployed Sutra started with the alert as its input. Resolved alerts are deleted after SUTRA_AUDIT_RETENTION_DAYS. sutra alerts exits with 1 while a critical alert is firing, for scripts and monitors.

Security

  • Studio: the first visit creates the administrator; signed session cookies that end when the account is disabled or signed out everywhere; changing requests need the X-Sutra header; the admin port listens on 127.0.0.1 unless set otherwise.
  • Accounts and roles: people and system accounts hold roles (Administrator, Developer, Deployer, Operator, Approver, Viewer, API caller, or custom ones) for all projects or one project. Every admin API route checks a permission for its project (guard.ts); lists show only the caller's projects. Five wrong passwords lock an account for 15 minutes; an administrator-set password must be changed at the next sign-in; at least one active administrator always remains.
  • Automation: SUTRA_ADMIN_TOKEN acts as an administrator, compared in constant time. System accounts get their own API tokens (stored as hashes, with expiry) limited to their roles; headless engines accept only tokens.
  • Personal API tokens: a person makes their own tokens in My profile, with an expiry of 30, 60 or 90 days (at most 20). Such a token signs in as that person, with their roles, and is marked as a token caller: it cannot make or renew tokens or change the password, which need a session. Renew replaces an expired or nearly expired token with a new value. Sign out everywhere, a password reset by an administrator and disabling the account delete them; an administrator can revoke them or switch them off for the server (setting personalTokens), which also stops the ones that exist.
  • Server environment: ${env:NAME} in project properties, deployment config, logging and connections reads only names an administrator allowed (Server, Runtime); the server's own SUTRA_ variables never, and script steps do not receive them. Engine properties are not limited.
  • One project per request: guard.ts settles the project of each request before the permission check. A request naming two different projects is refused; create routes refuse an id that exists; an update keeps the stored project. Secrets are read only through the Secret properties of the running project or the engine (secrets.ts scope hook); design previews and live run events are filtered by the caller's projects.
  • Audit: every change, sign-in and refused request is recorded with who, when, from where and the result, searchable and exportable as CSV.
  • Vault: AES-256-GCM; values never leave the server through the API; masked in run history and logs.
  • Gateway: per-service API policies (API key, Basic with listed users or system accounts holding Call services on the project, JWT, mutual TLS, WS-Security); TLS with uploaded or Let's Encrypt certificates.
  • Outbound: security profiles, client certificates, OAuth tokens stored encrypted, circuit breakers on HTTP connections.
  • Data never becomes code: SQL text, transactions and procedure names may resolve only administrator-managed Project/Engine properties; input, trigger, earlier-output and Local-variable references there are rejected and runtime values must use bound parameters. Formulas and templates are parsed, not evaluated; scripts receive values as environment variables and a JSON file; programs get arguments without a shell; file activities stay inside their folder; custom JavaScript runs in a sandboxed worker with limits.
  • SSO client binding: OpenID Connect uses PKCE, state and nonce. SAML uses a one-time request in the shared database plus a short-lived signed client cookie; the callback must present both. A browserless client follows the same contract by retaining the cookie returned by the start request and sending it with the SAML callback.
  • Policies off by default: scripts, release activities and AI command-line tools (with MCP servers started by a command, limited to allowed command lines) each need an administrator's switch in Admin Console → Server → Runtime. Project and Engine properties are always read-only to Sutras.
  • Vendor supply chain: every build checks reviewed local dependency trees and packaging scope; connected CI, releases and a weekly workflow compare them with npm. A newer upstream version must be reviewed for API and behavior changes and pass focused plus complete regression tests before its pinned baseline moves.

AI and MCP

One AI provider connection chooses the engine: the Claude, Gemini or OpenAI APIs; Ollama (online or offline, with models pulled or imported from server paths: gguf, Modelfile, safetensors, or a copied Ollama folder); LM Studio, Hugging Face, local TGI or any OpenAI-compatible server; or the Claude, Gemini and Codex command-line tools installed on the server. Test connection lists the models. Every AI activity returns its answer plus ai: provider, engine, model, tokens and time.

The other direction: a Sutra that starts with an MCP skill trigger becomes a tool for AI assistants, described by its name, purpose and inputs, and answered by Reply to AI. An MCP server connection groups skills under one address, so an assistant can be given, for example, only the order skills.

The studio MCP server (studio-mcp.ts, /mcp/studio on the admin port) is for assistants that build Sutras. It accepts only a Bearer token (a person's own token, a system account's token or the admin token), never a browser cookie. Each of its 15 tools calls the studio's own admin API in the same process (app.inject) with the caller's token and x-sutra-client: mcp, so the permission rules, project checks and audit are those of the designer. Reading tools need View; create_sutra, change_sutra and test_sutra need Design and only make drafts and design-time runs; change_sutra returns a difference and a change id first and saves only when called again with it; deploy_release needs Deploy and the plan id a person approved. No tool returns a secret value, and every call is in the audit log as MCP studio <tool>, changes marked generated.

The AI guard step (ai/guard.ts) checks text before and after a model: personal data, hidden instructions, blocked topics, length and JSON shape, moderation categories with thresholds (block or warn), language with optional translation, and a cache of answers per Sutra and per person (table guard_cache; anonymous callers get no cache). ai/personal-data.ts also masks personal data in a project's log lines and run history when its logging asks for it.

Features by palette

142 activities in 22 palettes. The user guide describes each one with its settings.

PaletteActivities
Triggers7Manual start, Timer, REST service, SOAP service, Channel trigger, WebSocket service, WebSocket client
HTTP / REST2Send HTTP request, Send HTTP response
SOAP / Web services2Invoke SOAP service, SOAP reply
WebSocket2WebSocket send, WebSocket client send
Data & mapping13Map data, Parse JSON, Render JSON, Parse XML, Render XML, Parse CSV, Render CSV, Filter list, Sort list, Aggregate, Map JSON Data, Map XML Data, Transform (JSONata)
Flow control16If / else, Switch, Router, For each, Merge, Wait, Human approval, Set Local Variable, Get Local Variables, Get Properties, Throw error, End, Call Sutra, Return, Error handler, No operation
Files5File trigger, Read file, List / read directory, Write file, Move / copy / delete file
SFTP / FTP5Remote file trigger, List remote files, Read remote file, Write remote file, Move / copy / delete remote file
DB Ops5SQL query, SQL update, Call procedure, SQL script, SQL transaction
MongoDB7List MongoDB collections, Insert MongoDB documents, Find MongoDB documents, Update MongoDB documents, Delete MongoDB documents, Bulk write MongoDB documents, Aggregate MongoDB documents
Memory tables5Get Memory Record, Set Memory, Delete Memory Records, Query Memory Records, Refresh Memory Table
Service Bus3Publish message, Queue / topic trigger, Confirm message
Email2Send email, Email trigger
Firebase3Firestore, Realtime Database, Push notification (FCM)
Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook)15Connected API call, Google Sheets, Google Drive / Docs, Google Drive / Docs trigger, Dropbox, YouTube, Facebook Page, Twitch, Twitch live trigger, Discord, Discord trigger, Telegram, Telegram trigger, SharePoint / OneDrive, SharePoint / OneDrive trigger
Azure Data Factory & Databricks6Run ADF pipeline, ADF pipeline run, ADF run finished trigger, Run Databricks job or notebook, Databricks code block, Databricks SQL
Custom code2JavaScript code, HTML template
Scripts (PowerShell, shell, Python)4Python script, PowerShell script, Shell script, Run program
Release (packages)4Build package, Check package, Deploy package, Roll back
Dashboards4Dashboard page, Chart, Charts from AI, Dashboard reply
General4Log, Validate fields, Send to channel, Counter
AI26AI prompt, AI classify, AI router, AI extract, AI summarize, AI translate, AI sentiment, Ollama, AI agent, Ask a person, Hand off to agent, Load memory, Save memory, Clear memory, Add to knowledge, Read document text, Search knowledge, Ask knowledge, Remove knowledge, AI embed, Call MCP tool, Agent channel, Agent reply, AI guard, AI tool, Reply to AI

Connection types

HTTP connection, Outbound security, API security policy, AI provider, Memory table, AI memory store, Knowledge base (RAG), MCP client (outside tools), MCP server (AI skills), Email (SMTP), Email (IMAP), Database (DB Ops), Kafka, RabbitMQ (AMQP 0-9-1), ActiveMQ / AMQP 1.0, Firebase, SFTP server, FTP server, OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook), MongoDB, Azure Data Factory, Databricks workspace, Discord, Telegram bot, WebSocket connection.

Studio

  • Canvas with palettes, named connections with conditions, undo and redo, test and debug runs.
  • Mapper: drag from Process Data to Activity Input, formula editor with functions and live preview, For-Each, If and Choose.
  • Default outputs on every activity (file details, HTTP status, AI model and tokens) even when a schema is set.
  • Resources with a + menu by kind, own names and icons, Test connection; AI model lists and Ollama management.
  • 60 samples that together use every activity.
  • Runs with step data, approvals, cancel and resubmit; Releases with packages and history; the read-only Services page with endpoints; Admin Console → Server with runtime, gateway and TLS controls.
  • New project: empty, with chosen samples, from chosen Sutras of a package file, or a copy of chosen Sutras of a project, as drafts.

Admin Console features

  • Overview of engines, deployed Sutras, runs of the last day, failures, approvals, work queue and gateway certificate.
  • Applications: start, stop and restart deployed Sutras; runs with step results, resubmit and cancel; earlier versions; package history and roll back; per-Sutra tuning.
  • Engines of the cluster with drain and engine tuning; approvals; users, system accounts with API tokens, roles; personal API tokens; My profile; audit log with CSV export.
  • Gateway: apps with keys, scopes and OAuth2 client credentials; plans with limits and quotas; firewall; traffic statistics and request log; APIs with OpenAPI.
  • A Console panel with every action's output, and each action as a sutra command and an HTTP call for Windows PowerShell and Linux shells.
  • Alerts: rules of nine kinds, channels (email, webhook, Sutra), open alerts with acknowledge and resolve, reminders; the Overview with open alerts and charts of runs and gateway traffic.

What each file does

Line counts are from this build. Use the search box to find a file by name or by what it does.

Files: Server start, storage and cluster

The process: how it starts and stops, where it keeps its data, and how several engines share one database.

FileLinesWhat it does
server/src/main.ts52Entry point of npm start. Boots the server, prints the studio and gateway addresses, and turns SIGTERM and Ctrl+C into a graceful stop (drain first).
server/src/dns.ts31Validates the administrator-controlled SUTRA_DNS_SERVERS startup override and configures only this Node process before connector lookups. No public-resolver fallback is automatic; operating-system DNS and TLS verification are unchanged.
server/src/index.ts195boot(): opens storage, registers every activity, loads deployment configs, deploys the packages in SUTRA_DEPLOY_DIR under a cluster-wide lock, starts the engine, the cluster beat, the gateway and the admin API, and wires change hooks (deploys rebuild routes, timers and listeners). Also the ordered stop().
server/src/config.ts122Process settings from environment variables (mode, environment, ports, folders, database with the password apart as SUTRA_DB_PASSWORD, engine id, drain, heartbeat, retention, logs, tracing, tokens) and the product version from package.json. Everything else is stored in the database and edited in the Designer or Admin Console according to ownership.
server/src/lifecycle.ts61Liveness (/health, with the version, mode, environment and the database in use) and readiness (/ready): storage answers, packages are deployed, the gateway listens, and the server is not draining.
server/src/cluster.ts239Heartbeat row per engine, the authoritative leader lease, recovery of a dead engine's steps, the deploy generation number that makes every engine reload its routes, leadership hand-over on stop, and the engine status list with the memory of each engine; a restart asked for in the Admin Console (2.1.1). A database interruption is contained and retried; after recovery the lease row decides whether this process still leads.
server/src/housekeeping.ts85Deletes finished runs older than SUTRA_RUN_RETENTION_DAYS, with their steps, in batches. Run by the leader about once a minute; waiting runs are never deleted.
server/src/db.ts658The synchronous compatibility storage layer: q (get, all, run) and tx (transaction) on SQLite or PostgreSQL, used by administrative and low-frequency paths. Holds the table definitions, converts them for PostgreSQL (bigint, double precision, bigserial) and ? placeholders to $n, and takes an advisory lock for each PostgreSQL write transaction (per run or Sutra queue with a key, one shared lock without). Refuses a synchronous write while an asynchronous transaction is open (asyncTxScope), so a transaction is never split over two connections. memoryStore gives the private in-memory database of runs that run in memory.
server/src/asyncdb.ts282Asynchronous storage for engine and gateway hot paths: on PostgreSQL a connection pool on the main thread (SUTRA_PG_POOL, metrics of waits and transaction times), on SQLite, PGlite and the in-memory engine one connection whose transactions take turns. Transactions are explicit objects (transaction(key, async tx => ...)); a first query travels with begin and the lock, and commitWith() sends the last statement with the commit, so a step completes in three round trips. Deadlocks and serialization failures are tried again.
server/src/pgworker.ts132Worker thread that owns the synchronous PostgreSQL connection of db.ts (pg, or PGlite for pglite: addresses). The main thread posts a numbered statement and waits on a shared flag for the answer with the same number. A lost connection is opened again on the next statement (10 tries); a statement already sent is never repeated, and a transaction the connection was lost in fails until it is rolled back. The engine uses the pool of asyncdb.ts instead.

Files: Engine

The durable step runner and the types every activity follows.

FileLinesWhat it does
server/src/engine/engine.ts841The public durable-engine façade and composition root: activity registration, start and drain, starting runs, complete/fail orchestration, and the in-memory twin. It keeps the API stable while delegating claims, execution, routing, storage, waits and operator actions.
server/src/engine/executor.ts278Executes one claimed activity: mapping context, variables and secrets, time limits and cancellation, loops, streamed emits, logs, and the complete-or-fail handoff. It does not own durable transition SQL.
server/src/engine/paths.ts140The path rule (2.1.7): a step may use the outputs of the steps before it on a connected path only. Finds the steps before a step, the step names a configuration refers to, and the references to steps that are not on the path; used by the design check, the engine and the designer.
server/src/engine/stage.ts48The stage of a run (2.1.7): design (a test or debug run, or a draft) or runtime (a deployed version), decided in one place when a run starts; a called Sutra takes its caller's stage. Also the client that started it (studio, api, cli) and the SQL every runtime figure uses.
server/src/engine/scheduler.ts142Queue polling, batched claims, priority order, concurrency slots and coalesced wake calls. PostgreSQL claims include the run and its outputs in the same round trip.
server/src/engine/queue-notify.ts78PostgreSQL LISTEN/NOTIFY wake hints with reconnect; durable polling remains authoritative and can be used alone with SUTRA_PG_NOTIFY=0.
server/src/engine/transitions.ts71Atomic primitives shared by complete, fail, route and settle: fenced updates, output plus run commits, state and logs, cancellation of open tasks, and routing scope.
server/src/engine/run-store.ts124The storage boundary for run loading, separately stored step outputs, claimed-task fencing, final settlement and copying ended in-memory runs into durable storage. A stale owner gets StaleStep and changes nothing.
server/src/engine/router.ts104Conditional routing, joins and dead-path elimination. It sends live or skip tokens and schedules the next activity without putting graph traversal back into the façade.
server/src/engine/waits.ts121Request/reply and finish callbacks, live run listeners, cross-engine completion checks and waitFor. Polling remains the correctness fallback when another engine finishes a run.
server/src/engine/operator.ts179Stable boundary for operator actions: approval decisions, cancel, resubmit, debug, queued-run promotion, time limits and cancellation observed from another engine.
server/src/engine/state.ts87Run-state types and pure helpers: separately stored outputs, initial process variables, compact streamed output and full state for API/history views.
server/src/engine/types.ts238Types shared by the engine, palettes and studio: Sutra document (nodes with descriptions, edges with label and condition), activity definition (fields, ports, output hint, design checks, execute), step settings, execution context and step result (port, output, wait, reply, call, result, stop).

Files: Data, mapping and expressions

How values move between steps: templates, formulas, structured mapping and design-time shapes.

FileLinesWhat it does
server/src/template.ts155{{ }} templates: input, nodes, trigger, vars, gv, secret, run, item, index; pipes such as upper, default, number, length. Parsed, never evaluated as code.
server/src/expr.ts621Formulas starting with =: functions (string, number, date, list, encoding), operators and predicates, plus read-only hooks for Project and Engine properties. Also the function catalog shown in the mapper.
server/src/values.ts75Path and value helpers shared by templates and formulas.
server/src/mapping.ts187Structured Activity Input mapping: a target tree from a schema or ad-hoc paths, with For-Each, where, group by, sort, conditions and Choose.
server/src/mapping-check.ts71Shared static mapping checks and runtime/sample value checks: required targets, formula syntax, stale rules, XML root/name rules, typed values and list cardinality.
server/src/schema-validation.ts95Shared asynchronous contract validation: AJV for JSON Schema and isolated libxml2 WebAssembly for original XML / namespace-preserved SOAP operations; bounded concurrency and project-local XSD dependencies.
server/src/schema-impact.ts66Read-only proposed-schema structural comparison and project-scoped saved-draft usage analysis. Injects an isolated lookup into design analysis; never saves or swaps shared schema state. Reports new diagnostics and explicit runtime/deployed/transitive-dependency limitations.
server/src/contracts.ts173Project-scoped strict contract definitions, non-mutating payload checks and Manual/REST/SOAP/WebSocket starter validation shared by engine admission and execution. SOAP operation objects are validated as namespace-aware XML against the real XSD; invalid starter input is rejected before durable run creation.
server/src/call-contract.ts83The input contract of a called Sutra (2.1.7): the payload schema of its Manual start, for the version a Call Sutra step uses (draft or deployed), with a fingerprint so the designer can say when the called Sutra changed it. Feeds the Call Sutra mapping targets, its notes and the contract API.
server/src/sample-mongodb.ts38Credential-free Atlas M0 lifecycle sample scoped to the current run ID, with strict starter schema, query modes, update, aggregation and precise cleanup.
server/src/connectors/mongodb-kind.ts49Independent MongoDB connection field metadata, avoiding initialization cycles with the runtime resource registry.
server/src/connectors/mongodb.ts404Native Atlas M0 document activities, verified TLS and vault-backed URI, small pooled clients, bounded operations/cursor cleanup and canonical Extended JSON. Only M0-verified activities are registered; advanced capabilities are not implied by driver probes. Bulk write sends up to 1000 insert/update/replace/delete operations in one request, with the single-activity guards, and fails the step with the written counts on any failed operation.
server/src/mapping-preview.ts61Read-only whole-mapping JSON/XML preview and proposed JSON Schema/XSD generation from bounded sample text. No activity dispatch or external connector is executed.
server/src/sample-schemas.ts79Project-scoped schema contracts attached to newly added samples without replacing existing drafts or edited shared schemas.
server/src/sample-hints.ts43The hint added to a database error when sample data is missing (2.1.7): a query on a sample_ database or table that does not exist names the install Sutra of the project that makes it, such as "Run 'Sample: Sales orders install' first."
server/src/sample-mapping.ts56Executable typed JSON and XML mapping examples: shared JSON targets and manual XML attributes, namespaces and repeating elements.
server/src/sample-functions.ts191The Functions sample (2.1.3): an order message and one working formula for every function of the formula language, by group; the sample maps each group in a Map data step and logs it. A test keeps it complete.
server/src/sample-validation.ts108Ten described contract-validation samples: schema-backed XML mapping, JSON/XML pipelines and expected rejection, strict file reads, and live HTTP/REST/SOAP examples; project-scoped schemas are reused without overwriting edits.
server/src/design.ts202Design-time data shapes: what each step receives and returns before anything has run, and the warnings of each step (unmapped required fields, schema problems, and the activity's own design checks). Feeds the Process Data tree, the Output tab and the canvas warnings.
server/src/schemas.ts326Shared schemas of a project: JSON Schema, sample JSON, XSD and WSDL, all converted to one tree format for the mapper.
server/src/settings.ts112Common checkbox defaults and strict Boolean Project/Engine-property conversion for activities and gateway/listener configuration, preserving legacy non-Boolean aliases. Booleans accept true/on/yes/1 or false/off/no/0; missing or invalid property values fail rather than use string truthiness. Selected-schema validation is opt-in; On requires a valid matching contract. Strict sample JSON requires every shown field and forbids extras; JSON Schema follows its authored constraints. Compiled checks are reused only for unchanged persisted schema text. Executable SQL identifiers accept only administrator properties while run data remains bound.

Files: Projects, Sutras, connections and releases

What a team edits and ships.

FileLinesWhat it does
server/src/projects.ts470Projects: administrator-managed Project properties, logging, deployment (ops) configs with ${env:...} values, the project files folder (${files} = <data>/files/<project>), Engine properties and server policies. Renaming a project keeps its id and moves its name-based files folder and deployment config.
server/src/flows.ts309Sutras: draft, published versions, deploy and undeploy, step descriptions kept, validation (names, ports, connection conditions, Error handler, API paths, MCP skill names, and the design checks of each activity, such as a missing Python, file or connection), the change hooks, and missing project variables per step (also through its connections).
server/src/git/files.ts244A project as Git files and back: sutraflow.json, sutras, connections (secret names only), schemas, in folders; stable JSON; repository ids mapped to each workspace's own ids, references translated both ways.
server/src/git/engine.ts287Git for workspaces: the git command (tokens through one-command environment settings, never on the command line) or isomorphic-git built in (content-compared status); init, clone, status, commit, push, fetch, pull with conflicts, branches, history, files at a commit.
server/src/git/accounts.ts97Each person's Git accounts (GitHub, GitLab, Bitbucket, Azure DevOps, others): encrypted tokens used only for that person, author name and email.
server/src/git/workspaces.ts280Workspaces: initialize a team project, clone into a personal copy (owner only, not deployable, restricted until trusted), status by item, commit, push, pull, conflicts, discard, branches, history, diffs, disconnect.
server/src/git/restricted.ts44Restricted mode: the steps that run code or commands from a repository, refused in an untrusted personal copy.
server/src/folders.ts109Folders of the Project explorer for Sutras, Resources, Schemas and Service descriptors: a folder path on each item, empty folders in the folders table; rename and move take the contents along, remove lifts them one level, nothing is deleted.
server/src/resources.ts481Connection types (HTTP, SOAP, security profiles, API policies, AI provider, MCP server and the connector kinds) with their fields and icons. Secret values are never stored here, only vault names.
server/src/resourceTest.ts146"Test connection": tries the settings as they are on screen, with variables resolved, and reports the result in one sentence; for every kind, including AI providers, knowledge bases, MCP, databases, SFTP and FTP, brokers, OAuth accounts (YouTube channel, Twitch user), Azure Data Factory, Databricks, Discord and Telegram.
server/src/secrets.ts165The vault. AES-256-GCM with a key from SUTRA_MASTER_KEY or data/master.key. Values are never returned by the API and are masked in run history. 2.1.8 (audit F1): while the work of a project runs (a step, a listener, Test connection, model discovery, a preview) only the secrets behind its own and the engine Secret properties can be read, whichever way the name arrived; server-level work reads unscoped. Each stored secret records the project it belongs to (empty for a server-level secret): a Secret property can point only to its own project's secret, a name not stored yet, or (with Manage secrets) a server-level one, and a secret owned by another project is dropped from a run's scope even when a binding exists.
server/src/ai/cli-policy.ts149AI command-line tools (2.1.8, audit F2): AI providers that use the Claude, Gemini or Codex command-line tool and MCP servers started by a command run a program only when an administrator switched them on (Admin Console > Server > Runtime) and the command line starts with an allowed one, word for word; AI tools run in an empty folder and refuse flags that let them act without asking; programs get a small environment (path, home, temp, locale and the names the administrator lists). At the first start of 2.1.8 every server starts with the switch off; command lines found in existing connections are listed as waiting for an administrator to approve or dismiss them, never trusted on their own.
server/src/fs-confine.ts68Link-aware folder confinement (2.1.8): a path is resolved to its real location, following symbolic links and Windows junctions, and checked against the real folder, so a link inside a File step's folder or a project's files folder cannot carry a read or write elsewhere. Folder walks do not follow links.
server/src/secret-scope.ts103Upgrade checks for 2.1.8. Environment variables projects use with ${env:NAME} that an administrator has not allowed (names and where, never values). Audit F1: connections, Sutra drafts and deployed Sutras that name a stored secret their project can no longer read. Shown on the Admin Console Overview and by sutra secret check; names only.
server/src/samples.ts1924The sample catalog offered in "New Sutra" (60 samples covering every activity) and addSamples(): each goes to a Samples/<topic> folder, and every empty connection field it uses is set to a "Sample ..." connection made once in the project.
server/src/channels.ts45Send to channel: starts every deployed Sutra of the project whose Channel trigger listens on that name. Reads deployments from the database, so it works across engines.
server/src/bundles.ts205Release zips: the package, a deployment config to fill in (connections, project variables, secrets needed), a README, the documentation (HTML and Markdown) and the project files (files/, written to the project files folder on deploy and import); zip writer and reader; packages built from the Git files of a project without a server.
server/src/connectors/websocket.ts215WebSocket palette: the WebSocket service trigger and send step (answer, push, broadcast, close), the WebSocket connection kind, the client trigger (reconnects with growing waits, subscribes again, leader engine only) and the client send step that can wait for its answer.
server/src/connectors/chat.ts334Discord (webhook or bot) and Telegram bots: messages, embeds and files, reading a channel, Test connection, and triggers for messages and commands (channel polling, Telegram long polling).
server/src/connectors/azure.ts595Azure Data Factory and Databricks: Entra ID sign-in (service principal, managed identity, Azure CLI) and Databricks tokens or OAuth; run, wait for, rerun and cancel pipelines; the run-finished trigger; jobs, notebooks, code blocks and SQL; Test connection.
server/src/python.ts116Python on the server: finding the interpreter (setting, SUTRA_PYTHON, py, python3, python), and checks before a run: syntax, missing files, virtual environments and packages.
server/src/dbmigrate.ts180Moving the server's own data from SQLite to PostgreSQL: the saved connection (password in the vault), Test connection with plain-word errors for remote servers, SSL modes, the migration status, and starting tools/migrate-to-postgres from the Admin Console.
server/src/docs.ts263Documentation made from Sutras: triggers, steps in run order with their descriptions and settings (connections by name, secrets by name), next steps, error handling, connections and variables; Markdown and HTML, for one Sutra, a project or a package.
server/src/sample-data.ts330The samples and their data as the installer lists and removes them (2.1.5): everything a sample stores is named sample_<objective>; sampleData({ remove }) finds the sample Sutras, the Sample ... connections nothing else uses (with their knowledge, AI memory and memory tables), schemas, counters, the properties the samples added, sample_ files in the project and data folders, and through the Sample ... database, MongoDB, SFTP and FTP connections the sample_ objects there; the sample names of earlier versions too.
server/src/sampledocs.ts201The documents of the RAG samples (a PDF, a Word document, a PowerPoint deck and a Markdown FAQ of a tea shop), made in code so they are always the same.
server/src/packages.ts526Project packages: build (Sutras at their versions, connections, schemas, variables, a sha256 checksum), read, check, deploy (matched by name, prune or keep others, deployment config), history, rollback and test. 2.1.6: planDeploy works out the plan (each Sutra new, unchanged, deployed again or replacing the version here; undeploys; schemas; what is created; the checklist of connections, properties and logging kept as they are, field names only) with a plan id; replacing or undeploying needs approve = that id (or approved for the deploy folder, rollback and sutra test), audited.
server/src/config-files.ts489Configuration as files (2.1.6): exportConfig writes server settings (engine properties, roles, system accounts without tokens, shared connections, gateway options, firewall, trusted proxies, policies, gateway plans and apps without keys, alert channels and rules, server knowledge bases and grants) and projects (properties, logging, connections named not by id) as a document, secrets as ${env:} placeholders, never people. runConfig checks or applies one in a single transaction: creates what is missing, all or nothing (a check rolls back and reruns change hooks), lists what is there in a checklist (differing field names; secrets compared in memory), plain secret values into the vault, audits each item created. configNeeds names the permissions a file needs.
server/src/config-values.ts96Config file values where sutra config runs (2.1.6), with no database: YAML or JSON parsing, the environment file merged over the config file (lists matched by name), ${env:NAME} read from the environment, file:/path read for secret, private key and certificate properties, $${env:NAME} kept as a run-time reference; reports missing variables or files and secrets written directly, by name only.
server/src/api-docs.ts342What every admin API route does (2.1.6), keyed like guard.ts RULES, with the sutra command that calls it, and the admin port endpoints outside /api; the source of the Admin API part of the Administration Guide. A test fails when a route has no entry.
server/src/cli.ts1158The sutra command, on a remote server with a token or on the local data folder. Commands (read from sutra help when this page is built): package, check, deploy, config, test, history, doc, rollback, connect, python, secret, db, user, sutras, runs, approvals, engines, memory, agents, knowledge, token, audit, alerts, gateway.

Files: Admin API, gateway and triggers

The two network faces of the server and the long-running starters.

FileLinesWhat it does
server/src/api.ts1349Admin API on port 4800 (Fastify): sign-in, projects, Sutras, runs, approvals, resources, secrets, packages and release zips, documentation, sample projects, Git, OAuth sign-in, engine control, server settings, Python, the database page and the move to PostgreSQL, design-time SQL previews capped at ten rows, /health, /ready, /metrics, /guide, /architecture and the studio files. Bearer tokens for automation; a headless engine allows only a short list of routes.
server/src/access.ts418Users and system accounts (provision, disable, lockout, password rules, sign out everywhere), roles made of permissions, grants for all projects or one project, permission checks, API tokens of system accounts and personal API tokens of people (stored as hashes; 30, 60 or 90 days, renew, server switch), and Basic sign-in of system accounts at the gateway.
server/src/studio-mcp.ts368The studio MCP server at /mcp/studio: 15 tools for AI assistants that read projects, make and change Sutra drafts (difference first, then confirm), check and test them, and check and deploy releases with a person's approval; each tool calls the admin API in-process with the caller's token, so permissions and audit are the designer's.
server/src/guard.ts449The permission of every admin API route and the project it applies to, settled once per request (two different projects are refused). The server refuses to start when a route has no rule. Also writes each change and each refusal to the audit log, without passwords or secret values, marking calls made through the studio MCP server.
server/src/console.ts150Data for the Admin Console: the overview (engines, deployed Sutras, runs of the last day, failures, approvals, gateway), deployed applications with their triggers and run counts, starting and stopping a deployed Sutra, and drain requests for any engine. Always limited to the projects the caller may see.
server/src/tuning.ts164Tuning parameters: engine values for the cluster or one engine (steps at once, in memory too, steps per run, reply wait, retention, trace sampling, queue check, settings refresh) and per deployed Sutra (execution durable or in memory, runs at once, priority, run time limit, default retries, step data in history, retention). Stored in settings and deployments, applied by every engine on the next beat. Refuses in memory for Sutras with steps that wait.
server/src/memtables.ts499Memory tables: small reference data each engine keeps in an LRU JavaScript Map; loaded from Oracle, SQL Server, MySQL, PostgreSQL or SQLite, filled by Sutras or fetched on a miss. Set Memory updates running row/byte counts and cached quotas in constant time; Refresh alone builds and measures a replacement before an atomic swap. Cron/interval schedules use the leader for failsafe tables and each engine for memory-only tables. Failsafe changes use mem_rows and mem_meta versioning; engines read deltas and hot-reload requests.
server/src/palettes/memory.ts129Memory tables palette: Get Memory Record (read-through), Set Memory, Delete Memory Records, Query Memory Records and Refresh Memory Table. Cache mutation never writes to the external source database.
server/src/sizing.ts82Machine profiles from 1 vCPU / 1 GB up, measured with tools/loadtest.mjs: steps at once, queue check, settings refresh, engines per machine, Node memory, files read whole, rows per streamed batch, database. Engine defaults and the Admin Console panel This machine come from here.
server/src/alerts.ts358Alerts: channels (email, signed webhook, a Sutra), rules of nine kinds checked by the cluster leader every 30 seconds, alerts that open, remind, are acknowledged and resolve, delivery records, and the runs timeline of the Overview.
server/src/audit.ts119The audit log: record, search, CSV export, and deletion after SUTRA_AUDIT_RETENTION_DAYS.
server/src/approvals.ts227The Approval Center: who may decide an approval (roles and accounts the step names, from the data too; Approve permission when it names nobody; administrators on behalf), the rule (any, all, a number), votes, history, reassigning, and the leader's 30-second tick for email notices, reminders, escalation and expiry.
server/src/deletes.ts140Deleting and renaming project items: one Sutra, connection, schema or service descriptor, or a folder with everything in it (confirm=delete, refused while a Sutra in it is deployed, in one transaction); what uses an item; the Git working copy written again at once. Configuration is never deleted here.
server/src/sso.ts260Single sign-on for people with OpenID Connect or SAML 2.0. OIDC uses authorization code with PKCE, state and nonce. SAML combines one-time shared-database state with a signed client cookie, usable by browsers or cookie-aware API clients, and delegates signed assertion validation to saml-sso.ts. Accounts are found by the provider subject/NameID, created or linked only when allowed; roles come from groups.
server/src/saml-sso.ts137SAML 2.0 browser sign-on: Redirect AuthnRequest generation and HTTP-POST Response verification. Requires one signed assertion or signed response and checks issuer, request, destination, bearer recipient, audience and time limits while refusing duplicate-ID wrapping.
server/src/auth.ts81Studio sign-in: the first visit creates the administrator, sessions are signed cookies, and changing requests need the X-Sutra header (a cross-site form cannot send it).
server/src/gateway/gateway.ts480The gateway façade and route dispatcher: HTTP and HTTPS listener lifecycle, deployed route tables, REST/SOAP service dispatch, policy checks, run start with the caller's traceparent, and waiting for replies. Protocol-specific MCP and OAuth handling is delegated.
server/src/gateway/rest.ts47REST body decoding and response serialization, kept apart from listener and routing lifecycle.
server/src/gateway/soap.ts69SOAP envelopes, faults, XML rendering and WSDL generation, kept apart from listener and routing lifecycle.
server/src/gateway/mcp-handler.ts138Streamable HTTP MCP endpoint handling: protocol negotiation, sessions, JSON-RPC validation, tool discovery and calls; starts runs through the gateway callback without owning listener lifecycle.
server/src/gateway/oauth-handler.ts41The OAuth 2.0 client-credentials token endpoint: form decoding, client authentication, scope checks and token response.
server/src/gateway/agents.ts351Published agents on the gateway: chat page, chat API, jobs and the chat button script; OpenAI-compatible models and chat completions (plain and streamed); the ask_ MCP tool; A2A agent card, message/send and tasks/get. Answers within the agent time, else a job id.
server/src/gateway/dashboards.ts237Dashboards on the gateway (2.1.5): the page /dash/ with Apache ECharts served by SutraFlow, its data behind the dashboard policy with results cached for the refresh time and shared by viewers (or per caller) and one run at a time per key, the embed script that passes a website login, and PNG and SVG export in the page.
server/src/gateway/apps.ts433Gateway management: apps with scopes and plans, API keys (stored as hashes), OAuth2 client credentials tokens, cluster-wide plan limits, the firewall, trusted proxies (2.1.4: the only senders whose X-Forwarded-For and X-Forwarded-Proto are believed, by the gateway and the studio), request log, traffic statistics and OpenAPI. Authentication, quotas, firewall reads and request logging use the asynchronous pool on the request path; admin screens retain the compatibility layer.
server/src/gateway/websocket.ts276WebSocket services on the gateway: upgrades through the firewall and the API security policy (token or key in the query for browsers, CORS origins), a run per message in order per connection, size and schema checks, pings, and an outbox table so a step on any engine reaches a connection held by another. 2.1.4: a connection is registered before the client sees it open; messages older than 30 seconds are dropped, an engine clears its outbox at start, and the leader removes the connections and messages of a dead engine (cluster.ts).
server/src/gateway/tls.ts228Gateway certificates: off, self-signed, uploaded, or Let's Encrypt (ACME HTTP-01) with renewal 30 days before expiry, and client CA for mutual TLS.
server/src/mcp.ts94Model Context Protocol over Streamable HTTP: tools/list from deployed MCP skill triggers, tools/call starts the Sutra and returns what Reply to AI sends. JSON Schema from shared schemas or simple input rows.
server/src/scheduler.ts63Timer triggers (cron or interval) of deployed Sutras, on the leader.
server/src/listeners.ts249Long-running process starters on the elected leader: folder watchers, mailbox polling, queue and topic subscriptions, Drive and chat polling. Rebuilt one after another when deployments, properties or connections change; General settings are resolved before a listener starts. Each poll runs under withConnection(): a lease on the limited connections the trigger selects, skipped with a status when there is no room; subscriptions hold no permit.

Files: Security

Inbound checks, outbound authentication and protection of slow services.

FileLinesWhat it does
server/src/security/inbound.ts292API policies on gateway services: none, API key, Basic, JWT, mutual TLS, WS-Security UsernameToken; refusals become HTTP errors or SOAP faults.
server/src/security/outbound.ts271Outbound security profiles for HTTP and SOAP calls: Basic, bearer, API key, OAuth client credentials, client certificates and TLS options.
server/src/security/hmac.ts126HMAC request signing for incoming and outgoing requests (timestamp and body, or method, path, timestamp and body, or the body only; several secrets while one is replaced; replays refused through a table every engine shares) and OAuth 2.0 token introspection with answers kept until the token expires.
server/src/security/validate.ts262Checks on what callers send to REST and SOAP services before a run starts: threat protection from the API security policy (nesting depth on the raw text, fields, list items, text length, body size, no DOCTYPE) and validation against the service schema (JSON Schema with ajv; XSD elements and JSON samples as schema trees).
server/src/security/wssin.ts335WS-Security on the raw SOAP XML: incoming X.509 signatures (certificate trusted, Body and Timestamp signed, one Body only), signed SAML assertions (issuer, audience, validity), timestamps, and XML decryption (AES-GCM or AES-CBC, keys by RSA-OAEP; RSA 1.5 refused). The verified caller certificate may become the recipient of an encrypted service reply.
server/src/security/wss.ts207WS-Security headers for SOAP calls: UsernameToken, timestamps, X.509 signatures, SAML assertions and body encryption; UsernameToken checks on incoming requests. The X.509 signature is placed in wsse:Security by xml-crypto while signing (no deprecated calls).
server/src/security/breaker.ts56Circuit breaker per HTTP connection: after a number of failures in a row, calls fail at once for a while, then one trial call decides.

Files: Observability

What operations teams watch.

FileLinesWhat it does
server/src/metrics.ts80Prometheus counters, histograms and gauges per engine, served at /metrics (optionally behind SUTRA_METRICS_TOKEN).
server/src/tracing.ts85OpenTelemetry traces over OTLP/HTTP JSON: one trace per run with a span per step; ids come from run and step ids, so steps on different engines join one trace.
server/src/logger.ts156Per-project log files with level, format and rotation, personal data masked when the project asks for it, and JSON lines on standard output when SUTRA_LOG_FORMAT=json.

Files: Palettes (activities)

Each file defines activities: fields shown in the studio, ports, an output hint for mapping, and an execute function.

FileLinesWhat it does
server/src/palettes/index.ts77Palette order (with Azure Data Factory & Databricks, Apps and social, Scripts with Python) and the list of all activities registered with the engine; AI steps get a 10-minute time limit.
server/src/palettes/common.ts80Field builders (F, when) and write options shared by file-like activities.
server/src/palettes/core.ts561Triggers (Start, Timer, REST service, SOAP service), flow control (If, Switch, Router, For each, Merge, Wait, Approval, Set variable, Throw, End with stop options), data (Mapper, JSON, XML, CSV, filter, sort, aggregate, validate) and Log.
server/src/palettes/process.ts183Call Sutra and Return, Error handler, No operation, channels (send and trigger) and Counter.
server/src/palettes/transform.ts66JSONata transform.
server/src/palettes/http.ts150HTTP request (with connection, security profile and circuit breaker) and HTTP response.
server/src/palettes/soap.ts197SOAP call from a WSDL (operation picker) and SOAP reply.
server/src/palettes/file.ts240File trigger, read, list, write and move, confined to the configured folder. Write and Move always return file details. Read and List can stream big CSV and line files in batches on a batch port.
server/src/palettes/fileformat.ts348Encodings and formats for file content: text, base64, CSV, lines, JSON, XML, with schema-typed columns. A CSV parser that takes text in pieces, and the streaming reader that hands rows over in batches with back pressure.
server/src/palettes/code.ts173JavaScript code in a sandboxed worker (no host objects, time and memory limits) and HTML templates.
server/src/palettes/scripts.ts278PowerShell, shell scripts, Python (code or a .py file, arguments, parameters, virtual environment, printed JSON as result, design checks for Python, syntax, files and packages) and programs, with output and errors captured; values arrive as environment variables and JSON files, never inside the script text. Off until allowed.
server/src/palettes/release.ts185Build package, Check package, Deploy package and Roll back, on this server or a remote engine. Off until allowed.
server/src/palettes/ai.ts269AI prompt, classify, router, extract, summarize, translate, sentiment and the Ollama activity (all endpoints). JSON answers are read leniently with one stricter retry.
server/src/palettes/mcp.ts73AI tool trigger (describes the tool for agents and MCP clients) and Reply to AI.
server/src/palettes/agent.ts387AI agent palette: AI agent, Ask a person, Hand off to agent, Load / Save / Clear memory, Read document text, Add to knowledge (skip unchanged), Search / Ask knowledge, Remove knowledge (a source, keep only listed sources, everything, rebuild vectors), AI embed, Call MCP tool, Agent channel, Agent reply, AI guard.
server/src/palettes/dashboard.ts445Dashboards palette (2.1.5): Dashboard page (the trigger of a dashboard on the gateway, with its policy, refresh time and cache scope), Chart (rows to a plain-JSON Apache ECharts chart: bar, line, area, pie, donut, scatter, number, gauge, table) with the allow-list check for chart settings suggested by a step such as an AI prompt, and Dashboard reply.

Files: Connectors

Activities for outside systems and their connection kinds.

FileLinesWhat it does
server/src/connectors/kinds.ts156Connection kinds for email, databases, service bus, Firebase, SFTP and FTP, and OAuth apps (with the scopes each service needs and an optional refresh token secret).
server/src/connectors/remote.ts403SFTP / FTP palette: Remote file trigger, list, read, write and move / copy / delete over SFTP (ssh2-sftp-client, host key fingerprint check) or FTP / FTPS (basic-ftp). Every activity selects a shared connector; host, port, user, base folder, limits and secret names resolve Project variables and deployment overrides at runtime. Paths are fenced into the base folder; connections have time limits, retry policy and SFTP keep-alive.
server/src/connectors/db.ts501DB Ops for PostgreSQL, MySQL, SQL Server, Oracle and SQLite: query, update, stored procedure, SQL script and transaction, with :name parameters always bound (no SQL injection), and connection pools. inlineRunData writes Project and Engine properties into SQL text and turns every other {{...}} reference (run input, trigger data, earlier outputs) into a bound parameter, quoted literals as one text value; Databricks SQL uses it too. The shared named-parameter parser also performs design and deployment checks: every placeholder needs one case-sensitive Parameters row; missing, mismatched, duplicate and unnamed rows are errors, while an unused row is a warning. Quotes, comments and PostgreSQL :: casts are excluded by the same parser used at runtime. Designer previews accept read-only SELECT / WITH SQL, reject data-changing CTEs, and apply the database or Databricks ten-row limit; normal run SQL is never rewritten with that preview limit.
server/src/connectors/bus.ts716Service Bus for Kafka, RabbitMQ and AMQP 1.0 brokers: strict TLS with system or private CA trust, SASL where applicable, optional mutual TLS with vault-held private keys, publish, the Queue / topic trigger and explicit confirmation. Client acknowledgement waits for run success; the explicit handle is registered under the reserved run id before execution, so even a one-step Confirm is safe. A durable Kafka-offset or AMQP-message-id guard binds redelivery to its reserved run across leader changes; a copy delivered while the prior run is active or waiting is held unacknowledged (one extra prefetch or credit slot) and settled when that run ends, while Kafka pauses the partition. Kafka listeners report ready only after group join and the first completed fetch/offset round trip. ActiveMQ connections use unique role-suffixed container ids and normalize JMS destinations; RabbitMQ in-place requeues are counted even though the broker does not add x-death.
server/src/connectors/message-body.ts86Shared JSON, XML, text, map and binary codecs for native broker publishers and receivers. XML retains exact text and rejects malformed markup and DTD/entities. Receive decoding captures a bodyError for the normal engine failure/acknowledgement policy instead of throwing outside the broker callback.
server/src/connectors/email.ts181Send email (SMTP) and the mailbox trigger (IMAP).
server/src/connectors/firebase.ts214Firestore, Realtime Database and Cloud Messaging with a service account.
server/src/connectors/oauth.ts171OAuth 2.0 connections (Google, Microsoft, Dropbox, Facebook, Twitch, custom): authorization-code sign-in, tokens encrypted and refreshed, a refresh token secret for servers without the studio (set by a pipeline), Twitch client id on every call, and streamed requests for large uploads and downloads.
server/src/connectors/microsoft.ts182SharePoint document libraries and OneDrive through Microsoft Graph: list, read (as document text), search, upload, and a polling trigger for added, changed and removed files.
server/src/connectors/saas.ts579Google Sheets; Google Drive and Docs (list, upload, download or export, saving large files straight to a server file) and the Drive trigger; Dropbox; YouTube (videos, playlists, comments, channel and video statistics, Analytics reports, resumable streamed upload from a server file, update, thumbnail); Facebook Pages; Twitch (users, live status, channel, followers, videos, clips, schedule, update channel, clip, chat) and the Twitch live trigger; any REST API of a connected account.

Files: AI engines

One AI provider connection, many engines.

FileLinesWhat it does
server/src/ai/engines.ts23The list of AI engines. Has no imports so any module can load it first.
server/src/ai/agent.ts339The AI agent loop: one JSON step per model call (tool, answer or ask), tool Sutras run as called Sutras with the step resumed afterwards, progress saved per step in ai_agent_state, limits, small-model tolerance and a last plain answer at the step limit.
server/src/ai/memory.ts274AI memory stores (built-in, a database table, a folder): turns with token estimates, fitting the context window, the running summary, encryption, retention, and the first-in-first-out queue per session.
server/src/ai/policy.ts47AI request deadlines (2.1.3): the 120-second default, a connection's timeout or a step's own override, shared by chat, vector and CLI calls; an outer cancellation always wins, and the current step's log callback travels in an async context that never carries credentials.
server/src/ai/knowledge-access.ts117Knowledge admin access (2.1.5): what running work may do with a knowledge base: its home project and work outside a project fully; a granted project searches its areas (or everything when every project may search) and changes only the areas granted for changes; a Sutra exported from a managed source changes only its area; whole-base actions (remove everything, rebuild, build the search index) only at home; the own connections of the base are reached as the home project.
server/src/ai/knowledge-admin.ts642Knowledge admin (2.1.5): server knowledge bases (kb_admin), grants by project and area (kb_grants), managed sources (kb_sources) reading a server folder, SFTP/FTP, SharePoint/OneDrive, Google Drive, web pages, a database query or an HTTP API; one writer per area; sync on the leader every 15 seconds for due or asked sources: fingerprints per item (kb_source_items) so only new and changed items get vectors, removed items leave, an empty listing removes nothing, runs recorded (kb_sync_runs) and interrupted runs marked; the MCP search tool per knowledge base behind the policy of the MCP server; export of a database, folder or web source as a Sutra of ordinary steps.
server/src/ai/knowledge.ts593Knowledge bases: chunking, vectors from a model or built-in word vectors, stores (built-in, folder, pgvector, Qdrant, Chroma, Pinecone), search by meaning and shared words with folder and detail filters, add (skipping unchanged text by a content hash; a new source in slices of 500 passages, pgvector rows 100 to a statement, 2.1.4), replace, remove, keep only listed sources, list sources, rebuild.
server/src/ai/documents.ts154Document text: a small zip reader for Word, PowerPoint, Excel and OpenDocument, PDF through unpdf, and HTML to text.
server/src/ai/mcpClient.ts152MCP client over streamable HTTP (JSON or event-stream answers, session header) or a command on standard input and output: list and call tools.
server/src/ai/guard.ts251AI guard rules: personal data patterns (with a card number checksum), hidden instruction phrases, blocked topics, length and JSON shape, moderation categories with thresholds, language detection and translation, the answer cache per Sutra and person, and an optional model check.
server/src/ai/personal-data.ts64Finds and hides or masks personal data (e-mail, phone and card numbers, IBAN, Aadhaar, PAN, SSN and similar) for the AI guard and for project logs and run history.
server/src/ai/providers.ts459Calls to the Claude, Gemini and OpenAI APIs, OpenAI-compatible servers (LM Studio, Hugging Face, local TGI), Ollama, and the Claude, Gemini and Codex command-line tools. Model lists, Ollama pull and import (gguf, Modelfile, safetensors, Ollama folder). Every call returns provider, engine, model, tokens and time.

Files: Studio (web/src)

The browser application: React with React Flow, built by Vite into dist/web and served by the admin API.

FileLinesWhat it does
web/index.html33Page shell for the studio.
web/vite.config.ts37Vite build of three pages (designer, Admin Console and Approval Center) and the development proxy to the admin API.
web/src/main.tsx29Mounts the React application.
web/src/App.tsx92Top bar, sign-in, the switch between Designer, Runs, Resources and Server, and the name button that opens My profile.
web/src/Profile.tsx152My profile, in the designer and the Admin Console: account and roles per project, change password, and the person's own API tokens (create with 30, 60 or 90 days, shown once, renew, revoke).
web/src/NewProject.tsx229New project: empty, with chosen samples, from chosen Sutras of a release zip or package file (with its files), from a sample project, or a copy of chosen Sutras of a project; the searchable pick list also used for samples in New Sutra.
web/src/Auth.tsx89Sign-in (password or single sign-on), first administrator and password change, shared by the designer, the Admin Console and the Approval Center.
web/src/api.ts42Thin client for the admin API; changing calls carry the X-Sutra header.
web/src/types.ts184Studio-side types of Sutras, activities, fields and runs.
web/src/ui.tsx130Toasts and the catalog (current project, its connections and schemas, secret names).
web/src/ConfirmDelete.tsx73The delete dialog of the designer: what goes, what still uses it, and Delete enabled only once delete is typed.
web/src/Designer.tsx698The canvas: palette, drag and drop, connections with labels, step descriptions as tooltips (marked on the step), undo and redo, Delete-key handling, test and debug runs, sample picker.
web/src/local-variables.ts51The designer's view of run-local variables (2.1.3): the shape of plain and record-ID variables for the General editors and the data trees, worked out from the Sutra without running formulas, and the name/value pairs of one Get Local Variables step's own result, never a later run's.
web/src/Inspector.tsx482Right panel for a step or a connection: General (with the step description), Input, Output and Settings tabs, loop settings, connection name and condition; the Sutra's General tab with its documentation (HTML and Markdown) and the count of steps without a description.
web/src/Fields.tsx416Field editors (text, select, secret, resource, schema, Sutra picker) that accept drops from the data tree.
web/src/Mapper.tsx772Input mapping: Process Data on the left, Activity Input on the right with lines between them, the formula editor with function browser, preview, For-Each, If and Choose.
web/src/MappingTools.tsx135Input-tab schema selection/create/edit, typed manual-field options, explicit delete confirmation and bounded whole-result preview. Shared schema edits list affected Sutras.
web/src/sample-import.ts26Sample-import completion barrier: refresh flows and the shared project catalog before selecting a created flow, so new schemas/resources/properties are immediately available.
web/src/XmlOutput.tsx56Bounded, read-only XML output/preview tree: nested elements, attributes, text and repeated siblings.
web/src/mapping-fields.ts68Immutable add, rename and subtree deletion operations preserving formulas, typed definitions and repeating-path markers. Designer history owns undo/redo.
web/src/mapping-sources.ts72Names source activities with their palette types, distinguishes current-input candidates from named outputs and labels other branches without implying synchronization. Excludes downstream outputs.
web/src/line-colours.ts134Line colours on the canvas (2.1.7): a palette of 8 named colours with light and dark values, automatic colours where two or more lines go into one step (by source step, distinct at each meeting step, stable when steps move), colours chosen by hand (edge.color), error lines that stay red, and the canvas highlighting of a step's lines and its path.
web/src/tidy.ts96Tidy (2.1.7): lays a Sutra out left to right in columns by the longest path from its trigger (loops ignored), orders each column by the positions of the steps before it so lines cross less, and stacks steps by their real heights. Changes positions only; the designer keeps it as one undo step.
web/src/ref-origin.ts79Where a reference in a field comes from (2.1.7): {{trigger.params.region}} reads as "trigger data → Sales on MySQL (Dashboard page) → params → region", {{nodes.X.y}} names the step and says when it is not on this step's path, properties, variables and run details are named, and SQL fields say that run data is sent as a bound parameter.
web/src/mapping-values.ts34Infers observed runtime fields independently of design contracts and summarizes repeated scalar values without hiding all but the first item. Shared activity-output rendering uses emitted data.
web/src/SchemaImpact.tsx59Shared read-only schema impact report in both schema editors. Discards stale asynchronous results when the proposed definition changes; lists activity names/types and deployed-use cautions.
web/src/test-session.ts26Confirms engine cancellation before discarding test preview state. Failed or unconfirmed stop requests retain controls; terminal completion races and repeated cancellation are safe.
web/src/mapping-tools.css27Layout for Input-tab schemas, typed target controls and preview.
web/src/DataTree.tsx68The data tree on the mapper's source side, from the last run or from output shapes.
web/src/Project.tsx871Project panel: Sutras, Resources with the + menu and Test connection, schemas and service descriptors, each as a folder tree (drag and drop; the ⋯ menu or a right-click renames, moves and deletes items and folders), variables with the missing-variable warning, AI models, project log, releases (release zip or package download, deploying zips with their config and files, documentation, history).
web/src/Git.tsx375The Git tab: initialize or clone, accounts, changes by item with diffs (steps added, removed, changed), commit, push, pull, sync, branches, conflicts, graph, trust.
web/src/vars.ts50Which project variables a step or connection reads that the project does not define (the same rule as the server).
web/src/variable-drafts.ts30Prepares project-variable saves by flushing pending encrypted Secret drafts first; only opaque references enter project settings. Stable editor keys are stripped, and failed storage aborts persistence.
web/src/Resources.tsx123Shared resources and the secret vault.
web/src/Runs.tsx152Run history with steps, input and output, approvals, cancel and resubmit, and the engine that ran each run.
web/src/Server.tsx66Read-only Services page for workflow authors: published REST, SOAP and MCP addresses, listener health and current run counts.
web/src/templates.ts88Starter Sutras offered by "New Sutra".
web/src/styles.css468Studio styles.
web/src/env.d.ts18Vite type declarations.

Files: Admin Console (web/admin)

The second page of the web build, served at /admin on every server, headless engines included. It manages what is deployed; design stays in the designer.

FileLinesWhat it does
web/admin.html33Page shell of the Admin Console.
web/admin/main.tsx29Mounts the console and applies the saved theme.
web/admin/Console.tsx188Sign-in (or, on a headless engine without users, how to add the first administrator), password change, permission-based navigation, and the pages under Operate, Alerts, Gateway, Access, Records and Server.
web/admin/Server.tsx303Server-only controls: Engine properties, script permission and Python interpreter, release-activity permission, gateway listeners, TLS certificates, ACME and mutual TLS. Kept out of the Designer so operational changes require the Server permission.
web/admin/shared.tsx120What the signed-in account may do, loading and refresh helpers, state labels, in-page confirmation, password generator.
web/admin/Overview.tsx140Tiles for engines, deployed Sutras, runs of the last day, approvals, work queue and gateway; recent failures with Resubmit.
web/admin/Apps.tsx270Deployed projects and Sutras: start and stop, runs with step results, resubmit and cancel, deploy an earlier version, package history and roll back. Also the side panel used by other pages.
web/admin/log.tsx167Every console action goes through act(): recorded with its output for the Console panel, and turned into the same action as a sutra command and an HTTP call for Windows PowerShell and Linux shells. Passwords and new tokens never appear.
web/admin/Tuning.tsx144Tuning forms for a Sutra and for the engines, with the defaults shown and the change confirmed with its command.
web/admin/Gateway.tsx486Gateway pages: Traffic (chart, percentiles, busiest and slowest services, apps, request log), Apps and keys, Plans, Firewall, APIs with OpenAPI and gateway options.
web/admin/Alerts.tsx266Alerts pages: open alerts and history with acknowledge and resolve, alert rules with Check now, channels with Send a test.
web/admin/Chart.tsx42Stacked bar chart over time with ECharts, coloured from the theme (Overview runs and gateway traffic).
web/admin/EChart.tsx91Apache ECharts for the Admin Console, shipped with SutraFlow (no CDN, works offline) and loaded the first time a page shows a chart: theme colours read from the CSS tokens and redrawn when the theme changes, resize following the page, and the shared axis/tooltip/legend style.
web/admin/echarts-setup.ts29The ECharts parts the Admin Console uses (bar and line charts, grid, legend, tooltip, mark line, zoom, SVG renderer), registered once; a file of its own in the build, loaded on demand by EChart.tsx.
web/admin/Trace.tsx216Admin Console, Traceability: projects and their Sutras by run outcome, run search by id, starter or input value, and a run with its ids, who started it, its input, every step input and output, reply, log and linked runs; download as JSON.
web/admin/Knowledge.tsx81Admin Console, Knowledge search: knowledge bases kept in PostgreSQL (pgvector) with their search index, and Build search index for a table that already holds passages.
web/admin/KnowledgeAdmin.tsx262Admin Console, Knowledge admin (2.1.5): every knowledge base with its home project; make it a server knowledge base, who may search it (every project or granted projects), grants by project and area with search or change, managed sources (folder, SFTP/FTP, SharePoint/OneDrive, Google Drive, web pages, database query, HTTP API, Sutras of a project) with their schedule, Sync now, Re-index, sync history, Export as Sutra and removal with their passages, the MCP search tool, and Rebuild vectors.
web/admin/Conversations.tsx71Admin Console, Agent conversations (2.1.5): the conversations of every published agent, active and expired, with their messages; administrators clear expired conversations with their AI memory, with the same action as a sutra command.
web/admin/Connections.tsx114Admin Console, Connection limits: every limited connection with its limit (and the Project property it comes from), use by steps and by listener or background leases, waiting steps and their reasons, and a graph of use, waiting and limit over 1 hour to 7 days.
web/admin/Approvals.tsx52What waits for a person and for whom (roles, accounts, progress, due time), with a button to open the Approval Center.
web/admin/Engines.tsx138Engines of the cluster: alive, leader, load, heartbeat; drain and stop one; delete old runs now.
web/admin/Sso.tsx106Single sign-on settings: the identity provider, client, claims, groups to roles, creating and linking accounts; shows the redirect address to register.
web/admin/People.tsx271Users and system accounts: add, roles per project, disable, unlock, passwords, sign out everywhere, delete; API tokens shown once; a person's own tokens listed with Revoke, and the server switch for personal tokens.
web/admin/Roles.tsx90Permission matrix of all roles; custom roles.
web/admin/Database.tsx187Database page: the database in use, the PostgreSQL connection with Test connection, Migrate now, and the progress through the restart.
web/admin/Memory.tsx231Memory tables: source/query and interval/cron configuration, cluster and per-project row/MB quotas, usage, next refresh, every table and its records with approximate size, hot reload, clear, and cached values changed by hand.
web/admin/Releases.tsx182Releases: upload a release zip, see its check (Sutras, secrets, source, config) and its plan (2.1.6), deploy it (replacing needs the project name typed; the plan id is sent as the approval); the package history of each project with rollback.
web/src/DeployPlan.tsx76The deployment plan shown before a release changes anything (2.1.6), in the Admin Console and the designer: Sutras new, unchanged, deployed again or replacing, those undeployed, changed schemas, what is created, the checklist and the plan id; PlanApproval asks for the project name when something is replaced or undeployed.
web/admin/Audit.tsx186Audit log with filters, plain-word actions, details and CSV export.
web/admin/console.css224Console layout on the studio colour tokens, light and dark, one column on phones.

Files: Approval Center (web/approvals)

The third page of the web build, served at /approvals on every server, headless engines included: the approvals and questions of running Sutras for business people, nothing else. It signs in like the other pages (password or single sign-on), uses the approvals API (/api/approvals, decided per item by approvals.ts), and is laid out for phones first.

FileLinesWhat it does
web/approvals.html33The Approval Center page shell.
web/approvals/Center.tsx143The Approval Center page (/approvals) for business people: sign-in, Waiting for me, All waiting, Decided; details, votes, due time, approve or reject with a comment, answers to questions; works on a phone.
web/approvals/center.css59Styles of the Approval Center: one column, readable on a phone, light and dark.
web/approvals/main.tsx29Entry of the Approval Center page.

Files: Documentation tools

Pages built from the code, so they stay accurate.

FileLinesWhat it does
tools/migrate-to-postgres.mjs142The SQLite to PostgreSQL move for Windows (.cmd) and Linux (.sh): stops SutraFlow with the launcher, copies and counts every table (sutra db migrate), switches sutraflow.env, starts SutraFlow, checks it, and puts SQLite back on any failure.
tools/migrate-to-postgres.cmd27Windows wrapper of migrate-to-postgres.mjs: finds Node.js from sutraflow.env and passes the settings file.
tools/migrate-to-postgres.sh27Linux and macOS wrapper of migrate-to-postgres.mjs: finds Node.js from sutraflow.env and passes the settings file.
tools/add-headers.mjs105Puts the copyright and licence header (developer, website, years, file version, AGPL-3.0-only) on every source file that lacks it; with --check, lists files without it (a test runs this). Each file keeps its own version.
tools/build-release.mjs209Builds the release archives: sutraflow--windows.zip and -linux.tar.gz (launcher and shell scripts executable) with SHA-256 files, holding the built server, launcher, docs, samples, deployment templates, runtime tools and licences; with --offline also an archive with the runtime packages for the system it runs on.
tools/copy-web-vendor.mjs33Run by npm run build after Vite (2.1.5): copies Apache ECharts (its built file, licence and notice) into dist/web/vendor/echarts, so dashboards on the gateway use ECharts from SutraFlow itself, never a CDN.
.github/workflows/release.yml197GitHub release workflow: on a v* tag, tests, builds the archives on Windows and Linux (with offline archives), and attaches them with RELEASE-NOTES.md to a GitHub Release.
tools/runtime-check.mjs153Runtime check of a release archive (2.1.1): unpack, setup, silent install with a Node memory, start, health, a Sutra run, sign in, a memory change applied by Restart, and an upgrade of a running previous release with its data. Run by CI on Linux; runs the same on Windows.
tools/soak.mjs1568Soak test: hours of mixed load on a cluster (every starter that runs on one machine, files and documents of 10 to 60 MB, AI on a local Ollama), an engine killed and a database cut on the way, unattended with retries; writes samples, events and a Markdown and HTML report. Since 2.1.1 the one soak for everything: --scenarios picks the parts (core, files, ai, faults, the Amaron shop, local brokers, Kafka, MongoDB, remote databases, the regression suite on the same servers), --connections reads the services from a notes file, and every row and message carries the run id.
tools/soak/amaron.mjs248The soak test shop Amaron (2.1.1): a kept PostgreSQL database of customers, products, warehouses and stock, orders, shipments, order events, care tickets and AI decisions, seeded once with made-up data that looks real; every row carries the soak run id, and soak_runs records each run with its result.
tools/soak/connections.mjs137Reads the soak test connections (remote PostgreSQL and MySQL, Kafka, MongoDB, local RabbitMQ and ActiveMQ) from a notes file kept outside the repository, by its section headings; prints only a masked summary.
tools/soak/local-brokers.mjs89Starts local RabbitMQ and ActiveMQ from their folders for the soak test when they are not running, and stops only the ones it started.
tools/soak/RUNBOOK.md47How to run the soak test (2.1.1): what to prepare, the commands for a short trial and for the 8- and 24-hour runs, the connections file, and how to read and keep the report.
tools/loadtest.mjs391Load test: starts a studio and engines on their own temporary database, runs a benchmark Sutra (durable or in memory, small or big outputs), and reports steps and runs per second, queue wait and step time percentiles, database lock waits and transactions, CPU and memory; can kill an engine to check recovery, limit cores and memory, or soak. Results in docs/benchmarks.
tools/bigfiletest.mjs111Big file test: one engine with a small memory limit streams a generated CSV file of any size through a Sutra (Read file, Stream in batches) and reports the time and the peak memory of the process.
tools/build-sample-projects.ts81Builds the sample project zips in samples/ (npm run samples): whole projects as release zips with their files, listed in samples/index.json for New project.
tools/build-user-guide.ts387Builds docs/sutraflow-user-guide.html, docs/sutraflow-admin-guide.html, docs/sutraflow-design-guide.html (2.1.4) and docs/Sutra-Contributor Information.html (npm run guide), from the same page layout: chapters in parts, every activity with its settings table, connection types, functions, pipes and samples, read from the server code. A link to a chapter of the other guide opens that guide there; a link to a chapter no guide has fails the build.
tools/guide/admin.ts1137Chapters written for the SutraFlow Administration Guide (2.1.2): what administrators do, planning a server, the web installer page by page, silent installation, how upgrades work, development machines, the launcher and server settings, receiving releases, monitoring and troubleshooting.
tools/guide/api-reference.ts165The Admin API part of the Administration Guide (2.1.6), made from the server tables: addresses, signing in, the X-Sutra header, permissions, status codes, examples, the sutra command beside each endpoint, then every endpoint by area with what it does, who may call it, and whether headless engines serve it.
tools/guide/design.ts621Chapters of the Sutra Design Guide (2.1.4): design standards for designers and reviewers: principles, naming and project structure, functions and transformations, called Sutras, contracts and configuration, REST, SOAP and API security, integration patterns, messaging, files, databases, errors, logging, microservices, resilience, testing, releases and a review checklist.
tools/guide/design-samples.ts435Chapters of the Sutra Design Guide about solutions and samples (2.1.4): packaging with properties, connections and secrets; blueprints for a microservices platform, an API for mobile apps, integration through a broker and notifications; error handling through logs with traceability from project to Sutra to run; and every sample explained with what to change before production.
tools/guide/headless.mjs91A headless Edge or Chrome for the guide screenshots, driven through the DevTools protocol with its own temporary profile: navigate, run code in the page, save screenshots to docs/guide-images.
tools/capture-admin-shots.mjs255Takes the Administration Guide screenshots on a throwaway installation from the offline release: the web installer page by page, the Admin Console of a seeded server, and with SUTRA_SHOTS_UPGRADE a real upgrade of a named installation through the upgrade pages; then removes what it made.
tools/guide/tables.ts141The tables of SutraFlow itself, for the guide and this page: what each holds, groups, what is encrypted or grows, and the columns read from db.ts (the schema and the columns later versions add).
tools/guide/chapters.ts2771Guide chapters and their order: PARTS places the user guide chapters (designers, approvers, and later developers using the developer portal: concepts, mapping, palettes and activities, releases) and ADMIN_PARTS the Administration Guide chapters (installing, running, engines, the Admin Console, security); every chapter is in exactly one part of one guide.
tools/guide/contributor.ts148Chapters of Sutra-Contributor Information, for people who change SutraFlow itself: building from source, where the code is, file headers and overviews, tests and their real-service variables, security rules, vendored packages, release builds, and the load, soak and big-file test tools.
tools/guide/activities.ts1097Advice text for every activity in the user guide.
tools/guide/benchmarks.ts81Guide tables made from measurements: the machine profiles of sizing.ts and the load test results in docs/benchmarks.
tools/guide/logo.ts20The SutraFlow mark used by both pages.
tools/capture-guide-shots.mjs307Takes the user guide screenshots with headless Edge while the server runs (npm run guide:shots).
tools/check-vendor.mjs114Vendor dependency gate: verifies the reviewed source-tree hashes, package and lockfile links, licences, consumers, focused tests and runtime packaging scope; in online mode it also fails when npm latest or tarball integrity differs.
tools/build-architecture.ts1183Builds this page (npm run architecture) and fails when a source file has no description.
tools/architecture/diagrams.ts257The diagrams on this page, as inline SVG.

Files: Build, containers and documents

Files outside the source folders.

FileLinesWhat it does
package.json119Dependencies and scripts: dev, build, start, test, guide, architecture, sutra. The sutra command is its bin.
server/tsconfig.json17TypeScript build of the server into dist/server.
web/tsconfig.json15TypeScript settings of the studio.
Dockerfile75Multi-stage image on node:24-bookworm-slim: builds studio and server, runs as the node user under tini, health check on /ready, headless by default with /data and /deploy volumes and JSON logs.
.dockerignore20Keeps data, node_modules and builds out of the image context.
.github/workflows/vendor.yml34Weekly and manual online check for newer upstream releases of maintained vendor dependencies.
vendor/vendor-lock.json50Reviewed vendor provenance: upstream npm version and integrity, patched local version and tree hash, patch reasons, consumers, focused tests and release scope.
vendor/README.md26The manual compatibility-review and update procedure for maintained vendor packages.
docker-compose.yml48One container: studio, engine and gateway.
deploy/docker/compose.yml53From the image (2.1.6): a studio and a headless engine, each with its own data; values from .env (image, version, admin token, master key); a deploy folder for .sutra packages; 45 seconds to drain.
deploy/docker/compose.cluster.yml78From the image (2.1.6): PostgreSQL with pgvector, a studio without workers and two engines sharing the database and master key; SUTRA_DB for a managed database.
deploy/kubernetes/base/engine.yaml95Kubernetes engines (2.1.6): a Deployment (readiness /ready, liveness /health, startup probe, 60 seconds to drain, non-root, engine name from the pod), its Service (gateway and admin ports) and a PodDisruptionBudget.
deploy/kubernetes/base/config.yaml30The ConfigMap every SutraFlow pod reads (2.1.6), and how to make the sutraflow Secret (admin token, master key, database address) by hand.
deploy/kubernetes/base/network.yaml32NetworkPolicy (2.1.6): gateway ports open; the admin API only from pods labelled sutraflow-admin and from other SutraFlow pods.
deploy/kubernetes/base/kustomization.yaml28The Kustomize base (2.1.6): config, engines, network policy, the image tag.
deploy/kubernetes/components/studio/kustomization.yaml22Optional Kustomize component (2.1.6): the studio in the cluster.
deploy/kubernetes/components/studio/studio.yaml63The studio Deployment and Service (2.1.6): shares the database, runs no steps (SUTRA_WORKERS=0).
deploy/kubernetes/overlays/test/kustomization.yaml44Test overlay (2.1.6): namespace sutraflow-test, one engine, the studio, SUTRA_ENVIRONMENT=test.
deploy/kubernetes/overlays/prod/kustomization.yaml40Production overlay (2.1.6): namespace sutraflow-prod, three engines, autoscaler, Ingress, optional pull secret.
deploy/kubernetes/overlays/prod/ingress.yaml34Ingress for the gateway (2.1.6): one host, TLS at the ingress; the admin API is not published.
deploy/kubernetes/overlays/prod/autoscaler.yaml29HorizontalPodAutoscaler for engines (2.1.6): 2 to 10 on CPU, slow scale-down.
deploy/kubernetes/jobs/config-and-deploy.yaml74The Job a pipeline runs after approval (2.1.6): downloads the release, sutra config apply (create what is missing) then sutra deploy --approve with the approved plan id, with a system account token and the environment secrets.
deploy/ci/github-actions.yml93GitHub Actions release pipeline template (2.1.6): build from Git, test, check (plan, checklist, plan id in the summary), production environment reviewers approve, config apply and deploy --approve.
deploy/ci/gitlab-ci.yml63GitLab CI release pipeline template (2.1.6): build, test, check (plan id as a dotenv artifact), a manual deploy job on a protected environment with --approve.
deploy/ci/azure-pipelines.yml90Azure DevOps release pipeline template (2.1.6): build, test, check (plan id as a stage output), environment approvals, config apply and deploy --approve.
docker-compose.cluster.yml78PostgreSQL, a studio without workers and two headless engines sharing the database.
bin/sutraflow.mjs500The sutraflow launcher, the one place for every command on Windows and Linux: setup, start and stop (studio or engine, background or foreground, graceful drain), restart, status, logs, open, cli (the sutra command with the local admin token), db, service (systemd unit or Windows task), and docker and docker cluster (compose, with the token and master key made once into .env). Used by tools/migrate-to-postgres to stop and start SutraFlow.
bin/sutraflow24Linux and macOS entry of the launcher; takes Node.js from SUTRA_NODE or sutraflow.env.
bin/sutraflow.cmd24Windows entry of the launcher; takes Node.js from SUTRA_NODE or sutraflow.env.
sutraflow.env.example61Launcher settings: data folder, ports of the studio and the engine, database, Node.js path; copied to sutraflow.env on first use.
deploy/laragon/sutraflow.env32Laragon settings for the launcher: ports 4810 and 4811, data in C:/laragon/data/sutraflow, PostgreSQL, Node.js path.
deploy/laragon/README.txt37Laragon: install steps and the launcher commands.
deploy/laragon/01-sutra.conf34Laragon Apache site: forwards http://sutra.test to the Node.js server.
deploy/laragon/.htaccess11Denies direct access to the SutraFlow folder under the Laragon www folder.
deploy/README.md11The deploy folder: drop .sutra packages here for engines that deploy them at start.
docs/architecture.md128Short text notes on the architecture (this page is the full version).
docs/sutraflow-user-guide.html3991The generated user guide, for designers, served at /guide.
docs/sutraflow-admin-guide.html2201The generated Administration Guide (2.1.2), for administrators, served at /admin-guide: installing, upgrading, running, engines and clusters, the Admin Console, security, releases on servers.
README.md306Project introduction and quick start.
RELEASE-NOTES.md892Release notes of the current version: what is new, requirements, install steps for Windows and Linux, upgrade steps, known limitations. The release archives require it.

Files: Tests (test/)

Node's test runner with tsx. npm test compiles the server first, then runs every suite; the PostgreSQL suite runs the in-process suites again on PGlite with shifted ports.

FileLinesWhat it does
test/helpers.ts85Test environment per suite: temporary data folder, ports (with SUTRA_TEST_PORT_OFFSET), node and edge builders, a capture server.
test/pem-fixtures.ts29Broker-test PEM input adapter supporting process-only certificate/key values and existing file-path fixtures without logging material. This is test infrastructure, not a production credential store.
test/tsconfig.json16TypeScript settings for the tests (strict), so npm run typecheck checks them with the server and studio.
test/proc.ts51Starts real server processes for multi-process tests and waits for their endpoints.
test/mcpstdio.mjs34A small MCP server on standard input and output (one tool, add), for the MCP client tests.
test/sftpserver.ts93A small SFTP server over a local folder (ssh2), with password and key sign-in and an optional slow read, for the SFTP tests.
test/fixtures/ActiveMqOpenWireProbe.java60Test-only Java JMS client: sends and receives through ActiveMQ OpenWire so the real-broker matrix proves that SutraFlow AMQP 1.0 messages interoperate at the body, header and property level. It is source-file launched from the installed ActiveMQ client jars and is never packaged with SutraFlow.
test/fixtures/tls-tcp-proxy.mjs35Test-only mutual-TLS TCP endpoint: validates an OpenSSL-generated client certificate and forwards the unchanged protocol to a local RabbitMQ or ActiveMQ broker, proving private-CA and client-certificate connector paths without changing the installed brokers. It is never packaged.
test/fixtures/broker-tls-proxy.mjs52Repeatable local ActiveMQ/RabbitMQ mTLS matrix runner: generates short-lived test certificates, starts strict TLS transport proxies, executes both real broker suites and cleans up its generated fixtures. Native broker keystores are not changed or certified.
test/access.test.ts2139 tests.
test/activemq.test.ts38216 tests.
test/admin.test.ts862 tests.
test/agent.test.ts2437 tests.
test/agentchannel.test.ts39213 tests.
test/ai-policy.test.ts16011 tests.
test/aicli218.test.ts1516 tests.
test/alerts.test.ts2235 tests.
test/api-docs.test.ts674 tests.
test/approvals.test.ts1364 tests.
test/asyncdb.test.ts1124 tests.
test/asyncpg.test.ts1474 tests.
test/azure.test.ts2678 tests.
test/broker-rest.test.ts1744 tests.
test/certificates.test.ts1154 tests.
test/chat.test.ts2157 tests.
test/cluster.test.ts2328 tests.
test/config-files.test.ts2397 tests.
test/confine218.test.ts603 tests.
test/connections217.test.ts1998 tests.
test/connectors.test.ts47118 tests.
test/connlimits-pg.test.ts431 tests.
test/connlimits.test.ts43416 tests.
test/console.test.ts1226 tests.
test/contract217.test.ts1868 tests.
test/contracts210.test.ts1147 tests.
test/credentials210.test.ts1596 tests.
test/dashboards.test.ts2868 tests.
test/dbcopy.test.ts852 tests.
test/dbmigrate.test.ts2455 tests.
test/deletes.test.ts1215 tests.
test/docker.test.ts1278 tests.
test/docsample.test.ts1987 tests.
test/engine-memory.test.ts671 tests.
test/engine.test.ts20611 tests.
test/events218.test.ts1334 tests.
test/expr.test.ts1269 tests.
test/features.test.ts2748 tests.
test/file-overviews.test.ts271 tests.
test/fixes217.test.ts843 tests.
test/folders.test.ts33411 tests.
test/gateway.test.ts2499 tests.
test/gatewayapps.test.ts2338 tests.
test/git.test.ts2149 tests.
test/guard218.test.ts2414 tests.
test/headless.test.ts1655 tests.
test/hmac.test.ts1615 tests.
test/install.test.ts35915 tests.
test/kafka.test.ts24410 tests.
test/knowledge-admin.test.ts2097 tests.
test/leader.test.ts742 tests.
test/logs.test.ts1555 tests.
test/mapping-fields.test.ts513 tests.
test/mapping-sources.test.ts714 tests.
test/mapping-values.test.ts423 tests.
test/mapping207.test.ts25713 tests.
test/mcp.test.ts991 tests.
test/mcpgen-remote.test.ts871 tests.
test/mcpgen218.test.ts2297 tests.
test/memory.test.ts1144 tests.
test/memtables.test.ts23412 tests.
test/message208.test.ts915 tests.
test/mongodb.test.ts23110 tests.
test/mysql.test.ts1053 tests.
test/observability.test.ts2096 tests.
test/packages.test.ts32411 tests.
test/palettes.test.ts1174 tests.
test/paths217.test.ts19812 tests.
test/payloads.test.ts842 tests.
test/pem-fixtures.test.ts423 tests.
test/performance.test.ts28014 tests.
test/pgoutage.test.ts1343 tests.
test/postgres.test.ts872 tests.
test/postgresdb.test.ts1283 tests.
test/process.test.ts1695 tests.
test/profile218.test.ts1665 tests.
test/project.test.ts29912 tests.
test/project218.test.ts1696 tests.
test/pyyoutube.test.ts24211 tests.
test/rabbitmq.test.ts28710 tests.
test/rag.test.ts2795 tests.
test/regression.test.ts41229 tests.
test/release.test.ts1494 tests.
test/release211.test.ts1486 tests.
test/releases.test.ts2629 tests.
test/remote.test.ts2176 tests.
test/remotedb.test.ts531 tests.
test/saml-sso.test.ts1183 tests.
test/sample-consistency.test.ts581 tests.
test/sample-data.test.ts2045 tests.
test/sample-import.test.ts482 tests.
test/samples213.test.ts2249 tests.
test/schema-contract-inventory.test.ts391 tests.
test/schema-impact.test.ts944 tests.
test/scripts.test.ts1386 tests.
test/secrets218.test.ts21510 tests.
test/security210.test.ts1676 tests.
test/sso.test.ts1774 tests.
test/stage217.test.ts1545 tests.
test/strict208.test.ts1366 tests.
test/sutras.test.ts38911 tests.
test/sweep218.test.ts1916 tests.
test/template.test.ts635 tests.
test/test-session.test.ts623 tests.
test/trace.test.ts772 tests.
test/tuning.test.ts1806 tests.
test/validation-samples.test.ts1855 tests.
test/validation.test.ts1463 tests.
test/variables.test.ts674 tests.
test/vendor.test.ts432 tests.
test/websocket.test.ts1985 tests.
test/wss.test.ts1806 tests.

Files: Admission and code maintenance

Durable connection admission and first-party code navigation.

FileLinesWhat it does
server/src/install/core.ts875The installer and upgrader steps (2.1.1), shared by the web installer and the silent install: system and port checks, the database test (PostgreSQL: reachable, created when allowed, rights, pgvector), sutraflow.env written keeping its comments, the master key (2.1.4: made before the tables, returned once with a new admin token for the last page, never logged), tables and the first administrator through install/task.ts, the install lock; an upgrade from 2.1.0 on with a read-only snapshot, graceful stop, backup (data folder, settings, pg_dump or a SQLite copy of the database), the old runtime moved aside, the new one copied in, new settings with their defaults, database changes, comparison and health check, and the way back on failure; settings files for further engines of a cluster.
server/src/install/task.ts119Installer database work in a child process with the target installation's settings: tables and the first administrator (with the built-in roles), a SQLite copy of the database, its restore, and the database changes of this version.
server/src/install/server.ts159The web installer (2.1.1): a page of several steps served on 127.0.0.1 only with a one-time token and a check of the Host header, its JSON API (state, ports, database test, install and upgrade jobs with progress, cluster files) over install/core.ts.
server/src/install/cli.ts110Silent install and upgrade from a JSON file (2.1.1): passwords only as environment variables or files, every problem reported before anything changes, a dry run that prints the plan, progress to the terminal and data/logs/installer.log.
server/src/connectors/tls-files.ts92Certificates and private keys of connections and security policies (2.1.1): one setting per item that may be a file on the server (Windows or Linux path, with variables), a Certificate or Private key property, or PEM text; read when the client is made, so renewing is replacing the file or changing the property.
server/src/ddl-once.ts48Tables a feature makes for itself (a pgvector knowledge table, an AI memory table), made once per engine with every concurrent step waiting for it, and retried when another engine makes the same table at the same moment (2.1.1; found by the 8-hour soak).
server/src/sqlite-file.ts32Where the SQLite database is: always in the data folder, sutra.db or the file name SUTRA_DB gives (2.1.1); shared by the server and the installer.
server/src/engine-memory.ts86Node memory per engine (2.1.1): heap used and limit, process and machine memory for the heartbeat; a changed Node memory written to the engine's own settings file (STUDIO_MEMORY_MB or ENGINE_MEMORY_MB) for the launcher; a restart asked for in the Admin Console done through sutraflow restart, for engines the launcher started in the background.
server/src/engine/payloads.ts134Large values stored once (2.1.1): a run's input parts over 256 KB kept once in the payloads table with a reference in run data; steps get whole copies through a size-bounded cache, values passed on are written back as their reference, callers always get whole answers.
server/src/security/visitor.ts73Visitor tokens (2.1.1; since 2.1.5 they expire after SUTRA_VISITOR_DAYS and renew): each caller of an agent channel without a security policy gets a signed identity (X-Sutra-Visitor), so its conversations, memory and jobs are its own; a missing or forged token makes a new visitor.
server/src/security/conversation.ts138Conversation tokens of published agents (2.1.5): a signed token per conversation, bound to the agent and the caller and expiring after the Conversation lasts time of the agent channel, issued by every entry point instead of a session id the caller made up; agent_conversations records each conversation without message text; the Admin Console and the sutra command list them and clear expired ones with their AI memory.
web/install/Installer.tsx482The installer page (2.1.1): Install (welcome and system check, administrator, database with Test connection, server ports checked free, optional cluster, review, progress, done with the new master key and admin token shown once, 2.1.4) or Upgrade (installation, review, progress, done), with the SutraFlow logo.
server/src/trace.ts122Traceability for the Admin Console: per project, each Sutra with its runs by outcome over a period; runs found by id, by who started them or by a value in their input; who or what started a run (recorded since 2.1.0, worked out from the source for older runs); and the runs a run called or was called by (Call Sutra). Reads the runs and tasks tables, filtered to the projects the caller may see.
server/src/connection-limits.ts460One admission service for every use of a limited connection (Maximum concurrent activities, Project properties allowed), cluster-wide in the engine database. A step is counted on the connections it selects and, transitively, on those their settings select (a knowledge base: its vector database and AI provider), all at once or none; its permit belongs to its durable claim. Listener polls and scheduled refreshes take renewable leases that expire after a crashed engine, and a lost lease aborts its work. Waiting steps stay queued with a reason and a growing pause (no attempt, no worker, timeout not started). In-memory steps fail closed. One lock per connection (several in id order); admission only counts what still holds a place (four round trips), a finished step gives its places back at once and wakes the waiting steps, and the leader sweeps old rows. Also the Admin Console view and the leader samples behind its graphs.
tools/file-overviews.mjs94Maintains first-party file overview comments and a companion code index from architecture descriptions, local imports and function entry points. Preserves shebangs and licenses; excludes generated and vendored artifacts. Check mode detects drift.

Admin API routes

276 routes in server/src/api.ts. People use them through the studio with a session; automation sends the admin token. Headless engines allow only packages, the projects list, rollback, runs, secrets, meta and engine routes.

AreaRoutes
serviceGET /health GET /ready GET /metrics GET /sutraflow-architecture.html GET /architecture GET /admin GET /approvals
authGET /api/auth/status GET /api/auth/sso/start GET /api/auth/sso/callback POST /api/auth/sso/callback POST /api/auth/setup POST /api/auth/login POST /api/auth/logout POST /api/auth/password
accessGET /api/access/sso PUT /api/access/sso GET /api/access/me GET /api/access/me/tokens POST /api/access/me/tokens POST /api/access/me/tokens/:id/renew DELETE /api/access/me/tokens/:id GET /api/access/personal-tokens PUT /api/access/personal-tokens GET /api/access/permissions GET /api/access/roles POST /api/access/roles PUT /api/access/roles/:id DELETE /api/access/roles/:id GET /api/access/users POST /api/access/users GET /api/access/users/:name PUT /api/access/users/:name DELETE /api/access/users/:name POST /api/access/users/:name/password POST /api/access/users/:name/unlock POST /api/access/users/:name/sign-out GET /api/access/users/:name/tokens POST /api/access/users/:name/tokens DELETE /api/access/users/:name/tokens/:id
auditGET /api/audit GET /api/audit/policy PUT /api/audit/policy POST /api/audit/clear GET /api/audit/export
gitGET /api/git/providers GET /api/git/accounts POST /api/git/accounts PUT /api/git/accounts/:id DELETE /api/git/accounts/:id POST /api/git/accounts/:id/test POST /api/git/clone
projectsGET /api/projects/:id/git POST /api/projects/:id/git/init POST /api/projects/:id/git/publish POST /api/projects/:id/git/commit POST /api/projects/:id/git/push POST /api/projects/:id/git/pull POST /api/projects/:id/git/fetch POST /api/projects/:id/git/discard GET /api/projects/:id/git/branches POST /api/projects/:id/git/switch GET /api/projects/:id/git/log GET /api/projects/:id/git/commits/:sha GET /api/projects/:id/git/diff POST /api/projects/:id/git/resolve POST /api/projects/:id/git/abort POST /api/projects/:id/git/trust DELETE /api/projects/:id/git GET /api/projects POST /api/projects GET /api/projects/:id PUT /api/projects/:id PUT /api/projects/:id/variables/:name/secret DELETE /api/projects/:id GET /api/projects/:id/ops PUT /api/projects/:id/ops GET /api/projects/:id/ops/file POST /api/projects/:id/ops/file POST /api/projects/:id/samples GET /api/projects/:id/package GET /api/projects/:id/documentation GET /api/projects/:id/release GET /api/projects/:id/packages POST /api/projects/import POST /api/projects/:id/copy POST /api/projects/:id/rollback GET /api/projects/:id/log POST /api/projects/:id/log/clear POST /api/projects/:id/runs/clear-tests GET /api/projects/:id/folders POST /api/projects/:id/folders POST /api/projects/:id/folders/move DELETE /api/projects/:id/folders GET /api/projects/:id/usage GET /api/projects/:id/folders/contents
consoleGET /api/console/overview GET /api/console/secret-scope GET /api/console/apps GET /api/console/trace GET /api/console/trace/runs GET /api/console/trace/payloads/:id GET /api/console/trace/runs/:id PUT /api/console/sutras/:id/enabled POST /api/console/engines/:id/drain POST /api/console/engines/:id/restart POST /api/console/sutras/:id/restart GET /api/console/tuning GET /api/console/conversations POST /api/console/conversations/clear-expired GET /api/console/knowledge GET /api/console/knowledge/:id/figures GET /api/console/knowledge/:id/connections PUT /api/console/knowledge/:id POST /api/console/knowledge/:id/rebuild PUT /api/console/knowledge/:id/grants POST /api/console/knowledge/:id/grants/remove POST /api/console/knowledge/:id/sources PUT /api/console/knowledge/:id/sources/:sid DELETE /api/console/knowledge/:id/sources/:sid POST /api/console/knowledge/:id/sources/:sid/sync GET /api/console/knowledge/:id/sources/:sid/runs POST /api/console/knowledge/:id/sources/:sid/export GET /api/console/memory GET /api/console/connections GET /api/console/memory-quotas PUT /api/console/memory-quotas PUT /api/console/memory/:id/config POST /api/console/memory/:id/reload GET /api/console/memory/:id/rows PUT /api/console/memory/:id/rows DELETE /api/console/memory/:id/rows/:key POST /api/console/memory/:id/clear PUT /api/console/engines/:id/name PUT /api/console/engines/:id/lead PUT /api/console/cluster/name GET /api/console/machine PUT /api/console/tuning/engine PUT /api/console/tuning/engines/:id GET /api/console/sutras/:id/tuning PUT /api/console/sutras/:id/tuning
gatewayGET /api/gateway/apps POST /api/gateway/apps PUT /api/gateway/apps/:id DELETE /api/gateway/apps/:id GET /api/gateway/apps/:id/keys POST /api/gateway/apps/:id/keys DELETE /api/gateway/apps/:id/keys/:keyId GET /api/gateway/plans POST /api/gateway/plans PUT /api/gateway/plans/:id DELETE /api/gateway/plans/:id GET /api/gateway/firewall PUT /api/gateway/firewall GET /api/gateway/proxies PUT /api/gateway/proxies GET /api/gateway/options PUT /api/gateway/options GET /api/gateway/stats GET /api/gateway/requests GET /api/gateway/apis GET /api/gateway/openapi
alertsGET /api/alerts GET /api/alerts/summary POST /api/alerts/check POST /api/alerts/:id/acknowledge POST /api/alerts/:id/resolve GET /api/alerts/kinds GET /api/alerts/rules POST /api/alerts/rules PUT /api/alerts/rules/:id DELETE /api/alerts/rules/:id POST /api/alerts/rules/:id/check GET /api/alerts/channels POST /api/alerts/channels PUT /api/alerts/channels/:id DELETE /api/alerts/channels/:id POST /api/alerts/channels/:id/test
metaGET /api/meta
engine-variablesGET /api/engine-variables PUT /api/engine-variables
samplesGET /api/samples GET /api/samples/sutra-sample-shop.zip
flowsGET /api/flows/:id/documentation GET /api/flows POST /api/flows PUT /api/flows/:id/folder GET /api/flows/:id PUT /api/flows/:id DELETE /api/flows/:id POST /api/flows/:id/rename POST /api/flows/validate GET /api/flows/:id/versions GET /api/flows/:id/page-link GET /api/flows/:id/contract POST /api/flows/:id/deploy DELETE /api/flows/:id/deploy POST /api/flows/:id/test GET /api/flows/:id/sample POST /api/flows/:id/run
sample-projectsGET /api/sample-projects GET /api/sample-projects/:file
packagesPOST /api/packages/open POST /api/packages/check POST /api/packages/deploy POST /api/packages/test
configPOST /api/config/export
engineGET /api/engine/status POST /api/engine/drain POST /api/engine/housekeeping
releasesGET /api/releases/policy PUT /api/releases/policy
scriptsGET /api/scripts/policy GET /api/scripts/python PUT /api/scripts/python PUT /api/scripts/policy
serverGET /api/server/database PUT /api/server/database/target GET /api/server/database/reconnect PUT /api/server/database/reconnect POST /api/server/database/test POST /api/server/database/migrate GET /api/server PUT /api/server/gateway PUT /api/server/tls POST /api/server/tls/self-signed POST /api/server/tls/upload POST /api/server/tls/acme
aiGET /api/ai/cli-policy PUT /api/ai/cli-policy
env-bindingsGET /api/env-bindings PUT /api/env-bindings
oauthGET /api/oauth/:id GET /api/oauth/:id/start DELETE /api/oauth/:id GET /api/oauth/callback
schemasGET /api/schemas GET /api/schemas/:id POST /api/schemas PUT /api/schemas/:id DELETE /api/schemas/:id POST /api/schemas/:id/rename GET /api/schemas/:id/tree POST /api/schemas/:id/impact PUT /api/schemas/:id/folder
designPOST /api/design/schemas POST /api/design/mapping-preview POST /api/design/schema-from-sample POST /api/design/query-preview
exprPOST /api/expr/eval
resourcesPUT /api/resources/:id/folder GET /api/resources POST /api/resources/test POST /api/resources/models POST /api/resources/ai/resolve POST /api/resources/ollama/:action POST /api/resources PUT /api/resources/:id DELETE /api/resources/:id GET /api/resources/:id/search-index POST /api/resources/:id/search-index POST /api/resources/:id/rename
runsGET /api/runs GET /api/runs/:id POST /api/runs/:id/resubmit POST /api/runs/:id/cancel POST /api/runs/:id/debug
approvalsGET /api/approvals GET /api/approvals/history POST /api/approvals/:id POST /api/approvals/:id/reassign
eventsGET /api/events
secretsGET /api/secrets PUT /api/secrets/:name DELETE /api/secrets/:name
soapPOST /api/soap/describe

Environment settings

Process settings come from environment variables (config.ts). Everything else (gateway ports after the first start, TLS, policies, Engine properties) is stored in the database and edited in Admin Console → Server.

VariableDefaultMeaning
SUTRA_ENVIRONMENTdevelopment (studio), production (engine)development, test or production: shown on log lines and audit entries; production refuses designer deploys and limits who may clear logs.
SUTRA_DB_PASSWORD(none)The PostgreSQL password, kept apart from SUTRA_DB so the address can be shown and logged (written by the move to PostgreSQL).
SUTRA_PYTHON(found)The Python that runs Python steps; else the setting in Admin Console → Server → Runtime, then py, python3, python.
SUTRA_GIT(git if installed)system or builtin: the Git used by the Git tab.
SUTRA_GIT_ALLOW_FILE(off)1 allows file:// repositories (tests, local mirrors).
SUTRA_GIT_TOKEN, SUTRA_GIT_LOGIN(none)CLI only: the token (and login) for sutra package --from-git of a private repository.
SUTRA_NODEnodeLauncher and scripts: the Node.js program to use.
SUTRAFLOW_ENVsutraflow.envLauncher and scripts: another settings file.
STUDIO_PORT, STUDIO_GATEWAY_HTTP, STUDIO_GATEWAY_HTTPS, ENGINE_PORT, ENGINE_GATEWAY_HTTP, ENGINE_GATEWAY_HTTPS4800, 8080, 8443, 4801, 9080, 9443Launcher (sutraflow.env): the ports of the studio and of a headless engine beside it.
SUTRA_MODEstudiostudio: studio, engine and gateway in one process. engine: headless, no studio and only the automation API with the admin token.
SUTRA_DATA_DIR./dataSQLite database, vault key file, log files and deployment configs.
SUTRA_DNS_SERVERS(current resolver)Optional administrator-approved comma-separated DNS IP addresses for this Node process only. Applied once at startup before connector SRV/TXT lookups; no OS DNS change, implicit public fallback or TLS weakening.
SUTRA_DB(SQLite)postgres://user:pass@host/db for clusters on several machines; pglite:memory in tests.
SUTRA_PG_POOLby workersConnections of the engine's PostgreSQL pool (half of SUTRA_WORKERS, 4 to 20). Every engine opens up to this many plus one: keep the total under PostgreSQL's max_connections.
SUTRA_COUNT_SYNC_SQL(none)Diagnostics: a file where the engine writes, every 3 s, the statements it sent through the synchronous PostgreSQL connection and how often (to find what still waits for the database).
SUTRA_CAN_LEAD10: this engine never becomes the cluster leader (timers, listeners, recovery); for machines that cannot reach the folders that folder triggers watch.
SUTRA_PUBLIC_URL(none)The studio address as people reach it behind a proxy, for the single sign-on redirect address. Empty: taken from each request.
SUTRA_PG_ASYNC10 runs the engine through the synchronous PostgreSQL connection as before 1.7.6 (a fallback; slower).
SUTRA_PG_NOTIFY1PostgreSQL LISTEN/NOTIFY wakes idle engines for committed queue work. 0 disables the hint; durable polling always remains enabled.
SUTRA_MASTER_KEYkey fileVault key, base64 of 32 bytes. Must be the same on every engine of a cluster.
SUTRA_ADMIN_TOKEN(none)Bearer token for the CLI, CI and release activities on remote engines. Acts as an administrator.
SUTRA_DEPLOY_DIR(none)Folder of .sutra packages deployed at start (containers, headless engines).
SUTRA_CI_USER(none)sutra config apply on this machine (2.1.6): the person or pipeline user named in the audit log for what it creates.
SUTRA_IMAGEsutraflowsutraflow docker and deploy/docker compose files (2.1.6): the image name, such as ghcr.io/spinny007/sutraflow.
SUTRA_VERSION(this release)sutraflow docker and deploy/docker compose files (2.1.6): the image tag.
SUTRA_CONFIG_DIRdata/configDeployment config files loaded at start.
SUTRA_ENGINE_IDhost-pidThis engine's name in the cluster and on metrics.
SUTRA_WORKERSby machineSteps run at the same time (4 on 1 vCPU / 1 GB up to 32 on 8 cores, see sizing.ts). 0 = serve only (a studio in a cluster).
SUTRA_MEMORY_WORKERS0Steps at once for Sutras that run in memory; 0 = the same as SUTRA_WORKERS.
SUTRA_VISITOR_DAYS30How long a chat visitor identity (agent channels without a policy) lasts; renewed while the visitor keeps coming back (2.1.5).
SUTRA_STREAM_BUFFER_MB8A streaming step (batches of a big file) waits while the steps it handed on hold more input than this; one batch always goes on.
SUTRA_POLL_MSby machineHow often an idle engine looks for due steps (500 ms on the smallest machines, 200 to 250 ms otherwise).
SUTRA_SETTINGS_REFRESH_MSby machineHow long an engine keeps Project and Engine properties before reading them again; 0 reads them on every step.
SUTRA_MAX_STEPS10000Safety limit of steps per run.
SUTRA_REPLY_TIMEOUT_MS60000How long REST and SOAP callers wait for a reply step.
SUTRA_MEMORY_SYNC_MS1000How often an engine checks the database copy of memory tables for changes and reloads asked for elsewhere.
SUTRA_PAYLOAD_STORE_KB256Large messages: a part of a run input at least this big is stored once and referenced (not a size limit); 0 = never.
SUTRA_PAYLOAD_CACHE_MB64Memory for stored parts read back for steps.
SUTRA_MEMORY_MBset by the launcherThe Node memory (--max-old-space-size) this process was started with, from STUDIO_MEMORY_MB or ENGINE_MEMORY_MB; 0 = Node.js decides.
SUTRA_ENV_FILE, SUTRA_ROLE, SUTRA_LAUNCHED, SUTRA_HOMEset by the launcherThe settings file, role (studio or engine), how it was started (background or foreground) and folder: a changed Node memory is written there and Restart goes through the launcher.
SUTRA_KEEPALIVE_MS65000How long the admin and gateway servers keep an idle connection; longer than the idle time of a load balancer in front.
SUTRA_HEARTBEAT_MS5000Heartbeat interval; an engine silent for three beats is dead.
SUTRA_DRAIN_MS30000Time running steps get to finish on a graceful stop.
SUTRA_RUN_RETENTION_DAYS30Finished runs older than this are deleted; 0 keeps them.
SUTRA_DESIGN_RUN_RETENTION_DAYS7Finished design runs (tests, debugging, drafts) older than this are deleted first (2.1.7); 0 leaves them to SUTRA_RUN_RETENTION_DAYS.
SUTRA_AUDIT_RETENTION_DAYS365Audit entries older than this are deleted; 0 keeps them.
SUTRA_TRACE_SAMPLING1Share of runs traced, 0 to 1. Changed live by tuning.
SUTRA_LOG_FORMATtextjson: engine events as JSON lines on standard output.
SUTRA_METRICS_TOKEN(none)When set, /metrics needs this Bearer token.
OTEL_EXPORTER_OTLP_ENDPOINT(none)OpenTelemetry collector address (OTLP/HTTP).
OTEL_SERVICE_NAMEsutraflowService name on traces.
SUTRA_ADMIN_HOST, SUTRA_ADMIN_PORT127.0.0.1, 4800Studio and admin API address. Containers use 0.0.0.0.
SUTRA_GATEWAY_HTTP_PORT, SUTRA_GATEWAY_HTTPS_PORT8080, 8443Gateway ports until changed in Admin Console → Server → Gateway & TLS.
SUTRA_WEB_DIR(built in)Folder of the built studio, when not next to the server.
SUTRA_SERVER(none)CLI only: the server address, instead of --server.

Messaging certification and benchmark record

2.0.8 increment, 24 October 2026. A shared body codec handles JSON/XML/text/map/bytes. Exact XML text retains namespaces and attributes; malformed explicit formats become failed starter runs and follow the settlement policy instead of escaping an asynchronous callback. DTD/entities, multiple XML roots, undeclared entities, invalid XML characters and non-canonical base64 are refused. Designer test envelopes use the same representation checks. The expanded matrices passed 66 native scenario executions: ActiveMQ 15 plain + 15 strict mTLS; RabbitMQ 9 plain + 9 strict mTLS; hosted Kafka 9 TLS/SASL PLAIN + 9 mutual TLS. All five formats, malformed-payload retry ceilings, acknowledgement modes, duplicates and listener/concurrency behavior are covered. The generated XML queue sample forwards exact XML before Confirm against ActiveMQ in both modes. Four broker REST checks also pass, including execution of all four REST samples. Kafka REST uses public trust, separately from the native broker private CA. Details and transcript hashes are in docs/benchmarks/release-2.0.8-verification.md.

Deployment validation and the direct engine entry (including in-memory dispatch) require exactly one starter. Legacy multi-starter documents are not registered by gateway, scheduler, listener, MCP, agent or channel entry points. A single starter can expose multiple event/operation ports. Real external PostgreSQL 17.2 and MariaDB 11.8.9 passed bound SQL query activities, Project/Engine connection properties and rollback paths with client TLS verification. The managed PostgreSQL endpoint negotiates client TLS 1.3 but reports an unencrypted pool-to-database hop; confirm the provider's internal policy. No new 24-hour soak is implied.

SutraFlow 2.0.6 · verified 23 October 2026. This is SutraFlow's internal interoperability and reliability certification against real services. It records the tested implementation and configuration; it is not a broker-vendor certification or an assurance for every broker version. Publish message, Queue / topic trigger and Confirm message are exercised through the engine, including the settlement and durable duplicate-guard paths.

Protocols, security and certified environments

Service / environmentProtocol and clientSecurity actually exercisedResult
Hosted Aiven KafkaNative Apache Kafka wire protocol through KafkaJS; consumer groups, partitions and committed offsets.TLS with the provider CA and SASL PLAIN; separately TLS client-certificate authentication (mutual TLS, no SASL).7/7 scenarios in each mode; 14 successful scenario executions.
RabbitMQ 4.4.0, local Windows serviceAMQP 0-9-1 through amqplib; queues, topic exchange bindings and publisher confirms.Plain TCP; separately strict private-CA mutual TLS through the test TLS proxy.8/8 scenarios in each mode; 16 successful scenario executions.
ActiveMQ Classic 6.3.2, local Windows / OpenJDK 21AMQP 1.0 through rhea for SutraFlow; two-way interoperability with a Java Jakarta Messaging (JMS-style) client over OpenWire. Classic AMQP connector uses transport.transformer=jms.Plain AMQP TCP; separately strict private-CA mutual TLS through the test TLS proxy. The Java OpenWire probe uses the local TCP connector.13/13 scenarios in each mode; 26 successful scenario executions.

Terminology. TLS secures a transport; mutual TLS also authenticates the client certificate. SASL is an authentication framework; PLAIN and SCRAM are mechanisms. AMQP 0-9-1 and AMQP 1.0 are different messaging wire protocols. OpenWire is ActiveMQ's wire protocol. JMS (Java Message Service, now Jakarta Messaging) is a Java API and message model, not an encryption protocol. Kafka uses its own wire protocol. Broker Java/Erlang runtimes are separate from SutraFlow's Node.js clients.

The local mutual-TLS fixture validates the client certificate and forwards the original broker protocol to the installed broker. It proves SutraFlow's CA trust, hostname verification, client-certificate and vault-key paths, but does not certify a broker-native Java keystore or RabbitMQ TLS-listener configuration. TLS versions and cipher suites were negotiated by the runtime; no specific version/cipher benchmark is claimed. SCRAM-SHA-256/512 is configurable, but the hosted service run exercised PLAIN and certificates. Artemis and other broker versions have not been certified by this record.

Reliability scenarios passed

CoverageVerified behavior
All three brokersConnect and authenticate; publish and consume; preserve body and supported metadata; auto acknowledgement does not replay a failed run; client acknowledgement retries failure; explicit confirm, requeue, reject and missing Confirm obey the selected boundary; retry ceilings; listener restart and concurrent batches complete without missing or duplicate runs.
Kafka detailsKey, headers, custom properties, partition and offset; delivery counts; commit on terminal rejection/ceiling; durable offset identity across consumer rebuild; 12-message partition-concurrency batch. Readiness waits for group join and the first completed fetch, preventing a new latest-offset group from skipping a message published immediately after ready.
RabbitMQ detailsJSON, text, map and bytes; message-id duplicate suppression; in-place nack/requeue attempt counting; TTL; durable topic queue binding; publisher confirms.
ActiveMQ detailsJSON, text, map and bytes; headers, properties and JMS destination normalization; message selectors; TTL; durable topic subscription while undeployed; unique container identities; Java OpenWire producer to SutraFlow AMQP consumer and the reverse.
Shared guard testsA duplicate belonging to an active/waiting run does not create another run. RabbitMQ/AMQP copies are held and settled when that run ends; Kafka pauses that partition. Custom duplicate keys and the missing-id rejection policy are covered. These use controlled fixtures in addition to the real-broker matrices.

The native matrices total 56 successful scenario executions across six connection-mode runs. This is delivery correctness coverage, not exactly-once execution of outside effects. A crash between an outside write and acknowledgement can repeat that effect: use idempotency keys. Kafka reject/ceiling commits the source offset; retaining the event requires an explicit retry/dead-letter topic. Retry counters belong to the current consumer and are not a durable lifetime attempt count across leader restarts.

REST integration and executable samples

EndpointPassed operation / sampleSemantic boundary
Aiven Karapace-compatible Kafka REST over HTTPS / Basic authPublish; create consumer, subscribe, poll JSON records, commit offsets and close. Sample: Kafka REST publish and Sample: Kafka REST subscribe both execute successfully.The REST endpoint uses a publicly trusted Let’s Encrypt chain; its trust configuration differs from the native broker CA. The example uses earliest for a new group; latest can skip records sent before initial offset establishment.
RabbitMQ management HTTP APIDeclare durable queue, publish, fetch with ack_requeue_false and delete the sample queue. Generated sample executes successfully.HTTP fetch acknowledges at the API call, not at later workflow completion. Native AMQP provides the production trigger and publisher-confirm path.
ActiveMQ Jolokia management REST APICreate queue, send text, browse, remove the exact message and delete the sample queue. Generated sample executes successfully.Browse/remove is management automation, not JMS receive/ack. Classic 6.3 disables the deprecated MessageServlet by default for security; the sample keeps it disabled.

test/broker-rest.test.ts passed 4/4 checks: three endpoint workflows and one engine-level check executing all four generated REST sample Sutras. The local management APIs used HTTP on loopback; broker-native mTLS results must not be read as certification of HTTPS for those management endpoints.

Benchmark scope and reproducibility

The runs above are functional and fault-handling certification. They did not measure sustained messages/second, end-to-end p50/p95/p99, maximum queue depth, TLS CPU cost or long-duration broker-outage recovery. The earlier engine soak figures elsewhere in the documentation are not messaging-protocol benchmarks. A messaging performance result must state broker/client versions, partitions or prefetch/credit, payload size, acknowledgement mode, durability, TLS/authentication, engine count, database/network topology and duration alongside throughput, latency, errors, redeliveries and duplicates.

Reproduce native coverage with test/kafka.test.ts, test/rabbitmq.test.ts and test/activemq.test.ts; enable their opt-in environment variables and supply credentials through the test environment. REST coverage is test/broker-rest.test.ts. test/connectors.test.ts covers guard and TLS configuration failures. The Java OpenWire and TLS proxy fixtures live under test/fixtures and are test-only. Certificates, passwords and keys are not included in source, sample packages or this report.

Tests

npm test compiles the server, then runs every suite with Node's test runner. The build first runs the offline vendor integrity gate. Connected CI and release jobs also run its npm freshness mode; a weekly workflow detects an upstream release without waiting for a code change. Multi-process suites start real servers (headless engines, clusters on one database, drain and failover). The PostgreSQL suite runs the in-process suites again on PGlite with shifted ports. Three suites run only when their tools exist: the Docker image build, a real PostgreSQL server through SUTRA_TEST_PG_URL, and DB Ops against a real MySQL server through SUTRA_TEST_MYSQL_URL (for example Laragon's). A guard test fails if names of other products appear in the source or documents.

access.test.ts

  • the first administrator gets every permission; built-in roles exist
  • every route has an access rule, and every rule names a real route
  • a developer on one project: password change first, then only that project, no deploy, no admin
  • custom roles: permissions checked; built-in roles cannot change; a role in use cannot go
  • lockout after repeated wrong passwords, unlock, disable ends sessions, sign out everywhere
  • at least one administrator remains; nobody disables or deletes themselves
  • system accounts: tokens for the API (scoped, expiring, revocable), no studio sign-in
  • gateway Basic sign-in with system accounts: needs Call services on the policy's project
  • audit log: changes, sign-ins and refusals; filters; CSV; never passwords or secret values

activemq.test.ts

  • ActiveMQ Classic real-broker activity matrix
  • connects through the ActiveMQ / AMQP 1.0 resource
  • interoperates both ways with native OpenWire/JMS clients
  • queue client acknowledgement preserves JSON and JMS headers, properties, and duplicate protection
  • JSON, XML, text, map and bytes bodies round-trip through Sutra activities
  • generated XML queue sample forwards exact XML before confirming its delivery
  • malformed JSON and XML fail before processing and respect the retry ceiling
  • selector accepts only matching application properties
  • auto acknowledgement does not redeliver a failed Sutra
  • client acknowledgement requeues failures and rejects at the delivery ceiling
  • explicit confirm, requeue and reject decisions settle as selected
  • ending explicit mode without Confirm causes redelivery up to the configured ceiling
  • TTL expires a queued message before a subscriber appears
  • durable topic subscription receives messages published while undeployed
  • listener restart during an unacknowledged run does not start a duplicate
  • concurrency processes a batch once without losing messages

admin.test.ts

  • first run creates the admin; API needs a session and the X-Sutra header
  • Sutras, test runs, secrets and meta through the API

agent.test.ts

  • an agent uses a tool Sutra, answers, and remembers the conversation
  • messages of one session are handled one at a time, in arrival order; other sessions run alongside
  • limits stop a looping agent; an unknown tool is explained to it
  • the agent asks a person; the answer comes back through Ask a person
  • memory: turns fit the window, old turns fold into a summary, sessions clear
  • knowledge: add, search by meaning and words, ask with sources, filters, remove
  • the guard hides personal data and blocks hidden instructions and topics

agentchannel.test.ts

  • chat page and chat API: sessions carry the conversation
  • slow work answers with a job; the job gives the answer later
  • OpenAI-compatible API: models, answers, streaming, one session per conversation
  • MCP: the agent is the tool ask_order_desk; an MCP client calls it
  • A2A: agent card, message/send with a context, tasks/get
  • a policy on an entry point keeps strangers out
  • a conversation token continues only for the caller who started it; a made-up session id starts a new one; a job answers only its caller
  • MCP client over a command; Call MCP tool; an agent uses outside tools; hand-off to an agent
  • visitors without a security policy are told apart: each has its own conversation and jobs, proved by a signed token
  • 2.1.5: a conversation expires after its set time; administrators clear expired ones with their memory
  • 2.1.5: visitor tokens of 2.1.4 are renewed, expired ones give a new visitor; the widget hands the website login to its own frame only
  • 2.1.5 sample: Chat for customers and support: website tokens, customers see their own orders, support every order
  • 2.1.5: the Sutra Sample Shop website downloads as a zip with its README and never its local settings

ai-policy.test.ts

  • blank explicit model fails before any network call; no hidden local or hosted defaults
  • Automatic is opt-in, uses the configured endpoint/key and records its actual selection
  • an unavailable explicit model is rejected without fetching or switching to another model
  • Gemini discovery follows pagination, filters by capability and accepts 3.x/4.x IDs
  • Gemini 3.x and 4.x requests preserve explicit IDs and use header authentication
  • connection deadline aborts a delayed model request and discovery
  • caller cancellation wins, and concurrent activity timeout overrides stay isolated
  • engine inherits the AI connection deadline and an explicit step override can extend it
  • native Ollama uses automatic selection only for inference, never for destructive operations
  • invalid timeout values and embedded URL credentials fail clearly; CLI has no API URL
  • CLI deadline terminates its process instead of returning a stale success

aicli218.test.ts

  • setup: an administrator, a project and a developer on it; a new server starts with AI command-line tools off
  • switched off: Test connection starts no program (the audit probe), and a developer cannot switch it on
  • switched on: only a listed command line runs, and never with a flag that lets the tool act on its own
  • an allowed tool runs in an empty folder with a small environment, whatever folder the connection names
  • an MCP server started by a command follows the same switch and list
  • first start of 2.1.8: commands found in connections wait for an administrator; nothing is trusted on its own

alerts.test.ts

  • channels: webhook (signed), email (SMTP), a Sutra; tested; wrong settings refused
  • failed runs open one alert, notify every channel, remind, and resolve with a message when they clear
  • engines, work waiting, gateway errors and latency, certificate and listeners
  • rules and channels: validation, a channel in use cannot go, rule check now; permissions; overview dashboard
  • alerts from the sutra command: rules, channels, test, check, list (exit 1 while a critical alert fires), ack

api-docs.test.ts

  • every admin API route is described in the Admin API reference
  • the reference describes no route that does not exist
  • every route the sutra command calls names its sutra command
  • the Admin API part places every described route in exactly one chapter

approvals.test.ts

  • the approvers decide: a role and an account from the data, all of them, a comment to reject
  • one rejection rejects; an administrator decides only on behalf, recorded so
  • at the due time an approval escalates to other roles, or goes on through its expired output
  • the Approval Center page is served on its own address

asyncdb.test.ts

  • a transaction is explicit: inside it, a synchronous write, a nested transaction or a query past its object is refused
  • fencing: a step taken over meanwhile (recovered by another engine) is not completed by the engine that lost it
  • a run is ended once: settling it again changes nothing and does not answer its caller twice
  • many runs at once all finish with every step done once

asyncpg.test.ts

  • the engine uses the pool on PostgreSQL, and its transactions run at the same time
  • PostgreSQL NOTIFY wakes an idle engine while durable polling remains the fallback
  • fencing on PostgreSQL: a step recovered by another engine meanwhile is left to it
  • runs at once, approvals and cancel work through the pool

azure.test.ts

  • Test connection signs in to Azure and reads the factory and its pipelines; a wrong secret says why
  • Run ADF pipeline: starts it with parameters, waits, and returns the activity runs
  • a failed pipeline goes to failed with the failing activity; a rerun starts from the failure
  • a run still going at the wait limit is cancelled and the step says where to look
  • ADF pipeline run: recent runs, list pipelines, start a trigger; a missing pipeline name warns in the designer
  • Databricks: Test connection, a notebook with parameters and its exit value, and a failing one
  • Databricks code block starts the stopped cluster, passes parameters as data, and reports a Python error
  • Databricks SQL sends named parameters, waits, and reads every chunk

broker-rest.test.ts

  • RabbitMQ management REST publishes, fetches with acknowledgement, and cleans up
  • ActiveMQ Jolokia REST creates, publishes, browses, removes and cleans up
  • Kafka REST publishes and completes create-subscribe-poll-commit-close lifecycle
  • generated RabbitMQ, ActiveMQ and Kafka REST sample Sutras execute

certificates.test.ts

  • certificate settings: a file on Windows or Linux, PEM text, or the older pasted text
  • private key settings: a key file, PEM text from a Private key property, or a vault secret
  • a connection takes its certificates and key from files and variables; mutual TLS needs both
  • Certificate and Private key properties: a certificate is readable text or a path, a private key is kept in the vault

chat.test.ts

  • Test connection: a Discord webhook, a Discord bot and its channel, a Telegram bot and its chat
  • a wrong Telegram chat says why and never shows the bot token
  • Discord: a webhook message with an embed and a file; a bot message with mentions switched off
  • Telegram: an HTML reply, and a document from a server file
  • the Telegram trigger skips old messages and starts the Sutra for a new /command
  • the Discord trigger starts the Sutra for a !command, and leaves out bots
  • the Discord and Telegram templates are complete and described

cluster.test.ts

  • two engines start together: the package is deployed once, both are alive, exactly one leads
  • work is shared between engines, each step runs exactly once, every caller gets its reply
  • an engine with no workers only serves: its callers are answered by steps run on the others
  • the timer fires once per second in the whole cluster, from the leader only
  • when the leader dies, the other engine takes over within a few heartbeats
  • steps of an engine that dies mid-step are finished by another engine
  • a package deployed through one engine is served by the other at once
  • draining: a step that finishes in time completes; one that does not is handed back and finished elsewhere

config-files.test.ts

  • export: server settings and projects as YAML, secrets as ${env:} placeholders, connections named, never people (2.1.6)
  • check changes nothing; apply creates a new project with its connections and vault secret, all at once (2.1.6)
  • apply again: nothing is changed; what is there is listed with name, type, where and the fields that differ (2.1.6)
  • all or nothing: one item that cannot be created stops the apply and nothing is created (2.1.6)
  • server part: missing items created, existing ones listed; a person never set by a file (2.1.6)
  • values: ${env:} read where the command runs, $${env:} kept, file: for secrets, plain secrets warned, missing ones stop it (2.1.6)
  • permissions follow what the file holds: Deploy on its projects, Users for accounts, Server settings for the server part (2.1.6)

confine218.test.ts

  • a File step path through a junction inside its folder is refused, for reading and for writing
  • listing a folder does not follow junctions
  • a release cannot write its files through a junction in the project files folder

connections217.test.ts

  • automatic colours: only where lines meet, distinct for 2 to 8 lines, by source step
  • automatic colours do not change when steps move, and two lines from one step are not a meeting
  • colours chosen by hand win, error lines stay red, and the colour survives save, export and import
  • the palette has 3:1 contrast with the canvas in both themes, and the stylesheet uses the same values
  • highlighting: a step lights its own lines; Path lights everything before and after it, across a join
  • the Input tab key lists each incoming line with its colour
  • Tidy lays steps out in columns by order, changes positions only, and removes crossings
  • every bundled sample leaves room for its lines: no steps on top of each other, a gap between columns

connectors.test.ts

  • ActiveMQ JMS destination qualifiers are hidden from Sutra message headers
  • Kafka TLS requires complete mutual-TLS credentials and keeps private keys in the vault
  • RabbitMQ and AMQP 1.0 TLS require a complete client certificate pair and strict CA validation
  • DB Ops placeholders per database, ignoring quotes, comments and ::casts
  • designer checks missing, mismatched, duplicate and unused named SQL parameters
  • SQL text: properties are written in, run data written in the SQL is bound
  • DB Ops on SQLite: update, query with bound parameters, transaction rollback
  • DB Ops on SQLite: transactions of steps running at the same time on one connection take turns
  • Kafka: a copy delivered while its run waits pauses the partition instead of starting a second run
  • RabbitMQ and ActiveMQ: a copy delivered while its run waits is held, then settled by how that run ends
  • Duplicate key: messages without a broker message id are recognised by a chosen field
  • Messages without an id: processed by default, or rejected to the dead-letter queue when chosen
  • Send email over SMTP
  • Kafka publish: a connection the broker dropped while signing in is opened again and the message sent once
  • a listener that cannot start is tried again until it starts (the broker not there yet, or still holding the old leader)
  • ActiveMQ / AMQP 1.0: publish with broker confirmation; subscriber accepts after success and releases on failure
  • Firebase: service-account token, Firestore set/get with value conversion, push notification
  • OAuth connection: sign-in, Google Sheets append, automatic token refresh

connlimits-pg.test.ts

  • connection limits on a real PostgreSQL server

connlimits.test.ts

  • a step is counted on the connections behind the one it selects (a knowledge base and its database)
  • a Project property sets the limit; an invalid value is reported, not ignored
  • a limit never shows its value and never comes from a Secret property
  • a shared connection counts other projects' work without naming it
  • a lease whose renewals keep failing stops its work before it can run out
  • in memory and durable Sutras share one limit: an in-memory step takes a lease in the shared engine database and waits for room
  • leases: a listener poll or background job shares the limit with steps, and is renewed, released or lost
  • a poll with no room is skipped and the trigger says why; with room again it runs
  • a waiting step keeps its place, says why, backs off, and its timeout starts only when it runs
  • a step being re-checked keeps its wait record and still counts as waiting
  • a place that frees goes to a waiting step at once, not after its pause
  • Admin Console: connections with their limit, users, waits and samples over time
  • two engines share a limit of 1 across every kind of use without a deadlock
  • calls inside a step are counted where they are made: parallel calls take places of their own, a limit of 1 makes them take turns, nested calls count once
  • a cancelled run gives its places back at once, and the steps waiting for them go on
  • an engine that stops gives its places back: its steps are recovered and its leases run out

console.test.ts

  • set up: two projects with deployed Sutras, an administrator, a viewer of one project, an operator
  • overview: engines, deployed Sutras, runs and failures, limited to the projects the caller may see
  • applications: projects, Sutras, triggers and run counts; viewers see only their projects
  • stop and start a deployed Sutra: its address stops answering, then answers again; viewers may not
  • the Admin Console page is served at /admin
  • drain an engine from the console: only with the Engines permission; the engine drains on its next beat

contract217.test.ts

  • Manual start with an XSD: XML test payload in, Parse XML shape plus the text out
  • Manual start with an XSD refuses a wrong root, a missing field, a wrong type and text that is not XML
  • the designer: an XSD Manual start gives the schema shape plus xml, and warns about a JSON test payload
  • Call Sutra takes the called Sutra's payload schema as its contract: targets, notes, change since accepted
  • Call Sutra: an old step with its own Input schema keeps it; the contract is offered, not forced
  • Call Sutra: draft and deployed versions have their own contracts
  • a bad input fails the Call Sutra step before any step of the called Sutra runs, with or without Wait
  • the studio Test and the Run API refuse the same bad input to a Sutra with an XSD Manual start

contracts210.test.ts

  • strict Manual start rejects configured/supplied mismatches before creating a run or downstream task
  • strict flag resolution and missing/wrong/foreign schemas fail closed; Off remains explicitly descriptive
  • unsupported JSON validation keywords are rejected instead of silently ignored
  • REST/WebSocket direct engine admission cannot bypass configured request rejection
  • Call Sutra and Return enforce input/result boundaries, including resumed child results
  • strict local/remote file triggers never forward invalid parsed events or read-error envelopes
  • SOAP engine admission applies real XSD patterns and namespaces before business processing

credentials210.test.ts

  • named Secret GVs own stable project-specific backing values, and connection Test/runtime resolve the same reference
  • project Secret API enforces design and Manage secrets permissions and never audits plaintext
  • one variable Save encrypts pending secrets before persisting references, which survive reload
  • connection secret properties resolve once, remain project-specific and never serialize plaintext
  • administrator Secret engine properties are write-only references and masked at execution boundaries
  • legacy URI-secret connections remain compatible and invalid references never echo URI credentials

dashboards.test.ts

  • a suggested chart is used only for known settings and fields of the data; titles lose markup; the data comes from the rows
  • sample Sales dashboard: the page with ECharts from SutraFlow, its charts, one run per refresh shared by viewers, the suggestion checked
  • a dashboard behind a policy refuses callers without its key; the embed script passes the website login to its own frame only
  • a dashboard cached for each caller keeps callers apart by everything the Sutra sees: issuer and claims, not the subject only (2.1.6)
  • raw JSON rows: grouped by month, split into series, counted, nested fields, the page filters, KPI cards and the list inside an answer
  • Charts from AI: the model plans, every chart is checked, the numbers come from the rows; without a provider, rules choose
  • sample Dashboard from JSON: filters on the page and in the address reach the Chart steps; a click target per chart; suggested charts join the page
  • a dashboard on a real ${db === 'mysql' ? 'MySQL' : 'PostgreSQL'} database: the page filters reach the query as bound parameters

dbcopy.test.ts

  • SQLite to PostgreSQL (PGlite): every table, batches, refusal, replace, ids continue
  • SQLite to a real PostgreSQL server

dbmigrate.test.ts

  • the Database page shows SQLite in use; a connection is checked before it is saved; Migrate waits for a tested one
  • the migration scripts exist for Windows (CRLF) and Linux (LF) and run the same Node script
  • the whole move on a real PostgreSQL: stop, copy, switch, start, check
  • a failed copy changes nothing: sutraflow.env stays on SQLite and SutraFlow comes back
  • a password-protected PostgreSQL that requires SSL: wrong password, no SSL, unchecked certificate, then the whole move

deletes.test.ts

  • setup: an administrator, a viewer, a project with items in folders
  • rename: Sutra, connection and schema; a name used twice and an empty name are refused; a viewer may not
  • delete one item: usage is listed first, a deployed Sutra is refused until undeployed, a viewer may not
  • delete a folder with everything in it: needs confirm=delete, refuses deployed Sutras, removes folders too
  • in a Git project, a deleted Sutra shows as a deleted file to commit at once

docker.test.ts

  • the image runs as a non-root user, with health check, init, volumes and the documented ports
  • both images have a sutra command that talks to the container's own server unless SUTRA_SERVER is set
  • the build context leaves out local state, secrets and build output
  • the Docker build context keeps every vendor review test required by the build gate
  • compose: a studio and a headless engine with a token, separate data, a read-only deploy folder and time to drain
  • smoke test: the compiled server started as the image starts it passes the image's own health check
  • the image builds (when a compatible Linux Docker daemon is available)
  • cluster compose: PostgreSQL, a studio and two engines with one master key and token

docsample.test.ts

  • the sample documents are a real PDF, Word document, PowerPoint deck and Markdown file
  • adding the sample writes the documents, sets DOCS_FOLDER and makes five described Sutras
  • the feed adds every document, skips unchanged ones on the next run, and removes deleted files
  • the MCP tool returns passages with sources; the API answers from the documents
  • documentation is made from the steps and their descriptions
  • the sample project zip imports as a new project with its documents, and its feed runs
  • the project files folder is ${files}: a name of the project, never outside the data folder

engine-memory.test.ts

  • Node memory: each engine reports its heap and machine; a changed value goes to its own settings file and waits for a restart

engine.test.ts

  • mapping, if/else, merge with dead-path elimination
  • for each runs per item and then done
  • Set Local Variable and Get Local Variables return the latest run-local values
  • retries with backoff, then error branch handles the failure
  • unhandled error fails the run and cancels other branches
  • human approval waits as saved state and resumes on decision
  • crash recovery: a task left running resumes after restart
  • HTTP request with Basic auth: header sent, secret masked in history
  • HTTP 500 fails the step with the response detail
  • durable wait over 5 seconds is deferred, not held in memory
  • step outputs are kept apart from the run state, and a run started before 1.8.0 keeps its outputs

events218.test.ts

  • setup: projects A and B, a developer granted only A, and B's schema and Sutra
  • F5: the shape preview needs a project, and never shows another project's schema or called Sutra
  • F6: the live stream sends A's events to A's developer, not B's; design runs need Design
  • F6: access taken away while the stream is open stops the events at once

expr.test.ts

  • string functions and nesting
  • encode / decode
  • date and time
  • numbers and lists
  • logic
  • errors are clear
  • refs and the = prefix in fields
  • XPath-style predicates filter repeating rows; position(), last() and indexes
  • xs: conversion functions and utility functions

features.test.ts

  • For-Each with Where, Group by and Sort by (bare column names)
  • project and Engine properties are readable in settings, connections and formulas
  • files: CSV rows typed by a schema, encodings, wildcard directory listing, write CSV from rows
  • Transform (JSONata) reshapes repeating rows
  • SQL text may use administrator-managed project variables while values stay bound parameters
  • Service Bus: JMS headers and properties; explicit acknowledgement with Confirm message
  • End can stop the whole Sutra as success or error; file steps always return file details
  • AI router, summarize, translate and sentiment (mock Claude endpoint)

file-overviews.test.ts

  • first-party file overviews and code-navigation index match current imports and functions

fixes217.test.ts

  • a Dashboard page trigger: not deployed, then a link to its page, and a note when the draft changes its name
  • missing sample data: the error names the install Sutra of the project that makes it
  • a SQL query step on a missing sample table fails with the hint (SQLite)

folders.test.ts

  • resources, schemas and service descriptors have folders of their own
  • a Sutra imported alone brings only the connections and schemas it uses, in their folders
  • samples added before folders existed are filed; other Sutras stay put
  • the list used to file old samples matches what addSamples makes
  • missing project variables are warnings on the step that reads them
  • a watched file is retried when its run cannot be saved on the first poll
  • folders: make, move Sutras, rename, remove (nothing deleted), and travel in packages
  • samples go to Samples/<topic> folders and get the connections they need
  • mock SOAP service and JSON microservices answer on the gateway
  • SFTP sample runs every remote step against a server
  • SQL install script and the procedure as a microservice (MySQL)

gateway.test.ts

  • gateway starter settings resolve project variables before routes are published
  • REST service with API key policy, path params, JSON reply and rate limit
  • REST service with JWT (HS256) policy, issuer, audience and scopes
  • SOAP service with WS-Security UsernameToken, called by the SOAP palette from its WSDL
  • SOAP replay protection: the same digest nonce is refused twice
  • outbound SAML token and X.509 signature are placed in wsse:Security
  • HTTPS gateway with self-signed certificate and Require HTTPS policy
  • ACME challenges are shared through storage and issuance is leased across engines
  • deploy refuses a path already served by another Sutra

gatewayapps.test.ts

  • plans, apps and keys: keys shown once and stored as hashes; wrong input refused
  • a service for gateway apps: key or token, scopes, plan limit with rate headers and 429
  • OAuth2 client credentials: token for the app scopes; wrong secret, foreign scope and disabled app refused
  • firewall: deny wins, an allow list admits only its addresses, wrong rules refused
  • trusted proxies: forwarded address and HTTPS only from listed proxies, nearest untrusted hop wins
  • request log and statistics: services, apps, statuses, latency; filtered; old entries deleted
  • OpenAPI for deployed services with their security; published on the gateway only when chosen; Gateway permission
  • the gateway from the sutra command: plans, apps, keys, firewall, statistics, OpenAPI

git.test.ts

  • setup: a team project with Sutras in folders, a connection and a schema; an administrator and a developer
  • initialize the team project, publish it; the repository holds readable files and never secret values
  • a developer clones a personal copy: only they see it, it is restricted until trusted, and it cannot be deployed
  • change, see it by item, diff, commit and push; the team project pulls it
  • both change the same Sutra: the second puller resolves the conflict by choosing a side
  • branches: work on a branch, switch back; discard undoes uncommitted changes
  • Git accounts are per person: tokens are never returned, never usable by others, and go only in the request header
  • the built-in Git: init, commit, status, history and files at a commit, without the git command
  • disconnecting a personal copy removes it; the team project keeps its Sutras

guard218.test.ts

  • moderation: a category at its threshold blocks; a warn-only category lets the text through with a warning
  • language: detected, and translated with the guard's model to the set language
  • answer cache: per Sutra and per person; never given to another person or an unidentified caller
  • a project can mask personal data in its log and run history; the steps still pass the real data on

headless.test.ts

  • a headless engine deploys the packages in its folder and serves them, with no studio
  • a new package deployed through the API is served at once; restarting does not deploy the folder twice
  • an updated package in the folder replaces the old version on the next start
  • a package that cannot be deployed stops the engine with an error
  • an engine without an admin token keeps its API closed but still serves and reports health

hmac.test.ts

  • HMAC: signed requests pass once; changed, old, replayed or unsigned ones do not; a second secret works while one is replaced
  • HMAC variants: method and path signed too, and the body only with a sha256= prefix
  • an HTTP request step signs its body with an HMAC outbound profile
  • OAuth token introspection: active tokens with their scopes pass, answers are kept, others are refused
  • scopes per SOAP operation

install.test.ts

  • installer checks: administrator, ports and a cluster without PostgreSQL are refused with every reason at once
  • saved answers (2.1.2): the same choices as a silent-install file, every password an environment variable, none written
  • an upgrade stopped only the studio, so the engine beside it ran on while its program and database changed and a rollback waited on its locks: both stop, and the engine starts again
  • a busy port is reported with the next free one; sutraflow.env keeps its comments and order when values are set
  • install: settings, data folder, tables and the administrator are made, then the installer is locked
  • upgrade: only from 2.1.0 on, the same version only as a reinstall, never a newer one, and never in the installer's own folder
  • reinstall: the same version again only when asked (a repair), a damaged one without its launcher too, never a newer one
  • an upgrade took an SQLite file of its own for PostgreSQL, met a folder another program held only halfway through, and its way back copied the whole data folder back (read-only Git objects refused it): SQLite stays SQLite, the folder is checked first, and the old version starts again
  • Node memory: 0 or from 256 MB, the processes on this machine leave room for the system, further engines are checked on their own
  • a start that fails names its error and log, not the Node.js version that ends a crash
  • cluster: each further engine gets a settings file with the same database, its own id and ports, and no password
  • PostgreSQL: pgvector must be enabled in the database before the install goes on, enabled there when the server has it
  • cluster and SQLite choices: engine names valid and their own, at least one may lead, the SQLite file a name in the data folder
  • 2.1.5 installer: server name, a self-signed gateway certificate, sample Sutras, steps at once, heartbeat and drain; wrong TLS choices refused
  • 2.1.5: a silent install file may be YAML; sutraflow engine-file writes the settings of an engine joining later, without the password

kafka.test.ts

  • Kafka real-broker activity matrix
  • connects through the Kafka resource
  • publishes and consumes body, key, headers, properties and offsets
  • JSON, XML, text, map and bytes round-trip through Kafka activities
  • malformed JSON and XML fail before processing and commit at the retry ceiling
  • client acknowledgement retries a failure and commits at the configured ceiling
  • auto acknowledgement does not replay a failed Sutra
  • explicit requeue then confirm settles one Kafka offset without a third run
  • explicit reject commits the offset and a missing Confirm retries to the ceiling
  • listener restart and partition concurrency do not duplicate or lose messages

knowledge-admin.test.ts

  • a knowledge base of another project is out of reach until an administrator grants it; areas limit searching and changing
  • removing an area takes only that area, matched with its case: Products/ is not products/ (2.1.6)
  • a step of a granted project searches the knowledge base; a step outside its area is refused
  • one writer per area: a managed source and a granted project cannot both write it
  • managed folder source: new and changed files are added, unchanged skipped, deleted removed; an empty listing removes nothing
  • managed database source: one item per row, text from the columns, details kept; changed rows only; export as a Sutra writes only its area
  • MCP search tool: needs an MCP server with a policy; assistants search only its area

leader.test.ts

  • an engine with SUTRA_CAN_LEAD=0 lets go of the lease and never takes it; others can
  • who may lead and the cluster name are set from the Admin Console, kept in the database, and followed by every engine

logs.test.ts

  • setup: an administrator, a developer and an operator
  • audit retention: an operator reads it; only an administrator changes it or clears the log, and the clearing is recorded
  • project log: developers read it by level and words, and clear it and their test runs on a development server
  • log lines and audit entries say which server, which kind of run, and name the project and Sutra
  • on a production server only an administrator clears project logs

mapping-fields.test.ts

  • rename default target preserves its formula and changes runtime output
  • rename object/list carries descendant fields and all rule options
  • rename rejects sibling conflicts and invalid names without losing mappings

mapping-sources.test.ts

  • mapping names current input and earlier activities with their activity types
  • multiple incoming branches do not falsely identify a unique runtime source
  • streaming and multi-port predecessor outputs are not incorrectly collapsed into current input
  • starter, unknown types and cycles have safe labels without self references

mapping-values.test.ts

  • runtime tree exposes actual scores, never synthesizing the schema-only zone field
  • all runtime payload types are inferred from emitted values without an old-run fallback
  • repeating scalar previews show all small values, not a misleading first-item scalar

mapping207.test.ts

  • typed field edits preserve definitions, descendants and source formulas; deletion is immutable
  • typed runtime/preview detects integer, boolean, required and array count failures
  • deployment checks invalid formulas, missing required targets, stale schema rules and hidden mapping mode
  • JSON allOf retains own properties and reusable required fields; XSD choice is not falsely required
  • sample inference creates browsable JSON/XSD; rejects invalid XML and entities
  • read-only preview API uses project authorization, bounds samples, and never creates runs
  • both new palettes and documented sample processes execute with expected structured and serialized outputs
  • new typed palette rejects a bad runtime value through normal error handling
  • shared JSON validator enforces pattern, format, ranges, extra fields and drafts
  • XSD validator checks reusable repeating choice, optional types, enums and XSD patterns
  • XSD dependencies stay project local and SOAP preserves operation namespaces
  • structured file readers/writers and HTTP reply reject invalid data; no schema preserves behavior
  • Parse/Render JSON and XML enforce selected contracts through real engine execution

mcp.test.ts

  • MCP skills: a Sutra is a tool on an MCP server; Reply to AI returns the outcome

mcpgen-remote.test.ts

  • a personal token builds and tests a database Sutra over MCP on remote PostgreSQL and MySQL

mcpgen218.test.ts

  • the MCP server needs a valid token and lists the studio tools
  • learn what exists: own projects, the palette with fields, connections and properties by name only
  • generate: a new draft that passes its design checks and a test run, marked as generated
  • repair: a broken Sutra is changed through a difference that is saved only when confirmed
  • no secret value through any tool; a generated Sutra reads secrets through properties only
  • each tool against its role, and never another project's items
  • hand over: a deploy needs the plan approved by a person with Deploy

memory.test.ts

  • a finished run is freed: the garbage collector takes its Sutra document, nothing in the engine keeps it
  • documents of runs settled by another engine are dropped once unused
  • work the database lost track of while away is picked up: a run left open with every step ended is closed, a step stuck as running on a live engine runs again
  • a step that fails to prepare (the database away) is no longer listed as running, so the sweep runs it again

memtables.test.ts

  • loads part of a table at first use; Memory get finds a row, fetches a missing one with the lookup query, says missing otherwise
  • Memory put, query and delete; memory-lookup() reads memory in a mapping
  • Delete Memory Records removes a list of keys or records matching fields and a condition
  • failsafe: every change is in the database copy; a restarted engine (or another one) has the rows without asking the source
  • failsafe: a change the database copy did not take is taken back from memory, so a crash loses nothing the engine served
  • limits: memory tables are for small reference data; a load that is too big is refused, rows beyond the limit are dropped
  • Set Memory stays near-linear as a table grows
  • Admin Console: tables with their settings and figures, rows, reload and clear
  • Admin configures refresh schedules and cluster/project quotas
  • a scheduled table recovers when its external source becomes available after startup
  • connection details are cached for the settings refresh time and a change clears them at once
  • engines get a display name in the Admin Console; their id stays the same

message208.test.ts

  • all five message formats round-trip without losing XML namespaces or binary bytes
  • invalid explicit message formats fail closed and retain a safe failed-run envelope
  • malformed receiver payload fails in the engine before business processing
  • multiple starters are rejected by designer validation and direct engine calls
  • database TLS respects strict Boolean tokens and the trusted custom CA

mongodb.test.ts

  • MongoDB BSON types round-trip, invalid documents fail and every exposed activity has a sample
  • a connection Atlas turns away names the cause (IP access list), and no driver text or URI reaches the message
  • Atlas M0 activities use isolated seeded data, strict boundaries and real engine execution
  • seed, find, count, distinct, aggregate and explicit paging
  • update, replace, upsert, deletion guards and empty results
  • bulk write: mixed operations, ordered and unordered failures, guards
  • duplicate keys, strict input/read rejection and no writes on invalid input
  • separate credentials through Secret GV, List Collections, input override and array updates
  • M0 candidate capabilities: transaction rollback, change stream and small GridFS
  • shipped MongoDB sample imports its starter schema and completes its document lifecycle on M0

mysql.test.ts

  • MySQL: create, insert with bound parameters (injection stays data), query, update
  • MySQL: a transaction rolls back every statement when one fails
  • MySQL: stored procedure with parameters; tables dropped afterwards

observability.test.ts

  • metrics: runs, steps by outcome, retries and durations; gauges read when scraped; valid text format
  • gateway: requests counted; every answer carries the run trace; a caller's traceparent is continued
  • traces: a run is a trace with a root span and one span per step, sent to the collector over OTLP
  • JSON log lines on standard output
  • retention: finished runs older than the limit are deleted with their steps; waiting and recent runs stay
  • run again from the failed step: the failed HTTP call is repeated once the service is back

packages.test.ts

  • a package carries every Sutra at its version, connections, schemas, variables; never secret values
  • a changed or foreign file is refused
  • check: missing secrets, addresses used by another project, unknown activities
  • deploy to another project: ids remapped, Sutras deployed, references work, history kept
  • new version, pruning, keep-others and rollback
  • package tests run every Sutra with its test data
  • admin API: package download, check and deploy with the bearer token; sessions still need sign-in
  • command line: package, check, deploy, history, rollback, test, usage errors (local data folder)
  • command line against a running server with the token
  • new project from chosen Sutras of a package: drafts by default (no address clash), name must be new, secrets only warn
  • copy chosen Sutras of a project into a new project, as drafts; the original keeps running

palettes.test.ts

  • JavaScript code step: runs, logs, returns data
  • code sandbox blocks host access, eval, endless loops and memory bombs
  • HTML template escapes values and supports each / if / formulas
  • file activities stay inside their folder; file trigger fires on added, modified and removed

paths217.test.ts

  • steps before a step: lanes, joins and loops
  • step references: templates, formulas, JSONata, code; names with spaces, longest first
  • the lanes example: c sees a, not b (design check and data list)
  • the data list agrees with the rule on every sample step
  • Test and Deploy are refused for a reference to another lane
  • the engine refuses a reference to another lane at run time (a version made before 2.1.7)
  • at run time a step sees only the outputs on its path, and the Error handler sees all
  • a valid run across a join completes with both lanes
  • conditions use only their source step and the steps before it
  • the Error handler may use every step
  • every bundled sample follows the path rule
  • the designer says where each reference comes from (trigger, steps, properties, SQL binding)

payloads.test.ts

  • a large message is stored once: the run carries a reference, each step sees the whole value, the caller gets it whole
  • small inputs are not touched, and an in-memory run keeps its stored parts when it is saved

pem-fixtures.test.ts

  • PEM fixture reader accepts process-only values without reading the configured path
  • PEM fixture file fallback stays compatible and missing settings return no material
  • invalid inline material fails without reflecting its contents in the error

performance.test.ts

  • lock numbers: the same key always gives the same number, other keys others, never the shared lock
  • settings cache: variables are kept for the refresh time, a change on this engine clears them at once, 0 reads every step
  • in memory: steps run without database writes and the whole run is saved when it ends
  • in memory: tests and debugging stay durable; retries and the error port work; a step that waits fails with a clear message
  • in memory: a run can be cancelled while it is in memory
  • memory store: a private database with the full schema
  • tuning: queue check, settings refresh and steps at once in memory apply at once
  • CSV in pieces: any split of the text gives the same rows as the whole text
  • streaming: a big CSV file is read in batches with typed rows, only one batch at a time
  • streaming: lines with skipped rows, no trailing empty line, other encodings
  • Read file with Stream in batches: each batch starts the steps on the batch port, out gives the totals
  • sizing: the profile is the smaller of what the cores and the memory allow
  • streaming with step data none: batch steps keep no input or output; the reader waits for the queue (back pressure)
  • covering indexes exist for the claim and status queries

pgoutage.test.ts

  • after PostgreSQL was cut for a few seconds, the engine reads, writes and finishes runs again
  • while PostgreSQL is cut, a synchronous statement fails at once instead of holding the engine for the whole outage
  • reconnect settings: kept within limits, and a lost connection is tried as often as set

postgres.test.ts

  • every in-process suite passes on PostgreSQL (PGlite)
  • two engines share a real PostgreSQL server

postgresdb.test.ts

  • PostgreSQL: Test connection, create, insert with bound parameters (injection stays data), query, update
  • PostgreSQL: a transaction rolls back every statement when one fails
  • PostgreSQL: an install script with a plpgsql procedure ($$ bodies), then Call procedure and a function

process.test.ts

  • Call Sutra waits for the called Sutra and continues with its Return result
  • Call Sutra: a failure in the called Sutra goes to the error output; fire and forget; recursion is stopped
  • Error handler catches unhandled errors; End with Sutra: error still fails the run
  • Activity loops: for each item collects results; repeat while runs until the condition is false
  • Counter, channels between deployed Sutras, and the circuit breaker

profile218.test.ts

  • a person makes their own token: 30, 60 or 90 days, shown once, acting as them with their roles
  • the studio MCP server with a personal token: her roles, her name in the audit log
  • an expired token is refused and renewed with a new value, same name and period
  • change password at any time; single sign-on people have none to change
  • administrators see and revoke tokens, can switch them off; sign out everywhere, reset and disable end them

project.test.ts

  • project variables, Sutra variables and ops overrides with ${env:}
  • Get Properties reads Project and Engine scopes without exposing project secrets
  • connection-line conditions resolve Project properties and validate missing ones
  • Timer schedules resolve project variables before the leader starts them
  • renaming a project moves its files and deployment configuration
  • ops config file export / import overrides a resource for this environment
  • XSD, JSON Schema and sample JSON become schema trees
  • mapping with For-Each, Choose/When, If and nested functions
  • Render XML from a mapped XSD, and design-time shapes before any run
  • Router takes the first matching route, or all, or otherwise
  • debugger: step one activity at a time, breakpoints, continue
  • project log file records runs, steps and errors

project218.test.ts

  • setup: projects A and B, a developer granted only A, and B's connection, schema and Sutra
  • F3: a request naming two different projects is refused, on every route that reads the project from the body
  • F3: one name, both names equal, and null or empty values settle to the same project
  • F4: a create route sent another item's id is refused, and B's item is unchanged
  • F4: an update keeps its project; a body naming another project is refused
  • the save helpers themselves never move an existing item to another project (imports, Git, config apply)

pyyoutube.test.ts

  • Python is found on this server (py, python3 or python), or the reason says how to install it
  • a Python step reads its parameters and the previous output, and its printed JSON is the result
  • a script file runs with its arguments; a traceback fails the step with its last lines
  • before anything runs: syntax errors, missing files, packages and virtual environments are warnings
  • a refresh token secret signs in an OAuth connection without the studio (Test connection proves it)
  • Google Drive saves a video to a server file, and YouTube uploads that file (streamed, resumable)
  • YouTube channel statistics and an Analytics report
  • Twitch sends the app's client id; stream status tells who is live
  • the ADF, Databricks, Python, YouTube and Twitch templates are complete, described, and the Python file one runs
  • Google Drive: a server file is uploaded streamed (resumable) and fetched back to a server file
  • Google Drive: a CSV is read as it downloads, in batches of rows, never saved to disk

rabbitmq.test.ts

  • RabbitMQ real-broker activity matrix
  • connects through the RabbitMQ resource
  • queue client acknowledgement preserves body, JMS headers, properties, and deduplication
  • JSON, XML, text, map and bytes bodies round-trip
  • malformed JSON and XML fail before processing and respect the retry ceiling
  • auto acknowledgement does not redeliver a failed Sutra
  • client acknowledgement requeues and enforces the delivery ceiling
  • explicit confirm, requeue, reject, and missing Confirm settle correctly
  • TTL and durable topics retain the intended broker semantics
  • listener restart and concurrency do not duplicate or lose messages

rag.test.ts

  • knowledge in ${store}: add, replace, search with folder and detail filters, remove a folder, rebuild
  • pgvector search index: a new table gets it at once, a small knowledge base in a shared table still finds its passages, an existing table is indexed on request
  • a big new source is learned in slices: every passage stored once, in order; replacing still swaps the whole source
  • document text: Word, PowerPoint, Excel, PDF, HTML
  • SharePoint: list a library folder, read a Word file as text, feed a knowledge base

regression.test.ts

  • PostgreSQL lowercased camelCase column names; queries quote them (failures list, approvals)
  • "window" is a reserved word in PostgreSQL: plan usage is counted in a column named win
  • a transaction inside a transaction joined it instead of failing ("cannot start a transaction within a transaction")
  • the first folder table migrated with INSERT ... SELECT ... ON CONFLICT, a syntax error in SQLite that stopped the server
  • a wrong SFTP host key took 25 s to fail (the library retried); it fails at once and is not retried
  • remote paths stayed inside the base folder even with base "/" and ../ in the name
  • an MCP server command in a folder with spaces (Windows) did not start through the shell
  • every AI activity had the 2-minute step limit; models often take longer, so AI steps allow 10 minutes
  • small models answered "tool": "none", "(order_status)" or "final_answer"; the agent understands them
  • a small model called the same tool again and again until the step limit; repeats are not run, and the limit still answers
  • knowledge search missed "returns" for "return" (no stemming)
  • Excel text lost its column tabs (whitespace tidy collapsed them)
  • a message waiting for a person kept the caller waiting the full answer time; it returns a job at once
  • clearing the audit log left two entries (the request and the clearing); now one
  • project variable references were found inside other words ("agv.X") after a backslash was lost in \\b
  • the built-in Git missed an edit of the same size in the same second (it trusted file times)
  • "sutraflow help" made a settings file and printed a path of the machine
  • every sutra command had a description in its help (the guide listed some with none)
  • the user guide had no text for new activities (the guide build listed them as missing)
  • an activity link inside a guide tip ended the tip box early and showed raw [[...]] text
  • guide links to chapters used the chapter id without its ch- prefix and went nowhere
  • a model call failed with ECONNRESET when the server closed an idle keep-alive connection as the call went out; it is sent once more
  • a single backslash in a guide chapter (C:\\SutraFlow) vanished in the page: chapters are template strings
  • X.509 signing of SOAP messages used a method xml-crypto deprecated (a warning on every signed call); the signature is now placed by xml-crypto itself
  • the README test badge said 275 while the suite had grown past 300: it must match the tests in the files
  • a Microsoft connection for one organisation signed in at "common", which such apps refuse (AADSTS50194): the tenant is used
  • a JSON message body written as text with {{...}} values was published as a quoted string, not as the JSON object
  • a release unpacked under a web root (Laragon www) let Apache serve sutraflow.env with the database password: every release carries an .htaccess that denies everything
  • the first big document learned in parallel batches failed: "duplicate key value violates unique constraint pg_type_typname_nsp_index" (several steps made the pgvector table at once)

release.test.ts

  • release activities are off until an administrator allows them
  • a release Sutra: build, check, deploy with a deployment config, then roll back, on this server
  • remote engine: build there, check and deploy there with its token from the vault; refusals go to the error output
  • the Release pipeline sample: build, check, deploy to test, approval, deploy to production

release211.test.ts

  • strict MCP rejects wrong types/ranges/extra fields before creating a run; Off remains descriptive
  • MCP result contracts reject before replying, including a trigger-owned success contract
  • AI guard validates the complete JSON contract and fails closed on missing configuration
  • SOAP strict request/response use actual operation XML; invalid requests never reach the endpoint
  • connection cap is shared by two schedulers, queues excess work and permits another connection
  • stale permits are fenced and recovered, and invalid connection limits are refused

releases.test.ts

  • a release zip holds the package, a deployment config to fill in and a README
  • a config written for the package project fits the project it is deployed under
  • the designer downloads a release zip; an uploaded zip opens with its check and config
  • sutra deploy release.zip creates the project with the zip's deployment config; later configs never change what is there, they list it (2.1.6)
  • replacing a deployed Sutra needs a person: without a terminal sutra deploy stops with exit code 3; --approve with the plan id from sutra check deploys (2.1.6)
  • sutra package --from-git builds a release from the repository files, with no server
  • --ref builds the release from a tag, not from the newest commit
  • a production server refuses deploys from the designer; packages still deploy
  • a release zip's files/ reach the project files folder when deployed with sutra deploy

remote.test.ts

  • paths stay inside the base folder
  • test connection: SFTP shows the host key; a wrong fingerprint and a wrong password are refused; key sign-in works
  • ${proto}: write CSV from rows, append, list and read rows, copy, move, refuse overwrite, delete
  • remote file trigger: a new file starts the Sutra once it stops changing, with its rows; then it is moved
  • time limits: connection attempts with waits, a response limit per operation, and a longer default step limit
  • a big CSV on SFTP is streamed in batches, so only one batch is in memory and the engine keeps serving

remotedb.test.ts

  • external PostgreSQL and MySQL TLS connectors execute bound engine queries and rollback

saml-sso.test.ts

  • SAML sign-on settings expose an AuthnRequest and assertion-consumer address
  • SAML HTTP-POST sign-on verifies the assertion, creates the person and maps groups to roles
  • SAML sign-on refuses unsigned, changed-audience and mismatched browser responses

sample-consistency.test.ts

  • entire bundled catalogue has project-local schemas and consistent starter payload contracts

sample-data.test.ts

  • everything the samples store is named sample_
  • the installer lists and removes the samples and their data, and keeps the site's own
  • the Samples project stays when it holds a connection, schema or property of the site, and the list says why (2.1.6)
  • removal reaches sample_ folders and the old sample files on a Sample SFTP server, and keeps the rest
  • removal drops sample_ objects inside the database a Sample MySQL connection names

sample-import.test.ts

  • sample import waits for flow and shared schema/resource catalog refresh before opening the result
  • failed sample import/refresh is surfaced rather than reporting a fully refreshed import

samples213.test.ts

  • the Functions sample has a formula for every function of the library, by its group
  • the Functions sample runs: each group is mapped, then logged, one group after another
  • the counter sample: local variables as records 1 and 2 in one structure, read back with the run id, a counter kept across runs, every step described; Set Local Variable logs what it set
  • Set Local Variable: steps with one ID add to one record, another ID makes another, no ID keeps plain variables (Sutras before 2.1.3); Get Local Variables reads one ID
  • variable designer catalog preserves plain declarations and record-ID paths without inventing dynamic record names
  • General variable config reads declarations, updates a plain name and reads record pairs; earlier Get results remain snapshots
  • every sample added becomes new Sutras with new ids: in another project, and again in the same project
  • 2.1.4 Traceability sample: one correlation id through intake, the called credit check and the notification hub on a channel
  • 2.1.5 sample: Knowledge feed from a database: published rows become passages with details, unchanged skipped, unpublished removed

schema-contract-inventory.test.ts

  • every schema-aware activity/field is inventoried; new contract fields require boundary review

schema-impact.test.ts

  • proposed schema removal reports downstream broken source references without writing state
  • XSD root and occurrence changes are reported; constraints carry explicit limitations
  • impact endpoint requires authorization and does not expose another project via a body override
  • HTML, Markdown and package documentation resolve schema and connection names safely

scripts.test.ts

  • scripts run only when the administrator allows them
  • Run program: arguments are passed as they are, output and error output captured, JSON read
  • a failing script goes to the error output with its exit code, output and error output
  • PowerShell script: variables, the input file, JSON output and error output
  • Shell script: bash and cmd
  • the Scripts sample runs: PowerShell JSON, a program with an argument

secrets218.test.ts

  • setup: an administrator, projects A and B, a developer granted only A
  • the secret list: a project sees only the names it can use; the whole list needs Secrets, Server settings or Alerts
  • model discovery never sends another project's secret or a raw vault name, but does send A's own and the engine's
  • Test connection of an unsaved connection cannot read B's secret or a raw vault name
  • a step: {{secret.NAME}} works only for names behind A's or the engine's Secret properties
  • the reader itself: in a project's work only its and the engine's names; outside, server-level reads still work
  • upgrade check: a connection or Sutra naming a stored secret directly is listed for administrators only
  • a release that names a stored secret directly stops the deploy check
  • a project property cannot read the server environment (SUTRA_ADMIN_TOKEN) unless an administrator allowed the name
  • a developer cannot point a Secret property of A at B's stored secret, or at a server secret without Manage secrets

security210.test.ts

  • a mapping path can never reach the object prototype, and an inherited flag never grants a permission
  • a step cannot use a connection of another project; shared connections stay usable
  • a Git repository cannot make the import read a file outside it
  • the sign-in return path can never carry a script or leave this server
  • two identity realms with the same subject are different owners of jobs and conversations
  • an archive is read only within per-entry, total and entry-count limits, measured on what it really unpacks to

sso.test.ts

  • single sign-on: settings are checked, and the sign-in button appears once it is on
  • single sign-on: a new person gets an account with the roles of their groups; the session works
  • single sign-on refuses forged or mismatched sign-ins and existing names
  • single sign-on can link an existing local account when the administrator allows it; the last administrator stays

stage217.test.ts

  • each source and version has its stage; the client is recorded (${ADMIN ? 'PostgreSQL' : 'SQLite'})
  • runs started by the studio, the Run API, the CLI and a trigger get their stage and client; a child takes its caller's stage
  • figures and traces leave out design runs; the Design / Runtime / All filter in Traceability and Runs
  • the upgrade fills the stage of older runs from source and version, in batches
  • retention: design runs are kept for their own time; runtime runs as before

strict208.test.ts

  • checkbox defaults and literal/property Boolean tokens have one strict interpretation
  • all JSON/XML parsers, renderers and typed mappers reject On without a schema in engine and Deploy
  • XML/JSON checked validation rejects missing fields, wrong-kind contracts and invalid GV flags; Off stays Off
  • strict JSON samples require fields and reject undeclared/nested fields and wrong types
  • process documentation includes defaults, inactive settings, full mapping rules and property expressions without credentials
  • keyword-only and Boolean JSON Schemas are validation contracts, not sample payloads

sutras.test.ts

  • sample Sutras: For-Each mapping, activity loops, sub-Sutra, try and catch
  • AI engines: OpenAI, Gemini, Ollama and a command-line tool return text plus provider, model and tokens
  • Test connection: HTTP, database, mail failure, with project variables resolved
  • Engine properties are read-only for Sutras
  • no third-party product names in the code, docs or guide
  • connections: names, "when" conditions on the previous output, and "otherwise"
  • sample mappings ship shared schemas and reuse them on repeated import
  • more samples across the palettes run as tests (REST, files, database, XML, transform, routing, channels, counter)
  • samples for every starter and palette: timer, file trigger, text formats, SQL update, SOAP call, scripts
  • every sample uses only pipes and functions that exist
  • every source file carries the copyright and AGPL licence header with its version

sweep218.test.ts

  • route table: every route without a project is reviewed, and every reviewed one still exists
  • setup: projects A and B, a developer granted only A, and B's WSDL, security profile, memory table, conversation and alerts
  • WSDL describe: needs a project, reads only its WSDLs, its or shared connections, and http(s) addresses
  • Check (flows/validate) needs a project the caller designs in
  • packages: testing or opening a package for B needs Deploy on B
  • Admin Console reads show the caller's projects only: memory tables, conversations, alerts

template.test.ts

  • whole-field references keep their type
  • text with several references becomes a string
  • pipes
  • pipes with separators inside quotes
  • resolveDeep and setPath

test-session.test.ts

  • stop requests cancellation before confirming terminal state and clearing previews
  • failed cancellation preserves controls; a race with normal completion is safe
  • real engine stop cancels waiting and paused tests without executing downstream steps

trace.test.ts

  • traceability: Sutras by run outcome per project, runs found by a value in their input or by who started them, and who started each run
  • traceability: a run that called another (Call Sutra) links to it, and the called run back to its caller

tuning.test.ts

  • engine tuning: for all engines and for one, applied at once; wrong values refused; empty returns to the default
  • Runs at once: extra runs wait in a queue and start when one ends
  • priority: steps of higher priority Sutras are taken from the queue first
  • default retries for steps without their own; run time limit; step data kept or not
  • per-Sutra run retention; restart keeps it started; viewers may not tune
  • the console actions from the sutra command: list, stop, start, restart, tune, runs, engines, tokens

validation-samples.test.ts

  • validation catalogue covers new activities, explicit strict reads and described, reusable contracts
  • every connection-free validation and mapping sample runs; rejection samples take their expected invalid branch
  • sample file read checkbox rejects invalid JSON/XML only when checked, including missing and mismatched contracts
  • sample REST/HTTP client and SOAP server enforce real ingress, egress, namespaces and no-run-on-invalid boundaries
  • authorized invalid REST/SOAP callers receive relevant errors without a run; unauthorized callers get no schema details

validation.test.ts

  • REST bodies are checked against a JSON Schema, a JSON sample and an XSD before a run starts
  • SOAP operations are checked against their XSD element; a bad request gets a Client fault
  • threat protection: depth before parsing, DOCTYPE, fields, list items, text length and body size

variables.test.ts

  • every palette uses the common project-variable resolver for General settings
  • every process starter is identified consistently in the Designer palette
  • nested connection properties resolve while step-time secret references remain intact
  • PEM connection fields accept exact Project and Engine properties without templating certificate text

vendor.test.ts

  • the committed vendor policy and trees pass the offline build gate
  • the maintained ACME client still provides SutraFlow certificate APIs

websocket.test.ts

  • a WebSocket service answers each message on its connection, in order, and runs on open and close
  • WebSocket security: the policy at connect (key in a header or the query), origins, scopes and message checks
  • broadcast to every connection of a service, and messages for connections held by other engines
  • 2.1.4: a connection is registered before it opens; the connections and messages of a dead engine go; old messages are not sent to new clients
  • WebSocket client: the send step waits for its answer, and the trigger reconnects and subscribes again

wss.test.ts

  • X.509 signed requests: a certificate issued by a trusted CA passes; untrusted, changed or unsigned ones do not
  • SAML assertions: signed by the identity provider, from the right issuer, for this audience, in time
  • timestamps: an expired one is refused, and a required one must be there
  • XML encryption: requests encrypted for the service are decrypted; signed then encrypted works; RSA 1.5 and wrong keys are refused
  • SOAP responses encrypt for the verified caller certificate or a configured certificate
  • an Invoke SOAP service step signs and encrypts with its outbound security profile