@superglue/cli 1.1.0 → 1.1.2
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/.claude-plugin/plugin.json +20 -0
- package/LICENSE +21 -0
- package/README.md +34 -10
- package/dist/cli.js +346 -309
- package/dist/dist/cli.js +23616 -0
- package/dist/dist/skills/superglue/SKILL.md +624 -0
- package/dist/dist/skills/superglue/agents/openai.yaml +7 -0
- package/dist/dist/skills/superglue/assets/superglue.png +0 -0
- package/dist/dist/skills/superglue/references/databases.md +88 -0
- package/dist/dist/skills/superglue/references/file-servers.md +136 -0
- package/dist/dist/skills/superglue/references/integration.md +279 -0
- package/dist/dist/skills/superglue/references/transforms-and-output.md +92 -0
- package/dist/skills/superglue/SKILL.md +184 -235
- package/dist/skills/superglue/agents/openai.yaml +7 -0
- package/dist/skills/superglue/assets/superglue.png +0 -0
- package/dist/skills/superglue/references/integration.md +61 -56
- package/package.json +3 -3
- package/skills/superglue/SKILL.md +184 -235
- package/skills/superglue/agents/openai.yaml +7 -0
- package/skills/superglue/assets/superglue.png +0 -0
- package/skills/superglue/references/integration.md +61 -56
|
@@ -15,7 +15,7 @@ export SUPERGLUE_API_ENDPOINT="https://api.superglue.cloud"
|
|
|
15
15
|
curl -X POST "$SUPERGLUE_API_ENDPOINT/v1/tools/my-tool-id/run" \
|
|
16
16
|
-H "Authorization: Bearer $SUPERGLUE_API_KEY" \
|
|
17
17
|
-H "Content-Type: application/json" \
|
|
18
|
-
-d '{"inputs": {"userId": "123"}
|
|
18
|
+
-d '{"inputs": {"userId": "123"}}'
|
|
19
19
|
|
|
20
20
|
# Run a tool (async - returns immediately)
|
|
21
21
|
curl -X POST "$SUPERGLUE_API_ENDPOINT/v1/tools/my-tool-id/run" \
|
|
@@ -50,6 +50,7 @@ curl -X POST "$SUPERGLUE_API_ENDPOINT/v1/runs/{runId}/cancel" \
|
|
|
50
50
|
"toolId": "my-tool-id",
|
|
51
51
|
"status": "success",
|
|
52
52
|
"data": { "result": "..." },
|
|
53
|
+
"stepResults": [{ "stepId": "step-1", "success": true, "data": {} }],
|
|
53
54
|
"metadata": {
|
|
54
55
|
"startedAt": "2024-01-15T10:00:00Z",
|
|
55
56
|
"completedAt": "2024-01-15T10:00:05Z",
|
|
@@ -80,103 +81,118 @@ npm install @superglue/client
|
|
|
80
81
|
pip install superglue-client
|
|
81
82
|
```
|
|
82
83
|
|
|
84
|
+
Both SDKs are auto-generated from the OpenAPI spec (JS via orval, Python via openapi-python-client).
|
|
85
|
+
|
|
83
86
|
## TypeScript/JavaScript Usage
|
|
84
87
|
|
|
88
|
+
The JS SDK exports: `configure`, `listTools`, `getTool`, `runTool`, `getRun`, `cancelRun`, `triggerWebhook`, `listRuns`.
|
|
89
|
+
|
|
85
90
|
```typescript
|
|
86
|
-
import { configure,
|
|
91
|
+
import { configure, runTool, getRun, listTools, getTool } from "@superglue/client";
|
|
87
92
|
|
|
88
|
-
// Configure once at startup
|
|
89
93
|
configure({
|
|
90
|
-
apiKey: process.env.SUPERGLUE_API_KEY
|
|
91
|
-
baseUrl: "https://api.superglue.cloud/v1",
|
|
94
|
+
apiKey: process.env.SUPERGLUE_API_KEY!,
|
|
95
|
+
baseUrl: "https://api.superglue.cloud/v1",
|
|
92
96
|
});
|
|
97
|
+
```
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
### Run a Tool (Sync)
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const response = await runTool("my-tool-id", {
|
|
96
103
|
inputs: { userId: "123", date: "2024-01-15" },
|
|
97
|
-
options: { async: false },
|
|
98
104
|
});
|
|
99
105
|
|
|
100
|
-
if (
|
|
101
|
-
|
|
106
|
+
if (response.status === 200) {
|
|
107
|
+
const run = response.data;
|
|
108
|
+
console.log(run.status); // "success" | "failed"
|
|
109
|
+
console.log(run.data); // tool output
|
|
102
110
|
} else {
|
|
103
|
-
console.error(
|
|
111
|
+
console.error("Error:", response.data);
|
|
104
112
|
}
|
|
105
113
|
```
|
|
106
114
|
|
|
115
|
+
The response is `{ data: Run, status: number, headers: Headers }`. The `Run` object has: `runId`, `toolId`, `status`, `data`, `error`, `stepResults`, `metadata`.
|
|
116
|
+
|
|
107
117
|
### Async Execution (Fire-and-Forget)
|
|
108
118
|
|
|
109
119
|
```typescript
|
|
110
|
-
|
|
111
|
-
const { data: run } = await runTool("my-tool-id", {
|
|
120
|
+
const response = await runTool("my-tool-id", {
|
|
112
121
|
inputs: { userId: "123" },
|
|
113
122
|
options: { async: true },
|
|
114
123
|
});
|
|
115
124
|
|
|
116
|
-
|
|
125
|
+
if (response.status === 202) {
|
|
126
|
+
const run = response.data;
|
|
127
|
+
console.log(`Run started: ${run.runId}`);
|
|
117
128
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
let latest = run;
|
|
130
|
+
while (latest.status === "running") {
|
|
131
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
132
|
+
const poll = await getRun(latest.runId);
|
|
133
|
+
latest = poll.data;
|
|
134
|
+
}
|
|
124
135
|
}
|
|
125
136
|
```
|
|
126
137
|
|
|
127
138
|
### List and Discover Tools
|
|
128
139
|
|
|
129
140
|
```typescript
|
|
130
|
-
import { listTools, getTool, listSystems } from "@superglue/client";
|
|
131
|
-
|
|
132
|
-
// List all tools
|
|
133
141
|
const { data: tools } = await listTools({ page: 1, limit: 50 });
|
|
134
142
|
console.log(tools.data);
|
|
135
143
|
|
|
136
|
-
// Get tool details (including inputSchema)
|
|
137
144
|
const { data: tool } = await getTool("my-tool-id");
|
|
138
145
|
console.log(tool.inputSchema);
|
|
139
|
-
|
|
140
|
-
// List systems
|
|
141
|
-
const { data: systems } = await listSystems();
|
|
142
146
|
```
|
|
143
147
|
|
|
144
148
|
## Python Usage
|
|
145
149
|
|
|
150
|
+
The Python SDK uses `AuthenticatedClient` with httpx. Functions are in `superglue_client.api.tools` and `superglue_client.api.runs`.
|
|
151
|
+
|
|
146
152
|
```python
|
|
147
153
|
import os
|
|
148
|
-
from superglue_client import
|
|
154
|
+
from superglue_client import AuthenticatedClient
|
|
149
155
|
from superglue_client.api.tools import run_tool, list_tools, get_tool
|
|
150
156
|
from superglue_client.api.runs import get_run
|
|
157
|
+
from superglue_client.models.run_request import RunRequest
|
|
158
|
+
from superglue_client.models.run_request_inputs import RunRequestInputs
|
|
151
159
|
|
|
152
|
-
|
|
153
|
-
client = SuperglueClient(
|
|
160
|
+
client = AuthenticatedClient(
|
|
154
161
|
base_url="https://api.superglue.cloud/v1",
|
|
155
|
-
token=os.environ["SUPERGLUE_API_KEY"]
|
|
162
|
+
token=os.environ["SUPERGLUE_API_KEY"],
|
|
156
163
|
)
|
|
164
|
+
```
|
|
157
165
|
|
|
158
|
-
|
|
166
|
+
### Run a Tool (Sync)
|
|
167
|
+
|
|
168
|
+
```python
|
|
159
169
|
with client as c:
|
|
160
170
|
result = run_tool.sync(
|
|
171
|
+
"my-tool-id",
|
|
161
172
|
client=c,
|
|
162
|
-
|
|
163
|
-
|
|
173
|
+
body=RunRequest(
|
|
174
|
+
inputs=RunRequestInputs.from_dict({"userId": "123"}),
|
|
175
|
+
),
|
|
164
176
|
)
|
|
165
177
|
|
|
166
|
-
if result.status == "success":
|
|
178
|
+
if hasattr(result, "status") and result.status == "success":
|
|
167
179
|
print(result.data)
|
|
168
|
-
|
|
180
|
+
elif hasattr(result, "error"):
|
|
169
181
|
print(result.error)
|
|
170
182
|
```
|
|
171
183
|
|
|
184
|
+
`sync()` returns `Run | Error | None`. Use `sync_detailed()` for the full `Response` wrapper with status code and headers.
|
|
185
|
+
|
|
172
186
|
### Async Python
|
|
173
187
|
|
|
174
188
|
```python
|
|
175
189
|
async with client as c:
|
|
176
190
|
result = await run_tool.asyncio(
|
|
191
|
+
"my-tool-id",
|
|
177
192
|
client=c,
|
|
178
|
-
|
|
179
|
-
|
|
193
|
+
body=RunRequest(
|
|
194
|
+
inputs=RunRequestInputs.from_dict({"userId": "123"}),
|
|
195
|
+
),
|
|
180
196
|
)
|
|
181
197
|
```
|
|
182
198
|
|
|
@@ -226,14 +242,16 @@ curl "https://api.superglue.cloud/v1/runs/{runId}" \
|
|
|
226
242
|
```typescript
|
|
227
243
|
async function runToolWithRetry(toolId: string, inputs: Record<string, any>, maxRetries = 3) {
|
|
228
244
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
229
|
-
const
|
|
245
|
+
const response = await runTool(toolId, { inputs });
|
|
230
246
|
|
|
231
|
-
if (
|
|
247
|
+
if (response.status === 200 && response.data.status === "success") {
|
|
248
|
+
return response.data;
|
|
249
|
+
}
|
|
232
250
|
|
|
233
|
-
|
|
234
|
-
|
|
251
|
+
if (response.data.error?.includes("validation")) {
|
|
252
|
+
throw new Error(response.data.error);
|
|
253
|
+
}
|
|
235
254
|
|
|
236
|
-
// Exponential backoff for transient errors
|
|
237
255
|
if (attempt < maxRetries) {
|
|
238
256
|
await new Promise((r) => setTimeout(r, 1000 * Math.pow(2, attempt)));
|
|
239
257
|
}
|
|
@@ -242,19 +260,6 @@ async function runToolWithRetry(toolId: string, inputs: Record<string, any>, max
|
|
|
242
260
|
}
|
|
243
261
|
```
|
|
244
262
|
|
|
245
|
-
### Fallback Pattern
|
|
246
|
-
|
|
247
|
-
```typescript
|
|
248
|
-
async function runWithFallback(inputs: Record<string, any>) {
|
|
249
|
-
const { data: primary } = await runTool("primary-tool", { inputs, options: { async: false } });
|
|
250
|
-
if (primary.status === "success") return primary;
|
|
251
|
-
|
|
252
|
-
console.warn("Primary tool failed, using fallback");
|
|
253
|
-
const { data: fallback } = await runTool("fallback-tool", { inputs, options: { async: false } });
|
|
254
|
-
return fallback;
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
263
|
## Environment Configuration
|
|
259
264
|
|
|
260
265
|
```bash
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superglue/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sg": "./dist/cli.js"
|
|
6
6
|
},
|
|
7
7
|
"files": [
|
|
8
|
+
".claude-plugin/",
|
|
8
9
|
"dist/",
|
|
9
10
|
"skills/",
|
|
10
|
-
"
|
|
11
|
+
"LICENSE"
|
|
11
12
|
],
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"commander": "^13.0.0",
|
|
14
15
|
"fast-json-patch": "^3.1.1"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@superglue/shared": "file:../shared",
|
|
18
18
|
"@types/node": "^20.0.0",
|
|
19
19
|
"tsup": "^8.0.0",
|
|
20
20
|
"typescript": "^5.0.0"
|