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