@blankline/dropstone-sdk 1.0.8

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 (80) hide show
  1. package/README.md +146 -0
  2. package/dist/api.d.ts +118 -0
  3. package/dist/api.js +125 -0
  4. package/dist/client.d.ts +7 -0
  5. package/dist/client.js +51 -0
  6. package/dist/gen/client/client.gen.d.ts +2 -0
  7. package/dist/gen/client/client.gen.js +165 -0
  8. package/dist/gen/client/index.d.ts +7 -0
  9. package/dist/gen/client/index.js +5 -0
  10. package/dist/gen/client/types.gen.d.ts +127 -0
  11. package/dist/gen/client/types.gen.js +2 -0
  12. package/dist/gen/client/utils.gen.d.ts +38 -0
  13. package/dist/gen/client/utils.gen.js +226 -0
  14. package/dist/gen/client.gen.d.ts +12 -0
  15. package/dist/gen/client.gen.js +5 -0
  16. package/dist/gen/core/auth.gen.d.ts +18 -0
  17. package/dist/gen/core/auth.gen.js +14 -0
  18. package/dist/gen/core/bodySerializer.gen.d.ts +17 -0
  19. package/dist/gen/core/bodySerializer.gen.js +57 -0
  20. package/dist/gen/core/params.gen.d.ts +33 -0
  21. package/dist/gen/core/params.gen.js +89 -0
  22. package/dist/gen/core/pathSerializer.gen.d.ts +33 -0
  23. package/dist/gen/core/pathSerializer.gen.js +106 -0
  24. package/dist/gen/core/queryKeySerializer.gen.d.ts +18 -0
  25. package/dist/gen/core/queryKeySerializer.gen.js +93 -0
  26. package/dist/gen/core/serverSentEvents.gen.d.ts +59 -0
  27. package/dist/gen/core/serverSentEvents.gen.js +117 -0
  28. package/dist/gen/core/types.gen.d.ts +78 -0
  29. package/dist/gen/core/types.gen.js +2 -0
  30. package/dist/gen/core/utils.gen.d.ts +14 -0
  31. package/dist/gen/core/utils.gen.js +69 -0
  32. package/dist/gen/sdk.gen.d.ts +403 -0
  33. package/dist/gen/sdk.gen.js +881 -0
  34. package/dist/gen/types.gen.d.ts +3380 -0
  35. package/dist/gen/types.gen.js +2 -0
  36. package/dist/index.d.ts +11 -0
  37. package/dist/index.js +17 -0
  38. package/dist/process.d.ts +3 -0
  39. package/dist/process.js +33 -0
  40. package/dist/server.d.ts +23 -0
  41. package/dist/server.js +105 -0
  42. package/dist/v2/client.d.ts +8 -0
  43. package/dist/v2/client.js +96 -0
  44. package/dist/v2/data.d.ts +9 -0
  45. package/dist/v2/data.js +22 -0
  46. package/dist/v2/gen/client/client.gen.d.ts +2 -0
  47. package/dist/v2/gen/client/client.gen.js +232 -0
  48. package/dist/v2/gen/client/index.d.ts +8 -0
  49. package/dist/v2/gen/client/index.js +6 -0
  50. package/dist/v2/gen/client/types.gen.d.ts +117 -0
  51. package/dist/v2/gen/client/types.gen.js +2 -0
  52. package/dist/v2/gen/client/utils.gen.d.ts +33 -0
  53. package/dist/v2/gen/client/utils.gen.js +226 -0
  54. package/dist/v2/gen/client.gen.d.ts +12 -0
  55. package/dist/v2/gen/client.gen.js +3 -0
  56. package/dist/v2/gen/core/auth.gen.d.ts +18 -0
  57. package/dist/v2/gen/core/auth.gen.js +14 -0
  58. package/dist/v2/gen/core/bodySerializer.gen.d.ts +25 -0
  59. package/dist/v2/gen/core/bodySerializer.gen.js +57 -0
  60. package/dist/v2/gen/core/params.gen.d.ts +43 -0
  61. package/dist/v2/gen/core/params.gen.js +102 -0
  62. package/dist/v2/gen/core/pathSerializer.gen.d.ts +33 -0
  63. package/dist/v2/gen/core/pathSerializer.gen.js +106 -0
  64. package/dist/v2/gen/core/queryKeySerializer.gen.d.ts +18 -0
  65. package/dist/v2/gen/core/queryKeySerializer.gen.js +93 -0
  66. package/dist/v2/gen/core/serverSentEvents.gen.d.ts +71 -0
  67. package/dist/v2/gen/core/serverSentEvents.gen.js +133 -0
  68. package/dist/v2/gen/core/types.gen.d.ts +78 -0
  69. package/dist/v2/gen/core/types.gen.js +2 -0
  70. package/dist/v2/gen/core/utils.gen.d.ts +19 -0
  71. package/dist/v2/gen/core/utils.gen.js +87 -0
  72. package/dist/v2/gen/sdk.gen.d.ts +1549 -0
  73. package/dist/v2/gen/sdk.gen.js +3146 -0
  74. package/dist/v2/gen/types.gen.d.ts +5749 -0
  75. package/dist/v2/gen/types.gen.js +2 -0
  76. package/dist/v2/index.d.ts +11 -0
  77. package/dist/v2/index.js +17 -0
  78. package/dist/v2/server.d.ts +23 -0
  79. package/dist/v2/server.js +105 -0
  80. package/package.json +86 -0
@@ -0,0 +1,2 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export {};
@@ -0,0 +1,11 @@
1
+ export * from "./client.js";
2
+ export * from "./server.js";
3
+ import type { ServerOptions } from "./server.js";
4
+ export * as data from "./data.js";
5
+ export declare function createDropstone(options?: ServerOptions): Promise<{
6
+ client: import("./client.js").DropstoneClient;
7
+ server: {
8
+ url: string;
9
+ close(): void;
10
+ };
11
+ }>;
@@ -0,0 +1,17 @@
1
+ export * from "./client.js";
2
+ export * from "./server.js";
3
+ import { createDropstoneClient } from "./client.js";
4
+ import { createDropstoneServer } from "./server.js";
5
+ export * as data from "./data.js";
6
+ export async function createDropstone(options) {
7
+ const server = await createDropstoneServer({
8
+ ...options,
9
+ });
10
+ const client = createDropstoneClient({
11
+ baseUrl: server.url,
12
+ });
13
+ return {
14
+ client,
15
+ server,
16
+ };
17
+ }
@@ -0,0 +1,23 @@
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 createDropstoneServer(options?: ServerOptions): Promise<{
18
+ url: string;
19
+ close(): void;
20
+ }>;
21
+ export declare function createDropstoneTui(options?: TuiOptions): {
22
+ close(): void;
23
+ };
@@ -0,0 +1,105 @@
1
+ import launch from "cross-spawn";
2
+ import { stop, bindAbort } from "../process.js";
3
+ export async function createDropstoneServer(options) {
4
+ options = Object.assign({
5
+ hostname: "127.0.0.1",
6
+ port: 4096,
7
+ timeout: 5000,
8
+ }, options ?? {});
9
+ const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
10
+ if (options.config?.logLevel)
11
+ args.push(`--log-level=${options.config.logLevel}`);
12
+ const proc = launch(`dropstone`, args, {
13
+ env: {
14
+ ...process.env,
15
+ DROPSTONE_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
16
+ },
17
+ });
18
+ let clear = () => { };
19
+ const url = await new Promise((resolve, reject) => {
20
+ const id = setTimeout(() => {
21
+ clear();
22
+ stop(proc);
23
+ reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
24
+ }, options.timeout);
25
+ let output = "";
26
+ let resolved = false;
27
+ proc.stdout?.on("data", (chunk) => {
28
+ if (resolved)
29
+ return;
30
+ output += chunk.toString();
31
+ const lines = output.split("\n");
32
+ for (const line of lines) {
33
+ if (line.startsWith("dropstone server listening")) {
34
+ const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
35
+ if (!match) {
36
+ clear();
37
+ stop(proc);
38
+ clearTimeout(id);
39
+ reject(new Error(`Failed to parse server url from output: ${line}`));
40
+ return;
41
+ }
42
+ clearTimeout(id);
43
+ resolved = true;
44
+ resolve(match[1]);
45
+ return;
46
+ }
47
+ }
48
+ });
49
+ proc.stderr?.on("data", (chunk) => {
50
+ output += chunk.toString();
51
+ });
52
+ proc.on("exit", (code) => {
53
+ clearTimeout(id);
54
+ let msg = `Server exited with code ${code}`;
55
+ if (output.trim()) {
56
+ msg += `\nServer output: ${output}`;
57
+ }
58
+ reject(new Error(msg));
59
+ });
60
+ proc.on("error", (error) => {
61
+ clearTimeout(id);
62
+ reject(error);
63
+ });
64
+ clear = bindAbort(proc, options.signal, () => {
65
+ clearTimeout(id);
66
+ reject(options.signal?.reason);
67
+ });
68
+ });
69
+ return {
70
+ url,
71
+ close() {
72
+ clear();
73
+ stop(proc);
74
+ },
75
+ };
76
+ }
77
+ export function createDropstoneTui(options) {
78
+ const args = [];
79
+ if (options?.project) {
80
+ args.push(`--project=${options.project}`);
81
+ }
82
+ if (options?.model) {
83
+ args.push(`--model=${options.model}`);
84
+ }
85
+ if (options?.session) {
86
+ args.push(`--session=${options.session}`);
87
+ }
88
+ if (options?.agent) {
89
+ args.push(`--agent=${options.agent}`);
90
+ }
91
+ const proc = launch(`dropstone`, args, {
92
+ stdio: "inherit",
93
+ env: {
94
+ ...process.env,
95
+ DROPSTONE_CONFIG_CONTENT: JSON.stringify(options?.config ?? {}),
96
+ },
97
+ });
98
+ const clear = bindAbort(proc, options?.signal);
99
+ return {
100
+ close() {
101
+ clear();
102
+ stop(proc);
103
+ },
104
+ };
105
+ }
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "@blankline/dropstone-sdk",
4
+ "version": "1.0.8",
5
+ "description": "TypeScript SDK for Dropstone CLI — programmatic access to the Dropstone agent server.",
6
+ "license": "MIT",
7
+ "homepage": "https://dropstone.io",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/blankline-org/dropstone-cli.git",
11
+ "directory": "packages/sdk/js"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/blankline-org/dropstone-cli/issues"
15
+ },
16
+ "keywords": [
17
+ "dropstone",
18
+ "ai",
19
+ "coding-agent",
20
+ "sdk",
21
+ "agent",
22
+ "llm",
23
+ "cli"
24
+ ],
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "scripts": {
28
+ "typecheck": "tsgo --noEmit",
29
+ "build": "bun ./script/build.ts",
30
+ "publish:npm": "bun ./script/publish.ts"
31
+ },
32
+ "exports": {
33
+ ".": {
34
+ "import": "./dist/index.js",
35
+ "types": "./dist/index.d.ts"
36
+ },
37
+ "./client": {
38
+ "import": "./dist/client.js",
39
+ "types": "./dist/client.d.ts"
40
+ },
41
+ "./server": {
42
+ "import": "./dist/server.js",
43
+ "types": "./dist/server.d.ts"
44
+ },
45
+ "./api": {
46
+ "import": "./dist/api.js",
47
+ "types": "./dist/api.d.ts"
48
+ },
49
+ "./v2": {
50
+ "import": "./dist/v2/index.js",
51
+ "types": "./dist/v2/index.d.ts"
52
+ },
53
+ "./v2/client": {
54
+ "import": "./dist/v2/client.js",
55
+ "types": "./dist/v2/client.d.ts"
56
+ },
57
+ "./v2/gen/client": {
58
+ "import": "./dist/v2/gen/client/index.js",
59
+ "types": "./dist/v2/gen/client/index.d.ts"
60
+ },
61
+ "./v2/server": {
62
+ "import": "./dist/v2/server.js",
63
+ "types": "./dist/v2/server.d.ts"
64
+ }
65
+ },
66
+ "files": [
67
+ "dist",
68
+ "README.md",
69
+ "LICENSE"
70
+ ],
71
+ "publishConfig": {
72
+ "access": "public",
73
+ "registry": "https://registry.npmjs.org/"
74
+ },
75
+ "devDependencies": {
76
+ "@hey-api/openapi-ts": "0.90.10",
77
+ "@tsconfig/node22": "22.0.2",
78
+ "@types/cross-spawn": "6.0.6",
79
+ "@types/node": "24.12.2",
80
+ "@typescript/native-preview": "7.0.0-dev.20251207.1",
81
+ "typescript": "5.8.2"
82
+ },
83
+ "dependencies": {
84
+ "cross-spawn": "7.0.6"
85
+ }
86
+ }