Exact Scalar Text Edit Alignment
Generate a minimum unit-edit alignment of two supplied short texts with deterministic ties, scalar/UTF-16/UTF-8 spans, exact digests and a fully guarded text-edits-apply request. Preserves every supplied scalar and newline without normalization.
data-assurance · Operation ID: text-edit-align
Choose this operation when
- Produce a complete reproducible minimum unit-edit script and consumer-ready guarded edit request
Outside this profile
- Line, token, grapheme or semantic alignment; fuzzy anchoring or transposition distance
- Long documents or more than 200 separated changed blocks
- Network requests, file changes, external execution, publishing or deployment
Exact release references
Static JSON contract · Markdown reference · Fixed example response
Complete input schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"before": {
"type": "string",
"maxLength": 1024
},
"after": {
"type": "string",
"maxLength": 1024
}
},
"required": [
"before",
"after"
],
"additionalProperties": false
}
Complete output-envelope schema
{
"type": "object",
"required": [
"operation",
"version",
"result",
"provenance"
],
"properties": {
"operation": {
"const": "text-edit-align",
"type": "string"
},
"version": {
"const": "0.29.0",
"type": "string"
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"profile": {
"type": "string",
"const": "scalar-unit-edit-alignment-v1"
},
"tieOrder": {
"type": "array",
"prefixItems": [
{
"type": "string",
"const": "equal"
},
{
"type": "string",
"const": "substitute"
},
{
"type": "string",
"const": "delete"
},
{
"type": "string",
"const": "insert"
}
],
"items": false,
"minItems": 4,
"maxItems": 4
},
"distance": {
"type": "integer",
"minimum": 0,
"maximum": 512
},
"counts": {
"type": "object",
"properties": {
"insertions": {
"type": "integer",
"minimum": 0,
"maximum": 512
},
"deletions": {
"type": "integer",
"minimum": 0,
"maximum": 512
},
"substitutions": {
"type": "integer",
"minimum": 0,
"maximum": 512
}
},
"required": [
"insertions",
"deletions",
"substitutions"
],
"additionalProperties": false
},
"before": {
"type": "object",
"properties": {
"scalar": {
"type": "integer",
"minimum": 0,
"maximum": 512
},
"utf16": {
"type": "integer",
"minimum": 0,
"maximum": 1024
},
"utf8": {
"type": "integer",
"minimum": 0,
"maximum": 2048
}
},
"required": [
"scalar",
"utf16",
"utf8"
],
"additionalProperties": false
},
"after": {
"type": "object",
"properties": {
"scalar": {
"type": "integer",
"minimum": 0,
"maximum": 512
},
"utf16": {
"type": "integer",
"minimum": 0,
"maximum": 1024
},
"utf8": {
"type": "integer",
"minimum": 0,
"maximum": 2048
}
},
"required": [
"scalar",
"utf16",
"utf8"
],
"additionalProperties": false
},
"beforeSha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"afterSha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"digestEncoding": {
"type": "string",
"const": "exact-utf8"
},
"dpCellCount": {
"type": "integer",
"minimum": 0,
"maximum": 262144
},
"operations": {
"maxItems": 1024,
"type": "array",
"items": {
"type": "object",
"properties": {
"op": {
"type": "string",
"enum": [
"equal",
"substitute",
"delete",
"insert"
]
},
"source": {
"type": "object",
"properties": {
"scalar": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
],
"items": false,
"minItems": 2,
"maxItems": 2
},
"utf16": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
],
"items": false,
"minItems": 2,
"maxItems": 2
},
"utf8": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
],
"items": false,
"minItems": 2,
"maxItems": 2
}
},
"required": [
"scalar",
"utf16",
"utf8"
],
"additionalProperties": false
},
"target": {
"type": "object",
"properties": {
"scalar": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
],
"items": false,
"minItems": 2,
"maxItems": 2
},
"utf16": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
],
"items": false,
"minItems": 2,
"maxItems": 2
},
"utf8": {
"type": "array",
"prefixItems": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
],
"items": false,
"minItems": 2,
"maxItems": 2
}
},
"required": [
"scalar",
"utf16",
"utf8"
],
"additionalProperties": false
},
"sourceText": {
"type": "string"
},
"targetText": {
"type": "string"
}
},
"required": [
"op",
"source",
"target",
"sourceText",
"targetText"
],
"additionalProperties": false
}
},
"applyRequest": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"expectedSha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"edits": {
"maxItems": 200,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"start": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"end": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"expected": {
"type": "string"
},
"replacement": {
"type": "string"
}
},
"required": [
"id",
"start",
"end",
"expected",
"replacement"
],
"additionalProperties": false
}
}
},
"required": [
"text",
"expectedSha256",
"edits"
],
"additionalProperties": false
},
"consumerValidated": {
"type": "boolean",
"const": true
},
"externalRequests": {
"type": "number",
"const": 0
}
},
"required": [
"profile",
"tieOrder",
"distance",
"counts",
"before",
"after",
"beforeSha256",
"afterSha256",
"digestEncoding",
"dpCellCount",
"operations",
"applyRequest",
"consumerValidated",
"externalRequests"
],
"additionalProperties": false
},
"provenance": {
"type": "object",
"required": [
"inputSha256",
"outputSha256",
"deterministic",
"externalRequests"
],
"properties": {
"inputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"outputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"deterministic": {
"const": true
},
"externalRequests": {
"const": 0
}
}
}
},
"additionalProperties": false
}
Fixed example
One accepted fixed example, not a custom-input trial. No operation runs when this static page is requested.
Example input
{
"before": "A😀cat\n",
"after": "A😀cut!\n"
}
Example response
{
"operation": "text-edit-align",
"version": "0.29.0",
"result": {
"profile": "scalar-unit-edit-alignment-v1",
"tieOrder": [
"equal",
"substitute",
"delete",
"insert"
],
"distance": 2,
"counts": {
"insertions": 1,
"deletions": 0,
"substitutions": 1
},
"before": {
"scalar": 6,
"utf16": 7,
"utf8": 9
},
"after": {
"scalar": 7,
"utf16": 8,
"utf8": 10
},
"beforeSha256": "c413f26d179faf31f2918a1c080a2004c7ee7f9bee8f1a2138342a9d56e078b6",
"afterSha256": "adcffe9889029b9ee89f1d701983df061893f2e639ff91db6ffcad296cff2911",
"digestEncoding": "exact-utf8",
"dpCellCount": 56,
"operations": [
{
"op": "equal",
"source": {
"scalar": [
0,
3
],
"utf16": [
0,
4
],
"utf8": [
0,
6
]
},
"target": {
"scalar": [
0,
3
],
"utf16": [
0,
4
],
"utf8": [
0,
6
]
},
"sourceText": "A😀c",
"targetText": "A😀c"
},
{
"op": "substitute",
"source": {
"scalar": [
3,
4
],
"utf16": [
4,
5
],
"utf8": [
6,
7
]
},
"target": {
"scalar": [
3,
4
],
"utf16": [
4,
5
],
"utf8": [
6,
7
]
},
"sourceText": "a",
"targetText": "u"
},
{
"op": "equal",
"source": {
"scalar": [
4,
5
],
"utf16": [
5,
6
],
"utf8": [
7,
8
]
},
"target": {
"scalar": [
4,
5
],
"utf16": [
5,
6
],
"utf8": [
7,
8
]
},
"sourceText": "t",
"targetText": "t"
},
{
"op": "insert",
"source": {
"scalar": [
5,
5
],
"utf16": [
6,
6
],
"utf8": [
8,
8
]
},
"target": {
"scalar": [
5,
6
],
"utf16": [
6,
7
],
"utf8": [
8,
9
]
},
"sourceText": "",
"targetText": "!"
},
{
"op": "equal",
"source": {
"scalar": [
5,
6
],
"utf16": [
6,
7
],
"utf8": [
8,
9
]
},
"target": {
"scalar": [
6,
7
],
"utf16": [
7,
8
],
"utf8": [
9,
10
]
},
"sourceText": "\n",
"targetText": "\n"
}
],
"applyRequest": {
"text": "A😀cat\n",
"expectedSha256": "c413f26d179faf31f2918a1c080a2004c7ee7f9bee8f1a2138342a9d56e078b6",
"edits": [
{
"id": "e000",
"start": 4,
"end": 5,
"expected": "a",
"replacement": "u"
},
{
"id": "e001",
"start": 6,
"end": 6,
"expected": "",
"replacement": "!"
}
]
},
"consumerValidated": true,
"externalRequests": 0
},
"provenance": {
"inputSha256": "f90c8be8123103b347d0ea86db5571ec73dfb0a46de190ba7f761b4787aa2cad",
"outputSha256": "346e06c8ac2c43944f12e853e875b8d69f68f31225ee4b36876ffc2c2b278d7a",
"deterministic": true,
"externalRequests": 0
}
}
Bounds and precision
JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.
{
"global": {
"requestBytes": 131072,
"responseBytes": 524288,
"jsonDepth": 32,
"jsonNodes": 20000,
"requestsPerMinute": 60,
"paidAttemptsPerMinute": 20,
"idempotencyHours": 24
},
"operation": {
"inputBytes": 100000,
"outputBytes": 300000,
"jsonNodes": 12000,
"depth": 20,
"dpCells": 262144,
"textScalars": 512,
"atomicSteps": 1024,
"editBlocks": 200,
"editOffsetUnit": "utf16-code-units",
"alignmentUnit": "unicode-scalars",
"tieOrder": "equal,substitute,delete,insert"
}
}
Complete schemas, descriptions and cross-field validation may impose additional limits.
Proposed price and protocol definitions
{
"unit": "one successful operation call",
"proposedNominalUsd": "0.006",
"sixDecimalTokenBaseUnits": "6000",
"subscription": false,
"includesPayerWalletOrNetworkFees": false,
"liveQuoteVerified": false,
"condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
}
Protocol definitions: x402, mpp. MPP uses Tempo charge. Paid MCP execution is unsupported. All runtime readiness is not evaluated in this build.
API path templates, not endpoints on this documentation host
{
"x402": "/v1/x402/text-edit-align",
"mpp": "/v1/mpp/text-edit-align"
}
Required headers
{
"Content-Type": "application/json",
"Idempotency-Key": "random 16–128 character operation identifier"
}
Actual SDK challenge amount, asset, network, recipient and wallet costs must pass independent authorization. Preserve identical key, body, protocol and credential on retries; on PAYMENT_UNCERTAIN stop and reconcile.
Execution profile and provider conditions
{
"deterministic": true,
"externalRequests": 0,
"maxExternalRequests": 0,
"resultSnapshotPersisted": false,
"fixedExampleIsIllustrativeSnapshot": false,
"requiresPayment": true,
"supportsMcpExecution": false
}
Deterministic supplied-input operation with no external requests or stored request/result bodies. Payment infrastructure retains payment metadata and hashes.
Failure handling
- HTTP 400: Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch Correct the request before payment
- HTTP 402: Payment challenge or rejected payment Use official protocol SDK; inspect payment outcome before another payment
- HTTP 409: Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay
- HTTP 413: Input or generated output too large Reduce input; no payment attempted for validation failure
- HTTP 415: Unsupported media type or compression Send uncompressed application/json
- HTTP 422: Schema or service-specific semantic validation failure Correct input using returned error code; no payment attempted
- HTTP 429: Request/payment-attempt rate exceeded Wait for rate limit window; preserve existing payment identity
- HTTP 503: Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation
Declared requirements
Before any paid call, refresh the live operation contract and POST the complete bounded budgeted plan to the separate API's /preflight. Unknown requirements block selection; compatible preflight is not permission to spend.