@integrity-labs/agt-cli 0.28.391 → 0.28.392

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.
@@ -36537,6 +36537,36 @@ function clearRestartConfirmMarker(filePath) {
36537
36537
  }
36538
36538
  }
36539
36539
 
36540
+ // src/restart-context-notice.ts
36541
+ function parseRestartContextHint(json) {
36542
+ let obj;
36543
+ try {
36544
+ obj = JSON.parse(json);
36545
+ } catch {
36546
+ return null;
36547
+ }
36548
+ if (!obj || typeof obj !== "object") return null;
36549
+ const { topic, channel, thread_ts, written_at } = obj;
36550
+ if (typeof topic !== "string" || typeof channel !== "string" || typeof thread_ts !== "string" || typeof written_at !== "string") {
36551
+ return null;
36552
+ }
36553
+ if (!topic.trim()) return null;
36554
+ return { topic, channel, thread_ts, written_at };
36555
+ }
36556
+ function resolveRestartTopic(hint, expectedChannel, expectedThreadTs) {
36557
+ if (!hint) return null;
36558
+ if (hint.channel !== expectedChannel || hint.thread_ts !== expectedThreadTs) return null;
36559
+ const topic = hint.topic.trim();
36560
+ return topic ? topic : null;
36561
+ }
36562
+ function buildStrandedInboundNoticeText(topic) {
36563
+ const trimmed = topic?.trim();
36564
+ if (trimmed) {
36565
+ return `I was restarted mid-conversation (we were discussing: "${trimmed}") and may have missed your last message. Please re-send if I didn't reply.`;
36566
+ }
36567
+ return "I was restarted mid-conversation and may have missed your last message. Please re-send if I didn't reply.";
36568
+ }
36569
+
36540
36570
  // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
36541
36571
  import process2 from "process";
36542
36572
 
@@ -38850,6 +38880,7 @@ function getEffectivePingAllowedUsers() {
38850
38880
  return readLivePingAllowedUsers() ?? PING_ALLOWED_USERS;
38851
38881
  }
38852
38882
  var SLACK_PENDING_INBOUND_DIR = SLACK_AGENT_DIR ? join17(SLACK_AGENT_DIR, "slack-pending-inbound") : null;
38883
+ var SLACK_RESTART_CONTEXT_DIR = SLACK_AGENT_DIR ? join17(SLACK_AGENT_DIR, "slack-restart-context") : null;
38853
38884
  var SLACK_RECOVERY_OUTBOX_DIR = SLACK_AGENT_DIR ? join17(SLACK_AGENT_DIR, "slack-recovery-outbox") : null;
38854
38885
  var SLACK_RECOVERY_LEDGER_DIR = SLACK_AGENT_DIR ? join17(SLACK_AGENT_DIR, ".agt-slack-recovery-ledger") : null;
38855
38886
  var SLACK_DELIVERY_LEDGER_DIR = SLACK_AGENT_DIR ? join17(SLACK_AGENT_DIR, ".agt-inbound-delivery-ledger") : null;
@@ -39840,9 +39871,45 @@ var STRANDED_INBOUND_MIN_AGE_FROM_BOOT_MS = 6e4;
39840
39871
  var STRANDED_INBOUND_MAX_AGE_MS = 5 * 60 * 1e3;
39841
39872
  var strandedInboundNoticeFired = false;
39842
39873
  var strandedInboundNoticeInFlight = false;
39874
+ function readRestartTopicForMarker(filename, channel, threadTs) {
39875
+ if (!SLACK_RESTART_CONTEXT_DIR) return null;
39876
+ let raw;
39877
+ try {
39878
+ raw = readFileSync17(join17(SLACK_RESTART_CONTEXT_DIR, filename), "utf-8");
39879
+ } catch {
39880
+ return null;
39881
+ }
39882
+ return resolveRestartTopic(parseRestartContextHint(raw), channel, threadTs);
39883
+ }
39884
+ function removeRestartContextHint(filename) {
39885
+ if (!SLACK_RESTART_CONTEXT_DIR) return;
39886
+ try {
39887
+ unlinkSync7(join17(SLACK_RESTART_CONTEXT_DIR, filename));
39888
+ } catch {
39889
+ }
39890
+ }
39891
+ function clearAllRestartContextHints() {
39892
+ if (!SLACK_RESTART_CONTEXT_DIR) return;
39893
+ let names;
39894
+ try {
39895
+ names = readdirSync5(SLACK_RESTART_CONTEXT_DIR);
39896
+ } catch {
39897
+ return;
39898
+ }
39899
+ for (const name of names) {
39900
+ if (!name.endsWith(".json")) continue;
39901
+ try {
39902
+ unlinkSync7(join17(SLACK_RESTART_CONTEXT_DIR, name));
39903
+ } catch {
39904
+ }
39905
+ }
39906
+ }
39843
39907
  async function notifyStrandedInboundsOnFirstConnect() {
39844
39908
  if (strandedInboundNoticeFired || strandedInboundNoticeInFlight) return;
39845
- if (channelReplayEnabled()) return;
39909
+ if (channelReplayEnabled()) {
39910
+ clearAllRestartContextHints();
39911
+ return;
39912
+ }
39846
39913
  strandedInboundNoticeInFlight = true;
39847
39914
  let hadFailure = false;
39848
39915
  try {
@@ -39878,13 +39945,15 @@ async function notifyStrandedInboundsOnFirstConnect() {
39878
39945
  unlinkSync7(fullPath);
39879
39946
  } catch {
39880
39947
  }
39948
+ removeRestartContextHint(filename);
39881
39949
  continue;
39882
39950
  }
39883
39951
  seen.add(key2);
39952
+ const topic = readRestartTopicForMarker(filename, channel, thread_ts);
39884
39953
  const res = await postSlackMessage({
39885
39954
  channel,
39886
39955
  thread_ts,
39887
- text: "I was restarted mid-conversation and may have missed your last message. Please re-send if I didn't reply."
39956
+ text: buildStrandedInboundNoticeText(topic)
39888
39957
  });
39889
39958
  if (res.ok) {
39890
39959
  notified += 1;
@@ -39892,6 +39961,7 @@ async function notifyStrandedInboundsOnFirstConnect() {
39892
39961
  unlinkSync7(fullPath);
39893
39962
  } catch {
39894
39963
  }
39964
+ removeRestartContextHint(filename);
39895
39965
  } else {
39896
39966
  hadFailure = true;
39897
39967
  process.stderr.write(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.391",
3
+ "version": "0.28.392",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {