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