@botiverse/kimi-code-sdk 0.19.2-botiverse.0 → 0.20.0-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 +174 -6
- package/dist/index.mjs +803 -194
- 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.
|
|
4
|
+
from [MoonshotAI/kimi-code](https://github.com/MoonshotAI/kimi-code) at `@moonshot-ai/kimi-code@0.20.0`, 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.
|
|
3
|
+
Built repackage of `@moonshot-ai/kimi-code-sdk` (kimi-code @moonshot-ai/kimi-code@0.20.0) 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
|
@@ -24,6 +24,7 @@ import type { OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.
|
|
|
24
24
|
import type { OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
25
25
|
import type { Readable } from 'node:stream';
|
|
26
26
|
import { SessionMetaUpdatedEvent } from '@moonshot-ai/protocol';
|
|
27
|
+
import type { SessionWarning } from '@moonshot-ai/protocol';
|
|
27
28
|
import { SkillActivatedEvent } from '@moonshot-ai/protocol';
|
|
28
29
|
import { SubagentCompletedEvent } from '@moonshot-ai/protocol';
|
|
29
30
|
import { SubagentFailedEvent } from '@moonshot-ai/protocol';
|
|
@@ -145,6 +146,8 @@ declare class Agent {
|
|
|
145
146
|
|
|
146
147
|
declare interface AgentAPI {
|
|
147
148
|
prompt: (payload: PromptPayload) => void;
|
|
149
|
+
runShellCommand: (payload: RunShellCommandPayload) => Promise<ShellCommandResult>;
|
|
150
|
+
cancelShellCommand: (payload: CancelShellCommandPayload) => void;
|
|
148
151
|
steer: (payload: SteerPayload) => void;
|
|
149
152
|
cancel: (payload: CancelPayload) => void;
|
|
150
153
|
undoHistory: (payload: UndoHistoryPayload) => void;
|
|
@@ -577,6 +580,7 @@ declare class BackgroundManager {
|
|
|
577
580
|
readOutput(taskId: string, tail?: number): Promise<string>;
|
|
578
581
|
suppressTerminalNotification(taskId: string): Promise<void>;
|
|
579
582
|
detach(taskId: string): BackgroundTaskInfo | undefined;
|
|
583
|
+
persistOutput(taskId: string): void;
|
|
580
584
|
/** Stop a running task. SIGTERM → 5s grace → SIGKILL. */
|
|
581
585
|
stop(taskId: string, reason?: string): Promise<BackgroundTaskInfo | undefined>;
|
|
582
586
|
stopAll(reason?: string): Promise<readonly BackgroundTaskInfo[]>;
|
|
@@ -847,6 +851,10 @@ declare interface CancelPlanPayload {
|
|
|
847
851
|
readonly id?: string;
|
|
848
852
|
}
|
|
849
853
|
|
|
854
|
+
declare interface CancelShellCommandPayload {
|
|
855
|
+
readonly commandId: string;
|
|
856
|
+
}
|
|
857
|
+
|
|
850
858
|
/** Top-level catalog: `{ [providerId]: ProviderEntry }` (e.g. models.dev/api.json). */
|
|
851
859
|
export declare type Catalog = Record<string, CatalogProviderEntry>;
|
|
852
860
|
|
|
@@ -1087,7 +1095,18 @@ declare class ContextMemory {
|
|
|
1087
1095
|
get lastAssistantAt(): number | null;
|
|
1088
1096
|
appendUserMessage(content: readonly ContentPart[], origin?: PromptOrigin): void;
|
|
1089
1097
|
appendSystemReminder(content: string, origin: PromptOrigin): void;
|
|
1098
|
+
/**
|
|
1099
|
+
* Inject a user-invisible message and immediately send it to the model by
|
|
1100
|
+
* launching/steering a turn. The content is used as-is (no wrapper tag), so
|
|
1101
|
+
* callers can pass raw tool-result-style text or wrap it themselves. The
|
|
1102
|
+
* message is skipped on replay / transcript (so the user never sees it) but
|
|
1103
|
+
* is included in the context sent to the model. Use this for events the
|
|
1104
|
+
* model must react to right away without surfacing a user-visible message.
|
|
1105
|
+
*/
|
|
1106
|
+
injectAndNotify(content: string, origin?: PromptOrigin): void;
|
|
1090
1107
|
appendLocalCommandStdout(content: string): void;
|
|
1108
|
+
appendBashInput(command: string): void;
|
|
1109
|
+
appendBashOutput(stdout: string, stderr: string, isError?: boolean): void;
|
|
1091
1110
|
popMatchedMessage(matcher: (origin: PromptOrigin | undefined) => boolean): boolean;
|
|
1092
1111
|
clear(): void;
|
|
1093
1112
|
undo(count: number): void;
|
|
@@ -1663,6 +1682,12 @@ declare interface ExecutableToolContext {
|
|
|
1663
1682
|
readonly metadata?: unknown;
|
|
1664
1683
|
readonly signal: AbortSignal;
|
|
1665
1684
|
readonly onUpdate?: ((update: ToolUpdate_2) => void) | undefined;
|
|
1685
|
+
/**
|
|
1686
|
+
* Fired once when a foreground (non-background) process task is registered,
|
|
1687
|
+
* carrying its task id. Used by the `!` shell-command path so the TUI can
|
|
1688
|
+
* later detach (ctrl+b) that exact task. Background runs skip it.
|
|
1689
|
+
*/
|
|
1690
|
+
readonly onForegroundTaskStart?: ((taskId: string) => void) | undefined;
|
|
1666
1691
|
}
|
|
1667
1692
|
|
|
1668
1693
|
declare interface ExecutableToolErrorResult {
|
|
@@ -1672,6 +1697,8 @@ declare interface ExecutableToolErrorResult {
|
|
|
1672
1697
|
readonly message?: string | undefined;
|
|
1673
1698
|
/** See {@link ExecutableToolSuccessResult.stopTurn}. */
|
|
1674
1699
|
readonly stopTurn?: boolean | undefined;
|
|
1700
|
+
/** See {@link ExecutableToolSuccessResult.truncated}. */
|
|
1701
|
+
readonly truncated?: boolean | undefined;
|
|
1675
1702
|
}
|
|
1676
1703
|
|
|
1677
1704
|
declare type ExecutableToolOutput = string | ContentPart[];
|
|
@@ -1695,6 +1722,12 @@ declare interface ExecutableToolSuccessResult {
|
|
|
1695
1722
|
* this to the user.
|
|
1696
1723
|
*/
|
|
1697
1724
|
readonly message?: string | undefined;
|
|
1725
|
+
/**
|
|
1726
|
+
* True when the tool has already returned a partial result because it
|
|
1727
|
+
* truncated, paged, or otherwise dropped original output. Later generic
|
|
1728
|
+
* budgeting must not treat the visible output as complete source text.
|
|
1729
|
+
*/
|
|
1730
|
+
readonly truncated?: boolean | undefined;
|
|
1698
1731
|
}
|
|
1699
1732
|
|
|
1700
1733
|
export declare interface ExperimentalFeatureState {
|
|
@@ -2806,7 +2839,7 @@ export declare const KIMI_ERROR_INFO: {
|
|
|
2806
2839
|
readonly title: "Turn exceeded max steps";
|
|
2807
2840
|
readonly retryable: false;
|
|
2808
2841
|
readonly public: true;
|
|
2809
|
-
readonly action: "Increase loop_control.max_steps_per_turn or split the task.";
|
|
2842
|
+
readonly action: "Increase loop_control.max_steps_per_turn in config.toml or split the task.";
|
|
2810
2843
|
};
|
|
2811
2844
|
readonly 'provider.api_error': {
|
|
2812
2845
|
readonly title: "Provider API error";
|
|
@@ -3337,6 +3370,7 @@ declare class KimiCore implements PromisableMethods<CoreAPI> {
|
|
|
3337
3370
|
resumeSessionWithOverrides(input: ResumeSessionPayload, overrides: {
|
|
3338
3371
|
kaos?: Kaos;
|
|
3339
3372
|
persistenceKaos?: Kaos;
|
|
3373
|
+
forcePluginSessionStartReminder?: boolean;
|
|
3340
3374
|
}): Promise<ResumeSessionResult>;
|
|
3341
3375
|
reloadSession(input: ReloadSessionPayload): Promise<ResumeSessionResult>;
|
|
3342
3376
|
forkSession(input: ForkSessionPayload): Promise<ResumeSessionResult>;
|
|
@@ -3348,6 +3382,8 @@ declare class KimiCore implements PromisableMethods<CoreAPI> {
|
|
|
3348
3382
|
setKimiConfig(input: SetKimiConfigPayload): Promise<KimiConfig>;
|
|
3349
3383
|
removeKimiProvider(input: RemoveKimiProviderPayload): Promise<KimiConfig>;
|
|
3350
3384
|
prompt({ sessionId, ...payload }: SessionAgentPayload<PromptPayload>): Promise<void>;
|
|
3385
|
+
runShellCommand({ sessionId, ...payload }: SessionAgentPayload<RunShellCommandPayload>): Promise<ShellCommandResult>;
|
|
3386
|
+
cancelShellCommand({ sessionId, ...payload }: SessionAgentPayload<CancelShellCommandPayload>): Promise<void>;
|
|
3351
3387
|
steer({ sessionId, ...payload }: SessionAgentPayload<SteerPayload>): Promise<void>;
|
|
3352
3388
|
cancel({ sessionId, ...payload }: SessionAgentPayload<CancelPayload>): Promise<void>;
|
|
3353
3389
|
undoHistory({ sessionId, ...payload }: SessionAgentPayload<UndoHistoryPayload>): Promise<void>;
|
|
@@ -3385,6 +3421,7 @@ declare class KimiCore implements PromisableMethods<CoreAPI> {
|
|
|
3385
3421
|
getMcpStartupMetrics({ sessionId, ...payload }: SessionScopedPayload<EmptyPayload>): Promise<McpStartupMetrics>;
|
|
3386
3422
|
reconnectMcpServer({ sessionId, ...payload }: SessionScopedPayload<ReconnectMcpServerPayload>): Promise<void>;
|
|
3387
3423
|
generateAgentsMd({ sessionId, ...payload }: SessionScopedPayload<EmptyPayload>): Promise<void>;
|
|
3424
|
+
getSessionWarnings({ sessionId, ...payload }: SessionScopedPayload<EmptyPayload>): Promise<readonly SessionWarning[]>;
|
|
3388
3425
|
addAdditionalDir({ sessionId, ...payload }: SessionScopedPayload<AddAdditionalDirPayload>): Promise<AddAdditionalDirResult_2>;
|
|
3389
3426
|
startBtw({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): Promise<string>;
|
|
3390
3427
|
createGoal({ sessionId, ...payload }: SessionAgentPayload<CreateGoalPayload>): Promise<GoalSnapshot>;
|
|
@@ -3525,7 +3562,7 @@ export declare class KimiHarness {
|
|
|
3525
3562
|
setTelemetryContext(patch: TelemetryContextPatch): void;
|
|
3526
3563
|
createSession(options: CreateSessionOptions): Promise<Session>;
|
|
3527
3564
|
resumeSession(input: ResumeSessionInput): Promise<Session>;
|
|
3528
|
-
reloadSession(input:
|
|
3565
|
+
reloadSession(input: ReloadSessionInput): Promise<Session>;
|
|
3529
3566
|
forkSession(input: ForkSessionInput): Promise<Session>;
|
|
3530
3567
|
getSession(id: string): Session | undefined;
|
|
3531
3568
|
closeSession(id: string): Promise<void>;
|
|
@@ -3974,6 +4011,7 @@ declare class McpConnectionManager {
|
|
|
3974
4011
|
|
|
3975
4012
|
declare interface McpConnectionManagerOptions {
|
|
3976
4013
|
readonly envLookup?: (name: string) => string | undefined;
|
|
4014
|
+
readonly stdioCwd?: string;
|
|
3977
4015
|
/**
|
|
3978
4016
|
* Optional OAuth orchestrator. When provided, remote servers without a
|
|
3979
4017
|
* static bearer token participate in the OAuth-via-synthetic-tool flow:
|
|
@@ -4687,7 +4725,10 @@ export declare interface PluginSummary {
|
|
|
4687
4725
|
readonly github?: PluginGithubMetadata;
|
|
4688
4726
|
}
|
|
4689
4727
|
|
|
4690
|
-
declare
|
|
4728
|
+
declare interface PreparedSystemPromptContext extends Pick<SystemPromptContext, 'cwdListing' | 'agentsMd' | 'additionalDirsInfo'> {
|
|
4729
|
+
/** Present when the combined AGENTS.md content exceeds the recommended size. */
|
|
4730
|
+
readonly agentsMdWarning?: string;
|
|
4731
|
+
}
|
|
4691
4732
|
|
|
4692
4733
|
declare interface PrepareToolExecutionResult extends AuthorizeToolExecutionResult {
|
|
4693
4734
|
readonly updatedArgs?: unknown;
|
|
@@ -4714,7 +4755,7 @@ declare type Promisify<T> = [T] extends [Promise<any>] ? T : Promise<T>;
|
|
|
4714
4755
|
|
|
4715
4756
|
export declare type PromptInput = readonly PromptPart[];
|
|
4716
4757
|
|
|
4717
|
-
export declare type PromptOrigin = UserPromptOrigin | SkillActivationOrigin | InjectionOrigin | CompactionSummaryOrigin | SystemTriggerOrigin | BackgroundTaskOrigin | CronJobOrigin | CronMissedOrigin | HookResultOrigin | RetryOrigin;
|
|
4758
|
+
export declare type PromptOrigin = UserPromptOrigin | SkillActivationOrigin | InjectionOrigin | ShellCommandOrigin | CompactionSummaryOrigin | SystemTriggerOrigin | BackgroundTaskOrigin | CronJobOrigin | CronMissedOrigin | HookResultOrigin | RetryOrigin;
|
|
4718
4759
|
|
|
4719
4760
|
export declare type PromptPart = Extract<ContentPart, {
|
|
4720
4761
|
type: 'text' | 'image_url' | 'video_url';
|
|
@@ -4865,6 +4906,12 @@ declare interface RegisterBackgroundTaskOptions {
|
|
|
4865
4906
|
readonly detached?: boolean;
|
|
4866
4907
|
/** Deadline owned by BackgroundManager. `0` and `undefined` do not arm a timer. */
|
|
4867
4908
|
readonly timeoutMs?: number;
|
|
4909
|
+
/**
|
|
4910
|
+
* When set, detaching a foreground task resets its deadline to this value
|
|
4911
|
+
* (counted from the detach moment). Lets a command started with a short
|
|
4912
|
+
* foreground timeout run longer once it is moved to the background.
|
|
4913
|
+
*/
|
|
4914
|
+
readonly detachTimeoutMs?: number;
|
|
4868
4915
|
/** Foreground caller signal. Ignored for tasks created already detached. */
|
|
4869
4916
|
readonly signal?: AbortSignal;
|
|
4870
4917
|
}
|
|
@@ -4877,8 +4924,27 @@ declare interface RegisterToolPayload {
|
|
|
4877
4924
|
|
|
4878
4925
|
declare type ReloadPluginsResult = ReloadSummary;
|
|
4879
4926
|
|
|
4927
|
+
export declare interface ReloadSessionInput extends ResumeSessionInput {
|
|
4928
|
+
readonly forcePluginSessionStartReminder?: boolean;
|
|
4929
|
+
}
|
|
4930
|
+
|
|
4931
|
+
export declare interface ReloadSessionOptions {
|
|
4932
|
+
readonly forcePluginSessionStartReminder?: boolean;
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4880
4935
|
declare interface ReloadSessionPayload {
|
|
4881
4936
|
readonly sessionId: string;
|
|
4937
|
+
/**
|
|
4938
|
+
* When true, append a fresh `<plugin_session_start>` system reminder to the
|
|
4939
|
+
* main agent after the session is reloaded, reflecting the currently enabled
|
|
4940
|
+
* plugins. Used by the explicit `/reload` command so the model sees plugin
|
|
4941
|
+
* changes without starting a new session. Defaults to false.
|
|
4942
|
+
*/
|
|
4943
|
+
readonly forcePluginSessionStartReminder?: boolean;
|
|
4944
|
+
}
|
|
4945
|
+
|
|
4946
|
+
declare interface ReloadSessionRpcInput extends SessionIdRpcInput {
|
|
4947
|
+
readonly forcePluginSessionStartReminder?: boolean;
|
|
4882
4948
|
}
|
|
4883
4949
|
|
|
4884
4950
|
export declare interface ReloadSummary {
|
|
@@ -5060,6 +5126,16 @@ declare interface RunnableToolExecution {
|
|
|
5060
5126
|
readonly execute: (ctx: ExecutableToolContext) => Promise<ExecutableToolResult>;
|
|
5061
5127
|
}
|
|
5062
5128
|
|
|
5129
|
+
declare interface RunShellCommandPayload {
|
|
5130
|
+
readonly command: string;
|
|
5131
|
+
/**
|
|
5132
|
+
* TUI-generated correlation id echoed back on every `shell.output` live event
|
|
5133
|
+
* so the client can route chunks to the matching entry and drop stale events
|
|
5134
|
+
* from a prior run. Optional for callers that don't stream.
|
|
5135
|
+
*/
|
|
5136
|
+
readonly commandId?: string;
|
|
5137
|
+
}
|
|
5138
|
+
|
|
5063
5139
|
declare interface RunSubagentOptions {
|
|
5064
5140
|
readonly parentToolCallId: string;
|
|
5065
5141
|
readonly parentToolCallUuid?: string;
|
|
@@ -5130,7 +5206,7 @@ export declare abstract class SDKRpcClientBase {
|
|
|
5130
5206
|
createSessionWithKaos(input: CreateSessionOptions, kaos: Kaos, persistenceKaos?: Kaos): Promise<SessionSummary>;
|
|
5131
5207
|
resumeSession(input: ResumeSessionInput): Promise<ResumedSessionSummary>;
|
|
5132
5208
|
resumeSessionWithKaos(input: ResumeSessionInput, kaos: Kaos, persistenceKaos?: Kaos): Promise<ResumedSessionSummary>;
|
|
5133
|
-
reloadSession(input:
|
|
5209
|
+
reloadSession(input: ReloadSessionRpcInput): Promise<ResumedSessionSummary>;
|
|
5134
5210
|
forkSession(input: ForkSessionInput): Promise<SessionSummary>;
|
|
5135
5211
|
closeSession(input: SessionIdRpcInput): Promise<void>;
|
|
5136
5212
|
listSessions(input?: ListSessionsOptions): Promise<readonly SessionSummary[]>;
|
|
@@ -5142,8 +5218,27 @@ export declare abstract class SDKRpcClientBase {
|
|
|
5142
5218
|
setConfig(input: KimiConfigPatch): Promise<KimiConfig>;
|
|
5143
5219
|
removeProvider(providerId: string): Promise<KimiConfig>;
|
|
5144
5220
|
prompt(input: SessionPromptRpcInput): Promise<void>;
|
|
5221
|
+
runShellCommand(input: {
|
|
5222
|
+
sessionId: string;
|
|
5223
|
+
command: string;
|
|
5224
|
+
commandId?: string;
|
|
5225
|
+
}): Promise<{
|
|
5226
|
+
stdout: string;
|
|
5227
|
+
stderr: string;
|
|
5228
|
+
isError?: boolean;
|
|
5229
|
+
backgrounded?: boolean;
|
|
5230
|
+
}>;
|
|
5231
|
+
cancelShellCommand(input: {
|
|
5232
|
+
sessionId: string;
|
|
5233
|
+
commandId: string;
|
|
5234
|
+
}): Promise<void>;
|
|
5145
5235
|
steer(input: SessionPromptRpcInput): Promise<void>;
|
|
5146
5236
|
generateAgentsMd(input: SessionIdRpcInput): Promise<void>;
|
|
5237
|
+
getSessionWarnings(input: SessionIdRpcInput): Promise<readonly {
|
|
5238
|
+
code: string;
|
|
5239
|
+
message: string;
|
|
5240
|
+
severity: "error" | "info" | "warning";
|
|
5241
|
+
}[]>;
|
|
5147
5242
|
addAdditionalDir(input: AddAdditionalDirInput): Promise<AddAdditionalDirResult>;
|
|
5148
5243
|
startBtw(input: SessionIdRpcInput): Promise<string>;
|
|
5149
5244
|
cancel(input: SessionIdRpcInput): Promise<void>;
|
|
@@ -5268,14 +5363,32 @@ export declare class Session {
|
|
|
5268
5363
|
private closed;
|
|
5269
5364
|
constructor(options: SessionOptions);
|
|
5270
5365
|
getResumeState(): ResumedSessionState | undefined;
|
|
5271
|
-
reloadSession(): Promise<ResumedSessionSummary>;
|
|
5366
|
+
reloadSession(options?: ReloadSessionOptions): Promise<ResumedSessionSummary>;
|
|
5272
5367
|
onEvent(listener: (event: Event_2) => void): Unsubscribe;
|
|
5273
5368
|
setApprovalHandler(handler: ApprovalHandler | undefined): void;
|
|
5274
5369
|
setQuestionHandler(handler: QuestionHandler | undefined): void;
|
|
5275
5370
|
prompt(input: string | PromptInput): Promise<void>;
|
|
5371
|
+
/** Execute a user-initiated `!` shell command (silent — does not prompt the
|
|
5372
|
+
* model). Resolves with the command's stdout/stderr for immediate display.
|
|
5373
|
+
* Pass `commandId` to receive live `shell.output` events for this command. */
|
|
5374
|
+
runShellCommand(command: string, options?: {
|
|
5375
|
+
commandId?: string;
|
|
5376
|
+
}): Promise<{
|
|
5377
|
+
stdout: string;
|
|
5378
|
+
stderr: string;
|
|
5379
|
+
isError?: boolean;
|
|
5380
|
+
backgrounded?: boolean;
|
|
5381
|
+
}>;
|
|
5382
|
+
/** Cancel a running `!` shell command by its commandId (e.g. on Esc / Ctrl+C). */
|
|
5383
|
+
cancelShellCommand(commandId: string): Promise<void>;
|
|
5276
5384
|
steer(input: string | PromptInput): Promise<void>;
|
|
5277
5385
|
swarm(input: string | PromptInput): Promise<void>;
|
|
5278
5386
|
init(): Promise<void>;
|
|
5387
|
+
getSessionWarnings(): Promise<readonly {
|
|
5388
|
+
code: string;
|
|
5389
|
+
message: string;
|
|
5390
|
+
severity: "error" | "info" | "warning";
|
|
5391
|
+
}[]>;
|
|
5279
5392
|
addAdditionalDir(path: string, options?: AddAdditionalDirOptions): Promise<AddAdditionalDirResult>;
|
|
5280
5393
|
startBtw(): Promise<string>;
|
|
5281
5394
|
cancel(): Promise<void>;
|
|
@@ -5371,6 +5484,7 @@ declare class Session_2 {
|
|
|
5371
5484
|
private readonly skillsReady;
|
|
5372
5485
|
metadata: SessionMeta;
|
|
5373
5486
|
private writeMetadataPromise;
|
|
5487
|
+
private agentsMdWarning;
|
|
5374
5488
|
constructor(options: SessionOptions_2);
|
|
5375
5489
|
setToolKaos(kaos: Kaos): void;
|
|
5376
5490
|
getAdditionalDirs(): readonly string[];
|
|
@@ -5408,7 +5522,24 @@ declare class Session_2 {
|
|
|
5408
5522
|
* through here so the two paths cannot drift apart.
|
|
5409
5523
|
*/
|
|
5410
5524
|
private bootstrapAgentProfile;
|
|
5525
|
+
getSessionWarnings(): Promise<readonly SessionWarning[]>;
|
|
5526
|
+
private computeAgentsMdWarning;
|
|
5411
5527
|
generateAgentsMd(): Promise<void>;
|
|
5528
|
+
/**
|
|
5529
|
+
* Appends a fresh `<plugin_session_start>` system reminder to the main agent
|
|
5530
|
+
* using the currently enabled plugins, then flushes records so the reminder is
|
|
5531
|
+
* persisted and visible on the wire. Used by the explicit `/reload` flow after
|
|
5532
|
+
* the session has been re-resumed with reloaded plugin state.
|
|
5533
|
+
*
|
|
5534
|
+
* When no plugin session start is currently resolvable but an earlier
|
|
5535
|
+
* When no plugin session start is currently resolvable but the context may still
|
|
5536
|
+
* carry stale plugin guidance — either an earlier `<plugin_session_start>`
|
|
5537
|
+
* reminder, or a compaction summary that may have folded one in — appends a
|
|
5538
|
+
* neutralizing reminder instead, so the model does not keep following stale
|
|
5539
|
+
* plugin instructions and the turn-loop injector does not dedup against them.
|
|
5540
|
+
*/
|
|
5541
|
+
appendPluginSessionStartReminder(): Promise<void>;
|
|
5542
|
+
private shouldNeutralizePluginSessionStart;
|
|
5412
5543
|
get hasActiveTurn(): boolean;
|
|
5413
5544
|
protected get metadataPath(): string;
|
|
5414
5545
|
writeMetadata(): Promise<void>;
|
|
@@ -5444,6 +5575,7 @@ declare interface SessionAPI extends AgentAPIWithId {
|
|
|
5444
5575
|
getMcpStartupMetrics: (payload: EmptyPayload) => McpStartupMetrics;
|
|
5445
5576
|
reconnectMcpServer: (payload: ReconnectMcpServerPayload) => void;
|
|
5446
5577
|
generateAgentsMd: (payload: EmptyPayload) => void;
|
|
5578
|
+
getSessionWarnings: (payload: EmptyPayload) => readonly SessionWarning[];
|
|
5447
5579
|
addAdditionalDir: (payload: AddAdditionalDirPayload) => AddAdditionalDirResult_2;
|
|
5448
5580
|
}
|
|
5449
5581
|
|
|
@@ -5751,6 +5883,26 @@ declare interface SetThinkingPayload {
|
|
|
5751
5883
|
readonly level: string;
|
|
5752
5884
|
}
|
|
5753
5885
|
|
|
5886
|
+
declare interface ShellCommandOrigin {
|
|
5887
|
+
readonly kind: 'shell_command';
|
|
5888
|
+
readonly phase: 'input' | 'output';
|
|
5889
|
+
/** Only present on `phase: 'output'` — whether the command failed, so replay
|
|
5890
|
+
* can colour stderr red only for actual failures (not warnings). */
|
|
5891
|
+
readonly isError?: boolean;
|
|
5892
|
+
}
|
|
5893
|
+
|
|
5894
|
+
declare interface ShellCommandResult {
|
|
5895
|
+
readonly stdout: string;
|
|
5896
|
+
readonly stderr: string;
|
|
5897
|
+
/** True when the command failed (non-zero exit / timeout / killed) — used by
|
|
5898
|
+
* the TUI to render stderr in red only for actual failures, not warnings. */
|
|
5899
|
+
readonly isError?: boolean;
|
|
5900
|
+
/** True when the command was detached to the background (ctrl+b) instead of
|
|
5901
|
+
* completing in the foreground. The TUI uses this to skip the normal final
|
|
5902
|
+
* render (the backgrounding path owns the UI + model notification). */
|
|
5903
|
+
readonly backgrounded?: boolean;
|
|
5904
|
+
}
|
|
5905
|
+
|
|
5754
5906
|
export declare interface ShellEnvironment {
|
|
5755
5907
|
readonly term?: string | undefined;
|
|
5756
5908
|
readonly termProgram?: string | undefined;
|
|
@@ -6250,10 +6402,26 @@ declare class ToolManager {
|
|
|
6250
6402
|
private mcpAccessPatterns;
|
|
6251
6403
|
protected readonly store: Partial<ToolStoreData>;
|
|
6252
6404
|
private mcpToolStatusUnsubscribe;
|
|
6405
|
+
/** Abort controllers for in-flight `!` shell commands, keyed by commandId so
|
|
6406
|
+
* the TUI can cancel (Esc / Ctrl+C) a running command. */
|
|
6407
|
+
private readonly shellCommandControllers;
|
|
6253
6408
|
constructor(agent: Agent);
|
|
6254
6409
|
protected get toolStore(): ToolStore;
|
|
6255
6410
|
attachMcpTools(): void;
|
|
6256
6411
|
updateStore<K extends ToolStoreKey>(key: K, value: ToolStoreData[K]): void;
|
|
6412
|
+
/**
|
|
6413
|
+
* Execute a user-initiated `!` shell command. Reuses the builtin Bash tool
|
|
6414
|
+
* (same kaos / cwd / BackgroundManager as the agent), recording the command
|
|
6415
|
+
* and its output as `shell_command`-origin messages. It does NOT start a turn
|
|
6416
|
+
* — the model is not prompted (parity with claude-code's `shouldQuery: false`).
|
|
6417
|
+
*/
|
|
6418
|
+
runShellCommand(command: string, commandId?: string): Promise<{
|
|
6419
|
+
stdout: string;
|
|
6420
|
+
stderr: string;
|
|
6421
|
+
isError?: boolean;
|
|
6422
|
+
backgrounded?: boolean;
|
|
6423
|
+
}>;
|
|
6424
|
+
cancelShellCommand(commandId: string): void;
|
|
6257
6425
|
registerUserTool(input: UserToolRegistration): void;
|
|
6258
6426
|
unregisterUserTool(name: string): void;
|
|
6259
6427
|
inheritUserTools(parent: ToolManager): void;
|