Skip to content

Commit 9fd08f9

Browse files
committed
refactor: remove type-only import cycles
1 parent fe1fd05 commit 9fd08f9

37 files changed

Lines changed: 785 additions & 693 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
268aca42eaae8b4dd37d7eddb7202d002db16a4a27830cd90d98b5c4413cbbe7 plugin-sdk-api-baseline.json
2-
4fe4fc194bec72a58bdd5566c4b31c00b2c0a520941fdcdd0f42bdf02b683ea5 plugin-sdk-api-baseline.jsonl
1+
70ecd040dd5815b237eb749db2de98e300fd53630e5b418deea0865b781adf4a plugin-sdk-api-baseline.json
2+
7a7b08495662e48d466a1c7cb20d6e81557df05d361de0bebc54369e34dffa35 plugin-sdk-api-baseline.jsonl

src/agents/auth-profiles/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { OpenClawConfig } from "../../config/config.js";
1+
import type { OpenClawConfig } from "../../config/types.openclaw.js";
22
import type { SecretRef } from "../../config/types.secrets.js";
33

44
export type OAuthProvider = string;

src/auto-reply/chunk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// unintentionally breaking on newlines. Using [\s\S] keeps newlines inside
33
// the chunk so messages are only split when they truly exceed the limit.
44

5-
import type { ChannelId } from "../channels/plugins/types.js";
6-
import type { OpenClawConfig } from "../config/config.js";
5+
import type { ChannelId } from "../channels/plugins/types.core.js";
6+
import type { OpenClawConfig } from "../config/types.openclaw.js";
77
import { findFenceSpanAt, isSafeFenceBreak, parseFenceSpans } from "../markdown/fences.js";
88
import { resolveChannelStreamingChunkMode } from "../plugin-sdk/channel-streaming.js";
99
import { resolveAccountEntry } from "../routing/account-lookup.js";
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export type CommandArgValue = string | number | boolean | bigint;
2+
export type CommandArgValues = Record<string, CommandArgValue>;
3+
4+
export type CommandArgs = {
5+
raw?: string;
6+
values?: CommandArgValues;
7+
};

src/auto-reply/commands-registry.types.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import type { OpenClawConfig } from "../config/types.js";
2+
import type { CommandArgValues } from "./commands-args.types.js";
3+
4+
export type { CommandArgValue, CommandArgValues, CommandArgs } from "./commands-args.types.js";
25

36
export type CommandScope = "text" | "native" | "both";
47

@@ -40,14 +43,6 @@ export type CommandArgMenuSpec = {
4043
title?: string;
4144
};
4245

43-
export type CommandArgValue = string | number | boolean | bigint;
44-
export type CommandArgValues = Record<string, CommandArgValue>;
45-
46-
export type CommandArgs = {
47-
raw?: string;
48-
values?: CommandArgValues;
49-
};
50-
5146
export type CommandArgsParsing = "none" | "positional";
5247

5348
export type ChatCommandDefinition = {

src/auto-reply/reply/commands-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { SessionEntry, SessionScope } from "../../config/sessions.js";
66
import type { MsgContext } from "../templating.js";
77
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "../thinking.js";
88
import type { GetReplyOptions, ReplyPayload } from "../types.js";
9-
import type { InlineDirectives } from "./directive-handling.js";
9+
import type { InlineDirectives } from "./directive-handling.parse.js";
1010
import type { TypingController } from "./typing.js";
1111

1212
export type CommandContext = {

src/auto-reply/templating.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import type { ChannelId } from "../channels/plugins/types.js";
21
import type {
32
MediaUnderstandingDecision,
43
MediaUnderstandingOutput,
54
} from "../media-understanding/types.js";
65
import type { InputProvenance } from "../sessions/input-provenance.js";
7-
import type { CommandArgs } from "./commands-registry.types.js";
6+
import type { CommandArgs } from "./commands-args.types.js";
87
import type { ReplyThreadingPolicy } from "./types.js";
98

109
/** Valid message channels for routing. */
11-
export type OriginatingChannelType = ChannelId;
10+
export type OriginatingChannelType = string & { readonly __originatingChannelBrand?: never };
1211

1312
export type StickerContextMetadata = {
1413
cachedDescription?: string;

src/channels/plugins/config-write-policy-shared.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { OpenClawConfig } from "../../config/config.js";
21
import { resolveAccountEntry } from "../../routing/account-lookup.js";
32
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../routing/session-key.js";
43

@@ -11,6 +10,10 @@ type ChannelConfigWithAccounts = {
1110
accounts?: Record<string, AccountConfigWithWrites>;
1211
};
1312

13+
type ConfigWritePolicyConfig = {
14+
channels?: Record<string, ChannelConfigWithAccounts>;
15+
};
16+
1417
export type ConfigWriteScopeLike<TChannelId extends string = string> = {
1518
channelId?: TChannelId | null;
1619
accountId?: string | null;
@@ -46,13 +49,13 @@ function listConfigWriteTargetScopes<TChannelId extends string>(
4649
}
4750

4851
function resolveChannelConfig<TChannelId extends string>(
49-
cfg: OpenClawConfig,
52+
cfg: ConfigWritePolicyConfig,
5053
channelId?: TChannelId | null,
5154
): ChannelConfigWithAccounts | undefined {
5255
if (!channelId) {
5356
return undefined;
5457
}
55-
return (cfg.channels as Record<string, ChannelConfigWithAccounts> | undefined)?.[channelId];
58+
return cfg.channels?.[channelId];
5659
}
5760

5861
function resolveChannelAccountConfig(
@@ -63,7 +66,7 @@ function resolveChannelAccountConfig(
6366
}
6467

6568
export function resolveChannelConfigWritesShared<TChannelId extends string>(params: {
66-
cfg: OpenClawConfig;
69+
cfg: ConfigWritePolicyConfig;
6770
channelId?: TChannelId | null;
6871
accountId?: string | null;
6972
}): boolean {
@@ -77,7 +80,7 @@ export function resolveChannelConfigWritesShared<TChannelId extends string>(para
7780
}
7881

7982
export function authorizeConfigWriteShared<TChannelId extends string>(params: {
80-
cfg: OpenClawConfig;
83+
cfg: ConfigWritePolicyConfig;
8184
origin?: ConfigWriteScopeLike<TChannelId>;
8285
target?: ConfigWriteTargetLike<TChannelId>;
8386
allowBypass?: boolean;

src/channels/plugins/config-writes.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { OpenClawConfig } from "../../config/config.js";
1+
import type { OpenClawConfig } from "../../config/types.openclaw.js";
22
import { normalizeLowercaseStringOrEmpty } from "../../shared/string-coerce.js";
3-
import { isInternalMessageChannel } from "../../utils/message-channel.js";
43
import {
54
authorizeConfigWriteShared,
65
canBypassConfigWritePolicyShared,
@@ -12,11 +11,15 @@ import {
1211
type ConfigWriteScopeLike,
1312
type ConfigWriteTargetLike,
1413
} from "./config-write-policy-shared.js";
15-
import type { ChannelId } from "./types.js";
14+
import type { ChannelId } from "./types.core.js";
1615
export type ConfigWriteScope = ConfigWriteScopeLike<ChannelId>;
1716
export type ConfigWriteTarget = ConfigWriteTargetLike<ChannelId>;
1817
export type ConfigWriteAuthorizationResult = ConfigWriteAuthorizationResultLike<ChannelId>;
1918

19+
function isInternalConfigWriteMessageChannel(channel?: string | null): boolean {
20+
return normalizeLowercaseStringOrEmpty(channel) === "webchat";
21+
}
22+
2023
export function resolveChannelConfigWrites(params: {
2124
cfg: OpenClawConfig;
2225
channelId?: ChannelId | null;
@@ -51,7 +54,7 @@ export function canBypassConfigWritePolicy(params: {
5154
}): boolean {
5255
return canBypassConfigWritePolicyShared({
5356
...params,
54-
isInternalMessageChannel,
57+
isInternalMessageChannel: isInternalConfigWriteMessageChannel,
5558
});
5659
}
5760

src/channels/plugins/setup-group-access.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type { WizardPrompter } from "../../wizard/prompts.js";
2-
import { splitSetupEntries } from "./setup-wizard-helpers.js";
32

43
export type ChannelAccessPolicy = "allowlist" | "open" | "disabled";
54

65
export function parseAllowlistEntries(raw: string): string[] {
7-
return splitSetupEntries(String(raw ?? ""));
6+
return String(raw ?? "")
7+
.split(/[\n,;]+/g)
8+
.map((entry) => entry.trim())
9+
.filter(Boolean);
810
}
911

1012
export function formatAllowlistEntries(entries: string[]): string {

0 commit comments

Comments
 (0)