@sjawhar/pi-envoy 10.26.0 → 11.0.0

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/dispatch.js CHANGED
@@ -14814,9 +14814,20 @@ function parseCommand(argv, io) {
14814
14814
  for (let index = 0;index < rest.length; index++) {
14815
14815
  const token = rest[index];
14816
14816
  if (!token.startsWith("--")) {
14817
- if (ISSUE_KEY.test(token) && surface.flags.has("--issue") && !setBy.has("issue")) {
14818
- if (claim("issue", "--issue", false))
14819
- args.issue = token;
14817
+ if (ISSUE_KEY.test(token) && surface.flags.has("--issue")) {
14818
+ if (index === 0) {
14819
+ if (claim("issue", `the issue key ${token}`, false))
14820
+ args["issue"] = token;
14821
+ } else {
14822
+ const earlier = setBy.get("issue");
14823
+ const current = quoteWord(String(args["issue"]));
14824
+ let reason = `a bare issue key is the --issue only as the first argument; otherwise write --issue ${quoteWord(token)}`;
14825
+ if (earlier === "--issue")
14826
+ reason = `--issue is already ${current}`;
14827
+ else if (earlier?.startsWith("--"))
14828
+ reason = `${earlier} already set --issue to ${current}`;
14829
+ problems.push(`unexpected argument ${quoteWord(token)}: ${reason}`);
14830
+ }
14820
14831
  continue;
14821
14832
  }
14822
14833
  problems.push(`unexpected argument ${quoteWord(token)}: every value follows its flag`);
package/dist/envoy.js CHANGED
@@ -33998,6 +33998,7 @@ try {
33998
33998
  }
33999
33999
  `;
34000
34000
  var MAY_HAVE_POSTED = "the reply may have been posted, and posting it again may put it in the thread twice";
34001
+ var AGENT_SECRETS_INJECTION = `agent-secrets: ${SLACK_BOT_TOKEN_SECRET} from `;
34001
34002
  var URL_CANDIDATE = /(?<![a-z0-9+.-])[a-z][a-z0-9+.-]{0,31}:\/\/[^\s<>|"'`]+/gi;
34002
34003
  var WEB_SCHEME = /^https?:\/\//i;
34003
34004
  var BARE_HOST = /(?<![\w@./:%-])((?:[a-z0-9-]{1,63}\.)*[a-z0-9-]{1,63})\.?(:\d{1,5})?(?![\w-])/gi;
@@ -34101,23 +34102,26 @@ async function postSlackReply(reply, options = {}) {
34101
34102
  new Response(child.stderr).text(),
34102
34103
  child.exited
34103
34104
  ]).finally(() => clearTimeout(timer));
34104
- const said = stderr.trim().split(`
34105
- `).filter(Boolean).join(" ");
34105
+ const stderrLines = stderr.trim().split(`
34106
+ `).filter(Boolean);
34107
+ const injectedAt = stderrLines.findIndex((line2) => line2.startsWith(AGENT_SECRETS_INJECTION));
34108
+ const beforeInjection = injectedAt < 0 ? stderrLines.join(" ") : stderrLines.slice(0, injectedAt).join(" ");
34106
34109
  const line = posterLine(stdout);
34107
34110
  if (line === undefined) {
34108
34111
  if (child.signalCode === "SIGKILL") {
34109
34112
  throw new Error(`slack_post got no answer within ${POST_TIMEOUT_MS / 1000} s: ${MAY_HAVE_POSTED}`);
34110
34113
  }
34111
- if (said.startsWith("agent-secrets:")) {
34114
+ if (injectedAt < 0 && beforeInjection.startsWith("agent-secrets:")) {
34112
34115
  if (code === 75) {
34113
- throw new Error(`the secrets broker has not granted ${SLACK_BOT_TOKEN_SECRET}: its request is waiting for approval (${said}); nothing was posted`);
34116
+ throw new Error(`the secrets broker has not granted ${SLACK_BOT_TOKEN_SECRET}: its request is waiting for approval (${beforeInjection}); nothing was posted`);
34114
34117
  }
34115
34118
  if (code === 77) {
34116
- throw new Error(`the secrets broker denied ${SLACK_BOT_TOKEN_SECRET} (${said}); nothing was posted`);
34119
+ throw new Error(`the secrets broker denied ${SLACK_BOT_TOKEN_SECRET} (${beforeInjection}); nothing was posted`);
34117
34120
  }
34118
- throw new Error(`the secrets broker did not release ${SLACK_BOT_TOKEN_SECRET} (${said}); nothing was posted`);
34121
+ throw new Error(`the secrets broker did not release ${SLACK_BOT_TOKEN_SECRET} (${beforeInjection}); nothing was posted`);
34119
34122
  }
34120
- throw new Error(`slack_post's poster exited ${code} without an answer: ${MAY_HAVE_POSTED}`);
34123
+ const detail = beforeInjection === "" ? "" : ` (${beforeInjection})`;
34124
+ throw new Error(`slack_post's poster exited ${code} without an answer${detail}: ${MAY_HAVE_POSTED}`);
34121
34125
  }
34122
34126
  if (line.refused === null) {
34123
34127
  throw new Error("Slack refused chat.postMessage with an error code slack_post does not pass on");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-envoy",
3
- "version": "10.26.0",
3
+ "version": "11.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {