nextclaw-core 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +177 -149
  2. package/dist/index.js +566 -161
  3. package/package.json +3 -2
package/dist/index.d.ts CHANGED
@@ -228,6 +228,21 @@ declare class CronService {
228
228
  };
229
229
  }
230
230
 
231
+ type ConfigUiHint = {
232
+ label?: string;
233
+ help?: string;
234
+ group?: string;
235
+ order?: number;
236
+ advanced?: boolean;
237
+ sensitive?: boolean;
238
+ placeholder?: string;
239
+ };
240
+ type ConfigUiHints = Record<string, ConfigUiHint>;
241
+ declare function isSensitiveConfigPath(path: string): boolean;
242
+ declare function buildBaseHints(): ConfigUiHints;
243
+ declare function applySensitiveHints(hints: ConfigUiHints): ConfigUiHints;
244
+ declare function mapSensitivePaths(schema: z.ZodType, path: string, hints: ConfigUiHints): ConfigUiHints;
245
+
231
246
  declare const WhatsAppConfigSchema: z.ZodObject<{
232
247
  enabled: z.ZodDefault<z.ZodBoolean>;
233
248
  bridgeUrl: z.ZodDefault<z.ZodString>;
@@ -2880,6 +2895,80 @@ declare const ConfigSchema: z.ZodObject<{
2880
2895
  };
2881
2896
  };
2882
2897
  };
2898
+ providers: {
2899
+ openrouter: {
2900
+ apiKey: string;
2901
+ apiBase: string | null;
2902
+ extraHeaders: Record<string, string> | null;
2903
+ wireApi: "auto" | "chat" | "responses";
2904
+ };
2905
+ aihubmix: {
2906
+ apiKey: string;
2907
+ apiBase: string | null;
2908
+ extraHeaders: Record<string, string> | null;
2909
+ wireApi: "auto" | "chat" | "responses";
2910
+ };
2911
+ openai: {
2912
+ apiKey: string;
2913
+ apiBase: string | null;
2914
+ extraHeaders: Record<string, string> | null;
2915
+ wireApi: "auto" | "chat" | "responses";
2916
+ };
2917
+ anthropic: {
2918
+ apiKey: string;
2919
+ apiBase: string | null;
2920
+ extraHeaders: Record<string, string> | null;
2921
+ wireApi: "auto" | "chat" | "responses";
2922
+ };
2923
+ deepseek: {
2924
+ apiKey: string;
2925
+ apiBase: string | null;
2926
+ extraHeaders: Record<string, string> | null;
2927
+ wireApi: "auto" | "chat" | "responses";
2928
+ };
2929
+ gemini: {
2930
+ apiKey: string;
2931
+ apiBase: string | null;
2932
+ extraHeaders: Record<string, string> | null;
2933
+ wireApi: "auto" | "chat" | "responses";
2934
+ };
2935
+ zhipu: {
2936
+ apiKey: string;
2937
+ apiBase: string | null;
2938
+ extraHeaders: Record<string, string> | null;
2939
+ wireApi: "auto" | "chat" | "responses";
2940
+ };
2941
+ dashscope: {
2942
+ apiKey: string;
2943
+ apiBase: string | null;
2944
+ extraHeaders: Record<string, string> | null;
2945
+ wireApi: "auto" | "chat" | "responses";
2946
+ };
2947
+ moonshot: {
2948
+ apiKey: string;
2949
+ apiBase: string | null;
2950
+ extraHeaders: Record<string, string> | null;
2951
+ wireApi: "auto" | "chat" | "responses";
2952
+ };
2953
+ minimax: {
2954
+ apiKey: string;
2955
+ apiBase: string | null;
2956
+ extraHeaders: Record<string, string> | null;
2957
+ wireApi: "auto" | "chat" | "responses";
2958
+ };
2959
+ vllm: {
2960
+ apiKey: string;
2961
+ apiBase: string | null;
2962
+ extraHeaders: Record<string, string> | null;
2963
+ wireApi: "auto" | "chat" | "responses";
2964
+ };
2965
+ groq: {
2966
+ apiKey: string;
2967
+ apiBase: string | null;
2968
+ extraHeaders: Record<string, string> | null;
2969
+ wireApi: "auto" | "chat" | "responses";
2970
+ };
2971
+ };
2883
2972
  channels: {
2884
2973
  whatsapp: {
2885
2974
  enabled: boolean;
@@ -2987,80 +3076,6 @@ declare const ConfigSchema: z.ZodObject<{
2987
3076
  markdownSupport: boolean;
2988
3077
  };
2989
3078
  };
2990
- providers: {
2991
- openrouter: {
2992
- apiKey: string;
2993
- apiBase: string | null;
2994
- extraHeaders: Record<string, string> | null;
2995
- wireApi: "auto" | "chat" | "responses";
2996
- };
2997
- aihubmix: {
2998
- apiKey: string;
2999
- apiBase: string | null;
3000
- extraHeaders: Record<string, string> | null;
3001
- wireApi: "auto" | "chat" | "responses";
3002
- };
3003
- openai: {
3004
- apiKey: string;
3005
- apiBase: string | null;
3006
- extraHeaders: Record<string, string> | null;
3007
- wireApi: "auto" | "chat" | "responses";
3008
- };
3009
- anthropic: {
3010
- apiKey: string;
3011
- apiBase: string | null;
3012
- extraHeaders: Record<string, string> | null;
3013
- wireApi: "auto" | "chat" | "responses";
3014
- };
3015
- deepseek: {
3016
- apiKey: string;
3017
- apiBase: string | null;
3018
- extraHeaders: Record<string, string> | null;
3019
- wireApi: "auto" | "chat" | "responses";
3020
- };
3021
- gemini: {
3022
- apiKey: string;
3023
- apiBase: string | null;
3024
- extraHeaders: Record<string, string> | null;
3025
- wireApi: "auto" | "chat" | "responses";
3026
- };
3027
- zhipu: {
3028
- apiKey: string;
3029
- apiBase: string | null;
3030
- extraHeaders: Record<string, string> | null;
3031
- wireApi: "auto" | "chat" | "responses";
3032
- };
3033
- dashscope: {
3034
- apiKey: string;
3035
- apiBase: string | null;
3036
- extraHeaders: Record<string, string> | null;
3037
- wireApi: "auto" | "chat" | "responses";
3038
- };
3039
- moonshot: {
3040
- apiKey: string;
3041
- apiBase: string | null;
3042
- extraHeaders: Record<string, string> | null;
3043
- wireApi: "auto" | "chat" | "responses";
3044
- };
3045
- minimax: {
3046
- apiKey: string;
3047
- apiBase: string | null;
3048
- extraHeaders: Record<string, string> | null;
3049
- wireApi: "auto" | "chat" | "responses";
3050
- };
3051
- vllm: {
3052
- apiKey: string;
3053
- apiBase: string | null;
3054
- extraHeaders: Record<string, string> | null;
3055
- wireApi: "auto" | "chat" | "responses";
3056
- };
3057
- groq: {
3058
- apiKey: string;
3059
- apiBase: string | null;
3060
- extraHeaders: Record<string, string> | null;
3061
- wireApi: "auto" | "chat" | "responses";
3062
- };
3063
- };
3064
3079
  gateway: {
3065
3080
  host: string;
3066
3081
  port: number;
@@ -3106,6 +3121,80 @@ declare const ConfigSchema: z.ZodObject<{
3106
3121
  } | undefined;
3107
3122
  } | undefined;
3108
3123
  } | undefined;
3124
+ providers?: {
3125
+ openrouter?: {
3126
+ apiKey?: string | undefined;
3127
+ apiBase?: string | null | undefined;
3128
+ extraHeaders?: Record<string, string> | null | undefined;
3129
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3130
+ } | undefined;
3131
+ aihubmix?: {
3132
+ apiKey?: string | undefined;
3133
+ apiBase?: string | null | undefined;
3134
+ extraHeaders?: Record<string, string> | null | undefined;
3135
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3136
+ } | undefined;
3137
+ openai?: {
3138
+ apiKey?: string | undefined;
3139
+ apiBase?: string | null | undefined;
3140
+ extraHeaders?: Record<string, string> | null | undefined;
3141
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3142
+ } | undefined;
3143
+ anthropic?: {
3144
+ apiKey?: string | undefined;
3145
+ apiBase?: string | null | undefined;
3146
+ extraHeaders?: Record<string, string> | null | undefined;
3147
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3148
+ } | undefined;
3149
+ deepseek?: {
3150
+ apiKey?: string | undefined;
3151
+ apiBase?: string | null | undefined;
3152
+ extraHeaders?: Record<string, string> | null | undefined;
3153
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3154
+ } | undefined;
3155
+ gemini?: {
3156
+ apiKey?: string | undefined;
3157
+ apiBase?: string | null | undefined;
3158
+ extraHeaders?: Record<string, string> | null | undefined;
3159
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3160
+ } | undefined;
3161
+ zhipu?: {
3162
+ apiKey?: string | undefined;
3163
+ apiBase?: string | null | undefined;
3164
+ extraHeaders?: Record<string, string> | null | undefined;
3165
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3166
+ } | undefined;
3167
+ dashscope?: {
3168
+ apiKey?: string | undefined;
3169
+ apiBase?: string | null | undefined;
3170
+ extraHeaders?: Record<string, string> | null | undefined;
3171
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3172
+ } | undefined;
3173
+ moonshot?: {
3174
+ apiKey?: string | undefined;
3175
+ apiBase?: string | null | undefined;
3176
+ extraHeaders?: Record<string, string> | null | undefined;
3177
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3178
+ } | undefined;
3179
+ minimax?: {
3180
+ apiKey?: string | undefined;
3181
+ apiBase?: string | null | undefined;
3182
+ extraHeaders?: Record<string, string> | null | undefined;
3183
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3184
+ } | undefined;
3185
+ vllm?: {
3186
+ apiKey?: string | undefined;
3187
+ apiBase?: string | null | undefined;
3188
+ extraHeaders?: Record<string, string> | null | undefined;
3189
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3190
+ } | undefined;
3191
+ groq?: {
3192
+ apiKey?: string | undefined;
3193
+ apiBase?: string | null | undefined;
3194
+ extraHeaders?: Record<string, string> | null | undefined;
3195
+ wireApi?: "auto" | "chat" | "responses" | undefined;
3196
+ } | undefined;
3197
+ } | undefined;
3109
3198
  channels?: {
3110
3199
  whatsapp?: {
3111
3200
  enabled?: boolean | undefined;
@@ -3213,80 +3302,6 @@ declare const ConfigSchema: z.ZodObject<{
3213
3302
  markdownSupport?: boolean | undefined;
3214
3303
  } | undefined;
3215
3304
  } | undefined;
3216
- providers?: {
3217
- openrouter?: {
3218
- apiKey?: string | undefined;
3219
- apiBase?: string | null | undefined;
3220
- extraHeaders?: Record<string, string> | null | undefined;
3221
- wireApi?: "auto" | "chat" | "responses" | undefined;
3222
- } | undefined;
3223
- aihubmix?: {
3224
- apiKey?: string | undefined;
3225
- apiBase?: string | null | undefined;
3226
- extraHeaders?: Record<string, string> | null | undefined;
3227
- wireApi?: "auto" | "chat" | "responses" | undefined;
3228
- } | undefined;
3229
- openai?: {
3230
- apiKey?: string | undefined;
3231
- apiBase?: string | null | undefined;
3232
- extraHeaders?: Record<string, string> | null | undefined;
3233
- wireApi?: "auto" | "chat" | "responses" | undefined;
3234
- } | undefined;
3235
- anthropic?: {
3236
- apiKey?: string | undefined;
3237
- apiBase?: string | null | undefined;
3238
- extraHeaders?: Record<string, string> | null | undefined;
3239
- wireApi?: "auto" | "chat" | "responses" | undefined;
3240
- } | undefined;
3241
- deepseek?: {
3242
- apiKey?: string | undefined;
3243
- apiBase?: string | null | undefined;
3244
- extraHeaders?: Record<string, string> | null | undefined;
3245
- wireApi?: "auto" | "chat" | "responses" | undefined;
3246
- } | undefined;
3247
- gemini?: {
3248
- apiKey?: string | undefined;
3249
- apiBase?: string | null | undefined;
3250
- extraHeaders?: Record<string, string> | null | undefined;
3251
- wireApi?: "auto" | "chat" | "responses" | undefined;
3252
- } | undefined;
3253
- zhipu?: {
3254
- apiKey?: string | undefined;
3255
- apiBase?: string | null | undefined;
3256
- extraHeaders?: Record<string, string> | null | undefined;
3257
- wireApi?: "auto" | "chat" | "responses" | undefined;
3258
- } | undefined;
3259
- dashscope?: {
3260
- apiKey?: string | undefined;
3261
- apiBase?: string | null | undefined;
3262
- extraHeaders?: Record<string, string> | null | undefined;
3263
- wireApi?: "auto" | "chat" | "responses" | undefined;
3264
- } | undefined;
3265
- moonshot?: {
3266
- apiKey?: string | undefined;
3267
- apiBase?: string | null | undefined;
3268
- extraHeaders?: Record<string, string> | null | undefined;
3269
- wireApi?: "auto" | "chat" | "responses" | undefined;
3270
- } | undefined;
3271
- minimax?: {
3272
- apiKey?: string | undefined;
3273
- apiBase?: string | null | undefined;
3274
- extraHeaders?: Record<string, string> | null | undefined;
3275
- wireApi?: "auto" | "chat" | "responses" | undefined;
3276
- } | undefined;
3277
- vllm?: {
3278
- apiKey?: string | undefined;
3279
- apiBase?: string | null | undefined;
3280
- extraHeaders?: Record<string, string> | null | undefined;
3281
- wireApi?: "auto" | "chat" | "responses" | undefined;
3282
- } | undefined;
3283
- groq?: {
3284
- apiKey?: string | undefined;
3285
- apiBase?: string | null | undefined;
3286
- extraHeaders?: Record<string, string> | null | undefined;
3287
- wireApi?: "auto" | "chat" | "responses" | undefined;
3288
- } | undefined;
3289
- } | undefined;
3290
3305
  gateway?: {
3291
3306
  host?: string | undefined;
3292
3307
  port?: number | undefined;
@@ -3310,6 +3325,13 @@ declare const ConfigSchema: z.ZodObject<{
3310
3325
  restrictToWorkspace?: boolean | undefined;
3311
3326
  } | undefined;
3312
3327
  }>;
3328
+ type ConfigSchemaJson = Record<string, unknown>;
3329
+ type ConfigSchemaResponse = {
3330
+ schema: ConfigSchemaJson;
3331
+ uiHints: ConfigUiHints;
3332
+ version: string;
3333
+ generatedAt: string;
3334
+ };
3313
3335
  type Config = z.infer<typeof ConfigSchema>;
3314
3336
  type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
3315
3337
  declare function getWorkspacePathFromConfig(config: Config): string;
@@ -3321,6 +3343,9 @@ declare function getProvider(config: Config, model?: string): ProviderConfig | n
3321
3343
  declare function getProviderName(config: Config, model?: string): string | null;
3322
3344
  declare function getApiKey(config: Config, model?: string): string | null;
3323
3345
  declare function getApiBase(config: Config, model?: string): string | null;
3346
+ declare function buildConfigSchema(options?: {
3347
+ version?: string;
3348
+ }): ConfigSchemaResponse;
3324
3349
 
3325
3350
  declare class AgentLoop {
3326
3351
  private options;
@@ -3440,6 +3465,8 @@ type ReloadPlan = {
3440
3465
  declare function diffConfigPaths(prev: unknown, next: unknown, prefix?: string): string[];
3441
3466
  declare function buildReloadPlan(changedPaths: string[]): ReloadPlan;
3442
3467
 
3468
+ declare function redactConfigObject<T>(value: T, hints?: ConfigUiHints, prefix?: string): T;
3469
+
3443
3470
  declare const DEFAULT_HEARTBEAT_INTERVAL_S: number;
3444
3471
  declare const HEARTBEAT_PROMPT = "Read HEARTBEAT.md in your workspace (if it exists).\nFollow any instructions or tasks listed there.\nIf nothing needs attention, reply with just: HEARTBEAT_OK";
3445
3472
  declare const HEARTBEAT_OK_TOKEN = "HEARTBEAT_OK";
@@ -3529,5 +3556,6 @@ declare function parseSessionKey(key: string): {
3529
3556
  chatId: string;
3530
3557
  };
3531
3558
  declare function expandHome(value: string): string;
3559
+ declare function getPackageVersion(): string;
3532
3560
 
3533
- export { APP_NAME, APP_REPLY_SUBJECT, APP_TAGLINE, APP_TITLE, APP_USER_AGENT, AgentDefaultsSchema, AgentLoop, AgentsConfigSchema, ChannelManager, ChannelsConfigSchema, type Config, ConfigSchema, ContextBootstrapSchema, ContextConfigSchema, ContextMemorySchema, CronService, DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_PATH, DEFAULT_HEARTBEAT_INTERVAL_S, DEFAULT_HOME_DIR, DEFAULT_WORKSPACE_DIR, DEFAULT_WORKSPACE_PATH, DingTalkConfigSchema, DiscordConfigSchema, ENV_APP_NAME_KEY, ENV_HOME_KEY, EmailConfigSchema, ExecToolConfigSchema, FeishuConfigSchema, type FeishuProbeResult, GatewayConfigSchema, type GatewayConfigSnapshot, type GatewayController, GatewayTool, HEARTBEAT_OK_TOKEN, HEARTBEAT_PROMPT, HeartbeatService, LLMProvider, type LLMResponse, LiteLLMProvider, type LiteLLMProviderOptions, MessageBus, MochatConfigSchema, MochatGroupRuleSchema, MochatMentionSchema, PROVIDERS, type ProviderConfig, ProviderConfigSchema, ProviderManager, type ProviderSpec, ProvidersConfigSchema, QQConfigSchema, type ReloadPlan, SKILL_METADATA_KEY, type Session, SessionManager, type SessionMessage, SlackConfigSchema, SlackDMSchema, TelegramConfigSchema, type ToolCallRequest, ToolsConfigSchema, UiConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WhatsAppConfigSchema, type WireApiMode, buildReloadPlan, diffConfigPaths, ensureDir, expandHome, findGateway, findProviderByModel, findProviderByName, getApiBase, getApiKey, getConfigPath, getDataDir, getDataPath, getMemoryPath, getProvider, getProviderName, getSessionsPath, getSkillsPath, getWorkspacePath, getWorkspacePathFromConfig, loadConfig, matchProvider, parseSessionKey, probeFeishu, providerLabel, safeFilename, saveConfig, timestamp, todayDate, truncateString };
3561
+ export { APP_NAME, APP_REPLY_SUBJECT, APP_TAGLINE, APP_TITLE, APP_USER_AGENT, AgentDefaultsSchema, AgentLoop, AgentsConfigSchema, ChannelManager, ChannelsConfigSchema, type Config, ConfigSchema, type ConfigSchemaJson, type ConfigSchemaResponse, type ConfigUiHint, type ConfigUiHints, ContextBootstrapSchema, ContextConfigSchema, ContextMemorySchema, CronService, DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_PATH, DEFAULT_HEARTBEAT_INTERVAL_S, DEFAULT_HOME_DIR, DEFAULT_WORKSPACE_DIR, DEFAULT_WORKSPACE_PATH, DingTalkConfigSchema, DiscordConfigSchema, ENV_APP_NAME_KEY, ENV_HOME_KEY, EmailConfigSchema, ExecToolConfigSchema, FeishuConfigSchema, type FeishuProbeResult, GatewayConfigSchema, type GatewayConfigSnapshot, type GatewayController, GatewayTool, HEARTBEAT_OK_TOKEN, HEARTBEAT_PROMPT, HeartbeatService, LLMProvider, type LLMResponse, LiteLLMProvider, type LiteLLMProviderOptions, MessageBus, MochatConfigSchema, MochatGroupRuleSchema, MochatMentionSchema, PROVIDERS, type ProviderConfig, ProviderConfigSchema, ProviderManager, type ProviderSpec, ProvidersConfigSchema, QQConfigSchema, type ReloadPlan, SKILL_METADATA_KEY, type Session, SessionManager, type SessionMessage, SlackConfigSchema, SlackDMSchema, TelegramConfigSchema, type ToolCallRequest, ToolsConfigSchema, UiConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WhatsAppConfigSchema, type WireApiMode, applySensitiveHints, buildBaseHints, buildConfigSchema, buildReloadPlan, diffConfigPaths, ensureDir, expandHome, findGateway, findProviderByModel, findProviderByName, getApiBase, getApiKey, getConfigPath, getDataDir, getDataPath, getMemoryPath, getPackageVersion, getProvider, getProviderName, getSessionsPath, getSkillsPath, getWorkspacePath, getWorkspacePathFromConfig, isSensitiveConfigPath, loadConfig, mapSensitivePaths, matchProvider, parseSessionKey, probeFeishu, providerLabel, redactConfigObject, safeFilename, saveConfig, timestamp, todayDate, truncateString };