@idapt/browser-app-sdk 0.1.0 → 0.3.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.
package/dist/index.cjs CHANGED
@@ -691,6 +691,151 @@ function errorEvent(payload) {
691
691
  return event;
692
692
  }
693
693
 
694
+ // ../sdk/src/api/automations.ts
695
+ var AutomationsApi = class {
696
+ constructor(ctx) {
697
+ this.ctx = ctx;
698
+ }
699
+ // ---------------------------------------------------------------------------
700
+ // CRUD
701
+ // ---------------------------------------------------------------------------
702
+ async list(query = {}, opts = {}) {
703
+ const res = await request(this.ctx, {
704
+ method: "GET",
705
+ path: "/api/v1/automations",
706
+ query,
707
+ signal: opts.signal
708
+ });
709
+ return res.data;
710
+ }
711
+ /**
712
+ * Create an automation. `workspace_id` is passed in the request BODY
713
+ * alongside the flat automation definition — it is not a query param. The request
714
+ * body is flat: every scheduling field (`cron_expression`, …) and every
715
+ * action field (`agent_id`, `prompt_template`, `function_id`, …) sits at the
716
+ * top level — there are no nested `trigger_config` / `action_config`
717
+ * objects any more.
718
+ *
719
+ * For a webhook automation the response additionally carries a one-time
720
+ * plaintext `secret` (use `AutomationWithSecret`); other automation types
721
+ * resolve to a plain `Automation`.
722
+ */
723
+ async create(workspaceId, input, opts = {}) {
724
+ const res = await request(this.ctx, {
725
+ method: "POST",
726
+ path: "/api/v1/automations",
727
+ body: { workspace_id: workspaceId, ...input },
728
+ signal: opts.signal
729
+ });
730
+ return res.data;
731
+ }
732
+ async get(id, opts = {}) {
733
+ const res = await request(this.ctx, {
734
+ method: "GET",
735
+ path: `/api/v1/automations/${id}`,
736
+ signal: opts.signal
737
+ });
738
+ return res.data;
739
+ }
740
+ async update(id, input, opts = {}) {
741
+ const res = await request(this.ctx, {
742
+ method: "PATCH",
743
+ path: `/api/v1/automations/${id}`,
744
+ body: input,
745
+ signal: opts.signal
746
+ });
747
+ return res.data;
748
+ }
749
+ async delete(id, opts = {}) {
750
+ return request(this.ctx, {
751
+ method: "DELETE",
752
+ path: `/api/v1/automations/${id}`,
753
+ signal: opts.signal
754
+ });
755
+ }
756
+ async archive(id, opts = {}) {
757
+ const res = await request(this.ctx, {
758
+ method: "POST",
759
+ path: `/api/v1/automations/${id}/archive`,
760
+ signal: opts.signal
761
+ });
762
+ return res.data;
763
+ }
764
+ async unarchive(id, opts = {}) {
765
+ const res = await request(this.ctx, {
766
+ method: "POST",
767
+ path: `/api/v1/automations/${id}/unarchive`,
768
+ signal: opts.signal
769
+ });
770
+ return res.data;
771
+ }
772
+ // ---------------------------------------------------------------------------
773
+ // Fire + rotate-secret + runs
774
+ // ---------------------------------------------------------------------------
775
+ /**
776
+ * Fire an automation via its webhook secret. This endpoint does NOT use the
777
+ * client's `ap_` key — the bearer is the automation's secret — so we build a
778
+ * one-off HttpContext for it rather than mutating the shared one.
779
+ *
780
+ * Responds HTTP 202. The response identifies the fired automation via `id`
781
+ * only.
782
+ */
783
+ async fire(id, input, opts = {}) {
784
+ const localCtx = {
785
+ apiUrl: this.ctx.apiUrl,
786
+ key: input.secret,
787
+ fetch: this.ctx.fetch
788
+ };
789
+ const res = await request(localCtx, {
790
+ method: "POST",
791
+ path: `/api/v1/automations/${id}/fire`,
792
+ body: input.body ?? {},
793
+ signal: opts.signal
794
+ });
795
+ return res.data;
796
+ }
797
+ /**
798
+ * Rotate the webhook secret. Returns the automation with a fresh one-time
799
+ * plaintext `secret` populated (`AutomationWithSecret`). The old secret
800
+ * immediately stops working.
801
+ */
802
+ async rotateSecret(id, opts = {}) {
803
+ const res = await request(this.ctx, {
804
+ method: "POST",
805
+ path: `/api/v1/automations/${id}/rotate-secret`,
806
+ signal: opts.signal
807
+ });
808
+ return res.data;
809
+ }
810
+ /** Recent fires + their success/error outcome. */
811
+ async listRuns(id, query = {}, opts = {}) {
812
+ const res = await request(this.ctx, {
813
+ method: "GET",
814
+ path: `/api/v1/automations/${id}/runs`,
815
+ query,
816
+ signal: opts.signal
817
+ });
818
+ return res.data;
819
+ }
820
+ async getCostStats(id, opts = {}) {
821
+ const res = await request(this.ctx, {
822
+ method: "GET",
823
+ path: `/api/v1/automations/${id}/cost-stats`,
824
+ signal: opts.signal
825
+ });
826
+ return res.data;
827
+ }
828
+ async getCostStatsMap(query = {}, opts = {}) {
829
+ const res = await request(this.ctx, {
830
+ method: "GET",
831
+ path: "/api/v1/automations/cost-stats",
832
+ query,
833
+ signal: opts.signal
834
+ });
835
+ return res.data.by_id;
836
+ }
837
+ };
838
+
694
839
  // ../sdk/src/api/blobs.ts
695
840
  var enc = encodeURIComponent;
696
841
  var BlobsApi = class {
@@ -939,8 +1084,8 @@ async function executeCommand(binding, args = {}, ctx, opts = {}) {
939
1084
  }
940
1085
  async function awaitOperation(binding, operationId, ctx, opts = {}) {
941
1086
  const sleep = opts.sleep ?? defaultSleep;
942
- const interval = opts.pollIntervalMs ?? 1500;
943
- const maxAttempts = opts.maxPollAttempts ?? 120;
1087
+ const interval = opts.pollIntervalMs ?? binding.pollHint?.intervalMs ?? 1500;
1088
+ const maxAttempts = opts.maxPollAttempts ?? binding.pollHint?.maxAttempts ?? 120;
944
1089
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
945
1090
  if (opts.signal?.aborted) {
946
1091
  throw new IdaptError({
@@ -1238,6 +1383,143 @@ var COMMAND_BINDINGS = {
1238
1383
  "responseKind": "list",
1239
1384
  "async": false
1240
1385
  },
1386
+ "automation archive": {
1387
+ "command": "automation archive",
1388
+ "method": "POST",
1389
+ "path": "/automations/:id/archive",
1390
+ "pathParams": [
1391
+ "id"
1392
+ ],
1393
+ "argLocation": "body",
1394
+ "responseKind": "single",
1395
+ "async": false
1396
+ },
1397
+ "automation cost-stats": {
1398
+ "command": "automation cost-stats",
1399
+ "method": "GET",
1400
+ "path": "/automations/:id/cost-stats",
1401
+ "pathParams": [
1402
+ "id"
1403
+ ],
1404
+ "argLocation": "query",
1405
+ "responseKind": "single",
1406
+ "async": false
1407
+ },
1408
+ "automation cost-stats-all": {
1409
+ "command": "automation cost-stats-all",
1410
+ "method": "GET",
1411
+ "path": "/automations/cost-stats",
1412
+ "pathParams": [],
1413
+ "argLocation": "query",
1414
+ "responseKind": "single",
1415
+ "async": false
1416
+ },
1417
+ "automation create": {
1418
+ "command": "automation create",
1419
+ "method": "POST",
1420
+ "path": "/automations",
1421
+ "pathParams": [],
1422
+ "argLocation": "body",
1423
+ "responseKind": "created",
1424
+ "async": false
1425
+ },
1426
+ "automation delete": {
1427
+ "command": "automation delete",
1428
+ "method": "DELETE",
1429
+ "path": "/automations/:id",
1430
+ "pathParams": [
1431
+ "id"
1432
+ ],
1433
+ "argLocation": "body",
1434
+ "responseKind": "deleted",
1435
+ "async": false
1436
+ },
1437
+ "automation fire": {
1438
+ "command": "automation fire",
1439
+ "method": "POST",
1440
+ "path": "/automations/:id/fire",
1441
+ "pathParams": [
1442
+ "id"
1443
+ ],
1444
+ "argLocation": "body",
1445
+ "responseKind": "created",
1446
+ "async": true
1447
+ },
1448
+ "automation get": {
1449
+ "command": "automation get",
1450
+ "method": "GET",
1451
+ "path": "/automations/:id",
1452
+ "pathParams": [
1453
+ "id"
1454
+ ],
1455
+ "argLocation": "query",
1456
+ "responseKind": "single",
1457
+ "async": false
1458
+ },
1459
+ "automation list": {
1460
+ "command": "automation list",
1461
+ "method": "GET",
1462
+ "path": "/automations",
1463
+ "pathParams": [],
1464
+ "argLocation": "query",
1465
+ "responseKind": "list",
1466
+ "async": false
1467
+ },
1468
+ "automation rotate-secret": {
1469
+ "command": "automation rotate-secret",
1470
+ "method": "POST",
1471
+ "path": "/automations/:id/rotate-secret",
1472
+ "pathParams": [
1473
+ "id"
1474
+ ],
1475
+ "argLocation": "body",
1476
+ "responseKind": "single",
1477
+ "async": false
1478
+ },
1479
+ "automation runs": {
1480
+ "command": "automation runs",
1481
+ "method": "GET",
1482
+ "path": "/automations/:id/runs",
1483
+ "pathParams": [
1484
+ "id"
1485
+ ],
1486
+ "argLocation": "query",
1487
+ "responseKind": "list",
1488
+ "async": false
1489
+ },
1490
+ "automation test-fire": {
1491
+ "command": "automation test-fire",
1492
+ "method": "POST",
1493
+ "path": "/automations/:id/test-fire",
1494
+ "pathParams": [
1495
+ "id"
1496
+ ],
1497
+ "argLocation": "body",
1498
+ "responseKind": "single",
1499
+ "async": true
1500
+ },
1501
+ "automation unarchive": {
1502
+ "command": "automation unarchive",
1503
+ "method": "POST",
1504
+ "path": "/automations/:id/unarchive",
1505
+ "pathParams": [
1506
+ "id"
1507
+ ],
1508
+ "argLocation": "body",
1509
+ "responseKind": "single",
1510
+ "async": false
1511
+ },
1512
+ "automation update": {
1513
+ "command": "automation update",
1514
+ "method": "PATCH",
1515
+ "path": "/automations/:id",
1516
+ "pathParams": [
1517
+ "id"
1518
+ ],
1519
+ "argLocation": "body",
1520
+ "responseKind": "single",
1521
+ "async": false
1522
+ },
1241
1523
  "blobs delete": {
1242
1524
  "command": "blobs delete",
1243
1525
  "method": "DELETE",
@@ -1691,19 +1973,10 @@ var COMMAND_BINDINGS = {
1691
1973
  "responseKind": "created",
1692
1974
  "async": false
1693
1975
  },
1694
- "code execute": {
1695
- "command": "code execute",
1696
- "method": "POST",
1697
- "path": "/code-runs",
1698
- "pathParams": [],
1699
- "argLocation": "body",
1700
- "responseKind": "created",
1701
- "async": true
1702
- },
1703
- "code get": {
1704
- "command": "code get",
1976
+ "computer activity": {
1977
+ "command": "computer activity",
1705
1978
  "method": "GET",
1706
- "path": "/code-runs/:id",
1979
+ "path": "/computers/:id/activity",
1707
1980
  "pathParams": [
1708
1981
  "id"
1709
1982
  ],
@@ -1711,35 +1984,15 @@ var COMMAND_BINDINGS = {
1711
1984
  "responseKind": "single",
1712
1985
  "async": false
1713
1986
  },
1714
- "code interrupt": {
1715
- "command": "code interrupt",
1987
+ "computer add-exposure": {
1988
+ "command": "computer add-exposure",
1716
1989
  "method": "POST",
1717
- "path": "/code-runs/:id/interrupt",
1990
+ "path": "/computers/:id/expose",
1718
1991
  "pathParams": [
1719
1992
  "id"
1720
1993
  ],
1721
1994
  "argLocation": "body",
1722
- "responseKind": "single",
1723
- "async": false
1724
- },
1725
- "code list": {
1726
- "command": "code list",
1727
- "method": "GET",
1728
- "path": "/code-runs",
1729
- "pathParams": [],
1730
- "argLocation": "query",
1731
- "responseKind": "list",
1732
- "async": false
1733
- },
1734
- "computer activity": {
1735
- "command": "computer activity",
1736
- "method": "GET",
1737
- "path": "/computers/:id/activity",
1738
- "pathParams": [
1739
- "id"
1740
- ],
1741
- "argLocation": "query",
1742
- "responseKind": "single",
1995
+ "responseKind": "created",
1743
1996
  "async": false
1744
1997
  },
1745
1998
  "computer add-local-model": {
@@ -2044,23 +2297,43 @@ var COMMAND_BINDINGS = {
2044
2297
  "application/gzip"
2045
2298
  ]
2046
2299
  },
2047
- "computer exec": {
2048
- "command": "computer exec",
2300
+ "computer download-to-drive": {
2301
+ "command": "computer download-to-drive",
2049
2302
  "method": "POST",
2050
- "path": "/computers/:id/exec",
2303
+ "path": "/computers/:id/sftp/download",
2051
2304
  "pathParams": [
2052
2305
  "id"
2053
2306
  ],
2054
2307
  "argLocation": "body",
2055
2308
  "responseKind": "single",
2056
- "async": true
2309
+ "async": false
2057
2310
  },
2058
- "computer expose": {
2059
- "command": "computer expose",
2311
+ "computer ephemeral": {
2312
+ "command": "computer ephemeral",
2060
2313
  "method": "POST",
2061
- "path": "/computers/:id/tunnels",
2062
- "pathParams": [
2063
- "id"
2314
+ "path": "/computers/ephemeral",
2315
+ "pathParams": [],
2316
+ "argLocation": "body",
2317
+ "responseKind": "created",
2318
+ "async": false
2319
+ },
2320
+ "computer exec": {
2321
+ "command": "computer exec",
2322
+ "method": "POST",
2323
+ "path": "/computers/:id/exec",
2324
+ "pathParams": [
2325
+ "id"
2326
+ ],
2327
+ "argLocation": "body",
2328
+ "responseKind": "single",
2329
+ "async": true
2330
+ },
2331
+ "computer expose": {
2332
+ "command": "computer expose",
2333
+ "method": "POST",
2334
+ "path": "/computers/:id/tunnels",
2335
+ "pathParams": [
2336
+ "id"
2064
2337
  ],
2065
2338
  "argLocation": "body",
2066
2339
  "responseKind": "single",
@@ -2100,28 +2373,6 @@ var COMMAND_BINDINGS = {
2100
2373
  "responseKind": "single",
2101
2374
  "async": false
2102
2375
  },
2103
- "computer link": {
2104
- "command": "computer link",
2105
- "method": "POST",
2106
- "path": "/computers/:id/workspace-links",
2107
- "pathParams": [
2108
- "id"
2109
- ],
2110
- "argLocation": "body",
2111
- "responseKind": "created",
2112
- "async": false
2113
- },
2114
- "computer links": {
2115
- "command": "computer links",
2116
- "method": "GET",
2117
- "path": "/computers/:id/workspace-links",
2118
- "pathParams": [
2119
- "id"
2120
- ],
2121
- "argLocation": "query",
2122
- "responseKind": "single",
2123
- "async": false
2124
- },
2125
2376
  "computer list": {
2126
2377
  "command": "computer list",
2127
2378
  "method": "GET",
@@ -2184,6 +2435,18 @@ var COMMAND_BINDINGS = {
2184
2435
  "responseKind": "single",
2185
2436
  "async": false
2186
2437
  },
2438
+ "computer remove-exposure": {
2439
+ "command": "computer remove-exposure",
2440
+ "method": "DELETE",
2441
+ "path": "/computers/:id/expose/:workspace_id",
2442
+ "pathParams": [
2443
+ "id",
2444
+ "workspace_id"
2445
+ ],
2446
+ "argLocation": "body",
2447
+ "responseKind": "single",
2448
+ "async": false
2449
+ },
2187
2450
  "computer remove-local-model": {
2188
2451
  "command": "computer remove-local-model",
2189
2452
  "method": "DELETE",
@@ -2196,6 +2459,15 @@ var COMMAND_BINDINGS = {
2196
2459
  "responseKind": "single",
2197
2460
  "async": false
2198
2461
  },
2462
+ "computer run": {
2463
+ "command": "computer run",
2464
+ "method": "POST",
2465
+ "path": "/computers/run",
2466
+ "pathParams": [],
2467
+ "argLocation": "body",
2468
+ "responseKind": "single",
2469
+ "async": true
2470
+ },
2199
2471
  "computer set-ports": {
2200
2472
  "command": "computer set-ports",
2201
2473
  "method": "PATCH",
@@ -2274,6 +2546,17 @@ var COMMAND_BINDINGS = {
2274
2546
  "responseKind": "single",
2275
2547
  "async": false
2276
2548
  },
2549
+ "computer transfer": {
2550
+ "command": "computer transfer",
2551
+ "method": "POST",
2552
+ "path": "/computers/:id/transfer",
2553
+ "pathParams": [
2554
+ "id"
2555
+ ],
2556
+ "argLocation": "body",
2557
+ "responseKind": "single",
2558
+ "async": false
2559
+ },
2277
2560
  "computer tunnels": {
2278
2561
  "command": "computer tunnels",
2279
2562
  "method": "GET",
@@ -2307,24 +2590,24 @@ var COMMAND_BINDINGS = {
2307
2590
  "responseKind": "single",
2308
2591
  "async": false
2309
2592
  },
2310
- "computer unlink": {
2311
- "command": "computer unlink",
2312
- "method": "DELETE",
2313
- "path": "/computers/:id/workspace-links/:workspace_id",
2593
+ "computer update": {
2594
+ "command": "computer update",
2595
+ "method": "PATCH",
2596
+ "path": "/computers/:id",
2314
2597
  "pathParams": [
2315
- "id",
2316
- "workspace_id"
2598
+ "id"
2317
2599
  ],
2318
2600
  "argLocation": "body",
2319
2601
  "responseKind": "single",
2320
2602
  "async": false
2321
2603
  },
2322
- "computer update": {
2323
- "command": "computer update",
2604
+ "computer update-exposure": {
2605
+ "command": "computer update-exposure",
2324
2606
  "method": "PATCH",
2325
- "path": "/computers/:id",
2607
+ "path": "/computers/:id/expose/:workspace_id",
2326
2608
  "pathParams": [
2327
- "id"
2609
+ "id",
2610
+ "workspace_id"
2328
2611
  ],
2329
2612
  "argLocation": "body",
2330
2613
  "responseKind": "single",
@@ -2661,6 +2944,101 @@ var COMMAND_BINDINGS = {
2661
2944
  "responseKind": "created",
2662
2945
  "async": false
2663
2946
  },
2947
+ "functions create": {
2948
+ "command": "functions create",
2949
+ "method": "POST",
2950
+ "path": "/functions",
2951
+ "pathParams": [],
2952
+ "argLocation": "body",
2953
+ "responseKind": "created",
2954
+ "async": false
2955
+ },
2956
+ "functions delete": {
2957
+ "command": "functions delete",
2958
+ "method": "DELETE",
2959
+ "path": "/functions/:id",
2960
+ "pathParams": [
2961
+ "id"
2962
+ ],
2963
+ "argLocation": "query",
2964
+ "responseKind": "deleted",
2965
+ "async": false
2966
+ },
2967
+ "functions deploy": {
2968
+ "command": "functions deploy",
2969
+ "method": "POST",
2970
+ "path": "/functions/:id/deploy",
2971
+ "pathParams": [
2972
+ "id"
2973
+ ],
2974
+ "argLocation": "body",
2975
+ "responseKind": "created",
2976
+ "async": false
2977
+ },
2978
+ "functions deployments": {
2979
+ "command": "functions deployments",
2980
+ "method": "GET",
2981
+ "path": "/functions/:id/deployments",
2982
+ "pathParams": [
2983
+ "id"
2984
+ ],
2985
+ "argLocation": "query",
2986
+ "responseKind": "list",
2987
+ "async": false
2988
+ },
2989
+ "functions get": {
2990
+ "command": "functions get",
2991
+ "method": "GET",
2992
+ "path": "/functions/:id",
2993
+ "pathParams": [
2994
+ "id"
2995
+ ],
2996
+ "argLocation": "query",
2997
+ "responseKind": "single",
2998
+ "async": false
2999
+ },
3000
+ "functions invoke": {
3001
+ "command": "functions invoke",
3002
+ "method": "POST",
3003
+ "path": "/functions/:id/invoke",
3004
+ "pathParams": [
3005
+ "id"
3006
+ ],
3007
+ "argLocation": "body",
3008
+ "responseKind": "single",
3009
+ "async": false
3010
+ },
3011
+ "functions list": {
3012
+ "command": "functions list",
3013
+ "method": "GET",
3014
+ "path": "/functions",
3015
+ "pathParams": [],
3016
+ "argLocation": "query",
3017
+ "responseKind": "list",
3018
+ "async": false
3019
+ },
3020
+ "functions promote": {
3021
+ "command": "functions promote",
3022
+ "method": "POST",
3023
+ "path": "/functions/:id/promote",
3024
+ "pathParams": [
3025
+ "id"
3026
+ ],
3027
+ "argLocation": "body",
3028
+ "responseKind": "single",
3029
+ "async": false
3030
+ },
3031
+ "functions update": {
3032
+ "command": "functions update",
3033
+ "method": "PATCH",
3034
+ "path": "/functions/:id",
3035
+ "pathParams": [
3036
+ "id"
3037
+ ],
3038
+ "argLocation": "body",
3039
+ "responseKind": "single",
3040
+ "async": false
3041
+ },
2664
3042
  "guide get": {
2665
3043
  "command": "guide get",
2666
3044
  "method": "GET",
@@ -2868,6 +3246,125 @@ var COMMAND_BINDINGS = {
2868
3246
  "responseKind": "single",
2869
3247
  "async": false
2870
3248
  },
3249
+ "memory box-delete": {
3250
+ "command": "memory box-delete",
3251
+ "method": "DELETE",
3252
+ "path": "/memory/boxes/:id",
3253
+ "pathParams": [
3254
+ "id"
3255
+ ],
3256
+ "argLocation": "body",
3257
+ "responseKind": "deleted",
3258
+ "async": false
3259
+ },
3260
+ "memory box-get": {
3261
+ "command": "memory box-get",
3262
+ "method": "GET",
3263
+ "path": "/memory/boxes/:id",
3264
+ "pathParams": [
3265
+ "id"
3266
+ ],
3267
+ "argLocation": "query",
3268
+ "responseKind": "single",
3269
+ "async": false
3270
+ },
3271
+ "memory box-list": {
3272
+ "command": "memory box-list",
3273
+ "method": "GET",
3274
+ "path": "/memory/boxes",
3275
+ "pathParams": [],
3276
+ "argLocation": "query",
3277
+ "responseKind": "list",
3278
+ "async": false
3279
+ },
3280
+ "memory box-update": {
3281
+ "command": "memory box-update",
3282
+ "method": "PATCH",
3283
+ "path": "/memory/boxes/:id",
3284
+ "pathParams": [
3285
+ "id"
3286
+ ],
3287
+ "argLocation": "body",
3288
+ "responseKind": "single",
3289
+ "async": false
3290
+ },
3291
+ "memory delete": {
3292
+ "command": "memory delete",
3293
+ "method": "DELETE",
3294
+ "path": "/memory/boxes/:id/note",
3295
+ "pathParams": [
3296
+ "id"
3297
+ ],
3298
+ "argLocation": "query",
3299
+ "responseKind": "deleted",
3300
+ "async": false
3301
+ },
3302
+ "memory index-read": {
3303
+ "command": "memory index-read",
3304
+ "method": "GET",
3305
+ "path": "/memory/boxes/:id/index",
3306
+ "pathParams": [
3307
+ "id"
3308
+ ],
3309
+ "argLocation": "query",
3310
+ "responseKind": "single",
3311
+ "async": false
3312
+ },
3313
+ "memory index-write": {
3314
+ "command": "memory index-write",
3315
+ "method": "POST",
3316
+ "path": "/memory/boxes/:id/index",
3317
+ "pathParams": [
3318
+ "id"
3319
+ ],
3320
+ "argLocation": "body",
3321
+ "responseKind": "single",
3322
+ "async": false
3323
+ },
3324
+ "memory list": {
3325
+ "command": "memory list",
3326
+ "method": "GET",
3327
+ "path": "/memory/boxes/:id/notes",
3328
+ "pathParams": [
3329
+ "id"
3330
+ ],
3331
+ "argLocation": "query",
3332
+ "responseKind": "list",
3333
+ "async": false
3334
+ },
3335
+ "memory read": {
3336
+ "command": "memory read",
3337
+ "method": "GET",
3338
+ "path": "/memory/boxes/:id/note",
3339
+ "pathParams": [
3340
+ "id"
3341
+ ],
3342
+ "argLocation": "query",
3343
+ "responseKind": "single",
3344
+ "async": false
3345
+ },
3346
+ "memory search": {
3347
+ "command": "memory search",
3348
+ "method": "GET",
3349
+ "path": "/memory/boxes/:id/search",
3350
+ "pathParams": [
3351
+ "id"
3352
+ ],
3353
+ "argLocation": "query",
3354
+ "responseKind": "list",
3355
+ "async": false
3356
+ },
3357
+ "memory write": {
3358
+ "command": "memory write",
3359
+ "method": "POST",
3360
+ "path": "/memory/boxes/:id/notes",
3361
+ "pathParams": [
3362
+ "id"
3363
+ ],
3364
+ "argLocation": "body",
3365
+ "responseKind": "single",
3366
+ "async": false
3367
+ },
2871
3368
  "models list": {
2872
3369
  "command": "models list",
2873
3370
  "method": "GET",
@@ -2948,6 +3445,61 @@ var COMMAND_BINDINGS = {
2948
3445
  "responseKind": "deleted",
2949
3446
  "async": false
2950
3447
  },
3448
+ "notes folder-create": {
3449
+ "command": "notes folder-create",
3450
+ "method": "POST",
3451
+ "path": "/notes/boxes/:id/folders",
3452
+ "pathParams": [
3453
+ "id"
3454
+ ],
3455
+ "argLocation": "body",
3456
+ "responseKind": "created",
3457
+ "async": false
3458
+ },
3459
+ "notes folder-delete": {
3460
+ "command": "notes folder-delete",
3461
+ "method": "DELETE",
3462
+ "path": "/notes/folders/:folderId",
3463
+ "pathParams": [
3464
+ "folderId"
3465
+ ],
3466
+ "argLocation": "body",
3467
+ "responseKind": "deleted",
3468
+ "async": false
3469
+ },
3470
+ "notes folder-list": {
3471
+ "command": "notes folder-list",
3472
+ "method": "GET",
3473
+ "path": "/notes/boxes/:id/folders",
3474
+ "pathParams": [
3475
+ "id"
3476
+ ],
3477
+ "argLocation": "query",
3478
+ "responseKind": "list",
3479
+ "async": false
3480
+ },
3481
+ "notes folder-move": {
3482
+ "command": "notes folder-move",
3483
+ "method": "POST",
3484
+ "path": "/notes/folders/:folderId/move",
3485
+ "pathParams": [
3486
+ "folderId"
3487
+ ],
3488
+ "argLocation": "body",
3489
+ "responseKind": "single",
3490
+ "async": false
3491
+ },
3492
+ "notes folder-rename": {
3493
+ "command": "notes folder-rename",
3494
+ "method": "PATCH",
3495
+ "path": "/notes/folders/:folderId",
3496
+ "pathParams": [
3497
+ "folderId"
3498
+ ],
3499
+ "argLocation": "body",
3500
+ "responseKind": "single",
3501
+ "async": false
3502
+ },
2951
3503
  "notes graph": {
2952
3504
  "command": "notes graph",
2953
3505
  "method": "GET",
@@ -2959,6 +3511,17 @@ var COMMAND_BINDINGS = {
2959
3511
  "responseKind": "single",
2960
3512
  "async": false
2961
3513
  },
3514
+ "notes import": {
3515
+ "command": "notes import",
3516
+ "method": "POST",
3517
+ "path": "/notes/boxes/:id/import",
3518
+ "pathParams": [
3519
+ "id"
3520
+ ],
3521
+ "argLocation": "body",
3522
+ "responseKind": "single",
3523
+ "async": false
3524
+ },
2962
3525
  "notes index-read": {
2963
3526
  "command": "notes index-read",
2964
3527
  "method": "GET",
@@ -2999,8 +3562,19 @@ var COMMAND_BINDINGS = {
2999
3562
  "pathParams": [
3000
3563
  "id"
3001
3564
  ],
3002
- "argLocation": "query",
3003
- "responseKind": "list",
3565
+ "argLocation": "query",
3566
+ "responseKind": "list",
3567
+ "async": false
3568
+ },
3569
+ "notes note-move": {
3570
+ "command": "notes note-move",
3571
+ "method": "POST",
3572
+ "path": "/notes/boxes/:id/notes/move",
3573
+ "pathParams": [
3574
+ "id"
3575
+ ],
3576
+ "argLocation": "body",
3577
+ "responseKind": "single",
3004
3578
  "async": false
3005
3579
  },
3006
3580
  "notes note-rename": {
@@ -3014,6 +3588,15 @@ var COMMAND_BINDINGS = {
3014
3588
  "responseKind": "single",
3015
3589
  "async": false
3016
3590
  },
3591
+ "notes purge": {
3592
+ "command": "notes purge",
3593
+ "method": "POST",
3594
+ "path": "/notes/trash/purge",
3595
+ "pathParams": [],
3596
+ "argLocation": "body",
3597
+ "responseKind": "deleted",
3598
+ "async": false
3599
+ },
3017
3600
  "notes read": {
3018
3601
  "command": "notes read",
3019
3602
  "method": "GET",
@@ -3025,6 +3608,15 @@ var COMMAND_BINDINGS = {
3025
3608
  "responseKind": "single",
3026
3609
  "async": false
3027
3610
  },
3611
+ "notes restore": {
3612
+ "command": "notes restore",
3613
+ "method": "POST",
3614
+ "path": "/notes/trash/restore",
3615
+ "pathParams": [],
3616
+ "argLocation": "body",
3617
+ "responseKind": "deleted",
3618
+ "async": false
3619
+ },
3028
3620
  "notes search": {
3029
3621
  "command": "notes search",
3030
3622
  "method": "GET",
@@ -3067,6 +3659,35 @@ var COMMAND_BINDINGS = {
3067
3659
  "responseKind": "single",
3068
3660
  "async": false
3069
3661
  },
3662
+ "notes trash-empty": {
3663
+ "command": "notes trash-empty",
3664
+ "method": "DELETE",
3665
+ "path": "/notes/trash",
3666
+ "pathParams": [],
3667
+ "argLocation": "query",
3668
+ "responseKind": "single",
3669
+ "async": false
3670
+ },
3671
+ "notes trash-list": {
3672
+ "command": "notes trash-list",
3673
+ "method": "GET",
3674
+ "path": "/notes/trash",
3675
+ "pathParams": [],
3676
+ "argLocation": "query",
3677
+ "responseKind": "list",
3678
+ "async": false
3679
+ },
3680
+ "notes tree": {
3681
+ "command": "notes tree",
3682
+ "method": "GET",
3683
+ "path": "/notes/boxes/:id/tree",
3684
+ "pathParams": [
3685
+ "id"
3686
+ ],
3687
+ "argLocation": "query",
3688
+ "responseKind": "single",
3689
+ "async": false
3690
+ },
3070
3691
  "notes write": {
3071
3692
  "command": "notes write",
3072
3693
  "method": "POST",
@@ -4036,6 +4657,17 @@ var COMMAND_BINDINGS = {
4036
4657
  "responseKind": "single",
4037
4658
  "async": false
4038
4659
  },
4660
+ "tasks import": {
4661
+ "command": "tasks import",
4662
+ "method": "POST",
4663
+ "path": "/tasks/lists/:id/import",
4664
+ "pathParams": [
4665
+ "id"
4666
+ ],
4667
+ "argLocation": "body",
4668
+ "responseKind": "single",
4669
+ "async": false
4670
+ },
4039
4671
  "tasks label-create": {
4040
4672
  "command": "tasks label-create",
4041
4673
  "method": "POST",
@@ -4177,140 +4809,34 @@ var COMMAND_BINDINGS = {
4177
4809
  "responseKind": "single",
4178
4810
  "async": false
4179
4811
  },
4180
- "trigger archive": {
4181
- "command": "trigger archive",
4182
- "method": "POST",
4183
- "path": "/triggers/:id/archive",
4184
- "pathParams": [
4185
- "id"
4186
- ],
4187
- "argLocation": "body",
4188
- "responseKind": "single",
4189
- "async": false
4190
- },
4191
- "trigger cost-stats": {
4192
- "command": "trigger cost-stats",
4193
- "method": "GET",
4194
- "path": "/triggers/:id/cost-stats",
4195
- "pathParams": [
4196
- "id"
4197
- ],
4198
- "argLocation": "query",
4199
- "responseKind": "single",
4200
- "async": false
4201
- },
4202
- "trigger cost-stats-all": {
4203
- "command": "trigger cost-stats-all",
4204
- "method": "GET",
4205
- "path": "/triggers/cost-stats",
4206
- "pathParams": [],
4207
- "argLocation": "query",
4208
- "responseKind": "single",
4209
- "async": false
4210
- },
4211
- "trigger create": {
4212
- "command": "trigger create",
4812
+ "video generate": {
4813
+ "command": "video generate",
4213
4814
  "method": "POST",
4214
- "path": "/triggers",
4815
+ "path": "/videos/generations",
4215
4816
  "pathParams": [],
4216
4817
  "argLocation": "body",
4217
- "responseKind": "created",
4218
- "async": false
4219
- },
4220
- "trigger delete": {
4221
- "command": "trigger delete",
4222
- "method": "DELETE",
4223
- "path": "/triggers/:id",
4224
- "pathParams": [
4225
- "id"
4226
- ],
4227
- "argLocation": "body",
4228
- "responseKind": "deleted",
4229
- "async": false
4230
- },
4231
- "trigger fire": {
4232
- "command": "trigger fire",
4233
- "method": "POST",
4234
- "path": "/triggers/:id/fire",
4235
- "pathParams": [
4236
- "id"
4237
- ],
4238
- "argLocation": "body",
4239
- "responseKind": "created",
4240
- "async": true
4241
- },
4242
- "trigger get": {
4243
- "command": "trigger get",
4244
- "method": "GET",
4245
- "path": "/triggers/:id",
4246
- "pathParams": [
4247
- "id"
4248
- ],
4249
- "argLocation": "query",
4250
4818
  "responseKind": "single",
4251
- "async": false
4819
+ "async": true,
4820
+ "pollHint": {
4821
+ "intervalMs": 5e3,
4822
+ "maxAttempts": 240
4823
+ }
4252
4824
  },
4253
- "trigger list": {
4254
- "command": "trigger list",
4825
+ "video models": {
4826
+ "command": "video models",
4255
4827
  "method": "GET",
4256
- "path": "/triggers",
4828
+ "path": "/videos/models",
4257
4829
  "pathParams": [],
4258
4830
  "argLocation": "query",
4259
4831
  "responseKind": "list",
4260
4832
  "async": false
4261
4833
  },
4262
- "trigger rotate-secret": {
4263
- "command": "trigger rotate-secret",
4264
- "method": "POST",
4265
- "path": "/triggers/:id/rotate-secret",
4266
- "pathParams": [
4267
- "id"
4268
- ],
4269
- "argLocation": "body",
4270
- "responseKind": "single",
4271
- "async": false
4272
- },
4273
- "trigger runs": {
4274
- "command": "trigger runs",
4834
+ "video search": {
4835
+ "command": "video search",
4275
4836
  "method": "GET",
4276
- "path": "/triggers/:id/runs",
4277
- "pathParams": [
4278
- "id"
4279
- ],
4837
+ "path": "/videos/models/search",
4838
+ "pathParams": [],
4280
4839
  "argLocation": "query",
4281
- "responseKind": "list",
4282
- "async": false
4283
- },
4284
- "trigger test-fire": {
4285
- "command": "trigger test-fire",
4286
- "method": "POST",
4287
- "path": "/triggers/:id/test-fire",
4288
- "pathParams": [
4289
- "id"
4290
- ],
4291
- "argLocation": "body",
4292
- "responseKind": "single",
4293
- "async": true
4294
- },
4295
- "trigger unarchive": {
4296
- "command": "trigger unarchive",
4297
- "method": "POST",
4298
- "path": "/triggers/:id/unarchive",
4299
- "pathParams": [
4300
- "id"
4301
- ],
4302
- "argLocation": "body",
4303
- "responseKind": "single",
4304
- "async": false
4305
- },
4306
- "trigger update": {
4307
- "command": "trigger update",
4308
- "method": "PATCH",
4309
- "path": "/triggers/:id",
4310
- "pathParams": [
4311
- "id"
4312
- ],
4313
- "argLocation": "body",
4314
4840
  "responseKind": "single",
4315
4841
  "async": false
4316
4842
  },
@@ -4729,46 +5255,6 @@ var ChatsApi = class {
4729
5255
  }
4730
5256
  };
4731
5257
 
4732
- // ../sdk/src/api/code.ts
4733
- var CodeRunsApi = class {
4734
- constructor(ctx) {
4735
- this.ctx = ctx;
4736
- }
4737
- /**
4738
- * Execute a code file. Returns the full `ExecutionRun` row — `id`,
4739
- * `status`, `stdout`, `stderr`, `exit_code`, and the run timestamps —
4740
- * the same shape as `GET /code-runs/:id`.
4741
- */
4742
- async run(input, opts = {}) {
4743
- const res = await request(this.ctx, {
4744
- method: "POST",
4745
- path: "/api/v1/code-runs",
4746
- body: input,
4747
- signal: opts.signal
4748
- });
4749
- return res.data;
4750
- }
4751
- /** List recent execution runs. */
4752
- async list(query = {}, opts = {}) {
4753
- const res = await request(this.ctx, {
4754
- method: "GET",
4755
- path: "/api/v1/code-runs",
4756
- query,
4757
- signal: opts.signal
4758
- });
4759
- return res.data;
4760
- }
4761
- /** Get a single execution run by id. */
4762
- async get(id, opts = {}) {
4763
- const res = await request(this.ctx, {
4764
- method: "GET",
4765
- path: `/api/v1/code-runs/${id}`,
4766
- signal: opts.signal
4767
- });
4768
- return res.data;
4769
- }
4770
- };
4771
-
4772
5258
  // ../sdk/src/api/computers.ts
4773
5259
  var ComputersApi = class {
4774
5260
  constructor(ctx) {
@@ -5132,59 +5618,85 @@ var ComputersApi = class {
5132
5618
  return res.data;
5133
5619
  }
5134
5620
  // ---------------------------------------------------------------------------
5135
- // Workspace links (share LOCAL INFERENCE into other workspaces)
5621
+ // Workspace exposures (expose an actor-owned machine into a workspace) +
5622
+ // ownership transfer
5136
5623
  // ---------------------------------------------------------------------------
5137
5624
  /**
5138
- * List the workspaces a computer's LOCAL INFERENCE is shared into. The home
5139
- * workspace is never listed (it already has full access). The route returns
5140
- * the links under a `links` key (not a standard list envelope).
5625
+ * Expose an actor-owned machine INTO a workspace (Layer 2) with a
5626
+ * per-capability grant, so that workspace's members can use it. Requires
5627
+ * machine-admin and membership of the target workspace. Rejects a duplicate
5628
+ * exposure. (CLI verb: `computer add-exposure` — the bare `expose`/`unexpose`
5629
+ * verbs are the tunnel port commands.)
5141
5630
  */
5142
- async listWorkspaceLinks(id, opts = {}) {
5143
- const res = await request(this.ctx, {
5144
- method: "GET",
5145
- path: `/api/v1/computers/${id}/workspace-links`,
5146
- signal: opts.signal
5147
- });
5148
- return res.data.links;
5631
+ async expose(id, input, opts = {}) {
5632
+ const res = await request(
5633
+ this.ctx,
5634
+ {
5635
+ method: "POST",
5636
+ path: `/api/v1/computers/${id}/expose`,
5637
+ body: input,
5638
+ signal: opts.signal
5639
+ }
5640
+ );
5641
+ return res.data.exposure;
5149
5642
  }
5150
5643
  /**
5151
- * Share a computer's LOCAL INFERENCE into another workspace (never shell /
5152
- * files / tunnels). `workspaceId` is the target workspace's `ws_…`
5153
- * resourceId or slug. Requires EDIT on the computer's home workspace and
5154
- * membership of the target. Rejects the home workspace and duplicates.
5644
+ * Replace the capability grant on an existing exposure. `workspaceId` is the
5645
+ * exposed workspace's `ws_…` resourceId. Requires machine-admin.
5646
+ * (CLI verb: `computer update-exposure`.)
5155
5647
  */
5156
- async linkWorkspace(id, workspaceId, opts = {}) {
5648
+ async updateExposure(id, workspaceId, capabilities, opts = {}) {
5157
5649
  const res = await request(
5158
5650
  this.ctx,
5159
5651
  {
5160
- method: "POST",
5161
- path: `/api/v1/computers/${id}/workspace-links`,
5162
- body: { workspace_id: workspaceId },
5652
+ method: "PATCH",
5653
+ path: `/api/v1/computers/${id}/expose/${workspaceId}`,
5654
+ body: { capabilities },
5163
5655
  signal: opts.signal
5164
5656
  }
5165
5657
  );
5166
- return res.data.link;
5658
+ return res.data.exposure;
5167
5659
  }
5168
5660
  /**
5169
- * Stop sharing a computer's local inference into a workspace. `workspaceId`
5170
- * is the target workspace's `ws_…` resourceId. Idempotent unlinking a
5171
- * non-existent link still succeeds.
5661
+ * Stop exposing a machine into a workspace. `workspaceId` is the exposed
5662
+ * workspace's `ws_…` resourceId. Allowed for machine-admin OR an admin of the
5663
+ * exposed workspace. Idempotent. (CLI verb: `computer remove-exposure`.)
5172
5664
  */
5173
- async unlinkWorkspace(id, workspaceId, opts = {}) {
5174
- const res = await request(this.ctx, {
5175
- method: "DELETE",
5176
- path: `/api/v1/computers/${id}/workspace-links/${workspaceId}`,
5177
- signal: opts.signal
5178
- });
5665
+ async unexpose(id, workspaceId, opts = {}) {
5666
+ const res = await request(
5667
+ this.ctx,
5668
+ {
5669
+ method: "DELETE",
5670
+ path: `/api/v1/computers/${id}/expose/${workspaceId}`,
5671
+ signal: opts.signal
5672
+ }
5673
+ );
5179
5674
  return res.data;
5180
5675
  }
5676
+ /**
5677
+ * Transfer an actor-owned machine to a new owner (self, or an org the caller
5678
+ * administers). `owner` is the target profile's resourceId; existing workspace
5679
+ * exposures are kept. Requires machine-admin. (CLI verb: `computer transfer`.)
5680
+ */
5681
+ async transfer(id, owner, opts = {}) {
5682
+ const res = await request(
5683
+ this.ctx,
5684
+ {
5685
+ method: "POST",
5686
+ path: `/api/v1/computers/${id}/transfer`,
5687
+ body: { owner },
5688
+ signal: opts.signal
5689
+ }
5690
+ );
5691
+ return res.data.computer;
5692
+ }
5181
5693
  // ---------------------------------------------------------------------------
5182
5694
  // Pair-token redemption (daemon bootstrap)
5183
5695
  // ---------------------------------------------------------------------------
5184
5696
  /**
5185
5697
  * Redeem a one-time pair token for a long-lived computer identity. The
5186
5698
  * token itself is the auth — we swap the bearer for the token on this
5187
- * call only (same pattern as `triggers.fire`).
5699
+ * call only (same pattern as `automations.fire`).
5188
5700
  *
5189
5701
  * Used by `idapt up --token` to bootstrap a daemon. The request body is
5190
5702
  * snake_case; the response is wrapped in the standard `{data:{…}}`
@@ -5361,47 +5873,197 @@ var FilesApi = class {
5361
5873
  return getFileText(this.ctx, id, opts);
5362
5874
  }
5363
5875
  /**
5364
- * Fetch a file's raw bytes as a Blob. The server sends the real MIME
5365
- * type on `Content-Type`; the returned Blob's `.type` reflects it.
5876
+ * Fetch a file's raw bytes as a Blob. The server sends the real MIME
5877
+ * type on `Content-Type`; the returned Blob's `.type` reflects it.
5878
+ */
5879
+ getBlob(id, opts = {}) {
5880
+ return getFileBlob(this.ctx, id, opts);
5881
+ }
5882
+ /**
5883
+ * Patch file metadata or content. Supports `expectedUpdatedAt` for
5884
+ * optimistic concurrency — pass it when you know the version you read.
5885
+ */
5886
+ patch(id, input, opts = {}) {
5887
+ return patchFile(this.ctx, id, input, opts);
5888
+ }
5889
+ delete(id, opts = {}) {
5890
+ return deleteFile(this.ctx, id, opts);
5891
+ }
5892
+ restore(id, opts = {}) {
5893
+ return restoreFile(this.ctx, id, opts);
5894
+ }
5895
+ permanentDelete(id, opts = {}) {
5896
+ return permanentDeleteFile(this.ctx, id, opts);
5897
+ }
5898
+ // ---------------------------------------------------------------------------
5899
+ // Folder / move / run
5900
+ // ---------------------------------------------------------------------------
5901
+ /**
5902
+ * Idempotent create-or-get a folder. Returns the existing folder (with
5903
+ * `200`) or the new one (`201`) — consumers don't need to distinguish.
5904
+ */
5905
+ createFolder(input, opts = {}) {
5906
+ return createFolder(this.ctx, input, opts);
5907
+ }
5908
+ move(id, parentId, opts = {}) {
5909
+ return moveFile(this.ctx, id, parentId, opts);
5910
+ }
5911
+ /**
5912
+ * Execute a code file (js/ts/py/sh) in a sandboxed Lambda. Returns the
5913
+ * full `ExecutionRun` record (status, stdout/stderr, exit code, timestamps).
5914
+ */
5915
+ run(id, input = {}, opts = {}) {
5916
+ return runFile(this.ctx, id, input, opts);
5917
+ }
5918
+ };
5919
+
5920
+ // ../sdk/src/api/functions.ts
5921
+ var enc3 = encodeURIComponent;
5922
+ var FunctionRunsApi = class {
5923
+ constructor(ctx) {
5924
+ this.ctx = ctx;
5925
+ }
5926
+ /** List one-off function runs (cursor-paginated). */
5927
+ async list(query = {}, opts = {}) {
5928
+ const res = await request(this.ctx, {
5929
+ method: "GET",
5930
+ path: "/api/v1/functions/runs",
5931
+ query,
5932
+ signal: opts.signal
5933
+ });
5934
+ return res.data;
5935
+ }
5936
+ /** Get a single one-off run by id. */
5937
+ async get(id, opts = {}) {
5938
+ const res = await request(this.ctx, {
5939
+ method: "GET",
5940
+ path: `/api/v1/functions/runs/${enc3(id)}`,
5941
+ signal: opts.signal
5942
+ });
5943
+ return res.data;
5944
+ }
5945
+ /**
5946
+ * Interrupt a running run. Only computer-backed runs can be interrupted;
5947
+ * Lambda-backed runs return 409 (`ConflictError`).
5366
5948
  */
5367
- getBlob(id, opts = {}) {
5368
- return getFileBlob(this.ctx, id, opts);
5949
+ async interrupt(id, opts = {}) {
5950
+ const res = await request(this.ctx, {
5951
+ method: "POST",
5952
+ path: `/api/v1/functions/runs/${enc3(id)}/interrupt`,
5953
+ body: {},
5954
+ signal: opts.signal
5955
+ });
5956
+ return res.data;
5957
+ }
5958
+ };
5959
+ var FunctionsApi = class {
5960
+ constructor(ctx) {
5961
+ this.ctx = ctx;
5962
+ this.runs = new FunctionRunsApi(ctx);
5369
5963
  }
5370
5964
  /**
5371
- * Patch file metadata or content. Supports `expectedUpdatedAt` for
5372
- * optimistic concurrency pass it when you know the version you read.
5965
+ * Run a script ONCE in the sandbox. Pass EITHER inline `script` (+ optional
5966
+ * `language`) OR an existing Drive `file_id`. Returns the full `FunctionRun`
5967
+ * row — `id`, `status`, `stdout`, `stderr`, `exit_code`, the run timestamps,
5968
+ * and any `output_files` the script wrote under `/tmp/output/`.
5373
5969
  */
5374
- patch(id, input, opts = {}) {
5375
- return patchFile(this.ctx, id, input, opts);
5970
+ async run(input, opts = {}) {
5971
+ const res = await request(this.ctx, {
5972
+ method: "POST",
5973
+ path: "/api/v1/functions/runs",
5974
+ body: input,
5975
+ signal: opts.signal
5976
+ });
5977
+ return res.data;
5376
5978
  }
5377
- delete(id, opts = {}) {
5378
- return deleteFile(this.ctx, id, opts);
5979
+ /** List deployed functions in the workspace. */
5980
+ async list(query = {}, opts = {}) {
5981
+ const res = await request(this.ctx, {
5982
+ method: "GET",
5983
+ path: "/api/v1/functions",
5984
+ query,
5985
+ signal: opts.signal
5986
+ });
5987
+ return res.data;
5379
5988
  }
5380
- restore(id, opts = {}) {
5381
- return restoreFile(this.ctx, id, opts);
5989
+ /** Get a deployed function by its resourceId. */
5990
+ async get(id, opts = {}) {
5991
+ const res = await request(this.ctx, {
5992
+ method: "GET",
5993
+ path: `/api/v1/functions/${enc3(id)}`,
5994
+ signal: opts.signal
5995
+ });
5996
+ return res.data;
5382
5997
  }
5383
- permanentDelete(id, opts = {}) {
5384
- return permanentDeleteFile(this.ctx, id, opts);
5998
+ /** Create a deployed function (config only `deploy` adds a bundle). */
5999
+ async create(input, opts = {}) {
6000
+ const res = await request(this.ctx, {
6001
+ method: "POST",
6002
+ path: "/api/v1/functions",
6003
+ body: input,
6004
+ signal: opts.signal
6005
+ });
6006
+ return res.data;
5385
6007
  }
5386
- // ---------------------------------------------------------------------------
5387
- // Folder / move / run
5388
- // ---------------------------------------------------------------------------
5389
- /**
5390
- * Idempotent create-or-get a folder. Returns the existing folder (with
5391
- * `200`) or the new one (`201`) — consumers don't need to distinguish.
5392
- */
5393
- createFolder(input, opts = {}) {
5394
- return createFolder(this.ctx, input, opts);
6008
+ /** Update a deployed function's config. */
6009
+ async update(id, patch, opts = {}) {
6010
+ const res = await request(this.ctx, {
6011
+ method: "PATCH",
6012
+ path: `/api/v1/functions/${enc3(id)}`,
6013
+ body: patch,
6014
+ signal: opts.signal
6015
+ });
6016
+ return res.data;
5395
6017
  }
5396
- move(id, parentId, opts = {}) {
5397
- return moveFile(this.ctx, id, parentId, opts);
6018
+ /** Delete a deployed function + all its deployments. */
6019
+ async delete(id, opts = {}) {
6020
+ return request(this.ctx, {
6021
+ method: "DELETE",
6022
+ path: `/api/v1/functions/${enc3(id)}`,
6023
+ signal: opts.signal
6024
+ });
5398
6025
  }
5399
6026
  /**
5400
- * Execute a code file (js/ts/py/sh) in a sandboxed Lambda. Returns the
5401
- * full `ExecutionRun` record (status, stdout/stderr, exit code, timestamps).
6027
+ * Deploy a new bundle (inline base64 files). Promotes the new deployment to
6028
+ * live immediately unless `promote: false`. Returns the new deployment.
5402
6029
  */
5403
- run(id, input = {}, opts = {}) {
5404
- return runFile(this.ctx, id, input, opts);
6030
+ async deploy(id, input, opts = {}) {
6031
+ const res = await request(this.ctx, {
6032
+ method: "POST",
6033
+ path: `/api/v1/functions/${enc3(id)}/deploy`,
6034
+ body: input,
6035
+ signal: opts.signal
6036
+ });
6037
+ return res.data;
6038
+ }
6039
+ /** List a function's deployments (newest-first). */
6040
+ async deployments(id, opts = {}) {
6041
+ const res = await request(this.ctx, {
6042
+ method: "GET",
6043
+ path: `/api/v1/functions/${enc3(id)}/deployments`,
6044
+ signal: opts.signal
6045
+ });
6046
+ return res.data;
6047
+ }
6048
+ /** Promote (or roll back to) a deployment — flips the active one. */
6049
+ async promote(id, input, opts = {}) {
6050
+ const res = await request(this.ctx, {
6051
+ method: "POST",
6052
+ path: `/api/v1/functions/${enc3(id)}/promote`,
6053
+ body: input,
6054
+ signal: opts.signal
6055
+ });
6056
+ return res.data;
6057
+ }
6058
+ /** Invoke a deployed function synchronously; returns its response. */
6059
+ async invoke(id, input = {}, opts = {}) {
6060
+ const res = await request(this.ctx, {
6061
+ method: "POST",
6062
+ path: `/api/v1/functions/${enc3(id)}/invoke`,
6063
+ body: input,
6064
+ signal: opts.signal
6065
+ });
6066
+ return res.data;
5405
6067
  }
5406
6068
  };
5407
6069
 
@@ -5707,7 +6369,7 @@ var ProviderEndpointsApi = class {
5707
6369
  };
5708
6370
 
5709
6371
  // ../sdk/src/api/realtime.ts
5710
- var enc3 = encodeURIComponent;
6372
+ var enc4 = encodeURIComponent;
5711
6373
  var RECONNECT_MIN_MS = 1e3;
5712
6374
  var RECONNECT_MAX_MS = 3e4;
5713
6375
  var RealtimeApi = class {
@@ -5718,7 +6380,7 @@ var RealtimeApi = class {
5718
6380
  async broadcast(channel, message, opts = {}) {
5719
6381
  const res = await request(this.ctx, {
5720
6382
  method: "POST",
5721
- path: `/api/v1/realtime/${enc3(channel)}/broadcast`,
6383
+ path: `/api/v1/realtime/${enc4(channel)}/broadcast`,
5722
6384
  body: { message },
5723
6385
  signal: opts.signal
5724
6386
  });
@@ -5728,7 +6390,7 @@ var RealtimeApi = class {
5728
6390
  async heartbeat(channel, opts = {}) {
5729
6391
  const res = await request(this.ctx, {
5730
6392
  method: "POST",
5731
- path: `/api/v1/realtime/${enc3(channel)}/presence`,
6393
+ path: `/api/v1/realtime/${enc4(channel)}/presence`,
5732
6394
  body: { meta: opts.meta, ttl_seconds: opts.ttlSeconds },
5733
6395
  signal: opts.signal
5734
6396
  });
@@ -5738,7 +6400,7 @@ var RealtimeApi = class {
5738
6400
  async presence(channel, opts = {}) {
5739
6401
  const res = await request(this.ctx, {
5740
6402
  method: "GET",
5741
- path: `/api/v1/realtime/${enc3(channel)}/presence`,
6403
+ path: `/api/v1/realtime/${enc4(channel)}/presence`,
5742
6404
  signal: opts.signal
5743
6405
  });
5744
6406
  return res.data;
@@ -6145,7 +6807,7 @@ var SubscriptionApi = class {
6145
6807
  };
6146
6808
 
6147
6809
  // ../sdk/src/api/tables.ts
6148
- var enc4 = encodeURIComponent;
6810
+ var enc5 = encodeURIComponent;
6149
6811
  var TablesApi = class {
6150
6812
  constructor(ctx) {
6151
6813
  this.ctx = ctx;
@@ -6166,7 +6828,7 @@ var TablesApi = class {
6166
6828
  async get(id, opts = {}) {
6167
6829
  const res = await request(this.ctx, {
6168
6830
  method: "GET",
6169
- path: `/api/v1/tables/${enc4(id)}`,
6831
+ path: `/api/v1/tables/${enc5(id)}`,
6170
6832
  signal: opts.signal
6171
6833
  });
6172
6834
  return res.data;
@@ -6183,7 +6845,7 @@ var TablesApi = class {
6183
6845
  async update(id, input, opts = {}) {
6184
6846
  const res = await request(this.ctx, {
6185
6847
  method: "PATCH",
6186
- path: `/api/v1/tables/${enc4(id)}`,
6848
+ path: `/api/v1/tables/${enc5(id)}`,
6187
6849
  body: input,
6188
6850
  signal: opts.signal
6189
6851
  });
@@ -6192,7 +6854,7 @@ var TablesApi = class {
6192
6854
  async delete(id, opts = {}) {
6193
6855
  return request(this.ctx, {
6194
6856
  method: "DELETE",
6195
- path: `/api/v1/tables/${enc4(id)}`,
6857
+ path: `/api/v1/tables/${enc5(id)}`,
6196
6858
  signal: opts.signal
6197
6859
  });
6198
6860
  }
@@ -6200,7 +6862,7 @@ var TablesApi = class {
6200
6862
  async query(id, query = {}, opts = {}) {
6201
6863
  const res = await request(this.ctx, {
6202
6864
  method: "POST",
6203
- path: `/api/v1/tables/${enc4(id)}/query`,
6865
+ path: `/api/v1/tables/${enc5(id)}/query`,
6204
6866
  body: query,
6205
6867
  signal: opts.signal
6206
6868
  });
@@ -6209,7 +6871,7 @@ var TablesApi = class {
6209
6871
  async createRecord(id, values, opts = {}) {
6210
6872
  const res = await request(this.ctx, {
6211
6873
  method: "POST",
6212
- path: `/api/v1/tables/${enc4(id)}/records`,
6874
+ path: `/api/v1/tables/${enc5(id)}/records`,
6213
6875
  body: { values },
6214
6876
  signal: opts.signal
6215
6877
  });
@@ -6218,7 +6880,7 @@ var TablesApi = class {
6218
6880
  async getRecord(id, recordId, opts = {}) {
6219
6881
  const res = await request(this.ctx, {
6220
6882
  method: "GET",
6221
- path: `/api/v1/tables/${enc4(id)}/records/${enc4(recordId)}`,
6883
+ path: `/api/v1/tables/${enc5(id)}/records/${enc5(recordId)}`,
6222
6884
  signal: opts.signal
6223
6885
  });
6224
6886
  return res.data;
@@ -6226,7 +6888,7 @@ var TablesApi = class {
6226
6888
  async updateRecord(id, recordId, values, opts = {}) {
6227
6889
  const res = await request(this.ctx, {
6228
6890
  method: "PATCH",
6229
- path: `/api/v1/tables/${enc4(id)}/records/${enc4(recordId)}`,
6891
+ path: `/api/v1/tables/${enc5(id)}/records/${enc5(recordId)}`,
6230
6892
  body: { values },
6231
6893
  signal: opts.signal
6232
6894
  });
@@ -6235,7 +6897,7 @@ var TablesApi = class {
6235
6897
  async deleteRecord(id, recordId, opts = {}) {
6236
6898
  return request(this.ctx, {
6237
6899
  method: "DELETE",
6238
- path: `/api/v1/tables/${enc4(id)}/records/${enc4(recordId)}`,
6900
+ path: `/api/v1/tables/${enc5(id)}/records/${enc5(recordId)}`,
6239
6901
  signal: opts.signal
6240
6902
  });
6241
6903
  }
@@ -6243,7 +6905,7 @@ var TablesApi = class {
6243
6905
  async exportCsv(id, opts = {}) {
6244
6906
  const res = await requestRaw(this.ctx, {
6245
6907
  method: "GET",
6246
- path: `/api/v1/tables/${enc4(id)}/export`,
6908
+ path: `/api/v1/tables/${enc5(id)}/export`,
6247
6909
  signal: opts.signal,
6248
6910
  expectJson: false
6249
6911
  });
@@ -6253,7 +6915,7 @@ var TablesApi = class {
6253
6915
  async importCsv(id, csv, opts = {}) {
6254
6916
  const res = await request(this.ctx, {
6255
6917
  method: "POST",
6256
- path: `/api/v1/tables/${enc4(id)}/import`,
6918
+ path: `/api/v1/tables/${enc5(id)}/import`,
6257
6919
  body: { csv },
6258
6920
  signal: opts.signal
6259
6921
  });
@@ -6261,193 +6923,94 @@ var TablesApi = class {
6261
6923
  }
6262
6924
  };
6263
6925
 
6264
- // ../sdk/src/api/triggers.ts
6265
- var TriggersApi = class {
6926
+ // ../sdk/src/api/user.ts
6927
+ var UserApi = class {
6266
6928
  constructor(ctx) {
6267
6929
  this.ctx = ctx;
6268
6930
  }
6269
- // ---------------------------------------------------------------------------
6270
- // CRUD
6271
- // ---------------------------------------------------------------------------
6272
- async list(query = {}, opts = {}) {
6931
+ /** Current authenticated user's profile. */
6932
+ async me(opts = {}) {
6273
6933
  const res = await request(this.ctx, {
6274
6934
  method: "GET",
6275
- path: "/api/v1/triggers",
6276
- query,
6935
+ path: "/api/v1/me",
6277
6936
  signal: opts.signal
6278
6937
  });
6279
6938
  return res.data;
6280
6939
  }
6281
6940
  /**
6282
- * Create a trigger. `workspace_id` is passed in the request BODY (alongside
6283
- * the flat trigger definition) it is not a query param. The request
6284
- * body is flat: every scheduling field (`cron_expression`, …) and every
6285
- * action field (`agent_id`, `prompt_template`, `file_id`, …) sits at the
6286
- * top level — there are no nested `trigger_config` / `action_config`
6287
- * objects any more.
6288
- *
6289
- * For a `webhook` trigger the response additionally carries a one-time
6290
- * plaintext `secret` (use `TriggerWithSecret`); other trigger types
6291
- * resolve to a plain `Trigger`.
6941
+ * Storage usage summary bytes used / total, snapshot footprint.
6942
+ * Corresponds to `GET /me/usage?view=summary` (the default).
6292
6943
  */
6293
- async create(workspaceId, input, opts = {}) {
6294
- const res = await request(
6295
- this.ctx,
6296
- {
6297
- method: "POST",
6298
- path: "/api/v1/triggers",
6299
- body: { workspace_id: workspaceId, ...input },
6300
- signal: opts.signal
6301
- }
6302
- );
6303
- return res.data;
6304
- }
6305
- async get(id, opts = {}) {
6944
+ async usage(opts = {}) {
6306
6945
  const res = await request(this.ctx, {
6307
6946
  method: "GET",
6308
- path: `/api/v1/triggers/${id}`,
6309
- signal: opts.signal
6310
- });
6311
- return res.data;
6312
- }
6313
- async update(id, input, opts = {}) {
6314
- const res = await request(this.ctx, {
6315
- method: "PATCH",
6316
- path: `/api/v1/triggers/${id}`,
6317
- body: input,
6318
- signal: opts.signal
6319
- });
6320
- return res.data;
6321
- }
6322
- async delete(id, opts = {}) {
6323
- return request(this.ctx, {
6324
- method: "DELETE",
6325
- path: `/api/v1/triggers/${id}`,
6326
- signal: opts.signal
6327
- });
6328
- }
6329
- async archive(id, opts = {}) {
6330
- const res = await request(this.ctx, {
6331
- method: "POST",
6332
- path: `/api/v1/triggers/${id}/archive`,
6333
- signal: opts.signal
6334
- });
6335
- return res.data;
6336
- }
6337
- async unarchive(id, opts = {}) {
6338
- const res = await request(this.ctx, {
6339
- method: "POST",
6340
- path: `/api/v1/triggers/${id}/unarchive`,
6341
- signal: opts.signal
6342
- });
6343
- return res.data;
6344
- }
6345
- // ---------------------------------------------------------------------------
6346
- // Fire + rotate-secret + runs
6347
- // ---------------------------------------------------------------------------
6348
- /**
6349
- * Fire a trigger via its webhook secret. This endpoint does NOT use the
6350
- * client's `ap_` key — the bearer is the trigger's secret — so we build a
6351
- * one-off HttpContext for it rather than mutating the shared one.
6352
- *
6353
- * Responds HTTP 202. The response identifies the fired trigger via `id`
6354
- * only.
6355
- */
6356
- async fire(id, input, opts = {}) {
6357
- const localCtx = {
6358
- apiUrl: this.ctx.apiUrl,
6359
- key: input.secret,
6360
- fetch: this.ctx.fetch
6361
- };
6362
- const res = await request(localCtx, {
6363
- method: "POST",
6364
- path: `/api/v1/triggers/${id}/fire`,
6365
- body: input.body ?? {},
6947
+ path: "/api/v1/me/usage",
6948
+ query: { view: "summary" },
6366
6949
  signal: opts.signal
6367
6950
  });
6368
6951
  return res.data;
6369
6952
  }
6370
6953
  /**
6371
- * Rotate the webhook secret. Returns the trigger with a fresh one-time
6372
- * plaintext `secret` populated (`TriggerWithSecret`). The old secret
6373
- * immediately stops working.
6954
+ * Paginated history of LLM / image / audio calls + cost.
6955
+ * Corresponds to `GET /me/usage?view=history`.
6374
6956
  */
6375
- async rotateSecret(id, opts = {}) {
6376
- const res = await request(this.ctx, {
6377
- method: "POST",
6378
- path: `/api/v1/triggers/${id}/rotate-secret`,
6379
- signal: opts.signal
6380
- });
6381
- return res.data;
6382
- }
6383
- /** Recent fires + their success/error outcome. */
6384
- async listRuns(id, query = {}, opts = {}) {
6385
- const res = await request(this.ctx, {
6386
- method: "GET",
6387
- path: `/api/v1/triggers/${id}/runs`,
6388
- query,
6389
- signal: opts.signal
6390
- });
6391
- return res.data;
6392
- }
6393
- async getCostStats(id, opts = {}) {
6957
+ async usageHistory(query = {}, opts = {}) {
6394
6958
  const res = await request(this.ctx, {
6395
6959
  method: "GET",
6396
- path: `/api/v1/triggers/${id}/cost-stats`,
6960
+ path: "/api/v1/me/usage",
6961
+ query: { view: "history", ...query },
6397
6962
  signal: opts.signal
6398
6963
  });
6399
6964
  return res.data;
6400
6965
  }
6401
- async getCostStatsMap(query = {}, opts = {}) {
6402
- const res = await request(this.ctx, {
6403
- method: "GET",
6404
- path: "/api/v1/triggers/cost-stats",
6405
- query,
6406
- signal: opts.signal
6407
- });
6408
- return res.data.by_id;
6409
- }
6410
6966
  };
6411
6967
 
6412
- // ../sdk/src/api/user.ts
6413
- var UserApi = class {
6968
+ // ../sdk/src/api/videos.ts
6969
+ var GENERATE_BINDING = COMMAND_BINDINGS["video generate"];
6970
+ var VideosApi = class {
6414
6971
  constructor(ctx) {
6415
6972
  this.ctx = ctx;
6416
6973
  }
6417
- /** Current authenticated user's profile. */
6418
- async me(opts = {}) {
6974
+ async listModels(opts = {}) {
6419
6975
  const res = await request(this.ctx, {
6420
6976
  method: "GET",
6421
- path: "/api/v1/me",
6977
+ path: "/api/v1/videos/models",
6422
6978
  signal: opts.signal
6423
6979
  });
6424
6980
  return res.data;
6425
6981
  }
6426
- /**
6427
- * Storage usage summary — bytes used / total, snapshot footprint.
6428
- * Corresponds to `GET /me/usage?view=summary` (the default).
6429
- */
6430
- async usage(opts = {}) {
6431
- const res = await request(this.ctx, {
6432
- method: "GET",
6433
- path: "/api/v1/me/usage",
6434
- query: { view: "summary" },
6435
- signal: opts.signal
6436
- });
6982
+ async searchModels(input = {}, opts = {}) {
6983
+ const res = await request(
6984
+ this.ctx,
6985
+ {
6986
+ method: "GET",
6987
+ path: "/api/v1/videos/models/search",
6988
+ query: input,
6989
+ signal: opts.signal
6990
+ }
6991
+ );
6437
6992
  return res.data;
6438
6993
  }
6439
- /**
6440
- * Paginated history of LLM / image / audio calls + cost.
6441
- * Corresponds to `GET /me/usage?view=history`.
6442
- */
6443
- async usageHistory(query = {}, opts = {}) {
6994
+ async generate(input, opts = {}) {
6444
6995
  const res = await request(this.ctx, {
6445
- method: "GET",
6446
- path: "/api/v1/me/usage",
6447
- query: { view: "history", ...query },
6996
+ method: "POST",
6997
+ path: "/api/v1/videos/generations",
6998
+ body: input,
6448
6999
  signal: opts.signal
6449
7000
  });
6450
- return res.data;
7001
+ const handle = res.data;
7002
+ if (opts.wait === false) return handle;
7003
+ const pollOpts = {
7004
+ signal: opts.signal,
7005
+ pollIntervalMs: opts.pollIntervalMs,
7006
+ maxPollAttempts: opts.maxPollAttempts
7007
+ };
7008
+ return await awaitOperation(
7009
+ GENERATE_BINDING,
7010
+ handle.id,
7011
+ this.ctx,
7012
+ pollOpts
7013
+ );
6451
7014
  }
6452
7015
  };
6453
7016
 
@@ -6614,7 +7177,7 @@ var WorkspacesApi = class {
6614
7177
  };
6615
7178
 
6616
7179
  // ../sdk/src/version.ts
6617
- var VERSION = "0.1.0" ;
7180
+ var VERSION = "0.3.0" ;
6618
7181
 
6619
7182
  // src/api/app.ts
6620
7183
  var RemoteBundleReader = class {
@@ -7108,7 +7671,7 @@ var IdaptClient2 = class {
7108
7671
  this.agents = new AgentsApi(v1Ctx);
7109
7672
  this.chats = new ChatsApi(v1Ctx);
7110
7673
  this.workspaces = new WorkspacesApi(v1Ctx);
7111
- this.triggers = new TriggersApi(v1Ctx);
7674
+ this.automations = new AutomationsApi(v1Ctx);
7112
7675
  this.computers = new ComputersApi(v1Ctx);
7113
7676
  this.secrets = new SecretsApi(v1Ctx);
7114
7677
  this.kv = new DatastoreApi(v1Ctx);
@@ -7125,7 +7688,7 @@ var IdaptClient2 = class {
7125
7688
  this.providerEndpoints = new ProviderEndpointsApi(v1Ctx);
7126
7689
  this.images = new ImagesApi(v1Ctx);
7127
7690
  this.audio = new AudioApi(v1Ctx);
7128
- this.code = new CodeRunsApi(v1Ctx);
7691
+ this.functions = new FunctionsApi(v1Ctx);
7129
7692
  this.search = new SearchApi(v1Ctx);
7130
7693
  this.web = new WebSearchApi(v1Ctx);
7131
7694
  this.guide = new GuideApi(v1Ctx);
@@ -7512,16 +8075,17 @@ exports.ApiKeysApi = ApiKeysApi;
7512
8075
  exports.AppFolder = AppFolder;
7513
8076
  exports.AudioApi = AudioApi;
7514
8077
  exports.AuthError = AuthError;
8078
+ exports.AutomationsApi = AutomationsApi;
7515
8079
  exports.BlobsApi = BlobsApi;
7516
8080
  exports.COMMAND_BINDINGS = COMMAND_BINDINGS;
7517
8081
  exports.ChatsApi = ChatsApi;
7518
- exports.CodeRunsApi = CodeRunsApi;
7519
8082
  exports.ComputersApi = ComputersApi;
7520
8083
  exports.ConflictError = ConflictError;
7521
8084
  exports.DataFolder = DataFolder;
7522
8085
  exports.DatastoreApi = DatastoreApi;
7523
8086
  exports.DocsApi = DocsApi;
7524
8087
  exports.FilesApi = FilesApi;
8088
+ exports.FunctionsApi = FunctionsApi;
7525
8089
  exports.GuideApi = GuideApi;
7526
8090
  exports.Idapt = Idapt2;
7527
8091
  exports.IdaptClient = IdaptClient2;
@@ -7547,9 +8111,9 @@ exports.SharingApi = SharingApi;
7547
8111
  exports.StoreApi = StoreApi;
7548
8112
  exports.SubscriptionApi = SubscriptionApi;
7549
8113
  exports.TablesApi = TablesApi;
7550
- exports.TriggersApi = TriggersApi;
7551
8114
  exports.UserApi = UserApi;
7552
8115
  exports.VERSION = VERSION;
8116
+ exports.VideosApi = VideosApi;
7553
8117
  exports.WebSearchApi = WebSearchApi;
7554
8118
  exports.WorkspacesApi = WorkspacesApi;
7555
8119
  exports.awaitOperation = awaitOperation;