@remnic/core 9.3.764 → 9.3.765

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.
@@ -472,27 +472,7 @@ function parseChatConfig(raw) {
472
472
  };
473
473
  }
474
474
 
475
- // src/config.ts
476
- var DEFAULT_MEMORY_DIR = path.join(
477
- resolveHomeDir(),
478
- ".openclaw",
479
- "workspace",
480
- "memory",
481
- "local"
482
- );
483
- var DEFAULT_WORKSPACE_DIR = path.join(
484
- resolveHomeDir(),
485
- ".openclaw",
486
- "workspace"
487
- );
488
- var DEFAULT_INIT_GATE_TIMEOUT_MS = 3e4;
489
- var CLIENT_SECRET_FIELD = ["client", "Secret"].join("");
490
- var REFRESH_TOKEN_FIELD = ["refresh", "Token"].join("");
491
- var LEGACY_ACTIVE_RECALL_CUSTOM_FIELD = [
492
- "activeRecall",
493
- "Prompt",
494
- "Override"
495
- ].join("");
475
+ // src/namespaces/scope-profile-config.ts
496
476
  var SCOPE_PROFILE_LAYER_IDS = [
497
477
  "userProject",
498
478
  "teamProject",
@@ -510,24 +490,25 @@ var SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES = [
510
490
  "rule",
511
491
  "procedure"
512
492
  ];
513
- var CONFIDENCE_TIERS = [
514
- "explicit",
515
- "implied",
516
- "inferred",
517
- "speculative"
518
- ];
493
+ var CONFIDENCE_TIERS = ["explicit", "implied", "inferred", "speculative"];
494
+ function isConfidenceTier(value) {
495
+ return typeof value === "string" && CONFIDENCE_TIERS.includes(value);
496
+ }
497
+ function isAutoPromoteCategory(value) {
498
+ return typeof value === "string" && SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES.includes(value);
499
+ }
519
500
  function isRecord(value) {
520
501
  return typeof value === "object" && value !== null && !Array.isArray(value);
521
502
  }
522
503
  function parseStringList(value, keyName) {
523
504
  if (value === void 0 || value === null) return [];
524
505
  if (!Array.isArray(value)) {
525
- throw new Error(keyName + " must be an array");
506
+ throw new Error(`${keyName} must be an array`);
526
507
  }
527
508
  const out = [];
528
509
  for (const entry of value) {
529
510
  if (typeof entry !== "string" || entry.length === 0) {
530
- throw new Error(keyName + " must contain only non-empty strings");
511
+ throw new Error(`${keyName} must contain only non-empty strings`);
531
512
  }
532
513
  out.push(entry);
533
514
  }
@@ -578,34 +559,30 @@ function parseScopeProfiles(value) {
578
559
  if (!isRecord(rawProfile)) {
579
560
  throw new Error(`scopeProfiles.${profileId} must be an object`);
580
561
  }
581
- const readOrder = parseScopeProfileLayerList(
582
- rawProfile.readOrder,
583
- `scopeProfiles.${profileId}.readOrder`,
584
- ["userProject", "userGlobal", "serverShared"]
585
- );
562
+ const readOrder = parseScopeProfileLayerList(rawProfile.readOrder, `scopeProfiles.${profileId}.readOrder`, [
563
+ "userProject",
564
+ "userGlobal",
565
+ "serverShared"
566
+ ]);
586
567
  const writeDefault = rawProfile.writeDefault === void 0 || rawProfile.writeDefault === null ? "userProject" : rawProfile.writeDefault;
587
568
  if (!SCOPE_PROFILE_LAYER_IDS.includes(writeDefault)) {
588
569
  throw new Error(`scopeProfiles.${profileId}.writeDefault contains unsupported layer: ${String(writeDefault)}`);
589
570
  }
590
571
  if (rawProfile.teamProject !== void 0 && rawProfile.teamProject !== null && !isRecord(rawProfile.teamProject)) {
591
- throw new Error("scopeProfiles." + profileId + ".teamProject must be an object");
572
+ throw new Error(`scopeProfiles.${profileId}.teamProject must be an object`);
592
573
  }
593
574
  const teamProject = (() => {
594
575
  if (!isRecord(rawProfile.teamProject)) return void 0;
595
576
  const out = {};
596
577
  if (rawProfile.teamProject.namespaceTemplate !== void 0) {
597
578
  if (typeof rawProfile.teamProject.namespaceTemplate !== "string" || rawProfile.teamProject.namespaceTemplate.length === 0) {
598
- throw new Error(
599
- `scopeProfiles.${profileId}.teamProject.namespaceTemplate must be a non-empty string`
600
- );
579
+ throw new Error(`scopeProfiles.${profileId}.teamProject.namespaceTemplate must be a non-empty string`);
601
580
  }
602
581
  out.namespaceTemplate = rawProfile.teamProject.namespaceTemplate;
603
582
  }
604
583
  if (rawProfile.teamProject.teamId !== void 0) {
605
584
  if (typeof rawProfile.teamProject.teamId !== "string" || rawProfile.teamProject.teamId.length === 0) {
606
- throw new Error(
607
- `scopeProfiles.${profileId}.teamProject.teamId must be a non-empty string`
608
- );
585
+ throw new Error(`scopeProfiles.${profileId}.teamProject.teamId must be a non-empty string`);
609
586
  }
610
587
  out.teamId = rawProfile.teamProject.teamId;
611
588
  }
@@ -615,20 +592,15 @@ function parseScopeProfiles(value) {
615
592
  throw new Error(`scopeProfiles.${profileId}.autoPromote must be an object`);
616
593
  }
617
594
  const rawAutoPromote = isRecord(rawProfile.autoPromote) ? rawProfile.autoPromote : {};
618
- const hasAutoPromoteEnabled = Object.prototype.hasOwnProperty.call(
619
- rawAutoPromote,
620
- "enabled"
621
- );
595
+ const hasAutoPromoteEnabled = Object.prototype.hasOwnProperty.call(rawAutoPromote, "enabled");
622
596
  const autoPromoteEnabled = coerceBool(rawAutoPromote.enabled);
623
597
  if (hasAutoPromoteEnabled && autoPromoteEnabled === void 0) {
624
- throw new Error(
625
- `scopeProfiles.${profileId}.autoPromote.enabled must be a boolean or boolean-like string`
626
- );
598
+ throw new Error(`scopeProfiles.${profileId}.autoPromote.enabled must be a boolean or boolean-like string`);
627
599
  }
628
600
  const minConfidenceTier = (() => {
629
601
  const rawTier = rawAutoPromote.minConfidenceTier;
630
602
  if (rawTier === void 0 || rawTier === null) return "explicit";
631
- if (typeof rawTier !== "string" || !CONFIDENCE_TIERS.includes(rawTier)) {
603
+ if (!isConfidenceTier(rawTier)) {
632
604
  throw new Error(
633
605
  `scopeProfiles.${profileId}.autoPromote.minConfidenceTier must be one of: ${CONFIDENCE_TIERS.join(", ")}`
634
606
  );
@@ -640,15 +612,13 @@ function parseScopeProfiles(value) {
640
612
  return ["fact", "correction", "decision", "preference"];
641
613
  }
642
614
  if (!Array.isArray(rawAutoPromote.categories)) {
643
- throw new Error(
644
- `scopeProfiles.${profileId}.autoPromote.categories must be an array`
645
- );
615
+ throw new Error(`scopeProfiles.${profileId}.autoPromote.categories must be an array`);
646
616
  }
647
617
  const categories = [];
648
618
  for (const entry of rawAutoPromote.categories) {
649
- if (typeof entry !== "string" || !SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES.includes(entry)) {
619
+ if (!isAutoPromoteCategory(entry)) {
650
620
  throw new Error(
651
- "scopeProfiles." + profileId + ".autoPromote.categories must contain only: " + SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES.join(", ")
621
+ `scopeProfiles.${profileId}.autoPromote.categories must contain only: ${SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES.join(", ")}`
652
622
  );
653
623
  }
654
624
  categories.push(entry);
@@ -709,12 +679,32 @@ function validateScopeProfileTeamReferences(profiles, teams) {
709
679
  for (const [profileId, profile] of Object.entries(profiles)) {
710
680
  const teamId = profile.teamProject?.teamId;
711
681
  if (teamId && !Object.prototype.hasOwnProperty.call(teams, teamId)) {
712
- throw new Error(
713
- `scopeProfiles.${profileId}.teamProject.teamId references unknown team: ${teamId}`
714
- );
682
+ throw new Error(`scopeProfiles.${profileId}.teamProject.teamId references unknown team: ${teamId}`);
715
683
  }
716
684
  }
717
685
  }
686
+
687
+ // src/config.ts
688
+ var DEFAULT_MEMORY_DIR = path.join(
689
+ resolveHomeDir(),
690
+ ".openclaw",
691
+ "workspace",
692
+ "memory",
693
+ "local"
694
+ );
695
+ var DEFAULT_WORKSPACE_DIR = path.join(
696
+ resolveHomeDir(),
697
+ ".openclaw",
698
+ "workspace"
699
+ );
700
+ var DEFAULT_INIT_GATE_TIMEOUT_MS = 3e4;
701
+ var CLIENT_SECRET_FIELD = ["client", "Secret"].join("");
702
+ var REFRESH_TOKEN_FIELD = ["refresh", "Token"].join("");
703
+ var LEGACY_ACTIVE_RECALL_CUSTOM_FIELD = [
704
+ "activeRecall",
705
+ "Prompt",
706
+ "Override"
707
+ ].join("");
718
708
  function parseBoundedIntegerMs(value, fallback, min, max) {
719
709
  const coerced = coerceNumber(value);
720
710
  if (coerced === void 0) return fallback;
@@ -3423,4 +3413,4 @@ export {
3423
3413
  VALID_MEMORY_CATEGORIES,
3424
3414
  parseConfig
3425
3415
  };
3426
- //# sourceMappingURL=chunk-2HAG7JOI.js.map
3416
+ //# sourceMappingURL=chunk-T4AWNIXJ.js.map