@mifune/agro 0.22.0 → 0.23.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.
Files changed (2) hide show
  1. package/dist/agro.js +9 -3
  2. package/package.json +1 -1
package/dist/agro.js CHANGED
@@ -2113,7 +2113,7 @@ import { basename as basename6, join as join6, sep as sep3 } from "node:path";
2113
2113
  import { basename as basename4, resolve as resolve7 } from "node:path";
2114
2114
 
2115
2115
  // src/lib/version.ts
2116
- var AGRO_VERSION = true ? "0.22.0" : "0.0.0-dev";
2116
+ var AGRO_VERSION = true ? "0.23.0" : "0.0.0-dev";
2117
2117
  var OFFICIAL_IMAGE = "ghcr.io/mifunedev/agro";
2118
2118
  var RELEASE_VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[a-z][a-z0-9]*\.[0-9]+)?$/;
2119
2119
  function parseReleaseVersion(value) {
@@ -5160,6 +5160,8 @@ var AGRO_COMMANDS = Object.freeze({
5160
5160
  var DEFAULT_CONSOLE_URL = "https://console.mifune.dev";
5161
5161
  var CONSOLE_CONFIG_MISSING = "set AGRO_CONSOLE_TOKEN, or run agro secret set AGRO_CONSOLE_TOKEN";
5162
5162
  var NODE_READY_TIMEOUT_MS = 15 * 60 * 1e3;
5163
+ var NODE_FAST_POLL_INTERVAL_MS = 1e3;
5164
+ var NODE_FAST_POLL_WINDOW_MS = 30 * 1e3;
5163
5165
  var NODE_POLL_INTERVAL_MS = 5e3;
5164
5166
  var FREE_TIER_SPEC = "n4";
5165
5167
  var FAILURE_STATUSES = /* @__PURE__ */ new Set(["failed", "destroy_requested", "destroying", "destroyed", "retired"]);
@@ -5182,6 +5184,9 @@ function readProjectSecret(key) {
5182
5184
  return void 0;
5183
5185
  }
5184
5186
  }
5187
+ function nodePollDelayMs(elapsedMs) {
5188
+ return elapsedMs < NODE_FAST_POLL_WINDOW_MS ? NODE_FAST_POLL_INTERVAL_MS : NODE_POLL_INTERVAL_MS;
5189
+ }
5185
5190
  function defaultDeps2() {
5186
5191
  return {
5187
5192
  fetch: (input, init) => globalThis.fetch(input, init),
@@ -5189,7 +5194,7 @@ function defaultDeps2() {
5189
5194
  readSecret: readProjectSecret,
5190
5195
  sleep: (ms) => new Promise((done) => setTimeout(done, ms)),
5191
5196
  now: () => Date.now(),
5192
- pollIntervalMs: NODE_POLL_INTERVAL_MS,
5197
+ pollDelayMs: nodePollDelayMs,
5193
5198
  timeoutMs: NODE_READY_TIMEOUT_MS,
5194
5199
  confirm: (question) => confirm(question, false)
5195
5200
  };
@@ -5317,6 +5322,7 @@ async function runCreate(tokens, io, deps, config, bin) {
5317
5322
  return 1;
5318
5323
  }
5319
5324
  const { spec, sshKeyIds, name, freeTier, json } = parsed.args;
5325
+ const requestedAt = deps.now();
5320
5326
  const created = await callApi(deps, config, "POST", "/api/nodes", {
5321
5327
  profile: "sandbox",
5322
5328
  spec,
@@ -5346,7 +5352,7 @@ async function runCreate(tokens, io, deps, config, bin) {
5346
5352
  `);
5347
5353
  return 1;
5348
5354
  }
5349
- await deps.sleep(Math.min(deps.pollIntervalMs, remaining));
5355
+ await deps.sleep(Math.min(deps.pollDelayMs(deps.now() - requestedAt), remaining));
5350
5356
  const polled = await callApi(deps, config, "GET", `/api/nodes/${encodeURIComponent(node.id)}`);
5351
5357
  if (!polled.ok) {
5352
5358
  io.stderr(`${prefix}: node ${node.id}: ${polled.message}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mifune/agro",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "AGRO CLI — create and manage sandboxes for coding agents.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mifunedev/agro#readme",