limixbot 0.3.28 → 0.3.30

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 (169) hide show
  1. package/dist/assets/{ActivityPanel-DWXoNPQ0.js → ActivityPanel-Ca93mwbG.js} +1 -1
  2. package/dist/assets/{App-AKtlUFTy.js → App-BNTTjhsV.js} +134 -133
  3. package/dist/assets/AppEventEditor-cfYkXfeJ.js +1 -0
  4. package/dist/assets/{BotSettingsDialog--VNs8Ujc.js → BotSettingsDialog-DSlyshDi.js} +2 -2
  5. package/dist/assets/BrowserPanel-KrCVA3c6.js +3 -0
  6. package/dist/assets/{BrowserProfilesManager-CYFWUNHq.js → BrowserProfilesManager-C-Vt0eJi.js} +1 -1
  7. package/dist/assets/CloudAddDialog-D6ATLiSR.js +1 -0
  8. package/dist/assets/{ComputerFilesPane-1v4DGO6R.js → ComputerFilesPane-DvNcD0u0.js} +1 -1
  9. package/dist/assets/ComputerPanel-BButaK92.js +2 -0
  10. package/dist/assets/{DataPanel-CTDfwsgJ.js → DataPanel-iOCJJ-ic.js} +1 -1
  11. package/dist/assets/{DesktopViewer-CRcjWYHe.js → DesktopViewer-DbEC8oPW.js} +1 -1
  12. package/dist/assets/{FilesView-GVsVwbHA.js → FilesView-tnqRwvfh.js} +2 -2
  13. package/dist/assets/{GrokMoveDialog-DV2CsI4-.js → GrokMoveDialog-DcD2N9NJ.js} +3 -3
  14. package/dist/assets/{InspectorPanel-CU7r0jNs.js → InspectorPanel-neNG3E93.js} +1 -1
  15. package/dist/assets/KeyboardShortcutsModal-CGzUNFhz.js +1 -0
  16. package/dist/assets/{LiveDesktop-D99l3t9X.js → LiveDesktop-DJnRvtY5.js} +1 -1
  17. package/dist/assets/LocalVmWorkspace-B4yOJABf.js +1 -0
  18. package/dist/assets/{MacLocalControl-DbgKqPjA.js → MacLocalControl-ClcDNzDl.js} +1 -1
  19. package/dist/assets/{MarkdownFilePreview-CgsVW_ti.js → MarkdownFilePreview-ufl-s03V.js} +1 -1
  20. package/dist/assets/{MenuMotion-BOUToDZz.js → MenuMotion-Dj4rtEj4.js} +1 -1
  21. package/dist/assets/NewBotDialog-BniS1lPX.js +1 -0
  22. package/dist/assets/PhoneAppDialog-CG3KQVI4.js +1 -0
  23. package/dist/assets/{PlacesRail-dslg5RRJ.js → PlacesRail-bn7tEIBM.js} +2 -2
  24. package/dist/assets/{PluginsPanel-BVLR1WAH.js → PluginsPanel-DHTTKAon.js} +5 -5
  25. package/dist/assets/{ProIntroduction-DDKnUNeq.js → ProIntroduction-uJD0s7Me.js} +1 -1
  26. package/dist/assets/{RemoteAgentSettingsPanel-B56P6Er4.js → RemoteAgentSettingsPanel-DCKwqq0d.js} +1 -1
  27. package/dist/assets/{RoomPanel-CqhmGYP1.js → RoomPanel-aIa7Diz1.js} +1 -1
  28. package/dist/assets/{RoutinesPage-BoC8z-Aj.js → RoutinesPage-CLHjhuBJ.js} +2 -2
  29. package/dist/assets/SettingsModal-Dx_ELHpv.js +19 -0
  30. package/dist/assets/ShareTeamDialog-BOzHCj2n.js +1 -0
  31. package/dist/assets/{SignedInSites-CpKq69sj.js → SignedInSites-C-nx8of8.js} +1 -1
  32. package/dist/assets/TeamLibraryPanel-Bp1ZcEZQ.js +1 -0
  33. package/dist/assets/TeamMapPage-BL5CHTBF.js +1 -0
  34. package/dist/assets/{TriggersPage-BY7Vq4y0.js → TriggersPage-BEHK5XH1.js} +1 -1
  35. package/dist/assets/{VisibilitySection-B9GJNaPh.js → VisibilitySection-DxR_98SK.js} +2 -2
  36. package/dist/assets/WebhookTrigger-DaoCLzsd.js +1 -0
  37. package/dist/assets/{WorksOnGrid-DbXKKR-y.js → WorksOnGrid-DrO1qcZh.js} +1 -1
  38. package/dist/assets/{abnfDiagram-YUKMZFIV-UeQ15ljp.js → abnfDiagram-YUKMZFIV-BcUIfOEe.js} +1 -1
  39. package/dist/assets/{activity-Rykx5lZJ.js → activity-BNFKxy1b.js} +1 -1
  40. package/dist/assets/{architectureDiagram-47P4ROYG-Cb42ilBV.js → architectureDiagram-47P4ROYG-C7ht62Bt.js} +1 -1
  41. package/dist/assets/{blockDiagram-E7TT5TSB-BF1yg64q.js → blockDiagram-E7TT5TSB-CaczmOHs.js} +1 -1
  42. package/dist/assets/{c4Diagram-CRA5TL53-VaNJpISp.js → c4Diagram-CRA5TL53-DSPaJBwh.js} +1 -1
  43. package/dist/assets/{calendar-days-kC634hX1.js → calendar-days-DU-aFzFs.js} +1 -1
  44. package/dist/assets/channel-BXNHTVIL.js +1 -0
  45. package/dist/assets/{chunk-2Q5K7J3B-NtXjlfnQ.js → chunk-2Q5K7J3B-D4erYHrR.js} +1 -1
  46. package/dist/assets/{chunk-5VM5RSS4-CYWCBb40.js → chunk-5VM5RSS4-D8syTc7K.js} +1 -1
  47. package/dist/assets/{chunk-7TKQ45FW-CTx1wLnU.js → chunk-7TKQ45FW-qZ8vN88Y.js} +1 -1
  48. package/dist/assets/{chunk-AW2ZBBNX-PDrwpbhk.js → chunk-AW2ZBBNX-COZ0RY0p.js} +1 -1
  49. package/dist/assets/{chunk-FVRAUYC3-CqIp8Ubp.js → chunk-FVRAUYC3-B9WP6gNL.js} +2 -2
  50. package/dist/assets/{chunk-HTAEGDNF-yA6riuIr.js → chunk-HTAEGDNF-DpLxKDYN.js} +1 -1
  51. package/dist/assets/{chunk-JWPE2WC7-DEE_S031.js → chunk-JWPE2WC7-CyI6_v_4.js} +1 -1
  52. package/dist/assets/{chunk-KQW6MTUR-QybxNtsY.js → chunk-KQW6MTUR-C3xLM0DV.js} +1 -1
  53. package/dist/assets/{chunk-XXDRQBXY-BjchQyqU.js → chunk-XXDRQBXY-C7oc9LKJ.js} +1 -1
  54. package/dist/assets/{classDiagram-v2-K4WV4PDN-DtOc8Abr.js → classDiagram-v2-K4WV4PDN-DtYcyxMZ.js} +1 -1
  55. package/dist/assets/{coins-D0wNJCPg.js → coins-C8BnHs7A.js} +1 -1
  56. package/dist/assets/{core-BPiVxfZh.js → core-CuBqcMgK.js} +1 -1
  57. package/dist/assets/{cose-bilkent-JH36ORCC-CWHsqn7M.js → cose-bilkent-JH36ORCC-BACClH_n.js} +1 -1
  58. package/dist/assets/{cynefin-EF2NZ3EQ-BqS-D9jN.js → cynefin-EF2NZ3EQ-DZo-gx9_.js} +1 -1
  59. package/dist/assets/{cynefinDiagram-3GCD6N5R-Fc51YETb.js → cynefinDiagram-3GCD6N5R-CB9Tufy-.js} +1 -1
  60. package/dist/assets/{dagre-W4DXFKR2-So1kz52t.js → dagre-W4DXFKR2-QmMefB-F.js} +1 -1
  61. package/dist/assets/{de-B1J17cai.js → de-BZ9nuzrz.js} +1 -1
  62. package/dist/assets/{diagram-2UJZ2QOL-DpdA_Lk0.js → diagram-2UJZ2QOL-BB9UdSXb.js} +1 -1
  63. package/dist/assets/{diagram-OVF4WLC6-BqSu7ih2.js → diagram-OVF4WLC6-BT1xV_u3.js} +1 -1
  64. package/dist/assets/{diagram-PFPMY2P6-BoM6YcIG.js → diagram-PFPMY2P6-Bb8Gcrwm.js} +1 -1
  65. package/dist/assets/{diagram-UMYRVEAY-B7wKoLi9.js → diagram-UMYRVEAY-CuhVtw_K.js} +1 -1
  66. package/dist/assets/{diagram-YEKJPTXX-BEXKw540.js → diagram-YEKJPTXX-BKeM2V-v.js} +1 -1
  67. package/dist/assets/{diagram-ZIFT7M5P-BAD7sJRi.js → diagram-ZIFT7M5P-CWJdSX39.js} +1 -1
  68. package/dist/assets/{ebnfDiagram-VR2GEFS7-DILoqvy-.js → ebnfDiagram-VR2GEFS7-CQt0qwgC.js} +1 -1
  69. package/dist/assets/{elk-IJKZMXRS-BHW-Cxin.js → elk-IJKZMXRS-DTpYboxu.js} +1 -1
  70. package/dist/assets/{erDiagram-O2IAPWRE-Blp0Wwq0.js → erDiagram-O2IAPWRE-CRmD7TiT.js} +1 -1
  71. package/dist/assets/es-BxLq0ePd.js +6 -0
  72. package/dist/assets/{file-up-CEuHjVBK.js → file-up-DA-MGVqh.js} +1 -1
  73. package/dist/assets/{flowDiagram-OXPTDLAJ-6SkVmYje.js → flowDiagram-OXPTDLAJ-C3OIuz51.js} +1 -1
  74. package/dist/assets/{fr-Dn65EJNi.js → fr-BoXnQ5F8.js} +1 -1
  75. package/dist/assets/{ganttDiagram-R7TSEDQI-DFDwj8QX.js → ganttDiagram-R7TSEDQI-DRztzQgb.js} +1 -1
  76. package/dist/assets/{gitGraphDiagram-XJZIOB7I-mtJG-sis.js → gitGraphDiagram-XJZIOB7I-DljlrTI8.js} +1 -1
  77. package/dist/assets/{hi-CHU0sl7u.js → hi-CcIxinfW.js} +1 -1
  78. package/dist/assets/{import-name-DmpyAnTM.js → import-name-D7OVVg4a.js} +1 -1
  79. package/dist/assets/{index-BPNGi-6U.js → index-Bt5WwBKC.js} +2 -2
  80. package/dist/assets/{index-6y27F-UC.js → index-C6I9mMp7.js} +1 -1
  81. package/dist/assets/{infoDiagram-5W2HQ5XZ-CmyXB17U.js → infoDiagram-5W2HQ5XZ-sZgtYSBR.js} +1 -1
  82. package/dist/assets/{ishikawaDiagram-K3B6WC7H-BKFtIESa.js → ishikawaDiagram-K3B6WC7H-C3hf18HZ.js} +1 -1
  83. package/dist/assets/it-I6t2VEkh.js +13 -0
  84. package/dist/assets/ja-XTlk5V47.js +13 -0
  85. package/dist/assets/{journeyDiagram-COXZFDF6-DuXMREdz.js → journeyDiagram-COXZFDF6-Cx7iVI1Y.js} +1 -1
  86. package/dist/assets/{kanban-definition-P3RFRI5V-B9mWvKdh.js → kanban-definition-P3RFRI5V-BCfPOAwE.js} +1 -1
  87. package/dist/assets/ko-BplWTKGd.js +13 -0
  88. package/dist/assets/{mcp-servers-B3q18o5s.js → mcp-servers-byTznZvJ.js} +1 -1
  89. package/dist/assets/{mermaid.core-3c-Lql2y.js → mermaid.core-u5mM9R6c.js} +4 -4
  90. package/dist/assets/{mindmap-definition-LZFPQGKD-BmLt9bkD.js → mindmap-definition-LZFPQGKD-Bl1ss-w7.js} +1 -1
  91. package/dist/assets/{minimize-BfKI3Nbu.js → minimize-CQhJEKJt.js} +1 -1
  92. package/dist/assets/{monitor-C-EBTsrK.js → monitor-DUalxLhV.js} +1 -1
  93. package/dist/assets/{new-bot-CfgTtkz8.js → new-bot-B_nigkqj.js} +1 -1
  94. package/dist/assets/{org-library-CUElcBwL.js → org-library-tjVQPsZw.js} +1 -1
  95. package/dist/assets/{package-format-BFiYSYhD.js → package-format-TOf-oPLr.js} +1 -1
  96. package/dist/assets/{pegDiagram-BGZESJAR-5w1MTtLg.js → pegDiagram-BGZESJAR-DYVS4bK_.js} +1 -1
  97. package/dist/assets/{pieDiagram-CAPJLFHJ-C4etNvsK.js → pieDiagram-CAPJLFHJ-Dd2OI03J.js} +1 -1
  98. package/dist/assets/pl-Bv2R8H4r.js +13 -0
  99. package/dist/assets/{pt-br-BtcqPDCE.js → pt-br-CM02ONwa.js} +1 -1
  100. package/dist/assets/{quadrantDiagram-GDMTTRAM-k4cDUeIN.js → quadrantDiagram-GDMTTRAM-DftvCum7.js} +1 -1
  101. package/dist/assets/{rail-C6qkoJbO.js → rail-5xabqdtQ.js} +1 -1
  102. package/dist/assets/{railroadDiagram-SM67HX2B-B9d0qasL.js → railroadDiagram-SM67HX2B-CMUXYZoX.js} +1 -1
  103. package/dist/assets/{remote-desktop-panel-BfQEsoFh.js → remote-desktop-panel-CnvMPI4j.js} +1 -1
  104. package/dist/assets/{requirementDiagram-X7JNWC4A-BlYV4z86.js → requirementDiagram-X7JNWC4A-TUFFobBi.js} +1 -1
  105. package/dist/assets/ru-CJcyvxC6.js +13 -0
  106. package/dist/assets/{sankeyDiagram-UM26HJRW-DaIVWJEd.js → sankeyDiagram-UM26HJRW-BoWUtM1O.js} +1 -1
  107. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-CAnXpud0.js → sequenceDiagram-ZO4K6R2Y-BJGhu1J3.js} +1 -1
  108. package/dist/assets/{sizeCapture-INFHLROL-BIeqIcHi.js → sizeCapture-INFHLROL-BjWOwFei.js} +1 -1
  109. package/dist/assets/{stateDiagram-v2-TBUQTH76-7ql5dn9y.js → stateDiagram-v2-TBUQTH76-BHnqACBE.js} +1 -1
  110. package/dist/assets/styles-BxpHDI63.css +1 -0
  111. package/dist/assets/{styles-BRMaHK08.js → styles-DnwnyZpR.js} +1 -1
  112. package/dist/assets/{swimlanes-N4OXWK64-CItt-UlU.js → swimlanes-N4OXWK64-w7Jh9mLp.js} +1 -1
  113. package/dist/assets/swimlanesDiagram-K3J5GTZL-zIHpuU63.js +8 -0
  114. package/dist/assets/{team-share-2OjfOHsk.js → team-share-iEP9Zjr-.js} +1 -1
  115. package/dist/assets/{timeline-definition-YOQAKGHF-8Xn9QBNo.js → timeline-definition-YOQAKGHF-D0trOSBD.js} +1 -1
  116. package/dist/assets/{tr-3Jw0E4fc.js → tr-CTl25e95.js} +1 -1
  117. package/dist/assets/{uk-B_Q6nXm0.js → uk-B_psMXqm.js} +1 -1
  118. package/dist/assets/{usecaseDiagram-VIAY4XPW-B6LxotkO.js → usecaseDiagram-VIAY4XPW-A_NiPbx_.js} +1 -1
  119. package/dist/assets/{vennDiagram-BLWOH2XV-Ciex0LDC.js → vennDiagram-BLWOH2XV-iEyMv06N.js} +1 -1
  120. package/dist/assets/{wardleyDiagram-YMQ3BMBF-B_TbpQlN.js → wardleyDiagram-YMQ3BMBF-yIcnyDG1.js} +1 -1
  121. package/dist/assets/{xychartDiagram-TAQBALBS-Dz_iIYt1.js → xychartDiagram-TAQBALBS-BbKfuPA4.js} +1 -1
  122. package/dist/assets/zh-BPHbGe7C.js +13 -0
  123. package/dist/assets/{zh-tw-CWDGum-b.js → zh-tw-BMYbS8NC.js} +1 -1
  124. package/dist/index.html +3 -3
  125. package/dist/rail.html +5 -5
  126. package/dist-server/container-mcp.js +4 -4
  127. package/dist-server/index.js +3047 -3002
  128. package/dist-server/openmausbot.js +312 -311
  129. package/dist-server/package.json +1 -1
  130. package/dist-server/pair-cli.js +312 -311
  131. package/dist-server/server/config.js +4 -0
  132. package/dist-server/server/container-computer.js +73 -4
  133. package/dist-server/server/drivers/chatgpt-plan-auth.js +1 -1
  134. package/dist-server/server/harness/registry.js +8 -3
  135. package/dist-server/server/index.js +11 -8
  136. package/dist-server/server/limix-bot-library.js +9 -6
  137. package/dist-server/server/limix-skill-requirements.js +324 -0
  138. package/dist-server/server/limix-vm-capacity.js +64 -0
  139. package/dist-server/server/local-vm-settings.js +10 -3
  140. package/dist-server/server/routes/bot-skills.js +11 -0
  141. package/dist-server/server/routes/computers.js +12 -13
  142. package/dist-server/server/routes/instances.js +12 -2
  143. package/dist-server/shared/limix-vm-capacity.js +1 -0
  144. package/dist-server/vps-container-mcp.js +4 -4
  145. package/dist-server/workspace-backup.worker.js +3 -3
  146. package/package.json +1 -1
  147. package/dist/assets/AppEventEditor-BbiQKfDF.js +0 -1
  148. package/dist/assets/BrowserPanel-BL-QulSx.js +0 -3
  149. package/dist/assets/CloudAddDialog-CIQAIQtu.js +0 -1
  150. package/dist/assets/ComputerPanel-qgolre5n.js +0 -2
  151. package/dist/assets/KeyboardShortcutsModal-CwzNonqy.js +0 -1
  152. package/dist/assets/LocalVmWorkspace-QFZ4nJ8z.js +0 -1
  153. package/dist/assets/NewBotDialog-DjykSVLq.js +0 -1
  154. package/dist/assets/PhoneAppDialog-BPplMkUl.js +0 -1
  155. package/dist/assets/SettingsModal-Tet7aBPK.js +0 -19
  156. package/dist/assets/ShareTeamDialog-ovqh9ly2.js +0 -1
  157. package/dist/assets/TeamLibraryPanel-B5OwB3qN.js +0 -1
  158. package/dist/assets/TeamMapPage-BGCgxtM7.js +0 -1
  159. package/dist/assets/WebhookTrigger-BfyyC34L.js +0 -1
  160. package/dist/assets/channel-Di74R1Kh.js +0 -1
  161. package/dist/assets/es-CS_V7OdX.js +0 -6
  162. package/dist/assets/it-CbDr93sA.js +0 -13
  163. package/dist/assets/ja-CJbW-M3a.js +0 -13
  164. package/dist/assets/ko-ZQvzPil_.js +0 -13
  165. package/dist/assets/pl-tZIDksyW.js +0 -13
  166. package/dist/assets/ru-Bfcy52OT.js +0 -13
  167. package/dist/assets/styles-Di_mG4l3.css +0 -1
  168. package/dist/assets/swimlanesDiagram-K3J5GTZL-DAZsljU6.js +0 -8
  169. package/dist/assets/zh-BwjuB8Xo.js +0 -13
@@ -455,6 +455,8 @@ export function parseStoredConfig(value) {
455
455
  const parsed = storedAppConfigSchema.safeParse(value);
456
456
  if (!parsed.success)
457
457
  throw new Error(schemaIssue(parsed.error, "Invalid stored configuration"));
458
+ if (parsed.data.localVm && parsed.data.localVm.automaticCapacity === undefined)
459
+ parsed.data.localVm.automaticCapacity = true;
458
460
  return parsed.data;
459
461
  }
460
462
  export function loadBrowserProfileIdAliases() {
@@ -810,6 +812,8 @@ export function saveConfig(patch, options = {}) {
810
812
  if (key === "threads" && !current.success)
811
813
  merged.maxConcurrentPerBot = defaultBotThreads();
812
814
  Object.assign(merged, section, key === "browserEngine" && checkedPatch.browserEngine?.egress ? { egress: { ...jsonObjectSchema.safeParse(merged.egress).data, ...checkedPatch.browserEngine.egress } } : {}); // a partial egress patch keeps the stored allow-list
815
+ if (key === "localVm" && checkedPatch.localVm?.maxInstances !== undefined && checkedPatch.localVm.automaticCapacity === undefined)
816
+ merged.automaticCapacity = false;
813
817
  for (const [sectionKey, sectionValue] of Object.entries(section)) {
814
818
  if (sectionValue === null)
815
819
  delete merged[sectionKey];
@@ -12,6 +12,8 @@ import { DATA_DIR } from "./config.js";
12
12
  import { applyResourcesBeforeStart, DEFAULT_DESKTOP_RESOURCES, PIDS_LIMIT, raisePidsLimit, resourceArgs, } from "./container-limits.js";
13
13
  import { appleResourcesAreLimited, currentHostUser, DESKTOP_FLAGS_LABEL, DESKTOP_FLAGS_VERSION, desktopCapArgs, desktopRootIsHostRoot, dockerSecurityIsHardened, GUEST_UID, guestIdsCommand, guestIdsFor, podmanSecurityIsHardened, } from "./container-isolation.js";
14
14
  import { SPAWNED_PROXIES } from "./proxy-paths.js";
15
+ import { limixVmCapacity, refreshLimixVmCapacity, serializeLimixVmStart } from "./limix-vm-capacity.js";
16
+ import { lxs } from "./limix-lang.js";
15
17
  const run = promisify(execFile);
16
18
  const SCREENSHOT_STATUS_TTL_MS = 10_000;
17
19
  export const CUA_DRIVER_VERSION = "0.37.0";
@@ -25,7 +27,7 @@ export const IMAGE_REPOSITORY = "localhost/limixbot/cua-local-vm";
25
27
  export const IMAGE_LAYER_VERSION = "9";
26
28
  export const IMAGE_LAYER_LABEL = "com.openmausbot.image-layer";
27
29
  export const IMAGE = `${IMAGE_REPOSITORY}:driver-${CUA_DRIVER_VERSION}-v${IMAGE_LAYER_VERSION}`;
28
- export const CONTAINER = "openmausbot-computer";
30
+ export const CONTAINER = "limixbot-computer";
29
31
  export const MANAGED_LABEL = "com.openmausbot.local-vm";
30
32
  export const DRIVER_LABEL = "com.openmausbot.cua-driver";
31
33
  export const BASE_IMAGE_LABEL = "com.openmausbot.cua-base";
@@ -199,6 +201,8 @@ export async function containerRuntimeStatus(runner = sh, platform = process.pla
199
201
  }
200
202
  }));
201
203
  const healthyIndex = healthy.indexOf(true);
204
+ if (runner === sh)
205
+ await refreshLimixVmCapacity(healthyIndex >= 0 ? available[healthyIndex] : null, runner);
202
206
  return {
203
207
  runtime: healthyIndex >= 0 ? available[healthyIndex] : (available[0] ?? null),
204
208
  available,
@@ -310,6 +314,36 @@ function containerOwnershipLabelsMatch(labels, target) {
310
314
  ? labels?.[TARGET_LABEL] === undefined || labels?.[TARGET_LABEL] === target.label
311
315
  : labels?.[TARGET_LABEL] === target.label));
312
316
  }
317
+ export async function migrateLocalVmName(runtime, target, runner) {
318
+ if (runtime === "container" || !target.containerName.startsWith(CONTAINER))
319
+ return;
320
+ try {
321
+ await runner(runtime, ["inspect", target.containerName]);
322
+ return;
323
+ }
324
+ catch { }
325
+ const legacy = target.containerName.replace(/^limixbot-computer/, "openmausbot-computer");
326
+ let labels;
327
+ try {
328
+ const { stdout } = await runner(runtime, ["inspect", legacy]);
329
+ labels = JSON.parse(stdout)[0]?.Config?.Labels;
330
+ }
331
+ catch {
332
+ return;
333
+ }
334
+ if (!containerOwnershipLabelsMatch(labels, target))
335
+ return;
336
+ try {
337
+ await runner(runtime, ["rename", legacy, target.containerName]);
338
+ }
339
+ catch (error) {
340
+ // Concurrent status requests may have already renamed the same container.
341
+ const { stdout } = await runner(runtime, ["inspect", target.containerName]);
342
+ const current = JSON.parse(stdout)[0];
343
+ if (!containerOwnershipLabelsMatch(current?.Config?.Labels, target))
344
+ throw error;
345
+ }
346
+ }
313
347
  function normalizeImageId(id) {
314
348
  return id?.trim().replace(/^sha256:/, "") || null;
315
349
  }
@@ -380,6 +414,7 @@ export async function containerComputerStatus(runner = sh, platform = process.pl
380
414
  status.image_id = image.id;
381
415
  }
382
416
  catch { }
417
+ await migrateLocalVmName(status.runtime, target, runner);
383
418
  try {
384
419
  const { stdout } = await runner(status.runtime, ["inspect", target.containerName]);
385
420
  if (status.runtime === "container") {
@@ -602,11 +637,12 @@ async function prepareManagedImage(runtime, runner) {
602
637
  await rm(context, { recursive: true, force: true });
603
638
  }
604
639
  }
605
- export async function containerComputerAction(action, runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET, resources = DEFAULT_DESKTOP_RESOURCES) {
640
+ export async function containerComputerAction(action, runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET, resources = DEFAULT_DESKTOP_RESOURCES, runningLimit) {
606
641
  if (runner === sh && platform === process.platform)
607
642
  screenshotStatusCache.delete(target.key);
608
643
  const before = await containerComputerStatus(runner, platform, target);
609
644
  const runtime = before.runtime;
645
+ let createdStopped = false;
610
646
  if (!runtime)
611
647
  throw Object.assign(new Error(before.problem ?? "No container runtime is installed"), { status: 409 });
612
648
  if (!before.daemonUp)
@@ -649,9 +685,42 @@ export async function containerComputerAction(action, runner = sh, platform = pr
649
685
  : action === "remove"
650
686
  ? ["rm", runtime === "container" ? "--force" : "-f", target.containerName]
651
687
  : [action, target.containerName];
652
- await runner(runtime, args, 2 * 60_000);
688
+ if ((action === "run" || action === "start") && (runner === sh || runningLimit !== undefined)) {
689
+ await serializeLimixVmStart(async () => {
690
+ const maximum = (typeof runningLimit === "function" ? runningLimit() : runningLimit) ?? limixVmCapacity(resources).limit;
691
+ const running = await runningLocalVmCount(runtime, runner);
692
+ if (running >= maximum) {
693
+ if (action === "run" && runtime !== "container") {
694
+ await runner(runtime, ["create", ...args.slice(2)], 2 * 60_000);
695
+ createdStopped = true;
696
+ return;
697
+ }
698
+ throw Object.assign(new Error(lxs(`Đã đạt giới hạn ${maximum} máy ảo đang chạy. Dừng một máy khác rồi bật lại máy này.`, `The limit of ${maximum} running desktops has been reached. Stop another desktop before starting this one.`)), { status: 409, code: "local_vm_capacity" });
699
+ }
700
+ await runner(runtime, args, 2 * 60_000);
701
+ });
702
+ }
703
+ else
704
+ await runner(runtime, args, 2 * 60_000);
705
+ }
706
+ const after = await containerComputerStatus(runner, platform, target);
707
+ if (createdStopped)
708
+ after.capacity_limited = true;
709
+ return after;
710
+ }
711
+ export async function runningLocalVmCount(runtime, runner = sh) {
712
+ if (runtime === "container") {
713
+ try {
714
+ const result = await runner(runtime, ["inspect", SHARED_LOCAL_VM_TARGET.containerName], 8000);
715
+ const rows = JSON.parse(result.stdout);
716
+ return rows.some((row) => row.status?.state === "running") ? 1 : 0;
717
+ }
718
+ catch {
719
+ return 0;
720
+ }
653
721
  }
654
- return containerComputerStatus(runner, platform, target);
722
+ const result = await runner(runtime, ["ps", "--filter", `label=${MANAGED_LABEL}=1`, "--format", "{{.Names}}"], 8000);
723
+ return result.stdout.split(/\r?\n/).filter((name) => name.trim()).length;
655
724
  }
656
725
  export async function containerComputerExists(runtime, target, runner = sh) {
657
726
  try {
@@ -327,7 +327,7 @@ export class ChatGptPlanAuthController {
327
327
  const redirectUri = `http://127.0.0.1:${address.port}/auth/callback`;
328
328
  const url = new URL(`${this.issuer}/api/accounts/authorize`);
329
329
  url.search = new URLSearchParams({ client_id: clientId ?? "dynamic_agent_client", ext_agent_host_id: hostId,
330
- ...(clientId ? {} : { agent_name_hint: "openmausbot" }), ...(previous?.email ? { login_hint: previous.email } : {}),
330
+ ...(clientId ? {} : { agent_name_hint: "Limix Bot" }), ...(previous?.email ? { login_hint: previous.email } : {}),
331
331
  ...(previous?.tokens && !previous.tokens.scopes.includes(DIRECT_SCOPE) ? { prompt: "consent" } : {}),
332
332
  response_type: "code", redirect_uri: redirectUri, scope: SCOPES, resource: this.resource, state, nonce,
333
333
  code_challenge_method: "S256", code_challenge: createHash("sha256").update(verifier).digest("base64url"),
@@ -1,6 +1,7 @@
1
1
  // Provider instance registry — port of upstream's ProviderInstanceRegistryLive behavior, minus Effect.
2
2
  import { findCliCandidates } from "../env-path.js";
3
- import { installNpmEngine, npmAvailable, serverInstallFor, standaloneLookupPath } from "../engine-install.js";
3
+ import { installNpmEngine, npmAvailable, npmLatestVersion, serverInstallFor, standaloneLookupPath, enginesBinDir } from "../engine-install.js";
4
+ import { join } from "node:path";
4
5
  import { installStandaloneEngine, isAppStandaloneCopy } from "../engine-standalone.js";
5
6
  import { pinnedNpmVersion } from "../engine-versions.js";
6
7
  import { withEngineMemory } from "../engine-memory.js";
@@ -296,7 +297,7 @@ export class ProviderRegistry {
296
297
  }
297
298
  return true;
298
299
  }
299
- async installRuntime(instanceId) {
300
+ async installRuntime(instanceId, options = {}) {
300
301
  const entry = this.byId.get(instanceId);
301
302
  if (!entry)
302
303
  return false;
@@ -315,7 +316,11 @@ export class ProviderRegistry {
315
316
  }
316
317
  if (!server?.package)
317
318
  return false;
318
- await installNpmEngine(server.package, { baseDir: this.enginesBaseDir, cli: cliDefaultOf(driver), version: driver ? pinnedNpmVersion(driver.driverKind) : undefined });
319
+ const updateCodex = options.update && driver?.driverKind === "codex";
320
+ const version = updateCodex ? await npmLatestVersion(server.package, this.enginesBaseDir) : driver ? pinnedNpmVersion(driver.driverKind) : undefined;
321
+ await installNpmEngine(server.package, { baseDir: this.enginesBaseDir, cli: cliDefaultOf(driver), version });
322
+ if (updateCodex)
323
+ return { useCli: join(enginesBinDir(this.enginesBaseDir), process.platform === "win32" ? "codex.cmd" : "codex"), expectedVersion: version };
319
324
  return true;
320
325
  }
321
326
  finally {
@@ -1,6 +1,9 @@
1
1
  // Import first: it reads a Cloud home's secrets off the launcher's pipe before any module can start a process.
2
2
  import { BOOT_CLOUD_SECRETS } from "./cloud-secrets-boot.js";
3
3
  import { startFailureText } from "./start-failure-text.js";
4
+ import { limixVmCapacity } from "./limix-vm-capacity.js";
5
+ import { localVmAutomaticCapacity } from "./local-vm-settings.js";
6
+ import { runningLocalVmCount } from "./container-computer.js";
4
7
  import { reserveGmailDrafts } from "./gmail-draft-policy.js";
5
8
  import { createGmailDrafts } from "./host/gmail-drafts.js";
6
9
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -5735,7 +5738,7 @@ let localVmProvisionBusy = false;
5735
5738
  let localVmModeChangeBusy = false;
5736
5739
  const localVmUpdates = createLocalVmUpdater({
5737
5740
  status: (target) => containerComputerStatus(undefined, undefined, target),
5738
- act: (action, target) => containerComputerAction(action, undefined, undefined, target, localVmResources(cfg)),
5741
+ act: (action, target) => containerComputerAction(action, undefined, undefined, target, localVmResources(cfg), () => localVmMaxInstances(cfg)),
5739
5742
  imageBusy: { get: () => localVmImageBusy, set: (busy) => { localVmImageBusy = busy; } },
5740
5743
  provisionBusy: { get: () => localVmProvisionBusy, set: (busy) => { localVmProvisionBusy = busy; } },
5741
5744
  lifecycleBusy: localVmLifecycleBusy,
@@ -11829,6 +11832,7 @@ const { fillLoginForTurn } = createFillLoginTurn({
11829
11832
  });
11830
11833
  async function localVmPayload(target, auth) {
11831
11834
  const status = localVmUpdates.describe(target, await containerComputerStatus(undefined, undefined, target));
11835
+ const running = status.runtime && status.daemonUp ? await runningLocalVmCount(status.runtime) : 0;
11832
11836
  return {
11833
11837
  ...localVmViewerStatus(status, auth),
11834
11838
  stop_reason: localVmStopReason(target.key, status),
@@ -11836,11 +11840,14 @@ async function localVmPayload(target, auth) {
11836
11840
  idle_timeout_ms: localVmIdleMs(),
11837
11841
  mode: localVmMode(cfg),
11838
11842
  max_instances: localVmMaxInstances(cfg),
11843
+ automatic_capacity: localVmAutomaticCapacity(cfg),
11844
+ capacity: limixVmCapacity(localVmResources(cfg)),
11845
+ running_instances: running,
11846
+ capacity_limited: status.container === "stopped" && running >= localVmMaxInstances(cfg),
11839
11847
  };
11840
11848
  }
11841
11849
  async function readyLocalVmForTurn(botId, target, isCurrent = () => true) {
11842
11850
  localVmLifecycleBusy.add(target.key);
11843
- // Fence before the first await, so two concurrent turns cannot both pass the per-bot limit between count and create.
11844
11851
  const pooled = target.key.startsWith("pool:");
11845
11852
  const ownsProvision = !pooled && !localVmProvisionBusy;
11846
11853
  if (ownsProvision)
@@ -11857,14 +11864,9 @@ async function readyLocalVmForTurn(botId, target, isCurrent = () => true) {
11857
11864
  return status;
11858
11865
  if (action === "run" && !pooled && !ownsProvision)
11859
11866
  return status;
11860
- if (action === "run" && target.key.startsWith("bot:")) {
11861
- const count = await existingPerBotLocalVmCount(status.runtime);
11862
- if (!isCurrent() || count >= localVmMaxInstances(cfg))
11863
- return status;
11864
- }
11865
11867
  broadcast({ kind: "computer", botId, state: "provisioning" });
11866
11868
  try {
11867
- status = await containerComputerAction(action, undefined, undefined, target, localVmResources(cfg));
11869
+ status = await containerComputerAction(action, undefined, undefined, target, localVmResources(cfg), () => localVmMaxInstances(cfg));
11868
11870
  }
11869
11871
  catch {
11870
11872
  // `run` can throw after the container exists, so arm the idle backstop anyway.
@@ -11956,6 +11958,7 @@ function configStatus() {
11956
11958
  localVm: {
11957
11959
  mode: localVmMode(cfg),
11958
11960
  maxInstances: localVmMaxInstances(cfg),
11961
+ automaticCapacity: localVmAutomaticCapacity(cfg),
11959
11962
  idleTimeoutMinutes: localVmIdleTimeoutMinutes(cfg),
11960
11963
  preserveInstalledApps: localVmPreservesInstalledApps(cfg),
11961
11964
  },
@@ -1,11 +1,11 @@
1
- // Limix bot templates: the "Bot dựng sẵn" list in Templates comes from github.com/leomieo/limix-bot-teams.
1
+ // Limix bot templates: the "Bot dựng sẵn" list in Templates comes from github.com/leomieo/limix-bot-templates.
2
2
  // GET /api/limix/bots reads only the light list in catalog.json (cached ten minutes); GET /api/limix/bots/<id> fetches
3
3
  // that one bot's file when the person presses "Dùng mẫu". Everything is checked here before it reaches the page, and a
4
4
  // template only describes who the bot is: its routines always arrive paused and nothing is connected for the person.
5
5
  import { MASCOT_BODY_IDS } from "../shared/mascot-bodies.js";
6
6
  import { MAUS_COLOR_NAMES } from "../shared/wire.js";
7
7
  import { lxs } from "./limix-lang.js";
8
- const TEAM_LIBRARY_RAW_ROOT = "https://raw.githubusercontent.com/leomieo/limix-bot-teams/main";
8
+ const BOT_LIBRARY_RAW_ROOT = "https://raw.githubusercontent.com/leomieo/limix-bot-templates/main";
9
9
  const LIST_TTL_MS = 10 * 60 * 1000;
10
10
  const MAX_CATALOG_BYTES = 256_000;
11
11
  const MAX_BOT_BYTES = 64_000;
@@ -147,17 +147,20 @@ async function fetchJson(url, maxBytes) {
147
147
  }
148
148
  }
149
149
  let cached = null;
150
+ let listingRequest = 0;
150
151
  /** `fresh`: the "Cập nhật" button. Skips this cache and GitHub's (raw files are cached there for about five minutes). */
151
152
  async function listing(fresh = false) {
152
153
  if (!fresh && cached && Date.now() - cached.at < LIST_TTL_MS)
153
154
  return cached.bots;
155
+ const request = ++listingRequest;
154
156
  try {
155
- const bots = parseBotListing(await fetchJson(`${TEAM_LIBRARY_RAW_ROOT}/catalog.json${fresh ? `?t=${Date.now()}` : ""}`, MAX_CATALOG_BYTES));
156
- cached = { at: Date.now(), bots };
157
+ const bots = parseBotListing(await fetchJson(`${BOT_LIBRARY_RAW_ROOT}/catalog.json${fresh ? `?t=${Date.now()}` : ""}`, MAX_CATALOG_BYTES));
158
+ if (request === listingRequest)
159
+ cached = { at: Date.now(), bots };
157
160
  return bots;
158
161
  }
159
162
  catch (error) {
160
- if (cached)
163
+ if (cached && !fresh)
161
164
  return cached.bots; // an older list beats none while GitHub is unreachable
162
165
  throw error;
163
166
  }
@@ -177,7 +180,7 @@ export async function handleLimixBotLibrary(method, path) {
177
180
  const id = match[1];
178
181
  if (!(await listing()).some((bot) => bot.id === id))
179
182
  return { status: 404, body: { error: lxs("Không có bot mẫu này", "No such template bot") } };
180
- return { status: 200, body: { bot: parseLibraryBot(await fetchJson(`${TEAM_LIBRARY_RAW_ROOT}/bots/${id}.json?t=${Date.now()}`, MAX_BOT_BYTES), id) } };
183
+ return { status: 200, body: { bot: parseLibraryBot(await fetchJson(`${BOT_LIBRARY_RAW_ROOT}/bots/${id}.json?t=${Date.now()}`, MAX_BOT_BYTES), id) } };
181
184
  }
182
185
  catch (error) {
183
186
  return { status: 502, body: { error: error instanceof Error ? error.message : String(error) } };
@@ -0,0 +1,324 @@
1
+ import { readdirSync, readFileSync, statSync, realpathSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { dirname, join, resolve, relative, isAbsolute, delimiter } from "node:path";
4
+ import { execFile } from "node:child_process";
5
+ import { promisify } from "node:util";
6
+ import { parseDocument } from "yaml";
7
+ import { DATA_DIR } from "./config.js";
8
+ import { loadBundledSkills, loadUserSkills, listLibrarySkills, librarySkillDirectory, skillsLibraryRoot } from "./skill-library.js";
9
+ import { readImportedSkills, IMPORTED_SKILLS_DIR } from "./imported-skills.js";
10
+ import { listMigratableSkills } from "./skills.js";
11
+ import { workspaceDir } from "./workspace.js";
12
+ const run = promisify(execFile);
13
+ const PACKAGE = /^(?:@[a-z0-9_.-]+\/)?[a-z0-9][a-z0-9_.-]*$/i;
14
+ const BIN = /^[a-z0-9][a-z0-9_.-]{0,79}$/i;
15
+ const object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
16
+ export function extractSkillRequirements(text) {
17
+ const out = [];
18
+ const add = (kind, value, evidence) => {
19
+ if (typeof value !== "string" || !value.trim())
20
+ return;
21
+ const raw = kind === "review" ? value.trim() : value.trim().replace(/[.,;:]+$/, "");
22
+ const match = raw.match(/^((?:@[\w.-]+\/)?[\w.-]+)(?:@|\s*(?=[<>=~^]))(.*)$/);
23
+ const name = match?.[1] ?? raw;
24
+ if (kind !== "review" && !(kind === "env" ? /^[A-Z_][A-Z0-9_]*$/.test(name) : kind === "bin" ? BIN.test(name) : PACKAGE.test(name))) {
25
+ out.push({ kind: "review", name: raw, evidence });
26
+ return;
27
+ }
28
+ out.push({ kind, name, ...(match?.[2] ? { required: match[2] } : {}), evidence });
29
+ };
30
+ const read = (value, kind, evidence) => {
31
+ if (Array.isArray(value))
32
+ for (const item of value)
33
+ add(typeof item === "string" ? kind : "review", typeof item === "string" ? item : JSON.stringify(item), evidence);
34
+ else if (typeof value === "string")
35
+ add(kind, value, evidence);
36
+ else
37
+ for (const [name, version] of Object.entries(object(value)))
38
+ add(kind, typeof version === "string" && version !== "*" ? `${name}@${version}` : name, evidence);
39
+ };
40
+ const front = text.replace(/^\uFEFF/, "").match(/^---\r?\n([\s\S]*?)\r?\n---/);
41
+ const body = front ? text.replace(/^\uFEFF/, "").slice(front[0].length) : text;
42
+ if (front) {
43
+ try {
44
+ const doc = parseDocument(front[1]);
45
+ if (doc.errors.length)
46
+ throw new Error("invalid YAML");
47
+ const fields = object(doc.toJS({ maxAliasCount: 20 }));
48
+ const metadata = object(fields.metadata);
49
+ for (const block of [fields.requires, fields.requirements, fields.dependencies, metadata.requires, metadata.requirements, metadata.dependencies, object(metadata.openclaw).requires, object(metadata.clawdbot).requires]) {
50
+ const req = object(block);
51
+ if (typeof block === "string" || Array.isArray(block))
52
+ read(block, "review", "SKILL.md metadata");
53
+ for (const [key, kind] of Object.entries({ bins: "bin", tools: "bin", npm: "npm", packages: "npm", python: "python", pip: "python", env: "env", mcp: "mcp" }))
54
+ read(req[key], kind, `metadata.${key}`);
55
+ for (const key of Object.keys(req))
56
+ if (!["bins", "tools", "npm", "packages", "python", "pip", "env", "mcp"].includes(key))
57
+ add("review", `${key}: ${JSON.stringify(req[key])}`, "SKILL.md metadata");
58
+ }
59
+ if (fields.compatibility)
60
+ add("review", fields.compatibility, "compatibility");
61
+ }
62
+ catch {
63
+ add("review", "SKILL.md metadata", "Could not parse the requirements metadata");
64
+ }
65
+ }
66
+ const requirementLines = [front?.[1] ?? "", ...body.split(/\r?\n/).filter((line) => /requires?|prerequisit|dependenc|compatibility|yêu cầu|cần cài/i.test(line))].join("\n");
67
+ for (const [pattern, name] of [[/\bffmpeg\b/i, "ffmpeg"], [/\bnode(?:\.js)?\b/i, "node"], [/\bdocker\b/i, "docker"], [/\bjava\b/i, "java"]]) {
68
+ if (pattern.test(requirementLines) && !out.some((r) => r.kind === "bin" && r.name === name))
69
+ add("bin", name, "Mentioned in requirements / compatibility; check version in source");
70
+ }
71
+ const commands = [...body.matchAll(/```[^\n]*\n([\s\S]*?)```/g), ...body.matchAll(/`([^`\n]+)`/g)].map((m) => m[1]).join("\n") + "\n" + body.split(/\r?\n/).filter((line) => /^\s*(?:\$\s*)?(?:npm|pnpm|yarn|bun|pip3?|uv|npx|bunx)\s/.test(line)).join("\n");
72
+ for (const match of commands.matchAll(/\b(npm\s+(?:install|i)|pnpm\s+add|yarn\s+add|bun\s+add|pip3?\s+install|uv\s+(?:pip\s+install|add|tool\s+install))\s+([^\n`]+)/gi)) {
73
+ const kind = /pip|^uv/i.test(match[1]) ? "python" : "npm";
74
+ for (const raw of match[2].match(/"[^"]*"|'[^']*'|\S+/g) ?? []) {
75
+ const token = raw.replace(/^["']|["']$/g, "");
76
+ if (/^[;&|#\\]/.test(token))
77
+ break;
78
+ if (token.startsWith("-")) {
79
+ if (["--save", "--save-dev", "--save-exact", "--no-audit", "--no-fund", "-D", "-g", "--global", "--user", "--upgrade", "-U"].includes(token))
80
+ continue;
81
+ add("review", match[0], "Install command needs review");
82
+ break;
83
+ }
84
+ if (!/^(?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*(?:(?:@|>=|<=|==|~=|>|<|=)[\w.^~*+<>=|,-]+)?$/i.test(token)) {
85
+ add("review", match[0], "Install command needs review");
86
+ break;
87
+ }
88
+ add(kind, token, match[0]);
89
+ }
90
+ }
91
+ for (const match of commands.matchAll(/\b(?:npx|bunx|pnpm\s+(?:exec|dlx))\s+(?:--?[\w-]+(?:=[^\s]+)?\s+)*((?:@[\w.-]+\/)?[\w.-]+(?:@[\w.^~+-]+)?)/g)) {
92
+ add("npm", match[1] === "remotion" ? "@remotion/cli" : match[1], match[0]);
93
+ }
94
+ if (/\bremotion\b/i.test(text)) {
95
+ for (const name of ["remotion", "@remotion/cli"])
96
+ if (!out.some((r) => r.kind === "npm" && r.name === name))
97
+ out.push({ kind: "npm", name, evidence: "Remotion code-rendering workflow", optional: true });
98
+ }
99
+ let section = false;
100
+ for (const line of body.split(/\r?\n/)) {
101
+ if (/^#{1,6}\s/.test(line))
102
+ section = /prerequisit|requirement|dependenc|installation|setup|yêu cầu|cài đặt|phụ thuộc/i.test(line);
103
+ else if (section && line.trim() && !line.trim().startsWith("```"))
104
+ add("review", line.trim(), "Requirements / setup instructions");
105
+ else if (/\b(?:requires?|prerequisites?|dependencies|needs? to be installed)\b|yêu cầu|cần (?:cài|có)/i.test(line))
106
+ add("review", line.trim(), "Requirements mentioned in skill instructions");
107
+ }
108
+ const unique = new Map(out.map((req) => [`${req.kind}:${req.name}:${req.required ?? ""}`, req]));
109
+ return [...unique.values()];
110
+ }
111
+ export function findSkillBinary(name, dirs, platform = process.platform) {
112
+ if (!BIN.test(name))
113
+ return null;
114
+ for (const dir of dirs)
115
+ for (const ext of platform === "win32" ? ["", ".exe", ".cmd", ".bat", ".com"] : [""]) {
116
+ const file = join(dir, name + ext);
117
+ try {
118
+ if (statSync(file).isFile())
119
+ return file;
120
+ }
121
+ catch { }
122
+ }
123
+ return null;
124
+ }
125
+ export function findSkillNpmPackage(name, roots) {
126
+ if (!PACKAGE.test(name))
127
+ return null;
128
+ for (const root of roots) {
129
+ let dir = resolve(root);
130
+ for (;;) {
131
+ const file = join(dir, "node_modules", name, "package.json");
132
+ try {
133
+ const pkg = JSON.parse(readFileSync(file, "utf8"));
134
+ if (pkg.name === name)
135
+ return { version: typeof pkg.version === "string" ? pkg.version : undefined, where: file };
136
+ }
137
+ catch { }
138
+ const parent = dirname(dir);
139
+ if (parent === dir)
140
+ break;
141
+ dir = parent;
142
+ }
143
+ }
144
+ return null;
145
+ }
146
+ export function findSkillPythonPackage(name, roots) {
147
+ const normalized = (value) => value.toLowerCase().replace(/[-_.]+/g, "-");
148
+ for (const root of roots)
149
+ for (const env of [root, join(root, ".venv"), join(root, "venv")]) {
150
+ const sites = [join(env, "Lib", "site-packages")];
151
+ try {
152
+ for (const dir of readdirSync(join(env, "lib")))
153
+ if (/^python\d/.test(dir))
154
+ sites.push(join(env, "lib", dir, "site-packages"));
155
+ }
156
+ catch { }
157
+ for (const site of sites) {
158
+ try {
159
+ for (const dir of readdirSync(site).filter((s) => s.endsWith(".dist-info"))) {
160
+ const file = join(site, dir, "METADATA");
161
+ const text = readFileSync(file, "utf8");
162
+ if (normalized(text.match(/^Name: (.+)$/m)?.[1]?.trim() ?? "") !== normalized(name))
163
+ continue;
164
+ const version = text.match(/^Version: (.+)$/m)?.[1]?.trim();
165
+ if (version)
166
+ return { version, where: file };
167
+ }
168
+ }
169
+ catch { }
170
+ }
171
+ }
172
+ return null;
173
+ }
174
+ export async function scanSkillRequirements(bots, mcpServers = {}, projects = []) {
175
+ const sources = new Map();
176
+ const warnings = [];
177
+ const add = (name, directory, projects = []) => {
178
+ try {
179
+ const real = realpathSync(directory);
180
+ const prior = sources.get(real);
181
+ if (prior)
182
+ prior.projects = [...new Set([...prior.projects, ...projects])];
183
+ else
184
+ sources.set(real, { name, directory: real, projects });
185
+ }
186
+ catch {
187
+ warnings.push(`Could not read ${name}`);
188
+ }
189
+ };
190
+ for (const skill of [...loadBundledSkills(), ...loadUserSkills(join(DATA_DIR, "skills"))])
191
+ add(skill.manifest.name, skill.directory);
192
+ for (const skill of listLibrarySkills())
193
+ add(skill.name, librarySkillDirectory(skillsLibraryRoot(), skill.name));
194
+ for (const name of Object.keys(readImportedSkills()))
195
+ add(name, join(IMPORTED_SKILLS_DIR, name));
196
+ for (const bot of bots)
197
+ for (const skill of listMigratableSkills(bot.id)) {
198
+ if (skill.directory)
199
+ add(`${skill.name} (${bot.name})`, skill.directory, [bot.cwd ?? workspaceDir(bot.id)]);
200
+ }
201
+ const home = homedir();
202
+ const dirs = `${process.env.OMB_EXTRA_PATH ?? ""}${delimiter}${process.env.PATH ?? ""}`.split(delimiter).filter(Boolean);
203
+ if (process.platform === "win32") {
204
+ try {
205
+ const { stdout } = await run("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", "[Environment]::GetEnvironmentVariable('Path','Machine')+';'+[Environment]::GetEnvironmentVariable('Path','User')"], { windowsHide: true, timeout: 8000 });
206
+ dirs.push(...stdout.trim().split(";").map((p) => p.replace(/%([^%]+)%/g, (_m, key) => process.env[key] ?? "")));
207
+ }
208
+ catch {
209
+ warnings.push("Could not refresh Windows PATH");
210
+ }
211
+ }
212
+ const requirements = [];
213
+ for (const source of sources.values()) {
214
+ const documents = [];
215
+ const readDocuments = (dir, depth = 0) => {
216
+ if (depth > 4) {
217
+ warnings.push(`Document depth limit: ${source.name}`);
218
+ return;
219
+ }
220
+ try {
221
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
222
+ if (["node_modules", ".git", ".venv", "venv"].includes(entry.name) || entry.isSymbolicLink())
223
+ continue;
224
+ const file = join(dir, entry.name);
225
+ if (entry.isDirectory()) {
226
+ readDocuments(file, depth + 1);
227
+ continue;
228
+ }
229
+ if (!entry.isFile() || !(/\.md$/i.test(entry.name) || ["manifest.json", "requirements.json", "requirements.yaml", "requirements.yml", "package.json", "requirements.txt", "pyproject.toml"].includes(entry.name)))
230
+ continue;
231
+ const rel = relative(source.directory, realpathSync(file));
232
+ if (isAbsolute(rel) || rel.startsWith(".."))
233
+ continue;
234
+ if (statSync(file).size > 256 * 1024) {
235
+ warnings.push(`Document too large: ${source.name}/${entry.name}`);
236
+ continue;
237
+ }
238
+ documents.push({ file: entry.name, text: readFileSync(file, "utf8") });
239
+ }
240
+ }
241
+ catch {
242
+ warnings.push(`Could not read documents: ${source.name}`);
243
+ }
244
+ };
245
+ readDocuments(source.directory);
246
+ const found = [];
247
+ for (const doc of documents) {
248
+ found.push(...extractSkillRequirements(doc.text));
249
+ if (["manifest.json", "requirements.json", "requirements.yaml", "requirements.yml"].includes(doc.file))
250
+ found.push(...extractSkillRequirements(`---\n${doc.text}\n---`));
251
+ if (doc.file === "package.json") {
252
+ try {
253
+ const pkg = JSON.parse(doc.text);
254
+ for (const [name, version] of Object.entries({ ...pkg.dependencies, ...pkg.devDependencies, ...pkg.peerDependencies }))
255
+ found.push({ kind: "npm", name, required: String(version), evidence: "package.json" });
256
+ }
257
+ catch {
258
+ warnings.push(`Invalid package.json: ${source.name}`);
259
+ }
260
+ }
261
+ if (doc.file === "requirements.txt")
262
+ for (const line of doc.text.split(/\r?\n/).filter((s) => s.trim() && !s.startsWith("#"))) {
263
+ const match = line.trim().match(/^([\w.-]+)(.*)$/);
264
+ found.push(match ? { kind: "python", name: match[1], required: match[2] || undefined, evidence: "requirements.txt" } : { kind: "review", name: line, evidence: "requirements.txt" });
265
+ }
266
+ if (doc.file === "pyproject.toml") {
267
+ const declarations = doc.text.match(/(?:dependencies|requires)\s*=\s*\[[\s\S]*?\]/g) ?? ["Python project dependencies need review"];
268
+ for (const declaration of declarations)
269
+ found.push({ kind: "review", name: "pyproject.toml", evidence: declaration });
270
+ }
271
+ }
272
+ if (!found.length)
273
+ found.push({ kind: "review", name: "SKILL.md", evidence: "No machine-checkable requirements declared; review skill instructions" });
274
+ if (!documents.some((doc) => doc.file === "SKILL.md"))
275
+ warnings.push(`SKILL.md unreadable: ${source.name}`);
276
+ const unique = new Map(found.map((req) => [`${req.kind}:${req.name}:${req.required ?? ""}`, req]));
277
+ for (const req of unique.values()) {
278
+ const result = { ...req, skill: source.name, directory: source.directory, status: "review" };
279
+ if (req.kind === "bin") {
280
+ const where = findSkillBinary(req.name, dirs);
281
+ result.status = where ? req.required ? "review" : "found" : "missing";
282
+ if (where)
283
+ result.where = where;
284
+ }
285
+ else if (req.kind === "npm") {
286
+ const pkg = findSkillNpmPackage(req.name, [source.directory, ...source.projects, ...projects, ...bots.filter((b) => !b.computer || b.computer === "local").map((b) => b.cwd ?? workspaceDir(b.id)), join(process.env.APPDATA ?? home, "npm")]);
287
+ result.status = pkg ? req.required && req.required !== "*" ? "review" : "found" : "missing";
288
+ if (pkg)
289
+ Object.assign(result, pkg);
290
+ }
291
+ else if (req.kind === "env")
292
+ result.status = process.env[req.name] ? "found" : "missing";
293
+ else if (req.kind === "python") {
294
+ const pkg = findSkillPythonPackage(req.name, [source.directory, ...source.projects, ...projects, ...bots.filter((b) => !b.computer || b.computer === "local").map((b) => b.cwd ?? workspaceDir(b.id))]);
295
+ if (pkg) {
296
+ Object.assign(result, pkg);
297
+ result.status = req.required ? "review" : "found";
298
+ }
299
+ }
300
+ else if (req.kind === "mcp")
301
+ result.where = Object.hasOwn(mcpServers, req.name) ? "Configured; connection needs checking" : "No matching MCP configuration";
302
+ requirements.push(result);
303
+ }
304
+ }
305
+ const python = process.env.LIMIX_PYTHON ?? findSkillBinary("python", dirs) ?? findSkillBinary("python3", dirs);
306
+ const pythonRows = requirements.filter((r) => r.kind === "python" && !r.version && PACKAGE.test(r.name));
307
+ if (python && pythonRows.length) {
308
+ try {
309
+ const names = [...new Set(pythonRows.map((r) => r.name))];
310
+ const code = "import importlib.metadata as m,json,sys\nout={}\nfor n in sys.argv[1:]:\n try: out[n]=m.version(n)\n except m.PackageNotFoundError: pass\nprint(json.dumps(out))";
311
+ const { stdout } = await run(python, ["-c", code, ...names], { timeout: 10000, windowsHide: true, maxBuffer: 1024 * 1024 });
312
+ const versions = JSON.parse(stdout);
313
+ for (const row of pythonRows) {
314
+ row.version = versions[row.name];
315
+ row.where = python;
316
+ row.status = row.version ? row.required ? "review" : "found" : "missing";
317
+ }
318
+ }
319
+ catch {
320
+ warnings.push("Could not inspect Python package metadata");
321
+ }
322
+ }
323
+ return { scope: "host", scannedAt: new Date().toISOString(), skillCount: sources.size, requirements, warnings };
324
+ }