gitdone-agent 0.8.13 → 0.8.14

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/index.js +13 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -32,7 +32,7 @@ import { randomUUID, createHash } from 'node:crypto'
32
32
  // Reported to the server on every sync so the web UI can flag outdated agents.
33
33
  // Keep in lockstep with packages/agent/package.json. The server's offline
34
34
  // fallback is bumped only after this release has actually reached npm.
35
- const AGENT_VERSION = '0.8.13'
35
+ const AGENT_VERSION = '0.8.14'
36
36
 
37
37
  const AGENT_DIR = join(homedir(), '.gitdone-agent')
38
38
  const CONFIG_PATH = join(AGENT_DIR, 'config.json')
@@ -1280,7 +1280,10 @@ function writeGameOverlayState() {
1280
1280
  const profile = runtime ? GAME_PROFILES.find((item) => item.id === runtime.gameId) : null
1281
1281
  const state = {
1282
1282
  ...gameOverlaySettings,
1283
- visible: gameOverlaySettings.enabled && runtime?.playing === true,
1283
+ // Keep the clock on-screen for the whole time the game is running. During
1284
+ // pause/menu states it stays visible but frozen; only active gameplay adds
1285
+ // time. This also prevents brief detector transitions from blinking it.
1286
+ visible: gameOverlaySettings.enabled && runtime?.running === true,
1284
1287
  text: profile ? `${profile.shortName} · Днес ${formatGameClock(todayMs)}` : '',
1285
1288
  }
1286
1289
  const json = JSON.stringify(state)
@@ -1299,8 +1302,9 @@ function writeGameOverlayState() {
1299
1302
  function observeGameActivity(gameId, state, observedAt) {
1300
1303
  const at = Date.parse(observedAt) || Date.now()
1301
1304
  const playing = state === 'playing'
1305
+ const running = state === 'playing' || state === 'paused'
1302
1306
  if (!activeGameOverlay || activeGameOverlay.gameId !== gameId) {
1303
- if (playing) activeGameOverlay = { gameId, playing: true, todayMs: 0, asOf: at }
1307
+ if (running) activeGameOverlay = { gameId, playing, running: true, todayMs: 0, asOf: at }
1304
1308
  } else if (activeGameOverlay.playing !== playing) {
1305
1309
  if (activeGameOverlay.playing) {
1306
1310
  activeGameOverlay.todayMs += Math.max(0, at - activeGameOverlay.asOf)
@@ -1308,6 +1312,7 @@ function observeGameActivity(gameId, state, observedAt) {
1308
1312
  activeGameOverlay.playing = playing
1309
1313
  activeGameOverlay.asOf = at
1310
1314
  }
1315
+ if (activeGameOverlay?.gameId === gameId) activeGameOverlay.running = running
1311
1316
  writeGameOverlayState()
1312
1317
  }
1313
1318
 
@@ -1332,6 +1337,8 @@ public static class GitDoneGameMemory {
1332
1337
  public static extern int GetWindowLong(IntPtr window, int index);
1333
1338
  [DllImport("user32.dll", SetLastError=true)]
1334
1339
  public static extern int SetWindowLong(IntPtr window, int index, int value);
1340
+ [DllImport("user32.dll", SetLastError=true)]
1341
+ public static extern bool SetWindowPos(IntPtr window, IntPtr insertAfter, int x, int y, int width, int height, uint flags);
1335
1342
  public static UInt32 ReadUInt32(IntPtr process, UInt64 address) {
1336
1343
  var bytes = new byte[4]; UIntPtr read;
1337
1344
  if (!ReadProcessMemory(process, new IntPtr(unchecked((long)address)), bytes, 4, out read) || read.ToUInt64() != 4)
@@ -1423,6 +1430,9 @@ function Update-Overlay {
1423
1430
  $y = if ([string]$state.position -like 'bottom-*') { $area.Bottom - $form.Height - $margin } else { $area.Top + $margin }
1424
1431
  $form.Location = [System.Drawing.Point]::new([int]$x, [int]$y)
1425
1432
  if (!$form.Visible) { $form.Show() }
1433
+ # Reassert HWND_TOPMOST after showing. Games can reorder top-level windows
1434
+ # when their DX swap chain becomes active, especially in fullscreen modes.
1435
+ [GitDoneGameMemory]::SetWindowPos($form.Handle, [IntPtr](-1), $form.Left, $form.Top, $form.Width, $form.Height, 0x0010 -bor 0x0040) | Out-Null
1426
1436
  if (!$script:overlayWasVisible -and $form.Visible) {
1427
1437
  [pscustomobject]@{ type='overlay'; visible=$true; monitor=$screenIndex; position=[string]$state.position } | ConvertTo-Json -Compress
1428
1438
  [Console]::Out.Flush()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitdone-agent",
3
- "version": "0.8.13",
3
+ "version": "0.8.14",
4
4
  "description": "Local gitDone companion for repository and optional World of Warcraft progress sync",
5
5
  "type": "module",
6
6
  "files": [