@integrity-labs/agt-cli 0.28.9 → 0.28.10

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.
@@ -14014,16 +14014,34 @@ var DirectChatClaimTracker = class {
14014
14014
  }
14015
14015
  };
14016
14016
 
14017
+ // src/direct-chat-session-state.ts
14018
+ import { existsSync, readFileSync } from "fs";
14019
+ import { join } from "path";
14020
+ function readDirectChatSessionState(agentDir, nowMs) {
14021
+ const path = join(agentDir, "direct-chat-session.json");
14022
+ try {
14023
+ if (!existsSync(path)) return { fresh: false, startedAtMs: nowMs };
14024
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
14025
+ if (!parsed || typeof parsed !== "object") return { fresh: false, startedAtMs: nowMs };
14026
+ const o = parsed;
14027
+ const fresh = o.fresh === true;
14028
+ const startedAtMs = typeof o.startedAtMs === "number" && Number.isFinite(o.startedAtMs) ? o.startedAtMs : nowMs;
14029
+ return { fresh, startedAtMs };
14030
+ } catch {
14031
+ return { fresh: false, startedAtMs: nowMs };
14032
+ }
14033
+ }
14034
+
14017
14035
  // src/mcp-spawn-lock.ts
14018
14036
  import {
14019
- existsSync,
14037
+ existsSync as existsSync2,
14020
14038
  mkdirSync,
14021
- readFileSync,
14039
+ readFileSync as readFileSync2,
14022
14040
  renameSync,
14023
14041
  unlinkSync,
14024
14042
  writeFileSync
14025
14043
  } from "fs";
14026
- import { join } from "path";
14044
+ import { join as join2 } from "path";
14027
14045
  function defaultIsPidAlive(pid) {
14028
14046
  if (!Number.isFinite(pid) || pid <= 0) return false;
14029
14047
  try {
@@ -14041,7 +14059,7 @@ function acquireMcpSpawnLock(args) {
14041
14059
  const isPidAlive = options.isPidAlive ?? defaultIsPidAlive;
14042
14060
  const selfPid = options.selfPid ?? process.pid;
14043
14061
  const now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
14044
- const path = join(agentDir, basename);
14062
+ const path = join2(agentDir, basename);
14045
14063
  const existing = readLockHolder(path);
14046
14064
  if (existing) {
14047
14065
  if (existing.pid === selfPid) {
@@ -14070,9 +14088,9 @@ function releaseMcpSpawnLock(lockPath, opts = {}) {
14070
14088
  }
14071
14089
  }
14072
14090
  function readLockHolder(path) {
14073
- if (!existsSync(path)) return null;
14091
+ if (!existsSync2(path)) return null;
14074
14092
  try {
14075
- const raw = readFileSync(path, "utf8");
14093
+ const raw = readFileSync2(path, "utf8");
14076
14094
  const parsed = JSON.parse(raw);
14077
14095
  const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
14078
14096
  if (!Number.isFinite(pid) || pid <= 0) return null;
@@ -14085,15 +14103,15 @@ function readLockHolder(path) {
14085
14103
 
14086
14104
  // src/direct-chat-channel.ts
14087
14105
  import { homedir as homedir2 } from "os";
14088
- import { join as join3 } from "path";
14106
+ import { join as join4 } from "path";
14089
14107
  import { watch, mkdirSync as mkdirSync2 } from "fs";
14090
14108
 
14091
14109
  // src/flags-cache-read.ts
14092
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
14110
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
14093
14111
  import { homedir } from "os";
14094
- import { join as join2 } from "path";
14112
+ import { join as join3 } from "path";
14095
14113
  function defaultFlagsCachePath() {
14096
- return join2(homedir(), ".augmented", "flags-cache.json");
14114
+ return join3(homedir(), ".augmented", "flags-cache.json");
14097
14115
  }
14098
14116
  function envBoolean(raw) {
14099
14117
  if (raw === void 0) return void 0;
@@ -14105,8 +14123,8 @@ function envBoolean(raw) {
14105
14123
  }
14106
14124
  function cachedBoolean(key, path) {
14107
14125
  try {
14108
- if (!existsSync2(path)) return void 0;
14109
- const parsed = JSON.parse(readFileSync2(path, "utf8"));
14126
+ if (!existsSync3(path)) return void 0;
14127
+ const parsed = JSON.parse(readFileSync3(path, "utf8"));
14110
14128
  if (!parsed || typeof parsed !== "object") return void 0;
14111
14129
  const flags = parsed.flags;
14112
14130
  if (!flags || typeof flags !== "object") return void 0;
@@ -14129,7 +14147,7 @@ function resolveHostBooleanFlag(opts) {
14129
14147
  var AGT_HOST = process.env.AGT_HOST;
14130
14148
  var AGT_API_KEY = process.env.AGT_API_KEY;
14131
14149
  var AGT_AGENT_ID = process.env.AGT_AGENT_ID;
14132
- var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ? join3(homedir2(), ".augmented", AGT_AGENT_ID) : null;
14150
+ var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ? join4(homedir2(), ".augmented", AGT_AGENT_ID) : null;
14133
14151
  var inboundContextClient = createInboundContextClient({
14134
14152
  agtHost: AGT_HOST ?? null,
14135
14153
  agtApiKey: AGT_API_KEY ?? null,
@@ -14358,10 +14376,11 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
14358
14376
  });
14359
14377
  await mcp.connect(new StdioServerTransport());
14360
14378
  var processedIds = /* @__PURE__ */ new Set();
14361
- async function pollForMessages() {
14379
+ async function pollForMessages(sinceMs) {
14362
14380
  try {
14363
14381
  const res = await apiPost("/host/direct-chat/poll", {
14364
- agent_id: AGT_AGENT_ID
14382
+ agent_id: AGT_AGENT_ID,
14383
+ ...typeof sinceMs === "number" ? { since_ms: sinceMs } : {}
14365
14384
  });
14366
14385
  if (!res.ok) return;
14367
14386
  const data = await res.json();
@@ -14424,11 +14443,11 @@ var DOORBELL_ENABLED = resolveHostBooleanFlag({
14424
14443
  var DOORBELL_FILE = "direct-chat-doorbell";
14425
14444
  var SAFETY_NET_POLL_MS = 3e4;
14426
14445
  var pollInFlight = false;
14427
- async function pollOnce() {
14446
+ async function pollOnce(sinceMs) {
14428
14447
  if (pollInFlight) return;
14429
14448
  pollInFlight = true;
14430
14449
  try {
14431
- await pollForMessages();
14450
+ await pollForMessages(sinceMs);
14432
14451
  } finally {
14433
14452
  pollInFlight = false;
14434
14453
  }
@@ -14440,13 +14459,15 @@ if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
14440
14459
  mkdirSync2(DIRECT_CHAT_AGENT_DIR, { recursive: true });
14441
14460
  } catch {
14442
14461
  }
14462
+ const sessionState = readDirectChatSessionState(DIRECT_CHAT_AGENT_DIR, Date.now());
14463
+ const sinceMs = sessionState.startedAtMs;
14443
14464
  let debounce = null;
14444
14465
  try {
14445
14466
  doorbellWatcher = watch(DIRECT_CHAT_AGENT_DIR, (_event, filename) => {
14446
14467
  if (filename !== DOORBELL_FILE) return;
14447
14468
  if (debounce) clearTimeout(debounce);
14448
14469
  debounce = setTimeout(() => {
14449
- void pollOnce();
14470
+ void pollOnce(sinceMs);
14450
14471
  }, 50);
14451
14472
  });
14452
14473
  } catch (err) {
@@ -14456,12 +14477,14 @@ if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
14456
14477
  );
14457
14478
  }
14458
14479
  safetyNetTimer = setInterval(() => {
14459
- void pollOnce();
14480
+ void pollOnce(sinceMs);
14460
14481
  }, SAFETY_NET_POLL_MS);
14461
14482
  safetyNetTimer.unref?.();
14462
- void pollOnce();
14483
+ if (sessionState.fresh) {
14484
+ void pollOnce(void 0);
14485
+ }
14463
14486
  process.stderr.write(
14464
- `direct-chat-channel: Started (agent=${AGT_AGENT_ID}, delivery=doorbell+pull \u2014 watching ${DOORBELL_FILE}, safety-net ${SAFETY_NET_POLL_MS}ms)
14487
+ `direct-chat-channel: Started (agent=${AGT_AGENT_ID}, delivery=doorbell+pull, session=${sessionState.fresh ? "fresh\u2192backlog-drain" : "resumed\u2192new-only"}, since=${sinceMs} \u2014 watching ${DOORBELL_FILE}, safety-net ${SAFETY_NET_POLL_MS}ms)
14465
14488
  `
14466
14489
  );
14467
14490
  } else {
@@ -2,6 +2,7 @@ import {
2
2
  SEND_KEYS_ENTER_DELAY_MS,
3
3
  _internals,
4
4
  collectDiagnostics,
5
+ directChatSessionStatePath,
5
6
  getLastFailureContext,
6
7
  getProjectDir,
7
8
  getSessionState,
@@ -22,14 +23,16 @@ import {
22
23
  stopAllSessionsAndWait,
23
24
  stopPersistentSession,
24
25
  takeZombieDetection,
26
+ writeDirectChatSessionState,
25
27
  writePersistentClaudeWrapper
26
- } from "./chunk-QG553V7F.js";
28
+ } from "./chunk-7BWFZ7LX.js";
27
29
  import "./chunk-CHUL4CPY.js";
28
30
  import "./chunk-XWVM4KPK.js";
29
31
  export {
30
32
  SEND_KEYS_ENTER_DELAY_MS,
31
33
  _internals,
32
34
  collectDiagnostics,
35
+ directChatSessionStatePath,
33
36
  getLastFailureContext,
34
37
  getProjectDir,
35
38
  getSessionState,
@@ -50,6 +53,7 @@ export {
50
53
  stopAllSessionsAndWait,
51
54
  stopPersistentSession,
52
55
  takeZombieDetection,
56
+ writeDirectChatSessionState,
53
57
  writePersistentClaudeWrapper
54
58
  };
55
- //# sourceMappingURL=persistent-session-S6H3P6WD.js.map
59
+ //# sourceMappingURL=persistent-session-EO6TNQK2.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-QG553V7F.js";
3
+ } from "./chunk-7BWFZ7LX.js";
4
4
  import "./chunk-CHUL4CPY.js";
5
5
  import "./chunk-XWVM4KPK.js";
6
6
 
@@ -250,4 +250,4 @@ export {
250
250
  parkPendingInbound,
251
251
  readAndResetChannelDeflections
252
252
  };
253
- //# sourceMappingURL=responsiveness-probe-NRVZR2KR.js.map
253
+ //# sourceMappingURL=responsiveness-probe-SV6QQHRW.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.9",
3
+ "version": "0.28.10",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {