@camstack/agent 1.1.52 → 1.1.54

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.js CHANGED
@@ -2081,13 +2081,39 @@ function createAgentService(deps) {
2081
2081
  }
2082
2082
  return deps.installFromNpm(pkg, v);
2083
2083
  },
2084
- applyBundle: (buf) => applyDeployedBundle({
2085
- addonsDir: deps.addonsDir,
2086
- addonId,
2087
- bundle: buf,
2088
- extract,
2089
- logger: deploySwapLogger
2090
- }),
2084
+ // #17: route the bundle through the agent's AddonInstaller when
2085
+ // wired — installFromTgz runs the FULL post-install (manifest
2086
+ // strip, runtime-deps npm install, manifest-driven NATIVE deps)
2087
+ // with its own staged extract + atomic swap. The plain tar swap
2088
+ // below never installed deps, so every pipeline/post-analysis
2089
+ // deploy on the Mac Electron agent silently shipped without
2090
+ // `sharp` et al. Fallback kept for agents without an installer
2091
+ // (test harnesses).
2092
+ applyBundle: async (buf) => {
2093
+ if (deps.installBundleTgz) {
2094
+ const tgzPath = path5.join(
2095
+ os2.tmpdir(),
2096
+ `camstack-deploy-${addonId.replace(/[^\w.-]/g, "_")}-${Date.now()}.tgz`
2097
+ );
2098
+ fs5.writeFileSync(tgzPath, buf);
2099
+ try {
2100
+ const { name } = await deps.installBundleTgz(tgzPath);
2101
+ return { addonDir: path5.join(deps.addonsDir, name) };
2102
+ } finally {
2103
+ try {
2104
+ fs5.unlinkSync(tgzPath);
2105
+ } catch {
2106
+ }
2107
+ }
2108
+ }
2109
+ return applyDeployedBundle({
2110
+ addonsDir: deps.addonsDir,
2111
+ addonId,
2112
+ bundle: buf,
2113
+ extract,
2114
+ logger: deploySwapLogger
2115
+ });
2116
+ },
2091
2117
  fetchBundle: (s) => fetchBundleFromHub(s),
2092
2118
  // Evict every addon DECLARATION id this package contributes
2093
2119
  // from `loadedAddons` so the follow-up `$agent.reload` actually
@@ -2682,7 +2708,11 @@ async function startAgent(configPath) {
2682
2708
  expectedClusterSecretHash: config.secret ? (0, import_system3.hashClusterSecret)(config.secret) : void 0,
2683
2709
  installFromNpm: async (pkg, version) => {
2684
2710
  await installer.install(pkg, version);
2685
- }
2711
+ },
2712
+ // #17: deployed bundles go through the installer's full post-install
2713
+ // (manifest strip + runtime deps + native deps + atomic swap) instead of
2714
+ // the bare tar swap that shipped addons without their node_modules.
2715
+ installBundleTgz: (tgzPath) => installer.installFromTgz(tgzPath)
2686
2716
  });
2687
2717
  broker.createService(agentServiceSchema);
2688
2718
  const agentTcpPort = (0, import_system3.deriveAgentListenPort)(broker.nodeID);
@@ -2832,6 +2862,9 @@ async function startAgent(configPath) {
2832
2862
  agentUdsRegistry.onReadinessSnapshotRequest(
2833
2863
  () => agentReadinessRegistry.getSnapshotForTransport()
2834
2864
  );
2865
+ broker.createService(
2866
+ (0, import_system3.createReadinessServiceForRegistry)(agentReadinessRegistry, import_system3.AGENT_READINESS_SERVICE_NAME)
2867
+ );
2835
2868
  }
2836
2869
  const getBrokerFn = (() => broker);
2837
2870
  void startAgentHttpServer(getBrokerFn, {