@kilocode/sdk 7.2.5 → 7.2.7

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.
@@ -0,0 +1,3 @@
1
+ import { type ChildProcess } from "node:child_process";
2
+ export declare function stop(proc: ChildProcess): void;
3
+ export declare function bindAbort(proc: ChildProcess, signal?: AbortSignal, onAbort?: () => void): () => void;
@@ -0,0 +1,33 @@
1
+ import { spawnSync } from "node:child_process";
2
+ // Duplicated from `packages/opencode/src/util/process.ts` because the SDK cannot
3
+ // import `opencode` without creating a cycle (`opencode` depends on `@kilocode/sdk`).
4
+ export function stop(proc) {
5
+ if (proc.exitCode !== null || proc.signalCode !== null)
6
+ return;
7
+ if (process.platform === "win32" && proc.pid) {
8
+ const out = spawnSync("taskkill", ["/pid", String(proc.pid), "/T", "/F"], { windowsHide: true });
9
+ if (!out.error && out.status === 0)
10
+ return;
11
+ }
12
+ proc.kill();
13
+ }
14
+ export function bindAbort(proc, signal, onAbort) {
15
+ if (!signal)
16
+ return () => { };
17
+ const abort = () => {
18
+ clear();
19
+ stop(proc);
20
+ onAbort?.();
21
+ };
22
+ const clear = () => {
23
+ signal.removeEventListener("abort", abort);
24
+ proc.off("exit", clear);
25
+ proc.off("error", clear);
26
+ };
27
+ signal.addEventListener("abort", abort, { once: true });
28
+ proc.on("exit", clear);
29
+ proc.on("error", clear);
30
+ if (signal.aborted)
31
+ abort();
32
+ return clear;
33
+ }
package/dist/server.js CHANGED
@@ -1,4 +1,5 @@
1
- import { spawn } from "node:child_process";
1
+ import launch from "cross-spawn";
2
+ import { stop, bindAbort } from "./process.js";
2
3
  // kilocode_change start - Merge existing KILO_CONFIG_CONTENT with new config
3
4
  // This preserves Kilocode-injected modes when spawning nested CLI instances
4
5
  function mergeConfig(existing, incoming) {
@@ -39,22 +40,25 @@ export async function createKiloServer(options) {
39
40
  const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
40
41
  if (options.config?.logLevel)
41
42
  args.push(`--log-level=${options.config.logLevel}`);
42
- // kilocode_change start
43
- const proc = spawn(`kilo`, args, {
44
- // kilocode_change end
45
- signal: options.signal,
46
- windowsHide: true,
43
+ const proc = launch(`kilo`, args, {
44
+ // kilocode_change
47
45
  env: {
48
46
  ...process.env,
49
47
  KILO_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
50
48
  },
51
49
  });
50
+ let clear = () => { };
52
51
  const url = await new Promise((resolve, reject) => {
53
52
  const id = setTimeout(() => {
53
+ clear();
54
+ stop(proc);
54
55
  reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
55
56
  }, options.timeout);
56
57
  let output = "";
58
+ let resolved = false;
57
59
  proc.stdout?.on("data", (chunk) => {
60
+ if (resolved)
61
+ return;
58
62
  output += chunk.toString();
59
63
  const lines = output.split("\n");
60
64
  for (const line of lines) {
@@ -63,9 +67,14 @@ export async function createKiloServer(options) {
63
67
  // kilocode_change end
64
68
  const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
65
69
  if (!match) {
66
- throw new Error(`Failed to parse server url from output: ${line}`);
70
+ clear();
71
+ stop(proc);
72
+ clearTimeout(id);
73
+ reject(new Error(`Failed to parse server url from output: ${line}`));
74
+ return;
67
75
  }
68
76
  clearTimeout(id);
77
+ resolved = true;
69
78
  resolve(match[1]);
70
79
  return;
71
80
  }
@@ -86,17 +95,16 @@ export async function createKiloServer(options) {
86
95
  clearTimeout(id);
87
96
  reject(error);
88
97
  });
89
- if (options.signal) {
90
- options.signal.addEventListener("abort", () => {
91
- clearTimeout(id);
92
- reject(new Error("Aborted"));
93
- });
94
- }
98
+ clear = bindAbort(proc, options.signal, () => {
99
+ clearTimeout(id);
100
+ reject(options.signal?.reason);
101
+ });
95
102
  });
96
103
  return {
97
104
  url,
98
105
  close() {
99
- proc.kill();
106
+ clear();
107
+ stop(proc);
100
108
  },
101
109
  };
102
110
  }
@@ -114,10 +122,8 @@ export function createKiloTui(options) {
114
122
  if (options?.agent) {
115
123
  args.push(`--agent=${options.agent}`);
116
124
  }
117
- // kilocode_change start
118
- const proc = spawn(`kilo`, args, {
119
- // kilocode_change end
120
- signal: options?.signal,
125
+ const proc = launch(`kilo`, args, {
126
+ // kilocode_change
121
127
  stdio: "inherit",
122
128
  windowsHide: true,
123
129
  env: {
@@ -125,9 +131,11 @@ export function createKiloTui(options) {
125
131
  KILO_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
126
132
  },
127
133
  });
134
+ const clear = bindAbort(proc, options?.signal);
128
135
  return {
129
136
  close() {
130
- proc.kill();
137
+ clear();
138
+ stop(proc);
131
139
  },
132
140
  };
133
141
  }
package/dist/v2/client.js CHANGED
@@ -75,5 +75,6 @@ export function createKiloClient(config) {
75
75
  directory: config?.directory,
76
76
  workspace: config?.experimental_workspaceID,
77
77
  }));
78
- return new KiloClient({ client });
78
+ const result = new KiloClient({ client });
79
+ return result;
79
80
  }
@@ -0,0 +1,9 @@
1
+ import type { Part, UserMessage } from "./client.js";
2
+ export declare const message: {
3
+ user(input: Omit<UserMessage, "role" | "time" | "id"> & {
4
+ parts: Omit<Part, "id" | "sessionID" | "messageID">[];
5
+ }): {
6
+ info: UserMessage;
7
+ parts: Part[];
8
+ };
9
+ };
@@ -0,0 +1,22 @@
1
+ export const message = {
2
+ user(input) {
3
+ const { parts, ...rest } = input;
4
+ const info = {
5
+ ...rest,
6
+ id: "asdasd",
7
+ time: {
8
+ created: Date.now(),
9
+ },
10
+ role: "user",
11
+ };
12
+ return {
13
+ info,
14
+ parts: input.parts.map((part) => ({
15
+ ...part,
16
+ id: "asdasd",
17
+ messageID: info.id,
18
+ sessionID: info.sessionID,
19
+ })),
20
+ };
21
+ },
22
+ };
@@ -1,5 +1,5 @@
1
1
  import { type Client, type Options as Options2, type TDataShape } from "./client/index.js";
2
- import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, AppSkillsResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, CommandListResponses, CommitMessageGenerateErrors, CommitMessageGenerateResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, ConfigWarningsResponses, EnhancePromptEnhanceErrors, EnhancePromptEnhanceResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, ExperimentalSessionListResponses, ExperimentalWorkspaceCreateErrors, ExperimentalWorkspaceCreateResponses, ExperimentalWorkspaceListResponses, ExperimentalWorkspaceRemoveErrors, ExperimentalWorkspaceRemoveResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, GlobalSyncEventSubscribeResponses, GlobalUpgradeErrors, GlobalUpgradeResponses, InstanceDisposeResponses, KiloClawChatCredentialsResponses, KiloClawStatusResponses, KiloCloudSessionGetErrors, KiloCloudSessionGetResponses, KiloCloudSessionImportErrors, KiloCloudSessionImportResponses, KiloCloudSessionsErrors, KiloCloudSessionsResponses, KilocodeRemoveAgentErrors, KilocodeRemoveAgentResponses, KilocodeRemoveSkillErrors, KilocodeRemoveSkillResponses, KilocodeSessionImportMessageErrors, KilocodeSessionImportMessageResponses, KilocodeSessionImportPartErrors, KilocodeSessionImportPartResponses, KilocodeSessionImportProjectErrors, KilocodeSessionImportProjectResponses, KilocodeSessionImportSessionErrors, KilocodeSessionImportSessionResponses, KiloFimErrors, KiloFimResponses, KiloModesResponses, KiloNotificationsErrors, KiloNotificationsResponses, KiloOrganizationSetErrors, KiloOrganizationSetResponses, KiloProfileErrors, KiloProfileResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, NetworkListResponses, NetworkRejectErrors, NetworkRejectResponses, NetworkReplyErrors, NetworkReplyResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionAllowEverythingErrors, PermissionAllowEverythingResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, PermissionSaveAlwaysRulesErrors, PermissionSaveAlwaysRulesResponses, ProjectCurrentResponses, ProjectInitGitResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, RemoteDisableResponses, RemoteEnableResponses, RemoteStatusResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteMessageErrors, SessionDeleteMessageResponses, SessionDeleteResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SessionViewedResponses, SubtaskPartInput, TelemetryCaptureErrors, TelemetryCaptureResponses, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeDiffErrors, WorktreeDiffFileErrors, WorktreeDiffFileResponses, WorktreeDiffResponses, WorktreeDiffSummaryErrors, WorktreeDiffSummaryResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
2
+ import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, AppSkillsResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, CommandListResponses, CommitMessageGenerateErrors, CommitMessageGenerateResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, ConfigWarningsResponses, EnhancePromptEnhanceErrors, EnhancePromptEnhanceResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalConsoleGetResponses, ExperimentalConsoleListOrgsResponses, ExperimentalConsoleSwitchOrgResponses, ExperimentalResourceListResponses, ExperimentalSessionListResponses, ExperimentalWorkspaceCreateErrors, ExperimentalWorkspaceCreateResponses, ExperimentalWorkspaceListResponses, ExperimentalWorkspaceRemoveErrors, ExperimentalWorkspaceRemoveResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, GlobalSyncEventSubscribeResponses, GlobalUpgradeErrors, GlobalUpgradeResponses, InstanceDisposeResponses, KiloClawChatCredentialsResponses, KiloClawStatusResponses, KiloCloudSessionGetErrors, KiloCloudSessionGetResponses, KiloCloudSessionImportErrors, KiloCloudSessionImportResponses, KiloCloudSessionsErrors, KiloCloudSessionsResponses, KilocodeRemoveAgentErrors, KilocodeRemoveAgentResponses, KilocodeRemoveSkillErrors, KilocodeRemoveSkillResponses, KilocodeSessionImportMessageErrors, KilocodeSessionImportMessageResponses, KilocodeSessionImportPartErrors, KilocodeSessionImportPartResponses, KilocodeSessionImportProjectErrors, KilocodeSessionImportProjectResponses, KilocodeSessionImportSessionErrors, KilocodeSessionImportSessionResponses, KiloFimErrors, KiloFimResponses, KiloModesResponses, KiloNotificationsErrors, KiloNotificationsResponses, KiloOrganizationSetErrors, KiloOrganizationSetResponses, KiloProfileErrors, KiloProfileResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, NetworkListResponses, NetworkRejectErrors, NetworkRejectResponses, NetworkReplyErrors, NetworkReplyResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionAllowEverythingErrors, PermissionAllowEverythingResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, PermissionSaveAlwaysRulesErrors, PermissionSaveAlwaysRulesResponses, ProjectCurrentResponses, ProjectInitGitResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, RemoteDisableResponses, RemoteEnableResponses, RemoteStatusResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteMessageErrors, SessionDeleteMessageResponses, SessionDeleteResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SessionViewedResponses, SubtaskPartInput, TelemetryCaptureErrors, TelemetryCaptureResponses, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsDiffResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeDiffErrors, WorktreeDiffFileErrors, WorktreeDiffFileResponses, WorktreeDiffResponses, WorktreeDiffSummaryErrors, WorktreeDiffSummaryResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -297,27 +297,36 @@ export declare class Config2 extends HeyApiClient {
297
297
  workspace?: string;
298
298
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ConfigProvidersResponses, unknown, ThrowOnError, "fields">;
299
299
  }
300
- export declare class Tool extends HeyApiClient {
300
+ export declare class Console extends HeyApiClient {
301
301
  /**
302
- * List tool IDs
302
+ * Get active Console provider metadata
303
303
  *
304
- * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
304
+ * Get the active Console org name and the set of provider IDs managed by that Console org.
305
305
  */
306
- ids<ThrowOnError extends boolean = false>(parameters?: {
306
+ get<ThrowOnError extends boolean = false>(parameters?: {
307
307
  directory?: string;
308
308
  workspace?: string;
309
- }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ToolIdsResponses, ToolIdsErrors, ThrowOnError, "fields">;
309
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalConsoleGetResponses, unknown, ThrowOnError, "fields">;
310
310
  /**
311
- * List tools
311
+ * List switchable Console orgs
312
312
  *
313
- * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
313
+ * Get the available Console orgs across logged-in accounts, including the current active org.
314
314
  */
315
- list<ThrowOnError extends boolean = false>(parameters: {
315
+ listOrgs<ThrowOnError extends boolean = false>(parameters?: {
316
316
  directory?: string;
317
317
  workspace?: string;
318
- provider: string;
319
- model: string;
320
- }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ToolListResponses, ToolListErrors, ThrowOnError, "fields">;
318
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalConsoleListOrgsResponses, unknown, ThrowOnError, "fields">;
319
+ /**
320
+ * Switch active Console org
321
+ *
322
+ * Persist a new active Console account/org selection for the current local Kilo state.
323
+ */
324
+ switchOrg<ThrowOnError extends boolean = false>(parameters?: {
325
+ directory?: string;
326
+ workspace?: string;
327
+ accountID?: string;
328
+ orgID?: string;
329
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalConsoleSwitchOrgResponses, unknown, ThrowOnError, "fields">;
321
330
  }
322
331
  export declare class Workspace extends HeyApiClient {
323
332
  /**
@@ -384,6 +393,8 @@ export declare class Resource extends HeyApiClient {
384
393
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalResourceListResponses, unknown, ThrowOnError, "fields">;
385
394
  }
386
395
  export declare class Experimental extends HeyApiClient {
396
+ private _console?;
397
+ get console(): Console;
387
398
  private _workspace?;
388
399
  get workspace(): Workspace;
389
400
  private _session?;
@@ -391,6 +402,28 @@ export declare class Experimental extends HeyApiClient {
391
402
  private _resource?;
392
403
  get resource(): Resource;
393
404
  }
405
+ export declare class Tool extends HeyApiClient {
406
+ /**
407
+ * List tool IDs
408
+ *
409
+ * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
410
+ */
411
+ ids<ThrowOnError extends boolean = false>(parameters?: {
412
+ directory?: string;
413
+ workspace?: string;
414
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ToolIdsResponses, ToolIdsErrors, ThrowOnError, "fields">;
415
+ /**
416
+ * List tools
417
+ *
418
+ * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
419
+ */
420
+ list<ThrowOnError extends boolean = false>(parameters: {
421
+ directory?: string;
422
+ workspace?: string;
423
+ provider: string;
424
+ model: string;
425
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ToolListResponses, ToolListErrors, ThrowOnError, "fields">;
426
+ }
394
427
  export declare class Worktree extends HeyApiClient {
395
428
  /**
396
429
  * Remove worktree
@@ -759,6 +792,7 @@ export declare class Session2 extends HeyApiClient {
759
792
  sessionID: string;
760
793
  directory?: string;
761
794
  workspace?: string;
795
+ messageID?: string;
762
796
  agent?: string;
763
797
  model?: {
764
798
  providerID: string;
@@ -1290,6 +1324,16 @@ export declare class Vcs extends HeyApiClient {
1290
1324
  directory?: string;
1291
1325
  workspace?: string;
1292
1326
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<VcsGetResponses, unknown, ThrowOnError, "fields">;
1327
+ /**
1328
+ * Get VCS diff
1329
+ *
1330
+ * Retrieve the current git diff for the working tree or against the default branch.
1331
+ */
1332
+ diff<ThrowOnError extends boolean = false>(parameters: {
1333
+ directory?: string;
1334
+ workspace?: string;
1335
+ mode: "git" | "branch";
1336
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<VcsDiffResponses, unknown, ThrowOnError, "fields">;
1293
1337
  }
1294
1338
  export declare class Command extends HeyApiClient {
1295
1339
  /**
@@ -1796,10 +1840,10 @@ export declare class KiloClient extends HeyApiClient {
1796
1840
  get pty(): Pty;
1797
1841
  private _config?;
1798
1842
  get config(): Config2;
1799
- private _tool?;
1800
- get tool(): Tool;
1801
1843
  private _experimental?;
1802
1844
  get experimental(): Experimental;
1845
+ private _tool?;
1846
+ get tool(): Tool;
1803
1847
  private _worktree?;
1804
1848
  get worktree(): Worktree;
1805
1849
  private _session?;
@@ -559,13 +559,13 @@ export class Config2 extends HeyApiClient {
559
559
  });
560
560
  }
561
561
  }
562
- export class Tool extends HeyApiClient {
562
+ export class Console extends HeyApiClient {
563
563
  /**
564
- * List tool IDs
564
+ * Get active Console provider metadata
565
565
  *
566
- * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
566
+ * Get the active Console org name and the set of provider IDs managed by that Console org.
567
567
  */
568
- ids(parameters, options) {
568
+ get(parameters, options) {
569
569
  const params = buildClientParams([parameters], [
570
570
  {
571
571
  args: [
@@ -575,31 +575,56 @@ export class Tool extends HeyApiClient {
575
575
  },
576
576
  ]);
577
577
  return (options?.client ?? this.client).get({
578
- url: "/experimental/tool/ids",
578
+ url: "/experimental/console",
579
579
  ...options,
580
580
  ...params,
581
581
  });
582
582
  }
583
583
  /**
584
- * List tools
584
+ * List switchable Console orgs
585
585
  *
586
- * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
586
+ * Get the available Console orgs across logged-in accounts, including the current active org.
587
587
  */
588
- list(parameters, options) {
588
+ listOrgs(parameters, options) {
589
589
  const params = buildClientParams([parameters], [
590
590
  {
591
591
  args: [
592
592
  { in: "query", key: "directory" },
593
593
  { in: "query", key: "workspace" },
594
- { in: "query", key: "provider" },
595
- { in: "query", key: "model" },
596
594
  ],
597
595
  },
598
596
  ]);
599
597
  return (options?.client ?? this.client).get({
600
- url: "/experimental/tool",
598
+ url: "/experimental/console/orgs",
599
+ ...options,
600
+ ...params,
601
+ });
602
+ }
603
+ /**
604
+ * Switch active Console org
605
+ *
606
+ * Persist a new active Console account/org selection for the current local Kilo state.
607
+ */
608
+ switchOrg(parameters, options) {
609
+ const params = buildClientParams([parameters], [
610
+ {
611
+ args: [
612
+ { in: "query", key: "directory" },
613
+ { in: "query", key: "workspace" },
614
+ { in: "body", key: "accountID" },
615
+ { in: "body", key: "orgID" },
616
+ ],
617
+ },
618
+ ]);
619
+ return (options?.client ?? this.client).post({
620
+ url: "/experimental/console/switch",
601
621
  ...options,
602
622
  ...params,
623
+ headers: {
624
+ "Content-Type": "application/json",
625
+ ...options?.headers,
626
+ ...params.headers,
627
+ },
603
628
  });
604
629
  }
605
630
  }
@@ -728,6 +753,10 @@ export class Resource extends HeyApiClient {
728
753
  }
729
754
  }
730
755
  export class Experimental extends HeyApiClient {
756
+ _console;
757
+ get console() {
758
+ return (this._console ??= new Console({ client: this.client }));
759
+ }
731
760
  _workspace;
732
761
  get workspace() {
733
762
  return (this._workspace ??= new Workspace({ client: this.client }));
@@ -741,6 +770,50 @@ export class Experimental extends HeyApiClient {
741
770
  return (this._resource ??= new Resource({ client: this.client }));
742
771
  }
743
772
  }
773
+ export class Tool extends HeyApiClient {
774
+ /**
775
+ * List tool IDs
776
+ *
777
+ * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
778
+ */
779
+ ids(parameters, options) {
780
+ const params = buildClientParams([parameters], [
781
+ {
782
+ args: [
783
+ { in: "query", key: "directory" },
784
+ { in: "query", key: "workspace" },
785
+ ],
786
+ },
787
+ ]);
788
+ return (options?.client ?? this.client).get({
789
+ url: "/experimental/tool/ids",
790
+ ...options,
791
+ ...params,
792
+ });
793
+ }
794
+ /**
795
+ * List tools
796
+ *
797
+ * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
798
+ */
799
+ list(parameters, options) {
800
+ const params = buildClientParams([parameters], [
801
+ {
802
+ args: [
803
+ { in: "query", key: "directory" },
804
+ { in: "query", key: "workspace" },
805
+ { in: "query", key: "provider" },
806
+ { in: "query", key: "model" },
807
+ ],
808
+ },
809
+ ]);
810
+ return (options?.client ?? this.client).get({
811
+ url: "/experimental/tool",
812
+ ...options,
813
+ ...params,
814
+ });
815
+ }
816
+ }
744
817
  export class Worktree extends HeyApiClient {
745
818
  /**
746
819
  * Remove worktree
@@ -1446,6 +1519,7 @@ export class Session2 extends HeyApiClient {
1446
1519
  { in: "path", key: "sessionID" },
1447
1520
  { in: "query", key: "directory" },
1448
1521
  { in: "query", key: "workspace" },
1522
+ { in: "body", key: "messageID" },
1449
1523
  { in: "body", key: "agent" },
1450
1524
  { in: "body", key: "model" },
1451
1525
  { in: "body", key: "command" },
@@ -2609,6 +2683,27 @@ export class Vcs extends HeyApiClient {
2609
2683
  ...params,
2610
2684
  });
2611
2685
  }
2686
+ /**
2687
+ * Get VCS diff
2688
+ *
2689
+ * Retrieve the current git diff for the working tree or against the default branch.
2690
+ */
2691
+ diff(parameters, options) {
2692
+ const params = buildClientParams([parameters], [
2693
+ {
2694
+ args: [
2695
+ { in: "query", key: "directory" },
2696
+ { in: "query", key: "workspace" },
2697
+ { in: "query", key: "mode" },
2698
+ ],
2699
+ },
2700
+ ]);
2701
+ return (options?.client ?? this.client).get({
2702
+ url: "/vcs/diff",
2703
+ ...options,
2704
+ ...params,
2705
+ });
2706
+ }
2612
2707
  }
2613
2708
  export class Command extends HeyApiClient {
2614
2709
  /**
@@ -3376,14 +3471,14 @@ export class KiloClient extends HeyApiClient {
3376
3471
  get config() {
3377
3472
  return (this._config ??= new Config2({ client: this.client }));
3378
3473
  }
3379
- _tool;
3380
- get tool() {
3381
- return (this._tool ??= new Tool({ client: this.client }));
3382
- }
3383
3474
  _experimental;
3384
3475
  get experimental() {
3385
3476
  return (this._experimental ??= new Experimental({ client: this.client }));
3386
3477
  }
3478
+ _tool;
3479
+ get tool() {
3480
+ return (this._tool ??= new Tool({ client: this.client }));
3481
+ }
3387
3482
  _worktree;
3388
3483
  get worktree() {
3389
3484
  return (this._worktree ??= new Worktree({ client: this.client }));
@@ -28,6 +28,12 @@ export type EventProjectUpdated = {
28
28
  type: "project.updated";
29
29
  properties: Project;
30
30
  };
31
+ export type EventServerInstanceDisposed = {
32
+ type: "server.instance.disposed";
33
+ properties: {
34
+ directory: string;
35
+ };
36
+ };
31
37
  export type EventInstallationUpdated = {
32
38
  type: "installation.updated";
33
39
  properties: {
@@ -40,12 +46,6 @@ export type EventInstallationUpdateAvailable = {
40
46
  version: string;
41
47
  };
42
48
  };
43
- export type EventServerInstanceDisposed = {
44
- type: "server.instance.disposed";
45
- properties: {
46
- directory: string;
47
- };
48
- };
49
49
  export type EventServerConnected = {
50
50
  type: "server.connected";
51
51
  properties: {
@@ -167,6 +167,19 @@ export type EventMessagePartDelta = {
167
167
  delta: string;
168
168
  };
169
169
  };
170
+ export type EventSessionTurnOpen = {
171
+ type: "session.turn.open";
172
+ properties: {
173
+ sessionID: string;
174
+ };
175
+ };
176
+ export type EventSessionTurnClose = {
177
+ type: "session.turn.close";
178
+ properties: {
179
+ sessionID: string;
180
+ reason: "completed" | "error" | "interrupted";
181
+ };
182
+ };
170
183
  export type PermissionRequest = {
171
184
  id: string;
172
185
  sessionID: string;
@@ -193,6 +206,109 @@ export type EventPermissionReplied = {
193
206
  reply: "once" | "always" | "reject";
194
207
  };
195
208
  };
209
+ export type SnapshotFileDiff = {
210
+ file: string;
211
+ patch: string;
212
+ additions: number;
213
+ deletions: number;
214
+ status?: "added" | "deleted" | "modified";
215
+ };
216
+ export type EventSessionDiff = {
217
+ type: "session.diff";
218
+ properties: {
219
+ sessionID: string;
220
+ diff: Array<SnapshotFileDiff>;
221
+ };
222
+ };
223
+ export type ProviderAuthError = {
224
+ name: "ProviderAuthError";
225
+ data: {
226
+ providerID: string;
227
+ message: string;
228
+ };
229
+ };
230
+ export type UnknownError = {
231
+ name: "UnknownError";
232
+ data: {
233
+ message: string;
234
+ };
235
+ };
236
+ export type MessageOutputLengthError = {
237
+ name: "MessageOutputLengthError";
238
+ data: {
239
+ [key: string]: unknown;
240
+ };
241
+ };
242
+ export type MessageAbortedError = {
243
+ name: "MessageAbortedError";
244
+ data: {
245
+ message: string;
246
+ };
247
+ };
248
+ export type StructuredOutputError = {
249
+ name: "StructuredOutputError";
250
+ data: {
251
+ message: string;
252
+ retries: number;
253
+ };
254
+ };
255
+ export type ContextOverflowError = {
256
+ name: "ContextOverflowError";
257
+ data: {
258
+ message: string;
259
+ responseBody?: string;
260
+ };
261
+ };
262
+ export type ApiError = {
263
+ name: "APIError";
264
+ data: {
265
+ message: string;
266
+ statusCode?: number;
267
+ isRetryable: boolean;
268
+ responseHeaders?: {
269
+ [key: string]: string;
270
+ };
271
+ responseBody?: string;
272
+ metadata?: {
273
+ [key: string]: string;
274
+ };
275
+ };
276
+ };
277
+ export type EventSessionError = {
278
+ type: "session.error";
279
+ properties: {
280
+ sessionID?: string;
281
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | StructuredOutputError | ContextOverflowError | ApiError;
282
+ };
283
+ };
284
+ export type EventFileEdited = {
285
+ type: "file.edited";
286
+ properties: {
287
+ file: string;
288
+ };
289
+ };
290
+ export type EventFileWatcherUpdated = {
291
+ type: "file.watcher.updated";
292
+ properties: {
293
+ file: string;
294
+ event: "add" | "change" | "unlink";
295
+ };
296
+ };
297
+ export type EventVcsBranchUpdated = {
298
+ type: "vcs.branch.updated";
299
+ properties: {
300
+ branch?: string;
301
+ };
302
+ };
303
+ export type EventCommandExecuted = {
304
+ type: "command.executed";
305
+ properties: {
306
+ name: string;
307
+ sessionID: string;
308
+ arguments: string;
309
+ messageID: string;
310
+ };
311
+ };
196
312
  export type QuestionOption = {
197
313
  /**
198
314
  * Display text (1-5 words, concise)
@@ -278,19 +394,6 @@ export type EventTodoUpdated = {
278
394
  todos: Array<Todo>;
279
395
  };
280
396
  };
281
- export type EventSessionTurnOpen = {
282
- type: "session.turn.open";
283
- properties: {
284
- sessionID: string;
285
- };
286
- };
287
- export type EventSessionTurnClose = {
288
- type: "session.turn.close";
289
- properties: {
290
- sessionID: string;
291
- reason: "completed" | "error" | "interrupted";
292
- };
293
- };
294
397
  export type SessionStatus = {
295
398
  type: "idle";
296
399
  } | {
@@ -324,110 +427,6 @@ export type EventSessionCompacted = {
324
427
  sessionID: string;
325
428
  };
326
429
  };
327
- export type EventFileEdited = {
328
- type: "file.edited";
329
- properties: {
330
- file: string;
331
- };
332
- };
333
- export type EventFileWatcherUpdated = {
334
- type: "file.watcher.updated";
335
- properties: {
336
- file: string;
337
- event: "add" | "change" | "unlink";
338
- };
339
- };
340
- export type EventCommandExecuted = {
341
- type: "command.executed";
342
- properties: {
343
- name: string;
344
- sessionID: string;
345
- arguments: string;
346
- messageID: string;
347
- };
348
- };
349
- export type FileDiff = {
350
- file: string;
351
- before: string;
352
- after: string;
353
- additions: number;
354
- deletions: number;
355
- status?: "added" | "deleted" | "modified";
356
- };
357
- export type EventSessionDiff = {
358
- type: "session.diff";
359
- properties: {
360
- sessionID: string;
361
- diff: Array<FileDiff>;
362
- };
363
- };
364
- export type ProviderAuthError = {
365
- name: "ProviderAuthError";
366
- data: {
367
- providerID: string;
368
- message: string;
369
- };
370
- };
371
- export type UnknownError = {
372
- name: "UnknownError";
373
- data: {
374
- message: string;
375
- };
376
- };
377
- export type MessageOutputLengthError = {
378
- name: "MessageOutputLengthError";
379
- data: {
380
- [key: string]: unknown;
381
- };
382
- };
383
- export type MessageAbortedError = {
384
- name: "MessageAbortedError";
385
- data: {
386
- message: string;
387
- };
388
- };
389
- export type StructuredOutputError = {
390
- name: "StructuredOutputError";
391
- data: {
392
- message: string;
393
- retries: number;
394
- };
395
- };
396
- export type ContextOverflowError = {
397
- name: "ContextOverflowError";
398
- data: {
399
- message: string;
400
- responseBody?: string;
401
- };
402
- };
403
- export type ApiError = {
404
- name: "APIError";
405
- data: {
406
- message: string;
407
- statusCode?: number;
408
- isRetryable: boolean;
409
- responseHeaders?: {
410
- [key: string]: string;
411
- };
412
- responseBody?: string;
413
- metadata?: {
414
- [key: string]: string;
415
- };
416
- };
417
- };
418
- export type EventSessionError = {
419
- type: "session.error";
420
- properties: {
421
- sessionID?: string;
422
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | StructuredOutputError | ContextOverflowError | ApiError;
423
- };
424
- };
425
- export type EventVcsBranchUpdated = {
426
- type: "vcs.branch.updated";
427
- properties: {
428
- branch?: string;
429
- };
430
- };
431
430
  export type EventKiloSessionsRemoteStatusChanged = {
432
431
  type: "kilo-sessions.remote-status-changed";
433
432
  properties: {
@@ -517,18 +516,18 @@ export type UserMessage = {
517
516
  summary?: {
518
517
  title?: string;
519
518
  body?: string;
520
- diffs: Array<FileDiff>;
519
+ diffs: Array<SnapshotFileDiff>;
521
520
  };
522
521
  agent: string;
523
522
  model: {
524
523
  providerID: string;
525
524
  modelID: string;
525
+ variant?: string;
526
526
  };
527
527
  system?: string;
528
528
  tools?: {
529
529
  [key: string]: boolean;
530
530
  };
531
- variant?: string;
532
531
  editorContext?: {
533
532
  visibleFiles?: Array<string>;
534
533
  openTabs?: Array<string>;
@@ -892,7 +891,7 @@ export type EventSessionDeleted = {
892
891
  info: Session;
893
892
  };
894
893
  };
895
- export type Event = EventProjectUpdated | EventInstallationUpdated | EventInstallationUpdateAvailable | EventServerInstanceDisposed | EventServerConnected | EventGlobalDisposed | EventGlobalConfigUpdated | EventLspClientDiagnostics | EventLspUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventSessionNetworkAsked | EventSessionNetworkReplied | EventSessionNetworkRejected | EventSessionNetworkRestored | EventMessagePartDelta | EventPermissionAsked | EventPermissionReplied | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventTodoUpdated | EventSessionTurnOpen | EventSessionTurnClose | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventFileWatcherUpdated | EventCommandExecuted | EventSessionDiff | EventSessionError | EventVcsBranchUpdated | EventKiloSessionsRemoteStatusChanged | EventWorkspaceReady | EventWorkspaceFailed | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorktreeReady | EventWorktreeFailed | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCreated | EventSessionUpdated | EventSessionDeleted;
894
+ export type Event = EventProjectUpdated | EventServerInstanceDisposed | EventInstallationUpdated | EventInstallationUpdateAvailable | EventServerConnected | EventGlobalDisposed | EventGlobalConfigUpdated | EventLspClientDiagnostics | EventLspUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventSessionNetworkAsked | EventSessionNetworkReplied | EventSessionNetworkRejected | EventSessionNetworkRestored | EventMessagePartDelta | EventSessionTurnOpen | EventSessionTurnClose | EventPermissionAsked | EventPermissionReplied | EventSessionDiff | EventSessionError | EventFileEdited | EventFileWatcherUpdated | EventVcsBranchUpdated | EventCommandExecuted | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventTodoUpdated | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventKiloSessionsRemoteStatusChanged | EventWorkspaceReady | EventWorkspaceFailed | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorktreeReady | EventWorktreeFailed | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCreated | EventSessionUpdated | EventSessionDeleted;
896
895
  export type GlobalEvent = {
897
896
  directory: string;
898
897
  payload: Event;
@@ -1101,6 +1100,29 @@ export type ProviderConfig = {
1101
1100
  env?: Array<string>;
1102
1101
  id?: string;
1103
1102
  npm?: string;
1103
+ whitelist?: Array<string>;
1104
+ blacklist?: Array<string>;
1105
+ options?: {
1106
+ apiKey?: string;
1107
+ baseURL?: string;
1108
+ /**
1109
+ * GitHub Enterprise URL for copilot authentication
1110
+ */
1111
+ enterpriseUrl?: string;
1112
+ /**
1113
+ * Enable promptCacheKey for this provider (default false)
1114
+ */
1115
+ setCacheKey?: boolean;
1116
+ /**
1117
+ * Timeout in milliseconds for requests to this provider. Default is 120000 (2 minutes). Set to false to disable timeout.
1118
+ */
1119
+ timeout?: number | false;
1120
+ /**
1121
+ * Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.
1122
+ */
1123
+ chunkTimeout?: number;
1124
+ [key: string]: unknown | string | boolean | number | false | number | undefined;
1125
+ };
1104
1126
  models?: {
1105
1127
  [key: string]: {
1106
1128
  id?: string;
@@ -1135,22 +1157,18 @@ export type ProviderConfig = {
1135
1157
  input: Array<"text" | "audio" | "image" | "video" | "pdf">;
1136
1158
  output: Array<"text" | "audio" | "image" | "video" | "pdf">;
1137
1159
  };
1138
- recommendedIndex?: number;
1139
- prompt?: "codex" | "gemini" | "beast" | "anthropic" | "trinity" | "anthropic_without_todo";
1140
- isFree?: boolean;
1141
- ai_sdk_provider?: "anthropic" | "openai" | "openai-compatible" | "openrouter";
1142
1160
  experimental?: boolean;
1143
1161
  status?: "alpha" | "beta" | "deprecated";
1162
+ provider?: {
1163
+ npm?: string;
1164
+ api?: string;
1165
+ };
1144
1166
  options?: {
1145
1167
  [key: string]: unknown;
1146
1168
  };
1147
1169
  headers?: {
1148
1170
  [key: string]: string;
1149
1171
  };
1150
- provider?: {
1151
- npm?: string;
1152
- api?: string;
1153
- };
1154
1172
  /**
1155
1173
  * Variant-specific configuration
1156
1174
  */
@@ -1165,29 +1183,6 @@ export type ProviderConfig = {
1165
1183
  };
1166
1184
  };
1167
1185
  };
1168
- whitelist?: Array<string>;
1169
- blacklist?: Array<string>;
1170
- options?: {
1171
- apiKey?: string;
1172
- baseURL?: string;
1173
- /**
1174
- * GitHub Enterprise URL for copilot authentication
1175
- */
1176
- enterpriseUrl?: string;
1177
- /**
1178
- * Enable promptCacheKey for this provider (default false)
1179
- */
1180
- setCacheKey?: boolean;
1181
- /**
1182
- * Timeout in milliseconds for requests to this provider. Default is 120000 (2 minutes). Set to false to disable timeout.
1183
- */
1184
- timeout?: number | false;
1185
- /**
1186
- * Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.
1187
- */
1188
- chunkTimeout?: number;
1189
- [key: string]: unknown | string | boolean | number | false | number | undefined;
1190
- };
1191
1186
  };
1192
1187
  export type McpLocalConfig = {
1193
1188
  /**
@@ -1226,6 +1221,10 @@ export type McpOAuthConfig = {
1226
1221
  * OAuth scopes to request during authorization
1227
1222
  */
1228
1223
  scope?: string;
1224
+ /**
1225
+ * OAuth redirect URI (default: http://127.0.0.1:19876/mcp/oauth/callback).
1226
+ */
1227
+ redirectUri?: string;
1229
1228
  };
1230
1229
  export type McpRemoteConfig = {
1231
1230
  /**
@@ -1422,6 +1421,15 @@ export type Config = {
1422
1421
  */
1423
1422
  url?: string;
1424
1423
  };
1424
+ /**
1425
+ * Configuration for AI-generated commit messages
1426
+ */
1427
+ commit_message?: {
1428
+ /**
1429
+ * Custom system prompt for AI commit message generation. When set, replaces the default conventional commits prompt entirely.
1430
+ */
1431
+ prompt?: string;
1432
+ };
1425
1433
  compaction?: {
1426
1434
  /**
1427
1435
  * Enable automatic compaction when context is full (default: true)
@@ -1482,6 +1490,9 @@ export type OAuth = {
1482
1490
  export type ApiAuth = {
1483
1491
  type: "api";
1484
1492
  key: string;
1493
+ metadata?: {
1494
+ [key: string]: string;
1495
+ };
1485
1496
  };
1486
1497
  export type WellKnownAuth = {
1487
1498
  type: "wellknown";
@@ -1616,11 +1627,12 @@ export type WorktreeResetInput = {
1616
1627
  };
1617
1628
  export type WorktreeDiffItem = {
1618
1629
  file: string;
1619
- before: string;
1620
- after: string;
1630
+ patch: string;
1621
1631
  additions: number;
1622
1632
  deletions: number;
1623
1633
  status?: "added" | "deleted" | "modified";
1634
+ before: string;
1635
+ after: string;
1624
1636
  tracked: boolean;
1625
1637
  generatedLike: boolean;
1626
1638
  summarized: boolean;
@@ -1824,6 +1836,14 @@ export type Path = {
1824
1836
  };
1825
1837
  export type VcsInfo = {
1826
1838
  branch?: string;
1839
+ default_branch?: string;
1840
+ };
1841
+ export type VcsFileDiff = {
1842
+ file: string;
1843
+ patch: string;
1844
+ additions: number;
1845
+ deletions: number;
1846
+ status?: "added" | "deleted" | "modified";
1827
1847
  };
1828
1848
  export type Command = {
1829
1849
  name: string;
@@ -2394,6 +2414,70 @@ export type ConfigProvidersResponses = {
2394
2414
  };
2395
2415
  };
2396
2416
  export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses];
2417
+ export type ExperimentalConsoleGetData = {
2418
+ body?: never;
2419
+ path?: never;
2420
+ query?: {
2421
+ directory?: string;
2422
+ workspace?: string;
2423
+ };
2424
+ url: "/experimental/console";
2425
+ };
2426
+ export type ExperimentalConsoleGetResponses = {
2427
+ /**
2428
+ * Active Console provider metadata
2429
+ */
2430
+ 200: {
2431
+ consoleManagedProviders: Array<string>;
2432
+ activeOrgName?: string;
2433
+ switchableOrgCount: number;
2434
+ };
2435
+ };
2436
+ export type ExperimentalConsoleGetResponse = ExperimentalConsoleGetResponses[keyof ExperimentalConsoleGetResponses];
2437
+ export type ExperimentalConsoleListOrgsData = {
2438
+ body?: never;
2439
+ path?: never;
2440
+ query?: {
2441
+ directory?: string;
2442
+ workspace?: string;
2443
+ };
2444
+ url: "/experimental/console/orgs";
2445
+ };
2446
+ export type ExperimentalConsoleListOrgsResponses = {
2447
+ /**
2448
+ * Switchable Console orgs
2449
+ */
2450
+ 200: {
2451
+ orgs: Array<{
2452
+ accountID: string;
2453
+ accountEmail: string;
2454
+ accountUrl: string;
2455
+ orgID: string;
2456
+ orgName: string;
2457
+ active: boolean;
2458
+ }>;
2459
+ };
2460
+ };
2461
+ export type ExperimentalConsoleListOrgsResponse = ExperimentalConsoleListOrgsResponses[keyof ExperimentalConsoleListOrgsResponses];
2462
+ export type ExperimentalConsoleSwitchOrgData = {
2463
+ body?: {
2464
+ accountID: string;
2465
+ orgID: string;
2466
+ };
2467
+ path?: never;
2468
+ query?: {
2469
+ directory?: string;
2470
+ workspace?: string;
2471
+ };
2472
+ url: "/experimental/console/switch";
2473
+ };
2474
+ export type ExperimentalConsoleSwitchOrgResponses = {
2475
+ /**
2476
+ * Switch success
2477
+ */
2478
+ 200: boolean;
2479
+ };
2480
+ export type ExperimentalConsoleSwitchOrgResponse = ExperimentalConsoleSwitchOrgResponses[keyof ExperimentalConsoleSwitchOrgResponses];
2397
2481
  export type ToolIdsData = {
2398
2482
  body?: never;
2399
2483
  path?: never;
@@ -2620,7 +2704,7 @@ export type WorktreeDiffResponses = {
2620
2704
  /**
2621
2705
  * File diffs
2622
2706
  */
2623
- 200: Array<FileDiff>;
2707
+ 200: Array<SnapshotFileDiff>;
2624
2708
  };
2625
2709
  export type WorktreeDiffResponse = WorktreeDiffResponses[keyof WorktreeDiffResponses];
2626
2710
  export type WorktreeDiffSummaryData = {
@@ -3145,7 +3229,7 @@ export type SessionDiffResponses = {
3145
3229
  /**
3146
3230
  * Successfully retrieved diff
3147
3231
  */
3148
- 200: Array<FileDiff>;
3232
+ 200: Array<SnapshotFileDiff>;
3149
3233
  };
3150
3234
  export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses];
3151
3235
  export type SessionSummarizeData = {
@@ -3501,6 +3585,7 @@ export type SessionCommandResponses = {
3501
3585
  export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses];
3502
3586
  export type SessionShellData = {
3503
3587
  body?: {
3588
+ messageID?: string;
3504
3589
  agent: string;
3505
3590
  model?: {
3506
3591
  providerID: string;
@@ -3532,7 +3617,10 @@ export type SessionShellResponses = {
3532
3617
  /**
3533
3618
  * Created message
3534
3619
  */
3535
- 200: AssistantMessage;
3620
+ 200: {
3621
+ info: Message;
3622
+ parts: Array<Part>;
3623
+ };
3536
3624
  };
3537
3625
  export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses];
3538
3626
  export type SessionRevertData = {
@@ -3820,70 +3908,7 @@ export type ProviderListResponses = {
3820
3908
  * List of providers
3821
3909
  */
3822
3910
  200: {
3823
- all: Array<{
3824
- api?: string;
3825
- name: string;
3826
- env: Array<string>;
3827
- id: string;
3828
- npm?: string;
3829
- models: {
3830
- [key: string]: {
3831
- id: string;
3832
- name: string;
3833
- family?: string;
3834
- release_date: string;
3835
- attachment: boolean;
3836
- reasoning: boolean;
3837
- temperature: boolean;
3838
- tool_call: boolean;
3839
- interleaved?: true | {
3840
- field: "reasoning_content" | "reasoning_details";
3841
- };
3842
- cost?: {
3843
- input: number;
3844
- output: number;
3845
- cache_read?: number;
3846
- cache_write?: number;
3847
- context_over_200k?: {
3848
- input: number;
3849
- output: number;
3850
- cache_read?: number;
3851
- cache_write?: number;
3852
- };
3853
- };
3854
- limit: {
3855
- context: number;
3856
- input?: number;
3857
- output: number;
3858
- };
3859
- modalities?: {
3860
- input: Array<"text" | "audio" | "image" | "video" | "pdf">;
3861
- output: Array<"text" | "audio" | "image" | "video" | "pdf">;
3862
- };
3863
- recommendedIndex?: number;
3864
- prompt?: "codex" | "gemini" | "beast" | "anthropic" | "trinity" | "anthropic_without_todo";
3865
- isFree?: boolean;
3866
- ai_sdk_provider?: "anthropic" | "openai" | "openai-compatible" | "openrouter";
3867
- experimental?: boolean;
3868
- status?: "alpha" | "beta" | "deprecated";
3869
- options: {
3870
- [key: string]: unknown;
3871
- };
3872
- headers?: {
3873
- [key: string]: string;
3874
- };
3875
- provider?: {
3876
- npm?: string;
3877
- api?: string;
3878
- };
3879
- variants?: {
3880
- [key: string]: {
3881
- [key: string]: unknown;
3882
- };
3883
- };
3884
- };
3885
- };
3886
- }>;
3911
+ all: Array<Provider>;
3887
3912
  default: {
3888
3913
  [key: string]: string;
3889
3914
  };
@@ -4635,6 +4660,23 @@ export type VcsGetResponses = {
4635
4660
  200: VcsInfo;
4636
4661
  };
4637
4662
  export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses];
4663
+ export type VcsDiffData = {
4664
+ body?: never;
4665
+ path?: never;
4666
+ query: {
4667
+ directory?: string;
4668
+ workspace?: string;
4669
+ mode: "git" | "branch";
4670
+ };
4671
+ url: "/vcs/diff";
4672
+ };
4673
+ export type VcsDiffResponses = {
4674
+ /**
4675
+ * VCS diff
4676
+ */
4677
+ 200: Array<VcsFileDiff>;
4678
+ };
4679
+ export type VcsDiffResponse = VcsDiffResponses[keyof VcsDiffResponses];
4638
4680
  export type CommandListData = {
4639
4681
  body?: never;
4640
4682
  path?: never;
@@ -1,6 +1,7 @@
1
1
  export * from "./client.js";
2
2
  export * from "./server.js";
3
3
  import type { ServerOptions } from "./server.js";
4
+ export * as data from "./data.js";
4
5
  export declare function createKilo(options?: ServerOptions): Promise<{
5
6
  client: import("./client.js").KiloClient;
6
7
  server: {
package/dist/v2/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./client.js";
2
2
  export * from "./server.js";
3
3
  import { createKiloClient } from "./client.js";
4
4
  import { createKiloServer } from "./server.js";
5
+ export * as data from "./data.js";
5
6
  export async function createKilo(options) {
6
7
  const server = await createKiloServer({
7
8
  ...options,
package/dist/v2/server.js CHANGED
@@ -1,4 +1,5 @@
1
- import { spawn } from "node:child_process";
1
+ import launch from "cross-spawn";
2
+ import { stop, bindAbort } from "../process.js";
2
3
  // kilocode_change start - Merge existing KILO_CONFIG_CONTENT with new config
3
4
  // This preserves Kilocode-injected modes when spawning nested CLI instances
4
5
  function mergeConfig(existing, incoming) {
@@ -40,21 +41,25 @@ export async function createKiloServer(options) {
40
41
  if (options.config?.logLevel)
41
42
  args.push(`--log-level=${options.config.logLevel}`);
42
43
  // kilocode_change start
43
- const proc = spawn(`kilo`, args, {
44
+ const proc = launch(`kilo`, args, {
44
45
  // kilocode_change end
45
- signal: options.signal,
46
- windowsHide: true,
47
46
  env: {
48
47
  ...process.env,
49
48
  KILO_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
50
49
  },
51
50
  });
51
+ let clear = () => { };
52
52
  const url = await new Promise((resolve, reject) => {
53
53
  const id = setTimeout(() => {
54
+ clear();
55
+ stop(proc);
54
56
  reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
55
57
  }, options.timeout);
56
58
  let output = "";
59
+ let resolved = false;
57
60
  proc.stdout?.on("data", (chunk) => {
61
+ if (resolved)
62
+ return;
58
63
  output += chunk.toString();
59
64
  const lines = output.split("\n");
60
65
  for (const line of lines) {
@@ -63,9 +68,14 @@ export async function createKiloServer(options) {
63
68
  // kilocode_change end
64
69
  const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
65
70
  if (!match) {
66
- throw new Error(`Failed to parse server url from output: ${line}`);
71
+ clear();
72
+ stop(proc);
73
+ clearTimeout(id);
74
+ reject(new Error(`Failed to parse server url from output: ${line}`));
75
+ return;
67
76
  }
68
77
  clearTimeout(id);
78
+ resolved = true;
69
79
  resolve(match[1]);
70
80
  return;
71
81
  }
@@ -86,17 +96,16 @@ export async function createKiloServer(options) {
86
96
  clearTimeout(id);
87
97
  reject(error);
88
98
  });
89
- if (options.signal) {
90
- options.signal.addEventListener("abort", () => {
91
- clearTimeout(id);
92
- reject(new Error("Aborted"));
93
- });
94
- }
99
+ clear = bindAbort(proc, options.signal, () => {
100
+ clearTimeout(id);
101
+ reject(options.signal?.reason);
102
+ });
95
103
  });
96
104
  return {
97
105
  url,
98
106
  close() {
99
- proc.kill();
107
+ clear();
108
+ stop(proc);
100
109
  },
101
110
  };
102
111
  }
@@ -115,9 +124,8 @@ export function createKiloTui(options) {
115
124
  args.push(`--agent=${options.agent}`);
116
125
  }
117
126
  // kilocode_change start
118
- const proc = spawn(`kilo`, args, {
127
+ const proc = launch(`kilo`, args, {
119
128
  // kilocode_change end
120
- signal: options?.signal,
121
129
  stdio: "inherit",
122
130
  windowsHide: true,
123
131
  env: {
@@ -125,9 +133,11 @@ export function createKiloTui(options) {
125
133
  KILO_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
126
134
  },
127
135
  });
136
+ const clear = bindAbort(proc, options?.signal);
128
137
  return {
129
138
  close() {
130
- proc.kill();
139
+ clear();
140
+ stop(proc);
131
141
  },
132
142
  };
133
143
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@kilocode/sdk",
4
- "version": "7.2.5",
4
+ "version": "7.2.7",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -44,11 +44,14 @@
44
44
  "devDependencies": {
45
45
  "@hey-api/openapi-ts": "0.90.10",
46
46
  "@tsconfig/node22": "22.0.2",
47
+ "@types/cross-spawn": "6.0.6",
47
48
  "@types/node": "22.13.9",
48
- "typescript": "5.8.2",
49
- "@typescript/native-preview": "7.0.0-dev.20260316.1"
49
+ "@typescript/native-preview": "7.0.0-dev.20260316.1",
50
+ "typescript": "5.8.2"
51
+ },
52
+ "dependencies": {
53
+ "cross-spawn": "7.0.6"
50
54
  },
51
- "dependencies": {},
52
55
  "peerDependencies": {},
53
56
  "repository": {
54
57
  "type": "git",