@anhlp/alp-core 0.0.0-beta.2 → 0.0.1-beta.10

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 (158) hide show
  1. package/dist/backup.js +106 -4
  2. package/dist/bridges.d.ts +26 -0
  3. package/dist/bridges.js +96 -0
  4. package/dist/gate-ledger.d.ts +30 -0
  5. package/dist/gate-ledger.js +99 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +2 -0
  8. package/dist/library-edit.d.ts +57 -5
  9. package/dist/library-edit.js +216 -11
  10. package/dist/library.d.ts +14 -1
  11. package/dist/library.js +73 -5
  12. package/dist/migrations.js +1 -1
  13. package/dist/models.d.ts +74 -0
  14. package/dist/models.js +67 -1
  15. package/dist/packaged.d.ts +122 -0
  16. package/dist/packaged.js +125 -0
  17. package/dist/packs.d.ts +57 -0
  18. package/dist/packs.js +247 -0
  19. package/dist/permissions.d.ts +3 -2
  20. package/dist/permissions.js +6 -3
  21. package/dist/profiles.js +6 -6
  22. package/dist/providers.d.ts +4 -5
  23. package/dist/providers.js +26 -5
  24. package/dist/skill-validate.d.ts +85 -0
  25. package/dist/skill-validate.js +298 -0
  26. package/dist/task-rows.d.ts +5 -0
  27. package/dist/task-rows.js +1 -1
  28. package/dist/tasks.d.ts +23 -4
  29. package/dist/tasks.js +103 -9
  30. package/dist/types.d.ts +3 -0
  31. package/dist/upgrade.d.ts +10 -0
  32. package/dist/upgrade.js +112 -6
  33. package/dist/user-settings.d.ts +2 -0
  34. package/dist/user-settings.js +40 -1
  35. package/dist/user-worktree.d.ts +29 -0
  36. package/dist/user-worktree.js +242 -0
  37. package/dist/validation.d.ts +1 -0
  38. package/dist/validation.js +35 -13
  39. package/package.json +34 -2
  40. package/src/backup.js +106 -5
  41. package/src/bridges.js +113 -0
  42. package/src/gate-ledger.js +125 -0
  43. package/src/index.js +1 -0
  44. package/src/library-edit.js +227 -12
  45. package/src/library.js +96 -6
  46. package/src/migrations.js +1 -1
  47. package/src/models.js +87 -1
  48. package/src/packaged.js +207 -0
  49. package/src/packs.js +246 -0
  50. package/src/permissions.d.ts +3 -2
  51. package/src/permissions.js +13 -3
  52. package/src/profiles.js +7 -7
  53. package/src/providers.js +23 -7
  54. package/src/resolver.js +1 -1
  55. package/src/skill-validate.js +287 -0
  56. package/src/task-rows.js +1 -1
  57. package/src/tasks.d.ts +23 -4
  58. package/src/tasks.js +137 -10
  59. package/src/types.d.ts +3 -0
  60. package/src/upgrade.js +54 -6
  61. package/src/user-settings.d.ts +2 -0
  62. package/src/user-settings.js +51 -1
  63. package/src/user-worktree.js +259 -0
  64. package/src/validation.d.ts +1 -0
  65. package/src/validation.js +43 -14
  66. package/templates/ALP.md +52 -52
  67. package/templates/agents/lead/AGENT.md +77 -74
  68. package/templates/agents/main/AGENT.md +153 -141
  69. package/templates/agents/oracle/AGENT.md +38 -37
  70. package/templates/agents/peer/AGENT.md +56 -52
  71. package/templates/agents/reviewer/AGENT.md +63 -65
  72. package/templates/agents/supervisor/AGENT.md +63 -63
  73. package/templates/packs/architecture/agents/architect/AGENT.md +41 -0
  74. package/templates/packs/architecture/agents/architect/agent.json +5 -0
  75. package/templates/packs/architecture/agents/docs-maintainer/AGENT.md +33 -0
  76. package/templates/packs/architecture/agents/docs-maintainer/agent.json +4 -0
  77. package/templates/packs/architecture/pack.json +7 -0
  78. package/templates/packs/architecture/teams/blueprint/HOUSE_RULES.md +12 -0
  79. package/templates/packs/architecture/teams/blueprint/team.json +19 -0
  80. package/templates/packs/backend/pack.json +6 -0
  81. package/templates/packs/backend/skills/backend-development/SKILL.md +102 -0
  82. package/templates/packs/backend/skills/backend-development/references/api-design.md +96 -0
  83. package/templates/packs/backend/skills/backend-development/references/authentication.md +78 -0
  84. package/templates/packs/backend/skills/backend-development/references/error-handling.md +86 -0
  85. package/templates/packs/backend/skills/backend-development/references/testing.md +81 -0
  86. package/templates/packs/backend/skills/databases/SKILL.md +103 -0
  87. package/templates/packs/backend/skills/databases/references/query-performance.md +87 -0
  88. package/templates/packs/backend/skills/databases/references/schema-and-migrations.md +87 -0
  89. package/templates/packs/design/pack.json +6 -0
  90. package/templates/packs/design/skills/ui-design/SKILL.md +86 -0
  91. package/templates/packs/design/skills/ui-design/references/design-tokens.md +67 -0
  92. package/templates/packs/design/skills/ui-design/references/interaction-states.md +73 -0
  93. package/templates/packs/design/skills/ui-design/references/layout-and-typography.md +71 -0
  94. package/templates/packs/design/skills/ui-design/references/ui-review.md +83 -0
  95. package/templates/packs/frontend/pack.json +6 -0
  96. package/templates/packs/frontend/skills/frontend-development/SKILL.md +105 -0
  97. package/templates/packs/frontend/skills/frontend-development/references/accessibility.md +86 -0
  98. package/templates/packs/frontend/skills/frontend-development/references/components-and-state.md +79 -0
  99. package/templates/packs/frontend/skills/frontend-development/references/data-fetching.md +86 -0
  100. package/templates/packs/frontend/skills/frontend-development/references/frameworks.md +77 -0
  101. package/templates/packs/frontend/skills/frontend-development/references/performance.md +78 -0
  102. package/templates/packs/integration/pack.json +6 -0
  103. package/templates/packs/integration/skills/mcp-integration/SKILL.md +100 -0
  104. package/templates/packs/integration/skills/mcp-integration/references/server-implementation.md +95 -0
  105. package/templates/packs/integration/skills/mcp-integration/references/testing.md +78 -0
  106. package/templates/packs/integration/skills/mcp-integration/references/tool-design.md +97 -0
  107. package/templates/packs/operations/pack.json +6 -0
  108. package/templates/packs/operations/skills/devops/SKILL.md +85 -0
  109. package/templates/packs/operations/skills/devops/references/ci-cd.md +84 -0
  110. package/templates/packs/operations/skills/devops/references/containers.md +85 -0
  111. package/templates/packs/operations/skills/devops/references/deployment-and-rollback.md +85 -0
  112. package/templates/packs/operations/skills/devops/references/observability.md +86 -0
  113. package/templates/packs/quality/pack.json +6 -0
  114. package/templates/packs/quality/skills/web-testing/SKILL.md +102 -0
  115. package/templates/packs/quality/skills/web-testing/references/e2e.md +85 -0
  116. package/templates/packs/quality/skills/web-testing/references/performance-testing.md +85 -0
  117. package/templates/packs/quality/skills/web-testing/references/security-testing.md +78 -0
  118. package/templates/packs/quality/skills/web-testing/references/unit-and-component.md +78 -0
  119. package/templates/role-skills.json +4 -4
  120. package/templates/skills/architecture-docs/SKILL.md +81 -0
  121. package/templates/skills/architecture-docs/references/adr.md +62 -0
  122. package/templates/skills/architecture-docs/references/diagrams.md +60 -0
  123. package/templates/skills/architecture-docs/references/evidence-rules.md +49 -0
  124. package/templates/skills/bug-loop/SKILL.md +41 -40
  125. package/templates/skills/bug-loop/references/test-proof.md +21 -19
  126. package/templates/skills/compact/SKILL.md +34 -0
  127. package/templates/skills/curate/SKILL.md +36 -0
  128. package/templates/skills/feature-architecture/SKILL.md +90 -0
  129. package/templates/skills/feature-architecture/references/architecture-contract.md +95 -0
  130. package/templates/skills/feature-architecture/references/feature-design.md +69 -0
  131. package/templates/skills/feature-architecture/scripts/check-boundaries.mjs +270 -0
  132. package/templates/skills/goal-griller/SKILL.md +27 -27
  133. package/templates/skills/prompt-leverage/SKILL.md +29 -27
  134. package/templates/skills/prompt-leverage/references/brief-template.md +9 -9
  135. package/templates/skills/release-readiness/SKILL.md +83 -0
  136. package/templates/skills/release-readiness/references/checklist.md +40 -0
  137. package/templates/skills/release-readiness/references/verdict-template.md +53 -0
  138. package/templates/skills/safe-refactor/SKILL.md +84 -0
  139. package/templates/skills/safe-refactor/references/characterization-tests.md +57 -0
  140. package/templates/skills/safe-refactor/references/compatibility-checklist.md +56 -0
  141. package/templates/skills/security-review/SKILL.md +87 -0
  142. package/templates/skills/security-review/references/checklist.md +74 -0
  143. package/templates/skills/security-review/references/severity.md +61 -0
  144. package/templates/skills/sequence-execution-plan/SKILL.md +41 -38
  145. package/templates/skills/sequence-execution-plan/references/plan-template.md +5 -5
  146. package/templates/skills/skill-authoring/SKILL.md +84 -0
  147. package/templates/skills/skill-authoring/references/evaluation.md +45 -0
  148. package/templates/skills/skill-authoring/references/skill-anatomy.md +74 -0
  149. package/templates/skills/skill-authoring/references/trigger-design.md +52 -0
  150. package/templates/skills/smart-commits/SKILL.md +37 -36
  151. package/templates/skills/test-strategy/SKILL.md +83 -0
  152. package/templates/skills/test-strategy/references/contract-tests.md +46 -0
  153. package/templates/skills/test-strategy/references/risk-matrix.md +53 -0
  154. package/templates/skills/xia/SKILL.md +40 -38
  155. package/templates/teams/cafe/HOUSE_RULES.md +1 -1
  156. package/templates/teams/cafe/team.json +1 -1
  157. package/templates/teams/pho/HOUSE_RULES.md +1 -1
  158. package/templates/teams/pho/team.json +1 -1
package/src/upgrade.js CHANGED
@@ -14,14 +14,62 @@ const legacy = {
14
14
  };
15
15
  // SHA-256 of shipped role definitions after CRLF normalization. Custom
16
16
  // definitions do not match and remain untouched. Keep historical IDs immutable.
17
+ //
18
+ // A project only receives a new role definition when the copy it holds is listed here, so a version
19
+ // ALP once shipped and never listed is stranded as customInstructions for ever (t-1293). The second
20
+ // block of each list is every distinct content `templates/<file>` ever had in this repository, in
21
+ // commit order, with the commit it first appeared in; the first block is what earlier releases (and
22
+ // the pre-fork Paseo team-v1 lineage) listed by hand. Append only, never edit or remove a line.
23
+ // To extend after changing a template, take the hash of the content being replaced:
24
+ // git show <commit>:templates/agents/supervisor/AGENT.md |
25
+ // node -e 'let d="";process.stdin.setEncoding("utf8").on("data",c=>d+=c).on("end",()=>console.log(require("crypto").createHash("sha256").update(d.replaceAll("\r\n","\n")).digest("hex")))'
17
26
  const teamV1 = {
18
- 'ALP.md': ['c2785aac6538d10e79bd6fb59b11066ccdec77287edf950fad59aa57bf3417f1', '0875293195d35d965effb70bb150d1edbc789f66f72c545f7760dea4346b1a9a'],
19
- '.alp/agents/main/AGENT.md': ['15d217cbc5ede782790d1086124598d9a2b5ff13bcf971a37231962fcef1b47c', 'e7201a1ed7800d7500b5c8091bd8a435aa9d5138f247c2b02b8bf76299387c90', '5001b807bbb686aa1a3b7ecadf9501428909e052e8231281454fd41cbe0ebf27', '90f9903fcc97ddf6336e1a28b81103dddc60a6038dcf74d326be8998862cb022', '9085ab906e2744a4151ae5c63dd66a545115cd4c876be1fd80f0a0ed4e623da8', 'fb55cfb0852d07592090de2c49e6c5c2b57936cbffc823dd24767c2db5e5f7fb'],
20
- '.alp/agents/lead/AGENT.md': ['c259b085a3c102445f97e5c7d402ca68347bcc1a9b02d6ab96e02be6d8b6f9af', '2eef2a4474f757cd89b35b50638a1b23fe49a54c26bf0dedb24a96d7117ddd92', '6c71393c9b3aa655c4731bda96396ea3ec0d4da62cddb3ad50d1a24113416b77', 'a382f0faa724e23a0ba9c212205978aa3fef87c3aecdf8823fba136e04568487', '547e3f8fc354b22c7beb3432182d68f4de1f24938375c8bfb167ae8afbf97de2'],
21
- '.alp/agents/peer/AGENT.md': ['f3dcf16c8c899a5378a468e922ca3956fd72cbb3e3798ed1109f11e01aa8f476', '39ccf3317eba3003faad77ebad4489fae3eb3c4d89258a03f619d1d3d65af0b7', 'c59e45e8f22eb0daca9b8b5e1b19e90666156807f160e75a21eca48b5fee1102', '9623dbf76eda598f6267629e993663c149acb0efd253f3900a4ee1eda8f2f9e7'],
22
- '.alp/agents/oracle/AGENT.md': ['cdce1babcd587a190dc94a32a951ed70ce2c75f99c205a4049df940851ac7059'],
23
- '.alp/agents/reviewer/AGENT.md': ['6eab9f918c79335a0665bf4e3a3a26b66258684d6725c4c95637e70e8d355123'],
27
+ 'ALP.md': ['c2785aac6538d10e79bd6fb59b11066ccdec77287edf950fad59aa57bf3417f1', '0875293195d35d965effb70bb150d1edbc789f66f72c545f7760dea4346b1a9a', 'fe0d5e6f64ef5a5030ee99feaf083f062a8e5136ac52d451e2ca7cdacb21d14f',
28
+ 'e04fe558a26d6e3c9b08211c426a83c368e4f0d15b0929e55df8ab4e5c4bb932', // 61181b5
29
+ 'ff1a7da448b735a9b4f88e3d9b6006d048114d3becee96a331d225b63e453c56', // ca2a971
30
+ '263135a3139eb40501f6e502271e946ec3db4692b63e39c2dd349ac0aaae6d62', // 818ab2e
31
+ 'e855f56ca0af0691c731ac5f2eb93d2528e339f2dbfd6f2376594f878d2c11e1', // 1f827c6
32
+ '48c6a0f80b41958457f8dbaaad7a4b3118efeaf5feb6ae626501c2f7896b077d'], // PR #330 (replaces 83388aa's hash, which never reached main)
33
+ '.alp/agents/main/AGENT.md': ['15d217cbc5ede782790d1086124598d9a2b5ff13bcf971a37231962fcef1b47c', 'e7201a1ed7800d7500b5c8091bd8a435aa9d5138f247c2b02b8bf76299387c90', '5001b807bbb686aa1a3b7ecadf9501428909e052e8231281454fd41cbe0ebf27', '90f9903fcc97ddf6336e1a28b81103dddc60a6038dcf74d326be8998862cb022', '9085ab906e2744a4151ae5c63dd66a545115cd4c876be1fd80f0a0ed4e623da8', 'fb55cfb0852d07592090de2c49e6c5c2b57936cbffc823dd24767c2db5e5f7fb', '91b71f5750e75f707488b70618e1d65a63aabf7518762f97ea0fde999d36fead',
34
+ '60d92fa634e178244a38e99c074e169af1847d7512e268262148ec15ebf08bed', // 61181b5
35
+ 'b501142ebff430e2ac6d0c3ecb2673cbf0fe0e1fa123b73b113ba9b4aa5f3a39', // ca2a971
36
+ 'ddbd75ebacf5f13615fa3da4941a389b14b534742032c3046e0e6c214a46c989', // ec26e6c
37
+ '5d610e7639bc8eaa29ad4119a5c090cbd286bd217f2f4a7d3abdd59725a985c1', // a1acd92
38
+ '28037d678457a392a42510d57919b14a643ea729c2a358fa7aeee4b7a33e6727', // 8d0e12a
39
+ 'b4435cf5ef8cfab2238eee86298f21cfa508e3fdeb6b3e697fde94160c341fe7', // 105f68f
40
+ '973539ce5dd998440cb59938f37260760f96f66a67b66369fcb28421acd49903', // 40ce2de
41
+ 'ab85e561f62a46e8838cc955984b66583a7325e69c1e7f2fd049479241553751', // cc9215e
42
+ '8b8d0bff45d245543f543ecd15043be38fd03edd364c6750aac58b87785c1afa', // 818ab2e
43
+ '2e82f110b108032c3c4444c306e73409bb6b481e5dc9ab080fe1ee2eb583fb78', // b8d2fbc
44
+ 'cde93f41883b26c2ef7636735d88be8fb202b143c479821647799c83b7d673dc', // 9180aa1
45
+ '29f181001edfee5521d8f4965b33f501f8ef869f6af3abf74a05e5f1623809ac', // f4d7986
46
+ 'd6f8002a81e3e0b7bb5868a6834d7be37731cc307877d7a03513067be10cad2f', // 1f827c6
47
+ 'b9bdd073e22903e3813f13caf87c9341215476ed692b3f04bc0971b66fd93ac5'], // 83388aa
48
+ '.alp/agents/lead/AGENT.md': ['c259b085a3c102445f97e5c7d402ca68347bcc1a9b02d6ab96e02be6d8b6f9af', '2eef2a4474f757cd89b35b50638a1b23fe49a54c26bf0dedb24a96d7117ddd92', '6c71393c9b3aa655c4731bda96396ea3ec0d4da62cddb3ad50d1a24113416b77', 'a382f0faa724e23a0ba9c212205978aa3fef87c3aecdf8823fba136e04568487', '547e3f8fc354b22c7beb3432182d68f4de1f24938375c8bfb167ae8afbf97de2', 'f3609df1486c0911459d8ee7d823b344369df0538654b0de6e9bc23170186b22',
49
+ '1674d7b96450824111ce885c828af51aa8924c38888bdeb583f4f31684c2bf60', // 61181b5
50
+ '7cd01a44200fda79ae0979a4975c483494a35e2e8c144b4e56f0b61046fc1a67', // ca2a971
51
+ 'c622392fcb94aeec18efcb12fe9ed574117304af02c303d0f575a2181991b454', // 8d0e12a
52
+ '6e9166b3b72333b76b4b2ef5a7778e142d6fd3c1023efd8a792bec1b12516415', // 40ce2de
53
+ '8aef2591deb1ca12f3cbc843445688140aeb03f7c42bff8e15ef74bdd03be940', // 1f827c6
54
+ 'e241608ee9579ed894024cba8f9b7b60e75283179d68ebbd4cb28a526c78965d'], // 83388aa
55
+ '.alp/agents/peer/AGENT.md': ['f3dcf16c8c899a5378a468e922ca3956fd72cbb3e3798ed1109f11e01aa8f476', '39ccf3317eba3003faad77ebad4489fae3eb3c4d89258a03f619d1d3d65af0b7', 'c59e45e8f22eb0daca9b8b5e1b19e90666156807f160e75a21eca48b5fee1102', '9623dbf76eda598f6267629e993663c149acb0efd253f3900a4ee1eda8f2f9e7', '20b0d2b6be74597ea1f39cf6d2d56c0ef2bffe39cb3bfe1ae41761748ef9bfae',
56
+ 'da389b7fa194fcf4cb8683664d30e06197999d804ec4ee94c1889bb397f540a9', // 61181b5
57
+ 'c7c8f4c5468484bab165f8f32b141398a259d4e6e9966e304528d82858e6807e', // ca2a971
58
+ 'd7cbdac679c82086ce2601d0a2c82480f6b2300ea011a9e07862f1b900d6ac75'], // 1f827c6
59
+ '.alp/agents/oracle/AGENT.md': ['cdce1babcd587a190dc94a32a951ed70ce2c75f99c205a4049df940851ac7059', '0907091b17aa8e54215b65171433f222b8491e9490a16a66b6a2b8cffc3f9023',
60
+ 'ae6219e0141d290705ed45992f0cc78688d17c78757f7f1f72f1639432e110cc'], // 1f827c6
61
+ '.alp/agents/reviewer/AGENT.md': ['6eab9f918c79335a0665bf4e3a3a26b66258684d6725c4c95637e70e8d355123', '1809de0be6473d5f9ceeae2d35128d52a0c0cde3968b45a7569ceae7a8a74416',
62
+ '56bebc192fda9d67bc2ceaf14d4f0cf274eaa40bf3e652caaf85c239eba1a253'], // 1f827c6
63
+ '.alp/agents/supervisor/AGENT.md': ['81ac93f4fbf2337224f838d39a9c4ef13fdba12d5fc7de681a00628bf9e69a27',
64
+ 'a2be7e682b030d2ff122ba4e836b1c89858493a05937fa11ad1fa808e0df9c8d', // 61181b5
65
+ 'd26d642128bedb6c90d4a84b227877ae4ea8be0838de75f40d786c0ba55183ae', // ec26e6c
66
+ 'f920b505cda38c90f7014827352225846b6b1e35a40675e2f5d01b03cee250ce', // cdbc297
67
+ '10e22e451264a901a7ad62e04189a91fae70940a62f4646f22c1135244986d03', // cc9215e
68
+ '6c306170ee5218313c93dc8bc1049e1dd9daf401073fda4c476ff4b5630765ab'], // 1f827c6
24
69
  };
70
+ /** The hashes above, by project-relative path, so a test can hold the list to the templates. */
71
+ export const shippedRoleHashes = teamV1;
72
+
25
73
  /** Profiles' names before 0.4. */
26
74
  const renamedProfiles = { smart: 'pho', supervised: 'cafe' };
27
75
 
@@ -4,3 +4,5 @@ export function userLanguage(home?: string): Promise<string>;
4
4
  export function languageSetting(home: string): Promise<{ language: string | null; applies: string; default: string }>;
5
5
  export function setLanguage(home: string | undefined, language: string | null): Promise<{ language: string | null; applies: string; default: string }>;
6
6
  export function setWebRelay(home: string, patch: { enabled?: boolean; endpoint?: string; useTls?: boolean }): Promise<{ enabled?: boolean; endpoint?: string; useTls?: boolean }>;
7
+ export function dashboardSettings(settings: unknown): { enabled?: boolean; port?: number; permissions?: string[] };
8
+ export function migrateDashboardSettings(home: string): Promise<{ moved: string[]; conflicts: string[] }>;
@@ -3,7 +3,7 @@ import { moveFile } from './atomic.js';
3
3
  import { randomUUID } from 'node:crypto';
4
4
  import path from 'node:path';
5
5
  import { AlpError } from './errors.js';
6
- import { validateUserSettings } from './validation.js';
6
+ import { DASHBOARD_SETTINGS, validateUserSettings } from './validation.js';
7
7
 
8
8
  /**
9
9
  * The user's own settings in $ALP_HOME/settings.json that ALP and its screens edit
@@ -74,3 +74,53 @@ export async function setWebRelay(home, patch) {
74
74
  await moveFile(temporary, file);
75
75
  return next.web.relay;
76
76
  }
77
+
78
+ /**
79
+ * alp dashboard's settings (enabled, port, permissions): `dashboard.*` first, then the `web.*` they
80
+ * had before the rename (t-81b0.5), so a file not yet migrated is still obeyed rather than ignored.
81
+ * @param {any} settings
82
+ * @returns {{ enabled?: boolean, port?: number, permissions?: string[] }}
83
+ */
84
+ export function dashboardSettings(settings) {
85
+ const now = settings?.dashboard ?? {};
86
+ const before = settings?.web ?? {};
87
+ /** @type {any} */
88
+ const result = {};
89
+ for (const key of DASHBOARD_SETTINGS) {
90
+ const value = now[key] !== undefined ? now[key] : before[key];
91
+ if (value !== undefined) result[key] = value;
92
+ }
93
+ return result;
94
+ }
95
+
96
+ /**
97
+ * Moves alp dashboard's settings from `web` (before the rename, t-81b0.5) to `dashboard` in
98
+ * settings.json, keeping everything else, `web.relay` (Paseo's) included. A key `dashboard` already
99
+ * sets wins: the `web` one is left in place and reported, never merged over it. Idempotent: a file
100
+ * with nothing to move is not written. Returns what it moved and what it left.
101
+ * @param {string} home
102
+ * @returns {Promise<{ moved: string[], conflicts: string[] }>}
103
+ */
104
+ export async function migrateDashboardSettings(home) {
105
+ const { file, settings } = await readSettings(home);
106
+ const web = settings.web;
107
+ if (!web || typeof web !== 'object') return { moved: [], conflicts: [] };
108
+ const moved = [], conflicts = [];
109
+ const dashboard = { ...settings.dashboard };
110
+ const rest = { ...web };
111
+ for (const key of DASHBOARD_SETTINGS) {
112
+ if (web[key] === undefined) continue;
113
+ if (dashboard[key] !== undefined) { conflicts.push(key); continue; }
114
+ dashboard[key] = web[key];
115
+ delete rest[key];
116
+ moved.push(key);
117
+ }
118
+ if (!moved.length) return { moved, conflicts };
119
+ const next = { ...settings, dashboard };
120
+ if (Object.keys(rest).length) next.web = rest; else delete next.web;
121
+ validateUserSettings(next, file);
122
+ const temporary = `${file}.${randomUUID().slice(0, 8)}.tmp`;
123
+ await writeFile(temporary, JSON.stringify(next, null, 2) + '\n', { mode: 0o600 });
124
+ await moveFile(temporary, file);
125
+ return { moved, conflicts };
126
+ }
@@ -0,0 +1,259 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { lstat, realpath, open } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { constants } from 'node:fs';
5
+
6
+ /** Bounded, no-follow administrative reads; no Git process is needed to re-check a grant. */
7
+ async function control(file) {
8
+ const handle = await open(file, constants.O_RDONLY | constants.O_NOFOLLOW);
9
+ try {
10
+ const info = await handle.stat();
11
+ if (!info.isFile() || info.nlink !== 1 || info.size > 4096) throw new Error('Invalid Git administrative file');
12
+ const bytes = Buffer.alloc(4097);
13
+ const { bytesRead } = await handle.read(bytes, 0, bytes.length, 0);
14
+ if (bytesRead > 4096) throw new Error('Git administrative file exceeds limit');
15
+ return bytes
16
+ .subarray(0, bytesRead)
17
+ .toString('utf8')
18
+ .replace(/\r?\n$/, '');
19
+ } finally {
20
+ await handle.close();
21
+ }
22
+ }
23
+ export async function repositoryIdentity(directory) {
24
+ if ((await realpath(directory)) !== directory) throw new Error('Repository root is not canonical');
25
+ const entry = path.join(directory, '.git');
26
+ const info = await lstat(entry);
27
+ let gitDir;
28
+ if (info.isDirectory()) gitDir = await realpath(entry);
29
+ else {
30
+ const value = await control(entry);
31
+ if (!value.startsWith('gitdir: ') || /[\r\n\0]/.test(value)) throw new Error('Invalid Git control link');
32
+ gitDir = await realpath(path.resolve(directory, value.slice(8)));
33
+ }
34
+ const commonEntry = path.join(gitDir, 'commondir');
35
+ const hasCommon = await lstat(commonEntry).catch((error) => {
36
+ if (error.code === 'ENOENT') return undefined;
37
+ throw error;
38
+ });
39
+ const commonDir = hasCommon ? await realpath(path.resolve(gitDir, await control(commonEntry))) : gitDir;
40
+ if (gitDir !== commonDir) {
41
+ if (
42
+ path.dirname(gitDir) !== path.join(commonDir, 'worktrees') ||
43
+ path.resolve(gitDir, await control(path.join(gitDir, 'gitdir'))) !== entry
44
+ )
45
+ throw new Error('Git worktree backlink changed');
46
+ }
47
+ const head = await control(path.join(gitDir, 'HEAD'));
48
+ const branch = head.startsWith('ref: refs/heads/') ? head.slice(16) : null;
49
+ if (branch !== null && (!branch || /[\r\n\0]/.test(branch))) throw new Error('Invalid branch reference');
50
+ return { gitDir, commonDir, branch };
51
+ }
52
+
53
+ /** User workspace primitives. Assignment cleanup's force/rm semantics must never be used here. */
54
+ export function userWorktreeGit({ executable = '/usr/bin/git', timeoutMs = 15_000, maxBytes = 2 * 1024 * 1024 } = {}) {
55
+ if (process.platform === 'win32') throw new Error('User worktree operations are unavailable on this host');
56
+ if (!path.isAbsolute(executable)) throw new Error('Git executable must be host configured and absolute');
57
+ const disabled = [
58
+ '-c',
59
+ 'core.hooksPath=/dev/null',
60
+ '-c',
61
+ 'core.fsmonitor=false',
62
+ '-c',
63
+ 'core.untrackedCache=false',
64
+ '-c',
65
+ 'core.pager=cat',
66
+ '-c',
67
+ 'maintenance.auto=false',
68
+ '-c',
69
+ 'gc.auto=0',
70
+ '-c',
71
+ 'protocol.allow=never',
72
+ '-c',
73
+ 'submodule.recurse=false'
74
+ ];
75
+ // No inherited Git context, PATH or user/system config. Repository config is data, never a program.
76
+ const env = {
77
+ PATH: '/usr/bin:/bin',
78
+ GIT_CONFIG_NOSYSTEM: '1',
79
+ GIT_CONFIG_GLOBAL: '/dev/null',
80
+ GIT_TERMINAL_PROMPT: '0',
81
+ GIT_OPTIONAL_LOCKS: '0',
82
+ LANG: 'C',
83
+ LC_ALL: 'C'
84
+ };
85
+ async function raw(cwd, args, extra = []) {
86
+ return new Promise((resolve, reject) => {
87
+ const child = spawn(executable, [...disabled, ...extra, ...args], {
88
+ cwd,
89
+ env,
90
+ stdio: ['ignore', 'pipe', 'pipe'],
91
+ windowsHide: true,
92
+ detached: true
93
+ });
94
+ let size = 0;
95
+ let overflow = false;
96
+ const stdout = [];
97
+ const stderr = [];
98
+ const kill = () => {
99
+ try {
100
+ process.kill(-child.pid, 'SIGKILL');
101
+ } catch {
102
+ child.kill('SIGKILL');
103
+ }
104
+ };
105
+ const timer = setTimeout(() => {
106
+ overflow = true;
107
+ kill();
108
+ }, timeoutMs);
109
+ const collect = (sink) => (chunk) => {
110
+ size += chunk.length;
111
+ if (size > maxBytes) {
112
+ overflow = true;
113
+ kill();
114
+ } else sink.push(chunk);
115
+ };
116
+ child.stdout.on('data', collect(stdout));
117
+ child.stderr.on('data', collect(stderr));
118
+ child.once('error', (error) => {
119
+ clearTimeout(timer);
120
+ reject(error);
121
+ });
122
+ child.once('close', (code) => {
123
+ clearTimeout(timer);
124
+ if (overflow) reject(new Error('Git operation exceeded its host limit'));
125
+ else
126
+ resolve({
127
+ code,
128
+ stdout: Buffer.concat(stdout).toString('utf8'),
129
+ stderr: Buffer.concat(stderr).toString('utf8')
130
+ });
131
+ });
132
+ });
133
+ }
134
+ async function filterOverrides(cwd) {
135
+ // Status/removal may run clean/process filters as well as creation's smudge filter.
136
+ const filters = await raw(cwd, [
137
+ 'config',
138
+ '--null',
139
+ '--name-only',
140
+ '--get-regexp',
141
+ '^filter\\..*\\.(smudge|clean|process|required)$'
142
+ ]);
143
+ if (filters.code !== 0 && filters.code !== 1) throw new Error('Cannot inspect repository filters');
144
+ const neutral = filters.stdout
145
+ .split('\0')
146
+ .filter(Boolean)
147
+ .flatMap((key) => ['-c', `${key}=${key.endsWith('.required') ? 'false' : ''}`]);
148
+ return neutral;
149
+ }
150
+ async function run(cwd, args, extra = []) {
151
+ return raw(cwd, args, [...(await filterOverrides(cwd)), ...extra]);
152
+ }
153
+ async function checked(cwd, args, extra = []) {
154
+ const result = await run(cwd, args, extra);
155
+ if (result.code !== 0) throw new Error('Git workspace operation refused');
156
+ return result.stdout.trim();
157
+ }
158
+ async function directory(value) {
159
+ const canonical = await realpath(value);
160
+ if (canonical !== value || !(await lstat(value)).isDirectory())
161
+ throw new Error('Workspace paths must be canonical directories');
162
+ return canonical;
163
+ }
164
+ async function facts(source) {
165
+ await directory(source);
166
+ const top = await checked(source, ['rev-parse', '--show-toplevel']);
167
+ if ((await realpath(top)) !== source) throw new Error('Workspace must be a repository top level');
168
+ const commonDir = await realpath(
169
+ await checked(source, ['rev-parse', '--path-format=absolute', '--git-common-dir'])
170
+ );
171
+ const identity = await repositoryIdentity(source);
172
+ if (identity.commonDir !== commonDir) throw new Error('Repository identity changed');
173
+ const head = await checked(source, ['rev-parse', '--verify', 'HEAD']);
174
+ const branch = await run(source, ['symbolic-ref', '--quiet', '--short', 'HEAD']);
175
+ return { commonDir, gitDir: identity.gitDir, head, branch: branch.code === 0 ? branch.stdout.trim() : null };
176
+ }
177
+ async function list(source) {
178
+ const result = await checked(source, ['worktree', 'list', '--porcelain', '-z']);
179
+ return result
180
+ .split('\0\0')
181
+ .filter(Boolean)
182
+ .map((block) =>
183
+ Object.fromEntries(
184
+ block
185
+ .split('\0')
186
+ .filter(Boolean)
187
+ .map((line) => {
188
+ const i = line.indexOf(' ');
189
+ return i < 0 ? [line, true] : [line.slice(0, i), line.slice(i + 1)];
190
+ })
191
+ )
192
+ );
193
+ }
194
+ async function inspect(source, target, branch) {
195
+ const row = (await list(source)).find((row) => row.worktree === target);
196
+ if (!row) return undefined;
197
+ await directory(target);
198
+ if (row.branch !== `refs/heads/${branch}` || row.locked || row.prunable)
199
+ throw new Error('Managed worktree identity changed');
200
+ const origin = await facts(source);
201
+ const destination = await facts(target);
202
+ if (origin.commonDir !== destination.commonDir) throw new Error('Managed worktree repository changed');
203
+ return row;
204
+ }
205
+ async function assertClean(target) {
206
+ const flags = await checked(target, ['ls-files', '-v', '-z']);
207
+ if (flags.split('\0').some((row) => row && (row[0] === 'S' || /[a-z]/.test(row[0]))))
208
+ throw new Error('Worktree has hidden index state');
209
+ if ((await checked(target, ['ls-files', '--stage', '-z'])).split('\0').some((row) => row.startsWith('160000 ')))
210
+ throw new Error('Worktree has submodules');
211
+ // Ignored data is user data too. Never force a delete or fall back to recursive rm.
212
+ if ((await checked(target, ['status', '--porcelain=v1', '--untracked-files=all', '--ignored'])).length)
213
+ throw new Error('Worktree contains uncommitted or ignored files');
214
+ }
215
+ return {
216
+ facts,
217
+ inspect,
218
+ assertClean,
219
+ async checkoutFacts(directory) {
220
+ const canonical = await realpath(directory);
221
+ const repoRoot = await checked(canonical, ['rev-parse', '--show-toplevel']);
222
+ const branch = await run(canonical, ['symbolic-ref', '--quiet', '--short', 'HEAD']);
223
+ const remote = await run(canonical, ['config', '--get', 'remote.origin.url']);
224
+ const status = await checked(canonical, ['status', '--porcelain=v1', '--untracked-files=all']);
225
+ return {
226
+ isGit: /** @type {const} */ (true),
227
+ repoRoot,
228
+ currentBranch: branch.code === 0 ? branch.stdout.trim() : null,
229
+ remoteUrl: remote.code === 0 ? remote.stdout.trim() || null : null,
230
+ isDirty: !!status
231
+ };
232
+ },
233
+ async create(source, parent, name, branch, head) {
234
+ await directory(parent);
235
+ if (!/^wks_[0-9a-f]{16}$/.test(name) || branch !== `alp/workspace/${name}` || !/^[0-9a-f]{40,64}$/.test(head))
236
+ throw new Error('Invalid generated worktree identity');
237
+ const target = path.join(parent, name);
238
+ if (
239
+ await lstat(target).catch((error) => {
240
+ if (error.code === 'ENOENT') return undefined;
241
+ throw error;
242
+ })
243
+ )
244
+ throw new Error('Worktree destination already exists');
245
+ await checked(source, ['worktree', 'add', '--quiet', '--no-checkout', '-b', branch, target, head]);
246
+ // Conditional gitdir/onbranch config is resolved in the new checkout before materialization.
247
+ await checked(target, ['reset', '--hard', '--no-recurse-submodules', head]);
248
+ if (!(await inspect(source, target, branch))) throw new Error('Worktree creation needs reconciliation');
249
+ return target;
250
+ },
251
+ async remove(source, target, branch) {
252
+ if (!(await inspect(source, target, branch))) throw new Error('Managed worktree is missing');
253
+ await assertClean(target);
254
+ await checked(source, ['worktree', 'remove', target], await filterOverrides(target));
255
+ if ((await list(source)).some((row) => row.worktree === target))
256
+ throw new Error('Worktree removal needs reconciliation');
257
+ }
258
+ };
259
+ }
@@ -1,5 +1,6 @@
1
1
  export const PROJECT_SETTINGS: string[];
2
2
  export const USER_SETTINGS: string[];
3
+ export const DASHBOARD_SETTINGS: readonly string[];
3
4
  export const RETIRED_SETTINGS: { project: Record<string, string>; user: Record<string, string> };
4
5
  export function settingsKeys(settings: unknown, known: string[], retired?: Record<string, string>): { unknown: Array<{ key: string; suggestion?: string }>; retired: Array<{ key: string; instead: string }> };
5
6
  export function settingsWarnings(settings: unknown, scope: 'project' | 'user'): string[];
package/src/validation.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { AlpError } from './errors.js';
3
- import { MODELS } from './models.js';
3
+ import { EFFORTS, knownModel } from './models.js';
4
4
  import { validatePermissions } from './permissions.js';
5
5
  import { validateVerify } from './verify.js';
6
6
 
@@ -11,12 +11,12 @@ function requireValue(condition, code, source, message) {
11
11
  if (!condition) throw new AlpError(code, `${source}: ${message}`);
12
12
  }
13
13
 
14
- /** Efforts a profile may name; a model ALP knows takes only its own (src/core/models.js). */
15
- const EFFORTS = ['none', 'off', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra', 'ultracode'];
16
14
  /** Top-level keys of a project's .alp/settings.json. */
17
- export const PROJECT_SETTINGS = ['$schema', 'defaultAgent', 'workflow', 'runtime', 'permissions', 'verify', 'delegation', 'team', 'profile', 'templateDefaults'];
15
+ export const PROJECT_SETTINGS = ['$schema', 'defaultAgent', 'workflow', 'runtime', 'permissions', 'verify', 'delegation', 'team', 'profile', 'templateDefaults', 'compact', 'curate'];
18
16
  /** Top-level keys of the user's $ALP_HOME/settings.json. */
19
- export const USER_SETTINGS = ['$schema', 'language', 'permissions', 'limits', 'recovery', 'web'];
17
+ export const USER_SETTINGS = ['$schema', 'language', 'permissions', 'limits', 'recovery', 'dashboard', 'web', 'curate'];
18
+ /** The settings of `alp dashboard`; before the rename (t-81b0.5) they lived under `web`, which still holds Paseo's relay. */
19
+ export const DASHBOARD_SETTINGS = Object.freeze(['enabled', 'port', 'permissions']);
20
20
  /**
21
21
  * Top-level keys ALP no longer reads, with what to use instead. They warn rather than
22
22
  * fail, so settings written for an older ALP keep working.
@@ -62,11 +62,20 @@ export function settingsWarnings(settings, scope) {
62
62
  .map(({ key, instead }) => `setting '${key}' is no longer read; ${instead}`);
63
63
  }
64
64
 
65
+ /** curate: { monthly: boolean } turns the monthly lessons-and-skills review on or off. */
66
+ function checkCurate(settings, check) {
67
+ if (settings.curate === undefined) return;
68
+ check(object(settings.curate), 'curate must be an object');
69
+ check(Object.keys(settings.curate).every(key => key === 'monthly'), 'unsupported curate field; use monthly');
70
+ if (settings.curate.monthly !== undefined) check(typeof settings.curate.monthly === 'boolean', 'curate.monthly must be true or false');
71
+ }
72
+
65
73
  export function validateSettings(settings, source) {
66
74
  const check = (ok, message) => requireValue(ok, 'INVALID_SETTINGS', source, message);
67
75
  check(object(settings), 'expected an object');
68
76
  const { unknown } = settingsKeys(settings, PROJECT_SETTINGS, RETIRED_SETTINGS.project);
69
77
  check(!unknown.length, unknown.length ? unknownMessage(unknown[0], PROJECT_SETTINGS) : '');
78
+ checkCurate(settings, check);
70
79
  if (settings.defaultAgent !== undefined) check(nonempty(settings.defaultAgent), 'defaultAgent must be a nonempty string');
71
80
  if (settings.workflow !== undefined) {
72
81
  check(object(settings.workflow), 'workflow must be an object');
@@ -76,6 +85,12 @@ export function validateSettings(settings, source) {
76
85
  if (settings.workflow.maxPeers !== undefined) check(Number.isSafeInteger(settings.workflow.maxPeers) && settings.workflow.maxPeers > 0, 'workflow.maxPeers must be a positive integer');
77
86
  if (settings.workflow.supervisor !== undefined) check(typeof settings.workflow.supervisor === 'boolean', 'workflow.supervisor must be true or false');
78
87
  }
88
+ if (settings.compact !== undefined) {
89
+ check(object(settings.compact), 'compact must be an object');
90
+ check(Object.keys(settings.compact).every(key => ['auto', 'threshold'].includes(key)), 'compact takes auto and threshold');
91
+ if (settings.compact.auto !== undefined) check(typeof settings.compact.auto === 'boolean', 'compact.auto must be true or false');
92
+ if (settings.compact.threshold !== undefined) check(typeof settings.compact.threshold === 'number' && settings.compact.threshold > 0 && settings.compact.threshold < 1, 'compact.threshold must be a number between 0 and 1');
93
+ }
79
94
  if (settings.templateDefaults !== undefined) {
80
95
  check(object(settings.templateDefaults), 'templateDefaults must map teams to profile fingerprints');
81
96
  for (const [team, agents] of Object.entries(settings.templateDefaults)) {
@@ -103,8 +118,10 @@ export function validateSettings(settings, source) {
103
118
  const where = `${key}.${team}.${agent}`;
104
119
  check(object(config), `${where} must be an object`);
105
120
  if (config.autocompact !== undefined) validateAutoCompact(config.autocompact, check, `${where}.autocompact`);
121
+ // t-efa3: the runtime's own commands and skills its "/" list offers besides the agent's ALP skills.
122
+ if (config.commands !== undefined) check(Array.isArray(config.commands) && config.commands.every(name => typeof name === 'string' && /^[^\s/]{1,256}$/.test(name)), `${where}.commands must be a list of command names, without whitespace or /`);
106
123
  if (Object.hasOwn(config, 'profiles')) {
107
- check(Object.keys(config).every(key => ['profiles', 'autocompact'].includes(key)), `${where}: use profiles and autocompact`);
124
+ check(Object.keys(config).every(key => ['profiles', 'autocompact', 'commands'].includes(key)), `${where}: use profiles, autocompact and commands`);
108
125
  check(Array.isArray(config.profiles) && config.profiles.length > 0, `${where}.profiles must be a nonempty list`);
109
126
  const models = [];
110
127
  for (const [index, entry] of config.profiles.entries()) {
@@ -114,7 +131,8 @@ export function validateSettings(settings, source) {
114
131
  const [provider, model, effort] = entry.split(':');
115
132
  check(model !== '*' || (agent !== 'oracle' && agent !== 'main'), `${at}: ${agent} runs on a named model, not any model`);
116
133
  if (effort !== undefined) {
117
- const known = MODELS.find(candidate => candidate.runtime === provider && candidate.id === model);
134
+ // The live catalog when this process has one (knownModels), else MODELS; never beyond EFFORTS.
135
+ const known = knownModel(`${provider}:${model}`);
118
136
  check(EFFORTS.includes(effort), `${at}: effort ${effort} is unsupported`);
119
137
  check(!known?.efforts.length || known.efforts.includes(effort), `${at}: ${provider}:${model} takes effort ${known?.efforts.join(', ')}`);
120
138
  }
@@ -128,14 +146,14 @@ export function validateSettings(settings, source) {
128
146
  check(new Set(models).size === models.length, `${where}.profiles must not repeat the same model`);
129
147
  check(agent !== 'main' || config.profiles.length === 1, `${where}.profiles: main runs on exactly one model`);
130
148
  } else if (agent === 'oracle') {
131
- const entries = Object.entries(config).filter(([key]) => key !== 'autocompact');
149
+ const entries = Object.entries(config).filter(([key]) => key !== 'autocompact' && key !== 'commands');
132
150
  check(entries.length > 0 && entries.every(([provider]) => ['claude', 'codex'].includes(provider)), `${where} must define profiles or claude/codex lenses`);
133
151
  for (const [provider, lens] of entries) {
134
152
  validateChoice(lens, `${where}.${provider}`);
135
153
  check(lens.provider === provider && nonempty(lens.model), `${where}.${provider}: specify matching provider and model`);
136
154
  }
137
155
  } else {
138
- const { autocompact, ...legacy } = config;
156
+ const { autocompact, commands, ...legacy } = config;
139
157
  validateChoice(legacy, where);
140
158
  }
141
159
  }
@@ -158,6 +176,7 @@ export function validateUserSettings(settings, source) {
158
176
  check(object(settings), 'expected an object');
159
177
  const { unknown } = settingsKeys(settings, USER_SETTINGS, RETIRED_SETTINGS.user);
160
178
  check(!unknown.length, unknown.length ? unknownMessage(unknown[0], USER_SETTINGS) : '');
179
+ checkCurate(settings, check);
161
180
  for (const key of ['limits', 'recovery']) {
162
181
  if (settings[key] === undefined) continue;
163
182
  check(object(settings[key]), `${key} must be an object`);
@@ -165,10 +184,22 @@ export function validateUserSettings(settings, source) {
165
184
  check(!extra, `unsupported ${key} field '${extra}'; use autoResume`);
166
185
  if (settings[key].autoResume !== undefined) check(typeof settings[key].autoResume === 'boolean', `${key}.autoResume must be true or false`);
167
186
  }
187
+ // `dashboard` holds alp dashboard's settings. `web` keeps Paseo's relay, and still accepts the
188
+ // dashboard settings written before the rename (alp dashboard moves them, then reads them from
189
+ // `dashboard` first and `web` second), so a file written for an older release stays valid.
190
+ for (const key of ['dashboard', 'web']) {
191
+ const section = settings[key];
192
+ if (section === undefined) continue;
193
+ check(object(section), `${key} must be an object`);
194
+ const allowed = key === 'web' ? [...DASHBOARD_SETTINGS, 'relay'] : DASHBOARD_SETTINGS;
195
+ const extra = Object.keys(section).find(field => !allowed.includes(field));
196
+ check(!extra, `unsupported ${key} field '${extra}'; use ${allowed.slice(0, -1).join(', ')} or ${allowed.at(-1)}`);
197
+ // Gateway permissions `alp dashboard` adds to its default grant; the service checks each name against the gateway's list.
198
+ if (section.permissions !== undefined) check(Array.isArray(section.permissions) && section.permissions.every(entry => typeof entry === 'string' && /^[a-z][a-z.]*$/.test(entry)), `${key}.permissions must be a list of permission names, such as files.read`);
199
+ if (section.enabled !== undefined) check(typeof section.enabled === 'boolean', `${key}.enabled must be true or false`);
200
+ if (section.port !== undefined) check(Number.isInteger(section.port) && section.port >= 1024 && section.port <= 65535, `${key}.port must be a port from 1024 to 65535`);
201
+ }
168
202
  if (settings.web !== undefined) {
169
- check(object(settings.web), 'web must be an object');
170
- const extra = Object.keys(settings.web).find(field => !['enabled', 'port', 'relay'].includes(field));
171
- check(!extra, `unsupported web field '${extra}'; use enabled, port or relay`);
172
203
  // The relay that lets Paseo's app reach alpd from another device (ALPD §64).
173
204
  const relay = settings.web.relay;
174
205
  if (relay !== undefined) {
@@ -179,8 +210,6 @@ export function validateUserSettings(settings, source) {
179
210
  if (relay.endpoint !== undefined) check(typeof relay.endpoint === 'string' && /^[a-z0-9.-]+:\d{1,5}$/i.test(relay.endpoint), 'web.relay.endpoint must be host:port, such as relay.paseo.sh:443');
180
211
  if (relay.useTls !== undefined) check(typeof relay.useTls === 'boolean', 'web.relay.useTls must be true or false');
181
212
  }
182
- if (settings.web.enabled !== undefined) check(typeof settings.web.enabled === 'boolean', 'web.enabled must be true or false');
183
- if (settings.web.port !== undefined) check(Number.isInteger(settings.web.port) && settings.web.port >= 1024 && settings.web.port <= 65535, 'web.port must be a port from 1024 to 65535');
184
213
  }
185
214
  if (settings.language !== undefined) check(nonempty(settings.language) && settings.language.trim().length <= 40, 'language must be a language name of at most 40 characters, such as Vietnamese or English');
186
215
  validatePermissions(settings.permissions, source);