@usestatemachines/sdk 0.1.1 → 0.2.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 (39) hide show
  1. package/README.md +175 -75
  2. package/agents/SKILL.md +24 -44
  3. package/agents/index.js +7 -7
  4. package/agents/llms.txt +18 -39
  5. package/agents/prompt.md +11 -34
  6. package/esm/extensions/apps.d.ts +8 -0
  7. package/esm/extensions/apps.js +23 -0
  8. package/esm/extensions/client.d.ts +33 -3
  9. package/esm/extensions/client.js +144 -28
  10. package/esm/extensions/errors.d.ts +24 -5
  11. package/esm/extensions/errors.js +3 -2
  12. package/esm/extensions/index.d.ts +3 -1
  13. package/esm/extensions/index.js +1 -0
  14. package/esm/extensions/running-environment.d.ts +29 -0
  15. package/esm/extensions/running-environment.js +35 -0
  16. package/esm/extensions/signal.d.ts +1 -2
  17. package/esm/extensions/signal.js +9 -4
  18. package/esm/extensions/wait.d.ts +1 -0
  19. package/esm/extensions/wait.js +1 -1
  20. package/esm/funcs/create-environment-definition.d.ts +11 -0
  21. package/esm/funcs/create-environment-definition.js +94 -0
  22. package/esm/lib/config.d.ts +2 -2
  23. package/esm/lib/config.js +2 -2
  24. package/esm/models/connection-secret.d.ts +16 -0
  25. package/esm/models/connection-secret.js +13 -0
  26. package/esm/models/connection.d.ts +14 -0
  27. package/esm/models/connection.js +14 -0
  28. package/esm/models/error-response.d.ts +4 -0
  29. package/esm/models/error-response.js +4 -0
  30. package/esm/models/operations/create-environment-definition.d.ts +143 -0
  31. package/esm/models/operations/create-environment-definition.js +90 -0
  32. package/esm/models/operations/index.d.ts +1 -0
  33. package/esm/models/operations/index.js +1 -0
  34. package/esm/models/operations/reveal-connection.d.ts +26 -4
  35. package/esm/models/operations/reveal-connection.js +28 -2
  36. package/esm/sdk/sdk.d.ts +3 -1
  37. package/esm/sdk/sdk.js +5 -0
  38. package/openapi.json +394 -7
  39. package/package.json +1 -1
package/openapi.json CHANGED
@@ -139,6 +139,49 @@
139
139
  "baseUrl": {
140
140
  "type": ["string", "null"]
141
141
  },
142
+ "connections": {
143
+ "items": {
144
+ "additionalProperties": false,
145
+ "properties": {
146
+ "actorId": {
147
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
148
+ "type": "string"
149
+ },
150
+ "authentication": {
151
+ "type": "string"
152
+ },
153
+ "key": {
154
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
155
+ "type": "string"
156
+ },
157
+ "parameters": {
158
+ "additionalProperties": {
159
+ "type": "string"
160
+ },
161
+ "type": "object"
162
+ },
163
+ "secrets": {
164
+ "items": {
165
+ "type": "string"
166
+ },
167
+ "type": "array"
168
+ }
169
+ },
170
+ "required": [
171
+ "key",
172
+ "actorId",
173
+ "authentication",
174
+ "parameters",
175
+ "secrets"
176
+ ],
177
+ "type": "object"
178
+ },
179
+ "type": "array"
180
+ },
181
+ "defaultConnection": {
182
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
183
+ "type": ["string", "null"]
184
+ },
142
185
  "environmentId": {
143
186
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
144
187
  "type": "string"
@@ -159,6 +202,8 @@
159
202
  "baseUrl",
160
203
  "expiresAt",
161
204
  "actors",
205
+ "connections",
206
+ "defaultConnection",
162
207
  "apis"
163
208
  ],
164
209
  "type": "object"
@@ -176,6 +221,10 @@
176
221
  "pattern": "^[a-z][a-z0-9-]{0,39}$",
177
222
  "type": "string"
178
223
  },
224
+ "connectionKey": {
225
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
226
+ "type": ["string", "null"]
227
+ },
179
228
  "environmentId": {
180
229
  "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
181
230
  "type": "string"
@@ -186,9 +235,44 @@
186
235
  "expiresAt": {
187
236
  "format": "date-time",
188
237
  "type": "string"
238
+ },
239
+ "native": {
240
+ "properties": {
241
+ "authentication": {
242
+ "type": "string"
243
+ },
244
+ "baseUrl": {
245
+ "type": "string"
246
+ },
247
+ "credentials": {
248
+ "additionalProperties": {
249
+ "type": "string"
250
+ },
251
+ "type": "object"
252
+ },
253
+ "key": {
254
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
255
+ "type": "string"
256
+ },
257
+ "parameters": {
258
+ "additionalProperties": {
259
+ "type": "string"
260
+ },
261
+ "type": "object"
262
+ }
263
+ },
264
+ "required": [
265
+ "key",
266
+ "authentication",
267
+ "baseUrl",
268
+ "parameters",
269
+ "credentials"
270
+ ],
271
+ "type": "object"
189
272
  }
190
273
  },
191
274
  "required": [
275
+ "connectionKey",
192
276
  "environmentId",
193
277
  "appKey",
194
278
  "actorId",
@@ -489,15 +573,19 @@
489
573
  "code": {
490
574
  "enum": [
491
575
  "body-too-large",
576
+ "connection-not-authorized",
492
577
  "connection-unavailable",
493
578
  "environment-limit",
494
579
  "forbidden",
495
580
  "idempotency-conflict",
496
581
  "identity-request-rejected",
582
+ "initialization-busy",
583
+ "initialization-unavailable",
497
584
  "internal-error",
498
585
  "invalid-cursor",
499
586
  "invalid-request",
500
587
  "invalid-response",
588
+ "invalid-setup",
501
589
  "invalid-webhook",
502
590
  "last-owner",
503
591
  "last-workspace",
@@ -1602,14 +1690,35 @@
1602
1690
  "content": {
1603
1691
  "application/json": {
1604
1692
  "schema": {
1605
- "properties": {
1606
- "actorId": {
1607
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
1608
- "type": "string"
1693
+ "anyOf": [
1694
+ {
1695
+ "additionalProperties": false,
1696
+ "properties": {
1697
+ "connectionKey": {
1698
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
1699
+ "type": "string"
1700
+ }
1701
+ },
1702
+ "required": ["connectionKey"],
1703
+ "type": "object"
1704
+ },
1705
+ {
1706
+ "additionalProperties": false,
1707
+ "properties": {
1708
+ "actorId": {
1709
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
1710
+ "type": "string"
1711
+ }
1712
+ },
1713
+ "required": ["actorId"],
1714
+ "type": "object"
1715
+ },
1716
+ {
1717
+ "additionalProperties": false,
1718
+ "properties": {},
1719
+ "type": "object"
1609
1720
  }
1610
- },
1611
- "required": ["actorId"],
1612
- "type": "object"
1721
+ ]
1613
1722
  }
1614
1723
  }
1615
1724
  },
@@ -2320,6 +2429,284 @@
2320
2429
  "x-state-credentials": ["user", "api_key"]
2321
2430
  }
2322
2431
  },
2432
+ "/v1/workspaces/{workspaceId}/environment-definitions": {
2433
+ "post": {
2434
+ "operationId": "createEnvironmentDefinition",
2435
+ "parameters": [
2436
+ {
2437
+ "in": "path",
2438
+ "name": "workspaceId",
2439
+ "required": true,
2440
+ "schema": {
2441
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
2442
+ "type": "string"
2443
+ }
2444
+ },
2445
+ {
2446
+ "in": "header",
2447
+ "name": "idempotency-key",
2448
+ "required": true,
2449
+ "schema": {
2450
+ "maxLength": 128,
2451
+ "minLength": 8,
2452
+ "pattern": "^[A-Za-z0-9._:-]+$",
2453
+ "type": "string"
2454
+ }
2455
+ }
2456
+ ],
2457
+ "requestBody": {
2458
+ "content": {
2459
+ "application/json": {
2460
+ "schema": {
2461
+ "anyOf": [
2462
+ {
2463
+ "additionalProperties": false,
2464
+ "properties": {
2465
+ "apps": {
2466
+ "anyOf": [
2467
+ {
2468
+ "items": {
2469
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
2470
+ "type": "string"
2471
+ },
2472
+ "maxItems": 10,
2473
+ "minItems": 1,
2474
+ "type": "array"
2475
+ },
2476
+ {
2477
+ "additionalProperties": {
2478
+ "additionalProperties": false,
2479
+ "properties": {
2480
+ "app": {
2481
+ "maxLength": 128,
2482
+ "minLength": 1,
2483
+ "type": "string"
2484
+ },
2485
+ "configure": {
2486
+ "additionalProperties": true,
2487
+ "description": "Native values validated by the selected replica release.",
2488
+ "type": "object"
2489
+ },
2490
+ "connections": {
2491
+ "additionalProperties": true,
2492
+ "description": "Native values validated by the selected replica release.",
2493
+ "type": "object"
2494
+ },
2495
+ "defaultConnection": {
2496
+ "pattern": "^[a-z][a-z0-9-]{0,39}$",
2497
+ "type": "string"
2498
+ },
2499
+ "preset": {
2500
+ "maxLength": 128,
2501
+ "minLength": 1,
2502
+ "type": "string"
2503
+ },
2504
+ "release": {
2505
+ "maxLength": 128,
2506
+ "minLength": 1,
2507
+ "type": "string"
2508
+ },
2509
+ "resources": {
2510
+ "additionalProperties": true,
2511
+ "description": "Native values validated by the selected replica release.",
2512
+ "type": "object"
2513
+ },
2514
+ "settings": {
2515
+ "additionalProperties": true,
2516
+ "description": "Native values validated by the selected replica release.",
2517
+ "type": "object"
2518
+ }
2519
+ },
2520
+ "required": ["app"],
2521
+ "type": "object"
2522
+ },
2523
+ "type": "object"
2524
+ }
2525
+ ]
2526
+ },
2527
+ "labels": {
2528
+ "additionalProperties": {
2529
+ "maxLength": 256,
2530
+ "type": "string"
2531
+ },
2532
+ "default": {},
2533
+ "type": "object"
2534
+ },
2535
+ "lifetimeMinutes": {
2536
+ "maximum": 1440,
2537
+ "minimum": 1,
2538
+ "type": "integer"
2539
+ },
2540
+ "name": {
2541
+ "maxLength": 120,
2542
+ "minLength": 1,
2543
+ "type": "string"
2544
+ },
2545
+ "version": {
2546
+ "default": 1,
2547
+ "enum": [1],
2548
+ "type": "number"
2549
+ }
2550
+ },
2551
+ "required": ["apps"],
2552
+ "type": "object"
2553
+ },
2554
+ {
2555
+ "additionalProperties": false,
2556
+ "properties": {
2557
+ "from": {
2558
+ "additionalProperties": false,
2559
+ "properties": {
2560
+ "snapshot": {
2561
+ "maxLength": 128,
2562
+ "minLength": 1,
2563
+ "type": "string"
2564
+ }
2565
+ },
2566
+ "required": ["snapshot"],
2567
+ "type": "object"
2568
+ },
2569
+ "version": {
2570
+ "default": 1,
2571
+ "enum": [1],
2572
+ "type": "number"
2573
+ }
2574
+ },
2575
+ "required": ["from"],
2576
+ "type": "object"
2577
+ }
2578
+ ]
2579
+ }
2580
+ }
2581
+ },
2582
+ "required": true
2583
+ },
2584
+ "responses": {
2585
+ "202": {
2586
+ "content": {
2587
+ "application/json": {
2588
+ "schema": {
2589
+ "properties": {
2590
+ "data": {
2591
+ "$ref": "#/components/schemas/Environment"
2592
+ }
2593
+ },
2594
+ "required": ["data"],
2595
+ "type": "object"
2596
+ }
2597
+ }
2598
+ },
2599
+ "description": "Environment accepted from its setup definition"
2600
+ },
2601
+ "400": {
2602
+ "content": {
2603
+ "application/json": {
2604
+ "schema": {
2605
+ "$ref": "#/components/schemas/ErrorResponse"
2606
+ }
2607
+ }
2608
+ },
2609
+ "description": "Invalid request"
2610
+ },
2611
+ "401": {
2612
+ "content": {
2613
+ "application/json": {
2614
+ "schema": {
2615
+ "$ref": "#/components/schemas/ErrorResponse"
2616
+ }
2617
+ }
2618
+ },
2619
+ "description": "Authentication required"
2620
+ },
2621
+ "403": {
2622
+ "content": {
2623
+ "application/json": {
2624
+ "schema": {
2625
+ "$ref": "#/components/schemas/ErrorResponse"
2626
+ }
2627
+ }
2628
+ },
2629
+ "description": "Permission denied"
2630
+ },
2631
+ "404": {
2632
+ "content": {
2633
+ "application/json": {
2634
+ "schema": {
2635
+ "$ref": "#/components/schemas/ErrorResponse"
2636
+ }
2637
+ }
2638
+ },
2639
+ "description": "Resource not found"
2640
+ },
2641
+ "409": {
2642
+ "content": {
2643
+ "application/json": {
2644
+ "schema": {
2645
+ "$ref": "#/components/schemas/ErrorResponse"
2646
+ }
2647
+ }
2648
+ },
2649
+ "description": "Conflicting request or version"
2650
+ },
2651
+ "413": {
2652
+ "content": {
2653
+ "application/json": {
2654
+ "schema": {
2655
+ "$ref": "#/components/schemas/ErrorResponse"
2656
+ }
2657
+ }
2658
+ },
2659
+ "description": "Request body too large"
2660
+ },
2661
+ "422": {
2662
+ "content": {
2663
+ "application/json": {
2664
+ "schema": {
2665
+ "$ref": "#/components/schemas/ErrorResponse"
2666
+ }
2667
+ }
2668
+ },
2669
+ "description": "Unsupported configuration"
2670
+ },
2671
+ "429": {
2672
+ "content": {
2673
+ "application/json": {
2674
+ "schema": {
2675
+ "$ref": "#/components/schemas/ErrorResponse"
2676
+ }
2677
+ }
2678
+ },
2679
+ "description": "Admission limit reached"
2680
+ },
2681
+ "500": {
2682
+ "content": {
2683
+ "application/json": {
2684
+ "schema": {
2685
+ "$ref": "#/components/schemas/ErrorResponse"
2686
+ }
2687
+ }
2688
+ },
2689
+ "description": "Unexpected failure"
2690
+ },
2691
+ "503": {
2692
+ "content": {
2693
+ "application/json": {
2694
+ "schema": {
2695
+ "$ref": "#/components/schemas/ErrorResponse"
2696
+ }
2697
+ }
2698
+ },
2699
+ "description": "Dependency unavailable"
2700
+ }
2701
+ },
2702
+ "security": [
2703
+ {
2704
+ "bearerAuth": []
2705
+ }
2706
+ ],
2707
+ "x-state-credentials": ["user", "api_key"]
2708
+ }
2709
+ },
2323
2710
  "/v1/workspaces/{workspaceId}/environments": {
2324
2711
  "get": {
2325
2712
  "operationId": "listEnvironments",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usestatemachines/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript SDK for State environments",
5
5
  "license": "MIT",
6
6
  "homepage": "https://usestatemachines.com",