Unicode Evidence Offset Mapping
Translate caller-supplied UTF-8 byte, UTF-16 code-unit or Unicode code-point offsets into all three coordinate systems and LF-based line/column positions. Only exact scalar boundaries are valid; text is never normalized or rewritten.
document-assurance · Operation ID: text-offset-map
Choose this operation when
- Reconcile byte and character offsets from different extraction tools
- Convert annotation spans between UTF-8 UTF-16 and code-point systems
Outside this profile
- Grapheme cluster, display-width, tokenizer or normalization mapping
- Offsets into binary files or malformed Unicode
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": {
"text": {
"type": "string",
"maxLength": 90000
},
"from": {
"type": "string",
"enum": [
"utf16",
"utf8",
"codepoint"
]
},
"offsets": {
"maxItems": 1000,
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 360000
}
}
},
"required": [
"text",
"from",
"offsets"
],
"additionalProperties": false
}
Complete output-envelope schema
{
"type": "object",
"required": [
"operation",
"version",
"result",
"provenance"
],
"properties": {
"operation": {
"const": "text-offset-map",
"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": "unicode-scalar-offset-map-v1"
},
"points": {
"type": "array",
"items": {
"type": "object",
"properties": {
"input": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"utf16": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"utf8": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"codepoint": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"line": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"column": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input",
"utf16",
"utf8",
"codepoint",
"line",
"column"
],
"additionalProperties": false
}
},
"totals": {
"type": "object",
"properties": {
"utf16": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"utf8": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"codepoint": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"lines": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"utf16",
"utf8",
"codepoint",
"lines"
],
"additionalProperties": false
},
"lineConvention": {
"type": "string",
"const": "1-based-LF-lines-codepoint-columns"
}
},
"required": [
"profile",
"points",
"totals",
"lineConvention"
],
"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
{
"text": "A😀\né",
"from": "utf8",
"offsets": [
0,
1,
5,
6,
8
]
}
Example response
{
"operation": "text-offset-map",
"version": "0.29.0",
"result": {
"profile": "unicode-scalar-offset-map-v1",
"points": [
{
"input": 0,
"utf16": 0,
"utf8": 0,
"codepoint": 0,
"line": 1,
"column": 1
},
{
"input": 1,
"utf16": 1,
"utf8": 1,
"codepoint": 1,
"line": 1,
"column": 2
},
{
"input": 5,
"utf16": 3,
"utf8": 5,
"codepoint": 2,
"line": 1,
"column": 3
},
{
"input": 6,
"utf16": 4,
"utf8": 6,
"codepoint": 3,
"line": 2,
"column": 1
},
{
"input": 8,
"utf16": 5,
"utf8": 8,
"codepoint": 4,
"line": 2,
"column": 2
}
],
"totals": {
"utf16": 5,
"utf8": 8,
"codepoint": 4,
"lines": 2
},
"lineConvention": "1-based-LF-lines-codepoint-columns"
},
"provenance": {
"inputSha256": "b96469ff1344750024c3ccbbc17e975ddfefb337ec5759bfd1515689289beee8",
"outputSha256": "1fd72d8c7258d8e48f78132366cde6e3eceece17efe526d8cf9b606f512113ee",
"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": 400000,
"jsonNodes": 8000,
"depth": 20,
"findings": 200,
"offsets": 1000,
"textCodeUnits": 90000,
"lineConvention": "1-based-LF-lines-codepoint-columns"
}
}
Complete schemas, descriptions and cross-field validation may impose additional limits.
Proposed price and protocol definitions
{
"unit": "one successful operation call",
"proposedNominalUsd": "0.003",
"sixDecimalTokenBaseUnits": "3000",
"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-offset-map",
"mpp": "/v1/mpp/text-offset-map"
}
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.