← All procedures

claude.read

Read the new events of a turn from its output file

CLI
Package
@procedures/claude-cli · README
Path
["claude","read"]
CLI
mark claude read --outputFile <string>
As data
{"$proc":["claude","read"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/claude-cli/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["claude","read"], { outputFile: "<outputFile>" });
console.log(JSON.stringify(result));

From the command line

$ mark claude read --outputFile <string>

As data, in a program

{
  "$proc": ["claude", "read"],
  "input": { "outputFile": "<outputFile>" }
}

Input

FieldTypeRequiredDefaultDescription
outputFilestringyesThe output file of the turn
offsetintegernoThe byte offset to start from (default: 0)
pidintegernoThe process id of the turn

Output

FieldTypeRequiredDefaultDescription
eventsobject[]yesThe new events
offsetnumberyesThe byte offset for the next read
finishedbooleanyesTrue when the events include the result of the turn
runningbooleannoTrue when the process runs (only with pid)
newBytesnumberyesThe number of new bytes in the file
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "outputFile": {
        "type": "string",
        "minLength": 1,
        "description": "The output file of the turn"
      },
      "offset": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991,
        "description": "The byte offset to start from (default: 0)"
      },
      "pid": {
        "type": "integer",
        "minimum": 2,
        "maximum": 9007199254740991,
        "description": "The process id of the turn"
      }
    },
    "required": [
      "outputFile"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "events": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "offset": {
              "type": "number",
              "description": "The byte offset after the line of the event"
            },
            "event": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "meta, text, text-delta, thinking, tool-use, tool-result, result, log or error"
                }
              },
              "required": [
                "type"
              ],
              "additionalProperties": {}
            }
          },
          "required": [
            "offset",
            "event"
          ],
          "additionalProperties": false
        },
        "description": "The new events"
      },
      "offset": {
        "type": "number",
        "description": "The byte offset for the next read"
      },
      "finished": {
        "type": "boolean",
        "description": "True when the events include the result of the turn"
      },
      "running": {
        "description": "True when the process runs (only with pid)",
        "type": "boolean"
      },
      "newBytes": {
        "type": "number",
        "description": "The number of new bytes in the file"
      }
    },
    "required": [
      "events",
      "offset",
      "finished",
      "newBytes"
    ],
    "additionalProperties": false
  }
}