@idapt/browser-app-sdk 0.2.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 {
@@ -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",
@@ -1702,6 +1984,17 @@ var COMMAND_BINDINGS = {
1702
1984
  "responseKind": "single",
1703
1985
  "async": false
1704
1986
  },
1987
+ "computer add-exposure": {
1988
+ "command": "computer add-exposure",
1989
+ "method": "POST",
1990
+ "path": "/computers/:id/expose",
1991
+ "pathParams": [
1992
+ "id"
1993
+ ],
1994
+ "argLocation": "body",
1995
+ "responseKind": "created",
1996
+ "async": false
1997
+ },
1705
1998
  "computer add-local-model": {
1706
1999
  "command": "computer add-local-model",
1707
2000
  "method": "POST",
@@ -2080,28 +2373,6 @@ var COMMAND_BINDINGS = {
2080
2373
  "responseKind": "single",
2081
2374
  "async": false
2082
2375
  },
2083
- "computer link": {
2084
- "command": "computer link",
2085
- "method": "POST",
2086
- "path": "/computers/:id/workspace-links",
2087
- "pathParams": [
2088
- "id"
2089
- ],
2090
- "argLocation": "body",
2091
- "responseKind": "created",
2092
- "async": false
2093
- },
2094
- "computer links": {
2095
- "command": "computer links",
2096
- "method": "GET",
2097
- "path": "/computers/:id/workspace-links",
2098
- "pathParams": [
2099
- "id"
2100
- ],
2101
- "argLocation": "query",
2102
- "responseKind": "single",
2103
- "async": false
2104
- },
2105
2376
  "computer list": {
2106
2377
  "command": "computer list",
2107
2378
  "method": "GET",
@@ -2164,6 +2435,18 @@ var COMMAND_BINDINGS = {
2164
2435
  "responseKind": "single",
2165
2436
  "async": false
2166
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
+ },
2167
2450
  "computer remove-local-model": {
2168
2451
  "command": "computer remove-local-model",
2169
2452
  "method": "DELETE",
@@ -2176,6 +2459,15 @@ var COMMAND_BINDINGS = {
2176
2459
  "responseKind": "single",
2177
2460
  "async": false
2178
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
+ },
2179
2471
  "computer set-ports": {
2180
2472
  "command": "computer set-ports",
2181
2473
  "method": "PATCH",
@@ -2254,6 +2546,17 @@ var COMMAND_BINDINGS = {
2254
2546
  "responseKind": "single",
2255
2547
  "async": false
2256
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
+ },
2257
2560
  "computer tunnels": {
2258
2561
  "command": "computer tunnels",
2259
2562
  "method": "GET",
@@ -2287,24 +2590,24 @@ var COMMAND_BINDINGS = {
2287
2590
  "responseKind": "single",
2288
2591
  "async": false
2289
2592
  },
2290
- "computer unlink": {
2291
- "command": "computer unlink",
2292
- "method": "DELETE",
2293
- "path": "/computers/:id/workspace-links/:workspace_id",
2593
+ "computer update": {
2594
+ "command": "computer update",
2595
+ "method": "PATCH",
2596
+ "path": "/computers/:id",
2294
2597
  "pathParams": [
2295
- "id",
2296
- "workspace_id"
2598
+ "id"
2297
2599
  ],
2298
2600
  "argLocation": "body",
2299
2601
  "responseKind": "single",
2300
2602
  "async": false
2301
2603
  },
2302
- "computer update": {
2303
- "command": "computer update",
2604
+ "computer update-exposure": {
2605
+ "command": "computer update-exposure",
2304
2606
  "method": "PATCH",
2305
- "path": "/computers/:id",
2607
+ "path": "/computers/:id/expose/:workspace_id",
2306
2608
  "pathParams": [
2307
- "id"
2609
+ "id",
2610
+ "workspace_id"
2308
2611
  ],
2309
2612
  "argLocation": "body",
2310
2613
  "responseKind": "single",
@@ -2721,48 +3024,8 @@ var COMMAND_BINDINGS = {
2721
3024
  "pathParams": [
2722
3025
  "id"
2723
3026
  ],
2724
- "argLocation": "body",
2725
- "responseKind": "single",
2726
- "async": false
2727
- },
2728
- "functions run": {
2729
- "command": "functions run",
2730
- "method": "POST",
2731
- "path": "/functions/runs",
2732
- "pathParams": [],
2733
- "argLocation": "body",
2734
- "responseKind": "created",
2735
- "async": true
2736
- },
2737
- "functions run-get": {
2738
- "command": "functions run-get",
2739
- "method": "GET",
2740
- "path": "/functions/runs/:id",
2741
- "pathParams": [
2742
- "id"
2743
- ],
2744
- "argLocation": "query",
2745
- "responseKind": "single",
2746
- "async": false
2747
- },
2748
- "functions run-interrupt": {
2749
- "command": "functions run-interrupt",
2750
- "method": "POST",
2751
- "path": "/functions/runs/:id/interrupt",
2752
- "pathParams": [
2753
- "id"
2754
- ],
2755
- "argLocation": "body",
2756
- "responseKind": "single",
2757
- "async": false
2758
- },
2759
- "functions run-list": {
2760
- "command": "functions run-list",
2761
- "method": "GET",
2762
- "path": "/functions/runs",
2763
- "pathParams": [],
2764
- "argLocation": "query",
2765
- "responseKind": "list",
3027
+ "argLocation": "body",
3028
+ "responseKind": "single",
2766
3029
  "async": false
2767
3030
  },
2768
3031
  "functions update": {
@@ -4546,143 +4809,6 @@ var COMMAND_BINDINGS = {
4546
4809
  "responseKind": "single",
4547
4810
  "async": false
4548
4811
  },
4549
- "trigger archive": {
4550
- "command": "trigger archive",
4551
- "method": "POST",
4552
- "path": "/triggers/:id/archive",
4553
- "pathParams": [
4554
- "id"
4555
- ],
4556
- "argLocation": "body",
4557
- "responseKind": "single",
4558
- "async": false
4559
- },
4560
- "trigger cost-stats": {
4561
- "command": "trigger cost-stats",
4562
- "method": "GET",
4563
- "path": "/triggers/:id/cost-stats",
4564
- "pathParams": [
4565
- "id"
4566
- ],
4567
- "argLocation": "query",
4568
- "responseKind": "single",
4569
- "async": false
4570
- },
4571
- "trigger cost-stats-all": {
4572
- "command": "trigger cost-stats-all",
4573
- "method": "GET",
4574
- "path": "/triggers/cost-stats",
4575
- "pathParams": [],
4576
- "argLocation": "query",
4577
- "responseKind": "single",
4578
- "async": false
4579
- },
4580
- "trigger create": {
4581
- "command": "trigger create",
4582
- "method": "POST",
4583
- "path": "/triggers",
4584
- "pathParams": [],
4585
- "argLocation": "body",
4586
- "responseKind": "created",
4587
- "async": false
4588
- },
4589
- "trigger delete": {
4590
- "command": "trigger delete",
4591
- "method": "DELETE",
4592
- "path": "/triggers/:id",
4593
- "pathParams": [
4594
- "id"
4595
- ],
4596
- "argLocation": "body",
4597
- "responseKind": "deleted",
4598
- "async": false
4599
- },
4600
- "trigger fire": {
4601
- "command": "trigger fire",
4602
- "method": "POST",
4603
- "path": "/triggers/:id/fire",
4604
- "pathParams": [
4605
- "id"
4606
- ],
4607
- "argLocation": "body",
4608
- "responseKind": "created",
4609
- "async": true
4610
- },
4611
- "trigger get": {
4612
- "command": "trigger get",
4613
- "method": "GET",
4614
- "path": "/triggers/:id",
4615
- "pathParams": [
4616
- "id"
4617
- ],
4618
- "argLocation": "query",
4619
- "responseKind": "single",
4620
- "async": false
4621
- },
4622
- "trigger list": {
4623
- "command": "trigger list",
4624
- "method": "GET",
4625
- "path": "/triggers",
4626
- "pathParams": [],
4627
- "argLocation": "query",
4628
- "responseKind": "list",
4629
- "async": false
4630
- },
4631
- "trigger rotate-secret": {
4632
- "command": "trigger rotate-secret",
4633
- "method": "POST",
4634
- "path": "/triggers/:id/rotate-secret",
4635
- "pathParams": [
4636
- "id"
4637
- ],
4638
- "argLocation": "body",
4639
- "responseKind": "single",
4640
- "async": false
4641
- },
4642
- "trigger runs": {
4643
- "command": "trigger runs",
4644
- "method": "GET",
4645
- "path": "/triggers/:id/runs",
4646
- "pathParams": [
4647
- "id"
4648
- ],
4649
- "argLocation": "query",
4650
- "responseKind": "list",
4651
- "async": false
4652
- },
4653
- "trigger test-fire": {
4654
- "command": "trigger test-fire",
4655
- "method": "POST",
4656
- "path": "/triggers/:id/test-fire",
4657
- "pathParams": [
4658
- "id"
4659
- ],
4660
- "argLocation": "body",
4661
- "responseKind": "single",
4662
- "async": true
4663
- },
4664
- "trigger unarchive": {
4665
- "command": "trigger unarchive",
4666
- "method": "POST",
4667
- "path": "/triggers/:id/unarchive",
4668
- "pathParams": [
4669
- "id"
4670
- ],
4671
- "argLocation": "body",
4672
- "responseKind": "single",
4673
- "async": false
4674
- },
4675
- "trigger update": {
4676
- "command": "trigger update",
4677
- "method": "PATCH",
4678
- "path": "/triggers/:id",
4679
- "pathParams": [
4680
- "id"
4681
- ],
4682
- "argLocation": "body",
4683
- "responseKind": "single",
4684
- "async": false
4685
- },
4686
4812
  "video generate": {
4687
4813
  "command": "video generate",
4688
4814
  "method": "POST",
@@ -5492,59 +5618,85 @@ var ComputersApi = class {
5492
5618
  return res.data;
5493
5619
  }
5494
5620
  // ---------------------------------------------------------------------------
5495
- // Workspace links (share LOCAL INFERENCE into other workspaces)
5621
+ // Workspace exposures (expose an actor-owned machine into a workspace) +
5622
+ // ownership transfer
5496
5623
  // ---------------------------------------------------------------------------
5497
5624
  /**
5498
- * List the workspaces a computer's LOCAL INFERENCE is shared into. The home
5499
- * workspace is never listed (it already has full access). The route returns
5500
- * 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.)
5501
5630
  */
5502
- async listWorkspaceLinks(id, opts = {}) {
5503
- const res = await request(this.ctx, {
5504
- method: "GET",
5505
- path: `/api/v1/computers/${id}/workspace-links`,
5506
- signal: opts.signal
5507
- });
5508
- 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;
5509
5642
  }
5510
5643
  /**
5511
- * Share a computer's LOCAL INFERENCE into another workspace (never shell /
5512
- * files / tunnels). `workspaceId` is the target workspace's `ws_…`
5513
- * resourceId or slug. Requires EDIT on the computer's home workspace and
5514
- * 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`.)
5515
5647
  */
5516
- async linkWorkspace(id, workspaceId, opts = {}) {
5648
+ async updateExposure(id, workspaceId, capabilities, opts = {}) {
5517
5649
  const res = await request(
5518
5650
  this.ctx,
5519
5651
  {
5520
- method: "POST",
5521
- path: `/api/v1/computers/${id}/workspace-links`,
5522
- body: { workspace_id: workspaceId },
5652
+ method: "PATCH",
5653
+ path: `/api/v1/computers/${id}/expose/${workspaceId}`,
5654
+ body: { capabilities },
5523
5655
  signal: opts.signal
5524
5656
  }
5525
5657
  );
5526
- return res.data.link;
5658
+ return res.data.exposure;
5527
5659
  }
5528
5660
  /**
5529
- * Stop sharing a computer's local inference into a workspace. `workspaceId`
5530
- * is the target workspace's `ws_…` resourceId. Idempotent unlinking a
5531
- * 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`.)
5532
5664
  */
5533
- async unlinkWorkspace(id, workspaceId, opts = {}) {
5534
- const res = await request(this.ctx, {
5535
- method: "DELETE",
5536
- path: `/api/v1/computers/${id}/workspace-links/${workspaceId}`,
5537
- signal: opts.signal
5538
- });
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
+ );
5539
5674
  return res.data;
5540
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
+ }
5541
5693
  // ---------------------------------------------------------------------------
5542
5694
  // Pair-token redemption (daemon bootstrap)
5543
5695
  // ---------------------------------------------------------------------------
5544
5696
  /**
5545
5697
  * Redeem a one-time pair token for a long-lived computer identity. The
5546
5698
  * token itself is the auth — we swap the bearer for the token on this
5547
- * call only (same pattern as `triggers.fire`).
5699
+ * call only (same pattern as `automations.fire`).
5548
5700
  *
5549
5701
  * Used by `idapt up --token` to bootstrap a daemon. The request body is
5550
5702
  * snake_case; the response is wrapped in the standard `{data:{…}}`
@@ -6771,154 +6923,6 @@ var TablesApi = class {
6771
6923
  }
6772
6924
  };
6773
6925
 
6774
- // ../sdk/src/api/triggers.ts
6775
- var TriggersApi = class {
6776
- constructor(ctx) {
6777
- this.ctx = ctx;
6778
- }
6779
- // ---------------------------------------------------------------------------
6780
- // CRUD
6781
- // ---------------------------------------------------------------------------
6782
- async list(query = {}, opts = {}) {
6783
- const res = await request(this.ctx, {
6784
- method: "GET",
6785
- path: "/api/v1/triggers",
6786
- query,
6787
- signal: opts.signal
6788
- });
6789
- return res.data;
6790
- }
6791
- /**
6792
- * Create a trigger. `workspace_id` is passed in the request BODY (alongside
6793
- * the flat trigger definition) — it is not a query param. The request
6794
- * body is flat: every scheduling field (`cron_expression`, …) and every
6795
- * action field (`agent_id`, `prompt_template`, `file_id`, …) sits at the
6796
- * top level — there are no nested `trigger_config` / `action_config`
6797
- * objects any more.
6798
- *
6799
- * For a `webhook` trigger the response additionally carries a one-time
6800
- * plaintext `secret` (use `TriggerWithSecret`); other trigger types
6801
- * resolve to a plain `Trigger`.
6802
- */
6803
- async create(workspaceId, input, opts = {}) {
6804
- const res = await request(
6805
- this.ctx,
6806
- {
6807
- method: "POST",
6808
- path: "/api/v1/triggers",
6809
- body: { workspace_id: workspaceId, ...input },
6810
- signal: opts.signal
6811
- }
6812
- );
6813
- return res.data;
6814
- }
6815
- async get(id, opts = {}) {
6816
- const res = await request(this.ctx, {
6817
- method: "GET",
6818
- path: `/api/v1/triggers/${id}`,
6819
- signal: opts.signal
6820
- });
6821
- return res.data;
6822
- }
6823
- async update(id, input, opts = {}) {
6824
- const res = await request(this.ctx, {
6825
- method: "PATCH",
6826
- path: `/api/v1/triggers/${id}`,
6827
- body: input,
6828
- signal: opts.signal
6829
- });
6830
- return res.data;
6831
- }
6832
- async delete(id, opts = {}) {
6833
- return request(this.ctx, {
6834
- method: "DELETE",
6835
- path: `/api/v1/triggers/${id}`,
6836
- signal: opts.signal
6837
- });
6838
- }
6839
- async archive(id, opts = {}) {
6840
- const res = await request(this.ctx, {
6841
- method: "POST",
6842
- path: `/api/v1/triggers/${id}/archive`,
6843
- signal: opts.signal
6844
- });
6845
- return res.data;
6846
- }
6847
- async unarchive(id, opts = {}) {
6848
- const res = await request(this.ctx, {
6849
- method: "POST",
6850
- path: `/api/v1/triggers/${id}/unarchive`,
6851
- signal: opts.signal
6852
- });
6853
- return res.data;
6854
- }
6855
- // ---------------------------------------------------------------------------
6856
- // Fire + rotate-secret + runs
6857
- // ---------------------------------------------------------------------------
6858
- /**
6859
- * Fire a trigger via its webhook secret. This endpoint does NOT use the
6860
- * client's `ap_` key — the bearer is the trigger's secret — so we build a
6861
- * one-off HttpContext for it rather than mutating the shared one.
6862
- *
6863
- * Responds HTTP 202. The response identifies the fired trigger via `id`
6864
- * only.
6865
- */
6866
- async fire(id, input, opts = {}) {
6867
- const localCtx = {
6868
- apiUrl: this.ctx.apiUrl,
6869
- key: input.secret,
6870
- fetch: this.ctx.fetch
6871
- };
6872
- const res = await request(localCtx, {
6873
- method: "POST",
6874
- path: `/api/v1/triggers/${id}/fire`,
6875
- body: input.body ?? {},
6876
- signal: opts.signal
6877
- });
6878
- return res.data;
6879
- }
6880
- /**
6881
- * Rotate the webhook secret. Returns the trigger with a fresh one-time
6882
- * plaintext `secret` populated (`TriggerWithSecret`). The old secret
6883
- * immediately stops working.
6884
- */
6885
- async rotateSecret(id, opts = {}) {
6886
- const res = await request(this.ctx, {
6887
- method: "POST",
6888
- path: `/api/v1/triggers/${id}/rotate-secret`,
6889
- signal: opts.signal
6890
- });
6891
- return res.data;
6892
- }
6893
- /** Recent fires + their success/error outcome. */
6894
- async listRuns(id, query = {}, opts = {}) {
6895
- const res = await request(this.ctx, {
6896
- method: "GET",
6897
- path: `/api/v1/triggers/${id}/runs`,
6898
- query,
6899
- signal: opts.signal
6900
- });
6901
- return res.data;
6902
- }
6903
- async getCostStats(id, opts = {}) {
6904
- const res = await request(this.ctx, {
6905
- method: "GET",
6906
- path: `/api/v1/triggers/${id}/cost-stats`,
6907
- signal: opts.signal
6908
- });
6909
- return res.data;
6910
- }
6911
- async getCostStatsMap(query = {}, opts = {}) {
6912
- const res = await request(this.ctx, {
6913
- method: "GET",
6914
- path: "/api/v1/triggers/cost-stats",
6915
- query,
6916
- signal: opts.signal
6917
- });
6918
- return res.data.by_id;
6919
- }
6920
- };
6921
-
6922
6926
  // ../sdk/src/api/user.ts
6923
6927
  var UserApi = class {
6924
6928
  constructor(ctx) {
@@ -7173,7 +7177,7 @@ var WorkspacesApi = class {
7173
7177
  };
7174
7178
 
7175
7179
  // ../sdk/src/version.ts
7176
- var VERSION = "0.2.0" ;
7180
+ var VERSION = "0.3.0" ;
7177
7181
 
7178
7182
  // src/api/app.ts
7179
7183
  var RemoteBundleReader = class {
@@ -7667,7 +7671,7 @@ var IdaptClient2 = class {
7667
7671
  this.agents = new AgentsApi(v1Ctx);
7668
7672
  this.chats = new ChatsApi(v1Ctx);
7669
7673
  this.workspaces = new WorkspacesApi(v1Ctx);
7670
- this.triggers = new TriggersApi(v1Ctx);
7674
+ this.automations = new AutomationsApi(v1Ctx);
7671
7675
  this.computers = new ComputersApi(v1Ctx);
7672
7676
  this.secrets = new SecretsApi(v1Ctx);
7673
7677
  this.kv = new DatastoreApi(v1Ctx);
@@ -8071,6 +8075,7 @@ exports.ApiKeysApi = ApiKeysApi;
8071
8075
  exports.AppFolder = AppFolder;
8072
8076
  exports.AudioApi = AudioApi;
8073
8077
  exports.AuthError = AuthError;
8078
+ exports.AutomationsApi = AutomationsApi;
8074
8079
  exports.BlobsApi = BlobsApi;
8075
8080
  exports.COMMAND_BINDINGS = COMMAND_BINDINGS;
8076
8081
  exports.ChatsApi = ChatsApi;
@@ -8106,7 +8111,6 @@ exports.SharingApi = SharingApi;
8106
8111
  exports.StoreApi = StoreApi;
8107
8112
  exports.SubscriptionApi = SubscriptionApi;
8108
8113
  exports.TablesApi = TablesApi;
8109
- exports.TriggersApi = TriggersApi;
8110
8114
  exports.UserApi = UserApi;
8111
8115
  exports.VERSION = VERSION;
8112
8116
  exports.VideosApi = VideosApi;