@pab-iprg/huohuo 1.0.0-preview.1 → 1.0.0-preview.2

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/cli.js CHANGED
@@ -457,10 +457,6 @@ function evaluateResources(sample, policy, costs, phase) {
457
457
  blocked = true;
458
458
  reasons.push("\u7CFB\u7EDF\u5185\u5B58\u538B\u529B\u4E25\u91CD");
459
459
  }
460
- if (sample.pressure === "high" || sample.pressure === "unknown") {
461
- limited = true;
462
- reasons.push(sample.pressure === "high" ? "\u7CFB\u7EDF\u5185\u5B58\u538B\u529B\u504F\u9AD8" : "\u538B\u529B\u4FE1\u53F7\u7F3A\u5931\uFF0C\u4FDD\u5B88\u8FD0\u884C");
463
- }
464
460
  const disks = diskBudgets(sample, costs, policy.diskReserveBytes);
465
461
  for (const disk of disks) {
466
462
  if (disk.availableBytes === null) {
@@ -468,9 +464,16 @@ function evaluateResources(sample, policy, costs, phase) {
468
464
  reasons.push(`\u6587\u4EF6\u7CFB\u7EDF\u53EF\u7528\u7A7A\u95F4\u672A\u77E5\uFF1A${disk.device}`);
469
465
  } else if (disk.availableBytes < disk.requiredBytes) {
470
466
  blocked = true;
471
- reasons.push(`\u6587\u4EF6\u7CFB\u7EDF\u7A7A\u95F4\u4E0D\u8DB3\uFF1A\u53EF\u7528 ${disk.availableBytes} \u5B57\u8282\uFF0C\u9700\u8981 ${disk.requiredBytes} \u5B57\u8282`);
467
+ const available = (disk.availableBytes / 1e9).toFixed(2);
468
+ const required = (disk.requiredBytes / 1e9).toFixed(2);
469
+ const missing = (Math.ceil((disk.requiredBytes - disk.availableBytes) / 1e7) / 100).toFixed(2);
470
+ reasons.push(`\u78C1\u76D8\u7A7A\u95F4\u4E0D\u8DB3\uFF1A\u5269\u4F59 ${available} GB\uFF0C\u9700\u8981 ${required} GB\u3002\u8BF7\u81F3\u5C11\u518D\u817E\u51FA ${missing} GB\u3002`);
472
471
  }
473
472
  }
473
+ if (sample.pressure === "high" || sample.pressure === "unknown") {
474
+ limited = true;
475
+ reasons.push(sample.pressure === "high" ? "\u5F53\u524D\u5185\u5B58\u6BD4\u8F83\u7D27\u5F20\uFF0C\u53EF\u4EE5\u5148\u5173\u95ED\u6682\u65F6\u4E0D\u7528\u7684\u5E94\u7528\u3002" : "\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u5185\u5B58\u538B\u529B\u3002");
476
+ }
474
477
  const status = blocked ? "blocked" : unknown ? "unknown" : limited ? "limited" : "pass";
475
478
  return { status, reasons, disks, sample, policy, concurrency: status === "pass" ? Math.min(1, availableParallelism()) : 0 };
476
479
  }
@@ -656,7 +659,12 @@ async function install(home, candidate, hooks = {}, programsOnly = false) {
656
659
  }
657
660
  const result = evaluateResources(observation, release.budget, costs, "install");
658
661
  await atomicJSON(join3(home, "state/resources.json"), result);
659
- if (result.status === "unknown" || result.status === "blocked") throw Object.assign(new Error(result.reasons.join("\uFF1B")), { code: "RESOURCE_BLOCKED" });
662
+ if (result.status === "unknown" || result.status === "blocked") {
663
+ const details = result.reasons.map((reason) => `- ${reason}`).join("\n");
664
+ throw Object.assign(new Error(`\u706B\u706B\u6682\u65F6\u65E0\u6CD5\u7EE7\u7EED\u5B89\u88C5\u3002
665
+ ${details}
666
+ \u5904\u7406\u540E\uFF0C\u91CD\u65B0\u8FD0\u884C\u521A\u624D\u7684\u5B89\u88C5\u547D\u4EE4\u3002`), { code: "RESOURCE_BLOCKED" });
667
+ }
660
668
  };
661
669
  const stage = async (name, action) => {
662
670
  hooks.progress?.(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pab-iprg/huohuo",
3
- "version": "1.0.0-preview.1",
3
+ "version": "1.0.0-preview.2",
4
4
  "type": "module",
5
5
  "description": "火火投研伙伴安装入口",
6
6
  "bin": {
package/release.json CHANGED
@@ -13,11 +13,11 @@
13
13
  "runtime": {
14
14
  "name": "@huohuo/research-agent",
15
15
  "version": "1.0.0",
16
- "url": "https://bundled.invalid/3357844499b0a3ee1e273eccc4ce7c4afde2d354a9ff4f473720e7875cdbabf7.tgz",
17
- "sha256": "3357844499b0a3ee1e273eccc4ce7c4afde2d354a9ff4f473720e7875cdbabf7",
18
- "integrity": "sha512-Yzy/15UCnJiyFjL5gnGFS5ro0Orkd155EFGs2YTLtY37mo/nxnfkRrLPMsdh4aABEfCS0Dpu6ve+MKqkiyh5qQ==",
19
- "downloadBytes": 2542280,
20
- "expandedBytes": 8237016,
16
+ "url": "https://bundled.invalid/3126256d1e3ad445b74f67e0a97a339774bc23cdcc5249578f1c9e1b7f3d8f6d.tgz",
17
+ "sha256": "3126256d1e3ad445b74f67e0a97a339774bc23cdcc5249578f1c9e1b7f3d8f6d",
18
+ "integrity": "sha512-KmCItvQmE0LZbNiKdrWeYsUCD4p4YaBfiS+OOwsepOix03nON46tgpFgOeT/effrEWzPROmuwI64IU8g4loTYw==",
19
+ "downloadBytes": 2542537,
20
+ "expandedBytes": 8237483,
21
21
  "bundled": true
22
22
  },
23
23
  "python": {