@superglue/cli 1.1.34 → 1.1.36
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 +1 -1
- package/dist/cli.js +451 -161
- package/dist/skills/superglue/SKILL.md +29 -6
- package/dist/skills/superglue/references/file-handling.md +1 -1
- package/dist/skills/superglue/references/http.md +2 -2
- package/dist/skills/superglue/references/mongodb.md +2 -0
- package/dist/skills/superglue/references/mssql.md +3 -1
- package/dist/skills/superglue/references/odbc.md +2 -0
- package/dist/skills/superglue/references/postgres.md +2 -0
- package/dist/skills/superglue/references/redis.md +2 -0
- package/dist/skills/superglue/references/sftp-smb.md +2 -0
- package/dist/skills/superglue/references/superglue-info.md +0 -1
- package/package.json +2 -2
- package/skills/superglue/SKILL.md +29 -6
- package/skills/superglue/references/file-handling.md +1 -1
- package/skills/superglue/references/http.md +2 -2
- package/skills/superglue/references/mongodb.md +2 -0
- package/skills/superglue/references/mssql.md +3 -1
- package/skills/superglue/references/odbc.md +2 -0
- package/skills/superglue/references/postgres.md +2 -0
- package/skills/superglue/references/redis.md +2 -0
- package/skills/superglue/references/sftp-smb.md +2 -0
- package/skills/superglue/references/superglue-info.md +0 -1
|
@@ -218,7 +218,7 @@ Agents familiar with the web tool names can map them directly to CLI commands:
|
|
|
218
218
|
| `save_tool` | `sg tool save --draft <draftId>` | Persists a draft to the database |
|
|
219
219
|
| `run_command` with `vfs` for `/org/tools/` | `sg tool find --id <id>` / `sg tool find <q>` | Full config with `--id`, compact search with a query string |
|
|
220
220
|
| `create_system` | `sg system create --name "..." --url "..."` | Use `--template <id>` when available |
|
|
221
|
-
| `edit_system` | `sg system edit --id <id> ...` |
|
|
221
|
+
| `edit_system` | `sg system edit --id <id> ...` | Edits the system with that exact ID |
|
|
222
222
|
| `run_command` with `vfs` for `/org/systems/` | `sg system find <query>` / `--id <id>` | Returns secret-key presence and the system URL |
|
|
223
223
|
| Credentials VFS / saved credentials | `sg system credentials get/set/clear` | Manage the current user's credentials for a system |
|
|
224
224
|
| `call_system` | `sg system call --url "..." --system-id <id>` | Authenticated ad-hoc calls for testing / schema introspection |
|
|
@@ -267,7 +267,7 @@ sg system create --name "Slack" --template slack
|
|
|
267
267
|
sg system edit --id my_api --credentials '{...}'
|
|
268
268
|
sg system list
|
|
269
269
|
sg system find slack
|
|
270
|
-
sg system find --id my_api
|
|
270
|
+
sg system find --id my_api
|
|
271
271
|
sg system credentials get --system-id my_api
|
|
272
272
|
sg system credentials set --system-id my_api --credentials '{"api_key":"sk-xxx"}'
|
|
273
273
|
sg system credentials clear --system-id my_api
|
|
@@ -414,17 +414,38 @@ sourceData = {
|
|
|
414
414
|
// Current loop item (only set inside a looping step's config)
|
|
415
415
|
currentItem: { id: 1 },
|
|
416
416
|
|
|
417
|
+
// Persistent per-tool state (see Persistent Tool State)
|
|
418
|
+
persistedState: { lastSyncedAt: "..." },
|
|
419
|
+
|
|
417
420
|
// Credentials (flattened, namespaced)
|
|
418
421
|
my_api_access_token: "...",
|
|
419
422
|
my_api_api_key: "..."
|
|
420
423
|
}
|
|
421
424
|
```
|
|
422
425
|
|
|
426
|
+
### Persistent Tool State
|
|
427
|
+
|
|
428
|
+
`sourceData.persistedState` is a per-tool key-value object that persists across runs of a saved tool. It is loaded before the run starts and written back only after the workflow and run record complete successfully. A failed step that stops execution, failed output processing, cancellation, or run-finalization failure leaves the previous state unchanged. A step with `failureBehavior: "continue"` does not fail the run, so earlier state changes can still commit when the remaining workflow succeeds.
|
|
429
|
+
|
|
430
|
+
- Write it by setting keys inside a transform: `(sourceData) => { sourceData.persistedState.cursor = sourceData.fetchOrders.data.nextCursor; return sourceData.fetchOrders.data.items; }`. Never reassign `sourceData.persistedState` itself — whether reassignment takes effect depends on the execution context, so only key mutation is reliable.
|
|
431
|
+
- Read it anywhere: `<<(sourceData) => sourceData.persistedState.lastSyncedAt || "2024-01-01">>`. A tool's first run starts with `{}`, so every read needs a fallback.
|
|
432
|
+
- Inline runs (`sg tool run` with an unsaved config) start with empty state and do not persist it; only saved-tool runs (frontend, agent, REST, MCP, webhook, schedule, tool-chain) persist state.
|
|
433
|
+
- Limits: 100 keys, 64KB per value. Exceeding a limit rejects the entire state write and records a run warning — the run itself still succeeds.
|
|
434
|
+
- Concurrent runs of the same tool are reconciled per key with compare-and-set: if another run changed a key first, this run's value for that key is discarded and a run warning is recorded.
|
|
435
|
+
- Batch continuation: process a large import in manageable batches and save the next cursor, so each scheduled run continues where the previous run stopped.
|
|
436
|
+
- Polling-based change detection: poll an API on a schedule, compare its version or fingerprint with the previous result, and trigger follow-up work only when it changes. This is useful when the provider lacks the required webhook.
|
|
437
|
+
- Incremental syncs and dedupe: store a timestamp or cursor for new records, or a bounded set such as `persistedState.seenIds`.
|
|
438
|
+
- State gives at-least-once execution with progress tracking, never exactly-once: crashes, concurrent-run conflicts, and state resets all cause re-processing, which re-executes side effects. Steps that write to external systems MUST be replay-safe — upsert by a stable external id or pass an idempotency key — or duplicates will land in the target system.
|
|
439
|
+
- Keep set-valued keys bounded (e.g. keep only the most recent ~1,000 ids): an unbounded set eventually exceeds the 64KB value limit, which rejects the tool's entire state write on every run.
|
|
440
|
+
- Never copy credential values into state — state is stored unencrypted and readable by anyone with read access to the tool.
|
|
441
|
+
- Inspect current state via `sg tool state get <toolId>` (values matching known system credentials are masked); reset it via `sg tool state reset <toolId>`. A reset wins over in-flight runs: their updates to pre-reset keys are discarded as conflicts; only keys they newly add are kept.
|
|
442
|
+
- Set state deliberately via `sg tool state set <toolId> --state '<json>'` (or `--state-file`) — a full replace, subject to the same key and size limits. To test warm-state behavior without touching real state, pass `--state-fixture '<json>'` (or `--state-fixture-file`) to `sg tool run`: it seeds `sourceData.persistedState` for that run and the run never saves state changes. Side effects still execute, including `tool:` chain webhooks — a chained tool runs for real against its own real state.
|
|
443
|
+
|
|
423
444
|
### Naming Rules — Avoiding Key Collisions
|
|
424
445
|
|
|
425
446
|
Everything in `sourceData` shares ONE flat namespace. Saving a tool rejects payload input keys and step ids that collide with it:
|
|
426
447
|
|
|
427
|
-
- `__files__`, `currentItem`, `sg_auth_email`, `sg_auth_jwt` — injected by the runtime
|
|
448
|
+
- `__files__`, `currentItem`, `persistedState`, `sg_auth_email`, `sg_auth_jwt` — injected by the runtime
|
|
428
449
|
- `page`, `offset`, `cursor`, `limit`, `pageSize` — rejected only when the tool has a paginated step, because they would shadow the live pagination counters; on non-paginated tools they are allowed but discouraged (a later edit that adds pagination will force a rename)
|
|
429
450
|
- the tool's own step ids — the step result overwrites a same-named payload key
|
|
430
451
|
- anything starting with `<systemId>_` for a system the tool uses — the entire prefix is reserved for namespaced credentials (`<systemId>_<credKey>`, `<systemId>_url`), even names that don't match an existing credential, because credentials added to the system later would silently shadow the input
|
|
@@ -510,12 +531,14 @@ System id="stripe", selected credential has secret named: api_key
|
|
|
510
531
|
|
|
511
532
|
Basic auth auto-encodes: if the value after `Basic ` isn't already base64, the engine encodes it.
|
|
512
533
|
|
|
513
|
-
**System URL variables** — use these instead of hardcoding base URLs. They
|
|
534
|
+
**System URL variables** — use these instead of hardcoding base URLs. They resolve the URL of the exact referenced system ID:
|
|
514
535
|
|
|
515
536
|
```json
|
|
516
537
|
{ "url": "<<salesforce_url>>/services/data/v58.0/sobjects/Account" }
|
|
517
538
|
```
|
|
518
539
|
|
|
540
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Set an override with `sg system credentials set --system-id <id> --credentials '{...}' --url <url>` when each tenant has its own host; pass an empty string to clear it.
|
|
541
|
+
|
|
519
542
|
**Credential lifecycle:**
|
|
520
543
|
|
|
521
544
|
- Pass all secret values via `--credentials '{"api_key":"...","client_secret":"..."}'` on create/edit
|
|
@@ -538,7 +561,7 @@ sg system create --name "My API" --url https://api.example.com \
|
|
|
538
561
|
--credentials '{"client_id":"...","client_secret":"...","auth_url":"https://example.com/oauth/authorize","token_url":"https://example.com/oauth/token"}'
|
|
539
562
|
```
|
|
540
563
|
|
|
541
|
-
**
|
|
564
|
+
**Tags:** do not add tags by default. Add tags only when the user explicitly requests them or when existing systems show a clear tag or grouping convention that applies. Reuse exact existing tag values; do not invent new tags. Tags are metadata only. Tools and credentials always reference the exact system ID.
|
|
542
565
|
|
|
543
566
|
**System-specific instructions:** systems may include `specificInstructions` from the user (visible in `sg system find` output). Follow them when present — they override general patterns.
|
|
544
567
|
|
|
@@ -615,7 +638,7 @@ curl -X POST "https://api.superglue.cloud/v1/hooks/{toolId}?token=$SUPERGLUE_API
|
|
|
615
638
|
- **`<<currentItem.id>>`** — must use arrow function syntax: `<<(sourceData) => sourceData.currentItem.id>>`
|
|
616
639
|
- **Hardcoded pagination params** — use `<<page>>`, `<<offset>>`, `<<cursor>>`, `<<limit>>`
|
|
617
640
|
- **Missing auth headers** — credentials are never automatically included in any protocol, including for OAuth systems (only token refresh is automatic)
|
|
618
|
-
- **Hardcoded base URLs** — prefer system URL variables (`<<systemId_url>>`)
|
|
641
|
+
- **Hardcoded base URLs** — prefer system URL variables (`<<systemId_url>>`) so tools follow the referenced system's configured URL
|
|
619
642
|
- **Empty `instruction`** — never leave the tool-level `instruction` blank
|
|
620
643
|
- **Adding `outputSchema` unsolicited** — only add when the user explicitly requests a specific response structure
|
|
621
644
|
- **Multi-line `outputTransform`** — must be a single-line JS string (no literal newlines or tabs)
|
|
@@ -207,7 +207,7 @@ To make files downloadable from the tool's API response, set `outputFile: true`
|
|
|
207
207
|
"config": { "type": "request", "url": "https://api.example.com/report" }
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
|
-
"id": "
|
|
210
|
+
"id": "createCsv",
|
|
211
211
|
"config": {
|
|
212
212
|
"type": "transform",
|
|
213
213
|
"transformCode": "(sourceData) => ({ __files__: { \"report.csv\": Papa.unparse(sourceData.fetchData.data) } })"
|
|
@@ -164,7 +164,7 @@ XML responses are parsed into a JSON tree with ALL tag names normalized to UPPER
|
|
|
164
164
|
|
|
165
165
|
Non-2xx responses throw with method, URL, response body preview (1000 chars), masked config, and retry count. Any response with status in the 2xx range is treated as success and returned to the step as-is — the runtime does not scan successful response bodies for error fields, so APIs that return HTTP 200 with `{ "error": "..." }` must be handled by your transform or by setting a `stopCondition`/assertion at the step level.
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
Set step-level `failureBehavior: "continue"` to keep the workflow running after a non-2xx failure. The failure remains in `stepResults`.
|
|
168
168
|
|
|
169
169
|
### Retry Behavior
|
|
170
170
|
|
|
@@ -249,7 +249,7 @@ When an HTTP step downloads a file (PDF, CSV, binary response), set `outputFile:
|
|
|
249
249
|
## Common Pitfalls
|
|
250
250
|
|
|
251
251
|
- Hardcoding base URLs instead of using `<<systemId_url>>`.
|
|
252
|
-
- Wrong slash at the `<<systemId_url>>` join. The placeholder resolves to the
|
|
252
|
+
- Wrong slash at the `<<systemId_url>>` join. The placeholder resolves to the selected credential's `url` override when set, else the system's `url`, exactly as stored — it may or may not end in `/`. Read the `url` shown by `sg system find` and write the path so there is exactly one `/` between base and path: against a base with no trailing slash, `<<systemId_url>>crm/v3/...` becomes a broken host (`https://api.hubapi.comcrm/...`) that silently hits the wrong server; against a base ending in `/`, a leading `/` produces `//`.
|
|
253
253
|
- Forgetting auth headers entirely — nothing is injected automatically, including for OAuth systems (only token refresh is automatic)
|
|
254
254
|
- Forgetting `outputFile: true` on steps that download files the user wants
|
|
255
255
|
- Putting pagination variables in the config but not setting a `pagination` block, or vice versa
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for MongoDB steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
17
17
|
|
|
18
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
19
|
+
|
|
18
20
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for database steps.
|
|
19
21
|
|
|
20
22
|
### Fields
|
|
@@ -224,7 +226,7 @@ Defaults are tuned for Azure SQL; on-prem servers usually need adjustments:
|
|
|
224
226
|
- **Self-signed certificates** — on-prem servers rarely have CA-signed certs, so the default `trustServerCertificate=false` fails the TLS handshake. Add `?trustServerCertificate=true` (keeps encryption, skips CA validation).
|
|
225
227
|
- **Old SQL Server versions** — SQL Server 2008/2008 R2 without TLS 1.2 patches cannot complete a modern TLS handshake. Use `?encrypt=false` as a last resort, preferably only over the Secure Gateway tunnel.
|
|
226
228
|
- **Named instances** — use the `?instanceName=` query parameter (see URL Format above); remember SQL Browser (UDP 1434) is required for instance resolution and does not work through the Secure Gateway tunnel.
|
|
227
|
-
- **Firewalled servers** — on-prem databases are typically not internet-reachable; configure the system with a Secure Gateway tunnel.
|
|
229
|
+
- **Firewalled servers** — on-prem databases are typically not internet-reachable; configure the system with a Secure Gateway tunnel. Direct users to the setup guide at https://superglue.ai/docs/guides/secure-gateway/ — do not describe the setup flow from memory.
|
|
228
230
|
|
|
229
231
|
### Retry Behavior
|
|
230
232
|
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for database steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for database steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for Redis steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -15,6 +15,8 @@ FTP, SFTP, and SMB share an identical operation interface. Only the URL protocol
|
|
|
15
15
|
|
|
16
16
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
17
17
|
|
|
18
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
19
|
+
|
|
18
20
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for file server steps.
|
|
19
21
|
|
|
20
22
|
### Fields
|
|
@@ -69,7 +69,6 @@ The persistent left sidebar contains these top-level items:
|
|
|
69
69
|
- **Runs** (`/runs`, detail at `/runs/{runId}`) — execution history for full, draft, and single-step tool runs. Runs is a top-level sidebar item, not a Control Panel sub-item.
|
|
70
70
|
- **Control Panel** (`/admin`) — expandable group for organization and account administration:
|
|
71
71
|
- **Overview** (`/admin`) — dashboard summary, including failed-run and schedule summaries.
|
|
72
|
-
- **Landscape** (`/landscape`) — graph overview of tools, systems, and their connections.
|
|
73
72
|
- **Schedules** (`/admin?view=schedules`) — scheduled and recurring tool runs.
|
|
74
73
|
- **Access Rules** (`/admin/access`) — role and access-rule configuration; visible to admins on paid tiers. Use the access-rules reference for RBAC behavior, base roles, and personal roles.
|
|
75
74
|
- **Organization** (`/organization`) — visible on paid tiers as a standalone page without tabs. It shows members, invitations, role assignment, and member-management actions; management actions are admin-gated.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superglue/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sg": "./dist/cli.js"
|
|
6
6
|
},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"fast-json-patch": "3.1.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@superglue/shared": "file
|
|
18
|
+
"@superglue/shared": "file:../shared",
|
|
19
19
|
"@types/node": "25.5.0",
|
|
20
20
|
"tsup": "8.5.1",
|
|
21
21
|
"typescript": "5.8.3"
|
|
@@ -218,7 +218,7 @@ Agents familiar with the web tool names can map them directly to CLI commands:
|
|
|
218
218
|
| `save_tool` | `sg tool save --draft <draftId>` | Persists a draft to the database |
|
|
219
219
|
| `run_command` with `vfs` for `/org/tools/` | `sg tool find --id <id>` / `sg tool find <q>` | Full config with `--id`, compact search with a query string |
|
|
220
220
|
| `create_system` | `sg system create --name "..." --url "..."` | Use `--template <id>` when available |
|
|
221
|
-
| `edit_system` | `sg system edit --id <id> ...` |
|
|
221
|
+
| `edit_system` | `sg system edit --id <id> ...` | Edits the system with that exact ID |
|
|
222
222
|
| `run_command` with `vfs` for `/org/systems/` | `sg system find <query>` / `--id <id>` | Returns secret-key presence and the system URL |
|
|
223
223
|
| Credentials VFS / saved credentials | `sg system credentials get/set/clear` | Manage the current user's credentials for a system |
|
|
224
224
|
| `call_system` | `sg system call --url "..." --system-id <id>` | Authenticated ad-hoc calls for testing / schema introspection |
|
|
@@ -267,7 +267,7 @@ sg system create --name "Slack" --template slack
|
|
|
267
267
|
sg system edit --id my_api --credentials '{...}'
|
|
268
268
|
sg system list
|
|
269
269
|
sg system find slack
|
|
270
|
-
sg system find --id my_api
|
|
270
|
+
sg system find --id my_api
|
|
271
271
|
sg system credentials get --system-id my_api
|
|
272
272
|
sg system credentials set --system-id my_api --credentials '{"api_key":"sk-xxx"}'
|
|
273
273
|
sg system credentials clear --system-id my_api
|
|
@@ -414,17 +414,38 @@ sourceData = {
|
|
|
414
414
|
// Current loop item (only set inside a looping step's config)
|
|
415
415
|
currentItem: { id: 1 },
|
|
416
416
|
|
|
417
|
+
// Persistent per-tool state (see Persistent Tool State)
|
|
418
|
+
persistedState: { lastSyncedAt: "..." },
|
|
419
|
+
|
|
417
420
|
// Credentials (flattened, namespaced)
|
|
418
421
|
my_api_access_token: "...",
|
|
419
422
|
my_api_api_key: "..."
|
|
420
423
|
}
|
|
421
424
|
```
|
|
422
425
|
|
|
426
|
+
### Persistent Tool State
|
|
427
|
+
|
|
428
|
+
`sourceData.persistedState` is a per-tool key-value object that persists across runs of a saved tool. It is loaded before the run starts and written back only after the workflow and run record complete successfully. A failed step that stops execution, failed output processing, cancellation, or run-finalization failure leaves the previous state unchanged. A step with `failureBehavior: "continue"` does not fail the run, so earlier state changes can still commit when the remaining workflow succeeds.
|
|
429
|
+
|
|
430
|
+
- Write it by setting keys inside a transform: `(sourceData) => { sourceData.persistedState.cursor = sourceData.fetchOrders.data.nextCursor; return sourceData.fetchOrders.data.items; }`. Never reassign `sourceData.persistedState` itself — whether reassignment takes effect depends on the execution context, so only key mutation is reliable.
|
|
431
|
+
- Read it anywhere: `<<(sourceData) => sourceData.persistedState.lastSyncedAt || "2024-01-01">>`. A tool's first run starts with `{}`, so every read needs a fallback.
|
|
432
|
+
- Inline runs (`sg tool run` with an unsaved config) start with empty state and do not persist it; only saved-tool runs (frontend, agent, REST, MCP, webhook, schedule, tool-chain) persist state.
|
|
433
|
+
- Limits: 100 keys, 64KB per value. Exceeding a limit rejects the entire state write and records a run warning — the run itself still succeeds.
|
|
434
|
+
- Concurrent runs of the same tool are reconciled per key with compare-and-set: if another run changed a key first, this run's value for that key is discarded and a run warning is recorded.
|
|
435
|
+
- Batch continuation: process a large import in manageable batches and save the next cursor, so each scheduled run continues where the previous run stopped.
|
|
436
|
+
- Polling-based change detection: poll an API on a schedule, compare its version or fingerprint with the previous result, and trigger follow-up work only when it changes. This is useful when the provider lacks the required webhook.
|
|
437
|
+
- Incremental syncs and dedupe: store a timestamp or cursor for new records, or a bounded set such as `persistedState.seenIds`.
|
|
438
|
+
- State gives at-least-once execution with progress tracking, never exactly-once: crashes, concurrent-run conflicts, and state resets all cause re-processing, which re-executes side effects. Steps that write to external systems MUST be replay-safe — upsert by a stable external id or pass an idempotency key — or duplicates will land in the target system.
|
|
439
|
+
- Keep set-valued keys bounded (e.g. keep only the most recent ~1,000 ids): an unbounded set eventually exceeds the 64KB value limit, which rejects the tool's entire state write on every run.
|
|
440
|
+
- Never copy credential values into state — state is stored unencrypted and readable by anyone with read access to the tool.
|
|
441
|
+
- Inspect current state via `sg tool state get <toolId>` (values matching known system credentials are masked); reset it via `sg tool state reset <toolId>`. A reset wins over in-flight runs: their updates to pre-reset keys are discarded as conflicts; only keys they newly add are kept.
|
|
442
|
+
- Set state deliberately via `sg tool state set <toolId> --state '<json>'` (or `--state-file`) — a full replace, subject to the same key and size limits. To test warm-state behavior without touching real state, pass `--state-fixture '<json>'` (or `--state-fixture-file`) to `sg tool run`: it seeds `sourceData.persistedState` for that run and the run never saves state changes. Side effects still execute, including `tool:` chain webhooks — a chained tool runs for real against its own real state.
|
|
443
|
+
|
|
423
444
|
### Naming Rules — Avoiding Key Collisions
|
|
424
445
|
|
|
425
446
|
Everything in `sourceData` shares ONE flat namespace. Saving a tool rejects payload input keys and step ids that collide with it:
|
|
426
447
|
|
|
427
|
-
- `__files__`, `currentItem`, `sg_auth_email`, `sg_auth_jwt` — injected by the runtime
|
|
448
|
+
- `__files__`, `currentItem`, `persistedState`, `sg_auth_email`, `sg_auth_jwt` — injected by the runtime
|
|
428
449
|
- `page`, `offset`, `cursor`, `limit`, `pageSize` — rejected only when the tool has a paginated step, because they would shadow the live pagination counters; on non-paginated tools they are allowed but discouraged (a later edit that adds pagination will force a rename)
|
|
429
450
|
- the tool's own step ids — the step result overwrites a same-named payload key
|
|
430
451
|
- anything starting with `<systemId>_` for a system the tool uses — the entire prefix is reserved for namespaced credentials (`<systemId>_<credKey>`, `<systemId>_url`), even names that don't match an existing credential, because credentials added to the system later would silently shadow the input
|
|
@@ -510,12 +531,14 @@ System id="stripe", selected credential has secret named: api_key
|
|
|
510
531
|
|
|
511
532
|
Basic auth auto-encodes: if the value after `Basic ` isn't already base64, the engine encodes it.
|
|
512
533
|
|
|
513
|
-
**System URL variables** — use these instead of hardcoding base URLs. They
|
|
534
|
+
**System URL variables** — use these instead of hardcoding base URLs. They resolve the URL of the exact referenced system ID:
|
|
514
535
|
|
|
515
536
|
```json
|
|
516
537
|
{ "url": "<<salesforce_url>>/services/data/v58.0/sobjects/Account" }
|
|
517
538
|
```
|
|
518
539
|
|
|
540
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Set an override with `sg system credentials set --system-id <id> --credentials '{...}' --url <url>` when each tenant has its own host; pass an empty string to clear it.
|
|
541
|
+
|
|
519
542
|
**Credential lifecycle:**
|
|
520
543
|
|
|
521
544
|
- Pass all secret values via `--credentials '{"api_key":"...","client_secret":"..."}'` on create/edit
|
|
@@ -538,7 +561,7 @@ sg system create --name "My API" --url https://api.example.com \
|
|
|
538
561
|
--credentials '{"client_id":"...","client_secret":"...","auth_url":"https://example.com/oauth/authorize","token_url":"https://example.com/oauth/token"}'
|
|
539
562
|
```
|
|
540
563
|
|
|
541
|
-
**
|
|
564
|
+
**Tags:** do not add tags by default. Add tags only when the user explicitly requests them or when existing systems show a clear tag or grouping convention that applies. Reuse exact existing tag values; do not invent new tags. Tags are metadata only. Tools and credentials always reference the exact system ID.
|
|
542
565
|
|
|
543
566
|
**System-specific instructions:** systems may include `specificInstructions` from the user (visible in `sg system find` output). Follow them when present — they override general patterns.
|
|
544
567
|
|
|
@@ -615,7 +638,7 @@ curl -X POST "https://api.superglue.cloud/v1/hooks/{toolId}?token=$SUPERGLUE_API
|
|
|
615
638
|
- **`<<currentItem.id>>`** — must use arrow function syntax: `<<(sourceData) => sourceData.currentItem.id>>`
|
|
616
639
|
- **Hardcoded pagination params** — use `<<page>>`, `<<offset>>`, `<<cursor>>`, `<<limit>>`
|
|
617
640
|
- **Missing auth headers** — credentials are never automatically included in any protocol, including for OAuth systems (only token refresh is automatic)
|
|
618
|
-
- **Hardcoded base URLs** — prefer system URL variables (`<<systemId_url>>`)
|
|
641
|
+
- **Hardcoded base URLs** — prefer system URL variables (`<<systemId_url>>`) so tools follow the referenced system's configured URL
|
|
619
642
|
- **Empty `instruction`** — never leave the tool-level `instruction` blank
|
|
620
643
|
- **Adding `outputSchema` unsolicited** — only add when the user explicitly requests a specific response structure
|
|
621
644
|
- **Multi-line `outputTransform`** — must be a single-line JS string (no literal newlines or tabs)
|
|
@@ -207,7 +207,7 @@ To make files downloadable from the tool's API response, set `outputFile: true`
|
|
|
207
207
|
"config": { "type": "request", "url": "https://api.example.com/report" }
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
|
-
"id": "
|
|
210
|
+
"id": "createCsv",
|
|
211
211
|
"config": {
|
|
212
212
|
"type": "transform",
|
|
213
213
|
"transformCode": "(sourceData) => ({ __files__: { \"report.csv\": Papa.unparse(sourceData.fetchData.data) } })"
|
|
@@ -164,7 +164,7 @@ XML responses are parsed into a JSON tree with ALL tag names normalized to UPPER
|
|
|
164
164
|
|
|
165
165
|
Non-2xx responses throw with method, URL, response body preview (1000 chars), masked config, and retry count. Any response with status in the 2xx range is treated as success and returned to the step as-is — the runtime does not scan successful response bodies for error fields, so APIs that return HTTP 200 with `{ "error": "..." }` must be handled by your transform or by setting a `stopCondition`/assertion at the step level.
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
Set step-level `failureBehavior: "continue"` to keep the workflow running after a non-2xx failure. The failure remains in `stepResults`.
|
|
168
168
|
|
|
169
169
|
### Retry Behavior
|
|
170
170
|
|
|
@@ -249,7 +249,7 @@ When an HTTP step downloads a file (PDF, CSV, binary response), set `outputFile:
|
|
|
249
249
|
## Common Pitfalls
|
|
250
250
|
|
|
251
251
|
- Hardcoding base URLs instead of using `<<systemId_url>>`.
|
|
252
|
-
- Wrong slash at the `<<systemId_url>>` join. The placeholder resolves to the
|
|
252
|
+
- Wrong slash at the `<<systemId_url>>` join. The placeholder resolves to the selected credential's `url` override when set, else the system's `url`, exactly as stored — it may or may not end in `/`. Read the `url` shown by `sg system find` and write the path so there is exactly one `/` between base and path: against a base with no trailing slash, `<<systemId_url>>crm/v3/...` becomes a broken host (`https://api.hubapi.comcrm/...`) that silently hits the wrong server; against a base ending in `/`, a leading `/` produces `//`.
|
|
253
253
|
- Forgetting auth headers entirely — nothing is injected automatically, including for OAuth systems (only token refresh is automatic)
|
|
254
254
|
- Forgetting `outputFile: true` on steps that download files the user wants
|
|
255
255
|
- Putting pagination variables in the config but not setting a `pagination` block, or vice versa
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for MongoDB steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
17
17
|
|
|
18
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
19
|
+
|
|
18
20
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for database steps.
|
|
19
21
|
|
|
20
22
|
### Fields
|
|
@@ -224,7 +226,7 @@ Defaults are tuned for Azure SQL; on-prem servers usually need adjustments:
|
|
|
224
226
|
- **Self-signed certificates** — on-prem servers rarely have CA-signed certs, so the default `trustServerCertificate=false` fails the TLS handshake. Add `?trustServerCertificate=true` (keeps encryption, skips CA validation).
|
|
225
227
|
- **Old SQL Server versions** — SQL Server 2008/2008 R2 without TLS 1.2 patches cannot complete a modern TLS handshake. Use `?encrypt=false` as a last resort, preferably only over the Secure Gateway tunnel.
|
|
226
228
|
- **Named instances** — use the `?instanceName=` query parameter (see URL Format above); remember SQL Browser (UDP 1434) is required for instance resolution and does not work through the Secure Gateway tunnel.
|
|
227
|
-
- **Firewalled servers** — on-prem databases are typically not internet-reachable; configure the system with a Secure Gateway tunnel.
|
|
229
|
+
- **Firewalled servers** — on-prem databases are typically not internet-reachable; configure the system with a Secure Gateway tunnel. Direct users to the setup guide at https://superglue.ai/docs/guides/secure-gateway/ — do not describe the setup flow from memory.
|
|
228
230
|
|
|
229
231
|
### Retry Behavior
|
|
230
232
|
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for database steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for database steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
15
15
|
|
|
16
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
17
|
+
|
|
16
18
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for Redis steps.
|
|
17
19
|
|
|
18
20
|
### Fields
|
|
@@ -15,6 +15,8 @@ FTP, SFTP, and SMB share an identical operation interface. Only the URL protocol
|
|
|
15
15
|
|
|
16
16
|
Configure the connection URL based on the selected credential's secrets — use `sg system find` to inspect the available secret names and reference them accordingly.
|
|
17
17
|
|
|
18
|
+
`<<systemId_url>>` resolves to the selected credential's `url` override when one is set, else to the system `url`. Use it as the full connection string when each tenant has its own host; set the override with `sg system credentials set --url`.
|
|
19
|
+
|
|
18
20
|
`method`, `headers`, `queryParams`, and `pagination` are HTTP-only fields — omit them for file server steps.
|
|
19
21
|
|
|
20
22
|
### Fields
|
|
@@ -69,7 +69,6 @@ The persistent left sidebar contains these top-level items:
|
|
|
69
69
|
- **Runs** (`/runs`, detail at `/runs/{runId}`) — execution history for full, draft, and single-step tool runs. Runs is a top-level sidebar item, not a Control Panel sub-item.
|
|
70
70
|
- **Control Panel** (`/admin`) — expandable group for organization and account administration:
|
|
71
71
|
- **Overview** (`/admin`) — dashboard summary, including failed-run and schedule summaries.
|
|
72
|
-
- **Landscape** (`/landscape`) — graph overview of tools, systems, and their connections.
|
|
73
72
|
- **Schedules** (`/admin?view=schedules`) — scheduled and recurring tool runs.
|
|
74
73
|
- **Access Rules** (`/admin/access`) — role and access-rule configuration; visible to admins on paid tiers. Use the access-rules reference for RBAC behavior, base roles, and personal roles.
|
|
75
74
|
- **Organization** (`/organization`) — visible on paid tiers as a standalone page without tabs. It shows members, invitations, role assignment, and member-management actions; management actions are admin-gated.
|