@sjawhar/claude-envoy 4.17.1 → 4.18.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.
@@ -2,5 +2,5 @@
2
2
  "name": "claude-envoy",
3
3
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
4
4
  "mcpServers": "./.mcp.json",
5
- "version": "4.17.1"
5
+ "version": "4.18.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "4.17.1",
3
+ "version": "4.18.0",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
@@ -57836,7 +57836,7 @@ var import_nats5 = __toESM(require_mod4(), 1);
57836
57836
 
57837
57837
  // package.json
57838
57838
  var name2 = "@sjawhar/claude-envoy";
57839
- var version2 = "4.17.1";
57839
+ var version2 = "4.18.0";
57840
57840
  var legion = {
57841
57841
  daemonApiVersion: 199
57842
57842
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "4.17.1",
3
+ "version": "4.18.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
package/scripts/build.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  // buildBundles and buildLegionPlugin report reading; a file this script reads by path or
20
20
  // imports from outside the listed packages (.bun-version, scripts/third-party-notices.ts, the
21
21
  // scripts it runs) is listed by hand.
22
- import { cp, mkdir, readdir, readFile, realpath, writeFile } from "node:fs/promises"
22
+ import { chmod, cp, lstat, mkdir, readdir, readFile, realpath, writeFile } from "node:fs/promises"
23
23
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path"
24
24
  import { thirdPartyNotices } from "../../../scripts/third-party-notices"
25
25
  import { PHASE_HOOK_TOOL_NAME } from "../src/legion-phase-hook"
@@ -489,6 +489,21 @@ export async function buildCodexPlugin(out: string, dist?: string): Promise<void
489
489
  }
490
490
  if (dist === undefined) await buildBundles(join(out, "dist"))
491
491
  else await cp(dist, join(out, "dist"), { recursive: true })
492
+ // The pack keeps each file's mode as the disk has it, and the copies and writes above take the
493
+ // source's mode and the builder's umask: a build under umask 0002, which a systemd user unit
494
+ // runs with, ships group-writable files. Every entry of `out` is shipped, so each loses group and
495
+ // other write; every user keeps read, and search on each directory and execute on each file the
496
+ // owner can run. The published modes are then the same whoever builds.
497
+ for (const path of [
498
+ out,
499
+ ...(await readdir(out, { recursive: true })).map((entry) => join(out, entry)),
500
+ ]) {
501
+ const entry = await lstat(path)
502
+ if (entry.isSymbolicLink()) continue
503
+ const mode = entry.mode & 0o7777
504
+ const runnable = entry.isDirectory() || (mode & 0o100) !== 0
505
+ await chmod(path, (mode & ~0o022) | 0o444 | (runnable ? 0o111 : 0))
506
+ }
492
507
  }
493
508
 
494
509
  const USAGE =
@@ -17,7 +17,9 @@
17
17
  # rather than deleting them, and the list of skills is read off the links rather than written out
18
18
  # a second time here.
19
19
  #
20
- # Where no postpack runs — bun runs none when a pack fails — `--restore` puts the links back.
20
+ # Where no postpack runs — bun runs none when a pack fails — `--restore` puts the links back. The
21
+ # prepack's last step takes group and other write from every shipped path, so the published modes
22
+ # do not depend on the packer's umask.
21
23
  #
22
24
  # npm and bun both run these with the package root as the working directory, as that script's
23
25
  # header says, so the package is $PWD and the repository $PWD/../..:
@@ -131,11 +133,39 @@ if [ ${#staged[@]} -gt 0 ]; then
131
133
  refuse "bash scripts/pack-skills.sh --restore puts those links back"
132
134
  fi
133
135
 
134
- # The swap, under a trap that puts back every link it has replaced. What is left to fail here is
135
- # the filesystem rather than an entry, and a failure between the first swap and the last would
136
- # leave tracked links as copied directories. The trap is disarmed the moment the loop finishes,
137
- # and nowhere earlier: the pack this prepack runs for needs the real directories, and the
138
- # postpack puts the links back after it.
136
+ # The paths the pack ships, read here, before the swap, so that every refusal comes before a link is
137
+ # touched. The tarball keeps each shipped file's mode as it is on disk, and that mode is the
138
+ # packer's umask's: a checkout and a pack under umask 0002, which a systemd user unit runs with,
139
+ # give 0664 and 0775 where umask 022 gives 0644 and 0755, and the copies the swap makes take the
140
+ # packer's umask too. So every path the pack ships loses group and other write after the swap: each
141
+ # `files` entry that exists (a `<dir>/**` entry is its directory), and what `bun pm pack` ships
142
+ # whatever `files` says (bun 1.4.4: the manifest and the root's README*, LICENSE* and LICENCE*
143
+ # files). Every user keeps read, search on each directory and execute on each file already
144
+ # executable (chmod's X).
145
+ command -v jq > /dev/null 2>&1 || refuse "jq is required to set the shipped files' modes"
146
+ files_list=$(jq -r '.files | if type == "array" then .[] else empty end' package.json) ||
147
+ refuse "package.json could not be read for its files list"
148
+ [ -n "$files_list" ] || refuse "package.json has no files list, or an empty one, to set the shipped files' modes from"
149
+ shopt -s nullglob nocaseglob
150
+ shipped=(package.json README* LICENSE* LICENCE*)
151
+ shopt -u nocaseglob
152
+ while IFS= read -r entry; do
153
+ case $entry in
154
+ */\*\*) root=${entry%/\*\*} ;;
155
+ *[*?[]*) refuse "files entry \"$entry\" is a pattern whose paths this prepack cannot set the modes of; list a path, or a directory as <dir>/**" ;;
156
+ *) root=$entry ;;
157
+ esac
158
+ if [ -e "$root" ]; then
159
+ shipped+=("$root")
160
+ fi
161
+ done <<< "$files_list"
162
+
163
+ # The swap and the modes, under a trap that puts back every link it has replaced. What is left to
164
+ # fail here is the filesystem rather than an entry, and a failure between the first swap and the
165
+ # chmod would leave tracked links as copied directories. The trap is disarmed the moment the chmod
166
+ # has passed, and nowhere earlier: the pack this prepack runs for needs the real directories, and
167
+ # the postpack puts the links back after it. `shipped` names skills/ itself, so the chmod reaches
168
+ # the copies the swap made.
139
169
  swapped=()
140
170
  trap '[ ${#swapped[@]} -eq 0 ] || link_back "${swapped[@]}"' EXIT
141
171
  for name in "${names[@]}"; do
@@ -143,4 +173,5 @@ for name in "${names[@]}"; do
143
173
  swapped+=("$name")
144
174
  cp -R "$repo_skills/$name" "skills/$name"
145
175
  done
176
+ chmod -R go-w,a+rX -- "${shipped[@]}"
146
177
  trap - EXIT