All contracts

Workspace Intelligence / JSON Schema

Workspai Workspace Repair Transaction v1

Durable CLI-owned state for one governed workspace repair from plan through verification or rollback.

Schema version
workspai.workspace-repair-transaction.v1
Contract path
contracts/workspace-intelligence/workspace-repair-transaction.v1.json
Publication
embedded-type, json-schema
Defined fields
100
Artifact bindings
1

Why this contract exists

Architecture role

Defines a versioned interoperability boundary used by Workspai and contract-aware consumers.

Consumption boundary

  • Workspai CLI
  • Workspace Intelligence consumers
  • IDEs and agents

Related commands

Commands are linked only when the runtime contract identifies a direct production relationship. Supporting contracts may be consumed without having a single producer command.

Produced artifacts

These durable files are emitted by registered commands and validated against this contract.

Artifact pathSchemaProducer
.workspai/reports/workspace-repair-last-run.jsonworkspai.workspace-repair-transaction.v1
workspai workspace repair plan
workspai workspace repair propose
workspai workspace repair approve
workspai workspace repair decide
workspai workspace repair execute
workspai workspace repair resume
workspai workspace repair rollback
workspai workspace repair cancel

Field reference

Every declared schema property or published capability path is listed here. Required means the contract declares or publishes that field at the shown boundary.

Field pathTypeRequiredMeaningConstraints
$defs.adapterEvaluation.adapterIdstringYesDefines the adapterid value at this contract boundary.minLength: 1
$defs.adapterEvaluation.ecosystemstringYesDefines the ecosystem value at this contract boundary.minLength: 1
$defs.adapterEvaluation.manifestsarrayYesDefines the manifests value at this contract boundary.
$defs.adapterEvaluation.messagestringYesDefines the message value at this contract boundary.
$defs.adapterEvaluation.missingExecutablesarrayYesDefines the missingexecutables value at this contract boundary.
$defs.adapterEvaluation.projectPathstringYesDefines the projectpath value at this contract boundary.minLength: 1
$defs.adapterEvaluation.requiredExecutablesarrayYesDefines the requiredexecutables value at this contract boundary.
$defs.adapterEvaluation.statusenumYesDefines the status value at this contract boundary.enum: ready, partial, unsupported
$defs.adapterEvaluation.supportenumYesDefines the support value at this contract boundary.enum: full, conditional, unsupported
$defs.checkpoint.capturedAtstringNoDefines the capturedat value at this contract boundary.format: date-time
$defs.checkpoint.filesarrayYesDefines the files value at this contract boundary.
$defs.checkpoint.restoredAtstringNoDefines the restoredat value at this contract boundary.format: date-time
$defs.checkpoint.statusenumYesDefines the status value at this contract boundary.enum: pending, captured, restored, conflicted, unavailable
$defs.checkpointFile.afterHashstring | nullNoDefines the afterhash value at this contract boundary.
$defs.checkpointFile.backupRefstringNoDefines the backupref value at this contract boundary.minLength: 1
$defs.checkpointFile.beforeHashstring | nullYesDefines the beforehash value at this contract boundary.
$defs.checkpointFile.existedbooleanYesDefines the existed value at this contract boundary.
$defs.checkpointFile.modeintegerNoDefines the mode value at this contract boundary.minimum: 0 · maximum: 65535
$defs.checkpointFile.pathstringYesDefines the path value at this contract boundary.minLength: 1
$defs.decision.causesarrayNoDefines the causes value at this contract boundary.minItems: 1
$defs.decision.optionsarrayYesDefines the options value at this contract boundary.minItems: 1
$defs.decision.reasonstringYesDefines the reason value at this contract boundary.minLength: 1
$defs.decisionCause.adapterIdstringNoDefines the adapterid value at this contract boundary.minLength: 1
$defs.decisionCause.executablestringNoDefines the executable value at this contract boundary.minLength: 1
$defs.decisionCause.idstringYesDefines the id value at this contract boundary.minLength: 1
$defs.decisionCause.kindenumYesDefines the kind value at this contract boundary.enum: missing-executable, unsupported-adapter, failed-precondition, risk-approval, policy-exception, source-repair-required
$defs.decisionCause.messagestringYesDefines the message value at this contract boundary.minLength: 1
$defs.decisionCause.projectPathstringNoDefines the projectpath value at this contract boundary.minLength: 1
$defs.event.atstringYesDefines the at value at this contract boundary.format: date-time
$defs.event.messagestringYesDefines the message value at this contract boundary.
$defs.event.sequenceintegerYesDefines the sequence value at this contract boundary.minimum: 1
$defs.event.stageIdstringNoDefines the stageid value at this contract boundary.
$defs.event.statusstringNoDefines the status value at this contract boundary.
$defs.event.typeenumYesDefines the type value at this contract boundary.enum: planned, approval, checkpoint, stage, verification, decision, rollback, closed, failed, cancelled
$defs.invocation.argsarrayYesDefines the args value at this contract boundary.
$defs.invocation.cwdstringYesDefines the cwd value at this contract boundary.minLength: 1
$defs.invocation.executablestringYesDefines the executable value at this contract boundary.minLength: 1
$defs.invocation.purposeenumYesDefines the purpose value at this contract boundary.enum: repair, reconcile, audit, test, build, verify
$defs.invocation.timeoutMsintegerYesDefines the timeoutms value at this contract boundary.minimum: 1000 · maximum: 900000
$defs.precondition.idstringYesDefines the id value at this contract boundary.minLength: 1
$defs.precondition.messagestringYesDefines the message value at this contract boundary.
$defs.precondition.statusenumYesDefines the status value at this contract boundary.enum: passed, failed, unknown
$defs.stage.changedPathsarrayNoDefines the changedpaths value at this contract boundary.
$defs.stage.completedAtstringNoDefines the completedat value at this contract boundary.format: date-time
$defs.stage.exitCodeinteger | nullNoDefines the exitcode value at this contract boundary.
$defs.stage.idstringYesDefines the id value at this contract boundary.minLength: 1
$defs.stage.invocationreferenceNoDefines the invocation value at this contract boundary.ref: #/$defs/invocation
$defs.stage.kindenumYesDefines the kind value at this contract boundary.enum: repair, reconcile, audit, test, build, verify, rollback
$defs.stage.requiredbooleanYesDefines the required value at this contract boundary.
$defs.stage.riskenumYesDefines the risk value at this contract boundary.enum: safe, guarded, invasive
$defs.stage.startedAtstringNoDefines the startedat value at this contract boundary.format: date-time
$defs.stage.statusenumYesDefines the status value at this contract boundary.enum: pending, running, passed, failed, blocked, skipped, cancelled
$defs.stage.stderrTailstringNoDefines the stderrtail value at this contract boundary.
$defs.stage.stdoutTailstringNoDefines the stdouttail value at this contract boundary.
$defs.stage.summarystringYesDefines the summary value at this contract boundary.
$defs.verification.artifactstringYesDefines the artifact value at this contract boundary.const: ".workspai/reports/workspace-intelligence-run-last-run.json"
$defs.verification.exitCodeinteger | nullYesDefines the exitcode value at this contract boundary.
$defs.verification.remainingActionIdsarrayNoDefines the remainingactionids value at this contract boundary.
$defs.verification.statusenumYesDefines the status value at this contract boundary.enum: passed, failed, not-run
$defs.verification.summarystringYesDefines the summary value at this contract boundary.
$defs.verification.targetStatusenumNoDefines the targetstatus value at this contract boundary.enum: passed, failed, unknown
$defs.verification.workspaceStatusenumNoDefines the workspacestatus value at this contract boundary.enum: passed, blocked, failed
adapterEvaluationsarrayNoDefines the adapterevaluations value at this contract boundary.
approvalobjectYesDefines the approval value at this contract boundary.additionalProperties: false
approval.approvedAtstringNoDefines the approvedat value at this contract boundary.format: date-time
approval.approvedBystringNoDefines the approvedby value at this contract boundary.minLength: 1
approval.approvedPlanHashstringNoDefines the approvedplanhash value at this contract boundary.pattern: ^[a-f0-9]{64}$
approval.requiredbooleanYesDefines the required value at this contract boundary.const: true
approval.statusenumYesDefines the status value at this contract boundary.enum: pending, approved, rejected, expired
checkpointreferenceYesDefines the checkpoint value at this contract boundary.ref: #/$defs/checkpoint
createdAtstringYesDefines the createdat value at this contract boundary.format: date-time
decisionreferenceNoDefines the decision value at this contract boundary.ref: #/$defs/decision
eventsarrayYesDefines the events value at this contract boundary.
integrityobjectYesDefines the integrity value at this contract boundary.additionalProperties: false
integrity.planHashstringYesDefines the planhash value at this contract boundary.pattern: ^[a-f0-9]{64}$
integrity.sourceEvidenceHashstringYesDefines the sourceevidencehash value at this contract boundary.pattern: ^[a-f0-9]{64}$
policyobjectYesDefines the policy value at this contract boundary.additionalProperties: false
policy.allowBreakingbooleanYesDefines the allowbreaking value at this contract boundary.
policy.allowForcebooleanYesDefines the allowforce value at this contract boundary.
policy.autoRollbackbooleanYesDefines the autorollback value at this contract boundary.
policy.maxRiskenumYesDefines the maxrisk value at this contract boundary.enum: safe, guarded, invasive
policy.strictVerifybooleanYesDefines the strictverify value at this contract boundary.const: true
preconditionsarrayYesDefines the preconditions value at this contract boundary.
revisionintegerYesDefines the revision value at this contract boundary.minimum: 1
schemaVersionstringYesDefines the schemaversion value at this contract boundary.const: "workspai.workspace-repair-transaction.v1"
stagesarrayYesDefines the stages value at this contract boundary.minItems: 1
stateenumYesDefines the state value at this contract boundary.enum: planned, awaiting-approval, approved, checkpointed, executing, verifying, closed, decision-required, rollback-required, rolling-back, rolled-back, failed, cancelled
targetobjectYesDefines the target value at this contract boundary.additionalProperties: false
target.actionIdsarrayYesDefines the actionids value at this contract boundary.minItems: 1
target.blockerSignaturestringNoDefines the blockersignature value at this contract boundary.minLength: 1 · maxLength: 256
target.cardIdstringYesDefines the cardid value at this contract boundary.minLength: 1
target.projectNamestringNoDefines the projectname value at this contract boundary.minLength: 1
target.projectPathstringNoDefines the projectpath value at this contract boundary.minLength: 1
target.scopeenumYesDefines the scope value at this contract boundary.enum: workspace, project
transactionIdstringYesDefines the transactionid value at this contract boundary.pattern: ^[A-Za-z0-9_-]{12,128}$
updatedAtstringYesDefines the updatedat value at this contract boundary.format: date-time
verificationreferenceNoDefines the verification value at this contract boundary.ref: #/$defs/verification
workspaceobjectYesDefines the workspace value at this contract boundary.additionalProperties: false
workspace.namestringYesDefines the name value at this contract boundary.minLength: 1
workspace.rootRefstringYesDefines the rootref value at this contract boundary.const: "."

Canonical machine-readable definition

The raw synchronized contract remains authoritative. The educational sections above are projections of this definition.

Show raw JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://workspai.dev/contracts/workspace-intelligence/workspace-repair-transaction.v1.json",
  "title": "Workspai Workspace Repair Transaction v1",
  "description": "Durable CLI-owned state for one governed workspace repair from plan through verification or rollback.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "transactionId",
    "revision",
    "createdAt",
    "updatedAt",
    "workspace",
    "target",
    "state",
    "policy",
    "approval",
    "preconditions",
    "checkpoint",
    "stages",
    "events",
    "integrity"
  ],
  "properties": {
    "schemaVersion": {
      "const": "workspai.workspace-repair-transaction.v1"
    },
    "transactionId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{12,128}$"
    },
    "revision": {
      "type": "integer",
      "minimum": 1
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "workspace": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "rootRef"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "rootRef": {
          "const": "."
        }
      }
    },
    "target": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "cardId",
        "scope",
        "actionIds"
      ],
      "properties": {
        "cardId": {
          "type": "string",
          "minLength": 1
        },
        "blockerSignature": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "scope": {
          "enum": [
            "workspace",
            "project"
          ]
        },
        "projectName": {
          "type": "string",
          "minLength": 1
        },
        "projectPath": {
          "type": "string",
          "minLength": 1
        },
        "actionIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "state": {
      "enum": [
        "planned",
        "awaiting-approval",
        "approved",
        "checkpointed",
        "executing",
        "verifying",
        "closed",
        "decision-required",
        "rollback-required",
        "rolling-back",
        "rolled-back",
        "failed",
        "cancelled"
      ]
    },
    "policy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "maxRisk",
        "allowForce",
        "allowBreaking",
        "autoRollback",
        "strictVerify"
      ],
      "properties": {
        "maxRisk": {
          "enum": [
            "safe",
            "guarded",
            "invasive"
          ]
        },
        "allowForce": {
          "type": "boolean"
        },
        "allowBreaking": {
          "type": "boolean"
        },
        "autoRollback": {
          "type": "boolean"
        },
        "strictVerify": {
          "const": true
        }
      }
    },
    "approval": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "required",
        "status"
      ],
      "properties": {
        "required": {
          "const": true
        },
        "status": {
          "enum": [
            "pending",
            "approved",
            "rejected",
            "expired"
          ]
        },
        "approvedAt": {
          "type": "string",
          "format": "date-time"
        },
        "approvedBy": {
          "type": "string",
          "minLength": 1
        },
        "approvedPlanHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "preconditions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/precondition"
      }
    },
    "adapterEvaluations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/adapterEvaluation"
      }
    },
    "checkpoint": {
      "$ref": "#/$defs/checkpoint"
    },
    "stages": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/stage"
      }
    },
    "verification": {
      "$ref": "#/$defs/verification"
    },
    "decision": {
      "$ref": "#/$defs/decision"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/event"
      }
    },
    "integrity": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "planHash",
        "sourceEvidenceHash"
      ],
      "properties": {
        "planHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "sourceEvidenceHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    }
  },
  "$defs": {
    "adapterEvaluation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "adapterId",
        "ecosystem",
        "projectPath",
        "manifests",
        "support",
        "status",
        "requiredExecutables",
        "missingExecutables",
        "message"
      ],
      "properties": {
        "adapterId": {
          "type": "string",
          "minLength": 1
        },
        "ecosystem": {
          "type": "string",
          "minLength": 1
        },
        "projectPath": {
          "type": "string",
          "minLength": 1
        },
        "manifests": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "support": {
          "enum": [
            "full",
            "conditional",
            "unsupported"
          ]
        },
        "status": {
          "enum": [
            "ready",
            "partial",
            "unsupported"
          ]
        },
        "requiredExecutables": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "missingExecutables": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "message": {
          "type": "string"
        }
      }
    },
    "invocation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "cwd",
        "executable",
        "args",
        "purpose",
        "timeoutMs"
      ],
      "properties": {
        "cwd": {
          "type": "string",
          "minLength": 1
        },
        "executable": {
          "type": "string",
          "minLength": 1
        },
        "args": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "purpose": {
          "enum": [
            "repair",
            "reconcile",
            "audit",
            "test",
            "build",
            "verify"
          ]
        },
        "timeoutMs": {
          "type": "integer",
          "minimum": 1000,
          "maximum": 900000
        }
      }
    },
    "precondition": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "status",
        "message"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "passed",
            "failed",
            "unknown"
          ]
        },
        "message": {
          "type": "string"
        }
      }
    },
    "checkpointFile": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "existed",
        "beforeHash"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "existed": {
          "type": "boolean"
        },
        "beforeHash": {
          "type": [
            "string",
            "null"
          ]
        },
        "mode": {
          "type": "integer",
          "minimum": 0,
          "maximum": 65535
        },
        "afterHash": {
          "type": [
            "string",
            "null"
          ]
        },
        "backupRef": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "checkpoint": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "files"
      ],
      "properties": {
        "status": {
          "enum": [
            "pending",
            "captured",
            "restored",
            "conflicted",
            "unavailable"
          ]
        },
        "capturedAt": {
          "type": "string",
          "format": "date-time"
        },
        "restoredAt": {
          "type": "string",
          "format": "date-time"
        },
        "files": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/checkpointFile"
          }
        }
      }
    },
    "stage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "kind",
        "status",
        "required",
        "risk",
        "summary"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "enum": [
            "repair",
            "reconcile",
            "audit",
            "test",
            "build",
            "verify",
            "rollback"
          ]
        },
        "status": {
          "enum": [
            "pending",
            "running",
            "passed",
            "failed",
            "blocked",
            "skipped",
            "cancelled"
          ]
        },
        "required": {
          "type": "boolean"
        },
        "risk": {
          "enum": [
            "safe",
            "guarded",
            "invasive"
          ]
        },
        "summary": {
          "type": "string"
        },
        "invocation": {
          "$ref": "#/$defs/invocation"
        },
        "startedAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": "string",
          "format": "date-time"
        },
        "exitCode": {
          "type": [
            "integer",
            "null"
          ]
        },
        "stdoutTail": {
          "type": "string"
        },
        "stderrTail": {
          "type": "string"
        },
        "changedPaths": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "artifact",
        "exitCode",
        "summary"
      ],
      "properties": {
        "status": {
          "enum": [
            "passed",
            "failed",
            "not-run"
          ]
        },
        "targetStatus": {
          "enum": [
            "passed",
            "failed",
            "unknown"
          ]
        },
        "workspaceStatus": {
          "enum": [
            "passed",
            "blocked",
            "failed"
          ]
        },
        "remainingActionIds": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "artifact": {
          "const": ".workspai/reports/workspace-intelligence-run-last-run.json"
        },
        "exitCode": {
          "type": [
            "integer",
            "null"
          ]
        },
        "summary": {
          "type": "string"
        }
      }
    },
    "decision": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "reason",
        "options"
      ],
      "properties": {
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "options": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": [
              "approve-guarded",
              "approve-invasive",
              "allow-breaking",
              "allow-force",
              "manual-repair",
              "rollback",
              "cancel"
            ]
          }
        },
        "causes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/decisionCause"
          }
        }
      }
    },
    "decisionCause": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "id",
        "message"
      ],
      "properties": {
        "kind": {
          "enum": [
            "missing-executable",
            "unsupported-adapter",
            "failed-precondition",
            "risk-approval",
            "policy-exception",
            "source-repair-required"
          ]
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "message": {
          "type": "string",
          "minLength": 1
        },
        "projectPath": {
          "type": "string",
          "minLength": 1
        },
        "adapterId": {
          "type": "string",
          "minLength": 1
        },
        "executable": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "event": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sequence",
        "at",
        "type",
        "message"
      ],
      "properties": {
        "sequence": {
          "type": "integer",
          "minimum": 1
        },
        "at": {
          "type": "string",
          "format": "date-time"
        },
        "type": {
          "enum": [
            "planned",
            "approval",
            "checkpoint",
            "stage",
            "verification",
            "decision",
            "rollback",
            "closed",
            "failed",
            "cancelled"
          ]
        },
        "stageId": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}