@kilocode/sdk 7.7.6 → 7.7.9

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.
@@ -1,3 +1,46 @@
1
+ const ATTEMPTS = 3;
2
+ // Mirrors the transient classifier in
3
+ // packages/kilo-vscode/src/services/cli-backend/retry.ts. The SDK cannot import
4
+ // that module, so keep the two lists in sync by hand, including the exact
5
+ // "terminated" match for undici pooled-connection drops. Only transport-level
6
+ // failures are retried. A status-less client error such as a response parse
7
+ // failure or a server-version mismatch is definitive and must not be replayed.
8
+ // Re-sending an identical rule set after a lost response is tolerable because
9
+ // duplicate patterns do not change the decision.
10
+ const TRANSIENT = [
11
+ "load failed",
12
+ "network connection was lost",
13
+ "network request failed",
14
+ "failed to fetch",
15
+ "fetch failed",
16
+ "econnreset",
17
+ "econnrefused",
18
+ "etimedout",
19
+ "socket hang up",
20
+ ];
21
+ const TRANSIENT_EXACT = ["terminated"];
22
+ function transport(error) {
23
+ if (!error)
24
+ return false;
25
+ const message = String(error instanceof Error ? error.message : error)
26
+ .toLowerCase()
27
+ .trim();
28
+ if (TRANSIENT_EXACT.includes(message))
29
+ return true;
30
+ return TRANSIENT.some((entry) => message.includes(entry));
31
+ }
32
+ async function send(fn, budget) {
33
+ for (let attempt = 0;; attempt++) {
34
+ try {
35
+ return await fn();
36
+ }
37
+ catch (error) {
38
+ if (attempt >= ATTEMPTS - 1 || !transport(error) || budget() <= 0)
39
+ throw error;
40
+ await new Promise((resolve) => setTimeout(resolve, Math.min(100 * 2 ** attempt, budget())));
41
+ }
42
+ }
43
+ }
1
44
  /**
2
45
  * Send a permission decision with one bounded wait across both requests.
3
46
  * A timeout aborts only the client wait, so callers must reconcile an aborted
@@ -10,20 +53,20 @@ export async function respondToPermission(client, input, timeout = 15_000) {
10
53
  const saved = input.approvedAlways.length > 0 || input.deniedAlways.length > 0;
11
54
  try {
12
55
  if (saved) {
13
- await client.permission.saveAlwaysRules({
56
+ await send(() => client.permission.saveAlwaysRules({
14
57
  requestID: input.requestID,
15
58
  directory: input.directory,
16
59
  approvedAlways: input.approvedAlways,
17
60
  deniedAlways: input.deniedAlways,
18
- }, { throwOnError: true, signal: AbortSignal.timeout(budget()) });
61
+ }, { throwOnError: true, signal: AbortSignal.timeout(budget()) }), budget);
19
62
  }
20
- await client.permission.reply({
63
+ await send(() => client.permission.reply({
21
64
  requestID: input.requestID,
22
65
  directory: input.directory,
23
66
  reply: input.reply,
24
67
  interactive: true,
25
68
  ...(input.message ? { message: input.message } : {}),
26
- }, { throwOnError: true, signal: AbortSignal.timeout(budget()) });
69
+ }, { throwOnError: true, signal: AbortSignal.timeout(budget()) }), budget);
27
70
  return { saved };
28
71
  }
29
72
  catch (error) {
@@ -2172,7 +2172,7 @@ export declare class Marketplace extends HeyApiClient {
2172
2172
  /**
2173
2173
  * Install a marketplace item
2174
2174
  *
2175
- * Install a marketplace MCP server, agent, or skill into project or global Kilo config.
2175
+ * Install a marketplace MCP server, agent, skill, or plugin into project or global Kilo config.
2176
2176
  */
2177
2177
  install<ThrowOnError extends boolean = false>(parameters: {
2178
2178
  directory?: string;
@@ -2186,7 +2186,7 @@ export declare class Marketplace extends HeyApiClient {
2186
2186
  /**
2187
2187
  * Remove a marketplace item
2188
2188
  *
2189
- * Remove a marketplace MCP server, agent, or skill from project or global Kilo config.
2189
+ * Remove a marketplace MCP server, agent, skill, or plugin from project or global Kilo config.
2190
2190
  */
2191
2191
  remove<ThrowOnError extends boolean = false>(parameters: {
2192
2192
  directory?: string;
@@ -2417,7 +2417,7 @@ export declare class SessionImport extends HeyApiClient {
2417
2417
  partID?: string;
2418
2418
  snapshot?: string;
2419
2419
  diff?: string;
2420
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2420
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2421
2421
  };
2422
2422
  permission?: {
2423
2423
  [key: string]: unknown;
@@ -4357,7 +4357,7 @@ export class Marketplace extends HeyApiClient {
4357
4357
  /**
4358
4358
  * Install a marketplace item
4359
4359
  *
4360
- * Install a marketplace MCP server, agent, or skill into project or global Kilo config.
4360
+ * Install a marketplace MCP server, agent, skill, or plugin into project or global Kilo config.
4361
4361
  */
4362
4362
  install(parameters, options) {
4363
4363
  const params = buildClientParams([parameters], [
@@ -4385,7 +4385,7 @@ export class Marketplace extends HeyApiClient {
4385
4385
  /**
4386
4386
  * Remove a marketplace item
4387
4387
  *
4388
- * Remove a marketplace MCP server, agent, or skill from project or global Kilo config.
4388
+ * Remove a marketplace MCP server, agent, skill, or plugin from project or global Kilo config.
4389
4389
  */
4390
4390
  remove(parameters, options) {
4391
4391
  const params = buildClientParams([parameters], [
@@ -272,7 +272,7 @@ export type Session = {
272
272
  partID?: string;
273
273
  snapshot?: string;
274
274
  diff?: string;
275
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
275
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
276
276
  };
277
277
  };
278
278
  export type OutputFormatText = {
@@ -2278,7 +2278,7 @@ export type GlobalSession = {
2278
2278
  partID?: string;
2279
2279
  snapshot?: string;
2280
2280
  diff?: string;
2281
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2281
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2282
2282
  };
2283
2283
  project: ProjectSummary | null;
2284
2284
  worktreeName?: string;
@@ -2587,7 +2587,7 @@ export type Session1 = {
2587
2587
  partID?: string;
2588
2588
  snapshot?: string;
2589
2589
  diff?: string;
2590
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2590
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2591
2591
  };
2592
2592
  };
2593
2593
  export type Session2 = {
@@ -2640,7 +2640,7 @@ export type Session2 = {
2640
2640
  partID?: string;
2641
2641
  snapshot?: string;
2642
2642
  diff?: string;
2643
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2643
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2644
2644
  };
2645
2645
  };
2646
2646
  export type NotFoundError = {
@@ -2699,7 +2699,7 @@ export type Session3 = {
2699
2699
  partID?: string;
2700
2700
  snapshot?: string;
2701
2701
  diff?: string;
2702
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2702
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2703
2703
  };
2704
2704
  };
2705
2705
  export type Session4 = {
@@ -2752,7 +2752,7 @@ export type Session4 = {
2752
2752
  partID?: string;
2753
2753
  snapshot?: string;
2754
2754
  diff?: string;
2755
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2755
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2756
2756
  };
2757
2757
  };
2758
2758
  export type Session5 = {
@@ -2805,7 +2805,7 @@ export type Session5 = {
2805
2805
  partID?: string;
2806
2806
  snapshot?: string;
2807
2807
  diff?: string;
2808
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2808
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2809
2809
  };
2810
2810
  };
2811
2811
  export type Session6 = {
@@ -2858,7 +2858,7 @@ export type Session6 = {
2858
2858
  partID?: string;
2859
2859
  snapshot?: string;
2860
2860
  diff?: string;
2861
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2861
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2862
2862
  };
2863
2863
  };
2864
2864
  export type Session7 = {
@@ -2911,7 +2911,7 @@ export type Session7 = {
2911
2911
  partID?: string;
2912
2912
  snapshot?: string;
2913
2913
  diff?: string;
2914
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
2914
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
2915
2915
  };
2916
2916
  };
2917
2917
  export type TextPartInput = {
@@ -3014,7 +3014,7 @@ export type Session8 = {
3014
3014
  partID?: string;
3015
3015
  snapshot?: string;
3016
3016
  diff?: string;
3017
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
3017
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
3018
3018
  };
3019
3019
  };
3020
3020
  export type Session9 = {
@@ -3067,7 +3067,7 @@ export type Session9 = {
3067
3067
  partID?: string;
3068
3068
  snapshot?: string;
3069
3069
  diff?: string;
3070
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
3070
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
3071
3071
  };
3072
3072
  };
3073
3073
  export type EventTuiPromptAppend2 = {
@@ -3449,7 +3449,20 @@ export type SkillMarketplaceItem = {
3449
3449
  displayName: string;
3450
3450
  displayCategory: string;
3451
3451
  };
3452
- export type MarketplaceItem = McpMarketplaceItem | AgentMarketplaceItem | SkillMarketplaceItem;
3452
+ export type PluginMarketplaceItem = {
3453
+ id: string;
3454
+ name: string;
3455
+ description: string;
3456
+ category: string;
3457
+ author?: string;
3458
+ authorUrl?: string;
3459
+ prerequisites?: Array<string>;
3460
+ suggest_for?: MarketplaceSuggestFor;
3461
+ type: "plugin";
3462
+ content: string;
3463
+ url?: string;
3464
+ };
3465
+ export type MarketplaceItem = McpMarketplaceItem | AgentMarketplaceItem | SkillMarketplaceItem | PluginMarketplaceItem;
3453
3466
  export type MarketplaceInstalledMetadata = {
3454
3467
  project: {
3455
3468
  [key: string]: {
@@ -3500,17 +3513,23 @@ export type SkillInstallItem = {
3500
3513
  id: string;
3501
3514
  content: string;
3502
3515
  };
3503
- export type MarketplaceInstallItem = McpInstallItem | AgentInstallItem | SkillInstallItem;
3516
+ export type PluginInstallItem = {
3517
+ type: "plugin";
3518
+ id: string;
3519
+ content: string;
3520
+ };
3521
+ export type MarketplaceInstallItem = McpInstallItem | AgentInstallItem | SkillInstallItem | PluginInstallItem;
3504
3522
  export type MarketplaceInstallResult = {
3505
3523
  success: boolean;
3506
3524
  slug: string;
3507
3525
  error?: string;
3508
3526
  filePath?: string;
3527
+ filePaths?: Array<string>;
3509
3528
  line?: number;
3510
3529
  };
3511
3530
  export type MarketplaceItemRef = {
3512
3531
  id: string;
3513
- type: "mcp" | "agent" | "skill";
3532
+ type: "mcp" | "agent" | "skill" | "plugin";
3514
3533
  };
3515
3534
  export type MarketplaceRemoveResult = {
3516
3535
  success: boolean;
@@ -4831,7 +4850,7 @@ export type RevertState = {
4831
4850
  snapshot?: string;
4832
4851
  diff?: string;
4833
4852
  files?: Array<FileDiff>;
4834
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
4853
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
4835
4854
  };
4836
4855
  export type EventSessionNextRevertStaged = {
4837
4856
  id: string;
@@ -14893,6 +14912,7 @@ export type KilocodeSessionModelUsageResponses = {
14893
14912
  */
14894
14913
  200: {
14895
14914
  sessionIDs: Array<string>;
14915
+ sessionCost?: number;
14896
14916
  totals: {
14897
14917
  steps: number;
14898
14918
  cost: number;
@@ -15611,7 +15631,7 @@ export type KilocodeSessionImportSessionData = {
15611
15631
  partID?: string;
15612
15632
  snapshot?: string;
15613
15633
  diff?: string;
15614
- workspace?: "restored" | "snapshots-disabled" | "unavailable";
15634
+ workspace?: "restored" | "snapshots-disabled" | "unavailable" | "not-a-git-repo";
15615
15635
  };
15616
15636
  permission?: {
15617
15637
  [key: string]: unknown;
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.7.6",
4
+ "version": "7.7.9",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {