@alva-ai/toolkit 0.4.3 → 0.7.0-beta.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.d.cts CHANGED
@@ -5,7 +5,7 @@ interface AlvaClientConfig {
5
5
  arraysBaseUrl?: string;
6
6
  }
7
7
  interface UserProfile {
8
- id: number;
8
+ id: string;
9
9
  username: string;
10
10
  subscription_tier: 'free' | 'pro';
11
11
  telegram_username: string | null;
@@ -161,6 +161,14 @@ interface CronjobRun {
161
161
  duration_ms: number;
162
162
  credits_used: number;
163
163
  created_at: string;
164
+ /**
165
+ * Hatchet workflow run id captured at trigger time. Populated for runs
166
+ * persisted by recent worker binaries (both naturally-scheduled ticks and
167
+ * triggered runs); empty for older rows. External callers that issued
168
+ * `deploy.trigger()` filter by this field to find the run their request
169
+ * produced.
170
+ */
171
+ workflow_run_id?: string;
164
172
  }
165
173
  interface CronjobRunStats {
166
174
  total_runs: number;
@@ -177,6 +185,15 @@ interface CronjobRunsListResponse {
177
185
  interface CronjobRunLogsResponse {
178
186
  logs: string;
179
187
  }
188
+ interface CronjobTriggerResponse {
189
+ /**
190
+ * Hatchet workflow run id at enqueue. Async — the persisted
191
+ * `cronjob_runs` row appears only after the worker finishes the run.
192
+ * Callers verify completion by polling `deploy.listRuns({cronjob_id})`
193
+ * and matching `runs[].workflow_run_id` against this value.
194
+ */
195
+ workflow_run_id: string;
196
+ }
180
197
  interface FeedReleaseRequest {
181
198
  name: string;
182
199
  version: string;
@@ -201,6 +218,12 @@ interface PlaybookDraftRequest {
201
218
  feed_major?: number;
202
219
  }>;
203
220
  trading_symbols?: string[];
221
+ /**
222
+ * Optional source-template reference in "username/name" form (matches
223
+ * playbook_templates PK, e.g. "alva/screener"). Persisted set-once on
224
+ * the playbook's first draft; subsequent drafts ignore the field.
225
+ */
226
+ template_id?: string;
204
227
  }
205
228
  interface PlaybookDraftResponse {
206
229
  playbook_id: number;
@@ -216,6 +239,14 @@ interface PlaybookReleaseRequest {
216
239
  feed_major?: number;
217
240
  }>;
218
241
  changelog: string;
242
+ /**
243
+ * Owner-attested README location. Server validates the value is one of:
244
+ * - relative: `<name>/README.md`
245
+ * - absolute: `/alva/home/<username>/playbooks/<name>/README.md`
246
+ * The owner is responsible for placing the README at that path on ALFS
247
+ * before publish; the server does not write the file.
248
+ */
249
+ readme_url: string;
219
250
  }
220
251
  interface PlaybookReleaseResponse {
221
252
  playbook_id: number;
@@ -288,6 +319,9 @@ interface ScreenshotParams {
288
319
  url: string;
289
320
  selector?: string;
290
321
  xpath?: string;
322
+ compress?: boolean;
323
+ compressQuality?: number;
324
+ compressMaxWidth?: number;
291
325
  }
292
326
  interface TradingAccount {
293
327
  id: string;
@@ -572,6 +606,21 @@ declare class DeployResource {
572
606
  resume(params: {
573
607
  id: number;
574
608
  }): Promise<void>;
609
+ /**
610
+ * Fire the cronjob workflow once, immediately, bypassing the schedule.
611
+ * Async — returns the Hatchet workflow run id at enqueue. The
612
+ * `cronjob_runs` row appears only after the worker finishes the run;
613
+ * callers verify completion by polling `listRuns({cronjob_id})` and
614
+ * matching `runs[].workflow_run_id` against the returned id.
615
+ *
616
+ * Surfaces backend status as HTTP errors (handled by AlvaClient):
617
+ * - 404 not found / cross-user
618
+ * - 412 cronjob is paused (resume before triggering)
619
+ * - 503 worker workflow handle not yet connected (startup race)
620
+ */
621
+ trigger(params: {
622
+ id: number;
623
+ }): Promise<CronjobTriggerResponse>;
575
624
  listRuns(params: CronjobRunsListParams): Promise<CronjobRunsListResponse>;
576
625
  getRunLogs(params: {
577
626
  cronjob_id: number;
@@ -618,16 +667,40 @@ declare class SdkDocsResource {
618
667
  }): Promise<PartitionSummaryResponse>;
619
668
  }
620
669
 
670
+ type SkillEndpointTier = 'public' | 'alternative' | 'unstructured';
671
+ interface SkillEndpointMetadata {
672
+ skill: string;
673
+ file: string;
674
+ method: string;
675
+ path: string;
676
+ tier: SkillEndpointTier;
677
+ required_subscription_tier: 'free' | 'pro';
678
+ access: 'free_and_pro' | 'pro_only';
679
+ pro_required: boolean;
680
+ }
681
+
682
+ type SkillTierCounts = Partial<Record<SkillEndpointTier, number>>;
683
+
684
+ interface SkillMetadata {
685
+ endpoint_count: number;
686
+ endpoint_tier_counts: SkillTierCounts;
687
+ pro_count: number;
688
+ }
621
689
  interface SkillSummary {
622
690
  name: string;
623
691
  description: string;
692
+ metadata?: SkillMetadata;
693
+ endpoint_tier_counts?: SkillTierCounts;
624
694
  }
625
695
  interface SkillDoc {
626
696
  name: string;
627
697
  description: string;
628
698
  content: string;
699
+ metadata?: SkillMetadata | SkillEndpointMetadata;
700
+ endpoint_metadata?: SkillEndpointMetadata[];
701
+ endpoint_tier_counts?: SkillTierCounts;
629
702
  }
630
- declare class SkillsResource {
703
+ declare class DataSkillsResource {
631
704
  private client;
632
705
  constructor(client: AlvaClient);
633
706
  list(): Promise<{
@@ -642,6 +715,47 @@ declare class SkillsResource {
642
715
  }): Promise<SkillDoc>;
643
716
  }
644
717
 
718
+ interface PlaybookSkillSummary {
719
+ username: string;
720
+ name: string;
721
+ description: string;
722
+ tags: string[];
723
+ creator_uid: number;
724
+ updated_at: string;
725
+ }
726
+ interface PlaybookSkillFileMeta {
727
+ path: string;
728
+ size_bytes: number;
729
+ }
730
+ interface PlaybookSkillMeta extends PlaybookSkillSummary {
731
+ files: PlaybookSkillFileMeta[];
732
+ }
733
+ interface PlaybookSkillFile {
734
+ username: string;
735
+ name: string;
736
+ path: string;
737
+ content: string;
738
+ updated_at: string;
739
+ }
740
+ interface PlaybookSkillTagEntry {
741
+ name: string;
742
+ }
743
+ declare class PlaybookSkillsResource {
744
+ private client;
745
+ constructor(client: AlvaClient);
746
+ list(params?: {
747
+ tag?: string;
748
+ username?: string;
749
+ }): Promise<{
750
+ skills: PlaybookSkillSummary[];
751
+ }>;
752
+ tags(): Promise<{
753
+ tags: PlaybookSkillTagEntry[];
754
+ }>;
755
+ get(id: string): Promise<PlaybookSkillMeta>;
756
+ file(id: string, path: string): Promise<PlaybookSkillFile>;
757
+ }
758
+
645
759
  declare class CommentsResource {
646
760
  private client;
647
761
  constructor(client: AlvaClient);
@@ -824,7 +938,8 @@ declare class AlvaClient {
824
938
  private _release?;
825
939
  private _secrets?;
826
940
  private _sdk?;
827
- private _skills?;
941
+ private _dataSkills?;
942
+ private _playbookSkills?;
828
943
  private _comments?;
829
944
  private _remix?;
830
945
  private _screenshot?;
@@ -841,7 +956,8 @@ declare class AlvaClient {
841
956
  get release(): ReleaseResource;
842
957
  get secrets(): SecretsResource;
843
958
  get sdk(): SdkDocsResource;
844
- get skills(): SkillsResource;
959
+ get dataSkills(): DataSkillsResource;
960
+ get playbookSkills(): PlaybookSkillsResource;
845
961
  get comments(): CommentsResource;
846
962
  get remix(): RemixResource;
847
963
  get screenshot(): ScreenshotResource;
@@ -864,4 +980,4 @@ declare class AlvaError extends Error {
864
980
  /** SDK version, injected at build time from package.json. */
865
981
  declare const VERSION: string;
866
982
 
867
- export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, VERSION };
983
+ export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, VERSION };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ interface AlvaClientConfig {
5
5
  arraysBaseUrl?: string;
6
6
  }
7
7
  interface UserProfile {
8
- id: number;
8
+ id: string;
9
9
  username: string;
10
10
  subscription_tier: 'free' | 'pro';
11
11
  telegram_username: string | null;
@@ -161,6 +161,14 @@ interface CronjobRun {
161
161
  duration_ms: number;
162
162
  credits_used: number;
163
163
  created_at: string;
164
+ /**
165
+ * Hatchet workflow run id captured at trigger time. Populated for runs
166
+ * persisted by recent worker binaries (both naturally-scheduled ticks and
167
+ * triggered runs); empty for older rows. External callers that issued
168
+ * `deploy.trigger()` filter by this field to find the run their request
169
+ * produced.
170
+ */
171
+ workflow_run_id?: string;
164
172
  }
165
173
  interface CronjobRunStats {
166
174
  total_runs: number;
@@ -177,6 +185,15 @@ interface CronjobRunsListResponse {
177
185
  interface CronjobRunLogsResponse {
178
186
  logs: string;
179
187
  }
188
+ interface CronjobTriggerResponse {
189
+ /**
190
+ * Hatchet workflow run id at enqueue. Async — the persisted
191
+ * `cronjob_runs` row appears only after the worker finishes the run.
192
+ * Callers verify completion by polling `deploy.listRuns({cronjob_id})`
193
+ * and matching `runs[].workflow_run_id` against this value.
194
+ */
195
+ workflow_run_id: string;
196
+ }
180
197
  interface FeedReleaseRequest {
181
198
  name: string;
182
199
  version: string;
@@ -201,6 +218,12 @@ interface PlaybookDraftRequest {
201
218
  feed_major?: number;
202
219
  }>;
203
220
  trading_symbols?: string[];
221
+ /**
222
+ * Optional source-template reference in "username/name" form (matches
223
+ * playbook_templates PK, e.g. "alva/screener"). Persisted set-once on
224
+ * the playbook's first draft; subsequent drafts ignore the field.
225
+ */
226
+ template_id?: string;
204
227
  }
205
228
  interface PlaybookDraftResponse {
206
229
  playbook_id: number;
@@ -216,6 +239,14 @@ interface PlaybookReleaseRequest {
216
239
  feed_major?: number;
217
240
  }>;
218
241
  changelog: string;
242
+ /**
243
+ * Owner-attested README location. Server validates the value is one of:
244
+ * - relative: `<name>/README.md`
245
+ * - absolute: `/alva/home/<username>/playbooks/<name>/README.md`
246
+ * The owner is responsible for placing the README at that path on ALFS
247
+ * before publish; the server does not write the file.
248
+ */
249
+ readme_url: string;
219
250
  }
220
251
  interface PlaybookReleaseResponse {
221
252
  playbook_id: number;
@@ -288,6 +319,9 @@ interface ScreenshotParams {
288
319
  url: string;
289
320
  selector?: string;
290
321
  xpath?: string;
322
+ compress?: boolean;
323
+ compressQuality?: number;
324
+ compressMaxWidth?: number;
291
325
  }
292
326
  interface TradingAccount {
293
327
  id: string;
@@ -572,6 +606,21 @@ declare class DeployResource {
572
606
  resume(params: {
573
607
  id: number;
574
608
  }): Promise<void>;
609
+ /**
610
+ * Fire the cronjob workflow once, immediately, bypassing the schedule.
611
+ * Async — returns the Hatchet workflow run id at enqueue. The
612
+ * `cronjob_runs` row appears only after the worker finishes the run;
613
+ * callers verify completion by polling `listRuns({cronjob_id})` and
614
+ * matching `runs[].workflow_run_id` against the returned id.
615
+ *
616
+ * Surfaces backend status as HTTP errors (handled by AlvaClient):
617
+ * - 404 not found / cross-user
618
+ * - 412 cronjob is paused (resume before triggering)
619
+ * - 503 worker workflow handle not yet connected (startup race)
620
+ */
621
+ trigger(params: {
622
+ id: number;
623
+ }): Promise<CronjobTriggerResponse>;
575
624
  listRuns(params: CronjobRunsListParams): Promise<CronjobRunsListResponse>;
576
625
  getRunLogs(params: {
577
626
  cronjob_id: number;
@@ -618,16 +667,40 @@ declare class SdkDocsResource {
618
667
  }): Promise<PartitionSummaryResponse>;
619
668
  }
620
669
 
670
+ type SkillEndpointTier = 'public' | 'alternative' | 'unstructured';
671
+ interface SkillEndpointMetadata {
672
+ skill: string;
673
+ file: string;
674
+ method: string;
675
+ path: string;
676
+ tier: SkillEndpointTier;
677
+ required_subscription_tier: 'free' | 'pro';
678
+ access: 'free_and_pro' | 'pro_only';
679
+ pro_required: boolean;
680
+ }
681
+
682
+ type SkillTierCounts = Partial<Record<SkillEndpointTier, number>>;
683
+
684
+ interface SkillMetadata {
685
+ endpoint_count: number;
686
+ endpoint_tier_counts: SkillTierCounts;
687
+ pro_count: number;
688
+ }
621
689
  interface SkillSummary {
622
690
  name: string;
623
691
  description: string;
692
+ metadata?: SkillMetadata;
693
+ endpoint_tier_counts?: SkillTierCounts;
624
694
  }
625
695
  interface SkillDoc {
626
696
  name: string;
627
697
  description: string;
628
698
  content: string;
699
+ metadata?: SkillMetadata | SkillEndpointMetadata;
700
+ endpoint_metadata?: SkillEndpointMetadata[];
701
+ endpoint_tier_counts?: SkillTierCounts;
629
702
  }
630
- declare class SkillsResource {
703
+ declare class DataSkillsResource {
631
704
  private client;
632
705
  constructor(client: AlvaClient);
633
706
  list(): Promise<{
@@ -642,6 +715,47 @@ declare class SkillsResource {
642
715
  }): Promise<SkillDoc>;
643
716
  }
644
717
 
718
+ interface PlaybookSkillSummary {
719
+ username: string;
720
+ name: string;
721
+ description: string;
722
+ tags: string[];
723
+ creator_uid: number;
724
+ updated_at: string;
725
+ }
726
+ interface PlaybookSkillFileMeta {
727
+ path: string;
728
+ size_bytes: number;
729
+ }
730
+ interface PlaybookSkillMeta extends PlaybookSkillSummary {
731
+ files: PlaybookSkillFileMeta[];
732
+ }
733
+ interface PlaybookSkillFile {
734
+ username: string;
735
+ name: string;
736
+ path: string;
737
+ content: string;
738
+ updated_at: string;
739
+ }
740
+ interface PlaybookSkillTagEntry {
741
+ name: string;
742
+ }
743
+ declare class PlaybookSkillsResource {
744
+ private client;
745
+ constructor(client: AlvaClient);
746
+ list(params?: {
747
+ tag?: string;
748
+ username?: string;
749
+ }): Promise<{
750
+ skills: PlaybookSkillSummary[];
751
+ }>;
752
+ tags(): Promise<{
753
+ tags: PlaybookSkillTagEntry[];
754
+ }>;
755
+ get(id: string): Promise<PlaybookSkillMeta>;
756
+ file(id: string, path: string): Promise<PlaybookSkillFile>;
757
+ }
758
+
645
759
  declare class CommentsResource {
646
760
  private client;
647
761
  constructor(client: AlvaClient);
@@ -824,7 +938,8 @@ declare class AlvaClient {
824
938
  private _release?;
825
939
  private _secrets?;
826
940
  private _sdk?;
827
- private _skills?;
941
+ private _dataSkills?;
942
+ private _playbookSkills?;
828
943
  private _comments?;
829
944
  private _remix?;
830
945
  private _screenshot?;
@@ -841,7 +956,8 @@ declare class AlvaClient {
841
956
  get release(): ReleaseResource;
842
957
  get secrets(): SecretsResource;
843
958
  get sdk(): SdkDocsResource;
844
- get skills(): SkillsResource;
959
+ get dataSkills(): DataSkillsResource;
960
+ get playbookSkills(): PlaybookSkillsResource;
845
961
  get comments(): CommentsResource;
846
962
  get remix(): RemixResource;
847
963
  get screenshot(): ScreenshotResource;
@@ -864,4 +980,4 @@ declare class AlvaError extends Error {
864
980
  /** SDK version, injected at build time from package.json. */
865
981
  declare const VERSION: string;
866
982
 
867
- export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, VERSION };
983
+ export { AlvaClient, type AlvaClientConfig, AlvaError, type ChannelGroupAdminInfo, type ChannelGroupCallerInfo, type ChannelGroupSubscription, type ChannelGroupSubscriptionContextResponse, type ChannelGroupSubscriptionListResponse, type ChannelGroupSubscriptionMutationParams, type ChannelGroupSubscriptionMutationResponse, type ChannelGroupSubscriptionSessionParams, type ChannelGroupSubscriptionTarget, type ChannelGroupSubscriptionTargetType, type FsChmodParams, type FsCopyParams, type FsEntry, type FsGrantParams, type FsMkdirParams, type FsRawWriteParams, type FsReadParams, type FsReaddirParams, type FsReaddirResponse, type FsReadlinkParams, type FsRemoveParams, type FsRenameParams, type FsRevokeParams, type FsStat, type FsSymlinkParams, type FsWriteParams, type FsWriteResponse, type SkillDoc, type SkillEndpointMetadata, type SkillEndpointTier, type SkillMetadata, type SkillSummary, VERSION };