@alva-ai/toolkit 0.17.0 → 0.17.1-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/cli.d.ts CHANGED
@@ -340,6 +340,8 @@ interface FeedReleaseRequest {
340
340
  * regular (non-agent) feed. The backend validates it against its catalog.
341
341
  */
342
342
  agent_type?: string;
343
+ /** Suppress ReleaseFeed's default publish-time first run. */
344
+ skip_auto_trigger?: boolean;
343
345
  }
344
346
  interface FeedReleaseResponse {
345
347
  feed_id: number;
package/dist/cli.js CHANGED
@@ -9858,7 +9858,8 @@ var ReleaseResource = class {
9858
9858
  view_json: params.view_json,
9859
9859
  description: params.description,
9860
9860
  changelog: params.changelog,
9861
- agent_type: params.agent_type
9861
+ agent_type: params.agent_type,
9862
+ skip_auto_trigger: params.skip_auto_trigger
9862
9863
  }
9863
9864
  });
9864
9865
  }
@@ -13652,7 +13653,7 @@ import * as fs2 from "fs";
13652
13653
  import * as os2 from "os";
13653
13654
  import * as fsPromises2 from "fs/promises";
13654
13655
  import { Agent, setGlobalDispatcher } from "undici";
13655
- var CLI_VERSION = true ? "0.17.0" : "dev";
13656
+ var CLI_VERSION = true ? "0.17.1-beta.0" : "dev";
13656
13657
  var DEFAULT_RUN_TIMEOUT_MS = 6e5;
13657
13658
  var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
13658
13659
  var configuredRunFetchTimeoutMs;
@@ -14044,14 +14045,14 @@ Build-time verify (fire once, then poll up to 5 minutes):
14044
14045
  --run-id "$(echo "$STATUS_JSON" | jq -r .run.id)"`,
14045
14046
  loop: `Usage: alva loop <subcommand> [options]
14046
14047
 
14047
- Create a bounded, self-scheduled in-channel goal loop: a cronjob that each tick runs
14048
- one fire-and-forget agent turn on a channel's stable main session (via the
14049
- @alva/loop SDK), continuing that channel's conversation toward a goal. Sugar
14050
- over 'alva deploy create' \u2014 it seeds a shared loop-runner script and packs the
14051
- goal/channel into the cronjob's args.
14048
+ Create a bounded, self-scheduled in-channel goal loop. Each tick runs one
14049
+ fire-and-forget agent turn on a channel's stable main session (via the
14050
+ @alva/loop SDK), continuing that channel's conversation toward a goal. Creation
14051
+ seeds a shared runner, creates its cronjob, and registers the cronjob as an
14052
+ Automation without starting an extra publish-time run.
14052
14053
 
14053
14054
  Subcommands:
14054
- create Create a loop (seeds the shared loop-runner + a cronjob)
14055
+ create Create a loop and its visible Automation
14055
14056
 
14056
14057
  Create flags:
14057
14058
  --goal <text> Instruction run each tick (required)
@@ -14064,7 +14065,9 @@ Create flags:
14064
14065
  1-63 lowercase alphanumeric/hyphens)
14065
14066
 
14066
14067
  At least one of --until or --runs is required. RFC3339 timestamps must include
14067
- a timezone (Z or \xB1HH:MM).
14068
+ a timezone (Z or \xB1HH:MM). The result includes automation_id and cronjob_id.
14069
+ Use 'alva automation inspect/stop/resume/delete --id <automation_id>' for
14070
+ lifecycle management; deletion also removes the Automation's producer cronjob.
14068
14071
 
14069
14072
  Examples:
14070
14073
  alva loop create --channel-id 7284... --goal "watch NVDA pre-market, alert on setup" --cron "*/5 * * * *" --until "2026-07-15T09:30:00-04:00"
@@ -15255,6 +15258,12 @@ function loopCronjobName(flags, goal) {
15255
15258
  const slug = (base ? `loop-${base}` : "loop").slice(0, 63).replace(/-+$/g, "");
15256
15259
  return slug || "loop";
15257
15260
  }
15261
+ function loopAutomationDescription(goal) {
15262
+ const prefix = "Channel loop: ";
15263
+ const maxDescriptionRunes = 4096;
15264
+ const availableGoalRunes = maxDescriptionRunes - Array.from(prefix).length;
15265
+ return prefix + Array.from(goal).slice(0, availableGoalRunes).join("");
15266
+ }
15258
15267
  function parseCreditsItemsParams(flags) {
15259
15268
  const command = "credits items";
15260
15269
  const hasToday = boolFlag(flags["today"]) === true;
@@ -15750,13 +15759,14 @@ async function dispatch(client, args, meta, deps) {
15750
15759
  "loop"
15751
15760
  );
15752
15761
  }
15762
+ const name = loopCronjobName(flags, goal);
15753
15763
  await client.fs.write({
15754
15764
  path: LOOP_RUNNER_PATH,
15755
15765
  data: LOOP_RUNNER_SRC,
15756
15766
  mkdir_parents: true
15757
15767
  });
15758
- return client.deploy.create({
15759
- name: loopCronjobName(flags, goal),
15768
+ const cronjob = await client.deploy.create({
15769
+ name,
15760
15770
  path: LOOP_RUNNER_PATH,
15761
15771
  cron_expression: cron,
15762
15772
  args: channelId ? { goal, channelId } : { goal },
@@ -15764,6 +15774,33 @@ async function dispatch(client, args, meta, deps) {
15764
15774
  end_at: endAt,
15765
15775
  max_runs: maxRuns
15766
15776
  });
15777
+ try {
15778
+ const automation = await client.automation.publish({
15779
+ name,
15780
+ version: "1.0.0",
15781
+ cronjob_id: cronjob.id,
15782
+ description: loopAutomationDescription(goal),
15783
+ skip_auto_trigger: true
15784
+ });
15785
+ return {
15786
+ name,
15787
+ automation_id: String(automation.feed_id),
15788
+ cronjob_id: cronjob.id
15789
+ };
15790
+ } catch (publishError) {
15791
+ const publishMessage = publishError instanceof Error ? publishError.message : String(publishError);
15792
+ try {
15793
+ await client.deploy.delete({ id: cronjob.id });
15794
+ } catch (rollbackError) {
15795
+ const rollbackMessage = rollbackError instanceof Error ? rollbackError.message : String(rollbackError);
15796
+ throw new Error(
15797
+ `failed to publish loop "${name}" as an automation after creating cronjob ${cronjob.id}: ${publishMessage}; automatic rollback failed: ${rollbackMessage}; cronjob ${cronjob.id} may still exist; run \`alva deploy delete --id ${cronjob.id}\``
15798
+ );
15799
+ }
15800
+ throw new Error(
15801
+ `failed to publish loop "${name}" as an automation; rolled back cronjob ${cronjob.id}: ${publishMessage}`
15802
+ );
15803
+ }
15767
15804
  }
15768
15805
  default:
15769
15806
  throw new CliUsageError(