@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.cjs
CHANGED
|
@@ -20,8 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
AlertsResource: () => AlertsResource,
|
|
23
24
|
AlvaClient: () => AlvaClient,
|
|
24
25
|
AlvaError: () => AlvaError,
|
|
26
|
+
AutomationResource: () => AutomationResource,
|
|
25
27
|
CliUsageError: () => CliUsageError,
|
|
26
28
|
PBSV_UPDATE_MESSAGE: () => PBSV_UPDATE_MESSAGE,
|
|
27
29
|
SUBSCRIBE_PROPOSE_MESSAGE: () => SUBSCRIBE_PROPOSE_MESSAGE,
|
|
@@ -452,6 +454,19 @@ var FeedResource = class {
|
|
|
452
454
|
this.client = client;
|
|
453
455
|
}
|
|
454
456
|
client;
|
|
457
|
+
/**
|
|
458
|
+
* List feeds owned by the caller. Backed by GET /api/v1/feed.
|
|
459
|
+
*/
|
|
460
|
+
async list(params = {}) {
|
|
461
|
+
this.client._requireAuth();
|
|
462
|
+
return this.client._request("GET", "/api/v1/feed", {
|
|
463
|
+
query: {
|
|
464
|
+
limit: params.limit,
|
|
465
|
+
cursor: params.cursor,
|
|
466
|
+
status: params.status
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
455
470
|
/**
|
|
456
471
|
* Stop a feed's producer cronjob. This pauses future scheduled runs while
|
|
457
472
|
* preserving the feed and its existing data.
|
|
@@ -495,6 +510,29 @@ var FeedResource = class {
|
|
|
495
510
|
`/api/v1/feed/${encodeURIComponent(String(id))}`
|
|
496
511
|
);
|
|
497
512
|
}
|
|
513
|
+
/**
|
|
514
|
+
* Publish or unpublish a feed. Backed by POST /api/v1/feed/:id/visibility.
|
|
515
|
+
*
|
|
516
|
+
* Setting visibility to 'public' publishes the feed (the backend sets
|
|
517
|
+
* feeds.is_public and projects the ALFS public read grant in the same
|
|
518
|
+
* transaction); 'private' unpublishes it. Prefer this over granting the
|
|
519
|
+
* ALFS public read subject directly (e.g. `alva fs grant`), which bypasses
|
|
520
|
+
* the is_public flag and causes drift.
|
|
521
|
+
*
|
|
522
|
+
* Auth: caller must own the feed (uid match), enforced by the backend.
|
|
523
|
+
*/
|
|
524
|
+
async setVisibility(params) {
|
|
525
|
+
this.client._requireAuth();
|
|
526
|
+
const id = requireFeedID(params.id);
|
|
527
|
+
if (params.visibility !== "public" && params.visibility !== "private") {
|
|
528
|
+
throw new Error("visibility must be 'public' or 'private'");
|
|
529
|
+
}
|
|
530
|
+
return this.client._request(
|
|
531
|
+
"POST",
|
|
532
|
+
`/api/v1/feed/${encodeURIComponent(String(id))}/visibility`,
|
|
533
|
+
{ body: { visibility: params.visibility } }
|
|
534
|
+
);
|
|
535
|
+
}
|
|
498
536
|
};
|
|
499
537
|
function requireFeedID(id) {
|
|
500
538
|
if (!Number.isInteger(id) || id <= 0) {
|
|
@@ -503,6 +541,46 @@ function requireFeedID(id) {
|
|
|
503
541
|
return id;
|
|
504
542
|
}
|
|
505
543
|
|
|
544
|
+
// src/resources/automation.ts
|
|
545
|
+
var AutomationResource = class {
|
|
546
|
+
constructor(client) {
|
|
547
|
+
this.client = client;
|
|
548
|
+
}
|
|
549
|
+
client;
|
|
550
|
+
list(params = {}) {
|
|
551
|
+
return this.client.feed.list(params);
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Inspect one automation. Backed by GET /api/v1/automation/:id.
|
|
555
|
+
*/
|
|
556
|
+
async inspect(params) {
|
|
557
|
+
this.client._requireAuth();
|
|
558
|
+
const id = requireAutomationID(params.id);
|
|
559
|
+
return this.client._request(
|
|
560
|
+
"GET",
|
|
561
|
+
`/api/v1/automation/${encodeURIComponent(String(id))}`
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
stop(params) {
|
|
565
|
+
return this.client.feed.stop(params);
|
|
566
|
+
}
|
|
567
|
+
resume(params) {
|
|
568
|
+
return this.client.feed.resume(params);
|
|
569
|
+
}
|
|
570
|
+
delete(params) {
|
|
571
|
+
return this.client.feed.delete(params);
|
|
572
|
+
}
|
|
573
|
+
publish(params) {
|
|
574
|
+
return this.client.release.feed(params);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
function requireAutomationID(id) {
|
|
578
|
+
if (!Number.isInteger(id) || id <= 0) {
|
|
579
|
+
throw new Error("automation id must be a positive integer");
|
|
580
|
+
}
|
|
581
|
+
return id;
|
|
582
|
+
}
|
|
583
|
+
|
|
506
584
|
// src/resources/playbooks.ts
|
|
507
585
|
var PLAYBOOK_VISIBILITIES = [
|
|
508
586
|
"public",
|
|
@@ -755,16 +833,6 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
755
833
|
access: "free_and_pro",
|
|
756
834
|
pro_required: false
|
|
757
835
|
},
|
|
758
|
-
{
|
|
759
|
-
skill: "arrays-data-api-spot-market-price-and-volume",
|
|
760
|
-
file: "crypto-detail",
|
|
761
|
-
method: "GET",
|
|
762
|
-
path: "/api/v1/crypto/detail",
|
|
763
|
-
tier: "public",
|
|
764
|
-
required_subscription_tier: "free",
|
|
765
|
-
access: "free_and_pro",
|
|
766
|
-
pro_required: false
|
|
767
|
-
},
|
|
768
836
|
{
|
|
769
837
|
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
770
838
|
file: "fear-greed-index",
|
|
@@ -805,16 +873,6 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
805
873
|
access: "free_and_pro",
|
|
806
874
|
pro_required: false
|
|
807
875
|
},
|
|
808
|
-
{
|
|
809
|
-
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
810
|
-
file: "list",
|
|
811
|
-
method: "GET",
|
|
812
|
-
path: "/api/v1/crypto/list",
|
|
813
|
-
tier: "public",
|
|
814
|
-
required_subscription_tier: "free",
|
|
815
|
-
access: "free_and_pro",
|
|
816
|
-
pro_required: false
|
|
817
|
-
},
|
|
818
876
|
{
|
|
819
877
|
skill: "arrays-data-api-crypto-futures-data",
|
|
820
878
|
file: "long-short-ratio",
|
|
@@ -877,9 +935,9 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
877
935
|
},
|
|
878
936
|
{
|
|
879
937
|
skill: "arrays-data-api-crypto-metrics-and-screener",
|
|
880
|
-
file: "
|
|
938
|
+
file: "crypto-detail",
|
|
881
939
|
method: "GET",
|
|
882
|
-
path: "/api/v1/crypto/
|
|
940
|
+
path: "/api/v1/crypto/detail",
|
|
883
941
|
tier: "public",
|
|
884
942
|
required_subscription_tier: "free",
|
|
885
943
|
access: "free_and_pro",
|
|
@@ -1485,6 +1543,26 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
1485
1543
|
access: "pro_only",
|
|
1486
1544
|
pro_required: true
|
|
1487
1545
|
},
|
|
1546
|
+
{
|
|
1547
|
+
skill: "arrays-data-api-options",
|
|
1548
|
+
file: "greeks",
|
|
1549
|
+
method: "GET",
|
|
1550
|
+
path: "/api/v1/options/greeks",
|
|
1551
|
+
tier: "alternative",
|
|
1552
|
+
required_subscription_tier: "pro",
|
|
1553
|
+
access: "pro_only",
|
|
1554
|
+
pro_required: true
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
skill: "arrays-data-api-options",
|
|
1558
|
+
file: "chain",
|
|
1559
|
+
method: "GET",
|
|
1560
|
+
path: "/api/v1/options/chain",
|
|
1561
|
+
tier: "alternative",
|
|
1562
|
+
required_subscription_tier: "pro",
|
|
1563
|
+
access: "pro_only",
|
|
1564
|
+
pro_required: true
|
|
1565
|
+
},
|
|
1488
1566
|
{
|
|
1489
1567
|
skill: "arrays-data-api-equity-fundamentals",
|
|
1490
1568
|
file: "company-executives",
|
|
@@ -1848,6 +1926,66 @@ var SKILL_ENDPOINT_METADATA = [
|
|
|
1848
1926
|
required_subscription_tier: "free",
|
|
1849
1927
|
access: "free_and_pro",
|
|
1850
1928
|
pro_required: false
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1932
|
+
file: "dram-spot-price",
|
|
1933
|
+
method: "GET",
|
|
1934
|
+
path: "/api/v1/other/semiconductor/dram-spot-price",
|
|
1935
|
+
tier: "alternative",
|
|
1936
|
+
required_subscription_tier: "pro",
|
|
1937
|
+
access: "pro_only",
|
|
1938
|
+
pro_required: true
|
|
1939
|
+
},
|
|
1940
|
+
{
|
|
1941
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1942
|
+
file: "dram-contract-price",
|
|
1943
|
+
method: "GET",
|
|
1944
|
+
path: "/api/v1/other/semiconductor/dram-contract-price",
|
|
1945
|
+
tier: "alternative",
|
|
1946
|
+
required_subscription_tier: "pro",
|
|
1947
|
+
access: "pro_only",
|
|
1948
|
+
pro_required: true
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1952
|
+
file: "nand-flash-spot-price",
|
|
1953
|
+
method: "GET",
|
|
1954
|
+
path: "/api/v1/other/semiconductor/nand-flash-spot-price",
|
|
1955
|
+
tier: "alternative",
|
|
1956
|
+
required_subscription_tier: "pro",
|
|
1957
|
+
access: "pro_only",
|
|
1958
|
+
pro_required: true
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1962
|
+
file: "nand-flash-contract-price",
|
|
1963
|
+
method: "GET",
|
|
1964
|
+
path: "/api/v1/other/semiconductor/nand-flash-contract-price",
|
|
1965
|
+
tier: "alternative",
|
|
1966
|
+
required_subscription_tier: "pro",
|
|
1967
|
+
access: "pro_only",
|
|
1968
|
+
pro_required: true
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1972
|
+
file: "memory-card-price",
|
|
1973
|
+
method: "GET",
|
|
1974
|
+
path: "/api/v1/other/semiconductor/memory-card-price",
|
|
1975
|
+
tier: "alternative",
|
|
1976
|
+
required_subscription_tier: "pro",
|
|
1977
|
+
access: "pro_only",
|
|
1978
|
+
pro_required: true
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
skill: "arrays-data-api-semiconductor-price",
|
|
1982
|
+
file: "dxi-index",
|
|
1983
|
+
method: "GET",
|
|
1984
|
+
path: "/api/v1/other/semiconductor/dxi-index",
|
|
1985
|
+
tier: "alternative",
|
|
1986
|
+
required_subscription_tier: "pro",
|
|
1987
|
+
access: "pro_only",
|
|
1988
|
+
pro_required: true
|
|
1851
1989
|
}
|
|
1852
1990
|
];
|
|
1853
1991
|
function getSkillEndpointMetadata(skill, file) {
|
|
@@ -2417,6 +2555,47 @@ var SubscriptionsResource = class {
|
|
|
2417
2555
|
}
|
|
2418
2556
|
};
|
|
2419
2557
|
|
|
2558
|
+
// src/resources/alerts.ts
|
|
2559
|
+
var AlertsResource = class {
|
|
2560
|
+
constructor(client) {
|
|
2561
|
+
this.client = client;
|
|
2562
|
+
}
|
|
2563
|
+
client;
|
|
2564
|
+
list(params = {}) {
|
|
2565
|
+
return this.client.subscriptions.list(params);
|
|
2566
|
+
}
|
|
2567
|
+
follows(params = {}) {
|
|
2568
|
+
return this.client.subscriptions.follows(params);
|
|
2569
|
+
}
|
|
2570
|
+
enableAutomation(params) {
|
|
2571
|
+
return this.client.subscriptions.subscribeFeed(params);
|
|
2572
|
+
}
|
|
2573
|
+
disableAutomation(params) {
|
|
2574
|
+
return this.client.subscriptions.unsubscribeFeed(params);
|
|
2575
|
+
}
|
|
2576
|
+
enablePlaybook(params) {
|
|
2577
|
+
return this.client.subscriptions.subscribePlaybook(params);
|
|
2578
|
+
}
|
|
2579
|
+
disablePlaybook(params) {
|
|
2580
|
+
return this.client.subscriptions.unsubscribePlaybook(params);
|
|
2581
|
+
}
|
|
2582
|
+
disableBatch(params) {
|
|
2583
|
+
return this.client.subscriptions.unsubscribeBatch(params);
|
|
2584
|
+
}
|
|
2585
|
+
historyAutomation(params) {
|
|
2586
|
+
return this.client.notifications.listFeed(params);
|
|
2587
|
+
}
|
|
2588
|
+
historyPlaybook(params) {
|
|
2589
|
+
return this.client.notifications.listPlaybook(params);
|
|
2590
|
+
}
|
|
2591
|
+
preferences() {
|
|
2592
|
+
return this.client.notificationPreferences.list();
|
|
2593
|
+
}
|
|
2594
|
+
updatePreference(params) {
|
|
2595
|
+
return this.client.notificationPreferences.update(params);
|
|
2596
|
+
}
|
|
2597
|
+
};
|
|
2598
|
+
|
|
2420
2599
|
// src/resources/channelGroupSubscriptions.ts
|
|
2421
2600
|
var ChannelGroupSubscriptionsResource = class {
|
|
2422
2601
|
constructor(client) {
|
|
@@ -2455,6 +2634,24 @@ var ChannelGroupSubscriptionsResource = class {
|
|
|
2455
2634
|
}
|
|
2456
2635
|
);
|
|
2457
2636
|
}
|
|
2637
|
+
/**
|
|
2638
|
+
* Read a group's buffered chat messages in a time window, for the group-chat
|
|
2639
|
+
* digest automation. Admin-gated: the authenticated caller must be that
|
|
2640
|
+
* group's Alva admin (a digest feed runs as that admin). Each message carries
|
|
2641
|
+
* a `permalink` deep-link back to the original message for "jump to original".
|
|
2642
|
+
* `from_micros`/`to_micros` are message-origin timestamps in microseconds.
|
|
2643
|
+
*/
|
|
2644
|
+
async getGroupChatHistory(params) {
|
|
2645
|
+
this.client._requireAuth();
|
|
2646
|
+
return this.client._request("GET", "/api/v1/channel/group-history", {
|
|
2647
|
+
query: {
|
|
2648
|
+
channel: params.channel,
|
|
2649
|
+
remote_chat_id: params.remote_chat_id,
|
|
2650
|
+
from_micros: String(params.from_micros),
|
|
2651
|
+
to_micros: String(params.to_micros)
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
}
|
|
2458
2655
|
};
|
|
2459
2656
|
function mutationBody(params) {
|
|
2460
2657
|
return `{"session_id":${idLiteral(params.session_id)},"target_type":${JSON.stringify(params.target_type)},"target_id":${idLiteral(params.target_id)}}`;
|
|
@@ -2849,6 +3046,7 @@ var AlvaClient = class {
|
|
|
2849
3046
|
_serviceAccount;
|
|
2850
3047
|
_release;
|
|
2851
3048
|
_feed;
|
|
3049
|
+
_automation;
|
|
2852
3050
|
_playbooks;
|
|
2853
3051
|
_secrets;
|
|
2854
3052
|
_sdk;
|
|
@@ -2864,6 +3062,7 @@ var AlvaClient = class {
|
|
|
2864
3062
|
_notifications;
|
|
2865
3063
|
_notificationPreferences;
|
|
2866
3064
|
_subscriptions;
|
|
3065
|
+
_alerts;
|
|
2867
3066
|
_channelGroupSubscriptions;
|
|
2868
3067
|
_feedback;
|
|
2869
3068
|
_functions;
|
|
@@ -2898,6 +3097,9 @@ var AlvaClient = class {
|
|
|
2898
3097
|
get feed() {
|
|
2899
3098
|
return this._feed ??= new FeedResource(this);
|
|
2900
3099
|
}
|
|
3100
|
+
get automation() {
|
|
3101
|
+
return this._automation ??= new AutomationResource(this);
|
|
3102
|
+
}
|
|
2901
3103
|
get playbooks() {
|
|
2902
3104
|
return this._playbooks ??= new PlaybooksResource(this);
|
|
2903
3105
|
}
|
|
@@ -2943,6 +3145,9 @@ var AlvaClient = class {
|
|
|
2943
3145
|
get subscriptions() {
|
|
2944
3146
|
return this._subscriptions ??= new SubscriptionsResource(this);
|
|
2945
3147
|
}
|
|
3148
|
+
get alerts() {
|
|
3149
|
+
return this._alerts ??= new AlertsResource(this);
|
|
3150
|
+
}
|
|
2946
3151
|
get channelGroupSubscriptions() {
|
|
2947
3152
|
return this._channelGroupSubscriptions ??= new ChannelGroupSubscriptionsResource(this);
|
|
2948
3153
|
}
|
|
@@ -3556,11 +3761,13 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
3556
3761
|
};
|
|
3557
3762
|
|
|
3558
3763
|
// src/index.ts
|
|
3559
|
-
var VERSION = true ? "0.
|
|
3764
|
+
var VERSION = true ? "0.16.0" : "dev";
|
|
3560
3765
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3561
3766
|
0 && (module.exports = {
|
|
3767
|
+
AlertsResource,
|
|
3562
3768
|
AlvaClient,
|
|
3563
3769
|
AlvaError,
|
|
3770
|
+
AutomationResource,
|
|
3564
3771
|
CliUsageError,
|
|
3565
3772
|
PBSV_UPDATE_MESSAGE,
|
|
3566
3773
|
SUBSCRIBE_PROPOSE_MESSAGE,
|