@yemi33/minions 0.1.2182 → 0.1.2183

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.
Files changed (2) hide show
  1. package/dashboard.js +18 -2
  2. package/package.json +1 -1
package/dashboard.js CHANGED
@@ -3596,6 +3596,15 @@ const CC_API_FALLBACK_BLOCKED_PREFIXES = [
3596
3596
  // captures no-op via the truthy guard.
3597
3597
  let _ccApiRoutesMeta = null;
3598
3598
 
3599
+ // Cache for the GET /api/routes public payload (P-d0e1f2a3 — Phase 3 cheap-win
3600
+ // #5). The ROUTES array is rebuilt per request (the literal lives inside the
3601
+ // http.createServer callback), but its CONTENTS are static — the routes table
3602
+ // is deterministic at boot. Recomputing _routesAsMeta(ROUTES).map(...) on
3603
+ // every /api/routes hit allocated ~180 wrapper objects + reran the param /
3604
+ // readOnly / destructive classification per route. The cache stores the
3605
+ // already-projected response shape so the hot path is a single array read.
3606
+ let _publicApiRoutesCache = null;
3607
+
3599
3608
  function _routePathForMeta(route) {
3600
3609
  if (!route) return '';
3601
3610
  if (typeof route.path === 'string') return route.path;
@@ -3720,6 +3729,10 @@ function _resetCcApiRoutesMetaForTest() {
3720
3729
  _ccApiRoutesMeta = null;
3721
3730
  }
3722
3731
 
3732
+ function _resetPublicApiRoutesCacheForTest() {
3733
+ _publicApiRoutesCache = null;
3734
+ }
3735
+
3723
3736
  function _formatCcApiRoutesIndex() {
3724
3737
  if (!Array.isArray(_ccApiRoutesMeta) || _ccApiRoutesMeta.length === 0) return '';
3725
3738
  return _ccApiRoutesMeta
@@ -11963,8 +11976,10 @@ What would you like to discuss or change? When you're happy, say "approve" and I
11963
11976
  });
11964
11977
  }},
11965
11978
  { method: 'GET', path: '/api/routes', desc: 'List all available API endpoints', handler: (req, res) => {
11966
- const list = _routesAsMeta(ROUTES).map(({ desc, ...rest }) => ({ ...rest, description: desc }));
11967
- return jsonReply(res, 200, { routes: list });
11979
+ if (!_publicApiRoutesCache) {
11980
+ _publicApiRoutesCache = _routesAsMeta(ROUTES).map(({ desc, ...rest }) => ({ ...rest, description: desc }));
11981
+ }
11982
+ return jsonReply(res, 200, { routes: _publicApiRoutesCache });
11968
11983
  }},
11969
11984
 
11970
11985
  // Status & health
@@ -13303,6 +13318,7 @@ module.exports = {
13303
13318
  _ccRuntimeNeedsResumeBookkeepingGuard,
13304
13319
  _joinCcPromptParts,
13305
13320
  _captureApiRoutesMeta,
13321
+ _resetPublicApiRoutesCacheForTest,
13306
13322
  _formatCcApiRoutesIndex,
13307
13323
  _formatCcCliCommandsIndex,
13308
13324
  _resetPreambleCache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2182",
3
+ "version": "0.1.2183",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"