@agenticmail/claudecode 0.1.14 → 0.1.16

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2GPBHK2M.js";
4
4
  import {
5
5
  install
6
- } from "./chunk-GAD64LKZ.js";
6
+ } from "./chunk-ZTSWLNUP.js";
7
7
  import {
8
8
  status
9
9
  } from "./chunk-O4H76K3B.js";
@@ -125,15 +125,21 @@ async function install(opts = {}) {
125
125
  };
126
126
  }
127
127
  function resolveDispatcherBinPath() {
128
- const thisFile = fileURLToPath(import.meta.url);
129
- const dir = thisFile.slice(0, thisFile.lastIndexOf("/"));
130
- return `${dir}/dispatcher-bin.js`;
128
+ return resolveSiblingBin("dispatcher-bin.js");
131
129
  }
132
130
  function resolveMailHookCommand() {
131
+ return `node "${resolveSiblingBin("mail-hook.js")}"`;
132
+ }
133
+ function resolveSiblingBin(filename) {
133
134
  const thisFile = fileURLToPath(import.meta.url);
134
135
  const dir = thisFile.slice(0, thisFile.lastIndexOf("/"));
135
- const hookPath = `${dir}/mail-hook.js`;
136
- return `node "${hookPath}"`;
136
+ const sibling = `${dir}/${filename}`;
137
+ if (existsSync(sibling)) return sibling;
138
+ const distSibling = `${dir.replace(/\/src$/, "")}/dist/${filename}`;
139
+ if (existsSync(distSibling)) return distSibling;
140
+ const parentDist = `${dir}/../dist/${filename}`;
141
+ if (existsSync(parentDist)) return parentDist;
142
+ return sibling;
137
143
  }
138
144
  async function startDispatcherForInstall(cfg) {
139
145
  const binPath = resolveDispatcherBinPath();
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-2GPBHK2M.js";
5
5
  import {
6
6
  install
7
- } from "./chunk-GAD64LKZ.js";
7
+ } from "./chunk-ZTSWLNUP.js";
8
8
  import "./chunk-DKTAW2N5.js";
9
9
  import {
10
10
  status
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createIntegrationRoutes
3
- } from "./chunk-RGLMLG7Y.js";
3
+ } from "./chunk-PTLX7SQV.js";
4
4
  import "./chunk-2GPBHK2M.js";
5
- import "./chunk-GAD64LKZ.js";
5
+ import "./chunk-ZTSWLNUP.js";
6
6
  import "./chunk-DKTAW2N5.js";
7
7
  import "./chunk-O4H76K3B.js";
8
8
  import "./chunk-US5FT2UB.js";
package/dist/index.js CHANGED
@@ -4,13 +4,13 @@ import {
4
4
  } from "./chunk-RNKJRBEF.js";
5
5
  import {
6
6
  createIntegrationRoutes
7
- } from "./chunk-RGLMLG7Y.js";
7
+ } from "./chunk-PTLX7SQV.js";
8
8
  import {
9
9
  uninstall
10
10
  } from "./chunk-2GPBHK2M.js";
11
11
  import {
12
12
  install
13
- } from "./chunk-GAD64LKZ.js";
13
+ } from "./chunk-ZTSWLNUP.js";
14
14
  import "./chunk-DKTAW2N5.js";
15
15
  import {
16
16
  status
package/dist/install.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  install,
3
3
  selectExposableAgents
4
- } from "./chunk-GAD64LKZ.js";
4
+ } from "./chunk-ZTSWLNUP.js";
5
5
  import "./chunk-DKTAW2N5.js";
6
6
  import "./chunk-US5FT2UB.js";
7
7
  import "./chunk-SBP7MJP2.js";
package/dist/mail-hook.js CHANGED
@@ -8,29 +8,43 @@ var AGENTICMAIL_DIR = join(homedir(), ".agenticmail");
8
8
  var CONFIG_PATH = join(AGENTICMAIL_DIR, "config.json");
9
9
  var CURSOR_PATH = join(AGENTICMAIL_DIR, "claudecode-hook-cursor.json");
10
10
  var HOOK_VERSION = "1";
11
- var HTTP_TIMEOUT_MS = 2e3;
11
+ var HTTP_TIMEOUT_MS = 800;
12
+ var GLOBAL_TIMEOUT_MS = 1500;
12
13
  var STOP_THROTTLE_MS = 15e3;
13
14
  async function readStdinJson() {
14
15
  if (process.stdin.isTTY) return null;
15
16
  return new Promise((resolve) => {
16
17
  let buf = "";
17
- process.stdin.setEncoding("utf-8");
18
- process.stdin.on("data", (chunk) => {
18
+ let settled = false;
19
+ const onData = (chunk) => {
19
20
  buf += chunk;
20
- });
21
- process.stdin.on("end", () => {
22
- if (!buf.trim()) {
23
- resolve(null);
24
- return;
25
- }
21
+ };
22
+ const onEnd = () => finish(() => {
23
+ if (!buf.trim()) return null;
26
24
  try {
27
- resolve(JSON.parse(buf));
25
+ return JSON.parse(buf);
28
26
  } catch {
29
- resolve(null);
27
+ return null;
30
28
  }
31
29
  });
32
- process.stdin.on("error", () => resolve(null));
33
- setTimeout(() => resolve(null), 200).unref();
30
+ const onError = () => finish(() => null);
31
+ const finish = (compute) => {
32
+ if (settled) return;
33
+ settled = true;
34
+ process.stdin.removeListener("data", onData);
35
+ process.stdin.removeListener("end", onEnd);
36
+ process.stdin.removeListener("error", onError);
37
+ try {
38
+ process.stdin.unref();
39
+ } catch {
40
+ }
41
+ resolve(compute());
42
+ };
43
+ process.stdin.setEncoding("utf-8");
44
+ process.stdin.on("data", onData);
45
+ process.stdin.on("end", onEnd);
46
+ process.stdin.on("error", onError);
47
+ setTimeout(() => finish(() => null), 200).unref();
34
48
  });
35
49
  }
36
50
  async function main() {
@@ -108,20 +122,20 @@ async function main() {
108
122
  }
109
123
  newOnes.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
110
124
  const lines = [];
111
- lines.push(`[AgenticMail bridge inbox] You have ${newOnes.length} new email${newOnes.length === 1 ? "" : "s"} since your last turn:`);
125
+ const count = newOnes.length;
126
+ lines.push(`\u{1F380} New AgenticMail (bridge inbox) \u2014 ${count} message${count === 1 ? "" : "s"} since the last check:`);
127
+ lines.push("");
112
128
  for (const m of newOnes) {
113
129
  const fromAddr = m.from?.[0]?.address ?? "unknown";
114
130
  const fromName = m.from?.[0]?.name ?? "";
115
131
  const fromDisp = fromName && fromName !== fromAddr ? `${fromName} <${fromAddr}>` : fromAddr;
116
132
  const subj = m.subject ?? "(no subject)";
117
- const preview = (m.preview ?? "").replace(/\s+/g, " ").trim().slice(0, 120);
118
- const tail = preview ? ` \u2014 ${preview}${preview.length === 120 ? "\u2026" : ""}` : "";
119
- lines.push(`- UID ${m.uid} | from ${fromDisp} | "${subj}"${tail}`);
133
+ const preview = (m.preview ?? "").replace(/\s+/g, " ").trim().slice(0, 180);
134
+ lines.push(` \xB7 UID ${m.uid} \u2014 ${fromDisp} \xB7 ${subj}`);
135
+ if (preview) lines.push(` > ${preview}${preview.length === 180 ? "\u2026" : ""}`);
136
+ lines.push("");
120
137
  }
121
- lines.push("");
122
- lines.push(
123
- "These are real replies from sub-agents (or mid-task questions). If any of them are addressed to you (Claude Code, the host), surface them to the user and act on whichever they direct you to. Use mcp__agenticmail__read_email for the full body, mcp__agenticmail__reply_email (with replyAll: true) to respond on the thread. You do NOT need to ping the user \u2014 just be aware these landed."
124
- );
138
+ lines.push("Full body: mcp__agenticmail__read_email. Reply: mcp__agenticmail__reply_email (replyAll: true).");
125
139
  const newestMs = Math.max(...newOnes.map((m) => new Date(m.date).getTime()));
126
140
  try {
127
141
  if (!existsSync(dirname(CURSOR_PATH))) mkdirSync(dirname(CURSOR_PATH), { recursive: true });
@@ -149,6 +163,8 @@ async function main() {
149
163
  }));
150
164
  }
151
165
  }
152
- main().catch(() => {
153
- process.exit(0);
166
+ var globalTimeout = new Promise((resolve) => {
167
+ setTimeout(() => resolve(), GLOBAL_TIMEOUT_MS).unref();
154
168
  });
169
+ Promise.race([main(), globalTimeout]).catch(() => {
170
+ }).finally(() => process.exit(0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/claudecode",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Claude Code integration for AgenticMail — surfaces every AgenticMail agent as a native Claude Code subagent so any Claude Code session can delegate to them with the Agent tool",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",