mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-19 01:11:43 +00:00
fix(gateway): approval registry hardening and protocol-surface follow-ups
Follow-up delta to the merged #103579 head, rebased onto current main: - gateway-protocol wire types derive from owner-module schema consts (types.ts tombstone) and ProtocolSchemas leaves the package index so the public plugin-sdk d.ts graph tree-shakes the registry declaration - approval access authority follows the operator.approvals scope tier with reviewerDeviceIds as the opt-in restriction (cross-surface first-answer-wins; requester identity gates only legacy adapters) - plugin node.invoke approvals register directly so unrenderable presentations fail closed before request routing - exec-approval manager reconciliation with #103515 revocation hardening (resolution source attribution, one-shot ask-fallback consumption) - surface-report pins and plugin-sdk API baseline refreshed; Swift models regenerated
This commit is contained in:
@@ -10135,22 +10135,18 @@ public struct ApprovalGetResult: Codable, Sendable {
|
||||
|
||||
public struct ApprovalResolveParams: Codable, Sendable {
|
||||
public let id: String
|
||||
public let kind: ApprovalKind
|
||||
public let decision: ApprovalDecision
|
||||
|
||||
public init(
|
||||
id: String,
|
||||
kind: ApprovalKind,
|
||||
decision: ApprovalDecision)
|
||||
{
|
||||
self.id = id
|
||||
self.kind = kind
|
||||
self.decision = decision
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
case kind
|
||||
case decision
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,13 +108,8 @@ describe("unified approval protocol validators", () => {
|
||||
allowedDecisions: ["allow-always"],
|
||||
}),
|
||||
).toBe(false);
|
||||
expect(
|
||||
validateApprovalResolveParams({ id: execRecord.id, kind: "exec", decision: "deny" }),
|
||||
).toBe(true);
|
||||
expect(validateApprovalResolveParams({ id: execRecord.id, decision: "deny" })).toBe(false);
|
||||
expect(
|
||||
validateApprovalResolveParams({ id: execRecord.id, kind: "exec", decision: "accept" }),
|
||||
).toBe(false);
|
||||
expect(validateApprovalResolveParams({ id: execRecord.id, decision: "deny" })).toBe(true);
|
||||
expect(validateApprovalResolveParams({ id: execRecord.id, decision: "accept" })).toBe(false);
|
||||
});
|
||||
|
||||
it("validates pending and every fail-closed terminal state", () => {
|
||||
@@ -168,17 +163,12 @@ describe("unified approval protocol validators", () => {
|
||||
expect(validateApprovalGetParams({ id: pluginRecord.id })).toBe(true);
|
||||
expect(validateApprovalGetParams({ id: "" })).toBe(false);
|
||||
expect(validateApprovalGetParams({ id: pluginRecord.id, kind: "plugin" })).toBe(false);
|
||||
expect(
|
||||
validateApprovalResolveParams({
|
||||
id: "plugin",
|
||||
kind: "plugin",
|
||||
decision: "deny",
|
||||
prefix: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
expect(validateApprovalResolveParams({ id: "plugin", decision: "deny", prefix: true })).toBe(
|
||||
false,
|
||||
);
|
||||
for (const id of ["\ud800", "\udc00", ".", ".."]) {
|
||||
expect(validateApprovalGetParams({ id })).toBe(false);
|
||||
expect(validateApprovalResolveParams({ id, kind: "exec", decision: "deny" })).toBe(false);
|
||||
expect(validateApprovalResolveParams({ id, decision: "deny" })).toBe(false);
|
||||
}
|
||||
expect(validateApprovalGetParams({ id: "approval:🦞/percent%" })).toBe(true);
|
||||
|
||||
|
||||
@@ -562,7 +562,6 @@ import {
|
||||
WebPushTestParamsSchema,
|
||||
type PresenceEntry,
|
||||
PresenceEntrySchema,
|
||||
ProtocolSchemas,
|
||||
type RequestFrame,
|
||||
RequestFrameSchema,
|
||||
type ResponseFrame,
|
||||
@@ -1964,7 +1963,6 @@ export {
|
||||
FsDirEntrySchema,
|
||||
FsListDirParamsSchema,
|
||||
FsListDirResultSchema,
|
||||
ProtocolSchemas,
|
||||
MIN_CLIENT_PROTOCOL_VERSION,
|
||||
MIN_NODE_PROTOCOL_VERSION,
|
||||
MIN_PROBE_PROTOCOL_VERSION,
|
||||
|
||||
@@ -36,7 +36,6 @@ export * from "./schema/system-info.js";
|
||||
export * from "./schema/task-suggestions.js";
|
||||
export * from "./schema/tasks.js";
|
||||
export * from "./schema/terminal.js";
|
||||
export * from "./schema/types.js";
|
||||
export * from "./schema/plugin-approvals.js";
|
||||
export * from "./schema/plugins.js";
|
||||
export * from "./schema/wizard.js";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { InputProvenanceSchema, NonEmptyString, SessionLabelString } from "./primitives.js";
|
||||
|
||||
@@ -294,3 +295,13 @@ export const WakeParamsSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: true }, // external wake senders may attach opaque metadata
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type AgentEvent = Static<typeof AgentEventSchema>;
|
||||
export type AgentIdentityParams = Static<typeof AgentIdentityParamsSchema>;
|
||||
export type AgentIdentityResult = Static<typeof AgentIdentityResultSchema>;
|
||||
export type MessageActionParams = Static<typeof MessageActionParamsSchema>;
|
||||
export type PollParams = Static<typeof PollParamsSchema>;
|
||||
export type AgentWaitParams = Static<typeof AgentWaitParamsSchema>;
|
||||
export type WakeParams = Static<typeof WakeParamsSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -1098,3 +1099,73 @@ export const ToolsInvokeResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type AgentSummary = Static<typeof AgentSummarySchema>;
|
||||
export type AgentsFileEntry = Static<typeof AgentsFileEntrySchema>;
|
||||
export type AgentsCreateParams = Static<typeof AgentsCreateParamsSchema>;
|
||||
export type AgentsCreateResult = Static<typeof AgentsCreateResultSchema>;
|
||||
export type AgentsUpdateParams = Static<typeof AgentsUpdateParamsSchema>;
|
||||
export type AgentsUpdateResult = Static<typeof AgentsUpdateResultSchema>;
|
||||
export type AgentsDeleteParams = Static<typeof AgentsDeleteParamsSchema>;
|
||||
export type AgentsDeleteResult = Static<typeof AgentsDeleteResultSchema>;
|
||||
export type AgentsFilesListParams = Static<typeof AgentsFilesListParamsSchema>;
|
||||
export type AgentsFilesListResult = Static<typeof AgentsFilesListResultSchema>;
|
||||
export type AgentsFilesGetParams = Static<typeof AgentsFilesGetParamsSchema>;
|
||||
export type AgentsFilesGetResult = Static<typeof AgentsFilesGetResultSchema>;
|
||||
export type AgentsFilesSetParams = Static<typeof AgentsFilesSetParamsSchema>;
|
||||
export type AgentsFilesSetResult = Static<typeof AgentsFilesSetResultSchema>;
|
||||
export type AgentsListParams = Static<typeof AgentsListParamsSchema>;
|
||||
export type AgentsListResult = Static<typeof AgentsListResultSchema>;
|
||||
export type ModelChoice = Static<typeof ModelChoiceSchema>;
|
||||
export type ModelsListParams = Static<typeof ModelsListParamsSchema>;
|
||||
export type ModelsListResult = Static<typeof ModelsListResultSchema>;
|
||||
export type SkillsStatusParams = Static<typeof SkillsStatusParamsSchema>;
|
||||
export type ToolsCatalogParams = Static<typeof ToolsCatalogParamsSchema>;
|
||||
export type ToolCatalogProfile = Static<typeof ToolCatalogProfileSchema>;
|
||||
export type ToolCatalogEntry = Static<typeof ToolCatalogEntrySchema>;
|
||||
export type ToolCatalogGroup = Static<typeof ToolCatalogGroupSchema>;
|
||||
export type ToolsCatalogResult = Static<typeof ToolsCatalogResultSchema>;
|
||||
export type ToolsEffectiveParams = Static<typeof ToolsEffectiveParamsSchema>;
|
||||
export type ToolsEffectiveEntry = Static<typeof ToolsEffectiveEntrySchema>;
|
||||
export type ToolsEffectiveGroup = Static<typeof ToolsEffectiveGroupSchema>;
|
||||
export type ToolsEffectiveNotice = Static<typeof ToolsEffectiveNoticeSchema>;
|
||||
export type ToolsEffectiveResult = Static<typeof ToolsEffectiveResultSchema>;
|
||||
export type ToolsInvokeParams = Static<typeof ToolsInvokeParamsSchema>;
|
||||
export type ToolsInvokeResult = Static<typeof ToolsInvokeResultSchema>;
|
||||
export type SkillsBinsParams = Static<typeof SkillsBinsParamsSchema>;
|
||||
export type SkillsBinsResult = Static<typeof SkillsBinsResultSchema>;
|
||||
export type SkillsSearchParams = Static<typeof SkillsSearchParamsSchema>;
|
||||
export type SkillsSearchResult = Static<typeof SkillsSearchResultSchema>;
|
||||
export type SkillsDetailParams = Static<typeof SkillsDetailParamsSchema>;
|
||||
export type SkillsDetailResult = Static<typeof SkillsDetailResultSchema>;
|
||||
export type SkillsProposalsListParams = Static<typeof SkillsProposalsListParamsSchema>;
|
||||
export type SkillsProposalsListResult = Static<typeof SkillsProposalsListResultSchema>;
|
||||
export type SkillsProposalInspectParams = Static<typeof SkillsProposalInspectParamsSchema>;
|
||||
export type SkillsProposalInspectResult = Static<typeof SkillsProposalInspectResultSchema>;
|
||||
export type SkillsProposalCreateParams = Static<typeof SkillsProposalCreateParamsSchema>;
|
||||
export type SkillsProposalUpdateParams = Static<typeof SkillsProposalUpdateParamsSchema>;
|
||||
export type SkillsProposalReviseParams = Static<typeof SkillsProposalReviseParamsSchema>;
|
||||
export type SkillsProposalRequestRevisionParams = Static<
|
||||
typeof SkillsProposalRequestRevisionParamsSchema
|
||||
>;
|
||||
export type SkillsProposalRequestRevisionResult = Static<
|
||||
typeof SkillsProposalRequestRevisionResultSchema
|
||||
>;
|
||||
export type SkillsProposalActionParams = Static<typeof SkillsProposalActionParamsSchema>;
|
||||
export type SkillsProposalApplyResult = Static<typeof SkillsProposalApplyResultSchema>;
|
||||
export type SkillsProposalRecordResult = Static<typeof SkillsProposalRecordResultSchema>;
|
||||
export type SkillsCuratorStatusParams = Static<typeof SkillsCuratorStatusParamsSchema>;
|
||||
export type SkillsCuratorStatusResult = Static<typeof SkillsCuratorStatusResultSchema>;
|
||||
export type SkillsCuratorActionParams = Static<typeof SkillsCuratorActionParamsSchema>;
|
||||
export type SkillsCuratorActionResult = Static<typeof SkillsCuratorActionResultSchema>;
|
||||
export type SkillsSecurityVerdictsParams = Static<typeof SkillsSecurityVerdictsParamsSchema>;
|
||||
export type SkillsSecurityVerdictsResult = Static<typeof SkillsSecurityVerdictsResultSchema>;
|
||||
export type SkillsSkillCardParams = Static<typeof SkillsSkillCardParamsSchema>;
|
||||
export type SkillsSkillCardResult = Static<typeof SkillsSkillCardResultSchema>;
|
||||
export type SkillsUploadBeginParams = Static<typeof SkillsUploadBeginParamsSchema>;
|
||||
export type SkillsUploadChunkParams = Static<typeof SkillsUploadChunkParamsSchema>;
|
||||
export type SkillsUploadCommitParams = Static<typeof SkillsUploadCommitParamsSchema>;
|
||||
export type SkillsInstallParams = Static<typeof SkillsInstallParamsSchema>;
|
||||
export type SkillsUpdateParams = Static<typeof SkillsUpdateParamsSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -78,3 +79,12 @@ export const AgentsWorkspaceGetResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type AgentsWorkspaceEntry = Static<typeof AgentsWorkspaceEntrySchema>;
|
||||
export type AgentsWorkspaceFile = Static<typeof AgentsWorkspaceFileSchema>;
|
||||
export type AgentsWorkspaceListParams = Static<typeof AgentsWorkspaceListParamsSchema>;
|
||||
export type AgentsWorkspaceListResult = Static<typeof AgentsWorkspaceListResultSchema>;
|
||||
export type AgentsWorkspaceGetParams = Static<typeof AgentsWorkspaceGetParamsSchema>;
|
||||
export type AgentsWorkspaceGetResult = Static<typeof AgentsWorkspaceGetResultSchema>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Static } from "typebox";
|
||||
// Gateway Protocol schema module defines durable cross-surface approval shapes.
|
||||
import { Type } from "typebox";
|
||||
import type { Static } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
const APPROVAL_ID_WELL_FORMED_UNICODE_PATTERN =
|
||||
@@ -212,7 +212,6 @@ export const ApprovalGetResultSchema = Type.Object(
|
||||
export const ApprovalResolveParamsSchema = Type.Object(
|
||||
{
|
||||
id: ApprovalRecordCommonFields.id,
|
||||
kind: ApprovalKindSchema,
|
||||
decision: ApprovalDecisionSchema,
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
@@ -227,8 +226,8 @@ export const ApprovalResolveResultSchema = Type.Object(
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// These types are plugin-SDK-reachable through approval presentation. Export
|
||||
// them from the owner module so public declarations do not retain ProtocolSchemas.
|
||||
// Owner-local wire types derived directly from local schema consts so the
|
||||
// public plugin-sdk declaration graph never pulls in the ProtocolSchemas registry.
|
||||
export type ApprovalKind = Static<typeof ApprovalKindSchema>;
|
||||
export type ApprovalDecision = Static<typeof ApprovalDecisionSchema>;
|
||||
export type ApprovalAllowDecision = Static<typeof ApprovalAllowDecisionSchema>;
|
||||
@@ -238,13 +237,13 @@ export type ExecApprovalPresentation = Static<typeof ExecApprovalPresentationSch
|
||||
export type PluginApprovalPresentation = Static<typeof PluginApprovalPresentationSchema>;
|
||||
export type ApprovalPresentation = Static<typeof ApprovalPresentationSchema>;
|
||||
export type PendingApprovalSnapshot = Static<typeof PendingApprovalSnapshotSchema>;
|
||||
export type AllowedApprovalSnapshot = Static<typeof AllowedApprovalSnapshotSchema>;
|
||||
export type DeniedApprovalSnapshot = Static<typeof DeniedApprovalSnapshotSchema>;
|
||||
export type ExpiredApprovalSnapshot = Static<typeof ExpiredApprovalSnapshotSchema>;
|
||||
export type CancelledApprovalSnapshot = Static<typeof CancelledApprovalSnapshotSchema>;
|
||||
export type ApprovalSnapshot = Static<typeof ApprovalSnapshotSchema>;
|
||||
export type TerminalApprovalSnapshot = Static<typeof TerminalApprovalSnapshotSchema>;
|
||||
export type ApprovalGetParams = Static<typeof ApprovalGetParamsSchema>;
|
||||
export type ApprovalGetResult = Static<typeof ApprovalGetResultSchema>;
|
||||
export type ApprovalResolveParams = Static<typeof ApprovalResolveParamsSchema>;
|
||||
export type ApprovalResolveResult = Static<typeof ApprovalResolveResultSchema>;
|
||||
export type AllowedApprovalSnapshot = Static<typeof AllowedApprovalSnapshotSchema>;
|
||||
export type DeniedApprovalSnapshot = Static<typeof DeniedApprovalSnapshotSchema>;
|
||||
export type ExpiredApprovalSnapshot = Static<typeof ExpiredApprovalSnapshotSchema>;
|
||||
export type CancelledApprovalSnapshot = Static<typeof CancelledApprovalSnapshotSchema>;
|
||||
export type TerminalApprovalSnapshot = Static<typeof TerminalApprovalSnapshotSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -87,3 +88,13 @@ export const ArtifactsDownloadResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type ArtifactSummary = Static<typeof ArtifactSummarySchema>;
|
||||
export type ArtifactsListParams = Static<typeof ArtifactsListParamsSchema>;
|
||||
export type ArtifactsListResult = Static<typeof ArtifactsListResultSchema>;
|
||||
export type ArtifactsGetParams = Static<typeof ArtifactsGetParamsSchema>;
|
||||
export type ArtifactsGetResult = Static<typeof ArtifactsGetResultSchema>;
|
||||
export type ArtifactsDownloadParams = Static<typeof ArtifactsDownloadParamsSchema>;
|
||||
export type ArtifactsDownloadResult = Static<typeof ArtifactsDownloadResultSchema>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Versioned metadata-only activity audit query payloads.
|
||||
import { Type, type TProperties, type TSchema } from "typebox";
|
||||
import { type TProperties, type TSchema, Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
const AuditActivitySchemaVersionV1Schema = Type.Integer({ minimum: 1, maximum: 1 });
|
||||
@@ -458,3 +458,180 @@ export const AuditActivityListResultSchema: TSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
/** Metadata-only audit query payloads. */
|
||||
// These wire types stay explicit because the runtime schemas use JSON Schema
|
||||
// `allOf` correlations that TypeBox cannot infer without expanding the public
|
||||
// declaration graph far beyond the compact protocol contract.
|
||||
type AuditActivityRecordBaseV1 = {
|
||||
schemaVersion: 1;
|
||||
eventId: string;
|
||||
sequence: number;
|
||||
sourceSequence: number;
|
||||
occurredAt: number;
|
||||
redaction: "metadata_only";
|
||||
};
|
||||
|
||||
type AuditActivityAgentRecordBaseV1 = AuditActivityRecordBaseV1 & {
|
||||
actor: { type: "agent" | "system"; id: string };
|
||||
agentId: string;
|
||||
sessionKey?: string;
|
||||
sessionId?: string;
|
||||
runId: string;
|
||||
};
|
||||
|
||||
type AuditActivityAgentRunV1Terminal =
|
||||
| { action: "agent.run.started"; status: "started"; errorCode?: never }
|
||||
| { action: "agent.run.finished"; status: "succeeded"; errorCode?: never }
|
||||
| { action: "agent.run.finished"; status: "failed"; errorCode: "run_failed" }
|
||||
| { action: "agent.run.finished"; status: "cancelled"; errorCode: "run_cancelled" }
|
||||
| { action: "agent.run.finished"; status: "timed_out"; errorCode: "run_timed_out" }
|
||||
| { action: "agent.run.finished"; status: "blocked"; errorCode: "run_blocked" };
|
||||
export type AuditActivityAgentRunV1 = AuditActivityAgentRecordBaseV1 & {
|
||||
eventType: "agent_run";
|
||||
kind: "agent_run";
|
||||
} & AuditActivityAgentRunV1Terminal;
|
||||
|
||||
type AuditActivityToolActionV1Terminal =
|
||||
| { action: "tool.action.started"; status: "started"; errorCode?: never }
|
||||
| { action: "tool.action.finished"; status: "succeeded"; errorCode?: never }
|
||||
| { action: "tool.action.finished"; status: "failed"; errorCode: "tool_failed" }
|
||||
| { action: "tool.action.finished"; status: "cancelled"; errorCode: "tool_cancelled" }
|
||||
| { action: "tool.action.finished"; status: "timed_out"; errorCode: "tool_timed_out" }
|
||||
| { action: "tool.action.finished"; status: "blocked"; errorCode: "tool_blocked" }
|
||||
| {
|
||||
action: "tool.action.finished";
|
||||
status: "unknown";
|
||||
errorCode: "tool_outcome_unknown";
|
||||
};
|
||||
export type AuditActivityToolActionV1 = AuditActivityAgentRecordBaseV1 & {
|
||||
eventType: "tool_action";
|
||||
kind: "tool_action";
|
||||
toolCallId?: string;
|
||||
toolName?: string;
|
||||
} & AuditActivityToolActionV1Terminal;
|
||||
|
||||
type AuditActivityMessageRecordBaseV1 = AuditActivityRecordBaseV1 & {
|
||||
kind: "message";
|
||||
channel: string;
|
||||
conversationKind: "direct" | "group" | "channel" | "unknown";
|
||||
durationMs?: number;
|
||||
resultCount?: number;
|
||||
agentId?: string;
|
||||
runId?: string;
|
||||
accountRef?: string;
|
||||
conversationRef?: string;
|
||||
messageRef?: string;
|
||||
targetRef?: string;
|
||||
sessionKey?: never;
|
||||
sessionId?: never;
|
||||
toolCallId?: never;
|
||||
toolName?: never;
|
||||
};
|
||||
|
||||
type AuditActivityInboundMessageV1Terminal =
|
||||
| {
|
||||
status: "succeeded";
|
||||
outcome: "completed";
|
||||
errorCode?: never;
|
||||
reasonCode?:
|
||||
| "fast_abort"
|
||||
| "plugin_bound_handled"
|
||||
| "plugin_bound_unavailable"
|
||||
| "plugin_bound_declined"
|
||||
| "before_dispatch_handled"
|
||||
| "acp_dispatch_completed"
|
||||
| "acp_dispatch_empty";
|
||||
}
|
||||
| {
|
||||
status: "blocked";
|
||||
outcome: "skipped";
|
||||
errorCode?: never;
|
||||
reasonCode?:
|
||||
| "duplicate"
|
||||
| "reply_operation_active"
|
||||
| "reply_operation_aborted"
|
||||
| "acp_dispatch_aborted";
|
||||
}
|
||||
| {
|
||||
status: "failed";
|
||||
outcome: "failed";
|
||||
errorCode: "message_processing_failed";
|
||||
reasonCode?: "acp_dispatch_failed" | "plugin_bound_error";
|
||||
};
|
||||
export type AuditActivityInboundMessageV1 = AuditActivityMessageRecordBaseV1 & {
|
||||
eventType: "inbound_message";
|
||||
action: "message.inbound.processed";
|
||||
direction: "inbound";
|
||||
actor: { type: "channel_sender"; id: string } | { type: "system"; id: string };
|
||||
deliveryKind?: never;
|
||||
failureStage?: never;
|
||||
} & AuditActivityInboundMessageV1Terminal;
|
||||
|
||||
type AuditActivityOutboundMessageV1Terminal =
|
||||
| {
|
||||
status: "succeeded";
|
||||
outcome: "sent";
|
||||
errorCode?: never;
|
||||
reasonCode?: never;
|
||||
failureStage?: never;
|
||||
deliveryKind?: "text" | "media" | "other";
|
||||
}
|
||||
| {
|
||||
status: "blocked";
|
||||
outcome: "suppressed";
|
||||
errorCode?: never;
|
||||
reasonCode:
|
||||
| "cancelled_by_message_sending_hook"
|
||||
| "cancelled_by_reply_payload_sending_hook"
|
||||
| "empty_after_message_sending_hook"
|
||||
| "empty_after_reply_payload_sending_hook"
|
||||
| "no_visible_payload";
|
||||
failureStage?: never;
|
||||
deliveryKind?: never;
|
||||
}
|
||||
| {
|
||||
status: "failed";
|
||||
outcome: "failed";
|
||||
errorCode: "message_delivery_failed" | "message_delivery_partial_failure";
|
||||
reasonCode?: never;
|
||||
failureStage: "platform_send" | "queue" | "unknown";
|
||||
deliveryKind?: "text" | "media" | "other";
|
||||
}
|
||||
| {
|
||||
status: "unknown";
|
||||
outcome: "unknown";
|
||||
errorCode?: never;
|
||||
reasonCode?: never;
|
||||
failureStage: "platform_send" | "queue" | "unknown";
|
||||
deliveryKind?: never;
|
||||
};
|
||||
export type AuditActivityOutboundMessageV1 = AuditActivityMessageRecordBaseV1 & {
|
||||
eventType: "outbound_message";
|
||||
action: "message.outbound.finished";
|
||||
direction: "outbound";
|
||||
actor: { type: "agent" | "system"; id: string };
|
||||
} & AuditActivityOutboundMessageV1Terminal;
|
||||
|
||||
export type AuditActivityEventV1 =
|
||||
| AuditActivityAgentRunV1
|
||||
| AuditActivityToolActionV1
|
||||
| AuditActivityInboundMessageV1
|
||||
| AuditActivityOutboundMessageV1;
|
||||
export type AuditActivityListParams = {
|
||||
agentId?: string;
|
||||
sessionKey?: string;
|
||||
runId?: string;
|
||||
kind?: "agent_run" | "tool_action" | "message";
|
||||
status?: "started" | "succeeded" | "failed" | "cancelled" | "timed_out" | "blocked" | "unknown";
|
||||
direction?: "inbound" | "outbound";
|
||||
channel?: string;
|
||||
after?: number;
|
||||
before?: number;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
};
|
||||
export type AuditActivityListResult = {
|
||||
events: AuditActivityEventV1[];
|
||||
nextCursor?: string;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines metadata-only audit query payloads.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -89,3 +90,9 @@ export const AuditListResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type AuditEvent = Static<typeof AuditEventSchema>;
|
||||
export type AuditListParams = Static<typeof AuditListParamsSchema>;
|
||||
export type AuditListResult = Static<typeof AuditListResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString, SecretInputSchema } from "./primitives.js";
|
||||
|
||||
@@ -880,3 +881,44 @@ export const WebLoginWaitParamsSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type TalkEvent = Static<typeof TalkEventSchema>;
|
||||
export type TalkModeParams = Static<typeof TalkModeParamsSchema>;
|
||||
export type TalkCatalogParams = Static<typeof TalkCatalogParamsSchema>;
|
||||
export type TalkCatalogResult = Static<typeof TalkCatalogResultSchema>;
|
||||
export type TalkConfigParams = Static<typeof TalkConfigParamsSchema>;
|
||||
export type TalkConfigResult = Static<typeof TalkConfigResultSchema>;
|
||||
export type TalkClientCreateParams = Static<typeof TalkClientCreateParamsSchema>;
|
||||
export type TalkClientCreateResult = Static<typeof TalkClientCreateResultSchema>;
|
||||
export type TalkClientSteerParams = Static<typeof TalkClientSteerParamsSchema>;
|
||||
export type TalkAgentControlResult = Static<typeof TalkAgentControlResultSchema>;
|
||||
export type TalkClientToolCallParams = Static<typeof TalkClientToolCallParamsSchema>;
|
||||
export type TalkClientToolCallResult = Static<typeof TalkClientToolCallResultSchema>;
|
||||
export type TalkSessionCreateParams = Static<typeof TalkSessionCreateParamsSchema>;
|
||||
export type TalkSessionCreateResult = Static<typeof TalkSessionCreateResultSchema>;
|
||||
export type TalkSessionJoinParams = Static<typeof TalkSessionJoinParamsSchema>;
|
||||
export type TalkSessionJoinResult = Static<typeof TalkSessionJoinResultSchema>;
|
||||
export type TalkSessionAppendAudioParams = Static<typeof TalkSessionAppendAudioParamsSchema>;
|
||||
export type TalkSessionTurnParams = Static<typeof TalkSessionTurnParamsSchema>;
|
||||
export type TalkSessionCancelTurnParams = Static<typeof TalkSessionCancelTurnParamsSchema>;
|
||||
export type TalkSessionCancelOutputParams = Static<typeof TalkSessionCancelOutputParamsSchema>;
|
||||
export type TalkSessionTurnResult = Static<typeof TalkSessionTurnResultSchema>;
|
||||
export type TalkSessionSteerParams = Static<typeof TalkSessionSteerParamsSchema>;
|
||||
export type TalkSessionSubmitToolResultParams = Static<
|
||||
typeof TalkSessionSubmitToolResultParamsSchema
|
||||
>;
|
||||
export type TalkSessionCloseParams = Static<typeof TalkSessionCloseParamsSchema>;
|
||||
export type TalkSessionOkResult = Static<typeof TalkSessionOkResultSchema>;
|
||||
export type TalkSpeakParams = Static<typeof TalkSpeakParamsSchema>;
|
||||
export type TalkSpeakResult = Static<typeof TalkSpeakResultSchema>;
|
||||
export type TtsSpeakParams = Static<typeof TtsSpeakParamsSchema>;
|
||||
export type TtsSpeakResult = Static<typeof TtsSpeakResultSchema>;
|
||||
export type ChannelsStatusParams = Static<typeof ChannelsStatusParamsSchema>;
|
||||
export type ChannelsStatusResult = Static<typeof ChannelsStatusResultSchema>;
|
||||
export type ChannelsStartParams = Static<typeof ChannelsStartParamsSchema>;
|
||||
export type ChannelsStopParams = Static<typeof ChannelsStopParamsSchema>;
|
||||
export type ChannelsLogoutParams = Static<typeof ChannelsLogoutParamsSchema>;
|
||||
export type WebLoginStartParams = Static<typeof WebLoginStartParamsSchema>;
|
||||
export type WebLoginWaitParams = Static<typeof WebLoginWaitParamsSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -118,3 +119,9 @@ export const CommandsListResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type CommandEntry = Static<typeof CommandEntrySchema>;
|
||||
export type CommandsListParams = Static<typeof CommandsListParamsSchema>;
|
||||
export type CommandsListResult = Static<typeof CommandsListResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -146,3 +147,16 @@ export const ConfigSchemaLookupResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type ConfigGetParams = Static<typeof ConfigGetParamsSchema>;
|
||||
export type ConfigSetParams = Static<typeof ConfigSetParamsSchema>;
|
||||
export type ConfigApplyParams = Static<typeof ConfigApplyParamsSchema>;
|
||||
export type ConfigPatchParams = Static<typeof ConfigPatchParamsSchema>;
|
||||
export type ConfigSchemaParams = Static<typeof ConfigSchemaParamsSchema>;
|
||||
export type ConfigSchemaLookupParams = Static<typeof ConfigSchemaLookupParamsSchema>;
|
||||
export type ConfigSchemaResponse = Static<typeof ConfigSchemaResponseSchema>;
|
||||
export type ConfigSchemaLookupResult = Static<typeof ConfigSchemaLookupResultSchema>;
|
||||
export type UpdateStatusParams = Static<typeof UpdateStatusParamsSchema>;
|
||||
export type UpdateRunParams = Static<typeof UpdateRunParamsSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines Crestodian chat payloads.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
import { WizardStartResultSchema } from "./wizard.js";
|
||||
@@ -201,3 +202,16 @@ export const CrestodianSetupAuthStartParamsSchema = Type.Object(
|
||||
);
|
||||
|
||||
export const CrestodianSetupAuthStartResultSchema = WizardStartResultSchema;
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type CrestodianChatParams = Static<typeof CrestodianChatParamsSchema>;
|
||||
export type CrestodianChatResult = Static<typeof CrestodianChatResultSchema>;
|
||||
export type CrestodianSetupDetectParams = Static<typeof CrestodianSetupDetectParamsSchema>;
|
||||
export type CrestodianSetupDetectResult = Static<typeof CrestodianSetupDetectResultSchema>;
|
||||
export type CrestodianSetupActivateParams = Static<typeof CrestodianSetupActivateParamsSchema>;
|
||||
export type CrestodianSetupActivateResult = Static<typeof CrestodianSetupActivateResultSchema>;
|
||||
export type CrestodianSetupVerifyParams = Static<typeof CrestodianSetupVerifyParamsSchema>;
|
||||
export type CrestodianSetupVerifyResult = Static<typeof CrestodianSetupVerifyResultSchema>;
|
||||
export type CrestodianSetupAuthStartParams = Static<typeof CrestodianSetupAuthStartParamsSchema>;
|
||||
export type CrestodianSetupAuthStartResult = Static<typeof CrestodianSetupAuthStartResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type, type TSchema } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -665,3 +666,18 @@ export const CronRunLogEntrySchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type CronJob = Static<typeof CronJobSchema>;
|
||||
export type CronListParams = Static<typeof CronListParamsSchema>;
|
||||
export type CronStatusParams = Static<typeof CronStatusParamsSchema>;
|
||||
export type CronGetParams = Static<typeof CronGetParamsSchema>;
|
||||
export type CronAddParams = Static<typeof CronAddParamsSchema>;
|
||||
export type CronAddResult = Static<typeof CronAddResultSchema>;
|
||||
export type CronDeclarativeAddResult = Static<typeof CronDeclarativeAddResultSchema>;
|
||||
export type CronUpdateParams = Static<typeof CronUpdateParamsSchema>;
|
||||
export type CronRemoveParams = Static<typeof CronRemoveParamsSchema>;
|
||||
export type CronRunParams = Static<typeof CronRunParamsSchema>;
|
||||
export type CronRunsParams = Static<typeof CronRunsParamsSchema>;
|
||||
export type CronRunLogEntry = Static<typeof CronRunLogEntrySchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -131,3 +132,15 @@ export const DevicePairSetupCodeResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type DevicePairListParams = Static<typeof DevicePairListParamsSchema>;
|
||||
export type DevicePairApproveParams = Static<typeof DevicePairApproveParamsSchema>;
|
||||
export type DevicePairRejectParams = Static<typeof DevicePairRejectParamsSchema>;
|
||||
export type DevicePairRemoveParams = Static<typeof DevicePairRemoveParamsSchema>;
|
||||
export type DevicePairSetupCodeParams = Static<typeof DevicePairSetupCodeParamsSchema>;
|
||||
export type DevicePairSetupCodeResult = Static<typeof DevicePairSetupCodeResultSchema>;
|
||||
export type DevicePairRenameParams = Static<typeof DevicePairRenameParamsSchema>;
|
||||
export type DeviceTokenRotateParams = Static<typeof DeviceTokenRotateParamsSchema>;
|
||||
export type DeviceTokenRevokeParams = Static<typeof DeviceTokenRevokeParamsSchema>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Static } from "typebox";
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
@@ -366,3 +367,15 @@ export const ExecApprovalResolveParamsSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Owner-local wire types derived directly from local schema consts so the
|
||||
// public plugin-sdk declaration graph never pulls in the ProtocolSchemas registry.
|
||||
export type ExecApprovalsGetParams = Static<typeof ExecApprovalsGetParamsSchema>;
|
||||
export type ExecApprovalsSetParams = Static<typeof ExecApprovalsSetParamsSchema>;
|
||||
export type ExecApprovalsNodeGetParams = Static<typeof ExecApprovalsNodeGetParamsSchema>;
|
||||
export type ExecApprovalsNodeSnapshot = Static<typeof ExecApprovalsNodeSnapshotSchema>;
|
||||
export type ExecApprovalsNodeSetParams = Static<typeof ExecApprovalsNodeSetParamsSchema>;
|
||||
export type ExecApprovalsSnapshot = Static<typeof ExecApprovalsSnapshotSchema>;
|
||||
export type ExecApprovalGetParams = Static<typeof ExecApprovalGetParamsSchema>;
|
||||
export type ExecApprovalRequestParams = Static<typeof ExecApprovalRequestParamsSchema>;
|
||||
export type ExecApprovalResolveParams = Static<typeof ExecApprovalResolveParamsSchema>;
|
||||
|
||||
@@ -225,3 +225,8 @@ export type RequestFrame = Static<typeof RequestFrameSchema>;
|
||||
export type ResponseFrame = Static<typeof ResponseFrameSchema>;
|
||||
export type EventFrame = Static<typeof EventFrameSchema>;
|
||||
export type GatewayFrame = Static<typeof GatewayFrameSchema>;
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type TickEvent = Static<typeof TickEventSchema>;
|
||||
export type ShutdownEvent = Static<typeof ShutdownEventSchema>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -33,3 +34,9 @@ export const FsListDirResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type FsDirEntry = Static<typeof FsDirEntrySchema>;
|
||||
export type FsListDirParams = Static<typeof FsListDirParamsSchema>;
|
||||
export type FsListDirResult = Static<typeof FsListDirResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schemas for cooperative host suspension.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
|
||||
const SuspensionTokenSchema = Type.String({ minLength: 1, maxLength: 128, pattern: "\\S" });
|
||||
@@ -107,3 +108,14 @@ export const GatewaySuspendResumeResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type GatewaySuspendTaskBlocker = Static<typeof GatewaySuspendTaskBlockerSchema>;
|
||||
export type GatewaySuspendBlocker = Static<typeof GatewaySuspendBlockerSchema>;
|
||||
export type GatewaySuspendPrepareParams = Static<typeof GatewaySuspendPrepareParamsSchema>;
|
||||
export type GatewaySuspendPrepareResult = Static<typeof GatewaySuspendPrepareResultSchema>;
|
||||
export type GatewaySuspendStatusParams = Static<typeof GatewaySuspendStatusParamsSchema>;
|
||||
export type GatewaySuspendStatusResult = Static<typeof GatewaySuspendStatusResultSchema>;
|
||||
export type GatewaySuspendResumeParams = Static<typeof GatewaySuspendResumeParamsSchema>;
|
||||
export type GatewaySuspendResumeResult = Static<typeof GatewaySuspendResumeResultSchema>;
|
||||
|
||||
@@ -235,3 +235,13 @@ export const ChatEventSchema = Type.Union([
|
||||
ChatAbortedEventSchema,
|
||||
ChatErrorEventSchema,
|
||||
]);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type ChatMetadataParams = Static<typeof ChatMetadataParamsSchema>;
|
||||
export type ChatToolTitlesParams = Static<typeof ChatToolTitlesParamsSchema>;
|
||||
export type LogsTailParams = Static<typeof LogsTailParamsSchema>;
|
||||
export type LogsTailResult = Static<typeof LogsTailResultSchema>;
|
||||
export type ChatAbortParams = Static<typeof ChatAbortParamsSchema>;
|
||||
export type ChatInjectParams = Static<typeof ChatInjectParamsSchema>;
|
||||
export type ChatEvent = Static<typeof ChatEventSchema>;
|
||||
|
||||
@@ -276,3 +276,24 @@ export const NodeInvokeRequestEventSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type NodePairListParams = Static<typeof NodePairListParamsSchema>;
|
||||
export type NodePairApproveParams = Static<typeof NodePairApproveParamsSchema>;
|
||||
export type NodePairRejectParams = Static<typeof NodePairRejectParamsSchema>;
|
||||
export type NodePairRemoveParams = Static<typeof NodePairRemoveParamsSchema>;
|
||||
export type NodeRenameParams = Static<typeof NodeRenameParamsSchema>;
|
||||
export type NodeListParams = Static<typeof NodeListParamsSchema>;
|
||||
export type NodePendingAckParams = Static<typeof NodePendingAckParamsSchema>;
|
||||
export type NodeDescribeParams = Static<typeof NodeDescribeParamsSchema>;
|
||||
export type NodeInvokeParams = Static<typeof NodeInvokeParamsSchema>;
|
||||
export type NodeInvokeResultParams = Static<typeof NodeInvokeResultParamsSchema>;
|
||||
export type NodeEventParams = Static<typeof NodeEventParamsSchema>;
|
||||
export type NodeEventResult = Static<typeof NodeEventResultSchema>;
|
||||
export type NodePresenceAlivePayload = Static<typeof NodePresenceAlivePayloadSchema>;
|
||||
export type NodePresenceAliveReason = Static<typeof NodePresenceAliveReasonSchema>;
|
||||
export type NodePendingDrainParams = Static<typeof NodePendingDrainParamsSchema>;
|
||||
export type NodePendingDrainResult = Static<typeof NodePendingDrainResultSchema>;
|
||||
export type NodePendingEnqueueParams = Static<typeof NodePendingEnqueueParamsSchema>;
|
||||
export type NodePendingEnqueueResult = Static<typeof NodePendingEnqueueResultSchema>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Static } from "typebox";
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
@@ -54,3 +55,8 @@ export const PluginApprovalResolveParamsSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Owner-local wire types derived directly from local schema consts so the
|
||||
// public plugin-sdk declaration graph never pulls in the ProtocolSchemas registry.
|
||||
export type PluginApprovalRequestParams = Static<typeof PluginApprovalRequestParamsSchema>;
|
||||
export type PluginApprovalResolveParams = Static<typeof PluginApprovalResolveParamsSchema>;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import { Type, type Static } from "typebox";
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
/**
|
||||
@@ -278,3 +279,11 @@ export type PluginsUninstallParams = Static<typeof PluginsUninstallParamsSchema>
|
||||
export type PluginsUninstallResult = Static<typeof PluginsUninstallResultSchema>;
|
||||
export type PluginsSetEnabledParams = Static<typeof PluginsSetEnabledParamsSchema>;
|
||||
export type PluginsSetEnabledResult = Static<typeof PluginsSetEnabledResultSchema>;
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type PluginControlUiDescriptor = Static<typeof PluginControlUiDescriptorSchema>;
|
||||
export type PluginsUiDescriptorsParams = Static<typeof PluginsUiDescriptorsParamsSchema>;
|
||||
export type PluginsUiDescriptorsResult = Static<typeof PluginsUiDescriptorsResultSchema>;
|
||||
export type PluginsSessionActionParams = Static<typeof PluginsSessionActionParamsSchema>;
|
||||
export type PluginsSessionActionResult = Static<typeof PluginsSessionActionResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -91,3 +92,8 @@ export type WebPushTestParams = {
|
||||
title?: string;
|
||||
body?: string;
|
||||
};
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type PushTestParams = Static<typeof PushTestParamsSchema>;
|
||||
export type PushTestResult = Static<typeof PushTestResultSchema>;
|
||||
|
||||
@@ -710,3 +710,56 @@ export const SessionsUsageParamsSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type SessionsListParams = Static<typeof SessionsListParamsSchema>;
|
||||
export type SessionsCleanupParams = Static<typeof SessionsCleanupParamsSchema>;
|
||||
export type SessionsPreviewParams = Static<typeof SessionsPreviewParamsSchema>;
|
||||
export type SessionsDescribeParams = Static<typeof SessionsDescribeParamsSchema>;
|
||||
export type SessionsResolveParams = Static<typeof SessionsResolveParamsSchema>;
|
||||
export type SessionCompactionCheckpoint = Static<typeof SessionCompactionCheckpointSchema>;
|
||||
export type SessionOperationEvent = Static<typeof SessionOperationEventSchema>;
|
||||
export type SessionsCompactionListParams = Static<typeof SessionsCompactionListParamsSchema>;
|
||||
export type SessionsCompactionGetParams = Static<typeof SessionsCompactionGetParamsSchema>;
|
||||
export type SessionsCompactionBranchParams = Static<typeof SessionsCompactionBranchParamsSchema>;
|
||||
export type SessionsCompactionRestoreParams = Static<typeof SessionsCompactionRestoreParamsSchema>;
|
||||
export type SessionsCompactionListResult = Static<typeof SessionsCompactionListResultSchema>;
|
||||
export type SessionsCompactionGetResult = Static<typeof SessionsCompactionGetResultSchema>;
|
||||
export type SessionsCompactionBranchResult = Static<typeof SessionsCompactionBranchResultSchema>;
|
||||
export type SessionsCompactionRestoreResult = Static<typeof SessionsCompactionRestoreResultSchema>;
|
||||
export type SessionWorktreeInfo = Static<typeof SessionWorktreeInfoSchema>;
|
||||
export type SessionsCreateParams = Static<typeof SessionsCreateParamsSchema>;
|
||||
export type SessionsCreateResult = Static<typeof SessionsCreateResultSchema>;
|
||||
export type SessionsSendParams = Static<typeof SessionsSendParamsSchema>;
|
||||
export type SessionsMessagesSubscribeParams = Static<typeof SessionsMessagesSubscribeParamsSchema>;
|
||||
export type SessionsMessagesUnsubscribeParams = Static<
|
||||
typeof SessionsMessagesUnsubscribeParamsSchema
|
||||
>;
|
||||
export type SessionsAbortParams = Static<typeof SessionsAbortParamsSchema>;
|
||||
export type SessionsPluginPatchParams = Static<typeof SessionsPluginPatchParamsSchema>;
|
||||
export type SessionsPluginPatchResult = Static<typeof SessionsPluginPatchResultSchema>;
|
||||
export type SessionsResetParams = Static<typeof SessionsResetParamsSchema>;
|
||||
export type SessionsDeleteParams = Static<typeof SessionsDeleteParamsSchema>;
|
||||
export type SessionGroup = Static<typeof SessionGroupSchema>;
|
||||
export type SessionsGroupsListParams = Static<typeof SessionsGroupsListParamsSchema>;
|
||||
export type SessionsGroupsListResult = Static<typeof SessionsGroupsListResultSchema>;
|
||||
export type SessionsGroupsPutParams = Static<typeof SessionsGroupsPutParamsSchema>;
|
||||
export type SessionsGroupsRenameParams = Static<typeof SessionsGroupsRenameParamsSchema>;
|
||||
export type SessionsGroupsDeleteParams = Static<typeof SessionsGroupsDeleteParamsSchema>;
|
||||
export type SessionsGroupsMutationResult = Static<typeof SessionsGroupsMutationResultSchema>;
|
||||
export type SessionsCompactParams = Static<typeof SessionsCompactParamsSchema>;
|
||||
export type SessionsUsageParams = Static<typeof SessionsUsageParamsSchema>;
|
||||
export type SessionFileKind = Static<typeof SessionFileKindSchema>;
|
||||
export type SessionFileRelevance = Static<typeof SessionFileRelevanceSchema>;
|
||||
export type SessionFileEntry = Static<typeof SessionFileEntrySchema>;
|
||||
export type SessionFileBrowserEntry = Static<typeof SessionFileBrowserEntrySchema>;
|
||||
export type SessionFileBrowserResult = Static<typeof SessionFileBrowserResultSchema>;
|
||||
export type SessionsFilesListParams = Static<typeof SessionsFilesListParamsSchema>;
|
||||
export type SessionsFilesListResult = Static<typeof SessionsFilesListResultSchema>;
|
||||
export type SessionsFilesGetParams = Static<typeof SessionsFilesGetParamsSchema>;
|
||||
export type SessionsFilesGetResult = Static<typeof SessionsFilesGetResultSchema>;
|
||||
export type SessionDiffFileStatus = Static<typeof SessionDiffFileStatusSchema>;
|
||||
export type SessionDiffFile = Static<typeof SessionDiffFileSchema>;
|
||||
export type SessionsDiffParams = Static<typeof SessionsDiffParamsSchema>;
|
||||
export type SessionsDiffResult = Static<typeof SessionsDiffResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -82,3 +83,9 @@ export const SnapshotSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type Snapshot = Static<typeof SnapshotSchema>;
|
||||
export type PresenceEntry = Static<typeof PresenceEntrySchema>;
|
||||
export type StateVersion = Static<typeof StateVersionSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines Gateway host system information.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
|
||||
/** Empty request payload for Gateway host system information. */
|
||||
@@ -29,3 +30,8 @@ export const SystemInfoResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type SystemInfoParams = Static<typeof SystemInfoParamsSchema>;
|
||||
export type SystemInfoResult = Static<typeof SystemInfoResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines ephemeral follow-up task suggestions.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
|
||||
const TaskIdSchema = Type.String({ minLength: 1, maxLength: 128 });
|
||||
@@ -102,3 +103,17 @@ export const TaskSuggestionEventSchema = Type.Union([
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
]);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type TaskSuggestion = Static<typeof TaskSuggestionSchema>;
|
||||
export type TaskSuggestionEvent = Static<typeof TaskSuggestionEventSchema>;
|
||||
export type TaskSuggestionResolution = Static<typeof TaskSuggestionResolutionSchema>;
|
||||
export type TaskSuggestionsAcceptParams = Static<typeof TaskSuggestionsAcceptParamsSchema>;
|
||||
export type TaskSuggestionsAcceptResult = Static<typeof TaskSuggestionsAcceptResultSchema>;
|
||||
export type TaskSuggestionsCreateParams = Static<typeof TaskSuggestionsCreateParamsSchema>;
|
||||
export type TaskSuggestionsCreateResult = Static<typeof TaskSuggestionsCreateResultSchema>;
|
||||
export type TaskSuggestionsDismissParams = Static<typeof TaskSuggestionsDismissParamsSchema>;
|
||||
export type TaskSuggestionsDismissResult = Static<typeof TaskSuggestionsDismissResultSchema>;
|
||||
export type TaskSuggestionsListParams = Static<typeof TaskSuggestionsListParamsSchema>;
|
||||
export type TaskSuggestionsListResult = Static<typeof TaskSuggestionsListResultSchema>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -106,3 +107,13 @@ export const TasksCancelResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type TaskSummary = Static<typeof TaskSummarySchema>;
|
||||
export type TasksListParams = Static<typeof TasksListParamsSchema>;
|
||||
export type TasksListResult = Static<typeof TasksListResultSchema>;
|
||||
export type TasksGetParams = Static<typeof TasksGetParamsSchema>;
|
||||
export type TasksGetResult = Static<typeof TasksGetResultSchema>;
|
||||
export type TasksCancelParams = Static<typeof TasksCancelParamsSchema>;
|
||||
export type TasksCancelResult = Static<typeof TasksCancelResultSchema>;
|
||||
|
||||
@@ -1,540 +0,0 @@
|
||||
/**
|
||||
* Static TypeScript types derived from the canonical gateway protocol schemas.
|
||||
*
|
||||
* Owner-local schema modules export hot public types directly. The remaining
|
||||
* aliases stay wired through `ProtocolSchemas` so validators, runtime schemas,
|
||||
* and compile-time types cannot drift apart.
|
||||
*/
|
||||
import type { Static } from "typebox";
|
||||
import type { ProtocolSchemas } from "./protocol-schemas.js";
|
||||
|
||||
/** Stable schema names registered in the protocol schema registry. */
|
||||
type ProtocolSchemaName = keyof typeof ProtocolSchemas;
|
||||
/** Inferred TypeScript type for a named TypeBox protocol schema. */
|
||||
type SchemaType<TName extends ProtocolSchemaName> = Static<(typeof ProtocolSchemas)[TName]>;
|
||||
|
||||
/** Snapshot and shared state wire types. */
|
||||
export type Snapshot = SchemaType<"Snapshot">;
|
||||
export type PresenceEntry = SchemaType<"PresenceEntry">;
|
||||
export type StateVersion = SchemaType<"StateVersion">;
|
||||
export type GatewaySuspendTaskBlocker = SchemaType<"GatewaySuspendTaskBlocker">;
|
||||
export type GatewaySuspendBlocker = SchemaType<"GatewaySuspendBlocker">;
|
||||
export type GatewaySuspendPrepareParams = SchemaType<"GatewaySuspendPrepareParams">;
|
||||
export type GatewaySuspendPrepareResult = SchemaType<"GatewaySuspendPrepareResult">;
|
||||
export type GatewaySuspendStatusParams = SchemaType<"GatewaySuspendStatusParams">;
|
||||
export type GatewaySuspendStatusResult = SchemaType<"GatewaySuspendStatusResult">;
|
||||
export type GatewaySuspendResumeParams = SchemaType<"GatewaySuspendResumeParams">;
|
||||
export type GatewaySuspendResumeResult = SchemaType<"GatewaySuspendResumeResult">;
|
||||
|
||||
export type SystemInfoParams = SchemaType<"SystemInfoParams">;
|
||||
export type SystemInfoResult = SchemaType<"SystemInfoResult">;
|
||||
export type TaskSuggestion = SchemaType<"TaskSuggestion">;
|
||||
export type TaskSuggestionEvent = SchemaType<"TaskSuggestionEvent">;
|
||||
export type TaskSuggestionResolution = SchemaType<"TaskSuggestionResolution">;
|
||||
export type TaskSuggestionsAcceptParams = SchemaType<"TaskSuggestionsAcceptParams">;
|
||||
export type TaskSuggestionsAcceptResult = SchemaType<"TaskSuggestionsAcceptResult">;
|
||||
export type TaskSuggestionsCreateParams = SchemaType<"TaskSuggestionsCreateParams">;
|
||||
export type TaskSuggestionsCreateResult = SchemaType<"TaskSuggestionsCreateResult">;
|
||||
export type TaskSuggestionsDismissParams = SchemaType<"TaskSuggestionsDismissParams">;
|
||||
export type TaskSuggestionsDismissResult = SchemaType<"TaskSuggestionsDismissResult">;
|
||||
export type TaskSuggestionsListParams = SchemaType<"TaskSuggestionsListParams">;
|
||||
export type TaskSuggestionsListResult = SchemaType<"TaskSuggestionsListResult">;
|
||||
export type WorktreeRecord = SchemaType<"WorktreeRecord">;
|
||||
export type WorktreesListParams = SchemaType<"WorktreesListParams">;
|
||||
export type WorktreesListResult = SchemaType<"WorktreesListResult">;
|
||||
export type WorktreesCreateParams = SchemaType<"WorktreesCreateParams">;
|
||||
export type WorktreesRemoveParams = SchemaType<"WorktreesRemoveParams">;
|
||||
export type WorktreesRemoveResult = SchemaType<"WorktreesRemoveResult">;
|
||||
export type WorktreesRestoreParams = SchemaType<"WorktreesRestoreParams">;
|
||||
export type WorktreesGcParams = SchemaType<"WorktreesGcParams">;
|
||||
export type WorktreesGcResult = SchemaType<"WorktreesGcResult">;
|
||||
export type WorktreeBranch = SchemaType<"WorktreeBranch">;
|
||||
export type WorktreesBranchesParams = SchemaType<"WorktreesBranchesParams">;
|
||||
export type WorktreesBranchesResult = SchemaType<"WorktreesBranchesResult">;
|
||||
export type FsDirEntry = SchemaType<"FsDirEntry">;
|
||||
export type FsListDirParams = SchemaType<"FsListDirParams">;
|
||||
export type FsListDirResult = SchemaType<"FsListDirResult">;
|
||||
|
||||
/** Agent activity, identity, send, poll, wait, and wake protocol payloads. */
|
||||
export type AgentEvent = SchemaType<"AgentEvent">;
|
||||
export type AgentIdentityParams = SchemaType<"AgentIdentityParams">;
|
||||
export type AgentIdentityResult = SchemaType<"AgentIdentityResult">;
|
||||
export type MessageActionParams = SchemaType<"MessageActionParams">;
|
||||
export type PollParams = SchemaType<"PollParams">;
|
||||
export type AgentWaitParams = SchemaType<"AgentWaitParams">;
|
||||
export type WakeParams = SchemaType<"WakeParams">;
|
||||
|
||||
/** Node pairing, presence, invoke, and pending-queue protocol payloads. */
|
||||
export type NodePairListParams = SchemaType<"NodePairListParams">;
|
||||
export type NodePairApproveParams = SchemaType<"NodePairApproveParams">;
|
||||
export type NodePairRejectParams = SchemaType<"NodePairRejectParams">;
|
||||
export type NodePairRemoveParams = SchemaType<"NodePairRemoveParams">;
|
||||
export type NodeRenameParams = SchemaType<"NodeRenameParams">;
|
||||
export type NodeListParams = SchemaType<"NodeListParams">;
|
||||
// NodePluginToolDescriptor / NodeSkillDescriptor and their update params are
|
||||
// plugin-SDK-reachable, so nodes.ts exports them directly; routing them through
|
||||
// ProtocolSchemas would retain the whole registry in the public plugin-sdk dts.
|
||||
export type NodePendingAckParams = SchemaType<"NodePendingAckParams">;
|
||||
export type NodeDescribeParams = SchemaType<"NodeDescribeParams">;
|
||||
export type NodeInvokeParams = SchemaType<"NodeInvokeParams">;
|
||||
export type NodeInvokeResultParams = SchemaType<"NodeInvokeResultParams">;
|
||||
export type NodeEventParams = SchemaType<"NodeEventParams">;
|
||||
export type NodeEventResult = SchemaType<"NodeEventResult">;
|
||||
export type NodePresenceAlivePayload = SchemaType<"NodePresenceAlivePayload">;
|
||||
export type NodePresenceAliveReason = SchemaType<"NodePresenceAliveReason">;
|
||||
export type NodePendingDrainParams = SchemaType<"NodePendingDrainParams">;
|
||||
export type NodePendingDrainResult = SchemaType<"NodePendingDrainResult">;
|
||||
export type NodePendingEnqueueParams = SchemaType<"NodePendingEnqueueParams">;
|
||||
export type NodePendingEnqueueResult = SchemaType<"NodePendingEnqueueResult">;
|
||||
|
||||
/** Push notification test result contracts exposed through gateway RPC. */
|
||||
export type PushTestParams = SchemaType<"PushTestParams">;
|
||||
export type PushTestResult = SchemaType<"PushTestResult">;
|
||||
|
||||
/** Session lifecycle, message routing, compaction, patch, and usage payloads. */
|
||||
export type SessionsListParams = SchemaType<"SessionsListParams">;
|
||||
export type SessionsCleanupParams = SchemaType<"SessionsCleanupParams">;
|
||||
export type SessionsPreviewParams = SchemaType<"SessionsPreviewParams">;
|
||||
export type SessionsDescribeParams = SchemaType<"SessionsDescribeParams">;
|
||||
export type SessionsResolveParams = SchemaType<"SessionsResolveParams">;
|
||||
export type SessionCompactionCheckpoint = SchemaType<"SessionCompactionCheckpoint">;
|
||||
export type SessionOperationEvent = SchemaType<"SessionOperationEvent">;
|
||||
export type SessionsCompactionListParams = SchemaType<"SessionsCompactionListParams">;
|
||||
export type SessionsCompactionGetParams = SchemaType<"SessionsCompactionGetParams">;
|
||||
export type SessionsCompactionBranchParams = SchemaType<"SessionsCompactionBranchParams">;
|
||||
export type SessionsCompactionRestoreParams = SchemaType<"SessionsCompactionRestoreParams">;
|
||||
export type SessionsCompactionListResult = SchemaType<"SessionsCompactionListResult">;
|
||||
export type SessionsCompactionGetResult = SchemaType<"SessionsCompactionGetResult">;
|
||||
export type SessionsCompactionBranchResult = SchemaType<"SessionsCompactionBranchResult">;
|
||||
export type SessionsCompactionRestoreResult = SchemaType<"SessionsCompactionRestoreResult">;
|
||||
export type SessionWorktreeInfo = SchemaType<"SessionWorktreeInfo">;
|
||||
export type SessionsCreateParams = SchemaType<"SessionsCreateParams">;
|
||||
export type SessionsCreateResult = SchemaType<"SessionsCreateResult">;
|
||||
export type SessionsSendParams = SchemaType<"SessionsSendParams">;
|
||||
export type SessionsMessagesSubscribeParams = SchemaType<"SessionsMessagesSubscribeParams">;
|
||||
export type SessionsMessagesUnsubscribeParams = SchemaType<"SessionsMessagesUnsubscribeParams">;
|
||||
export type SessionsAbortParams = SchemaType<"SessionsAbortParams">;
|
||||
export type SessionsPluginPatchParams = SchemaType<"SessionsPluginPatchParams">;
|
||||
export type SessionsPluginPatchResult = SchemaType<"SessionsPluginPatchResult">;
|
||||
export type SessionsResetParams = SchemaType<"SessionsResetParams">;
|
||||
export type SessionsDeleteParams = SchemaType<"SessionsDeleteParams">;
|
||||
export type SessionGroup = SchemaType<"SessionGroup">;
|
||||
export type SessionsGroupsListParams = SchemaType<"SessionsGroupsListParams">;
|
||||
export type SessionsGroupsListResult = SchemaType<"SessionsGroupsListResult">;
|
||||
export type SessionsGroupsPutParams = SchemaType<"SessionsGroupsPutParams">;
|
||||
export type SessionsGroupsRenameParams = SchemaType<"SessionsGroupsRenameParams">;
|
||||
export type SessionsGroupsDeleteParams = SchemaType<"SessionsGroupsDeleteParams">;
|
||||
export type SessionsGroupsMutationResult = SchemaType<"SessionsGroupsMutationResult">;
|
||||
export type SessionsCompactParams = SchemaType<"SessionsCompactParams">;
|
||||
export type SessionsUsageParams = SchemaType<"SessionsUsageParams">;
|
||||
|
||||
/** Metadata-only audit query payloads. */
|
||||
// These wire types stay explicit because the runtime schemas use JSON Schema
|
||||
// `allOf` correlations that TypeBox cannot infer without expanding the public
|
||||
// declaration graph far beyond the compact protocol contract.
|
||||
type AuditActivityRecordBaseV1 = {
|
||||
schemaVersion: 1;
|
||||
eventId: string;
|
||||
sequence: number;
|
||||
sourceSequence: number;
|
||||
occurredAt: number;
|
||||
redaction: "metadata_only";
|
||||
};
|
||||
|
||||
type AuditActivityAgentRecordBaseV1 = AuditActivityRecordBaseV1 & {
|
||||
actor: { type: "agent" | "system"; id: string };
|
||||
agentId: string;
|
||||
sessionKey?: string;
|
||||
sessionId?: string;
|
||||
runId: string;
|
||||
};
|
||||
|
||||
type AuditActivityAgentRunV1Terminal =
|
||||
| { action: "agent.run.started"; status: "started"; errorCode?: never }
|
||||
| { action: "agent.run.finished"; status: "succeeded"; errorCode?: never }
|
||||
| { action: "agent.run.finished"; status: "failed"; errorCode: "run_failed" }
|
||||
| { action: "agent.run.finished"; status: "cancelled"; errorCode: "run_cancelled" }
|
||||
| { action: "agent.run.finished"; status: "timed_out"; errorCode: "run_timed_out" }
|
||||
| { action: "agent.run.finished"; status: "blocked"; errorCode: "run_blocked" };
|
||||
export type AuditActivityAgentRunV1 = AuditActivityAgentRecordBaseV1 & {
|
||||
eventType: "agent_run";
|
||||
kind: "agent_run";
|
||||
} & AuditActivityAgentRunV1Terminal;
|
||||
|
||||
type AuditActivityToolActionV1Terminal =
|
||||
| { action: "tool.action.started"; status: "started"; errorCode?: never }
|
||||
| { action: "tool.action.finished"; status: "succeeded"; errorCode?: never }
|
||||
| { action: "tool.action.finished"; status: "failed"; errorCode: "tool_failed" }
|
||||
| { action: "tool.action.finished"; status: "cancelled"; errorCode: "tool_cancelled" }
|
||||
| { action: "tool.action.finished"; status: "timed_out"; errorCode: "tool_timed_out" }
|
||||
| { action: "tool.action.finished"; status: "blocked"; errorCode: "tool_blocked" }
|
||||
| {
|
||||
action: "tool.action.finished";
|
||||
status: "unknown";
|
||||
errorCode: "tool_outcome_unknown";
|
||||
};
|
||||
export type AuditActivityToolActionV1 = AuditActivityAgentRecordBaseV1 & {
|
||||
eventType: "tool_action";
|
||||
kind: "tool_action";
|
||||
toolCallId?: string;
|
||||
toolName?: string;
|
||||
} & AuditActivityToolActionV1Terminal;
|
||||
|
||||
type AuditActivityMessageRecordBaseV1 = AuditActivityRecordBaseV1 & {
|
||||
kind: "message";
|
||||
channel: string;
|
||||
conversationKind: "direct" | "group" | "channel" | "unknown";
|
||||
durationMs?: number;
|
||||
resultCount?: number;
|
||||
agentId?: string;
|
||||
runId?: string;
|
||||
accountRef?: string;
|
||||
conversationRef?: string;
|
||||
messageRef?: string;
|
||||
targetRef?: string;
|
||||
sessionKey?: never;
|
||||
sessionId?: never;
|
||||
toolCallId?: never;
|
||||
toolName?: never;
|
||||
};
|
||||
|
||||
type AuditActivityInboundMessageV1Terminal =
|
||||
| {
|
||||
status: "succeeded";
|
||||
outcome: "completed";
|
||||
errorCode?: never;
|
||||
reasonCode?:
|
||||
| "fast_abort"
|
||||
| "plugin_bound_handled"
|
||||
| "plugin_bound_unavailable"
|
||||
| "plugin_bound_declined"
|
||||
| "before_dispatch_handled"
|
||||
| "acp_dispatch_completed"
|
||||
| "acp_dispatch_empty";
|
||||
}
|
||||
| {
|
||||
status: "blocked";
|
||||
outcome: "skipped";
|
||||
errorCode?: never;
|
||||
reasonCode?:
|
||||
| "duplicate"
|
||||
| "reply_operation_active"
|
||||
| "reply_operation_aborted"
|
||||
| "acp_dispatch_aborted";
|
||||
}
|
||||
| {
|
||||
status: "failed";
|
||||
outcome: "failed";
|
||||
errorCode: "message_processing_failed";
|
||||
reasonCode?: "acp_dispatch_failed" | "plugin_bound_error";
|
||||
};
|
||||
export type AuditActivityInboundMessageV1 = AuditActivityMessageRecordBaseV1 & {
|
||||
eventType: "inbound_message";
|
||||
action: "message.inbound.processed";
|
||||
direction: "inbound";
|
||||
actor: { type: "channel_sender"; id: string } | { type: "system"; id: string };
|
||||
deliveryKind?: never;
|
||||
failureStage?: never;
|
||||
} & AuditActivityInboundMessageV1Terminal;
|
||||
|
||||
type AuditActivityOutboundMessageV1Terminal =
|
||||
| {
|
||||
status: "succeeded";
|
||||
outcome: "sent";
|
||||
errorCode?: never;
|
||||
reasonCode?: never;
|
||||
failureStage?: never;
|
||||
deliveryKind?: "text" | "media" | "other";
|
||||
}
|
||||
| {
|
||||
status: "blocked";
|
||||
outcome: "suppressed";
|
||||
errorCode?: never;
|
||||
reasonCode:
|
||||
| "cancelled_by_message_sending_hook"
|
||||
| "cancelled_by_reply_payload_sending_hook"
|
||||
| "empty_after_message_sending_hook"
|
||||
| "empty_after_reply_payload_sending_hook"
|
||||
| "no_visible_payload";
|
||||
failureStage?: never;
|
||||
deliveryKind?: never;
|
||||
}
|
||||
| {
|
||||
status: "failed";
|
||||
outcome: "failed";
|
||||
errorCode: "message_delivery_failed" | "message_delivery_partial_failure";
|
||||
reasonCode?: never;
|
||||
failureStage: "platform_send" | "queue" | "unknown";
|
||||
deliveryKind?: "text" | "media" | "other";
|
||||
}
|
||||
| {
|
||||
status: "unknown";
|
||||
outcome: "unknown";
|
||||
errorCode?: never;
|
||||
reasonCode?: never;
|
||||
failureStage: "platform_send" | "queue" | "unknown";
|
||||
deliveryKind?: never;
|
||||
};
|
||||
export type AuditActivityOutboundMessageV1 = AuditActivityMessageRecordBaseV1 & {
|
||||
eventType: "outbound_message";
|
||||
action: "message.outbound.finished";
|
||||
direction: "outbound";
|
||||
actor: { type: "agent" | "system"; id: string };
|
||||
} & AuditActivityOutboundMessageV1Terminal;
|
||||
|
||||
export type AuditActivityEventV1 =
|
||||
| AuditActivityAgentRunV1
|
||||
| AuditActivityToolActionV1
|
||||
| AuditActivityInboundMessageV1
|
||||
| AuditActivityOutboundMessageV1;
|
||||
export type AuditActivityListParams = {
|
||||
agentId?: string;
|
||||
sessionKey?: string;
|
||||
runId?: string;
|
||||
kind?: "agent_run" | "tool_action" | "message";
|
||||
status?: "started" | "succeeded" | "failed" | "cancelled" | "timed_out" | "blocked" | "unknown";
|
||||
direction?: "inbound" | "outbound";
|
||||
channel?: string;
|
||||
after?: number;
|
||||
before?: number;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
};
|
||||
export type AuditActivityListResult = {
|
||||
events: AuditActivityEventV1[];
|
||||
nextCursor?: string;
|
||||
};
|
||||
export type AuditEvent = SchemaType<"AuditEvent">;
|
||||
export type AuditListParams = SchemaType<"AuditListParams">;
|
||||
export type AuditListResult = SchemaType<"AuditListResult">;
|
||||
|
||||
/** Task ledger query and cancellation payloads. */
|
||||
export type TaskSummary = SchemaType<"TaskSummary">;
|
||||
export type TasksListParams = SchemaType<"TasksListParams">;
|
||||
export type TasksListResult = SchemaType<"TasksListResult">;
|
||||
export type TasksGetParams = SchemaType<"TasksGetParams">;
|
||||
export type TasksGetResult = SchemaType<"TasksGetResult">;
|
||||
export type TasksCancelParams = SchemaType<"TasksCancelParams">;
|
||||
export type TasksCancelResult = SchemaType<"TasksCancelResult">;
|
||||
|
||||
/** Config read/write/schema payloads plus update status and run controls. */
|
||||
export type ConfigGetParams = SchemaType<"ConfigGetParams">;
|
||||
export type ConfigSetParams = SchemaType<"ConfigSetParams">;
|
||||
export type ConfigApplyParams = SchemaType<"ConfigApplyParams">;
|
||||
export type ConfigPatchParams = SchemaType<"ConfigPatchParams">;
|
||||
export type ConfigSchemaParams = SchemaType<"ConfigSchemaParams">;
|
||||
export type ConfigSchemaLookupParams = SchemaType<"ConfigSchemaLookupParams">;
|
||||
export type ConfigSchemaResponse = SchemaType<"ConfigSchemaResponse">;
|
||||
export type ConfigSchemaLookupResult = SchemaType<"ConfigSchemaLookupResult">;
|
||||
export type UpdateStatusParams = SchemaType<"UpdateStatusParams">;
|
||||
|
||||
/** Crestodian chat payloads exchanged by clients and the gateway. */
|
||||
export type CrestodianChatParams = SchemaType<"CrestodianChatParams">;
|
||||
export type CrestodianChatResult = SchemaType<"CrestodianChatResult">;
|
||||
export type CrestodianSetupDetectParams = SchemaType<"CrestodianSetupDetectParams">;
|
||||
export type CrestodianSetupDetectResult = SchemaType<"CrestodianSetupDetectResult">;
|
||||
export type CrestodianSetupVerifyParams = SchemaType<"CrestodianSetupVerifyParams">;
|
||||
export type CrestodianSetupVerifyResult = SchemaType<"CrestodianSetupVerifyResult">;
|
||||
export type CrestodianSetupActivateParams = SchemaType<"CrestodianSetupActivateParams">;
|
||||
export type CrestodianSetupActivateResult = SchemaType<"CrestodianSetupActivateResult">;
|
||||
export type CrestodianSetupAuthStartParams = SchemaType<"CrestodianSetupAuthStartParams">;
|
||||
export type CrestodianSetupAuthStartResult = SchemaType<"CrestodianSetupAuthStartResult">;
|
||||
|
||||
/** Wizard setup flow payloads exchanged by CLI, UI, and gateway. */
|
||||
export type WizardStartParams = SchemaType<"WizardStartParams">;
|
||||
export type WizardNextParams = SchemaType<"WizardNextParams">;
|
||||
export type WizardCancelParams = SchemaType<"WizardCancelParams">;
|
||||
export type WizardStatusParams = SchemaType<"WizardStatusParams">;
|
||||
export type WizardStep = SchemaType<"WizardStep">;
|
||||
export type WizardNextResult = SchemaType<"WizardNextResult">;
|
||||
export type WizardStartResult = SchemaType<"WizardStartResult">;
|
||||
export type WizardStatusResult = SchemaType<"WizardStatusResult">;
|
||||
|
||||
/** Realtime Talk client/session/event payloads. */
|
||||
export type TalkEvent = SchemaType<"TalkEvent">;
|
||||
export type TalkModeParams = SchemaType<"TalkModeParams">;
|
||||
export type TalkCatalogParams = SchemaType<"TalkCatalogParams">;
|
||||
export type TalkCatalogResult = SchemaType<"TalkCatalogResult">;
|
||||
export type TalkConfigParams = SchemaType<"TalkConfigParams">;
|
||||
export type TalkConfigResult = SchemaType<"TalkConfigResult">;
|
||||
export type TalkClientCreateParams = SchemaType<"TalkClientCreateParams">;
|
||||
export type TalkClientCreateResult = SchemaType<"TalkClientCreateResult">;
|
||||
export type TalkClientSteerParams = SchemaType<"TalkClientSteerParams">;
|
||||
export type TalkAgentControlResult = SchemaType<"TalkAgentControlResult">;
|
||||
export type TalkClientToolCallParams = SchemaType<"TalkClientToolCallParams">;
|
||||
export type TalkClientToolCallResult = SchemaType<"TalkClientToolCallResult">;
|
||||
export type TalkSessionCreateParams = SchemaType<"TalkSessionCreateParams">;
|
||||
export type TalkSessionCreateResult = SchemaType<"TalkSessionCreateResult">;
|
||||
export type TalkSessionJoinParams = SchemaType<"TalkSessionJoinParams">;
|
||||
export type TalkSessionJoinResult = SchemaType<"TalkSessionJoinResult">;
|
||||
export type TalkSessionAppendAudioParams = SchemaType<"TalkSessionAppendAudioParams">;
|
||||
export type TalkSessionTurnParams = SchemaType<"TalkSessionTurnParams">;
|
||||
export type TalkSessionCancelTurnParams = SchemaType<"TalkSessionCancelTurnParams">;
|
||||
export type TalkSessionCancelOutputParams = SchemaType<"TalkSessionCancelOutputParams">;
|
||||
export type TalkSessionTurnResult = SchemaType<"TalkSessionTurnResult">;
|
||||
export type TalkSessionSteerParams = SchemaType<"TalkSessionSteerParams">;
|
||||
export type TalkSessionSubmitToolResultParams = SchemaType<"TalkSessionSubmitToolResultParams">;
|
||||
export type TalkSessionCloseParams = SchemaType<"TalkSessionCloseParams">;
|
||||
export type TalkSessionOkResult = SchemaType<"TalkSessionOkResult">;
|
||||
export type TalkSpeakParams = SchemaType<"TalkSpeakParams">;
|
||||
export type TalkSpeakResult = SchemaType<"TalkSpeakResult">;
|
||||
export type TtsSpeakParams = SchemaType<"TtsSpeakParams">;
|
||||
export type TtsSpeakResult = SchemaType<"TtsSpeakResult">;
|
||||
|
||||
/** Channel control and web-login payloads. */
|
||||
export type ChannelsStatusParams = SchemaType<"ChannelsStatusParams">;
|
||||
export type ChannelsStatusResult = SchemaType<"ChannelsStatusResult">;
|
||||
export type ChannelsStartParams = SchemaType<"ChannelsStartParams">;
|
||||
export type ChannelsStopParams = SchemaType<"ChannelsStopParams">;
|
||||
export type ChannelsLogoutParams = SchemaType<"ChannelsLogoutParams">;
|
||||
export type WebLoginStartParams = SchemaType<"WebLoginStartParams">;
|
||||
export type WebLoginWaitParams = SchemaType<"WebLoginWaitParams">;
|
||||
|
||||
/** Agent config-file CRUD and artifact download/list payloads. */
|
||||
export type AgentSummary = SchemaType<"AgentSummary">;
|
||||
export type AgentsFileEntry = SchemaType<"AgentsFileEntry">;
|
||||
export type AgentsCreateParams = SchemaType<"AgentsCreateParams">;
|
||||
export type AgentsCreateResult = SchemaType<"AgentsCreateResult">;
|
||||
export type AgentsUpdateParams = SchemaType<"AgentsUpdateParams">;
|
||||
export type AgentsUpdateResult = SchemaType<"AgentsUpdateResult">;
|
||||
export type AgentsDeleteParams = SchemaType<"AgentsDeleteParams">;
|
||||
export type AgentsDeleteResult = SchemaType<"AgentsDeleteResult">;
|
||||
export type AgentsFilesListParams = SchemaType<"AgentsFilesListParams">;
|
||||
export type AgentsFilesListResult = SchemaType<"AgentsFilesListResult">;
|
||||
export type AgentsFilesGetParams = SchemaType<"AgentsFilesGetParams">;
|
||||
export type AgentsFilesGetResult = SchemaType<"AgentsFilesGetResult">;
|
||||
export type AgentsFilesSetParams = SchemaType<"AgentsFilesSetParams">;
|
||||
export type AgentsFilesSetResult = SchemaType<"AgentsFilesSetResult">;
|
||||
export type AgentsWorkspaceEntry = SchemaType<"AgentsWorkspaceEntry">;
|
||||
export type AgentsWorkspaceFile = SchemaType<"AgentsWorkspaceFile">;
|
||||
export type AgentsWorkspaceListParams = SchemaType<"AgentsWorkspaceListParams">;
|
||||
export type AgentsWorkspaceListResult = SchemaType<"AgentsWorkspaceListResult">;
|
||||
export type AgentsWorkspaceGetParams = SchemaType<"AgentsWorkspaceGetParams">;
|
||||
export type AgentsWorkspaceGetResult = SchemaType<"AgentsWorkspaceGetResult">;
|
||||
export type SessionFileKind = SchemaType<"SessionFileKind">;
|
||||
export type SessionFileRelevance = SchemaType<"SessionFileRelevance">;
|
||||
export type SessionFileEntry = SchemaType<"SessionFileEntry">;
|
||||
export type SessionFileBrowserEntry = SchemaType<"SessionFileBrowserEntry">;
|
||||
export type SessionFileBrowserResult = SchemaType<"SessionFileBrowserResult">;
|
||||
export type SessionsFilesListParams = SchemaType<"SessionsFilesListParams">;
|
||||
export type SessionsFilesListResult = SchemaType<"SessionsFilesListResult">;
|
||||
export type SessionsFilesGetParams = SchemaType<"SessionsFilesGetParams">;
|
||||
export type SessionsFilesGetResult = SchemaType<"SessionsFilesGetResult">;
|
||||
export type SessionDiffFileStatus = SchemaType<"SessionDiffFileStatus">;
|
||||
export type SessionDiffFile = SchemaType<"SessionDiffFile">;
|
||||
export type SessionsDiffParams = SchemaType<"SessionsDiffParams">;
|
||||
export type SessionsDiffResult = SchemaType<"SessionsDiffResult">;
|
||||
export type ArtifactSummary = SchemaType<"ArtifactSummary">;
|
||||
export type ArtifactsListParams = SchemaType<"ArtifactsListParams">;
|
||||
export type ArtifactsListResult = SchemaType<"ArtifactsListResult">;
|
||||
export type ArtifactsGetParams = SchemaType<"ArtifactsGetParams">;
|
||||
export type ArtifactsGetResult = SchemaType<"ArtifactsGetResult">;
|
||||
export type ArtifactsDownloadParams = SchemaType<"ArtifactsDownloadParams">;
|
||||
export type ArtifactsDownloadResult = SchemaType<"ArtifactsDownloadResult">;
|
||||
|
||||
/** Model, command, plugin UI action, tool catalog, and skill workshop payloads. */
|
||||
export type AgentsListParams = SchemaType<"AgentsListParams">;
|
||||
export type AgentsListResult = SchemaType<"AgentsListResult">;
|
||||
export type ModelChoice = SchemaType<"ModelChoice">;
|
||||
export type ModelsListParams = SchemaType<"ModelsListParams">;
|
||||
export type ModelsListResult = SchemaType<"ModelsListResult">;
|
||||
export type ChatMetadataParams = SchemaType<"ChatMetadataParams">;
|
||||
export type ChatToolTitlesParams = SchemaType<"ChatToolTitlesParams">;
|
||||
export type CommandEntry = SchemaType<"CommandEntry">;
|
||||
export type CommandsListParams = SchemaType<"CommandsListParams">;
|
||||
export type CommandsListResult = SchemaType<"CommandsListResult">;
|
||||
export type PluginControlUiDescriptor = SchemaType<"PluginControlUiDescriptor">;
|
||||
export type PluginsUiDescriptorsParams = SchemaType<"PluginsUiDescriptorsParams">;
|
||||
export type PluginsUiDescriptorsResult = SchemaType<"PluginsUiDescriptorsResult">;
|
||||
export type PluginsSessionActionParams = SchemaType<"PluginsSessionActionParams">;
|
||||
export type PluginsSessionActionResult = SchemaType<"PluginsSessionActionResult">;
|
||||
export type SkillsStatusParams = SchemaType<"SkillsStatusParams">;
|
||||
export type ToolsCatalogParams = SchemaType<"ToolsCatalogParams">;
|
||||
export type ToolCatalogProfile = SchemaType<"ToolCatalogProfile">;
|
||||
export type ToolCatalogEntry = SchemaType<"ToolCatalogEntry">;
|
||||
export type ToolCatalogGroup = SchemaType<"ToolCatalogGroup">;
|
||||
export type ToolsCatalogResult = SchemaType<"ToolsCatalogResult">;
|
||||
export type ToolsEffectiveParams = SchemaType<"ToolsEffectiveParams">;
|
||||
export type ToolsEffectiveEntry = SchemaType<"ToolsEffectiveEntry">;
|
||||
export type ToolsEffectiveGroup = SchemaType<"ToolsEffectiveGroup">;
|
||||
export type ToolsEffectiveNotice = SchemaType<"ToolsEffectiveNotice">;
|
||||
export type ToolsEffectiveResult = SchemaType<"ToolsEffectiveResult">;
|
||||
export type ToolsInvokeParams = SchemaType<"ToolsInvokeParams">;
|
||||
export type ToolsInvokeResult = SchemaType<"ToolsInvokeResult">;
|
||||
export type SkillsBinsParams = SchemaType<"SkillsBinsParams">;
|
||||
export type SkillsBinsResult = SchemaType<"SkillsBinsResult">;
|
||||
export type SkillsSearchParams = SchemaType<"SkillsSearchParams">;
|
||||
export type SkillsSearchResult = SchemaType<"SkillsSearchResult">;
|
||||
export type SkillsDetailParams = SchemaType<"SkillsDetailParams">;
|
||||
export type SkillsDetailResult = SchemaType<"SkillsDetailResult">;
|
||||
export type SkillsProposalsListParams = SchemaType<"SkillsProposalsListParams">;
|
||||
export type SkillsProposalsListResult = SchemaType<"SkillsProposalsListResult">;
|
||||
export type SkillsProposalInspectParams = SchemaType<"SkillsProposalInspectParams">;
|
||||
export type SkillsProposalInspectResult = SchemaType<"SkillsProposalInspectResult">;
|
||||
export type SkillsProposalCreateParams = SchemaType<"SkillsProposalCreateParams">;
|
||||
export type SkillsProposalUpdateParams = SchemaType<"SkillsProposalUpdateParams">;
|
||||
export type SkillsProposalReviseParams = SchemaType<"SkillsProposalReviseParams">;
|
||||
export type SkillsProposalRequestRevisionParams = SchemaType<"SkillsProposalRequestRevisionParams">;
|
||||
export type SkillsProposalRequestRevisionResult = SchemaType<"SkillsProposalRequestRevisionResult">;
|
||||
export type SkillsProposalActionParams = SchemaType<"SkillsProposalActionParams">;
|
||||
export type SkillsProposalApplyResult = SchemaType<"SkillsProposalApplyResult">;
|
||||
export type SkillsProposalRecordResult = SchemaType<"SkillsProposalRecordResult">;
|
||||
export type SkillsCuratorStatusParams = SchemaType<"SkillsCuratorStatusParams">;
|
||||
export type SkillsCuratorStatusResult = SchemaType<"SkillsCuratorStatusResult">;
|
||||
export type SkillsCuratorActionParams = SchemaType<"SkillsCuratorActionParams">;
|
||||
export type SkillsCuratorActionResult = SchemaType<"SkillsCuratorActionResult">;
|
||||
export type SkillsSecurityVerdictsParams = SchemaType<"SkillsSecurityVerdictsParams">;
|
||||
export type SkillsSecurityVerdictsResult = SchemaType<"SkillsSecurityVerdictsResult">;
|
||||
export type SkillsSkillCardParams = SchemaType<"SkillsSkillCardParams">;
|
||||
export type SkillsSkillCardResult = SchemaType<"SkillsSkillCardResult">;
|
||||
export type SkillsUploadBeginParams = SchemaType<"SkillsUploadBeginParams">;
|
||||
export type SkillsUploadChunkParams = SchemaType<"SkillsUploadChunkParams">;
|
||||
export type SkillsUploadCommitParams = SchemaType<"SkillsUploadCommitParams">;
|
||||
export type SkillsInstallParams = SchemaType<"SkillsInstallParams">;
|
||||
export type SkillsUpdateParams = SchemaType<"SkillsUpdateParams">;
|
||||
|
||||
/** Cron scheduler and run-log payloads. */
|
||||
export type CronJob = SchemaType<"CronJob">;
|
||||
export type CronListParams = SchemaType<"CronListParams">;
|
||||
export type CronStatusParams = SchemaType<"CronStatusParams">;
|
||||
export type CronGetParams = SchemaType<"CronGetParams">;
|
||||
export type CronAddParams = SchemaType<"CronAddParams">;
|
||||
export type CronAddResult = SchemaType<"CronAddResult">;
|
||||
export type CronDeclarativeAddResult = SchemaType<"CronDeclarativeAddResult">;
|
||||
export type CronUpdateParams = SchemaType<"CronUpdateParams">;
|
||||
export type CronRemoveParams = SchemaType<"CronRemoveParams">;
|
||||
export type CronRunParams = SchemaType<"CronRunParams">;
|
||||
export type CronRunsParams = SchemaType<"CronRunsParams">;
|
||||
export type CronRunLogEntry = SchemaType<"CronRunLogEntry">;
|
||||
|
||||
/** Logs and approval payloads for chat, exec commands, plugins, and devices. */
|
||||
export type LogsTailParams = SchemaType<"LogsTailParams">;
|
||||
export type LogsTailResult = SchemaType<"LogsTailResult">;
|
||||
export type ExecApprovalsGetParams = SchemaType<"ExecApprovalsGetParams">;
|
||||
export type ExecApprovalsSetParams = SchemaType<"ExecApprovalsSetParams">;
|
||||
export type ExecApprovalsNodeGetParams = SchemaType<"ExecApprovalsNodeGetParams">;
|
||||
export type ExecApprovalsNodeSnapshot = SchemaType<"ExecApprovalsNodeSnapshot">;
|
||||
export type ExecApprovalsNodeSetParams = SchemaType<"ExecApprovalsNodeSetParams">;
|
||||
export type ExecApprovalsSnapshot = SchemaType<"ExecApprovalsSnapshot">;
|
||||
export type ExecApprovalGetParams = SchemaType<"ExecApprovalGetParams">;
|
||||
export type ExecApprovalRequestParams = SchemaType<"ExecApprovalRequestParams">;
|
||||
export type ExecApprovalResolveParams = SchemaType<"ExecApprovalResolveParams">;
|
||||
export type PluginApprovalRequestParams = SchemaType<"PluginApprovalRequestParams">;
|
||||
export type PluginApprovalResolveParams = SchemaType<"PluginApprovalResolveParams">;
|
||||
export type DevicePairListParams = SchemaType<"DevicePairListParams">;
|
||||
export type DevicePairApproveParams = SchemaType<"DevicePairApproveParams">;
|
||||
export type DevicePairRejectParams = SchemaType<"DevicePairRejectParams">;
|
||||
export type DevicePairRemoveParams = SchemaType<"DevicePairRemoveParams">;
|
||||
export type DevicePairSetupCodeParams = SchemaType<"DevicePairSetupCodeParams">;
|
||||
export type DevicePairSetupCodeResult = SchemaType<"DevicePairSetupCodeResult">;
|
||||
export type DevicePairRenameParams = SchemaType<"DevicePairRenameParams">;
|
||||
export type DeviceTokenRotateParams = SchemaType<"DeviceTokenRotateParams">;
|
||||
export type DeviceTokenRevokeParams = SchemaType<"DeviceTokenRevokeParams">;
|
||||
export type ChatAbortParams = SchemaType<"ChatAbortParams">;
|
||||
export type ChatInjectParams = SchemaType<"ChatInjectParams">;
|
||||
export type ChatEvent = SchemaType<"ChatEvent">;
|
||||
|
||||
/** Gateway update and process lifecycle event payloads. */
|
||||
export type UpdateRunParams = SchemaType<"UpdateRunParams">;
|
||||
export type TickEvent = SchemaType<"TickEvent">;
|
||||
export type ShutdownEvent = SchemaType<"ShutdownEvent">;
|
||||
@@ -1,4 +1,5 @@
|
||||
// Gateway Protocol schema module defines protocol validation shapes.
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -127,3 +128,14 @@ export const WizardStatusResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type WizardStartParams = Static<typeof WizardStartParamsSchema>;
|
||||
export type WizardNextParams = Static<typeof WizardNextParamsSchema>;
|
||||
export type WizardCancelParams = Static<typeof WizardCancelParamsSchema>;
|
||||
export type WizardStatusParams = Static<typeof WizardStatusParamsSchema>;
|
||||
export type WizardStep = Static<typeof WizardStepSchema>;
|
||||
export type WizardNextResult = Static<typeof WizardNextResultSchema>;
|
||||
export type WizardStartResult = Static<typeof WizardStartResultSchema>;
|
||||
export type WizardStatusResult = Static<typeof WizardStatusResultSchema>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { Static } from "typebox";
|
||||
import { Type } from "typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
@@ -84,3 +85,18 @@ export const WorktreesGcResultSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
// Wire types derive directly from local schema consts so public d.ts graphs never
|
||||
// pull in the ProtocolSchemas registry.
|
||||
export type WorktreeRecord = Static<typeof WorktreeRecordSchema>;
|
||||
export type WorktreesListParams = Static<typeof WorktreesListParamsSchema>;
|
||||
export type WorktreesListResult = Static<typeof WorktreesListResultSchema>;
|
||||
export type WorktreesCreateParams = Static<typeof WorktreesCreateParamsSchema>;
|
||||
export type WorktreesRemoveParams = Static<typeof WorktreesRemoveParamsSchema>;
|
||||
export type WorktreesRemoveResult = Static<typeof WorktreesRemoveResultSchema>;
|
||||
export type WorktreesRestoreParams = Static<typeof WorktreesRestoreParamsSchema>;
|
||||
export type WorktreesGcParams = Static<typeof WorktreesGcParamsSchema>;
|
||||
export type WorktreesGcResult = Static<typeof WorktreesGcResultSchema>;
|
||||
export type WorktreeBranch = Static<typeof WorktreeBranchSchema>;
|
||||
export type WorktreesBranchesParams = Static<typeof WorktreesBranchesParamsSchema>;
|
||||
export type WorktreesBranchesResult = Static<typeof WorktreesBranchesResultSchema>;
|
||||
|
||||
@@ -205,7 +205,7 @@ export function readPluginSdkSurfaceBudgets(env = process.env) {
|
||||
),
|
||||
publicDeprecatedExports: readPluginSdkSurfaceBudgetEnv(
|
||||
"OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS",
|
||||
3274,
|
||||
3265,
|
||||
env,
|
||||
),
|
||||
publicWildcardReexports: readPluginSdkSurfaceBudgetEnv(
|
||||
|
||||
@@ -90,6 +90,9 @@ export type ExecApprovalManagerOptions<TPayload> = {
|
||||
approvalKind?: OperatorApprovalKind;
|
||||
persistence?: OperatorApprovalPersistenceRuntime;
|
||||
resolveAllowedDecisions?: (request: TPayload) => readonly ExecApprovalDecision[];
|
||||
/** Session-lineage audience policy is gateway-owned and injected; importing
|
||||
* it here would close an agents->gateway barrel cycle. Absent resolver seeds
|
||||
* only the raising session. */
|
||||
resolveAudienceSessionKeys?: (sourceSessionKey: string) => string[];
|
||||
onError?: (
|
||||
error: Error,
|
||||
@@ -257,14 +260,14 @@ export class ExecApprovalManager<TPayload = ExecApprovalRequestPayload> {
|
||||
const source = resolveApprovalSource(record.request);
|
||||
let audienceSessionKeys: string[] = [];
|
||||
if (source.sessionKey) {
|
||||
audienceSessionKeys = [source.sessionKey];
|
||||
if (this.options.resolveAudienceSessionKeys) {
|
||||
try {
|
||||
audienceSessionKeys = this.options.resolveAudienceSessionKeys(source.sessionKey);
|
||||
} catch {
|
||||
// Lineage is routing metadata, not an approval safety prerequisite.
|
||||
// Preserve at least the source audience when session stores are unavailable.
|
||||
}
|
||||
try {
|
||||
audienceSessionKeys = this.options.resolveAudienceSessionKeys?.(source.sessionKey) ?? [
|
||||
source.sessionKey,
|
||||
];
|
||||
} catch {
|
||||
// Lineage is routing metadata, not an approval safety prerequisite.
|
||||
// Preserve at least the source audience when session stores are unavailable.
|
||||
audienceSessionKeys = [source.sessionKey];
|
||||
}
|
||||
}
|
||||
const inserted = insertOperatorApproval({
|
||||
|
||||
@@ -115,8 +115,10 @@ function createApprovalRuntime(params: {
|
||||
const record = manager.create(request, timeoutMs, `plugin:${randomUUID()}`);
|
||||
bindApprovalRequesterMetadata({ record, client: params.client });
|
||||
const respond: RespondFn = () => {};
|
||||
// Internal policy requests have no RPC response channel. Registration
|
||||
// failures must reject so an unreviewable request cannot reach the node.
|
||||
// Register directly: persistence and presentation-validation failures
|
||||
// must throw so the plugin policy fails closed before any request
|
||||
// routing. The RPC storage-unavailable respond path does not apply to
|
||||
// this runtime-internal caller.
|
||||
const decisionPromise = manager.register(record, timeoutMs);
|
||||
const requestEvent = buildRequestedApprovalEvent(record);
|
||||
await handlePendingApprovalRequest({
|
||||
|
||||
@@ -3,9 +3,6 @@ import { ADMIN_SCOPE, APPROVALS_SCOPE } from "./method-scopes.js";
|
||||
import type { GatewayClient } from "./server-methods/types.js";
|
||||
|
||||
export type OperatorApprovalAccessBinding = {
|
||||
requestedByConnId?: string | null;
|
||||
requestedByDeviceId?: string | null;
|
||||
requestedByClientId?: string | null;
|
||||
reviewerDeviceIds?: readonly string[] | null;
|
||||
};
|
||||
|
||||
@@ -73,21 +70,11 @@ export function canAccessOperatorApproval(params: {
|
||||
return Boolean(clientDeviceId && reviewerDeviceIds.includes(clientDeviceId));
|
||||
}
|
||||
|
||||
const requestedByDeviceId = normalizeIdentity(params.binding.requestedByDeviceId);
|
||||
if (requestedByDeviceId) {
|
||||
return requestedByDeviceId === clientDeviceId;
|
||||
}
|
||||
|
||||
const requestedByConnId = normalizeIdentity(params.binding.requestedByConnId);
|
||||
if (requestedByConnId) {
|
||||
return requestedByConnId === normalizeIdentity(params.client?.connId);
|
||||
}
|
||||
|
||||
if (normalizeIdentity(params.binding.requestedByClientId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only genuinely legacy, unbound records retain the broad approvals-scope
|
||||
// recovery behavior.
|
||||
// No explicit reviewer binding: the operator.approvals scope tier is the
|
||||
// access authority, matching the shipped contract where any authorized
|
||||
// approval surface (Telegram buttons, macOS app, control UI) may resolve
|
||||
// any pending approval. Cross-surface first-answer-wins depends on this;
|
||||
// reviewerDeviceIds is the opt-in restriction, and requester identity gates
|
||||
// only the legacy adapters in approval-shared.
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Persistent operator approval lifecycle and first-answer-wins transitions.
|
||||
import type { Selectable } from "kysely";
|
||||
import { Value } from "typebox/value";
|
||||
import {
|
||||
ApprovalPresentationSchema,
|
||||
type ApprovalPresentation,
|
||||
isWellFormedApprovalId,
|
||||
} from "../../packages/gateway-protocol/src/schema/approvals.js";
|
||||
validateApprovalPresentation,
|
||||
} from "../../packages/gateway-protocol/src/index.js";
|
||||
import {
|
||||
executeSqliteQuerySync,
|
||||
executeSqliteQueryTakeFirstSync,
|
||||
@@ -169,7 +168,7 @@ const OPERATOR_APPROVAL_RESOLVER_KINDS = new Set<OperatorApprovalResolverKind>([
|
||||
function parseApprovalPresentation(raw: string): ApprovalPresentation | null {
|
||||
try {
|
||||
const value: unknown = JSON.parse(raw);
|
||||
return Value.Check(ApprovalPresentationSchema, value) ? value : null;
|
||||
return validateApprovalPresentation(value) ? value : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
@@ -222,7 +221,7 @@ function normalizeStringArray(values: readonly string[] | undefined): string[] {
|
||||
}
|
||||
|
||||
function stringifyPresentation(presentation: ApprovalPresentation): string {
|
||||
if (!Value.Check(ApprovalPresentationSchema, presentation)) {
|
||||
if (!validateApprovalPresentation(presentation)) {
|
||||
throw new Error("operator approval presentation must match the safe protocol schema");
|
||||
}
|
||||
let raw: string;
|
||||
|
||||
@@ -14,7 +14,6 @@ import { clearSessionStoreCacheForTest } from "../config/sessions/store.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { loadOrCreateDeviceIdentity } from "../infra/device-identity.js";
|
||||
import { captureEnv, deleteTestEnvValue, setTestEnvValue } from "../test-utils/env.js";
|
||||
import type { GatewayClient } from "./client.js";
|
||||
import { ADMIN_SCOPE, APPROVALS_SCOPE, READ_SCOPE } from "./method-scopes.js";
|
||||
import { withOperatorApprovalsGatewayClient } from "./operator-approvals-client.js";
|
||||
import { startGatewayServer } from "./server.js";
|
||||
@@ -37,9 +36,8 @@ const TEST_ENV_KEYS = [
|
||||
type Cleanup = () => Promise<void> | void;
|
||||
|
||||
async function requestExecApproval(params: {
|
||||
requester: Pick<GatewayClient, "request">;
|
||||
requester: Awaited<ReturnType<typeof connectGatewayClient>>;
|
||||
id: string;
|
||||
reviewerDeviceIds?: string[];
|
||||
}): Promise<void> {
|
||||
await expect(
|
||||
params.requester.request("exec.approval.request", {
|
||||
@@ -49,7 +47,6 @@ async function requestExecApproval(params: {
|
||||
host: "local",
|
||||
ask: "always",
|
||||
twoPhase: true,
|
||||
...(params.reviewerDeviceIds ? { approvalReviewerDeviceIds: params.reviewerDeviceIds } : {}),
|
||||
// This suite drives the stable ID directly from another authenticated
|
||||
// device, so no legacy event delivery route is required.
|
||||
requireDeliveryRoute: false,
|
||||
@@ -248,24 +245,7 @@ describe("operator approval gateway client e2e", () => {
|
||||
cleanup.push(() => disconnectGatewayClient(underscoped));
|
||||
|
||||
const approvalId = "multi-surface-first-answer-wins";
|
||||
const localConfig = {
|
||||
gateway: {
|
||||
port,
|
||||
auth: { mode: "token", token },
|
||||
},
|
||||
} satisfies OpenClawConfig;
|
||||
await withOperatorApprovalsGatewayClient(
|
||||
{
|
||||
config: localConfig,
|
||||
clientDisplayName: "approval runtime requester",
|
||||
},
|
||||
async (client) =>
|
||||
requestExecApproval({
|
||||
requester: client,
|
||||
id: approvalId,
|
||||
reviewerDeviceIds: [requesterIdentity.deviceId, reviewerIdentity.deviceId],
|
||||
}),
|
||||
);
|
||||
await requestExecApproval({ requester, id: approvalId });
|
||||
|
||||
const pending = await reviewer.request<ApprovalGetResult>("approval.get", { id: approvalId });
|
||||
expect(validateApprovalGetResult(pending)).toBe(true);
|
||||
@@ -279,7 +259,7 @@ describe("operator approval gateway client e2e", () => {
|
||||
"missing scope: operator.approvals",
|
||||
);
|
||||
await expect(
|
||||
underscoped.request("approval.resolve", { id: approvalId, kind: "exec", decision: "deny" }),
|
||||
underscoped.request("approval.resolve", { id: approvalId, decision: "deny" }),
|
||||
).rejects.toThrow("missing scope: operator.approvals");
|
||||
|
||||
const stillPending = await reviewer.request<ApprovalGetResult>("approval.get", {
|
||||
@@ -291,12 +271,10 @@ describe("operator approval gateway client e2e", () => {
|
||||
const [allowResult, denyResult] = await Promise.all([
|
||||
requester.request<ApprovalResolveResult>("approval.resolve", {
|
||||
id: approvalId,
|
||||
kind: "exec",
|
||||
decision: "allow-once",
|
||||
}),
|
||||
reviewer.request<ApprovalResolveResult>("approval.resolve", {
|
||||
id: approvalId,
|
||||
kind: "exec",
|
||||
decision: "deny",
|
||||
}),
|
||||
]);
|
||||
@@ -314,7 +292,6 @@ describe("operator approval gateway client e2e", () => {
|
||||
|
||||
const replay = await reviewer.request<ApprovalResolveResult>("approval.resolve", {
|
||||
id: approvalId,
|
||||
kind: "exec",
|
||||
decision: winningDecision,
|
||||
});
|
||||
expect(validateApprovalResolveResult(replay)).toBe(true);
|
||||
|
||||
@@ -103,8 +103,8 @@ export function createGatewayAuxHandlers(params: {
|
||||
const execApprovalManager = new ExecApprovalManager<ExecApprovalRequestPayload>({
|
||||
approvalKind: "exec",
|
||||
persistence: approvalPersistence,
|
||||
resolveAllowedDecisions: resolveExecApprovalRequestAllowedDecisions,
|
||||
resolveAudienceSessionKeys: resolveApprovalSessionAudience,
|
||||
resolveAllowedDecisions: resolveExecApprovalRequestAllowedDecisions,
|
||||
onError: (error, context) => {
|
||||
params.log.error?.(
|
||||
`${context.approvalKind} approval ${context.operation} failed for ${context.approvalId}: ${String(error)}`,
|
||||
@@ -127,8 +127,8 @@ export function createGatewayAuxHandlers(params: {
|
||||
const pluginApprovalManager = new ExecApprovalManager<PluginApprovalRequestPayload>({
|
||||
approvalKind: "plugin",
|
||||
persistence: approvalPersistence,
|
||||
resolveAllowedDecisions: (request) => resolvePluginApprovalRequestAllowedDecisions(request),
|
||||
resolveAudienceSessionKeys: resolveApprovalSessionAudience,
|
||||
resolveAllowedDecisions: (request) => resolvePluginApprovalRequestAllowedDecisions(request),
|
||||
onError: (error, context) => {
|
||||
params.log.error?.(
|
||||
`${context.approvalKind} approval ${context.operation} failed for ${context.approvalId}: ${String(error)}`,
|
||||
|
||||
@@ -94,6 +94,7 @@ describe("listGatewayMethods", () => {
|
||||
|
||||
it("preserves the legacy advertised method order", () => {
|
||||
const methods = listGatewayMethods();
|
||||
const coreMethods = listCoreGatewayMethodNames();
|
||||
expect(methods.slice(0, 5)).toEqual([
|
||||
"health",
|
||||
"diagnostics.stability",
|
||||
@@ -109,6 +110,13 @@ describe("listGatewayMethods", () => {
|
||||
"exec.approval.get",
|
||||
]);
|
||||
expect(methods).toContain("tts.speak");
|
||||
expect(coreMethods.slice(-5)).toEqual([
|
||||
"sessions.catalog.read",
|
||||
"sessions.catalog.continue",
|
||||
"sessions.catalog.archive",
|
||||
"approval.get",
|
||||
"approval.resolve",
|
||||
]);
|
||||
expect(methods.indexOf("approval.get")).toBeGreaterThan(methods.indexOf("tts.speak"));
|
||||
expect(methods.indexOf("approval.resolve")).toBe(methods.indexOf("approval.get") + 1);
|
||||
});
|
||||
|
||||
@@ -357,7 +357,7 @@ describe("unified approval handlers", () => {
|
||||
body:
|
||||
method === "approval.get"
|
||||
? { id: pending.record.id }
|
||||
: { id: pending.record.id, kind: "exec", decision: "deny" },
|
||||
: { id: pending.record.id, decision: "deny" },
|
||||
client: createClient({ deviceId }),
|
||||
});
|
||||
expect(response).toMatchObject({
|
||||
@@ -371,7 +371,7 @@ describe("unified approval handlers", () => {
|
||||
const winner = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: pending.record.id, kind: "exec", decision: "deny" },
|
||||
body: { id: pending.record.id, decision: "deny" },
|
||||
client: createClient({ deviceId: "reviewer-a" }),
|
||||
});
|
||||
expect(winner.result).toMatchObject({
|
||||
@@ -400,7 +400,7 @@ describe("unified approval handlers", () => {
|
||||
pluginApprovalManager: managers.plugin,
|
||||
databaseOptions,
|
||||
});
|
||||
const body = { id: pending.record.id, kind: "exec", decision: "deny" };
|
||||
const body = { id: pending.record.id, decision: "deny" };
|
||||
|
||||
const untrusted = await invoke({
|
||||
handlers,
|
||||
@@ -445,7 +445,7 @@ describe("unified approval handlers", () => {
|
||||
method,
|
||||
body: {
|
||||
id,
|
||||
...(method === "approval.resolve" ? { kind: "exec", decision: "deny" } : {}),
|
||||
...(method === "approval.resolve" ? { decision: "deny" } : {}),
|
||||
},
|
||||
client: createClient({ deviceId: "reviewer" }),
|
||||
});
|
||||
@@ -469,10 +469,7 @@ describe("unified approval handlers", () => {
|
||||
const response = await invoke({
|
||||
handlers,
|
||||
method,
|
||||
body:
|
||||
method === "approval.get"
|
||||
? { id: "lookup" }
|
||||
: { id: "lookup", kind: "exec", decision: "deny" },
|
||||
body: method === "approval.get" ? { id: "lookup" } : { id: "lookup", decision: "deny" },
|
||||
client: createClient({ deviceId: "reviewer" }),
|
||||
context,
|
||||
});
|
||||
@@ -545,7 +542,7 @@ describe("unified approval handlers", () => {
|
||||
const response = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id, kind: "exec", decision: "deny" },
|
||||
body: { id, decision: "deny" },
|
||||
client: createClient({ deviceId: "reviewer" }),
|
||||
context,
|
||||
});
|
||||
@@ -722,7 +719,7 @@ describe("unified approval handlers", () => {
|
||||
const response = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: pending.record.id, kind: "plugin", decision: "deny" },
|
||||
body: { id: pending.record.id, decision: "deny" },
|
||||
client: createClient({ deviceId: "phone-device" }),
|
||||
context,
|
||||
});
|
||||
@@ -813,7 +810,7 @@ describe("unified approval handlers", () => {
|
||||
const response = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: pending.record.id, kind: "exec", decision: "deny" },
|
||||
body: { id: pending.record.id, decision: "deny" },
|
||||
client: createClient({ deviceId: "reviewer-device" }),
|
||||
context,
|
||||
});
|
||||
@@ -863,14 +860,14 @@ describe("unified approval handlers", () => {
|
||||
invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: pending.record.id, kind: "exec", decision: "allow-once" },
|
||||
body: { id: pending.record.id, decision: "allow-once" },
|
||||
client: createClient({ deviceId: "control-ui" }),
|
||||
context,
|
||||
}),
|
||||
invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: pending.record.id, kind: "exec", decision: "deny" },
|
||||
body: { id: pending.record.id, decision: "deny" },
|
||||
client: createClient({ deviceId: "telegram" }),
|
||||
context,
|
||||
}),
|
||||
@@ -931,7 +928,7 @@ describe("unified approval handlers", () => {
|
||||
const response = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: pending.record.id, kind: "exec", decision },
|
||||
body: { id: pending.record.id, decision },
|
||||
client: createClient({ deviceId: "later-surface" }),
|
||||
context,
|
||||
});
|
||||
@@ -948,7 +945,7 @@ describe("unified approval handlers", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it("atomically denies malformed, mismatched-kind, and disallowed approving verdicts", async () => {
|
||||
it("atomically denies malformed and disallowed approving verdicts", async () => {
|
||||
const databaseOptions = createDatabaseOptions();
|
||||
const managers = createManagers(databaseOptions);
|
||||
const disallowed = registerExec(managers.exec, {
|
||||
@@ -959,10 +956,6 @@ describe("unified approval handlers", () => {
|
||||
id: "plugin:malformed",
|
||||
request: { allowedDecisions: ["allow-once"] },
|
||||
});
|
||||
const mismatchedKind = registerPlugin(managers.plugin, {
|
||||
id: "opaque-plugin-id",
|
||||
request: { allowedDecisions: ["allow-once"] },
|
||||
});
|
||||
const handlers = createApprovalHandlers({
|
||||
execApprovalManager: managers.exec,
|
||||
pluginApprovalManager: managers.plugin,
|
||||
@@ -973,7 +966,7 @@ describe("unified approval handlers", () => {
|
||||
const disallowedResponse = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: disallowed.record.id, kind: "exec", decision: "allow-always" },
|
||||
body: { id: disallowed.record.id, decision: "allow-always" },
|
||||
client,
|
||||
});
|
||||
expect(disallowedResponse.result).toMatchObject({
|
||||
@@ -985,7 +978,7 @@ describe("unified approval handlers", () => {
|
||||
const malformedResponse = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: malformed.record.id, kind: "plugin", decision: "ACCEPT" },
|
||||
body: { id: malformed.record.id, decision: "ACCEPT" },
|
||||
client,
|
||||
});
|
||||
expect(malformedResponse.result).toMatchObject({
|
||||
@@ -993,23 +986,6 @@ describe("unified approval handlers", () => {
|
||||
approval: { status: "denied", decision: "deny", reason: "malformed-verdict" },
|
||||
});
|
||||
await expect(malformed.decision).resolves.toBe("deny");
|
||||
|
||||
const mismatchedKindResponse = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: mismatchedKind.record.id, kind: "exec", decision: "allow-once" },
|
||||
client,
|
||||
});
|
||||
expect(mismatchedKindResponse.result).toMatchObject({
|
||||
applied: true,
|
||||
approval: {
|
||||
status: "denied",
|
||||
decision: "deny",
|
||||
reason: "malformed-verdict",
|
||||
presentation: { kind: "plugin" },
|
||||
},
|
||||
});
|
||||
await expect(mismatchedKind.decision).resolves.toBe("deny");
|
||||
});
|
||||
|
||||
it("lets the exact deadline beat a malformed verdict", async () => {
|
||||
@@ -1033,7 +1009,7 @@ describe("unified approval handlers", () => {
|
||||
const response = await invoke({
|
||||
handlers,
|
||||
method: "approval.resolve",
|
||||
body: { id: pending.record.id, kind: "exec", decision: "ACCEPT" },
|
||||
body: { id: pending.record.id, decision: "ACCEPT" },
|
||||
client: createClient({ deviceId: "reviewer" }),
|
||||
context,
|
||||
});
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
errorShape,
|
||||
isWellFormedApprovalId,
|
||||
type ApprovalDecision,
|
||||
type ApprovalResolveParams,
|
||||
type ApprovalSnapshot,
|
||||
validateApprovalGetParams,
|
||||
validateApprovalResolveParams,
|
||||
@@ -169,12 +168,7 @@ function loadVisibleApproval(params: {
|
||||
!canAccessOperatorApproval({
|
||||
client: params.client,
|
||||
allowApprovalRuntime: params.allowApprovalRuntime,
|
||||
binding: {
|
||||
requestedByConnId: liveRecord.requestedByConnId,
|
||||
requestedByDeviceId: liveRecord.requestedByDeviceId,
|
||||
requestedByClientId: liveRecord.requestedByClientId,
|
||||
reviewerDeviceIds: liveRecord.approvalReviewerDeviceIds,
|
||||
},
|
||||
binding: { reviewerDeviceIds: liveRecord.approvalReviewerDeviceIds },
|
||||
})
|
||||
) {
|
||||
return null;
|
||||
@@ -196,11 +190,7 @@ function loadVisibleApproval(params: {
|
||||
!canAccessOperatorApproval({
|
||||
client: params.client,
|
||||
allowApprovalRuntime: params.allowApprovalRuntime,
|
||||
binding: {
|
||||
requestedByDeviceId: lookup.record.requester.deviceId,
|
||||
requestedByClientId: lookup.record.requester.clientId,
|
||||
reviewerDeviceIds: lookup.record.reviewerDeviceIds,
|
||||
},
|
||||
binding: { reviewerDeviceIds: lookup.record.reviewerDeviceIds },
|
||||
})
|
||||
) {
|
||||
return null;
|
||||
@@ -502,16 +492,14 @@ export function createApprovalHandlers(
|
||||
const resolver = resolveApprovalResolver(client);
|
||||
const localResolvedBy = resolveLegacyApprovalLabel(client);
|
||||
const validParams = validateApprovalResolveParams(rawParams);
|
||||
const resolveParams = validParams ? (rawParams as ApprovalResolveParams) : null;
|
||||
const requestedDecision = resolveParams?.decision ?? null;
|
||||
const requestedDecision = validParams
|
||||
? (rawParams as { decision: ApprovalDecision }).decision
|
||||
: null;
|
||||
const decisionAllowed =
|
||||
requestedDecision === "deny" ||
|
||||
(requestedDecision !== null &&
|
||||
record.presentation.allowedDecisions.includes(requestedDecision));
|
||||
const kindMatches = resolveParams?.kind === record.presentation.kind;
|
||||
// Ambiguous verdicts consume the first-answer slot as a denial. Leaving
|
||||
// the approval retryable would let a later surface release authority.
|
||||
const forceMalformedDeny = !validParams || !kindMatches || !decisionAllowed;
|
||||
const forceMalformedDeny = !validParams || !decisionAllowed;
|
||||
let resolution:
|
||||
| ApplyApprovalDecisionResult<ExecApprovalRequestPayload>
|
||||
| ApplyApprovalDecisionResult<PluginApprovalRequestPayload>;
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
ApprovalDecision,
|
||||
ApprovalKind,
|
||||
ApprovalPresentation,
|
||||
} from "../../packages/gateway-protocol/src/schema/approvals.js";
|
||||
} from "../../packages/gateway-protocol/src/index.js";
|
||||
import {
|
||||
resolveExecApprovalCommandDisplay,
|
||||
sanitizeExecApprovalDisplayText,
|
||||
|
||||
Reference in New Issue
Block a user