@sjawhar/pi-legion 8.16.0 → 8.16.1

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/dist/legion.js +56 -12
  2. package/package.json +1 -1
package/dist/legion.js CHANGED
@@ -15307,25 +15307,21 @@ var checkWebSearch = async (host2, input, signal) => {
15307
15307
  return failed(`web_search failed: ${firstLine(text)}`);
15308
15308
  return ok(`web_search registered; provider ${String(provider)} answered in ${elapsed} ms`);
15309
15309
  };
15310
- var URL_USERINFO = /([a-z][a-z0-9+.-]*:\/\/)[^/\s@]+@/gi;
15311
15310
  function mcpErrorFor(errors3, name) {
15312
- let quoted;
15313
15311
  for (const entry of errors3) {
15314
15312
  if (typeof entry !== "object" || entry === null) {
15315
15313
  if (!String(entry).includes(name))
15316
15314
  continue;
15317
- quoted = String(entry);
15318
- break;
15315
+ return String(entry);
15319
15316
  }
15320
15317
  const record2 = entry;
15321
15318
  const names = [record2.server, record2.name, record2.path];
15322
15319
  if (!names.some((value) => value === name || value === `mcp:${name}`))
15323
15320
  continue;
15324
15321
  const message = record2.error ?? record2.message;
15325
- quoted = message === undefined ? String(entry) : String(message);
15326
- break;
15322
+ return message === undefined ? String(entry) : String(message);
15327
15323
  }
15328
- return quoted?.replace(URL_USERINFO, "$1***@");
15324
+ return;
15329
15325
  }
15330
15326
  var checkMCP = async (host2, input, signal) => {
15331
15327
  const { configs, sources } = await host2.loadMCPConfigs(input.cwd);
@@ -15465,6 +15461,54 @@ var CHECKS = {
15465
15461
  "dispatch-envoy-tools": checkDispatchEnvoyTools,
15466
15462
  github: checkGitHub
15467
15463
  };
15464
+ var MAX_DETAIL_BYTES = 1024;
15465
+ var HELD = "\uFFFF";
15466
+ function isSpace(code) {
15467
+ return code >= 9 && code <= 13 || code === 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288;
15468
+ }
15469
+ function truncateUtf8(text, max) {
15470
+ let bytes = 0;
15471
+ let end = 0;
15472
+ for (const char of text) {
15473
+ const code = char.codePointAt(0) ?? 0;
15474
+ bytes += code < 128 ? 1 : code < 2048 ? 2 : code < 65536 ? 3 : 4;
15475
+ if (bytes > max)
15476
+ break;
15477
+ end += char.length;
15478
+ }
15479
+ return text.slice(0, end);
15480
+ }
15481
+ var CREDENTIAL_RULES = [
15482
+ [/(?<![a-z0-9+.-])([0-9+.-]*[a-z][a-z0-9+.-]*:\/\/)[^ /?#]+@/gi, "$1***@"],
15483
+ [
15484
+ /([?&](?:token|key|secret|password|access_token|refresh_token|id_token|api_key|apikey|client_secret|sig|x-amz-security-token|x-amz-signature)=)[^ &#"'<>]+/gi,
15485
+ "$1***"
15486
+ ],
15487
+ [
15488
+ /(authorization["']?[ \uffff]*[:=][ \uffff]*)(?:(["'])((?:bearer|basic|token|digest)[ \uffff]+)?[^"']+|(\[?)((?:bearer|basic|token|digest)[ \uffff]+)?[^)\]}>]+)/gi,
15489
+ "$1$2$3$4$5***"
15490
+ ],
15491
+ [/(x-api-key["']?[ \uffff]*[:=][ \uffff]*["']?)[A-Za-z0-9._~+/=*\uffff-]+/gi, "$1***"],
15492
+ [/\b(bearer[ \uffff]+)[A-Za-z0-9._~+/=*\uffff-]+/gi, "$1***"],
15493
+ [/\b(gh[pousr]_|github_pat_)[A-Za-z0-9._\uffff-]{20,}/g, "$1***"],
15494
+ [
15495
+ /(?<![A-Za-z0-9_\uffff-])eyJ[A-Za-z0-9_\uffff-]{8,}\.[A-Za-z0-9_\uffff-]{8,}\.[A-Za-z0-9_\uffff-]*/g,
15496
+ "***"
15497
+ ],
15498
+ [/\b(sk-|dsp_)[A-Za-z0-9_\uffff-]{20,}/g, "$1***"],
15499
+ [/\b(AKIA|ASIA)[A-Z0-9]{16}\b/g, "$1***"]
15500
+ ];
15501
+ function cleanDetail(text) {
15502
+ let marked = "";
15503
+ for (const char of text) {
15504
+ const code = char.codePointAt(0) ?? 0;
15505
+ const control = code < 32 || code >= 127 && code < 160;
15506
+ marked += isSpace(code) ? " " : control ? HELD : char;
15507
+ }
15508
+ const redacted = CREDENTIAL_RULES.reduce((line2, [pattern, replacement]) => line2.replace(pattern, replacement), marked);
15509
+ const line = redacted.replaceAll(HELD, " ").split(" ").filter((field) => field !== "").join(" ");
15510
+ return truncateUtf8(line, MAX_DETAIL_BYTES);
15511
+ }
15468
15512
  function budgetLabel(ms) {
15469
15513
  return ms % 1000 === 0 ? `${ms / 1000} s` : `${ms} ms`;
15470
15514
  }
@@ -15498,10 +15542,10 @@ async function measureCapabilities(host2, input, budgets = DEFAULT_BUDGETS) {
15498
15542
  });
15499
15543
  for (const controller of controllers)
15500
15544
  controller.abort();
15501
- const rows = LIVE_CAPABILITIES.map((name) => ({
15502
- name,
15503
- ...outcomes.get(name) ?? failed(`did not finish within ${budgetLabel(budgets.reportMs)}`)
15504
- }));
15545
+ const rows = LIVE_CAPABILITIES.map((name) => {
15546
+ const { ok: ok2, detail } = outcomes.get(name) ?? failed(`did not finish within ${budgetLabel(budgets.reportMs)}`);
15547
+ return { name, ok: ok2, detail: cleanDetail(detail) };
15548
+ });
15505
15549
  return { measuredAt, elapsedMs: Date.now() - started, rows };
15506
15550
  }
15507
15551
  async function runCommand(command, args, options) {
@@ -15583,7 +15627,7 @@ function onEnvoyRoleRegained(listener) {
15583
15627
  // package.json
15584
15628
  var package_default = {
15585
15629
  name: "@sjawhar/pi-legion",
15586
- version: "8.16.0",
15630
+ version: "8.16.1",
15587
15631
  license: "Apache-2.0",
15588
15632
  type: "module",
15589
15633
  omp: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "8.16.0",
3
+ "version": "8.16.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {