publish_library

Generated automatically from the published contract sources.

Build metadata: Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

A script calls this action over HTTPS at POST https://turnzero.ai/api/v1/actions/publish_library, with a bearer credential and the action's payload as the JSON body.

Contract description

Publish the code library from a source commit. Platform operator or its publisher (the `publication` grant or `super_admin`) only. It takes three calls: `begin` with the catalog, `put` for each file with its SHA-256, then `commit` with `served_commit`, the commit `list_library` named as served before `begin`, or null where none was. A `commit` of a different commit is refused `publish_not_forward` unless `served_commit` names what is served at that moment. The publisher script that drives it checks the commit is reachable from `main` and descends from the served one.

Access and action metadata

{
  "name": "publish_library",
  "resource": "library",
  "tier": "reversible",
  "grant": "publication",
  "phases": [
    "begin",
    "put",
    "commit"
  ],
  "summary": "Publish the whole awake library from a commit reachable from main, in three phases: begin records the catalog and answers the blobs the store lacks, put writes one blob per call because the awake library exceeds a single body, and commit verifies every blob is present and swaps the served pointer last.",
  "annotations": {
    "readOnlyHint": false,
    "destructiveHint": true,
    "openWorldHint": false
  }
}

MCP catalog entry

{
  "name": "publish_library",
  "tier": "reversible",
  "summary": "Publish the code library from a source commit. Platform operator or its publisher (the `publication` grant or `super_admin`) only. It takes three calls: `begin` with the catalog, `put` for each file with its SHA-256, then `commit` with `served_commit`, the commit `list_library` named as served before `begin`, or null where none was. A `commit` of a different commit is refused `publish_not_forward` unless `served_commit` names what is served at that moment. The publisher script that drives it checks the commit is reachable from `main` and descends from the served one.",
  "owners": [
    "Q-239",
    "LC-01"
  ],
  "scenario": "API-L0-14"
}

request

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["phase","source_commit"]
Additional properties: false
/properties/phase `begin`, `put`, or `commit`.

Allowed values: ["begin","put","commit"]
/properties/source_commit The git commit the library is published from.

Type: string
Pattern: ^[0-9a-f]{7,40}$
/properties/catalog With `begin`: the catalog of entries and files being published. A `begin` for the commit already served must carry the served catalog, and is otherwise refused `publish_not_forward`. A `begin` whose entry keeps a served version under a different closure is refused `version_reused` and writes nothing: bump that entry's version, or restore its bytes. A `begin` whose catalog holds an entry name outside the form a take line carries is refused `invalid_request` and writes nothing. The form is one or two segments joined by a slash, each of lower-case letters, digits, `_`, and `-`, opening with a letter or a digit. The detail names the first such entry by its place in the catalog, with its name where the name can be repeated.

Type: object
/properties/blob With `put`: one file's content, base64.

Type: string
/properties/sha256 With `put`: the file's SHA-256, hex. A mismatch fails the call with an `internal` error naming both hashes and writes nothing.

Type: string
/properties/served_commit With `commit`: the served commit this publish was checked against, the `source_commit` `list_library` answered before `begin`, or null where nothing was served. A `commit` of a commit other than the served one is refused `publish_not_forward` unless this names what is served at that moment; a resumed commit of the served commit needs none.

Type: ["string","null"]
Pattern: ^[0-9a-f]{7,40}$

response

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["contract_version"]
Additional properties: false
/properties/contract_version Required value: 1
/properties/missing Type: array
/properties/missing/items Type: string
/properties/sha256 Type: string
/properties/served Type: object
Required fields: ["source_commit","published_at"]
Additional properties: false
/properties/served/properties/source_commit Type: string
/properties/served/properties/published_at Type: string

Complete payload contract

{
  "request": {
    "type": "object",
    "required": [
      "phase",
      "source_commit"
    ],
    "properties": {
      "phase": {
        "enum": [
          "begin",
          "put",
          "commit"
        ],
        "description": "`begin`, `put`, or `commit`."
      },
      "source_commit": {
        "type": "string",
        "pattern": "^[0-9a-f]{7,40}$",
        "description": "The git commit the library is published from."
      },
      "catalog": {
        "type": "object",
        "description": "With `begin`: the catalog of entries and files being published. A `begin` for the commit already served must carry the served catalog, and is otherwise refused `publish_not_forward`. A `begin` whose entry keeps a served version under a different closure is refused `version_reused` and writes nothing: bump that entry's version, or restore its bytes. A `begin` whose catalog holds an entry name outside the form a take line carries is refused `invalid_request` and writes nothing. The form is one or two segments joined by a slash, each of lower-case letters, digits, `_`, and `-`, opening with a letter or a digit. The detail names the first such entry by its place in the catalog, with its name where the name can be repeated."
      },
      "blob": {
        "type": "string",
        "description": "With `put`: one file's content, base64."
      },
      "sha256": {
        "type": "string",
        "description": "With `put`: the file's SHA-256, hex. A mismatch fails the call with an `internal` error naming both hashes and writes nothing."
      },
      "served_commit": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^[0-9a-f]{7,40}$",
        "description": "With `commit`: the served commit this publish was checked against, the `source_commit` `list_library` answered before `begin`, or null where nothing was served. A `commit` of a commit other than the served one is refused `publish_not_forward` unless this names what is served at that moment; a resumed commit of the served commit needs none."
      }
    },
    "additionalProperties": false
  },
  "response": {
    "type": "object",
    "required": [
      "contract_version"
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "missing": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "sha256": {
        "type": "string"
      },
      "served": {
        "type": "object",
        "required": [
          "source_commit",
          "published_at"
        ],
        "properties": {
          "source_commit": {
            "type": "string"
          },
          "published_at": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "additionalProperties": false
  }
}

Shared contracts