@botiverse/kimi-code-sdk 0.20.0 → 0.20.1-botiverse.0
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.
- package/NOTICE.md +1 -1
- package/README.md +1 -1
- package/dist/index.d.mts +139 -3
- package/dist/index.mjs +395 -110
- package/package.json +3 -3
package/NOTICE.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# NOTICE
|
|
2
2
|
|
|
3
3
|
@botiverse/kimi-code-sdk is a repackage of the built **@moonshot-ai/kimi-code-sdk** node-sdk
|
|
4
|
-
from [MoonshotAI/kimi-code](https://github.com/MoonshotAI/kimi-code) at `@moonshot-ai/kimi-code@0.20.
|
|
4
|
+
from [MoonshotAI/kimi-code](https://github.com/MoonshotAI/kimi-code) at `@moonshot-ai/kimi-code@0.20.1`, distributed under upstream's MIT License (see LICENSE). Sibling packages are bundled into `dist`.
|
|
5
5
|
Mirror + provenance: https://github.com/botiverse/kimi-code-sdk
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @botiverse/kimi-code-sdk
|
|
2
2
|
|
|
3
|
-
Built repackage of `@moonshot-ai/kimi-code-sdk` (kimi-code @moonshot-ai/kimi-code@0.20.
|
|
3
|
+
Built repackage of `@moonshot-ai/kimi-code-sdk` (kimi-code @moonshot-ai/kimi-code@0.20.1) for Slock/Botiverse.
|
|
4
4
|
Read-only mirror + release notes: https://github.com/botiverse/kimi-code-sdk
|
|
5
5
|
|
|
6
6
|
> Not affiliated with Moonshot AI. MIT (see LICENSE).
|
package/dist/index.d.mts
CHANGED
|
@@ -960,11 +960,16 @@ declare interface ChatProvider {
|
|
|
960
960
|
* budget clamped to `maxCompletionTokens`. Optional because not every
|
|
961
961
|
* backend benefits from a client-computed cap.
|
|
962
962
|
*
|
|
963
|
+
* When `options` are provided, implementations may further tighten the cap
|
|
964
|
+
* based on their own transport constraints — e.g. chat-completions
|
|
965
|
+
* endpoints size the cap to the remaining context window
|
|
966
|
+
* (`maxContextTokens - usedContextTokens`) and/or clamp to a fixed ceiling.
|
|
967
|
+
*
|
|
963
968
|
* Implementations MUST NOT mutate or replace internal HTTP clients on the
|
|
964
969
|
* returned clone — the clone is expected to share transport state with the
|
|
965
970
|
* original. See `KimiChatProvider._clone()` for the rationale.
|
|
966
971
|
*/
|
|
967
|
-
withMaxCompletionTokens?(maxCompletionTokens: number): ChatProvider;
|
|
972
|
+
withMaxCompletionTokens?(maxCompletionTokens: number, options?: MaxCompletionTokensOptions): ChatProvider;
|
|
968
973
|
/** Upload a video and return a content part that can be sent to this provider. */
|
|
969
974
|
uploadVideo?(input: string | VideoUploadInput, options?: GenerateOptions): Promise<VideoURLPart>;
|
|
970
975
|
}
|
|
@@ -1828,6 +1833,18 @@ declare interface ExtraBody {
|
|
|
1828
1833
|
/** Fetches a models.dev-style catalog. Public endpoint, no credentials needed. */
|
|
1829
1834
|
export declare function fetchCatalog(url: string, signal?: AbortSignal, fetchImpl?: typeof fetch): Promise<Catalog>;
|
|
1830
1835
|
|
|
1836
|
+
declare interface FetchCompleteFeedbackUploadOk {
|
|
1837
|
+
readonly kind: 'ok';
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
declare type FetchCompleteFeedbackUploadResult = FetchCompleteFeedbackUploadOk | FetchFeedbackUploadError;
|
|
1841
|
+
|
|
1842
|
+
declare interface FetchFeedbackUploadError {
|
|
1843
|
+
readonly kind: 'error';
|
|
1844
|
+
readonly status?: number;
|
|
1845
|
+
readonly message: string;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1831
1848
|
declare interface FetchManagedUsageError {
|
|
1832
1849
|
readonly kind: 'error';
|
|
1833
1850
|
readonly status?: number;
|
|
@@ -1842,6 +1859,7 @@ declare interface FetchSubmitFeedbackError {
|
|
|
1842
1859
|
|
|
1843
1860
|
declare interface FetchSubmitFeedbackOk {
|
|
1844
1861
|
readonly kind: 'ok';
|
|
1862
|
+
readonly feedbackId: number;
|
|
1845
1863
|
}
|
|
1846
1864
|
|
|
1847
1865
|
declare type FetchSubmitFeedbackResult = FetchSubmitFeedbackOk | FetchSubmitFeedbackError;
|
|
@@ -2382,7 +2400,35 @@ declare interface HookDef {
|
|
|
2382
2400
|
readonly matcher?: string;
|
|
2383
2401
|
readonly command: string;
|
|
2384
2402
|
readonly timeout?: number;
|
|
2385
|
-
|
|
2403
|
+
readonly cwd?: string;
|
|
2404
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
declare type HookDefConfig = z.infer<typeof HookDefSchema>;
|
|
2408
|
+
|
|
2409
|
+
declare const HookDefSchema: z.ZodObject<{
|
|
2410
|
+
event: z.ZodEnum<{
|
|
2411
|
+
PreToolUse: "PreToolUse";
|
|
2412
|
+
PostToolUse: "PostToolUse";
|
|
2413
|
+
PostToolUseFailure: "PostToolUseFailure";
|
|
2414
|
+
PermissionRequest: "PermissionRequest";
|
|
2415
|
+
PermissionResult: "PermissionResult";
|
|
2416
|
+
UserPromptSubmit: "UserPromptSubmit";
|
|
2417
|
+
Stop: "Stop";
|
|
2418
|
+
StopFailure: "StopFailure";
|
|
2419
|
+
Interrupt: "Interrupt";
|
|
2420
|
+
SessionStart: "SessionStart";
|
|
2421
|
+
SessionEnd: "SessionEnd";
|
|
2422
|
+
SubagentStart: "SubagentStart";
|
|
2423
|
+
SubagentStop: "SubagentStop";
|
|
2424
|
+
PreCompact: "PreCompact";
|
|
2425
|
+
PostCompact: "PostCompact";
|
|
2426
|
+
Notification: "Notification";
|
|
2427
|
+
}>;
|
|
2428
|
+
matcher: z.ZodOptional<z.ZodString>;
|
|
2429
|
+
command: z.ZodString;
|
|
2430
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
2431
|
+
}, z.core.$strict>;
|
|
2386
2432
|
|
|
2387
2433
|
declare class HookEngine {
|
|
2388
2434
|
private readonly options;
|
|
@@ -2981,6 +3027,31 @@ export declare const KIMI_ERROR_INFO: {
|
|
|
2981
3027
|
};
|
|
2982
3028
|
};
|
|
2983
3029
|
|
|
3030
|
+
export declare interface KimiAuthCompleteFeedbackUploadInput {
|
|
3031
|
+
readonly uploadId: number;
|
|
3032
|
+
readonly parts: readonly KimiAuthCompleteFeedbackUploadPart[];
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
export declare interface KimiAuthCompleteFeedbackUploadPart {
|
|
3036
|
+
readonly partNumber: number;
|
|
3037
|
+
readonly etag: string;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
export declare interface KimiAuthCreateFeedbackUploadUrlInput {
|
|
3041
|
+
readonly feedbackId: number;
|
|
3042
|
+
readonly filename: string;
|
|
3043
|
+
readonly size: number;
|
|
3044
|
+
readonly sha256: string;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
export declare interface KimiAuthCreateFeedbackUploadUrlOk {
|
|
3048
|
+
readonly kind: 'ok';
|
|
3049
|
+
readonly uploadId: number;
|
|
3050
|
+
readonly parts: readonly KimiAuthFeedbackUploadPart[];
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
export declare type KimiAuthCreateFeedbackUploadUrlResult = KimiAuthCreateFeedbackUploadUrlOk | FetchFeedbackUploadError;
|
|
3054
|
+
|
|
2984
3055
|
export declare class KimiAuthFacade {
|
|
2985
3056
|
private readonly options;
|
|
2986
3057
|
private readonly toolkit;
|
|
@@ -2990,6 +3061,8 @@ export declare class KimiAuthFacade {
|
|
|
2990
3061
|
logout(providerName?: string | undefined): Promise<KimiAuthLogoutResult>;
|
|
2991
3062
|
getManagedUsage(providerName?: string | undefined): Promise<AuthManagedUsageResult>;
|
|
2992
3063
|
submitFeedback(input: KimiAuthSubmitFeedbackInput, providerName?: string | undefined): Promise<FetchSubmitFeedbackResult>;
|
|
3064
|
+
createFeedbackUploadUrl(input: KimiAuthCreateFeedbackUploadUrlInput, providerName?: string | undefined): Promise<KimiAuthCreateFeedbackUploadUrlResult>;
|
|
3065
|
+
completeFeedbackUpload(input: KimiAuthCompleteFeedbackUploadInput, providerName?: string | undefined): Promise<FetchCompleteFeedbackUploadResult>;
|
|
2993
3066
|
getCachedAccessToken(providerName?: string, oauthRef?: OAuthRef | undefined): Promise<string | undefined>;
|
|
2994
3067
|
readonly resolveOAuthTokenProvider: (providerName: string, oauthRef?: OAuthRef | undefined) => BearerTokenProvider;
|
|
2995
3068
|
private resolveManagedAuth;
|
|
@@ -3005,6 +3078,13 @@ declare interface KimiAuthFacadeOptions {
|
|
|
3005
3078
|
readonly onRefresh?: ((outcome: OAuthRefreshOutcome) => void) | undefined;
|
|
3006
3079
|
}
|
|
3007
3080
|
|
|
3081
|
+
export declare interface KimiAuthFeedbackUploadPart {
|
|
3082
|
+
readonly partNumber: number;
|
|
3083
|
+
readonly url: string;
|
|
3084
|
+
readonly method: string;
|
|
3085
|
+
readonly size: number;
|
|
3086
|
+
}
|
|
3087
|
+
|
|
3008
3088
|
declare type KimiAuthLoginOptions = Omit<KimiOAuthLoginOptions, 'provisionConfig'>;
|
|
3009
3089
|
|
|
3010
3090
|
export declare interface KimiAuthLoginResult {
|
|
@@ -3026,6 +3106,8 @@ export declare interface KimiAuthSubmitFeedbackInput {
|
|
|
3026
3106
|
readonly version: string;
|
|
3027
3107
|
readonly os: string;
|
|
3028
3108
|
readonly model: string | null;
|
|
3109
|
+
readonly contact?: string;
|
|
3110
|
+
readonly info?: Record<string, unknown>;
|
|
3029
3111
|
}
|
|
3030
3112
|
|
|
3031
3113
|
export declare type KimiConfig = z.infer<typeof KimiConfigSchema>;
|
|
@@ -3640,6 +3722,7 @@ declare class KosongLLM implements LLM {
|
|
|
3640
3722
|
private readonly provider;
|
|
3641
3723
|
private readonly generate;
|
|
3642
3724
|
private readonly completionBudgetConfig;
|
|
3725
|
+
private readonly usedContextTokens;
|
|
3643
3726
|
constructor(config: KosongLLMConfig);
|
|
3644
3727
|
chat(params: LLMChatParams): Promise<LLMChatResponse>;
|
|
3645
3728
|
isRetryableError(error: unknown): boolean;
|
|
@@ -3660,6 +3743,12 @@ declare interface KosongLLMConfig {
|
|
|
3660
3743
|
* final cap is applied to each request.
|
|
3661
3744
|
*/
|
|
3662
3745
|
readonly completionBudgetConfig?: CompletionBudgetConfig | undefined;
|
|
3746
|
+
/**
|
|
3747
|
+
* Returns the number of context tokens already consumed by the latest
|
|
3748
|
+
* completed step (API-reported input + output). Used by chat-completions
|
|
3749
|
+
* providers to size the completion budget to the remaining context window.
|
|
3750
|
+
*/
|
|
3751
|
+
readonly usedContextTokens?: (() => number) | undefined;
|
|
3663
3752
|
}
|
|
3664
3753
|
|
|
3665
3754
|
export declare interface ListSessionsOptions {
|
|
@@ -3911,6 +4000,22 @@ declare interface LoopToolResultEvent {
|
|
|
3911
4000
|
*/
|
|
3912
4001
|
declare type LoopTurnStopReason = LoopTerminalStepStopReason | 'aborted';
|
|
3913
4002
|
|
|
4003
|
+
/**
|
|
4004
|
+
* Optional context passed to {@link ChatProvider.withMaxCompletionTokens} so a
|
|
4005
|
+
* provider can tighten the caller-supplied cap to its own transport
|
|
4006
|
+
* constraints.
|
|
4007
|
+
*/
|
|
4008
|
+
declare interface MaxCompletionTokensOptions {
|
|
4009
|
+
/**
|
|
4010
|
+
* Tokens already consumed by the current context (API-reported input +
|
|
4011
|
+
* output of the latest completed step). Chat-completions providers use it
|
|
4012
|
+
* to size the cap to the remaining context window.
|
|
4013
|
+
*/
|
|
4014
|
+
readonly usedContextTokens?: number;
|
|
4015
|
+
/** Model context-window size in tokens (`max_context_size`). */
|
|
4016
|
+
readonly maxContextTokens?: number;
|
|
4017
|
+
}
|
|
4018
|
+
|
|
3914
4019
|
export declare type MaybePromise<T> = T | Promise<T>;
|
|
3915
4020
|
|
|
3916
4021
|
export { MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE }
|
|
@@ -4638,6 +4743,7 @@ declare class PluginManager {
|
|
|
4638
4743
|
pluginSkillRoots(): readonly SkillRoot[];
|
|
4639
4744
|
enabledSessionStarts(): readonly EnabledPluginSessionStart[];
|
|
4640
4745
|
enabledMcpServers(): Record<string, McpServerConfig>;
|
|
4746
|
+
enabledHooks(): readonly HookDef[];
|
|
4641
4747
|
summaries(): readonly PluginSummary[];
|
|
4642
4748
|
info(id: string): PluginInfo | undefined;
|
|
4643
4749
|
private persist;
|
|
@@ -4659,6 +4765,7 @@ declare interface PluginManifest {
|
|
|
4659
4765
|
readonly skills?: readonly string[];
|
|
4660
4766
|
readonly sessionStart?: PluginSessionStart;
|
|
4661
4767
|
readonly mcpServers?: Readonly<Record<string, McpServerConfig>>;
|
|
4768
|
+
readonly hooks?: readonly HookDefConfig[];
|
|
4662
4769
|
readonly interface?: PluginInterface;
|
|
4663
4770
|
readonly skillInstructions?: string;
|
|
4664
4771
|
}
|
|
@@ -4719,6 +4826,7 @@ export declare interface PluginSummary {
|
|
|
4719
4826
|
readonly skillCount: number;
|
|
4720
4827
|
readonly mcpServerCount: number;
|
|
4721
4828
|
readonly enabledMcpServerCount: number;
|
|
4829
|
+
readonly hookCount: number;
|
|
4722
4830
|
readonly hasErrors: boolean;
|
|
4723
4831
|
readonly source: PluginSource;
|
|
4724
4832
|
readonly originalSource?: string;
|
|
@@ -6737,4 +6845,32 @@ declare interface WorkspaceAdditionalDirsLoadResult {
|
|
|
6737
6845
|
readonly warning?: string;
|
|
6738
6846
|
}
|
|
6739
6847
|
|
|
6740
|
-
export { }
|
|
6848
|
+
export { }
|
|
6849
|
+
|
|
6850
|
+
// Botiverse mirror surface extension — see scripts/repackage-sdk.mjs.
|
|
6851
|
+
// Minimal type declaration; runtime implementation is bundled in dist/index.mjs.
|
|
6852
|
+
declare class LocalKaos implements Kaos {
|
|
6853
|
+
static create(): Promise<LocalKaos>;
|
|
6854
|
+
readonly name: string;
|
|
6855
|
+
readonly osEnv: Kaos['osEnv'];
|
|
6856
|
+
pathClass(): 'posix' | 'win32';
|
|
6857
|
+
normpath(path: string): string;
|
|
6858
|
+
gethome(): string;
|
|
6859
|
+
getcwd(): string;
|
|
6860
|
+
chdir(path: string): Promise<void>;
|
|
6861
|
+
withCwd(cwd: string): LocalKaos;
|
|
6862
|
+
withEnv(env: Record<string, string>): LocalKaos;
|
|
6863
|
+
stat: Kaos['stat'];
|
|
6864
|
+
iterdir: Kaos['iterdir'];
|
|
6865
|
+
glob: Kaos['glob'];
|
|
6866
|
+
readBytes: Kaos['readBytes'];
|
|
6867
|
+
readText: Kaos['readText'];
|
|
6868
|
+
readLines: Kaos['readLines'];
|
|
6869
|
+
writeBytes: Kaos['writeBytes'];
|
|
6870
|
+
writeText: Kaos['writeText'];
|
|
6871
|
+
mkdir: Kaos['mkdir'];
|
|
6872
|
+
exec: Kaos['exec'];
|
|
6873
|
+
execWithEnv: Kaos['execWithEnv'];
|
|
6874
|
+
}
|
|
6875
|
+
export { LocalKaos };
|
|
6876
|
+
export type { Kaos };
|