{
  "id": "text-boundary-segment",
  "name": "Literal-boundary UTF-8 windows",
  "description": "Create source-preserving UTF-8-byte-bounded text windows with literal double-LF, LF and ASCII-space cut priority, scalar-safe overlap, exact UTF-16/UTF-8 spans and an aggregate duplication budget.",
  "category": "text",
  "priceUsd": "0.004",
  "pricingStatus": "proposed-unverified",
  "pricing": {
    "unit": "one successful operation call",
    "proposedNominalUsd": "0.004",
    "sixDecimalTokenBaseUnits": "4000",
    "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."
  },
  "intents": [
    "split text into byte bounded windows",
    "segment document at literal line boundaries",
    "create chunks with exact source spans and overlap budget"
  ],
  "whenToUse": [
    "Creating scalar-safe UTF-8 payload windows from supplied Unicode text",
    "Favoring literal double-LF, LF and ASCII-space boundaries with exact core reconstruction",
    "Bounding aggregate source-byte duplication independently of per-chunk overlap"
  ],
  "whenNotToUse": [
    "Model tokenizer limits, token costs, embedding or semantic retrieval",
    "Sentence, grapheme, word, CommonMark or Unicode line segmentation",
    "Source authenticity, linguistic understanding, normalization or privacy redaction",
    "Fetching sources, writing files, model calls, target execution or changing external state"
  ],
  "capabilities": [
    "Half-open absolute UTF-16 and UTF-8 source/core spans",
    "Nonoverlapping advancing cores with longest scalar-safe preceding-source suffix",
    "Literal boundary priority in the final half of each reserved core byte window",
    "Atomic chunk, returned-text, serialized-output and duplication admission",
    "Deterministic supplied-input-only inert artifact; no network, clock, randomness or external state change"
  ],
  "related": [
    "text-chunk",
    "document-chunk-audit",
    "context-budget-pack"
  ],
  "limits": {
    "inputBytes": 100000,
    "outputBytes": 300000,
    "jsonNodes": 10000,
    "depth": 20,
    "profile": "literal-boundary-utf8-windows-v1",
    "textUtf8Bytes": 60000,
    "textUtf16Units": 60000,
    "maxChunkBytes": 8192,
    "minChunkBytes": 8,
    "overlapBytes": 2048,
    "minimumCoreCapacity": 4,
    "maxDuplicatedBytes": 60000,
    "chunks": 512,
    "returnedTextUtf8Bytes": 120000,
    "boundarySearchProbes": 20000
  },
  "errorCodes": [
    "INPUT_LIMIT",
    "OUTPUT_LIMIT",
    "COMPLEXITY_LIMIT",
    "INVALID_JSON",
    "INVALID_NUMBER",
    "INVALID_UNICODE",
    "UNSAFE_KEY",
    "INVALID_INPUT",
    "TEXT_CAPACITY",
    "TEXT_BYTES_LIMIT",
    "TEXT_CHUNK_LIMIT",
    "TEXT_DUPLICATION_LIMIT",
    "TEXT_RETURNED_BYTES_LIMIT",
    "TEXT_WORK_LIMIT"
  ],
  "requirementsProfile": {
    "format": "declared-requirements-v1",
    "facts": {
      "execution.suppliedCode": false,
      "execution.remoteMutation": false,
      "execution.llmInference": false,
      "execution.paidMcp": false,
      "verification.semanticTruth": false,
      "verification.sourceAuthenticity": false,
      "verification.liveVulnerabilities": false,
      "numbers.arbitraryPrecisionJson": false,
      "numbers.model": "ieee754-binary64",
      "privacy.requestBodyPersisted": false,
      "execution.deterministic": true,
      "execution.networkAccess": false,
      "privacy.resultBodyPersisted": false,
      "payment.x402": true,
      "payment.mpp": true,
      "operation.id": "text-boundary-segment",
      "operation.category": "text",
      "limit.httpRequestBytes": 131072,
      "limit.requestBytes": 100000,
      "limit.responseBytes": 524288,
      "limit.resultBytes": 300000,
      "limit.jsonDepth": 20,
      "limit.jsonNodes": 10000,
      "segmentation.profile": "literal-boundary-utf8-windows-v1",
      "segmentation.measure": "utf8-bytes",
      "segmentation.scalarSafe": true,
      "segmentation.graphemeSafe": false,
      "segmentation.sentenceBoundaries": false,
      "segmentation.modelTokenLimit": false,
      "segmentation.linguisticQualityGuaranteed": false,
      "segmentation.normalizesText": false,
      "segmentation.corePartitionExact": true,
      "segmentation.maxSourceBytes": 60000,
      "segmentation.maxSourceUtf16Units": 60000,
      "segmentation.minChunkBytes": 8,
      "segmentation.maxChunkBytes": 8192,
      "segmentation.maxOverlapBytes": 2048,
      "segmentation.maxDuplicatedBytes": 60000,
      "segmentation.maxChunks": 512,
      "segmentation.maxBoundarySearchProbes": 20000,
      "segmentation.maxReturnedTextBytes": 120000,
      "segmentation.boundaryPolicy": "double-lf,lf,ascii-space,scalar-limit,end",
      "segmentation.offsets": "half-open-utf16-and-utf8",
      "input.text.maxLength": 60000,
      "input.maxChunkBytes.maximum": 8192,
      "input.maxChunkBytes.minimum": 8,
      "input.overlapBytes.maximum": 2048,
      "input.overlapBytes.minimum": 0,
      "input.maxDuplicatedBytes.maximum": 60000,
      "input.maxDuplicatedBytes.minimum": 0
    },
    "unknownPolicy": "Undeclared requirements are unknown, never compatible. Matching declared facts does not establish semantic fit or input validity.",
    "preflight": "/preflight"
  },
  "documentation": "/reference/tools/text-boundary-segment.md",
  "serviceContract": "/reference/services/text-boundary-segment.json",
  "errors": [
    {
      "status": 400,
      "meaning": "Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch",
      "retry": "Correct the request before payment"
    },
    {
      "status": 402,
      "meaning": "Payment challenge or rejected payment",
      "retry": "Use official protocol SDK; inspect payment outcome before another payment"
    },
    {
      "status": 409,
      "meaning": "Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN",
      "retry": "Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay"
    },
    {
      "status": 413,
      "meaning": "Input or generated output too large",
      "retry": "Reduce input; no payment attempted for validation failure"
    },
    {
      "status": 415,
      "meaning": "Unsupported media type or compression",
      "retry": "Send uncompressed application/json"
    },
    {
      "status": 422,
      "meaning": "Schema or service-specific semantic validation failure",
      "retry": "Correct input using returned error code; no payment attempted"
    },
    {
      "status": 429,
      "meaning": "Request/payment-attempt rate exceeded",
      "retry": "Wait for rate limit window; preserve existing payment identity"
    },
    {
      "status": 503,
      "meaning": "Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement",
      "retry": "Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation"
    }
  ],
  "numericPrecision": "JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.",
  "paymentWorkflow": {
    "discoveryOnly": false,
    "supportedProtocols": [
      "x402",
      "mpp"
    ],
    "x402": {
      "credentialHeader": "PAYMENT-SIGNATURE",
      "challengeHeader": "PAYMENT-REQUIRED",
      "receiptHeader": "PAYMENT-RESPONSE",
      "version": 2,
      "scheme": "exact",
      "paymentIdentifier": "payment-identifier extension MUST equal the HTTP Idempotency-Key",
      "sdk": "@x402/core with @x402/evm"
    },
    "mpp": {
      "supported": true,
      "credentialHeader": "Authorization",
      "challengeHeader": "WWW-Authenticate",
      "receiptHeader": "Payment-Receipt",
      "method": "tempo",
      "intent": "charge",
      "sdk": "mppx",
      "tokenDecimals": 6
    },
    "steps": [
      "Check configured readiness and the exact service schema",
      "Generate a fresh random Idempotency-Key for this operation; never use a discovery probe fixture for purchases",
      "Send valid input without a credential to obtain the official protocol challenge",
      "Use the official SDK and authorized wallet to fulfill the challenge",
      "Retry only with identical key, body, protocol and credential",
      "On PAYMENT_UNCERTAIN stop and request operator reconciliation; never blindly pay again"
    ],
    "versionedRetries": "Request fingerprint includes service release version. Retries across a version upgrade can conflict; coordinate upgrades outside the 24-hour replay window and reconcile pending attempts.",
    "docs": "/llms.txt"
  },
  "method": "POST",
  "paths": {
    "x402": "/v1/x402/text-boundary-segment",
    "mpp": "/v1/mpp/text-boundary-segment"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "maxLength": 60000
      },
      "maxChunkBytes": {
        "type": "integer",
        "minimum": 8,
        "maximum": 8192
      },
      "overlapBytes": {
        "type": "integer",
        "minimum": 0,
        "maximum": 2048
      },
      "maxDuplicatedBytes": {
        "type": "integer",
        "minimum": 0,
        "maximum": 60000
      }
    },
    "required": [
      "text",
      "maxChunkBytes",
      "overlapBytes",
      "maxDuplicatedBytes"
    ],
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "operation",
      "version",
      "result",
      "provenance"
    ],
    "properties": {
      "operation": {
        "const": "text-boundary-segment",
        "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": "literal-boundary-utf8-windows-v1"
          },
          "sourceBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 60000
          },
          "returnedTextBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 120000
          },
          "duplicatedBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 60000
          },
          "chunks": {
            "maxItems": 512,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "end": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "startByte": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "endByte": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "coreStart": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "coreEnd": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "coreStartByte": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "coreEndByte": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 60000
                },
                "text": {
                  "type": "string",
                  "maxLength": 8192
                },
                "utf8Bytes": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 8192
                },
                "overlapBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2048
                },
                "boundary": {
                  "type": "string",
                  "enum": [
                    "double-lf",
                    "lf",
                    "ascii-space",
                    "scalar-limit",
                    "end"
                  ]
                }
              },
              "required": [
                "start",
                "end",
                "startByte",
                "endByte",
                "coreStart",
                "coreEnd",
                "coreStartByte",
                "coreEndByte",
                "text",
                "utf8Bytes",
                "overlapBytes",
                "boundary"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "profile",
          "sourceBytes",
          "returnedTextBytes",
          "duplicatedBytes",
          "chunks"
        ],
        "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
  },
  "exampleInput": {
    "text": "A😀 B C",
    "maxChunkBytes": 8,
    "overlapBytes": 2,
    "maxDuplicatedBytes": 1
  },
  "exampleResponse": {
    "operation": "text-boundary-segment",
    "version": "0.29.0",
    "result": {
      "profile": "literal-boundary-utf8-windows-v1",
      "sourceBytes": 9,
      "returnedTextBytes": 10,
      "duplicatedBytes": 1,
      "chunks": [
        {
          "start": 0,
          "end": 4,
          "startByte": 0,
          "endByte": 6,
          "coreStart": 0,
          "coreEnd": 4,
          "coreStartByte": 0,
          "coreEndByte": 6,
          "text": "A😀 ",
          "utf8Bytes": 6,
          "overlapBytes": 0,
          "boundary": "ascii-space"
        },
        {
          "start": 3,
          "end": 7,
          "startByte": 5,
          "endByte": 9,
          "coreStart": 4,
          "coreEnd": 7,
          "coreStartByte": 6,
          "coreEndByte": 9,
          "text": " B C",
          "utf8Bytes": 4,
          "overlapBytes": 1,
          "boundary": "end"
        }
      ]
    },
    "provenance": {
      "inputSha256": "96f0ba6f9e9528c0885e699141905fb70393489c27189f4aecbc5c5ec38c1602",
      "outputSha256": "6f7758dd5b440e564c1865a1407a6a63ed19a29762fb88f4f85adb4c4f1d82f1",
      "deterministic": true,
      "externalRequests": 0
    }
  },
  "requiredHeaders": {
    "Content-Type": "application/json",
    "Idempotency-Key": "random 16–128 character operation identifier"
  },
  "fixedExample": "/reference/examples/text-boundary-segment.json",
  "execution": {
    "deterministic": true,
    "externalRequests": 0,
    "maxExternalRequests": 0,
    "resultSnapshotPersisted": false,
    "fixedExampleIsIllustrativeSnapshot": false,
    "requiresPayment": true,
    "supportsMcpExecution": false
  },
  "releaseSnapshot": {
    "format": "static-release-reference-v1",
    "sourceVersion": "0.29.0",
    "sourceRegistrySha256": "a2b5ec09bf6c38b9d2879d746a4fded374f5928b445377b0270ef6aa8e6cac65",
    "generatedAt": "2026-10-06T15:38:00Z",
    "releaseAcceptance": "not-verified-by-generator",
    "runtimeReadiness": "not-evaluated",
    "livePaymentsVerified": false,
    "indexingVerified": false,
    "apiOrigin": null,
    "notice": "Build-time release reference. Runtime readiness, deployment, payment settlement and external indexing are not evaluated here. Prices are proposed; this file cannot authorize execution or payment."
  }
}
