fix(gateway): expose settling wizard state

This commit is contained in:
Jesse Merhi
2026-08-10 01:23:32 +10:00
committed by jesse-merhi
parent 0c004b4e9a
commit a1bfa34368
6 changed files with 39 additions and 0 deletions
@@ -10330,6 +10330,7 @@ public struct SystemAgentChatResult: Codable, Sendable {
public let reply: String
public let sensitive: Bool?
public let wizardinputpending: Bool?
public let wizardsettling: Bool?
public let action: AnyCodable
public let agentdraft: String?
public let agentid: String?
@@ -10343,6 +10344,7 @@ public struct SystemAgentChatResult: Codable, Sendable {
reply: String,
sensitive: Bool? = nil,
wizardinputpending: Bool? = nil,
wizardsettling: Bool? = nil,
action: AnyCodable,
agentdraft: String? = nil,
agentid: String? = nil,
@@ -10355,6 +10357,7 @@ public struct SystemAgentChatResult: Codable, Sendable {
self.reply = reply
self.sensitive = sensitive
self.wizardinputpending = wizardinputpending
self.wizardsettling = wizardsettling
self.action = action
self.agentdraft = agentdraft
self.agentid = agentid
@@ -10369,6 +10372,7 @@ public struct SystemAgentChatResult: Codable, Sendable {
case reply
case sensitive
case wizardinputpending = "wizardInputPending"
case wizardsettling = "wizardSettling"
case action
case agentdraft = "agentDraft"
case agentid = "agentId"
@@ -7,6 +7,7 @@ import {
} from "../index.js";
import {
SystemAgentChatQuestionSchema,
SystemAgentChatResultSchema,
SystemAgentChatHistoryResultSchema,
SystemAgentSetupDetectResultSchema,
SystemAgentSetupVerifyResultSchema,
@@ -98,6 +99,19 @@ describe("OpenClaw chat question protocol", () => {
});
});
describe("OpenClaw chat result protocol", () => {
it("accepts an explicit non-input wizard settlement state", () => {
expect(
Value.Check(SystemAgentChatResultSchema, {
sessionId: "session-1",
reply: "Setup is still finishing the QR attempt.",
action: "none",
wizardSettling: true,
}),
).toBe(true);
});
});
describe("OpenClaw chat history protocol", () => {
it("accepts the default request and bounds explicit limits", () => {
expect(validateSystemAgentChatHistoryParams({})).toBe(true);
@@ -88,6 +88,8 @@ export const SystemAgentChatResultSchema = closedObject({
sensitive: Type.Optional(Type.Boolean()),
/** The hosted wizard will consume the next message as its current step answer. */
wizardInputPending: Type.Optional(Type.Boolean()),
/** The hosted wizard is settling external work and has no answerable step. */
wizardSettling: Type.Optional(Type.Boolean()),
action: Type.Union([
Type.Literal("none"),
// The user asked to talk to their agent; clients should move to their
@@ -146,6 +146,7 @@ type GatewaySystemAgentChatReply = {
action: "none" | "exit" | "open-tui" | "open-setup";
sensitive?: boolean;
wizardInputPending?: boolean;
wizardSettling?: boolean;
question?: SystemAgentChatQuestion;
step?: WizardStep;
};
@@ -184,4 +184,21 @@ describe("system-agent chat input", () => {
step: { id: "channel", type: "select" },
});
});
it("preserves non-input wizard settlement in the gateway result", () => {
expect(
buildSystemAgentChatResult({
sessionId: "s1",
reply: {
text: "Setup is still finishing the QR attempt.",
action: "none",
wizardSettling: true,
},
}),
).toMatchObject({
sessionId: "s1",
action: "none",
wizardSettling: true,
});
});
});
@@ -97,6 +97,7 @@ export function buildSystemAgentChatResult(params: {
: {}),
...(params.reply.sensitive === true ? { sensitive: true } : {}),
...(params.reply.wizardInputPending === true ? { wizardInputPending: true } : {}),
...(params.reply.wizardSettling === true ? { wizardSettling: true } : {}),
...(params.reply.question ? { question: params.reply.question } : {}),
...(params.reply.step ? { step: params.reply.step } : {}),
...(params.proposalId ? { needsApproval: true, proposalId: params.proposalId } : {}),