Member Junction
    Preparing search index...
    HarnessTurnEvent:
        | { Text: string; Type: "assistant-text" }
        | { Text: string; Type: "thinking-delta" }
        | {
            ArgumentsJson?: string;
            ToolCallId: string;
            ToolName: string;
            Type: "tool-use-start";
        }
        | {
            IsError?: boolean;
            Output: string;
            ToolCallId: string;
            ToolName?: string;
            Type: "tool-result";
        }
        | { Description: string; Type: "sandbox-activity" }
        | {
            Command?: string;
            Description: string;
            RequestId: string;
            Type: "permission-request";
        }
        | {
            CompletionTokens?: number;
            CostUsd?: number;
            InputTokens: number;
            OutputTokens: number;
            PromptTokens?: number;
            ThinkingTokens?: number;
            Type: "usage";
        }
        | {
            ArtifactUrls?: string[];
            AsyncWakePending?: boolean;
            CloudExecutionState?: CloudExecutionState;
            PullRequestUrl?: string;
            RawText: string;
            SessionId?: string;
            Type: "turn-complete";
        }
        | {
            CloudExecutionState?: CloudExecutionState;
            Error: string;
            Type: "session-error";
        }

    Events an adapter emits while a turn is in flight.

    Deliberately a small, closed set. Anything the harness does INSIDE its sandbox that does not cross one of these boundaries is governed by posture policy, not recorded as a run step — the opaque-super-step property of this design, which is intentional and must stay documented rather than quietly widened.

    Type Declaration

    • { Text: string; Type: "assistant-text" }

      Streamed narration, surfaced to onProgress and never persisted as a step.

    • { Text: string; Type: "thinking-delta" }

      Streamed model reasoning/thinking tokens for live observability.

    • {
          ArgumentsJson?: string;
          ToolCallId: string;
          ToolName: string;
          Type: "tool-use-start";
      }

      Structured tool invocation start emitted by CLI or cloud harnesses for live observability.

    • {
          IsError?: boolean;
          Output: string;
          ToolCallId: string;
          ToolName?: string;
          Type: "tool-result";
      }

      Structured tool execution result emitted by CLI or cloud harnesses for live observability.

    • { Description: string; Type: "sandbox-activity" }

      Informational in-sandbox activity (file edit, shell command) for live view only.

    • {
          Command?: string;
          Description: string;
          RequestId: string;
          Type: "permission-request";
      }

      The harness wants to do something the posture gates; becomes an MJ: AI Agent Requests row.

    • {
          CompletionTokens?: number;
          CostUsd?: number;
          InputTokens: number;
          OutputTokens: number;
          PromptTokens?: number;
          ThinkingTokens?: number;
          Type: "usage";
      }

      Token/cost usage for the turn. Without this the run cannot be accounted for — see below.

    • {
          ArtifactUrls?: string[];
          AsyncWakePending?: boolean;
          CloudExecutionState?: CloudExecutionState;
          PullRequestUrl?: string;
          RawText: string;
          SessionId?: string;
          Type: "turn-complete";
      }

      The turn ended. RawText is expected to carry the Loop next-step JSON envelope.

    • {
          CloudExecutionState?: CloudExecutionState;
          Error: string;
          Type: "session-error";
      }

      The session failed. Terminal for the turn; the run decides whether to retry.