@kilocode/sdk 1.0.15 → 1.0.21

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/dist/client.js CHANGED
@@ -17,7 +17,7 @@ export function createOpencodeClient(config) {
17
17
  if (config?.directory) {
18
18
  config.headers = {
19
19
  ...config.headers,
20
- "x-opencode-directory": config.directory,
20
+ "x-opencode-directory": encodeURIComponent(config.directory),
21
21
  };
22
22
  }
23
23
  const client = createClient(config);
@@ -1370,7 +1370,7 @@ export type FileNode = {
1370
1370
  ignored: boolean;
1371
1371
  };
1372
1372
  export type FileContent = {
1373
- type: "text";
1373
+ type: "text" | "binary";
1374
1374
  content: string;
1375
1375
  diff?: string;
1376
1376
  patch?: {
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
- // kilocode_change start - Merge existing OPENCODE_CONFIG_CONTENT with new config
2
+ // kilocode_change start - Merge existing KILO_CONFIG_CONTENT with new config
3
3
  // This preserves Kilocode-injected modes when spawning nested CLI instances
4
4
  function mergeConfig(existing, incoming) {
5
5
  const base = existing ?? {};
@@ -16,7 +16,7 @@ function mergeConfig(existing, incoming) {
16
16
  };
17
17
  }
18
18
  function parseExistingConfig() {
19
- const content = process.env.OPENCODE_CONFIG_CONTENT;
19
+ const content = process.env.KILO_CONFIG_CONTENT;
20
20
  if (!content)
21
21
  return undefined;
22
22
  try {
@@ -43,7 +43,7 @@ export async function createOpencodeServer(options) {
43
43
  signal: options.signal,
44
44
  env: {
45
45
  ...process.env,
46
- OPENCODE_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
46
+ KILO_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
47
47
  },
48
48
  });
49
49
  const url = await new Promise((resolve, reject) => {
@@ -55,7 +55,9 @@ export async function createOpencodeServer(options) {
55
55
  output += chunk.toString();
56
56
  const lines = output.split("\n");
57
57
  for (const line of lines) {
58
- if (line.startsWith("opencode server listening")) {
58
+ // kilocode_change start
59
+ if (line.startsWith("kilo server listening")) {
60
+ // kilocode_change end
59
61
  const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
60
62
  if (!match) {
61
63
  throw new Error(`Failed to parse server url from output: ${line}`);
@@ -114,7 +116,7 @@ export function createOpencodeTui(options) {
114
116
  stdio: "inherit",
115
117
  env: {
116
118
  ...process.env,
117
- OPENCODE_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
119
+ KILO_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
118
120
  },
119
121
  });
120
122
  return {
@@ -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, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, InstanceDisposeResponses, KiloNotificationsErrors, KiloNotificationsResponses, KiloOrganizationSetErrors, KiloOrganizationSetResponses, KiloProfileErrors, KiloProfileResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, 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, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, 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, SubtaskPartInput, 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, 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, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, InstanceDisposeResponses, KiloFimErrors, KiloFimResponses, KiloNotificationsErrors, KiloNotificationsResponses, KiloOrganizationSetErrors, KiloOrganizationSetResponses, KiloProfileErrors, KiloProfileResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, 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, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, 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, SubtaskPartInput, 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, 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
@@ -707,6 +707,19 @@ export declare class Kilo extends HeyApiClient {
707
707
  profile<ThrowOnError extends boolean = false>(parameters?: {
708
708
  directory?: string;
709
709
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<KiloProfileResponses, KiloProfileErrors, ThrowOnError, "fields">;
710
+ /**
711
+ * FIM completion
712
+ *
713
+ * Proxy a Fill-in-the-Middle completion request to the Kilo Gateway
714
+ */
715
+ fim<ThrowOnError extends boolean = false>(parameters?: {
716
+ directory?: string;
717
+ prefix?: string;
718
+ suffix?: string;
719
+ model?: string;
720
+ maxTokens?: number;
721
+ temperature?: number;
722
+ }, options?: Options<never, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<KiloFimResponses, KiloFimErrors>>;
710
723
  /**
711
724
  * Get Kilo notifications
712
725
  *
@@ -1376,6 +1376,35 @@ export class Kilo extends HeyApiClient {
1376
1376
  ...params,
1377
1377
  });
1378
1378
  }
1379
+ /**
1380
+ * FIM completion
1381
+ *
1382
+ * Proxy a Fill-in-the-Middle completion request to the Kilo Gateway
1383
+ */
1384
+ fim(parameters, options) {
1385
+ const params = buildClientParams([parameters], [
1386
+ {
1387
+ args: [
1388
+ { in: "query", key: "directory" },
1389
+ { in: "body", key: "prefix" },
1390
+ { in: "body", key: "suffix" },
1391
+ { in: "body", key: "model" },
1392
+ { in: "body", key: "maxTokens" },
1393
+ { in: "body", key: "temperature" },
1394
+ ],
1395
+ },
1396
+ ]);
1397
+ return (options?.client ?? this.client).sse.post({
1398
+ url: "/kilo/fim",
1399
+ ...options,
1400
+ ...params,
1401
+ headers: {
1402
+ "Content-Type": "application/json",
1403
+ ...options?.headers,
1404
+ ...params.headers,
1405
+ },
1406
+ });
1407
+ }
1379
1408
  /**
1380
1409
  * Get Kilo notifications
1381
1410
  *
@@ -83,6 +83,7 @@ export type FileDiff = {
83
83
  after: string;
84
84
  additions: number;
85
85
  deletions: number;
86
+ status?: "added" | "deleted" | "modified";
86
87
  };
87
88
  export type UserMessage = {
88
89
  id: string;
@@ -132,6 +133,13 @@ export type MessageAbortedError = {
132
133
  message: string;
133
134
  };
134
135
  };
136
+ export type ContextOverflowError = {
137
+ name: "ContextOverflowError";
138
+ data: {
139
+ message: string;
140
+ responseBody?: string;
141
+ };
142
+ };
135
143
  export type ApiError = {
136
144
  name: "APIError";
137
145
  data: {
@@ -155,7 +163,7 @@ export type AssistantMessage = {
155
163
  created: number;
156
164
  completed?: number;
157
165
  };
158
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError;
166
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ContextOverflowError | ApiError;
159
167
  parentID: string;
160
168
  modelID: string;
161
169
  providerID: string;
@@ -168,6 +176,7 @@ export type AssistantMessage = {
168
176
  summary?: boolean;
169
177
  cost: number;
170
178
  tokens: {
179
+ total?: number;
171
180
  input: number;
172
181
  output: number;
173
182
  reasoning: number;
@@ -176,6 +185,7 @@ export type AssistantMessage = {
176
185
  write: number;
177
186
  };
178
187
  };
188
+ variant?: string;
179
189
  finish?: string;
180
190
  };
181
191
  export type Message = UserMessage | AssistantMessage;
@@ -361,6 +371,7 @@ export type StepFinishPart = {
361
371
  snapshot?: string;
362
372
  cost: number;
363
373
  tokens: {
374
+ total?: number;
364
375
  input: number;
365
376
  output: number;
366
377
  reasoning: number;
@@ -704,7 +715,20 @@ export type EventSessionError = {
704
715
  type: "session.error";
705
716
  properties: {
706
717
  sessionID?: string;
707
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError;
718
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ContextOverflowError | ApiError;
719
+ };
720
+ };
721
+ export type EventSessionTurnOpen = {
722
+ type: "session.turn.open";
723
+ properties: {
724
+ sessionID: string;
725
+ };
726
+ };
727
+ export type EventSessionTurnClose = {
728
+ type: "session.turn.close";
729
+ properties: {
730
+ sessionID: string;
731
+ reason: "completed" | "error" | "interrupted";
708
732
  };
709
733
  };
710
734
  export type EventVcsBranchUpdated = {
@@ -760,7 +784,7 @@ export type EventWorktreeFailed = {
760
784
  message: string;
761
785
  };
762
786
  };
763
- export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventServerConnected | EventGlobalDisposed | EventLspClientDiagnostics | EventLspUpdated | EventFileEdited | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventSessionCompacted | EventFileWatcherUpdated | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorktreeReady | EventWorktreeFailed;
787
+ export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventServerConnected | EventGlobalDisposed | EventLspClientDiagnostics | EventLspUpdated | EventFileEdited | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventSessionCompacted | EventFileWatcherUpdated | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventSessionTurnOpen | EventSessionTurnClose | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorktreeReady | EventWorktreeFailed;
764
788
  export type GlobalEvent = {
765
789
  directory: string;
766
790
  payload: Event;
@@ -1145,6 +1169,10 @@ export type KeybindsConfig = {
1145
1169
  * Toggle news on home screen
1146
1170
  */
1147
1171
  news_toggle?: string;
1172
+ /**
1173
+ * Toggle thinking blocks visibility
1174
+ */
1175
+ display_thinking?: string;
1148
1176
  };
1149
1177
  /**
1150
1178
  * Log level
@@ -1166,6 +1194,10 @@ export type ServerConfig = {
1166
1194
  * Enable mDNS service discovery
1167
1195
  */
1168
1196
  mdns?: boolean;
1197
+ /**
1198
+ * Custom domain name for mDNS service (default: opencode.local)
1199
+ */
1200
+ mdnsDomain?: string;
1169
1201
  /**
1170
1202
  * Additional domains to allow for CORS
1171
1203
  */
@@ -1194,10 +1226,15 @@ export type PermissionConfig = {
1194
1226
  codesearch?: PermissionActionConfig;
1195
1227
  lsp?: PermissionRuleConfig;
1196
1228
  doom_loop?: PermissionActionConfig;
1229
+ skill?: PermissionRuleConfig;
1197
1230
  [key: string]: PermissionRuleConfig | Array<string> | PermissionActionConfig | undefined;
1198
1231
  } | PermissionActionConfig;
1199
1232
  export type AgentConfig = {
1200
1233
  model?: string;
1234
+ /**
1235
+ * Default model variant for this agent (applies only when using the agent's configured model).
1236
+ */
1237
+ variant?: string;
1201
1238
  temperature?: number;
1202
1239
  top_p?: number;
1203
1240
  prompt?: string;
@@ -1221,9 +1258,9 @@ export type AgentConfig = {
1221
1258
  [key: string]: unknown;
1222
1259
  };
1223
1260
  /**
1224
- * Hex color code for the agent (e.g., #FF5733)
1261
+ * Hex color code (e.g., #FF5733) or theme color (e.g., primary)
1225
1262
  */
1226
- color?: string;
1263
+ color?: string | "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info";
1227
1264
  /**
1228
1265
  * Maximum number of agentic iterations before forcing text-only response
1229
1266
  */
@@ -1237,7 +1274,7 @@ export type AgentConfig = {
1237
1274
  [key: string]: boolean;
1238
1275
  } | boolean | "subagent" | "primary" | "all" | {
1239
1276
  [key: string]: unknown;
1240
- } | string | number | PermissionConfig | undefined;
1277
+ } | string | "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info" | number | PermissionConfig | undefined;
1241
1278
  };
1242
1279
  export type ProviderConfig = {
1243
1280
  api?: string;
@@ -1440,6 +1477,19 @@ export type Config = {
1440
1477
  subtask?: boolean;
1441
1478
  };
1442
1479
  };
1480
+ /**
1481
+ * Additional skill folder paths
1482
+ */
1483
+ skills?: {
1484
+ /**
1485
+ * Additional paths to skill folders
1486
+ */
1487
+ paths?: Array<string>;
1488
+ /**
1489
+ * URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)
1490
+ */
1491
+ urls?: Array<string>;
1492
+ };
1443
1493
  watcher?: {
1444
1494
  ignore?: Array<string>;
1445
1495
  };
@@ -1495,6 +1545,9 @@ export type Config = {
1495
1545
  agent?: {
1496
1546
  plan?: AgentConfig;
1497
1547
  build?: AgentConfig;
1548
+ debug?: AgentConfig;
1549
+ orchestrator?: AgentConfig;
1550
+ ask?: AgentConfig;
1498
1551
  general?: AgentConfig;
1499
1552
  explore?: AgentConfig;
1500
1553
  title?: AgentConfig;
@@ -1565,28 +1618,12 @@ export type Config = {
1565
1618
  * Enable pruning of old tool outputs (default: true)
1566
1619
  */
1567
1620
  prune?: boolean;
1568
- };
1569
- experimental?: {
1570
- hook?: {
1571
- file_edited?: {
1572
- [key: string]: Array<{
1573
- command: Array<string>;
1574
- environment?: {
1575
- [key: string]: string;
1576
- };
1577
- }>;
1578
- };
1579
- session_completed?: Array<{
1580
- command: Array<string>;
1581
- environment?: {
1582
- [key: string]: string;
1583
- };
1584
- }>;
1585
- };
1586
1621
  /**
1587
- * Number of retries for chat completions on failure
1622
+ * Token buffer for compaction. Leaves enough window to avoid overflow during compaction.
1588
1623
  */
1589
- chatMaxRetries?: number;
1624
+ reserved?: number;
1625
+ };
1626
+ experimental?: {
1590
1627
  disable_paste_summary?: boolean;
1591
1628
  /**
1592
1629
  * Enable the batch tool
@@ -1823,7 +1860,7 @@ export type FileNode = {
1823
1860
  ignored: boolean;
1824
1861
  };
1825
1862
  export type FileContent = {
1826
- type: "text";
1863
+ type: "text" | "binary";
1827
1864
  content: string;
1828
1865
  diff?: string;
1829
1866
  patch?: {
@@ -1882,7 +1919,7 @@ export type Command = {
1882
1919
  description?: string;
1883
1920
  agent?: string;
1884
1921
  model?: string;
1885
- mcp?: boolean;
1922
+ source?: "command" | "mcp" | "skill";
1886
1923
  template: string;
1887
1924
  subtask?: boolean;
1888
1925
  hints: Array<string>;
@@ -1901,6 +1938,7 @@ export type Agent = {
1901
1938
  modelID: string;
1902
1939
  providerID: string;
1903
1940
  };
1941
+ variant?: string;
1904
1942
  prompt?: string;
1905
1943
  options: {
1906
1944
  [key: string]: unknown;
@@ -3652,6 +3690,33 @@ export type KiloOrganizationSetResponses = {
3652
3690
  200: boolean;
3653
3691
  };
3654
3692
  export type KiloOrganizationSetResponse = KiloOrganizationSetResponses[keyof KiloOrganizationSetResponses];
3693
+ export type KiloFimData = {
3694
+ body?: {
3695
+ prefix: string;
3696
+ suffix: string;
3697
+ model?: string;
3698
+ maxTokens?: number;
3699
+ temperature?: number;
3700
+ };
3701
+ path?: never;
3702
+ query?: {
3703
+ directory?: string;
3704
+ };
3705
+ url: "/kilo/fim";
3706
+ };
3707
+ export type KiloFimErrors = {
3708
+ /**
3709
+ * Bad request
3710
+ */
3711
+ 400: BadRequestError;
3712
+ };
3713
+ export type KiloFimError = KiloFimErrors[keyof KiloFimErrors];
3714
+ export type KiloFimResponses = {
3715
+ /**
3716
+ * Streaming FIM completion response
3717
+ */
3718
+ 200: unknown;
3719
+ };
3655
3720
  export type KiloNotificationsData = {
3656
3721
  body?: never;
3657
3722
  path?: never;
@@ -4374,6 +4439,7 @@ export type AppSkillsResponses = {
4374
4439
  name: string;
4375
4440
  description: string;
4376
4441
  location: string;
4442
+ content: string;
4377
4443
  }>;
4378
4444
  };
4379
4445
  export type AppSkillsResponse = AppSkillsResponses[keyof AppSkillsResponses];
package/dist/v2/server.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
- // kilocode_change start - Merge existing OPENCODE_CONFIG_CONTENT with new config
2
+ // kilocode_change start - Merge existing KILO_CONFIG_CONTENT with new config
3
3
  // This preserves Kilocode-injected modes when spawning nested CLI instances
4
4
  function mergeConfig(existing, incoming) {
5
5
  const base = existing ?? {};
@@ -16,7 +16,7 @@ function mergeConfig(existing, incoming) {
16
16
  };
17
17
  }
18
18
  function parseExistingConfig() {
19
- const content = process.env.OPENCODE_CONFIG_CONTENT;
19
+ const content = process.env.KILO_CONFIG_CONTENT;
20
20
  if (!content)
21
21
  return undefined;
22
22
  try {
@@ -39,11 +39,13 @@ export async function createOpencodeServer(options) {
39
39
  const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
40
40
  if (options.config?.logLevel)
41
41
  args.push(`--log-level=${options.config.logLevel}`);
42
- const proc = spawn(`opencode`, args, {
42
+ // kilocode_change start
43
+ const proc = spawn(`kilo`, args, {
44
+ // kilocode_change end
43
45
  signal: options.signal,
44
46
  env: {
45
47
  ...process.env,
46
- OPENCODE_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
48
+ KILO_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
47
49
  },
48
50
  });
49
51
  const url = await new Promise((resolve, reject) => {
@@ -55,7 +57,9 @@ export async function createOpencodeServer(options) {
55
57
  output += chunk.toString();
56
58
  const lines = output.split("\n");
57
59
  for (const line of lines) {
58
- if (line.startsWith("opencode server listening")) {
60
+ // kilocode_change start
61
+ if (line.startsWith("kilo server listening")) {
62
+ // kilocode_change end
59
63
  const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
60
64
  if (!match) {
61
65
  throw new Error(`Failed to parse server url from output: ${line}`);
@@ -109,12 +113,14 @@ export function createOpencodeTui(options) {
109
113
  if (options?.agent) {
110
114
  args.push(`--agent=${options.agent}`);
111
115
  }
112
- const proc = spawn(`opencode`, args, {
116
+ // kilocode_change start
117
+ const proc = spawn(`kilo`, args, {
118
+ // kilocode_change end
113
119
  signal: options?.signal,
114
120
  stdio: "inherit",
115
121
  env: {
116
122
  ...process.env,
117
- OPENCODE_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
123
+ KILO_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
118
124
  },
119
125
  });
120
126
  return {
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@kilocode/sdk",
4
- "version": "1.0.15",
4
+ "version": "1.0.21",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Kilo-Org/kilo",
10
+ "directory": "packages/sdk/js"
11
+ },
7
12
  "scripts": {
8
13
  "typecheck": "tsgo --noEmit",
9
14
  "build": "./script/build.ts"
@@ -47,5 +52,6 @@
47
52
  "dependencies": {},
48
53
  "publishConfig": {
49
54
  "directory": "dist"
50
- }
55
+ },
56
+ "peerDependencies": {}
51
57
  }