@naylence/agent-sdk 0.3.4-test.717 → 0.3.4-test.721

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.
@@ -15671,12 +15671,12 @@
15671
15671
  // --- END ENV SHIM ---
15672
15672
 
15673
15673
  // This file is auto-generated during build - do not edit manually
15674
- // Generated from package.json version: 0.3.5-test.919
15674
+ // Generated from package.json version: 0.3.5-test.921
15675
15675
  /**
15676
15676
  * The package version, injected at build time.
15677
15677
  * @internal
15678
15678
  */
15679
- const VERSION$1 = '0.3.5-test.919';
15679
+ const VERSION$1 = '0.3.5-test.921';
15680
15680
 
15681
15681
  /**
15682
15682
  * Fame protocol specific error classes with WebSocket close codes and proper inheritance.
@@ -16174,15 +16174,22 @@
16174
16174
  return LogLevel.OFF;
16175
16175
  }
16176
16176
  // Check FAME_LOG_LEVEL environment variable
16177
- if (isNode && typeof process !== 'undefined' && process.env.FAME_LOG_LEVEL) {
16177
+ let envLevel;
16178
+ if (isNode && typeof process !== 'undefined') {
16179
+ envLevel = process.env.FAME_LOG_LEVEL;
16180
+ }
16181
+ else if (typeof window !== 'undefined' && window.__ENV__) {
16182
+ envLevel = window.__ENV__.FAME_LOG_LEVEL;
16183
+ }
16184
+ if (envLevel) {
16178
16185
  try {
16179
- const envLevel = process.env.FAME_LOG_LEVEL.trim().toUpperCase();
16186
+ const normalized = envLevel.trim().toUpperCase();
16180
16187
  // Direct enum name match (e.g., "DEBUG", "INFO")
16181
- if (envLevel in LogLevel) {
16182
- return LogLevel[envLevel];
16188
+ if (normalized in LogLevel) {
16189
+ return LogLevel[normalized];
16183
16190
  }
16184
16191
  // Try alternative mappings
16185
- if (envLevel === 'WARN')
16192
+ if (normalized === 'WARN')
16186
16193
  return LogLevel.WARNING;
16187
16194
  }
16188
16195
  catch {
@@ -16670,17 +16677,18 @@
16670
16677
  grace_period_ms: gracePeriod,
16671
16678
  });
16672
16679
  const tasks = Array.from(this._tasks.values());
16673
- // 1. Python-style wait with immediate timeout check
16680
+ // 1. Signal all tasks to stop immediately (abort signal)
16681
+ // This allows long-running loops to break out of waits/sleeps
16682
+ tasks.forEach((task) => task.cancel());
16683
+ // 2. Wait gracefully for tasks to complete their cleanup
16674
16684
  const completed = await this._waitWithGracePeriod(tasks, gracePeriod);
16675
- // 2. Cancel stragglers if requested
16685
+ // 3. Check for stragglers that didn't respond to cancellation
16676
16686
  if (cancelHanging) {
16677
16687
  const stillRunning = tasks.filter((task) => task.getState() === TaskState.RUNNING && !completed.has(task));
16678
16688
  if (stillRunning.length > 0) {
16679
- logger$1b.debug('cancelling_hanging_tasks', {
16689
+ logger$1b.debug('tasks_did_not_complete_within_grace_period', {
16680
16690
  hanging_count: stillRunning.length,
16681
16691
  });
16682
- // Cancel all hanging tasks
16683
- stillRunning.forEach((task) => task.cancel());
16684
16692
  // Wait for them to finish with individual timeouts
16685
16693
  await Promise.allSettled(stillRunning.map(async (task) => {
16686
16694
  try {