@aexhq/sdk 0.40.1 → 0.40.2

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.mjs CHANGED
@@ -5029,6 +5029,8 @@ function parseFilters(tokens) {
5029
5029
 
5030
5030
  // dist/host/run-cmd.js
5031
5031
  var DEFAULT_SESSION_IDLE_TTL = "3m";
5032
+ var FOLLOW_SETTLE_POLL_DEADLINE_MS = 6e4;
5033
+ var FOLLOW_SETTLE_POLL_INTERVAL_MS = 750;
5032
5034
  async function runRunCmd(io2, argv) {
5033
5035
  if (await refuseInsideManagedRun(io2, "run"))
5034
5036
  return USAGE_ERR;
@@ -5467,7 +5469,7 @@ async function runRunCmd(io2, argv) {
5467
5469
  return SUCCESS;
5468
5470
  }
5469
5471
  try {
5470
- const final = await operations_exports.getSession(http, session.id);
5472
+ const final = await followSettledSessionRecord(http, session.id, controller.signal);
5471
5473
  io2.stdout(JSON.stringify(final) + "\n");
5472
5474
  if (isSessionOk(final.status))
5473
5475
  return SUCCESS;
@@ -5484,6 +5486,43 @@ async function runRunCmd(io2, argv) {
5484
5486
  return RUNTIME_ERR;
5485
5487
  }
5486
5488
  }
5489
+ async function followSettledSessionRecord(http, sessionId, signal) {
5490
+ const deadline = Date.now() + FOLLOW_SETTLE_POLL_DEADLINE_MS;
5491
+ let last = await operations_exports.getSession(http, sessionId);
5492
+ if (isSessionParked2(last.status))
5493
+ return last;
5494
+ while (signal.aborted !== true && Date.now() < deadline) {
5495
+ try {
5496
+ await sleep2(FOLLOW_SETTLE_POLL_INTERVAL_MS, signal);
5497
+ } catch {
5498
+ return last;
5499
+ }
5500
+ const next = await operations_exports.getSession(http, sessionId).catch(() => void 0);
5501
+ if (next === void 0)
5502
+ continue;
5503
+ last = next;
5504
+ if (isSessionParked2(next.status))
5505
+ return next;
5506
+ }
5507
+ return last;
5508
+ }
5509
+ async function sleep2(ms, signal) {
5510
+ if (signal.aborted)
5511
+ return;
5512
+ await new Promise((resolve, reject) => {
5513
+ const cleanup = () => signal.removeEventListener("abort", abort);
5514
+ const timer = setTimeout(() => {
5515
+ cleanup();
5516
+ resolve();
5517
+ }, ms);
5518
+ const abort = () => {
5519
+ clearTimeout(timer);
5520
+ cleanup();
5521
+ reject(new Error("aborted"));
5522
+ };
5523
+ signal.addEventListener("abort", abort, { once: true });
5524
+ });
5525
+ }
5487
5526
  async function buildSkill(io2, ref) {
5488
5527
  const content = await readAtFile(io2, ref);
5489
5528
  return buildCliSkill(content, ref);
@@ -5693,7 +5732,7 @@ async function runWaitCmd(io2, argv) {
5693
5732
  `);
5694
5733
  if (Date.now() >= deadline)
5695
5734
  return timeout({});
5696
- await sleep2(intervalMs);
5735
+ await sleep3(intervalMs);
5697
5736
  continue;
5698
5737
  }
5699
5738
  if (isSessionParked2(session.status)) {
@@ -5702,10 +5741,10 @@ async function runWaitCmd(io2, argv) {
5702
5741
  }
5703
5742
  if (Date.now() >= deadline)
5704
5743
  return timeout({ lastStatus: session.status });
5705
- await sleep2(intervalMs);
5744
+ await sleep3(intervalMs);
5706
5745
  }
5707
5746
  }
5708
- function sleep2(ms) {
5747
+ function sleep3(ms) {
5709
5748
  return new Promise((resolve) => setTimeout(resolve, ms));
5710
5749
  }
5711
5750
 
@@ -5765,7 +5804,7 @@ async function runEventsCmd(io2, argv) {
5765
5804
  `);
5766
5805
  if (Date.now() >= deadline)
5767
5806
  return emitTimeout(io2, sessionId, timeoutMs);
5768
- await sleep3(2e3);
5807
+ await sleep4(2e3);
5769
5808
  continue;
5770
5809
  }
5771
5810
  for (const event of events) {
@@ -5785,14 +5824,14 @@ async function runEventsCmd(io2, argv) {
5785
5824
  }
5786
5825
  if (Date.now() >= deadline)
5787
5826
  return emitTimeout(io2, sessionId, timeoutMs);
5788
- await sleep3(2e3);
5827
+ await sleep4(2e3);
5789
5828
  }
5790
5829
  }
5791
5830
  function emitTimeout(io2, sessionId, timeoutMs) {
5792
5831
  emitJsonError(io2, "events_follow_timeout", `timed out after ${timeoutMs}ms following session events`, { sessionId });
5793
5832
  return TIMEOUT_ERR;
5794
5833
  }
5795
- function sleep3(ms) {
5834
+ function sleep4(ms) {
5796
5835
  return new Promise((resolve) => setTimeout(resolve, ms));
5797
5836
  }
5798
5837
 
@@ -1 +1 @@
1
- 90bc6063ca102b13821b2fbaff9b462f13cccbb4548f18a57017cba9329e1bb2 cli.mjs
1
+ dbb425aaa53f35cc3bab68f292ea0fbe5bdcd30be193cc214e462a846496398f cli.mjs
package/dist/version.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * Used by the (future) User-Agent header on outbound SDK requests.
8
8
  */
9
- export declare const SDK_VERSION = "0.40.1";
9
+ export declare const SDK_VERSION = "0.40.2";
package/dist/version.js CHANGED
@@ -6,5 +6,5 @@
6
6
  *
7
7
  * Used by the (future) User-Agent header on outbound SDK requests.
8
8
  */
9
- export const SDK_VERSION = "0.40.1";
9
+ export const SDK_VERSION = "0.40.2";
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.40.1",
3
+ "version": "0.40.2",
4
4
  "description": "TypeScript SDK for running autonomous agent sessions across providers (Anthropic, OpenAI, DeepSeek, Gemini, Mistral) behind one interface.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {