{
  "id": "structured-log-template-pack",
  "name": "Explicit scalar log templates",
  "description": "Factor supplied JSON log records into exact literal templates and typed caller-selected scalar occurrences, preserving parsed values and record order for client reconstruction.",
  "category": "structured",
  "priceUsd": "0.005",
  "pricingStatus": "proposed-unverified",
  "pricing": {
    "unit": "one successful operation call",
    "proposedNominalUsd": "0.005",
    "sixDecimalTokenBaseUnits": "5000",
    "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": [
    "pack structured logs into reversible templates",
    "factor exact JSON log shapes",
    "extract caller-selected scalar log parameters"
  ],
  "whenToUse": [
    "Preserve every parsed JSON log value in exact literal templates and ordered occurrences",
    "Select scalar parameter pointers explicitly and reconstruct original records on the client"
  ],
  "whenNotToUse": [
    "Semantic log grouping, anomaly detection, root cause, severity or incident diagnosis",
    "Automatic timestamp, identifier, UUID, IP or secret detection and redaction",
    "Guaranteed compression, lower model token cost, authenticated history or safer sharing",
    "Preserving source member order, duplicate keys, numeric token spelling or pre-parse precision",
    "Network access, filesystem changes, target execution, publishing or deployment"
  ],
  "capabilities": [
    "Template equality includes every unselected literal, array order, present parameter pointers and scalar types",
    "Caller pointer order defines slots; first occurrence defines template indexes; record order is preserved",
    "Exact canonical structural keys distinguish null, absence, booleans, numbers and strings",
    "No automatic secret redaction: all original values remain in the artifact",
    "Pure supplied-input computation; complete bounded result admission before challenge; no external requests"
  ],
  "related": [
    "records-aggregate",
    "json-selector-redact"
  ],
  "limits": {
    "inputBytes": 100000,
    "outputBytes": 300000,
    "jsonNodes": 10000,
    "depth": 20,
    "records": 256,
    "parameterPointers": 16,
    "sourceNodes": 6000,
    "semanticDepth": 8,
    "templates": 128,
    "extractedScalars": 4096,
    "aggregateCanonicalSkeletonBytes": 64000,
    "pointerBytes": 256,
    "pointerDepth": 8,
    "pointerTraversalSteps": 32768
  },
  "errorCodes": [
    "INVALID_INPUT",
    "INVALID_JSON",
    "INVALID_NUMBER",
    "INVALID_UNICODE",
    "UNSAFE_KEY",
    "INPUT_LIMIT",
    "OUTPUT_LIMIT",
    "COMPLEXITY_LIMIT",
    "INVALID_POINTER",
    "OVERLAPPING_POINTERS",
    "UNSUPPORTED_TARGET",
    "LOG_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": "structured-log-template-pack",
      "operation.category": "structured",
      "limit.httpRequestBytes": 131072,
      "limit.requestBytes": 100000,
      "limit.responseBytes": 524288,
      "limit.resultBytes": 300000,
      "limit.jsonDepth": 20,
      "limit.jsonNodes": 10000,
      "logTemplates.profile": "explicit-scalar-log-templates-v1",
      "logTemplates.reversibleParsedValues": true,
      "logTemplates.scalarTypesPreserved": true,
      "logTemplates.sourceMemberOrderPreserved": false,
      "logTemplates.sourceNumericSpellingPreserved": false,
      "logTemplates.duplicateSourceKeysPreserved": false,
      "logTemplates.maxRecords": 256,
      "logTemplates.maxParameterPointers": 16,
      "logTemplates.maxValueNodes": 6000,
      "logTemplates.maxValueDepth": 8,
      "logTemplates.maxTemplates": 128,
      "logTemplates.maxExtractedValues": 4096,
      "logTemplates.maxSkeletonBytes": 64000,
      "logTemplates.skeletonByteAccounting": "all-source-records",
      "logTemplates.maxPointerDepth": 8,
      "logTemplates.maxPointerBytes": 256,
      "logTemplates.maxPointerSteps": 32768,
      "logTemplates.compressionGuaranteed": false,
      "logTemplates.tokenSavingsGuaranteed": false,
      "logTemplates.rootCauseInference": false,
      "logTemplates.secretRedaction": false,
      "logTemplates.sourceAuthenticity": false,
      "logTemplates.semanticEventEquivalence": false,
      "logTemplates.liveLogCollection": false,
      "input.records.maxItems": 256,
      "input.records.minItems": 1,
      "input.parameterPointers.maxItems": 16,
      "input.parameterPointers.minItems": 1
    },
    "unknownPolicy": "Undeclared requirements are unknown, never compatible. Matching declared facts does not establish semantic fit or input validity.",
    "preflight": "/preflight"
  },
  "documentation": "/reference/tools/structured-log-template-pack.md",
  "serviceContract": "/reference/services/structured-log-template-pack.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/structured-log-template-pack",
    "mpp": "/v1/mpp/structured-log-template-pack"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "records": {
        "minItems": 1,
        "maxItems": 256,
        "type": "array",
        "items": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      },
      "parameterPointers": {
        "minItems": 1,
        "maxItems": 16,
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      }
    },
    "required": [
      "records",
      "parameterPointers"
    ],
    "additionalProperties": false,
    "$defs": {
      "__schema0": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/$defs/__schema0"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/$defs/__schema0"
            }
          }
        ]
      }
    }
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "operation",
      "version",
      "result",
      "provenance"
    ],
    "properties": {
      "operation": {
        "const": "structured-log-template-pack",
        "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": "explicit-scalar-log-templates-v1"
          },
          "evidence": {
            "type": "string",
            "const": "literal-structure-only"
          },
          "reversibleParsedValues": {
            "type": "boolean",
            "const": true
          },
          "recordCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 256
          },
          "templateCounts": {
            "minItems": 1,
            "maxItems": 128,
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 256
            }
          },
          "artifact": {
            "type": "object",
            "properties": {
              "templates": {
                "minItems": 1,
                "maxItems": 128,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "skeleton": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "$ref": "#/properties/result/$defs/__schema0"
                      }
                    },
                    "parameters": {
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "pointer": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 256
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "null",
                              "boolean",
                              "number",
                              "string"
                            ]
                          }
                        },
                        "required": [
                          "pointer",
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "skeleton",
                    "parameters"
                  ],
                  "additionalProperties": false
                }
              },
              "occurrences": {
                "minItems": 1,
                "maxItems": 256,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "template": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 127
                    },
                    "values": {
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": [
                          "null",
                          "boolean",
                          "number",
                          "string"
                        ]
                      }
                    }
                  },
                  "required": [
                    "template",
                    "values"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "templates",
              "occurrences"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "profile",
          "evidence",
          "reversibleParsedValues",
          "recordCount",
          "templateCounts",
          "artifact"
        ],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/properties/result/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/properties/result/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "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": {
    "records": [
      {
        "event": "download",
        "job": "a",
        "status": 200
      },
      {
        "event": "download",
        "job": "b",
        "status": 200
      },
      {
        "event": "download",
        "job": "c",
        "status": 500
      }
    ],
    "parameterPointers": [
      "/job"
    ]
  },
  "exampleResponse": {
    "operation": "structured-log-template-pack",
    "version": "0.29.0",
    "result": {
      "profile": "explicit-scalar-log-templates-v1",
      "evidence": "literal-structure-only",
      "reversibleParsedValues": true,
      "recordCount": 3,
      "templateCounts": [
        2,
        1
      ],
      "artifact": {
        "templates": [
          {
            "skeleton": {
              "event": "download",
              "job": null,
              "status": 200
            },
            "parameters": [
              {
                "pointer": "/job",
                "type": "string"
              }
            ]
          },
          {
            "skeleton": {
              "event": "download",
              "job": null,
              "status": 500
            },
            "parameters": [
              {
                "pointer": "/job",
                "type": "string"
              }
            ]
          }
        ],
        "occurrences": [
          {
            "template": 0,
            "values": [
              "a"
            ]
          },
          {
            "template": 0,
            "values": [
              "b"
            ]
          },
          {
            "template": 1,
            "values": [
              "c"
            ]
          }
        ]
      }
    },
    "provenance": {
      "inputSha256": "0087aee5b205d2f5247ee37e75b4d5f8cf0510e389a7984416d065178c67b7e3",
      "outputSha256": "9893c0221a4326c737233d80d598f160bb0cd6fdd3b2c26de15d216866f890cf",
      "deterministic": true,
      "externalRequests": 0
    }
  },
  "requiredHeaders": {
    "Content-Type": "application/json",
    "Idempotency-Key": "random 16–128 character operation identifier"
  },
  "fixedExample": "/reference/examples/structured-log-template-pack.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."
  }
}
