@agentcomms/resend 0.7.0 → 0.7.2

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.
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { B as canPrompt, C as policyReport, D as showAccount, E as sendPolicyOf, F as CommsError, G as gatedChangeAtTerminal, H as colorEnabled, I as EXIT_CODES, J as renderInstall, K as installExitStatus, L as agentMarker, M as checkNewName, O as ResendContext, P as CHANNEL_SERVERS, Q as serverPruneChange, R as approvalKind, S as policyChange, T as removeAccountChange, U as escapeForDisplay, X as runCommand, Y as renderPrune, Z as serverInstallChange, _ as runDoctor, a as revokeSendApproval, b as listAccounts, c as downloadReceived, d as listReceived, et as truncateDisplay, f as listScheduled, g as showSentEmail, h as showReceived, i as prepareSend, l as getMetrics, m as listSuppressions, n as executeSend, o as sendStatus, ot as VERSION, p as listSentEmails, q as paint, r as finishSendApproval, s as cancelScheduledChange, t as beginSendApproval, tt as writeResult, u as listDomains, v as addAccountChange, w as policyWanted, x as modeOf, y as inspectKey, z as approveChangeAtTerminal } from "./send-DeGG4u2p.mjs";
2
+ import { B as canPrompt, C as policyReport, D as showAccount, E as sendPolicyOf, F as CommsError, G as gatedChangeAtTerminal, H as colorEnabled, I as EXIT_CODES, J as renderInstall, K as installExitStatus, L as agentMarker, M as checkNewName, O as ResendContext, P as CHANNEL_SERVERS, Q as serverPruneChange, R as approvalKind, S as policyChange, T as removeAccountChange, U as escapeForDisplay, X as runCommand, Y as renderPrune, Z as serverInstallChange, _ as runDoctor, a as revokeSendApproval, b as listAccounts, c as downloadReceived, d as listReceived, et as truncateDisplay, f as listScheduled, g as showSentEmail, h as showReceived, i as prepareSend, l as getMetrics, m as listSuppressions, n as executeSend, o as sendStatus, ot as VERSION, p as listSentEmails, q as paint, r as finishSendApproval, s as cancelScheduledChange, t as beginSendApproval, tt as writeResult, u as listDomains, v as addAccountChange, w as policyWanted, x as modeOf, y as inspectKey, z as approveChangeAtTerminal } from "./send-CobRSveB.mjs";
3
3
  import path from "node:path";
4
4
  import { createInterface } from "node:readline/promises";
5
5
  import { stripVTControlCharacters } from "node:util";
@@ -3370,7 +3370,7 @@ Exit codes: 0 ok · 1 unexpected · 10 a send or a change was refused or needs a
3370
3370
  }));
3371
3371
  const mcp = program.command("mcp").description("run the MCP server on stdio, for a coding agent to connect to").option("--account <name>", "pin the server to one account; every tool then acts on it and no other").action(async (flags) => {
3372
3372
  ran = true;
3373
- const { startResendStdioServer } = await import("./stdio-entry-CbYlbcyJ.mjs");
3373
+ const { startResendStdioServer } = await import("./stdio-entry-6o87ixrS.mjs");
3374
3374
  await startResendStdioServer({
3375
3375
  ...deps,
3376
3376
  env,
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { at as ROUTES, it as RESEND_DOWNLOAD_ORIGIN, nt as REFUSED, ot as VERSION, rt as RESEND_API_ORIGIN } from "./send-DeGG4u2p.mjs";
2
- import { t as createResendMcpServer } from "./server-CRIgeZCh.mjs";
1
+ import { at as ROUTES, it as RESEND_DOWNLOAD_ORIGIN, nt as REFUSED, ot as VERSION, rt as RESEND_API_ORIGIN } from "./send-CobRSveB.mjs";
2
+ import { t as createResendMcpServer } from "./server-BfZNu9Ci.mjs";
3
3
  //#region src/index.ts
4
4
  /**
5
5
  * The library entry of `@agentcomms/resend`.
@@ -12,7 +12,7 @@ import { constants as constants$1 } from "node:fs";
12
12
  //#endregion
13
13
  //#region src/version.ts
14
14
  /** The package version, read from package.json at build time. */
15
- const VERSION$1 = "0.7.0";
15
+ const VERSION$1 = "0.7.2";
16
16
  //#endregion
17
17
  //#region src/api/routes.ts
18
18
  /**
@@ -187,7 +187,7 @@ function refusedBecause(method, pathname) {
187
187
  return null;
188
188
  }
189
189
  //#endregion
190
- //#region ../core/dist/servers-BNBTijds.mjs
190
+ //#region ../core/dist/servers-CI6C4CNi.mjs
191
191
  /**
192
192
  * Every failure a user or an agent can act on carries a specific, stable code from this registry, a message, an
193
193
  * optional one-line hint and structured `details`. The code decides the process exit status; agents and skills branch
@@ -4265,7 +4265,56 @@ const PIN_OPTIONS = Object.freeze([
4265
4265
  ]);
4266
4266
  /** Looks for an executable on PATH, the way a shell would. */
4267
4267
  async function whichExecutable(name, env) {
4268
- const paths = (env.PATH ?? "").split(delimiter).filter(Boolean);
4268
+ return executableIn(name, (env.PATH ?? "").split(delimiter), env);
4269
+ }
4270
+ /**
4271
+ * Where a client's own command is usually installed, looked in after PATH: `~/.local/bin`, where Anthropic's native
4272
+ * installer puts `claude`, then `/opt/homebrew/bin` and `/usr/local/bin`, where Homebrew puts `claude` and `codex` on
4273
+ * Apple Silicon and on Intel.
4274
+ *
4275
+ * An install run from inside an MCP server has the PATH written into that server's entry at registration —
4276
+ * `node`'s own directory, `/usr/local/bin`, `/usr/bin`, `/bin` — and nothing of the person's shell. `claude` from
4277
+ * Homebrew on an Apple Silicon Mac, or from the native installer anywhere, is on none of those, so a registration
4278
+ * asked for from chat found no `claude`, registered nothing, and printed the entry instead. That PATH is left as it
4279
+ * is: it is in every entry already registered, and changing it would rewrite them all.
4280
+ *
4281
+ * The home is the environment's own `HOME`, never `os.homedir()`, so a test's temporary home is the only home looked
4282
+ * in. `AGENT_COMMS_CLIENT_CLI_DIRS` replaces the two system directories — a list, separated as PATH is, and empty for
4283
+ * none — which is how the tests keep every lookup inside their own directories: a `claude` or `codex` really
4284
+ * installed on the machine running them would otherwise be found, and run, by a test that meant to have none.
4285
+ *
4286
+ * Only absolute directories are looked in. A relative one would be read against whatever directory the server was
4287
+ * started from, so the command found — and run — would depend on where that was. And none on Windows: a client there
4288
+ * is a `.cmd` shim, which this cannot start without a shell, so a fallback could only find something it cannot run.
4289
+ */
4290
+ function clientCliDirectories(env) {
4291
+ if (process.platform === "win32") return [];
4292
+ const home = env.HOME;
4293
+ const system = env.AGENT_COMMS_CLIENT_CLI_DIRS !== void 0 ? env.AGENT_COMMS_CLIENT_CLI_DIRS.split(delimiter) : ["/opt/homebrew/bin", "/usr/local/bin"];
4294
+ return [...home ? [join(home, ".local", "bin")] : [], ...system].filter((directory) => directory !== "" && isAbsolute(directory));
4295
+ }
4296
+ /**
4297
+ * A client's own command — `claude`, `codex` — on PATH, or else where it is usually installed: see
4298
+ * `clientCliDirectories`. Every place that looks for a client's command looks through here, so the one that plans a
4299
+ * registration and the one that makes it cannot disagree about whether it is there.
4300
+ */
4301
+ async function findClientCli(name, env) {
4302
+ return await whichExecutable(name, env) ?? executableIn(name, clientCliDirectories(env), env);
4303
+ }
4304
+ /** Where `findClientCli` looked, as a sentence ends: "on PATH or in ~/.local/bin, /opt/homebrew/bin or /usr/local/bin". */
4305
+ function clientCliSearch(env) {
4306
+ const directories = clientCliDirectories(env);
4307
+ if (directories.length === 0) return "on PATH";
4308
+ const last = directories.at(-1);
4309
+ const rest = directories.slice(0, -1);
4310
+ return `on PATH or in ${rest.length > 0 ? `${rest.join(", ")} or ${last}` : last}`;
4311
+ }
4312
+ /**
4313
+ * The first of `directories` that holds an executable `name`. PATH is read by the caller, once: a test that counts
4314
+ * how often the installer looks at PATH counts exactly the looks it means.
4315
+ */
4316
+ async function executableIn(name, directories, env) {
4317
+ const paths = directories.filter(Boolean);
4269
4318
  const extensions = process.platform === "win32" ? (env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";") : [""];
4270
4319
  for (const directory of paths) for (const extension of extensions) {
4271
4320
  const candidate = join(directory, name + extension.toLowerCase());
@@ -4726,8 +4775,9 @@ async function backUp(context, client, name, previous, now) {
4726
4775
  }
4727
4776
  /**
4728
4777
  * Where an install with these options goes: the client's own CLI and the file it keeps its servers in, and whether
4729
- * anything will be written there at all — `--print`, `--client json` and a client whose CLI is not on PATH all end
4730
- * with an entry printed rather than registered.
4778
+ * anything will be written there at all — `--print`, `--client json` and a client whose CLI cannot be found all end
4779
+ * with an entry printed rather than registered. The CLI is looked for on PATH and then where it is usually installed:
4780
+ * see `findClientCli`.
4731
4781
  *
4732
4782
  * Exported because a registration is a change a person approves, and what they are shown has to be what then
4733
4783
  * happens. The core server plans an install with this before asking, and the install itself decides with it, so the
@@ -4736,7 +4786,7 @@ async function backUp(context, client, name, previous, now) {
4736
4786
  async function installTarget(context, options) {
4737
4787
  const apply = options.apply ?? true;
4738
4788
  const cliName = options.client === "claude-code" ? "claude" : options.client === "codex" ? "codex" : null;
4739
- const binary = cliName ? await whichExecutable(cliName, context.env) : null;
4789
+ const binary = cliName ? await findClientCli(cliName, context.env) : null;
4740
4790
  const own = knownClientConfigs(context.env).find((file) => file.client === options.client)?.path;
4741
4791
  const configPath = options.client === "claude-code" ? void 0 : own;
4742
4792
  return {
@@ -4991,7 +5041,7 @@ async function mcpInstall(context, product, options, planned) {
4991
5041
  }
4992
5042
  method = "cli";
4993
5043
  applied = true;
4994
- } else if (cliName && apply) notApplied = `${cliName} was not found on PATH, so nothing was registered`;
5044
+ } else if (cliName && apply) notApplied = `${cliName} was not found ${clientCliSearch(context.env)}, so nothing was registered`;
4995
5045
  else if (configPath && writes) {
4996
5046
  await mergeIntoJsonConfig(configPath, options.client, name, entry);
4997
5047
  method = "file";
@@ -5858,7 +5908,7 @@ function wholeNumber(raw, rule) {
5858
5908
  return value;
5859
5909
  }
5860
5910
  /** The package version, read from package.json at build time. */
5861
- const VERSION = "0.7.0";
5911
+ const VERSION = "0.7.2";
5862
5912
  /**
5863
5913
  * Registering, pruning and listing the MCP servers of every channel, from the core.
5864
5914
  *
@@ -6113,7 +6163,7 @@ function serverPruneChange(core, env, request, own) {
6113
6163
  };
6114
6164
  const { packageName, version } = ownProduct(request.channel, own) ?? {
6115
6165
  packageName: channelServer(request.channel).packageName,
6116
- version: "0.7.0"
6166
+ version: "0.7.2"
6117
6167
  };
6118
6168
  const product = {
6119
6169
  packageName,
@@ -6152,7 +6202,7 @@ function serverPruneChange(core, env, request, own) {
6152
6202
  };
6153
6203
  }
6154
6204
  //#endregion
6155
- //#region ../core/dist/tool-arguments-CY2Menl8.mjs
6205
+ //#region ../core/dist/tool-arguments-DBqML6N8.mjs
6156
6206
  const APPLIED = Symbol.for("agentcomms.strictToolArguments");
6157
6207
  const TARGET = "draft-2020-12";
6158
6208
  /**
@@ -1,4 +1,4 @@
1
- import { $ as toCommsError, A as MODES, C as policyReport, D as showAccount, F as CommsError, N as strictToolArguments, O as ResendContext, S as policyChange, T as removeAccountChange, V as changeToolResult, W as gatedChange, _ as runDoctor, b as listAccounts, c as downloadReceived, d as listReceived, f as listScheduled, g as showSentEmail, h as showReceived, i as prepareSend, j as SEND_POLICIES, k as CHANGE_POLICIES, l as getMetrics, m as listSuppressions, n as executeSend, o as sendStatus, ot as VERSION, p as listSentEmails, s as cancelScheduledChange, u as listDomains, w as policyWanted } from "./send-DeGG4u2p.mjs";
1
+ import { $ as toCommsError, A as MODES, C as policyReport, D as showAccount, F as CommsError, N as strictToolArguments, O as ResendContext, S as policyChange, T as removeAccountChange, V as changeToolResult, W as gatedChange, _ as runDoctor, b as listAccounts, c as downloadReceived, d as listReceived, f as listScheduled, g as showSentEmail, h as showReceived, i as prepareSend, j as SEND_POLICIES, k as CHANGE_POLICIES, l as getMetrics, m as listSuppressions, n as executeSend, o as sendStatus, ot as VERSION, p as listSentEmails, s as cancelScheduledChange, u as listDomains, w as policyWanted } from "./send-CobRSveB.mjs";
2
2
  import { S as union, c as boolean, g as object, h as number, s as array, x as string } from "./schemas-DiGKNDNq.mjs";
3
3
  import { t as McpServer } from "./mcp-DXXb3Vv3-Co5BzjYe.mjs";
4
4
  //#region src/mcp/server.ts
@@ -1,4 +1,4 @@
1
- import { t as createResendMcpServer } from "./server-CRIgeZCh.mjs";
1
+ import { t as createResendMcpServer } from "./server-BfZNu9Ci.mjs";
2
2
  //#region src/mcp/stdio-entry.ts
3
3
  /**
4
4
  * Starting the stdio server. On stdio, **stdout is the protocol**: one stray `console.log` corrupts the stream, so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentcomms/resend",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Resend for coding agents: read domains, sent and received mail, metrics and suppressions, and send mail that nothing sends without a person's approval of exactly what goes out.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "@modelcontextprotocol/server": "^2.0.0",
39
39
  "commander": "^15.0.0",
40
40
  "zod": "^4.6.5",
41
- "@agentcomms/core": "0.7.0"
41
+ "@agentcomms/core": "0.7.2"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"
@@ -92,7 +92,7 @@
92
92
  "scripts": {
93
93
  "build": "tsdown",
94
94
  "typecheck": "tsc -p tsconfig.json",
95
- "test": "node --experimental-strip-types --test --test-timeout=60000 \"test/**/*.test.ts\""
95
+ "test": "node --experimental-strip-types --test --test-timeout=600000 \"test/**/*.test.ts\""
96
96
  },
97
- "gitHead": "34732ca0ffb03feada69e76f97143413ec5398e4"
97
+ "gitHead": "b0e3060e9ce327f2fd9b040c69bde81721c37e3e"
98
98
  }