{
  "schemaVersion": "document-job/1-draft",
  "id": "runstamp.finance.workbook-update",
  "version": "0.2.0-draft",
  "description": "Local-preview bounded literal and explicit formula-cache update for an existing workbook. The local checker reopens exact output bytes; target-application readiness remains separate.",
  "owner": "Runstamp",
  "license": "Apache-2.0 (definition only; assets require separate rights)",
  "intent": {
    "kind": "mutation",
    "beforeInput": "workbook",
    "expectedChangesInput": "changes"
  },
  "inputs": {
    "workbook": {
      "kind": "artifact",
      "mediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    },
    "changes": {
      "kind": "json",
      "schema": {
        "id": "runstamp.finance.expected-writes",
        "version": "0.2.0-draft"
      }
    },
    "period": {
      "kind": "json",
      "schema": {
        "id": "runstamp.reporting-period",
        "version": "0.1.0-draft"
      }
    },
    "declared-views": { "kind": "json", "schema": { "id": "runstamp.finance.declared-views", "version": "0.1.0-draft" } },
    "artifact-id": {
      "kind": "json",
      "schema": {
        "id": "runstamp.artifact-id",
        "version": "0.1.0-draft"
      }
    }
  },
  "sources": [
    "workbook",
    "changes",
    "period",
    "declared-views",
    "artifact-id"
  ],
  "assets": {},
  "dependencies": [
    {
      "kind": "runtime",
      "key": "runtime",
      "id": "runstamp.local-node",
      "version": "0.1.0-draft"
    },
    {
      "kind": "schema",
      "key": "changes-schema",
      "id": "runstamp.finance.expected-writes",
      "version": "0.2.0-draft"
    },
    {
      "kind": "schema",
      "key": "artifact-id-schema",
      "id": "runstamp.artifact-id",
      "version": "0.1.0-draft"
    },
    {
      "kind": "schema",
      "key": "period-schema",
      "id": "runstamp.reporting-period",
      "version": "0.1.0-draft"
    },
    { "kind": "schema", "key": "declared-views-schema", "id": "runstamp.finance.declared-views", "version": "0.1.0-draft" },
    {
      "kind": "operation",
      "key": "write",
      "id": "xlsx.transform",
      "package": "@runstamp/xlsx",
      "packageVersion": "2.0.3",
      "contractVersion": "1.0.0"
    },
    {
      "kind": "profile",
      "key": "workbook-profile",
      "id": "runstamp.finance.workbook-delivery",
      "version": "0.2.0-draft"
    }
  ],
  "steps": [
    {
      "id": "write",
      "operation": "write",
      "input": {
        "workbookBase64": {
          "ref": {
            "from": "input",
            "name": "workbook"
          },
          "type": {
            "kind": "artifact",
            "mediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
          }
        },
        "writes": {
          "ref": {
            "from": "input",
            "name": "changes"
          },
          "type": {
            "kind": "json",
            "schema": {
              "id": "runstamp.finance.expected-writes",
              "version": "0.2.0-draft"
            }
          }
        },
        "artifactId": {
          "ref": {
            "from": "input",
            "name": "artifact-id"
          },
          "type": {
            "kind": "json",
            "schema": {
              "id": "runstamp.artifact-id",
              "version": "0.1.0-draft"
            }
          }
        }
      },
      "options": {},
      "outputs": {
        "artifact": {
          "type": {
            "kind": "artifact",
            "mediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
          },
          "valuePath": ["output"]
        }
      },
      "budget": {
        "timeoutMs": 60000,
        "maxInputBytes": 16777216,
        "maxOutputBytes": 33554432,
        "maxOutputs": 4
      },
      "retry": "never",
      "maxAttempts": 1
    }
  ],
  "outputs": [
    {
      "name": "workbook",
      "ref": {
        "from": "step",
        "step": "write",
        "output": "artifact"
      },
      "mediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
      "required": true,
      "profile": "workbook-profile",
      "editability": "required",
      "allowedLossCodes": [],
      "review": "required"
    }
  ],
  "runtime": {
    "capabilities": [
      "local.operation-registry",
      "artifact-store"
    ],
    "budget": {
      "timeoutMs": 60000,
      "maxInputBytes": 16777216,
      "maxOutputBytes": 33554432,
      "maxOutputs": 4
    }
  }
}
