@kilocode/sdk 1.0.14 → 1.0.16

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.
Files changed (71) hide show
  1. package/package.json +1 -1
  2. package/dist/client.d.ts +0 -7
  3. package/dist/client.js +0 -25
  4. package/dist/gen/client/client.gen.d.ts +0 -2
  5. package/dist/gen/client/client.gen.js +0 -165
  6. package/dist/gen/client/index.d.ts +0 -7
  7. package/dist/gen/client/index.js +0 -5
  8. package/dist/gen/client/types.gen.d.ts +0 -127
  9. package/dist/gen/client/types.gen.js +0 -2
  10. package/dist/gen/client/utils.gen.d.ts +0 -38
  11. package/dist/gen/client/utils.gen.js +0 -226
  12. package/dist/gen/client.gen.d.ts +0 -12
  13. package/dist/gen/client.gen.js +0 -5
  14. package/dist/gen/core/auth.gen.d.ts +0 -18
  15. package/dist/gen/core/auth.gen.js +0 -14
  16. package/dist/gen/core/bodySerializer.gen.d.ts +0 -17
  17. package/dist/gen/core/bodySerializer.gen.js +0 -57
  18. package/dist/gen/core/params.gen.d.ts +0 -33
  19. package/dist/gen/core/params.gen.js +0 -89
  20. package/dist/gen/core/pathSerializer.gen.d.ts +0 -33
  21. package/dist/gen/core/pathSerializer.gen.js +0 -106
  22. package/dist/gen/core/serverSentEvents.gen.d.ts +0 -59
  23. package/dist/gen/core/serverSentEvents.gen.js +0 -117
  24. package/dist/gen/core/types.gen.d.ts +0 -78
  25. package/dist/gen/core/types.gen.js +0 -2
  26. package/dist/gen/core/utils.gen.d.ts +0 -14
  27. package/dist/gen/core/utils.gen.js +0 -69
  28. package/dist/gen/sdk.gen.d.ts +0 -403
  29. package/dist/gen/sdk.gen.js +0 -881
  30. package/dist/gen/types.gen.d.ts +0 -3380
  31. package/dist/gen/types.gen.js +0 -2
  32. package/dist/index.d.ts +0 -10
  33. package/dist/index.js +0 -16
  34. package/dist/server.d.ts +0 -24
  35. package/dist/server.js +0 -125
  36. package/dist/v2/client.d.ts +0 -7
  37. package/dist/v2/client.js +0 -27
  38. package/dist/v2/gen/client/client.gen.d.ts +0 -2
  39. package/dist/v2/gen/client/client.gen.js +0 -232
  40. package/dist/v2/gen/client/index.d.ts +0 -8
  41. package/dist/v2/gen/client/index.js +0 -6
  42. package/dist/v2/gen/client/types.gen.d.ts +0 -117
  43. package/dist/v2/gen/client/types.gen.js +0 -2
  44. package/dist/v2/gen/client/utils.gen.d.ts +0 -33
  45. package/dist/v2/gen/client/utils.gen.js +0 -226
  46. package/dist/v2/gen/client.gen.d.ts +0 -12
  47. package/dist/v2/gen/client.gen.js +0 -3
  48. package/dist/v2/gen/core/auth.gen.d.ts +0 -18
  49. package/dist/v2/gen/core/auth.gen.js +0 -14
  50. package/dist/v2/gen/core/bodySerializer.gen.d.ts +0 -25
  51. package/dist/v2/gen/core/bodySerializer.gen.js +0 -57
  52. package/dist/v2/gen/core/params.gen.d.ts +0 -43
  53. package/dist/v2/gen/core/params.gen.js +0 -102
  54. package/dist/v2/gen/core/pathSerializer.gen.d.ts +0 -33
  55. package/dist/v2/gen/core/pathSerializer.gen.js +0 -106
  56. package/dist/v2/gen/core/queryKeySerializer.gen.d.ts +0 -18
  57. package/dist/v2/gen/core/queryKeySerializer.gen.js +0 -93
  58. package/dist/v2/gen/core/serverSentEvents.gen.d.ts +0 -71
  59. package/dist/v2/gen/core/serverSentEvents.gen.js +0 -133
  60. package/dist/v2/gen/core/types.gen.d.ts +0 -78
  61. package/dist/v2/gen/core/types.gen.js +0 -2
  62. package/dist/v2/gen/core/utils.gen.d.ts +0 -19
  63. package/dist/v2/gen/core/utils.gen.js +0 -87
  64. package/dist/v2/gen/sdk.gen.d.ts +0 -1136
  65. package/dist/v2/gen/sdk.gen.js +0 -2209
  66. package/dist/v2/gen/types.gen.d.ts +0 -4424
  67. package/dist/v2/gen/types.gen.js +0 -2
  68. package/dist/v2/index.d.ts +0 -10
  69. package/dist/v2/index.js +0 -16
  70. package/dist/v2/server.d.ts +0 -24
  71. package/dist/v2/server.js +0 -125
@@ -1,2 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export {};
@@ -1,10 +0,0 @@
1
- export * from "./client.js";
2
- export * from "./server.js";
3
- import type { ServerOptions } from "./server.js";
4
- export declare function createOpencode(options?: ServerOptions): Promise<{
5
- client: import("./client.js").OpencodeClient;
6
- server: {
7
- url: string;
8
- close(): void;
9
- };
10
- }>;
package/dist/v2/index.js DELETED
@@ -1,16 +0,0 @@
1
- export * from "./client.js";
2
- export * from "./server.js";
3
- import { createOpencodeClient } from "./client.js";
4
- import { createOpencodeServer } from "./server.js";
5
- export async function createOpencode(options) {
6
- const server = await createOpencodeServer({
7
- ...options,
8
- });
9
- const client = createOpencodeClient({
10
- baseUrl: server.url,
11
- });
12
- return {
13
- client,
14
- server,
15
- };
16
- }
@@ -1,24 +0,0 @@
1
- import { type Config } from "./gen/types.gen.js";
2
- export declare function buildConfigEnv(config?: Config): string;
3
- export type ServerOptions = {
4
- hostname?: string;
5
- port?: number;
6
- signal?: AbortSignal;
7
- timeout?: number;
8
- config?: Config;
9
- };
10
- export type TuiOptions = {
11
- project?: string;
12
- model?: string;
13
- session?: string;
14
- agent?: string;
15
- signal?: AbortSignal;
16
- config?: Config;
17
- };
18
- export declare function createOpencodeServer(options?: ServerOptions): Promise<{
19
- url: string;
20
- close(): void;
21
- }>;
22
- export declare function createOpencodeTui(options?: TuiOptions): {
23
- close(): void;
24
- };
package/dist/v2/server.js DELETED
@@ -1,125 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- // kilocode_change start - Merge existing OPENCODE_CONFIG_CONTENT with new config
3
- // This preserves Kilocode-injected modes when spawning nested CLI instances
4
- function mergeConfig(existing, incoming) {
5
- const base = existing ?? {};
6
- const override = incoming ?? {};
7
- return {
8
- ...base,
9
- ...override,
10
- agent: { ...base.agent, ...override.agent },
11
- command: { ...base.command, ...override.command },
12
- mcp: { ...base.mcp, ...override.mcp },
13
- mode: { ...base.mode, ...override.mode },
14
- plugin: [...(base.plugin ?? []), ...(override.plugin ?? [])],
15
- instructions: [...(base.instructions ?? []), ...(override.instructions ?? [])],
16
- };
17
- }
18
- function parseExistingConfig() {
19
- const content = process.env.OPENCODE_CONFIG_CONTENT;
20
- if (!content)
21
- return undefined;
22
- try {
23
- return JSON.parse(content);
24
- }
25
- catch {
26
- return undefined;
27
- }
28
- }
29
- export function buildConfigEnv(config) {
30
- const merged = mergeConfig(parseExistingConfig(), config);
31
- return JSON.stringify(merged);
32
- }
33
- export async function createOpencodeServer(options) {
34
- options = Object.assign({
35
- hostname: "127.0.0.1",
36
- port: 4096,
37
- timeout: 5000,
38
- }, options ?? {});
39
- const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
40
- if (options.config?.logLevel)
41
- args.push(`--log-level=${options.config.logLevel}`);
42
- const proc = spawn(`opencode`, args, {
43
- signal: options.signal,
44
- env: {
45
- ...process.env,
46
- OPENCODE_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
47
- },
48
- });
49
- const url = await new Promise((resolve, reject) => {
50
- const id = setTimeout(() => {
51
- reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
52
- }, options.timeout);
53
- let output = "";
54
- proc.stdout?.on("data", (chunk) => {
55
- output += chunk.toString();
56
- const lines = output.split("\n");
57
- for (const line of lines) {
58
- if (line.startsWith("opencode server listening")) {
59
- const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
60
- if (!match) {
61
- throw new Error(`Failed to parse server url from output: ${line}`);
62
- }
63
- clearTimeout(id);
64
- resolve(match[1]);
65
- return;
66
- }
67
- }
68
- });
69
- proc.stderr?.on("data", (chunk) => {
70
- output += chunk.toString();
71
- });
72
- proc.on("exit", (code) => {
73
- clearTimeout(id);
74
- let msg = `Server exited with code ${code}`;
75
- if (output.trim()) {
76
- msg += `\nServer output: ${output}`;
77
- }
78
- reject(new Error(msg));
79
- });
80
- proc.on("error", (error) => {
81
- clearTimeout(id);
82
- reject(error);
83
- });
84
- if (options.signal) {
85
- options.signal.addEventListener("abort", () => {
86
- clearTimeout(id);
87
- reject(new Error("Aborted"));
88
- });
89
- }
90
- });
91
- return {
92
- url,
93
- close() {
94
- proc.kill();
95
- },
96
- };
97
- }
98
- export function createOpencodeTui(options) {
99
- const args = [];
100
- if (options?.project) {
101
- args.push(`--project=${options.project}`);
102
- }
103
- if (options?.model) {
104
- args.push(`--model=${options.model}`);
105
- }
106
- if (options?.session) {
107
- args.push(`--session=${options.session}`);
108
- }
109
- if (options?.agent) {
110
- args.push(`--agent=${options.agent}`);
111
- }
112
- const proc = spawn(`opencode`, args, {
113
- signal: options?.signal,
114
- stdio: "inherit",
115
- env: {
116
- ...process.env,
117
- OPENCODE_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
118
- },
119
- });
120
- return {
121
- close() {
122
- proc.kill();
123
- },
124
- };
125
- }