mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 04:01:05 +00:00
fix(cycles): split residual shared type seams
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/types.js";
|
||||
import {
|
||||
normalizeOptionalLowercaseString,
|
||||
normalizeOptionalString,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from "./dependency-denylist.js";
|
||||
import { getGlobalHookRunner } from "./hook-runner-global.js";
|
||||
import { createBeforeInstallHookPayload } from "./install-policy-context.js";
|
||||
import type { InstallSafetyOverrides } from "./install-security-scan.js";
|
||||
import type { InstallSafetyOverrides } from "./install-security-scan.types.js";
|
||||
|
||||
type InstallScanLogger = {
|
||||
warn?: (message: string) => void;
|
||||
|
||||
@@ -2,9 +2,8 @@ type InstallScanLogger = {
|
||||
warn?: (message: string) => void;
|
||||
};
|
||||
|
||||
export type InstallSafetyOverrides = {
|
||||
dangerouslyForceUnsafeInstall?: boolean;
|
||||
};
|
||||
export type { InstallSafetyOverrides } from "./install-security-scan.types.js";
|
||||
import type { InstallSafetyOverrides } from "./install-security-scan.types.js";
|
||||
|
||||
export type InstallSecurityScanResult = {
|
||||
blocked?: {
|
||||
|
||||
3
src/plugins/install-security-scan.types.ts
Normal file
3
src/plugins/install-security-scan.types.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export type InstallSafetyOverrides = {
|
||||
dangerouslyForceUnsafeInstall?: boolean;
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/types.js";
|
||||
import {
|
||||
normalizeOptionalLowercaseString,
|
||||
normalizeOptionalString,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { SecretInput } from "../config/types.secrets.js";
|
||||
import type { EmbeddingInput } from "../memory-host-sdk/engine-embeddings.js";
|
||||
import type { EmbeddingInput } from "../memory-host-sdk/host/embedding-inputs.js";
|
||||
|
||||
export type MemoryEmbeddingBatchChunk = {
|
||||
text: string;
|
||||
|
||||
1
src/plugins/plugin-kind.types.ts
Normal file
1
src/plugins/plugin-kind.types.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type PluginKind = "memory" | "context-engine";
|
||||
@@ -1,12 +1,21 @@
|
||||
import { normalizeProviderId } from "../agents/provider-id.js";
|
||||
import { getActivePluginRegistry } from "./runtime.js";
|
||||
import type {
|
||||
ProviderDefaultThinkingPolicyContext,
|
||||
ProviderPlugin,
|
||||
ProviderThinkingPolicyContext,
|
||||
} from "./types.js";
|
||||
} from "./provider-thinking.types.js";
|
||||
import { getActivePluginRegistry } from "./runtime.js";
|
||||
|
||||
function matchesProviderId(provider: ProviderPlugin, providerId: string): boolean {
|
||||
type ThinkingProviderPlugin = {
|
||||
id: string;
|
||||
aliases?: string[];
|
||||
isBinaryThinking?: (ctx: ProviderThinkingPolicyContext) => boolean | undefined;
|
||||
supportsXHighThinking?: (ctx: ProviderThinkingPolicyContext) => boolean | undefined;
|
||||
resolveDefaultThinkingLevel?: (
|
||||
ctx: ProviderDefaultThinkingPolicyContext,
|
||||
) => "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "adaptive" | null | undefined;
|
||||
};
|
||||
|
||||
function matchesProviderId(provider: ThinkingProviderPlugin, providerId: string): boolean {
|
||||
const normalized = normalizeProviderId(providerId);
|
||||
if (!normalized) {
|
||||
return false;
|
||||
@@ -17,7 +26,7 @@ function matchesProviderId(provider: ProviderPlugin, providerId: string): boolea
|
||||
return (provider.aliases ?? []).some((alias) => normalizeProviderId(alias) === normalized);
|
||||
}
|
||||
|
||||
function resolveActiveThinkingProvider(providerId: string): ProviderPlugin | undefined {
|
||||
function resolveActiveThinkingProvider(providerId: string): ThinkingProviderPlugin | undefined {
|
||||
return getActivePluginRegistry()?.providers.find((entry) => {
|
||||
return matchesProviderId(entry.provider, providerId);
|
||||
})?.provider;
|
||||
|
||||
22
src/plugins/provider-thinking.types.ts
Normal file
22
src/plugins/provider-thinking.types.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Provider-owned thinking policy input.
|
||||
*
|
||||
* Used by shared `/think`, ACP controls, and directive parsing to ask a
|
||||
* provider whether a model supports special reasoning UX such as xhigh or a
|
||||
* binary on/off toggle.
|
||||
*/
|
||||
export type ProviderThinkingPolicyContext = {
|
||||
provider: string;
|
||||
modelId: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provider-owned default thinking policy input.
|
||||
*
|
||||
* `reasoning` is the merged catalog hint for the selected model when one is
|
||||
* available. Providers can use it to keep "reasoning model => low" behavior
|
||||
* without re-reading the catalog themselves.
|
||||
*/
|
||||
export type ProviderDefaultThinkingPolicyContext = ProviderThinkingPolicyContext & {
|
||||
reasoning?: boolean;
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AgentHarness } from "../agents/harness/types.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { OperatorScope } from "../gateway/method-scopes.js";
|
||||
import type { OperatorScope } from "../gateway/operator-scopes.js";
|
||||
import type { GatewayRequestHandlers } from "../gateway/server-methods/types.js";
|
||||
import type { HookEntry } from "../hooks/types.js";
|
||||
import type { PluginActivationSource } from "./config-state.js";
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { AgentHarness } from "../agents/harness/types.js";
|
||||
import type { AnyAgentTool } from "../agents/tools/common.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import { registerContextEngineForOwner } from "../context-engine/registry.js";
|
||||
import type { OperatorScope } from "../gateway/method-scopes.js";
|
||||
import type { OperatorScope } from "../gateway/operator-scopes.js";
|
||||
import type { GatewayRequestHandler } from "../gateway/server-methods/types.js";
|
||||
import { registerInternalHook, unregisterInternalHook } from "../hooks/internal-hooks.js";
|
||||
import type { HookEntry } from "../hooks/types.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/types.js";
|
||||
import type { PluginSlotsConfig } from "../config/types.plugins.js";
|
||||
import type { PluginKind } from "./types.js";
|
||||
import type { PluginKind } from "./plugin-kind.types.js";
|
||||
|
||||
export type PluginSlotKey = keyof PluginSlotsConfig;
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ import type {
|
||||
AuthProfileStore,
|
||||
} from "../agents/auth-profiles/types.js";
|
||||
import type { AgentHarness } from "../agents/harness/types.js";
|
||||
import type { ModelCatalogEntry } from "../agents/model-catalog.js";
|
||||
import type { ModelCatalogEntry } from "../agents/model-catalog.types.js";
|
||||
import type { AgentHarness } from "../agents/harness/types.js";
|
||||
import type { FailoverReason } from "../agents/pi-embedded-helpers/types.js";
|
||||
import type { ModelProviderRequestTransportOverrides } from "../agents/provider-request-config.js";
|
||||
import type { ProviderSystemPromptContribution } from "../agents/system-prompt-contribution.js";
|
||||
@@ -31,7 +32,7 @@ import type {
|
||||
import type { ModelCompatConfig } from "../config/types.models.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import type { TtsAutoMode } from "../config/types.tts.js";
|
||||
import type { OperatorScope } from "../gateway/method-scopes.js";
|
||||
import type { OperatorScope } from "../gateway/operator-scopes.js";
|
||||
import type { GatewayRequestHandler } from "../gateway/server-methods/types.js";
|
||||
import type { InternalHookHandler } from "../hooks/internal-hooks.js";
|
||||
import type { HookEntry } from "../hooks/types.js";
|
||||
@@ -80,8 +81,13 @@ import type {
|
||||
import type { DeliveryContext } from "../utils/delivery-context.js";
|
||||
import type { VideoGenerationProvider } from "../video-generation/types.js";
|
||||
import type { WizardPrompter } from "../wizard/prompts.js";
|
||||
import type { PluginKind } from "./plugin-kind.types.js";
|
||||
import type { SecretInputMode } from "./provider-auth-types.js";
|
||||
import type { createVpsAwareOAuthHandlers } from "./provider-oauth-flow.js";
|
||||
import type {
|
||||
ProviderDefaultThinkingPolicyContext,
|
||||
ProviderThinkingPolicyContext,
|
||||
} from "./provider-thinking.types.js";
|
||||
import type { PluginRuntime } from "./runtime/types.js";
|
||||
|
||||
export type { PluginRuntime } from "./runtime/types.js";
|
||||
@@ -112,7 +118,7 @@ export type PluginConfigUiHint = {
|
||||
placeholder?: string;
|
||||
};
|
||||
|
||||
export type PluginKind = "memory" | "context-engine";
|
||||
export type { PluginKind } from "./plugin-kind.types.js";
|
||||
|
||||
export type PluginConfigValidation =
|
||||
| { ok: true; value?: unknown }
|
||||
@@ -901,28 +907,10 @@ export type ProviderBuiltInModelSuppressionResult = {
|
||||
errorMessage?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provider-owned thinking policy input.
|
||||
*
|
||||
* Used by shared `/think`, ACP controls, and directive parsing to ask a
|
||||
* provider whether a model supports special reasoning UX such as xhigh or a
|
||||
* binary on/off toggle.
|
||||
*/
|
||||
export type ProviderThinkingPolicyContext = {
|
||||
provider: string;
|
||||
modelId: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provider-owned default thinking policy input.
|
||||
*
|
||||
* `reasoning` is the merged catalog hint for the selected model when one is
|
||||
* available. Providers can use it to keep "reasoning model => low" behavior
|
||||
* without re-reading the catalog themselves.
|
||||
*/
|
||||
export type ProviderDefaultThinkingPolicyContext = ProviderThinkingPolicyContext & {
|
||||
reasoning?: boolean;
|
||||
};
|
||||
export type {
|
||||
ProviderDefaultThinkingPolicyContext,
|
||||
ProviderThinkingPolicyContext,
|
||||
} from "./provider-thinking.types.js";
|
||||
|
||||
/**
|
||||
* Provider-owned "modern model" policy input.
|
||||
|
||||
Reference in New Issue
Block a user