@kilocode/sdk 7.2.4 → 7.2.6
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 +26 -0
- package/dist/process.d.ts +3 -0
- package/dist/process.js +33 -0
- package/dist/server.js +27 -19
- package/dist/v2/client.js +40 -3
- package/dist/v2/gen/sdk.gen.d.ts +647 -581
- package/dist/v2/gen/sdk.gen.js +746 -614
- package/dist/v2/gen/types.gen.d.ts +1802 -1534
- package/dist/v2/server.js +25 -15
- package/package.json +7 -4
package/dist/v2/server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "7.2.6",
|
|
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": "
|
|
49
|
-
"
|
|
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",
|