@ericsanchezok/synergy-sdk 0.0.3 → 1.0.0

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 (58) hide show
  1. package/dist/client.d.ts +3 -3
  2. package/dist/client.js +6 -4
  3. package/dist/gen/client/client.gen.js +92 -32
  4. package/dist/gen/client/index.d.ts +2 -1
  5. package/dist/gen/client/index.js +1 -0
  6. package/dist/gen/client/types.gen.d.ts +6 -16
  7. package/dist/gen/client/utils.gen.d.ts +7 -12
  8. package/dist/gen/client/utils.gen.js +32 -32
  9. package/dist/gen/client.gen.d.ts +3 -3
  10. package/dist/gen/client.gen.js +1 -3
  11. package/dist/gen/core/bodySerializer.gen.d.ts +12 -4
  12. package/dist/gen/core/params.gen.d.ts +10 -0
  13. package/dist/gen/core/params.gen.js +18 -5
  14. package/dist/gen/core/serverSentEvents.gen.d.ts +13 -1
  15. package/dist/gen/core/serverSentEvents.gen.js +16 -2
  16. package/dist/gen/core/types.gen.d.ts +12 -12
  17. package/dist/gen/core/utils.gen.d.ts +6 -1
  18. package/dist/gen/core/utils.gen.js +18 -0
  19. package/dist/gen/sdk.gen.d.ts +1713 -198
  20. package/dist/gen/sdk.gen.js +3312 -383
  21. package/dist/gen/types.gen.d.ts +5376 -1146
  22. package/package.json +2 -14
  23. package/dist/v2/client.d.ts +0 -11
  24. package/dist/v2/client.js +0 -29
  25. package/dist/v2/gen/client/client.gen.d.ts +0 -2
  26. package/dist/v2/gen/client/client.gen.js +0 -225
  27. package/dist/v2/gen/client/index.d.ts +0 -8
  28. package/dist/v2/gen/client/index.js +0 -6
  29. package/dist/v2/gen/client/types.gen.d.ts +0 -117
  30. package/dist/v2/gen/client/types.gen.js +0 -2
  31. package/dist/v2/gen/client/utils.gen.d.ts +0 -33
  32. package/dist/v2/gen/client/utils.gen.js +0 -226
  33. package/dist/v2/gen/client.gen.d.ts +0 -12
  34. package/dist/v2/gen/client.gen.js +0 -3
  35. package/dist/v2/gen/core/auth.gen.d.ts +0 -18
  36. package/dist/v2/gen/core/auth.gen.js +0 -14
  37. package/dist/v2/gen/core/bodySerializer.gen.d.ts +0 -25
  38. package/dist/v2/gen/core/bodySerializer.gen.js +0 -57
  39. package/dist/v2/gen/core/params.gen.d.ts +0 -43
  40. package/dist/v2/gen/core/params.gen.js +0 -102
  41. package/dist/v2/gen/core/pathSerializer.gen.d.ts +0 -33
  42. package/dist/v2/gen/core/pathSerializer.gen.js +0 -106
  43. package/dist/v2/gen/core/serverSentEvents.gen.d.ts +0 -71
  44. package/dist/v2/gen/core/serverSentEvents.gen.js +0 -131
  45. package/dist/v2/gen/core/types.gen.d.ts +0 -78
  46. package/dist/v2/gen/core/types.gen.js +0 -2
  47. package/dist/v2/gen/core/utils.gen.d.ts +0 -19
  48. package/dist/v2/gen/core/utils.gen.js +0 -87
  49. package/dist/v2/gen/sdk.gen.d.ts +0 -1114
  50. package/dist/v2/gen/sdk.gen.js +0 -2145
  51. package/dist/v2/gen/types.gen.d.ts +0 -4553
  52. package/dist/v2/gen/types.gen.js +0 -2
  53. package/dist/v2/index.d.ts +0 -12
  54. package/dist/v2/index.js +0 -18
  55. package/dist/v2/server.d.ts +0 -27
  56. package/dist/v2/server.js +0 -98
  57. /package/dist/{v2/gen → gen}/core/queryKeySerializer.gen.d.ts +0 -0
  58. /package/dist/{v2/gen → gen}/core/queryKeySerializer.gen.js +0 -0
@@ -1,2 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export {};
@@ -1,12 +0,0 @@
1
- export * from "./client.js";
2
- export * from "./server.js";
3
- import type { ServerOptions } from "./server.js";
4
- export declare function createSynergy(options?: ServerOptions): Promise<{
5
- client: import("./client.js").SynergyClient;
6
- server: {
7
- url: string;
8
- close(): void;
9
- };
10
- }>;
11
- /** @deprecated Use createSynergy instead */
12
- export declare const createOpencode: typeof createSynergy;
package/dist/v2/index.js DELETED
@@ -1,18 +0,0 @@
1
- export * from "./client.js";
2
- export * from "./server.js";
3
- import { createSynergyClient } from "./client.js";
4
- import { createSynergyServer } from "./server.js";
5
- export async function createSynergy(options) {
6
- const server = await createSynergyServer({
7
- ...options,
8
- });
9
- const client = createSynergyClient({
10
- baseUrl: server.url,
11
- });
12
- return {
13
- client,
14
- server,
15
- };
16
- }
17
- /** @deprecated Use createSynergy instead */
18
- export const createOpencode = createSynergy;
@@ -1,27 +0,0 @@
1
- import { type Config } from "./gen/types.gen.js";
2
- export type ServerOptions = {
3
- hostname?: string;
4
- port?: number;
5
- signal?: AbortSignal;
6
- timeout?: number;
7
- config?: Config;
8
- };
9
- export type TuiOptions = {
10
- project?: string;
11
- model?: string;
12
- session?: string;
13
- agent?: string;
14
- signal?: AbortSignal;
15
- config?: Config;
16
- };
17
- export declare function createSynergyServer(options?: ServerOptions): Promise<{
18
- url: string;
19
- close(): void;
20
- }>;
21
- /** @deprecated Use createSynergyServer instead */
22
- export declare const createOpencodeServer: typeof createSynergyServer;
23
- export declare function createSynergyTui(options?: TuiOptions): {
24
- close(): void;
25
- };
26
- /** @deprecated Use createSynergyTui instead */
27
- export declare const createOpencodeTui: typeof createSynergyTui;
package/dist/v2/server.js DELETED
@@ -1,98 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- export async function createSynergyServer(options) {
3
- options = Object.assign({
4
- hostname: "127.0.0.1",
5
- port: 4096,
6
- timeout: 5000,
7
- }, options ?? {});
8
- const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
9
- if (options.config?.logLevel)
10
- args.push(`--log-level=${options.config.logLevel}`);
11
- const proc = spawn(`synergy`, args, {
12
- signal: options.signal,
13
- env: {
14
- ...process.env,
15
- SYNERGY_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
16
- },
17
- });
18
- const url = await new Promise((resolve, reject) => {
19
- const id = setTimeout(() => {
20
- reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
21
- }, options.timeout);
22
- let output = "";
23
- proc.stdout?.on("data", (chunk) => {
24
- output += chunk.toString();
25
- const lines = output.split("\n");
26
- for (const line of lines) {
27
- if (line.startsWith("synergy server listening")) {
28
- const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
29
- if (!match) {
30
- throw new Error(`Failed to parse server url from output: ${line}`);
31
- }
32
- clearTimeout(id);
33
- resolve(match[1]);
34
- return;
35
- }
36
- }
37
- });
38
- proc.stderr?.on("data", (chunk) => {
39
- output += chunk.toString();
40
- });
41
- proc.on("exit", (code) => {
42
- clearTimeout(id);
43
- let msg = `Server exited with code ${code}`;
44
- if (output.trim()) {
45
- msg += `\nServer output: ${output}`;
46
- }
47
- reject(new Error(msg));
48
- });
49
- proc.on("error", (error) => {
50
- clearTimeout(id);
51
- reject(error);
52
- });
53
- if (options.signal) {
54
- options.signal.addEventListener("abort", () => {
55
- clearTimeout(id);
56
- reject(new Error("Aborted"));
57
- });
58
- }
59
- });
60
- return {
61
- url,
62
- close() {
63
- proc.kill();
64
- },
65
- };
66
- }
67
- /** @deprecated Use createSynergyServer instead */
68
- export const createOpencodeServer = createSynergyServer;
69
- export function createSynergyTui(options) {
70
- const args = [];
71
- if (options?.project) {
72
- args.push(`--project=${options.project}`);
73
- }
74
- if (options?.model) {
75
- args.push(`--model=${options.model}`);
76
- }
77
- if (options?.session) {
78
- args.push(`--session=${options.session}`);
79
- }
80
- if (options?.agent) {
81
- args.push(`--agent=${options.agent}`);
82
- }
83
- const proc = spawn(`synergy`, args, {
84
- signal: options?.signal,
85
- stdio: "inherit",
86
- env: {
87
- ...process.env,
88
- SYNERGY_CONFIG_CONTENT: JSON.stringify(options?.config ?? {}),
89
- },
90
- });
91
- return {
92
- close() {
93
- proc.kill();
94
- },
95
- };
96
- }
97
- /** @deprecated Use createSynergyTui instead */
98
- export const createOpencodeTui = createSynergyTui;