@mulmoclaude/core 7.8.0 → 7.9.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.
@@ -1060,9 +1060,12 @@ shipped builders produce, and asserts `handlePermission` comes back over the MCP
1060
1060
 
1061
1061
  ### Cause
1062
1062
 
1063
- The image freezes whichever CLI was current when it was built, and
1064
- `ensureSandboxImage()` (`packages/mulmoclaude/server/system/docker.ts`) rebuilds only when the **Dockerfile's SHA**
1065
- changes. A new CLI release upstream doesn't change that SHA, so nothing retriggers the build.
1063
+ The image freezes whichever CLI was current when it was built. `ensureSandboxImage()`
1064
+ (`packages/mulmoclaude/server/system/docker.ts`) rebuilds at start, blocking, only when the
1065
+ **Dockerfile's SHA** changes. Since #3728 it also rebuilds a **stale** image (past 30 days) in the
1066
+ background when npm has a newer CLI: the server starts on the old image, and the next turn after the
1067
+ rebuild uses the new one. That refresh needs npm reachable, so an offline machine, or one whose image
1068
+ is younger than the stale limit, keeps the old CLI.
1066
1069
 
1067
1070
  ### Fix
1068
1071
 
@@ -1082,7 +1085,15 @@ about what is inside:
1082
1085
  docker run --rm --entrypoint claude mulmoclaude-sandbox --version
1083
1086
  ```
1084
1087
 
1085
- If it's behind, drop the image and let the next run rebuild:
1088
+ Look for the background refresh in the boot log:
1089
+
1090
+ ```
1091
+ INFO [sandbox] rebuilding the stale sandbox image in the background from=2.1.232 to=2.1.334
1092
+ INFO [sandbox] sandbox image refreshed; the next agent turn uses it claudeCodeVersion=2.1.334
1093
+ ```
1094
+
1095
+ `background refresh of the sandbox image failed` keeps the old image; the warn carries the reason.
1096
+ If it's behind and no refresh ran (young image, npm unreachable), drop the image and let the next run rebuild:
1086
1097
 
1087
1098
  ```bash
1088
1099
  yarn sandbox:remove # docker rmi mulmoclaude-sandbox
@@ -588,8 +588,14 @@ function parseGithub(rest) {
588
588
  const ownerRepo = hash === -1 ? rest : rest.slice(0, hash);
589
589
  const tag = hash === -1 ? null : rest.slice(hash + 1);
590
590
  const [owner = "", repo = "", ...extra] = ownerRepo.split("/");
591
- if (extra.length > 0 || !GITHUB_OWNER.test(owner)) return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(ownerRepo)}`);
592
- if (!GITHUB_REPO.test(repo) || repo === "." || repo === "..") return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(ownerRepo)}`);
591
+ if (extra.length > 0) return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(ownerRepo)}`);
592
+ return githubSource(owner, repo, tag, ownerRepo);
593
+ }
594
+ /** Owner, repo and tag already split apart, checked as one GitHub source. `shown` is how the owner/repo
595
+ * was written, for the error. */
596
+ function githubSource(owner, repo, tag, shown) {
597
+ if (!GITHUB_OWNER.test(owner)) return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(shown)}`);
598
+ if (!GITHUB_REPO.test(repo) || repo === "." || repo === "..") return refuse$1(`not a GitHub owner/repo: ${JSON.stringify(shown)}`);
593
599
  if (tag !== null && !isGithubTag(tag)) return refuse$1(`not a release tag: ${JSON.stringify(tag)}`);
594
600
  return {
595
601
  ok: true,
@@ -614,12 +620,50 @@ function parseFile(rest) {
614
620
  }
615
621
  };
616
622
  }
623
+ var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
624
+ var URL_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//;
625
+ var GIT_SUFFIX = /\.git$/;
626
+ var GITHUB_URL_SHAPES = "https://github.com/<owner>/<repo>, …/releases/latest or …/releases/tag/<tag>";
627
+ var AUTHORITY_WITH_USERINFO = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#\\]*@/;
628
+ var refuseUrl = (input) => refuse$1(`not a GitHub repository or release URL (${GITHUB_URL_SHAPES}): ${JSON.stringify(input)}`);
629
+ /** The tag a release path names: none for the repository itself or `releases/latest`, else `releases/tag/<tag>`.
630
+ * `undefined` when the path is something else (a branch, a file, an issue). */
631
+ function releaseTagOf(rest) {
632
+ if (rest.length === 0) return null;
633
+ if (rest.length === 2 && rest[0] === "releases" && rest[1] === "latest") return null;
634
+ if (rest.length >= 3 && rest[0] === "releases" && rest[1] === "tag") return rest.slice(2).join("/");
635
+ }
636
+ /** A URL path's segments, percent-decoded; `null` when one does not decode. Only the leading `/` and one
637
+ * trailing `/` are dropped: an empty segment anywhere else is kept, so a tag written `x//y` is refused as
638
+ * `github:` refuses it rather than read as `x/y`. */
639
+ function decodedSegments(pathname) {
640
+ const segments = pathname.split("/").slice(1);
641
+ const withoutTrailing = segments.at(-1) === "" ? segments.slice(0, -1) : segments;
642
+ try {
643
+ return withoutTrailing.map((segment) => decodeURIComponent(segment));
644
+ } catch {
645
+ return null;
646
+ }
647
+ }
648
+ function parseGithubUrl(input) {
649
+ const url = URL.canParse(input) ? new URL(input) : null;
650
+ if (url === null || url.protocol !== "https:" || !GITHUB_HOSTS.has(url.hostname)) return refuseUrl(input);
651
+ if (url.port !== "" || AUTHORITY_WITH_USERINFO.test(input)) return refuseUrl(input);
652
+ const segments = decodedSegments(url.pathname);
653
+ if (segments === null) return refuseUrl(input);
654
+ const [owner = "", repo = "", ...rest] = segments;
655
+ const tag = releaseTagOf(rest);
656
+ if (tag === void 0 || owner === "" || repo === "") return refuseUrl(input);
657
+ const bareRepo = repo.replace(GIT_SUFFIX, "");
658
+ return githubSource(owner, bareRepo, tag, `${owner}/${bareRepo}`);
659
+ }
617
660
  function parseInstallSource(input) {
618
661
  if (typeof input !== "string") return refuse$1("an install source is a string");
619
662
  const trimmed = input.trim();
620
663
  if (trimmed === "") return refuse$1("an install source is empty");
621
664
  if (trimmed.startsWith(GITHUB_PREFIX)) return parseGithub(trimmed.slice(7));
622
665
  if (trimmed.startsWith(FILE_PREFIX)) return parseFile(trimmed.slice(5));
666
+ if (URL_SCHEME.test(trimmed)) return parseGithubUrl(trimmed);
623
667
  return parseNpm(trimmed);
624
668
  }
625
669
  /** The ledger's `source` field for what was actually installed: the resolved version or tag. */