CoAgent8 - Source API
    Preparing search index...

    Function createClaudeStreamCollector

    • Collects public answers, tool activity, session identity and the terminal result from Claude Code.

      Parameters

      Returns {
          isTerminal: () => boolean;
          line: (raw: string) => void;
          snapshot: () => {
              error: ExecutionError
              | undefined;
              hasAssistantMessage: boolean;
              initialized: boolean;
              model: string | undefined;
              output: string;
              sessionId: string | null;
              terminal: boolean;
              truncated: boolean;
              usage:
                  | {
                      inputTokens?: number;
                      outputTokens?: number;
                      source: "provider";
                      totalTokens?: number;
                  }
                  | undefined;
          };
      }

      A line collector whose snapshot is used directly by the production adapter.

      SANDBOX_UNAVAILABLE when system/init reports a tool, MCP server or permission mode outside the read-only profile; PROTOCOL_ERROR on malformed known events, a mismatched session ID or a second terminal result.

      Thinking blocks, tool inputs and tool results are discarded. Unknown event types and system subtypes are tolerated with one warning per type. Answer text is not passed through keyword redaction; only diagnostics are redacted.