@alva-ai/toolkit 0.16.0 → 0.16.1-beta.1

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
@@ -15,9 +15,14 @@ interface AlvaClientConfig {
15
15
  interface UserProfile {
16
16
  id: string;
17
17
  username: string;
18
- subscription_tier: 'free' | 'pro';
19
- telegram_username: string | null;
20
- slack_username: string | null;
18
+ subscription_tier: 'free' | 'pro' | 'max';
19
+ telegram_username: string;
20
+ discord_username: string;
21
+ slack_username: string;
22
+ whatsapp_username: string;
23
+ imessage_username: string;
24
+ active_channel: string;
25
+ toolkit_min_version: string;
21
26
  /** Caller's alfs home directory, e.g. `/alva/home/<username>`. */
22
27
  home_path: string;
23
28
  }
@@ -194,6 +199,14 @@ interface CronjobCreateRequest {
194
199
  * A string: SA ids are snowflake int64s that overflow JS number precision.
195
200
  */
196
201
  run_as_user_id?: string;
202
+ /** Inclusive RFC3339 lower bound. Omitted means start now (server clock). */
203
+ start_at?: string;
204
+ /**
205
+ * Exclusive RFC3339 upper bound. A run is admitted only while now < end_at.
206
+ */
207
+ end_at?: string;
208
+ /** Maximum number of admitted runs. */
209
+ max_runs?: number;
197
210
  }
198
211
  interface Cronjob {
199
212
  id: number;
@@ -210,6 +223,17 @@ interface Cronjob {
210
223
  * A string: snowflake int64 ids overflow JS number precision.
211
224
  */
212
225
  run_as_user_id: string;
226
+ /** Inclusive eligibility lower bound, resolved by the server on create. */
227
+ start_at?: string | null;
228
+ /**
229
+ * Lifetime ceiling (RFC3339), or null/omitted when the cronjob has no expiry.
230
+ * Set by `alva loop create`; unset for feeds and other crons.
231
+ */
232
+ end_at?: string | null;
233
+ /** Maximum admitted runs, or null when unbounded by count. */
234
+ max_runs?: number | null;
235
+ /** Number of runs admitted so far. */
236
+ run_count: number;
213
237
  created_at: string;
214
238
  updated_at: string;
215
239
  }
@@ -270,6 +294,22 @@ interface CronjobRunsListResponse {
270
294
  stats?: CronjobRunStats;
271
295
  next_cursor?: number;
272
296
  }
297
+ interface CronjobRunStatusParams {
298
+ cronjob_id: number;
299
+ workflow_run_id: string;
300
+ }
301
+ interface CronjobRunStatusResponse {
302
+ workflow_run_id: string;
303
+ /**
304
+ * PENDING means no cronjob_runs row exists yet. It is not falsifiable:
305
+ * a mistyped workflow_run_id, a workflow_run_id from another cronjob, or
306
+ * a workflow that failed before persistence can remain PENDING forever.
307
+ * DISPATCHED and RUNNING mean an in-flight row exists. Pollers must stop
308
+ * on their own deadline if the run never reaches a terminal state.
309
+ */
310
+ state: 'PENDING' | 'DISPATCHED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'SKIPPED' | 'UNSPECIFIED' | string;
311
+ run?: CronjobRun;
312
+ }
273
313
  interface CronjobRunLogsResponse {
274
314
  logs: string;
275
315
  }
@@ -277,8 +317,9 @@ interface CronjobTriggerResponse {
277
317
  /**
278
318
  * Hatchet workflow run id at enqueue. Async — the persisted
279
319
  * `cronjob_runs` row appears only after the worker finishes the run.
280
- * Callers verify completion by polling `deploy.listRuns({cronjob_id})`
281
- * and matching `runs[].workflow_run_id` against this value.
320
+ * Callers verify completion by polling
321
+ * `deploy.getRunStatus({cronjob_id, workflow_run_id})` with their own
322
+ * timeout/deadline.
282
323
  */
283
324
  workflow_run_id: string;
284
325
  }
@@ -778,8 +819,8 @@ interface PushSubscription {
778
819
  */
779
820
  kind?: 'PLAYBOOK_ALERTS' | 'FEED_ALERT' | 'UNSPECIFIED' | string;
780
821
  /**
781
- * Whether the caller also FOLLOWS the target playbook — the social
782
- * relation, distinct from this alert row. Always false for FEED targets.
822
+ * Legacy social playbook-follow signal. Do not use this to decide whether
823
+ * alert delivery is enabled; use kind + target_status instead.
783
824
  */
784
825
  following?: boolean;
785
826
  /**
@@ -1033,9 +1074,10 @@ declare class DeployResource {
1033
1074
  /**
1034
1075
  * Fire the cronjob workflow once, immediately, bypassing the schedule.
1035
1076
  * Async — returns the Hatchet workflow run id at enqueue. The
1036
- * `cronjob_runs` row appears only after the worker finishes the run;
1037
- * callers verify completion by polling `listRuns({cronjob_id})` and
1038
- * matching `runs[].workflow_run_id` against the returned id.
1077
+ * `cronjob_runs` row can appear as DISPATCHED/RUNNING before it reaches a
1078
+ * terminal status; callers verify completion by polling
1079
+ * `getRunStatus({cronjob_id, workflow_run_id})` with their own
1080
+ * timeout/deadline.
1039
1081
  *
1040
1082
  * Surfaces backend status as HTTP errors (handled by AlvaClient):
1041
1083
  * - 404 not found / cross-user
@@ -1046,6 +1088,7 @@ declare class DeployResource {
1046
1088
  id: number;
1047
1089
  }): Promise<CronjobTriggerResponse>;
1048
1090
  listRuns(params: CronjobRunsListParams): Promise<CronjobRunsListResponse>;
1091
+ getRunStatus(params: CronjobRunStatusParams): Promise<CronjobRunStatusResponse>;
1049
1092
  getRunLogs(params: {
1050
1093
  cronjob_id: number;
1051
1094
  run_id: number;
package/dist/index.d.ts CHANGED
@@ -15,9 +15,14 @@ interface AlvaClientConfig {
15
15
  interface UserProfile {
16
16
  id: string;
17
17
  username: string;
18
- subscription_tier: 'free' | 'pro';
19
- telegram_username: string | null;
20
- slack_username: string | null;
18
+ subscription_tier: 'free' | 'pro' | 'max';
19
+ telegram_username: string;
20
+ discord_username: string;
21
+ slack_username: string;
22
+ whatsapp_username: string;
23
+ imessage_username: string;
24
+ active_channel: string;
25
+ toolkit_min_version: string;
21
26
  /** Caller's alfs home directory, e.g. `/alva/home/<username>`. */
22
27
  home_path: string;
23
28
  }
@@ -194,6 +199,14 @@ interface CronjobCreateRequest {
194
199
  * A string: SA ids are snowflake int64s that overflow JS number precision.
195
200
  */
196
201
  run_as_user_id?: string;
202
+ /** Inclusive RFC3339 lower bound. Omitted means start now (server clock). */
203
+ start_at?: string;
204
+ /**
205
+ * Exclusive RFC3339 upper bound. A run is admitted only while now < end_at.
206
+ */
207
+ end_at?: string;
208
+ /** Maximum number of admitted runs. */
209
+ max_runs?: number;
197
210
  }
198
211
  interface Cronjob {
199
212
  id: number;
@@ -210,6 +223,17 @@ interface Cronjob {
210
223
  * A string: snowflake int64 ids overflow JS number precision.
211
224
  */
212
225
  run_as_user_id: string;
226
+ /** Inclusive eligibility lower bound, resolved by the server on create. */
227
+ start_at?: string | null;
228
+ /**
229
+ * Lifetime ceiling (RFC3339), or null/omitted when the cronjob has no expiry.
230
+ * Set by `alva loop create`; unset for feeds and other crons.
231
+ */
232
+ end_at?: string | null;
233
+ /** Maximum admitted runs, or null when unbounded by count. */
234
+ max_runs?: number | null;
235
+ /** Number of runs admitted so far. */
236
+ run_count: number;
213
237
  created_at: string;
214
238
  updated_at: string;
215
239
  }
@@ -270,6 +294,22 @@ interface CronjobRunsListResponse {
270
294
  stats?: CronjobRunStats;
271
295
  next_cursor?: number;
272
296
  }
297
+ interface CronjobRunStatusParams {
298
+ cronjob_id: number;
299
+ workflow_run_id: string;
300
+ }
301
+ interface CronjobRunStatusResponse {
302
+ workflow_run_id: string;
303
+ /**
304
+ * PENDING means no cronjob_runs row exists yet. It is not falsifiable:
305
+ * a mistyped workflow_run_id, a workflow_run_id from another cronjob, or
306
+ * a workflow that failed before persistence can remain PENDING forever.
307
+ * DISPATCHED and RUNNING mean an in-flight row exists. Pollers must stop
308
+ * on their own deadline if the run never reaches a terminal state.
309
+ */
310
+ state: 'PENDING' | 'DISPATCHED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'SKIPPED' | 'UNSPECIFIED' | string;
311
+ run?: CronjobRun;
312
+ }
273
313
  interface CronjobRunLogsResponse {
274
314
  logs: string;
275
315
  }
@@ -277,8 +317,9 @@ interface CronjobTriggerResponse {
277
317
  /**
278
318
  * Hatchet workflow run id at enqueue. Async — the persisted
279
319
  * `cronjob_runs` row appears only after the worker finishes the run.
280
- * Callers verify completion by polling `deploy.listRuns({cronjob_id})`
281
- * and matching `runs[].workflow_run_id` against this value.
320
+ * Callers verify completion by polling
321
+ * `deploy.getRunStatus({cronjob_id, workflow_run_id})` with their own
322
+ * timeout/deadline.
282
323
  */
283
324
  workflow_run_id: string;
284
325
  }
@@ -778,8 +819,8 @@ interface PushSubscription {
778
819
  */
779
820
  kind?: 'PLAYBOOK_ALERTS' | 'FEED_ALERT' | 'UNSPECIFIED' | string;
780
821
  /**
781
- * Whether the caller also FOLLOWS the target playbook — the social
782
- * relation, distinct from this alert row. Always false for FEED targets.
822
+ * Legacy social playbook-follow signal. Do not use this to decide whether
823
+ * alert delivery is enabled; use kind + target_status instead.
783
824
  */
784
825
  following?: boolean;
785
826
  /**
@@ -1033,9 +1074,10 @@ declare class DeployResource {
1033
1074
  /**
1034
1075
  * Fire the cronjob workflow once, immediately, bypassing the schedule.
1035
1076
  * Async — returns the Hatchet workflow run id at enqueue. The
1036
- * `cronjob_runs` row appears only after the worker finishes the run;
1037
- * callers verify completion by polling `listRuns({cronjob_id})` and
1038
- * matching `runs[].workflow_run_id` against the returned id.
1077
+ * `cronjob_runs` row can appear as DISPATCHED/RUNNING before it reaches a
1078
+ * terminal status; callers verify completion by polling
1079
+ * `getRunStatus({cronjob_id, workflow_run_id})` with their own
1080
+ * timeout/deadline.
1039
1081
  *
1040
1082
  * Surfaces backend status as HTTP errors (handled by AlvaClient):
1041
1083
  * - 404 not found / cross-user
@@ -1046,6 +1088,7 @@ declare class DeployResource {
1046
1088
  id: number;
1047
1089
  }): Promise<CronjobTriggerResponse>;
1048
1090
  listRuns(params: CronjobRunsListParams): Promise<CronjobRunsListResponse>;
1091
+ getRunStatus(params: CronjobRunStatusParams): Promise<CronjobRunStatusResponse>;
1049
1092
  getRunLogs(params: {
1050
1093
  cronjob_id: number;
1051
1094
  run_id: number;
package/dist/index.js CHANGED
@@ -219,7 +219,10 @@ var DeployResource = class {
219
219
  args: params.args,
220
220
  push_notify: params.push_notify,
221
221
  max_heap_size_mb: params.max_heap_size_mb,
222
- run_as_user_id: params.run_as_user_id
222
+ run_as_user_id: params.run_as_user_id,
223
+ start_at: params.start_at,
224
+ end_at: params.end_at,
225
+ max_runs: params.max_runs
223
226
  }
224
227
  });
225
228
  }
@@ -264,9 +267,10 @@ var DeployResource = class {
264
267
  /**
265
268
  * Fire the cronjob workflow once, immediately, bypassing the schedule.
266
269
  * Async — returns the Hatchet workflow run id at enqueue. The
267
- * `cronjob_runs` row appears only after the worker finishes the run;
268
- * callers verify completion by polling `listRuns({cronjob_id})` and
269
- * matching `runs[].workflow_run_id` against the returned id.
270
+ * `cronjob_runs` row can appear as DISPATCHED/RUNNING before it reaches a
271
+ * terminal status; callers verify completion by polling
272
+ * `getRunStatus({cronjob_id, workflow_run_id})` with their own
273
+ * timeout/deadline.
270
274
  *
271
275
  * Surfaces backend status as HTTP errors (handled by AlvaClient):
272
276
  * - 404 not found / cross-user
@@ -290,6 +294,13 @@ var DeployResource = class {
290
294
  }
291
295
  );
292
296
  }
297
+ async getRunStatus(params) {
298
+ this.client._requireAuth();
299
+ return this.client._request(
300
+ "GET",
301
+ `/api/v1/deploy/cronjob/${params.cronjob_id}/runs/by-workflow/${encodeURIComponent(params.workflow_run_id)}`
302
+ );
303
+ }
293
304
  async getRunLogs(params) {
294
305
  this.client._requireAuth();
295
306
  return this.client._request(
@@ -3704,7 +3715,7 @@ var installPlaybookRuntime = (targetWindow) => {
3704
3715
  };
3705
3716
 
3706
3717
  // src/index.ts
3707
- var VERSION = true ? "0.16.0" : "dev";
3718
+ var VERSION = true ? "0.16.1-beta.1" : "dev";
3708
3719
  export {
3709
3720
  AlertsResource,
3710
3721
  AlvaClient,