mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix(ci): break type cycles, satisfy export scan, regenerate Swift protocol models
This commit is contained in:
@@ -6290,12 +6290,6 @@ public struct SessionsPatchParams: Codable, Sendable {
|
||||
public let execask: AnyCodable?
|
||||
public let execnode: AnyCodable?
|
||||
public let model: AnyCodable?
|
||||
public let spawnedby: AnyCodable?
|
||||
public let spawnedworkspacedir: AnyCodable?
|
||||
public let spawnedcwd: AnyCodable?
|
||||
public let spawndepth: AnyCodable?
|
||||
public let subagentrole: AnyCodable?
|
||||
public let subagentcontrolscope: AnyCodable?
|
||||
public let inheritedtoolallow: AnyCodable?
|
||||
public let inheritedtooldeny: AnyCodable?
|
||||
public let sendpolicy: AnyCodable?
|
||||
@@ -6325,12 +6319,6 @@ public struct SessionsPatchParams: Codable, Sendable {
|
||||
execask: AnyCodable? = nil,
|
||||
execnode: AnyCodable? = nil,
|
||||
model: AnyCodable? = nil,
|
||||
spawnedby: AnyCodable? = nil,
|
||||
spawnedworkspacedir: AnyCodable? = nil,
|
||||
spawnedcwd: AnyCodable? = nil,
|
||||
spawndepth: AnyCodable? = nil,
|
||||
subagentrole: AnyCodable? = nil,
|
||||
subagentcontrolscope: AnyCodable? = nil,
|
||||
inheritedtoolallow: AnyCodable? = nil,
|
||||
inheritedtooldeny: AnyCodable? = nil,
|
||||
sendpolicy: AnyCodable? = nil,
|
||||
@@ -6359,12 +6347,6 @@ public struct SessionsPatchParams: Codable, Sendable {
|
||||
self.execask = execask
|
||||
self.execnode = execnode
|
||||
self.model = model
|
||||
self.spawnedby = spawnedby
|
||||
self.spawnedworkspacedir = spawnedworkspacedir
|
||||
self.spawnedcwd = spawnedcwd
|
||||
self.spawndepth = spawndepth
|
||||
self.subagentrole = subagentrole
|
||||
self.subagentcontrolscope = subagentcontrolscope
|
||||
self.inheritedtoolallow = inheritedtoolallow
|
||||
self.inheritedtooldeny = inheritedtooldeny
|
||||
self.sendpolicy = sendpolicy
|
||||
@@ -6395,12 +6377,6 @@ public struct SessionsPatchParams: Codable, Sendable {
|
||||
case execask = "execAsk"
|
||||
case execnode = "execNode"
|
||||
case model
|
||||
case spawnedby = "spawnedBy"
|
||||
case spawnedworkspacedir = "spawnedWorkspaceDir"
|
||||
case spawnedcwd = "spawnedCwd"
|
||||
case spawndepth = "spawnDepth"
|
||||
case subagentrole = "subagentRole"
|
||||
case subagentcontrolscope = "subagentControlScope"
|
||||
case inheritedtoolallow = "inheritedToolAllow"
|
||||
case inheritedtooldeny = "inheritedToolDeny"
|
||||
case sendpolicy = "sendPolicy"
|
||||
|
||||
@@ -10,7 +10,9 @@ import { createTestRegistry } from "../../test-utils/channel-plugins.js";
|
||||
import { extractAssistantText, sanitizeTextContent } from "./chat-history-text.js";
|
||||
|
||||
const callGatewayMock = vi.fn();
|
||||
const inProcessCreationMock = vi.fn(async (): Promise<unknown> => ({}));
|
||||
const inProcessCreationMock = vi.fn(
|
||||
async (..._args: [unknown, unknown, unknown]): Promise<unknown> => ({}),
|
||||
);
|
||||
// Default false mirrors running outside a gateway process; the trusted-creation
|
||||
// regression test flips it on and restores it.
|
||||
let inProcessGatewayContextAvailable = false;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import type { HookExternalContentSource } from "../../security/external-content.js";
|
||||
import type { SessionEntry } from "./types.js";
|
||||
|
||||
/** Kept aligned with SessionStateActorType (src/sessions/session-state-event-kinds.ts); not imported to avoid layering config/sessions onto src/sessions. */
|
||||
export type SessionCreatedActorType = "human" | "agent" | "system";
|
||||
export type SessionCreatedActor = { type: SessionCreatedActorType; id?: string };
|
||||
export type SessionCreatedActor = { type: "human" | "agent" | "system"; id?: string };
|
||||
export type SessionCreatedVia =
|
||||
| "operator" // gateway sessions.create (Control UI / operator clients)
|
||||
| "spawn" // sessions_spawn native or ACP subagent spawn
|
||||
@@ -14,11 +12,13 @@ export type SessionCreatedVia =
|
||||
| "plugin" // trusted plugin runtime creation
|
||||
| "internal"; // internal/hidden sessions (internal-session-effects, voice bare rows)
|
||||
|
||||
// Return shape mirrors the SessionEntry creation fields as a leaf contract;
|
||||
// types.ts imports from here, never the reverse (madge cycle guard).
|
||||
export function buildSessionCreationStamp(params: {
|
||||
via: SessionCreatedVia;
|
||||
actor?: SessionCreatedActor;
|
||||
now?: number;
|
||||
}): Pick<SessionEntry, "createdVia" | "createdActor" | "createdAt"> {
|
||||
}): { createdVia: SessionCreatedVia; createdActor?: SessionCreatedActor; createdAt: number } {
|
||||
return {
|
||||
createdVia: params.via,
|
||||
...(params.actor ? { createdActor: params.actor } : {}),
|
||||
|
||||
@@ -2,15 +2,23 @@ import type {
|
||||
SessionCreatedActor,
|
||||
SessionCreatedVia,
|
||||
} from "../../config/sessions/session-entry-provenance.js";
|
||||
import type { GatewayClient } from "./shared-types.js";
|
||||
|
||||
export type TrustedSessionCreation = {
|
||||
via: SessionCreatedVia;
|
||||
actor?: SessionCreatedActor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Structural subset of GatewayClient; a leaf contract so shared-types.ts can
|
||||
* import TrustedSessionCreation without a type cycle back through this module.
|
||||
*/
|
||||
type SessionCreationClient = {
|
||||
authenticatedUserProfile?: { profileId?: string } | null;
|
||||
internal?: { syntheticClient?: true; sessionCreation?: TrustedSessionCreation };
|
||||
};
|
||||
|
||||
export function resolveOperatorSessionCreation(
|
||||
client: GatewayClient | null,
|
||||
client: SessionCreationClient | null | undefined,
|
||||
options: { allowTrustedHint?: boolean } = {},
|
||||
): TrustedSessionCreation {
|
||||
if (options.allowTrustedHint && client?.internal?.sessionCreation) {
|
||||
|
||||
@@ -151,12 +151,15 @@ export type GatewaySessionRow = {
|
||||
pluginExtensions?: PluginSessionExtensionProjection[];
|
||||
};
|
||||
|
||||
type AssertTrue<T extends true> = T;
|
||||
|
||||
/** Keeps the Gateway projection assignable to the protocol schema's documented row fields. */
|
||||
export type GatewaySessionRowSchemaDriftGuard = AssertTrue<
|
||||
Pick<GatewaySessionRow, keyof SessionRow> extends SessionRow ? true : false
|
||||
>;
|
||||
/**
|
||||
* Compile-time drift guard: fails typecheck when the Gateway projection stops
|
||||
* matching the protocol schema's documented row fields. Value-level so the
|
||||
* unused-export scan sees a consumer.
|
||||
*/
|
||||
const sessionRowSchemaDriftGuard: Pick<GatewaySessionRow, keyof SessionRow> extends SessionRow
|
||||
? true
|
||||
: false = true;
|
||||
void sessionRowSchemaDriftGuard;
|
||||
|
||||
export type GatewayAgentRow = SharedGatewayAgentRow;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user