Vixen
c7401864
csharp
public sealed class AiDebugChannel

One agent's debug state, over a wire.

Read the guide page for this →

Remarks

Doc 37 § D17's one exception, built as an exception. Nothing in Vixen.Ai is replicated and nothing ever will be — a client that planned would plan from an interpolated view and reach different conclusions — but the editor's AI debugger has to work against a running dedicated server, and that means a request and a response for one agent's state.

⚠ Enabled is off, and a build that never turns it on cannot answer. TryHandle refuses before it looks at the entity, so the switch is one branch rather than a policy every caller has to remember. A host turns it on from the same condition doc 13's remote inspector uses — BuildVariants.Current.HasDiagnostics() — which is false in a shipping build. It is a property rather than a compile-time flag for the reason DebugDraw.Enabled is one: the build where somebody needs this most is a production server, and doc 13 asks for exactly that.

⚠ The payload is an AiAgentSnapshot and nothing else — no tree, no template, no blackboard layout. The far end gets rows of formatted strings, so the editor needs no copy of the server's content to read them and a protocol version does not have to move when somebody adds a node type.

Hand-written, little-endian, length-prefixed, and a truncated message is refused rather than read past — the four rules InspectorProtocol lays down, followed here rather than re-argued.

Fields and properties (6)

  • public const ushort Version

    What this build speaks. Bumped when a field is added to an existing message.

  • public const int MaximumStringBytes

    The longest string any field may carry.

  • public const int MaximumRows

    How many rows one response may carry.

  • public bool Enabled

    Whether this build answers at all. ⚠ Off, and a shipping build leaves it off.

  • public int Answered

    How many requests have been answered.

  • public int Refused

    How many have been refused, because the switch is off or the agent is gone.

Methods (5)

  • public static void WriteRequest(IBufferWriter<byte> writer, Entity entity)

    Writes a request for one agent.

  • public static bool TryReadRequest(ReadOnlySpan<byte> payload, out Entity entity, out ushort version)

    Reads a request.

  • public bool TryHandle(ReadOnlySpan<byte> request, AiSystem system, World world, IBufferWriter<byte> reply)

    Answers a request, if this build answers requests.

  • public static void WriteAgent(IBufferWriter<byte> writer, AiAgentSnapshot snapshot)

    Writes an agent's state.

  • public static bool TryReadAgent(ReadOnlySpan<byte> payload, AiAgentSnapshot into)

    Reads an agent's state.

Used by (1)

  • AiDebugChannelTestsVixen.Ai.Tests