@alva-ai/toolkit 0.15.0 → 0.16.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/browser.global.js +3 -3
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +158 -1
- package/dist/cli.js +652 -40
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +230 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +159 -2
- package/dist/index.d.ts +159 -2
- package/dist/index.js +228 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -397,6 +397,19 @@ var FeedResource = class {
|
|
|
397
397
|
this.client = client;
|
|
398
398
|
}
|
|
399
399
|
client;
|
|
400
|
+
/**
|
|
401
|
+
* List feeds owned by the caller. Backed by GET /api/v1/feed.
|
|
402
|
+
*/
|
|
403
|
+
async list(params = {}) {
|
|
404
|
+
this.client._requireAuth();
|
|
405
|
+
return this.client._request("GET", "/api/v1/feed", {
|
|
406
|
+
query: {
|
|
407
|
+
limit: params.limit,
|
|
408
|
+
cursor: params.cursor,
|
|
409
|
+
status: params.status
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
400
413
|
/**
|
|
401
414
|
* Stop a feed's producer cronjob. This pauses future scheduled runs while
|
|
402
415
|
* preserving the feed and its existing data.
|
|
@@ -440,6 +453,29 @@ var FeedResource = class {
|
|
|
440
453
|
`/api/v1/feed/${encodeURIComponent(String(id))}`
|
|
441
454
|
);
|
|
442
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* Publish or unpublish a feed. Backed by POST /api/v1/feed/:id/visibility.
|
|
458
|
+
*
|
|
459
|
+
* Setting visibility to 'public' publishes the feed (the backend sets
|
|
460
|
+
* feeds.is_public and projects the ALFS public read grant in the same
|
|
461
|
+
* transaction); 'private' unpublishes it. Prefer this over granting the
|
|
462
|
+
* ALFS public read subject directly (e.g. `alva fs grant`), which bypasses
|
|
463
|
+
* the is_public flag and causes drift.
|
|
464
|
+
*
|
|
465
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
466
|
+
*/
|
|
467
|
+
async setVisibility(params) {
|
|
468
|
+
this.client._requireAuth();
|
|
469
|
+
const id = requireFeedID(params.id);
|
|
470
|
+
if (params.visibility !== "public" && params.visibility !== "private") {
|
|
471
|
+
throw new Error("visibility must be 'public' or 'private'");
|
|
472
|
+
}
|
|
473
|
+
return this.client._request(
|
|
474
|
+
"POST",
|
|
475
|
+
`/api/v1/feed/${encodeURIComponent(String(id))}/visibility`,
|
|
476
|
+
{ body: { visibility: params.visibility } }
|
|
477
|
+
);
|
|
478
|
+
}
|
|
443
479
|
};
|
|
444
480
|
function requireFeedID(id) {
|
|
445
481
|
if (!Number.isInteger(id) || id <= 0) {
|
|
@@ -448,6 +484,46 @@ function requireFeedID(id) {
|
|
|
448
484
|
return id;
|
|
449
485
|
}
|
|
450
486
|
|
|
487
|
+
// src/resources/automation.ts
|
|
488
|
+
var AutomationResource = class {
|
|
489
|
+
constructor(client) {
|
|
490
|
+
this.client = client;
|
|
491
|
+
}
|
|
492
|
+
client;
|
|
493
|
+
list(params = {}) {
|
|
494
|
+
return this.client.feed.list(params);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Inspect one automation. Backed by GET /api/v1/automation/:id.
|
|
498
|
+
*/
|
|
499
|
+
async inspect(params) {
|
|
500
|
+
this.client._requireAuth();
|
|
501
|
+
const id = requireAutomationID(params.id);
|
|
502
|
+
return this.client._request(
|
|
503
|
+
"GET",
|
|
504
|
+
`/api/v1/automation/${encodeURIComponent(String(id))}`
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
stop(params) {
|
|
508
|
+
return this.client.feed.stop(params);
|
|
509
|
+
}
|
|
510
|
+
resume(params) {
|
|
511
|
+
return this.client.feed.resume(params);
|
|
512
|
+
}
|
|
513
|
+
delete(params) {
|
|
514
|
+
return this.client.feed.delete(params);
|
|
515
|
+
}
|
|
516
|
+
publish(params) {
|
|
517
|
+
return this.client.release.feed(params);
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
function requireAutomationID(id) {
|
|
521
|
+
if (!Number.isInteger(id) || id <= 0) {
|
|
522
|
+
throw new Error("automation id must be a positive integer");
|
|
523
|
+
}
|
|
524
|
+
return id;
|
|
525
|
+
}
|
|
526
|
+
|
|
451
527
|
// src/resources/playbooks.ts
|
|
452
528
|
var PLAYBOOK_VISIBILITIES = [
|
|
453
529
|
"public",
|
|
@@ -700,16 +776,6 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
700
776
|
access: "free_and_pro",
|
|
701
777
|
pro_required: false
|
|
702
778
|
},
|
|
703
|
-
{
|
|
704
|
-
skill: "arrays-data-api-spot-market-price-and-volume",
|
|
705
|
-
file: "crypto-detail",
|
|
706
|
-
method: "GET",
|
|
707
|
-
path: "/api/v1/crypto/detail",
|
|
708
|
-
tier: "public",
|
|
709
|
-
required_subscription_tier: "free",
|
|
710
|
-
access: "free_and_pro",
|
|
711
|
-
pro_required: false
|
|
712
|
-
},
|
|
713
779
|
{
|
|
714
780
|
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
715
781
|
file: "fear-greed-index",
|
|
@@ -750,16 +816,6 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
750
816
|
access: "free_and_pro",
|
|
751
817
|
pro_required: false
|
|
752
818
|
},
|
|
753
|
-
{
|
|
754
|
-
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
755
|
-
file: "list",
|
|
756
|
-
method: "GET",
|
|
757
|
-
path: "/api/v1/crypto/list",
|
|
758
|
-
tier: "public",
|
|
759
|
-
required_subscription_tier: "free",
|
|
760
|
-
access: "free_and_pro",
|
|
761
|
-
pro_required: false
|
|
762
|
-
},
|
|
763
819
|
{
|
|
764
820
|
skill: "arrays-data-api-crypto-futures-data",
|
|
765
821
|
file: "long-short-ratio",
|
|
@@ -822,9 +878,9 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
822
878
|
},
|
|
823
879
|
{
|
|
824
880
|
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
825
|
-
file: "
|
|
881
|
+
file: "crypto-detail",
|
|
826
882
|
method: "GET",
|
|
827
|
-
path: "/api/v1/crypto/
|
|
883
|
+
path: "/api/v1/crypto/detail",
|
|
828
884
|
tier: "public",
|
|
829
885
|
required_subscription_tier: "free",
|
|
830
886
|
access: "free_and_pro",
|
|
@@ -1430,6 +1486,26 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
1430
1486
|
access: "pro_only",
|
|
1431
1487
|
pro_required: true
|
|
1432
1488
|
},
|
|
1489
|
+
{
|
|
1490
|
+
skill: "arrays-data-api-options",
|
|
1491
|
+
file: "greeks",
|
|
1492
|
+
method: "GET",
|
|
1493
|
+
path: "/api/v1/options/greeks",
|
|
1494
|
+
tier: "alternative",
|
|
1495
|
+
required_subscription_tier: "pro",
|
|
1496
|
+
access: "pro_only",
|
|
1497
|
+
pro_required: true
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
skill: "arrays-data-api-options",
|
|
1501
|
+
file: "chain",
|
|
1502
|
+
method: "GET",
|
|
1503
|
+
path: "/api/v1/options/chain",
|
|
1504
|
+
tier: "alternative",
|
|
1505
|
+
required_subscription_tier: "pro",
|
|
1506
|
+
access: "pro_only",
|
|
1507
|
+
pro_required: true
|
|
1508
|
+
},
|
|
1433
1509
|
{
|
|
1434
1510
|
skill: "arrays-data-api-equity-fundamentals",
|
|
1435
1511
|
file: "company-executives",
|
|
@@ -1793,6 +1869,66 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
1793
1869
|
required_subscription_tier: "free",
|
|
1794
1870
|
access: "free_and_pro",
|
|
1795
1871
|
pro_required: false
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1875
|
+
file: "dram-spot-price",
|
|
1876
|
+
method: "GET",
|
|
1877
|
+
path: "/api/v1/other/semiconductor/dram-spot-price",
|
|
1878
|
+
tier: "alternative",
|
|
1879
|
+
required_subscription_tier: "pro",
|
|
1880
|
+
access: "pro_only",
|
|
1881
|
+
pro_required: true
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1885
|
+
file: "dram-contract-price",
|
|
1886
|
+
method: "GET",
|
|
1887
|
+
path: "/api/v1/other/semiconductor/dram-contract-price",
|
|
1888
|
+
tier: "alternative",
|
|
1889
|
+
required_subscription_tier: "pro",
|
|
1890
|
+
access: "pro_only",
|
|
1891
|
+
pro_required: true
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1895
|
+
file: "nand-flash-spot-price",
|
|
1896
|
+
method: "GET",
|
|
1897
|
+
path: "/api/v1/other/semiconductor/nand-flash-spot-price",
|
|
1898
|
+
tier: "alternative",
|
|
1899
|
+
required_subscription_tier: "pro",
|
|
1900
|
+
access: "pro_only",
|
|
1901
|
+
pro_required: true
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1905
|
+
file: "nand-flash-contract-price",
|
|
1906
|
+
method: "GET",
|
|
1907
|
+
path: "/api/v1/other/semiconductor/nand-flash-contract-price",
|
|
1908
|
+
tier: "alternative",
|
|
1909
|
+
required_subscription_tier: "pro",
|
|
1910
|
+
access: "pro_only",
|
|
1911
|
+
pro_required: true
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1915
|
+
file: "memory-card-price",
|
|
1916
|
+
method: "GET",
|
|
1917
|
+
path: "/api/v1/other/semiconductor/memory-card-price",
|
|
1918
|
+
tier: "alternative",
|
|
1919
|
+
required_subscription_tier: "pro",
|
|
1920
|
+
access: "pro_only",
|
|
1921
|
+
pro_required: true
|
|
1922
|
+
},
|
|
1923
|
+
{
|
|
1924
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1925
|
+
file: "dxi-index",
|
|
1926
|
+
method: "GET",
|
|
1927
|
+
path: "/api/v1/other/semiconductor/dxi-index",
|
|
1928
|
+
tier: "alternative",
|
|
1929
|
+
required_subscription_tier: "pro",
|
|
1930
|
+
access: "pro_only",
|
|
1931
|
+
pro_required: true
|
|
1796
1932
|
}
|
|
1797
1933
|
];
|
|
1798
1934
|
function getSkillEndpointMetadata(skill, file) {
|
|
@@ -2362,6 +2498,47 @@ var SubscriptionsResource = class {
|
|
|
2362
2498
|
}
|
|
2363
2499
|
};
|
|
2364
2500
|
|
|
2501
|
+
// src/resources/alerts.ts
|
|
2502
|
+
var AlertsResource = class {
|
|
2503
|
+
constructor(client) {
|
|
2504
|
+
this.client = client;
|
|
2505
|
+
}
|
|
2506
|
+
client;
|
|
2507
|
+
list(params = {}) {
|
|
2508
|
+
return this.client.subscriptions.list(params);
|
|
2509
|
+
}
|
|
2510
|
+
follows(params = {}) {
|
|
2511
|
+
return this.client.subscriptions.follows(params);
|
|
2512
|
+
}
|
|
2513
|
+
enableAutomation(params) {
|
|
2514
|
+
return this.client.subscriptions.subscribeFeed(params);
|
|
2515
|
+
}
|
|
2516
|
+
disableAutomation(params) {
|
|
2517
|
+
return this.client.subscriptions.unsubscribeFeed(params);
|
|
2518
|
+
}
|
|
2519
|
+
enablePlaybook(params) {
|
|
2520
|
+
return this.client.subscriptions.subscribePlaybook(params);
|
|
2521
|
+
}
|
|
2522
|
+
disablePlaybook(params) {
|
|
2523
|
+
return this.client.subscriptions.unsubscribePlaybook(params);
|
|
2524
|
+
}
|
|
2525
|
+
disableBatch(params) {
|
|
2526
|
+
return this.client.subscriptions.unsubscribeBatch(params);
|
|
2527
|
+
}
|
|
2528
|
+
historyAutomation(params) {
|
|
2529
|
+
return this.client.notifications.listFeed(params);
|
|
2530
|
+
}
|
|
2531
|
+
historyPlaybook(params) {
|
|
2532
|
+
return this.client.notifications.listPlaybook(params);
|
|
2533
|
+
}
|
|
2534
|
+
preferences() {
|
|
2535
|
+
return this.client.notificationPreferences.list();
|
|
2536
|
+
}
|
|
2537
|
+
updatePreference(params) {
|
|
2538
|
+
return this.client.notificationPreferences.update(params);
|
|
2539
|
+
}
|
|
2540
|
+
};
|
|
2541
|
+
|
|
2365
2542
|
// src/resources/channelGroupSubscriptions.ts
|
|
2366
2543
|
var ChannelGroupSubscriptionsResource = class {
|
|
2367
2544
|
constructor(client) {
|
|
@@ -2400,6 +2577,24 @@ var ChannelGroupSubscriptionsResource = class {
|
|
|
2400
2577
|
}
|
|
2401
2578
|
);
|
|
2402
2579
|
}
|
|
2580
|
+
/**
|
|
2581
|
+
* Read a group's buffered chat messages in a time window, for the group-chat
|
|
2582
|
+
* digest automation. Admin-gated: the authenticated caller must be that
|
|
2583
|
+
* group's Alva admin (a digest feed runs as that admin). Each message carries
|
|
2584
|
+
* a `permalink` deep-link back to the original message for "jump to original".
|
|
2585
|
+
* `from_micros`/`to_micros` are message-origin timestamps in microseconds.
|
|
2586
|
+
*/
|
|
2587
|
+
async getGroupChatHistory(params) {
|
|
2588
|
+
this.client._requireAuth();
|
|
2589
|
+
return this.client._request("GET", "/api/v1/channel/group-history", {
|
|
2590
|
+
query: {
|
|
2591
|
+
channel: params.channel,
|
|
2592
|
+
remote_chat_id: params.remote_chat_id,
|
|
2593
|
+
from_micros: String(params.from_micros),
|
|
2594
|
+
to_micros: String(params.to_micros)
|
|
2595
|
+
}
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2403
2598
|
};
|
|
2404
2599
|
function mutationBody(params) {
|
|
2405
2600
|
return `{"session_id":${idLiteral(params.session_id)},"target_type":${JSON.stringify(params.target_type)},"target_id":${idLiteral(params.target_id)}}`;
|
|
@@ -2794,6 +2989,7 @@ var AlvaClient = class {
|
|
|
2794
2989
|
_serviceAccount;
|
|
2795
2990
|
_release;
|
|
2796
2991
|
_feed;
|
|
2992
|
+
_automation;
|
|
2797
2993
|
_playbooks;
|
|
2798
2994
|
_secrets;
|
|
2799
2995
|
_sdk;
|
|
@@ -2809,6 +3005,7 @@ var AlvaClient = class {
|
|
|
2809
3005
|
_notifications;
|
|
2810
3006
|
_notificationPreferences;
|
|
2811
3007
|
_subscriptions;
|
|
3008
|
+
_alerts;
|
|
2812
3009
|
_channelGroupSubscriptions;
|
|
2813
3010
|
_feedback;
|
|
2814
3011
|
_functions;
|
|
@@ -2843,6 +3040,9 @@ var AlvaClient = class {
|
|
|
2843
3040
|
get feed() {
|
|
2844
3041
|
return this._feed ??= new FeedResource(this);
|
|
2845
3042
|
}
|
|
3043
|
+
get automation() {
|
|
3044
|
+
return this._automation ??= new AutomationResource(this);
|
|
3045
|
+
}
|
|
2846
3046
|
get playbooks() {
|
|
2847
3047
|
return this._playbooks ??= new PlaybooksResource(this);
|
|
2848
3048
|
}
|
|
@@ -2888,6 +3088,9 @@ var AlvaClient = class {
|
|
|
2888
3088
|
get subscriptions() {
|
|
2889
3089
|
return this._subscriptions ??= new SubscriptionsResource(this);
|
|
2890
3090
|
}
|
|
3091
|
+
get alerts() {
|
|
3092
|
+
return this._alerts ??= new AlertsResource(this);
|
|
3093
|
+
}
|
|
2891
3094
|
get channelGroupSubscriptions() {
|
|
2892
3095
|
return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
|
|
2893
3096
|
}
|
|
@@ -3501,10 +3704,12 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
3501
3704
|
};
|
|
3502
3705
|
|
|
3503
3706
|
// src/index.ts
|
|
3504
|
-
var VERSION = true ? "0.
|
|
3707
|
+
var VERSION = true ? "0.16.0" : "dev";
|
|
3505
3708
|
export {
|
|
3709
|
+
AlertsResource,
|
|
3506
3710
|
AlvaClient,
|
|
3507
3711
|
AlvaError,
|
|
3712
|
+
AutomationResource,
|
|
3508
3713
|
CliUsageError,
|
|
3509
3714
|
PBSV_UPDATE_MESSAGE,
|
|
3510
3715
|
SUBSCRIBE_PROPOSE_MESSAGE,
|