gitdone-agent 0.8.4 → 0.8.5

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 +25 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -29,7 +29,7 @@ import { randomUUID, createHash } from 'node:crypto'
29
29
  // Reported to the server on every sync so the web UI can flag outdated agents.
30
30
  // Keep in lockstep with packages/agent/package.json "version" AND
31
31
  // src/lib/agentVersion.ts LATEST_AGENT_VERSION.
32
- const AGENT_VERSION = '0.8.4'
32
+ const AGENT_VERSION = '0.8.5'
33
33
 
34
34
  const AGENT_DIR = join(homedir(), '.gitdone-agent')
35
35
  const CONFIG_PATH = join(AGENT_DIR, 'config.json')
@@ -999,19 +999,32 @@ function scanRepos(roots, maxDepth = 5) {
999
999
 
1000
1000
  // ─── Server sync + commands ─────────────────────────────────────────────────────
1001
1001
 
1002
+ // Keep the deadline below the server-side session stall window. Without a
1003
+ // deadline, a proxy/network connection that never completes can block the
1004
+ // event-posting loop forever, so no heartbeat reaches the server and the
1005
+ // watchdog incorrectly declares a live AI turn stalled.
1006
+ const API_REQUEST_TIMEOUT_MS = 10_000
1007
+
1002
1008
  async function apiOnce(cfg, path, body) {
1003
- const res = await fetch(`${cfg.url}${path}`, {
1004
- method: 'POST',
1005
- headers: { Authorization: `Bearer ${cfg.key}`, 'Content-Type': 'application/json' },
1006
- body: JSON.stringify(body),
1007
- })
1008
- if (!res.ok) {
1009
- const text = await res.text().catch(() => '')
1010
- const err = new Error(`HTTP ${res.status} ${path}: ${text}`)
1011
- err.status = res.status
1012
- throw err
1009
+ const controller = new AbortController()
1010
+ const timer = setTimeout(() => controller.abort(), API_REQUEST_TIMEOUT_MS)
1011
+ try {
1012
+ const res = await fetch(`${cfg.url}${path}`, {
1013
+ method: 'POST',
1014
+ headers: { Authorization: `Bearer ${cfg.key}`, 'Content-Type': 'application/json' },
1015
+ body: JSON.stringify(body),
1016
+ signal: controller.signal,
1017
+ })
1018
+ if (!res.ok) {
1019
+ const text = await res.text().catch(() => '')
1020
+ const err = new Error(`HTTP ${res.status} ${path}: ${text}`)
1021
+ err.status = res.status
1022
+ throw err
1023
+ }
1024
+ return res.json().catch(() => ({}))
1025
+ } finally {
1026
+ clearTimeout(timer)
1013
1027
  }
1014
- return res.json().catch(() => ({}))
1015
1028
  }
1016
1029
 
1017
1030
  // gd-514: statuses where the app server demonstrably never processed the body,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitdone-agent",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Local git agent for gitdone — watches a local repo and sends snapshots to gitdone.eu",
5
5
  "type": "module",
6
6
  "bin": {