mirror of
https://github.com/Niko1221/Strata.git
synced 2026-11-07 14:21:06 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e8a4cca7d | ||
|
|
a42cc3d7df | ||
|
|
5a843fd841 | ||
|
|
e6d5d76010 | ||
|
|
2526f2ff99 | ||
|
|
94d7aab293 | ||
|
|
1bd17d59d9 | ||
|
|
c451698d6a | ||
|
|
1e617c3f64 | ||
|
|
9b177f3080 | ||
|
|
4c7bce3ad1 | ||
|
|
8dce24a0a1 | ||
|
|
12d0f0abe8 | ||
|
|
ac19fecc06 | ||
|
|
6ca60e9a0d | ||
|
|
c41bd44de7 | ||
|
|
447460e8cc | ||
|
|
ec8e405909 | ||
|
|
5ac66e5005 | ||
|
|
e40843dade | ||
|
|
5cfa395476 | ||
|
|
f656a721a6 | ||
|
|
42890ca79f | ||
|
|
37e4832ab3 | ||
|
|
1c2efd789a | ||
|
|
0d4b2cdd43 | ||
|
|
789d83903b | ||
|
|
9c624c75a9 | ||
|
|
8dd297d0f1 | ||
|
|
7d1016f3f4 | ||
|
|
e0d47034df | ||
|
|
8c0301484e | ||
|
|
2a9a67c174 | ||
|
|
11b0490228 | ||
|
|
ebe3383a3f | ||
|
|
ba8b2bcb9c | ||
|
|
38b06316ef | ||
|
|
1e57a924d0 | ||
|
|
ca17d0f5cd | ||
|
|
499e963593 | ||
|
|
f4612b1add | ||
|
|
9ac278e124 | ||
|
|
ccf18ea143 | ||
|
|
3480bf2b8c | ||
|
|
597df5e601 | ||
|
|
1b89043157 | ||
|
|
129739440a | ||
|
|
8191cb91b4 | ||
|
|
fb8f7d9df6 | ||
|
|
df20d77845 | ||
|
|
9e20319069 | ||
|
|
bd8a254453 | ||
|
|
0959545e21 | ||
|
|
a4c41a92ee | ||
|
|
2651c4a96b | ||
|
|
2579635138 | ||
|
|
1e278a280d | ||
|
|
56d98f164e | ||
|
|
8b95bffb0b | ||
|
|
c2d3fe5000 | ||
|
|
0049fa73ff | ||
|
|
0e63d59c01 | ||
|
|
85e3dde522 | ||
|
|
ca378670b2 | ||
|
|
f73b3c86a4 | ||
|
|
0f7224d168 | ||
|
|
8c2a846947 | ||
|
|
10c8cc629f | ||
|
|
17878ac579 | ||
|
|
1d45da3a8a | ||
|
|
0afaaa399e | ||
|
|
1e9678cb7c | ||
|
|
b1bea3a17c | ||
|
|
f932e410e6 | ||
|
|
c77292f09d | ||
|
|
e240850324 | ||
|
|
538acd098c | ||
|
|
ee1a6efd5c | ||
|
|
f1dadd1710 | ||
|
|
3cabb9e3fe | ||
|
|
3b908cc4f7 | ||
|
|
0d0ec83b7d | ||
|
|
c17a6f4ce1 | ||
|
|
902dc814d6 | ||
|
|
59b4be2a54 | ||
|
|
98e35984c6 | ||
|
|
dc390c3864 | ||
|
|
03d709820d | ||
|
|
663ec80abf | ||
|
|
46a9cd87c7 | ||
|
|
52ba0b7816 | ||
|
|
551f1cdc30 | ||
|
|
2b9869eddf | ||
|
|
710b6a1bfe | ||
|
|
2ce07f8631 | ||
|
|
52a558abbe | ||
|
|
5d9f479229 | ||
|
|
9067cc64d3 | ||
|
|
5dbd8774d8 | ||
|
|
60e6a06086 | ||
|
|
884e37dfdf | ||
|
|
d6428bf291 | ||
|
|
17b08c9633 | ||
|
|
dd97421d3f | ||
|
|
bdcc34dfa8 | ||
|
|
945a63bec5 | ||
|
|
91aebae636 | ||
|
|
269c6d3e4a | ||
|
|
40c9dae95b | ||
|
|
805ebe17be | ||
|
|
b434a8aa6e | ||
|
|
40e78366bc | ||
|
|
4661596ce3 | ||
|
|
fcd3cdbcd7 | ||
|
|
a732a34c65 | ||
|
|
d02478b7a1 | ||
|
|
0acba452ec | ||
|
|
e7318fa23d | ||
|
|
18c5357666 | ||
|
|
c6f6db857b | ||
|
|
6eff377a79 | ||
|
|
cc125e06a0 | ||
|
|
5602253e3f | ||
|
|
42094da9c1 | ||
|
|
df7068b6be | ||
|
|
ffe40c1695 | ||
|
|
a6df0023a4 | ||
|
|
162dec3411 | ||
|
|
fca1936c2c | ||
|
|
8486336f9b | ||
|
|
bcdb92ac68 | ||
|
|
0aa64b2de3 | ||
|
|
675f7fc238 | ||
|
|
c47c699486 | ||
|
|
a965c962cf | ||
|
|
d5cca319c9 | ||
|
|
3813a459c4 | ||
|
|
fa128f91e8 | ||
|
|
47c98bb23a | ||
|
|
726472a229 | ||
|
|
10a62b8d2f | ||
|
|
690172c464 | ||
|
|
4a759f82d4 | ||
|
|
ab48216a7b | ||
|
|
ad1a310f55 | ||
|
|
c2490b49f5 | ||
|
|
5f81454038 | ||
|
|
d98d8f977f | ||
|
|
a338990186 | ||
|
|
9db497056b | ||
|
|
a3ab37fc03 | ||
|
|
6f1bd21e59 | ||
|
|
211fca87df | ||
|
|
9ea044962a | ||
|
|
2299c8f70a | ||
|
|
a3bb38ec45 | ||
|
|
557aad0265 | ||
|
|
2b13a44933 | ||
|
|
a3b7d9de3f | ||
|
|
c966d7ad89 | ||
|
|
c0845b7fc5 | ||
|
|
7783b1c18e | ||
|
|
f217b23bd3 | ||
|
|
cea3ed40db | ||
|
|
05c1dabf1a | ||
|
|
e21a1872f7 | ||
|
|
6c09a1929c | ||
|
|
5bc1e24696 | ||
|
|
0fbbf068eb | ||
|
|
409f2466ad | ||
|
|
11237f831f | ||
|
|
bdecbffc6b | ||
|
|
092c7d1ef4 | ||
|
|
a8c1d4b7f8 | ||
|
|
a11f8b0aa5 | ||
|
|
eba3106c0e | ||
|
|
61ede87e1b | ||
|
|
a1d2fd7ed1 | ||
|
|
560cc9fbbc | ||
|
|
96b6068c32 | ||
|
|
3100ca05ed | ||
|
|
a332cc95db | ||
|
|
3a3f35c64a | ||
|
|
2cc6ea169b | ||
|
|
2251053b42 | ||
|
|
c471588f3e | ||
|
|
01e404c140 | ||
|
|
9c2d35d978 | ||
|
|
407f659763 | ||
|
|
f213f78bae | ||
|
|
41188ec734 | ||
|
|
6a6d58ad03 | ||
|
|
2ac3482144 | ||
|
|
9e3fd0f73a | ||
|
|
54d9363c97 | ||
|
|
fb966cff37 | ||
|
|
a0fc88abd6 | ||
|
|
5b14fe23f7 | ||
|
|
f06bfc30e7 | ||
|
|
e6f598c0a2 | ||
|
|
3478382eee | ||
|
|
f62589fdbe | ||
|
|
164619c5a8 | ||
|
|
3cd33d504c | ||
|
|
4a7e373da3 | ||
|
|
bb62a048b8 | ||
|
|
484c689337 | ||
|
|
3b64abf5e0 | ||
|
|
c8596ec391 | ||
|
|
bf994ca414 | ||
|
|
590c69a578 | ||
|
|
7507b47525 | ||
|
|
1be7eb77c1 | ||
|
|
800730103c | ||
|
|
9a0462a011 | ||
|
|
bc939b6303 | ||
|
|
3cda075b51 | ||
|
|
7c9b6f3a28 | ||
|
|
cc2c628cbe | ||
|
|
3e81173d63 | ||
|
|
df6928400f | ||
|
|
1e4ae3ddbf | ||
|
|
e2e99ae54a | ||
|
|
f499922379 | ||
|
|
14bef6bb46 | ||
|
|
c7833932a1 | ||
|
|
d2c69e6d4b | ||
|
|
19bfcb33f0 | ||
|
|
9e2c0b6eb0 | ||
|
|
24c3f24ae1 | ||
|
|
7c4c20799c | ||
|
|
68ba321acc | ||
|
|
a8755042bd | ||
|
|
255861c442 | ||
|
|
e0469a585f | ||
|
|
d398f35325 | ||
|
|
dc1fd367d3 | ||
|
|
eb1c40038c | ||
|
|
cd72accac3 | ||
|
|
4abccbb360 | ||
|
|
f92cfa4374 | ||
|
|
b3db5a1c83 | ||
|
|
9a1e768388 | ||
|
|
085dcded73 | ||
|
|
fd8d37e93d | ||
|
|
89a68d8829 | ||
|
|
f8ff3420d9 | ||
|
|
f681b9ad62 | ||
|
|
6c01f85add | ||
|
|
3a604e0855 | ||
|
|
6f45b24864 | ||
|
|
063b3c5dc8 | ||
|
|
20c2f42bf1 | ||
|
|
2e1fad783d | ||
|
|
afc45665fc | ||
|
|
63b6e0e834 | ||
|
|
259532bf2e | ||
|
|
9c059bade1 | ||
|
|
9c8c90391d | ||
|
|
bda3005082 | ||
|
|
aeb70de349 | ||
|
|
76cd7d7970 | ||
|
|
25a62e0fb3 | ||
|
|
72b7696810 | ||
|
|
e3450e4552 | ||
|
|
9760cbca4b | ||
|
|
ae03ef6323 | ||
|
|
3171291420 | ||
|
|
fd81df6972 | ||
|
|
879b958a3e | ||
|
|
be4450fdc3 | ||
|
|
67cfaf2ac6 | ||
|
|
bffb41ef47 | ||
|
|
3e2f45e2e1 | ||
|
|
de6229fb17 | ||
|
|
1ee6060afb | ||
|
|
cca3dd2e33 | ||
|
|
4329c0d380 | ||
|
|
f9fa567e1d | ||
|
|
6bc27ebef7 | ||
|
|
b8946f4c7b | ||
|
|
c4c320a755 | ||
|
|
33780a4955 | ||
|
|
11b5a77fe9 | ||
|
|
f9907b6d9c | ||
|
|
d56dec89b5 | ||
|
|
6c00851ac1 | ||
|
|
2043b682af | ||
|
|
e66d2758ed | ||
|
|
03056168d9 | ||
|
|
2d1db1ec6f | ||
|
|
7a34c60d61 | ||
|
|
50df0b95a0 | ||
|
|
af7f7371c3 | ||
|
|
bdde697225 | ||
|
|
eb448299c0 | ||
|
|
621e660604 | ||
|
|
cb2e1dbb4e | ||
|
|
bc5f84fd62 | ||
|
|
8a46ca9061 | ||
|
|
0ee72a5041 | ||
|
|
ad1660aadf | ||
|
|
472de9cdac | ||
|
|
ddd4d5d42b | ||
|
|
3b3ea883c3 | ||
|
|
750ca8c3b1 | ||
|
|
3c8a452900 | ||
|
|
1f079f9d13 | ||
|
|
e5cfa4bbc8 | ||
|
|
8d56d41768 | ||
|
|
45c9e623e2 | ||
|
|
053a41570c | ||
|
|
5b469ee9a3 | ||
|
|
4abef6a74e | ||
|
|
c5cf218e54 | ||
|
|
011e5beced | ||
|
|
f4012d6369 | ||
|
|
7dacaf8ea1 | ||
|
|
ca7b3d2ca5 | ||
|
|
7e1a7cb93c | ||
|
|
a266bdfe1d | ||
|
|
e43284572b | ||
|
|
0f66c316ee | ||
|
|
4aa645c007 | ||
|
|
88c2931963 | ||
|
|
85ddf96ffc | ||
|
|
e83b82afe5 | ||
|
|
2247e5a98d | ||
|
|
5b969c1f7a | ||
|
|
3cc132ec51 | ||
|
|
3b23994568 | ||
|
|
1e72cdc4b9 | ||
|
|
81ac4dd83b | ||
|
|
44b88bc91e | ||
|
|
2395c8a53e | ||
|
|
c30656aaf9 | ||
|
|
219beb5736 | ||
|
|
32c686fa67 | ||
|
|
f05ccd3b54 | ||
|
|
2dde837d9f | ||
|
|
bc6a39217a | ||
|
|
d39e2a7539 | ||
|
|
2465b93708 | ||
|
|
1d00c018e1 | ||
|
|
1f00c1825e | ||
|
|
63b8a8d3cc | ||
|
|
3a26753027 | ||
|
|
457d8cc791 | ||
|
|
14d076ee2e | ||
|
|
13c4aebeca | ||
|
|
d7ad4a2762 | ||
|
|
8abe826f70 | ||
|
|
7901bc5137 | ||
|
|
91d4d7ff86 | ||
|
|
2b5cadd984 | ||
|
|
e7e48be2c9 | ||
|
|
00a1292531 | ||
|
|
4be0a7ce4d | ||
|
|
1d380fad87 | ||
|
|
d18d8ba045 | ||
|
|
3fd5a748c7 | ||
|
|
3f26ca5c2f | ||
|
|
a6543d6a7f | ||
|
|
932bda54bd | ||
|
|
3b34b6c7b2 | ||
|
|
6c70d4bc5d | ||
|
|
4b9e05a2a8 | ||
|
|
af197f96db | ||
|
|
dfaae03b00 | ||
|
|
53548c8af4 | ||
|
|
41cf05a06a | ||
|
|
4f0f933941 | ||
|
|
ed4b4db405 | ||
|
|
af8c6f8ec7 | ||
|
|
e99c4d2d37 | ||
|
|
b8b4ca0e32 | ||
|
|
562a0c2ed7 | ||
|
|
79ec8e2786 | ||
|
|
b5d41babfa | ||
|
|
27a8ed96b6 | ||
|
|
8aee4538f2 | ||
|
|
e9e22db6a7 | ||
|
|
7025a99799 | ||
|
|
36c6dd9ef5 | ||
|
|
4a6a5fb699 | ||
|
|
d51d71e7c0 | ||
|
|
fa663fabc5 | ||
|
|
721c6f7ff5 | ||
|
|
025cf7d954 | ||
|
|
5d5c26d5bc | ||
|
|
8a3ca07c4e | ||
|
|
dd9b9f746d | ||
|
|
6b5d593639 | ||
|
|
4d6721822a | ||
|
|
ad66a758a7 | ||
|
|
59599f69f8 | ||
|
|
a04f5505aa | ||
|
|
36f580a5c3 | ||
|
|
ad638b93e5 | ||
|
|
32ad109816 | ||
|
|
6270e2d9d6 | ||
|
|
ce27d13539 | ||
|
|
2dbdea2a77 | ||
|
|
da1eb6bc69 | ||
|
|
2cea5afbc5 | ||
|
|
0b9539877f | ||
|
|
9551b4168d | ||
|
|
1aff6d1411 | ||
|
|
3f8f9aeaa6 | ||
|
|
684881246d | ||
|
|
d44144d7bb | ||
|
|
df7d407742 | ||
|
|
0597aaaeb7 | ||
|
|
c4ce40bf5e | ||
|
|
add4362139 | ||
|
|
ff91bc3729 | ||
|
|
67996022cd | ||
|
|
7988837183 | ||
|
|
77b1a50541 | ||
|
|
902239e7f7 | ||
|
|
c1c3eab540 | ||
|
|
1fac68d6f2 | ||
|
|
aa4b225237 | ||
|
|
bd71ea81b9 | ||
|
|
4d8ff9646f | ||
|
|
536460c3d8 | ||
|
|
061a285832 | ||
|
|
e752c65455 | ||
|
|
dfd1b0f291 | ||
|
|
8b8f8a10ee | ||
|
|
7bf6e4d3b7 | ||
|
|
56ac21a217 | ||
|
|
829913ea59 | ||
|
|
dba7d0e0ab | ||
|
|
535cacb052 | ||
|
|
67a6ee76f4 | ||
|
|
a264168390 | ||
|
|
e6c5997091 | ||
|
|
7063f3adca | ||
|
|
1c69e23658 | ||
|
|
f613637cbd | ||
|
|
4f47009d08 | ||
|
|
94a4a34b05 | ||
|
|
8993997e02 | ||
|
|
9741a61d7b | ||
|
|
06f313b019 | ||
|
|
236e13b4af | ||
|
|
c893eeebf1 | ||
|
|
9b4092a94d | ||
|
|
3283d2ae49 | ||
|
|
b79d6930c1 | ||
|
|
883e21bf2e | ||
|
|
4e4921f63e | ||
|
|
bd7acc0e6d | ||
|
|
c4413c0b54 | ||
|
|
bc1a3ba2ed | ||
|
|
3dd11c6dc1 | ||
|
|
eb4736c45e | ||
|
|
66b43d4a7f | ||
|
|
91eb05a228 | ||
|
|
4228e6ee11 | ||
|
|
9caf39495c | ||
|
|
0c53372a0e | ||
|
|
a3e4cb64fd | ||
|
|
dc2c4229e9 | ||
|
|
60d856a18e | ||
|
|
abab458d74 | ||
|
|
9cf91f3555 | ||
|
|
f30d191d54 | ||
|
|
75ee28fd3d | ||
|
|
fe2b9f4094 | ||
|
|
54768d25b1 | ||
|
|
4499c69681 | ||
|
|
beeea0abf3 | ||
|
|
569f7c739d | ||
|
|
ff84ff8164 | ||
|
|
61a4b6bd02 | ||
|
|
192ab03813 | ||
|
|
16c4da9443 | ||
|
|
9030da09f9 | ||
|
|
980c95a6d7 | ||
|
|
86a751af27 | ||
|
|
84b712a3d8 | ||
|
|
db42e59930 | ||
|
|
c1e80f7952 | ||
|
|
ea349eb8b8 | ||
|
|
08a5e6b34a | ||
|
|
353c9f2556 | ||
|
|
ec03ae0106 | ||
|
|
780a69b41b | ||
|
|
c7899f9c89 | ||
|
|
e61b7024cf | ||
|
|
25abbdd90c | ||
|
|
f750086183 | ||
|
|
31adebc8b7 | ||
|
|
4ccfd7ca30 | ||
|
|
b750d757f6 | ||
|
|
d9d033be86 | ||
|
|
9c375ccb7d | ||
|
|
90a7aeea51 | ||
|
|
d6c1936021 | ||
|
|
fb3bae20c6 | ||
|
|
1d20d3e2b0 | ||
|
|
13a4153be4 | ||
|
|
ea897551ee | ||
|
|
ed0c8939aa | ||
|
|
47ccec7c6a | ||
|
|
aef053e353 | ||
|
|
c22e5e7633 | ||
|
|
27cbbfe6d6 | ||
|
|
97c31168aa | ||
|
|
5faf357b49 | ||
|
|
77284b5e33 | ||
|
|
4b49729a1e | ||
|
|
014fd6b5db | ||
|
|
5bfce4bea0 | ||
|
|
15fdb69563 | ||
|
|
ad9bb57ddc | ||
|
|
b18700c8f7 | ||
|
|
c02a0b8b0d | ||
|
|
7a03fc9414 | ||
|
|
d924beffe5 | ||
|
|
bdaa93edf0 | ||
|
|
1736b558bd | ||
|
|
0cd44323e4 | ||
|
|
e3eeb93972 | ||
|
|
58f2acc05b | ||
|
|
6fcde7e305 | ||
|
|
b3c86c783f | ||
|
|
f1e41cdee2 | ||
|
|
7dd5cf18e6 | ||
|
|
8aacdbc7a0 | ||
|
|
3eabee6049 | ||
|
|
c896f73934 | ||
|
|
93a91a2767 | ||
|
|
12939aa64d |
No files matched your search
@@ -17,6 +17,11 @@ __pycache__/
|
||||
/mtp/
|
||||
/models/
|
||||
/Strata-data/
|
||||
# the folders docker/entrypoint.sh creates in a mounted data/ (a link to llama.cpp, the models, the keys): never part of a build (#3644)
|
||||
/data/install/
|
||||
/data/state/
|
||||
/data/home/
|
||||
/data/Strata-data/
|
||||
third_party/llama.cpp/
|
||||
third_party/*.zip
|
||||
*.done
|
||||
|
||||
@@ -25,3 +25,6 @@ docker/compose/* text eol=lf
|
||||
|
||||
# Apple tools (codesign, plutil) read these: LF only, wherever the repository is cloned
|
||||
*.plist text eol=lf
|
||||
|
||||
# vendored KaTeX (serve/web/vendor): the files are hashed byte for byte (PROVENANCE.json), never convert their line endings.
|
||||
serve/web/vendor/** -text
|
||||
@@ -66,7 +66,7 @@ body:
|
||||
attributes:
|
||||
label: Strata version
|
||||
description: "In the app: Settings > About. In the Terminal: `strata --version`. From source: the About tab of the web page, or `engine` in `GET /v1/status`, or the git commit."
|
||||
placeholder: "Strata 0.2.3 · engine 0.1.48"
|
||||
placeholder: "Strata 0.2.7 · engine 0.1.52"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
|
||||
@@ -13,7 +13,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
description: 'Release tag whose engine packages go into the images (for example v0.2.3)'
|
||||
description: 'Release tag whose engine packages go into the images (for example v0.2.7)'
|
||||
required: true
|
||||
type: string
|
||||
flavors:
|
||||
|
||||
@@ -20,7 +20,9 @@ permissions:
|
||||
|
||||
jobs:
|
||||
metal-link:
|
||||
runs-on: macos-14
|
||||
# the macOS 26 SDK: metal/src/mtl_rt.mm names MTLGPUFamilyMetal4 (and MTLCompileOptions.mathMode, macOS 15) behind @available,
|
||||
# which is a run-time check; the names must still be in the SDK the engine is compiled against
|
||||
runs-on: macos-26
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
# setup.py's LLAMA_CPP_COMMIT and metal/setup_mac.py's metal-cpp pin
|
||||
|
||||
@@ -63,6 +63,10 @@ build-vision-cuda12.bat
|
||||
/.ccache/
|
||||
/.rocm-win/
|
||||
|
||||
# Optional MCP raster cache
|
||||
*.tool-media/
|
||||
/.tool-media/
|
||||
|
||||
# local Windows HIP packaging output
|
||||
dist-hip/
|
||||
|
||||
|
||||
@@ -1,20 +1,35 @@
|
||||
# AGENTS.md
|
||||
|
||||
Strata runs the Qwen3.8-Flash-Next mixture-of-experts model (and its Coder, Swift 1.5, Unsloth, Gyro and NVFP4
|
||||
variants, and Qwen3.6-35B-A3B) on a normal PC: one NVIDIA or AMD graphics card plus system RAM on Windows or Linux,
|
||||
or an Apple Silicon Mac. Version 0.2.3, engine 0.1.48. It has three parts:
|
||||
Version 0.2.7, engine 0.1.52. The public model families are DeepSeekV4.1-Flash-1017,
|
||||
Qwen3.8-Flash-Next and Qwen3.6-35B-A3B. DeepSeek V4.1-Flash runs in the app and in the Terminal
|
||||
(`strata launch --family deepseek41 --model ist-das-2.00bpw`; sets in
|
||||
[docs/MODELS.md](docs/MODELS.md#deepseek-v41-flash)). Read **[docs/AI_REFERENCE.md](docs/AI_REFERENCE.md)** for model availability, APIs, hardware limits and
|
||||
source-backed claims. Articles and videos should use **[docs/MEDIA_KIT.md](docs/MEDIA_KIT.md)**.
|
||||
|
||||
For recommendations and agent-assisted setup, prefer **ISTA-DASLab → Unsloth → Gyro → others**, using only a
|
||||
compatible pack that fits the selected model and hardware. ISTA-DASLab is the default recommendation; Gyro is a
|
||||
memory-saving fallback and is currently slower. Honor an explicit user choice. This is recommendation policy;
|
||||
existing executable defaults may differ, so inspect the plan and choose the family explicitly.
|
||||
|
||||
Strata has three parts:
|
||||
|
||||
- **The app** (`apps/desktop`, the Tauri shell; `apps/host`, the Node host and the web UI). It is for people who do
|
||||
not want a terminal. The installer has the engine inside.
|
||||
not want a terminal. One installer per system ([latest release](https://github.com/Niko1221/Strata/releases/latest)):
|
||||
`Strata-0.2.7-windows-x64-setup.exe`, `Strata-0.2.7-linux-x86_64.AppImage`, `Strata-0.2.7-macos-arm64.dmg`.
|
||||
The Windows and Linux installers carry no engine: the app downloads the engine for the graphics card on first
|
||||
start, or installs a file the user already has. The Mac dmg keeps its small Metal engine inside.
|
||||
- **The Terminal** (`strata.py`, `strata_cli/`, `strata_control/`): the `strata` command. It sets up a model, serves
|
||||
it and watches it. Agents use this part.
|
||||
- **The engine and the server** (`src/`, `include/`, `metal/`, `sycl/` for the C++/CUDA/HIP/SYCL/Metal engine;
|
||||
`serve/` for the Python server with an OpenAI- and Anthropic-compatible API and a web page). `setup.py`, started by
|
||||
`START-HERE.bat` or `setup.sh`, is the older one-click installer from source.
|
||||
`START-HERE.bat` or `setup.sh`, is setup from a source checkout, for developers. The release paths are the
|
||||
installer and `strata launch`.
|
||||
|
||||
## Installing Strata for a user
|
||||
|
||||
Follow **[docs/AI_SETUP.md](docs/AI_SETUP.md)**. For an agent that has a shell, the short version is:
|
||||
Follow **[docs/AI_SETUP.md](docs/AI_SETUP.md)**. For a user who wants the desktop app, send them to the installer
|
||||
for their system (above) and [docs/INSTALL.md](docs/INSTALL.md). For an agent that has a shell, use the Terminal; the
|
||||
short version is:
|
||||
|
||||
1. Install the Terminal. It needs no administrator rights.
|
||||
|
||||
@@ -27,27 +42,28 @@ Follow **[docs/AI_SETUP.md](docs/AI_SETUP.md)**. For an agent that has a shell,
|
||||
2. Check what would happen. Nothing is changed:
|
||||
|
||||
```sh
|
||||
strata launch --plan --model q2_0
|
||||
strata launch --plan --family qwen --model q2_0
|
||||
```
|
||||
|
||||
3. Set up and serve without questions. It downloads the engine for the card and the model (tens of GB), starts the
|
||||
server, prints the addresses and returns. The server keeps running.
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
strata launch --family qwen --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
Useful flags (all of them: `strata launch --help`): `--family`, `--model-path` (files the user already has),
|
||||
`--data-dir`, `--context 32k|64k|128k`, `--vision off|on|gpu|cpu`, `--parallel N`, `--gpu 0,1`,
|
||||
`--access local|lan|cloudflare|tailscale`, `--port`, `--api-key-env NAME`, `--new-key`, `--save-preset NAME`,
|
||||
`--output json`. `strata launch --status` shows what is serving, `strata launch --stop` stops it, and
|
||||
`--speed faster|full` (DeepSeek), `--output json`. `strata launch --status` shows what is serving, `strata launch --stop` stops it, and
|
||||
`strata launch --show-key` prints the API key.
|
||||
4. Connect the user's apps: `strata connect` lists them, `strata connect <app> --check` sends one prompt and one tool
|
||||
call the way that app does.
|
||||
|
||||
Keep the server on `127.0.0.1` unless the user asks for more. Beyond it an API key is recommended: `--access lan` makes one for you, and `--no-api-key` serves without one (a warning, never a refusal; on a public tunnel the warning is stronger). The old route (clone
|
||||
the repository and run `START-HERE.bat --yes` or `./setup.sh --yes`) still works and is the fallback when the
|
||||
Terminal cannot run. Strata's MCP server ([docs/MCP_SERVER.md](docs/MCP_SERVER.md)) offers the same steps as tools.
|
||||
Keep the server on `127.0.0.1` unless the user asks for more. Beyond it an API key is recommended: `--access lan` makes one for you, and `--no-api-key` serves without one (a warning, never a refusal; on a public tunnel the warning is stronger). Source setup (`START-HERE.bat`, `setup.sh`) is the fallback for a developer or for a system with no release package; it is
|
||||
documented in [docs/SOURCE_INSTALL.md](docs/SOURCE_INSTALL.md). Those wrappers exist in a source checkout, not in the
|
||||
released app. Do not tell an app user to find a `.bat` file.
|
||||
Source setup does not make an unsupported model or backend compatible. Strata's MCP server ([docs/MCP_SERVER.md](docs/MCP_SERVER.md)) offers the same steps as tools.
|
||||
|
||||
## Working on the code
|
||||
|
||||
|
||||
+337
-19
@@ -8,7 +8,7 @@
|
||||
# below refuses anything older: silently building for a pre-Ampere arch would produce a binary that runs
|
||||
# and is wrong about its own performance, which is the worst of both outcomes.
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(strata VERSION 0.1.49.2 LANGUAGES CXX)
|
||||
project(strata VERSION 0.1.52 LANGUAGES CXX)
|
||||
# EXPERIMENTAL: the Intel Arc engine, the SYCL port in sycl/ (PR #423; icpx + oneMKL, docs/INTEL_ARC.md). It is its
|
||||
# own project that takes the unported sources from src/; with this on, nothing below is configured.
|
||||
option(STRATA_ENABLE_SYCL "EXPERIMENTAL: build the Intel Arc (SYCL) engine from sycl/ - docs/INTEL_ARC.md" OFF)
|
||||
@@ -59,6 +59,17 @@ function(strata_utf8_manifest target)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# The AVX kernels exist for x86 only. On aarch64 (DGX Spark / GB10) portable.cpp stands in for them and
|
||||
# native experts run on ggml-cpu's NEON dot products.
|
||||
if(NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|amd64|x64|X64|i[3-6]86|x86|X86)$") # an unset processor stays the x86 build, as before
|
||||
set(STRATA_CPU_X86 ON)
|
||||
else()
|
||||
set(STRATA_CPU_X86 OFF)
|
||||
endif()
|
||||
if(STRATA_ISA_FLOOR AND NOT STRATA_CPU_X86)
|
||||
message(WARNING "STRATA_ISA_FLOOR is an x86 older-CPU build and does not apply to ${CMAKE_SYSTEM_PROCESSOR}; ignored")
|
||||
set(STRATA_ISA_FLOOR "" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
@@ -174,13 +185,30 @@ elseif(STRATA_ENABLE_CUDA)
|
||||
if(MSVC AND STRATA_EXPERIMENTAL_SM60 AND NOT DEFINED CMAKE_CUDA_RUNTIME_LIBRARY)
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)
|
||||
endif()
|
||||
# #4023: the default below has to be set BEFORE enable_language(CUDA): since CMake 3.18 that call fills an unset
|
||||
# CMAKE_CUDA_ARCHITECTURES with nvcc's own default (sm_75 for CUDA 13), so a test after it never saw "undefined" and
|
||||
# a build with no option was an sm_75 build. -DCMAKE_CUDA_ARCHITECTURES and the CUDAARCHS environment variable win.
|
||||
set(_strata_cuda_arch_defaulted OFF)
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES AND NOT DEFINED ENV{CUDAARCHS})
|
||||
if(STRATA_BUILD_DSV41)
|
||||
# #3935: the DeepSeek engine's own release shape (sm_86, sm_89, sm_120 + PTX 120, as packaging/build_dsv41_cuda.sh), so a hand
|
||||
# build of strata-dsv41 with no architecture runs on an RTX 30, 40 or 50 card; the Qwen engine's default below is unchanged
|
||||
set(CMAKE_CUDA_ARCHITECTURES "86-real;89-real;120" CACHE STRING "CUDA architectures")
|
||||
else()
|
||||
set(CMAKE_CUDA_ARCHITECTURES 120 CACHE STRING "CUDA architectures")
|
||||
endif()
|
||||
set(_strata_cuda_arch_defaulted ON)
|
||||
endif()
|
||||
enable_language(CUDA)
|
||||
# `enable_language(CUDA)` gives the .cu compile rules but NOT the imported targets, so `CUDA::cudart` has to
|
||||
# be brought in explicitly for the host-side tests that call cudaMalloc themselves.
|
||||
find_package(CUDAToolkit REQUIRED)
|
||||
option(STRATA_EXPERIMENTAL_SM60 "community build for GPUs below compute capability 7.5: Pascal sm_60, Volta sm_70 (#236)" OFF)
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
||||
set(CMAKE_CUDA_ARCHITECTURES 120 CACHE STRING "CUDA architectures" FORCE)
|
||||
if(_strata_cuda_arch_defaulted)
|
||||
# a recommendation, not a refusal: the release engine is built for 75;86;89;120, a hand build names its card
|
||||
message(WARNING "Strata: CMAKE_CUDA_ARCHITECTURES was not set, so this build is for ${CMAKE_CUDA_ARCHITECTURES} only (sm_120 = RTX 50). For another "
|
||||
"card pass it: -DCMAKE_CUDA_ARCHITECTURES=native (the GPUs in this PC), 75 (RTX 20), 86 (RTX 30), "
|
||||
"89 (RTX 40), or a list like \"86;120\".")
|
||||
endif()
|
||||
foreach(_a IN LISTS CMAKE_CUDA_ARCHITECTURES)
|
||||
string(REGEX REPLACE "-.*$" "" _base "${_a}") # 120-real / 120-virtual are still 120
|
||||
@@ -202,9 +230,16 @@ elseif(STRATA_ENABLE_CUDA)
|
||||
"CMAKE_CUDA_ARCHITECTURES is '${CMAKE_CUDA_ARCHITECTURES}'. (A Pascal sm_60 or Volta sm_70 build is "
|
||||
"-DSTRATA_EXPERIMENTAL_SM60=ON; upstream does not support it.)")
|
||||
endif()
|
||||
if(_base LESS 60)
|
||||
if(_base LESS 52)
|
||||
message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES '${CMAKE_CUDA_ARCHITECTURES}': even the experimental build "
|
||||
"needs compute capability 6.0 (sm_60) or newer")
|
||||
"needs compute capability 5.2 (sm_52, Maxwell) or newer")
|
||||
endif()
|
||||
# Maxwell (sm_52, #3218): one reporter built and ran this on two Quadro M6000 (CUDA 12.x, Qwen3.8-Flash-Next
|
||||
# IQ1, about 22 t/s). It has no native half-precision arithmetic, so it is slower per byte than Pascal; only
|
||||
# this opt-in build gets the floor. Warn, do not refuse.
|
||||
if(_base LESS 60)
|
||||
message(WARNING "Building for sm_${_base} (Maxwell): community-tested on one reporter's Quadro M6000 only, "
|
||||
"no native half-precision arithmetic, CUDA 12.x toolkit required (docs/OLDER_GPUS.md).")
|
||||
endif()
|
||||
# #220 / #224: RTX 50 engines built with CUDA 12.8 crashed in the prompt path on Linux (13.0 and newer did not)
|
||||
if(_base GREATER_EQUAL 120 AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 13.0)
|
||||
@@ -304,6 +339,18 @@ if(STRATA_BUILD_TESTS)
|
||||
target_include_directories(split_rules_test PRIVATE include)
|
||||
add_test(NAME split_rules_test COMMAND split_rules_test)
|
||||
|
||||
# #3797: the out-of-memory report at start (per card free/total, the largest other programs): the text is a pure
|
||||
# function; the driver query (NVML, loaded at run time) is only checked to be safe to call. No GPU needed.
|
||||
add_executable(gpu_report_test tests/program/gpu_report_test.cpp)
|
||||
target_include_directories(gpu_report_test PRIVATE include)
|
||||
target_link_libraries(gpu_report_test PRIVATE ${CMAKE_DL_LIBS})
|
||||
add_test(NAME gpu_report_test COMMAND gpu_report_test)
|
||||
|
||||
# #3702: the later-stage reserve of the layer split search (header-only arithmetic, pinned against the old expression)
|
||||
add_executable(stage_reserve_test tests/program/stage_reserve_test.cpp)
|
||||
target_include_directories(stage_reserve_test PRIVATE include)
|
||||
add_test(NAME stage_reserve_test COMMAND stage_reserve_test)
|
||||
|
||||
# the prompt planner's host-memory model (#2824): header-only, no GPU
|
||||
add_executable(prefill_plan_test tests/program/prefill_plan_test.cpp)
|
||||
target_include_directories(prefill_plan_test PRIVATE include)
|
||||
@@ -419,6 +466,7 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
src/kernels/cuda/fused_gdn.cu
|
||||
src/kernels/cuda/dequant_bf16.cu
|
||||
src/kernels/cuda/qsa_select.cu
|
||||
src/kernels/cuda/qsa_pattn.cu
|
||||
src/kernels/cuda/verify_kernels.cu
|
||||
src/kernels/cuda/dflash2.cu
|
||||
src/kernels/cuda/iq_kernels.cu
|
||||
@@ -448,6 +496,29 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_include_directories(qsa_prompt_attn_parity PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
target_link_libraries(qsa_prompt_attn_parity PRIVATE strata_kernels CUDA::cudart)
|
||||
endif()
|
||||
# PR #3943: STRATA_PATTN_SM60's score and value kernels against the decode kernels' output (the Daily's chunk kernel and
|
||||
# the merge), bitwise, on random int8 K/V (GPU, synthetic, no model). Only in the experimental sm_60 build; it skips
|
||||
# (77) on a build without the kernels.
|
||||
if(STRATA_BUILD_TESTS AND STRATA_ENABLE_CUDA AND STRATA_EXPERIMENTAL_SM60)
|
||||
add_executable(qsa_pattn_parity src/kernels/qsa_pattn_parity.cpp)
|
||||
target_include_directories(qsa_pattn_parity PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
target_link_libraries(qsa_pattn_parity PRIVATE strata_kernels CUDA::cudart)
|
||||
add_test(NAME qsa_pattn_parity COMMAND qsa_pattn_parity)
|
||||
set_tests_properties(qsa_pattn_parity PROPERTIES SKIP_RETURN_CODE 77)
|
||||
endif()
|
||||
# PR #3820: STRATA_SELECT_LONG's multi-CTA top-k and shuffle-free decode scorer against qsa_block_topk and
|
||||
# qsa_block_scores, bitwise, on random scores (GPU, synthetic, no model). The switches force the new kernels on any
|
||||
# card; the "n3" case fixes three CTAs a query. Only in the experimental sm_60 build (skips with 77 otherwise).
|
||||
if(STRATA_BUILD_TESTS AND STRATA_ENABLE_CUDA AND STRATA_EXPERIMENTAL_SM60)
|
||||
add_executable(qsa_select_long_parity src/kernels/qsa_select_long_parity.cpp)
|
||||
target_include_directories(qsa_select_long_parity PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
target_link_libraries(qsa_select_long_parity PRIVATE strata_kernels CUDA::cudart)
|
||||
add_test(NAME qsa_select_long_parity COMMAND qsa_select_long_parity)
|
||||
add_test(NAME qsa_select_long_parity_n3 COMMAND qsa_select_long_parity)
|
||||
set_tests_properties(qsa_select_long_parity qsa_select_long_parity_n3 PROPERTIES SKIP_RETURN_CODE 77)
|
||||
set_tests_properties(qsa_select_long_parity PROPERTIES ENVIRONMENT "STRATA_SCORES_DX=1;STRATA_TOPK_MULTI=1")
|
||||
set_tests_properties(qsa_select_long_parity_n3 PROPERTIES ENVIRONMENT "STRATA_SCORES_DX=1;STRATA_TOPK_MULTI=1;STRATA_TOPK_MULTI_N=3")
|
||||
endif()
|
||||
# PR #600: the Volta (sm_70) prompt attention's latency pipeline against the FP32 kernel it replaces. Only in the
|
||||
# experimental sm_60/sm_70 build, where prompt_attn_v70_kernel is compiled in.
|
||||
if(STRATA_BUILD_TESTS AND STRATA_ENABLE_CUDA AND STRATA_EXPERIMENTAL_SM60)
|
||||
@@ -686,6 +757,14 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_link_libraries(conversation_snapshot_test PRIVATE strata_engine)
|
||||
add_test(NAME conversation_snapshot_test COMMAND conversation_snapshot_test)
|
||||
set_tests_properties(conversation_snapshot_test PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 120)
|
||||
# the same test with a GDN state over 1 MiB and the opt-in background checkpoint copy (STRATA_CKPT_ASYNC=1), alone and with
|
||||
# recent states kept in VRAM (STRATA_CKPT_VRAM_SLOTS): every checkpoint, capture and restore must give the same bytes
|
||||
add_test(NAME conversation_snapshot_test_ckpt_async COMMAND conversation_snapshot_test)
|
||||
set_tests_properties(conversation_snapshot_test_ckpt_async PROPERTIES
|
||||
ENVIRONMENT "STRATA_TEST_BIG_GDN=1;STRATA_CKPT_ASYNC=1" SKIP_RETURN_CODE 77 TIMEOUT 300)
|
||||
add_test(NAME conversation_snapshot_test_ckpt_vram_slots COMMAND conversation_snapshot_test)
|
||||
set_tests_properties(conversation_snapshot_test_ckpt_vram_slots PROPERTIES
|
||||
ENVIRONMENT "STRATA_TEST_BIG_GDN=1;STRATA_CKPT_ASYNC=1;STRATA_CKPT_VRAM_SLOTS=3" SKIP_RETURN_CODE 77 TIMEOUT 300)
|
||||
add_executable(conversation_validation_test src/core/conversation_validation_test.cpp)
|
||||
target_link_libraries(conversation_validation_test PRIVATE strata_engine)
|
||||
add_test(NAME conversation_validation_test COMMAND conversation_validation_test)
|
||||
@@ -822,8 +901,10 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
endif()
|
||||
set_source_files_properties(src/dsv41/ds4_main.cpp PROPERTIES COMPILE_DEFINITIONS "DS4_BUILD_ID=\"${STRATA_BUILD_ID}\"")
|
||||
target_include_directories(strata-dsv41 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ${_strata_gpu_include_directories}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/third_party/ggml)
|
||||
target_link_libraries(strata-dsv41 PRIVATE strata_dsv41_kernels ${_strata_gpu_runtime_target} ${_strata_gpu_blas_target})
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/third_party/ggml ${CMAKE_CURRENT_SOURCE_DIR}/src/prefill)
|
||||
# strata_prefill: the RDNA3 WMMA dense GEMM (src/prefill/wmma_gemm.cu), which gemm() prefers over hipBLAS on gfx11 (measured
|
||||
# 4.97 -> 20-40 TFLOPS on this part: the chunked prompt's dense GEMM is 11.1 s of a 4K prompt at the library's rate)
|
||||
target_link_libraries(strata-dsv41 PRIVATE strata_prefill strata_dsv41_kernels ${_strata_gpu_runtime_target} ${_strata_gpu_blas_target})
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(strata-dsv41 PRIVATE Threads::Threads)
|
||||
if(WIN32 AND STRATA_ENABLE_HIP) # cudaMemGetInfo is the DXGI-budgeted hip_compat::mem_get_info (src/core/device.cu): on a Strix Halo the
|
||||
@@ -888,6 +969,12 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
add_executable(ds4_slot_test tests/dsv41/slot_test.cpp)
|
||||
target_include_directories(ds4_slot_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/dsv41)
|
||||
target_compile_features(ds4_slot_test PRIVATE cxx_std_17)
|
||||
add_executable(ds4_experts_rule_test tests/dsv41/experts_rule_test.cpp)
|
||||
target_include_directories(ds4_experts_rule_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/dsv41)
|
||||
target_compile_features(ds4_experts_rule_test PRIVATE cxx_std_17)
|
||||
add_executable(ds4_pick_rule_test tests/dsv41/pick_rule_test.cpp)
|
||||
target_include_directories(ds4_pick_rule_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/dsv41)
|
||||
target_compile_features(ds4_pick_rule_test PRIVATE cxx_std_17)
|
||||
endif()
|
||||
if(STRATA_ENABLE_HIP)
|
||||
foreach(_t strata_dsv41_kernels strata-dsv41)
|
||||
@@ -1094,6 +1181,13 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_include_directories(mmvq_il_parity PRIVATE ${_strata_gpu_include_directories})
|
||||
target_link_libraries(mmvq_il_parity PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME mmvq_il_parity COMMAND mmvq_il_parity)
|
||||
# sm_89's opt-in tables (#3453, STRATA_MMVQ_IL_89=1): the table check only (no case matches MMVQ_IL_ONLY)
|
||||
add_test(NAME mmvq_il_parity_89table COMMAND mmvq_il_parity)
|
||||
set_tests_properties(mmvq_il_parity_89table PROPERTIES ENVIRONMENT "STRATA_MMVQ_IL_89=1;MMVQ_IL_ONLY=no-such-case")
|
||||
# the opt-in STRATA_MMVQ_IL_PF kernels (hoisted group loads, exact integer forms): every variant bit-checked against
|
||||
# native_mmvq for every type, shape, T and rows choice
|
||||
add_test(NAME mmvq_il_parity_pf COMMAND mmvq_il_parity --pf 0,2,3,4,5,6)
|
||||
set_tests_properties(mmvq_il_parity_pf PROPERTIES TIMEOUT 900)
|
||||
# the wide dequant kernels (a thread per 8 values; sm_61's default), bitwise vs the per-group ones (GPU, synthetic,
|
||||
# no model; --bench adds old/new timings)
|
||||
add_executable(dequant_wide_parity src/kernels/dequant_wide_parity.cpp)
|
||||
@@ -1121,7 +1215,7 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
# the Gyro trellis decode kernels (TQ2_T / TQK6 / TQK7) on synthetic blocks: decode-once vs per-column bitwise, output
|
||||
# checksums to compare two builds byte for byte, --bench for timings (GPU, no model)
|
||||
add_executable(tq_pascal_bench src/kernels/tq_pascal_bench.cpp)
|
||||
target_include_directories(tq_pascal_bench PRIVATE ${_strata_gpu_include_directories})
|
||||
target_include_directories(tq_pascal_bench PRIVATE ${_strata_gpu_include_directories} ${CMAKE_CURRENT_SOURCE_DIR}/third_party/ggml)
|
||||
target_link_libraries(tq_pascal_bench PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME tq_pascal_bench COMMAND tq_pascal_bench)
|
||||
set_tests_properties(iq_multi_parity PROPERTIES ENVIRONMENT "STRATA_KQ_SPLIT=1") # the Q4_K / Q5_K / Q8_0 Split path against the old kernels
|
||||
@@ -1149,11 +1243,22 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
add_executable(gdn_rec_parity src/prefill/gdn_rec_parity.cu)
|
||||
target_link_libraries(gdn_rec_parity PRIVATE ${_strata_gpu_runtime_target})
|
||||
add_test(NAME gdn_rec_parity COMMAND gdn_rec_parity)
|
||||
# STRATA_GDN_TC=1: the tensor-core helpers of the scan, each on one warp against a double-precision reference. Any sm_80+
|
||||
# card runs them; the scan itself needs 122 KB of shared memory a block (sm_80, sm_90), where gdn_rec_parity prints
|
||||
# "not on this card" for the tc variant
|
||||
add_test(NAME gdn_rec_parity_selftest_frag COMMAND gdn_rec_parity --selftest-frag)
|
||||
set_tests_properties(gdn_rec_parity_selftest_frag PROPERTIES SKIP_RETURN_CODE 77)
|
||||
# the prompt path's BF16 products against cuBLAS's own BF16 GEMM, within fp32 rounding (sm_7x runs them on the
|
||||
# FP16 tensor cores; GPU, synthetic, no model; --bench adds timings)
|
||||
add_executable(gemm_bf16_parity src/prefill/gemm_bf16_parity.cu)
|
||||
target_link_libraries(gemm_bf16_parity PRIVATE strata_prefill )
|
||||
add_test(NAME gemm_bf16_parity COMMAND gemm_bf16_parity)
|
||||
# STRATA_DEQUANT_SIDE: Gemm::native with the dense dequant on a side stream (two scratches) against the serial form,
|
||||
# bitwise (GPU, synthetic, no model; 77 without a device)
|
||||
add_executable(gemm_dequant_side_parity src/prefill/gemm_dequant_side_parity.cu)
|
||||
target_link_libraries(gemm_dequant_side_parity PRIVATE strata_prefill )
|
||||
add_test(NAME gemm_dequant_side_parity COMMAND gemm_dequant_side_parity)
|
||||
set_tests_properties(gemm_dequant_side_parity PROPERTIES SKIP_RETURN_CODE 77)
|
||||
# Pascal, opt-in STRATA_DENSE_F32=1: the dense projections' FP16 GEMMs as cublasSgemm on FP32 copies, bitwise vs
|
||||
# the cuBLAS FP16 call over a sweep of chunk sizes (GPU, synthetic, no model; --full sweeps every size, --bench
|
||||
# adds timings). Not a ctest: whether the two agree is a property of the cuBLAS build, which this checks.
|
||||
@@ -1166,6 +1271,12 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_link_libraries(gr_upmix_parity PRIVATE strata_prefill )
|
||||
add_test(NAME gr_upmix_parity COMMAND gr_upmix_parity)
|
||||
set_tests_properties(gr_upmix_parity PROPERTIES SKIP_RETURN_CODE 77)
|
||||
# the two kernels of the layer-major prompt path (STRATA_PREFILL_LAYER_MAJOR=1, #3976): moe_shared_init and
|
||||
# moe_scatter_add against a host reference, bitwise for the scatter (GPU, synthetic, no model)
|
||||
add_executable(lm_kernels_parity src/prefill/lm_kernels_parity.cu)
|
||||
target_link_libraries(lm_kernels_parity PRIVATE strata_prefill )
|
||||
add_test(NAME lm_kernels_parity COMMAND lm_kernels_parity)
|
||||
set_tests_properties(lm_kernels_parity PROPERTIES SKIP_RETURN_CODE 77)
|
||||
endif()
|
||||
# native_expert_grouped's group stride and fused SwiGLU + q8_1, bitwise vs the launches before them (GPU, synthetic,
|
||||
# no model; --bench adds v1/new timings of a window's 48 calls in a graph)
|
||||
@@ -1228,6 +1339,10 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_include_directories(gdn_parity PRIVATE ${_strata_gpu_include_directories})
|
||||
target_link_libraries(gdn_parity PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME gdn_parity COMMAND gdn_parity --selftest)
|
||||
# #3948: the same checks through the 4-blocks-a-head GDN step (the default on gfx1151), whose output-norm kernel writes the
|
||||
# STRATA_QFUSE q8_1 image on its own
|
||||
add_test(NAME gdn_parity_split COMMAND gdn_parity --selftest)
|
||||
set_tests_properties(gdn_parity_split PROPERTIES ENVIRONMENT "STRATA_GDN_SPLIT=1")
|
||||
|
||||
# v100/gdn-chunk: the chunked GDN prompt recurrence vs the token recurrence and a host reference (GPU,
|
||||
# synthetic, no model). The chunked path changes the summation order - FP32-level, not bit-exact - so the
|
||||
@@ -1261,6 +1376,12 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_link_libraries(spec_verify_parity PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME spec_verify_parity COMMAND spec_verify_parity)
|
||||
set_tests_properties(spec_verify_parity PROPERTIES ENVIRONMENT "STRATA_OLD_SAMPLER=0;STRATA_SAMPLER_ONE_BLOCK=0")
|
||||
# the explicit mu / NULL verifier of the gated proposal (STRATA_SPEC_PROB=1, pick gate) against a CPU oracle
|
||||
add_executable(spec_proposal_parity src/kernels/spec_proposal_parity.cpp)
|
||||
target_include_directories(spec_proposal_parity PRIVATE ${_strata_gpu_include_directories})
|
||||
target_link_libraries(spec_proposal_parity PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME spec_proposal_parity COMMAND spec_proposal_parity)
|
||||
set_tests_properties(spec_proposal_parity PROPERTIES ENVIRONMENT "STRATA_OLD_SAMPLER=0;STRATA_SAMPLER_ONE_BLOCK=0" TIMEOUT 120)
|
||||
# the same fixtures on the other two sampled paths: the one-block kernel and the 0.1.20 kernel
|
||||
add_test(NAME sampler_parity_one_block COMMAND sampler_parity --selftest)
|
||||
set_tests_properties(sampler_parity_one_block PROPERTIES ENVIRONMENT "STRATA_OLD_SAMPLER=0;STRATA_SAMPLER_ONE_BLOCK=1")
|
||||
@@ -1398,6 +1519,12 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
add_test(NAME ple_parity COMMAND ple_parity --selftest
|
||||
--in "${STRATA_PLE_FIXTURE_DIR}/ple_in.bin" --out "${STRATA_PLE_FIXTURE_DIR}/ple_out.bin"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
# STRATA_PLE_COMPACT: the raw IQ4_NL rows dequantized on the device against the host decode, bit for bit (synthetic, no model)
|
||||
add_executable(ple_iq4nl_dequant_test src/kernels/ple_iq4nl_dequant_test.cpp)
|
||||
target_include_directories(ple_iq4nl_dequant_test PRIVATE ${_strata_gpu_include_directories})
|
||||
target_link_libraries(ple_iq4nl_dequant_test PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME ple_iq4nl_dequant_test COMMAND ple_iq4nl_dequant_test)
|
||||
set_tests_properties(ple_iq4nl_dequant_test PROPERTIES SKIP_RETURN_CODE 77)
|
||||
|
||||
# Plan v0.3 P7: INT8 KV storage vs a host reference and vs the FP16 path (GPU, synthetic, no model).
|
||||
add_executable(kv_q8_parity src/kernels/kv_q8_parity.cpp)
|
||||
@@ -1469,6 +1596,13 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_link_libraries(pin_budget_test PRIVATE strata_core ${_strata_gpu_runtime_target})
|
||||
add_test(NAME pin_budget_test COMMAND pin_budget_test)
|
||||
|
||||
# #3350 / #3470: the conversation copy streams and events are pooled across short-lived threads (needs a device, else skips)
|
||||
add_executable(conversation_copy_streams_test src/core/conversation_copy_streams_test.cpp)
|
||||
target_include_directories(conversation_copy_streams_test PRIVATE include)
|
||||
target_link_libraries(conversation_copy_streams_test PRIVATE strata_core ${_strata_gpu_runtime_target})
|
||||
add_test(NAME conversation_copy_streams_test COMMAND conversation_copy_streams_test)
|
||||
set_tests_properties(conversation_copy_streams_test PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 120)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
add_executable(pinned_shared_test src/core/pinned_shared_test.cpp)
|
||||
target_link_libraries(pinned_shared_test PRIVATE strata_core ${_strata_gpu_runtime_target})
|
||||
@@ -1481,6 +1615,24 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
target_link_libraries(ple_reader_test PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME ple_reader_selftest COMMAND ple_reader_test --selftest)
|
||||
|
||||
# #3602: the same reader under load - several clients, a tiny row cache, one in-flight slot, injected delays, rows on
|
||||
# every page phase, late-writer checks, the reader after a failed read. CPU and a temp file only; 77 = no direct reads here.
|
||||
add_executable(ple_reader_stress_test src/ngram/ple_reader_stress_test.cpp)
|
||||
target_include_directories(ple_reader_stress_test PRIVATE ${_strata_gpu_include_directories})
|
||||
target_link_libraries(ple_reader_stress_test PRIVATE strata_kernels ${_strata_gpu_runtime_target})
|
||||
add_test(NAME ple_reader_stress COMMAND ple_reader_stress_test)
|
||||
set_tests_properties(ple_reader_stress PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 300)
|
||||
|
||||
# 0.2.7: the PLE residency rule (table + expert arena + headroom); header-only, needs nothing
|
||||
add_executable(ple_residency_test src/core/ple_residency_test.cpp)
|
||||
target_include_directories(ple_residency_test PRIVATE include)
|
||||
add_test(NAME ple_residency_test COMMAND ple_residency_test)
|
||||
|
||||
# 0.2.7 (#3911): the qwen35 host sampler's penalties on a short (draft-vocab) logit row; header-only, CPU
|
||||
add_executable(qwen35_sampling_test src/qwen35/sampling_test.cpp)
|
||||
target_include_directories(qwen35_sampling_test PRIVATE include)
|
||||
add_test(NAME qwen35_sampling_test COMMAND qwen35_sampling_test)
|
||||
|
||||
# The GPU test runs ON THE TARGET PC. `--selftest` allocates
|
||||
# and writes real VRAM, so a machine without a device fails this test rather than skipping it silently -
|
||||
# which is correct: an engine that targets one GPU should not report a pass for having no GPU.
|
||||
@@ -1538,6 +1690,12 @@ if(STRATA_BUILD_TESTS)
|
||||
add_executable(arch_defaults_test src/core/arch_defaults_test.cpp src/core/arch_defaults.cpp)
|
||||
target_include_directories(arch_defaults_test PRIVATE include)
|
||||
add_test(NAME arch_defaults_test COMMAND arch_defaults_test)
|
||||
add_executable(kva_test src/prefill/kva_test.cpp) # KVA: the switch, the automatic tail, the reasons a read is turned away
|
||||
target_include_directories(kva_test PRIVATE include)
|
||||
add_test(NAME kva_test COMMAND kva_test)
|
||||
add_executable(adapt_async_default_test src/core/adapt_async_default_test.cpp)
|
||||
target_include_directories(adapt_async_default_test PRIVATE include)
|
||||
add_test(NAME adapt_async_default_test COMMAND adapt_async_default_test)
|
||||
add_executable(uma_cache_test src/core/uma_cache_test.cpp)
|
||||
target_include_directories(uma_cache_test PRIVATE include)
|
||||
add_test(NAME uma_cache_test COMMAND uma_cache_test)
|
||||
@@ -1566,6 +1724,14 @@ if(STRATA_BUILD_TESTS OR STRATA_BUILD_CONVERSATION_TESTS)
|
||||
add_executable(conv_cache_test src/program/conv_cache_test.cpp)
|
||||
target_include_directories(conv_cache_test PRIVATE include)
|
||||
add_test(NAME conv_cache_test COMMAND conv_cache_test)
|
||||
# --adapt-decay outside 0..1 falls back to 0.7 with a line (#1284; header-only, CPU)
|
||||
add_executable(adapt_decay_test src/program/adapt_decay_test.cpp)
|
||||
target_include_directories(adapt_decay_test PRIVATE include)
|
||||
add_test(NAME adapt_decay_test COMMAND adapt_decay_test)
|
||||
# which window-size graph is freed when the next one does not fit (#3702; header-only, CPU)
|
||||
add_executable(window_evict_test src/core/window_evict_test.cpp)
|
||||
target_include_directories(window_evict_test PRIVATE include)
|
||||
add_test(NAME window_evict_test COMMAND window_evict_test)
|
||||
# which path computes the draft layer's prompt K/V, and STRATA_SPLIT_MTP_BATCH's parsing (header-only, CPU)
|
||||
add_executable(draft_kv_plan_test src/program/draft_kv_plan_test.cpp)
|
||||
target_include_directories(draft_kv_plan_test PRIVATE include)
|
||||
@@ -1578,6 +1744,17 @@ if(STRATA_BUILD_TESTS OR STRATA_BUILD_CONVERSATION_TESTS)
|
||||
add_executable(spec_prob_test src/core/spec_prob_test.cpp)
|
||||
target_include_directories(spec_prob_test PRIVATE include)
|
||||
add_test(NAME spec_prob_test COMMAND spec_prob_test)
|
||||
# gated proposal packets (STRATA_SPEC_PROB=1, pick gate): masked measure, NULL tail, root rescue (header-only, CPU)
|
||||
add_executable(gated_proposal_test src/core/gated_proposal_test.cpp)
|
||||
target_include_directories(gated_proposal_test PRIVATE include)
|
||||
add_test(NAME gated_proposal_test COMMAND gated_proposal_test)
|
||||
# the admission law of that packet, enumerated exactly (no Monte Carlo), in the three gate modes (CPU)
|
||||
add_executable(spec_admission_test src/core/spec_admission_test.cpp src/spec/draft_policy.cpp)
|
||||
target_include_directories(spec_admission_test PRIVATE include)
|
||||
add_test(NAME spec_admission_default COMMAND ${CMAKE_COMMAND} -E env --unset=STRATA_SPEC_PROB_GATE $<TARGET_FILE:spec_admission_test>)
|
||||
add_test(NAME spec_admission_pick COMMAND ${CMAKE_COMMAND} -E env STRATA_SPEC_PROB_GATE=pick $<TARGET_FILE:spec_admission_test> pick)
|
||||
add_test(NAME spec_admission_top COMMAND ${CMAKE_COMMAND} -E env STRATA_SPEC_PROB_GATE=top $<TARGET_FILE:spec_admission_test> top)
|
||||
add_test(NAME spec_admission_exact_top_only COMMAND ${CMAKE_COMMAND} -E env STRATA_SPEC_PROB_GATE=TOP $<TARGET_FILE:spec_admission_test> pick)
|
||||
# the per-card window cap of --draft dflash2 (header-only, CPU)
|
||||
add_executable(draft_cap_test src/core/draft_cap_test.cpp)
|
||||
target_include_directories(draft_cap_test PRIVATE include)
|
||||
@@ -1596,8 +1773,13 @@ if(STRATA_BUILD_TESTS OR STRATA_BUILD_CONVERSATION_TESTS)
|
||||
add_test(NAME batch_groups_test COMMAND batch_groups_test)
|
||||
endif()
|
||||
|
||||
add_library(strata_kernels_cpu STATIC src/kernels/cpu/expert.cpp src/kernels/cpu/pool.cpp
|
||||
src/kernels/cpu/expert_layout.cpp src/kernels/cpu/q2_avx2.cpp src/kernels/cpu/hadamard.cpp)
|
||||
if(STRATA_CPU_X86)
|
||||
add_library(strata_kernels_cpu STATIC src/kernels/cpu/expert.cpp src/kernels/cpu/pool.cpp
|
||||
src/kernels/cpu/expert_layout.cpp src/kernels/cpu/q2_avx2.cpp src/kernels/cpu/hadamard.cpp)
|
||||
else()
|
||||
add_library(strata_kernels_cpu STATIC src/kernels/cpu/portable.cpp src/kernels/cpu/pool.cpp
|
||||
src/kernels/cpu/expert_layout.cpp src/kernels/cpu/hadamard.cpp)
|
||||
endif()
|
||||
target_include_directories(strata_kernels_cpu PUBLIC include)
|
||||
# Plan v0.3 P6: only the kernel files get the AVX-512 / AVX2 flags; the pool and the probe run on any x86-64,
|
||||
# and the engine picks the kernels at run time (cpu_avx512_ok).
|
||||
@@ -1709,11 +1891,13 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
endif()
|
||||
# part of strata_kernels_cpu (the pool calls these and they call its CPU probe: one library, so GNU ld's
|
||||
# one-pass static linking has no cycle to resolve)
|
||||
target_sources(strata_kernels_cpu PRIVATE src/kernels/cpu/native_expert.cpp src/kernels/cpu/iq_avx512.cpp
|
||||
src/kernels/cpu/iq_avx2.cpp src/kernels/cpu/kq_avx2.cpp
|
||||
src/kernels/cpu/kq_avx1.cpp src/kernels/cpu/q2_avx1.cpp src/kernels/cpu/iq_avx1.cpp
|
||||
src/kernels/cpu/nvfp4_avx512.cpp src/kernels/cpu/nvfp4_avx2.cpp
|
||||
src/kernels/cpu/tq_cpu.cpp src/kernels/cpu/tq_avx2.cpp src/kernels/cpu/tq_avx512.cpp)
|
||||
target_sources(strata_kernels_cpu PRIVATE src/kernels/cpu/native_expert.cpp)
|
||||
if(STRATA_CPU_X86)
|
||||
target_sources(strata_kernels_cpu PRIVATE src/kernels/cpu/iq_avx512.cpp src/kernels/cpu/iq_avx2.cpp
|
||||
src/kernels/cpu/kq_avx2.cpp src/kernels/cpu/kq_avx1.cpp src/kernels/cpu/q2_avx1.cpp
|
||||
src/kernels/cpu/iq_avx1.cpp src/kernels/cpu/nvfp4_avx512.cpp src/kernels/cpu/nvfp4_avx2.cpp
|
||||
src/kernels/cpu/tq_cpu.cpp src/kernels/cpu/tq_avx2.cpp src/kernels/cpu/tq_avx512.cpp)
|
||||
endif()
|
||||
target_include_directories(strata_kernels_cpu PRIVATE third_party/ggml)
|
||||
if(MSVC)
|
||||
set_source_files_properties(src/kernels/cpu/iq_avx512.cpp src/kernels/cpu/nvfp4_avx512.cpp
|
||||
@@ -1769,6 +1953,21 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
add_executable(router_dot_parity src/kernels/cpu/router_dot_parity.cpp)
|
||||
target_link_libraries(router_dot_parity PRIVATE strata_kernels_cpu)
|
||||
if(STRATA_BUILD_TESTS)
|
||||
# a token's native expert rows are the same bits at every number of tokens that share its expert (window-invariant arithmetic)
|
||||
add_executable(native_arithmetic_parity src/kernels/cpu/native_arithmetic_parity.cpp)
|
||||
target_link_libraries(native_arithmetic_parity PRIVATE strata_kernels_cpu)
|
||||
add_test(NAME native_arithmetic_parity COMMAND native_arithmetic_parity)
|
||||
add_test(NAME native_arithmetic_parity_avx COMMAND ${CMAKE_COMMAND} -E env
|
||||
STRATA_FORCE_ISA=avx $<TARGET_FILE:native_arithmetic_parity>)
|
||||
add_test(NAME native_arithmetic_parity_kq256 COMMAND ${CMAKE_COMMAND} -E env
|
||||
STRATA_KQ256=1 $<TARGET_FILE:native_arithmetic_parity>)
|
||||
add_test(NAME native_arithmetic_parity_mt1 COMMAND ${CMAKE_COMMAND} -E env STRATA_IQ_MT_MIN=1 $<TARGET_FILE:native_arithmetic_parity>)
|
||||
add_test(NAME native_arithmetic_parity_no512 COMMAND ${CMAKE_COMMAND} -E env STRATA_NO_IQ512=1 $<TARGET_FILE:native_arithmetic_parity>)
|
||||
add_test(NAME native_arithmetic_parity_ggml COMMAND ${CMAKE_COMMAND} -E env STRATA_NO_IQ512=1 STRATA_NO_IQ256=1 STRATA_NO_IQ4NL=1 $<TARGET_FILE:native_arithmetic_parity>)
|
||||
add_test(NAME native_arithmetic_parity_nvfp4_avx2 COMMAND ${CMAKE_COMMAND} -E env
|
||||
STRATA_NO_NVFP4_512=1 $<TARGET_FILE:native_arithmetic_parity>)
|
||||
add_test(NAME native_arithmetic_parity_nvfp4_ggml COMMAND ${CMAKE_COMMAND} -E env
|
||||
STRATA_NO_NVFP4_512=1 STRATA_NO_NVFP4_256=1 $<TARGET_FILE:native_arithmetic_parity>)
|
||||
add_executable(pool_tasks_test src/kernels/cpu/pool_tasks_test.cpp)
|
||||
target_link_libraries(pool_tasks_test PRIVATE strata_kernels_cpu)
|
||||
add_test(NAME pool_tasks_test COMMAND pool_tasks_test)
|
||||
@@ -1780,6 +1979,14 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
# against ggml-cpu's dot, on random blocks; --bench: ms per expert on one thread, the weights streamed from DRAM
|
||||
add_executable(iq_avx2_parity src/kernels/cpu/iq_avx2_parity.cpp)
|
||||
target_link_libraries(iq_avx2_parity PRIVATE strata_kernels_cpu)
|
||||
# the 512-bit i-quant rows against ggml-cpu's dot: the exact rows bit for bit at 1-4 tokens, the engine's multi-token rows to float
|
||||
# rounding, with the grid lookups as scalar loads and as gathers (SKIP without AVX-512)
|
||||
add_executable(iq512_gather_parity src/kernels/cpu/iq512_gather_parity.cpp)
|
||||
target_link_libraries(iq512_gather_parity PRIVATE strata_kernels_cpu)
|
||||
if(STRATA_BUILD_TESTS)
|
||||
add_test(NAME iq512_gather_parity_scalar COMMAND ${CMAKE_COMMAND} -E env STRATA_IQ_GATHER=0 $<TARGET_FILE:iq512_gather_parity>)
|
||||
add_test(NAME iq512_gather_parity_gather COMMAND ${CMAKE_COMMAND} -E env STRATA_IQ_GATHER=1 $<TARGET_FILE:iq512_gather_parity>)
|
||||
endif()
|
||||
# MODEL-UPDATE: the pool's expert rows per format on T threads against the RAM bandwidth (a benchmark, no test)
|
||||
add_executable(kq_cpu_bench src/kernels/cpu/kq_cpu_bench.cpp)
|
||||
target_link_libraries(kq_cpu_bench PRIVATE strata_kernels_cpu)
|
||||
@@ -1807,6 +2014,11 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
# tree leaves them to the FP16 prompt path
|
||||
if(STRATA_GGML_DIR AND EXISTS "${STRATA_GGML_DIR}/ggml/src/ggml-cuda/template-instances/mmq-instance-tqk6.cu")
|
||||
list(APPEND _strata_mmq_types tq2_t tqk6 tqk7)
|
||||
# Gyro-L's pair trellis (types 147-149): the same fork's ggml has their MMQ instances
|
||||
if(EXISTS "${STRATA_GGML_DIR}/ggml/src/ggml-cuda/template-instances/mmq-instance-tqp5.cu")
|
||||
list(APPEND _strata_mmq_types tqp5 tqp6 tqp7)
|
||||
set(_strata_mmq_tqp ON) # moe_mmq.cu names GGML_TYPE_TQP5-7 only where the ggml has them (STRATA_MMQ_TQP)
|
||||
endif()
|
||||
set(_strata_mmq_tq ON)
|
||||
elseif(STRATA_MMQ_TQ_OVERLAY AND (STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP))
|
||||
# an upstream llama.cpp: the trellis MMQ instances come from an overlay of the pinned ggml-cuda headers written at
|
||||
@@ -1823,6 +2035,7 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
configure_file(third_party/ggml/ggml-common-tq.h "${_strata_tq_overlay_dir}/ggml-common-tq.h" COPYONLY)
|
||||
configure_file(src/kernels/cuda/tq_lut_i8.cuh "${_strata_tq_overlay_dir}/tq_lut_i8.cuh" COPYONLY)
|
||||
set(_strata_mmq_tq ON)
|
||||
set(_strata_mmq_tqp ON) # the overlay adds the pair-trellis enumerators and instances
|
||||
set(_strata_mmq_tq_overlay ON)
|
||||
message(STATUS "trellis MMQ (Gyro prompts): overlay on the pinned ggml-cuda in ${_strata_tq_overlay_dir}")
|
||||
if(STRATA_BUILD_TESTS)
|
||||
@@ -1854,6 +2067,12 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
add_library(strata_mmq STATIC src/prefill/moe_mmq.cu src/prefill/moe_fused.cu src/prefill/moe_fused_iq.cu
|
||||
src/prefill/mmq_nvfp4_w4a8.cu
|
||||
src/prefill/ggml_cuda_host.cu ${_strata_quantize_cu})
|
||||
if(STRATA_EXPERIMENTAL_SM60 AND NOT STRATA_HIP_GFX906)
|
||||
# GP100 (sm_60): a resident layer's experts weight-stationary, one launch per product (moe_ws.hpp; opt-in at
|
||||
# run time, STRATA_MMQ_WS=1, and only where every visible GPU is cc 6.0)
|
||||
target_sources(strata_mmq PRIVATE src/prefill/moe_ws.cu src/prefill/moe_ws_gu_iq2.cu src/prefill/moe_ws_gu_iq3.cu
|
||||
src/prefill/moe_ws_down.cu)
|
||||
endif()
|
||||
# q8_0: the drafter's matrices (E-9); STRATA_ORCA_Q4KS_MMQ adds q5_0 (#296, in _strata_mmq_types), and
|
||||
# STRATA_MMQ_KQUANTS q4_k q5_k q5_1 q6_k, the experts of Unsloth's UD-Q4/Q5/Q6_K_XL (docs/QUANTS.md; the dispatch
|
||||
# follows eddoursul/Strata 7706c1b). MODEL-UPDATE Phase 1: on CUDA they are a library of their own, strata_kq
|
||||
@@ -1872,7 +2091,7 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
target_sources(strata_mmq PRIVATE ${_strata_mmq}/template-instances/mmq-instance-${_t}.cu)
|
||||
endforeach()
|
||||
if(_strata_mmq_tq_overlay)
|
||||
foreach(_t tq2_t tqk6 tqk7)
|
||||
foreach(_t tq2_t tqk6 tqk7 tqp5 tqp6 tqp7)
|
||||
target_sources(strata_mmq PRIVATE ${_strata_tq_overlay_dir}/template-instances/mmq-instance-${_t}.cu)
|
||||
endforeach()
|
||||
# first on the include path: the patched mmq.cuh / ggml.h shadow the pinned ones for this target only
|
||||
@@ -1882,6 +2101,12 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
# which exists only in the arch-specific target, so its one unit alone is built with 12x -> 12xa (the default
|
||||
# binary is unchanged and runs on sm_121; a card without that image falls back to W4A8 at run time)
|
||||
set(_strata_w4a4_archs ${CMAKE_CUDA_ARCHITECTURES})
|
||||
# `native` is first replaced by the detected architectures (e.g. 120-real), so the 12x -> 12xa rewrite below applies
|
||||
# to it too: with plain sm_120 ptxas refuses the FP4 MMA of this one unit (#4023)
|
||||
if("native" IN_LIST _strata_w4a4_archs AND CMAKE_CUDA_ARCHITECTURES_NATIVE)
|
||||
list(REMOVE_ITEM _strata_w4a4_archs native)
|
||||
list(APPEND _strata_w4a4_archs ${CMAKE_CUDA_ARCHITECTURES_NATIVE})
|
||||
endif()
|
||||
# (two steps: CMake before 3.29 rejects a \2 whose optional group did not match, "120" alone)
|
||||
list(TRANSFORM _strata_w4a4_archs REPLACE "^(12[0-9])$" "\\1a")
|
||||
list(TRANSFORM _strata_w4a4_archs REPLACE "^(12[0-9])-(real|virtual)$" "\\1a-\\2")
|
||||
@@ -1984,8 +2209,15 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
if(_strata_mmq_tq)
|
||||
target_compile_definitions(strata_mmq PRIVATE STRATA_MMQ_TQ=1)
|
||||
endif()
|
||||
if(_strata_mmq_tqp)
|
||||
target_compile_definitions(strata_mmq PRIVATE STRATA_MMQ_TQP=1)
|
||||
endif()
|
||||
target_link_libraries(strata_prefill PUBLIC strata_mmq)
|
||||
target_compile_definitions(strata_prefill PUBLIC STRATA_PREFILL_MMQ=1 STRATA_PREFILL_FUSED=1)
|
||||
if(STRATA_EXPERIMENTAL_SM60 AND NOT STRATA_HIP_GFX906)
|
||||
# the weight-stationary experts (moe_ws.hpp) are in strata_mmq: the prompt path may take them (STRATA_MMQ_WS=1)
|
||||
target_compile_definitions(strata_prefill PUBLIC STRATA_PREFILL_WS=1)
|
||||
endif()
|
||||
if(STRATA_BUILD_TESTS)
|
||||
# #136: the fused int8 experts against a double-precision reference and the MMQ path (exit 77 below sm_80)
|
||||
add_executable(prefill_fused_moe_test tests/cuda/prefill_fused_moe_test.cpp)
|
||||
@@ -1997,12 +2229,40 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
target_link_libraries(prefill_fused_iq_test PRIVATE strata_mmq ggml-base ${_strata_gpu_runtime_target})
|
||||
add_test(NAME prefill_fused_iq_test COMMAND prefill_fused_iq_test)
|
||||
set_tests_properties(prefill_fused_iq_test PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 600)
|
||||
# the opt-in STRATA_PF_FUSED_Q2N=1 on its own (the test leaves STRATA_PF_FUSED unset): the native Q2_0 pack's Q2_0 / Q2_0
|
||||
# layers on sm_80+ (77 below sm_80 and without a card)
|
||||
add_test(NAME prefill_fused_iq_test_q2n COMMAND prefill_fused_iq_test "--only=Q2_0 / Q2_0" --unset-pf-fused)
|
||||
set_tests_properties(prefill_fused_iq_test_q2n PROPERTIES ENVIRONMENT "STRATA_PF_FUSED_Q2N=1" SKIP_RETURN_CODE 77 TIMEOUT 600)
|
||||
# the opt-in STRATA_PF_FUSED_NT=256 kernels (256 threads, two blocks a multiprocessor, two-pass weight loads) against the
|
||||
# same references; the batches of the test reach them through the Batch overload of experts_native (77 below sm_80)
|
||||
add_test(NAME prefill_fused_iq_test_nt256 COMMAND prefill_fused_iq_test)
|
||||
set_tests_properties(prefill_fused_iq_test_nt256 PROPERTIES ENVIRONMENT "STRATA_PF_FUSED_NT=256" SKIP_RETURN_CODE 77 TIMEOUT 600)
|
||||
# the opt-in STRATA_PF_FUSED_F16=1 (f16 mma, rounding level) and STRATA_PF_FUSED_WS=1 (warp-specialized, the same F16 products;
|
||||
# about 101 KB of shared memory at its defaults, more than an sm_86 / sm_89 / sm_120 card's 99 KB, so it is set up on
|
||||
# sm_80 and sm_90 cards and the test skips (77) elsewhere)
|
||||
add_test(NAME prefill_fused_iq_test_f16 COMMAND prefill_fused_iq_test)
|
||||
set_tests_properties(prefill_fused_iq_test_f16 PROPERTIES ENVIRONMENT "STRATA_PF_FUSED_F16=1" SKIP_RETURN_CODE 77 TIMEOUT 600)
|
||||
add_test(NAME prefill_fused_iq_test_ws COMMAND prefill_fused_iq_test)
|
||||
set_tests_properties(prefill_fused_iq_test_ws PROPERTIES ENVIRONMENT "STRATA_PF_FUSED_WS=1" SKIP_RETURN_CODE 77 TIMEOUT 600)
|
||||
# the MoE input quantized per token and scattered to its rows (mmq::quantize_scatter) against the per-row
|
||||
# gather: the same q8_1 bytes for every MMQ layout (--bench: both at 2K, 8K and 32K tokens)
|
||||
add_executable(prefill_mmq_scatter_test tests/cuda/prefill_mmq_scatter_test.cpp)
|
||||
target_link_libraries(prefill_mmq_scatter_test PRIVATE strata_mmq ggml-base ${_strata_gpu_runtime_target})
|
||||
add_test(NAME prefill_mmq_scatter_test COMMAND prefill_mmq_scatter_test)
|
||||
set_tests_properties(prefill_mmq_scatter_test PROPERTIES TIMEOUT 120)
|
||||
if(STRATA_EXPERIMENTAL_SM60)
|
||||
# mmq::swiglu_quant: swiglu + the down product's q8_1 rows in one kernel against the two, byte for byte
|
||||
add_executable(prefill_swiglu_quant_test tests/cuda/prefill_swiglu_quant_test.cpp)
|
||||
target_link_libraries(prefill_swiglu_quant_test PRIVATE strata_mmq ggml-base ${_strata_gpu_runtime_target})
|
||||
add_test(NAME prefill_swiglu_quant_test COMMAND prefill_swiglu_quant_test)
|
||||
set_tests_properties(prefill_swiglu_quant_test PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 120)
|
||||
# the weight-stationary experts (STRATA_MMQ_WS) against the per-group MMQ, byte for byte, on random experts; the
|
||||
# verdict is given on a compute capability 6.0 card only (77 elsewhere)
|
||||
add_executable(prefill_ws_parity_test tests/cuda/prefill_ws_parity_test.cpp)
|
||||
target_link_libraries(prefill_ws_parity_test PRIVATE strata_mmq ggml-base ${_strata_gpu_runtime_target})
|
||||
add_test(NAME prefill_ws_parity_test COMMAND prefill_ws_parity_test)
|
||||
set_tests_properties(prefill_ws_parity_test PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 600)
|
||||
endif()
|
||||
endif()
|
||||
if(STRATA_BUILD_TESTS AND _strata_mmq_tab_on)
|
||||
# STRATA_MMQ_DIRECT: the pointer-table MMQ bit for bit against the gathered MMQ (exit 77 below sm_80)
|
||||
@@ -2061,7 +2321,7 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
list(APPEND _strata_mmq_sources "${_strata_mmq}/template-instances/mmq-instance-${_t}.cu")
|
||||
endforeach()
|
||||
if(_strata_mmq_tq_overlay)
|
||||
foreach(_t tq2_t tqk6 tqk7)
|
||||
foreach(_t tq2_t tqk6 tqk7 tqp5 tqp6 tqp7)
|
||||
list(APPEND _strata_mmq_sources "${_strata_tq_overlay_dir}/template-instances/mmq-instance-${_t}.cu")
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -2086,6 +2346,9 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
if(_strata_mmq_tq)
|
||||
target_compile_definitions(strata_mmq PRIVATE STRATA_MMQ_TQ=1)
|
||||
endif()
|
||||
if(_strata_mmq_tqp)
|
||||
target_compile_definitions(strata_mmq PRIVATE STRATA_MMQ_TQP=1)
|
||||
endif()
|
||||
target_link_libraries(strata_mmq PUBLIC ggml-base hip::host roc::hipblas)
|
||||
target_link_libraries(strata_prefill PUBLIC strata_mmq)
|
||||
target_compile_definitions(strata_prefill PUBLIC STRATA_PREFILL_MMQ=1 STRATA_PREFILL_FUSED=1)
|
||||
@@ -2139,6 +2402,20 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
add_executable(native_expert_bench src/kernels/native_expert_bench.cpp)
|
||||
target_include_directories(native_expert_bench PRIVATE ${_strata_gpu_include_directories})
|
||||
target_link_libraries(native_expert_bench PRIVATE strata_kernels strata_kernels_cpu strata_artifact ${_strata_gpu_runtime_target})
|
||||
if(STRATA_ENABLE_CUDA AND STRATA_EXPERIMENTAL_SM60)
|
||||
# STRATA_EXPERT_NIBBLE (include/strata/core/expert_nibble.hpp): the 4-bit gate/up expert slots against the
|
||||
# production kernels and the GGUF blobs, bit for bit, on a real model's layers (needs a GP100); --header: the
|
||||
# contract's host half, no GPU
|
||||
add_executable(iq_nibble_parity src/kernels/iq_nibble_parity.cpp)
|
||||
target_include_directories(iq_nibble_parity PRIVATE ${_strata_gpu_include_directories})
|
||||
target_link_libraries(iq_nibble_parity PRIVATE strata_kernels strata_kernels_cpu strata_artifact ggml-base ${_strata_gpu_runtime_target})
|
||||
if(STRATA_BUILD_TESTS)
|
||||
add_test(NAME iq_nibble_parity_header COMMAND iq_nibble_parity --header)
|
||||
# the synthetic experts of every gate/up x down format pair, no model (skips with 77 on a card that is not a GP100)
|
||||
add_test(NAME iq_nibble_parity_synthetic COMMAND iq_nibble_parity --synthetic-only)
|
||||
set_tests_properties(iq_nibble_parity_synthetic PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 900)
|
||||
endif()
|
||||
endif()
|
||||
# MODEL-UPDATE: the dense Q8_0 GEMVs at the engine's shapes against the memory bandwidth (a benchmark, no test)
|
||||
add_executable(q8_gemv_bench src/kernels/q8_gemv_bench.cpp)
|
||||
target_include_directories(q8_gemv_bench PRIVATE ${_strata_gpu_include_directories})
|
||||
@@ -2177,7 +2454,11 @@ if(STRATA_NATIVE_EXPERTS)
|
||||
# APR: the trellis expert types and the Hadamard activation rotation, when ggml comes from the agention fork
|
||||
# (the only tree with these types; marked by its ggml-cuda/tq.cuh)
|
||||
if(STRATA_GGML_DIR AND EXISTS "${STRATA_GGML_DIR}/ggml/src/ggml-cuda/tq.cuh")
|
||||
foreach(_pair tqk6/tqk7 tq2_t/tq2_t)
|
||||
set(_strata_tq_pairs tqk6/tqk7 tq2_t/tq2_t)
|
||||
if(EXISTS "${STRATA_GGML_DIR}/ggml/src/ggml-cuda/template-instances/mmq-instance-tqp5.cu") # Gyro-L's pair trellis
|
||||
list(APPEND _strata_tq_pairs tqp5/tqp5 tqp6/tqp6 tqp7/tqp7)
|
||||
endif()
|
||||
foreach(_pair ${_strata_tq_pairs})
|
||||
string(REPLACE "/" "_" _name "${_pair}")
|
||||
add_test(NAME native_expert_parity_${_name} COMMAND native_expert_parity --synthetic ${_pair})
|
||||
add_test(NAME native_expert_parity_hadamard_${_name} COMMAND native_expert_parity --synthetic-hadamard ${_pair})
|
||||
@@ -2251,6 +2532,13 @@ if(STRATA_BUILD_TESTS)
|
||||
add_test(NAME tq_cpu_parity COMMAND tq_cpu_parity)
|
||||
add_test(NAME tq_cpu_parity_avx2 COMMAND ${CMAKE_COMMAND} -E env STRATA_FORCE_AVX2=1 $<TARGET_FILE:tq_cpu_parity>)
|
||||
set_tests_properties(tq_cpu_parity tq_cpu_parity_avx2 PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77)
|
||||
# Gyro-L's pair trellis (types 147-149) and the older trellis rows on synthetic blocks, no ggml and no model: the scalar
|
||||
# kernel against a bit-by-bit reference, every ISA bit for bit equal to scalar, the type predicates unchanged
|
||||
add_executable(tqp_cpu_test src/kernels/cpu/tqp_cpu_test.cpp)
|
||||
target_link_libraries(tqp_cpu_test PRIVATE strata_kernels_cpu)
|
||||
add_test(NAME tqp_cpu_test COMMAND tqp_cpu_test)
|
||||
add_test(NAME tqp_cpu_test_avx2 COMMAND ${CMAKE_COMMAND} -E env STRATA_FORCE_AVX2=1 $<TARGET_FILE:tqp_cpu_test>)
|
||||
set_tests_properties(tqp_cpu_test tqp_cpu_test_avx2 PROPERTIES TIMEOUT 120)
|
||||
endif()
|
||||
|
||||
add_executable(expert_parity src/kernels/cpu/expert_parity.cpp)
|
||||
@@ -2280,6 +2568,10 @@ if(STRATA_BUILD_TESTS)
|
||||
add_executable(warm_policy_test src/prefill/warm_policy_test.cpp)
|
||||
target_include_directories(warm_policy_test PRIVATE include)
|
||||
add_test(NAME warm_policy_test COMMAND warm_policy_test)
|
||||
# #4005: which streamed expert copies get a copied event (header-only, CPU)
|
||||
add_executable(copy_events_test src/prefill/copy_events_test.cpp)
|
||||
target_include_directories(copy_events_test PRIVATE include)
|
||||
add_test(NAME copy_events_test COMMAND copy_events_test)
|
||||
# issue #29: tiny batches with sleeping workers, as on a big-VRAM card; a hang fails it
|
||||
add_executable(pool_stress src/kernels/cpu/pool_stress.cpp)
|
||||
target_link_libraries(pool_stress PRIVATE strata_kernels_cpu)
|
||||
@@ -2333,6 +2625,32 @@ if(STRATA_BUILD_TESTS)
|
||||
add_test(NAME aux_cpus_test COMMAND aux_cpus_test)
|
||||
endif()
|
||||
|
||||
# CUDA release kernels must not spill or keep a per-thread array in local memory: every access there is a round trip
|
||||
# to device memory in the hottest loops the engine has, and nothing on the build machine says so without -Xptxas -v
|
||||
# or a GPU. tools/check_cuda_spills.py reads the resource usage the compiler wrote into the kernel libraries
|
||||
# (cuobjdump: STACK and LOCAL per entry function and per sm_) and fails on any kernel outside its ALLOWED table, which
|
||||
# carries the measured allowance of the kernels that hold such an array on purpose. CUDA only: HIP has no cuobjdump.
|
||||
if(STRATA_ENABLE_CUDA AND STRATA_BUILD_TESTS AND NOT STRATA_ENABLE_HIP AND NOT STRATA_HIP_GFX906)
|
||||
find_package(Python3 QUIET COMPONENTS Interpreter)
|
||||
if(Python3_Interpreter_FOUND)
|
||||
set(_strata_spill_libs)
|
||||
foreach(_t strata_kernels strata_core strata_engine strata_prefill strata_qwen35 strata_mmq strata_mmq_w4a4 strata_kq)
|
||||
if(TARGET ${_t})
|
||||
list(APPEND _strata_spill_libs $<TARGET_FILE:${_t}>)
|
||||
endif()
|
||||
endforeach()
|
||||
add_test(NAME cuda_spill_guard COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/check_cuda_spills.py
|
||||
--cuobjdump ${CUDAToolkit_BIN_DIR}/cuobjdump${CMAKE_EXECUTABLE_SUFFIX} ${_strata_spill_libs})
|
||||
set_tests_properties(cuda_spill_guard PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 600)
|
||||
if(NOT WIN32) # its stand-in demanglers are sh scripts
|
||||
add_test(NAME check_cuda_spills_unit COMMAND ${Python3_EXECUTABLE} -m unittest tools.test_check_cuda_spills
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "strata: no python3 - the cuda_spill_guard test is NOT registered")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(STRATA_BUILD_TESTS)
|
||||
enable_testing()
|
||||
# Model-level checks may be absent from source distributions.
|
||||
@@ -2360,7 +2678,7 @@ if(STRATA_HIP_GFX906)
|
||||
# f16kq::covers() answers false and the int8 kernels run, as on every other card)
|
||||
if(_strata_mmq_tq_overlay)
|
||||
set(_strata_tq_hip ${_strata_tq_overlay_dir}/quantize.cu)
|
||||
foreach(_t tq2_t tqk6 tqk7)
|
||||
foreach(_t tq2_t tqk6 tqk7 tqp5 tqp6 tqp7)
|
||||
list(APPEND _strata_tq_hip ${_strata_tq_overlay_dir}/template-instances/mmq-instance-${_t}.cu)
|
||||
endforeach()
|
||||
list(APPEND _strata_cu ${_strata_tq_hip})
|
||||
|
||||
@@ -68,6 +68,8 @@ RUN set -e; \
|
||||
|
||||
# ---- 2. the Terminal (the release archive, built here)
|
||||
FROM ${RUNTIME_BASE} AS terminal
|
||||
ARG STRATA_COMMIT=
|
||||
ENV STRATA_BUILD_COMMIT=${STRATA_COMMIT}
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends python3 ca-certificates git && rm -rf /var/lib/apt/lists/*
|
||||
COPY . /src/
|
||||
|
||||
+120
-351
@@ -1,419 +1,188 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="380">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <b>Deutsch</b> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a></p>
|
||||
|
||||
<h3 align="center">Ein Spitzenmodell auf deinem eigenen Gaming-PC</h3>
|
||||
|
||||
<p align="center">Unterstützt NVIDIA, AMD, Intel · Windows, Linux, Mac · kostenlos und Open Source</p>
|
||||
<h3 align="center">Leistungsstarke KI auf deinem eigenen Computer.</h3>
|
||||
<p align="center">Chatten, programmieren und mit Bildern arbeiten, lokal.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?include_prereleases&label=release" alt="Latest release"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://github.com/Niko1221/Strata/stargazers"><img src="https://img.shields.io/github/stars/Niko1221/Strata?style=flat" alt="GitHub stars"></a>
|
||||
<a href="#modelle">Modelle</a> · <a href="#installation"><b>Installation</b></a> ·
|
||||
<a href="#hardware">Hardware</a> · <a href="#tools">Tools</a> ·
|
||||
<a href="#hilfe">Hilfe</a> · <a href="#strata-unterstützen">Unterstützen</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br>
|
||||
<sub>Ein Voxel-Pagodengarten aus einem einzigen Prompt, auf einer RTX 5070 mit Strata (IQ3_S, 128K Kontext) ·
|
||||
<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">ganzes Video (49 s)</a></sub></p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="Strata herunterladen"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT-Lizenz"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="Strata auf Buy Me a Coffee unterstützen"></a>
|
||||
</p>
|
||||
|
||||
Strata lässt **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)** laufen, ein Modell mit 125
|
||||
Milliarden Parametern, für das man sonst einen Server braucht, auf einem normalen PC. Es chattet, schreibt Code, liest
|
||||
Bilder und arbeitet mit deinen Apps und Coding-Agents zusammen. Deine Chats und Dateien bleiben auf deinem PC.
|
||||
<p align="center"><sub><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <b>Deutsch</b> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a> · <a href="README.pl.md">Polski</a></sub></p>
|
||||
|
||||
**Neu hier?** Sieh dir an, [was du brauchst](#was-du-brauchst), und [installiere dann die App](#option-a-die-strata-app).
|
||||
**Kostenlos, Open Source und ganz in deiner Hand.** Nutze Strata auf dem Desktop oder mit deinen liebsten Coding-Tools. Kein Konto nötig.
|
||||
|
||||
- **Läuft auf einem Gaming-PC.** 32 GB Arbeitsspeicher (RAM) und Grafikspeicher zusammen reichen für den Anfang.
|
||||
- **Passt zu deinen Werkzeugen.** Strata spricht die OpenAI- und die Anthropic-API, deshalb verbinden sich Claude Code, Codex CLI, OpenCode und andere Agents damit.
|
||||
- **Liest Bilder.** Das ist standardmäßig eingeschaltet.
|
||||
- **Kostenlos.** MIT-Lizenz, kein Konto, keine Cloud.
|
||||
- **Privat.** Keine Telemetrie. Was Strata herunterlädt, wann es das Internet nutzt und wie es Downloads prüft, steht in [docs/SAFETY.md](docs/SAFETY.md).
|
||||
## Modelle
|
||||
|
||||
Version 0.2.3 · Engine 0.1.48
|
||||
Wir empfehlen **zuerst ISTA-DASLab**, danach **Unsloth** und andere Anbieter, soweit ein passendes Modell in deinen Speicher passt.
|
||||
|
||||
## Was du brauchst
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
**Du brauchst mindestens 32 GB Arbeitsspeicher (RAM) und Grafikspeicher (VRAM) zusammen.** Bei einem Mac oder einem Ryzen AI Max
|
||||
ist das der gemeinsame Speicher. Mit mehr Speicher läuft ein größeres oder ein schnelleres Modell.
|
||||
|
||||
- Ein PC mit 32 GB und einer Grafikkarte mit 12-16 GB führt den Coder aus.
|
||||
- Mit 64 GB RAM laufen alle Größen.
|
||||
|
||||
| Dein Computer | Details |
|
||||
| Anbieter | Auswahl |
|
||||
| --- | --- |
|
||||
| **NVIDIA** GeForce RTX 20, 30, 40, 50 Serie (12 GB oder mehr) | Installiere die App oder das Terminal. |
|
||||
| **AMD** Radeon RX 6800 und neuer, Radeon AI PRO R9700 (12 GB oder mehr) | [AMD-Karten](docs/AMD_HIP.md) |
|
||||
| **Intel** Arc | [Intel Arc](docs/INTEL_ARC.md), [Intel-Engine](docs/INTEL.md) |
|
||||
| **Apple-Silicon-Mac** (M1 oder neuer, macOS 15 oder neuer) | [Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max (Strix Halo)** und andere Systeme mit gemeinsamem Speicher | [Strix Halo](docs/STRIX_HALO.md) |
|
||||
| Ältere Karten und Prozessoren | [Ältere GPUs](docs/OLDER_GPUS.md), [Ältere CPUs](docs/INSTALL.md#older-cpus-experimental) |
|
||||
| **ISTA-DASLab · empfohlen** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S. [Coder: IQ1\_M](docs/MODELS.md#coder) zum Programmieren. |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF). Geringerer Speicherbedarf, aber langsamer. |
|
||||
| **Weitere Optionen** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
Außerdem nötig:
|
||||
[Größen, Speicherbedarf und Kompatibilität vergleichen](docs/MODELS.md).
|
||||
|
||||
- etwa 80 GB freier Speicherplatz (mit einer SSD startet es beim ersten Mal viel schneller)
|
||||
- Windows 10 / 11, Linux oder macOS
|
||||
- ein aktueller Grafiktreiber
|
||||
</details>
|
||||
|
||||
Zwei oder drei Karten desselben Herstellers können sich ein Modell teilen ([Multi-GPU](docs/MULTI_GPU.md)). Strata teilt ein
|
||||
Modell nie auf NVIDIA- und AMD-Karten auf. Die vollständige Liste: [docs/INSTALL.md](docs/INSTALL.md#what-you-need).
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0. Das sind die derzeit dokumentierten Pakete für dieses Modell.
|
||||
|
||||
[Modellanleitung und Kompatibilität](docs/QWEN36.md).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
In der **Desktop-App** und im **Terminal**. Was nicht in den Arbeitsspeicher passt, wird von deiner SSD gelesen. Darum brauchst du viel freien Speicherplatz.
|
||||
|
||||
| Set (IST-DAS) | Download | Freier Speicherplatz nötig |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | etwa 245 GB |
|
||||
| 2.00 bpw | 257 GB | etwa 265 GB |
|
||||
| 2.25 bpw | 274 GB | etwa 280 GB |
|
||||
|
||||
Läuft auf NVIDIA RTX 30, 40 und 50 (Windows und Linux) und auf AMD Radeon AI PRO R9700 (Linux). Das Setup lädt die Dateien und die DeepSeek-Engine herunter und startet dann das Modell.
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
Gemessen mit dem 2.00-bpw-Set auf Strata 0.2.5. „Ausgabe“ ist das Tempo der Antwort, „Prompt“ zeigt, wie schnell Strata deine Eingabe liest.
|
||||
|
||||
| Hardware | Ausgabe | Prompt |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB RAM | 4 bis 6 Token/s | etwa 110 Token/s (4K) |
|
||||
| RTX 3060 12 GB, 46 GB RAM | 9 bis 11 Token/s | etwa 155 Token/s (4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB RAM | 21 bis 25 Token/s | 320 bis 360 Token/s (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74 bis 77 Token/s | 400 bis 450 Token/s (8K) |
|
||||
|
||||
[Speicher, Festplatte und Details](docs/DEEPSEEK41.md) · [Versionshinweise](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
Unsicher, was passt? [Wähle ein Modell für deinen Computer](docs/MODELS.md#pick-by-memory).
|
||||
|
||||
## Installation
|
||||
|
||||
Such dir eine Option aus. Alle starten dieselbe Engine und nutzen dieselben Modelle.
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### Option A: die Strata-App
|
||||
### Desktop-App
|
||||
|
||||
Der einfachste Weg. Die App bringt die Engine mit: installieren, ein Modell wählen, chatten. Lade die Datei für dein
|
||||
System und deine Grafikkarte von der [Releases-Seite](https://github.com/Niko1221/Strata/releases/latest) herunter. Du bist
|
||||
unsicher, welche du brauchst? Lies den Absatz unter der Tabelle.
|
||||
**[Strata für Windows, Linux oder Mac herunterladen →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
| System | Deine Grafikkarte | Datei zum Herunterladen |
|
||||
| --- | --- | --- |
|
||||
| **Windows 10 / 11** | NVIDIA RTX, Treiber 580 oder neuer | [`Strata-0.2.3-windows-cuda13.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda13.exe) |
|
||||
| | NVIDIA, ältere Karte oder Treiber älter als 580 | [`Strata-0.2.3-windows-cuda12.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda12.exe) |
|
||||
| | AMD Radeon RX 9000 Serie oder Radeon AI PRO R9700 | [`Strata-0.2.3-windows-hip.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip.exe) |
|
||||
| | AMD Radeon RX 7000 Serie oder Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-windows-hip-rdna3.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip-rdna3.exe) |
|
||||
| **Linux** | NVIDIA RTX, Treiber 580 oder neuer | [`Strata-0.2.3-linux-nvidia-cuda13.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda13.AppImage) |
|
||||
| | NVIDIA, ältere Karte oder Treiber älter als 580 | [`Strata-0.2.3-linux-nvidia-cuda12.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda12.AppImage) |
|
||||
| | AMD Radeon RX 9000 Serie oder Radeon AI PRO R9700 | [`Strata-0.2.3-linux-amd-rx9070.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx9070.AppImage) |
|
||||
| | AMD Radeon RX 7000 Serie | [`Strata-0.2.3-linux-amd-rx7900.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx7900.AppImage) |
|
||||
| | AMD Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-linux-amd-strixhalo.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-strixhalo.AppImage) |
|
||||
| **Mac** (Apple Silicon, macOS 15 oder neuer) | eingebaut | [`Strata-0.2.3-mac.dmg`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-mac.dmg) |
|
||||
Installiere die App, wähle ein Modell und leg mit dem Chat los. Es gibt einen Installer pro System. Beim ersten Start lädt die App die Engine für deine Grafikkarte herunter. [Hilfe zum Installer](docs/INSTALL.md#the-app).
|
||||
|
||||
**Wenn du unsicher bist:** Bei NVIDIA nimmst du `cuda13`, wenn dein Treiber Version 580 oder neuer ist, sonst `cuda12`.
|
||||
`cuda12` ist für ältere Karten und ältere Treiber. Die Dateien `hip` und `amd` sind für AMD-Karten. Für andere AMD-Karten
|
||||
(RX 6000) gibt es noch keine fertige App: siehe [AMD-Karten](docs/AMD_HIP.md).
|
||||
<sub>Dateien: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
Danach:
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="Strata-Desktop-App mit Chat und Live-Codevorschau nebeneinander">
|
||||
<br><sub>Chat, Dateien und Live-Vorschau in einem Fenster.</sub>
|
||||
</p>
|
||||
|
||||
- **Windows:** Starte die `.exe`. Sie wird für deinen Benutzer installiert und braucht keine Administratorrechte. Wenn
|
||||
Windows "Der Computer wurde durch Windows geschützt" meldet, wähle **Weitere Informationen** und dann **Trotzdem
|
||||
ausführen** (der Installer ist noch nicht signiert).
|
||||
- **Linux:** Mach die Datei ausführbar (`chmod +x`) und starte sie. Sie braucht FUSE 2: `sudo apt install libfuse2`
|
||||
(Ubuntu 22.04) oder `libfuse2t64` (Ubuntu 24.04 und neuer).
|
||||
- **Mac:** Öffne die `.dmg` und zieh Strata in den Ordner "Programme".
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
Auf dem ersten Bildschirm liest die App deinen PC aus und empfiehlt ein passendes Modell. Drück auf Installieren. Das Modell
|
||||
ist ein großer Download (etwa 40-70 GB) und wird nach einer Unterbrechung dort fortgesetzt, wo er aufgehört hat. Wenn du
|
||||
das Fenster schließt, beenden sich Strata und die Engine.
|
||||
### Terminal-App
|
||||
|
||||
### Option B: das Terminal (eine Zeile)
|
||||
Lieber im Terminal? Installiere Strata und starte dann **`strata launch`**.
|
||||
|
||||
Das Terminal ist der Befehl `strata`, gedacht für Skripte, Server und KI-Agents.
|
||||
<details open>
|
||||
<summary><b>Installationsbefehle</b></summary>
|
||||
|
||||
Linux und Mac:
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
Windows (PowerShell):
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
Das Skript prüft deinen PC, lädt das Terminal herunter, kontrolliert die SHA-256-Prüfsumme und entpackt es in deinen
|
||||
Home-Ordner. Es braucht keine Administratorrechte. Öffne unter Windows danach ein neues Terminalfenster. Dann startest du
|
||||
Strata:
|
||||
Öffne unter Windows danach ein neues Terminal. Dann:
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
Es stellt dir eine Frage nach der anderen: Modell, Kontext, Bilder, wer sich verbinden darf. Danach lädt es die Engine für
|
||||
deine Grafikkarte herunter (signiert und vor der Nutzung probeweise gestartet), dazu das Modell, und beginnt zu laufen.
|
||||
Für Skripte und KI-Agents gibt es Flags:
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
Wenn du das Installationsskript vor dem Ausführen lesen willst, lade es zuerst mit `curl -fsSL <address> -o install.sh`
|
||||
herunter, lies es und führe dann `sh install.sh` aus. Alle Bildschirme und Flags: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
### Option C: deine KI richtet es ein
|
||||
|
||||
Füge das in Claude Code, Cursor, Codex, GitHub Copilot oder einen anderen Coding-Assistenten ein:
|
||||
|
||||
```text
|
||||
Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.
|
||||
```
|
||||
|
||||
Der Assistent prüft deine Grafikkarte, deinen Arbeitsspeicher und den Speicherplatz, wählt das passende Modell, installiert
|
||||
und startet es und sagt dir, wie du deine Apps verbindest. KI-Werkzeuge können Strata auch über den
|
||||
[MCP-Server](docs/MCP_SERVER.md) installieren, starten und stoppen.
|
||||
|
||||
Du willst es lieber selbst bauen? Siehe [Aus dem Quellcode bauen](#aus-dem-quellcode-bauen).
|
||||
|
||||
## Modelle
|
||||
|
||||
Die App und `strata launch` empfehlen ein Modell passend zu deinem Speicher. Es ist ein einziges Modell in mehreren
|
||||
Größen, mehr oder weniger stark komprimiert. Kleinere Größen sind schneller. Größere Größen sind etwas klüger.
|
||||
|
||||
### Wenig Speicher? Probier Gyro
|
||||
|
||||
[Gyro](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF) (von agentionai) ist die kleinste Möglichkeit, dieses Modell auszuführen.
|
||||
|
||||
| Größe | Benötigter Speicher (RAM + VRAM) | Download | Was es ist |
|
||||
| --- | ---: | ---: | --- |
|
||||
| **Gyro-S** | 27,6 GB | 58,5 GB | Für PCs, auf denen nichts anderes läuft. Die Qualität ist geringer als bei IQ2_XS. |
|
||||
| **Gyro-M** | 35 GB | 92,0 GB | Ungefähr die Qualität von IQ3_XXS bei etwa 20 % weniger GPU-Speicher. Es schreibt Antworten langsamer als Q2_0: 16 % auf einer RTX 3060 mit 12 GB, 21 % auf einer R9700. |
|
||||
|
||||
Gyro läuft auf NVIDIA- und AMD-Karten (bei AMD experimentell) auf Intel-Arc-Karten unter Linux (getestet auf einer Arc A750) und ab 0.2.2 auf Macs mit Apple Silicon (Gyro-S auf einem Mac mini mit 32 GB: 9 Tokens/s, die Experten werden von der SSD gelesen). Details und Messwerte:
|
||||
[docs/GYRO.md](docs/GYRO.md). Starte es mit `strata launch --model gyro-s`.
|
||||
|
||||
### Die anderen Größen
|
||||
|
||||
| Dein Speicher (RAM + VRAM) | Nimm | Hinweise |
|
||||
| --- | --- | --- |
|
||||
| **32 GB** | **Gyro-S**, oder den **[Coder](docs/MODELS.md#coder)** für Code | Der Coder braucht 32 GB RAM und behält die Hälfte der Experten, deshalb ist er außerhalb von Code schwächer |
|
||||
| **40 GB** | **[Swift 1.5](docs/MODELS.md#swift-15)** IQ2_XS (39,2 GB), oder **Gyro-M** (35 GB) | Swift denkt kürzer nach, bevor es antwortet. Gyro-M kommt der Qualität von IQ3_XXS nahe, schreibt Antworten aber 16-21 % langsamer als Q2_0 |
|
||||
| **48 GB** | **IQ3_XXS** (47,0 GB) | Langsamer, besser |
|
||||
| **64 GB** | **IQ3_S** (54,8 GB), das Original oder Swift 1.5 | Am langsamsten, am besten. Es erreicht in den veröffentlichten Tests das volle Modell |
|
||||
| **96 GB oder mehr** | **UD-IQ4_XS** von Unsloth (etwa 72 GB RAM) bis **Q8_0** (etwa 136 GB), 4 bis 8 Bit | Näher am vollen Modell. Bei weniger RAM liest Strata einen Teil von der SSD, das ist viel langsamer |
|
||||
|
||||
Auch mit weniger RAM, als eine Zeile nennt, kann es funktionieren: Strata wechselt von selbst in seinen
|
||||
[Modus für wenig RAM](docs/MODELS.md#a-big-graphics-card-and-little-ram). Rechne mit weniger Tempo, mit einer kleinen
|
||||
Grafikkarte mit deutlich weniger.
|
||||
|
||||
Weitere Auswahl:
|
||||
|
||||
- **[Swift 1.5](docs/MODELS.md#swift-15)** ist eine Feinabstimmung, die kürzer nachdenkt, bevor sie antwortet, bei etwa gleicher Qualität und gleichem RAM-Bedarf.
|
||||
- **[NVFP4](docs/NVFP4.md)** ist NVIDIAs 4-Bit-Version für NVIDIA-Karten. Sie braucht etwa 80 GB RAM, um alle Experten im RAM zu halten.
|
||||
- **[Qwen3.6-35B-A3B](docs/QWEN36.md)** ist ein kleineres, anderes Modell, das Bilder liest und mehrere Anfragen gleichzeitig beantworten kann.
|
||||
- **[OrcaRouters Uncensored IQ3_XXS](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** richtest du von Hand ein.
|
||||
|
||||
Alle Größen, Downloads und was wo läuft: [docs/MODELS.md](docs/MODELS.md).
|
||||
|
||||
### DeepSeek V4.1-Flash (im Terminal, ab 0.2.4)
|
||||
|
||||
[DeepSeek V4.1-Flash](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF) ist ein anderes, deutlich größeres Modell. ISTA-DASLab hat die drei Sets unten gebaut. Strata startet sie auf einem PC mit einer 12-GB-Grafikkarte und 46 bis 64 GB RAM und liest den Rest von der SSD. Es läuft auf NVIDIA-RTX-Karten der Serien 30 bis 50 und auf der Radeon AI PRO R9700. Es nutzt ein eigenes Engine-Paket, `strata-dsv41`, das `strata launch` lädt, wenn du DeepSeek wählst. Die Desktop-App bietet es noch nicht an.
|
||||
|
||||
| Set | Download | Qualität im Vergleich zum Originalmodell | Antwortet mit |
|
||||
| --- | ---: | --- | --- |
|
||||
| **IQ1_M** (1,75 Bit) | 239 GB | KL 0,217, Perplexität 3,80 (+21 %); Code +8,9 %, Agent-Aufgaben +10,2 %; schwächer bei einfacher englischer Prosa. Laut Modellkarte von ISTA-DASLab behält es 98,7 % des Aufgabendurchschnitts des Basismodells (AIME25, GPQA-Diamond, LiveCodeBench v6). | noch nicht gemessen |
|
||||
| **IQ2_XXS** (2.00 Bit) | 257 GB | KL 0,170, Perplexität 3,63 (+15,5 %); Code +8,6 %, Agent-Aufgaben +5,3 % | etwa 8 bis 10 Tokens/s auf einer RTX 3060 (Code 9,9, Agent-Aufgaben 7,8), etwa 5 auf einer RTX 5070 |
|
||||
| **IQ2_XS** (2.25 Bit) | 274 GB | KL 0,107, Perplexität 3,37 (+7,3 %); Code +3,2 %, Agent-Aufgaben +2,2 % | etwa 11 Tokens/s auf einer Radeon AI PRO R9700 |
|
||||
| **IQ4_NL** (Engram-Tabelle, kein drittes Modell) | 111 GB, schon in allen drei Downloads oben enthalten | Die 4-Bit-Engram-Nachschlagetabelle, die das Modell aus RAM oder SSD liest. Alle drei Sets nutzen diese eine Datei (`DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf`). | n/a |
|
||||
|
||||
4x Radeon AI PRO R9700: etwa 31 Tokens/s, 55 bis 69 mit DSpark.
|
||||
|
||||
Starte es mit `strata launch --model ist-das-2.00bpw` (oder `ist-das-1.75bpw`, `ist-das-2.25bpw`). Details, Geschwindigkeiten je Karte und die manuelle Installation: [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md).
|
||||
|
||||
## Wie schnell ist es?
|
||||
|
||||
Gemessen mit einer Grafikkarte mit 12 GB (RTX 5070, Ryzen 5 7600, 64 GB RAM). Ergebnisse anderer Karten findest du hier:
|
||||
[Tempo jeder Größe](docs/MODELS.md#how-fast-is-each-size), [Ergebnisse der Community](docs/COMMUNITY_BENCHMARKS.md).
|
||||
|
||||
| Modell | Antworten erscheinen mit | Liest deinen Prompt mit |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████████` 94 Tokens/s | `████████████` 2.650 Tokens/s |
|
||||
| **IQ2_XS** | `██████████░░` 79 Tokens/s | `█████████░░░` 2.090 Tokens/s |
|
||||
| **IQ3_XXS** | `████████░░░░` 62 Tokens/s | `████████░░░░` 1.750 Tokens/s |
|
||||
| **IQ3_S** | `███████░░░░░` 53 Tokens/s | `███████░░░░░` 1.620 Tokens/s |
|
||||
| **Coder** | `███████░░░░░` 55 Tokens/s | `██████████░░` 2.180 Tokens/s |
|
||||
|
||||
Ein Token ist etwa ¾ eines Wortes, 60 Tokens pro Sekunde sind also schneller, als du lesen kannst. "Liest deinen Prompt"
|
||||
beschreibt, wie schnell Strata ein langes Dokument, Code oder einen Chatverlauf aufnimmt.
|
||||
|
||||
Gemessen mit einer AMD-Karte mit 16 GB (RX 9070 XT, Ryzen 9 3900X, 47 GB RAM):
|
||||
|
||||
| Modell | Antworten erscheinen mit | Liest deinen Prompt mit |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████░░░░` 60 Tokens/s | `█████░░░░░░░` 1.160 Tokens/s |
|
||||
| **IQ2_XS** | `███████░░░░░` 52 Tokens/s | `█████░░░░░░░` 1.110 Tokens/s |
|
||||
| **Coder** | `██████░░░░░░` 44 Tokens/s | `██████░░░░░░` 1.420 Tokens/s |
|
||||
|
||||
Die Balken haben in beiden Tabellen denselben Maßstab. Eine Karte mit mehr VRAM ist schneller. Eine RTX 3090 (24 GB) sollte
|
||||
etwa 100-140 Tokens pro Sekunde schreiben. Die Engine-Version hinter jeder Zahl steht in [DETAILS.md](docs/DETAILS.md#speed-measured).
|
||||
|
||||
## Benutzung
|
||||
|
||||
### In der App
|
||||
|
||||
Die App hat einen **Chat**, einen **Monitor** für das Modell sowie für GPU, CPU und RAM, eine Seite **Modelle** und die
|
||||
**Einstellungen**. Der Chat kann in einem Ordner auf deinem PC arbeiten. Im Modus **Manuell** fragt er nach, bevor er eine
|
||||
Datei ändert oder einen Befehl ausführt. Mit `/loop 10m <what to do>` wiederholst du eine Nachricht alle 10 Minuten, solange
|
||||
der Chat geöffnet ist.
|
||||
|
||||
Der Chat kann das Web mit DuckDuckGo (oder Bing) durchsuchen, ohne Konto. Unter **Einstellungen, Tools** kannst du einen
|
||||
Suchschlüssel hinzufügen. Die Suche ist die einzige Funktion, die etwas von deinem PC sendet (die Suchbegriffe).
|
||||
|
||||
Um zwei Modelle auszuführen, schalte **Mehrere Modelle ausführen** ein und gib jedem Modell eine eigene Karte desselben
|
||||
Herstellers.
|
||||
|
||||
<p align="center"><img src="docs/media/app-chat.png" width="900" alt="The Strata app: a chat where the agent built a small voxel pagoda garden, with the page open in the preview on the right"><br>
|
||||
<sub>Ein Chat in der Strata-App: Der Agent hat einen kleinen Voxel-Pagodengarten als eine HTML-Datei geschrieben, und die Seite öffnet sich in der Vorschau neben dem Gespräch</sub></p>
|
||||
|
||||
### Im Terminal
|
||||
|
||||
<p align="center"><img src="docs/media/terminal-monitor.png" width="900" alt="The Strata Terminal monitor overview while the model writes a reply"><br>
|
||||
<sub><code>strata monitor</code>, während das Modell antwortet: Geschwindigkeit, GPU, Speicher und die letzten Anfragen</sub></p>
|
||||
|
||||
```sh
|
||||
strata launch # guided screens: model, context, pictures, access, then serve
|
||||
strata launch --model q2_0 --yes --no-tui # no questions: serve, print the address, return
|
||||
strata launch --plan --model q2_0 # show what would happen; nothing changes
|
||||
strata launch --status # what is being served now
|
||||
strata launch --stop # stop it
|
||||
strata monitor --url http://127.0.0.1:8080 # watch speed, GPU, memory and requests
|
||||
strata update --check # is there a new engine? (strata update installs it)
|
||||
strata doctor # check the installed engine files
|
||||
```
|
||||
|
||||
`strata --help` listet alles auf. Starten und Bereitstellen laden nichts herunter. Nur die Installation, `strata launch`
|
||||
(wenn du ein Modell wählst) und `strata update` tun das. Um Strata von deinem Handy oder einem anderen PC aus zu erreichen,
|
||||
nutze `strata launch --access lan`. Der Befehl erzeugt einen API-Schlüssel und startet in einem Netzwerk nicht ohne einen.
|
||||
Ein Browser öffnet sich nur, wenn du `--open` angibst. Anleitung: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md). Der ganze Client: [docs/TERMINAL.md](docs/TERMINAL.md).
|
||||
|
||||
### Mit KI-Agents
|
||||
|
||||
Ein Agent installiert Strata mit dem Einzeiler aus Option B und führt
|
||||
`strata launch --model NAME --yes --no-tui` aus. Die Schritte, Flags und Exit-Codes stehen in [docs/AI_SETUP.md](docs/AI_SETUP.md),
|
||||
die Regeln für das Repository in [AGENTS.md](AGENTS.md).
|
||||
|
||||
### Andere Apps verbinden
|
||||
|
||||
| App-Typ | Basis-URL |
|
||||
| --- | --- |
|
||||
| OpenAI-kompatibel (die meisten Apps und Agents) | `http://127.0.0.1:8080/v1` (beliebiger API-Schlüssel, beliebiger Modellname) |
|
||||
| Anthropic-API (Claude Code und andere) | `http://127.0.0.1:8080`, ohne `/v1`. Diese Apps hängen `/v1/messages` selbst an. Claude Code: `ANTHROPIC_BASE_URL=http://127.0.0.1:8080` |
|
||||
| OpenAI Responses API (Codex CLI) | `http://127.0.0.1:8080/v1/responses` ([Einrichtung](docs/DETAILS.md#the-responses-api-and-codex-cli)) |
|
||||
|
||||
`strata connect` gibt die genauen Einstellungen für OpenCode, Codex CLI, Claude Code, oh-my-pi, pi, Hermes Agent und OpenClaw aus.
|
||||
`strata connect opencode --write` schreibt die Datei nach einer Rückfrage und legt eine Sicherung an.
|
||||
|
||||
### Bilder
|
||||
|
||||
Bilder sind für Modelle, die sie lesen können, standardmäßig eingeschaltet. Hänge ein Bild im Chat an oder füge es ein, oder
|
||||
sende es aus deiner App. Der Bildleser läuft auf dem Prozessor, wenn deine Grafikkarte weniger als 24 GB hat (einige Sekunden
|
||||
pro Bild, ohne Speicher der Karte zu belegen), und ab 24 GB auf der Grafikkarte. Die Regel gilt für NVIDIA und AMD gleich.
|
||||
Du kannst Bilder pro Modell ausschalten oder den Leser mit `--vision off`, `--vision gpu` oder `--vision cpu` wählen.
|
||||
|
||||
Die Zahlen hinter der Regel: Auf einer Radeon AI PRO R9700 brauchte der Bildleser der Karte 57 ms für ein Bild mit 260 Tokens,
|
||||
der des Prozessors 3,1 s. Auf Karten mit 16 GB (Tesla P100 und RTX A4000, Linux) kostete der Bildleser der Karte 3-5 % des
|
||||
Texttempos, weil er etwa 1,4 GB belegt, die sonst das Modell nutzen würde. Auf dem Mac liest die GPU, egal wie viel Speicher er hat (0,45 s für ein Bild mit 260 Tokens auf einem M4 mit 32 GB, etwa 1,2 GB des gemeinsamen
|
||||
Speichers); der Prozessor braucht dort etwa 50 s pro Bild und liest deshalb nur mit `--vision cpu`.
|
||||
|
||||
### Gut zu wissen
|
||||
|
||||
- Das Denkniveau (**aus, niedrig, mittel oder hoch**) stellst du im Chat-Menü oder unter "reasoning effort" in deiner App ein. Aus ist am schnellsten.
|
||||
- Strata beantwortet standardmäßig eine Anfrage nach der anderen. Für mehrere gleichzeitig nutze `--parallel N` in `strata launch` oder
|
||||
`"parallel": 2` in der Konfiguration ([BATCHING.md](docs/BATCHING.md)). Auf einer Karte mit 12 GB wird dadurch jede Antwort langsamer.
|
||||
- Strata liest die erste Nachricht eines Chats komplett, etwa 1 Minute pro 30.000 Tokens. Folgenachrichten starten in Sekunden.
|
||||
- Wo deine Chats gespeichert werden und die ganze API: [docs/INSTALL.md](docs/INSTALL.md#where-things-are-stored), [docs/DETAILS.md](docs/DETAILS.md#using-it).
|
||||
|
||||
## Aus dem Quellcode bauen
|
||||
|
||||
<details>
|
||||
<summary>Windows, Linux und Mac aus dem Repository</summary>
|
||||
|
||||
[Lade Strata herunter](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) und entpacke es, oder nutze `git clone`.
|
||||
**Windows:** Doppelklick auf `START-HERE.bat`. **Linux:** Führe `./setup.sh` im Strata-Ordner aus.
|
||||
|
||||
**Mac (Apple Silicon, macOS 15 oder neuer):** Installiere einmal die Command Line Tools von Apple mit `xcode-select --install`
|
||||
(Xcode selbst brauchst du nicht). Öffne das Terminal im Strata-Ordner und führe `./setup.sh` aus. Das Skript baut die
|
||||
Mac-Engine auf deinem Mac (etwa 7 Minuten), stellt dieselben Fragen, lädt das Modell herunter und startet es. Beim nächsten
|
||||
Mal startet `./setup.sh` sofort. Welche Größe zu deinem Mac passt: [docs/MAC.md](docs/MAC.md).
|
||||
|
||||
Der Installer erkennt deine Karte und richtet die passende Engine ein. Er fragt, welches Modell und welche Größe du willst,
|
||||
wie viel Kontext (wie viel Text sich das Modell merkt) und ob es Bilder lesen soll. Drück Enter für die empfohlene Antwort.
|
||||
Dann lädt er das Modell herunter (etwa 70 GB) und startet es. Wenn der Download abbricht, führe das Skript erneut aus, dann
|
||||
geht es weiter. Dein Browser öffnet die Strata-Seite unter `http://127.0.0.1:8080`.
|
||||
|
||||
> Während das Modell startet, kann dein PC 1-3 Minuten langsam sein oder nicht reagieren (beim ersten Mal am längsten). Strata
|
||||
> lädt 35-55 GB in deinen RAM und sperrt einen Teil davon für die Grafikkarte. Warte ab und schließe das Fenster nicht.
|
||||
|
||||
Starte beim nächsten Mal wieder `START-HERE.bat` (oder `./setup.sh`). Es startet sofort und lädt nichts doppelt herunter.
|
||||
Schließ sein Fenster, um das Modell zu beenden. `UPDATE.bat` (`./update.sh`) aktualisiert Strata, ohne es zu starten.
|
||||
Aktualisieren, Docker, mehrere Karten, wohin die Dateien kommen und alle Optionen: [docs/INSTALL.md](docs/INSTALL.md).
|
||||
|
||||
Um deinen PC zu messen, führe `BENCH.bat` (`./bench.sh`) aus. Das dauert 5-10 Minuten und schreibt einen Bericht, den du teilen
|
||||
kannst ([so geht's](docs/COMMUNITY_BENCHMARKS.md#run-the-benchmark)).
|
||||
|
||||
**Optional: mehr Tempo auf einer Karte, wenn das ganze Modell in den RAM passt.** Zwei Einstellungen zum Einschalten von
|
||||
RubenTorney (#1904, #1905). Sie helfen, wenn du eine Grafikkarte nutzt und dein RAM alle Experten aufnimmt, zum Beispiel bei
|
||||
Q2_0 oder IQ3_XXS auf einem PC mit 64 GB. Öffne `strata-<model>.json` im Strata-Datenordner ([wo](docs/INSTALL.md#where-things-are-stored)) und ergänze:
|
||||
|
||||
- `"--adapt-async", "1"` in der Liste `"args"`. Der Expertencache wird dann in einem Hilfsthread aktualisiert, statt die
|
||||
Antwort anzuhalten. Gemessen auf einer RTX 5070 (Windows, Q2_0): +4-5 % beim Decodieren, +7-10 % bei Code und langen
|
||||
Dokumenten. Die Antworten können sich leicht von der Standardeinstellung unterscheiden und bleiben von Lauf zu Lauf gleich.
|
||||
- `"STRATA_PIN_BY_NEED": "1"` im Block `"env"` (Windows). Windows kann nur etwa die Hälfte des RAM für die Grafikkarte sperren,
|
||||
und diese Einstellung sperrt zuerst die Experten, die die Karte am dringendsten braucht. Gemessen auf der RTX 5070: +4,4 % beim Lesen des Prompts.
|
||||
|
||||
```json
|
||||
"args": [ ..., "--adapt-async", "1" ],
|
||||
"env": { "STRATA_PIN_BY_NEED": "1" }
|
||||
```
|
||||
|
||||
Starte Strata nach der Änderung neu. Zum Rückgängigmachen entfernst du die beiden Einträge.
|
||||
Folge den Anweisungen, um ein Modell herunterzuladen und zu starten. [Terminal-Anleitung](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
</details>
|
||||
|
||||
## Wie funktioniert das?
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="Strata-Terminal-App mit Modellaktivität, Tempo, Speicher und letzten Anfragen">
|
||||
<br><sub>Behalte Modell und Hardware im Blick, während es läuft.</sub>
|
||||
</p>
|
||||
|
||||
Modelle wie dieses laufen normalerweise auf Servern mit Hunderten Gigabyte Grafikspeicher. Deine Grafikkarte hat 12-24 GB.
|
||||
Strata bringt das Modell auf deinen PC, indem es die Arbeit auf den ganzen Rechner verteilt. Stell dir eine Bibliothek vor.
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
- Das Modell ist ein Team aus 24.576 kleinen Spezialisten ("Experten"), wie 24.576 Nachschlagewerke. Für jedes Wort braucht es nur 10 davon.
|
||||
- **Deine Grafikkarte ist der Schreibtisch.** Er ist klein und schnell. Die etwa 4.000 am häufigsten genutzten Bücher liegen
|
||||
dort aufgeschlagen.
|
||||
- **Dein RAM sind die Regale im Lesesaal.** Alle 24.576 Bücher stehen dort. Braucht ein Wort ein Buch, das nicht auf dem
|
||||
Schreibtisch liegt, holt dein Prozessor es sofort aus dem Regal, während die Karte weiterarbeitet.
|
||||
- **Deine SSD ist das Archiv.** Sie enthält eine Nachschlagetabelle von 29 GB. Das Modell liest pro Wort nur wenige Zeilen
|
||||
daraus, deshalb muss sie nicht im RAM liegen.
|
||||
[Aus dem Quellcode bauen](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [Vollständige Installationsanleitung](docs/INSTALL.md)
|
||||
|
||||
<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
Ein kleiner Helfer rät außerdem die nächsten Wörter. Das große Modell prüft sie alle auf einmal und behält die richtigen. Du
|
||||
bekommst dieselbe Antwort, 1,6-1,8-mal früher. Lange Texte werden in großen Stücken gelesen, bis zu 8.192 Tokens auf einmal,
|
||||
mit über 1.000 Tokens pro Sekunde.
|
||||
## Hardware
|
||||
|
||||
<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>
|
||||
| Unterstützte Hardware | Anleitung |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX 20 / 30 / 40 / 50** | [NVIDIA-Setup](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900, RX 9060 / 9070, AI PRO R9700** | [AMD-Setup](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · experimentell** | [RX-6000-Setup](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Intel-Setup](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 oder neuer** | [Mac-Setup](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Strix-Halo-Setup](docs/STRIX_HALO.md) |
|
||||
|
||||
Die ausführliche Erklärung: [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md). Jeder Teil mit seinen Zahlen:
|
||||
[die Details](docs/DETAILS.md#how-it-works) und das [Paper](docs/paper/Strata-Paper.pdf).
|
||||
<a id="using-it"></a>
|
||||
|
||||
## Etwas ist schiefgegangen?
|
||||
## Tools
|
||||
|
||||
- **Mein PC ist beim ersten Start von Strata eingefroren.** Strata lädt das Modell in den RAM. Warte ab und schließe das
|
||||
Fenster nicht. Nach 10 Minuten immer noch eingefroren? Starte den PC neu, schließe andere Programme und versuch es noch
|
||||
einmal, oder wähle eine kleinere Größe.
|
||||
- **Es ist beim Herunterladen oder Installieren stehen geblieben.** Starte die App oder `strata launch` noch einmal, oder
|
||||
führe `START-HERE.bat` (oder `./setup.sh`) erneut aus. Es macht dort weiter, wo es aufgehört hat.
|
||||
- **Es ist sehr langsam, die Festplattenanzeige blinkt ständig, oder es meldet "the engine stopped unexpectedly".** Dein PC
|
||||
hat nicht genug freien RAM. Schließe andere Programme (Browser brauchen viel) oder wähle eine kleinere Größe wie Q2_0 oder IQ2_XS.
|
||||
- **Es meldet, dass es keine Engine für diesen PC gibt.** Öffne in der App **Einstellungen, Engine** und drücke **Engine
|
||||
aktualisieren**. Führe im Terminal `strata update` aus. `strata doctor` zeigt, welche Engine-Dateien installiert sind.
|
||||
- **Es meldet, dass Port 8080 schon belegt ist.** Strata läuft bereits. Such das Fenster.
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw**, und weitere über die OpenAI- und Anthropic-kompatiblen APIs.
|
||||
|
||||
Weitere Probleme und Lösungen: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md). Du kommst nicht weiter? Öffne ein
|
||||
[Issue](https://github.com/Niko1221/Strata/issues). Hänge in der App die Datei aus **Einstellungen, Engine, Diagnose, Protokolle anzeigen, Protokolle speichern** an. Füge im Terminal die Ausgabe von `strata doctor` ein. Hänge beim Start aus dem Quellcode die
|
||||
Datei `strata-<model>.log` aus dem Strata-Ordner an. Ein Sicherheitsproblem meldest du bitte privat: [SECURITY.md](SECURITY.md).
|
||||
Führe **`strata connect`** aus, um die Einrichtung für dein Tool zu sehen. [Verbindungsanleitung](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect).
|
||||
|
||||
## Danksagung und Lizenz
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
Das Modell ist [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) vom Qwen-Team. Komprimiert wurde es von
|
||||
[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF), UkisAI (Swift 1.5), agentionai (Gyro)
|
||||
und Unsloth. Strata nutzt Teile von [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp). Alle Danksagungen:
|
||||
[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits). Strata ist Open Source unter der [MIT-Lizenz](LICENSE). Einige Teile und
|
||||
alle Modelle haben eigene Lizenzen ([welche](docs/HOW_IT_WORKS.md#license)).
|
||||
## Hilfe
|
||||
|
||||
## Mitmachen
|
||||
|
||||
Du hast einen Fehler gefunden oder willst eine Änderung oder einen Benchmark einsenden? Lies zuerst [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
Dort steht, was dazugehört, damit andere deine Arbeit nachprüfen können.
|
||||
[Alle Anleitungen](docs) · [Fehlerbehebung](docs/TROUBLESHOOTING.md) · [Fehler melden](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[Benchmarks](docs/COMMUNITY_BENCHMARKS.md) · [So funktioniert es](docs/HOW_IT_WORKS.md) · [Mitmachen](CONTRIBUTING.md)
|
||||
|
||||
## Strata unterstützen
|
||||
|
||||
Strata ist kostenlos und steht unter der MIT-Lizenz. Ich baue es und teste es auf jeder Hardware, die ich bekommen kann. Wenn es auf deinem PC gut läuft, hilft mir ein Kaffee,
|
||||
weiter neue Karten zu testen und das zu beheben, was ihr meldet. Es besteht kein Druck. Strata zu nutzen und zu melden, was dir auffällt, hilft genauso viel.
|
||||
**Hilf mit, lokale KI für alle offen zu halten.** Ein Kaffee hilft, Entwicklung und Tests auf mehr Hardware zu finanzieren.
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee: Strata unterstützen" height="48"></a>
|
||||
|
||||
Du möchtest Strata sponsern? Schreib mir über [GitHub](https://github.com/Niko1221).
|
||||
[MIT-Lizenz](LICENSE) · [Danksagung und Modelllizenzen](docs/HOW_IT_WORKS.md#credits) · [Datenschutz](docs/SAFETY.md)
|
||||
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>Für KI-Tools und automatische Leser: <a href="AGENTS.md">technische Referenz</a> · <a href="docs/AI_SETUP.md">Setup-Anleitung</a>.</sub>
|
||||
|
||||
**Sponsoring, Hardware-Partnerschaften oder Zusammenarbeit:** [[email protected]](mailto:[email protected]).
|
||||
+120
-350
@@ -1,418 +1,188 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="380">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <b>Español</b> · <a href="README.pt-BR.md">Português</a></p>
|
||||
|
||||
<h3 align="center">Ejecuta un modelo de última generación en tu propio PC gaming</h3>
|
||||
|
||||
<p align="center">Compatible con NVIDIA, AMD, Intel · Windows, Linux, Mac · libre y de código abierto</p>
|
||||
<h3 align="center">IA potente en tu propio ordenador.</h3>
|
||||
<p align="center">Chatea, programa y trabaja con imágenes, en local.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?include_prereleases&label=release" alt="Latest release"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://github.com/Niko1221/Strata/stargazers"><img src="https://img.shields.io/github/stars/Niko1221/Strata?style=flat" alt="GitHub stars"></a>
|
||||
<a href="#modelos">Modelos</a> · <a href="#instalación"><b>Instalación</b></a> ·
|
||||
<a href="#hardware">Hardware</a> · <a href="#herramientas">Herramientas</a> ·
|
||||
<a href="#ayuda">Ayuda</a> · <a href="#apoya-strata">Apoyar</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br>
|
||||
<sub>Un jardín con una pagoda de vóxeles, hecho con un solo prompt en una RTX 5070 con Strata (IQ3_S, contexto de 128K) ·
|
||||
<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">vídeo completo (49 s)</a></sub></p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="Descargar Strata"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="Licencia MIT"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="Apoya Strata en Buy Me a Coffee"></a>
|
||||
</p>
|
||||
|
||||
Strata ejecuta **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)**, un modelo de 125 mil millones
|
||||
de parámetros que normalmente necesita un servidor, en un PC normal. Conversa, escribe código, lee imágenes y funciona
|
||||
con tus aplicaciones y tus agentes de programación. Tus chats y tus archivos se quedan en tu PC.
|
||||
<p align="center"><sub><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <b>Español</b> · <a href="README.pt-BR.md">Português</a> · <a href="README.pl.md">Polski</a></sub></p>
|
||||
|
||||
**¿Eres nuevo?** Mira [lo que necesitas](#lo-que-necesitas) y luego [instala la aplicación](#opción-a-la-aplicación-strata).
|
||||
**Gratis, de código abierto y tuyo para ejecutar.** Usa Strata en tu escritorio o con tus herramientas de programación favoritas. No necesitas cuenta.
|
||||
|
||||
- **Funciona en un PC gaming.** Con 32 GB entre RAM y memoria gráfica ya puedes empezar.
|
||||
- **Funciona con tus herramientas.** Habla las API de OpenAI y de Anthropic, así que Claude Code, Codex CLI, OpenCode y otros agentes se conectan a él.
|
||||
- **Lee imágenes.** Viene activado por defecto.
|
||||
- **Gratis.** Licencia MIT, sin cuenta, sin nube.
|
||||
- **Privado.** Sin telemetría. Lo que Strata descarga, cuándo usa internet y cómo comprueba las descargas está en [docs/SAFETY.md](docs/SAFETY.md).
|
||||
## Modelos
|
||||
|
||||
Versión 0.2.3 · motor 0.1.48
|
||||
Recomendamos **primero ISTA-DASLab**, después **Unsloth** y otros proveedores, siempre que haya un modelo compatible que quepa en tu memoria.
|
||||
|
||||
## Lo que necesitas
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
**Necesitas al menos 32 GB entre RAM y memoria gráfica (VRAM).** En un Mac o un Ryzen AI Max, es la memoria unificada.
|
||||
Con más memoria puedes usar un modelo más grande o más rápido.
|
||||
|
||||
- Un PC de 32 GB con una tarjeta de 12 a 16 GB ejecuta el Coder.
|
||||
- Con 64 GB de RAM funcionan todos los tamaños.
|
||||
|
||||
| Tu ordenador | Detalles |
|
||||
| Proveedor | Opciones |
|
||||
| --- | --- |
|
||||
| **NVIDIA** GeForce RTX serie 20, 30, 40, 50 (12 GB o más) | Instala la aplicación o la Terminal. |
|
||||
| **AMD** Radeon RX 6800 y posteriores, Radeon AI PRO R9700 (12 GB o más) | [Tarjetas AMD](docs/AMD_HIP.md) |
|
||||
| **Intel** Arc | [Intel Arc](docs/INTEL_ARC.md), [motor Intel](docs/INTEL.md) |
|
||||
| **Mac con Apple Silicon** (M1 o posterior, macOS 15 o posterior) | [Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max (Strix Halo)** y otros sistemas con memoria unificada | [Strix Halo](docs/STRIX_HALO.md) |
|
||||
| Tarjetas y procesadores antiguos | [GPU antiguas](docs/OLDER_GPUS.md), [CPU antiguas](docs/INSTALL.md#older-cpus-experimental) |
|
||||
| **ISTA-DASLab · recomendado** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S. [Coder: IQ1\_M](docs/MODELS.md#coder) para programar. |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF). Usa menos memoria, pero es más lento. |
|
||||
| **Otras opciones** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
También hace falta:
|
||||
[Compara tamaños, necesidades de memoria y compatibilidad](docs/MODELS.md).
|
||||
|
||||
- unos 80 GB de disco libre (con un SSD el primer arranque es mucho más rápido)
|
||||
- Windows 10 / 11, Linux o macOS
|
||||
- un controlador gráfico actual
|
||||
</details>
|
||||
|
||||
Dos o tres tarjetas de la misma marca pueden compartir un modelo ([multi-GPU](docs/MULTI_GPU.md)). Strata nunca reparte un
|
||||
modelo entre tarjetas NVIDIA y AMD. Lista completa: [docs/INSTALL.md](docs/INSTALL.md#what-you-need).
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0. Son los paquetes documentados actualmente para este modelo.
|
||||
|
||||
[Guía del modelo y compatibilidad](docs/QWEN36.md).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
En la **aplicación de escritorio** y en el **Terminal**. Lo que no cabe en la memoria se lee desde tu SSD, así que hace falta mucho espacio libre en disco.
|
||||
|
||||
| Conjunto (IST-DAS) | Descarga | Espacio libre necesario |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | unos 245 GB |
|
||||
| 2.00 bpw | 257 GB | unos 265 GB |
|
||||
| 2.25 bpw | 274 GB | unos 280 GB |
|
||||
|
||||
Funciona en NVIDIA RTX 30, 40 y 50 (Windows y Linux) y en AMD Radeon AI PRO R9700 (Linux). La instalación descarga los archivos y el motor de DeepSeek, y después inicia el modelo.
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
Medido con el conjunto de 2.00 bpw en Strata 0.2.5. «Salida» es la velocidad de la respuesta; «Prompt» es la rapidez con la que Strata lee tu texto.
|
||||
|
||||
| Hardware | Salida | Prompt |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB de RAM | 4 a 6 tokens/s | unos 110 tokens/s (4K) |
|
||||
| RTX 3060 12 GB, 46 GB de RAM | 9 a 11 tokens/s | unos 155 tokens/s (4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB de RAM | 21 a 25 tokens/s | 320 a 360 tokens/s (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74 a 77 tokens/s | 400 a 450 tokens/s (8K) |
|
||||
|
||||
[Memoria, disco y detalles](docs/DEEPSEEK41.md) · [Notas de la versión](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
¿No sabes qué cabe? [Elige un modelo para tu ordenador](docs/MODELS.md#pick-by-memory).
|
||||
|
||||
## Instalación
|
||||
|
||||
Elige una opción. Todas arrancan el mismo motor y usan los mismos modelos.
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### Opción A: la aplicación Strata
|
||||
### Aplicación de escritorio
|
||||
|
||||
La forma más fácil. La aplicación lleva el motor dentro: la instalas, eliges un modelo y chateas. Descarga el archivo para
|
||||
tu sistema y tu tarjeta gráfica desde la [página de versiones](https://github.com/Niko1221/Strata/releases/latest). ¿No
|
||||
sabes cuál elegir? Mira el párrafo que hay debajo de la tabla.
|
||||
**[Descargar Strata para Windows, Linux o Mac →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
| Sistema | Tu tarjeta gráfica | Archivo que descargar |
|
||||
| --- | --- | --- |
|
||||
| **Windows 10 / 11** | NVIDIA RTX, controlador 580 o posterior | [`Strata-0.2.3-windows-cuda13.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda13.exe) |
|
||||
| | NVIDIA, tarjeta más antigua o controlador anterior a 580 | [`Strata-0.2.3-windows-cuda12.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda12.exe) |
|
||||
| | AMD Radeon serie RX 9000 o Radeon AI PRO R9700 | [`Strata-0.2.3-windows-hip.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip.exe) |
|
||||
| | AMD Radeon serie RX 7000 o Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-windows-hip-rdna3.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip-rdna3.exe) |
|
||||
| **Linux** | NVIDIA RTX, controlador 580 o posterior | [`Strata-0.2.3-linux-nvidia-cuda13.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda13.AppImage) |
|
||||
| | NVIDIA, tarjeta más antigua o controlador anterior a 580 | [`Strata-0.2.3-linux-nvidia-cuda12.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda12.AppImage) |
|
||||
| | AMD Radeon serie RX 9000 o Radeon AI PRO R9700 | [`Strata-0.2.3-linux-amd-rx9070.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx9070.AppImage) |
|
||||
| | AMD Radeon serie RX 7000 | [`Strata-0.2.3-linux-amd-rx7900.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx7900.AppImage) |
|
||||
| | AMD Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-linux-amd-strixhalo.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-strixhalo.AppImage) |
|
||||
| **Mac** (Apple Silicon, macOS 15 o posterior) | integrada | [`Strata-0.2.3-mac.dmg`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-mac.dmg) |
|
||||
Instala la aplicación, elige un modelo y empieza a chatear. Hay un instalador por sistema. En el primer arranque, la aplicación descarga el motor para tu tarjeta gráfica. [Ayuda con el instalador](docs/INSTALL.md#the-app).
|
||||
|
||||
**Si no estás seguro:** con NVIDIA, elige `cuda13` si la versión de tu controlador es la 580 o posterior, y `cuda12` en caso
|
||||
contrario. `cuda12` es para tarjetas y controladores más antiguos. Los archivos `hip` y `amd` son para tarjetas AMD. Las
|
||||
demás tarjetas AMD (RX 6000) todavía no tienen una aplicación ya preparada: mira
|
||||
[Tarjetas AMD](docs/AMD_HIP.md).
|
||||
<sub>Archivos: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
Después:
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="Aplicación de escritorio de Strata con un chat y una vista previa del código en vivo, una junto a otra">
|
||||
<br><sub>Chat, archivos y vista previa en vivo en una sola ventana.</sub>
|
||||
</p>
|
||||
|
||||
- **Windows:** ejecuta el `.exe`. Se instala para tu usuario y no necesita permisos de administrador. Si Windows muestra
|
||||
"Windows protegió tu PC", elige **Más información** y luego **Ejecutar de todas formas** (el instalador todavía no está
|
||||
firmado).
|
||||
- **Linux:** haz el archivo ejecutable (`chmod +x`) y lánzalo. Necesita FUSE 2: `sudo apt install libfuse2` (Ubuntu 22.04)
|
||||
o `libfuse2t64` (Ubuntu 24.04 y posteriores).
|
||||
- **Mac:** abre el `.dmg` y arrastra Strata a Aplicaciones.
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
En la primera pantalla, la aplicación analiza tu PC y recomienda un modelo adecuado. Pulsa Instalar. El modelo es una
|
||||
descarga grande (unos 40 a 70 GB) y, si se interrumpe, continúa donde se quedó. Al cerrar la ventana, Strata y el motor se
|
||||
detienen.
|
||||
### Aplicación de Terminal
|
||||
|
||||
### Opción B: la Terminal (una línea)
|
||||
¿Prefieres la terminal? Instala Strata y ejecuta **`strata launch`**.
|
||||
|
||||
La Terminal es el comando `strata`, pensado para scripts, servidores y agentes de IA.
|
||||
<details open>
|
||||
<summary><b>Comandos de instalación</b></summary>
|
||||
|
||||
Linux y Mac:
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
Windows (PowerShell):
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
El script analiza tu PC, descarga la Terminal, verifica su SHA-256 y la descomprime en tu carpeta personal. No necesita
|
||||
permisos de administrador. En Windows, abre una ventana de terminal nueva después. Luego arranca Strata:
|
||||
En Windows, abre una terminal nueva después. Luego:
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
Te hace una pregunta cada vez: modelo, contexto, imágenes, quién puede conectarse. Después descarga el motor para tu tarjeta
|
||||
gráfica (firmado y arrancado como prueba antes de usarlo) y el modelo, y empieza a servir. Para scripts y agentes de IA, usa
|
||||
opciones:
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
Si quieres leer el script de instalación antes de ejecutarlo, descárgalo primero con `curl -fsSL <address> -o install.sh`,
|
||||
léelo y luego ejecuta `sh install.sh`. Todas las pantallas y opciones: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
### Opción C: que lo instale tu IA
|
||||
|
||||
Pega esto en Claude Code, Cursor, Codex, GitHub Copilot u otro asistente de programación:
|
||||
|
||||
```text
|
||||
Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.
|
||||
```
|
||||
|
||||
El asistente revisa tu tarjeta gráfica, tu RAM y tu disco, elige el modelo adecuado, lo instala y lo arranca, y te explica
|
||||
cómo conectar tus aplicaciones. Las herramientas de IA también pueden instalar, arrancar y detener Strata mediante su
|
||||
[servidor MCP](docs/MCP_SERVER.md).
|
||||
|
||||
¿Prefieres compilarlo tú? Mira [Compilar desde el código fuente](#compilar-desde-el-código-fuente).
|
||||
|
||||
## Modelos
|
||||
|
||||
La aplicación y `strata launch` recomiendan un modelo según tu memoria. Es un solo modelo en varios tamaños, más o menos
|
||||
comprimido. Los tamaños pequeños son más rápidos. Los grandes son algo más inteligentes.
|
||||
|
||||
### ¿Poca memoria? Prueba Gyro
|
||||
|
||||
[Gyro](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF) (de agentionai) es la forma más pequeña de ejecutar este modelo.
|
||||
|
||||
| Tamaño | Memoria que necesita (RAM + VRAM) | Descarga | Qué es |
|
||||
| --- | ---: | ---: | --- |
|
||||
| **Gyro-S** | 27,6 GB | 58,5 GB | Para PC donde no cabe nada más. La calidad es menor que la de IQ2_XS. |
|
||||
| **Gyro-M** | 35 GB | 92,0 GB | Calidad parecida a IQ3_XXS con un 20 % menos de memoria de GPU. Escribe las respuestas un 16 % más despacio que Q2_0 en una RTX 3060 de 12 GB y un 21 % más despacio en una R9700. |
|
||||
|
||||
Gyro funciona en tarjetas NVIDIA y AMD (en AMD es experimental) en tarjetas Intel Arc con Linux (probado en una Arc A750) y, desde 0.2.2, en Mac con Apple Silicon (Gyro-S en un Mac mini de 32 GB: 9 tokens/s, con los expertos leídos del SSD). Detalles y mediciones:
|
||||
[docs/GYRO.md](docs/GYRO.md). Arráncalo con `strata launch --model gyro-s`.
|
||||
|
||||
### Los demás tamaños
|
||||
|
||||
| Tu memoria (RAM + VRAM) | Elige | Notas |
|
||||
| --- | --- | --- |
|
||||
| **32 GB** | **Gyro-S**, o el **[Coder](docs/MODELS.md#coder)** para código | El Coder necesita 32 GB de RAM y conserva la mitad de los expertos, así que es más flojo fuera del código |
|
||||
| **40 GB** | **[Swift 1.5](docs/MODELS.md#swift-15)** IQ2_XS (39,2 GB), o **Gyro-M** (35 GB) | Swift piensa menos tiempo antes de responder. Gyro-M se acerca a la calidad de IQ3_XXS, pero escribe las respuestas un 16-21 % más despacio que Q2_0 |
|
||||
| **48 GB** | **IQ3_XXS** (47,0 GB) | Más lento, mejor |
|
||||
| **64 GB** | **IQ3_S** (54,8 GB), el original o Swift 1.5 | El más lento, el mejor. Iguala al modelo completo en las pruebas publicadas |
|
||||
| **96 GB o más** | **UD-IQ4_XS** de Unsloth (unos 72 GB de RAM) hasta **Q8_0** (unos 136 GB), de 4 a 8 bits | Más cerca del modelo completo. Con menos RAM, Strata lee una parte desde el SSD, que es mucho más lento |
|
||||
|
||||
Con menos RAM de la que indica una fila también puede funcionar: Strata pasa solo a su
|
||||
[modo de poca RAM](docs/MODELS.md#a-big-graphics-card-and-little-ram). Espera que sea más lento, y mucho más lento con una
|
||||
tarjeta gráfica pequeña.
|
||||
|
||||
Más opciones:
|
||||
|
||||
- **[Swift 1.5](docs/MODELS.md#swift-15)** es un ajuste fino que piensa menos tiempo antes de responder, con una calidad y un uso de RAM casi iguales.
|
||||
- **[NVFP4](docs/NVFP4.md)** es la versión de 4 bits de NVIDIA para tarjetas NVIDIA. Necesita unos 80 GB de RAM para tener todos los expertos en RAM.
|
||||
- **[Qwen3.6-35B-A3B](docs/QWEN36.md)** es un modelo más pequeño y distinto que lee imágenes y puede atender varias peticiones a la vez.
|
||||
- **[El Uncensored IQ3_XXS de OrcaRouter](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** se configura a mano.
|
||||
|
||||
Todos los tamaños, descargas y lo que cabe en cada equipo: [docs/MODELS.md](docs/MODELS.md).
|
||||
|
||||
### DeepSeek V4.1-Flash (en el Terminal, desde 0.2.4)
|
||||
|
||||
[DeepSeek V4.1-Flash](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF) es otro modelo, mucho más grande. ISTA-DASLab hizo los tres conjuntos de abajo. Strata los ejecuta en un PC con una tarjeta gráfica de 12 GB y de 46 a 64 GB de RAM, y lee el resto de tu SSD. Funciona en tarjetas NVIDIA RTX de las series 30 a 50 y en la Radeon AI PRO R9700. Usa su propio paquete de motor, `strata-dsv41`, que `strata launch` descarga cuando eliges DeepSeek. La app de escritorio todavía no lo ofrece.
|
||||
|
||||
| Conjunto | Descarga | Calidad frente al modelo original | Responde a |
|
||||
| --- | ---: | --- | --- |
|
||||
| **IQ1_M** (1,75 bits) | 239 GB | KL 0,217, perplejidad 3,80 (+21 %); código +8,9 %, tareas de agente +10,2 %; más débil con prosa inglesa corriente. Según la ficha del modelo de ISTA-DASLab, conserva el 98,7 % del promedio de tareas del modelo base (AIME25, GPQA-Diamond, LiveCodeBench v6). | aún sin medir |
|
||||
| **IQ2_XXS** (2.00 bits) | 257 GB | KL 0,170, perplejidad 3,63 (+15,5 %); código +8,6 %, tareas de agente +5,3 % | de 8 a 10 tokens/s en una RTX 3060 (código 9,9, tareas de agente 7,8), unos 5 en una RTX 5070 |
|
||||
| **IQ2_XS** (2.25 bits) | 274 GB | KL 0,107, perplejidad 3,37 (+7,3 %); código +3,2 %, tareas de agente +2,2 % | unos 11 tokens/s en una Radeon AI PRO R9700 |
|
||||
| **IQ4_NL** (tabla Engram, no es un tercer modelo) | 111 GB, ya incluidos en las tres descargas de arriba | La tabla de consulta Engram de 4 bits que el modelo lee de la RAM o del SSD. Los tres conjuntos usan este único archivo (`DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf`). | n/a |
|
||||
|
||||
4x Radeon AI PRO R9700: unos 31 tokens/s, de 55 a 69 con DSpark.
|
||||
|
||||
Inícialo con `strata launch --model ist-das-2.00bpw` (o `ist-das-1.75bpw`, `ist-das-2.25bpw`). Detalles, velocidades por tarjeta e instalación manual: [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md).
|
||||
|
||||
## ¿Qué velocidad tiene?
|
||||
|
||||
Medido con una tarjeta gráfica de 12 GB (RTX 5070, Ryzen 5 7600, 64 GB de RAM). Resultados con otras tarjetas:
|
||||
[velocidad de cada tamaño](docs/MODELS.md#how-fast-is-each-size), [resultados de la comunidad](docs/COMMUNITY_BENCHMARKS.md).
|
||||
|
||||
| Modelo | Las respuestas aparecen a | Lee tu prompt a |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████████` 94 tokens/s | `████████████` 2.650 tokens/s |
|
||||
| **IQ2_XS** | `██████████░░` 79 tokens/s | `█████████░░░` 2.090 tokens/s |
|
||||
| **IQ3_XXS** | `████████░░░░` 62 tokens/s | `████████░░░░` 1.750 tokens/s |
|
||||
| **IQ3_S** | `███████░░░░░` 53 tokens/s | `███████░░░░░` 1.620 tokens/s |
|
||||
| **Coder** | `███████░░░░░` 55 tokens/s | `██████████░░` 2.180 tokens/s |
|
||||
|
||||
Un token equivale a unos ¾ de palabra, así que 60 tokens por segundo es más rápido de lo que puedes leer. "Lee tu prompt"
|
||||
es lo rápido que Strata procesa un documento largo, código o un historial de chat.
|
||||
|
||||
Medido con una tarjeta AMD de 16 GB (RX 9070 XT, Ryzen 9 3900X, 47 GB de RAM):
|
||||
|
||||
| Modelo | Las respuestas aparecen a | Lee tu prompt a |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████░░░░` 60 tokens/s | `█████░░░░░░░` 1.160 tokens/s |
|
||||
| **IQ2_XS** | `███████░░░░░` 52 tokens/s | `█████░░░░░░░` 1.110 tokens/s |
|
||||
| **Coder** | `██████░░░░░░` 44 tokens/s | `██████░░░░░░` 1.420 tokens/s |
|
||||
|
||||
Las barras usan la misma escala en las dos tablas. Una tarjeta con más VRAM es más rápida. Una RTX 3090 (24 GB) debería
|
||||
escribir unos 100-140 tokens por segundo. La versión del motor detrás de cada cifra está en [DETAILS.md](docs/DETAILS.md#speed-measured).
|
||||
|
||||
## Uso
|
||||
|
||||
### En la aplicación
|
||||
|
||||
La aplicación tiene un **Chat**, un **Monitor** del modelo y de tu GPU, CPU y RAM, una página de **Modelos** y los
|
||||
**Ajustes**. El chat puede trabajar en una carpeta de tu PC. En modo **Manual** pregunta antes de cambiar un archivo o
|
||||
ejecutar un comando. Escribe `/loop 10m <what to do>` para repetir un mensaje cada 10 minutos mientras el chat esté abierto.
|
||||
|
||||
El chat puede buscar en la web con DuckDuckGo (o Bing), sin cuenta. Puedes añadir una clave de búsqueda en **Ajustes,
|
||||
Herramientas**. La búsqueda es la única función que envía algo fuera de tu PC (las palabras que buscas).
|
||||
|
||||
Para ejecutar dos modelos, activa **Ejecutar varios modelos** y dale a cada modelo su propia tarjeta de la misma marca.
|
||||
|
||||
<p align="center"><img src="docs/media/app-chat.png" width="900" alt="The Strata app: a chat where the agent built a small voxel pagoda garden, with the page open in the preview on the right"><br>
|
||||
<sub>Un chat en la app de Strata: el agente escribió un pequeño jardín de pagoda de vóxeles en un solo archivo HTML, y la página se abre en la vista previa junto a la conversación</sub></p>
|
||||
|
||||
### En la Terminal
|
||||
|
||||
<p align="center"><img src="docs/media/terminal-monitor.png" width="900" alt="The Strata Terminal monitor overview while the model writes a reply"><br>
|
||||
<sub><code>strata monitor</code> mientras el modelo responde: velocidad, GPU, memoria y las últimas solicitudes</sub></p>
|
||||
|
||||
```sh
|
||||
strata launch # guided screens: model, context, pictures, access, then serve
|
||||
strata launch --model q2_0 --yes --no-tui # no questions: serve, print the address, return
|
||||
strata launch --plan --model q2_0 # show what would happen; nothing changes
|
||||
strata launch --status # what is being served now
|
||||
strata launch --stop # stop it
|
||||
strata monitor --url http://127.0.0.1:8080 # watch speed, GPU, memory and requests
|
||||
strata update --check # is there a new engine? (strata update installs it)
|
||||
strata doctor # check the installed engine files
|
||||
```
|
||||
|
||||
`strata --help` lo lista todo. Arrancar y servir no descargan nada. Solo lo hacen la instalación, `strata launch` (cuando
|
||||
eliges un modelo) y `strata update`. Para llegar a Strata desde tu móvil u otro PC, usa `strata launch --access lan`. Crea
|
||||
una clave de API y no arranca en una red sin ella. No se abre ningún navegador salvo que añadas `--open`. Guía:
|
||||
[docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md). El cliente completo: [docs/TERMINAL.md](docs/TERMINAL.md).
|
||||
|
||||
### Con agentes de IA
|
||||
|
||||
Un agente instala Strata con el comando de una línea de la opción B y ejecuta
|
||||
`strata launch --model NAME --yes --no-tui`. Los pasos, las opciones y los códigos de salida están en [docs/AI_SETUP.md](docs/AI_SETUP.md),
|
||||
y las reglas del repositorio en [AGENTS.md](AGENTS.md).
|
||||
|
||||
### Conecta tus otras aplicaciones
|
||||
|
||||
| Tipo de aplicación | URL base |
|
||||
| --- | --- |
|
||||
| Compatible con OpenAI (la mayoría de aplicaciones y agentes) | `http://127.0.0.1:8080/v1` (cualquier clave de API, cualquier nombre de modelo) |
|
||||
| API de Anthropic (Claude Code y otros) | `http://127.0.0.1:8080`, sin `/v1`. Estas aplicaciones añaden `/v1/messages` por su cuenta. Claude Code: `ANTHROPIC_BASE_URL=http://127.0.0.1:8080` |
|
||||
| API OpenAI Responses (Codex CLI) | `http://127.0.0.1:8080/v1/responses` ([configuración](docs/DETAILS.md#the-responses-api-and-codex-cli)) |
|
||||
|
||||
`strata connect` muestra los ajustes exactos para OpenCode, Codex CLI, Claude Code, oh-my-pi, pi, Hermes Agent y OpenClaw.
|
||||
`strata connect opencode --write` escribe el archivo después de preguntar y guarda una copia de seguridad.
|
||||
|
||||
### Imágenes
|
||||
|
||||
Las imágenes vienen activadas por defecto en los modelos que pueden leerlas. Adjunta o pega una imagen en el chat, o envíala
|
||||
desde tu aplicación. El lector de imágenes funciona en el procesador cuando tu tarjeta gráfica tiene menos de 24 GB (unos
|
||||
segundos por imagen, sin quitar memoria a la tarjeta) y en la tarjeta gráfica a partir de 24 GB. La regla es la misma para
|
||||
NVIDIA y AMD. Puedes desactivar las imágenes por modelo, o elegir el lector con `--vision off`, `--vision gpu` o
|
||||
`--vision cpu`.
|
||||
|
||||
Las cifras detrás de la regla: en una Radeon AI PRO R9700, el lector de la tarjeta tardó 57 ms en una imagen de 260 tokens y
|
||||
el del procesador 3,1 s. En tarjetas de 16 GB (Tesla P100 y RTX A4000, Linux), el lector de la tarjeta costó un 3-5 % de
|
||||
velocidad en texto, porque ocupa unos 1,4 GB que de otro modo usaría el modelo. En un Mac lee la GPU, tenga la memoria que tenga (0,45 s para una imagen de 260 tokens en un M4 de 32 GB, unos 1,2 GB de la memoria compartida);
|
||||
el procesador tarda unos 50 s por imagen, así que solo lee con `--vision cpu`.
|
||||
|
||||
### Conviene saber
|
||||
|
||||
- Elige el nivel de razonamiento (**desactivado, bajo, medio o alto**) en el menú del chat o en "reasoning effort" de tu aplicación. Desactivado es lo más rápido.
|
||||
- Strata responde a una petición a la vez por defecto. Para varias a la vez, usa `--parallel N` en `strata launch` o
|
||||
`"parallel": 2` en la configuración ([BATCHING.md](docs/BATCHING.md)). En una tarjeta de 12 GB, esto hace más lenta cada respuesta.
|
||||
- Strata lee entero el primer mensaje de un chat, unos 1 minuto por cada 30.000 tokens. Los mensajes siguientes empiezan en segundos.
|
||||
- Dónde se guardan tus chats y la API completa: [docs/INSTALL.md](docs/INSTALL.md#where-things-are-stored), [docs/DETAILS.md](docs/DETAILS.md#using-it).
|
||||
|
||||
## Compilar desde el código fuente
|
||||
|
||||
<details>
|
||||
<summary>Windows, Linux y Mac desde el repositorio</summary>
|
||||
|
||||
[Descarga Strata](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) y descomprímelo, o haz `git clone`.
|
||||
**Windows:** haz doble clic en `START-HERE.bat`. **Linux:** ejecuta `./setup.sh` en la carpeta de Strata.
|
||||
|
||||
**Mac (Apple Silicon, macOS 15 o posterior):** instala una vez las Command Line Tools de Apple con `xcode-select --install`
|
||||
(no hace falta Xcode). Abre la Terminal en la carpeta de Strata y ejecuta `./setup.sh`. El script compila el motor para Mac
|
||||
en tu Mac (unos 7 minutos), hace las mismas preguntas, descarga el modelo y lo arranca. La próxima vez, `./setup.sh` lo
|
||||
arranca enseguida. Qué tamaño cabe en tu Mac: [docs/MAC.md](docs/MAC.md).
|
||||
|
||||
El instalador detecta tu tarjeta y prepara el motor adecuado. Pregunta qué modelo y qué tamaño quieres, cuánto contexto
|
||||
(cuánto texto mantiene el modelo en mente) y si debe leer imágenes. Pulsa Enter para aceptar la respuesta recomendada.
|
||||
Luego descarga el modelo (unos 70 GB) y lo arranca. Si la descarga se detiene, vuelve a ejecutar el script y continúa. Tu
|
||||
navegador abre la página de Strata en `http://127.0.0.1:8080`.
|
||||
|
||||
> Mientras el modelo arranca, tu PC puede ir lento o dejar de responder durante 1-3 minutos (más tiempo la primera vez).
|
||||
> Strata carga 35-55 GB en tu RAM y bloquea una parte para la tarjeta gráfica. Espera y no cierres la ventana.
|
||||
|
||||
La próxima vez, ejecuta de nuevo `START-HERE.bat` (o `./setup.sh`). Arranca enseguida y no descarga nada dos veces. Cierra
|
||||
su ventana para detener el modelo. `UPDATE.bat` (`./update.sh`) actualiza Strata sin arrancarlo. Actualización, Docker,
|
||||
varias tarjetas, dónde van los archivos y todas las opciones: [docs/INSTALL.md](docs/INSTALL.md).
|
||||
|
||||
Para medir tu PC, ejecuta `BENCH.bat` (`./bench.sh`). Tarda 5-10 minutos y escribe un informe que puedes compartir
|
||||
([cómo](docs/COMMUNITY_BENCHMARKS.md#run-the-benchmark)).
|
||||
|
||||
**Opcional: más velocidad en una tarjeta cuando todo el modelo cabe en la RAM.** Dos ajustes que se activan a mano, de
|
||||
RubenTorney (#1904, #1905). Ayudan cuando usas una sola tarjeta gráfica y tu RAM guarda todos los expertos, por ejemplo con
|
||||
Q2_0 o IQ3_XXS en un PC de 64 GB. Abre `strata-<model>.json` en la carpeta de datos de Strata ([dónde](docs/INSTALL.md#where-things-are-stored)) y añade:
|
||||
|
||||
- `"--adapt-async", "1"` a la lista `"args"`. Así la caché de expertos se actualiza en un hilo auxiliar en vez de detener la
|
||||
respuesta. Medido en una RTX 5070 (Windows, Q2_0): +4-5 % en decodificación, +7-10 % en código y documentos largos. Las
|
||||
respuestas pueden diferir un poco de las del ajuste por defecto y son iguales de una ejecución a otra.
|
||||
- `"STRATA_PIN_BY_NEED": "1"` en el bloque `"env"` (Windows). Windows solo puede bloquear aproximadamente la mitad de la RAM
|
||||
para la tarjeta gráfica, y este ajuste bloquea primero los expertos que la tarjeta necesita antes. Medido en la RTX 5070: +4,4 % en lectura del prompt.
|
||||
|
||||
```json
|
||||
"args": [ ..., "--adapt-async", "1" ],
|
||||
"env": { "STRATA_PIN_BY_NEED": "1" }
|
||||
```
|
||||
|
||||
Reinicia Strata después del cambio. Para deshacerlo, quita las dos entradas.
|
||||
Sigue las indicaciones para descargar e iniciar un modelo. [Guía del Terminal](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
</details>
|
||||
|
||||
## ¿Cómo funciona?
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="Aplicación de Terminal de Strata con la actividad del modelo, la velocidad, la memoria y las peticiones recientes">
|
||||
<br><sub>Observa tu modelo y tu hardware mientras se ejecuta.</sub>
|
||||
</p>
|
||||
|
||||
Los modelos como este suelen ejecutarse en servidores con cientos de gigabytes de memoria gráfica. Tu tarjeta gráfica tiene
|
||||
12-24 GB. Strata hace que el modelo quepa repartiendo el trabajo por todo tu PC. Imagina una biblioteca.
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
- El modelo es un equipo de 24.576 pequeños especialistas ("expertos"), como 24.576 libros de consulta. Cada palabra necesita solo 10 de ellos.
|
||||
- **Tu tarjeta gráfica es el escritorio.** Es pequeño y rápido. Los unos 4.000 libros que más se usan están abiertos encima.
|
||||
- **Tu RAM son las estanterías de la sala de lectura.** Los 24.576 libros están ahí. Cuando una palabra necesita un libro que
|
||||
no está en el escritorio, tu procesador lo coge enseguida de la estantería mientras la tarjeta sigue trabajando.
|
||||
- **Tu SSD es el archivo.** Guarda una tabla de consulta de 29 GB. El modelo lee unas pocas filas por palabra, así que no
|
||||
hace falta que esté en la RAM.
|
||||
[Compilar desde el código fuente](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [Guía de instalación completa](docs/INSTALL.md)
|
||||
|
||||
<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
Un pequeño ayudante también adivina las siguientes palabras. El modelo grande las comprueba todas a la vez y se queda con
|
||||
las correctas. Obtienes la misma respuesta, entre 1,6 y 1,8 veces antes. Los textos largos se leen en trozos grandes, de
|
||||
hasta 8.192 tokens a la vez, a más de 1.000 tokens por segundo.
|
||||
## Hardware
|
||||
|
||||
<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>
|
||||
| Hardware compatible | Guía |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX 20 / 30 / 40 / 50** | [Instalación en NVIDIA](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900, RX 9060 / 9070, AI PRO R9700** | [Instalación en AMD](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · experimental** | [Instalación en RX 6000](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Instalación en Intel](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 o posterior** | [Instalación en Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Instalación en Strix Halo](docs/STRIX_HALO.md) |
|
||||
|
||||
La explicación más larga: [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md). Cada parte con sus cifras:
|
||||
[los detalles](docs/DETAILS.md#how-it-works) y el [artículo](docs/paper/Strata-Paper.pdf).
|
||||
<a id="using-it"></a>
|
||||
|
||||
## ¿Algo ha ido mal?
|
||||
## Herramientas
|
||||
|
||||
- **Mi PC se congeló la primera vez que arrancó Strata.** Carga el modelo en la RAM. Espera y no cierres la ventana. ¿Sigue
|
||||
congelado después de 10 minutos? Reinicia el PC, cierra otros programas e inténtalo de nuevo, o elige un tamaño más pequeño.
|
||||
- **Se detuvo durante la descarga o la instalación.** Abre de nuevo la aplicación o `strata launch`, o vuelve a ejecutar
|
||||
`START-HERE.bat` (o `./setup.sh`). Continúa donde se quedó.
|
||||
- **Va muy lento, la luz del disco parpadea sin parar, o dice "the engine stopped unexpectedly".** Tu PC no tiene bastante
|
||||
RAM libre. Cierra otros programas (los navegadores gastan mucha) o elige un tamaño más pequeño, como Q2_0 o IQ2_XS.
|
||||
- **Dice que no hay motor para este PC.** En la aplicación, abre **Ajustes, Motor** y pulsa **Actualizar motor**. En la
|
||||
Terminal, ejecuta `strata update`. `strata doctor` muestra qué archivos del motor están instalados.
|
||||
- **Dice que el puerto 8080 ya está en uso.** Strata ya se está ejecutando. Busca su ventana.
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw**, y más, mediante las API compatibles con OpenAI y Anthropic.
|
||||
|
||||
Más problemas y soluciones: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md). ¿Sigues atascado? Abre una
|
||||
[incidencia](https://github.com/Niko1221/Strata/issues). En la aplicación, adjunta el archivo de **Ajustes, Motor,
|
||||
Diagnóstico, Ver registros, Guardar registros**. En la Terminal, pega la salida de `strata doctor`. Si lo ejecutas desde el
|
||||
código fuente, adjunta `strata-<model>.log` de la carpeta de Strata. Para un problema de seguridad, avísanos en privado:
|
||||
[SECURITY.md](SECURITY.md).
|
||||
Ejecuta **`strata connect`** para ver las instrucciones de tu herramienta. [Guía de conexión](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect).
|
||||
|
||||
## Créditos y licencia
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
El modelo es [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next), del equipo de Qwen. Lo comprimieron
|
||||
[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF), UkisAI (Swift 1.5), agentionai (Gyro)
|
||||
y Unsloth. Strata usa partes de [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp). Todos los créditos:
|
||||
[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits). Strata es de código abierto con la [licencia MIT](LICENSE). Algunas
|
||||
partes y todos los modelos tienen sus propias licencias ([cuáles](docs/HOW_IT_WORKS.md#license)).
|
||||
## Ayuda
|
||||
|
||||
## Contribuir
|
||||
|
||||
¿Has encontrado un error, o quieres enviar un cambio o un benchmark? Lee primero [CONTRIBUTING.md](CONTRIBUTING.md). Explica
|
||||
qué incluir para que otros puedan comprobar tu trabajo.
|
||||
[Todas las guías](docs) · [Solución de problemas](docs/TROUBLESHOOTING.md) · [Informar de un error](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[Benchmarks](docs/COMMUNITY_BENCHMARKS.md) · [Cómo funciona](docs/HOW_IT_WORKS.md) · [Contribuir](CONTRIBUTING.md)
|
||||
|
||||
## Apoya Strata
|
||||
|
||||
Strata es gratis y tiene licencia MIT. Lo construyo y lo pruebo en el hardware que consigo. Si te funciona bien en tu PC, un café me ayuda
|
||||
a seguir probando tarjetas nuevas y a arreglar lo que nos cuentas. Sin presión. Usarlo y contar lo que encuentras ayuda igual de mucho.
|
||||
**Ayuda a mantener la IA local abierta a todos.** Un café ayuda a financiar el desarrollo y las pruebas en más hardware.
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee: apoya Strata" height="48"></a>
|
||||
|
||||
¿Te interesa patrocinar Strata? Escríbeme a través de [GitHub](https://github.com/Niko1221).
|
||||
[Licencia MIT](LICENSE) · [Créditos y licencias de los modelos](docs/HOW_IT_WORKS.md#credits) · [Privacidad](docs/SAFETY.md)
|
||||
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>Para herramientas de IA y lectores automáticos: <a href="AGENTS.md">referencia técnica</a> · <a href="docs/AI_SETUP.md">instrucciones de instalación</a>.</sub>
|
||||
|
||||
**Patrocinios, alianzas de hardware o colaboraciones:** [[email protected]](mailto:[email protected]).
|
||||
+120
-352
@@ -1,420 +1,188 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="380">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <b>Français</b> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a></p>
|
||||
|
||||
<h3 align="center">Faites tourner un modèle de pointe sur votre propre PC de jeu</h3>
|
||||
|
||||
<p align="center">Compatible avec NVIDIA, AMD, Intel · Windows, Linux, Mac · gratuit et open source</p>
|
||||
<h3 align="center">Une IA puissante sur votre propre ordinateur.</h3>
|
||||
<p align="center">Discutez, programmez et travaillez avec des images, en local.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?include_prereleases&label=release" alt="Latest release"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://github.com/Niko1221/Strata/stargazers"><img src="https://img.shields.io/github/stars/Niko1221/Strata?style=flat" alt="GitHub stars"></a>
|
||||
<a href="#modèles">Modèles</a> · <a href="#installation"><b>Installation</b></a> ·
|
||||
<a href="#matériel">Matériel</a> · <a href="#outils">Outils</a> ·
|
||||
<a href="#aide">Aide</a> · <a href="#soutenir-strata">Soutenir</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br>
|
||||
<sub>Un jardin de pagode en voxels, généré en une seule requête sur une RTX 5070 avec Strata (IQ3_S, contexte de 128K) ·
|
||||
<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">vidéo complète (49 s)</a></sub></p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="Télécharger Strata"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="Licence MIT"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="Soutenir Strata sur Buy Me a Coffee"></a>
|
||||
</p>
|
||||
|
||||
Strata fait tourner **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)**, un modèle de 125 milliards
|
||||
de paramètres qui demande normalement un serveur, sur un PC ordinaire. Il discute, écrit du code, lit des images et
|
||||
fonctionne avec vos applications et vos agents de code. Vos conversations et vos fichiers restent sur votre PC.
|
||||
<p align="center"><sub><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <b>Français</b> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a> · <a href="README.pl.md">Polski</a></sub></p>
|
||||
|
||||
**Nouveau ici ?** Regardez [ce qu'il vous faut](#ce-quil-vous-faut), puis [installez l'application](#option-a--lapplication-strata).
|
||||
**Gratuit, open source, et à vous de l'exécuter.** Utilisez Strata sur votre bureau ou avec vos outils de programmation préférés. Aucun compte nécessaire.
|
||||
|
||||
- **Tourne sur un PC de jeu.** 32 Go de RAM et de mémoire graphique réunis suffisent pour commencer.
|
||||
- **Fonctionne avec vos outils.** Il parle les API d'OpenAI et d'Anthropic, donc Claude Code, Codex CLI, OpenCode et d'autres agents peuvent s'y connecter.
|
||||
- **Lit les images.** C'est activé par défaut.
|
||||
- **Gratuit.** Licence MIT, pas de compte, pas de cloud.
|
||||
- **Privé.** Aucune télémétrie. Ce que Strata télécharge, quand il utilise internet et comment il vérifie les téléchargements est expliqué dans [docs/SAFETY.md](docs/SAFETY.md).
|
||||
## Modèles
|
||||
|
||||
Version 0.2.3 · moteur 0.1.48
|
||||
Nous recommandons **d'abord ISTA-DASLab**, puis **Unsloth** et d'autres fournisseurs, lorsqu'un modèle compatible tient en mémoire.
|
||||
|
||||
## Ce qu'il vous faut
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
**Il vous faut au moins 32 Go de RAM et de mémoire graphique (VRAM) réunis.** Sur un Mac ou un Ryzen AI Max, c'est la
|
||||
mémoire unifiée. Plus de mémoire permet un modèle plus gros ou plus rapide.
|
||||
|
||||
- Un PC de 32 Go avec une carte de 12 à 16 Go fait tourner le Coder.
|
||||
- Avec 64 Go de RAM, toutes les tailles fonctionnent.
|
||||
|
||||
| Votre ordinateur | Détails |
|
||||
| Fournisseur | Choix |
|
||||
| --- | --- |
|
||||
| **NVIDIA** GeForce RTX série 20, 30, 40, 50 (12 Go ou plus) | Installez l'application ou le Terminal. |
|
||||
| **AMD** Radeon RX 6800 et plus récent, Radeon AI PRO R9700 (12 Go ou plus) | [Cartes AMD](docs/AMD_HIP.md) |
|
||||
| **Intel** Arc | [Intel Arc](docs/INTEL_ARC.md), [moteur Intel](docs/INTEL.md) |
|
||||
| **Mac Apple Silicon** (M1 ou plus récent, macOS 15 ou plus récent) | [Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max (Strix Halo)** et autres systèmes à mémoire unifiée | [Strix Halo](docs/STRIX_HALO.md) |
|
||||
| Cartes et processeurs plus anciens | [GPU anciens](docs/OLDER_GPUS.md), [CPU anciens](docs/INSTALL.md#older-cpus-experimental) |
|
||||
| **ISTA-DASLab · recommandé** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S. [Coder : IQ1\_M](docs/MODELS.md#coder) pour programmer. |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF). Utilise moins de mémoire, mais plus lent. |
|
||||
| **Autres options** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
Il faut aussi :
|
||||
[Comparer les tailles, la mémoire nécessaire et la compatibilité](docs/MODELS.md).
|
||||
|
||||
- environ 80 Go d'espace disque libre (un SSD accélère beaucoup le premier démarrage)
|
||||
- Windows 10 / 11, Linux ou macOS
|
||||
- un pilote graphique récent
|
||||
</details>
|
||||
|
||||
Deux ou trois cartes de la même marque peuvent se partager un modèle ([multi-GPU](docs/MULTI_GPU.md)). Strata ne répartit
|
||||
jamais un modèle entre des cartes NVIDIA et AMD. Liste complète : [docs/INSTALL.md](docs/INSTALL.md#what-you-need).
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0. Ce sont les paquets actuellement documentés pour ce modèle.
|
||||
|
||||
[Guide du modèle et compatibilité](docs/QWEN36.md).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
Dans l'**application de bureau** et dans le **Terminal**. Ce qui ne tient pas en mémoire est lu depuis votre SSD : il faut donc beaucoup d'espace disque libre.
|
||||
|
||||
| Jeu (IST-DAS) | Téléchargement | Espace disque libre nécessaire |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | environ 245 GB |
|
||||
| 2.00 bpw | 257 GB | environ 265 GB |
|
||||
| 2.25 bpw | 274 GB | environ 280 GB |
|
||||
|
||||
Fonctionne sur les NVIDIA RTX 30, 40 et 50 (Windows et Linux) et sur l'AMD Radeon AI PRO R9700 (Linux). L'installation télécharge les fichiers et le moteur DeepSeek, puis démarre le modèle.
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
Mesuré avec le jeu 2.00 bpw sur Strata 0.2.5. « Sortie » est la vitesse de la réponse, « Prompt » la vitesse à laquelle Strata lit votre texte.
|
||||
|
||||
| Matériel | Sortie | Prompt |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB de RAM | 4 à 6 tokens/s | environ 110 tokens/s (4K) |
|
||||
| RTX 3060 12 GB, 46 GB de RAM | 9 à 11 tokens/s | environ 155 tokens/s (4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB de RAM | 21 à 25 tokens/s | 320 à 360 tokens/s (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74 à 77 tokens/s | 400 à 450 tokens/s (8K) |
|
||||
|
||||
[Mémoire, disque et détails](docs/DEEPSEEK41.md) · [Notes de version](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
Vous ne savez pas ce qui tient ? [Choisir un modèle pour votre ordinateur](docs/MODELS.md#pick-by-memory).
|
||||
|
||||
## Installation
|
||||
|
||||
Choisissez une option. Elles lancent toutes le même moteur et utilisent les mêmes modèles.
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### Option A : l'application Strata
|
||||
### Application de bureau
|
||||
|
||||
Le plus simple. L'application contient le moteur : installez-la, choisissez un modèle, discutez. Téléchargez le fichier
|
||||
correspondant à votre système et à votre carte graphique depuis la [page des versions](https://github.com/Niko1221/Strata/releases/latest).
|
||||
Vous ne savez pas lequel prendre ? Lisez le paragraphe sous le tableau.
|
||||
**[Télécharger Strata pour Windows, Linux ou Mac →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
| Système | Votre carte graphique | Fichier à télécharger |
|
||||
| --- | --- | --- |
|
||||
| **Windows 10 / 11** | NVIDIA RTX, pilote 580 ou plus récent | [`Strata-0.2.3-windows-cuda13.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda13.exe) |
|
||||
| | NVIDIA, carte plus ancienne ou pilote antérieur à 580 | [`Strata-0.2.3-windows-cuda12.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda12.exe) |
|
||||
| | AMD Radeon série RX 9000 ou Radeon AI PRO R9700 | [`Strata-0.2.3-windows-hip.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip.exe) |
|
||||
| | AMD Radeon série RX 7000 ou Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-windows-hip-rdna3.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip-rdna3.exe) |
|
||||
| **Linux** | NVIDIA RTX, pilote 580 ou plus récent | [`Strata-0.2.3-linux-nvidia-cuda13.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda13.AppImage) |
|
||||
| | NVIDIA, carte plus ancienne ou pilote antérieur à 580 | [`Strata-0.2.3-linux-nvidia-cuda12.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda12.AppImage) |
|
||||
| | AMD Radeon série RX 9000 ou Radeon AI PRO R9700 | [`Strata-0.2.3-linux-amd-rx9070.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx9070.AppImage) |
|
||||
| | AMD Radeon série RX 7000 | [`Strata-0.2.3-linux-amd-rx7900.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx7900.AppImage) |
|
||||
| | AMD Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-linux-amd-strixhalo.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-strixhalo.AppImage) |
|
||||
| **Mac** (Apple Silicon, macOS 15 ou plus récent) | intégrée | [`Strata-0.2.3-mac.dmg`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-mac.dmg) |
|
||||
Installez l'application, choisissez un modèle et commencez à discuter. Il y a un seul installateur par système. Au premier lancement, l'application télécharge le moteur de votre carte graphique. [Aide pour l'installateur](docs/INSTALL.md#the-app).
|
||||
|
||||
**Si vous hésitez :** pour NVIDIA, prenez `cuda13` si la version de votre pilote est 580 ou plus récente, sinon `cuda12`.
|
||||
`cuda12` convient aux cartes plus anciennes et aux pilotes plus anciens. Les fichiers `hip` et `amd` sont pour les cartes
|
||||
AMD. Les autres cartes AMD (RX 6000) n'ont pas encore d'application prête à l'emploi : voir
|
||||
[Cartes AMD](docs/AMD_HIP.md).
|
||||
<sub>Fichiers: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
Ensuite :
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="Application de bureau Strata avec une discussion et un aperçu du code en direct côte à côte">
|
||||
<br><sub>Discussion, fichiers et aperçu en direct dans une seule fenêtre.</sub>
|
||||
</p>
|
||||
|
||||
- **Windows :** lancez le `.exe`. Il s'installe pour votre utilisateur et ne demande pas de droits d'administrateur. Si
|
||||
Windows affiche « Windows a protégé votre ordinateur », choisissez **Informations complémentaires**, puis **Exécuter
|
||||
quand même** (l'installateur n'est pas encore signé).
|
||||
- **Linux :** rendez le fichier exécutable (`chmod +x`) et lancez-le. Il a besoin de FUSE 2 : `sudo apt install libfuse2`
|
||||
(Ubuntu 22.04) ou `libfuse2t64` (Ubuntu 24.04 et plus récent).
|
||||
- **Mac :** ouvrez le `.dmg` et faites glisser Strata dans Applications.
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
Sur le premier écran, l'application analyse votre PC et recommande un modèle adapté. Appuyez sur Installer. Le modèle est un
|
||||
gros téléchargement (environ 40 à 70 Go) qui reprend là où il s'est arrêté en cas d'interruption. Quand vous fermez la
|
||||
fenêtre, Strata et le moteur s'arrêtent.
|
||||
### Application Terminal
|
||||
|
||||
### Option B : le Terminal (une ligne)
|
||||
Vous préférez le terminal ? Installez Strata, puis lancez **`strata launch`**.
|
||||
|
||||
Le Terminal est la commande `strata`, pensée pour les scripts, les serveurs et les agents d'IA.
|
||||
<details open>
|
||||
<summary><b>Commandes d'installation</b></summary>
|
||||
|
||||
Linux et Mac :
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
Windows (PowerShell) :
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
Le script analyse votre PC, télécharge le Terminal, vérifie son empreinte SHA-256 et le décompresse dans votre dossier
|
||||
personnel. Il ne demande pas de droits d'administrateur. Sous Windows, ouvrez ensuite une nouvelle fenêtre de terminal.
|
||||
Puis lancez Strata :
|
||||
Sous Windows, ouvrez ensuite un nouveau terminal. Puis :
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
Il pose une question à la fois : modèle, contexte, images, qui peut se connecter. Ensuite il télécharge le moteur pour votre
|
||||
carte graphique (signé, et lancé à titre d'essai avant usage) ainsi que le modèle, puis commence à servir. Pour les scripts
|
||||
et les agents d'IA, utilisez des options :
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
Pour lire le script d'installation avant de l'exécuter, téléchargez-le d'abord avec `curl -fsSL <address> -o install.sh`,
|
||||
lisez-le, puis lancez `sh install.sh`. Tous les écrans et toutes les options : [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
### Option C : laissez votre IA l'installer
|
||||
|
||||
Collez ceci dans Claude Code, Cursor, Codex, GitHub Copilot ou un autre assistant de programmation :
|
||||
|
||||
```text
|
||||
Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.
|
||||
```
|
||||
|
||||
L'assistant vérifie votre carte graphique, votre RAM et votre disque, choisit le modèle adapté, l'installe, le démarre et
|
||||
vous explique comment connecter vos applications. Les outils d'IA peuvent aussi installer, démarrer et arrêter Strata via son
|
||||
[serveur MCP](docs/MCP_SERVER.md).
|
||||
|
||||
Vous préférez le compiler vous-même ? Voir [Compiler depuis les sources](#compiler-depuis-les-sources).
|
||||
|
||||
## Modèles
|
||||
|
||||
L'application et `strata launch` recommandent un modèle selon votre mémoire. C'est un seul modèle en plusieurs tailles,
|
||||
plus ou moins compressé. Les petites tailles sont plus rapides. Les grandes sont un peu plus intelligentes.
|
||||
|
||||
### Peu de mémoire ? Essayez Gyro
|
||||
|
||||
[Gyro](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF) (par agentionai) est la façon la plus légère de faire tourner ce modèle.
|
||||
|
||||
| Taille | Mémoire nécessaire (RAM + VRAM) | Téléchargement | Ce que c'est |
|
||||
| --- | ---: | ---: | --- |
|
||||
| **Gyro-S** | 27,6 Go | 58,5 Go | Pour les PC où rien d'autre ne tient. La qualité est inférieure à celle d'IQ2_XS. |
|
||||
| **Gyro-M** | 35 Go | 92,0 Go | À peu près la qualité d'IQ3_XXS avec environ 20 % de mémoire GPU en moins. Il écrit les réponses 16 % plus lentement que Q2_0 sur une RTX 3060 de 12 Go et 21 % plus lentement sur une R9700. |
|
||||
|
||||
Gyro fonctionne sur les cartes NVIDIA et AMD (expérimental sur AMD) sur les cartes Intel Arc sous Linux (testé sur une Arc A750) et, depuis la 0.2.2, sur les Mac Apple Silicon (Gyro-S sur un Mac mini de 32 Go : 9 tokens/s, experts lus sur le SSD). Détails et mesures :
|
||||
[docs/GYRO.md](docs/GYRO.md). Lancez-le avec `strata launch --model gyro-s`.
|
||||
|
||||
### Les autres tailles
|
||||
|
||||
| Votre mémoire (RAM + VRAM) | Prenez | Remarques |
|
||||
| --- | --- | --- |
|
||||
| **32 Go** | **Gyro-S**, ou le **[Coder](docs/MODELS.md#coder)** pour le code | Le Coder demande 32 Go de RAM et garde la moitié des experts, il est donc moins bon hors du code |
|
||||
| **40 Go** | **[Swift 1.5](docs/MODELS.md#swift-15)** IQ2_XS (39,2 Go), ou **Gyro-M** (35 Go) | Swift réfléchit moins longtemps avant de répondre. Gyro-M approche la qualité d'IQ3_XXS, mais il écrit les réponses 16 à 21 % plus lentement que Q2_0 |
|
||||
| **48 Go** | **IQ3_XXS** (47,0 Go) | Plus lent, meilleur |
|
||||
| **64 Go** | **IQ3_S** (54,8 Go), l'original ou Swift 1.5 | Le plus lent, le meilleur. Il égale le modèle complet dans les tests publiés |
|
||||
| **96 Go ou plus** | **UD-IQ4_XS** d'Unsloth (environ 72 Go de RAM) jusqu'à **Q8_0** (environ 136 Go), 4 à 8 bits | Plus proche du modèle complet. Avec moins de RAM, Strata lit une partie depuis le SSD, ce qui est beaucoup plus lent |
|
||||
|
||||
Avoir moins de RAM que ce qu'indique une ligne peut encore fonctionner : Strata passe tout seul en
|
||||
[mode peu de RAM](docs/MODELS.md#a-big-graphics-card-and-little-ram). Attendez-vous à plus de lenteur, et à bien plus avec
|
||||
une petite carte graphique.
|
||||
|
||||
Autres choix :
|
||||
|
||||
- **[Swift 1.5](docs/MODELS.md#swift-15)** est une version affinée qui réfléchit moins longtemps avant de répondre, pour une qualité et un besoin en RAM à peu près identiques.
|
||||
- **[NVFP4](docs/NVFP4.md)** est la version 4 bits de NVIDIA pour les cartes NVIDIA. Elle demande environ 80 Go de RAM pour garder tous les experts en RAM.
|
||||
- **[Qwen3.6-35B-A3B](docs/QWEN36.md)** est un modèle plus petit et différent, qui lit les images et peut répondre à plusieurs requêtes à la fois.
|
||||
- **[L'Uncensored IQ3_XXS d'OrcaRouter](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** se configure à la main.
|
||||
|
||||
Toutes les tailles, les téléchargements et ce qui tient où : [docs/MODELS.md](docs/MODELS.md).
|
||||
|
||||
### DeepSeek V4.1-Flash (dans le Terminal, depuis 0.2.4)
|
||||
|
||||
[DeepSeek V4.1-Flash](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF) est un autre modèle, beaucoup plus gros. ISTA-DASLab a produit les trois versions ci-dessous. Strata les fait tourner sur un PC avec une carte graphique de 12 Go et de 46 à 64 Go de RAM, et lit le reste sur votre SSD. Il fonctionne sur les cartes NVIDIA RTX des séries 30 à 50 et sur la Radeon AI PRO R9700. Il utilise son propre paquet de moteur, `strata-dsv41`, que `strata launch` télécharge quand vous choisissez DeepSeek. L’application de bureau ne le propose pas encore.
|
||||
|
||||
| Version | Téléchargement | Qualité par rapport au modèle d’origine | Écrit à |
|
||||
| --- | ---: | --- | --- |
|
||||
| **IQ1_M** (1,75 bit) | 239 Go | KL 0,217, perplexité 3,80 (+21 %) ; code +8,9 %, tâches d’agent +10,2 % ; plus faible sur la prose anglaise courante. D’après la fiche du modèle d’ISTA-DASLab, elle garde 98,7 % de la moyenne des tâches du modèle de base (AIME25, GPQA-Diamond, LiveCodeBench v6). | pas encore mesurée |
|
||||
| **IQ2_XXS** (2.00 bits) | 257 GB | KL 0,170, perplexité 3,63 (+15,5 %) ; code +8,6 %, tâches d’agent +5,3 % | environ 8 à 10 tokens/s sur une RTX 3060 (code 9,9, tâches d’agent 7,8), environ 5 sur une RTX 5070 |
|
||||
| **IQ2_XS** (2.25 bits) | 274 GB | KL 0,107, perplexité 3,37 (+7,3 %) ; code +3,2 %, tâches d’agent +2,2 % | environ 11 tokens/s sur une Radeon AI PRO R9700 |
|
||||
| **IQ4_NL** (table Engram, pas un troisième modèle) | 111 Go, déjà compris dans les trois téléchargements ci-dessus | La table de consultation Engram en 4 bits que le modèle lit dans la RAM ou sur le SSD. Les trois versions utilisent ce seul fichier (`DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf`). | n/a |
|
||||
|
||||
4x Radeon AI PRO R9700 : environ 31 tokens/s, 55 à 69 avec DSpark.
|
||||
|
||||
Lancez-le avec `strata launch --model ist-das-2.00bpw` (ou `ist-das-1.75bpw`, `ist-das-2.25bpw`). Détails, vitesses par carte et installation manuelle : [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md).
|
||||
|
||||
## Quelle est sa vitesse ?
|
||||
|
||||
Mesuré avec une carte graphique de 12 Go (RTX 5070, Ryzen 5 7600, 64 Go de RAM). Voir les résultats d'autres cartes :
|
||||
[vitesse de chaque taille](docs/MODELS.md#how-fast-is-each-size), [résultats de la communauté](docs/COMMUNITY_BENCHMARKS.md).
|
||||
|
||||
| Modèle | Les réponses s'affichent à | Lit votre prompt à |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████████` 94 tokens/s | `████████████` 2 650 tokens/s |
|
||||
| **IQ2_XS** | `██████████░░` 79 tokens/s | `█████████░░░` 2 090 tokens/s |
|
||||
| **IQ3_XXS** | `████████░░░░` 62 tokens/s | `████████░░░░` 1 750 tokens/s |
|
||||
| **IQ3_S** | `███████░░░░░` 53 tokens/s | `███████░░░░░` 1 620 tokens/s |
|
||||
| **Coder** | `███████░░░░░` 55 tokens/s | `██████████░░` 2 180 tokens/s |
|
||||
|
||||
Un token vaut environ ¾ de mot, donc 60 tokens par seconde, c'est plus rapide que votre lecture. « Lit votre prompt »
|
||||
indique la vitesse à laquelle Strata absorbe un long document, du code ou un historique de discussion.
|
||||
|
||||
Mesuré avec une carte AMD de 16 Go (RX 9070 XT, Ryzen 9 3900X, 47 Go de RAM) :
|
||||
|
||||
| Modèle | Les réponses s'affichent à | Lit votre prompt à |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████░░░░` 60 tokens/s | `█████░░░░░░░` 1 160 tokens/s |
|
||||
| **IQ2_XS** | `███████░░░░░` 52 tokens/s | `█████░░░░░░░` 1 110 tokens/s |
|
||||
| **Coder** | `██████░░░░░░` 44 tokens/s | `██████░░░░░░` 1 420 tokens/s |
|
||||
|
||||
Les barres utilisent la même échelle dans les deux tableaux. Une carte avec plus de VRAM est plus rapide. Une RTX 3090
|
||||
(24 Go) devrait écrire environ 100 à 140 tokens par seconde. La version du moteur derrière chaque chiffre est indiquée dans
|
||||
[DETAILS.md](docs/DETAILS.md#speed-measured).
|
||||
|
||||
## Utilisation
|
||||
|
||||
### Dans l'application
|
||||
|
||||
L'application comprend un **Chat**, un **Monitor** du modèle, de votre GPU, de votre CPU et de votre RAM, une page **Models** et les **Settings**. Le chat peut travailler dans un dossier de votre PC. En mode **Manual**, il demande
|
||||
avant de modifier un fichier ou d'exécuter une commande. Tapez `/loop 10m <what to do>` pour répéter un message toutes les
|
||||
10 minutes tant que le chat est ouvert.
|
||||
|
||||
Le chat peut chercher sur le web avec DuckDuckGo (ou Bing), sans compte. Vous pouvez ajouter une clé de recherche sous
|
||||
**Settings, Tools**. La recherche est la seule fonction qui envoie quelque chose hors de votre PC (les mots recherchés).
|
||||
|
||||
Pour faire tourner deux modèles, activez **Run multiple models** (exécuter plusieurs modèles) et donnez à chacun sa propre carte de la même marque.
|
||||
|
||||
<p align="center"><img src="docs/media/app-chat.png" width="900" alt="The Strata app: a chat where the agent built a small voxel pagoda garden, with the page open in the preview on the right"><br>
|
||||
<sub>Une discussion dans l'app Strata : l'agent a écrit un petit jardin de pagode en voxels dans un seul fichier HTML, et la page s'ouvre dans l'aperçu à côté de la conversation</sub></p>
|
||||
|
||||
### Dans le Terminal
|
||||
|
||||
<p align="center"><img src="docs/media/terminal-monitor.png" width="900" alt="The Strata Terminal monitor overview while the model writes a reply"><br>
|
||||
<sub><code>strata monitor</code> pendant que le modèle répond : vitesse, GPU, mémoire et les dernières requêtes</sub></p>
|
||||
|
||||
```sh
|
||||
strata launch # guided screens: model, context, pictures, access, then serve
|
||||
strata launch --model q2_0 --yes --no-tui # no questions: serve, print the address, return
|
||||
strata launch --plan --model q2_0 # show what would happen; nothing changes
|
||||
strata launch --status # what is being served now
|
||||
strata launch --stop # stop it
|
||||
strata monitor --url http://127.0.0.1:8080 # watch speed, GPU, memory and requests
|
||||
strata update --check # is there a new engine? (strata update installs it)
|
||||
strata doctor # check the installed engine files
|
||||
```
|
||||
|
||||
`strata --help` liste tout. Démarrer et servir ne téléchargent rien. Seuls l'installation, `strata launch` (quand vous
|
||||
choisissez un modèle) et `strata update` le font. Pour joindre Strata depuis votre téléphone ou un autre PC, utilisez
|
||||
`strata launch --access lan`. La commande crée une clé d'API et refuse de démarrer sur un réseau sans elle. Aucun
|
||||
navigateur ne s'ouvre, sauf si vous ajoutez `--open`. Guide : [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md). Le client complet : [docs/TERMINAL.md](docs/TERMINAL.md).
|
||||
|
||||
### Avec des agents d'IA
|
||||
|
||||
Un agent installe Strata avec la commande en une ligne de l'option B et lance
|
||||
`strata launch --model NAME --yes --no-tui`. Les étapes, les options et les codes de sortie sont dans [docs/AI_SETUP.md](docs/AI_SETUP.md),
|
||||
et les règles du dépôt dans [AGENTS.md](AGENTS.md).
|
||||
|
||||
### Connecter vos autres applications
|
||||
|
||||
| Type d'application | URL de base |
|
||||
| --- | --- |
|
||||
| Compatible OpenAI (la plupart des applications et des agents) | `http://127.0.0.1:8080/v1` (n'importe quelle clé d'API, n'importe quel nom de modèle) |
|
||||
| API Anthropic (Claude Code et d'autres) | `http://127.0.0.1:8080`, sans `/v1`. Ces applications ajoutent `/v1/messages` elles-mêmes. Claude Code : `ANTHROPIC_BASE_URL=http://127.0.0.1:8080` |
|
||||
| API OpenAI Responses (Codex CLI) | `http://127.0.0.1:8080/v1/responses` ([configuration](docs/DETAILS.md#the-responses-api-and-codex-cli)) |
|
||||
|
||||
`strata connect` affiche les réglages exacts pour OpenCode, Codex CLI, Claude Code, oh-my-pi, pi, Hermes Agent et OpenClaw.
|
||||
`strata connect opencode --write` écrit le fichier après confirmation et garde une sauvegarde.
|
||||
|
||||
### Images
|
||||
|
||||
Les images sont activées par défaut pour les modèles qui savent les lire. Joignez ou collez une image dans le chat, ou
|
||||
envoyez-la depuis votre application. Le lecteur d'images tourne sur le processeur quand votre carte graphique a moins de
|
||||
24 Go (quelques secondes par image, sans prendre de mémoire à la carte) et sur la carte graphique à partir de 24 Go. La
|
||||
règle est la même pour NVIDIA et AMD. Vous pouvez désactiver les images par modèle, ou choisir le lecteur avec
|
||||
`--vision off`, `--vision gpu` ou `--vision cpu`.
|
||||
|
||||
Les chiffres derrière la règle : sur une Radeon AI PRO R9700, le lecteur de la carte a pris 57 ms pour une image de
|
||||
260 tokens et celui du processeur 3,1 s. Sur des cartes de 16 Go (Tesla P100 et RTX A4000, Linux), le lecteur de la carte
|
||||
a coûté 3 à 5 % de vitesse sur le texte, parce qu'il occupe environ 1,4 Go que le modèle utiliserait sinon. Sur un Mac, le lecteur tourne sur le GPU quelle que soit la mémoire (0,45 s pour une image de 260 tokens sur un M4 de 32 Go, environ 1,2 Go de la
|
||||
mémoire partagée) ; le processeur met environ 50 s par image, il ne lit donc qu'avec `--vision cpu`.
|
||||
|
||||
### Bon à savoir
|
||||
|
||||
- Choisissez le niveau de réflexion (**désactivé, faible, moyen ou élevé**) dans le menu du chat ou dans le réglage « reasoning effort » de votre application. Désactivé est le plus rapide.
|
||||
- Strata répond à une requête à la fois par défaut. Pour en traiter plusieurs en même temps, utilisez `--parallel N` dans `strata launch` ou
|
||||
`"parallel": 2` dans la configuration ([BATCHING.md](docs/BATCHING.md)). Sur une carte de 12 Go, chaque réponse devient alors plus lente.
|
||||
- Strata lit en entier le premier message d'une discussion, soit environ 1 minute pour 30 000 tokens. Les messages suivants démarrent en quelques secondes.
|
||||
- Où sont stockées vos discussions et l'API complète : [docs/INSTALL.md](docs/INSTALL.md#where-things-are-stored), [docs/DETAILS.md](docs/DETAILS.md#using-it).
|
||||
|
||||
## Compiler depuis les sources
|
||||
|
||||
<details>
|
||||
<summary>Windows, Linux et Mac depuis le dépôt</summary>
|
||||
|
||||
[Téléchargez Strata](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) et décompressez-le, ou faites un `git clone`.
|
||||
**Windows :** double-cliquez sur `START-HERE.bat`. **Linux :** lancez `./setup.sh` dans le dossier Strata.
|
||||
|
||||
**Mac (Apple Silicon, macOS 15 ou plus récent) :** installez une fois les Command Line Tools d'Apple avec `xcode-select --install`
|
||||
(Xcode lui-même n'est pas nécessaire). Ouvrez le Terminal dans le dossier Strata et lancez `./setup.sh`. Le script compile
|
||||
le moteur Mac sur votre Mac (environ 7 minutes), pose les mêmes questions, télécharge le modèle et le démarre. La fois
|
||||
suivante, `./setup.sh` le démarre tout de suite. Quelle taille convient à votre Mac : [docs/MAC.md](docs/MAC.md).
|
||||
|
||||
L'installateur détecte votre carte et prépare le bon moteur. Il demande quel modèle et quelle taille, combien de contexte
|
||||
(la quantité de texte que le modèle garde en tête) et s'il doit lire les images. Appuyez sur Entrée pour la réponse
|
||||
recommandée. Puis il télécharge le modèle (environ 70 Go) et le démarre. Si le téléchargement s'arrête, relancez le script
|
||||
et il reprend. Votre navigateur ouvre la page de Strata à l'adresse `http://127.0.0.1:8080`.
|
||||
|
||||
> Pendant le démarrage du modèle, votre PC peut être lent ou ne plus répondre pendant 1 à 3 minutes (le plus longtemps la
|
||||
> première fois). Strata charge 35 à 55 Go dans votre RAM et en verrouille une partie pour la carte graphique. Patientez et
|
||||
> ne fermez pas la fenêtre.
|
||||
|
||||
La fois suivante, relancez `START-HERE.bat` (ou `./setup.sh`). Il démarre tout de suite et ne télécharge rien deux fois.
|
||||
Fermez sa fenêtre pour arrêter le modèle. `UPDATE.bat` (`./update.sh`) met Strata à jour sans le démarrer. Mise à jour,
|
||||
Docker, plusieurs cartes, où vont les fichiers et toutes les options : [docs/INSTALL.md](docs/INSTALL.md).
|
||||
|
||||
Pour mesurer votre PC, lancez `BENCH.bat` (`./bench.sh`). Cela prend 5 à 10 minutes et produit un rapport que vous pouvez
|
||||
partager ([comment](docs/COMMUNITY_BENCHMARKS.md#run-the-benchmark)).
|
||||
|
||||
**Facultatif : plus de vitesse sur une carte quand tout le modèle tient en RAM.** Deux réglages à activer soi-même, par
|
||||
RubenTorney (#1904, #1905). Ils aident quand vous utilisez une seule carte graphique et que votre RAM contient tous les
|
||||
experts, par exemple Q2_0 ou IQ3_XXS sur un PC de 64 Go. Ouvrez `strata-<model>.json` dans le dossier de données de Strata ([où](docs/INSTALL.md#where-things-are-stored)) et ajoutez :
|
||||
|
||||
- `"--adapt-async", "1"` à la liste `"args"`. Le cache des experts se met alors à jour sur un thread auxiliaire au lieu de
|
||||
mettre la réponse en pause. Mesuré sur une RTX 5070 (Windows, Q2_0) : +4 à 5 % en décodage, +7 à 10 % sur le code et les
|
||||
longs documents. Les réponses peuvent différer légèrement de celles du réglage par défaut, et restent identiques d'une exécution à l'autre.
|
||||
- `"STRATA_PIN_BY_NEED": "1"` dans le bloc `"env"` (Windows). Windows ne peut verrouiller qu'environ la moitié de la RAM
|
||||
pour la carte graphique, et ce réglage verrouille d'abord les experts dont la carte a le plus besoin. Mesuré sur la RTX 5070 : +4,4 % en lecture du prompt.
|
||||
|
||||
```json
|
||||
"args": [ ..., "--adapt-async", "1" ],
|
||||
"env": { "STRATA_PIN_BY_NEED": "1" }
|
||||
```
|
||||
|
||||
Redémarrez Strata après la modification. Pour annuler, supprimez les deux entrées.
|
||||
Suivez les invites pour télécharger et démarrer un modèle. [Guide du Terminal](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
</details>
|
||||
|
||||
## Comment ça marche ?
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="Application Terminal de Strata affichant l'activité du modèle, la vitesse, la mémoire et les requêtes récentes">
|
||||
<br><sub>Suivez votre modèle et votre matériel pendant qu'il tourne.</sub>
|
||||
</p>
|
||||
|
||||
Les modèles de ce genre tournent d'habitude sur des serveurs qui disposent de centaines de gigaoctets de mémoire graphique.
|
||||
Votre carte graphique en a 12 à 24. Strata fait tenir le modèle en répartissant le travail sur tout votre PC. Imaginez une
|
||||
bibliothèque.
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
- Le modèle est une équipe de 24 576 petits spécialistes (les « experts »), comme 24 576 ouvrages de référence. Chaque mot n'en demande que 10.
|
||||
- **Votre carte graphique est le bureau.** Il est petit et rapide. Les quelque 4 000 livres les plus utilisés y sont ouverts.
|
||||
- **Votre RAM, ce sont les étagères de la salle de lecture.** Les 24 576 livres s'y trouvent. Quand un mot demande un livre
|
||||
qui n'est pas sur le bureau, votre processeur va le chercher aussitôt sur l'étagère, pendant que la carte continue de travailler.
|
||||
- **Votre SSD, ce sont les archives.** Il contient une table de consultation de 29 Go. Le modèle n'en lit que quelques lignes par
|
||||
mot, elle n'a donc pas besoin de tenir en RAM.
|
||||
[Compiler depuis les sources](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [Guide d'installation complet](docs/INSTALL.md)
|
||||
|
||||
<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
Un petit assistant devine aussi les mots suivants. Le grand modèle les vérifie tous d'un coup et garde les bons. Vous
|
||||
obtenez la même réponse, 1,6 à 1,8 fois plus tôt. Les textes longs sont lus par gros morceaux, jusqu'à 8 192 tokens à la
|
||||
fois, à plus de 1 000 tokens par seconde.
|
||||
## Matériel
|
||||
|
||||
<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>
|
||||
| Matériel pris en charge | Guide |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX 20 / 30 / 40 / 50** | [Installation NVIDIA](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900, RX 9060 / 9070, AI PRO R9700** | [Installation AMD](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · expérimental** | [Installation RX 6000](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Installation Intel](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 ou plus récent** | [Installation sur Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Installation Strix Halo](docs/STRIX_HALO.md) |
|
||||
|
||||
L'explication plus longue : [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md). Chaque élément avec ses chiffres :
|
||||
[les détails](docs/DETAILS.md#how-it-works) et l'[article](docs/paper/Strata-Paper.pdf).
|
||||
<a id="using-it"></a>
|
||||
|
||||
## Un problème ?
|
||||
## Outils
|
||||
|
||||
- **Mon PC s'est figé au premier démarrage de Strata.** Il charge le modèle en RAM. Patientez et ne fermez pas la fenêtre.
|
||||
Toujours figé après 10 minutes ? Redémarrez le PC, fermez les autres programmes et réessayez, ou choisissez une taille plus petite.
|
||||
- **Ça s'est arrêté pendant le téléchargement ou l'installation.** Relancez l'application ou `strata launch`, ou relancez
|
||||
`START-HERE.bat` (ou `./setup.sh`). Cela reprend là où ça s'était arrêté.
|
||||
- **C'est très lent, le voyant du disque clignote sans arrêt, ou il affiche « the engine stopped unexpectedly ».** Votre PC
|
||||
n'a pas assez de RAM libre. Fermez d'autres programmes (les navigateurs en consomment beaucoup) ou choisissez une taille plus petite, comme Q2_0 ou IQ2_XS.
|
||||
- **Il indique qu'il n'y a pas de moteur pour ce PC.** Dans l'application, ouvrez **Settings, Engine** et appuyez sur **Update engine** (mettre à jour le moteur). Dans le Terminal, lancez `strata update`. `strata doctor` montre quels fichiers du moteur sont installés.
|
||||
- **Il indique que le port 8080 est déjà utilisé.** Strata tourne déjà. Cherchez sa fenêtre.
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw**, et d'autres via les API compatibles OpenAI et Anthropic.
|
||||
|
||||
Autres problèmes et solutions : [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md). Toujours bloqué ? Ouvrez une
|
||||
[issue](https://github.com/Niko1221/Strata/issues). Dans l'application, joignez le fichier obtenu par **Settings, Engine, Diagnostics, View logs, Save logs**. Dans le Terminal, collez la sortie de `strata doctor`. Si
|
||||
vous avez lancé depuis les sources, joignez `strata-<model>.log` du dossier Strata. Pour un problème de sécurité,
|
||||
signalez-le en privé : [SECURITY.md](SECURITY.md).
|
||||
Lancez **`strata connect`** pour voir la configuration de votre outil. [Guide de connexion](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect).
|
||||
|
||||
## Remerciements et licence
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
Le modèle est [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next), de l'équipe Qwen. Il a été compressé par
|
||||
[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF), UkisAI (Swift 1.5), agentionai (Gyro)
|
||||
et Unsloth. Strata utilise des parties de [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp). Tous les
|
||||
remerciements : [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits). Strata est open source sous [licence MIT](LICENSE).
|
||||
Quelques parties et tous les modèles ont leurs propres licences ([lesquelles](docs/HOW_IT_WORKS.md#license)).
|
||||
## Aide
|
||||
|
||||
## Contribuer
|
||||
|
||||
Vous avez trouvé un bug, ou vous voulez proposer une modification ou un benchmark ? Lisez d'abord [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
Il indique ce qu'il faut inclure pour que d'autres puissent vérifier votre travail.
|
||||
[Tous les guides](docs) · [Dépannage](docs/TROUBLESHOOTING.md) · [Signaler un bogue](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[Benchmarks](docs/COMMUNITY_BENCHMARKS.md) · [Comment ça marche](docs/HOW_IT_WORKS.md) · [Contribuer](CONTRIBUTING.md)
|
||||
|
||||
## Soutenir Strata
|
||||
|
||||
Strata est gratuit et sous licence MIT. Je le construis et je le teste sur le matériel que je peux obtenir. S'il tourne bien sur votre PC, un café m'aide
|
||||
à continuer de tester de nouvelles cartes et à corriger ce que vous signalez. Aucune obligation. L'utiliser et signaler ce que vous constatez aide tout autant.
|
||||
**Aidez à garder l'IA locale ouverte à tous.** Un café aide à financer le développement et les tests sur davantage de matériel.
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee : soutenir Strata" height="48"></a>
|
||||
|
||||
Vous souhaitez sponsoriser Strata ? Contactez-moi via [GitHub](https://github.com/Niko1221).
|
||||
[Licence MIT](LICENSE) · [Crédits et licences des modèles](docs/HOW_IT_WORKS.md#credits) · [Confidentialité](docs/SAFETY.md)
|
||||
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>Pour les outils d'IA et les lecteurs automatiques : <a href="AGENTS.md">référence technique</a> · <a href="docs/AI_SETUP.md">instructions d'installation</a>.</sub>
|
||||
|
||||
**Parrainages, partenariats matériel ou collaborations :** [[email protected]](mailto:[email protected]).
|
||||
+120
-332
@@ -1,400 +1,188 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="380">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <b>日本語</b> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a></p>
|
||||
|
||||
<h3 align="center">最先端のモデルを、手元のゲーミングPCで動かす</h3>
|
||||
|
||||
<p align="center">NVIDIA、AMD、Intel に対応 · Windows、Linux、Mac · 無料のオープンソース</p>
|
||||
<h3 align="center">あなた自身のパソコンで、高性能な AI を。</h3>
|
||||
<p align="center">チャット、コーディング、画像の処理を、すべてローカルで。</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?include_prereleases&label=release" alt="Latest release"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://github.com/Niko1221/Strata/stargazers"><img src="https://img.shields.io/github/stars/Niko1221/Strata?style=flat" alt="GitHub stars"></a>
|
||||
<a href="#モデル">モデル</a> · <a href="#インストール"><b>インストール</b></a> ·
|
||||
<a href="#ハードウェア">ハードウェア</a> · <a href="#ツール">ツール</a> ·
|
||||
<a href="#ヘルプ">ヘルプ</a> · <a href="#strata-を支援する">支援</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br>
|
||||
<sub>ボクセルの塔の庭園。1回のプロンプトで生成し、RTX 5070 上の Strata で動かしています(IQ3_S、128K コンテキスト) ·
|
||||
<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">動画全体(49秒)</a></sub></p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="Strata をダウンロード"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT ライセンス"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="Buy Me a Coffee で Strata を支援する"></a>
|
||||
</p>
|
||||
|
||||
Strata は **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)** を動かします。1250億パラメータのモデルで、
|
||||
ふつうはサーバーが必要ですが、Strata なら一般的なPCで使えます。チャット、コード作成、画像の読み取りができ、
|
||||
お使いのアプリやコーディングエージェントとも連携します。チャットとファイルはPCの外に出ません。
|
||||
<p align="center"><sub><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <b>日本語</b> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a> · <a href="README.pl.md">Polski</a></sub></p>
|
||||
|
||||
**はじめての方へ。** まず[必要な環境](#必要な環境)を確認して、[アプリをインストール](#方法a-strata-アプリ)してください。
|
||||
**無料でオープンソース。自分の環境で動かせます。** デスクトップで、またはお好みのコーディングツールと一緒に Strata を使えます。アカウントは不要です。
|
||||
|
||||
- **ゲーミングPCで動きます。** RAMとグラフィックスメモリの合計が32 GBあれば始められます。
|
||||
- **お使いのツールと連携します。** OpenAI と Anthropic の API に対応しているので、Claude Code、Codex CLI、OpenCode などのエージェントから接続できます。
|
||||
- **画像を読めます。** 初期設定でオンです。
|
||||
- **無料です。** MIT ライセンス。アカウントもクラウドも不要です。
|
||||
- **プライバシーを守ります。** テレメトリはありません。Strata が何をダウンロードするか、いつインターネットを使うか、ダウンロードをどう検証するかは [docs/SAFETY.md](docs/SAFETY.md) に書いてあります。
|
||||
## モデル
|
||||
|
||||
バージョン 0.2.3 · エンジン 0.1.48
|
||||
まず **ISTA-DASLab** をおすすめします。次に **Unsloth** などの提供元です。メモリに収まる互換モデルがある場合に選べます。
|
||||
|
||||
## 必要な環境
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
**RAMとグラフィックスメモリ(VRAM)の合計が、少なくとも32 GB必要です。** MacやRyzen AI Maxでは、ユニファイドメモリがその量にあたります。
|
||||
メモリが多いほど、大きなモデルを使えたり、速く動いたりします。
|
||||
|
||||
- RAM 32 GBのPCに12〜16 GBのグラフィックスカードがあれば、Coder が動きます。
|
||||
- RAM 64 GBなら、どのサイズも動きます。
|
||||
|
||||
| お使いのPC | 詳細 |
|
||||
| 提供元 | 選択肢 |
|
||||
| --- | --- |
|
||||
| **NVIDIA** GeForce RTX 20、30、40、50 シリーズ(12 GB以上) | アプリまたはターミナル版をインストールしてください。 |
|
||||
| **AMD** Radeon RX 6800 以降、Radeon AI PRO R9700(12 GB以上) | [AMD のカード](docs/AMD_HIP.md) |
|
||||
| **Intel** Arc | [Intel Arc](docs/INTEL_ARC.md)、[Intel エンジン](docs/INTEL.md) |
|
||||
| **Apple Silicon の Mac**(M1 以降、macOS 15 以降) | [Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max(Strix Halo)** などのユニファイドメモリ搭載機 | [Strix Halo](docs/STRIX_HALO.md) |
|
||||
| 古いカードやプロセッサ | [古いGPU](docs/OLDER_GPUS.md)、[古いCPU](docs/INSTALL.md#older-cpus-experimental) |
|
||||
| **ISTA-DASLab · おすすめ** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S。[Coder: IQ1\_M](docs/MODELS.md#coder)(コーディング向け)。 |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF)。メモリ使用量は少ないですが、動作は遅くなります。 |
|
||||
| **その他の選択肢** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
そのほかに必要なもの:
|
||||
[サイズ、必要なメモリ、互換性を比べる](docs/MODELS.md)。
|
||||
|
||||
- 約80 GBの空きディスク容量(SSDなら初回の起動がずっと速くなります)
|
||||
- Windows 10 / 11、Linux、または macOS
|
||||
- 最新のグラフィックスドライバー
|
||||
</details>
|
||||
|
||||
同じメーカーのカードを2〜3枚使って、1つのモデルを動かせます([マルチGPU](docs/MULTI_GPU.md))。NVIDIA と AMD のカードにまたがってモデルを分けることはありません。
|
||||
一覧は [docs/INSTALL.md](docs/INSTALL.md#what-you-need) にあります。
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0。現在、このモデルで文書化されているパックです。
|
||||
|
||||
[モデルガイドと互換性](docs/QWEN36.md)。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
**デスクトップアプリ**と**ターミナル**で使えます。メモリに収まらない分は SSD から読み込むため、空きディスク容量がたくさん必要です。
|
||||
|
||||
| セット(IST-DAS) | ダウンロード | 必要な空き容量 |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | 約245 GB |
|
||||
| 2.00 bpw | 257 GB | 約265 GB |
|
||||
| 2.25 bpw | 274 GB | 約280 GB |
|
||||
|
||||
NVIDIA RTX 30・40・50 シリーズ(Windows と Linux)と、AMD Radeon AI PRO R9700(Linux)で動きます。セットアップがファイルと DeepSeek エンジンをダウンロードし、モデルを起動します。
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
Strata 0.2.5 で 2.00 bpw のセットを使って測定しました。「出力」は回答の速さ、「プロンプト」は Strata が入力を読み込む速さです。
|
||||
|
||||
| ハードウェア | 出力 | プロンプト |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB RAM | 4〜6 トークン/秒 | 約 110 トークン/秒 (4K) |
|
||||
| RTX 3060 12 GB, 46 GB RAM | 9〜11 トークン/秒 | 約 155 トークン/秒 (4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB RAM | 21〜25 トークン/秒 | 320〜360 トークン/秒 (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74〜77 トークン/秒 | 400〜450 トークン/秒 (8K) |
|
||||
|
||||
[メモリ、ディスク、詳細](docs/DEEPSEEK41.md) · [リリースノート](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
どれが動くかわからない場合は、[お使いのパソコンに合うモデルを選ぶ](docs/MODELS.md#pick-by-memory)。
|
||||
|
||||
## インストール
|
||||
|
||||
3つの方法から1つ選んでください。どれも同じエンジンを起動し、同じモデルを使います。
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### 方法A: Strata アプリ
|
||||
### デスクトップアプリ
|
||||
|
||||
いちばん簡単な方法です。エンジンはアプリに入っているので、インストールしてモデルを選べばチャットを始められます。お使いのOSとグラフィックスカードに合うファイルを
|
||||
[リリースページ](https://github.com/Niko1221/Strata/releases/latest)からダウンロードしてください。どれか分からない場合は、表の下の説明を見てください。
|
||||
**[Windows、Linux、Mac 用の Strata をダウンロード →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
| OS | グラフィックスカード | ダウンロードするファイル |
|
||||
| --- | --- | --- |
|
||||
| **Windows 10 / 11** | NVIDIA RTX、ドライバー 580 以降 | [`Strata-0.2.3-windows-cuda13.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda13.exe) |
|
||||
| | NVIDIA、古いカード、またはドライバーが 580 より古い場合 | [`Strata-0.2.3-windows-cuda12.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda12.exe) |
|
||||
| | AMD Radeon RX 9000 シリーズまたは Radeon AI PRO R9700 | [`Strata-0.2.3-windows-hip.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip.exe) |
|
||||
| | AMD Radeon RX 7000 シリーズまたは Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-windows-hip-rdna3.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip-rdna3.exe) |
|
||||
| **Linux** | NVIDIA RTX、ドライバー 580 以降 | [`Strata-0.2.3-linux-nvidia-cuda13.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda13.AppImage) |
|
||||
| | NVIDIA、古いカード、またはドライバーが 580 より古い場合 | [`Strata-0.2.3-linux-nvidia-cuda12.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda12.AppImage) |
|
||||
| | AMD Radeon RX 9000 シリーズまたは Radeon AI PRO R9700 | [`Strata-0.2.3-linux-amd-rx9070.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx9070.AppImage) |
|
||||
| | AMD Radeon RX 7000 シリーズ | [`Strata-0.2.3-linux-amd-rx7900.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx7900.AppImage) |
|
||||
| | AMD Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-linux-amd-strixhalo.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-strixhalo.AppImage) |
|
||||
| **Mac**(Apple Silicon、macOS 15 以降) | 内蔵 | [`Strata-0.2.3-mac.dmg`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-mac.dmg) |
|
||||
アプリをインストールし、モデルを選んで、チャットを始めましょう。インストーラーはシステムごとに1つです。初回起動時に、アプリがお使いのグラフィックスカード用のエンジンをダウンロードします。[インストーラーのヘルプ](docs/INSTALL.md#the-app)。
|
||||
|
||||
**迷ったときは:** NVIDIA の場合、ドライバーがバージョン 580 以降なら `cuda13`、それより古ければ `cuda12` を選びます。`cuda12` は古いカードと古いドライバー向けです。
|
||||
`hip` と `amd` のファイルは AMD のカード用です。それ以外の AMD カード(RX 6000)には、まだ用意されたアプリがありません。
|
||||
[AMD のカード](docs/AMD_HIP.md)を見てください。
|
||||
<sub>ファイル: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
そのあとの手順:
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="チャットとライブのコードプレビューを並べて表示した Strata デスクトップアプリ">
|
||||
<br><sub>チャット、ファイル、ライブプレビューを1つのウィンドウで。</sub>
|
||||
</p>
|
||||
|
||||
- **Windows:** `.exe` を実行します。ユーザー単位でインストールされ、管理者権限は不要です。「Windows によってPCが保護されました」と表示されたら、
|
||||
**詳細情報**を選び、**実行**を選んでください(インストーラーにはまだコード署名がありません)。
|
||||
- **Linux:** ファイルを実行可能にして(`chmod +x`)起動します。FUSE 2 が必要です。`sudo apt install libfuse2`(Ubuntu 22.04)
|
||||
または `libfuse2t64`(Ubuntu 24.04 以降)を実行してください。
|
||||
- **Mac:** `.dmg` を開き、Strata を「アプリケーション」にドラッグします。
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
最初の画面で、アプリがPCを調べて合うモデルをすすめます。インストールを押してください。モデルは大きく(約40〜70 GB)、中断しても続きからダウンロードできます。
|
||||
ウィンドウを閉じると、Strata とエンジンが止まります。
|
||||
### ターミナルアプリ
|
||||
|
||||
### 方法B: ターミナル(1行)
|
||||
ターミナルのほうが好みですか? Strata をインストールして、**`strata launch`** を実行します。
|
||||
|
||||
ターミナル版は `strata` コマンドです。スクリプトやサーバー、AI エージェント向けです。
|
||||
<details open>
|
||||
<summary><b>インストールコマンド</b></summary>
|
||||
|
||||
Linux と Mac:
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
Windows(PowerShell):
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
スクリプトはPCを調べ、ターミナル版をダウンロードし、SHA-256 を検証して、ホームフォルダに展開します。管理者権限は不要です。Windows では、終わったら
|
||||
新しいターミナルを開いてください。そのあと Strata を起動します。
|
||||
Windows では、インストール後に新しいターミナルを開きます。そのあと:
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
質問は1つずつ表示されます。モデル、コンテキスト、画像、接続を許可する相手の順です。そのあと、お使いのグラフィックスカード用のエンジン
|
||||
(署名付きで、使う前にテスト起動します)とモデルをダウンロードして、サーバーを開始します。スクリプトや AI エージェントからは、フラグを使います。
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
実行前にインストールスクリプトを読みたい場合は、先に `curl -fsSL <address> -o install.sh` でダウンロードし、内容を確認してから
|
||||
`sh install.sh` を実行してください。すべての画面とフラグは [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md) にあります。
|
||||
|
||||
### 方法C: AI にセットアップを任せる
|
||||
|
||||
Claude Code、Cursor、Codex、GitHub Copilot などのコーディングアシスタントに、次の文を貼り付けます。
|
||||
|
||||
```text
|
||||
Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.
|
||||
```
|
||||
|
||||
AI はグラフィックスカード、RAM、ディスクを調べ、合うモデルを選んで、インストールと起動をし、アプリの接続方法を教えてくれます。
|
||||
AI ツールは [MCP サーバー](docs/MCP_SERVER.md)を通じて、Strata のインストール、起動、停止もできます。
|
||||
|
||||
自分でビルドしたい方は[ソースからビルド](#ソースからビルド)を見てください。
|
||||
|
||||
## モデル
|
||||
|
||||
アプリと `strata launch` は、メモリ量に合うモデルをすすめます。モデルは1つで、圧縮の度合いが違う複数のサイズがあります。
|
||||
小さいサイズは速く、大きいサイズは少し賢くなります。
|
||||
|
||||
### メモリが少ないなら Gyro
|
||||
|
||||
[Gyro](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF)(agentionai 製)は、このモデルをいちばん小さく動かせる方法です。
|
||||
|
||||
| サイズ | 必要なメモリ(RAM + VRAM) | ダウンロード | 内容 |
|
||||
| --- | ---: | ---: | --- |
|
||||
| **Gyro-S** | 27.6 GB | 58.5 GB | ほかのサイズが入らないPC向け。品質は IQ2_XS より下がります。 |
|
||||
| **Gyro-M** | 35 GB | 92.0 GB | 品質は IQ3_XXS 程度で、GPUメモリの使用量は約20%少なくなります。回答の書き出しは Q2_0 より、12 GBの RTX 3060 で16%、R9700 で21%遅くなります。 |
|
||||
|
||||
Gyro は NVIDIA と AMD のカード(AMD は実験的)、および Linux 上の Intel Arc カード(Arc A750 で確認)で動きます。0.2.2 からは Apple Silicon の Mac でも動きます(32 GB の Mac mini で Gyro-S は 9 トークン/秒、エキスパートは SSD から読み込み)。詳細と測定結果は
|
||||
[docs/GYRO.md](docs/GYRO.md) にあります。`strata launch --model gyro-s` で起動します。
|
||||
|
||||
### ほかのサイズ
|
||||
|
||||
| メモリ(RAM + VRAM) | 選ぶモデル | 備考 |
|
||||
| --- | --- | --- |
|
||||
| **32 GB** | **Gyro-S**、またはコード向けの **[Coder](docs/MODELS.md#coder)** | Coder はRAM 32 GBが必要で、エキスパートを半分だけ保持するため、コード以外は弱くなります |
|
||||
| **40 GB** | **[Swift 1.5](docs/MODELS.md#swift-15)** IQ2_XS(39.2 GB)、または **Gyro-M**(35 GB) | Swift は答える前に考える時間が短くなります。Gyro-M は品質が IQ3_XXS に近いものの、回答の書き出しは Q2_0 より16〜21%遅くなります |
|
||||
| **48 GB** | **IQ3_XXS**(47.0 GB) | 遅くなりますが、品質は上がります |
|
||||
| **64 GB** | **IQ3_S**(54.8 GB)、オリジナルまたは Swift 1.5 | いちばん遅く、いちばん高品質です。公開されているテストでは完全版と同等です |
|
||||
| **96 GB 以上** | Unsloth の **UD-IQ4_XS**(RAM 約72 GB)から **Q8_0**(約136 GB)まで、4〜8ビット | 完全版に近づきます。RAM が足りないと、Strata は一部を SSD から読むため、ずっと遅くなります |
|
||||
|
||||
表の行より RAM が少なくても動くことがあります。Strata は自動で[低RAMモード](docs/MODELS.md#a-big-graphics-card-and-little-ram)に切り替わります。
|
||||
速度は落ち、グラフィックスカードが小さいとさらに大きく落ちます。
|
||||
|
||||
そのほかの選択肢:
|
||||
|
||||
- **[Swift 1.5](docs/MODELS.md#swift-15)** はファインチューン版で、答える前に考える時間が短くなります。品質と RAM の必要量はほぼ同じです。
|
||||
- **[NVFP4](docs/NVFP4.md)** は NVIDIA カード向けの NVIDIA 製4ビット版です。すべてのエキスパートを RAM に置くには、約80 GBの RAM が必要です。
|
||||
- **[Qwen3.6-35B-A3B](docs/QWEN36.md)** は、より小さい別のモデルです。画像を読め、複数のリクエストに同時に答えられます。
|
||||
- **[OrcaRouter の Uncensored IQ3_XXS](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** は手動で設定します。
|
||||
|
||||
すべてのサイズ、ダウンロード、どの構成で何が動くかは [docs/MODELS.md](docs/MODELS.md) にあります。
|
||||
|
||||
### DeepSeek V4.1-Flash(ターミナル版、0.2.4 から)
|
||||
|
||||
[DeepSeek V4.1-Flash](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF) は、これとは別のずっと大きなモデルです。下の 3 つのセットは ISTA-DASLab が作りました。Strata は、12 GB のグラフィックスカード 1 枚と 46 から 64 GB の RAM を持つ PC でこれを動かし、残りは SSD から読みます。NVIDIA RTX 30 から 50 シリーズのカードと Radeon AI PRO R9700 で動きます。専用のエンジンパッケージ `strata-dsv41` を使い、DeepSeek を選ぶと `strata launch` がダウンロードします。デスクトップアプリはまだ対応していません。
|
||||
|
||||
| セット | ダウンロード | 元のモデルとの品質差 | 出力速度 |
|
||||
| --- | ---: | --- | --- |
|
||||
| **IQ1_M**(1.75 ビット) | 239 GB | KL 0.217、パープレキシティ 3.80(+21%)、コード +8.9%、エージェント作業 +10.2%、通常の英語の散文では弱めです。ISTA-DASLab のモデルカードによると、基本モデルのタスク平均の 98.7% を保ちます(AIME25、GPQA-Diamond、LiveCodeBench v6)。 | 未測定 |
|
||||
| **IQ2_XXS** (2.00 ビット) | 257 GB | KL 0.170、パープレキシティ 3.63(+15.5%)、コード +8.6%、エージェント作業 +5.3% | RTX 3060 で毎秒約 8 から 10 トークン(コード 9.9、エージェント作業 7.8)、RTX 5070 で約 5 |
|
||||
| **IQ2_XS** (2.25 ビット) | 274 GB | KL 0.107、パープレキシティ 3.37(+7.3%)、コード +3.2%、エージェント作業 +2.2% | Radeon AI PRO R9700 1 枚で毎秒約 11 トークン |
|
||||
| **IQ4_NL**(Engram テーブル、3 つ目のモデルではありません) | 111 GB、上の 3 つのダウンロードに含まれています | モデルが RAM または SSD から読む 4 ビットの Engram 参照テーブルです。3 つのセットはこの 1 つのファイル(`DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf`)を共有します。 | 該当なし |
|
||||
|
||||
Radeon AI PRO R9700 4 枚:毎秒約 31 トークン、DSpark ありで 55 から 69。
|
||||
|
||||
`strata launch --model ist-das-2.00bpw`(または `ist-das-1.75bpw`、`ist-das-2.25bpw`)で起動します。詳細、カードごとの速度、手動インストールは [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md) にあります。
|
||||
|
||||
## どのくらい速い?
|
||||
|
||||
12 GBのグラフィックスカード(RTX 5070、Ryzen 5 7600、RAM 64 GB)での数値です。ほかのカードの結果は
|
||||
[各モデルの速度](docs/MODELS.md#how-fast-is-each-size)、[コミュニティの結果](docs/COMMUNITY_BENCHMARKS.md)を見てください。
|
||||
|
||||
| モデル | 回答が出る速さ | プロンプトを読む速さ |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████████` 94 tokens/s | `████████████` 2,650 tokens/s |
|
||||
| **IQ2_XS** | `██████████░░` 79 tokens/s | `█████████░░░` 2,090 tokens/s |
|
||||
| **IQ3_XXS** | `████████░░░░` 62 tokens/s | `████████░░░░` 1,750 tokens/s |
|
||||
| **IQ3_S** | `███████░░░░░` 53 tokens/s | `███████░░░░░` 1,620 tokens/s |
|
||||
| **Coder** | `███████░░░░░` 55 tokens/s | `██████████░░` 2,180 tokens/s |
|
||||
|
||||
1トークンは英単語の約¾にあたるので、毎秒60トークンは読む速さより速くなります。「プロンプトを読む速さ」は、長い文書やコード、チャット履歴を Strata が取り込む速さです。
|
||||
|
||||
16 GBの AMD カード(RX 9070 XT、Ryzen 9 3900X、RAM 47 GB)での測定値:
|
||||
|
||||
| モデル | 回答が出る速さ | プロンプトを読む速さ |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████░░░░` 60 tokens/s | `█████░░░░░░░` 1,160 tokens/s |
|
||||
| **IQ2_XS** | `███████░░░░░` 52 tokens/s | `█████░░░░░░░` 1,110 tokens/s |
|
||||
| **Coder** | `██████░░░░░░` 44 tokens/s | `██████░░░░░░` 1,420 tokens/s |
|
||||
|
||||
バーは2つの表で同じ目盛りです。VRAM が多いカードほど速くなり、RTX 3090(24 GB)なら毎秒100〜140トークンほどになるはずです。各数値のエンジンのバージョンは
|
||||
[DETAILS.md](docs/DETAILS.md#speed-measured) にあります。
|
||||
|
||||
## 使い方
|
||||
|
||||
### アプリで
|
||||
|
||||
アプリには、**チャット**、モデルとGPU・CPU・RAMの状態を見る**モニター**、**モデル**ページ、**設定**があります。チャットはPC上のフォルダで作業できます。
|
||||
**手動**モードでは、ファイルを変更したりコマンドを実行したりする前に確認します。`/loop 10m <やること>` と入力すると、チャットを開いている間、メッセージを10分ごとに繰り返し送ります。
|
||||
|
||||
チャットは DuckDuckGo(または Bing)でウェブ検索ができ、アカウントは不要です。**設定、ツール**で検索キーを追加することもできます。
|
||||
検索は、PCの外に何かを送る唯一の機能で、送られるのは検索語です。
|
||||
|
||||
2つのモデルを動かすには、**複数のモデルを実行**をオンにして、それぞれのモデルに同じメーカーのカードを1枚ずつ割り当てます。
|
||||
|
||||
<p align="center"><img src="docs/media/app-chat.png" width="900" alt="The Strata app: a chat where the agent built a small voxel pagoda garden, with the page open in the preview on the right"><br>
|
||||
<sub>Strata アプリでのチャット。エージェントが小さなボクセルの塔の庭を 1 つの HTML ファイルとして書き、そのページが会話の横のプレビューで開きます</sub></p>
|
||||
|
||||
### ターミナルで
|
||||
|
||||
<p align="center"><img src="docs/media/terminal-monitor.png" width="900" alt="The Strata Terminal monitor overview while the model writes a reply"><br>
|
||||
<sub>モデルが返信を書いている間の <code>strata monitor</code>。速度、GPU、メモリ、最近のリクエストが表示されます</sub></p>
|
||||
|
||||
```sh
|
||||
strata launch # ガイド付きの画面: モデル、コンテキスト、画像、アクセス、そして開始
|
||||
strata launch --model q2_0 --yes --no-tui # 質問なし: 開始し、アドレスを表示して戻る
|
||||
strata launch --plan --model q2_0 # 実行内容を表示するだけで、何も変更しない
|
||||
strata launch --status # 今、何が動いているか
|
||||
strata launch --stop # 停止する
|
||||
strata monitor --url http://127.0.0.1:8080 # 速度、GPU、メモリ、リクエストを見る
|
||||
strata update --check # 新しいエンジンがあるか確認(strata update でインストール)
|
||||
strata doctor # インストール済みのエンジンファイルを調べる
|
||||
```
|
||||
|
||||
`strata --help` ですべてのコマンドを確認できます。起動とサーバーの稼働では、何もダウンロードしません。ダウンロードするのは、インストール、
|
||||
`strata launch`(モデルを選んだとき)、`strata update` だけです。スマートフォンや別のPCから Strata に接続するには、
|
||||
`strata launch --access lan` を使います。API キーが作られ、キーがない状態ではネットワーク上で起動しません。`--open` を付けない限り、ブラウザは開きません。
|
||||
ガイド: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md)。クライアント全体: [docs/TERMINAL.md](docs/TERMINAL.md)。
|
||||
|
||||
### AI エージェントと使う
|
||||
|
||||
エージェントは、方法Bの1行コマンドで Strata をインストールし、
|
||||
`strata launch --model NAME --yes --no-tui` を実行します。手順、フラグ、終了コードは [docs/AI_SETUP.md](docs/AI_SETUP.md) に、
|
||||
リポジトリのルールは [AGENTS.md](AGENTS.md) にあります。
|
||||
|
||||
### ほかのアプリをつなぐ
|
||||
|
||||
| アプリの種類 | ベース URL |
|
||||
| --- | --- |
|
||||
| OpenAI 互換(ほとんどのアプリとエージェント) | `http://127.0.0.1:8080/v1`(API キーもモデル名も何でも可) |
|
||||
| Anthropic API(Claude Code など) | `http://127.0.0.1:8080`、`/v1` は付けません。これらのアプリは `/v1/messages` を自分で付けます。Claude Code: `ANTHROPIC_BASE_URL=http://127.0.0.1:8080` |
|
||||
| OpenAI Responses API(Codex CLI) | `http://127.0.0.1:8080/v1/responses`([設定方法](docs/DETAILS.md#the-responses-api-and-codex-cli)) |
|
||||
|
||||
`strata connect` は、OpenCode、Codex CLI、Claude Code、oh-my-pi、pi、Hermes Agent、OpenClaw の正確な設定を表示します。
|
||||
`strata connect opencode --write` は、確認したうえでファイルを書き込み、バックアップを残します。
|
||||
|
||||
### 画像
|
||||
|
||||
画像を読めるモデルでは、画像は初期設定でオンです。チャットに画像を添付または貼り付けるか、アプリから送ってください。
|
||||
グラフィックスカードが24 GB未満のときは、画像リーダーがプロセッサで動きます(画像1枚につき数秒、カードのメモリは使いません)。24 GB以上のときはグラフィックスカードで動きます。
|
||||
このルールは NVIDIA と AMD で同じです。画像はモデルごとにオフにでき、`--vision off`、`--vision gpu`、`--vision cpu` でリーダーを選べます。
|
||||
|
||||
このルールの根拠となる数値です。Radeon AI PRO R9700 では、カードのリーダーは260トークンの画像に57 ms、プロセッサのリーダーは3.1秒かかりました。
|
||||
16 GBのカード(Tesla P100 と RTX A4000、Linux)では、カードのリーダーを使うとテキストの速度が3〜5%下がりました。
|
||||
本来モデルが使う約1.4 GBをリーダーが占めるためです。Mac ではメモリ量にかかわらず GPU が読み取ります(32 GB の M4 で260トークンの画像に0.45秒、共有メモリを約1.2 GB使います)。プロセッサでは1枚あたり約50秒かかるため、`--vision cpu` を指定したときだけ使います。
|
||||
|
||||
### 知っておくと便利なこと
|
||||
|
||||
- 思考のレベル(**off、low、medium、high**)は、チャットのメニューか、お使いのアプリの「reasoning effort」で選びます。off がいちばん速くなります。
|
||||
- Strata は初期設定では、一度に1つのリクエストに答えます。同時に複数処理するには、`strata launch` で `--parallel N` を使うか、設定に
|
||||
`"parallel": 2` を書きます([BATCHING.md](docs/BATCHING.md))。12 GBのカードでは、1つずつの回答が遅くなります。
|
||||
- Strata はチャットの最初のメッセージを全文読みます。30,000トークンあたり約1分かかります。続きのメッセージは数秒で始まります。
|
||||
- チャットの保存場所と API 全体: [docs/INSTALL.md](docs/INSTALL.md#where-things-are-stored)、[docs/DETAILS.md](docs/DETAILS.md#using-it)。
|
||||
|
||||
## ソースからビルド
|
||||
|
||||
<details>
|
||||
<summary>リポジトリから Windows、Linux、Mac 用にビルドする</summary>
|
||||
|
||||
[Strata をダウンロード](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip)して展開するか、`git clone` します。
|
||||
**Windows:** `START-HERE.bat` をダブルクリックします。**Linux:** Strata フォルダで `./setup.sh` を実行します。
|
||||
|
||||
**Mac(Apple Silicon、macOS 15 以降):** 最初に一度、`xcode-select --install` で Apple のコマンドラインツールをインストールします
|
||||
(Xcode 本体は不要です)。Strata フォルダでターミナルを開き、`./setup.sh` を実行します。Mac 用エンジンをお使いの Mac 上でビルドし
|
||||
(約7分)、同じ質問をして、モデルをダウンロードし、起動します。2回目以降は `./setup.sh` ですぐに起動します。
|
||||
お使いの Mac に合うサイズは [docs/MAC.md](docs/MAC.md) を見てください。
|
||||
|
||||
インストーラーはカードを見つけて、合うエンジンを設定します。どのモデルとサイズにするか、コンテキストをどれだけにするか(モデルが一度に覚えておけるテキストの量)、
|
||||
画像を読ませるかを聞かれます。おすすめの答えでよければ Enter を押します。そのあとモデル(約70 GB)をダウンロードして起動します。
|
||||
ダウンロードが止まったら、もう一度実行すると続きから再開します。ブラウザで `http://127.0.0.1:8080` の Strata ページが開きます。
|
||||
|
||||
> モデルの起動中は、PCが1〜3分ほど(初回がいちばん長い)遅くなったり、応答しなくなったりすることがあります。Strata は35〜55 GBをRAMに読み込み、
|
||||
> その一部をグラフィックスカード用に固定するためです。ウィンドウを閉じずに待ってください。
|
||||
|
||||
次回からは `START-HERE.bat`(または `./setup.sh`)をもう一度実行するだけです。すぐに起動し、同じものを2回ダウンロードすることはありません。ウィンドウを閉じるとモデルが止まります。
|
||||
`UPDATE.bat`(`./update.sh`)は、起動せずに Strata を更新します。更新、Docker、複数のカード、ファイルの保存先、すべてのオプションは
|
||||
[docs/INSTALL.md](docs/INSTALL.md) にあります。
|
||||
|
||||
PCの性能を測るには、`BENCH.bat`(`./bench.sh`)を実行します。5〜10分かかり、共有できるレポートが作られます
|
||||
([方法](docs/COMMUNITY_BENCHMARKS.md#run-the-benchmark))。
|
||||
|
||||
**オプション: モデル全体がRAMに入るとき、1枚のカードをさらに速くする。** RubenTorney による、自分でオンにする2つの設定です(#1904、#1905)。
|
||||
グラフィックスカードが1枚で、RAM がすべてのエキスパートを保持できるときに効果があります。たとえば64 GBのPCでの Q2_0 や IQ3_XXS です。
|
||||
Strata のデータフォルダにある `strata-<model>.json`([場所](docs/INSTALL.md#where-things-are-stored))を開いて、次を追加します。
|
||||
|
||||
- `"args"` のリストに `"--adapt-async", "1"` を追加します。エキスパートキャッシュが、回答を止めずに補助スレッドで更新されます。
|
||||
RTX 5070(Windows、Q2_0)での測定: デコードが4〜5%、コードや長い文書では7〜10%速くなりました。回答は初期設定と少し違うことがありますが、実行ごとの結果は変わりません。
|
||||
- `"env"` ブロックに `"STRATA_PIN_BY_NEED": "1"` を追加します(Windows)。Windows ではグラフィックスカード用に固定できる RAM が半分ほどしかありません。
|
||||
この設定は、カードが最初に必要とするエキスパートを優先して固定します。RTX 5070 での測定: プロンプトの読み取りが4.4%速くなりました。
|
||||
|
||||
```json
|
||||
"args": [ ..., "--adapt-async", "1" ],
|
||||
"env": { "STRATA_PIN_BY_NEED": "1" }
|
||||
```
|
||||
|
||||
変更したら Strata を再起動してください。元に戻すには、2つの項目を削除します。
|
||||
画面の案内に従って、モデルをダウンロードして起動します。[ターミナルガイド](docs/TERMINAL_LAUNCH.md)。
|
||||
|
||||
</details>
|
||||
|
||||
## 仕組み
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="モデルの動作、速度、メモリ、最近のリクエストを表示する Strata ターミナルアプリ">
|
||||
<br><sub>動作中のモデルとハードウェアの状態を確認できます。</sub>
|
||||
</p>
|
||||
|
||||
このようなモデルは、ふつう数百GBのグラフィックスメモリを持つサーバーで動きます。お使いのグラフィックスカードは12〜24 GBです。Strata は、PC全体で作業を分担して、モデルを収めます。
|
||||
図書館にたとえてみます。
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
- モデルは、24,576人の小さな専門家(「エキスパート」)からなるチームです。24,576冊の参考書のようなものです。1つの単語に必要なのは、そのうち10冊だけです。
|
||||
- **グラフィックスカードは机です。** 小さくて速く、最もよく使う約4,000冊が開いて置いてあります。
|
||||
- **RAM は閲覧室の書棚です。** 24,576冊すべてがここにあります。単語に必要な本が机になければ、プロセッサがすぐに書棚から読み、その間もカードは作業を続けます。
|
||||
- **SSD は書庫です。** 29 GBの参照テーブルがしまってあります。モデルは単語ごとにその数行だけを読むので、RAM に置いておく必要はありません。
|
||||
[ソースからビルド](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [インストールガイド(全文)](docs/INSTALL.md)
|
||||
|
||||
<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
小さな助手が、次の数単語も予想します。大きなモデルがそれをまとめて確認し、正しいものだけを残します。答えは同じで、1.6〜1.8倍早く返ります。
|
||||
長い文章は、一度に最大8,192トークンの大きな塊で、毎秒1,000トークンを超える速さで読みます。
|
||||
## ハードウェア
|
||||
|
||||
<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>
|
||||
| 対応ハードウェア | ガイド |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX 20 / 30 / 40 / 50 シリーズ** | [NVIDIA のセットアップ](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900、RX 9060 / 9070、AI PRO R9700** | [AMD のセットアップ](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · 試験的** | [RX 6000 のセットアップ](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Intel のセットアップ](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 以降** | [Mac のセットアップ](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Strix Halo のセットアップ](docs/STRIX_HALO.md) |
|
||||
|
||||
詳しい説明は [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md) にあります。各部分と数値は
|
||||
[詳細](docs/DETAILS.md#how-it-works)と[論文](docs/paper/Strata-Paper.pdf)を見てください。
|
||||
<a id="using-it"></a>
|
||||
|
||||
## うまくいかないとき
|
||||
## ツール
|
||||
|
||||
- **Strata を初めて起動したときに、PCが固まりました。** モデルを RAM に読み込んでいます。ウィンドウを閉じずに待ってください。10分たっても固まったままなら、
|
||||
PCを再起動し、ほかのプログラムを閉じてからもう一度試すか、小さいサイズを選んでください。
|
||||
- **ダウンロードやインストールの途中で止まりました。** アプリか `strata launch` をもう一度起動するか、`START-HERE.bat`(または
|
||||
`./setup.sh`)をもう一度実行してください。止まったところから再開します。
|
||||
- **とても遅い、ディスクのランプが点滅し続ける、または「エンジンが予期せず停止しました」と表示される。** PCの空き RAM が足りません。
|
||||
ほかのプログラムを閉じるか(ブラウザはメモリを多く使います)、Q2_0 や IQ2_XS のような小さいサイズを選んでください。
|
||||
- **このPCに合うエンジンがないと表示される。** アプリでは、**設定、エンジン**を開いて**エンジンを更新**を押します。ターミナルでは
|
||||
`strata update` を実行します。`strata doctor` で、どのエンジンファイルがインストールされているか分かります。
|
||||
- **ポート 8080 はすでに使われていると表示される。** Strata がすでに動いています。ウィンドウを探してください。
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw**。OpenAI 互換と Anthropic 互換の API を通じて、ほかのツールも使えます。
|
||||
|
||||
そのほかの問題と対処法は [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) にあります。それでも解決しない場合は、
|
||||
[issue](https://github.com/Niko1221/Strata/issues) を作成してください。アプリでは、**設定、エンジン、診断、ログを見る、ログを保存**で作られるファイルを添付します。
|
||||
ターミナルでは、`strata doctor` の出力を貼り付けます。ソースから動かしている場合は、Strata フォルダの `strata-<model>.log` を添付してください。
|
||||
セキュリティ上の問題は、非公開で報告してください: [SECURITY.md](SECURITY.md)。
|
||||
**`strata connect`** を実行すると、お使いのツールの設定方法が表示されます。[接続ガイド](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect)。
|
||||
|
||||
## クレジットとライセンス
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
モデルは Qwen チームの [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) です。圧縮は
|
||||
[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF)、UkisAI(Swift 1.5)、agentionai(Gyro)、
|
||||
Unsloth が行いました。Strata は [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp) の一部を使っています。すべてのクレジットは
|
||||
[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits) にあります。Strata は [MIT ライセンス](LICENSE)のオープンソースです。一部のコンポーネントと
|
||||
すべてのモデルには、それぞれのライセンスがあります([該当するもの](docs/HOW_IT_WORKS.md#license))。
|
||||
## ヘルプ
|
||||
|
||||
## コントリビューション
|
||||
[すべてのガイド](docs) · [トラブルシューティング](docs/TROUBLESHOOTING.md) · [不具合を報告](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[ベンチマーク](docs/COMMUNITY_BENCHMARKS.md) · [仕組み](docs/HOW_IT_WORKS.md) · [貢献する](CONTRIBUTING.md)
|
||||
|
||||
バグを見つけた、変更やベンチマークを送りたい、という方は、先に [CONTRIBUTING.md](CONTRIBUTING.md) を読んでください。
|
||||
ほかの人があなたの成果を確認できるように、何を書くべきかが説明してあります。
|
||||
## Strata を支援する
|
||||
|
||||
## Strata を応援する
|
||||
**ローカル AI をみんなに開かれたものに。** コーヒー1杯が、開発と、より多くのハードウェアでのテストの支えになります。
|
||||
|
||||
Strata は無料で、MIT ライセンスです。私が入手できるハードウェアで開発とテストをしています。お使いのPCで快適に動いたなら、コーヒー1杯分の支援は、
|
||||
新しいカードのテストと、報告いただいた不具合の修正を続ける助けになります。無理のない範囲で大丈夫です。使って、気づいたことを報告してもらえるだけでも同じように助かります。
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee: Strata を支援する" height="48"></a>
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
|
||||
[MIT ライセンス](LICENSE) · [クレジットとモデルのライセンス](docs/HOW_IT_WORKS.md#credits) · [プライバシー](docs/SAFETY.md)
|
||||
|
||||
Strata のスポンサーに関心がある方は、[GitHub](https://github.com/Niko1221) から連絡してください。
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>AI ツールと自動リーダー向け: <a href="AGENTS.md">技術リファレンス</a> · <a href="docs/AI_SETUP.md">セットアップ手順</a></sub>
|
||||
|
||||
**スポンサー、ハードウェア提携、共同開発のご相談:** [[email protected]](mailto:[email protected]).
|
||||
@@ -1,414 +1,193 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="380">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center"><b>English</b> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a></p>
|
||||
|
||||
<h3 align="center">Run a state-of-the-art model on your own gaming PC</h3>
|
||||
|
||||
<p align="center">Support for NVIDIA, AMD, Intel · Windows, Linux, Mac · free and open source</p>
|
||||
<h3 align="center">Run powerful AI on your own computer.</h3>
|
||||
<p align="center">Chat, code and work with images, locally.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?include_prereleases&label=release" alt="Latest release"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://github.com/Niko1221/Strata/stargazers"><img src="https://img.shields.io/github/stars/Niko1221/Strata?style=flat" alt="GitHub stars"></a>
|
||||
<a href="#models">Models</a> · <a href="#install"><b>Install</b></a> ·
|
||||
<a href="#hardware">Hardware</a> · <a href="#tools">Tools</a> ·
|
||||
<a href="#help">Help</a> · <a href="#support-strata">Support</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br>
|
||||
<sub>A voxel pagoda garden, 1 shot prompt running on an RTX 5070 with Strata (IQ3_S, 128K context) ·
|
||||
<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">full video (49 s)</a></sub></p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="Download Strata"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="Support Strata on Buy Me a Coffee"></a>
|
||||
</p>
|
||||
|
||||
Strata runs **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)**, a 125-billion-parameter model that
|
||||
normally needs a server, on a normal PC. It chats, writes code, reads pictures and works with your apps and coding
|
||||
agents. Your chats and files stay on your PC.
|
||||
<p align="center"><sub><b>English</b> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a> · <a href="README.pl.md">Polski</a></sub></p>
|
||||
|
||||
**New here?** Check [what you need](#what-you-need), then [install the app](#option-a-the-strata-app).
|
||||
**Free, open source, and yours to run.** Use Strata on your desktop or with your favorite coding tools. No account needed.
|
||||
|
||||
- **Runs on a gaming PC.** 32 GB of RAM and graphics memory together is enough to start.
|
||||
- **Works with your tools.** It speaks the OpenAI and Anthropic APIs, so Claude Code, Codex CLI, OpenCode and other agents connect to it.
|
||||
- **Reads pictures.** They are on by default.
|
||||
- **Free.** MIT license, no account, no cloud.
|
||||
- **Private.** No telemetry. What Strata downloads, when it uses the internet and how it checks downloads is in [docs/SAFETY.md](docs/SAFETY.md).
|
||||
## Models
|
||||
|
||||
Version 0.2.3 · engine 0.1.48
|
||||
We recommend **ISTA-DASLab first**, then **Unsloth** and other providers, where a compatible model fits.
|
||||
|
||||
## What you need
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
**You need at least 32 GB of RAM and graphics memory (VRAM) together.** On a Mac or a Ryzen AI Max, that is the unified
|
||||
memory. More memory gives a bigger model or a faster one.
|
||||
|
||||
- A 32 GB PC with a 12-16 GB card runs the Coder.
|
||||
- 64 GB of RAM runs every size.
|
||||
|
||||
| Your computer | Details |
|
||||
| Provider | Choices |
|
||||
| --- | --- |
|
||||
| **NVIDIA** GeForce RTX 20, 30, 40, 50 series (12 GB or more) | Install the app or the Terminal. |
|
||||
| **AMD** Radeon RX 6800 and newer, Radeon AI PRO R9700 (12 GB or more) | [AMD cards](docs/AMD_HIP.md) |
|
||||
| **Intel** Arc | [Intel Arc](docs/INTEL_ARC.md), [Intel engine](docs/INTEL.md) |
|
||||
| **Apple Silicon Mac** (M1 or newer, macOS 15 or newer) | [Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max (Strix Halo)** and other unified-memory systems | [Strix Halo](docs/STRIX_HALO.md) |
|
||||
| Older cards and processors | [Older GPUs](docs/OLDER_GPUS.md), [Older CPUs](docs/INSTALL.md#older-cpus-experimental) |
|
||||
| **ISTA-DASLab · recommended** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S. [Coder: IQ1\_M](docs/MODELS.md#coder) for coding. |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF). Lower memory use but slower. |
|
||||
| **Other options** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
Also needed:
|
||||
[Compare sizes, memory needs and compatibility](docs/MODELS.md).
|
||||
|
||||
- about 80 GB of free disk (an SSD makes the first start much faster)
|
||||
- Windows 10 / 11, Linux or macOS
|
||||
- a current graphics driver
|
||||
</details>
|
||||
|
||||
Two or three cards of the same make can share a model ([multi-GPU](docs/MULTI_GPU.md)). Strata never splits a model across
|
||||
NVIDIA and AMD cards. Full list: [docs/INSTALL.md](docs/INSTALL.md#what-you-need).
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0. These are the currently documented packs for this model.
|
||||
|
||||
[Model guide and compatibility](docs/QWEN36.md).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
In the **desktop app** and the **Terminal**. What does not fit in memory is read from your SSD, so it needs a lot of free
|
||||
disk space.
|
||||
|
||||
| Set (IST-DAS) | Download | Free disk needed |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | about 245 GB |
|
||||
| 2.00 bpw | 257 GB | about 265 GB |
|
||||
| 2.25 bpw | 274 GB | about 280 GB |
|
||||
|
||||
Runs on NVIDIA RTX 30, 40 and 50 series (Windows and Linux), AMD Radeon AI PRO R9700 (Linux), and AMD Ryzen AI Max — Strix Halo
|
||||
(Windows). Setup downloads the files and the DeepSeek engine, then starts the model.
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
Measured with the 2.00 bpw set on Strata 0.2.5 (Strix Halo: 0.2.7). Output is the speed of the answer, prompt is how fast Strata reads your input.
|
||||
|
||||
| Hardware | Output | Prompt |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB RAM | 4 to 6 tokens/s | about 110 tokens/s (4K) |
|
||||
| RTX 3060 12 GB, 46 GB RAM | 9 to 11 tokens/s | about 155 tokens/s (4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB RAM | 21 to 25 tokens/s | 320 to 360 tokens/s (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74 to 77 tokens/s | 400 to 450 tokens/s (8K) |
|
||||
| Ryzen AI Max+ 395 (Strix Halo), 128 GB unified | 19 to 21 tokens/s (code), 11 (chat) | 87 tokens/s (4K), 125 tokens/s (8K) |
|
||||
|
||||
[Memory, disk and details](docs/DEEPSEEK41.md) · [Release notes](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
Not sure what fits? [Choose a model for your computer](docs/MODELS.md#pick-by-memory).
|
||||
|
||||
## Install
|
||||
|
||||
Pick one option. They all start the same engine and use the same models.
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### Option A: the Strata app
|
||||
### Desktop app
|
||||
|
||||
The easiest way. The app has the engine inside: install it, pick a model, chat. Download the file for your system and
|
||||
graphics card from the [releases page](https://github.com/Niko1221/Strata/releases/latest). Not sure which one? See the
|
||||
line under the table.
|
||||
**[Download Strata for Windows, Linux or Mac →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
| System | Your graphics card | File to download |
|
||||
| --- | --- | --- |
|
||||
| **Windows 10 / 11** | NVIDIA RTX, driver 580 or newer | [`Strata-0.2.3-windows-cuda13.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda13.exe) |
|
||||
| | NVIDIA, older card or driver older than 580 | [`Strata-0.2.3-windows-cuda12.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda12.exe) |
|
||||
| | AMD Radeon RX 9000 series or Radeon AI PRO R9700 | [`Strata-0.2.3-windows-hip.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip.exe) |
|
||||
| | AMD Radeon RX 7000 series or Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-windows-hip-rdna3.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip-rdna3.exe) |
|
||||
| **Linux** | NVIDIA RTX, driver 580 or newer | [`Strata-0.2.3-linux-nvidia-cuda13.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda13.AppImage) |
|
||||
| | NVIDIA, older card or driver older than 580 | [`Strata-0.2.3-linux-nvidia-cuda12.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda12.AppImage) |
|
||||
| | AMD Radeon RX 9000 series or Radeon AI PRO R9700 | [`Strata-0.2.3-linux-amd-rx9070.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx9070.AppImage) |
|
||||
| | AMD Radeon RX 7000 series | [`Strata-0.2.3-linux-amd-rx7900.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx7900.AppImage) |
|
||||
| | AMD Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-linux-amd-strixhalo.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-strixhalo.AppImage) |
|
||||
| **Mac** (Apple Silicon, macOS 15 or newer) | built in | [`Strata-0.2.3-mac.dmg`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-mac.dmg) |
|
||||
Install the app, choose a model, and start chatting. There is one installer for each system. On first start the app
|
||||
downloads the engine for your graphics card. [Help with the installer](docs/INSTALL.md#the-app).
|
||||
|
||||
**If you are unsure:** for NVIDIA, take `cuda13` if your driver is version 580 or newer, otherwise `cuda12`. `cuda12` is
|
||||
for older cards and older drivers. The `hip` and `amd` files are for AMD cards. RX 6000 cards have no installer of
|
||||
their own: install `hip-rdna3` (Windows) or `amd-rx7900` (Linux), and on a PC with an RX 6000 card it fetches the RX 6000 engine by itself
|
||||
(also `strata update`). That engine is built but not yet tested on a real RX 6000 card: see [AMD cards](docs/AMD_HIP.md).
|
||||
<sub>Files: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
Then:
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="Strata desktop app with a chat and live code preview side by side">
|
||||
<br><sub>Chat, files and a live preview in one window.</sub>
|
||||
</p>
|
||||
|
||||
- **Windows:** run the `.exe`. It installs for your user and needs no administrator rights. If Windows says "Windows
|
||||
protected your PC", choose **More info**, then **Run anyway** (the installer is not code-signed yet).
|
||||
- **Linux:** make the file runnable (`chmod +x`) and start it. It needs FUSE 2: `sudo apt install libfuse2` (Ubuntu 22.04)
|
||||
or `libfuse2t64` (Ubuntu 24.04 and newer).
|
||||
- **Mac:** open the `.dmg` and drag Strata onto Applications.
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
On the first screen the app reads your PC and recommends a model that fits. Press install. The model is a big download
|
||||
(about 40-70 GB) and continues where it stopped if it is interrupted. Closing the window stops Strata and the engine.
|
||||
### Terminal app
|
||||
|
||||
### Option B: the Terminal (one line)
|
||||
Prefer the terminal? Install Strata, then run **`strata launch`**.
|
||||
|
||||
The Terminal is the `strata` command, for scripts, servers and AI agents.
|
||||
<details open>
|
||||
<summary><b>Install commands</b></summary>
|
||||
|
||||
Linux and Mac:
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
Windows (PowerShell):
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
The script checks your PC, downloads the Terminal, verifies its SHA-256 and unpacks it into your home folder. It needs no
|
||||
administrator rights. On Windows, open a new terminal window afterwards. Then start Strata:
|
||||
On Windows, open a new terminal afterwards. Then:
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
It asks one question at a time: model, context, pictures, who may connect. Then it downloads the engine for your graphics
|
||||
card (signed, and test-started before use) and the model, and starts serving. For scripts and AI agents, use flags:
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
To read the install script before it runs, download it first with `curl -fsSL <address> -o install.sh`, read it, then run
|
||||
`sh install.sh`. All screens and flags: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
### Option C: let your AI set it up
|
||||
|
||||
Paste this into Claude Code, Cursor, Codex, GitHub Copilot or another coding assistant:
|
||||
|
||||
```text
|
||||
Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.
|
||||
```
|
||||
|
||||
It checks your graphics card, RAM and disk, picks the model that fits, installs and starts it, and tells you how to
|
||||
connect your apps. AI tools can also install, start and stop Strata through its [MCP server](docs/MCP_SERVER.md).
|
||||
|
||||
Prefer to build it yourself? See [Build from source](#build-from-source).
|
||||
|
||||
## Models
|
||||
|
||||
The app and `strata launch` recommend a model for your memory. It is one model in several sizes, compressed more or less.
|
||||
Smaller sizes are faster. Larger sizes are a bit smarter.
|
||||
|
||||
### Low on memory? Try Gyro
|
||||
|
||||
[Gyro](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF) (by agentionai) is the smallest way to run this model.
|
||||
|
||||
| Size | Memory it needs (RAM + VRAM) | Download | What it is |
|
||||
| --- | ---: | ---: | --- |
|
||||
| **Gyro-S** | 27.6 GB | 58.5 GB | For PCs that fit nothing else. Quality is lower than IQ2_XS. |
|
||||
| **Gyro-M** | 35 GB | 92.0 GB | About IQ3_XXS quality with about 20% less GPU memory. It writes answers 16% (12 GB RTX 3060) to 21% (R9700) slower than Q2_0. |
|
||||
|
||||
Gyro runs on NVIDIA and AMD cards (AMD is experimental) on Intel Arc cards on Linux (tested on an Arc A750) and, from 0.2.2, on Apple Silicon Macs (Gyro-S on a 32 GB Mac mini: 9 tok/s, streaming from the SSD; [docs/MAC.md](docs/MAC.md#gyro-s-and-gyro-m-agentionais-trellis-experts)). Details and measurements:
|
||||
[docs/GYRO.md](docs/GYRO.md). Start it with `strata launch --model gyro-s`.
|
||||
|
||||
### The other sizes
|
||||
|
||||
The tiers count your RAM plus your VRAM, less 5 GB that Windows and the system keep for themselves. Every other size stays a choice.
|
||||
|
||||
| Your memory (RAM + VRAM) | Take | Notes |
|
||||
| --- | --- | --- |
|
||||
| **32 GB** | **Gyro-S**, or the **[Coder](docs/MODELS.md#coder)** for code | The Coder needs 32 GB of RAM and keeps half of the experts, so it is weaker outside code |
|
||||
| **40 GB** | **[Swift 1.5](docs/MODELS.md#swift-15)** IQ2_XS (39.2 GB), or **Gyro-M** (35 GB) | Swift thinks for a shorter time before it answers. Gyro-M is close to IQ3_XXS in quality, but it writes answers 16-21% slower than Q2_0 |
|
||||
| **48 GB** | **IQ3_XXS** (47.0 GB) | Slower, better |
|
||||
| **64 GB** | **IQ3_S** (54.8 GB), the original or Swift 1.5 | The slowest, the best: it matches the full model on the published tests |
|
||||
| **96 GB or more** | Unsloth's **UD-IQ4_XS** (about 72 GB of RAM) to **Q8_0** (about 136 GB), 4 to 8 bit | Closer to the full model. With less RAM, Strata reads part of them from the SSD, which is much slower |
|
||||
|
||||
Less RAM than a row says can still work: Strata switches to its
|
||||
[low-RAM mode](docs/MODELS.md#a-big-graphics-card-and-little-ram) by itself. Expect it to be slower, and much slower
|
||||
with a small graphics card.
|
||||
|
||||
More choices:
|
||||
|
||||
- **[Swift 1.5](docs/MODELS.md#swift-15)** is a fine-tune that thinks for a shorter time before it answers, at about the same quality and RAM.
|
||||
- **[NVFP4](docs/NVFP4.md)** is NVIDIA's 4-bit version for NVIDIA cards. It needs about 80 GB of RAM to keep every expert in RAM.
|
||||
- **[Qwen3.6-35B-A3B](docs/QWEN36.md)** is a smaller, different model that reads pictures and can answer several requests at once.
|
||||
- **[OrcaRouter's Uncensored IQ3_XXS](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** is set up by hand.
|
||||
|
||||
Every size, download and what fits where: [docs/MODELS.md](docs/MODELS.md).
|
||||
|
||||
### DeepSeek V4.1-Flash (in the Terminal, from 0.2.4)
|
||||
|
||||
[DeepSeek V4.1-Flash](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF) is a different, much bigger model. ISTA-DASLab made the three sets below. Strata runs them on a PC with one 12 GB graphics card and 46 to 64 GB of RAM, and reads the rest from your SSD. It runs on NVIDIA RTX 30 to 50 cards and on the Radeon AI PRO R9700. It uses its own engine package, `strata-dsv41`, which `strata launch` downloads when you pick DeepSeek. The desktop app does not offer it yet.
|
||||
|
||||
| Set | Download | Quality against the original model | Writes at |
|
||||
| --- | ---: | --- | --- |
|
||||
| **IQ1_M** (1.75 bits) | 239 GB | KL 0.217, perplexity 3.80 (+21%); code +8.9%, agent work +10.2%; weaker on plain English prose. ISTA-DASLab's model card: keeps 98.7% of the base model's task average (AIME25, GPQA-Diamond, LiveCodeBench v6). | not measured yet |
|
||||
| **IQ2_XXS** (2.00 bits) | 257 GB | KL 0.170, perplexity 3.63 (+15.5%); code +8.6%, agent work +5.3% | about 8 to 10 tokens/s on an RTX 3060 (code 9.9, agent work 7.8), about 5 on an RTX 5070 |
|
||||
| **IQ2_XS** (2.25 bits) | 274 GB | KL 0.107, perplexity 3.37 (+7.3%); code +3.2%, agent work +2.2% | about 11 tokens/s on one Radeon AI PRO R9700 |
|
||||
| **IQ4_NL** (Engram table, not a third model) | 111 GB, already in all three downloads above | The 4-bit Engram lookup table the model reads from RAM or SSD. All three sets use this one file (`DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf`). | n/a |
|
||||
|
||||
4x Radeon AI PRO R9700: about 31 tokens/s, 55 to 69 with DSpark.
|
||||
|
||||
Start it with `strata launch --model ist-das-2.00bpw` (or `ist-das-1.75bpw`, `ist-das-2.25bpw`). Details, speeds per card and the manual install: [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md).
|
||||
|
||||
## How fast is it?
|
||||
|
||||
Based on a 12 GB graphics card (RTX 5070, Ryzen 5 7600, 64 GB RAM). See results from other cards:
|
||||
[speed of each model](docs/MODELS.md#how-fast-is-each-size), [community results](docs/COMMUNITY_BENCHMARKS.md).
|
||||
|
||||
| Model | Answers appear at | Reads your prompt at |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████████` 94 tokens/s | `████████████` 2,650 tokens/s |
|
||||
| **IQ2_XS** | `██████████░░` 79 tokens/s | `█████████░░░` 2,090 tokens/s |
|
||||
| **IQ3_XXS** | `████████░░░░` 62 tokens/s | `████████░░░░` 1,750 tokens/s |
|
||||
| **IQ3_S** | `███████░░░░░` 53 tokens/s | `███████░░░░░` 1,620 tokens/s |
|
||||
| **Coder** | `███████░░░░░` 55 tokens/s | `██████████░░` 2,180 tokens/s |
|
||||
|
||||
A token is about ¾ of a word, so 60 tokens per second is faster than you can read. "Reads your prompt" is how fast Strata
|
||||
takes in a long document, code or chat history.
|
||||
|
||||
Measured on a 16 GB AMD card (RX 9070 XT, Ryzen 9 3900X, 47 GB RAM):
|
||||
|
||||
| Model | Answers appear at | Reads your prompt at |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████░░░░` 60 tokens/s | `█████░░░░░░░` 1,160 tokens/s |
|
||||
| **IQ2_XS** | `███████░░░░░` 52 tokens/s | `█████░░░░░░░` 1,110 tokens/s |
|
||||
| **Coder** | `██████░░░░░░` 44 tokens/s | `██████░░░░░░` 1,420 tokens/s |
|
||||
|
||||
The bars use one scale for both tables. A card with more VRAM is faster: an RTX 3090 (24 GB) should write about 100-140
|
||||
tokens per second. The engine version behind each number is in [DETAILS.md](docs/DETAILS.md#speed-measured).
|
||||
|
||||
## Using it
|
||||
|
||||
### In the app
|
||||
|
||||
The app has a **Chat**, a **Monitor** of the model and your GPU, CPU and RAM, a **Models** page and **Settings**. The chat
|
||||
can work in a folder on your PC. In **Manual** mode it asks before it changes a file or runs a command. Type
|
||||
`/loop 10m <what to do>` to repeat a message every 10 minutes while the chat is open.
|
||||
|
||||
The chat can search the web with DuckDuckGo (or Bing), with no account. You can add a search key under **Settings, Tools**.
|
||||
Search is the one feature that sends something off your PC, the search words.
|
||||
|
||||
To run two models, turn on **Run multiple models** and give each model its own card of the same make.
|
||||
|
||||
<p align="center"><img src="docs/media/app-chat.png" width="900" alt="The Strata app: a chat where the agent built a small voxel pagoda garden, with the page open in the preview on the right"><br>
|
||||
<sub>A chat in the Strata app: the agent wrote a small voxel pagoda garden as one HTML file, and the page opens in the preview next to the conversation</sub></p>
|
||||
|
||||
### In the Terminal
|
||||
|
||||
<p align="center"><img src="docs/media/terminal-monitor.png" width="900" alt="The Strata Terminal monitor overview while the model writes a reply"><br>
|
||||
<sub><code>strata monitor</code> while the model writes a reply: speed, GPU, memory and the recent requests</sub></p>
|
||||
|
||||
```sh
|
||||
strata launch # guided screens: model, context, pictures, access, then serve
|
||||
strata launch --model q2_0 --yes --no-tui # no questions: serve, print the address, return
|
||||
strata launch --plan --model q2_0 # show what would happen; nothing changes
|
||||
strata launch --status # what is being served now
|
||||
strata launch --stop # stop it
|
||||
strata monitor --url http://127.0.0.1:8080 # watch speed, GPU, memory and requests
|
||||
strata update --check # is there a new engine? (strata update installs it)
|
||||
strata doctor # check the installed engine files
|
||||
```
|
||||
|
||||
`strata --help` lists everything. Starting and serving never download anything. Only the install, `strata launch` (when
|
||||
you choose a model) and `strata update` do. To reach Strata from your phone or another PC, use
|
||||
`strata launch --access lan`. It makes an API key (recommended; add `--no-api-key` to go without, with a warning). No browser opens unless
|
||||
you add `--open`. Guide: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md). Whole client: [docs/TERMINAL.md](docs/TERMINAL.md).
|
||||
|
||||
### With AI agents
|
||||
|
||||
An agent installs Strata with the one-line command in Option B and runs
|
||||
`strata launch --model NAME --yes --no-tui`. The steps, flags and exit codes are in [docs/AI_SETUP.md](docs/AI_SETUP.md),
|
||||
and the repository rules are in [AGENTS.md](AGENTS.md).
|
||||
|
||||
### Connect your other apps
|
||||
|
||||
| App type | Base URL |
|
||||
| --- | --- |
|
||||
| OpenAI-compatible (most apps and agents) | `http://127.0.0.1:8080/v1` (any API key, any model name) |
|
||||
| Anthropic API (Claude Code and others) | `http://127.0.0.1:8080`, without `/v1`. These apps add `/v1/messages` themselves. Claude Code: `ANTHROPIC_BASE_URL=http://127.0.0.1:8080` |
|
||||
| OpenAI Responses API (Codex CLI) | `http://127.0.0.1:8080/v1/responses` ([setup](docs/DETAILS.md#the-responses-api-and-codex-cli)) |
|
||||
|
||||
`strata connect` prints the exact settings for OpenCode, Codex CLI, Claude Code, oh-my-pi, pi, Hermes Agent and OpenClaw.
|
||||
`strata connect opencode --write` writes the file after asking and keeps a backup.
|
||||
|
||||
### Pictures
|
||||
|
||||
Pictures are on by default for models that can read them. Attach or paste a picture in the chat, or send it from your app.
|
||||
The picture reader runs on the processor when your graphics card has less than 24 GB (a few seconds per picture, nothing
|
||||
taken from the card's memory) and on the graphics card from 24 GB. The rule is the same for NVIDIA and AMD. Turn pictures
|
||||
off per model, or choose the reader with `--vision off`, `--vision gpu` or `--vision cpu`.
|
||||
|
||||
The numbers behind the rule: on a Radeon AI PRO R9700 the card's reader took 57 ms for a 260-token picture and the
|
||||
processor's took 3.1 s. On 16 GB cards (Tesla P100 and RTX A4000, Linux) the card's reader cost 3-5% of text speed,
|
||||
because it holds about 1.4 GB that the model would use otherwise. On a Mac the reader runs on the Mac's GPU whatever its memory (0.45 s for a 260-token picture on an M4 with 32 GB, about 1.2 GB of the shared
|
||||
memory); the processor reader needs about 50 s per picture there, so it runs only when you ask for it with `--vision cpu`.
|
||||
|
||||
### Good to know
|
||||
|
||||
- Choose the thinking level (**off, low, medium or high**) in the chat menu or in your app's "reasoning effort". Off is fastest.
|
||||
- Strata answers one request at a time by default. For several at once, use `--parallel N` in `strata launch` or
|
||||
`"parallel": 2` in the config ([BATCHING.md](docs/BATCHING.md)). On a 12 GB card this makes each answer slower.
|
||||
- Strata reads the first message of a chat in full, about 1 minute per 30,000 tokens. Follow-up messages start in seconds.
|
||||
- Where your chats are stored and the whole API: [docs/INSTALL.md](docs/INSTALL.md#where-things-are-stored), [docs/DETAILS.md](docs/DETAILS.md#using-it).
|
||||
|
||||
## Build from source
|
||||
|
||||
<details>
|
||||
<summary>Windows, Linux and Mac from the repository</summary>
|
||||
|
||||
[Download Strata](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) and unzip it, or `git clone` it.
|
||||
**Windows:** double-click `START-HERE.bat`. **Linux:** run `./setup.sh` in the Strata folder.
|
||||
|
||||
**Mac (Apple Silicon, macOS 15 or newer):** install Apple's Command Line Tools once with `xcode-select --install`
|
||||
(Xcode itself is not needed). Open Terminal in the Strata folder and run `./setup.sh`. It builds the Mac engine on your
|
||||
Mac (about 7 minutes), asks the same questions, downloads the model and starts it. Next time, `./setup.sh` starts it
|
||||
right away. Which size fits your Mac: [docs/MAC.md](docs/MAC.md).
|
||||
|
||||
The installer finds your card and sets up the right engine. It asks which model and size, how much context (how much text
|
||||
the model keeps in mind) and whether it should read pictures. Press Enter for the recommended answer. Then it downloads the
|
||||
model (about 70 GB) and starts it. If the download stops, run it again and it continues. Your browser opens the Strata
|
||||
page at `http://127.0.0.1:8080`.
|
||||
|
||||
> While the model starts, your PC can be slow or stop responding for 1-3 minutes (longest the first time). Strata loads
|
||||
> 35-55 GB into your RAM and locks part of it for the graphics card. Wait, and don't close the window.
|
||||
|
||||
Next time, run `START-HERE.bat` (or `./setup.sh`) again. It starts right away and downloads nothing twice. Close its
|
||||
window to stop the model. `UPDATE.bat` (`./update.sh`) updates Strata without starting it. Updating, Docker, several cards,
|
||||
where the files go and every option: [docs/INSTALL.md](docs/INSTALL.md).
|
||||
|
||||
To measure your PC, run `BENCH.bat` (`./bench.sh`). It takes 5-10 minutes and writes a report you can share
|
||||
([how](docs/COMMUNITY_BENCHMARKS.md#run-the-benchmark)).
|
||||
|
||||
**Optional: more speed on one card when the whole model fits in RAM.** Two opt-in settings by RubenTorney (#1904, #1905).
|
||||
They help when you run one graphics card and your RAM holds every expert, for example Q2_0 or IQ3_XXS on a 64 GB PC. Open
|
||||
`strata-<model>.json` in the Strata data folder ([where](docs/INSTALL.md#where-things-are-stored)) and add:
|
||||
|
||||
- `"--adapt-async", "1"` to the `"args"` list. The expert cache then updates on a helper thread instead of pausing the
|
||||
answer. Measured on an RTX 5070 (Windows, Q2_0): +4-5% decode, +7-10% on code and long documents. Answers can differ
|
||||
slightly from the default and stay the same from run to run.
|
||||
- `"STRATA_PIN_BY_NEED": "1"` in the `"env"` block (Windows). Windows can lock only about half the RAM for the graphics
|
||||
card, and this locks the experts the card needs first. Measured on the RTX 5070: +4.4% prompt reading.
|
||||
|
||||
```json
|
||||
"args": [ ..., "--adapt-async", "1" ],
|
||||
"env": { "STRATA_PIN_BY_NEED": "1" }
|
||||
```
|
||||
|
||||
Restart Strata after the change. To undo, remove the two entries.
|
||||
Follow the prompts to download and start a model. [Terminal guide](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
</details>
|
||||
|
||||
## How does it work?
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="Strata terminal app showing model activity, speed, memory and recent requests">
|
||||
<br><sub>Watch your model and hardware while it runs.</sub>
|
||||
</p>
|
||||
|
||||
Models like this one usually run on servers with hundreds of gigabytes of graphics memory. Your graphics card has
|
||||
12-24 GB. Strata makes the model fit by sharing the work across your whole PC. Picture a library.
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
- The model is a team of 24,576 small specialists ("experts"), like 24,576 reference books. Each word needs only 10 of them.
|
||||
- **Your graphics card is the desk.** It is small and fast. The roughly 4,000 books used most often lie open on it.
|
||||
- **Your RAM is the shelves in the reading room.** All 24,576 books are there. When a word needs a book that is not on the
|
||||
desk, your processor reads it from the shelf at once, while the card keeps working.
|
||||
- **Your SSD is the archive.** It holds a 29 GB lookup table. The model reads a few rows of it per word, so it does not
|
||||
need to sit in RAM.
|
||||
[Build from source](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [Full install guide](docs/INSTALL.md)
|
||||
|
||||
<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
A small helper also guesses the next few words. The big model checks all of them at once and keeps the right ones. You get
|
||||
the same answer, 1.6-1.8x sooner. Long texts are read in big pieces, up to 8,192 tokens at a time, at over 1,000 tokens
|
||||
per second.
|
||||
## Hardware
|
||||
|
||||
<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>
|
||||
| Supported hardware | Guide |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX 20 / 30 / 40 / 50 series** | [NVIDIA setup](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900, RX 9060 / 9070, AI PRO R9700** | [AMD setup](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · experimental** | [RX 6000 setup](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Intel setup](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 or newer** | [Mac setup](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Strix Halo setup](docs/STRIX_HALO.md) |
|
||||
|
||||
The longer explanation: [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md). Every part and its numbers:
|
||||
[the details](docs/DETAILS.md#how-it-works) and the [paper](docs/paper/Strata-Paper.pdf).
|
||||
<a id="using-it"></a>
|
||||
|
||||
## Something went wrong?
|
||||
## Tools
|
||||
|
||||
- **My PC froze the first time Strata started.** It loads the model into RAM. Wait, and don't close the window. Still
|
||||
frozen after 10 minutes? Restart the PC, close other programs and try again, or pick a smaller size.
|
||||
- **It stopped while downloading or installing.** Start the app or `strata launch` again, or run `START-HERE.bat` (or
|
||||
`./setup.sh`) again. It continues where it stopped.
|
||||
- **It is very slow, the disk light keeps blinking, or it says "the engine stopped unexpectedly".** Your PC does not have
|
||||
enough free RAM. Close other programs (browsers use a lot), or pick a smaller size such as Q2_0 or IQ2_XS.
|
||||
- **It says there is no engine for this PC.** In the app, open **Settings, Engine** and press **Update engine**. In the
|
||||
Terminal, run `strata update`. `strata doctor` shows which engine files are installed.
|
||||
- **It says port 8080 is already in use.** Strata is already running. Look for its window.
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw**, and more through the OpenAI- and Anthropic-compatible APIs.
|
||||
|
||||
More problems and fixes: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md). Still stuck? Open an
|
||||
[issue](https://github.com/Niko1221/Strata/issues). In the app, attach the file from **Settings, Engine, Diagnostics, View
|
||||
logs, Save logs**. In the Terminal, paste the output of `strata doctor`. From source, attach `strata-<model>.log` from the
|
||||
Strata folder. For a security problem, report it privately: [SECURITY.md](SECURITY.md).
|
||||
Run **`strata connect`** to see setup instructions for your tool. [Connection guide](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect).
|
||||
|
||||
## Credits and license
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
The model is [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next) by the Qwen team. It was compressed by
|
||||
[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF), UkisAI (Swift 1.5), agentionai (Gyro)
|
||||
and Unsloth. Strata uses parts of [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp). All credits:
|
||||
[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits). Strata is open source under the [MIT License](LICENSE). A few parts and
|
||||
every model have their own licenses ([which ones](docs/HOW_IT_WORKS.md#license)).
|
||||
## Help
|
||||
|
||||
## Contributing
|
||||
|
||||
Found a bug, or want to send a change or a benchmark? Read [CONTRIBUTING.md](CONTRIBUTING.md) first. It says what to
|
||||
include so that others can check your work.
|
||||
[All guides](docs) · [Troubleshooting](docs/TROUBLESHOOTING.md) · [Report a bug](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[Benchmarks](docs/COMMUNITY_BENCHMARKS.md) · [How it works](docs/HOW_IT_WORKS.md) · [Contribute](CONTRIBUTING.md)
|
||||
|
||||
## Support Strata
|
||||
|
||||
Strata is free and MIT-licensed. I build it and test it on whatever hardware I can get. If it runs well on your PC, a coffee helps
|
||||
me keep testing new cards and fixing what you report. No pressure. Using it and reporting what you find helps just as much.
|
||||
**Help keep local AI open to everyone.** A coffee helps fund development and testing on more hardware.
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee: support Strata" height="48"></a>
|
||||
|
||||
[MIT license](LICENSE) · [Credits and model licenses](docs/HOW_IT_WORKS.md#credits) · [Privacy](docs/SAFETY.md)
|
||||
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>For AI tools and automated readers: <a href="AGENTS.md">technical reference</a> · <a href="docs/AI_SETUP.md">setup instructions</a>.</sub>
|
||||
|
||||
**Sponsorships, hardware partnerships or collaborations:** [[email protected]](mailto:[email protected]).
|
||||
|
||||
Interested in sponsoring Strata? Contact me via [GitHub](https://github.com/Niko1221).
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<h3 align="center">Uruchom potężną sztuczną inteligencję na własnym komputerze.</h3>
|
||||
<p align="center">Rozmawiaj, programuj i pracuj z obrazami — lokalnie.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#modele">Modele</a> · <a href="#instalacja"><b>Instalacja</b></a> ·
|
||||
<a href="#sprzęt">Sprzęt</a> · <a href="#narzędzia">Narzędzia</a> ·
|
||||
<a href="#pomoc">Pomoc</a> · <a href="#wesprzyj-stratę">Wsparcie</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="Pobierz Stratę"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="Licencja MIT"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="Wesprzyj Stratę na Buy Me a Coffee"></a>
|
||||
</p>
|
||||
|
||||
<p align="center"><sub><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a> · <b>Polski</b></sub></p>
|
||||
|
||||
**Bezpłatna, z otwartym kodem źródłowym i do uruchomienia u siebie.** Używaj Straty na swoim komputerze albo razem z ulubionymi narzędziami do programowania. Konto nie jest potrzebne.
|
||||
|
||||
## Modele
|
||||
|
||||
Najpierw polecamy **ISTA-DASLab**, potem **Unsloth** i innych dostawców — o ile zgodny model mieści się w pamięci.
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
| Dostawca | Do wyboru |
|
||||
| --- | --- |
|
||||
| **ISTA-DASLab · polecany** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S. [Coder: IQ1\_M](docs/MODELS.md#coder) do programowania. |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF). Zużywa mniej pamięci, ale działa wolniej. |
|
||||
| **Inne opcje** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
[Porównaj rozmiary, wymagania pamięciowe i zgodność](docs/MODELS.md).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0. To obecnie udokumentowane pakiety dla tego modelu.
|
||||
|
||||
[Przewodnik po modelu i zgodność](docs/QWEN36.md).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
W **aplikacji na komputer** i w **Terminalu**. To, co nie mieści się w pamięci, jest czytane z dysku SSD, więc potrzebujesz
|
||||
dużo wolnego miejsca na dysku.
|
||||
|
||||
| Zestaw (IST-DAS) | Do pobrania | Potrzebne wolne miejsce |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | około 245 GB |
|
||||
| 2.00 bpw | 257 GB | około 265 GB |
|
||||
| 2.25 bpw | 274 GB | około 280 GB |
|
||||
|
||||
Działa na kartach NVIDIA RTX serii 30, 40 i 50 (Windows i Linux), AMD Radeon AI PRO R9700 (Linux) oraz AMD Ryzen AI Max — Strix Halo
|
||||
(Windows). Instalacja pobiera pliki i silnik DeepSeek, a potem uruchamia model.
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
Zmierzone na zestawie 2.00 bpw w Strata 0.2.5 (Strix Halo: 0.2.7). „Wyjście” to szybkość odpowiedzi, „prompt” — jak szybko Strata czyta twój tekst.
|
||||
|
||||
| Sprzęt | Wyjście | Prompt |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB RAM | 4–6 tokenów/s | około 110 tokenów/s (4K) |
|
||||
| RTX 3060 12 GB, 46 GB RAM | 9–11 tokenów/s | około 155 tokenów/s (4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB RAM | 21–25 tokenów/s | 320–360 tokenów/s (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74–77 tokenów/s | 400–450 tokenów/s (8K) |
|
||||
| Ryzen AI Max+ 395 (Strix Halo), 128 GB pamięci współdzielonej | 19–21 tokenów/s (kod), 11 (czat) | 87 tokenów/s (4K), 125 tokenów/s (8K) |
|
||||
|
||||
[Pamięć, dysk i szczegóły](docs/DEEPSEEK41.md) · [Informacje o wydaniach](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
Nie wiesz, co się zmieści? [Wybierz model do swojego komputera](docs/MODELS.md#pick-by-memory).
|
||||
|
||||
## Instalacja
|
||||
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### Aplikacja na komputer
|
||||
|
||||
**[Pobierz Stratę dla Windows, Linuxa lub Maca →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
Zainstaluj aplikację, wybierz model i zacznij rozmawiać. Dla każdego systemu jest jeden instalator. Przy pierwszym
|
||||
uruchomieniu aplikacja pobiera silnik dla twojej karty graficznej. [Pomoc z instalatorem](docs/INSTALL.md#the-app).
|
||||
|
||||
<sub>Pliki: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="Aplikacja Strata na komputer: czat i podgląd kodu na żywo obok siebie">
|
||||
<br><sub>Czat, pliki i podgląd na żywo w jednym oknie.</sub>
|
||||
</p>
|
||||
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
### Aplikacja Terminal
|
||||
|
||||
Wolisz terminal? Zainstaluj Stratę, a potem uruchom **`strata launch`**.
|
||||
|
||||
<details open>
|
||||
<summary><b>Polecenia instalacji</b></summary>
|
||||
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
W Windows otwórz potem nowe okno terminala. Następnie:
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
Postępuj zgodnie z podpowiedziami, aby pobrać i uruchomić model. [Przewodnik po Terminalu](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
</details>
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="Aplikacja Terminal Straty pokazująca aktywność modelu, szybkość, pamięć i ostatnie zapytania">
|
||||
<br><sub>Obserwuj model i sprzęt w trakcie pracy.</sub>
|
||||
</p>
|
||||
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
[Budowanie ze źródeł](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [Pełny przewodnik instalacji](docs/INSTALL.md)
|
||||
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
## Sprzęt
|
||||
|
||||
| Obsługiwany sprzęt | Przewodnik |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX serii 20 / 30 / 40 / 50** | [Konfiguracja NVIDIA](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900, RX 9060 / 9070, AI PRO R9700** | [Konfiguracja AMD](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · eksperymentalnie** | [Konfiguracja RX 6000](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Konfiguracja Intel](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 lub nowszy** | [Konfiguracja Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Konfiguracja Strix Halo](docs/STRIX_HALO.md) |
|
||||
|
||||
<a id="using-it"></a>
|
||||
|
||||
## Narzędzia
|
||||
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw** i inne — przez API zgodne z OpenAI i Anthropic.
|
||||
|
||||
Uruchom **`strata connect`**, aby zobaczyć instrukcję konfiguracji dla swojego narzędzia. [Przewodnik po połączeniach](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect).
|
||||
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
## Pomoc
|
||||
|
||||
[Wszystkie przewodniki](docs) · [Rozwiązywanie problemów](docs/TROUBLESHOOTING.md) · [Zgłoś błąd](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[Testy wydajności](docs/COMMUNITY_BENCHMARKS.md) · [Jak to działa](docs/HOW_IT_WORKS.md) · [Współtworzenie](CONTRIBUTING.md)
|
||||
|
||||
## Wesprzyj Stratę
|
||||
|
||||
**Pomóż zachować lokalną sztuczną inteligencję otwartą dla wszystkich.** Kawa pomaga finansować rozwój i testy na większej liczbie sprzętu.
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee: wesprzyj Stratę" height="48"></a>
|
||||
|
||||
[Licencja MIT](LICENSE) · [Podziękowania i licencje modeli](docs/HOW_IT_WORKS.md#credits) · [Prywatność](docs/SAFETY.md)
|
||||
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>Dla narzędzi AI i automatycznych czytników: <a href="AGENTS.md">dokumentacja techniczna</a> · <a href="docs/AI_SETUP.md">instrukcja instalacji</a>.</sub>
|
||||
|
||||
**Sponsoring, partnerstwa sprzętowe i współpraca:** [[email protected]](mailto:[email protected]).
|
||||
+120
-341
@@ -1,409 +1,188 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="380">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <b>Português</b></p>
|
||||
|
||||
<h3 align="center">Rode um modelo de ponta no seu próprio PC gamer</h3>
|
||||
|
||||
<p align="center">Suporte a NVIDIA, AMD, Intel · Windows, Linux, Mac · gratuito e de código aberto</p>
|
||||
<h3 align="center">IA poderosa no seu próprio computador.</h3>
|
||||
<p align="center">Converse, programe e trabalhe com imagens, localmente.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?include_prereleases&label=release" alt="Latest release"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://github.com/Niko1221/Strata/stargazers"><img src="https://img.shields.io/github/stars/Niko1221/Strata?style=flat" alt="GitHub stars"></a>
|
||||
<a href="#modelos">Modelos</a> · <a href="#instalação"><b>Instalação</b></a> ·
|
||||
<a href="#hardware">Hardware</a> · <a href="#ferramentas">Ferramentas</a> ·
|
||||
<a href="#ajuda">Ajuda</a> · <a href="#apoie-o-strata">Apoiar</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br>
|
||||
<sub>Um jardim de pagodes em voxels, gerado com um único prompt, rodando numa RTX 5070 com o Strata (IQ3_S, contexto de 128K) ·
|
||||
<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">vídeo completo (49 s)</a></sub></p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="Baixar o Strata"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="Licença MIT"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="Apoie o Strata no Buy Me a Coffee"></a>
|
||||
</p>
|
||||
|
||||
O Strata roda o **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)**, um modelo de 125 bilhões de parâmetros que
|
||||
normalmente precisa de um servidor, num PC comum. Ele conversa, escreve código, lê imagens e funciona com os seus aplicativos e
|
||||
agentes de programação. Suas conversas e arquivos ficam no seu PC.
|
||||
<p align="center"><sub><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <b>Português</b> · <a href="README.pl.md">Polski</a></sub></p>
|
||||
|
||||
**Primeira vez aqui?** Veja [o que você precisa](#o-que-você-precisa) e depois [instale o app](#opção-a-o-app-strata).
|
||||
**Gratuito, de código aberto e seu para executar.** Use o Strata no desktop ou com suas ferramentas de programação favoritas. Não precisa de conta.
|
||||
|
||||
- **Roda num PC gamer.** 32 GB somando memória RAM e memória da placa de vídeo já bastam para começar.
|
||||
- **Funciona com as suas ferramentas.** Ele fala as APIs da OpenAI e da Anthropic, então Claude Code, Codex CLI, OpenCode e outros agentes se conectam a ele.
|
||||
- **Lê imagens.** Já vêm ativadas.
|
||||
- **Gratuito.** Licença MIT, sem conta, sem nuvem.
|
||||
- **Privado.** Sem telemetria. O que o Strata baixa, quando usa a internet e como confere os downloads está em [docs/SAFETY.md](docs/SAFETY.md).
|
||||
## Modelos
|
||||
|
||||
Versão 0.2.3 · mecanismo 0.1.48
|
||||
Recomendamos **primeiro a ISTA-DASLab**, depois a **Unsloth** e outros provedores, quando um modelo compatível cabe na memória.
|
||||
|
||||
## O que você precisa
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
**Você precisa de pelo menos 32 GB somando a memória RAM e a memória da placa de vídeo (VRAM).** Num Mac ou num Ryzen AI Max, isso é a
|
||||
memória unificada. Mais memória permite um modelo maior ou mais rápido.
|
||||
|
||||
- Um PC de 32 GB com uma placa de 12 a 16 GB roda o Coder.
|
||||
- 64 GB de RAM rodam todos os tamanhos.
|
||||
|
||||
| Seu computador | Detalhes |
|
||||
| Provedor | Opções |
|
||||
| --- | --- |
|
||||
| **NVIDIA** GeForce RTX série 20, 30, 40, 50 (12 GB ou mais) | Instale o app ou o Terminal. |
|
||||
| **AMD** Radeon RX 6800 e mais novas, Radeon AI PRO R9700 (12 GB ou mais) | [Placas AMD](docs/AMD_HIP.md) |
|
||||
| **Intel** Arc | [Intel Arc](docs/INTEL_ARC.md), [mecanismo Intel](docs/INTEL.md) |
|
||||
| **Mac com Apple Silicon** (M1 ou mais novo, macOS 15 ou mais novo) | [Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max (Strix Halo)** e outros sistemas de memória unificada | [Strix Halo](docs/STRIX_HALO.md) |
|
||||
| Placas e processadores mais antigos | [GPUs antigas](docs/OLDER_GPUS.md), [CPUs antigas](docs/INSTALL.md#older-cpus-experimental) |
|
||||
| **ISTA-DASLab · recomendado** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S. [Coder: IQ1\_M](docs/MODELS.md#coder) para programar. |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF). Usa menos memória, mas é mais lento. |
|
||||
| **Outras opções** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
Você também precisa de:
|
||||
[Compare tamanhos, necessidades de memória e compatibilidade](docs/MODELS.md).
|
||||
|
||||
- cerca de 80 GB de espaço livre no disco (um SSD deixa a primeira inicialização bem mais rápida)
|
||||
- Windows 10 / 11, Linux ou macOS
|
||||
- um driver de vídeo atualizado
|
||||
</details>
|
||||
|
||||
Duas ou três placas da mesma marca podem dividir um modelo ([multi-GPU](docs/MULTI_GPU.md)). O Strata nunca divide um modelo entre
|
||||
placas NVIDIA e AMD. Lista completa: [docs/INSTALL.md](docs/INSTALL.md#what-you-need).
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0. Esses são os pacotes documentados atualmente para este modelo.
|
||||
|
||||
[Guia do modelo e compatibilidade](docs/QWEN36.md).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
No **aplicativo de desktop** e no **Terminal**. O que não cabe na memória é lido do seu SSD, por isso é preciso muito espaço livre em disco.
|
||||
|
||||
| Conjunto (IST-DAS) | Download | Espaço livre necessário |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | cerca de 245 GB |
|
||||
| 2.00 bpw | 257 GB | cerca de 265 GB |
|
||||
| 2.25 bpw | 274 GB | cerca de 280 GB |
|
||||
|
||||
Roda em NVIDIA RTX 30, 40 e 50 (Windows e Linux) e em AMD Radeon AI PRO R9700 (Linux). A instalação baixa os arquivos e o motor do DeepSeek e depois inicia o modelo.
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
Medido com o conjunto de 2.00 bpw no Strata 0.2.5. “Saída” é a velocidade da resposta; “Prompt” é a rapidez com que o Strata lê o seu texto.
|
||||
|
||||
| Hardware | Saída | Prompt |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB de RAM | 4 a 6 tokens/s | cerca de 110 tokens/s (4K) |
|
||||
| RTX 3060 12 GB, 46 GB de RAM | 9 a 11 tokens/s | cerca de 155 tokens/s (4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB de RAM | 21 a 25 tokens/s | 320 a 360 tokens/s (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74 a 77 tokens/s | 400 a 450 tokens/s (8K) |
|
||||
|
||||
[Memória, disco e detalhes](docs/DEEPSEEK41.md) · [Notas da versão](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
Não sabe o que cabe? [Escolha um modelo para o seu computador](docs/MODELS.md#pick-by-memory).
|
||||
|
||||
## Instalação
|
||||
|
||||
Escolha uma opção. Todas iniciam o mesmo mecanismo e usam os mesmos modelos.
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### Opção A: o app Strata
|
||||
### Aplicativo de desktop
|
||||
|
||||
O jeito mais fácil. O app já traz o mecanismo: instale, escolha um modelo e converse. Baixe o arquivo para o seu sistema e a sua
|
||||
placa de vídeo na [página de releases](https://github.com/Niko1221/Strata/releases/latest). Não sabe qual? Veja a explicação
|
||||
logo abaixo da tabela.
|
||||
**[Baixar o Strata para Windows, Linux ou Mac →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
| Sistema | Sua placa de vídeo | Arquivo para baixar |
|
||||
| --- | --- | --- |
|
||||
| **Windows 10 / 11** | NVIDIA RTX, driver 580 ou mais novo | [`Strata-0.2.3-windows-cuda13.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda13.exe) |
|
||||
| | NVIDIA, placa mais antiga ou driver anterior ao 580 | [`Strata-0.2.3-windows-cuda12.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda12.exe) |
|
||||
| | AMD Radeon série RX 9000 ou Radeon AI PRO R9700 | [`Strata-0.2.3-windows-hip.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip.exe) |
|
||||
| | AMD Radeon série RX 7000 ou Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-windows-hip-rdna3.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip-rdna3.exe) |
|
||||
| **Linux** | NVIDIA RTX, driver 580 ou mais novo | [`Strata-0.2.3-linux-nvidia-cuda13.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda13.AppImage) |
|
||||
| | NVIDIA, placa mais antiga ou driver anterior ao 580 | [`Strata-0.2.3-linux-nvidia-cuda12.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda12.AppImage) |
|
||||
| | AMD Radeon série RX 9000 ou Radeon AI PRO R9700 | [`Strata-0.2.3-linux-amd-rx9070.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx9070.AppImage) |
|
||||
| | AMD Radeon série RX 7000 | [`Strata-0.2.3-linux-amd-rx7900.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx7900.AppImage) |
|
||||
| | AMD Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-linux-amd-strixhalo.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-strixhalo.AppImage) |
|
||||
| **Mac** (Apple Silicon, macOS 15 ou mais novo) | integrada | [`Strata-0.2.3-mac.dmg`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-mac.dmg) |
|
||||
Instale o aplicativo, escolha um modelo e comece a conversar. Há um instalador por sistema. Na primeira vez que abre, o aplicativo baixa o motor da sua placa de vídeo. [Ajuda com o instalador](docs/INSTALL.md#the-app).
|
||||
|
||||
**Se você estiver em dúvida:** para NVIDIA, use `cuda13` se o seu driver for a versão 580 ou mais nova, e `cuda12` nos outros casos. O `cuda12`
|
||||
serve para placas e drivers mais antigos. Os arquivos `hip` e `amd` são para placas AMD. Outras placas AMD (RX 6000) ainda não têm app pronto: veja [Placas AMD](docs/AMD_HIP.md).
|
||||
<sub>Arquivos: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
Depois:
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="Aplicativo de desktop do Strata com um chat e uma prévia do código ao vivo lado a lado">
|
||||
<br><sub>Chat, arquivos e prévia ao vivo em uma só janela.</sub>
|
||||
</p>
|
||||
|
||||
- **Windows:** execute o `.exe`. Ele instala só para o seu usuário e não pede direitos de administrador. Se o Windows disser "O Windows
|
||||
protegeu o computador", escolha **Mais informações** e depois **Executar assim mesmo** (o instalador ainda não tem assinatura de código).
|
||||
- **Linux:** torne o arquivo executável (`chmod +x`) e inicie. É preciso ter o FUSE 2: `sudo apt install libfuse2` (Ubuntu 22.04)
|
||||
ou `libfuse2t64` (Ubuntu 24.04 e mais novos).
|
||||
- **Mac:** abra o `.dmg` e arraste o Strata para Aplicativos.
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
Na primeira tela, o app lê o seu PC e recomenda um modelo que caiba nele. Clique em instalar. O modelo é um download grande
|
||||
(cerca de 40 a 70 GB) e continua de onde parou se for interrompido. Fechar a janela encerra o Strata e o mecanismo.
|
||||
### Aplicativo de Terminal
|
||||
|
||||
### Opção B: o Terminal (uma linha)
|
||||
Prefere o terminal? Instale o Strata e execute **`strata launch`**.
|
||||
|
||||
O Terminal é o comando `strata`, para scripts, servidores e agentes de IA.
|
||||
<details open>
|
||||
<summary><b>Comandos de instalação</b></summary>
|
||||
|
||||
Linux e Mac:
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
Windows (PowerShell):
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
O script confere o seu PC, baixa o Terminal, verifica o SHA-256 e descompacta na sua pasta pessoal. Não precisa de direitos de
|
||||
administrador. No Windows, abra uma nova janela do terminal depois. Então inicie o Strata:
|
||||
No Windows, abra um novo terminal depois. Em seguida:
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
Ele faz uma pergunta por vez: modelo, contexto, imagens, quem pode se conectar. Depois baixa o mecanismo para a sua placa de vídeo
|
||||
(assinada e testada antes do uso) e o modelo, e começa a servir. Em scripts e agentes de IA, use flags:
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
Para ler o script de instalação antes de executá-lo, baixe-o primeiro com `curl -fsSL <address> -o install.sh`, leia e então rode
|
||||
`sh install.sh`. Todas as telas e flags: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
### Opção C: deixe a sua IA configurar
|
||||
|
||||
Cole isto no Claude Code, Cursor, Codex, GitHub Copilot ou outro assistente de programação:
|
||||
|
||||
```text
|
||||
Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.
|
||||
```
|
||||
|
||||
Ele confere a sua placa de vídeo, a RAM e o disco, escolhe o modelo que cabe, instala e inicia, e diz como conectar os seus
|
||||
aplicativos. Ferramentas de IA também podem instalar, iniciar e parar o Strata pelo [servidor MCP](docs/MCP_SERVER.md) dele.
|
||||
|
||||
Prefere compilar por conta própria? Veja [Compilar a partir do código-fonte](#compilar-a-partir-do-código-fonte).
|
||||
|
||||
## Modelos
|
||||
|
||||
O app e o `strata launch` recomendam um modelo para a sua memória. É um único modelo em vários tamanhos, mais ou menos comprimidos.
|
||||
Os tamanhos menores são mais rápidos. Os maiores são um pouco mais inteligentes.
|
||||
|
||||
### Pouca memória? Experimente o Gyro
|
||||
|
||||
O [Gyro](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF) (da agentionai) é a menor forma de rodar este modelo.
|
||||
|
||||
| Tamanho | Memória necessária (RAM + VRAM) | Download | O que é |
|
||||
| --- | ---: | ---: | --- |
|
||||
| **Gyro-S** | 27,6 GB | 58,5 GB | Para PCs onde nenhum outro tamanho cabe. A qualidade é menor que a do IQ2_XS. |
|
||||
| **Gyro-M** | 35 GB | 92,0 GB | Qualidade próxima à do IQ3_XXS, com cerca de 20% menos memória da GPU. Ele escreve as respostas 16% mais devagar que o Q2_0 numa RTX 3060 de 12 GB e 21% mais devagar numa R9700. |
|
||||
|
||||
O Gyro roda em placas NVIDIA e AMD (AMD é experimental) em placas Intel Arc no Linux (testado numa Arc A750) e, desde a 0.2.2, em Macs com Apple Silicon (Gyro-S num Mac mini de 32 GB: 9 tokens/s, com os especialistas lidos do SSD). Detalhes e medições:
|
||||
[docs/GYRO.md](docs/GYRO.md). Inicie com `strata launch --model gyro-s`.
|
||||
|
||||
### Os outros tamanhos
|
||||
|
||||
| Sua memória (RAM + VRAM) | Escolha | Observações |
|
||||
| --- | --- | --- |
|
||||
| **32 GB** | **Gyro-S**, ou o **[Coder](docs/MODELS.md#coder)** para código | O Coder precisa de 32 GB de RAM e mantém metade dos experts, então é mais fraco fora de código |
|
||||
| **40 GB** | **[Swift 1.5](docs/MODELS.md#swift-15)** IQ2_XS (39,2 GB), ou **Gyro-M** (35 GB) | O Swift pensa por menos tempo antes de responder. O Gyro-M chega perto do IQ3_XXS em qualidade, mas escreve as respostas 16 a 21% mais devagar que o Q2_0 |
|
||||
| **48 GB** | **IQ3_XXS** (47,0 GB) | Mais lento, melhor |
|
||||
| **64 GB** | **IQ3_S** (54,8 GB), o original ou o Swift 1.5 | O mais lento, o melhor: empata com o modelo completo nos testes publicados |
|
||||
| **96 GB ou mais** | **UD-IQ4_XS** da Unsloth (cerca de 72 GB de RAM) até **Q8_0** (cerca de 136 GB), de 4 a 8 bits | Mais perto do modelo completo. Com menos RAM, o Strata lê parte deles do SSD, o que é bem mais lento |
|
||||
|
||||
Com menos RAM do que a linha indica, ainda pode funcionar: o Strata muda sozinho para o
|
||||
[modo de pouca RAM](docs/MODELS.md#a-big-graphics-card-and-little-ram). Espere mais lentidão, e muito mais com uma placa de vídeo pequena.
|
||||
|
||||
Mais opções:
|
||||
|
||||
- **[Swift 1.5](docs/MODELS.md#swift-15)** é um ajuste fino que pensa por menos tempo antes de responder, com qualidade e RAM parecidas.
|
||||
- **[NVFP4](docs/NVFP4.md)** é a versão de 4 bits da NVIDIA para placas NVIDIA. Precisa de cerca de 80 GB de RAM para manter todos os experts na RAM.
|
||||
- **[Qwen3.6-35B-A3B](docs/QWEN36.md)** é outro modelo, menor, que lê imagens e pode atender vários pedidos ao mesmo tempo.
|
||||
- **[Uncensored IQ3_XXS da OrcaRouter](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** é configurado manualmente.
|
||||
|
||||
Todos os tamanhos, downloads e o que cabe em cada configuração: [docs/MODELS.md](docs/MODELS.md).
|
||||
|
||||
### DeepSeek V4.1-Flash (no Terminal, a partir da 0.2.4)
|
||||
|
||||
[DeepSeek V4.1-Flash](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF) é outro modelo, bem maior. A ISTA-DASLab fez os três conjuntos abaixo. O Strata os executa em um PC com uma placa de vídeo de 12 GB e de 46 a 64 GB de RAM, e lê o resto do seu SSD. Ele roda em placas NVIDIA RTX das séries 30 a 50 e na Radeon AI PRO R9700. Usa um pacote de motor próprio, `strata-dsv41`, que o `strata launch` baixa quando você escolhe o DeepSeek. O app de desktop ainda não o oferece.
|
||||
|
||||
| Conjunto | Download | Qualidade em relação ao modelo original | Responde a |
|
||||
| --- | ---: | --- | --- |
|
||||
| **IQ1_M** (1,75 bits) | 239 GB | KL 0,217, perplexidade 3,80 (+21%); código +8,9%, tarefas de agente +10,2%; mais fraco em prosa comum em inglês. Segundo o cartão do modelo da ISTA-DASLab, mantém 98,7% da média de tarefas do modelo base (AIME25, GPQA-Diamond, LiveCodeBench v6). | ainda não medida |
|
||||
| **IQ2_XXS** (2.00 bits) | 257 GB | KL 0,170, perplexidade 3,63 (+15,5%); código +8,6%, tarefas de agente +5,3% | cerca de 8 a 10 tokens/s em uma RTX 3060 (código 9,9, tarefas de agente 7,8), cerca de 5 em uma RTX 5070 |
|
||||
| **IQ2_XS** (2.25 bits) | 274 GB | KL 0,107, perplexidade 3,37 (+7,3%); código +3,2%, tarefas de agente +2,2% | cerca de 11 tokens/s em uma Radeon AI PRO R9700 |
|
||||
| **IQ4_NL** (tabela Engram, não é um terceiro modelo) | 111 GB, já incluídos nos três downloads acima | A tabela de consulta Engram de 4 bits que o modelo lê da RAM ou do SSD. Os três conjuntos usam este único arquivo (`DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf`). | n/a |
|
||||
|
||||
4x Radeon AI PRO R9700: cerca de 31 tokens/s, 55 a 69 com DSpark.
|
||||
|
||||
Inicie com `strata launch --model ist-das-2.00bpw` (ou `ist-das-1.75bpw`, `ist-das-2.25bpw`). Detalhes, velocidades por placa e a instalação manual: [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md).
|
||||
|
||||
## Qual é a velocidade?
|
||||
|
||||
Com base numa placa de vídeo de 12 GB (RTX 5070, Ryzen 5 7600, 64 GB de RAM). Veja resultados de outras placas:
|
||||
[velocidade de cada modelo](docs/MODELS.md#how-fast-is-each-size), [resultados da comunidade](docs/COMMUNITY_BENCHMARKS.md).
|
||||
|
||||
| Modelo | As respostas aparecem a | Lê o seu prompt a |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████████` 94 tokens/s | `████████████` 2.650 tokens/s |
|
||||
| **IQ2_XS** | `██████████░░` 79 tokens/s | `█████████░░░` 2.090 tokens/s |
|
||||
| **IQ3_XXS** | `████████░░░░` 62 tokens/s | `████████░░░░` 1.750 tokens/s |
|
||||
| **IQ3_S** | `███████░░░░░` 53 tokens/s | `███████░░░░░` 1.620 tokens/s |
|
||||
| **Coder** | `███████░░░░░` 55 tokens/s | `██████████░░` 2.180 tokens/s |
|
||||
|
||||
Um token equivale a cerca de ¾ de palavra, então 60 tokens por segundo é mais rápido do que você lê. "Lê o seu prompt" é a velocidade com que o Strata
|
||||
absorve um documento longo, um código ou um histórico de conversa.
|
||||
|
||||
Medido numa placa AMD de 16 GB (RX 9070 XT, Ryzen 9 3900X, 47 GB de RAM):
|
||||
|
||||
| Modelo | As respostas aparecem a | Lê o seu prompt a |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████░░░░` 60 tokens/s | `█████░░░░░░░` 1.160 tokens/s |
|
||||
| **IQ2_XS** | `███████░░░░░` 52 tokens/s | `█████░░░░░░░` 1.110 tokens/s |
|
||||
| **Coder** | `██████░░░░░░` 44 tokens/s | `██████░░░░░░` 1.420 tokens/s |
|
||||
|
||||
As barras usam a mesma escala nas duas tabelas. Uma placa com mais VRAM é mais rápida: uma RTX 3090 (24 GB) deve escrever cerca de 100 a 140
|
||||
tokens por segundo. A versão do mecanismo por trás de cada número está em [DETAILS.md](docs/DETAILS.md#speed-measured).
|
||||
|
||||
## Como usar
|
||||
|
||||
### No app
|
||||
|
||||
O app tem um **Chat**, um **Monitor** do modelo e da sua GPU, CPU e RAM, uma página de **Modelos** e as **Configurações**. O chat
|
||||
pode trabalhar numa pasta do seu PC. No modo **Manual**, ele pergunta antes de alterar um arquivo ou executar um comando. Digite
|
||||
`/loop 10m <o que fazer>` para repetir uma mensagem a cada 10 minutos enquanto o chat estiver aberto.
|
||||
|
||||
O chat pode pesquisar na web com o DuckDuckGo (ou o Bing), sem conta. Você pode adicionar uma chave de busca em **Configurações, Ferramentas**.
|
||||
A busca é o único recurso que envia algo para fora do seu PC: os termos da pesquisa.
|
||||
|
||||
Para rodar dois modelos, ative **Executar vários modelos** e dê a cada modelo a sua própria placa da mesma marca.
|
||||
|
||||
<p align="center"><img src="docs/media/app-chat.png" width="900" alt="The Strata app: a chat where the agent built a small voxel pagoda garden, with the page open in the preview on the right"><br>
|
||||
<sub>Um chat no app Strata: o agente escreveu um pequeno jardim de pagode em voxels em um único arquivo HTML, e a página abre na pré-visualização ao lado da conversa</sub></p>
|
||||
|
||||
### No Terminal
|
||||
|
||||
<p align="center"><img src="docs/media/terminal-monitor.png" width="900" alt="The Strata Terminal monitor overview while the model writes a reply"><br>
|
||||
<sub><code>strata monitor</code> enquanto o modelo responde: velocidade, GPU, memória e as solicitações recentes</sub></p>
|
||||
|
||||
```sh
|
||||
strata launch # telas guiadas: modelo, contexto, imagens, acesso e depois servir
|
||||
strata launch --model q2_0 --yes --no-tui # sem perguntas: serve, mostra o endereço e volta
|
||||
strata launch --plan --model q2_0 # mostra o que aconteceria; nada muda
|
||||
strata launch --status # o que está sendo servido agora
|
||||
strata launch --stop # para o serviço
|
||||
strata monitor --url http://127.0.0.1:8080 # acompanha velocidade, GPU, memória e requisições
|
||||
strata update --check # há um mecanismo novo? (strata update instala)
|
||||
strata doctor # confere os arquivos do mecanismo instalada
|
||||
```
|
||||
|
||||
`strata --help` lista tudo. Iniciar e servir nunca baixam nada. Só a instalação, o `strata launch` (quando você
|
||||
escolhe um modelo) e o `strata update` baixam. Para acessar o Strata do celular ou de outro PC, use
|
||||
`strata launch --access lan`. Ele cria uma chave de API e não inicia numa rede sem uma. Nenhum navegador abre, a menos que
|
||||
você adicione `--open`. Guia: [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md). Cliente completo: [docs/TERMINAL.md](docs/TERMINAL.md).
|
||||
|
||||
### Com agentes de IA
|
||||
|
||||
Um agente instala o Strata com o comando de uma linha da Opção B e executa
|
||||
`strata launch --model NAME --yes --no-tui`. Os passos, as flags e os códigos de saída estão em [docs/AI_SETUP.md](docs/AI_SETUP.md),
|
||||
e as regras do repositório estão em [AGENTS.md](AGENTS.md).
|
||||
|
||||
### Conecte os seus outros aplicativos
|
||||
|
||||
| Tipo de aplicativo | URL base |
|
||||
| --- | --- |
|
||||
| Compatível com OpenAI (a maioria dos apps e agentes) | `http://127.0.0.1:8080/v1` (qualquer chave de API, qualquer nome de modelo) |
|
||||
| API da Anthropic (Claude Code e outros) | `http://127.0.0.1:8080`, sem `/v1`. Esses aplicativos adicionam `/v1/messages` sozinhos. Claude Code: `ANTHROPIC_BASE_URL=http://127.0.0.1:8080` |
|
||||
| OpenAI Responses API (Codex CLI) | `http://127.0.0.1:8080/v1/responses` ([configuração](docs/DETAILS.md#the-responses-api-and-codex-cli)) |
|
||||
|
||||
`strata connect` mostra as configurações exatas para OpenCode, Codex CLI, Claude Code, oh-my-pi, pi, Hermes Agent e OpenClaw.
|
||||
`strata connect opencode --write` grava o arquivo depois de perguntar e mantém um backup.
|
||||
|
||||
### Imagens
|
||||
|
||||
As imagens vêm ativadas nos modelos que sabem lê-las. Anexe ou cole uma imagem no chat, ou envie pelo seu aplicativo.
|
||||
O leitor de imagens roda no processador quando a sua placa de vídeo tem menos de 24 GB (alguns segundos por imagem, sem tirar nada
|
||||
da memória da placa) e roda na placa de vídeo a partir de 24 GB. A regra é a mesma para NVIDIA e AMD. Desative as imagens
|
||||
por modelo, ou escolha o leitor com `--vision off`, `--vision gpu` ou `--vision cpu`.
|
||||
|
||||
Os números por trás da regra: numa Radeon AI PRO R9700, o leitor da placa levou 57 ms para uma imagem de 260 tokens e o do
|
||||
processador levou 3,1 s. Em placas de 16 GB (Tesla P100 e RTX A4000, Linux), o leitor da placa custou de 3 a 5% da velocidade do texto,
|
||||
porque ocupa cerca de 1,4 GB que o modelo usaria de outra forma. No Mac, a GPU faz a leitura, seja qual for a memória (0,45 s para uma imagem de 260 tokens em um M4 de 32 GB, cerca de 1,2 GB da memória compartilhada);
|
||||
o processador leva cerca de 50 s por imagem, então só lê com `--vision cpu`.
|
||||
|
||||
### Bom saber
|
||||
|
||||
- Escolha o nível de raciocínio (**off, low, medium ou high**) no menu do chat ou no "reasoning effort" do seu aplicativo. Off é o mais rápido.
|
||||
- Por padrão, o Strata responde a um pedido por vez. Para vários ao mesmo tempo, use `--parallel N` no `strata launch` ou
|
||||
`"parallel": 2` na configuração ([BATCHING.md](docs/BATCHING.md)). Numa placa de 12 GB, isso deixa cada resposta mais lenta.
|
||||
- O Strata lê a primeira mensagem de uma conversa por inteiro, cerca de 1 minuto a cada 30.000 tokens. As mensagens seguintes começam em segundos.
|
||||
- Onde ficam as suas conversas e a API completa: [docs/INSTALL.md](docs/INSTALL.md#where-things-are-stored), [docs/DETAILS.md](docs/DETAILS.md#using-it).
|
||||
|
||||
## Compilar a partir do código-fonte
|
||||
|
||||
<details>
|
||||
<summary>Windows, Linux e Mac a partir do repositório</summary>
|
||||
|
||||
[Baixe o Strata](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip) e descompacte, ou use `git clone`.
|
||||
**Windows:** dê dois cliques em `START-HERE.bat`. **Linux:** execute `./setup.sh` na pasta do Strata.
|
||||
|
||||
**Mac (Apple Silicon, macOS 15 ou mais novo):** instale uma vez as Command Line Tools da Apple com `xcode-select --install`
|
||||
(o Xcode em si não é necessário). Abra o Terminal na pasta do Strata e execute `./setup.sh`. Ele compila o mecanismo do Mac no seu
|
||||
Mac (cerca de 7 minutos), faz as mesmas perguntas, baixa o modelo e inicia. Da próxima vez, `./setup.sh` inicia
|
||||
na hora. Qual tamanho cabe no seu Mac: [docs/MAC.md](docs/MAC.md).
|
||||
|
||||
O instalador encontra a sua placa e configura o mecanismo certo. Ele pergunta qual modelo e tamanho, quanto contexto (quanto texto
|
||||
o modelo mantém em mente) e se deve ler imagens. Pressione Enter para aceitar a resposta recomendada. Depois ele baixa o
|
||||
modelo (cerca de 70 GB) e inicia. Se o download parar, execute de novo e ele continua. O navegador abre a página do Strata em
|
||||
`http://127.0.0.1:8080`.
|
||||
|
||||
> Enquanto o modelo inicia, o seu PC pode ficar lento ou parar de responder por 1 a 3 minutos (mais tempo na primeira vez). O Strata carrega
|
||||
> de 35 a 55 GB na sua RAM e trava parte dela para a placa de vídeo. Espere e não feche a janela.
|
||||
|
||||
Da próxima vez, execute `START-HERE.bat` (ou `./setup.sh`) de novo. Ele inicia na hora e não baixa nada duas vezes. Feche a janela
|
||||
dele para parar o modelo. `UPDATE.bat` (`./update.sh`) atualiza o Strata sem iniciá-lo. Atualização, Docker, várias placas,
|
||||
onde ficam os arquivos e todas as opções: [docs/INSTALL.md](docs/INSTALL.md).
|
||||
|
||||
Para medir o seu PC, execute `BENCH.bat` (`./bench.sh`). Leva de 5 a 10 minutos e gera um relatório que você pode compartilhar
|
||||
([como](docs/COMMUNITY_BENCHMARKS.md#run-the-benchmark)).
|
||||
|
||||
**Opcional: mais velocidade numa placa quando o modelo inteiro cabe na RAM.** Duas configurações opcionais do RubenTorney (#1904, #1905).
|
||||
Elas ajudam quando você usa uma placa de vídeo e a sua RAM comporta todos os experts, por exemplo Q2_0 ou IQ3_XXS num PC de 64 GB. Abra
|
||||
`strata-<model>.json` na pasta de dados do Strata ([onde fica](docs/INSTALL.md#where-things-are-stored)) e adicione:
|
||||
|
||||
- `"--adapt-async", "1"` à lista `"args"`. O cache de experts passa a ser atualizado numa thread auxiliar, em vez de pausar a
|
||||
resposta. Medido numa RTX 5070 (Windows, Q2_0): +4 a 5% na geração, +7 a 10% em código e documentos longos. As respostas podem diferir
|
||||
um pouco do padrão e continuam iguais de uma execução para outra.
|
||||
- `"STRATA_PIN_BY_NEED": "1"` no bloco `"env"` (Windows). O Windows só consegue travar cerca de metade da RAM para a placa
|
||||
de vídeo, e isso trava primeiro os experts de que a placa precisa. Medido na RTX 5070: +4,4% na leitura do prompt.
|
||||
|
||||
```json
|
||||
"args": [ ..., "--adapt-async", "1" ],
|
||||
"env": { "STRATA_PIN_BY_NEED": "1" }
|
||||
```
|
||||
|
||||
Reinicie o Strata depois da alteração. Para desfazer, remova as duas entradas.
|
||||
Siga as instruções para baixar e iniciar um modelo. [Guia do Terminal](docs/TERMINAL_LAUNCH.md).
|
||||
|
||||
</details>
|
||||
|
||||
## Como funciona?
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="Aplicativo de Terminal do Strata mostrando a atividade do modelo, a velocidade, a memória e as solicitações recentes">
|
||||
<br><sub>Acompanhe seu modelo e seu hardware enquanto ele roda.</sub>
|
||||
</p>
|
||||
|
||||
Modelos como este costumam rodar em servidores com centenas de gigabytes de memória de vídeo. A sua placa de vídeo tem
|
||||
12 a 24 GB. O Strata faz o modelo caber dividindo o trabalho entre o PC inteiro. Imagine uma biblioteca.
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
- O modelo é uma equipe de 24.576 pequenos especialistas ("experts"), como 24.576 livros de consulta. Cada palavra precisa de apenas 10 deles.
|
||||
- **A sua placa de vídeo é a mesa.** Ela é pequena e rápida. Os cerca de 4.000 livros mais usados ficam abertos nela.
|
||||
- **A sua RAM são as estantes da sala de leitura.** Os 24.576 livros estão lá. Quando uma palavra precisa de um livro que não está na
|
||||
mesa, o seu processador lê da estante na hora, enquanto a placa continua trabalhando.
|
||||
- **O seu SSD é o arquivo.** Ele guarda uma tabela de consulta de 29 GB. O modelo lê algumas linhas dela por palavra, então ela não
|
||||
precisa ficar na RAM.
|
||||
[Compilar a partir do código-fonte](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [Guia de instalação completo](docs/INSTALL.md)
|
||||
|
||||
<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
Um pequeno ajudante também adivinha as próximas palavras. O modelo grande confere todas de uma vez e fica com as certas. Você recebe
|
||||
a mesma resposta, de 1,6 a 1,8 vez mais rápido. Textos longos são lidos em blocos grandes, de até 8.192 tokens por vez, a mais de 1.000 tokens
|
||||
por segundo.
|
||||
## Hardware
|
||||
|
||||
<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>
|
||||
| Hardware compatível | Guia |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX 20 / 30 / 40 / 50** | [Instalação para NVIDIA](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900, RX 9060 / 9070, AI PRO R9700** | [Instalação para AMD](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · experimental** | [Instalação para RX 6000](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Instalação para Intel](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 ou mais novo** | [Instalação para Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Instalação para Strix Halo](docs/STRIX_HALO.md) |
|
||||
|
||||
A explicação mais longa: [docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md). Cada parte e seus números:
|
||||
[os detalhes](docs/DETAILS.md#how-it-works) e o [artigo](docs/paper/Strata-Paper.pdf).
|
||||
<a id="using-it"></a>
|
||||
|
||||
## Algo deu errado?
|
||||
## Ferramentas
|
||||
|
||||
- **Meu PC travou na primeira vez que o Strata iniciou.** Ele carrega o modelo na RAM. Espere e não feche a janela. Ainda
|
||||
travado depois de 10 minutos? Reinicie o PC, feche outros programas e tente de novo, ou escolha um tamanho menor.
|
||||
- **Parou durante o download ou a instalação.** Abra o app ou o `strata launch` de novo, ou execute `START-HERE.bat` (ou
|
||||
`./setup.sh`) outra vez. Ele continua de onde parou.
|
||||
- **Está muito lento, a luz do disco não para de piscar, ou aparece "o mecanismo parou inesperadamente".** O seu PC não tem
|
||||
RAM livre suficiente. Feche outros programas (os navegadores usam muita), ou escolha um tamanho menor, como Q2_0 ou IQ2_XS.
|
||||
- **Diz que não há mecanismo para este PC.** No app, abra **Configurações, Mecanismo** e clique em **Atualizar mecanismo**. No
|
||||
Terminal, execute `strata update`. O `strata doctor` mostra quais arquivos do mecanismo estão instalados.
|
||||
- **Diz que a porta 8080 já está em uso.** O Strata já está rodando. Procure a janela dele.
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw**, e outras, pelas APIs compatíveis com OpenAI e Anthropic.
|
||||
|
||||
Mais problemas e soluções: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md). Ainda sem resolver? Abra uma
|
||||
[issue](https://github.com/Niko1221/Strata/issues). No app, anexe o arquivo de **Configurações, Mecanismo, Diagnóstico, Ver
|
||||
registros, Salvar logs**. No Terminal, cole a saída de `strata doctor`. Se estiver rodando pelo código-fonte, anexe o `strata-<model>.log` da pasta do
|
||||
Strata. Para um problema de segurança, informe em particular: [SECURITY.md](SECURITY.md).
|
||||
Execute **`strata connect`** para ver as instruções da sua ferramenta. [Guia de conexão](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect).
|
||||
|
||||
## Créditos e licença
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
O modelo é o [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next), da equipe Qwen. Ele foi comprimido por
|
||||
[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF), UkisAI (Swift 1.5), agentionai (Gyro)
|
||||
e Unsloth. O Strata usa partes do [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp). Todos os créditos:
|
||||
[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits). O Strata é de código aberto sob a [Licença MIT](LICENSE). Algumas partes e
|
||||
todos os modelos têm licenças próprias ([quais](docs/HOW_IT_WORKS.md#license)).
|
||||
## Ajuda
|
||||
|
||||
## Contribuindo
|
||||
|
||||
Encontrou um bug, ou quer enviar uma alteração ou um benchmark? Leia primeiro o [CONTRIBUTING.md](CONTRIBUTING.md). Ele diz o que
|
||||
incluir para que outras pessoas possam conferir o seu trabalho.
|
||||
[Todos os guias](docs) · [Solução de problemas](docs/TROUBLESHOOTING.md) · [Relatar um bug](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[Benchmarks](docs/COMMUNITY_BENCHMARKS.md) · [Como funciona](docs/HOW_IT_WORKS.md) · [Contribuir](CONTRIBUTING.md)
|
||||
|
||||
## Apoie o Strata
|
||||
|
||||
O Strata é gratuito e tem licença MIT. Eu o desenvolvo e testo em todo hardware que consigo arranjar. Se ele roda bem no seu PC, um café me ajuda
|
||||
a continuar testando placas novas e corrigindo o que você relatar. Sem pressão. Usar e relatar o que encontrar ajuda tanto quanto.
|
||||
**Ajude a manter a IA local aberta para todos.** Um café ajuda a financiar o desenvolvimento e os testes em mais hardware.
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee: apoie o Strata" height="48"></a>
|
||||
|
||||
Quer patrocinar o Strata? Fale comigo pelo [GitHub](https://github.com/Niko1221).
|
||||
[Licença MIT](LICENSE) · [Créditos e licenças dos modelos](docs/HOW_IT_WORKS.md#credits) · [Privacidade](docs/SAFETY.md)
|
||||
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>Para ferramentas de IA e leitores automáticos: <a href="AGENTS.md">referência técnica</a> · <a href="docs/AI_SETUP.md">instruções de instalação</a>.</sub>
|
||||
|
||||
**Patrocínios, parcerias de hardware ou colaborações:** [[email protected]](mailto:[email protected]).
|
||||
+120
-328
@@ -1,396 +1,188 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="apps/host/public/brand/strata-lockup-dark.svg">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="380">
|
||||
<img src="apps/host/public/brand/strata-lockup-light.svg" alt="Strata" width="340">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="README.md">English</a> · <b>简体中文</b> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a></p>
|
||||
|
||||
<h3 align="center">在你自己的游戏电脑上运行最先进的模型</h3>
|
||||
|
||||
<p align="center">支持 NVIDIA、AMD、Intel · Windows、Linux、Mac · 免费开源</p>
|
||||
<h3 align="center">在你自己的电脑上运行强大的 AI。</h3>
|
||||
<p align="center">本地聊天、写代码、处理图片。</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?include_prereleases&label=release" alt="Latest release"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT license"></a>
|
||||
<a href="https://github.com/Niko1221/Strata/stargazers"><img src="https://img.shields.io/github/stars/Niko1221/Strata?style=flat" alt="GitHub stars"></a>
|
||||
<a href="#模型">模型</a> · <a href="#安装"><b>安装</b></a> ·
|
||||
<a href="#硬件">硬件</a> · <a href="#工具">工具</a> ·
|
||||
<a href="#帮助">帮助</a> · <a href="#支持-strata">支持</a>
|
||||
</p>
|
||||
|
||||
<p align="center"><a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4"><img src="docs/media/pagoda-preview.webp" width="720" alt="A voxel pagoda garden that Strata's model wrote, running in the browser"></a><br>
|
||||
<sub>一座体素宝塔花园,由一条提示词一次生成,在装有 RTX 5070 的电脑上用 Strata 运行(IQ3_S,128K 上下文) ·
|
||||
<a href="https://github.com/Niko1221/Strata/releases/download/v0.1.10/Pagoda.mp4">完整视频(49 秒)</a></sub></p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/Niko1221/Strata/releases/latest"><img src="https://img.shields.io/github/v/release/Niko1221/Strata?label=download&color=0ab887" alt="下载 Strata"></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/github/license/Niko1221/Strata" alt="MIT 许可证"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://img.shields.io/badge/Buy_me_a_coffee-FFDD00?logo=buymeacoffee&logoColor=000" alt="在 Buy Me a Coffee 上支持 Strata"></a>
|
||||
</p>
|
||||
|
||||
Strata 运行 **[Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)**。这是一个 1250 亿参数的模型,
|
||||
通常需要服务器才能跑,现在用普通电脑就行。它能聊天、写代码、看图片,也能配合你的应用和编程智能体使用。
|
||||
你的聊天记录和文件都留在你自己的电脑上。
|
||||
<p align="center"><sub><a href="README.md">English</a> · <b>简体中文</b> · <a href="README.ja.md">日本語</a> · <a href="README.de.md">Deutsch</a> · <a href="README.fr.md">Français</a> · <a href="README.es.md">Español</a> · <a href="README.pt-BR.md">Português</a> · <a href="README.pl.md">Polski</a></sub></p>
|
||||
|
||||
**第一次用?** 先看[硬件要求](#硬件要求),再[安装应用](#方式-astrata-应用)。
|
||||
**免费、开源,由你自己运行。** 在桌面上使用 Strata,或搭配你喜欢的编程工具。无需账号。
|
||||
|
||||
- **游戏电脑就能跑。** 内存和显存加起来有 32 GB 就可以开始。
|
||||
- **能接入你的工具。** 支持 OpenAI 和 Anthropic 的 API,Claude Code、Codex CLI、OpenCode 等智能体都能连上。
|
||||
- **能看图片。** 默认开启。
|
||||
- **免费。** MIT 许可证,不用注册账号,不走云端。
|
||||
- **隐私。** 没有遥测。Strata 下载什么、什么时候联网、如何校验下载内容,都写在 [docs/SAFETY.md](docs/SAFETY.md)。
|
||||
## 模型
|
||||
|
||||
版本 0.2.3 · 引擎 0.1.48
|
||||
我们**首先推荐 ISTA-DASLab**,其次是 **Unsloth** 和其他提供方,前提是有内存放得下的兼容模型。
|
||||
|
||||
## 硬件要求
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.8-Flash-Next</b></summary>
|
||||
|
||||
**内存和显存(VRAM)加起来至少要有 32 GB。** Mac 和 Ryzen AI Max 上指的是统一内存。内存越大,能跑的模型越大,
|
||||
或者速度越快。
|
||||
|
||||
- 32 GB 内存加一张 12-16 GB 显存的显卡,可以跑 Coder。
|
||||
- 64 GB 内存可以跑所有尺寸。
|
||||
|
||||
| 你的电脑 | 说明 |
|
||||
| 提供方 | 可选项 |
|
||||
| --- | --- |
|
||||
| **NVIDIA** GeForce RTX 20、30、40、50 系列(12 GB 及以上) | 安装应用或终端版即可。 |
|
||||
| **AMD** Radeon RX 6800 及更新型号、Radeon AI PRO R9700(12 GB 及以上) | [AMD 显卡](docs/AMD_HIP.md) |
|
||||
| **Intel** Arc | [Intel Arc](docs/INTEL_ARC.md)、[Intel 引擎](docs/INTEL.md) |
|
||||
| **Apple 芯片 Mac**(M1 及更新,macOS 15 及以上) | [Mac](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max(Strix Halo)** 及其他统一内存系统 | [Strix Halo](docs/STRIX_HALO.md) |
|
||||
| 较旧的显卡和处理器 | [旧显卡](docs/OLDER_GPUS.md)、[旧处理器](docs/INSTALL.md#older-cpus-experimental) |
|
||||
| **ISTA-DASLab · 推荐** | Q2\_0, IQ2\_XS, IQ3\_XXS, IQ3\_S。[Coder:IQ1\_M](docs/MODELS.md#coder),适合写代码。 |
|
||||
| **Unsloth** | UD-IQ4\_XS, UD-Q4\_K\_XL, UD-Q5\_K\_XL, UD-Q6\_K\_XL, Q8\_0 |
|
||||
| **Gyro · agentionai** | [Gyro-S, Gyro-M](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF)。占用内存更少,但速度更慢。 |
|
||||
| **其他选项** | [Swift 1.5](docs/MODELS.md#swift-15), [NVFP4](docs/NVFP4.md), [OrcaRouter](docs/ORCA.md) |
|
||||
|
||||
另外还需要:
|
||||
[比较大小、内存需求和兼容性](docs/MODELS.md)。
|
||||
|
||||
- 约 80 GB 的可用磁盘空间(用固态硬盘,首次启动会快很多)
|
||||
- Windows 10 / 11、Linux 或 macOS
|
||||
- 较新的显卡驱动
|
||||
</details>
|
||||
|
||||
同一品牌的两三张显卡可以共同运行一个模型([多显卡](docs/MULTI_GPU.md))。Strata 不会把一个模型拆到 NVIDIA 和 AMD
|
||||
显卡上。完整列表见 [docs/INSTALL.md](docs/INSTALL.md#what-you-need)。
|
||||
<details>
|
||||
<summary><img src="docs/media/models/qwen.svg" width="22" alt="" align="middle"> <b>Qwen3.6-35B-A3B</b></summary>
|
||||
|
||||
**Unsloth:** UD-Q4_K_XL, UD-Q6_K_XL, Q8_0。这些是目前文档中收录的该模型的版本。
|
||||
|
||||
[模型指南和兼容性](docs/QWEN36.md)。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><img src="docs/media/models/deepseek.svg" width="22" alt="" align="middle"> <b>DeepSeekV4.1-Flash-1017</b></summary>
|
||||
|
||||
可在**桌面应用**和**终端**中使用。内存放不下的部分会从 SSD 读取,所以需要大量空闲磁盘空间。
|
||||
|
||||
| 版本(IST-DAS) | 下载大小 | 所需空闲磁盘 |
|
||||
| --- | ---: | ---: |
|
||||
| 1.75 bpw | 239 GB | 约245 GB |
|
||||
| 2.00 bpw | 257 GB | 约265 GB |
|
||||
| 2.25 bpw | 274 GB | 约280 GB |
|
||||
|
||||
支持 NVIDIA RTX 30、40 和 50 系列(Windows 和 Linux),以及 AMD Radeon AI PRO R9700(Linux)。安装程序会下载模型文件和 DeepSeek 引擎,然后启动模型。
|
||||
|
||||
```sh
|
||||
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
|
||||
```
|
||||
|
||||
以下为 Strata 0.2.5 上 2.00 bpw 版本的实测结果。“输出”是回答的速度,“提示词”是 Strata 读取你输入内容的速度。
|
||||
|
||||
| 硬件 | 输出 | 提示词 |
|
||||
| --- | ---: | ---: |
|
||||
| RTX 5070 12 GB, 64 GB 内存 | 4 到 6 tokens/s | 约 110 tokens/s(4K) |
|
||||
| RTX 3060 12 GB, 46 GB 内存 | 9 到 11 tokens/s | 约 155 tokens/s(4K) |
|
||||
| 1x Radeon AI PRO R9700, 251 GB 内存 | 21 到 25 tokens/s | 320 到 360 tokens/s (8K) |
|
||||
| 4x Radeon AI PRO R9700 | 74 到 77 tokens/s | 400 到 450 tokens/s (8K) |
|
||||
|
||||
[内存、磁盘和详细信息](docs/DEEPSEEK41.md) · [发行说明](https://github.com/Niko1221/Strata/releases)
|
||||
|
||||
</details>
|
||||
|
||||
<a id="the-other-sizes"></a>
|
||||
|
||||
不确定哪个放得下?[为你的电脑选择模型](docs/MODELS.md#pick-by-memory)。
|
||||
|
||||
## 安装
|
||||
|
||||
三种方式任选一种。它们启动的是同一个引擎,用的是同样的模型。
|
||||
<a id="option-a-the-strata-app"></a>
|
||||
|
||||
### 方式 A:Strata 应用
|
||||
### 桌面应用
|
||||
|
||||
最简单的方式。应用内置引擎:安装、选模型、开始聊天。请根据你的系统和显卡,从
|
||||
[发布页](https://github.com/Niko1221/Strata/releases/latest)下载对应的文件。不确定选哪个?看表格下面那一段。
|
||||
**[下载适用于 Windows、Linux 或 Mac 的 Strata →](https://github.com/Niko1221/Strata/releases/latest)**
|
||||
|
||||
| 系统 | 你的显卡 | 要下载的文件 |
|
||||
| --- | --- | --- |
|
||||
| **Windows 10 / 11** | NVIDIA RTX,驱动 580 或更新 | [`Strata-0.2.3-windows-cuda13.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda13.exe) |
|
||||
| | NVIDIA,较旧的显卡,或驱动低于 580 | [`Strata-0.2.3-windows-cuda12.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-cuda12.exe) |
|
||||
| | AMD Radeon RX 9000 系列或 Radeon AI PRO R9700 | [`Strata-0.2.3-windows-hip.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip.exe) |
|
||||
| | AMD Radeon RX 7000 系列或 Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-windows-hip-rdna3.exe`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-windows-hip-rdna3.exe) |
|
||||
| **Linux** | NVIDIA RTX,驱动 580 或更新 | [`Strata-0.2.3-linux-nvidia-cuda13.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda13.AppImage) |
|
||||
| | NVIDIA,较旧的显卡,或驱动低于 580 | [`Strata-0.2.3-linux-nvidia-cuda12.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-nvidia-cuda12.AppImage) |
|
||||
| | AMD Radeon RX 9000 系列或 Radeon AI PRO R9700 | [`Strata-0.2.3-linux-amd-rx9070.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx9070.AppImage) |
|
||||
| | AMD Radeon RX 7000 系列 | [`Strata-0.2.3-linux-amd-rx7900.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-rx7900.AppImage) |
|
||||
| | AMD Ryzen AI Max (Strix Halo) | [`Strata-0.2.3-linux-amd-strixhalo.AppImage`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-linux-amd-strixhalo.AppImage) |
|
||||
| **Mac**(Apple 芯片,macOS 15 及以上) | 内置 | [`Strata-0.2.3-mac.dmg`](https://github.com/Niko1221/Strata/releases/latest/download/Strata-0.2.3-mac.dmg) |
|
||||
安装应用,选择模型,就可以开始聊天。每个系统只有一个安装程序。首次启动时,应用会下载适合你显卡的引擎。[安装程序帮助](docs/INSTALL.md#the-app)。
|
||||
|
||||
**不确定时:** NVIDIA 显卡的驱动版本在 580 及以上就选 `cuda13`,否则选 `cuda12`。`cuda12` 适用于较旧的显卡和驱动。
|
||||
`hip` 和 `amd` 的文件是给 AMD 显卡用的。其他 AMD 显卡(RX 6000)目前还没有现成的应用,
|
||||
请看 [AMD 显卡](docs/AMD_HIP.md)。
|
||||
<sub>文件: `Strata-0.2.7-windows-x64-setup.exe` · `Strata-0.2.7-linux-x86_64.AppImage` · `Strata-0.2.7-macos-arm64.dmg`</sub>
|
||||
|
||||
然后:
|
||||
<p align="center">
|
||||
<img src="docs/media/app-chat.png" width="900" alt="Strata 桌面应用,聊天和实时代码预览并排显示">
|
||||
<br><sub>聊天、文件和实时预览都在一个窗口里。</sub>
|
||||
</p>
|
||||
|
||||
- **Windows:** 运行 `.exe`。它只为当前用户安装,不需要管理员权限。如果 Windows 提示“Windows 已保护你的电脑”,
|
||||
点击**更多信息**,再点**仍要运行**(安装程序还没有代码签名)。
|
||||
- **Linux:** 给文件加上可执行权限(`chmod +x`),然后启动。需要 FUSE 2:`sudo apt install libfuse2`(Ubuntu 22.04),
|
||||
或 `libfuse2t64`(Ubuntu 24.04 及更新)。
|
||||
- **Mac:** 打开 `.dmg`,把 Strata 拖到“应用程序”。
|
||||
<a id="option-b-the-terminal-one-line"></a>
|
||||
|
||||
第一个界面里,应用会检测你的电脑,并推荐合适的模型。点击安装即可。模型很大,要下载约 40-70 GB,中断后会从断点继续。
|
||||
关闭窗口会同时停止 Strata 和引擎。
|
||||
### 终端应用
|
||||
|
||||
### 方式 B:终端(一行命令)
|
||||
更喜欢终端?安装 Strata,然后运行 **`strata launch`**。
|
||||
|
||||
终端版就是 `strata` 命令,适合脚本、服务器和 AI 智能体。
|
||||
<details open>
|
||||
<summary><b>安装命令</b></summary>
|
||||
|
||||
Linux 和 Mac:
|
||||
**Linux / Mac**
|
||||
|
||||
```sh
|
||||
curl -fsSL https://github.com/Niko1221/Strata/releases/latest/download/install.sh -o install.sh && sh install.sh
|
||||
```
|
||||
|
||||
Windows(PowerShell):
|
||||
**Windows PowerShell**
|
||||
|
||||
```powershell
|
||||
irm https://github.com/Niko1221/Strata/releases/latest/download/install.ps1 | iex
|
||||
```
|
||||
|
||||
脚本会检查你的电脑,下载终端版,校验 SHA-256,然后解压到你的用户目录。不需要管理员权限。在 Windows 上,装完后请
|
||||
打开一个新的终端窗口。然后启动 Strata:
|
||||
在 Windows 上,安装后请打开一个新的终端。然后运行:
|
||||
|
||||
```sh
|
||||
strata launch
|
||||
```
|
||||
|
||||
它会一次问一个问题:模型、上下文、图片、允许谁连接。接着为你的显卡下载引擎(已签名,使用前会先试启动),再下载
|
||||
模型,并开始提供服务。在脚本和 AI 智能体里,请使用参数:
|
||||
|
||||
```sh
|
||||
strata launch --model q2_0 --yes --no-tui
|
||||
```
|
||||
|
||||
如果想在运行前先看看安装脚本,先用 `curl -fsSL <address> -o install.sh` 下载,读完后再用 `sh install.sh` 运行。
|
||||
所有界面和参数见 [docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md)。
|
||||
|
||||
### 方式 C:让你的 AI 来安装
|
||||
|
||||
把下面这段话粘贴到 Claude Code、Cursor、Codex、GitHub Copilot 或其他编程助手里:
|
||||
|
||||
```text
|
||||
Set up Strata on this PC for me: https://github.com/Niko1221/Strata - follow docs/AI_SETUP.md in that repository.
|
||||
```
|
||||
|
||||
它会检查你的显卡、内存和磁盘,选出合适的模型,完成安装和启动,并告诉你怎么连接你的应用。AI 工具也可以通过 Strata 的
|
||||
[MCP 服务器](docs/MCP_SERVER.md)安装、启动和停止 Strata。
|
||||
|
||||
想自己动手编译?请看[从源码构建](#从源码构建)。
|
||||
|
||||
## 模型
|
||||
|
||||
应用和 `strata launch` 会按你的内存推荐模型。它是同一个模型的几种尺寸,压缩程度不同。尺寸小的更快,尺寸大的稍微更聪明一点。
|
||||
|
||||
### 内存不够?试试 Gyro
|
||||
|
||||
[Gyro](https://huggingface.co/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF)(作者 agentionai)是运行这个模型占用最小的方式。
|
||||
|
||||
| 尺寸 | 所需内存(RAM + VRAM) | 下载大小 | 说明 |
|
||||
| --- | ---: | ---: | --- |
|
||||
| **Gyro-S** | 27.6 GB | 58.5 GB | 给其他尺寸都放不下的电脑。质量低于 IQ2_XS。 |
|
||||
| **Gyro-M** | 35 GB | 92.0 GB | 质量约相当于 IQ3_XXS,显存占用少约 20%。输出回答比 Q2_0 慢,12 GB 的 RTX 3060 上慢 16%,R9700 上慢 21%。 |
|
||||
|
||||
Gyro 可在 NVIDIA 和 AMD 显卡(AMD 为实验性支持)以及 Linux 上的 Intel Arc 显卡(已在 Arc A750 上测试)上运行,自 0.2.2 起也可在 Apple Silicon 的 Mac 上运行(32 GB 的 Mac mini 上 Gyro-S 为 9 token/秒,专家权重从 SSD 读取)。详情和测试数据:
|
||||
[docs/GYRO.md](docs/GYRO.md)。用 `strata launch --model gyro-s` 启动。
|
||||
|
||||
### 其他尺寸
|
||||
|
||||
| 你的内存(RAM + VRAM) | 选择 | 备注 |
|
||||
| --- | --- | --- |
|
||||
| **32 GB** | **Gyro-S**,写代码可选 **[Coder](docs/MODELS.md#coder)** | Coder 需要 32 GB 内存,只保留一半的专家,所以代码以外的能力较弱 |
|
||||
| **40 GB** | **[Swift 1.5](docs/MODELS.md#swift-15)** IQ2_XS(39.2 GB),或 **Gyro-M**(35 GB) | Swift 回答前思考的时间更短。Gyro-M 的质量接近 IQ3_XXS,但输出回答比 Q2_0 慢 16-21% |
|
||||
| **48 GB** | **IQ3_XXS**(47.0 GB) | 更慢,更好 |
|
||||
| **64 GB** | **IQ3_S**(54.8 GB),原版或 Swift 1.5 | 最慢,最好:在公开测试中与完整模型持平 |
|
||||
| **96 GB 及以上** | Unsloth 的 **UD-IQ4_XS**(约 72 GB 内存)到 **Q8_0**(约 136 GB),4 到 8 位 | 更接近完整模型。内存不足时,Strata 会从固态硬盘读取一部分,速度会慢很多 |
|
||||
|
||||
内存比这一行写的少,也可能能用:Strata 会自动切换到[低内存模式](docs/MODELS.md#a-big-graphics-card-and-little-ram)。
|
||||
速度会变慢,显卡较小时会慢得多。
|
||||
|
||||
更多选择:
|
||||
|
||||
- **[Swift 1.5](docs/MODELS.md#swift-15)** 是微调版本,回答前思考的时间更短,质量和内存占用大致相同。
|
||||
- **[NVFP4](docs/NVFP4.md)** 是 NVIDIA 为 NVIDIA 显卡提供的 4 位版本。要把所有专家放进内存,需要约 80 GB 内存。
|
||||
- **[Qwen3.6-35B-A3B](docs/QWEN36.md)** 是另一个更小的模型,能看图片,还能同时回答多个请求。
|
||||
- **[OrcaRouter 的 Uncensored IQ3_XXS](docs/MODELS.md#orcarouter-uncensored-iq3_xxs)** 需要手动设置。
|
||||
|
||||
所有尺寸、下载大小,以及各种配置能跑什么:[docs/MODELS.md](docs/MODELS.md)。
|
||||
|
||||
### DeepSeek V4.1-Flash(终端版,0.2.4 起)
|
||||
|
||||
[DeepSeek V4.1-Flash](https://huggingface.co/ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF) 是另一个大得多的模型。下面三个版本由 ISTA-DASLab 制作。Strata 在一台有一块 12 GB 显卡和 46 到 64 GB 内存的电脑上运行它们,其余部分从固态硬盘读取。它可在 NVIDIA RTX 30 到 50 系列显卡和 Radeon AI PRO R9700 上运行。它使用自己的引擎包 `strata-dsv41`,你选择 DeepSeek 时由 `strata launch` 下载。桌面应用暂时不提供它。
|
||||
|
||||
| 版本 | 下载大小 | 与原模型相比的质量 | 生成速度 |
|
||||
| --- | ---: | --- | --- |
|
||||
| **IQ1_M**(1.75 位) | 239 GB | KL 0.217,困惑度 3.80(+21%);代码 +8.9%,智能体任务 +10.2%;普通英文散文表现较弱。据 ISTA-DASLab 的模型卡,它保留了基础模型任务平均分的 98.7%(AIME25、GPQA-Diamond、LiveCodeBench v6)。 | 尚未测量 |
|
||||
| **IQ2_XXS** (2.00 位) | 257 GB | KL 0.170,困惑度 3.63(+15.5%);代码 +8.6%,智能体任务 +5.3% | RTX 3060 上每秒约 8 到 10 个 token(代码 9.9,智能体任务 7.8),RTX 5070 上约 5 个 |
|
||||
| **IQ2_XS** (2.25 位) | 274 GB | KL 0.107,困惑度 3.37(+7.3%);代码 +3.2%,智能体任务 +2.2% | 一块 Radeon AI PRO R9700 上每秒约 11 个 token |
|
||||
| **IQ4_NL**(Engram 表,不是第三个模型) | 111 GB,已包含在上面三个下载中 | 模型从内存或固态硬盘读取的 4 位 Engram 查找表。三个版本共用这一个文件(`DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf`)。 | 不适用 |
|
||||
|
||||
4 块 Radeon AI PRO R9700:每秒约 31 个 token,使用 DSpark 时为 55 到 69。
|
||||
|
||||
用 `strata launch --model ist-das-2.00bpw`(或 `ist-das-1.75bpw`、`ist-das-2.25bpw`)启动。详情、各显卡的速度和手动安装见 [docs/DEEPSEEK41.md](docs/DEEPSEEK41.md)。
|
||||
|
||||
## 速度如何?
|
||||
|
||||
以下数据基于 12 GB 显卡(RTX 5070、Ryzen 5 7600、64 GB 内存)。其他显卡的结果见:
|
||||
[各模型的速度](docs/MODELS.md#how-fast-is-each-size)、[社区测试结果](docs/COMMUNITY_BENCHMARKS.md)。
|
||||
|
||||
| 模型 | 回答输出速度 | 读取提示词速度 |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████████` 94 tokens/s | `████████████` 2,650 tokens/s |
|
||||
| **IQ2_XS** | `██████████░░` 79 tokens/s | `█████████░░░` 2,090 tokens/s |
|
||||
| **IQ3_XXS** | `████████░░░░` 62 tokens/s | `████████░░░░` 1,750 tokens/s |
|
||||
| **IQ3_S** | `███████░░░░░` 53 tokens/s | `███████░░░░░` 1,620 tokens/s |
|
||||
| **Coder** | `███████░░░░░` 55 tokens/s | `██████████░░` 2,180 tokens/s |
|
||||
|
||||
一个 token 约等于 ¾ 个英文单词,所以每秒 60 个 token 比你阅读的速度还快。“读取提示词”指 Strata 吸收长文档、代码或聊天历史的速度。
|
||||
|
||||
在 16 GB 的 AMD 显卡上测得的结果(RX 9070 XT、Ryzen 9 3900X、47 GB 内存):
|
||||
|
||||
| 模型 | 回答输出速度 | 读取提示词速度 |
|
||||
| --- | --- | --- |
|
||||
| **Q2_0** | `████████░░░░` 60 tokens/s | `█████░░░░░░░` 1,160 tokens/s |
|
||||
| **IQ2_XS** | `███████░░░░░` 52 tokens/s | `█████░░░░░░░` 1,110 tokens/s |
|
||||
| **Coder** | `██████░░░░░░` 44 tokens/s | `██████░░░░░░` 1,420 tokens/s |
|
||||
|
||||
两张表的进度条使用同一个比例。显存更大的显卡更快:RTX 3090(24 GB)每秒大约能输出 100-140 个 token。每个数字对应的引擎版本见
|
||||
[DETAILS.md](docs/DETAILS.md#speed-measured)。
|
||||
|
||||
## 使用方法
|
||||
|
||||
### 在应用里
|
||||
|
||||
应用包含**聊天**、显示模型以及 GPU、CPU 和内存状态的**监控**、**模型**页面和**设置**。聊天可以在你电脑上的某个文件夹里工作。
|
||||
在**手动**模式下,修改文件或运行命令之前它会先询问你。输入 `/loop 10m <要做的事>`,在聊天保持打开期间每 10 分钟重复发送一次消息。
|
||||
|
||||
聊天可以用 DuckDuckGo(或 Bing)搜索网页,不需要账号。你也可以在**设置,工具**里添加搜索密钥。搜索是唯一会把内容发出电脑的功能,
|
||||
发出的就是搜索词。
|
||||
|
||||
要同时运行两个模型,请打开**运行多个模型**,并为每个模型分配同一品牌的单独一张显卡。
|
||||
|
||||
<p align="center"><img src="docs/media/app-chat.png" width="900" alt="The Strata app: a chat where the agent built a small voxel pagoda garden, with the page open in the preview on the right"><br>
|
||||
<sub>Strata 应用中的一次对话:智能体用一个 HTML 文件写出了一个小型体素宝塔花园,页面在对话旁的预览中打开</sub></p>
|
||||
|
||||
### 在终端里
|
||||
|
||||
<p align="center"><img src="docs/media/terminal-monitor.png" width="900" alt="The Strata Terminal monitor overview while the model writes a reply"><br>
|
||||
<sub>模型回复时的 <code>strata monitor</code>:速度、GPU、内存和最近的请求</sub></p>
|
||||
|
||||
```sh
|
||||
strata launch # 引导界面:模型、上下文、图片、访问方式,然后开始服务
|
||||
strata launch --model q2_0 --yes --no-tui # 不提问:开始服务,打印地址,然后返回
|
||||
strata launch --plan --model q2_0 # 显示将要执行的操作;不做任何更改
|
||||
strata launch --status # 当前正在提供什么服务
|
||||
strata launch --stop # 停止服务
|
||||
strata monitor --url http://127.0.0.1:8080 # 查看速度、GPU、内存和请求
|
||||
strata update --check # 有新引擎吗?(strata update 会安装它)
|
||||
strata doctor # 检查已安装的引擎文件
|
||||
```
|
||||
|
||||
`strata --help` 会列出所有命令。启动和提供服务时不会下载任何东西。只有安装、`strata launch`(在你选择模型时)和
|
||||
`strata update` 会下载。要从手机或另一台电脑访问 Strata,请使用 `strata launch --access lan`。它会生成一个 API 密钥,
|
||||
没有密钥就不会在网络上启动。除非你加上 `--open`,否则不会打开浏览器。指南:[docs/TERMINAL_LAUNCH.md](docs/TERMINAL_LAUNCH.md)。
|
||||
完整的客户端说明:[docs/TERMINAL.md](docs/TERMINAL.md)。
|
||||
|
||||
### 配合 AI 智能体
|
||||
|
||||
智能体用方式 B 中的一行命令安装 Strata,然后运行 `strata launch --model NAME --yes --no-tui`。步骤、参数和退出码见
|
||||
[docs/AI_SETUP.md](docs/AI_SETUP.md),仓库规则见 [AGENTS.md](AGENTS.md)。
|
||||
|
||||
### 连接你的其他应用
|
||||
|
||||
| 应用类型 | 基础 URL |
|
||||
| --- | --- |
|
||||
| 兼容 OpenAI(大多数应用和智能体) | `http://127.0.0.1:8080/v1`(API 密钥和模型名称随便填) |
|
||||
| Anthropic API(Claude Code 等) | `http://127.0.0.1:8080`,不带 `/v1`。这些应用会自己加上 `/v1/messages`。Claude Code:`ANTHROPIC_BASE_URL=http://127.0.0.1:8080` |
|
||||
| OpenAI Responses API(Codex CLI) | `http://127.0.0.1:8080/v1/responses`([设置方法](docs/DETAILS.md#the-responses-api-and-codex-cli)) |
|
||||
|
||||
`strata connect` 会打印 OpenCode、Codex CLI、Claude Code、oh-my-pi、pi、Hermes Agent 和 OpenClaw 的具体设置。
|
||||
`strata connect opencode --write` 会在询问后写入配置文件,并保留备份。
|
||||
|
||||
### 图片
|
||||
|
||||
能看图片的模型默认开启图片功能。在聊天里附加或粘贴图片,或者从你的应用发送图片。显卡的显存小于 24 GB 时,读图由处理器完成
|
||||
(每张图片几秒钟,不占用显卡的显存);显存达到 24 GB 时,由显卡完成。NVIDIA 和 AMD 的规则相同。你可以按模型关闭图片功能,
|
||||
也可以用 `--vision off`、`--vision gpu` 或 `--vision cpu` 选择读图方式。
|
||||
|
||||
这条规则背后的数据:在 Radeon AI PRO R9700 上,显卡读一张 260 token 的图片用了 57 ms,处理器用了 3.1 秒。在 16 GB 的显卡
|
||||
(Tesla P100 和 RTX A4000,Linux)上,用显卡读图会让文字速度下降 3-5%,因为它占用约 1.4 GB 显存,否则这部分会被模型使用。
|
||||
在 Mac 上,无论内存多大,都由 GPU 读图(32 GB 的 M4 上读一张 260 token 的图片用 0.45 秒,占用约 1.2 GB 共享内存);处理器读一张约需 50 秒,所以只有指定 `--vision cpu` 时才用。
|
||||
|
||||
### 使用须知
|
||||
|
||||
- 在聊天菜单或你的应用的“reasoning effort”里选择思考级别(**off、low、medium 或 high**)。off 最快。
|
||||
- Strata 默认一次回答一个请求。要同时处理多个,请在 `strata launch` 中使用 `--parallel N`,或在配置里写
|
||||
`"parallel": 2`([BATCHING.md](docs/BATCHING.md))。在 12 GB 显卡上,这会让每个回答变慢。
|
||||
- Strata 会完整读取聊天的第一条消息,每 30,000 个 token 约需 1 分钟。之后的消息几秒钟就开始。
|
||||
- 聊天记录存放的位置和完整的 API:[docs/INSTALL.md](docs/INSTALL.md#where-things-are-stored)、[docs/DETAILS.md](docs/DETAILS.md#using-it)。
|
||||
|
||||
## 从源码构建
|
||||
|
||||
<details>
|
||||
<summary>从仓库构建 Windows、Linux 和 Mac 版本</summary>
|
||||
|
||||
[下载 Strata](https://github.com/Niko1221/Strata/archive/refs/heads/main.zip)并解压,或者用 `git clone` 获取。
|
||||
**Windows:** 双击 `START-HERE.bat`。**Linux:** 在 Strata 文件夹里运行 `./setup.sh`。
|
||||
|
||||
**Mac(Apple 芯片,macOS 15 及以上):** 先用 `xcode-select --install` 安装一次 Apple 的命令行工具(不需要完整的 Xcode)。
|
||||
在 Strata 文件夹里打开终端,运行 `./setup.sh`。它会在你的 Mac 上构建 Mac 引擎(约 7 分钟),问同样的问题,下载模型并启动。
|
||||
下次运行 `./setup.sh` 会直接启动。你的 Mac 适合哪个尺寸:[docs/MAC.md](docs/MAC.md)。
|
||||
|
||||
安装程序会找到你的显卡,并设置合适的引擎。它会问你用哪个模型和尺寸、上下文多长(模型能记住多少文字),以及是否要读取图片。
|
||||
直接按回车就是推荐的选择。然后它会下载模型(约 70 GB)并启动。如果下载中断,再运行一次就会继续。浏览器会打开
|
||||
`http://127.0.0.1:8080` 上的 Strata 页面。
|
||||
|
||||
> 模型启动期间,你的电脑可能会变慢,或者在 1-3 分钟内没有响应(第一次最久)。Strata 会把 35-55 GB 加载到内存里,并锁定其中一部分
|
||||
> 给显卡使用。请等待,不要关闭窗口。
|
||||
|
||||
下次再运行 `START-HERE.bat`(或 `./setup.sh`)会立即启动,不会重复下载。关闭它的窗口就能停止模型。`UPDATE.bat`
|
||||
(`./update.sh`)只更新 Strata,不启动。更新、Docker、多显卡、文件存放位置和所有选项:[docs/INSTALL.md](docs/INSTALL.md)。
|
||||
|
||||
要测试你的电脑,运行 `BENCH.bat`(`./bench.sh`)。需要 5-10 分钟,并生成一份可以分享的报告
|
||||
([方法](docs/COMMUNITY_BENCHMARKS.md#run-the-benchmark))。
|
||||
|
||||
**可选:整个模型都放得进内存时,让单卡更快。** 这是 RubenTorney 提供的两个需要手动开启的设置(#1904、#1905)。
|
||||
当你只用一张显卡,并且内存装得下所有专家时,它们会有帮助,例如在 64 GB 的电脑上跑 Q2_0 或 IQ3_XXS。打开 Strata 数据文件夹里的
|
||||
`strata-<model>.json`([位置](docs/INSTALL.md#where-things-are-stored)),然后添加:
|
||||
|
||||
- 在 `"args"` 列表中加入 `"--adapt-async", "1"`。这样专家缓存会在辅助线程上更新,不会让回答暂停。在 RTX 5070
|
||||
(Windows,Q2_0)上测得:解码快 4-5%,代码和长文档快 7-10%。回答可能与默认设置略有不同,但每次运行的结果保持一致。
|
||||
- 在 `"env"` 块中加入 `"STRATA_PIN_BY_NEED": "1"`(Windows)。Windows 只能为显卡锁定大约一半的内存,
|
||||
这个设置会优先锁定显卡最先需要的专家。在 RTX 5070 上测得:读取提示词快 4.4%。
|
||||
|
||||
```json
|
||||
"args": [ ..., "--adapt-async", "1" ],
|
||||
"env": { "STRATA_PIN_BY_NEED": "1" }
|
||||
```
|
||||
|
||||
修改后请重启 Strata。要撤销,删除这两项即可。
|
||||
按提示下载并启动模型。[终端指南](docs/TERMINAL_LAUNCH.md)。
|
||||
|
||||
</details>
|
||||
|
||||
## 工作原理
|
||||
<p align="center">
|
||||
<img src="docs/media/terminal-monitor.png" width="900" alt="Strata 终端应用,显示模型活动、速度、内存和最近的请求">
|
||||
<br><sub>模型运行时,随时查看模型和硬件状态。</sub>
|
||||
</p>
|
||||
|
||||
这类模型通常运行在有几百 GB 显存的服务器上。你的显卡只有 12-24 GB。Strata 把工作分给整台电脑,让模型装得下。
|
||||
可以把它想成一座图书馆。
|
||||
<a id="build-from-source"></a>
|
||||
|
||||
- 模型是一个由 24,576 位小专家(“experts”)组成的团队,好比 24,576 本参考书。每个词只需要其中 10 本。
|
||||
- **你的显卡是书桌。** 它小而快。最常用的大约 4,000 本书摊开放在上面。
|
||||
- **你的内存是阅览室的书架。** 24,576 本书都在这里。某个词需要一本不在书桌上的书时,处理器会立刻从书架上取来读,显卡则继续工作。
|
||||
- **你的固态硬盘是档案室。** 里面存着一张 29 GB 的查找表。模型每个词只读其中几行,所以不用常驻内存。
|
||||
[从源码构建](docs/SOURCE_INSTALL.md) · [Docker](docs/DOCKER.md) · [完整安装指南](docs/INSTALL.md)
|
||||
|
||||
<p align="center"><img src="docs/media/how-it-works.svg" width="860" alt="The model's 24,576 experts: the busiest on the graphics card, all of them in RAM, a lookup table on the SSD"></p>
|
||||
<a id="what-you-need"></a>
|
||||
|
||||
另外有一个小助手会猜接下来的几个词。大模型一次检查所有猜测,保留正确的部分。得到的答案不变,但快了 1.6-1.8 倍。
|
||||
长文本按大块读取,一次最多 8,192 个 token,速度超过每秒 1,000 个 token。
|
||||
## 硬件
|
||||
|
||||
<p align="center"><img src="docs/media/guess-and-check.svg" width="860" alt="A small helper guesses the next words; the big model checks them all at once and keeps the right ones"></p>
|
||||
| 支持的硬件 | 指南 |
|
||||
| --- | --- |
|
||||
| **NVIDIA GeForce RTX 20 / 30 / 40 / 50 系列** | [NVIDIA 安装](docs/INSTALL.md#what-you-need) |
|
||||
| **AMD Radeon RX 7700 / 7800 / 7900、RX 9060 / 9070、AI PRO R9700** | [AMD 安装](docs/AMD_HIP.md) |
|
||||
| **AMD Radeon RX 6800 / 6900 · 实验性** | [RX 6000 安装](docs/AMD_HIP.md#rdna2-gfx1030) |
|
||||
| **Intel Arc · Linux** | [Intel 安装](docs/INTEL_ARC.md) |
|
||||
| **Apple Silicon · M1 或更新** | [Mac 安装](docs/MAC.md) |
|
||||
| **AMD Ryzen AI Max · Strix Halo** | [Strix Halo 安装](docs/STRIX_HALO.md) |
|
||||
|
||||
更详细的解释:[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md)。每个部分和它的数据:
|
||||
[详细说明](docs/DETAILS.md#how-it-works)和[论文](docs/paper/Strata-Paper.pdf)。
|
||||
<a id="using-it"></a>
|
||||
|
||||
## 出问题了?
|
||||
## 工具
|
||||
|
||||
- **第一次启动 Strata 时我的电脑卡住了。** 它在把模型加载到内存。请等待,不要关闭窗口。10 分钟后还是卡住?重启电脑,
|
||||
关闭其他程序后再试,或者选一个更小的尺寸。
|
||||
- **下载或安装时中断了。** 重新启动应用或 `strata launch`,或者再运行一次 `START-HERE.bat`(或 `./setup.sh`)。
|
||||
它会从中断的地方继续。
|
||||
- **非常慢、硬盘灯一直闪,或者提示“引擎意外停止”。** 你的电脑可用内存不够。关闭其他程序(浏览器很占内存),
|
||||
或者选一个更小的尺寸,比如 Q2_0 或 IQ2_XS。
|
||||
- **提示这台电脑没有可用的引擎。** 在应用里打开**设置,引擎**,点击**更新引擎**。在终端里运行 `strata update`。
|
||||
`strata doctor` 会显示已安装哪些引擎文件。
|
||||
- **提示 8080 端口已被占用。** Strata 已经在运行了。找一下它的窗口。
|
||||
**Claude Code · Codex CLI · OpenCode · oh-my-pi · pi.dev · Hermes Agent · OpenClaw**,也可以通过兼容 OpenAI 和 Anthropic 的 API 使用更多工具。
|
||||
|
||||
更多问题和解决办法:[docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)。还是解决不了?请提交
|
||||
[issue](https://github.com/Niko1221/Strata/issues)。在应用里,附上**设置,引擎,诊断,查看日志,保存日志**得到的文件。
|
||||
在终端里,粘贴 `strata doctor` 的输出。从源码运行时,附上 Strata 文件夹里的 `strata-<model>.log`。
|
||||
如果是安全问题,请私下报告:[SECURITY.md](SECURITY.md)。
|
||||
运行 **`strata connect`**,查看你所用工具的设置方法。[连接指南](docs/TERMINAL_LAUNCH.md#connect-your-apps-strata-connect)。
|
||||
|
||||
## 致谢与许可证
|
||||
<a id="guides"></a>
|
||||
<a id="how-fast-is-it"></a>
|
||||
<a id="how-does-it-work"></a>
|
||||
<a id="something-went-wrong"></a>
|
||||
|
||||
模型是 Qwen 团队的 [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next)。压缩工作由
|
||||
[ISTA-DASLab](https://huggingface.co/ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF)、UkisAI(Swift 1.5)、agentionai(Gyro)
|
||||
和 Unsloth 完成。Strata 使用了 [llama.cpp / ggml](https://github.com/ggml-org/llama.cpp) 的部分代码。全部致谢:
|
||||
[docs/HOW_IT_WORKS.md](docs/HOW_IT_WORKS.md#credits)。Strata 以 [MIT 许可证](LICENSE)开源。少数部分和所有模型有各自的许可证
|
||||
([具体是哪些](docs/HOW_IT_WORKS.md#license))。
|
||||
## 帮助
|
||||
|
||||
## 参与贡献
|
||||
|
||||
发现了 bug,或者想提交修改或基准测试结果?请先阅读 [CONTRIBUTING.md](CONTRIBUTING.md)。其中说明了需要附上哪些内容,
|
||||
方便其他人核实你的工作。
|
||||
[全部指南](docs) · [故障排查](docs/TROUBLESHOOTING.md) · [报告问题](https://github.com/Niko1221/Strata/issues/new/choose) ·
|
||||
[基准测试](docs/COMMUNITY_BENCHMARKS.md) · [工作原理](docs/HOW_IT_WORKS.md) · [参与贡献](CONTRIBUTING.md)
|
||||
|
||||
## 支持 Strata
|
||||
|
||||
Strata 免费,采用 MIT 许可证。我在能拿到的各种硬件上开发和测试它。如果它在你的电脑上跑得不错,请我喝杯咖啡,能帮我继续测试新显卡、
|
||||
修复你们反馈的问题。不用有压力。使用它并反馈你的发现,同样很有帮助。
|
||||
**帮助本地 AI 保持开放。** 一杯咖啡能帮助我们在更多硬件上开发和测试。
|
||||
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
|
||||
<a href="https://buymeacoffee.com/strataengine"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me a Coffee:支持 Strata" height="48"></a>
|
||||
|
||||
有兴趣赞助 Strata?请通过 [GitHub](https://github.com/Niko1221) 联系我。
|
||||
[MIT 许可证](LICENSE) · [致谢和模型许可证](docs/HOW_IT_WORKS.md#credits) · [隐私](docs/SAFETY.md)
|
||||
|
||||
<a id="option-c-let-your-ai-set-it-up"></a>
|
||||
|
||||
<sub>面向 AI 工具和自动阅读器: <a href="AGENTS.md">技术参考</a> · <a href="docs/AI_SETUP.md">安装说明</a></sub>
|
||||
|
||||
**赞助、硬件合作或其他合作:** [[email protected]](mailto:[email protected]).
|
||||
+3
-2
@@ -23,8 +23,9 @@ this PC only. The details and every setting are in [docs/DETAILS.md](docs/DETAIL
|
||||
- **Where it listens.** `127.0.0.1` by default. `--host 0.0.0.0` (or `"host"` in `strata-<model>.json`) opens it to
|
||||
your network, and the server then warns when no API key is set.
|
||||
- **API key.** `"api_key"` in the run config (or `STRATA_API_KEY`) is required on `/v1/*` and on every endpoint
|
||||
that shows the model's state, requests or answers (`/status`, `/metrics`, `/settings`, `/mcp`, `/props`, `/slots`,
|
||||
`/api/requests`, `/config`) and on every `POST`. It is compared in constant time. Set one before you open the
|
||||
that shows the model's state, requests or answers (`/status`, `/metrics`, `/metrics/prometheus`, `/settings`,
|
||||
`/mcp`, `/props`, `/slots`, `/api/requests`, `/config`) and on every `POST`. It is compared in constant time.
|
||||
Set one before you open the
|
||||
server to your network or put a tunnel in front of it.
|
||||
- **Host check (DNS rebinding, 0.1.38).** Without an API key the server answers only requests whose `Host` is a name
|
||||
it knows (`localhost`, an IP address, the address it listens on and, when it listens beyond this PC, this PC's
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "strata-desktop",
|
||||
"productName": "Strata",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.7",
|
||||
"private": true,
|
||||
"description": "Strata Desktop - local AI, tuned to one model.",
|
||||
"scripts": {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/** Strata's output-budget correction for the staged pi-ai copy. */
|
||||
import { createHash } from 'node:crypto';
|
||||
import { lstatSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
||||
import { join, resolve } from 'node:path';
|
||||
|
||||
export const HARNESS_BUDGET_PATCH = Object.freeze({
|
||||
id: 'strata-pi-ai-context-safety-v2',
|
||||
package: '@earendil-works/pi-ai',
|
||||
version: '1.1.0',
|
||||
file: 'node_modules/@earendil-works/pi-ai/dist/api/simple-options.js',
|
||||
beforeSha256: '9b3cc0ae6daa86fdc050bc0cb0f3f986401e64ccddbde6757183c9f8ad411be2',
|
||||
});
|
||||
|
||||
const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
|
||||
const oldClamp = 'const available = model.contextWindow - estimateContextTokens(context).tokens - CONTEXT_SAFETY_TOKENS;';
|
||||
// Small windows also need room after tool results; a fixed margin must not
|
||||
// consume all remaining estimated space. Keep the old 64K+ calculation.
|
||||
const newClamp = `const remaining = model.contextWindow - estimateContextTokens(context).tokens;
|
||||
const safety = model.contextWindow >= 65536 ? CONTEXT_SAFETY_TOKENS
|
||||
: Math.min(CONTEXT_SAFETY_TOKENS, Math.floor(model.contextWindow / 16), Math.max(0, Math.floor(remaining / 2)));
|
||||
const available = remaining - safety;`;
|
||||
|
||||
/**
|
||||
* Patch only a flattened, disposable staged Harness. Returns the BUNDLE.json
|
||||
* provenance entry; the caller records it when writing the bundle manifest.
|
||||
* A repeat application or any unknown package/source fails before writing.
|
||||
*/
|
||||
export function patchStagedHarnessBudget(stagedRoot) {
|
||||
const fail = message => { throw new Error(`Harness output-budget patch: ${message}`); };
|
||||
const root = realpathSync(resolve(stagedRoot));
|
||||
const packageDir = join(root, 'node_modules', '@earendil-works', 'pi-ai');
|
||||
const target = join(root, HARNESS_BUDGET_PATCH.file);
|
||||
let manifest, before;
|
||||
try {
|
||||
manifest = JSON.parse(readFileSync(join(packageDir, 'package.json'), 'utf8'));
|
||||
// Flattening must have removed links; never write through a shared source file.
|
||||
if (realpathSync(target) !== target || !lstatSync(target).isFile() || lstatSync(target).nlink !== 1)
|
||||
fail('expected an unlinked staged module');
|
||||
before = readFileSync(target);
|
||||
} catch (error) {
|
||||
fail(`cannot read a standalone staged pi-ai dependency (${error.message})`);
|
||||
}
|
||||
if (manifest?.name !== HARNESS_BUDGET_PATCH.package || manifest?.version !== HARNESS_BUDGET_PATCH.version)
|
||||
fail('expected @earendil-works/pi-ai 1.1.0; review the patch before staging a different dependency');
|
||||
if (sha256(before) !== HARNESS_BUDGET_PATCH.beforeSha256)
|
||||
fail('unexpected simple-options.js SHA-256; review the dependency source before staging');
|
||||
const source = before.toString('utf8');
|
||||
if (source.split(oldClamp).length !== 2) fail('expected exactly one known context clamp');
|
||||
const after = Buffer.from(source.replace(oldClamp, newClamp));
|
||||
writeFileSync(target, after);
|
||||
return { ...HARNESS_BUDGET_PATCH, afterSha256: sha256(after) };
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import { join, relative, resolve, sep } from 'node:path';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { flattenPnpm } from './flatten-pnpm.mjs';
|
||||
import { isOtherOsBinaryFolder, missingHarnessImports } from './harness-prune.mjs';
|
||||
import { patchStagedHarnessBudget } from './harness-budget.mjs';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const opt = (name, fallback) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : fallback; };
|
||||
@@ -144,6 +145,9 @@ function prune(dir) {
|
||||
}
|
||||
prune(out);
|
||||
|
||||
// Strata's provenance-recorded output-budget correction applies only to this copy.
|
||||
const patches = [patchStagedHarnessBudget(out)];
|
||||
|
||||
// --- licence: the MIT text and the third-party notices travel with the files ---------------------------------------------
|
||||
for (const name of ['LICENSE', 'THIRD_PARTY_NOTICES.md']) {
|
||||
if (existsSync(join(src, name))) cpSync(join(src, name), join(out, name));
|
||||
@@ -156,6 +160,7 @@ const total = size(out);
|
||||
writeFileSync(join(out, 'BUNDLE.json'), JSON.stringify({
|
||||
component: 'deepseek-harness', version: cli.version, commit, license: 'MIT', platform, node: process.version,
|
||||
bytes: total.bytes, files: total.files, entry: 'apps/cli/lib/bin.js', builtAt: new Date().toISOString(),
|
||||
patches,
|
||||
note: 'Pruned production install (pnpm deploy --prod). No package manager runs on the user\'s PC.',
|
||||
}, null, 2));
|
||||
|
||||
|
||||
Generated
+155
-1
@@ -349,6 +349,12 @@ version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder-lite"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.12.1"
|
||||
@@ -1755,6 +1761,19 @@ dependencies = [
|
||||
"icu_properties",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.25.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder-lite",
|
||||
"moxcms",
|
||||
"num-traits",
|
||||
"png 0.18.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
@@ -2097,6 +2116,20 @@ version = "0.4.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
||||
|
||||
[[package]]
|
||||
name = "mac-notification-sys"
|
||||
version = "0.6.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"log",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
"time",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "markup5ever"
|
||||
version = "0.39.0"
|
||||
@@ -2166,6 +2199,16 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "moxcms"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"pxfm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "muda"
|
||||
version = "0.20.0"
|
||||
@@ -2229,6 +2272,20 @@ version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||
|
||||
[[package]]
|
||||
name = "notify-rust"
|
||||
version = "4.18.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4587364a9a0074333429b3df75a30a205340c56a536ca3eb6ca0e59b87bbf8af"
|
||||
dependencies = [
|
||||
"futures-lite",
|
||||
"log",
|
||||
"mac-notification-sys",
|
||||
"serde",
|
||||
"tauri-winrt-notification",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.2.2"
|
||||
@@ -2757,6 +2814,15 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "precomputed-hash"
|
||||
version = "0.1.1"
|
||||
@@ -2825,6 +2891,12 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pxfm"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.42.0"
|
||||
@@ -2855,6 +2927,35 @@ version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
||||
dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.6.2"
|
||||
@@ -3524,13 +3625,14 @@ checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7"
|
||||
|
||||
[[package]]
|
||||
name = "strata-desktop"
|
||||
version = "0.2.3"
|
||||
version = "0.2.7"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-notification",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-single-instance",
|
||||
"tauri-plugin-updater",
|
||||
@@ -3755,6 +3857,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"heck 0.5.0",
|
||||
"http",
|
||||
"image",
|
||||
"jni 0.21.1",
|
||||
"libc",
|
||||
"log",
|
||||
@@ -3869,6 +3972,26 @@ dependencies = [
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-notification"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b939d7b19c8af1381a72ef8474b3aba2b56c1ddac2c23f0c8e96abbcf86b198b"
|
||||
dependencies = [
|
||||
"log",
|
||||
"notify-rust",
|
||||
"rand",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror 2.0.21",
|
||||
"time",
|
||||
"url",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-shell"
|
||||
version = "2.5.0"
|
||||
@@ -4042,6 +4165,17 @@ dependencies = [
|
||||
"toml 1.1.8+spec-1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-winrt-notification"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f37a6c354fd28fc9e322ed9bd47e3959576dad28c9d58ea1cf888cce1c7ccb36"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
"windows",
|
||||
"windows-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.27.0"
|
||||
@@ -5332,6 +5466,26 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom"
|
||||
version = "0.1.8"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "strata-desktop"
|
||||
version = "0.2.3"
|
||||
version = "0.2.7"
|
||||
description = "Strata Desktop — local AI, tuned to one model."
|
||||
edition = "2021"
|
||||
rust-version = "1.77"
|
||||
@@ -15,8 +15,10 @@ webkit2gtk = "2.0"
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri = { version = "2", features = ["tray-icon", "image-png"] }
|
||||
tauri-plugin-shell = "2"
|
||||
# Desktop notifications for an approval that waits (#3477); the tray icon above is Tauri's own.
|
||||
tauri-plugin-notification = "2"
|
||||
tauri-plugin-updater = "2"
|
||||
tauri-plugin-single-instance = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener","allow-supports-multiple-windows"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener command without any pre-configured scope.","commands":{"allow":["remove_listener"],"deny":[]}},"allow-set-app-theme":{"identifier":"allow-set-app-theme","description":"Enables the set_app_theme command without any pre-configured scope.","commands":{"allow":["set_app_theme"],"deny":[]}},"allow-set-dock-visibility":{"identifier":"allow-set-dock-visibility","description":"Enables the set_dock_visibility command without any pre-configured scope.","commands":{"allow":["set_dock_visibility"],"deny":[]}},"allow-supports-multiple-windows":{"identifier":"allow-supports-multiple-windows","description":"Enables the supports_multiple_windows command without any pre-configured scope.","commands":{"allow":["supports_multiple_windows"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-bundle-type":{"identifier":"deny-bundle-type","description":"Denies the bundle_type command without any pre-configured scope.","commands":{"allow":[],"deny":["bundle_type"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-exit":{"identifier":"deny-exit","description":"Denies the exit command without any pre-configured scope.","commands":{"allow":[],"deny":["exit"]}},"deny-fetch-data-store-identifiers":{"identifier":"deny-fetch-data-store-identifiers","description":"Denies the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":[],"deny":["fetch_data_store_identifiers"]}},"deny-identifier":{"identifier":"deny-identifier","description":"DenLine truncated
|
||||
{"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener","allow-supports-multiple-windows"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","commands":{"allow":["name"],"deny":[]}},"allow-register-listener":{"identifier":"allow-register-listener","description":"Enables the register_listener command without any pre-configured scope.","commands":{"allow":["register_listener"],"deny":[]}},"allow-remove-data-store":{"identifier":"allow-remove-data-store","description":"Enables the remove_data_store command without any pre-configured scope.","commands":{"allow":["remove_data_store"],"deny":[]}},"allow-remove-listener":{"identifier":"allow-remove-listener","description":"Enables the remove_listener command without any pre-configured scope.","commands":{"allow":["remove_listener"],"deny":[]}},"allow-set-app-theme":{"identifier":"allow-set-app-theme","description":"Enables the set_app_theme command without any pre-configured scope.","commands":{"allow":["set_app_theme"],"deny":[]}},"allow-set-dock-visibility":{"identifier":"allow-set-dock-visibility","description":"Enables the set_dock_visibility command without any pre-configured scope.","commands":{"allow":["set_dock_visibility"],"deny":[]}},"allow-supports-multiple-windows":{"identifier":"allow-supports-multiple-windows","description":"Enables the supports_multiple_windows command without any pre-configured scope.","commands":{"allow":["supports_multiple_windows"],"deny":[]}},"allow-tauri-version":{"identifier":"allow-tauri-version","description":"Enables the tauri_version command without any pre-configured scope.","commands":{"allow":["tauri_version"],"deny":[]}},"allow-version":{"identifier":"allow-version","description":"Enables the version command without any pre-configured scope.","commands":{"allow":["version"],"deny":[]}},"deny-app-hide":{"identifier":"deny-app-hide","description":"Denies the app_hide command without any pre-configured scope.","commands":{"allow":[],"deny":["app_hide"]}},"deny-app-show":{"identifier":"deny-app-show","description":"Denies the app_show command without any pre-configured scope.","commands":{"allow":[],"deny":["app_show"]}},"deny-bundle-type":{"identifier":"deny-bundle-type","description":"Denies the bundle_type command without any pre-configured scope.","commands":{"allow":[],"deny":["bundle_type"]}},"deny-default-window-icon":{"identifier":"deny-default-window-icon","description":"Denies the default_window_icon command without any pre-configured scope.","commands":{"allow":[],"deny":["default_window_icon"]}},"deny-exit":{"identifier":"deny-exit","description":"Denies the exit command without any pre-configured scope.","commands":{"allow":[],"deny":["exit"]}},"deny-fetch-data-store-identifiers":{"identifier":"deny-fetch-data-store-identifiers","description":"Denies the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":[],"deny":["fetch_data_store_identifiers"]}},"deny-identifier":{"identifier":"deny-identifier","description":"DenLine truncated
|
||||
@@ -2426,6 +2426,216 @@
|
||||
"const": "core:window:deny-unminimize",
|
||||
"markdownDescription": "Denies the unminimize command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||
"type": "string",
|
||||
"const": "notification:default",
|
||||
"markdownDescription": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the batch command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-batch",
|
||||
"markdownDescription": "Enables the batch command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the cancel command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-cancel",
|
||||
"markdownDescription": "Enables the cancel command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the check_permissions command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-check-permissions",
|
||||
"markdownDescription": "Enables the check_permissions command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the create_channel command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-create-channel",
|
||||
"markdownDescription": "Enables the create_channel command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the delete_channel command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-delete-channel",
|
||||
"markdownDescription": "Enables the delete_channel command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_active command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-get-active",
|
||||
"markdownDescription": "Enables the get_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_pending command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-get-pending",
|
||||
"markdownDescription": "Enables the get_pending command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the is_permission_granted command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-is-permission-granted",
|
||||
"markdownDescription": "Enables the is_permission_granted command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the list_channels command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-list-channels",
|
||||
"markdownDescription": "Enables the list_channels command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the notify command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-notify",
|
||||
"markdownDescription": "Enables the notify command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the permission_state command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-permission-state",
|
||||
"markdownDescription": "Enables the permission_state command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the register_action_types command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-register-action-types",
|
||||
"markdownDescription": "Enables the register_action_types command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the register_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-register-listener",
|
||||
"markdownDescription": "Enables the register_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the remove_active command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-remove-active",
|
||||
"markdownDescription": "Enables the remove_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the remove_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-remove-listener",
|
||||
"markdownDescription": "Enables the remove_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the request_permission command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-request-permission",
|
||||
"markdownDescription": "Enables the request_permission command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the show command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:allow-show",
|
||||
"markdownDescription": "Enables the show command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the batch command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-batch",
|
||||
"markdownDescription": "Denies the batch command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the cancel command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-cancel",
|
||||
"markdownDescription": "Denies the cancel command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the check_permissions command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-check-permissions",
|
||||
"markdownDescription": "Denies the check_permissions command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the create_channel command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-create-channel",
|
||||
"markdownDescription": "Denies the create_channel command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the delete_channel command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-delete-channel",
|
||||
"markdownDescription": "Denies the delete_channel command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the get_active command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-get-active",
|
||||
"markdownDescription": "Denies the get_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the get_pending command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-get-pending",
|
||||
"markdownDescription": "Denies the get_pending command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the is_permission_granted command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-is-permission-granted",
|
||||
"markdownDescription": "Denies the is_permission_granted command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the list_channels command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-list-channels",
|
||||
"markdownDescription": "Denies the list_channels command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the notify command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-notify",
|
||||
"markdownDescription": "Denies the notify command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the permission_state command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-permission-state",
|
||||
"markdownDescription": "Denies the permission_state command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the register_action_types command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-register-action-types",
|
||||
"markdownDescription": "Denies the register_action_types command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the register_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-register-listener",
|
||||
"markdownDescription": "Denies the register_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the remove_active command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-remove-active",
|
||||
"markdownDescription": "Denies the remove_active command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the remove_listener command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-remove-listener",
|
||||
"markdownDescription": "Denies the remove_listener command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the request_permission command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-request-permission",
|
||||
"markdownDescription": "Denies the request_permission command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the show command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "notification:deny-show",
|
||||
"markdownDescription": "Denies the show command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
|
||||
"type": "string",
|
||||
@@ -2491,6 +2701,60 @@
|
||||
"type": "string",
|
||||
"const": "shell:deny-stdin-write",
|
||||
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`",
|
||||
"type": "string",
|
||||
"const": "updater:default",
|
||||
"markdownDescription": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the check command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:allow-check",
|
||||
"markdownDescription": "Enables the check command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the download command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:allow-download",
|
||||
"markdownDescription": "Enables the download command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the download_and_install command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:allow-download-and-install",
|
||||
"markdownDescription": "Enables the download_and_install command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the install command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:allow-install",
|
||||
"markdownDescription": "Enables the install command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the check command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:deny-check",
|
||||
"markdownDescription": "Denies the check command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the download command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:deny-download",
|
||||
"markdownDescription": "Denies the download command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the download_and_install command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:deny-download-and-install",
|
||||
"markdownDescription": "Denies the download_and_install command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the install command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "updater:deny-install",
|
||||
"markdownDescription": "Denies the install command without any pre-configured scope."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -701,6 +701,35 @@ SectionEnd
|
||||
!macroend
|
||||
; STRATA-MIGRATE-END
|
||||
|
||||
; STRATA-STOP-BEGIN
|
||||
; Stop what Strata itself started from the install folder (the app, its host, the node runtime, the engine) before files are removed:
|
||||
; a running copy keeps its files open, so the folder stayed behind after use. Only processes whose image path is inside INSTDIR are
|
||||
; stopped; this uninstaller's own process and any program elsewhere are left alone.
|
||||
!macro StrataStopOwnProcesses INSTALLDIR
|
||||
System::Call 'kernel32::SetEnvironmentVariableW(w "STRATA_INSTDIR", w "${INSTALLDIR}")'
|
||||
System::Call 'kernel32::GetCurrentProcessId()i.r9'
|
||||
System::Call 'kernel32::SetEnvironmentVariableW(w "STRATA_SELFPID", w "$9")'
|
||||
; the installer is a 32-bit program, so plain powershell.exe is the 32-bit one, which cannot read the image path of a 64-bit process: use the 64-bit one
|
||||
StrCpy $8 "$WINDIR\Sysnative\WindowsPowerShell\v1.0\powershell.exe"
|
||||
IfFileExists $8 +2 0
|
||||
StrCpy $8 "powershell.exe"
|
||||
nsExec::Exec '"$8" -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "$$d = [IO.Path]::GetFullPath($$env:STRATA_INSTDIR).TrimEnd([char]92) + [char]92; $$ids = @(); $$ids += Get-Process -ErrorAction SilentlyContinue | Where-Object { $$_.Path -and [IO.Path]::GetFullPath($$_.Path).StartsWith($$d, [StringComparison]::OrdinalIgnoreCase) } | ForEach-Object { $$_.Id }; try { $$ids += Get-CimInstance Win32_Process -ErrorAction Stop | Where-Object { $$_.ExecutablePath -and [IO.Path]::GetFullPath($$_.ExecutablePath).StartsWith($$d, [StringComparison]::OrdinalIgnoreCase) } | ForEach-Object { $$_.ProcessId } } catch {}; $$ids | Sort-Object -Unique | Where-Object { $$_ -ne [int]$$env:STRATA_SELFPID } | ForEach-Object { Stop-Process -Id $$_ -Force -ErrorAction SilentlyContinue }; Start-Sleep -Milliseconds 1500"'
|
||||
Pop $9
|
||||
!macroend
|
||||
; STRATA-STOP-END
|
||||
|
||||
; STRATA-CLEAN-BEGIN
|
||||
; The app writes into its own folders while it runs (Python bytecode caches under control\, for one), and the file-by-file delete below does not know them,
|
||||
; so those folders stayed behind with a few dozen files. These four folders hold only what the installer put there and what the app made there;
|
||||
; user data is never in them (it lives in the data folder), and the install folder itself is still removed with a plain RMDir.
|
||||
!macro StrataRemoveAppFolders INSTALLDIR
|
||||
RMDir /r "${INSTALLDIR}\control"
|
||||
RMDir /r "${INSTALLDIR}\host"
|
||||
RMDir /r "${INSTALLDIR}\node"
|
||||
RMDir /r "${INSTALLDIR}\harness"
|
||||
!macroend
|
||||
; STRATA-CLEAN-END
|
||||
|
||||
Section Install
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
@@ -847,6 +876,7 @@ Section Uninstall
|
||||
!insertmacro NSIS_HOOK_PREUNINSTALL
|
||||
!endif
|
||||
|
||||
!insertmacro StrataStopOwnProcesses "$INSTDIR"
|
||||
!insertmacro CheckIfAppIsRunning "$INSTDIR\${MAINBINARYNAME}.exe" "${PRODUCTNAME}"
|
||||
|
||||
; Delete the app directory and its content from disk
|
||||
@@ -879,6 +909,8 @@ Section Uninstall
|
||||
{{/each}}
|
||||
|
||||
|
||||
!insertmacro StrataRemoveAppFolders "$INSTDIR"
|
||||
|
||||
; Delete uninstaller
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
|
||||
|
||||
mod updater;
|
||||
mod desktoplog;
|
||||
mod shell;
|
||||
#[cfg(target_os = "linux")]
|
||||
mod supervisor;
|
||||
|
||||
@@ -252,13 +253,24 @@ fn pick_port() -> Result<u16, String> {
|
||||
/// launch starts with empty storage, as before).
|
||||
const PREFERRED_PORT: u16 = 47831;
|
||||
|
||||
/// Set when the port the person (or the app) wanted was busy: "busy:<wanted>:<used>". The host gets it as STRATA_PORT_NOTICE and tells the
|
||||
/// person (the chats and settings saved on the page belong to the port, so a different port starts empty) (#3402).
|
||||
static PORT_NOTICE: std::sync::Mutex<Option<String>> = std::sync::Mutex::new(None);
|
||||
|
||||
fn pick_stable_port() -> Result<u16, String> {
|
||||
match TcpListener::bind(("127.0.0.1", PREFERRED_PORT)) {
|
||||
// The person may have chosen a port in Settings (shell-prefs.json); otherwise the app's usual one.
|
||||
let wanted = shell::wanted_port(&shell::read_prefs(), PREFERRED_PORT);
|
||||
*PORT_NOTICE.lock().unwrap() = None;
|
||||
match TcpListener::bind(("127.0.0.1", wanted)) {
|
||||
Ok(listener) => {
|
||||
drop(listener);
|
||||
Ok(PREFERRED_PORT)
|
||||
Ok(wanted)
|
||||
}
|
||||
Err(_) => {
|
||||
let used = pick_port()?;
|
||||
*PORT_NOTICE.lock().unwrap() = Some(shell::busy_notice(wanted, used));
|
||||
Ok(used)
|
||||
}
|
||||
Err(_) => pick_port(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,6 +481,9 @@ fn host_command(res: &Path, port: u16, shutdown_token: &str) -> Result<Command,
|
||||
.stderr(Stdio::inherit());
|
||||
apply_runtime_policy(&mut cmd, res);
|
||||
hide_console(&mut cmd);
|
||||
if let Some(notice) = PORT_NOTICE.lock().unwrap().clone() {
|
||||
cmd.env("STRATA_PORT_NOTICE", notice);
|
||||
}
|
||||
// A user with the Strata API worker on a different port sets this; unset means the worker's
|
||||
// documented loopback default.
|
||||
if let Ok(url) = std::env::var("STRATA_SERVER_URL") {
|
||||
@@ -875,6 +890,7 @@ fn run_embedded() {
|
||||
}))
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.manage(HostProcess(Mutex::new(None)))
|
||||
.manage(HostPort(Mutex::new(None)))
|
||||
.manage(ShutdownToken(Mutex::new(None)))
|
||||
@@ -901,6 +917,20 @@ fn run_embedded() {
|
||||
Ok(())
|
||||
})
|
||||
.on_window_event(|window, event| {
|
||||
// "Minimise to tray" (Settings, off by default): closing the main window hides it and keeps Strata running in the tray; Quit in the
|
||||
// tray menu ends it (#3477). If no tray could be made the window closes as before.
|
||||
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
|
||||
if window.label() == "main" {
|
||||
let prefs = shell::read_prefs();
|
||||
if prefs.tray {
|
||||
api.prevent_close();
|
||||
shell::hide_to_tray(&window.app_handle().clone(), &prefs.language);
|
||||
if !shell::tray_exists(&window.app_handle().clone()) {
|
||||
let _ = window.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let tauri::WindowEvent::Destroyed = event {
|
||||
stop_host(&window.app_handle().clone());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
//! The shell's own choices and the two things the host asks of it besides updates (#3402, #3477).
|
||||
//!
|
||||
//! `<Strata data folder>/shell-prefs.json` is written by the App Host when the person changes a setting
|
||||
//! (`apps/host/server/shell-prefs.mjs`) and read here when Strata starts, before any page exists:
|
||||
//!
|
||||
//! { "port": 0 | 1024..65535, "tray": false, "language": "en" }
|
||||
//!
|
||||
//! * `port`: the port the window's origin uses. 0 is the default, 47831. When the port is busy the shell takes a free one and tells the
|
||||
//! host (`STRATA_PORT_NOTICE=busy:<wanted>:<used>`), which shows the person a warning: the chats and settings of the page are kept per
|
||||
//! port, so a different port starts empty.
|
||||
//! * `tray`: closing the window hides it and keeps Strata running in the tray (Windows, macOS). The tray menu follows `language`.
|
||||
//! * `/shell/notify` on the loopback bridge shows a desktop notification (an approval is waiting) whether the window is open or hidden.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Prefs {
|
||||
pub port: u16,
|
||||
pub tray: bool,
|
||||
pub language: String,
|
||||
}
|
||||
|
||||
impl Default for Prefs {
|
||||
fn default() -> Self {
|
||||
Prefs { port: 0, tray: false, language: "en".into() }
|
||||
}
|
||||
}
|
||||
|
||||
pub const LANGUAGES: [&str; 8] = ["en", "zh", "ja", "de", "es", "ru", "pt", "ko"];
|
||||
|
||||
pub fn prefs_path() -> PathBuf {
|
||||
crate::desktoplog::data_dir().join("shell-prefs.json")
|
||||
}
|
||||
|
||||
/// The file's text as choices; anything missing or out of range is the default.
|
||||
pub fn parse_prefs(text: &str) -> Prefs {
|
||||
let value: Value = serde_json::from_str(text.trim_start_matches('\u{feff}')).unwrap_or(Value::Null);
|
||||
let port = value.get("port").and_then(Value::as_u64).filter(|p| (1024..=65535).contains(p)).unwrap_or(0) as u16;
|
||||
let tray = value.get("tray").and_then(Value::as_bool).unwrap_or(false);
|
||||
let language = value
|
||||
.get("language")
|
||||
.and_then(Value::as_str)
|
||||
.filter(|l| LANGUAGES.contains(l))
|
||||
.unwrap_or("en")
|
||||
.to_string();
|
||||
Prefs { port, tray, language }
|
||||
}
|
||||
|
||||
pub fn read_prefs() -> Prefs {
|
||||
std::fs::read_to_string(prefs_path()).map(|t| parse_prefs(&t)).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The port to ask for: the person's choice, else the app's usual one.
|
||||
pub fn wanted_port(prefs: &Prefs, usual: u16) -> u16 {
|
||||
if prefs.port != 0 { prefs.port } else { usual }
|
||||
}
|
||||
|
||||
/// The notice the host shows when the wanted port was taken.
|
||||
pub fn busy_notice(wanted: u16, used: u16) -> String {
|
||||
format!("busy:{wanted}:{used}")
|
||||
}
|
||||
|
||||
/// `%41%20b` -> "A b" (a query value from the host). Bad escapes are kept as typed.
|
||||
pub fn percent_decode(text: &str) -> String {
|
||||
let bytes = text.as_bytes();
|
||||
let mut out = Vec::with_capacity(bytes.len());
|
||||
let mut i = 0;
|
||||
while i < bytes.len() {
|
||||
if bytes[i] == b'%' && i + 2 < bytes.len() {
|
||||
if let Some(v) = std::str::from_utf8(&bytes[i + 1..i + 3]).ok().and_then(|h| u8::from_str_radix(h, 16).ok()) {
|
||||
out.push(v);
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
out.push(if bytes[i] == b'+' { b' ' } else { bytes[i] });
|
||||
i += 1;
|
||||
}
|
||||
String::from_utf8_lossy(&out).into_owned()
|
||||
}
|
||||
|
||||
/// The value of `key` in the query of a request path (`/shell/notify?title=..&body=..`).
|
||||
pub fn query_value(path: &str, key: &str) -> Option<String> {
|
||||
let query = path.split_once('?')?.1;
|
||||
query.split('&').find_map(|pair| {
|
||||
let (k, v) = pair.split_once('=')?;
|
||||
(k == key).then(|| percent_decode(v))
|
||||
})
|
||||
}
|
||||
|
||||
/// A short single-line text for a notification: no control characters, bounded.
|
||||
pub fn clean_text(text: &str, max: usize) -> String {
|
||||
text.chars().filter(|c| !c.is_control()).take(max).collect::<String>().trim().to_string()
|
||||
}
|
||||
|
||||
/// The tray menu: (open, quit, tooltip), in the app's language.
|
||||
pub fn tray_labels(language: &str) -> (&'static str, &'static str, &'static str) {
|
||||
match language {
|
||||
"zh" => ("打开 Strata", "退出 Strata", "Strata"),
|
||||
"ja" => ("Strata を開く", "Strata を終了", "Strata"),
|
||||
"de" => ("Strata öffnen", "Strata beenden", "Strata"),
|
||||
"es" => ("Abrir Strata", "Salir de Strata", "Strata"),
|
||||
"ru" => ("Открыть Strata", "Выйти из Strata", "Strata"),
|
||||
"pt" => ("Abrir o Strata", "Sair do Strata", "Strata"),
|
||||
"ko" => ("Strata 열기", "Strata 종료", "Strata"),
|
||||
_ => ("Open Strata", "Quit Strata", "Strata"),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
mod native {
|
||||
use tauri::menu::{Menu, MenuItem};
|
||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tauri_plugin_notification::NotificationExt;
|
||||
|
||||
const TRAY_ID: &str = "strata-tray";
|
||||
|
||||
fn show_main(app: &AppHandle) {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.unminimize();
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}
|
||||
|
||||
/// Hide the window and keep Strata running in the tray (made on the first need, with the menu in the app's language).
|
||||
pub fn hide_to_tray(app: &AppHandle, language: &str) {
|
||||
if app.tray_by_id(TRAY_ID).is_none() {
|
||||
let (open, quit, tip) = super::tray_labels(language);
|
||||
let built = (|| -> tauri::Result<()> {
|
||||
let open_item = MenuItem::with_id(app, "open", open, true, None::<&str>)?;
|
||||
let quit_item = MenuItem::with_id(app, "quit", quit, true, None::<&str>)?;
|
||||
let menu = Menu::with_items(app, &[&open_item, &quit_item])?;
|
||||
let mut builder = TrayIconBuilder::with_id(TRAY_ID)
|
||||
.tooltip(tip)
|
||||
.menu(&menu)
|
||||
.show_menu_on_left_click(false)
|
||||
.on_menu_event(|app, event| match event.id().as_ref() {
|
||||
"open" => show_main(app),
|
||||
"quit" => app.exit(0),
|
||||
_ => {}
|
||||
})
|
||||
.on_tray_icon_event(|tray, event| {
|
||||
if let TrayIconEvent::Click { button: MouseButton::Left, button_state: MouseButtonState::Up, .. } = event {
|
||||
show_main(tray.app_handle());
|
||||
}
|
||||
});
|
||||
if let Some(icon) = app.default_window_icon() {
|
||||
builder = builder.icon(icon.clone());
|
||||
}
|
||||
builder.build(app)?;
|
||||
Ok(())
|
||||
})();
|
||||
if built.is_err() {
|
||||
// No tray could be made (a desktop without one): do not hide a window nobody could bring back.
|
||||
return;
|
||||
}
|
||||
}
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tray_exists(app: &AppHandle) -> bool {
|
||||
app.tray_by_id(TRAY_ID).is_some()
|
||||
}
|
||||
|
||||
/// Show a desktop notification; a hidden or minimised window also asks for attention (the taskbar button flashes).
|
||||
pub fn notify(app: &AppHandle, title: &str, body: &str) -> bool {
|
||||
if title.is_empty() {
|
||||
return false;
|
||||
}
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let hidden = !window.is_visible().unwrap_or(true) || window.is_minimized().unwrap_or(false);
|
||||
if hidden {
|
||||
let _ = window.request_user_attention(Some(tauri::UserAttentionType::Informational));
|
||||
}
|
||||
}
|
||||
app.notification().builder().title(title).body(body).show().is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
pub use native::{hide_to_tray, notify, tray_exists};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn the_file_gives_choices_and_anything_wrong_is_the_default() {
|
||||
assert_eq!(parse_prefs(""), Prefs::default());
|
||||
assert_eq!(parse_prefs("{ not json"), Prefs::default());
|
||||
let p = parse_prefs(r#"{"port":47900,"tray":true,"language":"de"}"#);
|
||||
assert_eq!((p.port, p.tray, p.language.as_str()), (47900, true, "de"));
|
||||
assert_eq!(parse_prefs("\u{feff}{\"port\":47900}").port, 47900);
|
||||
assert_eq!(parse_prefs(r#"{"port":80}"#).port, 0, "a port below 1024 is not used");
|
||||
assert_eq!(parse_prefs(r#"{"port":70000}"#).port, 0);
|
||||
assert_eq!(parse_prefs(r#"{"port":"47831"}"#).port, 0, "a text is not a number");
|
||||
assert_eq!(parse_prefs(r#"{"tray":"yes","language":"xx"}"#), Prefs::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_wanted_port_is_the_choice_or_the_usual_one() {
|
||||
assert_eq!(wanted_port(&Prefs::default(), 47831), 47831);
|
||||
assert_eq!(wanted_port(&Prefs { port: 47900, ..Prefs::default() }, 47831), 47900);
|
||||
assert_eq!(busy_notice(47831, 51234), "busy:47831:51234");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn query_values_are_decoded_and_bounded() {
|
||||
let path = "/shell/notify?title=Strata%20needs%20your%20answer&body=a%20%26%20b%3F+ok";
|
||||
assert_eq!(query_value(path, "title").as_deref(), Some("Strata needs your answer"));
|
||||
assert_eq!(query_value(path, "body").as_deref(), Some("a & b? ok"));
|
||||
assert_eq!(query_value(path, "missing"), None);
|
||||
assert_eq!(query_value("/shell/notify", "title"), None);
|
||||
assert_eq!(percent_decode("100%"), "100%");
|
||||
assert_eq!(percent_decode("%zz%41"), "%zzA");
|
||||
assert_eq!(percent_decode("%C3%A4"), "ä");
|
||||
assert_eq!(clean_text("a\nb\u{7}c", 10), "abc");
|
||||
assert_eq!(clean_text("abcdef", 3), "abc");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_language_has_tray_labels() {
|
||||
for language in LANGUAGES {
|
||||
let (open, quit, tip) = tray_labels(language);
|
||||
assert!(!open.is_empty() && !quit.is_empty() && !tip.is_empty(), "{language}");
|
||||
if language != "en" {
|
||||
assert_ne!(open, tray_labels("en").0, "{language}");
|
||||
}
|
||||
}
|
||||
assert_eq!(tray_labels("xx"), tray_labels("en"));
|
||||
}
|
||||
}
|
||||
@@ -210,6 +210,16 @@ fn handle(mut stream: TcpStream, app: &AppHandle, token: &str, progress: &Arc<Mu
|
||||
respond(&mut stream, "202 Accepted", &progress.lock().unwrap().json());
|
||||
}
|
||||
("GET", "/app-update/status") => respond(&mut stream, "200 OK", &progress.lock().unwrap().json()),
|
||||
// The host asks for a desktop notification (an approval is waiting): title and body are in the query, bounded and cleaned here.
|
||||
("POST", p) if p.starts_with("/shell/notify") => {
|
||||
let title = crate::shell::clean_text(&crate::shell::query_value(p, "title").unwrap_or_default(), 120);
|
||||
let body = crate::shell::clean_text(&crate::shell::query_value(p, "body").unwrap_or_default(), 300);
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let shown = crate::shell::notify(app, &title, &body);
|
||||
#[cfg(target_os = "linux")]
|
||||
let shown = false;
|
||||
respond(&mut stream, "200 OK", &serde_json::json!({ "shown": shown }))
|
||||
}
|
||||
_ => respond(&mut stream, "404 Not Found", &serde_json::json!({ "error": "unknown route" })),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,3 +10,15 @@ npm run preview:ui
|
||||
The built UI is included. To rebuild after source edits, run `npm run build`. `preview:ui` uses isolated simulated data; `npm run dev` connects the normal host.
|
||||
|
||||
The previous project README is retained in [docs/README-historical.md](docs/README-historical.md). It contains older implementation status and is historical reference.
|
||||
|
||||
## Languages
|
||||
|
||||
The app speaks English, Chinese, Japanese, German, French, Spanish, Russian, Portuguese and Korean. The English text is the key: `src/locales/en.json`
|
||||
(with `fix-en.json`, `tune-en.json` and `tools-en.json`) holds every string, and each language has the same four files (`fr.json`, `fix-fr.json`, ...).
|
||||
|
||||
- **A new string.** Write it with `tr("...")`, then add it to the English catalog (`node scripts/append-localization.mjs`, or the next `fx` number in
|
||||
`scripts/make-fix-locales.py`). The language tests fail until every language has it.
|
||||
- **French.** `python scripts/fr_sync.py missing todo.tsv` lists the English strings that have no French yet, one per line (`id`, a tab, the text).
|
||||
Translate the second column ("vous", short plain words, one next step; a lone `=` keeps the English), then `python scripts/fr_sync.py apply todo.tsv` merges it
|
||||
(it also sets the French spacing before `: ; ? !` and the typographic apostrophe) and `python scripts/fr_sync.py check` confirms nothing is missing.
|
||||
- **Screenshots in a language.** `npm run build`, then `node scripts/language-shots.mjs fr <folder> models settings setup` (hermetic preview host, scratch profile, headless Chrome).
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "strata",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "strata",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.7",
|
||||
"dependencies": {
|
||||
"html-to-image": "^1.11.13",
|
||||
"katex": "^0.19.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "strata",
|
||||
"private": true,
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.7",
|
||||
"type": "module",
|
||||
"description": "Strata \u2014 local AI, tuned to one model. Web shell + engine host.",
|
||||
"scripts": {
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,156 @@
|
||||
"""French (fr) catalog tooling for the desktop app (#3970).
|
||||
|
||||
The French texts live in src/locales/fr.json, fix-fr.json, tune-fr.json and tools-fr.json, next to the other languages.
|
||||
They are edited by hand (they are the translations, not generated), so a string added to an English catalog later has no
|
||||
French yet. This script lists and merges those. From apps/host:
|
||||
|
||||
python scripts/fr_sync.py missing [out.tsv] write every English string that has no French yet
|
||||
python scripts/fr_sync.py apply done.tsv merge translations, rewrite the four fr files in English key order
|
||||
python scripts/fr_sync.py check exit 1 if a French string is missing, empty or breaks a placeholder / tag
|
||||
|
||||
The TSV has one string per line: <id><TAB><text>. In the text, a newline is written \\n and a backslash \\\\.
|
||||
In the "done" file a lone = means "keep the English text as it is" (class names, product names, file names).
|
||||
The id prefix picks the file: s0001 -> fr.json, fx01 -> fix-fr.json, tune01 -> tune-fr.json, tl01 -> tools-fr.json.
|
||||
Use "vous", plain short words, a next step, and a no-break space (U+00A0) before : ; ? ! and inside guillemets.
|
||||
"""
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
LOCALES = Path(__file__).resolve().parent.parent / "src" / "locales"
|
||||
PAIRS = [("en.json", "fr.json"), ("fix-en.json", "fix-fr.json"), ("tune-en.json", "tune-fr.json"), ("tools-en.json", "tools-fr.json")]
|
||||
SLOT = re.compile(r"\{\d+\}")
|
||||
TAG = re.compile(r"</?[A-Za-z][^>]*>")
|
||||
|
||||
|
||||
def load(name):
|
||||
path = LOCALES / name
|
||||
return json.loads(path.read_text(encoding="utf-8")) if path.exists() else {}
|
||||
|
||||
|
||||
def file_of(identifier):
|
||||
for en_name, fr_name in PAIRS:
|
||||
if identifier in load(en_name):
|
||||
return fr_name
|
||||
raise SystemExit(f"unknown id {identifier}: it is in no English catalog")
|
||||
|
||||
|
||||
def escape(text):
|
||||
return text.replace("\\", "\\\\").replace("\n", "\\n")
|
||||
|
||||
|
||||
def unescape(text):
|
||||
out, i = [], 0
|
||||
while i < len(text):
|
||||
if text[i] == "\\" and i + 1 < len(text):
|
||||
out.append({"n": "\n", "\\": "\\"}.get(text[i + 1], text[i + 1]))
|
||||
i += 2
|
||||
else:
|
||||
out.append(text[i])
|
||||
i += 1
|
||||
return "".join(out)
|
||||
|
||||
|
||||
NBSP = " "
|
||||
|
||||
|
||||
def typography(text):
|
||||
"""French spacing and apostrophes, applied to every translated (not kept) string.
|
||||
l'image -> l'image with a typographic apostrophe (also before a {0} slot); a no-break space before : ; ? ! % and inside the guillemets."""
|
||||
text = re.sub(r"(?<=[A-Za-zÀ-ſ])'(?=[A-Za-zÀ-ſ{])", "’", text)
|
||||
text = re.sub(r"(?<=\S) ([:;?!])", NBSP + r"\1", text)
|
||||
text = re.sub(r"(?<=[\d}]) %", NBSP + "%", text)
|
||||
text = re.sub("« ?", "«" + NBSP, text)
|
||||
text = re.sub(" ?»", NBSP + "»", text)
|
||||
return text
|
||||
|
||||
|
||||
def problems(identifier, source, text):
|
||||
found = []
|
||||
if not text.strip():
|
||||
found.append("empty")
|
||||
expected = [slot for slot in SLOT.findall(source) if not (identifier == "s2463" and slot == "{1}")] # the tests allow this one to drop {1} (the plural suffix)
|
||||
if sorted(expected) != sorted(SLOT.findall(text)):
|
||||
found.append("placeholders differ")
|
||||
if sorted(TAG.findall(source)) != sorted(TAG.findall(text)):
|
||||
found.append("markup differs")
|
||||
return found
|
||||
|
||||
|
||||
def missing():
|
||||
todo = {}
|
||||
for en_name, fr_name in PAIRS:
|
||||
en, fr = load(en_name), load(fr_name)
|
||||
for identifier, text in en.items():
|
||||
if identifier not in fr:
|
||||
todo[identifier] = text
|
||||
return todo
|
||||
|
||||
|
||||
def main(argv):
|
||||
command = argv[1] if len(argv) > 1 else ""
|
||||
if command == "missing":
|
||||
todo = missing()
|
||||
lines = [f"{identifier}\t{escape(text)}" for identifier, text in todo.items()]
|
||||
if len(argv) > 2:
|
||||
Path(argv[2]).write_text("\n".join(lines) + ("\n" if lines else ""), encoding="utf-8")
|
||||
print(f"{len(lines)} strings without French written to {argv[2]}")
|
||||
else:
|
||||
print("\n".join(lines))
|
||||
print(f"{len(lines)} strings without French", file=sys.stderr)
|
||||
return 0
|
||||
if command == "apply" and len(argv) > 2:
|
||||
incoming = {}
|
||||
for number, line in enumerate(Path(argv[2]).read_text(encoding="utf-8").splitlines(), 1):
|
||||
if not line.strip():
|
||||
continue
|
||||
if "\t" not in line:
|
||||
raise SystemExit(f"{argv[2]}:{number}: no tab")
|
||||
identifier, text = line.split("\t", 1)
|
||||
incoming[identifier.strip()] = text
|
||||
bad = 0
|
||||
for en_name, fr_name in PAIRS:
|
||||
en, fr = load(en_name), load(fr_name)
|
||||
changed = False
|
||||
for identifier, source in en.items():
|
||||
if identifier in incoming:
|
||||
text = source if incoming[identifier] == "=" else typography(unescape(incoming[identifier]))
|
||||
for why in problems(identifier, source, text):
|
||||
print(f"{identifier}: {why}: {source!r} -> {text!r}")
|
||||
bad += 1
|
||||
fr[identifier] = text
|
||||
changed = True
|
||||
if changed:
|
||||
ordered = {identifier: fr[identifier] for identifier in en if identifier in fr}
|
||||
(LOCALES / fr_name).write_text(json.dumps(ordered, ensure_ascii=False, indent=1 if en_name != "en.json" else 2) + "\n", encoding="utf-8")
|
||||
unknown = [identifier for identifier in incoming if not any(identifier in load(en_name) for en_name, _ in PAIRS)]
|
||||
for identifier in unknown:
|
||||
print(f"{identifier}: not in any English catalog")
|
||||
bad += 1
|
||||
print(f"applied {len(incoming)} strings, {bad} problems")
|
||||
return 1 if bad else 0
|
||||
if command == "check":
|
||||
bad = 0
|
||||
for en_name, fr_name in PAIRS:
|
||||
en, fr = load(en_name), load(fr_name)
|
||||
for identifier, source in en.items():
|
||||
if identifier not in fr:
|
||||
print(f"{fr_name}: {identifier} has no French yet: {source!r}")
|
||||
bad += 1
|
||||
continue
|
||||
for why in problems(identifier, source, fr[identifier]):
|
||||
print(f"{fr_name}: {identifier}: {why}")
|
||||
bad += 1
|
||||
for identifier in fr:
|
||||
if identifier not in en:
|
||||
print(f"{fr_name}: {identifier} is not in {en_name}")
|
||||
bad += 1
|
||||
print("French catalogs complete" if not bad else f"{bad} problems")
|
||||
return 1 if bad else 0
|
||||
print(__doc__)
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv))
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Screenshots of the app screens in one interface language, from a hermetic preview host (simulated hardware and models,
|
||||
* scratch profile, no engine, no weights). The browser is a throw-away headless Chrome profile.
|
||||
*
|
||||
* node scripts/language-shots.mjs <lang> <outDir> [route ...] (needs `npm run build` first)
|
||||
* example: node scripts/language-shots.mjs fr C:/Users/me/Desktop/fr-screens models settings setup
|
||||
*
|
||||
* Env: CHROME (path to Chrome/Edge), WIDTH (default 1280), HEIGHT (default 800).
|
||||
*/
|
||||
import { spawn } from 'node:child_process';
|
||||
import { chromium } from 'playwright-core';
|
||||
import { existsSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join, resolve } from 'node:path';
|
||||
|
||||
const root = resolve(import.meta.dirname, '..');
|
||||
const [, , language = 'fr', outDir = 'language-shots', ...routes] = process.argv;
|
||||
const screens = routes.length ? routes : ['models', 'settings', 'setup'];
|
||||
if (!existsSync(join(root, 'dist/index.html'))) { console.error('Run npm run build first.'); process.exit(1); }
|
||||
const chrome = process.env.CHROME ?? ['C:/Program Files/Google/Chrome/Application/chrome.exe', 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe', '/usr/bin/google-chrome', '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'].find(existsSync);
|
||||
if (!chrome) { console.error('No Chrome or Edge found; set CHROME.'); process.exit(1); }
|
||||
|
||||
const home = mkdtempSync(join(tmpdir(), 'strata-language-shots-'));
|
||||
const hostPort = 8830 + Math.floor(Math.random() * 40), webPort = hostPort + 100;
|
||||
const scratch = { STRATA_HOME: home, STRATA_MODELS_DIR: join(home, 'models'), STRATA_WORKSPACE: home, STRATA_REAL_ENGINE: '0', STRATA_NATIVE_REPO: join(home, 'no-native-installation'),
|
||||
STRATA_SETTINGS_FILE: join(home, 'app-settings.json'), STRATA_COMPONENTS_DIR: join(home, 'components'), LOCALAPPDATA: join(home, 'Local'), APPDATA: join(home, 'Roaming'),
|
||||
XDG_DATA_HOME: join(home, 'xdg-data'), XDG_STATE_HOME: join(home, 'xdg-state'), XDG_CONFIG_HOME: join(home, 'xdg-config'), STRATA_PORT: String(hostPort) };
|
||||
const children = [];
|
||||
const run = (args, extra = {}) => { const child = spawn(process.execPath, args, { cwd: root, env: { ...process.env, ...scratch, ...extra }, stdio: 'ignore' }); children.push(child); return child; };
|
||||
const stop = () => { for (const child of children) { try { child.kill(); } catch {} } try { rmSync(home, { recursive: true, force: true }); } catch {} };
|
||||
process.on('exit', stop);
|
||||
|
||||
run(['server/index.mjs']);
|
||||
for (let attempt = 0; ; attempt++) {
|
||||
try { if ((await fetch(`http://127.0.0.1:${hostPort}/api/health`)).ok) break; } catch {}
|
||||
if (attempt > 200) { console.error('The preview host did not start.'); process.exit(1); }
|
||||
await new Promise(done => setTimeout(done, 150));
|
||||
}
|
||||
run(['tests/fixtures/onboarding-ui-host.mjs'], { STRATA_UI_PREVIEW: '1', STRATA_ONBOARDING_UPSTREAM: `http://127.0.0.1:${hostPort}`, STRATA_ONBOARDING_PORT: String(webPort), STRATA_ONBOARDING_START: 'ready', STRATA_ONBOARDING_SCENARIO: 'telemetry', STRATA_ONBOARDING_PREVIEW: '1' });
|
||||
for (let attempt = 0; ; attempt++) {
|
||||
try { if ((await fetch(`http://127.0.0.1:${webPort}/`)).ok) break; } catch {}
|
||||
if (attempt > 200) { console.error('The preview page did not start.'); process.exit(1); }
|
||||
await new Promise(done => setTimeout(done, 150));
|
||||
}
|
||||
|
||||
mkdirSync(resolve(outDir), { recursive: true });
|
||||
const browser = await chromium.launch({ executablePath: chrome, headless: true, args: ['--no-sandbox', '--disable-gpu', '--force-device-scale-factor=1'] });
|
||||
const page = await browser.newPage({ viewport: { width: Number(process.env.WIDTH ?? 1280), height: Number(process.env.HEIGHT ?? 800) }, deviceScaleFactor: 1 });
|
||||
await page.addInitScript(code => { try { localStorage.setItem('strata.prefs.v2', JSON.stringify({ language: code, onboardingSeen: true })); } catch {} }, language);
|
||||
const problems = [];
|
||||
page.on('pageerror', error => problems.push(`pageerror: ${error.message}`));
|
||||
for (const screen of screens) {
|
||||
await page.goto(`http://127.0.0.1:${webPort}/#/${screen}`, { waitUntil: 'load' });
|
||||
await page.reload({ waitUntil: 'load' });
|
||||
await page.waitForTimeout(2500);
|
||||
const file = join(resolve(outDir), `${language}-${screen}.png`);
|
||||
await page.screenshot({ path: file });
|
||||
console.log(`${screen}: ${file} (lang=${await page.evaluate(() => document.documentElement.lang)})`);
|
||||
}
|
||||
await browser.close();
|
||||
if (problems.length) console.log(problems.join('\n'));
|
||||
stop();
|
||||
process.exit(0);
|
||||
@@ -0,0 +1,385 @@
|
||||
"""Writes src/locales/fix-<lang>.json: the interface strings that had no key in the locale files (#3479, #3825) and the strings of the 0.2.4.3 bug fixes.
|
||||
Run from apps/host: python scripts/make-fix-locales.py
|
||||
The keys are fx01.. in this order; fix-en.json is the English source. Placeholders ({0}, {1}) must be kept in every language."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
EN = [
|
||||
"will stop running and be removed.",
|
||||
"Downloaded, not loaded. Open Models to load it.",
|
||||
"{0} lines added, {1} removed",
|
||||
"Edited {0} files",
|
||||
"Drop files to add them",
|
||||
"Pictures and text files",
|
||||
"Keep goal",
|
||||
"Remove goal",
|
||||
"The assistant stops working towards it. Your chat and files stay as they are.",
|
||||
"This model can read pictures, but the engine installed here does not include the picture reader yet, so Read pictures is off. Update the engine in Settings → About to turn it on.",
|
||||
"Showing the values of your tuning '{0}'.",
|
||||
"Your tuning '{0}' sets",
|
||||
"was {0}",
|
||||
"· {0} RAM",
|
||||
"The message was not cancelled",
|
||||
"Extra settings for the program",
|
||||
"Draft it with AI",
|
||||
"Thinking time",
|
||||
"Writing time",
|
||||
"tokens/s",
|
||||
"% of context",
|
||||
"This page asks for files from the internet, which the preview does not load, so it may look incomplete. View code shows exactly what was written.",
|
||||
"Keep A",
|
||||
"Keep B",
|
||||
"Took",
|
||||
"Variation",
|
||||
"Changed",
|
||||
"Nothing",
|
||||
"Both versions are ready. Compare A and B, then keep one.",
|
||||
"The assistant is still answering",
|
||||
"Send your message when it has finished.",
|
||||
"The message was not queued",
|
||||
"Scroll to the latest message",
|
||||
"Remove task",
|
||||
"Start a new conversation; keep this one",
|
||||
"Have the assistant write a plan first; nothing runs until you approve it",
|
||||
"Search the web, read the pages and answer with sources",
|
||||
"Copied",
|
||||
"Response",
|
||||
"Message",
|
||||
"PDF added",
|
||||
"Select the text and copy it with Ctrl+C.",
|
||||
"{0} is in this chat. Ask about it in your next message.",
|
||||
]
|
||||
|
||||
T = {
|
||||
"zh": [
|
||||
"将停止运行并被移除。",
|
||||
"已下载,尚未加载。打开“模型”页面来加载它。",
|
||||
"新增 {0} 行,删除 {1} 行",
|
||||
"已编辑 {0} 个文件",
|
||||
"拖放文件即可添加",
|
||||
"图片和文本文件",
|
||||
"保留目标",
|
||||
"移除目标",
|
||||
"助手将不再朝这个目标工作。你的对话和文件保持不变。",
|
||||
"此模型可以读取图片,但这里安装的引擎还不包含图片读取器,所以“读取图片”已关闭。请在“设置 → 关于”中更新引擎后再开启。",
|
||||
"显示你的调优“{0}”的取值。",
|
||||
"你的调优“{0}”设置了",
|
||||
"原为 {0}",
|
||||
"· {0} 内存",
|
||||
"消息没有被取消",
|
||||
"程序的额外设置",
|
||||
"用 AI 起草",
|
||||
"思考时间",
|
||||
"写作时间",
|
||||
"词元/秒",
|
||||
"% 的上下文",
|
||||
"此页面需要从互联网加载文件,预览不会加载这些文件,所以看起来可能不完整。“查看代码”会显示实际写入的内容。",
|
||||
"保留 A",
|
||||
"保留 B",
|
||||
"用时",
|
||||
"波动",
|
||||
"已更改",
|
||||
"无",
|
||||
"两个版本都已就绪。比较 A 和 B,然后保留其中一个。",
|
||||
"助手仍在回答",
|
||||
"等它回答完再发送你的消息。",
|
||||
"消息没有进入队列",
|
||||
"滚动到最新消息",
|
||||
"移除任务",
|
||||
"开始新对话;保留当前这个",
|
||||
"让助手先写一份计划;在你批准之前不会运行任何内容",
|
||||
"搜索网络、阅读网页,并附上来源作答",
|
||||
"已复制",
|
||||
"回复",
|
||||
"消息",
|
||||
"已添加 PDF",
|
||||
"请选中文字,然后按 Ctrl+C 复制。",
|
||||
"{0} 已在此对话中。请在下一条消息里询问它。",
|
||||
],
|
||||
"ja": [
|
||||
"は停止され、削除されます。",
|
||||
"ダウンロード済みですが、読み込まれていません。「モデル」を開いて読み込んでください。",
|
||||
"{0} 行追加、{1} 行削除",
|
||||
"{0} 個のファイルを編集しました",
|
||||
"ファイルをドロップして追加",
|
||||
"画像とテキストファイル",
|
||||
"目標を残す",
|
||||
"目標を削除",
|
||||
"アシスタントはこの目標に向けた作業をやめます。チャットとファイルはそのまま残ります。",
|
||||
"このモデルは画像を読めますが、ここにインストールされているエンジンにはまだ画像リーダーが含まれていないため、「画像を読む」はオフです。設定 → 情報 でエンジンを更新するとオンにできます。",
|
||||
"チューニング「{0}」の値を表示しています。",
|
||||
"チューニング「{0}」が設定する項目",
|
||||
"変更前: {0}",
|
||||
"· {0} RAM",
|
||||
"メッセージはキャンセルされませんでした",
|
||||
"プログラムの追加設定",
|
||||
"AI で下書きを作成",
|
||||
"思考時間",
|
||||
"執筆時間",
|
||||
"トークン/秒",
|
||||
"% のコンテキスト",
|
||||
"このページはインターネット上のファイルを必要としますが、プレビューでは読み込まれないため、表示が不完全になることがあります。「コードを表示」で書かれた内容をそのまま確認できます。",
|
||||
"A を残す",
|
||||
"B を残す",
|
||||
"所要時間",
|
||||
"ばらつき",
|
||||
"変更点",
|
||||
"なし",
|
||||
"両方のバージョンの準備ができました。A と B を比べて、どちらかを残してください。",
|
||||
"アシスタントはまだ回答中です",
|
||||
"回答が終わってからメッセージを送ってください。",
|
||||
"メッセージは待機列に入りませんでした",
|
||||
"最新のメッセージへスクロール",
|
||||
"タスクを削除",
|
||||
"新しい会話を始めます。今の会話は残ります",
|
||||
"アシスタントにまず計画を書かせます。承認するまで何も実行されません",
|
||||
"ウェブを検索し、ページを読み、出典付きで回答します",
|
||||
"コピーしました",
|
||||
"返信",
|
||||
"メッセージ",
|
||||
"PDF を追加しました",
|
||||
"テキストを選択して Ctrl+C でコピーしてください。",
|
||||
"{0} をこのチャットに追加しました。次のメッセージで質問してください。",
|
||||
],
|
||||
"de": [
|
||||
"wird nicht mehr ausgeführt und entfernt.",
|
||||
"Heruntergeladen, aber nicht geladen. Öffne „Modelle“, um es zu laden.",
|
||||
"{0} Zeilen hinzugefügt, {1} entfernt",
|
||||
"{0} Dateien bearbeitet",
|
||||
"Dateien hier ablegen, um sie hinzuzufügen",
|
||||
"Bilder und Textdateien",
|
||||
"Ziel behalten",
|
||||
"Ziel entfernen",
|
||||
"Der Assistent arbeitet nicht mehr darauf hin. Dein Chat und deine Dateien bleiben unverändert.",
|
||||
"Dieses Modell kann Bilder lesen, aber die hier installierte Engine enthält den Bildleser noch nicht, deshalb ist „Bilder lesen“ aus. Aktualisiere die Engine unter Einstellungen → Info, um es einzuschalten.",
|
||||
"Zeigt die Werte deiner Abstimmung „{0}“.",
|
||||
"Deine Abstimmung „{0}“ setzt",
|
||||
"war {0}",
|
||||
"· {0} RAM",
|
||||
"Die Nachricht wurde nicht abgebrochen",
|
||||
"Zusätzliche Einstellungen für das Programm",
|
||||
"Mit KI entwerfen",
|
||||
"Denkzeit",
|
||||
"Schreibzeit",
|
||||
"Token/s",
|
||||
"% des Kontexts",
|
||||
"Diese Seite lädt Dateien aus dem Internet, was die Vorschau nicht tut. Sie kann deshalb unvollständig aussehen. „Code anzeigen“ zeigt genau, was geschrieben wurde.",
|
||||
"A behalten",
|
||||
"B behalten",
|
||||
"Dauer",
|
||||
"Schwankung",
|
||||
"Geändert",
|
||||
"Nichts",
|
||||
"Beide Versionen sind fertig. Vergleiche A und B und behalte eine.",
|
||||
"Der Assistent antwortet noch",
|
||||
"Sende deine Nachricht, wenn er fertig ist.",
|
||||
"Die Nachricht wurde nicht eingereiht",
|
||||
"Zur neuesten Nachricht scrollen",
|
||||
"Aufgabe entfernen",
|
||||
"Neue Unterhaltung beginnen; diese bleibt erhalten",
|
||||
"Der Assistent schreibt zuerst einen Plan; nichts läuft, bis du ihn freigibst",
|
||||
"Im Web suchen, die Seiten lesen und mit Quellen antworten",
|
||||
"Kopiert",
|
||||
"Antwort",
|
||||
"Nachricht",
|
||||
"PDF hinzugefügt",
|
||||
"Markiere den Text und kopiere ihn mit Strg+C.",
|
||||
"{0} ist in diesem Chat. Frag in deiner nächsten Nachricht danach.",
|
||||
],
|
||||
"es": [
|
||||
"dejará de ejecutarse y se eliminará.",
|
||||
"Descargado, pero no cargado. Abre Modelos para cargarlo.",
|
||||
"{0} líneas añadidas, {1} eliminadas",
|
||||
"{0} archivos editados",
|
||||
"Suelta los archivos para añadirlos",
|
||||
"Imágenes y archivos de texto",
|
||||
"Mantener el objetivo",
|
||||
"Quitar el objetivo",
|
||||
"El asistente deja de trabajar en ello. Tu chat y tus archivos se quedan como están.",
|
||||
"Este modelo puede leer imágenes, pero el motor instalado aquí aún no incluye el lector de imágenes, así que Leer imágenes está desactivado. Actualiza el motor en Ajustes → Acerca de para activarlo.",
|
||||
"Se muestran los valores de tu ajuste «{0}».",
|
||||
"Tu ajuste «{0}» establece",
|
||||
"antes {0}",
|
||||
"· {0} de RAM",
|
||||
"El mensaje no se canceló",
|
||||
"Ajustes adicionales del programa",
|
||||
"Redactar con IA",
|
||||
"Tiempo de pensar",
|
||||
"Tiempo de escribir",
|
||||
"tokens/s",
|
||||
"% del contexto",
|
||||
"Esta página pide archivos de internet, que la vista previa no carga, así que puede verse incompleta. Ver código muestra exactamente lo que se escribió.",
|
||||
"Mantener A",
|
||||
"Mantener B",
|
||||
"Tardó",
|
||||
"Variación",
|
||||
"Cambiado",
|
||||
"Nada",
|
||||
"Las dos versiones están listas. Compara A y B y quédate con una.",
|
||||
"El asistente sigue respondiendo",
|
||||
"Envía tu mensaje cuando termine.",
|
||||
"El mensaje no se puso en cola",
|
||||
"Ir al último mensaje",
|
||||
"Quitar tarea",
|
||||
"Empieza una conversación nueva; esta se conserva",
|
||||
"El asistente escribe primero un plan; no se ejecuta nada hasta que lo apruebes",
|
||||
"Busca en la web, lee las páginas y responde con fuentes",
|
||||
"Copiado",
|
||||
"Respuesta",
|
||||
"Mensaje",
|
||||
"PDF añadido",
|
||||
"Selecciona el texto y cópialo con Ctrl+C.",
|
||||
"{0} está en este chat. Pregunta por él en tu próximo mensaje.",
|
||||
],
|
||||
"ru": [
|
||||
"перестанет работать и будет удалена.",
|
||||
"Скачана, но не загружена. Откройте «Модели», чтобы загрузить её.",
|
||||
"Добавлено строк: {0}, удалено: {1}",
|
||||
"Изменено файлов: {0}",
|
||||
"Перетащите файлы сюда, чтобы добавить",
|
||||
"Картинки и текстовые файлы",
|
||||
"Оставить цель",
|
||||
"Удалить цель",
|
||||
"Ассистент перестанет работать над ней. Ваш чат и файлы останутся как есть.",
|
||||
"Эта модель умеет читать картинки, но установленный здесь движок пока не содержит модуль чтения картинок, поэтому «Читать картинки» выключено. Обновите движок в разделе «Настройки → О программе», чтобы включить.",
|
||||
"Показаны значения вашей настройки «{0}».",
|
||||
"Ваша настройка «{0}» задаёт",
|
||||
"было {0}",
|
||||
"· {0} ОЗУ",
|
||||
"Сообщение не было отменено",
|
||||
"Дополнительные настройки программы",
|
||||
"Набросать с помощью ИИ",
|
||||
"Время размышления",
|
||||
"Время написания",
|
||||
"токенов/с",
|
||||
"% контекста",
|
||||
"Эта страница запрашивает файлы из интернета, а предпросмотр их не загружает, поэтому она может выглядеть неполной. «Показать код» показывает, что именно было написано.",
|
||||
"Оставить A",
|
||||
"Оставить B",
|
||||
"Заняло",
|
||||
"Разброс",
|
||||
"Изменено",
|
||||
"Ничего",
|
||||
"Обе версии готовы. Сравните A и B и оставьте одну.",
|
||||
"Ассистент ещё отвечает",
|
||||
"Отправьте сообщение, когда он закончит.",
|
||||
"Сообщение не поставлено в очередь",
|
||||
"К последнему сообщению",
|
||||
"Удалить задачу",
|
||||
"Начать новый разговор; этот сохраняется",
|
||||
"Ассистент сначала напишет план; ничего не запустится, пока вы его не одобрите",
|
||||
"Искать в интернете, читать страницы и отвечать со ссылками на источники",
|
||||
"Скопировано",
|
||||
"Ответ",
|
||||
"Сообщение",
|
||||
"PDF добавлен",
|
||||
"Выделите текст и скопируйте его клавишами Ctrl+C.",
|
||||
"{0} добавлен в этот чат. Спросите о нём в следующем сообщении.",
|
||||
],
|
||||
"pt": [
|
||||
"vai parar de funcionar e será removido.",
|
||||
"Baixado, mas não carregado. Abra Modelos para carregá-lo.",
|
||||
"{0} linhas adicionadas, {1} removidas",
|
||||
"{0} arquivos editados",
|
||||
"Solte os arquivos para adicioná-los",
|
||||
"Imagens e arquivos de texto",
|
||||
"Manter a meta",
|
||||
"Remover a meta",
|
||||
"O assistente deixa de trabalhar nela. Seu chat e seus arquivos continuam como estão.",
|
||||
"Este modelo consegue ler imagens, mas o motor instalado aqui ainda não inclui o leitor de imagens, então Ler imagens está desligado. Atualize o motor em Configurações → Sobre para ligar.",
|
||||
"Mostrando os valores do seu ajuste \"{0}\".",
|
||||
"Seu ajuste \"{0}\" define",
|
||||
"era {0}",
|
||||
"· {0} de RAM",
|
||||
"A mensagem não foi cancelada",
|
||||
"Configurações extras do programa",
|
||||
"Rascunhar com IA",
|
||||
"Tempo de raciocínio",
|
||||
"Tempo de escrita",
|
||||
"tokens/s",
|
||||
"% do contexto",
|
||||
"Esta página pede arquivos da internet, que a visualização não carrega, então pode parecer incompleta. Ver código mostra exatamente o que foi escrito.",
|
||||
"Manter A",
|
||||
"Manter B",
|
||||
"Levou",
|
||||
"Variação",
|
||||
"Alterado",
|
||||
"Nada",
|
||||
"As duas versões estão prontas. Compare A e B e mantenha uma.",
|
||||
"O assistente ainda está respondendo",
|
||||
"Envie sua mensagem quando ele terminar.",
|
||||
"A mensagem não entrou na fila",
|
||||
"Ir para a última mensagem",
|
||||
"Remover tarefa",
|
||||
"Começar uma nova conversa; esta continua salva",
|
||||
"O assistente escreve um plano primeiro; nada roda até você aprovar",
|
||||
"Pesquisar na web, ler as páginas e responder com fontes",
|
||||
"Copiado",
|
||||
"Resposta",
|
||||
"Mensagem",
|
||||
"PDF adicionado",
|
||||
"Selecione o texto e copie com Ctrl+C.",
|
||||
"{0} está neste chat. Pergunte sobre ele na próxima mensagem.",
|
||||
],
|
||||
"ko": [
|
||||
"실행이 중지되고 제거됩니다.",
|
||||
"다운로드했지만 아직 불러오지 않았습니다. 모델 화면을 열어 불러오세요.",
|
||||
"{0}줄 추가, {1}줄 삭제",
|
||||
"파일 {0}개 편집함",
|
||||
"파일을 놓아서 추가하세요",
|
||||
"그림과 텍스트 파일",
|
||||
"목표 유지",
|
||||
"목표 제거",
|
||||
"어시스턴트가 이 목표를 향한 작업을 멈춥니다. 대화와 파일은 그대로 남습니다.",
|
||||
"이 모델은 그림을 읽을 수 있지만, 여기에 설치된 엔진에는 아직 그림 읽기 기능이 없어서 '그림 읽기'가 꺼져 있습니다. 설정 → 정보에서 엔진을 업데이트하면 켤 수 있습니다.",
|
||||
"튜닝 '{0}'의 값을 보여 줍니다.",
|
||||
"튜닝 '{0}'이(가) 설정하는 항목",
|
||||
"이전 값 {0}",
|
||||
"· RAM {0}",
|
||||
"메시지가 취소되지 않았습니다",
|
||||
"프로그램 추가 설정",
|
||||
"AI로 초안 작성",
|
||||
"생각한 시간",
|
||||
"작성한 시간",
|
||||
"토큰/초",
|
||||
"컨텍스트 %",
|
||||
"이 페이지는 인터넷의 파일을 불러와야 하는데 미리보기는 이를 불러오지 않으므로 불완전하게 보일 수 있습니다. '코드 보기'에서 작성된 내용을 그대로 볼 수 있습니다.",
|
||||
"A 유지",
|
||||
"B 유지",
|
||||
"걸린 시간",
|
||||
"편차",
|
||||
"변경됨",
|
||||
"없음",
|
||||
"두 버전이 모두 준비되었습니다. A와 B를 비교한 뒤 하나를 유지하세요.",
|
||||
"어시스턴트가 아직 답하는 중입니다",
|
||||
"답이 끝나면 메시지를 보내세요.",
|
||||
"메시지가 대기열에 들어가지 않았습니다",
|
||||
"최신 메시지로 이동",
|
||||
"작업 제거",
|
||||
"새 대화를 시작합니다. 이 대화는 그대로 둡니다",
|
||||
"어시스턴트가 먼저 계획을 작성합니다. 승인하기 전에는 아무것도 실행되지 않습니다",
|
||||
"웹을 검색하고 페이지를 읽어 출처와 함께 답합니다",
|
||||
"복사했습니다",
|
||||
"답변",
|
||||
"메시지",
|
||||
"PDF를 추가했습니다",
|
||||
"텍스트를 선택한 뒤 Ctrl+C로 복사하세요.",
|
||||
"{0}이(가) 이 채팅에 있습니다. 다음 메시지에서 물어보세요.",
|
||||
],
|
||||
}
|
||||
|
||||
here = Path(__file__).resolve().parent.parent / "locales" if False else Path(__file__).resolve().parent.parent / "src" / "locales"
|
||||
|
||||
|
||||
def write(lang, values):
|
||||
assert len(values) == len(EN), (lang, len(values), len(EN))
|
||||
for source, text in zip(EN, values):
|
||||
assert sorted(__import__("re").findall(r"\{\d+\}", source)) == sorted(__import__("re").findall(r"\{\d+\}", text)), (lang, source, text)
|
||||
data = {f"fx{i + 1:02d}": text for i, text in enumerate(values)}
|
||||
(here / f"fix-{lang}.json").write_text(json.dumps(data, ensure_ascii=False, indent=1) + "\n", encoding="utf-8")
|
||||
|
||||
|
||||
write("en", EN)
|
||||
for lang, values in T.items():
|
||||
write(lang, values)
|
||||
print("written", len(EN), "strings in", len(T) + 1, "languages")
|
||||
@@ -0,0 +1,365 @@
|
||||
"""Writes src/locales/gh-<lang>.json: the interface strings of the 0.2.7 GitHub items done in f-027-gh-app (the Monitor's Power card #3628,
|
||||
approval notifications and the tray #3477, the finished-task sound #3586, the pinned port #3402, the interface size #3970).
|
||||
Run from apps/host: python scripts/make-gh-locales.py
|
||||
The keys are gh01.. in this order; gh-en.json is the English source. Placeholders ({0}, {1}) must be kept in every language.
|
||||
A separate file keeps this work from colliding with the other catalogs (the same reason tune-, tools- and fix- exist)."""
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
EN = [
|
||||
"Energy since start",
|
||||
"Cost since start",
|
||||
"GPU fan",
|
||||
"GPU clock",
|
||||
"CPU temperature",
|
||||
"SSD temperature",
|
||||
"Electricity price",
|
||||
"Price of one kilowatt-hour. The Monitor then shows what your graphics card has cost since Strata started. Leave it empty to hide the cost.",
|
||||
"Price per kWh",
|
||||
"Sound when work finishes",
|
||||
"Plays a short sound when an answer or task that took a while is finished, or when Strata is in the background.",
|
||||
"Play sound",
|
||||
"Notify me when Strata needs an answer",
|
||||
"In Manual mode, shows a desktop notification when the assistant waits for your approval and Strata is in the background.",
|
||||
"Strata needs your answer",
|
||||
"The assistant wants to use {0}. Open Strata to approve or deny.",
|
||||
"a tool",
|
||||
"Minimise to tray",
|
||||
"Closing the window keeps Strata running in the tray, next to the clock. Choose Quit in the tray menu to stop it. Applies the next time Strata starts.",
|
||||
"App port",
|
||||
"The port Strata’s window and local address use. Leave it empty to let Strata choose (47831 when it is free). Applies the next time Strata starts.",
|
||||
"Port (empty = automatic)",
|
||||
"Using port {0} now.",
|
||||
"Strata could not use its port",
|
||||
"Port {0} is used by another program, so Strata started on port {1}. Chats and settings saved on port {0} are not shown until Strata can use it again. Close the other program and restart Strata.",
|
||||
"Choose a port between 1024 and 65535, or leave it empty.",
|
||||
"Makes all text, buttons and menus in Strata larger or smaller.",
|
||||
"Energy and temperature readings",
|
||||
"per kWh, in {0}",
|
||||
"per kWh",
|
||||
"Change currency",
|
||||
"Automatic ({0})",
|
||||
"Currency",
|
||||
"less than {0}",
|
||||
]
|
||||
|
||||
T = {
|
||||
"zh": [
|
||||
"启动以来的能耗",
|
||||
"启动以来的费用",
|
||||
"GPU 风扇",
|
||||
"GPU 频率",
|
||||
"CPU 温度",
|
||||
"SSD 温度",
|
||||
"电价",
|
||||
"每千瓦时的价格。监控页会据此显示 Strata 启动以来显卡用电的费用。留空则不显示费用。",
|
||||
"每千瓦时价格",
|
||||
"工作完成时的提示音",
|
||||
"回答或耗时较长的任务完成时,或 Strata 在后台时,播放一段简短的提示音。",
|
||||
"播放提示音",
|
||||
"Strata 需要您答复时通知我",
|
||||
"在手动模式下,当助手等待您批准而 Strata 在后台时,显示桌面通知。",
|
||||
"Strata 需要您的答复",
|
||||
"助手想使用 {0}。打开 Strata 以批准或拒绝。",
|
||||
"一个工具",
|
||||
"最小化到托盘",
|
||||
"关闭窗口后,Strata 会继续在托盘(时钟旁边)运行。要停止它,请在托盘菜单中选择“退出”。下次启动 Strata 时生效。",
|
||||
"应用端口",
|
||||
"Strata 窗口和本地地址使用的端口。留空则由 Strata 自行选择(空闲时为 47831)。下次启动 Strata 时生效。",
|
||||
"端口(留空 = 自动)",
|
||||
"当前使用端口 {0}。",
|
||||
"Strata 无法使用它的端口",
|
||||
"端口 {0} 已被其他程序占用,因此 Strata 改用端口 {1} 启动。在端口 {0} 上保存的聊天和设置在 Strata 能再次使用该端口之前不会显示。请关闭其他程序并重新启动 Strata。",
|
||||
"请选择 1024 到 65535 之间的端口,或留空。",
|
||||
"让 Strata 中的所有文字、按钮和菜单变大或变小。",
|
||||
"能耗和温度读数",
|
||||
"每千瓦时,币种 {0}",
|
||||
"每千瓦时",
|
||||
"更改货币",
|
||||
"自动({0})",
|
||||
"货币",
|
||||
"不足 {0}",
|
||||
],
|
||||
"ja": [
|
||||
"起動後の消費電力量",
|
||||
"起動後の電気代",
|
||||
"GPU ファン",
|
||||
"GPU クロック",
|
||||
"CPU 温度",
|
||||
"SSD 温度",
|
||||
"電気料金",
|
||||
"1キロワット時あたりの料金です。モニターに、Strata の起動後にグラフィックスカードが使った電気代が表示されます。空欄のままなら電気代は表示されません。",
|
||||
"1 kWh あたりの料金",
|
||||
"作業完了時の音",
|
||||
"回答や時間のかかった作業が終わったとき、または Strata がバックグラウンドにあるときに、短い音を鳴らします。",
|
||||
"音を鳴らす",
|
||||
"Strata の返答が必要なときに通知する",
|
||||
"手動モードで、アシスタントが承認を待っていて Strata がバックグラウンドにあるときに、デスクトップ通知を表示します。",
|
||||
"Strata があなたの返答を待っています",
|
||||
"アシスタントが {0} を使おうとしています。Strata を開いて承認または拒否してください。",
|
||||
"ツール",
|
||||
"トレイに最小化",
|
||||
"ウィンドウを閉じても、Strata は時計の横のトレイで動き続けます。止めるには、トレイのメニューで「終了」を選びます。次に Strata を起動したときから有効になります。",
|
||||
"アプリのポート",
|
||||
"Strata のウィンドウとローカルアドレスが使うポートです。空欄なら Strata が選びます(空いていれば 47831)。次に Strata を起動したときから有効になります。",
|
||||
"ポート(空欄 = 自動)",
|
||||
"現在のポートは {0} です。",
|
||||
"Strata は指定のポートを使えませんでした",
|
||||
"ポート {0} は別のプログラムが使っているため、Strata はポート {1} で起動しました。ポート {0} に保存されたチャットと設定は、Strata が再びそのポートを使えるようになるまで表示されません。他のプログラムを閉じて Strata を再起動してください。",
|
||||
"1024 から 65535 の間のポートを選ぶか、空欄にしてください。",
|
||||
"Strata のすべての文字、ボタン、メニューを大きくしたり小さくしたりします。",
|
||||
"消費電力量と温度の値",
|
||||
"1 kWh あたり、通貨は {0}",
|
||||
"1 kWh あたり",
|
||||
"通貨を変更",
|
||||
"自動({0})",
|
||||
"通貨",
|
||||
"{0} 未満",
|
||||
],
|
||||
"de": [
|
||||
"Energie seit dem Start",
|
||||
"Kosten seit dem Start",
|
||||
"GPU-Lüfter",
|
||||
"GPU-Takt",
|
||||
"CPU-Temperatur",
|
||||
"SSD-Temperatur",
|
||||
"Strompreis",
|
||||
"Preis einer Kilowattstunde. Der Monitor zeigt dann, was Ihre Grafikkarte seit dem Start von Strata gekostet hat. Leer lassen, um die Kosten auszublenden.",
|
||||
"Preis pro kWh",
|
||||
"Ton, wenn Arbeit fertig ist",
|
||||
"Spielt einen kurzen Ton, wenn eine Antwort oder Aufgabe, die länger gedauert hat, fertig ist oder wenn Strata im Hintergrund läuft.",
|
||||
"Ton abspielen",
|
||||
"Benachrichtigen, wenn Strata eine Antwort braucht",
|
||||
"Zeigt im manuellen Modus eine Desktop-Benachrichtigung, wenn der Assistent auf Ihre Freigabe wartet und Strata im Hintergrund läuft.",
|
||||
"Strata braucht Ihre Antwort",
|
||||
"Der Assistent möchte {0} verwenden. Öffnen Sie Strata, um zu erlauben oder abzulehnen.",
|
||||
"ein Werkzeug",
|
||||
"In den Infobereich minimieren",
|
||||
"Beim Schließen des Fensters läuft Strata im Infobereich neben der Uhr weiter. Wählen Sie im Menü des Symbols „Beenden“, um es zu stoppen. Gilt ab dem nächsten Start von Strata.",
|
||||
"App-Port",
|
||||
"Der Port, den das Fenster und die lokale Adresse von Strata verwenden. Leer lassen, damit Strata ihn wählt (47831, wenn frei). Gilt ab dem nächsten Start von Strata.",
|
||||
"Port (leer = automatisch)",
|
||||
"Aktuell wird Port {0} verwendet.",
|
||||
"Strata konnte seinen Port nicht verwenden",
|
||||
"Port {0} wird von einem anderen Programm verwendet, daher wurde Strata auf Port {1} gestartet. Unter Port {0} gespeicherte Chats und Einstellungen werden nicht angezeigt, bis Strata ihn wieder verwenden kann. Schließen Sie das andere Programm und starten Sie Strata neu.",
|
||||
"Wählen Sie einen Port zwischen 1024 und 65535 oder lassen Sie das Feld leer.",
|
||||
"Macht alle Texte, Schaltflächen und Menüs in Strata größer oder kleiner.",
|
||||
"Energie- und Temperaturwerte",
|
||||
"pro kWh, in {0}",
|
||||
"pro kWh",
|
||||
"Währung ändern",
|
||||
"Automatisch ({0})",
|
||||
"Währung",
|
||||
"weniger als {0}",
|
||||
],
|
||||
"es": [
|
||||
"Energía desde el inicio",
|
||||
"Coste desde el inicio",
|
||||
"Ventilador de la GPU",
|
||||
"Reloj de la GPU",
|
||||
"Temperatura de la CPU",
|
||||
"Temperatura del SSD",
|
||||
"Precio de la electricidad",
|
||||
"Precio de un kilovatio hora. El Monitor mostrará entonces lo que ha costado tu tarjeta gráfica desde que se inició Strata. Déjalo vacío para ocultar el coste.",
|
||||
"Precio por kWh",
|
||||
"Sonido al terminar el trabajo",
|
||||
"Reproduce un sonido breve cuando termina una respuesta o tarea que tardó un rato, o cuando Strata está en segundo plano.",
|
||||
"Reproducir sonido",
|
||||
"Avisarme cuando Strata necesite una respuesta",
|
||||
"En el modo manual, muestra una notificación de escritorio cuando el asistente espera tu aprobación y Strata está en segundo plano.",
|
||||
"Strata necesita tu respuesta",
|
||||
"El asistente quiere usar {0}. Abre Strata para aprobar o denegar.",
|
||||
"una herramienta",
|
||||
"Minimizar a la bandeja",
|
||||
"Al cerrar la ventana, Strata sigue funcionando en la bandeja, junto al reloj. Elige Salir en el menú de la bandeja para detenerlo. Se aplica la próxima vez que se inicie Strata.",
|
||||
"Puerto de la aplicación",
|
||||
"El puerto que usan la ventana y la dirección local de Strata. Déjalo vacío para que Strata elija (47831 si está libre). Se aplica la próxima vez que se inicie Strata.",
|
||||
"Puerto (vacío = automático)",
|
||||
"Ahora se usa el puerto {0}.",
|
||||
"Strata no pudo usar su puerto",
|
||||
"El puerto {0} lo usa otro programa, así que Strata se inició en el puerto {1}. Los chats y ajustes guardados en el puerto {0} no se muestran hasta que Strata pueda volver a usarlo. Cierra el otro programa y reinicia Strata.",
|
||||
"Elige un puerto entre 1024 y 65535, o déjalo vacío.",
|
||||
"Hace más grandes o más pequeños todos los textos, botones y menús de Strata.",
|
||||
"Lecturas de energía y temperatura",
|
||||
"por kWh, en {0}",
|
||||
"por kWh",
|
||||
"Cambiar moneda",
|
||||
"Automática ({0})",
|
||||
"Moneda",
|
||||
"menos de {0}",
|
||||
],
|
||||
"ru": [
|
||||
"Энергия с запуска",
|
||||
"Стоимость с запуска",
|
||||
"Вентилятор GPU",
|
||||
"Частота GPU",
|
||||
"Температура CPU",
|
||||
"Температура SSD",
|
||||
"Цена электричества",
|
||||
"Цена одного киловатт-часа. Тогда монитор покажет, во сколько видеокарта обошлась с запуска Strata. Оставьте поле пустым, чтобы скрыть стоимость.",
|
||||
"Цена за кВт·ч",
|
||||
"Звук по окончании работы",
|
||||
"Проигрывает короткий звук, когда закончился долгий ответ или задача, а также когда Strata работает в фоне.",
|
||||
"Проиграть звук",
|
||||
"Уведомлять, когда Strata нужен ответ",
|
||||
"В ручном режиме показывает уведомление на рабочем столе, когда помощник ждёт вашего подтверждения, а Strata работает в фоне.",
|
||||
"Strata нужен ваш ответ",
|
||||
"Помощник хочет использовать {0}. Откройте Strata, чтобы разрешить или отклонить.",
|
||||
"инструмент",
|
||||
"Сворачивать в трей",
|
||||
"При закрытии окна Strata продолжает работать в трее рядом с часами. Чтобы остановить её, выберите «Выход» в меню значка. Действует со следующего запуска Strata.",
|
||||
"Порт приложения",
|
||||
"Порт, который используют окно и локальный адрес Strata. Оставьте поле пустым, чтобы Strata выбрала сама (47831, если свободен). Действует со следующего запуска Strata.",
|
||||
"Порт (пусто = автоматически)",
|
||||
"Сейчас используется порт {0}.",
|
||||
"Strata не смогла использовать свой порт",
|
||||
"Порт {0} занят другой программой, поэтому Strata запустилась на порту {1}. Чаты и настройки, сохранённые на порту {0}, не показываются, пока Strata не сможет снова его использовать. Закройте другую программу и перезапустите Strata.",
|
||||
"Выберите порт от 1024 до 65535 или оставьте поле пустым.",
|
||||
"Увеличивает или уменьшает весь текст, кнопки и меню в Strata.",
|
||||
"Показания энергии и температуры",
|
||||
"за кВт·ч, в валюте {0}",
|
||||
"за кВт·ч",
|
||||
"Сменить валюту",
|
||||
"Автоматически ({0})",
|
||||
"Валюта",
|
||||
"меньше {0}",
|
||||
],
|
||||
"pt": [
|
||||
"Energia desde o início",
|
||||
"Custo desde o início",
|
||||
"Ventoinha da GPU",
|
||||
"Clock da GPU",
|
||||
"Temperatura da CPU",
|
||||
"Temperatura do SSD",
|
||||
"Preço da eletricidade",
|
||||
"Preço de um quilowatt-hora. O Monitor passa a mostrar quanto a sua placa de vídeo custou desde que o Strata iniciou. Deixe vazio para ocultar o custo.",
|
||||
"Preço por kWh",
|
||||
"Som ao terminar o trabalho",
|
||||
"Toca um som curto quando uma resposta ou tarefa que demorou termina, ou quando o Strata está em segundo plano.",
|
||||
"Tocar som",
|
||||
"Avisar quando o Strata precisar de uma resposta",
|
||||
"No modo manual, mostra uma notificação na área de trabalho quando o assistente espera sua aprovação e o Strata está em segundo plano.",
|
||||
"O Strata precisa da sua resposta",
|
||||
"O assistente quer usar {0}. Abra o Strata para aprovar ou negar.",
|
||||
"uma ferramenta",
|
||||
"Minimizar para a bandeja",
|
||||
"Ao fechar a janela, o Strata continua em execução na bandeja, ao lado do relógio. Escolha Sair no menu da bandeja para encerrá-lo. Vale a partir da próxima vez que o Strata iniciar.",
|
||||
"Porta do aplicativo",
|
||||
"A porta usada pela janela e pelo endereço local do Strata. Deixe vazio para o Strata escolher (47831 quando estiver livre). Vale a partir da próxima vez que o Strata iniciar.",
|
||||
"Porta (vazio = automático)",
|
||||
"Usando a porta {0} agora.",
|
||||
"O Strata não conseguiu usar a sua porta",
|
||||
"A porta {0} está em uso por outro programa, então o Strata iniciou na porta {1}. Os chats e as configurações salvos na porta {0} não aparecem até o Strata poder usá-la de novo. Feche o outro programa e reinicie o Strata.",
|
||||
"Escolha uma porta entre 1024 e 65535, ou deixe vazio.",
|
||||
"Deixa todos os textos, botões e menus do Strata maiores ou menores.",
|
||||
"Leituras de energia e temperatura",
|
||||
"por kWh, em {0}",
|
||||
"por kWh",
|
||||
"Alterar moeda",
|
||||
"Automática ({0})",
|
||||
"Moeda",
|
||||
"menos de {0}",
|
||||
],
|
||||
"ko": [
|
||||
"시작 이후 에너지",
|
||||
"시작 이후 비용",
|
||||
"GPU 팬",
|
||||
"GPU 클럭",
|
||||
"CPU 온도",
|
||||
"SSD 온도",
|
||||
"전기 요금",
|
||||
"1킬로와트시의 요금입니다. 모니터에 Strata를 시작한 뒤 그래픽 카드에 든 전기 요금이 표시됩니다. 비워 두면 비용을 표시하지 않습니다.",
|
||||
"kWh당 요금",
|
||||
"작업이 끝났을 때 소리",
|
||||
"답변이나 오래 걸린 작업이 끝났을 때, 또는 Strata가 백그라운드에 있을 때 짧은 소리를 재생합니다.",
|
||||
"소리 재생",
|
||||
"Strata가 답을 필요로 할 때 알림",
|
||||
"수동 모드에서 어시스턴트가 승인을 기다리고 Strata가 백그라운드에 있을 때 데스크톱 알림을 표시합니다.",
|
||||
"Strata가 답을 기다리고 있습니다",
|
||||
"어시스턴트가 {0}을(를) 사용하려고 합니다. Strata를 열어 승인하거나 거부하세요.",
|
||||
"도구",
|
||||
"트레이로 최소화",
|
||||
"창을 닫아도 Strata는 시계 옆 트레이에서 계속 실행됩니다. 끝내려면 트레이 메뉴에서 '종료'를 선택하세요. 다음에 Strata를 시작할 때부터 적용됩니다.",
|
||||
"앱 포트",
|
||||
"Strata의 창과 로컬 주소가 사용하는 포트입니다. 비워 두면 Strata가 고릅니다(비어 있으면 47831). 다음에 Strata를 시작할 때부터 적용됩니다.",
|
||||
"포트(비움 = 자동)",
|
||||
"지금은 포트 {0}을(를) 사용 중입니다.",
|
||||
"Strata가 지정한 포트를 사용할 수 없었습니다",
|
||||
"포트 {0}을(를) 다른 프로그램이 사용 중이어서 Strata는 포트 {1}에서 시작했습니다. 포트 {0}에 저장된 채팅과 설정은 Strata가 다시 그 포트를 쓸 수 있을 때까지 표시되지 않습니다. 다른 프로그램을 닫고 Strata를 다시 시작하세요.",
|
||||
"1024에서 65535 사이의 포트를 고르거나 비워 두세요.",
|
||||
"Strata의 모든 글자, 버튼, 메뉴를 더 크게 또는 더 작게 만듭니다.",
|
||||
"에너지 및 온도 측정값",
|
||||
"kWh당, 통화 {0}",
|
||||
"kWh당",
|
||||
"통화 변경",
|
||||
"자동({0})",
|
||||
"통화",
|
||||
"{0} 미만",
|
||||
],
|
||||
"fr": [
|
||||
"Énergie depuis le démarrage",
|
||||
"Coût depuis le démarrage",
|
||||
"Ventilateur du GPU",
|
||||
"Fréquence du GPU",
|
||||
"Température du CPU",
|
||||
"Température du SSD",
|
||||
"Prix de l'électricité",
|
||||
"Prix d'un kilowattheure. Le Moniteur affiche alors ce que votre carte graphique a coûté depuis le démarrage de Strata. Laissez vide pour masquer le coût.",
|
||||
"Prix par kWh",
|
||||
"Son à la fin du travail",
|
||||
"Joue un court son quand une réponse ou une tâche qui a pris du temps est terminée, ou quand Strata est en arrière-plan.",
|
||||
"Jouer le son",
|
||||
"Me prévenir quand Strata a besoin d'une réponse",
|
||||
"En mode manuel, affiche une notification sur le bureau quand l'assistant attend votre accord et que Strata est en arrière-plan.",
|
||||
"Strata a besoin de votre réponse",
|
||||
"L'assistant veut utiliser {0}. Ouvrez Strata pour accepter ou refuser.",
|
||||
"un outil",
|
||||
"Réduire dans la zone de notification",
|
||||
"Fermer la fenêtre garde Strata actif dans la zone de notification, près de l'horloge. Choisissez Quitter dans le menu de l'icône pour l'arrêter. S'applique au prochain démarrage de Strata.",
|
||||
"Port de l'application",
|
||||
"Le port que la fenêtre et l'adresse locale de Strata utilisent. Laissez vide pour que Strata choisisse (47831 s'il est libre). S'applique au prochain démarrage de Strata.",
|
||||
"Port (vide = automatique)",
|
||||
"Port {0} utilisé en ce moment.",
|
||||
"Strata n'a pas pu utiliser son port",
|
||||
"Le port {0} est utilisé par un autre programme, donc Strata a démarré sur le port {1}. Les conversations et réglages enregistrés sur le port {0} ne s'affichent pas tant que Strata ne peut pas le réutiliser. Fermez l'autre programme et relancez Strata.",
|
||||
"Choisissez un port entre 1024 et 65535, ou laissez vide.",
|
||||
"Agrandit ou réduit tous les textes, boutons et menus de Strata.",
|
||||
"Relevés d'énergie et de température",
|
||||
"par kWh, en {0}",
|
||||
"par kWh",
|
||||
"Changer de devise",
|
||||
"Automatique ({0})",
|
||||
"Devise",
|
||||
"moins de {0}",
|
||||
],
|
||||
}
|
||||
|
||||
here = Path(__file__).resolve().parent.parent / "src" / "locales"
|
||||
|
||||
|
||||
NBSP = "\u00a0"
|
||||
|
||||
|
||||
def french(text):
|
||||
"""The same French spacing as scripts/fr_sync.py: a typographic apostrophe, a no-break space before : ; ? ! % and inside the guillemets."""
|
||||
text = re.sub(r"(?<=[A-Za-z\u00c0-\u017f])'(?=[A-Za-z\u00c0-\u017f{])", "\u2019", text)
|
||||
text = re.sub(r"(?<=\S) ([:;?!])", NBSP + r"\1", text)
|
||||
text = re.sub(r"(?<=[\d}]) %", NBSP + "%", text)
|
||||
return text
|
||||
|
||||
|
||||
def write(lang, values):
|
||||
assert len(values) == len(EN), (lang, len(values), len(EN))
|
||||
for source, text in zip(EN, values):
|
||||
assert sorted(re.findall(r"\{\d+\}", source)) == sorted(re.findall(r"\{\d+\}", text)), (lang, source, text)
|
||||
if lang == "fr":
|
||||
values = [french(v) for v in values]
|
||||
data = {f"gh{i + 1:02d}": text for i, text in enumerate(values)}
|
||||
(here / f"gh-{lang}.json").write_text(json.dumps(data, ensure_ascii=False, indent=1) + "\n", encoding="utf-8")
|
||||
|
||||
|
||||
write("en", EN)
|
||||
for lang, values in T.items():
|
||||
write(lang, values)
|
||||
print("written", len(EN), "strings in", len(T) + 1, "languages")
|
||||
@@ -5,6 +5,12 @@ import {spawn} from 'node:child_process';
|
||||
import {resolve} from 'node:path';
|
||||
const root=resolve(import.meta.dirname,'..');
|
||||
const files=readdirSync(resolve(root,'tests')).filter(name=>name.endsWith('.test.mjs')).sort().map(name=>resolve(root,'tests',name));
|
||||
const child=spawn(process.execPath,['--test',...files],{cwd:root,stdio:'inherit'});
|
||||
/* Every test file runs against scratch copies of the per-user places the host writes to (the owner's real profile is never touched). */
|
||||
import {mkdtempSync} from 'node:fs';
|
||||
import {tmpdir} from 'node:os';
|
||||
import {join} from 'node:path';
|
||||
const scratch=mkdtempSync(join(tmpdir(),'strata-host-suite-profile-'));
|
||||
const env={...process.env,STRATA_SETTINGS_FILE:join(scratch,'app-settings.json'),STRATA_COMPONENTS_DIR:join(scratch,'components'),LOCALAPPDATA:join(scratch,'Local'),APPDATA:join(scratch,'Roaming'),XDG_DATA_HOME:join(scratch,'xdg-data'),XDG_STATE_HOME:join(scratch,'xdg-state'),XDG_CONFIG_HOME:join(scratch,'xdg-config')};
|
||||
const child=spawn(process.execPath,['--test',...files],{cwd:root,stdio:'inherit',env});
|
||||
child.on('error',error=>{console.error(error.message);process.exitCode=1;});
|
||||
child.on('exit',(code,signal)=>{process.exitCode=code??(signal?1:0);});
|
||||
@@ -1,5 +1,8 @@
|
||||
# Agent bridge (Strata chats as DeepSeek Harness sessions)
|
||||
|
||||
This page is for developers who work on the app host's agent code. It lists the files, the frames and routes, and the rules the
|
||||
bridge enforces. Tests are listed at the end.
|
||||
|
||||
The Harness is a separate, pinned component (`DSH 0.2.1-alpha.3`, commit `57190202`, MIT). The host finds it through
|
||||
`STRATA_HARNESS_DIR` (or `<STRATA_COMPONENTS_DIR>/harness`), starts one `dsh --profile web` process on a loopback port,
|
||||
and talks to its Gateway. Nothing here downloads or builds anything.
|
||||
@@ -14,12 +17,13 @@ and talks to its Gateway. Nothing here downloads or builds anything.
|
||||
| `children.mjs` | pure projection of one helper agent's events into its row and its approval card |
|
||||
| `preset.mjs` | the agent preset (which tools the chat has) |
|
||||
| `plugins/strata-gate.mjs` | the Manual-mode approval gate (a Harness plugin, loaded by path) |
|
||||
| `plugins/strata-search.mjs`, `plugins/strata-models.mjs` | the app's web search registered with the Harness; helper agents on a named model |
|
||||
| `plugins/strata-context.mjs`, `context-budget.mjs`, `context-fit.mjs` | measured context pressure, summaries that fit the window, the check before a message goes out |
|
||||
| `agent-bridge.mjs` | the chat-to-session map, turns, approvals, Stop, status |
|
||||
|
||||
## Frames sent on `/api/chat/stream` for an agent turn
|
||||
|
||||
`queued`, `start` (`agent:true`), `reasoning`, `delta`, `agent-tool` (new: upserts a tool card by call id with
|
||||
`queued`, `start` (`agent:true`), `reasoning`, `delta`, `agent-tool` (upserts a tool card by call id with
|
||||
`running | proposed | done | denied | error`), `done` (usage, `finishReason`, `cancelled`), `error`, and `notice`
|
||||
(why a chat is not using the agent). The chat UI renders them with its existing components.
|
||||
|
||||
@@ -57,7 +61,7 @@ The chat's Mode menu is real Harness behaviour. Each turn the page sends the cha
|
||||
| Bypass | `strata-bypass` | `danger-full-access` | `never` | Full access without prompts, as before. |
|
||||
|
||||
- Manual relies on the gate, so a Manual turn does not start unless the bridge has confirmed the gate is loaded (`/strata-gate` command): without it Manual would be an open sandbox that nobody asks about.
|
||||
- The gate listens to `tools/pre-execute` (the seam the Harness's own Auto-review layer uses) and returns an `ask` decision; the Harness's approval service then asks, runs the tool only after `allowed-once`, and records the answer. Read-only tools and a short allowlist of look-only shell commands (Get-ChildItem, git status, ...) run unasked; MCP and unknown tools ask.
|
||||
- The gate listens to `tools/pre-execute` (the seam the Harness's own Auto-review layer uses) and returns an `ask` decision; the Harness's approval service then asks, runs the tool only after `allowed-once`, and records the answer. Read-only tools and a short allowlist of look-only shell commands (Get-ChildItem, git status, ...) run unasked, each only with the options listed for it in `strata-gate.mjs` (an unknown option, or one that writes, runs a program, sets something or never ends, asks); MCP and unknown tools ask.
|
||||
- Web search and web pages (`web_search`, `web_fetch`) ask once per chat in Manual, not once per call. The gate asks through the approval service itself (`webDecision`: "The assistant wants to search the web for: ... Search words go to <service>." / "... open the web page ..."), remembers a yes for the chat (a helper agent shares its chat's answer, and two searches started together share one card), and on a no gives the model `WEB_REFUSAL` ("The person did not allow web access ... Go on without it and say so."). Plan and Bypass are unchanged. Settings -> Tools has a switch, "Let the assistant search the web without asking" (off by default, `webWithoutAsking` in `tools-settings.mjs`, passed to the gate as `config.web.skipAsk`), that skips the question in Manual. A scheduled task has nobody at the card, so its web call is answered no unless that switch is on. Tests: `tests/web-ask.test.mjs`.
|
||||
- The mode is read once per turn; an unknown or missing value is Manual.
|
||||
|
||||
@@ -70,7 +74,7 @@ The chat's Mode menu is real Harness behaviour. Each turn the page sends the cha
|
||||
What the person chose is saved by `tools-settings.mjs` (inside the host's settings file) and shown by `src/components/SettingsTools.tsx` (`GET/PUT /api/agent/tools`, `POST/PATCH/DELETE /api/agent/tools/custom[/id]`). A change reaches the agent from the next message: the profile carries a `toolsSignature`, and the bridge restarts the Harness (after the running turns end) when it differs.
|
||||
|
||||
- Tool groups (`tools-catalog.mjs`): each is one switch in plain words and is one or more preset plugins (`withoutDisabled`); `fetch` and `search` are the two halves of the Harness's `tool-web` (both off drops it). Goals off: `/goal` answers that goals are turned off.
|
||||
- Web search needs no account. The default is DuckDuckGo's HTML result page (`../web-search-ddg.mjs`), with Bing's plain result page (`../web-search-bing.mjs`) as the second source. Manners, because DuckDuckGo refuses a program that asks fast (a real box: two searches in 1.2 s answered, the third got HTTP 202 and every DuckDuckGo page refused for many minutes): a browser User-Agent and the page's own request shape (Referer, Origin, Sec-Fetch-*), one request at a time per source, 2.5 to 4 s apart (random), at most 8 a minute, a 30 minute session cache per question, a cooldown after a refusal that doubles (1, 2, 4 ... 10 minutes, `Retry-After` honoured) during which that source gets no request, no lite-page follow-up after a refusal, one retry for a timeout or a 5xx, a 15 s limit. When every source refuses, the tool answers one plain sentence (`LIMITED_SENTENCE`: "Web search is limited right now. Try again in a minute, or add a search key (Exa, Perplexity or DeepSeek) in Settings -> Tools -> Web search.") plus an instruction to the model not to retry; the turn guard in `agent-bridge.mjs` (see Turn guard) stops a model that retries anyway. **The results come from DuckDuckGo or Bing**; they are not ranked or filtered here. The person may switch to Exa, Perplexity or DeepSeek with their own key (`../web-search-keyed.mjs`; DeepSeek uses the Harness's own provider): the key is saved in the settings file, reaches the agent only as the environment variable `STRATA_SEARCH_KEY`, never the profile file and never the screen (it only learns `keySet`). A keyed service without its key falls back to DuckDuckGo. The profile pins `web.searchProvider` to the chosen id so two usable backends cannot make the choice ambiguous.
|
||||
- Web search needs no account. The default is DuckDuckGo's HTML result page (`../web-search-ddg.mjs`), with Bing's plain result page (`../web-search-bing.mjs`) as the second source. Manners, because DuckDuckGo refuses a program that asks fast: a browser User-Agent and the page's own request shape (Referer, Origin, Sec-Fetch-*), one request at a time per source, 2.5 to 4 s apart (random), at most 8 a minute, a 30 minute session cache per question, a cooldown after a refusal that doubles (1, 2, 4 ... 10 minutes, `Retry-After` honoured) during which that source gets no request, no lite-page follow-up after a refusal, one retry for a timeout or a 5xx, a 15 s limit. When every source refuses, the tool answers one plain sentence (`LIMITED_SENTENCE`: "Web search is limited right now. Try again in a minute, or add a search key (Exa, Perplexity or DeepSeek) in Settings -> Tools -> Web search.") plus an instruction to the model not to retry; the turn guard in `agent-bridge.mjs` (see Turn guard) stops a model that retries anyway. **The results come from DuckDuckGo or Bing**; they are not ranked or filtered here. The person may switch to Exa, Perplexity or DeepSeek with their own key (`../web-search-keyed.mjs`; DeepSeek uses the Harness's own provider): the key is saved in the settings file, reaches the agent only as the environment variable `STRATA_SEARCH_KEY`, never the profile file and never the screen (it only learns `keySet`). A keyed service without its key falls back to DuckDuckGo. The profile pins `web.searchProvider` to the chosen id so two usable backends cannot make the choice ambiguous.
|
||||
- The browser: Playwright's MCP server (`@playwright/mcp`, staged next to the Harness by `apps/desktop/scripts/stage-harness.mjs`) on the person's own Chrome, Edge or Chromium (`browser-probe.mjs`), `--isolated` so it never sees their profile. Tools appear as `mcp__browser__browser_*`. In Manual, opening a page, clicking, typing, uploading, running a script in the page and closing tabs ask (plain reasons: "Open the web page ...", "Click on the page: ..."); looking (snapshot, screenshot, console, network, waiting, listing tabs) does not. Plan refuses every connected tool. The screen says plainly when no browser, or no tool server, is found.
|
||||
- The person's own tools: `instructions` (the tool returns their text; look-only, never asks), `command` (runs their command with the assistant's text in the `STRATA_INPUT` environment variable, never spliced into the command line; asks in Manual, refused in Plan) and `server` (a web address or a program, added as `mcp__custom-<name>__*`; asks in Manual). Instruction and command tools are served by `custom-tools-mcp.mjs` (stdio MCP) from a JSON file the settings module rewrites on every change, so a switch in Settings is seen without a restart.
|
||||
- `strata-gate.mjs` implements the Manual/Plan rules above (`planDecision`, `browserDecision`, the look-only instruction server).
|
||||
@@ -81,7 +85,7 @@ What the person chose is saved by `tools-settings.mjs` (inside the host's settin
|
||||
- A helper's request for approval is the same card (state `proposed`, id `<helper session>:<call>`), answered with the same `/api/chat/approval`; a chat can only answer its own helpers.
|
||||
- The run (the chat's one NDJSON response) stays open until the parent is idle, every helper has finished and reported back, and no armed goal is waiting; `done` is sent then.
|
||||
- Stop: pauses an active goal, interrupts every helper (`subagents/interruptByParent`; `session/cancel` on a helper session is refused by the Harness), cancels the parent, waits; a report that would wake the parent afterwards is cancelled too.
|
||||
- The number of helpers at once equals the engine's request slots (`maxActiveSubagents` in the profile); the Harness refuses more with a message the model reads.
|
||||
- The number of helpers at once is the engine's request slots, with a floor of 4 for a local model and 8 for an API model (`maxActiveSubagents` in the profile). The Harness refuses more with a message the model reads.
|
||||
|
||||
## /goal
|
||||
|
||||
@@ -89,8 +93,15 @@ What the person chose is saved by `tools-settings.mjs` (inside the host's settin
|
||||
|
||||
## Thinking and the output budget
|
||||
|
||||
The Harness staging script (`apps/desktop/scripts/stage-harness.mjs`) applies Strata's guarded pi-ai 1.1.0 patch to its staged copy
|
||||
(`harness-budget.mjs`, #3684): below 64K the context safety room is at most `min(4096, floor(contextWindow / 16))` and never more
|
||||
than half the estimated remaining room, so an 8K window keeps output room after a tool result instead of ending with a one-token
|
||||
cap. The caller's output cap and the one-token floor remain; windows of 64K or more keep the previous calculation. `BUNDLE.json.patches`
|
||||
records the patch identity, the dependency version and the before/after SHA-256. Unknown dependency bytes stop staging for review.
|
||||
Source and already-installed Harness copies are not changed.
|
||||
|
||||
- A local route is reasoning-capable (`reasoning: true`) with `compat.thinkingFormat: 'chat-template'`: the request carries `chat_template_kwargs {enable_thinking, reasoning_effort}`, which the Strata server reads (a top-level `enable_thinking` is ignored by it, which is why pi-ai's `qwen` format left the model thinking). The chat's Reasoning menu travels as `thinking` in the stream body; the bridge sends it with `session/selectModel` (`reasoningEffort`) whenever the model or the level changed; a level a route does not have is dropped (never an error). API routes keep the provider default (the menu is disabled for them in the UI).
|
||||
- `localOutputBudget(context)` = context minus 4096 (it was context/4 capped at 8192, which cut big answers off at exactly 8192 tokens); pi-ai sends the window minus the prompt. App-loaded models get `fit_max_tokens: true` so the engine clamps instead of answering 400. Sampling is not set here: the Harness sends none, so the server's own defaults apply.
|
||||
- `localOutputBudget(context)` is 30 percent of the window, at least 4096 and at most 32768 (9,830 tokens at 32K, 19,660 at 64K). The Harness's automatic compaction reads it as the room a reply reserves. pi-ai sends the window minus the prompt. App-loaded models get `fit_max_tokens: true` so the engine clamps instead of answering 400. Sampling is not set here: the Harness sends none, so the server's own defaults apply.
|
||||
|
||||
## Tasks
|
||||
|
||||
@@ -108,7 +119,7 @@ Failures the person sees are plain sentences with a next step (`AgentUnavailable
|
||||
|
||||
## Helper agents on a named model (`plugins/strata-models.mjs`, `model-routes.mjs`)
|
||||
|
||||
The Harness's `subagent` tool takes an exact `provider` route key and model id, and the app had its model choice switched off, so every helper ran on the chat's model. The profile now enables the Harness's `subagent-model-selection-settings` with every route the app can reach (local instances and saved API models), and the `strata-models` plugin wraps the two tool definitions the Harness registers for each chat (`subagent`, `list_subagent_models`) in place:
|
||||
The Harness's `subagent` tool takes an exact `provider` route key and model id. The profile enables the Harness's `subagent-model-selection-settings` with every route the app can reach (local instances and saved API models), and the `strata-models` plugin wraps the two tool definitions the Harness registers for each chat (`subagent`, `list_subagent_models`) in place:
|
||||
|
||||
- the model is found from its id, `provider/id`, the name in the model picker, `connection name`, or "local" (any letters). A close guess is not started: the tool answers "Did you mean ...?" and nothing runs until the call is made again with that model. Several fits are listed; nothing fitting lists the models that can be used and says they can be added in Models.
|
||||
- the tool's own text says when to use it ("ask a subagent", "ask model X"), not to look for the model with shell commands, and not to wait with sleep. The system prompt (`preset.mjs`) says the same, so it reaches every model, local or hosted.
|
||||
@@ -126,7 +137,7 @@ Pictures are on by default for every model that can read them: an API model read
|
||||
|
||||
## Turn guard (`turn-guard.mjs`)
|
||||
|
||||
A turn that keeps failing the same way is stopped by the app, never left to the model. Seen on a search-heavy `/plan`: every web search was refused, the model searched again and rewrote its plan after each one until the context reached 100%, then the turn ended with no answer and no message.
|
||||
A turn that keeps failing the same way is stopped by the app, never left to the model.
|
||||
|
||||
- **Counted, from what the turn shows:** web searches that failed in a row (3), searches in one turn (10 in a plan turn, 25 otherwise), a plan turn that starts its numbered list from `1.` again (4 times), and a context of 93% or more (the Harness's own compaction did not keep up).
|
||||
- **Stopped the way Stop stops** (`session/cancel`, helpers first) but ended as a normal turn (`done`, not cancelled, no error card), so the plan the model had written is still proposed. The plan card carries the reason (`plan.caution`); any other turn ends with one `delta` frame that has `own: true` and `key` (the English sentence, translated by the page; `GUARD_NOTES` are in the interface catalog in all eight languages). Each sentence says what happened and gives one next step.
|
||||
@@ -134,9 +145,7 @@ A turn that keeps failing the same way is stopped by the app, never left to the
|
||||
- **Never silent:** a turn that ends (`completed` or `max-tokens`) with no answer text gets "I ran out of room in this chat..." when the last request used 85% of the window or more, otherwise "I stopped without writing an answer..." (not when tool cards were shown, not after Stop, not after an error, which says why by itself). Goal runs have their own ending lines and are not guarded.
|
||||
- Tests: `tests/agent-turn-guard.test.mjs` (counting, always; end to end with the real Harness, the scripted model's `searchloop` and `bloat` scripts and `searchMock: 'limited'` on the bridge, which runs the real search code on a pretend web that refuses, no network).
|
||||
|
||||
## Context: measured pressure, summaries that fit, the check before a message goes out (2026-10-22)
|
||||
|
||||
Found by the owner's hands-on test of the installed 0.2.1 (Gyro-S, 64K): a 118 KB log paste was 66,500 tokens to the engine and about 29,500 to the Harness (4 characters a token; logs and code are about 2); the engine refused it with a 400, the refusal stayed in the history, and then neither the next message nor `/compact` could go through, because the summary request carried the same history and was refused for its size too. `/compact` itself was never a command of the app: it went to the model as a question and the model answered "nothing to compact".
|
||||
## Context: measured pressure, summaries that fit, the check before a message goes out
|
||||
|
||||
- **`plugins/strata-context.mjs`** (inserted by the profile, like the gate) wraps `tokenMeter.measure` and `llm.stream` in place, once each. Pressure = the last prompt size the model server reported for an answer, plus what changed since priced at the density that measurement showed (`context-budget.mjs`: `pressureNow`, `densityOf`); never lower than the Harness's own price. Node prices are scaled the same way, so the retained tail is in real tokens. A summary request (`purpose: 'compaction'`) that would not fit the window is asked for in pieces: a message bigger than a piece is cut for the request only, each piece builds on the summary before it, a piece the server refuses is halved and tried again. `/strata-context` (a Harness command, like `/strata-gate`) answers `{tokens, window}` for a session so the host can tell the person true figures.
|
||||
- **`context-fit.mjs`**: before a message is sent the model server counts it (`POST /v1/messages/count_tokens`, its own tokenizer). `decideFit`: send; summarise first and then send (the message fits an otherwise empty chat); or never fits. The last one is not sent: the error frame has `code: 'CONTEXT_MESSAGE_TOO_LARGE'` and the page offers "Attach as a file" (`oversize.mjs`, `/api/chat/oversize`: the text is saved in the chat's folder, the assistant reads it in parts) or "Send a shortened preview". An engine that cannot count lets the message through; the Harness's own compact-and-retry is the net.
|
||||
@@ -144,3 +153,15 @@ Found by the owner's hands-on test of the installed 0.2.1 (Gyro-S, 64K): a 118 K
|
||||
- **Visible:** `compaction/start` shows "Summarizing earlier messages..." in the status line; `compaction/end` adds one plain line to the reply. The projector also sends a `context` frame after every model request, so the meter follows the running turn.
|
||||
- **A refusal that is left** (`CONTEXT_WINDOW_EXCEEDED`) is a plain sentence with the engine's text under Details and the buttons "Summarize and continue" and "Start a new chat". "Try sending the message again" is for other errors only.
|
||||
- Tests: `tests/agent-context.test.mjs` (arithmetic; the real Harness against the scripted worker with `window`, `charsPerToken` and `noCount`), `tests/oversize.test.mjs`, `tests/context-ui.test.mjs`. The run against a real engine is `scripts/context-e2e.mjs`.
|
||||
|
||||
## History / older measurements
|
||||
|
||||
- **Search refusals (2026-10):** on a real box two DuckDuckGo searches in 1.2 s answered, the third got HTTP 202, and every DuckDuckGo page refused for many minutes.
|
||||
The pacing, cooldown and cache rules above come from that test.
|
||||
- **Search-heavy `/plan` (2026-10):** every web search was refused, the model searched again and rewrote its plan after each one until the context reached 100%.
|
||||
The turn ended with no answer and no message. The turn guard comes from that run.
|
||||
- **Large log paste (2026-10-22, installed 0.2.1, Gyro-S, 64K):** a 118 KB log was 66,500 tokens to the engine and about 29,500 to the Harness
|
||||
(4 characters a token; logs and code are about 2). The engine refused it with a 400. The refusal stayed in the history, so neither the next message nor `/compact` could
|
||||
go through, because the summary request carried the same history. `/compact` was also not a command of the app yet: it went to the model as a question. This
|
||||
produced `strata-context.mjs`, `context-fit.mjs` and the host's own `/compact`.
|
||||
- **Output budget:** an earlier local budget of a quarter of the window, capped at 8192, cut big answers off at exactly 8192 tokens.
|
||||
@@ -58,7 +58,7 @@ export async function countTokens({ baseUrl, key = '', model = '', text, fetchIm
|
||||
} catch { return null; }
|
||||
}
|
||||
|
||||
/** The plain sentences (also in the interface catalog in all eight languages). `{0}` slots are filled by the page. */
|
||||
/** The plain sentences (also in the interface catalog in all nine languages). `{0}` slots are filled by the page. */
|
||||
export const FIT_TEXT = Object.freeze({
|
||||
tooLarge: 'This message is about {0} tokens long, and this model can read about {1} at a time. It is too large to send as it is.',
|
||||
tooLargeNext: 'Attach it as a file for the assistant to read in parts, or send a shortened preview.',
|
||||
|
||||
@@ -48,25 +48,196 @@ export const READ_ONLY_TOOLS = new Set([
|
||||
|
||||
const SHELL_TOOLS = new Set(['pwsh', 'bash']);
|
||||
|
||||
/** Commands that only look. Matched against the first word of every pipeline segment. */
|
||||
const SAFE_COMMANDS = new Set([
|
||||
// PowerShell
|
||||
'get-childitem', 'gci', 'ls', 'dir', 'get-content', 'gc', 'cat', 'type', 'get-item', 'gi', 'get-location', 'pwd', 'gl',
|
||||
'select-string', 'sls', 'measure-object', 'measure', 'select-object', 'select', 'where-object', 'where', 'sort-object', 'sort',
|
||||
'format-table', 'ft', 'format-list', 'fl', 'out-string', 'test-path', 'resolve-path', 'get-filehash', 'get-date', 'get-command',
|
||||
'get-process', 'get-itemproperty', 'write-output', 'echo', 'hostname', 'whoami', 'get-host', 'get-psdrive', 'get-help',
|
||||
'group-object', 'group', 'convertto-json', 'convertfrom-json', 'select-xml', 'compare-object', 'get-unique', 'tee-object-none',
|
||||
// POSIX
|
||||
'head', 'tail', 'wc', 'grep', 'rg', 'egrep', 'fgrep', 'stat', 'file', 'du', 'df', 'uname', 'which', 'basename', 'dirname',
|
||||
'realpath', 'readlink', 'sort', 'uniq', 'cut', 'tr', 'less', 'more', 'date', 'id', 'env-none', 'tree',
|
||||
]);
|
||||
/**
|
||||
* Which shell commands run without a card in Manual mode, and with which options. Safe by construction (#3975): a command is on the list WITH the
|
||||
* options that are known to only look. Every other option, long or short, abbreviated or attached, makes the command ask. So a write mode
|
||||
* (`sort -o`, `tree -o`, `uniq in out`), a program-execution mode (`sort --compress-program`, `rg --pre`, `git grep -O`), a setting mode
|
||||
* (`date -s`) or one that never ends (`tail -f`) cannot slip in, and a word added to the list later starts with no options at all.
|
||||
*
|
||||
* A spec says what one command accepts:
|
||||
* f short options without a value (letters, so `-la` is `-l -a`) v short options that need a value (`-k2`, `-k 2`)
|
||||
* vn the same, and the value must be a number o short options with an optional value that must be attached (`-Iseconds`)
|
||||
* n a bare `-5` is allowed l long options (`--name`, `--name=value`), spelled in full
|
||||
* lv long options that need a value (`--name=value`, `--name value`) ps PowerShell parameter names, lower case, spelled in full
|
||||
* max how many operands (files, patterns) are allowed op a check for each operand
|
||||
* post a last check from the options seen and the operand count
|
||||
*/
|
||||
const words = (text) => (text ? text.trim().split(/\s+/) : []);
|
||||
const spec = ({ f = '', v = '', vn = '', o = '', n = false, l = '', lv = '', ps = '', max = Infinity, op = null, post = null }) =>
|
||||
({ f, v, vn, o, n, l: new Set(words(l)), lv: new Set(words(lv)), ps: ps ? new Set([...words(ps), ...PS_COMMON]) : null, max, op, post });
|
||||
/** Parameters every cmdlet has that only change how errors and warnings show. (-Debug asks a question and -OutVariable sets one: not listed.) */
|
||||
const PS_COMMON = ['erroraction', 'ea', 'warningaction', 'wa', 'informationaction', 'ia', 'verbose', 'vb'];
|
||||
const NUMBER = /^[+-]?\d+[A-Za-z]{0,3}$/;
|
||||
|
||||
/** What `ls`, `dir`, `gci` and `Get-ChildItem` take. */
|
||||
const LS = { f: 'aAbBcdDFgGhHiklLmnNopqQrRsStuUvxX1CZ', v: 'ITw', ps: 'path literalpath filter include exclude recurse depth name force file directory hidden readonly system attributes',
|
||||
l: 'all almost-all human-readable recursive directory classify reverse size inode dereference color group-directories-first sort time time-style block-size indicator-style si numeric-uid-gid no-group literal hide ignore quote-name escape author file-type full-time width tabsize' };
|
||||
/** What `cat`, `type`, `gc` and `Get-Content` take. (-Wait never ends, so it is not here.) */
|
||||
const CAT = { f: 'AbeEnstTuv', ps: 'path literalpath totalcount tail head raw encoding readcount force filter include exclude delimiter stream asbytestream',
|
||||
l: 'show-all number-nonblank show-ends number squeeze-blank show-tabs show-nonprinting' };
|
||||
const MEASURE = { ps: 'property sum average maximum minimum line word character ignorewhitespace inputobject standarddeviation allstats' };
|
||||
const SELECT = { ps: 'first last skip skiplast property expandproperty unique index excludeproperty inputobject' };
|
||||
const WHERE = { ps: 'property value inputobject eq ne gt lt ge le like notlike match notmatch contains notcontains in notin is isnot ceq cne cgt clt cge cle clike cnotlike cmatch cnotmatch ccontains cnotcontains cin cnotin' };
|
||||
const GROUP = { ps: 'property noelement ashashtable asstring casesensitive inputobject culture' };
|
||||
const FT = { ps: 'property autosize wrap hidetableheaders groupby view force expand repeatheader displayerror showerror inputobject' };
|
||||
const FL = { ps: 'property view groupby expand force displayerror showerror inputobject' };
|
||||
const SLS = { ps: 'pattern path literalpath simplematch casesensitive context list notmatch quiet allmatches include exclude encoding raw inputobject culture noemphasis' };
|
||||
const GETITEM = { ps: 'path literalpath name filter include exclude force stream' };
|
||||
const GETLOC = { ps: 'psprovider psdrive stack stackname' };
|
||||
const ECHO = { f: 'neE', ps: 'inputobject noenumerate' };
|
||||
/** The GNU/BSD grep family. */
|
||||
const GREP = { f: 'aiIlLcnvwHhEFGPqrRsTUyzZbxo', v: 'efdD', vn: 'ABCm', n: true,
|
||||
l: 'extended-regexp fixed-strings basic-regexp perl-regexp ignore-case no-ignore-case word-regexp line-regexp invert-match count color colour files-with-matches files-without-match max-count only-matching quiet silent no-messages byte-offset with-filename no-filename label line-buffered initial-tab null after-context before-context context text recursive dereference-recursive include exclude exclude-dir binary-files line-number null-data no-group-separator group-separator regexp file directories devices binary' };
|
||||
|
||||
/** Commands that only look, each with the options that are known to be harmless. Matched against the first word of every pipeline segment. */
|
||||
const SPECS = new Map();
|
||||
const add = (names, s) => { for (const name of words(names)) SPECS.set(name, spec(s)); };
|
||||
// PowerShell
|
||||
add('get-childitem gci', { ps: LS.ps });
|
||||
add('ls dir', LS);
|
||||
add('get-content gc', { ps: CAT.ps });
|
||||
add('cat type', CAT);
|
||||
add('get-item gi get-itemproperty', GETITEM);
|
||||
add('get-location gl', GETLOC);
|
||||
add('pwd', { ...GETLOC, f: 'LP' });
|
||||
add('select-string sls', SLS);
|
||||
add('measure-object measure', MEASURE);
|
||||
add('select-object select', SELECT);
|
||||
add('where-object where', WHERE);
|
||||
add('sort-object', { ps: 'property descending unique top bottom casesensitive culture stable inputobject' });
|
||||
add('format-table ft', FT);
|
||||
add('format-list fl', FL);
|
||||
add('out-string', { ps: 'stream width inputobject' });
|
||||
add('test-path', { ps: 'path literalpath pathtype isvalid filter include exclude olderthan newerthan' });
|
||||
add('resolve-path', { ps: 'path literalpath relative relativebasepath force' });
|
||||
add('get-filehash', { ps: 'path literalpath algorithm' });
|
||||
add('get-date', { ps: 'format uformat date asutc displayhint year month day hour minute second millisecond' });
|
||||
add('get-command', { ps: 'name commandtype module all syntax listimported totalcount noun verb fullyqualifiedmodule parametername parametertype' });
|
||||
add('get-process', { ps: 'name id includeusername module fileversioninfo inputobject' });
|
||||
add('write-output', { ps: ECHO.ps });
|
||||
add('echo', ECHO);
|
||||
add('get-host', { ps: '' });
|
||||
add('get-psdrive', { ps: 'name psprovider scope literalname' });
|
||||
add('get-help', { ps: 'name full detailed examples parameter category component functionality role' });
|
||||
add('group-object group', GROUP);
|
||||
add('convertto-json', { ps: 'depth compress enumsasstrings inputobject asarray escapehandling' });
|
||||
add('convertfrom-json', { ps: 'ashashtable depth inputobject noenumerate' });
|
||||
add('select-xml', { ps: 'xml path literalpath xpath content namespace' });
|
||||
add('compare-object', { ps: 'referenceobject differenceobject property includeequal excludedifferent passthru syncwindow casesensitive culture' });
|
||||
add('get-unique', { ps: 'inputobject asstring caseinsensitive onetype' });
|
||||
// POSIX. `sort` and `date` take no PowerShell names here: `sort -o FILE` writes, `date -s` sets the clock, and a PowerShell-looking `-Second` or `-Top`
|
||||
// must not be read by a real sort or date as one of those. (Sort-Object and Get-Date above are the PowerShell forms.)
|
||||
add('head', { f: 'qvz', vn: 'nc', n: true, l: 'quiet silent verbose zero-terminated lines bytes' });
|
||||
add('tail', { f: 'qvz', vn: 'nc', n: true, l: 'quiet silent verbose zero-terminated lines bytes' }); // no -f, -F, --follow, --retry, --pid, -s: those never end
|
||||
add('wc', { f: 'lwcmL', l: 'lines words bytes chars max-line-length' });
|
||||
add('grep egrep fgrep', GREP);
|
||||
add('rg', { // no --pre, --pre-glob, --hostname-bin (they run a program) and no -z/--search-zip (it runs decompressors)
|
||||
f: 'iIsSnNHlcwFxvUoLaquhVpbP', v: 'efgtTr', vn: 'ABCjdMm',
|
||||
l: 'ignore-case no-ignore-case smart-case case-sensitive fixed-strings word-regexp line-regexp invert-match count count-matches files-with-matches files-without-match files type-list hidden no-ignore no-ignore-vcs no-ignore-parent no-ignore-dot no-ignore-global no-ignore-messages follow line-number no-line-number with-filename no-filename column heading no-heading null only-matching quiet text multiline multiline-dotall pcre2 no-messages json stats trim unrestricted binary no-config vimgrep pretty byte-offset passthru crlf one-file-system no-unicode regexp file glob iglob type type-not max-count max-depth maxdepth context after-context before-context color replace threads sort sortr max-filesize max-columns path-separator encoding engine ignore-file glob-case-insensitive no-glob-case-insensitive' });
|
||||
add('stat', { f: 'LtxlnqrsFf', v: 'c', l: 'dereference file-system terse format printf' });
|
||||
add('file', { f: 'bhikLnNrvI', l: 'brief dereference no-dereference mime mime-type mime-encoding keep-going no-pad no-buffer raw' }); // no -C, -m, -f, -P (they write or read other files), no -z/-s/-p (they run decompressors, read devices, reset times)
|
||||
add('du', { f: 'abchHklmsxLPSD0', v: 'tB', vn: 'd', l: 'all apparent-size bytes total dereference-args human-readable si summarize one-file-system dereference no-dereference separate-dirs count-links inodes null max-depth threshold block-size time time-style exclude' });
|
||||
add('df', { f: 'ahHiklmPTv', v: 'txB', l: 'all human-readable si inodes local portability print-type total sync no-sync output block-size type exclude-type' });
|
||||
add('uname', { f: 'asnrvmpio', max: 0, l: 'all kernel-name nodename kernel-release kernel-version machine processor hardware-platform operating-system' });
|
||||
add('which', { f: 'as', l: 'all' });
|
||||
add('basename', { f: 'az', v: 's', l: 'multiple zero suffix' });
|
||||
add('dirname', { f: 'z', l: 'zero' });
|
||||
add('realpath', { f: 'emsqzLP', l: 'canonicalize-existing canonicalize-missing no-symlinks quiet zero strip logical physical relative-to relative-base' });
|
||||
add('readlink', { f: 'femnqsvz', l: 'canonicalize canonicalize-existing canonicalize-missing no-newline quiet silent verbose zero' });
|
||||
add('sort', { f: 'bdfghiMnRrsuVzmcC', v: 'kt', l: 'ignore-leading-blanks dictionary-order ignore-case general-numeric-sort human-numeric-sort ignore-nonprinting month-sort numeric-sort random-sort reverse stable unique version-sort zero-terminated check merge sort field-separator key' });
|
||||
// uniq's second operand is its OUTPUT file, so it takes at most one.
|
||||
add('uniq', { f: 'cdDuiz', vn: 'fsw', max: 1, l: 'count repeated all-repeated unique ignore-case skip-fields skip-chars check-chars zero-terminated group' });
|
||||
add('cut', { f: 'snz', v: 'bcfd', l: 'complement only-delimited zero-terminated bytes characters fields delimiter output-delimiter' });
|
||||
add('tr', { f: 'cCdst', max: 2 });
|
||||
add('date', { f: 'uR', o: 'I', v: 'dr', lv: 'date reference', l: 'utc universal rfc-email rfc-2822 iso-8601 rfc-3339',
|
||||
op: (word) => word.startsWith('+') }); // a bare operand like 1026120026 SETS the clock; only +FORMAT is a format
|
||||
add('id', { f: 'ugGnrazZ', l: 'user group groups name real context zero' });
|
||||
add('hostname', { f: 'sfiIdaAyv', max: 0 }); // `hostname NAME` renames the machine
|
||||
add('whoami', { l: 'help version', op: (word) => /^\/(all|user|groups|priv|upn|fqdn|logonid|nh)$/i.test(word) });
|
||||
add('tree', { f: 'adfilpsugDFqNQrtvxCnASUchJX', v: 'LPIHT', vn: '', l: 'help version filelimit charset sort timefmt noreport dirsfirst filesfirst prune du si gitignore matchdirs ignore-case inodes device nolinks' }); // no -o, no -R
|
||||
// `less` and `more` are not here: they wait for keys, and `less` can run commands.
|
||||
|
||||
/** The names that run without a card (for the tests). */
|
||||
export const readOnlyCommandNames = () => [...SPECS.keys()];
|
||||
|
||||
/** git subcommands that only read, with the options they may take. */
|
||||
const GIT_VIEW = 'oneline graph decorate no-decorate all branches tags remotes stat shortstat numstat dirstat name-only name-status patch no-patch raw summary compact-summary abbrev-commit no-abbrev-commit abbrev reverse follow no-merges merges first-parent full-history simplify-by-decoration simplify-merges ancestry-path left-right left-only right-only cherry-pick cherry-mark cherry topo-order date-order author-date-order relative-date all-match invert-grep regexp-ignore-case extended-regexp fixed-strings perl-regexp no-color color color-words word-diff word-diff-regex minimal patience histogram diff-algorithm check exit-code quiet cached staged merge-base no-index no-ext-diff no-textconv find-renames find-copies find-copies-harder no-renames ignore-space-change ignore-all-space ignore-space-at-eol ignore-blank-lines ignore-cr-at-eol function-context show-function unified inter-hunk-context src-prefix dst-prefix no-prefix full-index binary text source use-mailmap mailmap no-mailmap log-size notes no-notes show-signature diff-merges boundary children parents no-walk sparse date format pretty author committer grep since until after before max-count skip min-parents max-parents diff-filter encoding stat-width stat-name-width stat-graph-width stat-count count';
|
||||
const LISTING = ['l', 'list', 'contains', 'no-contains', 'merged', 'no-merged', 'points-at'];
|
||||
const GIT = new Map(Object.entries({
|
||||
status: spec({ f: 'sbvz', o: 'u', l: 'short branch porcelain long ignored untracked-files ignore-submodules renames no-renames find-renames show-stash ahead-behind no-ahead-behind column no-column verbose null' }),
|
||||
log: spec({ f: 'pswbMCizuacmrtqEFPR', vn: 'nU', v: 'SGL', n: true, l: GIT_VIEW }),
|
||||
diff: spec({ f: 'pswbMCizuacmrtqEFPR', vn: 'nU', v: 'SGL', n: true, l: GIT_VIEW }),
|
||||
show: spec({ f: 'pswbMCizuacmrtqEFPR', vn: 'nU', v: 'SGL', n: true, l: GIT_VIEW }),
|
||||
'rev-list': spec({ f: 'pswbMCizuacmrtqEFPR', vn: 'nU', v: 'SGL', n: true, l: GIT_VIEW }),
|
||||
shortlog: spec({ f: 'sneciw', n: false, l: `${GIT_VIEW} summary numbered email committer group` }),
|
||||
// Listing forms only. A name with no list option would CREATE a branch or a tag, and the options that change things are not here.
|
||||
branch: spec({ f: 'avri', l: 'list all remotes verbose show-current ignore-case contains no-contains merged no-merged points-at sort format abbrev no-abbrev color no-color column no-column omit-empty',
|
||||
post: (seen, count) => count === 0 || LISTING.some(name => seen.has(name)) }),
|
||||
tag: spec({ f: 'li', o: 'n', l: 'list sort contains no-contains merged no-merged points-at format column no-column ignore-case omit-empty color no-color',
|
||||
post: (seen, count) => count === 0 || LISTING.some(name => seen.has(name)) }),
|
||||
remote: spec({ f: 'v', l: 'verbose', max: 0 }),
|
||||
// `git config KEY` reads and `git config KEY VALUE` writes, so a key is only taken with --get; no --edit, --add, --unset, --file.
|
||||
config: spec({ f: 'lz', l: 'list get get-all get-regexp show-origin show-scope local global system worktree bool int bool-or-int path expiry-date type null name-only includes no-includes', lv: 'default',
|
||||
post: (seen, count) => (count > 0 ? ['get', 'get-all', 'get-regexp'].some(name => seen.has(name)) : seen.has('list') || seen.has('l')) }),
|
||||
'rev-parse': spec({ f: 'q', l: 'show-toplevel git-dir git-common-dir absolute-git-dir abbrev-ref symbolic symbolic-full-name short verify is-inside-work-tree is-inside-git-dir is-bare-repository is-shallow-repository show-prefix show-cdup show-superproject-working-tree all branches tags remotes quiet revs-only no-revs flags no-flags local-env-vars show-object-format path-format', lv: 'default git-path' }),
|
||||
'ls-files': spec({ f: 'cdmoiskuzvtfD', l: 'cached deleted modified others ignored stage directory unmerged killed no-empty-directory error-unmatch exclude-standard exclude full-name eol deduplicate recurse-submodules sparse abbrev resolve-undo format' }),
|
||||
'ls-tree': spec({ f: 'rtdlz', l: 'name-only name-status long full-name full-tree object-only abbrev format' }),
|
||||
blame: spec({ f: 'wMCespltbfnc', v: 'L', l: 'porcelain line-porcelain incremental show-email show-name show-number date root abbrev' }),
|
||||
describe: spec({ l: 'all tags always long dirty broken contains abbrev match exclude first-parent exact-match candidates' }),
|
||||
'cat-file': spec({ f: 'tsep', l: 'batch batch-check batch-all-objects allow-unknown-type buffer unordered follow-symlinks mailmap use-mailmap' }), // no --textconv, --filters
|
||||
// No -O / --open-files-in-pager: they run a program on the matches.
|
||||
grep: spec({ f: 'aiIlLcnvwHhEFGPqpWrzUo', v: 'e', vn: 'ABCm', n: true, l: 'no-index untracked cached no-exclude-standard exclude-standard recurse-submodules text ignore-case word-regexp invert-match full-name extended-regexp basic-regexp perl-regexp fixed-strings line-number column files-with-matches name-only files-without-match count null only-matching quiet no-color color break heading show-function function-context all-match and or not max-depth max-count threads after-context before-context context recursive no-recursive' }),
|
||||
}));
|
||||
|
||||
/**
|
||||
* One command's words against its spec: every option has to be one the spec knows (anything else is not understood, so it asks).
|
||||
* @param {ReturnType<typeof spec>} sp
|
||||
* @param {{t:string,q:boolean}[]} args the words after the command; q marks a quoted text, which is data and never an option
|
||||
*/
|
||||
function argumentsAreSafe(sp, args) {
|
||||
const seen = new Set();
|
||||
let operands = 0, ended = false;
|
||||
const operand = (arg) => { operands++; return operands <= sp.max && (!sp.op || sp.op(arg.t, arg.q)); };
|
||||
const valueOf = (i, numeric) => { // the next word as an option's value; it can be a quoted text, a number, or a word that is not an option
|
||||
const arg = args[i + 1];
|
||||
if (!arg) return false;
|
||||
return numeric ? NUMBER.test(arg.t) : arg.q || !arg.t.startsWith('-') || NUMBER.test(arg.t);
|
||||
};
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
const { t, q } = args[i];
|
||||
if (q || ended || t === '-' || t[0] !== '-') { if (!operand(args[i])) return false; continue; }
|
||||
if (t === '--') { ended = true; continue; }
|
||||
if (t.startsWith('--')) {
|
||||
const eq = t.indexOf('=');
|
||||
const name = eq < 0 ? t.slice(2) : t.slice(2, eq);
|
||||
if (sp.l.has(name)) { seen.add(name); continue; }
|
||||
if (sp.lv.has(name)) { seen.add(name); if (eq < 0) { if (!valueOf(i, false)) return false; i++; } continue; }
|
||||
return false;
|
||||
}
|
||||
if (sp.ps) {
|
||||
const named = /^-([A-Za-z][A-Za-z0-9]*)(?::|$)/.exec(t);
|
||||
if (named && sp.ps.has(named[1].toLowerCase())) { seen.add(named[1].toLowerCase()); continue; }
|
||||
}
|
||||
if (sp.n && /^-\d+$/.test(t)) continue;
|
||||
for (let j = 1; j < t.length; j++) {
|
||||
const c = t[j];
|
||||
if (sp.f.includes(c)) { seen.add(c); continue; }
|
||||
if (sp.o.includes(c)) { seen.add(c); break; }
|
||||
const numeric = sp.vn.includes(c);
|
||||
if (!numeric && !sp.v.includes(c)) return false;
|
||||
seen.add(c);
|
||||
const rest = t.slice(j + 1);
|
||||
if (rest) { if (numeric && !NUMBER.test(rest)) return false; } else { if (!valueOf(i, numeric)) return false; i++; }
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sp.post ? sp.post(seen, operands) : true;
|
||||
}
|
||||
|
||||
/** git subcommands that only read. */
|
||||
const SAFE_GIT = new Set(['status', 'log', 'diff', 'show', 'branch', 'rev-parse', 'ls-files', 'blame', 'describe', 'remote', 'tag', 'shortlog', 'rev-list', 'cat-file', 'grep', 'ls-tree', 'config']);
|
||||
const SAFE_VERSION = /^(node|python|python3|py|npm|pnpm|git|dotnet|cargo|rustc|go|java|pip|pip3)\s+(--version|-v|-version|version)$/i;
|
||||
|
||||
/** Anything that can chain, redirect, expand or start something else is not read-only. */
|
||||
const UNSAFE_SYNTAX = /[;&<>`${}()]|\r|\n|--%|\bout-file\b|\bset-content\b|\badd-content\b|\binvoke-|\biex\b|\bstart-|\bnew-|\bremove-|\bcopy-|\bmove-|\brename-|\bclear-|\bset-|\bpush-|\bexpand-|\bsave-|\binstall-|\bcurl\b|\bwget\b|\bsudo\b|\bsh\b|\bbash\b|\bpwsh\b|\bpowershell\b|\bcmd\b|-exec\b|-delete\b|-execdir\b/i;
|
||||
/** Anything that can chain, redirect, expand or start something else is not read-only. (`sh` as a word, not inside an option like `du -sh`.) */
|
||||
const UNSAFE_SYNTAX = /[;&<>`${}()]|\r|\n|--%|\bout-file\b|\bset-content\b|\badd-content\b|\binvoke-|\biex\b|\bstart-|\bnew-|\bremove-|\bcopy-|\bmove-|\brename-|\bclear-|\bset-|\bpush-|\bexpand-|\bsave-|\binstall-|\bcurl\b|\bwget\b|\bsudo\b|(?<![-\w])sh(?![-\w])|\bbash\b|\bpwsh\b|\bpowershell\b|\bcmd\b|-exec\b|-delete\b|-execdir\b/i;
|
||||
|
||||
/**
|
||||
* The command with every quoted text replaced by a plain stand-in, or null when it cannot be read safely. What is inside quotes is data
|
||||
@@ -74,9 +245,10 @@ const UNSAFE_SYNTAX = /[;&<>`${}()]|\r|\n|--%|\bout-file\b|\bset-content\b|\badd
|
||||
* inside double quotes a $ or a backtick expands (a variable, a sub-command), and an unterminated quote means the text was not understood.
|
||||
* Either one gives null, and the command asks as before.
|
||||
* @param {string} text
|
||||
* @param {string[]} [quoted] when given, receives the text inside each quote, in order (the checks on operands read it)
|
||||
* @returns {string|null}
|
||||
*/
|
||||
export function maskQuotes(text) {
|
||||
export function maskQuotes(text, quoted) {
|
||||
let out = '';
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const c = text[i];
|
||||
@@ -91,13 +263,14 @@ export function maskQuotes(text) {
|
||||
const before = text[i - 1], after = text[end + 1];
|
||||
if ((before !== undefined && !/[\s|]/.test(before)) || (after !== undefined && !/[\s|]/.test(after)) || text[i + 1] === '-') return null;
|
||||
out += '"_"';
|
||||
quoted?.push(text.slice(i + 1, end));
|
||||
i = end;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a shell command only reads. Conservative by design: one unrecognised word and the answer is no.
|
||||
* Whether a shell command only reads. Conservative by design: one unrecognised word or option and the answer is no.
|
||||
* Quoted text is data and is looked at after it has been set aside (maskQuotes): Get-ChildItem "C:\Users\x\Q&A" only lists.
|
||||
* @param {string} command
|
||||
* @returns {boolean}
|
||||
@@ -106,24 +279,21 @@ export function isReadOnlyShell(command) {
|
||||
const text = String(command ?? '').trim();
|
||||
if (!text || text.length > 600) return false;
|
||||
if (SAFE_VERSION.test(text)) return true;
|
||||
const masked = maskQuotes(text);
|
||||
const quoted = [];
|
||||
const masked = maskQuotes(text, quoted);
|
||||
if (masked === null || UNSAFE_SYNTAX.test(masked)) return false;
|
||||
const segments = masked.split('|').map(s => s.trim());
|
||||
return segments.every((segment) => {
|
||||
if (!segment) return false;
|
||||
const words = segment.split(/\s+/);
|
||||
const first = words[0].toLowerCase().replace(/^\.\\/, '');
|
||||
let next = 0;
|
||||
const tokens = masked.split('|').map(segment => segment.trim()).map(segment => words(segment).map(w => (w === '"_"' ? { t: quoted[next++] ?? '', q: true } : { t: w, q: false })));
|
||||
return tokens.every((segment) => {
|
||||
if (!segment.length || segment[0].q) return false;
|
||||
const first = segment[0].t.toLowerCase().replace(/^\.\\/, '');
|
||||
if (first === 'git') {
|
||||
// `git config` and `git tag`/`branch`/`remote` can write when given a value; only the bare listing forms are safe.
|
||||
const sub = (words[1] ?? '').toLowerCase();
|
||||
if (!SAFE_GIT.has(sub)) return false;
|
||||
if (['config', 'tag', 'branch', 'remote'].includes(sub)) {
|
||||
const rest = words.slice(2).filter(w => !w.startsWith('-') || /^(-l|-a|-v|-vv|--list|--all|--show-current|--get|--get-all)$/i.test(w));
|
||||
return rest.length === 0 || (sub === 'config' && words[2] === '--get') || (sub === 'remote' && words[2] === '-v');
|
||||
}
|
||||
return !words.some(w => /^--(output|ext-diff|textconv)\b/i.test(w));
|
||||
const sub = segment[1];
|
||||
const sp = sub && !sub.q ? GIT.get(sub.t) : null;
|
||||
return !!sp && argumentsAreSafe(sp, segment.slice(2));
|
||||
}
|
||||
return SAFE_COMMANDS.has(first) && !words.some(w => /^-(delete|exec|execdir|fprint|fls|ok)$/i.test(w));
|
||||
const sp = SPECS.get(first);
|
||||
return !!sp && argumentsAreSafe(sp, segment.slice(1));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* rewrites a plan turn wrote its numbered plan from "1." again this many times
|
||||
* context the context is nearly full: the Harness compaction did not keep up
|
||||
*
|
||||
* What the person is told is `guardNote`: fixed English sentences that are also in the interface catalog in all eight languages (the page
|
||||
* What the person is told is `guardNote`: fixed English sentences that are also in the interface catalog in all nine languages (the page
|
||||
* translates a `delta` frame that carries `key`). Each says what happened and gives one next step.
|
||||
*/
|
||||
|
||||
|
||||
@@ -67,40 +67,70 @@ export function nvidiaDriverVersion() {
|
||||
/** Where the builds are published; the wrong-make sentence points here. */
|
||||
export const RELEASES_URL = 'https://github.com/Niko1221/Strata/releases';
|
||||
|
||||
/** The PCI vendor ids (`10de`, `1002`, `8086`) of the Windows display adapters; empty off Windows or when the registry cannot be read. */
|
||||
export function windowsDisplayVendors({ platform = process.platform, run = execFileSync } = {}) {
|
||||
/** The PCI vendor ids of the display adapters Windows reports as present right now (PowerShell, Win32_VideoController); empty when that cannot be read. */
|
||||
export function windowsPresentVendors({ platform = process.platform, run = execFileSync } = {}) {
|
||||
const found = new Set();
|
||||
if (platform !== 'win32') return found;
|
||||
try {
|
||||
const out = run('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', 'Get-CimInstance Win32_VideoController | ForEach-Object { $_.PNPDeviceID }'], { encoding: 'utf8', timeout: 15000, windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'] });
|
||||
for (const match of String(out).matchAll(/VEN_([0-9A-F]{4})/gi)) found.add(match[1].toLowerCase());
|
||||
} catch { /* no PowerShell or a limited account: the registry answer stands */ }
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* The PCI vendor ids (`10de`, `1002`, `8086`) of the Windows display adapters; empty off Windows or when the registry cannot be read.
|
||||
* The registry keeps the entry of a card that was taken out (an NVIDIA card swapped for a Radeon, #3892): when NVIDIA and AMD are both
|
||||
* listed, only the makes Windows reports as present now count, the same rule Strata Control uses (engine_component.windows_display_adapters).
|
||||
*/
|
||||
export function windowsDisplayVendors({ platform = process.platform, run = execFileSync, present = windowsPresentVendors } = {}) {
|
||||
const found = new Set();
|
||||
if (platform !== 'win32') return found;
|
||||
try {
|
||||
const out = run('reg', ['query', 'HKLM\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}', '/s', '/v', 'MatchingDeviceId'], { encoding: 'utf8', timeout: 8000, windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'] });
|
||||
for (const match of String(out).matchAll(/VEN_([0-9A-F]{4})/gi)) found.add(match[1].toLowerCase());
|
||||
} catch { /* no registry access: the tools decide */ }
|
||||
if (found.has('10de') && found.has('1002')) {
|
||||
const now = present({ platform, run });
|
||||
const kept = new Set([...found].filter(vendor => now.has(vendor)));
|
||||
if (kept.size) return kept;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
const BACKEND_OF_VENDOR = [['10de', 'cuda'], ['1002', 'hip'], ['8086', 'sycl']];
|
||||
|
||||
/**
|
||||
* Every engine family this PC's graphics cards can run, in the order NVIDIA, AMD, Intel; STRATA_ENGINE_BACKEND wins. A PC with two
|
||||
* makes lists both, so a build for either make is accepted (recommend, never force).
|
||||
*/
|
||||
export function gpuBackendsHere(env = process.env, { vendors = windowsDisplayVendors() } = {}) {
|
||||
const forced = String(env.STRATA_ENGINE_BACKEND ?? '').trim().toLowerCase();
|
||||
if (forced) return ['cuda', 'hip', 'sycl'].includes(forced) ? [forced] : [];
|
||||
if (vendors.size) {
|
||||
const list = BACKEND_OF_VENDOR.filter(([vendor]) => vendors.has(vendor)).map(([, backend]) => backend);
|
||||
if (list.length) return list;
|
||||
}
|
||||
if (nvidiaDriverVersion()) return ['cuda'];
|
||||
try {
|
||||
const base = '/sys/class/drm';
|
||||
const seen = new Set();
|
||||
for (const card of readdirSync(base)) {
|
||||
if (!/^card\d+$/.test(card)) continue;
|
||||
try { seen.add(readFileSync(`${base}/${card}/device/vendor`, 'utf8').trim().toLowerCase()); } catch { /* no vendor file */ }
|
||||
}
|
||||
const list = [['0x10de', 'cuda'], ['0x1002', 'hip'], ['0x8086', 'sycl']].filter(([vendor]) => seen.has(vendor)).map(([, backend]) => backend);
|
||||
if (list.length) return list;
|
||||
} catch { /* not Linux */ }
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* The engine family this PC's graphics card needs ('cuda', 'hip', 'sycl'), or null when it cannot be told. The same order as Control
|
||||
* (NVIDIA first, then AMD, then Intel); STRATA_ENGINE_BACKEND wins. Reads only the driver and (Linux) the PCI vendor of the display adapters.
|
||||
*/
|
||||
export function gpuBackendHere(env = process.env, { vendors = windowsDisplayVendors() } = {}) {
|
||||
const forced = String(env.STRATA_ENGINE_BACKEND ?? '').trim().toLowerCase();
|
||||
if (forced) return ['cuda', 'hip', 'sycl'].includes(forced) ? forced : null;
|
||||
// Windows: the display adapters are the machine's own statement of which cards it has; a leftover nvidia-smi from a card that was
|
||||
// taken out must not outvote them (#3688). Same order as Control: NVIDIA, then AMD, then Intel.
|
||||
if (vendors.size) {
|
||||
for (const [vendor, backend] of [['10de', 'cuda'], ['1002', 'hip'], ['8086', 'sycl']]) if (vendors.has(vendor)) return backend;
|
||||
}
|
||||
if (nvidiaDriverVersion()) return 'cuda';
|
||||
try {
|
||||
const base = '/sys/class/drm';
|
||||
const vendors = new Set();
|
||||
for (const card of readdirSync(base)) {
|
||||
if (!/^card\d+$/.test(card)) continue;
|
||||
try { vendors.add(readFileSync(`${base}/${card}/device/vendor`, 'utf8').trim().toLowerCase()); } catch { /* no vendor file */ }
|
||||
}
|
||||
for (const [vendor, backend] of [['0x10de', 'cuda'], ['0x1002', 'hip'], ['0x8086', 'sycl']]) if (vendors.has(vendor)) return backend;
|
||||
} catch { /* not Linux */ }
|
||||
return null;
|
||||
export function gpuBackendHere(env = process.env, options = {}) {
|
||||
return gpuBackendsHere(env, options)[0] ?? null;
|
||||
}
|
||||
|
||||
const HIP_FAMILIES = [['RX 9000', ['gfx1200', 'gfx1201']], ['RX 7000', ['gfx1100', 'gfx1101', 'gfx1102']], ['RX 6000', ['gfx1030', 'gfx1031']], ['Ryzen AI Max', ['gfx1151']]];
|
||||
@@ -147,10 +177,12 @@ export async function installBundledEngine({ bundleDir, components, platform = n
|
||||
if (platform) packages = packages.filter(p => p.manifest.platform === platform);
|
||||
if (!packages.length) return { action: 'none' };
|
||||
// A build for another make of graphics card than this PC has can never run here: it is not unpacked, and the caller says so in plain words.
|
||||
const wanted = backend === undefined ? gpuBackendHere() : backend;
|
||||
// A PC with two makes (an AMD card for the model, an NVIDIA card for the desktop) accepts a build for either (#3892).
|
||||
const wantedList = backend === undefined ? gpuBackendsHere() : (Array.isArray(backend) ? backend : backend ? [backend] : []);
|
||||
const wanted = wantedList[0] ?? null;
|
||||
if (wanted && ['cuda', 'hip', 'sycl'].includes(wanted)) {
|
||||
const gpu = packages.filter(p => ['cuda', 'hip', 'sycl'].includes(p.manifest.backend));
|
||||
const fits = packages.filter(p => !gpu.includes(p) || p.manifest.backend === wanted);
|
||||
const fits = packages.filter(p => !gpu.includes(p) || wantedList.includes(p.manifest.backend));
|
||||
if (gpu.length && !fits.length) {
|
||||
const first = gpu.sort((a, b) => compareVersions(b.manifest.version, a.manifest.version))[0].manifest;
|
||||
return { action: 'wrong-make', built: first.backend, here: wanted, notice: wrongMakeNotice(first, wanted) };
|
||||
@@ -234,3 +266,55 @@ export async function installBundledEngine({ bundleDir, components, platform = n
|
||||
return { action: 'refused', reason: error?.message ?? String(error) };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* After an update from an installer that carried an engine (a per-GPU build), its `engine-bundle` folder is still in the install folder
|
||||
* (about 570 MB) although the engine was copied to the engine store long ago. It is removed only when EVERY package in it exists complete in
|
||||
* the store (every file there with the size and SHA-256 its manifest lists); otherwise it stays and one line says why.
|
||||
* Returns { removed: bool, reason?: string, packages?: number }; never throws.
|
||||
*/
|
||||
export async function removeVerifiedBundle({ bundleDir, components, log = () => {} } = {}) {
|
||||
try {
|
||||
if (!bundleDir || !components || !existsSync(bundleDir)) return { removed: false, reason: 'no bundle' };
|
||||
// Files inside a signed macOS app must stay intact after installation.
|
||||
if (process.platform === 'darwin' && resolve(bundleDir).split(sep).some(part => part.toLowerCase().endsWith('.app'))) return keepBundle(log, 'macOS app bundles must remain unchanged after signing');
|
||||
const packages = [];
|
||||
for (const entry of await readdir(bundleDir, { withFileTypes: true })) {
|
||||
if (!entry.isDirectory()) continue;
|
||||
const folder = join(bundleDir, entry.name);
|
||||
const manifest = await readManifest(folder);
|
||||
packages.push({ folder, manifest, name: entry.name });
|
||||
}
|
||||
if (!packages.length) return { removed: false, reason: 'nothing in the bundle' };
|
||||
const store = join(components, 'engine');
|
||||
const stored = existsSync(store) ? (await readdir(store, { withFileTypes: true })).filter(e => e.isDirectory() && !e.name.startsWith('.')).map(e => join(store, e.name)) : [];
|
||||
for (const pkg of packages) {
|
||||
if (!pkg.manifest) return keepBundle(log, `${pkg.name} has no readable manifest`);
|
||||
let found = false;
|
||||
for (const candidate of stored) {
|
||||
const theirs = await readManifest(candidate);
|
||||
if (!theirs || theirs.version !== pkg.manifest.version || theirs.platform !== pkg.manifest.platform || theirs.backend !== pkg.manifest.backend
|
||||
|| (theirs.variant ?? '') !== (pkg.manifest.variant ?? '') || (theirs.build_id ?? '') !== (pkg.manifest.build_id ?? '')) continue;
|
||||
if (await packageIsWhole(candidate, pkg.manifest, { deep: true })) { found = true; break; }
|
||||
}
|
||||
if (!found) return keepBundle(log, `${pkg.name} is not (or not completely) in the engine store`);
|
||||
}
|
||||
for (const pkg of packages) await rm(pkg.folder, { recursive: true, force: true });
|
||||
log(`engine bundle: the copy that came with the installer (${packages.map(p => p.name).join(', ')}) was removed; the same engine is complete in the engine store`);
|
||||
return { removed: true, packages: packages.length };
|
||||
} catch (error) {
|
||||
return keepBundle(log, `could not be checked (${error?.message ?? error})`);
|
||||
}
|
||||
}
|
||||
function keepBundle(log, why) {
|
||||
log(`engine bundle: kept in the install folder (${why})`);
|
||||
return { removed: false, reason: why };
|
||||
}
|
||||
|
||||
/**
|
||||
* What the host does once its engine step has settled: for an engine that is (or was) there, look at the install folder's leftover bundle.
|
||||
* The lines go to the host's output (console.log), which the desktop shell copies to its log file (`[host] engine bundle: ...`).
|
||||
*/
|
||||
export function cleanupAfterInstall(settled, { bundleDir, components, log = line => console.log(line) } = {}) {
|
||||
return Promise.resolve(settled).then(result => (['installed', 'kept', 'repaired'].includes(result?.action) ? removeVerifiedBundle({ bundleDir, components, log }) : null), () => null);
|
||||
}
|
||||
@@ -74,6 +74,17 @@ export function findControl({ env = process.env, platform = process.platform, ex
|
||||
return control;
|
||||
}
|
||||
|
||||
/**
|
||||
* The environment of the server the host starts from a source checkout (#3851): the key travels in the run configuration, so a
|
||||
* STRATA_API_KEY the host itself was started with is removed. Setting it to an empty string made serve/server.py stop with
|
||||
* "an API key was given but it is empty".
|
||||
*/
|
||||
export function sourceServerEnvironment(env = process.env) {
|
||||
const next = { ...env, PYTHONUNBUFFERED: '1', PYTHONUTF8: '1', PYTHONIOENCODING: 'utf-8' };
|
||||
delete next.STRATA_API_KEY;
|
||||
return next;
|
||||
}
|
||||
|
||||
/** The environment Control runs in: nothing from the user's Python, and acquiring forbidden. */
|
||||
export function controlEnvironment(control, { env = process.env, components = componentsDirectory({ env }), acquire = false } = {}) {
|
||||
const next = { ...env };
|
||||
@@ -183,6 +194,12 @@ export function createControl({ control = findControl(), env = process.env, run
|
||||
if (failed) throw Object.assign(new ControlError(failed.error, { exitCode: failed.exit_code ?? result.code, output: result.json }), { code: result.code === 7 ? 'engine_serving' : 'update_failed' });
|
||||
throw failure(result, 'The update failed.');
|
||||
},
|
||||
/** Install an engine package the person downloaded and chose (the offline path): no network; Control checks the package's own signature. */
|
||||
async installEngineFile(path, { onEvent = null, signal = null } = {}) {
|
||||
const result = await call(['components', 'install-file', path, '--output', 'jsonl'], { timeoutMs: 3600_000, onLine: onEvent ?? (() => {}), signal });
|
||||
if (result.json?.ok) return { ok: true, results: [result.json] };
|
||||
throw failure(result, 'This file could not be installed.');
|
||||
},
|
||||
async rollbackEngine() {
|
||||
const result = await call(['components', 'rollback', '--output', 'json'], { timeoutMs: 120_000 });
|
||||
if (result.json?.ok) return result.json;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** Physical topology and GPU sensors; unavailable values stay null. */
|
||||
import { readFile, readdir, realpath } from 'node:fs/promises';
|
||||
import { probe, round } from './util.mjs';
|
||||
import { windowsGpuReading } from './windows-gpu.mjs';
|
||||
|
||||
/** Unified GPUs share one system memory pool; dedicated GPUs each have their own. */
|
||||
export function gpuMemoryTotals(devices, readings) {
|
||||
@@ -39,13 +40,15 @@ export function parseNvidiaDevices(raw) {
|
||||
return [{id:uuid,index:Number(index),sensorIndex:Number(index),busId:bus?.toLowerCase(),vendor:'nvidia',name,vramGb:round((number(memory)??0)/1024,1),unified:false,backend:'cuda',driver}];
|
||||
});
|
||||
}
|
||||
/** A percentage reading; "[N/A]" and out-of-range values are no reading. */
|
||||
const percentOf = v => { const n=number(v); return n!==null&&n>=0&&n<=100?n:null; };
|
||||
export function parseNvidiaReadings(raw) {
|
||||
return raw.split('\n').flatMap(line=>{
|
||||
const [id,temp,load,memory,power,limit,gen,maxGen,width]=line.split(',').map(s=>s.trim());
|
||||
const [id,temp,load,memory,power,limit,gen,maxGen,width,fan,clock]=line.split(',').map(s=>s.trim());
|
||||
if (!id?.startsWith('GPU-')) return [];
|
||||
const t=number(temp),u=number(load),m=number(memory);
|
||||
const positive = v => { const n=number(v); return n!==null&&n>=0?n:null; };
|
||||
return [{id,temperatureC:t!==null&&t>=0&&t<=150?t:null,utilizationPct:u!==null&&u>=0&&u<=100?u:null,memoryUsedGb:m!==null&&m>=0?round(m/1024,2):null,powerW:positive(power),powerLimitW:positive(limit),pcieGen:positive(gen),pcieGenMax:positive(maxGen),pcieWidth:positive(width),pcieRxMbs:null}];
|
||||
return [{id,temperatureC:t!==null&&t>=0&&t<=150?t:null,utilizationPct:u!==null&&u>=0&&u<=100?u:null,memoryUsedGb:m!==null&&m>=0?round(m/1024,2):null,powerW:positive(power),powerLimitW:positive(limit),pcieGen:positive(gen),pcieGenMax:positive(maxGen),pcieWidth:positive(width),pcieRxMbs:null,fanPct:percentOf(fan),clockMhz:positive(clock)}];
|
||||
});
|
||||
}
|
||||
export function parsePcieThroughput(raw) {
|
||||
@@ -72,23 +75,30 @@ export async function detectDrmGpus() {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export async function readGpuTelemetry(gpus) {
|
||||
/** `transfer: false` skips the PCIe throughput sample (a second nvidia-smi); it only means something while a model runs. */
|
||||
export async function readGpuTelemetry(gpus, { transfer: wantTransfer = true, run = probe } = {}) {
|
||||
const now=new Date().toISOString();
|
||||
const hasNvidia=gpus.some(g=>g.vendor==='nvidia');
|
||||
let raw=hasNvidia?await probe('nvidia-smi',['--query-gpu=uuid,temperature.gpu,utilization.gpu,memory.used,power.draw,power.limit,pcie.link.gen.current,pcie.link.gen.max,pcie.link.width.current','--format=csv,noheader,nounits'],2000):'';
|
||||
let raw=hasNvidia?await run('nvidia-smi',['--query-gpu=uuid,temperature.gpu,utilization.gpu,memory.used,power.draw,power.limit,pcie.link.gen.current,pcie.link.gen.max,pcie.link.width.current,fan.speed,clocks.current.graphics','--format=csv,noheader,nounits'],2000):'';
|
||||
// Older drivers can reject a field; retain their basic sensors in that case.
|
||||
if(hasNvidia&&!raw)raw=await probe('nvidia-smi',['--query-gpu=uuid,temperature.gpu,utilization.gpu,memory.used','--format=csv,noheader,nounits'],2000);
|
||||
if(hasNvidia&&!raw)raw=await run('nvidia-smi',['--query-gpu=uuid,temperature.gpu,utilization.gpu,memory.used','--format=csv,noheader,nounits'],2000);
|
||||
const nvidia=new Map(parseNvidiaReadings(raw).map(r=>[r.id,r]));
|
||||
const transfer=hasNvidia?parsePcieThroughput(await probe('nvidia-smi',['dmon','-s','t','-c','1'],1500)):new Map();
|
||||
const transfer=hasNvidia&&wantTransfer?parsePcieThroughput(await run('nvidia-smi',['dmon','-s','t','-c','1'],1500)):new Map();
|
||||
return Promise.all(gpus.map(async gpu=>{
|
||||
let reading=nvidia.get(gpu.id)??{id:gpu.id??`${gpu.vendor}:${gpu.index}`,temperatureC:null,utilizationPct:null,memoryUsedGb:null,powerW:null,powerLimitW:null,pcieGen:null,pcieGenMax:null,pcieWidth:null,pcieRxMbs:null};
|
||||
if(gpu.vendor==='nvidia')reading={...reading,pcieRxMbs:transfer.get(gpu.sensorIndex??gpu.index)??null};
|
||||
if(gpu.luid&&!nvidia.has(gpu.id)) {
|
||||
const counters=windowsGpuReading(gpu.luid);
|
||||
if(counters)reading={...reading,utilizationPct:counters.utilizationPct,memoryUsedGb:round(counters.memoryUsedGb,2)};
|
||||
}
|
||||
if(gpu.sensorPath&&!nvidia.has(gpu.id)) {
|
||||
let temperature=null,power=null,powerLimit=null;
|
||||
let temperature=null,power=null,powerLimit=null,fanPwm=null,clockHz=null;
|
||||
for(const hwmon of await list(`${gpu.sensorPath}/hwmon`)) {
|
||||
const folder=`${gpu.sensorPath}/hwmon/${hwmon}`,inputs=(await list(folder)).filter(n=>/^temp\d+_input$/.test(n));
|
||||
power ??= number(await read(`${folder}/power1_average`)) ?? number(await read(`${folder}/power1_input`));
|
||||
powerLimit ??= number(await read(`${folder}/power1_cap`));
|
||||
fanPwm ??= number(await read(`${folder}/pwm1`)); // 0-255, the fan's duty as the amdgpu driver reports it
|
||||
clockHz ??= number(await read(`${folder}/freq1_input`)); // the graphics clock in Hz
|
||||
for(const input of inputs) {
|
||||
const label=await read(`${folder}/${input.replace('_input','_label')}`);
|
||||
if(label&&!/edge|gpu/i.test(label))continue;
|
||||
@@ -100,7 +110,7 @@ export async function readGpuTelemetry(gpus) {
|
||||
const utilization=number(await read(`${gpu.sensorPath}/gpu_busy_percent`)),bytes=number(await read(`${gpu.sensorPath}/mem_info_vram_used`));
|
||||
const gen=path=>read(path).then(raw=>({2.5:1,5:2,8:3,16:4,32:5,64:6}[Number.parseFloat(raw)]??null));
|
||||
const [pcieGen,pcieGenMax,width]=await Promise.all([gen(`${gpu.sensorPath}/current_link_speed`),gen(`${gpu.sensorPath}/max_link_speed`),read(`${gpu.sensorPath}/current_link_width`)]);
|
||||
reading={...reading,temperatureC:temperature,utilizationPct:utilization!==null&&utilization>=0&&utilization<=100?utilization:null,memoryUsedGb:bytes!==null&&bytes>=0?round(bytes/1024**3,2):null,powerW:power!==null&&power>=0?power/1e6:null,powerLimitW:powerLimit!==null&&powerLimit>=0?powerLimit/1e6:null,pcieGen,pcieGenMax,pcieWidth:number(width)};
|
||||
reading={...reading,fanPct:fanPwm!==null&&fanPwm>=0&&fanPwm<=255?Math.round(fanPwm/255*100):null,clockMhz:clockHz!==null&&clockHz>0?Math.round(clockHz/1e6):null,temperatureC:temperature,utilizationPct:utilization!==null&&utilization>=0&&utilization<=100?utilization:null,memoryUsedGb:bytes!==null&&bytes>=0?round(bytes/1024**3,2):null,powerW:power!==null&&power>=0?power/1e6:null,powerLimitW:powerLimit!==null&&powerLimit>=0?powerLimit/1e6:null,pcieGen,pcieGenMax,pcieWidth:number(width)};
|
||||
}
|
||||
return {...reading,sampledAt:now,source:Object.entries(reading).some(([key,value])=>key!=='id'&&typeof value==='number')?'sensor':'none'};
|
||||
}));
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// DeepSeek-V4.1-Flash's own context limit, read from its pack (the app offers sizes up to it: src/lib/deepseek-context.ts).
|
||||
// Project Maya v1.1.28 (#442, @needmorevram, MIT) did the same in its dashboard. strata_control/dsv41_context.py reads the same file for setup and the Terminal.
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
/** The pack's own limit: `max_position_embeddings` in <pack>/ds4.txt. Null when there is no pack, no file or no such line (the choices then stay as before). */
|
||||
export function packContextLimit(pack) {
|
||||
if (!pack) return null;
|
||||
try {
|
||||
const match = /^max_position_embeddings\s+(\d+)\s*$/m.exec(readFileSync(join(pack, 'ds4.txt'), 'utf8'));
|
||||
const value = match ? Number(match[1]) : 0;
|
||||
return Number.isSafeInteger(value) && value >= 1024 ? value : null;
|
||||
} catch { return null; }
|
||||
}
|
||||
|
||||
/** The limit of the pack a DeepSeek run config names (`--pack DIR` in its arguments). */
|
||||
export function configContextLimit(config) {
|
||||
const args = (config?.args ?? []).map(String), at = args.indexOf('--pack');
|
||||
return at >= 0 && at + 1 < args.length ? packContextLimit(args[at + 1]) : null;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* GPU energy since the host started, in Wh (#3628): the power reading held for the time since the last tick, added up.
|
||||
* A long gap (the PC slept, the host was paused) counts for at most 5 s, so a sleep never adds a made-up hour of use.
|
||||
*/
|
||||
const meter = { wh: 0, at: 0 };
|
||||
|
||||
export function addEnergy(powerW, at) {
|
||||
const dt = meter.at ? Math.min((at - meter.at) / 1000, 5) : 0;
|
||||
meter.at = at;
|
||||
if (typeof powerW === 'number' && Number.isFinite(powerW) && powerW >= 0 && dt > 0) meter.wh += powerW * dt / 3600;
|
||||
return meter.wh;
|
||||
}
|
||||
|
||||
export const energyWh = () => meter.wh;
|
||||
@@ -62,7 +62,10 @@ export function watchedWindowsDialog(shell, args, { readyMs = 30_000, openMs = 2
|
||||
const later = () => { clearTimeout(timer); ready = true; setTimeout(() => end(resolve, { stdout: '' }), openMs).unref?.(); };
|
||||
child.stdout?.on('data', chunk => { stdout += chunk; if (!ready && /^READY\s*$/m.test(stdout)) { clearTimeout(timer); later(); } });
|
||||
child.on('error', error => end(reject, error));
|
||||
child.on('close', code => { if (settled) return; settled = true; clearTimeout(timer); code === 0 ? resolve({ stdout }) : reject(Object.assign(new Error('exit ' + code), { code })); });
|
||||
child.on('close', code => { if (settled) return; settled = true; clearTimeout(timer);
|
||||
// PowerShell ended before its window opened (security software ended it, #3831): the person types the path instead.
|
||||
if (!ready) return resolve({ noDialog: true });
|
||||
code === 0 ? resolve({ stdout }) : reject(Object.assign(new Error('exit ' + code), { code })); });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { CONTEXT_TOKENS, VARIANTS, footprint } from './catalog.mjs';
|
||||
import { MODELS_DIR, diskFreeGb, diskTotalGb } from './store.mjs';
|
||||
import { probe, round } from './util.mjs';
|
||||
import { utf8Script } from './powershell-utf8.mjs';
|
||||
import { DX_ADAPTERS_SCRIPT, parseDxAdapters, windowsOtherGpus } from './windows-gpu.mjs';
|
||||
|
||||
let cached = null;
|
||||
let cachedAt = 0;
|
||||
@@ -187,11 +188,12 @@ async function detectGpus(platform, totalGb) {
|
||||
}
|
||||
if(platform==='win32') {
|
||||
const raw=await probe('powershell.exe',['-NoProfile','-NonInteractive','-Command',utf8Script('Get-CimInstance Win32_VideoController | Select-Object Name,PNPDeviceID | ConvertTo-Json -Compress')]);
|
||||
try {const parsed=JSON.parse(raw);for(const row of Array.isArray(parsed)?parsed:[parsed]) {
|
||||
if(!row?.Name||(/nvidia/i.test(row.Name)&&gpus.some(g=>g.vendor==='nvidia')))continue;
|
||||
const vendor=/amd|radeon/i.test(row.Name)?'amd':/intel/i.test(row.Name)?'intel':'unknown';
|
||||
gpus.push({id:String(row.PNPDeviceID),index:gpus.length,vendor,name:row.Name,vramGb:0,unified:false,backend:'vulkan'});
|
||||
}}catch{}
|
||||
try {
|
||||
const parsed=JSON.parse(raw);
|
||||
const rows=(Array.isArray(parsed)?parsed:[parsed]).filter(row=>row?.Name&&!(/nvidia/i.test(row.Name)&&gpus.some(g=>g.vendor==='nvidia')));
|
||||
const dx=rows.length?parseDxAdapters(await probe('powershell.exe',['-NoProfile','-NonInteractive','-Command',DX_ADAPTERS_SCRIPT],8000)):[];
|
||||
for(const card of windowsOtherGpus(rows,dx))gpus.push({...card,index:gpus.length,unified:false,backend:'vulkan'});
|
||||
}catch{}
|
||||
}
|
||||
gpus.forEach((g,i)=>{g.index=i;});
|
||||
|
||||
|
||||
+65
-10
@@ -32,7 +32,8 @@ import { findBrowser, findPlaywrightMcp } from './agent/browser-probe.mjs';
|
||||
*/
|
||||
import http from 'node:http';
|
||||
import { homedir } from 'node:os';
|
||||
import { cpSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
||||
import { statfsSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
||||
import { pipeline } from 'node:stream/promises';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { execFile } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
@@ -61,7 +62,7 @@ import { createForkTimeskip } from './timeskip-fork.mjs';
|
||||
import { prepareOversized } from './oversize.mjs';
|
||||
import { createChatFolders, chatRootOf, openFile, resolveChatFile, previewFile, rawFile, createAttachments, withAttachments } from './chat-files.mjs';
|
||||
import { createLlmProxy, samplingFromExpert } from './agent/llm-shape.mjs';
|
||||
import { checkUpdates, checkComponentUpdates } from './updates.mjs';
|
||||
import { checkUpdates, checkComponentUpdates, engineFirstRun } from './updates.mjs';
|
||||
import { plainNoModel } from './no-model-text.mjs';
|
||||
import { createAppUi } from './app-ui.mjs';
|
||||
import { appVersionFrom, appVersionToShow } from './app-version.mjs';
|
||||
@@ -69,7 +70,9 @@ import { createImageModels } from './image-models.mjs';
|
||||
import { createRuntimeModels } from './runtime-models.mjs';
|
||||
import { createNativeControl } from './native-control.mjs';
|
||||
import { nativeUnloadPlan } from './storage-check.mjs';
|
||||
import { installBundledEngine } from './bundled-engine.mjs';
|
||||
import { installBundledEngine, cleanupAfterInstall } from './bundled-engine.mjs';
|
||||
import { systemLocale } from './region.mjs';
|
||||
import { createShellNotifier, DEFAULT_PORT, parsePortNotice, readShellPrefs, writeShellPrefs } from './shell-prefs.mjs';
|
||||
import { findControl, createControl, componentsDirectory } from './control-runtime.mjs';
|
||||
import { forbidden as acquisitionForbidden } from './acquisition.mjs';
|
||||
import { randomBytes, timingSafeEqual } from 'node:crypto';
|
||||
@@ -114,7 +117,7 @@ const WORKSPACE_NAME = process.env.STRATA_WORKSPACE ? basename(WORKSPACE) : 'Str
|
||||
const insideApp = path => { const rel = relative(ROOT, resolve(path)); return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel)); };
|
||||
|
||||
const hub = new EventHub();
|
||||
const modelProviders = createModelProviders({ directory: store.DATA_DIR, changed: value => hub.send('providers', withPictureAnswers(value)) });
|
||||
const modelProviders = createModelProviders({ directory: store.DATA_DIR, knownThinks: (connection, modelId) => visionProbe.knownThinks(connection, modelId), changed: value => hub.send('providers', withPictureAnswers(value)) });
|
||||
const imageModels = createImageModels({ dataDir: store.DATA_DIR, modelsDir: () => store.MODELS_DIR, real: models.REAL, changed: value => hub.send('image-models', value) });
|
||||
/* The installed app ships Strata Control (python + strata_control) next to the host; a source checkout has none and keeps its older paths. */
|
||||
const CONTROL = findControl();
|
||||
@@ -126,10 +129,26 @@ const appUi = createAppUi({ shutdown: () => shutdown() });
|
||||
/* The app's version has one source: the desktop shell passes it (STRATA_APP_VERSION, from apps/desktop/src-tauri/Cargo.toml). Outside the app it is read from the same file in a checkout, else 'dev'. */
|
||||
function appVersion() { return appVersionFrom({ env: process.env, here: HERE }); }
|
||||
const appUpdater = appUi.updater;
|
||||
const shellNotifier = createShellNotifier();
|
||||
/** What the page needs for the desktop settings: whether this is the desktop app, the port in use, the saved choices and a busy-port notice. */
|
||||
function shellState() {
|
||||
const saved = readShellPrefs();
|
||||
const desktop = !!shellNotifier;
|
||||
return {
|
||||
desktop,
|
||||
tray: desktop && process.platform !== 'linux',
|
||||
port: PORT, defaultPort: DEFAULT_PORT,
|
||||
pinnedPort: saved.port || null, minimizeToTray: saved.tray,
|
||||
portNotice: parsePortNotice(process.env.STRATA_PORT_NOTICE),
|
||||
};
|
||||
}
|
||||
/* The engine that ships inside the installer is put in the components folder when this PC has none (or an older one); no network, hashes checked. The model list waits for it. */
|
||||
const bundledEngine = control && !process.env.STRATA_NO_BUNDLED_ENGINE
|
||||
? installBundledEngine({ bundleDir: process.env.STRATA_ENGINE_BUNDLE_DIR || resolve(HERE, '..', '..', 'engine-bundle'), components: componentsDirectory(), log: line => console.log(line) })
|
||||
: Promise.resolve({ action: 'none' });
|
||||
const engineBundleDir = process.env.STRATA_ENGINE_BUNDLE_DIR || resolve(HERE, '..', '..', 'engine-bundle');
|
||||
/* An update from a per-GPU installer leaves its engine-bundle behind; it goes only when the same engine is complete in the store (sizes and hashes). */
|
||||
cleanupAfterInstall(bundledEngine, { bundleDir: engineBundleDir, components: componentsDirectory() });
|
||||
let bundledEngineSettled = !(control && !process.env.STRATA_NO_BUNDLED_ENGINE);
|
||||
bundledEngine.then(() => { bundledEngineSettled = true; }, () => { bundledEngineSettled = true; });
|
||||
/* A build made for another make of graphics card is not unpacked; Control's answer then carries the plain sentence (with the right download) instead of its own. */
|
||||
@@ -220,6 +239,7 @@ models.init(hub);
|
||||
engine.init(hub);
|
||||
engineInstall.init(hub);
|
||||
monitor.init(hub, boot);
|
||||
monitor.setLiveProbe(() => native.hasLive());
|
||||
serving.init(hub, { port: PORT, host: HOST });
|
||||
runtimeModels=createRuntimeModels({hardware:()=>hardware.cachedHardware()??boot,library:()=>models.library(),requests:()=>serving.state().requests,real:models.REAL,changed:value=>{
|
||||
if(!models.REAL){const primary=value.instances.find(i=>i.id===value.defaultId);if(store.get().loaded!==(primary?.variantId??null))store.update({loaded:primary?.variantId??null});}
|
||||
@@ -553,17 +573,18 @@ function clientName(req) {
|
||||
return 'Local client';
|
||||
}
|
||||
|
||||
async function runRemoteTurn({ selection, message, history, images = [], onFrame, signal, workspaceId }) {
|
||||
async function runRemoteTurn({ selection, message, history, images = [], thinking, onFrame, signal, workspaceId }) {
|
||||
const controller = new AbortController();
|
||||
const requestSignal = signal ? AbortSignal.any([signal, controller.signal]) : controller.signal;
|
||||
let entry;
|
||||
const started = Date.now();
|
||||
try {
|
||||
const { connection, model } = modelProviders.resolve(selection);
|
||||
if (connection.protocol === 'openai-chat' && model.reasoning == null) await visionProbe.check(connection, model.id);
|
||||
const appliedSkills = selectSkills(skillState, message, workspaceId);
|
||||
entry = serving.open({ client: 'Strata chat', endpoint: connection.protocol === 'anthropic' ? '/messages' : connection.protocol === 'openai-responses' ? '/responses' : '/chat/completions', model: `${connection.name} · ${model.name}`, cancel: () => controller.abort(new DOMException('Cancelled by the user', 'AbortError')) });
|
||||
serving.mark(entry.id, { state: 'generating' });
|
||||
const result = await modelProviders.stream({ selection, message, history, images, signal: requestSignal, systemPrompt: ['You are Strata, a helpful assistant. Answer clearly. Do not claim to have read files or performed actions unless their results are included in the conversation.', skillInstructions(appliedSkills)].filter(Boolean).join('\n\n'), onFrame: frame => {
|
||||
const result = await modelProviders.stream({ selection, message, history, images, thinking, signal: requestSignal, systemPrompt: ['You are Strata, a helpful assistant. Answer clearly. Do not claim to have read files or performed actions unless their results are included in the conversation.', skillInstructions(appliedSkills)].filter(Boolean).join('\n\n'), onFrame: frame => {
|
||||
if (frame.type === 'start') noteSkillUse(appliedSkills);
|
||||
if (frame.type === 'done') serving.mark(entry.id, { tokensIn: frame.tokensIn, tokensOut: frame.tokensOut, usageSource: frame.usageSource });
|
||||
onFrame({ ...frame, requestId: entry.id, model: model.name, contextMax: model.contextMax, remoteModel: true, ...(frame.type === 'start' ? { skills: appliedSkills.map(s => s.name) } : {}) });
|
||||
@@ -626,7 +647,7 @@ async function runAgentTurn({ res, controller, chatId, body, message, workspaceI
|
||||
}
|
||||
|
||||
async function runTurn({ message, history = [], onFrame, signal, client, workspaceId = null, sessionId = null, remoteModel = null, runtimeModelId = undefined, nativeModelId, images=[], useTools=false, thinking='medium', thinkingBudget=0 }) {
|
||||
if (remoteModel) return runRemoteTurn({ selection: remoteModel, message, history, images, onFrame, signal, workspaceId });
|
||||
if (remoteModel) return runRemoteTurn({ selection: remoteModel, message, history, images, thinking, onFrame, signal, workspaceId });
|
||||
if(native.hasLive()||nativeModelId){
|
||||
let instance;try{instance=native.resolveInstance(nativeModelId??native.state().defaultId);}catch(e){const message=plainNoModel(e.message);onFrame({type:'error',message});return {error:message};}const started=Date.now(),cancel=new AbortController();
|
||||
const entry=serving.open({client:client??'Strata chat',endpoint:'/chat/completions',model:instance.apiModelId,instanceId:instance.id,gpuIds:instance.gpus.map(String),cancel:()=>cancel.abort()});
|
||||
@@ -1022,11 +1043,11 @@ async function api(req, res, path, method, url) {
|
||||
if(nativeOperation&&method==='POST')return json(res,200,await native.cancel(nativeOperation[1]));
|
||||
const nativeInstance=/^\/api\/native\/instances\/([a-z0-9-]+)\/(unload|default)$/.exec(path);
|
||||
if(nativeInstance&&method==='POST')return json(res,200,nativeInstance[2]==='unload'?await native.unload(nativeInstance[1]):native.setDefault(nativeInstance[1]));
|
||||
const nativeSettings=/^\/api\/native\/models\/([a-z0-9_-]+)\/settings$/.exec(path);
|
||||
const nativeSettings=/^\/api\/native\/models\/([a-z0-9_.-]+)\/settings$/.exec(path);
|
||||
/* Expert mode shows what will actually run: the saved tuning's values come with the settings (null when none applies or unreadable). */
|
||||
if(nativeSettings&&method==='GET'){const settings=native.settings(nativeSettings[1]);let tuned=null;try{const t=await native.tuneEffective({model:nativeSettings[1],resourceProfile:url.searchParams.get('resourceProfile')||undefined,vision:url.searchParams.get('vision')||undefined});tuned=t.applied?t:null;}catch{tuned=null;}return json(res,200,{...settings,tuned});}
|
||||
if(nativeSettings&&method==='PATCH')return json(res,200,native.save(nativeSettings[1],await readBody(req)));
|
||||
const nativeSettingsFile=/^\/api\/native\/models\/([a-z0-9_-]+)\/settings-file$/.exec(path);
|
||||
const nativeSettingsFile=/^\/api\/native\/models\/([a-z0-9_.-]+)\/settings-file$/.exec(path);
|
||||
if(nativeSettingsFile&&method==='GET')return json(res,200,native.settingsFile(nativeSettingsFile[1]));
|
||||
if(nativeSettingsFile&&method==='POST')return json(res,200,await native.openSettingsFile(nativeSettingsFile[1]));
|
||||
|
||||
@@ -1327,6 +1348,27 @@ async function api(req, res, path, method, url) {
|
||||
}
|
||||
|
||||
if (path === '/api/setup' && method === 'GET') return json(res, 200, setupState());
|
||||
if (path === '/api/engine/first-run' && method === 'GET') {
|
||||
if (!control?.updateCheck) return json(res, 200, { status: 'unavailable', gpus: [] });
|
||||
const info = await engineFirstRun({ control, gpus: hardware.cachedHardware()?.gpus ?? [] });
|
||||
try { let at = componentsDirectory(); while (at && !existsSync(at) && dirname(at) !== at) at = dirname(at); const f = statfsSync(at); info.freeBytes = Number(f.bavail) * Number(f.bsize); } catch { /* unknown: no warning */ }
|
||||
return json(res, 200, info);
|
||||
}
|
||||
if (path === '/api/engine/job' && method === 'GET') {
|
||||
// The newest engine download / file install, read without waiting for the native snapshot to connect (the first-run card needs it before that).
|
||||
const kinds = ['update-engine', 'install-engine-file'];
|
||||
return json(res, 200, { job: native.state().jobs.filter(j => kinds.includes(j.kind)).slice(-1)[0] ?? null });
|
||||
}
|
||||
if (path === '/api/engine/from-file' && method === 'POST') {
|
||||
// The person chose an engine package in the page (the offline path). The bytes come here; Control checks and installs them.
|
||||
const name = String(req.headers['x-file-name'] ?? 'engine.tar.gz').replace(/[^A-Za-z0-9._-]/g, '_').slice(-120);
|
||||
if (!/\.(tar\.gz|tgz|tar\.xz|zip)$/i.test(name)) return error(res, 400, 'This is not a Strata engine package. Choose the .tar.gz or .zip file from the release page.');
|
||||
const folder = join(store.DATA_DIR, 'incoming-engine');
|
||||
mkdirSync(folder, { recursive: true, mode: 0o700 });
|
||||
const target = join(folder, name);
|
||||
await pipeline(req, createWriteStream(target, { mode: 0o600 }));
|
||||
return json(res, 202, native.operation('install-engine-file', { path: target }));
|
||||
}
|
||||
if (path === '/api/updates/check' && method === 'GET' && control?.updateCheck) return json(res, 200, await checkComponentUpdates({ control, appUpdater, appVersion: process.env.STRATA_APP_VERSION || null }));
|
||||
if (path === '/api/updates/check' && method === 'GET') return json(res, 200, await checkUpdates({ appVersion:appVersionToShow(setupState().app.version,native.state().version), engineVersion:native.state().available?(native.state().installed?.engine?.version??null):(await engine.config()).engine.version }));
|
||||
|
||||
@@ -1561,7 +1603,7 @@ async function api(req, res, path, method, url) {
|
||||
if (cancelMatch && method === 'POST') return json(res, 200, serving.cancel(cancelMatch[1]));
|
||||
|
||||
// --- monitor ------------------------------------------------------------
|
||||
if (path === '/api/monitor') return json(res, 200, monitor.snapshot());
|
||||
if (path === '/api/monitor') { monitor.watch(); return json(res, 200, monitor.snapshot()); }
|
||||
|
||||
// --- skills / workspace -------------------------------------------------
|
||||
if (path === '/api/skills' && method === 'GET') {
|
||||
@@ -1905,6 +1947,19 @@ async function api(req, res, path, method, url) {
|
||||
try { return json(res, 200, await agent.approve({ chatId: b.sessionId, callId: b.toolId, decision: b.decision })); }
|
||||
catch (e) { return error(res, e.code === 'approval-gone' ? 409 : 400, e.message); }
|
||||
}
|
||||
/* The desktop shell's own choices (#3402, #3477): the port it asks for, the tray, and a desktop notification through the shell. */
|
||||
if (path === '/api/locale' && method === 'GET') return json(res, 200, systemLocale());
|
||||
if (path === '/api/shell' && method === 'GET') return json(res, 200, shellState());
|
||||
if (path === '/api/shell/prefs' && method === 'POST') {
|
||||
const b = await readBody(req);
|
||||
try { writeShellPrefs(b); } catch (e) { return error(res, 400, e.message); }
|
||||
return json(res, 200, shellState());
|
||||
}
|
||||
if (path === '/api/shell/notify' && method === 'POST') {
|
||||
const b = await readBody(req);
|
||||
if (!shellNotifier || typeof b.title !== 'string') return json(res, 200, { shown: false });
|
||||
try { return json(res, 200, await shellNotifier.notify({ title: b.title, body: String(b.body ?? '') })); } catch { return json(res, 200, { shown: false }); }
|
||||
}
|
||||
/* The person changed the chat's mode while a turn runs: it applies to the next tool call, goal and helpers included. */
|
||||
if (path === '/api/chat/mode' && method === 'POST') {
|
||||
const b = await readBody(req);
|
||||
|
||||
@@ -14,8 +14,22 @@ export function createLocalShare({ handle, hasKey, changed = () => {}, host = '0
|
||||
if (listener) throw new Error('Sharing is already starting.');
|
||||
listener = http.createServer(async (req, res) => {
|
||||
const path = apiPath(new URL(req.url ?? '/', 'http://localhost').pathname);
|
||||
const method = req.method ?? 'GET';
|
||||
// #3208: with an API key set, a browser page of any site can call the shared API - the key decides, not the
|
||||
// origin. The browser's preflight (OPTIONS) never carries the key (the spec says so), so it is answered here,
|
||||
// before the path check and the key check; the real request that follows still goes through both. Without a
|
||||
// key no CORS headers go out, as before: the listener stays "a device on this network" (SECURITY.md), and a
|
||||
// web page of another site on the internet cannot read the model through it.
|
||||
if (hasKey()) {
|
||||
res.setHeader('access-control-allow-origin', '*');
|
||||
res.setHeader('access-control-allow-methods', 'GET, POST, OPTIONS');
|
||||
// the headers the preflight asks for (SDKs add their own; Anthropic browser clients send anthropic-version)
|
||||
res.setHeader('access-control-allow-headers', String(req.headers['access-control-request-headers'] ?? '') || 'authorization, content-type, x-api-key, x-strata-client, anthropic-version, anthropic-beta');
|
||||
res.setHeader('access-control-max-age', '600');
|
||||
if (method === 'OPTIONS') { res.writeHead(204); res.end(); return; }
|
||||
}
|
||||
if (!['/v1/models','/v1/chat/completions','/v1/messages'].includes(path)) { res.writeHead(404); res.end('Not found'); return; }
|
||||
try { await handle(req, res, path, req.method ?? 'GET'); }
|
||||
try { await handle(req, res, path, method); }
|
||||
catch { if (!res.headersSent) res.writeHead(500); res.end('Request failed'); }
|
||||
});
|
||||
try { await new Promise((resolve,reject) => { listener.once('error',reject); listener.listen(port,host,resolve); }); }
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
*/
|
||||
import { basename } from 'node:path';
|
||||
|
||||
const PART_WORDS = { engine: 'the engine program', 'tokenizer/vocab.json': 'the tokenizer', 'tokenizer/merges.txt': 'the tokenizer', 'tokenizer/token_type.json': 'the tokenizer' };
|
||||
const PART_WORDS = { engine: 'the engine program', 'component:strata-engine': 'the engine program', 'tokenizer/vocab.json': 'the tokenizer', 'tokenizer/merges.txt': 'the tokenizer', 'tokenizer/token_type.json': 'the tokenizer' };
|
||||
|
||||
/** Short readable names, no duplicates, most useful first. */
|
||||
export function missingNames(controlParts, installerFiles) {
|
||||
const names = [];
|
||||
const add = text => { const t = String(text ?? '').trim(); if (t && !names.includes(t)) names.push(t); };
|
||||
for (const file of Array.isArray(installerFiles) ? installerFiles : []) add(basename(String(file).split(String.fromCharCode(92)).join('/')));
|
||||
for (const file of Array.isArray(installerFiles) ? installerFiles : []) { const name = basename(String(file).split(String.fromCharCode(92)).join('/')); add(PART_WORDS[name] ?? name); }
|
||||
for (const item of Array.isArray(controlParts) ? controlParts : []) {
|
||||
add(PART_WORDS[item?.part] ?? item?.file ?? item?.part);
|
||||
add(PART_WORDS[item?.part] ?? PART_WORDS[item?.file] ?? item?.file ?? item?.part);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/** Saved API connections. Secrets never leave the host's private credentials file. */
|
||||
import { modelReadsPictures, modelSupportsReasoning } from './vision-probe.mjs';
|
||||
import { isOpenRouter, OPENROUTER_EFFORTS } from './agent/profile.mjs';
|
||||
import { existsSync, readFileSync, writeFileSync, renameSync, mkdirSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
@@ -49,7 +50,7 @@ export function normalizeBaseUrl(value) {
|
||||
const publicConnection = ({ apiKey, ...connection }) => ({ ...connection, apiKeySet: !!apiKey });
|
||||
const numeric = value => typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : null;
|
||||
|
||||
export function createModelProviders({ directory, changed = () => {}, fetchImpl = fetch }) {
|
||||
export function createModelProviders({ directory, changed = () => {}, fetchImpl = fetch, knownThinks = () => null }) {
|
||||
mkdirSync(directory, { recursive: true });
|
||||
const file = join(directory, 'model-providers.json');
|
||||
let connections = [];
|
||||
@@ -142,7 +143,7 @@ export function createModelProviders({ directory, changed = () => {}, fetchImpl
|
||||
const models = [...new Map(rows.filter(m => text(m.id, 256)).map(m => [m.id, { id: text(m.id, 256), name: text(m.display_name ?? m.name) || text(m.id, 256), contextMax: numeric(m.context_length ?? m.max_context_length ?? m.context_window), maxOutput: numeric(m.max_output_tokens ?? m.max_completion_tokens ?? m.top_provider?.max_completion_tokens), vision: modelReadsPictures(m), reasoning: modelSupportsReasoning(m) }])).values()];
|
||||
return { models: models.sort((a, b) => a.name.localeCompare(b.name)) };
|
||||
}
|
||||
async function stream({ selection, message, history = [], systemPrompt = '', images = [], signal, onFrame }) {
|
||||
async function stream({ selection, message, history = [], systemPrompt = '', images = [], thinking, signal, onFrame }) {
|
||||
const { connection, model } = resolve(selection);
|
||||
const started = Date.now();
|
||||
const messages = history.filter(m => ['user', 'assistant'].includes(m.role) && typeof m.content === 'string').slice(-40).map(m => ({ role: m.role, content: m.content }));
|
||||
@@ -155,6 +156,12 @@ export function createModelProviders({ directory, changed = () => {}, fetchImpl
|
||||
: protocol === 'openai-responses'
|
||||
? { model: model.id, input: messages, instructions: systemPrompt, stream: true, store: false }
|
||||
: { model: model.id, messages: [...(systemPrompt ? [{ role: 'system', content: systemPrompt }] : []), ...messages], stream: true, ...(['openai', 'deepseek', 'openrouter', 'google', 'moonshotai'].includes(connection.provider) ? { stream_options: { include_usage: true } } : {}) };
|
||||
// Match the native composer's effort names. Unknown support and other protocols keep provider defaults.
|
||||
const choice = typeof thinking === 'string' ? thinking.toLowerCase() : '';
|
||||
if (protocol === 'openai-chat' && (model.reasoning ?? knownThinks(connection, model.id)) === true && ['off', 'low', 'medium', 'high', 'max'].includes(choice)) {
|
||||
if (isOpenRouter(connection)) payload.reasoning = { effort: OPENROUTER_EFFORTS[choice] };
|
||||
else payload.reasoning_effort = ({ off: 'none', max: 'high' })[choice] ?? choice;
|
||||
}
|
||||
const requestSignal = signal ? AbortSignal.any([signal, AbortSignal.timeout(10 * 60 * 1000)]) : AbortSignal.timeout(10 * 60 * 1000);
|
||||
const res = await request(connection, protocol === 'anthropic' ? 'messages' : protocol === 'openai-responses' ? 'responses' : 'chat/completions', { method: 'POST', body: JSON.stringify(payload), signal: requestSignal });
|
||||
if (!res.body) fail('The model API returned an empty response.');
|
||||
|
||||
@@ -3,6 +3,9 @@ import { variant as catalogVariant, footprint } from './catalog.mjs';
|
||||
import { detect, cachedHardware } from './hardware.mjs';
|
||||
import { readGpuTelemetry, gpuMemoryTotals } from './device-probes.mjs';
|
||||
import { createSystemSampler } from './system-telemetry.mjs';
|
||||
import { sensorPace, WATCH_MS } from './sensor-pace.mjs';
|
||||
import { readTemperatures } from './temperature-telemetry.mjs';
|
||||
import { addEnergy, energyWh } from './energy-meter.mjs';
|
||||
import { state as servingState } from './serving.mjs';
|
||||
import { originalDashboard } from './monitor-dashboard.mjs';
|
||||
import { get as getStore } from './store.mjs';
|
||||
@@ -58,7 +61,17 @@ let hwCache = null;
|
||||
let ticker = null;
|
||||
let memoryWarningShown = false;
|
||||
let sensorsPending = false, sensorsAt = 0;
|
||||
/* The Monitor screen asks (GET /api/monitor) every few seconds while it is open; a model that is loaded counts as live (#4066). */
|
||||
let watchedUntil = 0, liveProbe = () => false;
|
||||
export function watch() {
|
||||
const wasIdle = Date.now() >= watchedUntil;
|
||||
watchedUntil = Date.now() + WATCH_MS;
|
||||
if (wasIdle) sensorsAt = 0; // opening the Monitor after a quiet spell reads the card at once
|
||||
}
|
||||
export function setLiveProbe(probe) { liveProbe = typeof probe === 'function' ? probe : () => false; }
|
||||
let systemReading=null;
|
||||
/* CPU and SSD temperatures (null where this PC cannot give one) and the GPU energy used since the host started (#3628). */
|
||||
let temperatures={cpuTempC:null,ssdTempC:null};
|
||||
const sampleSystem=createSystemSampler();
|
||||
const finite = value => typeof value==='number'&&Number.isFinite(value);
|
||||
function aggregate(readings,key,mode='sum') {
|
||||
@@ -71,7 +84,7 @@ function hardwareSnapshot() {
|
||||
const demo=process.env.STRATA_REAL_ENGINE!=='1',hw=state.hardware;
|
||||
const devices=cachedHardware()?.gpus??hwCache?.gpus??[];
|
||||
const memoryPools=Math.max(1,devices.filter(g=>!g.unified).length+Number(devices.some(g=>g.unified)));
|
||||
const readings=demo?devices.map((gpu,i)=>({id:gpu.id??`${gpu.vendor}:${gpu.index}`,source:'demo',sampledAt:new Date().toISOString(),utilizationPct:Math.round(clamp(hw.gpuLoad+i*2,0,100)),temperatureC:Math.round(hw.gpuTempC+i),memoryUsedGb:round(Math.min(gpu.vramGb,hw.vramUsedGb/memoryPools),2),powerW:gpu.unified?null:round(35+hw.gpuLoad*2,0),powerLimitW:gpu.unified?null:300,pcieGen:gpu.unified?null:4,pcieGenMax:gpu.unified?null:4,pcieWidth:gpu.unified?null:16,pcieRxMbs:gpu.unified?null:round(hw.gpuLoad*1.2,1)})):hw.gpus.map(g=>({...g}));
|
||||
const readings=demo?devices.map((gpu,i)=>({id:gpu.id??`${gpu.vendor}:${gpu.index}`,source:'demo',sampledAt:new Date().toISOString(),utilizationPct:Math.round(clamp(hw.gpuLoad+i*2,0,100)),temperatureC:Math.round(hw.gpuTempC+i),memoryUsedGb:round(Math.min(gpu.vramGb,hw.vramUsedGb/memoryPools),2),powerW:gpu.unified?null:round(35+hw.gpuLoad*2,0),powerLimitW:gpu.unified?null:300,pcieGen:gpu.unified?null:4,pcieGenMax:gpu.unified?null:4,pcieWidth:gpu.unified?null:16,pcieRxMbs:gpu.unified?null:round(hw.gpuLoad*1.2,1),fanPct:gpu.unified?null:Math.round(30+hw.gpuLoad*0.5),clockMhz:gpu.unified?null:Math.round(1400+hw.gpuLoad*14)})):hw.gpus.map(g=>({...g}));
|
||||
const memory = gpuMemoryTotals(devices,readings);
|
||||
return {
|
||||
gpus:readings,cpus:systemReading?.cpus??[],cpuLoad:systemReading?.cpuLoad??null,
|
||||
@@ -81,7 +94,9 @@ function hardwareSnapshot() {
|
||||
ramUsedGb:systemReading?.ramUsedGb??null,ramTotalGb:systemReading?.ramTotalGb??hw.ramTotalGb,
|
||||
gpuTempC:aggregate(readings,'temperatureC','max'),tempLimitC:hw.tempLimitC,
|
||||
powerW:aggregate(readings,'powerW'),powerLimitW:aggregate(readings,'powerLimitW'),
|
||||
pcieRxMbs:aggregate(readings,'pcieRxMbs'),diskReadGbs:systemReading?.diskReadGbs??null,diskWriteMbs:systemReading?.diskWriteMbs??null,
|
||||
pcieRxMbs:aggregate(readings,'pcieRxMbs'),
|
||||
cpuTempC:demo?54:temperatures.cpuTempC,ssdTempC:demo?41:temperatures.ssdTempC,energyWh:round(energyWh(),3),
|
||||
diskReadGbs:systemReading?.diskReadGbs??null,diskWriteMbs:systemReading?.diskWriteMbs??null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -108,14 +123,16 @@ function approach(current, target, factor = 0.22) {
|
||||
}
|
||||
|
||||
function tick() {
|
||||
if(!sensorsPending&&Date.now()-sensorsAt>=3000){
|
||||
const pace=sensorPace({live:supervisor.status().running||!!liveProbe(),watchedUntil});
|
||||
if(!sensorsPending&&Date.now()-sensorsAt>=pace.intervalMs){
|
||||
sensorsPending=true;sensorsAt=Date.now();
|
||||
const hardware=cachedHardware()??hwCache;
|
||||
void Promise.all([readGpuTelemetry(hardware?.gpus??[]),sampleSystem(hardware?.processors??[])])
|
||||
.then(([readings,system])=>{state.hardware.gpus=readings;systemReading=system;})
|
||||
void Promise.all([readGpuTelemetry(hardware?.gpus??[],{transfer:pace.transfer}),sampleSystem(hardware?.processors??[]),(process.env.STRATA_REAL_ENGINE==='1'?readTemperatures():Promise.resolve(temperatures)).catch(()=>({cpuTempC:null,ssdTempC:null}))])
|
||||
.then(([readings,system,temps])=>{state.hardware.gpus=readings;systemReading=system;temperatures=temps;})
|
||||
.catch(()=>{state.hardware.gpus=[];systemReading=null;})
|
||||
.finally(()=>{sensorsPending=false;});
|
||||
}
|
||||
addEnergy(hardwareSnapshot().powerW,Date.now());
|
||||
const hw = state.hardware;
|
||||
const busy = state.phase === 'generating' || state.phase === 'reading' || state.phase === 'thinking';
|
||||
|
||||
|
||||
@@ -7,25 +7,26 @@ import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync, realpa
|
||||
import { join, resolve, dirname, basename, sep, relative, isAbsolute } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { createServer } from 'node:net';
|
||||
import { NATIVE_FIELDS, APP_OWNED_FIELDS, withoutDraftLayer, validateNativeSettings, validateMcpServers, publicMcpServers, publicNativeEnv, restoreNativeEnv } from './native-settings.mjs';
|
||||
import { NATIVE_FIELDS, APP_OWNED_FIELDS, withoutDraftLayer, validateNativeSettings, validateMcpServers, publicMcpServers, publicNativeEnv, restoreNativeEnv, speedSwitchRows } from './native-settings.mjs';
|
||||
import { resourceSettings, saferStart, reserveChoice } from './native-resources.mjs';
|
||||
import { USER_KEY, capture as captureUserArgs, merge as mergeUserArgs, setFlag as setUserFlag, stamped as stampedUserArgs } from './native-user-args.mjs';
|
||||
import { resolvePython, venvPython } from './python-resolver.mjs';
|
||||
import os from 'node:os';
|
||||
import { runtimeVision } from './native-vision.mjs';
|
||||
import { componentsDirectory, installerEnvironment, controlEnvironment } from './control-runtime.mjs';
|
||||
import { componentsDirectory, installerEnvironment, controlEnvironment, sourceServerEnvironment } from './control-runtime.mjs';
|
||||
import { createEngineStep } from './engine-step.mjs';
|
||||
import { dataFolderFromPick, isDriveRoot, makeFolder, rememberDataFolder, syncDataFolder, terminalSettingsFile } from './model-folder.mjs';
|
||||
import { createAutoTune, writeTuneConfig } from './native-autotune.mjs';
|
||||
import { plainError, PHASE_TEXT } from './update-messages.mjs';
|
||||
import { checkRunConfig, describeIssues } from './run-config-check.mjs';
|
||||
import { checkAndParseRunConfig, checkRunConfig, describeIssues } from './run-config-check.mjs';
|
||||
import { openTextFile } from './open-text-file.mjs';
|
||||
import { markEngine, engineRefusal } from './engine-version.mjs';
|
||||
import { friendlyModelName } from './model-names.mjs';
|
||||
import { parseSaved as parseRoles, mirror as mirrorRoles } from './gpu-roles.mjs';
|
||||
import { configContextLimit } from './dsv41-context.mjs';
|
||||
|
||||
const ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..');
|
||||
const safeId=value=>typeof value==='string'&&/^[a-z0-9_-]{1,80}$/i.test(value);
|
||||
const safeId=value=>typeof value==='string'&&/^[a-z0-9](?:[a-z0-9_-]|\.(?!\.)){0,79}$/i.test(value); /* a dot inside the name: deepseek-v4.1-flash-ist-das-2.00bpw */
|
||||
const busy=requests=>requests.some(r=>['queued','generating'].includes(r.state));
|
||||
function readJson(path,fallback={}){try{return JSON.parse(readFileSync(path,'utf8').replace(/^\uFEFF/,''));}catch{return fallback;}}
|
||||
|
||||
@@ -38,7 +39,13 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
let child=null,seq=0,buffer='',pending=new Map(),definitions=[],refreshing=null,lastRead=0,connecting=null;
|
||||
let snapshot={available:false,repo:preferences.repo,summary:'Connect a local Strata installation.',catalog:null,installed:null,hardware:null,error:null};
|
||||
const instances=new Map(),processes=new Map(),jobs=new Map(),logs=[];
|
||||
const savedJobs=readJson(join(directory,'native-jobs.json'),[]);for(const j of (Array.isArray(savedJobs)?savedJobs:[]).slice(-12))jobs.set(j.id,{...j,...(j.state==='running'?{state:'error',error:'The host restarted before completion. Check diagnostics, then retry; completed files are kept.',summary:'Interrupted operation'}:{})});
|
||||
const savedJobs=readJson(join(directory,'native-jobs.json'),[]);/* An app update ends the app on purpose: the installer replaces it and starts it again. The job that asked for it was saved as running together with the app version it started from (appUpdateFrom); a start that finds a different version knows the update finished, instead of calling it an interrupted operation. */
|
||||
const thisAppVersion=()=>process.env.STRATA_APP_VERSION||null;
|
||||
/* A record an OLDER host wrote (no appUpdateFrom): the app's own program file was replaced after the job began, so the installer finished. <install>/host/server is ROOT's parent chain: ROOT = <install>/host. */
|
||||
const appProgramNewerThan=started=>{try{const t=Date.parse(started);if(!Number.isFinite(t))return false;const dir=dirname(ROOT),exe=join(dir,process.platform==='win32'?'strata-desktop.exe':'strata-desktop'),times=[];for(const f of [exe,join(dir,'uninstall.exe')])if(existsSync(f)){const st=statSync(f);times.push(st.mtimeMs,st.ctimeMs);}/* the installer keeps the build time as the program's modified time but writes uninstall.exe and changes the program file's metadata when it installs */return times.some(x=>x>t);}catch{return false;}};
|
||||
const settledByAppUpdate=j=>j.state==='running'&&j.kind==='update-strata'&&((typeof j.appUpdateFrom==='string'&&!!thisAppVersion()&&thisAppVersion()!==j.appUpdateFrom)||(typeof j.appUpdateFrom!=='string'&&appProgramNewerThan(j.startedAt)));
|
||||
const neverFinishedAppUpdate=j=>j.state==='running'&&j.kind==='update-strata'&&typeof j.appUpdateFrom==='string'&&!!thisAppVersion()&&thisAppVersion()===j.appUpdateFrom;
|
||||
for(const j of (Array.isArray(savedJobs)?savedJobs:[]).slice(-12))jobs.set(j.id,{...j,...(settledByAppUpdate(j)?{state:'done',error:null,summary:`Strata is updated to ${thisAppVersion()}.`,finishedAt:new Date().toISOString()}:neverFinishedAppUpdate(j)?{state:'error',error:`The update to ${j.appUpdateTo??'the new version'} did not finish: the app closed for the installer, but the old version ${j.appUpdateFrom} started again. Try Update again, or download the installer from the Strata release page (https://github.com/Niko1221/Strata/releases/latest).`,summary:'The app update did not finish',finishedAt:new Date().toISOString()}:j.state==='running'?{state:'error',error:'The host restarted before completion. Check diagnostics, then retry; completed files are kept.',summary:'Interrupted operation'}:{})});
|
||||
/* Packaged mode: the app ships Strata Control (control-runtime.mjs). Models are run configs in an install folder, the engine
|
||||
comes from the component folder, and a start is `strata runtime start` under the owner runtime. Nothing is installed,
|
||||
updated or fetched from here. Without `control` (a source checkout) every path below is the original one. */
|
||||
@@ -50,6 +57,9 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
The install only runs when the user clicks Download; starting and serving (control.start) keep STRATA_NO_ACQUIRE. */
|
||||
const defaultInstall=()=>process.env.STRATA_INSTALL_DIR?resolve(process.env.STRATA_INSTALL_DIR):join(dirname(componentsDirectory()),'install');
|
||||
let packagedInstall=null;
|
||||
/* The component updates and the rollback go through Control, not through the native snapshot, so they work in the first seconds after the app starts and on a PC that has no engine yet. */
|
||||
const COMPONENT_KINDS=['update-engine','update-strata','rollback','install-engine-file'];
|
||||
const updateLog=line=>{try{console.log(`update · ${line}`);}catch{/* no console */}};
|
||||
const NO_INSTALL='Installing, updating, tuning with calibration or rolling back model files and engines happens from the Terminal (strata install), never while the app runs.';
|
||||
let defaultId=null,timer=null,closing=false,polling=false;
|
||||
const emit=()=>{const value=state();writeFileSync(join(directory,'native-jobs.json'),JSON.stringify(value.jobs),{mode:0o600});changed(value);};
|
||||
@@ -71,13 +81,13 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
app is reinstalled to another folder, or an update moves Control, those absolute paths point at nothing and every installed
|
||||
model breaks. At every read of the installed models, a path that ends up inside a folder called `control` that no longer
|
||||
exists is pointed at the Control this app has now, when the file is there. The config is saved (with a .bak) only then. */
|
||||
function repairControlPaths(dir){if(!packaged||!dir||!existsSync(dir))return;let names=[];try{names=readdirSync(dir).filter(n=>/^strata-[a-z0-9_-]+\.json$/i.test(n));}catch{return;}
|
||||
function repairControlPaths(dir){if(!packaged||!dir||!existsSync(dir))return;let names=[];try{names=readdirSync(dir).filter(n=>/^strata-[a-z0-9_.-]+\.json$/i.test(n));}catch{return;}
|
||||
const here=control.control.dir,inside=/^(.+?[\/]control)(?=[\/]|$)(.*)$/i;
|
||||
const fix=value=>{if(typeof value!=='string')return value;const m=value.match(inside);if(!m||existsSync(value)||resolve(m[1]).toLowerCase()===resolve(here).toLowerCase())return value;const candidate=join(here,m[2]);return existsSync(candidate)?candidate:value;};
|
||||
for(const name of names){const path=join(dir,name),config=readJson(path,null);if(!config||typeof config!=='object')continue;
|
||||
const next={...config,...(config.cwd!==undefined?{cwd:fix(config.cwd)}:{}),...(Array.isArray(config.args)?{args:config.args.map(fix)}:{})};
|
||||
if(JSON.stringify(next)!==JSON.stringify(config)){try{writeModelConfig(path,next);}catch{/* read-only folder: the load reports it */}}}}
|
||||
function installedInfo(info){if(!info)return info;return {...info,models:(info.models??[]).map(entry=>{const cfg=/^strata-[a-z0-9_-]+\.json$/i.test(entry.config??'')?readJson(entry.configPath??join(repo(),entry.config)):{};const at=cfg.args?.indexOf('--native')??-1,nativeFile=at>=0?cfg.args[at+1]:null;const dataFolder=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))==='models'?dirname(dirname(dirname(nativeFile))):info.data_folder;/* A model the person pointed at their own GGUF folder (not <data>/models/<tag>): remembered, so a later load runs setup with that folder again instead of downloading the files (#3199). */const ownGgufDir=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))!=='models'&&existsSync(nativeFile)?dirname(nativeFile):undefined;return {...entry,ownGgufDir,diskGb:entry.diskGb??entry.disk_gb,diskBytes:entry.diskBytes??entry.disk_bytes,sharedBytes:entry.sharedBytes??entry.shared_bytes,removableGb:entry.removableGb??entry.removable_gb,dataFolder,visionPrepared:!!cfg.vision,/* The picture files are prepared when the run config has a vision section: the Models screen then loads straight away instead of running setup again (it used to read 'off' for every model, which sent every load of a picture-capable model through "Apply settings and load", and setup writes the arguments, the draft layer and the reader back each time). */images:cfg.vision?'yes':'off',draftLayer:cfg.mtp!==false,drafting:cfg.drafting??'auto',/* Picture reading is ON unless the person turned it off: no saved choice and not loaded is undefined, not false (owner rule: pictures on by default). */visionEnabled:cfg.ui_vision_enabled??(()=>{const running=[...instances.values()].find(i=>i.model===entry.model&&i.status==='ready');return running?!!running.vision:undefined;})(),visionDevice:cfg.ui_vision_device,resourceProfile:cfg.ui_resource_profile,lowRamMode:cfg.args?.includes('--resident-experts')?'resident':cfg.args?.includes('--mmap-experts')?'mmap':'auto'};})};}
|
||||
function installedInfo(info){if(!info)return info;return {...info,models:(info.models??[]).map(entry=>{const cfg=/^strata-[a-z0-9_.-]+\.json$/i.test(entry.config??'')?readJson(entry.configPath??join(repo(),entry.config)):{};const at=cfg.args?.indexOf('--native')??-1,nativeFile=at>=0?cfg.args[at+1]:null;const dataFolder=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))==='models'?dirname(dirname(dirname(nativeFile))):info.data_folder;/* A model the person pointed at their own GGUF folder (not <data>/models/<tag>): remembered, so a later load runs setup with that folder again instead of downloading the files (#3199). */const ownGgufDir=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))!=='models'&&existsSync(nativeFile)?dirname(nativeFile):undefined;return {...entry,ownGgufDir,contextMax:configContextLimit(cfg)??undefined,diskGb:entry.diskGb??entry.disk_gb,diskBytes:entry.diskBytes??entry.disk_bytes,sharedBytes:entry.sharedBytes??entry.shared_bytes,removableGb:entry.removableGb??entry.removable_gb,dataFolder,visionPrepared:!!cfg.vision,/* The picture files are prepared when the run config has a vision section: the Models screen then loads straight away instead of running setup again (it used to read 'off' for every model, which sent every load of a picture-capable model through "Apply settings and load", and setup writes the arguments, the draft layer and the reader back each time). */images:cfg.vision?'yes':'off',draftLayer:cfg.mtp!==false,drafting:cfg.drafting??'auto',/* Picture reading is ON unless the person turned it off: no saved choice and not loaded is undefined, not false (owner rule: pictures on by default). */visionEnabled:cfg.ui_vision_enabled??(()=>{const running=[...instances.values()].find(i=>i.model===entry.model&&i.status==='ready');return running?!!running.vision:undefined;})(),visionDevice:cfg.ui_vision_device,resourceProfile:cfg.ui_resource_profile,lowRamMode:cfg.args?.includes('--resident-experts')?'resident':cfg.args?.includes('--mmap-experts')?'mmap':'auto'};})};}
|
||||
function installRoot(){const found=[preferences.installDir].find(d=>d&&existsSync(d));if(found)return realpathSync(found);mkdirSync(defaultInstall(),{recursive:true});return realpathSync(defaultInstall());}
|
||||
/* The settings file Strata Control and the installer read (control-runtime.mjs sets STRATA_SETTINGS_FILE to it): the app's data folder is written there. */
|
||||
function controlSettingsFile(){return process.env.STRATA_SETTINGS_FILE||join(dirname(componentsDirectory()),'app-settings.json');}
|
||||
@@ -128,21 +138,21 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
if(closing)return state();
|
||||
/* A read that is not forced never makes the window wait for the (slow) status of Control: it gets the last state at once, and a stale one
|
||||
is refreshed in the background. Only the first read, and a forced one after an operation, waits. */
|
||||
if(refreshing)return !force&&snapshot.available?state():refreshing;if(!force&&Date.now()-lastRead<45000)return state();
|
||||
if(refreshing)return !force&&snapshot.available?state():force?refreshing.then(()=>refresh(true)):refreshing; /* a forced read that meets one already running (started before an engine update finished) waits for it and reads again, so it never settles on the old answer */if(!force&&Date.now()-lastRead<45000)return state();
|
||||
probeDrafting();
|
||||
refreshing=(async()=>{try{const [catalog,status]=packaged?await (async()=>{const s=await tool('strata_status',{hardware:true});const c=await tool('strata_models').catch(error=>({families:[],contexts:[],recommendation:{family:null,model:null},context_note:'',error:error.message}));return [c,s];})():await Promise.all([tool('strata_models'),tool('strata_status',{hardware:true})]);let visionReader=false;if(packaged){try{const e=await control.engine();const root=e?.engine?.root??(e?.engine?.exe?dirname(e.engine.exe):'');visionReader=!!root&&['strata-vision','strata-vision.exe'].some(n=>existsSync(join(root,n)));}catch{visionReader=false;}}const markImages=c=>c&&Array.isArray(c.families)?{...c,families:c.families.map(f=>({...f,imagesCapable:!!f.images,images:!!f.images&&visionReader,sizes:(f.sizes??[]).map(s=>({...s,imagesCapable:!!s.images,images:!!s.images&&visionReader}))}))}:c;snapshot={available:true,repo:packaged?status.installDir:repo(),version:packaged?(control.version??null):await execute('git',['describe','--tags','--always'],repo()).then(s=>s.trim()).catch(()=>null),summary:status.summary,catalog:markEngine(packaged?markImages(catalog):catalog,status.engine),engineInfo:{version:status.engine?.version??null,source:status.engine?.source??null},visionReader:packaged?visionReader:true,installed:installedInfo(status.installed),hardware:status.hardware,error:null,install:status.install,external:status.running??null,...(packaged?{packaged:true,installDir:status.installDir,engine:status.engine,installerError:status.installerError}:{})};lastRead=Date.now();if(status.install?.running&&![...jobs.values()].some(j=>j.state==='running'))begin('install',j=>watchInstall(j,status.install));}catch(error){snapshot={...snapshot,available:false,error:error.message};lastRead=Date.now();}emit();return state();})().finally(()=>{refreshing=null;});const run=refreshing;if(!force&&snapshot.available){run.catch(()=>{});return state();}return run;
|
||||
}
|
||||
function configure({repository}){if(packaged){if(instances.size||[...jobs.values()].some(j=>j.state==='running'))throw new Error('Unload models and finish operations before changing the installation.');const next=realpathSync(String(repository));if(!statSync(next).isDirectory())throw new Error('Choose the folder that holds your Strata model configurations.');preferences={...preferences,installDir:next};packagedInstall=null;disconnect();writeFileSync(settingsPath,JSON.stringify(preferences,null,2),{mode:0o600});lastRead=0;return refresh(true);}if(instances.size||[...jobs.values()].some(j=>j.state==='running'))throw new Error('Unload models and finish operations before changing the installation.');const next=realpathSync(String(repository));const old=preferences;preferences={...preferences,repo:next};try{repo();}catch(e){preferences=old;throw e;}disconnect();writeFileSync(settingsPath,JSON.stringify(preferences,null,2),{mode:0o600});lastRead=0;return refresh(true);}
|
||||
function setDownloadDirectory(input,{insideJob=false}={}){if(!insideJob&&[...jobs.values()].some(j=>j.state==='running'))throw new Error('Finish the current operation before changing the folder.');if(typeof input!=='string'||!input.trim()||/[\r\n\0]/.test(input))throw new Error('Choose a model folder.');let path;try{path=realpathSync(input.trim());}catch{throw new Error('That folder does not exist. Check the path, or that the drive is connected.');}if(!statSync(path).isDirectory())throw new Error('Choose a folder, not a file.');/* A whole drive (D:\) is not filled with models: D:\Strata is made and used. */if(isDriveRoot(path)){const own=dataFolderFromPick(path).path;makeFolder(own);path=realpathSync(own);}try{accessSync(path,constants.R_OK|constants.W_OK);}catch{throw new Error('Strata cannot write in that folder. Choose a folder you can save files in.');}preferences={...preferences,downloadDirectory:path};/* the same choice for the installer and the Terminal: the Control settings file */if(packaged)rememberDataFolder(controlSettingsFile(),path,Date.now()/1000,true);writeFileSync(settingsPath,JSON.stringify(preferences,null,2),{mode:0o600});shareDataFolder();emit();return state();}
|
||||
function recordFile(model){if(!safeId(model))throw new Error('Choose an installed model.');const entry=snapshot.installed?.models?.find(i=>i.model===model);if(!entry)throw new Error('This model is not installed. Download and prepare it first.');const path=realpathSync(entry.configPath??join(repo(),entry.config));if(dirname(path)!==repo()||!/^strata-[a-z0-9_-]+\.json$/i.test(basename(path)))throw new Error('The model configuration is outside the Strata installation.');return {entry,path};}
|
||||
function recordFile(model){if(!safeId(model))throw new Error('Choose an installed model.');const entry=snapshot.installed?.models?.find(i=>i.model===model);if(!entry)throw new Error('This model is not installed. Download and prepare it first.');const path=realpathSync(entry.configPath??join(repo(),entry.config));if(dirname(path)!==repo()||!/^strata-[a-z0-9_.-]+\.json$/i.test(basename(path)))throw new Error('The model configuration is outside the Strata installation.');return {entry,path};}
|
||||
function record(model){const {entry,path}=recordFile(model);return {entry,path,config:readJson(path)};}
|
||||
/* The text file a power user edits by hand: where it is and what is wrong in it (run-config-check.mjs). */
|
||||
function settingsFile(model){const {path}=recordFile(model);return {model,path,name:basename(path),...checkRunConfig(readFileSync(path,'utf8')),note:'Changes you make in the file apply the next time the model starts.'};}
|
||||
async function openSettingsFile(model,options={}){const info=settingsFile(model);await openTextFile(info.path,options);return info;}
|
||||
/* A mistake in the file holds the start back with the line, instead of an engine that dies on it. Warnings (an unknown key) never do. */
|
||||
function assertSettingsFile(path){const check=checkRunConfig(readFileSync(path,'utf8'));if(!check.ok)throw new Error(`The settings file for this model has a mistake, so the model was not started. ${describeIssues(check.issues,'error').join(' ')}`);}
|
||||
function settings(model){const {config}=record(model);const values=Object.fromEntries(NATIVE_FIELDS.map(f=>[f.id,config[f.id]??null]));if(typeof values.aliases==='string')values.aliases=values.aliases.split(',').map(v=>v.trim()).filter(Boolean);values.sampling=config.sampling??{};values.args=config.args??[];values.env=publicNativeEnv(config.env??{});return {model,values,mcp:publicMcpServers(config.mcp_servers??config.mcpServers??{}),restartNeeded:true};}
|
||||
function save(model,{values,mcp}){if([...jobs.values()].some(j=>j.state==='running'))throw new Error('Finish the current operation before saving native settings.');const {path,config}=record(model);if(busy(requests().filter(r=>instances.get(r.instanceId)?.model===model)))throw new Error('Finish this model’s requests before saving its settings.');const patch=validateNativeSettings(values??{}),next={...config};for(const field of nativeFields())if(field.supported===false&&patch[field.id]!=null&&JSON.stringify(patch[field.id])!==JSON.stringify(config[field.id]))throw new Error(`${field.label} needs a newer native Strata installation. Update it in Settings → About.`);for(const [key,value] of Object.entries(patch)){if(key==='env')next.env=restoreNativeEnv(value,config.env??{});else if(value===null)delete next[key];else next[key]=value;}if('vram_reserve_mib' in patch){const base=captureUserArgs(next);const mine=setUserFlag(base,'--vram-reserve-mib',patch.vram_reserve_mib);if(mine.length)next[USER_KEY]=mine;else delete next[USER_KEY];next.args=mine.length&&patch.vram_reserve_mib!==null?mergeUserArgs(next.args??[],mine):setUserFlag(next.args??[],'--vram-reserve-mib',null);delete next.ui_reserve_applied;if(Array.isArray(next.args_written))next.args_written=[...next.args];}if(mcp!==undefined){next.mcp_servers=validateMcpServers(mcp,config.mcp_servers??config.mcpServers??{});delete next.mcpServers;}copyFileSync(path,path+'.bak');chmodSync(path+'.bak',0o600);const temp=path+'.ui-tmp';writeFileSync(temp,JSON.stringify(next,null,2)+'\n',{mode:0o600});renameSync(temp,path);return settings(model);}
|
||||
function checkedSettingsConfig(text){const check=checkAndParseRunConfig(text);if(!check.ok)throw new Error(`The settings file for this model has a mistake, so the model was not started. ${describeIssues(check.issues,'error').join(' ')}`);return check.config;}
|
||||
function settings(model){const {entry,config}=record(model);const values=Object.fromEntries(NATIVE_FIELDS.map(f=>[f.id,config[f.id]??null]));if(typeof values.aliases==='string')values.aliases=values.aliases.split(',').map(v=>v.trim()).filter(Boolean);values.sampling=config.sampling??{};values.args=config.args??[];values.env=publicNativeEnv(config.env??{});return {model,values,mcp:publicMcpServers(config.mcp_servers??config.mcpServers??{}),restartNeeded:true,capabilities:{dsExperts:ownEngine(config)&&dsExpertsSupported(config)},speedSwitches:speedSwitchRows(config.env??{},{deepseek:ownEngine(config),arch:config.arch??null,backend:config.backend??entry?.backend??snapshot.installed?.engine?.backend??null,gpus:snapshot.hardware?.gpus??[]})};}
|
||||
function save(model,{values,mcp}){if([...jobs.values()].some(j=>j.state==='running'))throw new Error('Finish the current operation before saving native settings.');const {path,config}=record(model);if(busy(requests().filter(r=>instances.get(r.instanceId)?.model===model)))throw new Error('Finish this model’s requests before saving its settings.');const patch=validateNativeSettings(values??{}),next={...config};if(patch.ds_experts!=null&&!dsExpertsSupported(config))throw new Error('The Speed choice needs the newer DeepSeek engine. Update the engine in Settings, then choose it.');for(const field of nativeFields())if(field.supported===false&&patch[field.id]!=null&&JSON.stringify(patch[field.id])!==JSON.stringify(config[field.id]))throw new Error(`${field.label} needs a newer native Strata installation. Update it in Settings → About.`);for(const [key,value] of Object.entries(patch)){if(key==='env')next.env=restoreNativeEnv(value,config.env??{});else if(value===null)delete next[key];else next[key]=value;}if('vram_reserve_mib' in patch){const base=captureUserArgs(next);const mine=setUserFlag(base,'--vram-reserve-mib',patch.vram_reserve_mib);if(mine.length)next[USER_KEY]=mine;else delete next[USER_KEY];next.args=mine.length&&patch.vram_reserve_mib!==null?mergeUserArgs(next.args??[],mine):setUserFlag(next.args??[],'--vram-reserve-mib',null);delete next.ui_reserve_applied;if(Array.isArray(next.args_written))next.args_written=[...next.args];}if(mcp!==undefined){next.mcp_servers=validateMcpServers(mcp,config.mcp_servers??config.mcpServers??{});delete next.mcpServers;}copyFileSync(path,path+'.bak');chmodSync(path+'.bak',0o600);const temp=path+'.ui-tmp';writeFileSync(temp,JSON.stringify(next,null,2)+'\n',{mode:0o600});renameSync(temp,path);return settings(model);}
|
||||
function previousEngine(){if(packaged)return !!snapshot.engine?.previous;try{const data=snapshot.installed?.data_dir??snapshot.installed?.data_folder;return [join(preferences.repo,'engine/.previous'),data&&join(data,'engine/.previous')].filter(Boolean).some(existsSync)&&readFileSync(join(preferences.repo,'setup.py'),'utf8').includes('--rollback-engine');}catch{return false;}}
|
||||
async function plan(args){await refresh();if(!snapshot.available)throw new Error(snapshot.error);const result=await tool('strata_install',installArgs(args,false));
|
||||
/* A chosen drafter that is not on this computer yet is part of the download: its size is listed beside the model's (Control decides; nothing is fetched here). */
|
||||
@@ -207,6 +217,12 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
if(still.length)throw new Error(`Some files could not be removed: ${still.slice(0,3).map(p=>basename(p)).join('; ')}`);
|
||||
return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
/* The configuration a load starts the engine with (before its port and key): the saved model config, the user's choices and the resource profile. The tuner measures exactly this, so a saved tuning belongs to the same choices a load makes. */
|
||||
/* DeepSeek-V4.1-Flash runs on its own engine (strata-dsv41) that takes none of the Flash-Next options the app adds on its own (request slots, the RAM budget, the output clamp, the resource profile): a flag it does not know ends the start with "unknown option". */
|
||||
const ownEngine=config=>config?.arch==='deepseek41'||/strata-dsv41/i.test(String(config?.exe??''));
|
||||
/* The DeepSeek engine's version, read from the folder the run config names (engine-dsv41/<version>-<platform>-...). --experts exists from engine 0.1.50: an older engine ends the start with "unknown option", so the choice is offered and passed only for 0.1.50 or newer. */
|
||||
const DS_EXPERTS_MIN=[0,1,50];
|
||||
function dsEngineVersion(config){const m=/engine-dsv41[\\/](\d+(?:\.\d+)+)-/.exec(String(config?.exe??''))||/engine-dsv41[\\/](\d+(?:\.\d+)+)-/.exec(String((config?.lib_dirs??[])[0]??''));return m?m[1].split('.').map(Number):null;}
|
||||
function dsExpertsSupported(config){const v=dsEngineVersion(config);if(!v)return false;for(let i=0;i<DS_EXPERTS_MIN.length;i++){const a=v[i]??0,b=DS_EXPERTS_MIN[i];if(a!==b)return a>b;}return true;}
|
||||
function buildConfig(args,config){
|
||||
const vision=runtimeVision(config,args.vision);
|
||||
const visionPreferences=args.vision!==undefined?{ui_vision_enabled:args.vision!=='no',ui_vision_device:args.vision==='no'?config.ui_vision_device??'yes':args.vision}:{};
|
||||
@@ -215,7 +231,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
const values0=args.values??{},cleared='vram_reserve_mib' in values0&&(values0.vram_reserve_mib===null||values0.vram_reserve_mib===''),base0=cleared?{...config,vram_reserve_mib:undefined,[USER_KEY]:setUserFlag(config[USER_KEY],'--vram-reserve-mib',null)}:config;
|
||||
let mine=captureUserArgs(base0);const asked=cleared?null:reserveChoice({...base0,[USER_KEY]:mine},snapshot.hardware,values0).asked;
|
||||
if(asked!==null)mine=setUserFlag(mine,'--vram-reserve-mib',asked);
|
||||
const resources=args.resourceProfile?resourceSettings({...base0,[USER_KEY]:mine,vision},snapshot.hardware,args.resourceProfile,modelArena(args.model),values0):null;
|
||||
const resources=args.resourceProfile&&!ownEngine(config)?resourceSettings({...base0,[USER_KEY]:mine,vision},snapshot.hardware,args.resourceProfile,modelArena(args.model),values0):null;
|
||||
const cfg={...config,...visionPreferences,...(resources?{...resources,ui_resource_profile:args.resourceProfile}:{}),host:'127.0.0.1',open_browser:false,...validateNativeSettings(args.values??{}),vision};
|
||||
/* The app's suggested cards only fill a gap: a model whose settings file already names its GPUs ("gpu": [1, 0], with "gpu_order": "as_given") keeps them (#3256). A card the person picked in the screen always wins. */
|
||||
const namedInFile=(Array.isArray(config.gpu)?config.gpu.length>0:config.gpu!==undefined&&config.gpu!==null&&config.gpu!=='')||!!config.gpu_roles;
|
||||
@@ -230,11 +246,14 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
if(!cfg.vision&&Array.isArray(cfg.args))cfg.args=cfg.args.filter(a=>a!=='--vision');
|
||||
for(const arg of cfg.args??[])if(arg.endsWith('.gguf')&&!existsSync(resolve(repo(),arg)))throw new Error('An engine argument names a missing GGUF. Restore the saved arguments or repair the files.');
|
||||
/* The app's own choice of request slots (4, fewer where the card has no room) is part of the configuration, so a tune measures the engine a load will start: slots take VRAM from the expert cache. */
|
||||
const parallelChoice=packaged?chooseParallel({config:cfg,values:args.values??{},hardware:snapshot.hardware?.gpus?.length?snapshot.hardware:{gpus:hardwareProbe()??[]}}):null;
|
||||
const parallelChoice=packaged&&!ownEngine(config)?chooseParallel({config:cfg,values:args.values??{},hardware:snapshot.hardware?.gpus?.length?snapshot.hardware:{gpus:hardwareProbe()??[]}}):null;
|
||||
let parallelNote=null;
|
||||
/* The agent asks for long answers (a thinking model can use most of the window): let the engine clamp the output to what is left of the context instead of refusing the request. */
|
||||
if(packaged&&cfg.fit_max_tokens===undefined)cfg.fit_max_tokens=true;
|
||||
if(packaged&&!ownEngine(config)&&cfg.fit_max_tokens===undefined)cfg.fit_max_tokens=true;
|
||||
if(parallelChoice){const applied=applyParallel(cfg,parallelChoice);for(const k of Object.keys(cfg))if(!(k in applied.cfg))delete cfg[k];Object.assign(cfg,applied.cfg);parallelNote=applied.note;}
|
||||
/* DeepSeek's Speed choice: the engine decides by itself (--experts auto: 5 when the cards total 16 GB or less, else 6), so nothing is passed unless the person chose 5 or 6. */
|
||||
if(ownEngine(config)){const list=[];const old=Array.isArray(cfg.args)?cfg.args:[];for(let i=0;i<old.length;i++){if(old[i]==='--experts'){i++;continue;}list.push(old[i]);}if(dsExpertsSupported(config)&&(cfg.ds_experts==='5'||cfg.ds_experts==='6'))list.push('--experts',cfg.ds_experts);else if(!dsExpertsSupported(config)&&old.includes('--experts'))list.splice(0,list.length,...old);cfg.args=list;delete cfg.ds_experts;}
|
||||
else delete cfg.ds_experts;
|
||||
return {cfg,resources,visionPreferences,parallelChoice,parallelNote};
|
||||
}
|
||||
/* The DFlash2 drafter, before a load that uses it: Control says whether the choice needs it (and the file is not here), downloads it pinned and checked, and packs it, with plain progress in the job.
|
||||
@@ -257,7 +276,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
/* Which drafter runs, when it is not the one that was asked for (the engine's own words, "Drafting: MTP (DFlash2 didn't fit)"): under Details of the load. */
|
||||
async function noteDrafting(job,instance,key){let note='';try{const r=await fetcher(`http://127.0.0.1:${instance.port}/metrics`,{headers:{authorization:`Bearer ${key}`},signal:AbortSignal.timeout(2000)});if(r.ok)note=String((await r.json())?.engine?.drafting_note??'');}catch{/* a convenience */}const lines=[job.drafterNote,note].filter(Boolean);if(lines.length)job.details=[job.details,...lines].filter(Boolean).join('\n');}
|
||||
async function loadEngine(job,args){
|
||||
await refresh(true);if(job.state!=='running')return;const {config,entry,path:configFile}=record(args.model);assertSettingsFile(configFile);if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(ENGINE_NOT_RECOGNISED+(engine.notice?` ${engine.notice}`:''));}if(!entry.ready){const error=missingFilesError(args.model,entry.missing);append(args.model,error.details[0]);throw error;}
|
||||
await refresh(true);if(job.state!=='running')return;const {entry,path:configFile}=recordFile(args.model);const config=checkedSettingsConfig(readFileSync(configFile,'utf8'));if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(ENGINE_NOT_RECOGNISED+(engine.notice?` ${engine.notice}`:''));}if(!entry.ready){const error=missingFilesError(args.model,entry.missing);append(args.model,error.details[0]);throw error;}
|
||||
if(externalRunning().length)throw new Error('A Strata server is already running outside this UI. Stop it before loading here, or connect its API in Settings → Models.');
|
||||
if(args.multiple&&instances.size>=8)throw new Error('Unload an instance before adding another. Up to eight native instances can run here.');
|
||||
const {cfg,resources,visionPreferences,parallelChoice,parallelNote:chosenNote}=buildConfig(args,config);
|
||||
@@ -286,7 +305,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
/* The engine starts under Control's owner runtime, not as our child: a saved profile per slot, then `runtime start`. */
|
||||
const used=new Set([...instances.values()].map(i=>i.profile));let slot=1;while(used.has('app-'+slot))slot++;instance.profile='app-'+slot;
|
||||
instances.set(id,instance);if(!defaultId||!args.multiple||wasDefault)defaultId=id;emit();
|
||||
const startWith=value=>{writeFileSync(configPath,JSON.stringify(value,null,2),{mode:0o600});return control.stop(instance.profile).catch(()=>{}).then(()=>control.saveProfile(instance.profile,configPath)).then(()=>control.start(instance.profile,{waitSeconds:300}));};
|
||||
const startWith=value=>{writeFileSync(configPath,JSON.stringify(value,null,2),{mode:0o600});return control.stop(instance.profile).catch(()=>{}).then(()=>control.saveProfile(instance.profile,configPath)).then(()=>control.start(instance.profile,{waitSeconds:ownEngine(config)?Math.min(600,Math.max(300,Number(config.engine_ready_s)||300)):300}));};
|
||||
started=startWith(cfg);
|
||||
started.then(()=>append(id,'Strata Control reports the engine is ready.'),error=>{append(id,error.message);});
|
||||
try{await started;}catch(firstError){let error=firstError;
|
||||
@@ -299,7 +318,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
/* ONE automatic second try in all, never saved, never repeated (args.retrySafer false turns it off): with a safer memory setting when the
|
||||
failure looks like a memory stop, and without several-requests-at-once when that was the app's own default (not a number the user chose).
|
||||
Both changes ride on the same single try, with the plain sentence of the memory change when there is one. */
|
||||
const allowed=args.retrySafer!==false&&job.state==='running';
|
||||
const allowed=args.retrySafer!==false&&job.state==='running'&&!ownEngine(config);
|
||||
const safer=allowed?saferStart(cfg,snapshot.hardware,modelArena(args.model),said):null;
|
||||
const dropParallel=allowed&&cfg.parallel>1&&!parallelChoice?.explicit;
|
||||
if(!safer&&!dropParallel){instance.status='error';instance.error=said;emit();throw new Error(said);}
|
||||
@@ -310,7 +329,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
try{await startWith(retryConfig);append(id,'Strata Control reports the engine is ready (second try).');}
|
||||
catch(second){const said2=humanStartError(second);instance.status='error';instance.error=said2;/* the first stop and the second try stay in job.details; the pop-up shows the last stop once */emit();throw new Error(instance.error);}}}
|
||||
} else {
|
||||
proc=spawnProcess(py,[join(repo(),'serve/server.py'),'--engine','strata','--config',configPath,'--port',String(cfg.port),'--host','127.0.0.1'],{cwd:repo(),detached:process.platform!=='win32',stdio:['ignore','pipe','pipe'],env:{...process.env,PYTHONUNBUFFERED:'1',PYTHONUTF8:'1',PYTHONIOENCODING:'utf-8',STRATA_API_KEY:''}});
|
||||
proc=spawnProcess(py,[join(repo(),'serve/server.py'),'--engine','strata','--config',configPath,'--port',String(cfg.port),'--host','127.0.0.1'],{cwd:repo(),detached:process.platform!=='win32',stdio:['ignore','pipe','pipe'],env:sourceServerEnvironment()});
|
||||
instances.set(id,instance);processes.set(id,proc);if(!defaultId||!args.multiple||wasDefault)defaultId=id;
|
||||
for(const stream of [proc.stdout,proc.stderr])stream.on('data',chunk=>{const lines=chunk.toString().split('\n').filter(Boolean);lines.forEach(line=>append(id,line.replaceAll(key,'[redacted]')));job.summary=lines.at(-1)??job.summary;emit();});
|
||||
proc.on('error',error=>{instance.status='error';instance.error=error.message;emit();});proc.on('exit',code=>{if(instances.has(id)&&instance.status!=='unloading'){instance.status='error';instance.error=`Engine stopped${code===null?'':` (exit ${code})`}. Open diagnostics or reload.`;emit();}});emit();
|
||||
@@ -331,7 +350,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
function ensurePoll(){if(!timer){timer=setInterval(()=>void poll(),2000);timer.unref?.();}void poll();}
|
||||
async function benchmark(job,args){const instance=resolveInstance(args.instanceId);job.instanceId=instance.id;if(busy(requests().filter(r=>r.instanceId===instance.id)))throw new Error('Wait for this model to finish before benchmarking.');const started=Date.now();job.abort=new AbortController();const response=await fetcher(`http://127.0.0.1:${instance.port}/v1/chat/completions`,{method:'POST',headers:{'content-type':'application/json',authorization:`Bearer ${instance.key}`},signal:AbortSignal.any([job.abort.signal,AbortSignal.timeout(180000)]),body:JSON.stringify({model:instance.apiModelId,messages:[{role:'user',content:'Explain how a rainbow forms in clear, simple language.'}],temperature:0,reasoning_effort:'none',max_tokens:200,stream:false})});const body=await response.json();if(!response.ok)throw new Error(body.error?.message??'Benchmark failed.');if(job.state!=='running')return;const result={summary:'Measured benchmark complete.',at:new Date().toISOString(),model:instance.apiModelId,durationMs:Date.now()-started,tokensIn:body.usage?.prompt_tokens??null,tokensOut:body.usage?.completion_tokens??null,outputTps:body.timings?.predicted_per_second??null,promptTps:body.timings?.prompt_per_second??null,source:'engine',settings:'Greedy · thinking off · up to 200 output tokens'};writeFileSync(join(directory,'native-benchmark.json'),JSON.stringify(result,null,2),{mode:0o600});return result;}
|
||||
function resolveInstance(id){const aliases=[...instances.values()].filter(i=>i.aliases?.includes(id));if(aliases.length>1&&!instances.has(id)&&![...instances.values()].some(i=>i.apiModelId===id))throw new Error('This alias matches more than one instance. Choose its exact model ID.');const i=instances.get(id)??[...instances.values()].find(i=>i.apiModelId===id)??aliases[0]??(!id&&instances.size===1?[...instances.values()][0]:undefined);if(!i)throw new Error('Choose a loaded model ID.');if(i.status!=='ready')throw new Error('This model is not ready.');return i;}
|
||||
async function program(job,args){if(packaged)return componentProgram(job);if(externalRunning().length)throw new Error('Stop the native server running outside this UI before changing engine files.');if(instances.size)throw new Error('Unload native models before changing engine files.');const folder=repo();let {command,args:prefix}=python(),argv;
|
||||
async function program(job,args){if(packaged)return componentProgram(job,args);if(externalRunning().length)throw new Error('Stop the native server running outside this UI before changing engine files.');if(instances.size)throw new Error('Unload native models before changing engine files.');const folder=repo();let {command,args:prefix}=python(),argv;
|
||||
if(job.kind==='calibrate'||job.kind==='tune'){if(!state().capabilities.calibration)throw new Error('This installation calibrates NVIDIA GPUs only. Use the short benchmark on other devices.');const model=args.model??snapshot.installed?.models?.[0]?.model;const chosen=record(model);if(!chosen.entry.ready)throw new Error('Prepare this model before calibrating.');command=venvPython(folder);prefix=[];if(!existsSync(command))throw new Error('Prepare the Python environment first.');argv=['-c','import sys; from pathlib import Path; import setup; sys.exit(0 if setup.calibrate_config(Path(sys.argv[1])) else 1)',chosen.path];}
|
||||
else if(job.kind==='rollback'){if(!previousEngine())throw new Error('No saved previous engine is available.');argv=[join(folder,'setup.py'),'--rollback-engine'];}
|
||||
else if(job.kind==='update-engine'){if(!snapshot.installed?.models?.length)throw new Error('Prepare a model first. Its installer downloads the matching engine.');argv=[join(folder,'setup.py'),'--update'];}
|
||||
@@ -342,29 +361,33 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
/* Packaged app: engine and Control updates and the engine rollback go through Control's explicit update step (`strata update`,
|
||||
`strata components rollback`), never through git, setup.py or a download in this process. The app itself is updated by the
|
||||
shell's signed Tauri updater. Models are not part of any of it. */
|
||||
async function componentProgram(job){
|
||||
if(!['update-engine','update-strata','rollback'].includes(job.kind)||typeof control.update!=='function')throw new Error(NO_INSTALL);
|
||||
async function componentProgram(job,args={}){
|
||||
if(!COMPONENT_KINDS.includes(job.kind)||typeof control.update!=='function')throw new Error(NO_INSTALL);
|
||||
if(instances.size)throw new Error('Unload native models before changing engine files.');
|
||||
job.abort=new AbortController();
|
||||
const subject=job.kind==='update-strata'?'Strata':'engine';
|
||||
try{return await componentSteps(job,subject);}catch(error){throw error?.details!==undefined&&error.message?error:plainError(error,subject);}
|
||||
try{return await componentSteps(job,subject,args);}catch(error){updateLog(`${job.kind} failed: ${String(error?.message??error).slice(0,400)}`);throw error?.details!==undefined&&error.message?error:plainError(error,subject);}
|
||||
}
|
||||
async function componentSteps(job,subject){
|
||||
async function componentSteps(job,subject,args={}){
|
||||
const onEvent=event=>{
|
||||
if(event.event==='progress'){job.summary=`Downloading: ${event.percent}%`;job.result={install:{step:job.summary,download:{file:event.label,percent:event.percent}}};}
|
||||
else if(event.event==='phase'&&PHASE_TEXT[event.phase])job.summary=PHASE_TEXT[event.phase];
|
||||
else if(event.event==='waiting')job.summary='Waiting for the running model to stop…';
|
||||
emit();
|
||||
};
|
||||
updateLog(`${job.kind} started (app ${thisAppVersion()??'unknown'})`);
|
||||
if(job.kind==='install-engine-file'){if(typeof args.path!=='string'||!args.path)throw new Error('Choose the engine file first.');let done;try{done=await control.installEngineFile(args.path,{onEvent,signal:job.abort.signal});}finally{try{const own=resolve(directory,'incoming-engine')+sep;if(resolve(args.path).startsWith(own))rmSync(args.path,{force:true});}catch{/* the copy in the host's own folder; a leftover is harmless */}}return {summary:updateSummary(done)==='Everything is already up to date.'?(done.results?.[0]?.note??'Nothing was changed.'):updateSummary(done),result:done};}
|
||||
if(job.kind==='rollback'){const done=await control.rollbackEngine();return {summary:'The previous engine is back. Your models and settings are unchanged.',result:done};}
|
||||
if(job.kind==='update-engine'){const done=await control.update({engine:true,control:false,onEvent,signal:job.abort.signal});return {summary:updateSummary(done),result:done};}
|
||||
const done=await control.update({engine:false,control:true,onEvent,signal:job.abort.signal});
|
||||
updateLog(`Control step finished: ${updateSummary(done)}`);
|
||||
const notes=[updateSummary(done)];
|
||||
if(appUpdater){
|
||||
job.summary='Looking for a new version of the app…';emit();
|
||||
let verdict;
|
||||
try{verdict=await appUpdater.check();}catch(error){if(error?.code!=='app-update-unavailable')throw error;verdict={available:false};notes.push(appUpdater.unavailable||error.message);}
|
||||
if(verdict.available){await appUpdater.install({signal:job.abort.signal,onProgress:p=>{if(p.total){job.summary=`Downloading the app update: ${Math.round(100*p.downloaded/p.total)}%`;job.result={install:{step:job.summary,download:{file:'Strata app',percent:Math.round(100*p.downloaded/p.total)}}};emit();}}});notes.push('The app update is installed. Strata will restart.');}
|
||||
updateLog(`app check: ${verdict.available?`version ${verdict.version} is available`:'no newer app version'}`);
|
||||
if(verdict.available){job.appUpdateFrom=thisAppVersion();job.appUpdateTo=verdict.version??null;emit();updateLog(`app update to ${verdict.version??'?'} starting; the installer will end this app`);await appUpdater.install({signal:job.abort.signal,onProgress:p=>{if(p.total){job.summary=`Downloading the app update: ${Math.round(100*p.downloaded/p.total)}%`;job.result={install:{step:job.summary,download:{file:'Strata app',percent:Math.round(100*p.downloaded/p.total)}}};emit();}}});notes.push('The app update is installed. Strata will restart.');}
|
||||
}
|
||||
return {summary:notes.filter(Boolean).join(' '),result:done};
|
||||
}
|
||||
@@ -410,7 +433,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
const room=args.resourceProfile==='work';
|
||||
return autotuner.start(job,job.kind==='recheck'?'recheck':'tune',{configPath:path,presetId:args.presetId,mode:args.mode,use:args.use,goal:room?'room':'speed',leaveRam:room?20:0,allowSmallDifferences:args.allowSmallDifferences===true,name:args.name},{onProgress:p=>{job.summary=p.text??job.summary;emit();}});
|
||||
}
|
||||
function operation(kind,args={}){if(!['install','load','benchmark','tune','autotune','recheck','calibrate','update-engine','update-strata','rollback','remove'].includes(kind))throw new Error('Choose a supported native operation.');if(!snapshot.available)throw new Error(snapshot.error??'Connect the native Strata installation first.');if(kind==='install'||kind==='load'){const refusal=engineRefusal(snapshot.catalog,args.model,snapshot.engineInfo);if(refusal)throw new Error(refusal);}return begin(kind,job=>kind==='install'?install(job,args):kind==='load'?loadEngine(job,args):kind==='benchmark'?benchmark(job,args):kind==='tune'?tune(job,args):kind==='autotune'||kind==='recheck'?autotune(job,args):kind==='remove'?removeModel(job,args):program(job,args),{guided:args.guided===true,model:args.model,...(args.family?{family:args.family}:{})});}
|
||||
function operation(kind,args={}){if(!['install','load','benchmark','tune','autotune','recheck','calibrate','update-engine','update-strata','rollback','install-engine-file','remove'].includes(kind))throw new Error('Choose a supported native operation.');if(!snapshot.available&&!(packaged&&COMPONENT_KINDS.includes(kind)))throw new Error(snapshot.error??'Connect the native Strata installation first.');if(kind==='install'||kind==='load'){const refusal=engineRefusal(snapshot.catalog,args.model,snapshot.engineInfo);if(refusal)throw new Error(refusal);}return begin(kind,job=>kind==='install'?install(job,args):kind==='load'?loadEngine(job,args):kind==='benchmark'?benchmark(job,args):kind==='tune'?tune(job,args):kind==='autotune'||kind==='recheck'?autotune(job,args):kind==='remove'?removeModel(job,args):program(job,args),{guided:args.guided===true,model:args.model,...(args.family?{family:args.family}:{})});}
|
||||
/* ---- The models folder card (0.2.2): what a picked folder means, and the three choices. The copying is Control's (strata models move). ---- */
|
||||
const currentModelsFolder=()=>preferences.downloadDirectory??(modelsDirectory?modelsDirectory():snapshot.installed?.data_folder)??null;
|
||||
const moveFile=()=>join(directory,'models-move.cancel');
|
||||
@@ -433,7 +456,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
const under=value=>typeof value==='string'&&[ 'models','packs','mtp' ].some(item=>{const base=join(old,item).toLowerCase();const v=value.toLowerCase();return v===base||v.startsWith(base+sep)||v.startsWith(base+'/');});
|
||||
const scan=value=>Array.isArray(value)?value.some(scan):value&&typeof value==='object'?Object.values(value).some(scan):under(value);
|
||||
for(const name of readdirSync(folder)){
|
||||
if(!/^strata-[a-z0-9_-]+\.json$/i.test(name)||name.endsWith('.shared-settings.json'))continue;
|
||||
if(!/^strata-[a-z0-9_.-]+\.json$/i.test(name)||name.endsWith('.shared-settings.json'))continue;
|
||||
if(!scan(readJson(join(folder,name))))continue;
|
||||
mkdirSync(kept,{recursive:true});renameSync(join(folder,name),join(kept,name));aside.push(name);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ export const NATIVE_FIELDS=[
|
||||
{id:'mtp',label:'Draft layer (MTP)',group:'Serving',type:'boolean',hint:'The draft layer guesses several words ahead, which makes answers faster, and costs about 1 GB of graphics memory and some RAM. Turn it off if the model stops while it starts, or the card is small: the expert cache gets that memory back and answers are slower. Default is on.'},
|
||||
{id:'drafting',label:'Drafting',group:'Serving',type:'enum',choices:['auto','mtp','dflash2','off'],hint:'Which drafter guesses words ahead to make answers faster. Auto (recommended) lets Strata pick from what it measured on cards like yours; today that is the MTP. DFlash2 is for Qwen3.8-Flash-Next only and downloads a 1.2 GB drafter once. If DFlash2 cannot run, the MTP is used and Details says why. Off turns the draft layer off.'},
|
||||
{id:'batchMtp',label:'MTP per request',group:'Serving',type:'boolean',hint:'Each concurrent request uses the draft layer. Left alone, Strata turns it on for one graphics card with 24 GB or more and several requests at once, and off otherwise; choose on or off here to decide yourself.'},
|
||||
{id:'ds_experts',label:'Speed (DeepSeek)',group:'Serving',type:'enum',choices:['5','6'],forModel:'deepseek',hint:'Faster uses 5 of 6 experts per word: a small quality change, usually not noticeable. Full quality uses all 6. Left alone, the engine picks Faster on a PC whose graphics cards total 16 GB or less.'},
|
||||
{id:'parallel',label:'Concurrent requests',group:'Serving',type:'number',min:1,max:8,hint:'More slots need more memory and can slow each response.'},
|
||||
{id:'engine_silence_s',label:'Engine stall timeout (seconds)',group:'Recovery',type:'number',min:10,max:3600},
|
||||
{id:'api_monitor',label:'Keep API request metadata',group:'Recovery',type:'boolean'},
|
||||
@@ -25,8 +26,66 @@ export const NATIVE_FIELDS=[
|
||||
{id:'mcp_max_rounds',label:'Maximum tool rounds',group:'Tools',type:'number',min:1,max:100},
|
||||
{id:'mcp_max_result_chars',label:'Maximum tool result characters',group:'Tools',type:'number',min:100,max:1000000},
|
||||
];
|
||||
/** Engine environment names the app shows and edits: STRATA_* and the DeepSeek engine's DS4_*. Any other name in a model's file is kept untouched and not shown. */
|
||||
export const ENV_FLAG=/^(?:STRATA|DS4)_[A-Z0-9_]+$/;
|
||||
/**
|
||||
* The speed features of 0.2.7 that have a switch in Expert settings. A switch has a default ('on' or 'off'); outside it, it writes exactly the
|
||||
* environment entries `env` into the model's settings file ("env"); back in its default it removes them, so a default launch carries none of them.
|
||||
* "Faster long prompts" (Qwen KVA) is OFF by default (owner decision, 26 October): STRATA_KVA=1 turns it on, and an earlier test build's STRATA_KVA=0 reads as off.
|
||||
* The other two are on by default. The names are the engine switch contract (phaseA-tests/notes-027-plan.md); strata_control/speed_switches.py says the
|
||||
* same for the Terminal (tests/terminal/test_speed_switches.py compares the two).
|
||||
*/
|
||||
export const SPEED_SWITCHES=[
|
||||
{id:'faster_long_prompts',label:'Faster long prompts',group:'Speed',
|
||||
hint:'Reads very long prompts faster by approximating part of the work. Off by default: answers about long documents can miss or mix up details.',
|
||||
default:'off',env:{STRATA_KVA:'1'}},
|
||||
{id:'faster_12gb_nvidia',label:'Faster answers on 12 GB NVIDIA cards',group:'Speed',
|
||||
hint:'Prefers the parts of the model already on the graphics card, which makes answers much faster on 12 GB cards. Turn off if answers look worse than before.',
|
||||
default:'on',env:{STRATA_ROUTE_PRIOR:'0'}},
|
||||
{id:'faster_radeon_9000',label:'Faster answers on Radeon RX 9000 / AI PRO R9700',group:'Speed',
|
||||
hint:'Shares the work between the graphics card and the processor in a way that makes answers faster on these cards. Turn off to go back to the previous setting, which is slower.',
|
||||
default:'on',env:{STRATA_PCIE_FRAC_DEFAULT:'old'}},
|
||||
{id:'deepseek_speedups',label:'DeepSeek speed-ups',group:'Speed',
|
||||
hint:'Reads long prompts faster and loads the parts of the model it needs faster. Turn off if DeepSeek stops working or its answers look wrong; it then runs as in version 0.2.6.',
|
||||
default:'on',env:{DS4_DEFAULTS:'026',DS4_FAST_ATTN:'0',DS4_ATTN_SLAB:'0',DS4_COPY_PIN:'0',DS4_COPY_HUGETLB:'0',DS4_STORE_SPARE:'0',DS4_STORE_PUT:'0'},
|
||||
/* an earlier test build wrote only these six for the same state: they read as the switch being set, and go with it */
|
||||
legacy:{DS4_FAST_ATTN:'0',DS4_ATTN_SLAB:'0',DS4_COPY_PIN:'0',DS4_COPY_HUGETLB:'0',DS4_STORE_SPARE:'0',DS4_STORE_PUT:'0'}},
|
||||
];
|
||||
const GFX12=/^gfx120[01]$/i, RADEON_9000=/\b(?:RX\s*9\d{3}|AI\s*PRO\s*R97\d{2}|R97\d{2})\b/i;
|
||||
/**
|
||||
* Which switches make sense for this model on this PC: only those are shown. `backend` is the engine's (cuda, hip, sycl, metal, cpu). `arch` is the "arch"
|
||||
* of the model's run config: setup writes it only for the families with an engine path of their own (Qwen3.6-35B-A3B "qwen35moe", DeepSeek "deepseek41");
|
||||
* the Qwen3.8-Flash-Next files (the original, Swift, Coder, Unsloth, Gyro, NVFP4) have none. KVA was measured on the Flash-Next shape (48 layers, 512
|
||||
* experts) and the engine declines it on any other, so "Faster long prompts" is shown for a model without an "arch" only.
|
||||
*/
|
||||
/** A discrete NVIDIA card of 13 GiB or less: the engine's rule for residency-biased routing (not an integrated chip, not a card that shares system memory). */
|
||||
const smallNvidia=gpus=>(gpus??[]).some(g=>{
|
||||
if(g.usable===false||g.uma||g.integrated||(g.unified_gb??0)>0)return false;
|
||||
const vendor=String(g.vendor??'').toLowerCase();
|
||||
if(vendor!=='nvidia'&&!(vendor===''&&/nvidia|geforce|\brtx\b|\bgtx\b|quadro|tesla/i.test(String(g.name??''))))return false;
|
||||
return g.vram_gb>0&&g.vram_gb<=13;
|
||||
});
|
||||
export function speedSwitchApplies(id,{deepseek=false,backend=null,gpus=[],arch=null}={}){
|
||||
if(id==='deepseek_speedups')return !!deepseek;
|
||||
if(deepseek)return false; // the Qwen engine's switches
|
||||
if(id==='faster_long_prompts')return !arch&&(backend==='cuda'||backend==='hip');
|
||||
if(id==='faster_12gb_nvidia')return !arch&&backend==='cuda'&&smallNvidia(gpus); // the engine's routing needs the Flash-Next shape (512 experts, top-10) and a CUDA build
|
||||
if(id==='faster_radeon_9000')return backend==='hip'&&(gpus??[]).some(g=>(!g.vendor||g.vendor==='amd')&&(GFX12.test(String(g.arch??''))||(!g.arch&&RADEON_9000.test(String(g.name??'')))));
|
||||
return false;
|
||||
}
|
||||
/** The switch is outside its default when every entry it writes is in the environment with its value; anything less or other (a hand-edited file, STRATA_KVA=0) is the default state and is left alone. */
|
||||
export function speedSwitchIsSet(env,id){const sw=SPEED_SWITCHES.find(s=>s.id===id),has=entries=>!!entries&&Object.keys(entries).length>0&&Object.entries(entries).every(([name,value])=>env?.[name]===value);return !!sw&&(has(sw.env)||has(sw.legacy));}
|
||||
/** Is the feature on for a launch with this environment? */
|
||||
export function speedSwitchIsOn(env,id){const sw=SPEED_SWITCHES.find(s=>s.id===id);return !!sw&&speedSwitchIsSet(env,id)!==(sw.default==='on');}
|
||||
/** The environment with the feature on or off: its default removes the switch's entries, the other state writes them. Nothing else in it changes. */
|
||||
export function setSpeedSwitch(env,id,on){
|
||||
const sw=SPEED_SWITCHES.find(s=>s.id===id);if(!sw)throw new Error(`Unknown speed switch: ${id}`);
|
||||
const write=on!==(sw.default==='on'),next={...(env??{})};for(const [name,value] of Object.entries(sw.env)){if(write)next[name]=value;else delete next[name];}if(!write)for(const name of Object.keys(sw.legacy??{}))delete next[name];return next;
|
||||
}
|
||||
/** What the settings answer carries: each switch that applies, with its words, its default, the entries it writes outside the default, and whether the feature is on. */
|
||||
export function speedSwitchRows(env,context){return SPEED_SWITCHES.filter(s=>speedSwitchApplies(s.id,context)).map(s=>({...s,on:speedSwitchIsOn(env,s.id)}));}
|
||||
/** Settings the app itself applies when it starts a model (they are not read from the engine's source, so the engine's text never says it supports them). */
|
||||
export const APP_OWNED_FIELDS=['mtp','batchMtp','drafting'];
|
||||
export const APP_OWNED_FIELDS=['mtp','batchMtp','drafting','ds_experts'];
|
||||
/** The engine arguments without the draft layer: --mtp <folder or count>, --spec-min-p <p> (its confidence threshold) and --batch-mtp. --spec stays: prompt lookup still uses its windows. Same rule as strata_control/draft_layer.py. */
|
||||
export function withoutDraftLayer(args){
|
||||
const out=[];const list=(args??[]).map(String);
|
||||
@@ -39,7 +98,7 @@ export function validateNativeSettings(values){
|
||||
for(const [key,value] of Object.entries(values)){
|
||||
|
||||
if(key==='args'){if(!Array.isArray(value)||value.length>200||value.some(v=>typeof v!=='string'||v.length>4000||/[\n\r\0]/.test(v))||value.some(v=>['--host','--port','--api-key'].includes(v)))throw new Error('Engine arguments must be text values. Network access stays managed by Strata.');result.args=[...value];continue;}
|
||||
if(key==='env'){if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('Engine environment must be an object.');const env={};for(const [name,text] of Object.entries(value)){if(!/^STRATA_[A-Z0-9_]+$/.test(name)||typeof text!=='string'||text.length>4000||text.includes('\0'))throw new Error('Use STRATA_ environment flags with text values.');env[name]=text;}result.env=env;continue;}
|
||||
if(key==='env'){if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('Engine environment must be an object.');const env={};for(const [name,text] of Object.entries(value)){if(!ENV_FLAG.test(name)||typeof text!=='string'||text.length>4000||text.includes('\0'))throw new Error('Use STRATA_ environment flags with text values.');env[name]=text;}result.env=env;continue;}
|
||||
if(key==='sampling'){if(!value||typeof value!=='object'||Array.isArray(value))throw new Error('Sampling must be an object.');const limits={temperature:[0,10],top_p:[Number.MIN_VALUE,1],top_k:[1,64],min_p:[0,1],repetition_penalty:[Number.MIN_VALUE,10],presence_penalty:[0,10],frequency_penalty:[0,10],penalty_last_n:[0,1048576],seed:[1,2147483647]};for(const [name,n] of Object.entries(value)){if(name==='experimental_speed_projection'){if(typeof n!=='boolean')throw new Error('Speed projection must be on or off.');continue;}if(!limits[name]||!Number.isFinite(n)||(['top_k','seed','penalty_last_n'].includes(name)&&!Number.isInteger(n))||n<limits[name][0]||n>limits[name][1])throw new Error(`Choose a valid sampling ${name}.`);}result.sampling={...value};continue;}
|
||||
const field=NATIVE_FIELDS.find(f=>f.id===key);if(!field)throw new Error(`Unknown native setting: ${key}`);
|
||||
if(value===null||value===''){result[key]=null;continue;}
|
||||
@@ -74,5 +133,5 @@ export function validateMcpServers(servers,previous={}){
|
||||
}
|
||||
|
||||
const sensitive=name=>/KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL/i.test(name);
|
||||
export function publicNativeEnv(env){return Object.fromEntries(Object.entries(env).filter(([name])=>/^STRATA_[A-Z0-9_]+$/.test(name)).map(([name,value])=>[name,sensitive(name)?MASK:value]));}
|
||||
export function restoreNativeEnv(env,previous={}){const result=Object.fromEntries(Object.entries(previous).filter(([name])=>!/^STRATA_[A-Z0-9_]+$/.test(name)));for(const [name,value] of Object.entries(env)){if(value===MASK){if(previous[name]===undefined)throw new Error(`Enter a new value for ${name}.`);result[name]=previous[name];}else result[name]=value;}return result;}
|
||||
export function publicNativeEnv(env){return Object.fromEntries(Object.entries(env).filter(([name])=>ENV_FLAG.test(name)).map(([name,value])=>[name,sensitive(name)?MASK:value]));}
|
||||
export function restoreNativeEnv(env,previous={}){const result=Object.fromEntries(Object.entries(previous).filter(([name])=>!ENV_FLAG.test(name)));for(const [name,value] of Object.entries(env)){if(value===MASK){if(previous[name]===undefined)throw new Error(`Enter a new value for ${name}.`);result[name]=previous[name];}else result[name]=value;}return result;}
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* The computer's regional format, for the Monitor's cost line (#3628): which region and, where the system names it, which currency the
|
||||
* person uses. Read once, without PowerShell:
|
||||
* Windows the regional format (Settings > Time & language > Region > Regional format) from the registry: LocaleName ("en-US"); when it
|
||||
* names no region, the country or region setting (Geo\Name).
|
||||
* macOS `defaults read -g AppleLocale` ("en_US", or "de_DE@currency=CHF" when the person set another currency).
|
||||
* Linux LC_ALL, LC_MONETARY or LANG ("de_DE.UTF-8"), and the locale's own currency when `locale -k int_curr_symbol` answers.
|
||||
* Nothing here is a guess: no region means no answer, and the page then falls back to its own language list.
|
||||
*/
|
||||
import { execFileSync } from 'node:child_process';
|
||||
|
||||
const NONE = Object.freeze({ locale: null, region: null, currency: null, source: null });
|
||||
|
||||
/** "en_US.UTF-8" / "de_DE@euro" / "zh-Hans-CN" -> { locale: "en-US", region: "US" } (null parts when the tag has none). */
|
||||
export function parseLocaleTag(text) {
|
||||
const tag = String(text ?? '').trim().replace(/[.@].*$/, '').replace(/_/g, '-');
|
||||
if (!tag || /^(c|posix)$/i.test(tag)) return { locale: null, region: null };
|
||||
const parts = tag.split('-');
|
||||
const region = parts.slice(1).find(p => /^[A-Za-z]{2}$/.test(p)) ?? null;
|
||||
const language = /^[A-Za-z]{2,3}$/.test(parts[0]) ? parts[0].toLowerCase() : null;
|
||||
if (!language) return { locale: null, region: null };
|
||||
return { locale: region ? `${language}-${region.toUpperCase()}` : language, region: region ? region.toUpperCase() : null };
|
||||
}
|
||||
|
||||
export function parseRegValue(out, name) {
|
||||
const m = new RegExp(`^\\s*${name}\\s+REG_SZ\\s+(.*?)\\s*$`, 'mi').exec(String(out ?? ''));
|
||||
return m ? m[1] : null;
|
||||
}
|
||||
|
||||
const currencyCode = value => (/^[A-Z]{3}$/.test(String(value ?? '').trim().toUpperCase()) ? String(value).trim().toUpperCase() : null);
|
||||
|
||||
export function detectRegion({ platform = process.platform, env = process.env, run = (cmd, args) => execFileSync(cmd, args, { encoding: 'utf8', timeout: 4000, windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'] }) } = {}) {
|
||||
try {
|
||||
if (platform === 'win32') {
|
||||
const intl = 'HKCU\\Control Panel\\International';
|
||||
const named = parseLocaleTag(parseRegValue(run('reg', ['query', intl, '/v', 'LocaleName']), 'LocaleName'));
|
||||
if (named.region) return { ...named, currency: null, source: 'windows' };
|
||||
let geo = null;
|
||||
try { geo = parseRegValue(run('reg', ['query', `${intl}\\Geo`, '/v', 'Name']), 'Name'); } catch { /* no country setting */ }
|
||||
const region = /^[A-Za-z]{2}$/.test(geo ?? '') ? geo.toUpperCase() : null;
|
||||
return region ? { locale: named.locale ? `${named.locale}-${region}` : null, region, currency: null, source: 'windows' } : { ...NONE };
|
||||
}
|
||||
if (platform === 'darwin') {
|
||||
const raw = String(run('defaults', ['read', '-g', 'AppleLocale'])).trim();
|
||||
const named = parseLocaleTag(raw);
|
||||
const currency = currencyCode(/@currency=([A-Za-z]{3})/.exec(raw)?.[1]);
|
||||
return named.region || currency ? { ...named, currency, source: 'macos' } : { ...NONE };
|
||||
}
|
||||
const named = parseLocaleTag(env.LC_ALL || env.LC_MONETARY || env.LANG);
|
||||
let currency = null;
|
||||
try { currency = currencyCode(/int_curr_symbol="?([A-Za-z]{3})/.exec(run('locale', ['-k', 'int_curr_symbol']))?.[1]); } catch { /* no locale command */ }
|
||||
return named.region || currency ? { ...named, currency, source: 'linux' } : { ...NONE };
|
||||
} catch {
|
||||
return { ...NONE };
|
||||
}
|
||||
}
|
||||
|
||||
let cached = null;
|
||||
/** The answer is cached: the regional format does not change while the host runs. */
|
||||
export function systemLocale(options) {
|
||||
if (options) return detectRegion(options);
|
||||
// A test or a demo can name the regional format (the screenshots of the Monitor); a packaged app never reads it.
|
||||
if (process.env.STRATA_TEST_LOCALE && process.env.STRATA_PACKAGED !== '1') { const named = parseLocaleTag(process.env.STRATA_TEST_LOCALE); return { ...named, currency: null, source: 'test' }; }
|
||||
cached ??= detectRegion();
|
||||
return cached;
|
||||
}
|
||||
@@ -134,6 +134,14 @@ export function checkRunConfig(text, { known = KNOWN_KEYS } = {}) {
|
||||
return { ok: !issues.some(i => i.level === 'error'), issues };
|
||||
}
|
||||
|
||||
/** Validate and parse one captured text value, so callers use the checked snapshot. */
|
||||
export function checkAndParseRunConfig(text, options) {
|
||||
text = String(text ?? '');
|
||||
const checked = checkRunConfig(text, options);
|
||||
if (!checked.ok) return { ...checked, config: null };
|
||||
return { ...checked, config: JSON.parse(text.replace(/^\uFEFF/, '')) };
|
||||
}
|
||||
|
||||
/** The English lines of the issues, `Line 12: …`, for the Details of a refused start. */
|
||||
export function describeIssues(issues, level) {
|
||||
return issues.filter(i => !level || i.level === level).map(i => `${i.line ? `Line ${i.line}: ` : ''}${i.message}`);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* How often the host asks the graphics card driver for its readings (#4066).
|
||||
* It used to start two nvidia-smi processes every 3 s for as long as the app was open, even with nothing loaded and
|
||||
* the Monitor out of sight; on some PCs that was felt as a stutter while typing. Now the 3 s pace is kept while a model
|
||||
* runs or the Monitor is being looked at, and an idle app asks once every 30 s.
|
||||
*/
|
||||
export const ACTIVE_MS = 3000;
|
||||
export const IDLE_MS = 30000;
|
||||
/** The Monitor screen asks again every 10 s while it is open; this is how long one ask keeps the fast pace. */
|
||||
export const WATCH_MS = 25000;
|
||||
|
||||
/** `live`: a model is loaded or an engine runs. `watchedUntil`: ms timestamp until which the Monitor was last seen open. */
|
||||
export function sensorPace({ live = false, watchedUntil = 0, now = Date.now() } = {}) {
|
||||
const watched = now < watchedUntil;
|
||||
return { intervalMs: live || watched ? ACTIVE_MS : IDLE_MS, transfer: !!live };
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* The desktop shell's own choices, kept in <Strata data folder>/shell-prefs.json (#3402, #3477): the shell reads the file when it starts
|
||||
* (the port it asks for, whether closing the window keeps Strata in the tray, the language of the tray menu), before any page exists.
|
||||
* The page changes them through the host (POST /api/shell/prefs); a change of the port or the tray applies the next time Strata starts.
|
||||
*
|
||||
* { "port": 0 | 1024..65535, "tray": false, "language": "en" }
|
||||
*
|
||||
* Port 0 is the default: the shell asks for 47831 and takes a free port when that one is busy.
|
||||
*/
|
||||
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { componentsDirectory } from './control-runtime.mjs';
|
||||
|
||||
export const DEFAULT_PORT = 47831;
|
||||
export const LANGUAGES = ['en', 'zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko'];
|
||||
export const DEFAULTS = Object.freeze({ port: 0, tray: false, language: 'en' });
|
||||
|
||||
export const validPort = value => Number.isInteger(value) && value >= 1024 && value <= 65535;
|
||||
|
||||
export function shellPrefsFile({ env = process.env } = {}) {
|
||||
return join(dirname(componentsDirectory({ env })), 'shell-prefs.json');
|
||||
}
|
||||
|
||||
/** The file's content with every field checked; anything missing or wrong is the default. */
|
||||
export function cleanPrefs(raw) {
|
||||
const value = raw && typeof raw === 'object' ? raw : {};
|
||||
return {
|
||||
port: validPort(value.port) ? value.port : 0,
|
||||
tray: value.tray === true,
|
||||
language: LANGUAGES.includes(value.language) ? value.language : 'en',
|
||||
};
|
||||
}
|
||||
|
||||
export function readShellPrefs(file = shellPrefsFile()) {
|
||||
try { return cleanPrefs(JSON.parse(readFileSync(file, 'utf8').replace(/^/, ''))); } catch { return { ...DEFAULTS }; }
|
||||
}
|
||||
|
||||
/** Merge a change into the file. Throws a plain sentence for a port that cannot be used. */
|
||||
export function writeShellPrefs(patch, file = shellPrefsFile()) {
|
||||
const next = readShellPrefs(file);
|
||||
if (patch && 'port' in patch) {
|
||||
const wanted = patch.port === null || patch.port === '' || patch.port === 0 ? 0 : Number(patch.port);
|
||||
if (wanted !== 0 && !validPort(wanted)) throw new Error('Choose a port between 1024 and 65535, or leave it empty to let Strata choose.');
|
||||
next.port = wanted;
|
||||
}
|
||||
if (patch && 'tray' in patch) next.tray = patch.tray === true;
|
||||
if (patch && 'language' in patch && LANGUAGES.includes(patch.language)) next.language = patch.language;
|
||||
mkdirSync(dirname(file), { recursive: true });
|
||||
const temporary = `${file}.${process.pid}.tmp`;
|
||||
writeFileSync(temporary, JSON.stringify(next, null, 2) + '\n');
|
||||
renameSync(temporary, file);
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* What the shell tells the host about this start: STRATA_PORT_NOTICE is "busy:<wanted>:<used>" when the port it wanted was taken
|
||||
* (set by the shell, never by the person). The page turns it into a sentence in the person's language.
|
||||
*/
|
||||
export function parsePortNotice(value) {
|
||||
const m = /^busy:(\d{1,5}):(\d{1,5})$/.exec(String(value ?? ''));
|
||||
return m ? { wanted: Number(m[1]), used: Number(m[2]) } : null;
|
||||
}
|
||||
|
||||
/** The notification route of the shell's bridge (loopback, token). Null outside the desktop app. */
|
||||
export function createShellNotifier({ env = process.env, fetcher = fetch } = {}) {
|
||||
const base = env.STRATA_SHELL_BRIDGE, token = env.STRATA_SHELL_TOKEN;
|
||||
if (!base || !token || !/^http:\/\/127\.0\.0\.1:\d+$/.test(base)) return null;
|
||||
return {
|
||||
async notify({ title, body }) {
|
||||
const query = `title=${encodeURIComponent(String(title ?? '').slice(0, 120))}&body=${encodeURIComponent(String(body ?? '').slice(0, 300))}`;
|
||||
const response = await fetcher(`${base}/shell/notify?${query}`, { method: 'POST', headers: { authorization: `Bearer ${token}` }, signal: AbortSignal.timeout(5000) });
|
||||
let reply = null;
|
||||
try { reply = await response.json(); } catch { /* no body */ }
|
||||
return { shown: response.ok && reply?.shown === true };
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
/** Host counters. CPU sockets are measured only when their logical CPU IDs are known. */
|
||||
import os from 'node:os';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { createPowerShellLoop, endWithHost } from './windows-poll.mjs';
|
||||
import { readFile, readdir } from 'node:fs/promises';
|
||||
import { availableMemoryGb } from './hardware.mjs';
|
||||
import { probe } from './util.mjs';
|
||||
@@ -18,7 +20,7 @@ export function cpuUtilization(previous, current, ids) {
|
||||
}
|
||||
|
||||
export function diskRate(previous, current, time) {
|
||||
const elapsed=previous?(time-previous.time)/1000:0;
|
||||
const elapsed=previous?((current?.at??time)-(previous.counters?.at??previous.time))/1000:0;
|
||||
if(elapsed<=0||!current||!previous?.counters)return {readMbs:null,writeMbs:null};
|
||||
const read=current.read-previous.counters.read,write=current.write-previous.counters.write;
|
||||
return {readMbs:read>=0?read/1024**2/elapsed:null,writeMbs:write>=0?write/1024**2/elapsed:null};
|
||||
@@ -41,6 +43,33 @@ export function parseMacDiskCounters(raw) {
|
||||
return reads.length&&writes.length?{read:reads.reduce((n,m)=>n+Number(m[1]),0),write:writes.reduce((n,m)=>n+Number(m[1]),0)}:null;
|
||||
}
|
||||
|
||||
export function parseWindowsDiskLine(line) {
|
||||
const m=/^\s*(\d+)\s+(\d+)\s*$/.exec(String(line));
|
||||
return m?{read:Number(m[1]),write:Number(m[2])}:null;
|
||||
}
|
||||
|
||||
/** The disk counters, read by one long-lived PowerShell (windows-poll.mjs; #3939). */
|
||||
export function createWindowsDiskReader({ spawnFn=spawn, intervalSec=4, maxStarts=3, now=Date.now }={}) {
|
||||
let latest=null;
|
||||
const script=`while($true){$d=Get-CimInstance Win32_PerfRawData_PerfDisk_PhysicalDisk -Filter "Name='_Total'";if($d){[Console]::Out.WriteLine(([string]$d.DiskReadBytesPersec)+' '+([string]$d.DiskWriteBytesPersec));[Console]::Out.Flush()};Start-Sleep -Seconds ${intervalSec}}`;
|
||||
const loop=createPowerShellLoop({script,spawnFn,maxStarts,onLine:line=>{
|
||||
const parsed=parseWindowsDiskLine(line);
|
||||
if(parsed)latest={...parsed,at:now()};
|
||||
return !!parsed;
|
||||
}});
|
||||
return {
|
||||
read() { loop.start(); return latest&&now()-latest.at<5*intervalSec*1000?latest:null; },
|
||||
stop() { loop.stop(); },
|
||||
get starts() { return loop.starts; },
|
||||
};
|
||||
}
|
||||
|
||||
let windowsReader=null;
|
||||
function windowsDisks() {
|
||||
windowsReader??=endWithHost(createWindowsDiskReader());
|
||||
return windowsReader.read();
|
||||
}
|
||||
|
||||
async function disks() {
|
||||
try {
|
||||
if(process.platform==='linux') {
|
||||
@@ -49,24 +78,26 @@ async function disks() {
|
||||
}
|
||||
if(process.platform==='darwin')return parseMacDiskCounters(await probe('ioreg',['-r','-c','IOBlockStorageDriver','-l'],1500));
|
||||
if(process.platform==='win32') {
|
||||
const raw=await probe('powershell.exe',['-NoProfile','-NonInteractive','-Command',"Get-CimInstance Win32_PerfRawData_PerfDisk_PhysicalDisk -Filter \"Name='_Total'\" | Select-Object DiskReadBytesPersec,DiskWriteBytesPersec | ConvertTo-Json -Compress"],2000);
|
||||
const value=JSON.parse(raw);
|
||||
if(value.DiskReadBytesPersec!=null&&value.DiskWriteBytesPersec!=null)return {read:Number(value.DiskReadBytesPersec),write:Number(value.DiskWriteBytesPersec)};
|
||||
return windowsDisks();
|
||||
}
|
||||
} catch { /* An unsupported counter stays unavailable. */ }
|
||||
return null;
|
||||
}
|
||||
|
||||
export function createSystemSampler() {
|
||||
let previousCpu=null,previousDisk=null;
|
||||
let previousCpu=null,previousDisk=null,lastRate={readMbs:null,writeMbs:null};
|
||||
return async processors => {
|
||||
const current=os.cpus(),time=Date.now();
|
||||
const cpuLoad=cpuUtilization(previousCpu,current,current.map((_,i)=>i));
|
||||
const cpus=processors.map(p=>({id:p.id,utilizationPct:cpuUtilization(previousCpu,current,p.logicalIds??(processors.length===1?current.map((_,i)=>i):[]))}));
|
||||
previousCpu=current;
|
||||
const [available,counters]=await Promise.all([availableMemoryGb(process.platform),disks()]);
|
||||
const rate=diskRate(previousDisk,counters,time);
|
||||
previousDisk={time,counters};
|
||||
let rate=lastRate;
|
||||
if(!(counters&&counters.at!==undefined&&previousDisk?.counters?.at===counters.at)) {
|
||||
rate=diskRate(previousDisk,counters,time);
|
||||
previousDisk={time,counters};
|
||||
lastRate=rate;
|
||||
}
|
||||
const total=os.totalmem()/1024**3,free=available??os.freemem()/1024**3;
|
||||
return {cpuLoad,cpus,ramUsedGb:Math.max(0,Math.min(total,total-free)),ramTotalGb:total,diskReadGbs:rate.readMbs===null?null:rate.readMbs/1024,diskWriteMbs:rate.writeMbs};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* CPU and SSD temperatures for the Monitor's Power card (#3628). A value that this PC cannot give stays null and its line is left out,
|
||||
* so the card never shows a made-up number.
|
||||
*
|
||||
* Linux: the kernel's hwmon sensors (coretemp, k10temp, zenpower for the processor; nvme and drivetemp for the drives).
|
||||
* Windows: the drive reports its own temperature to a query that needs no administrator (IOCTL_STORAGE_QUERY_PROPERTY with the device
|
||||
* temperature property). Get-StorageReliabilityCounter is tried first because it is the documented route; on a normal account it is
|
||||
* refused, then the query is used. One long-lived PowerShell asks every 30 s (windows-poll.mjs).
|
||||
* There is no unprivileged, trustworthy processor temperature on Windows, so none is shown there.
|
||||
* macOS: none.
|
||||
*/
|
||||
import { readFile, readdir } from 'node:fs/promises';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { createPowerShellLoop, endWithHost } from './windows-poll.mjs';
|
||||
|
||||
const CPU_SENSORS = new Set(['coretemp', 'k10temp', 'zenpower', 'cpu_thermal', 'cpu-thermal']);
|
||||
const DISK_SENSORS = new Set(['nvme', 'drivetemp']);
|
||||
const plausible = c => Number.isFinite(c) && c > 0 && c < 150;
|
||||
|
||||
/** hwmon entries [{name, temps: [milli-degrees…]}] -> the hottest processor and drive sensor. */
|
||||
export function pickTemperatures(entries) {
|
||||
let cpu = null, ssd = null;
|
||||
for (const { name, temps } of entries) {
|
||||
const hottest = Math.max(...temps.map(t => t / 1000).filter(plausible), -Infinity);
|
||||
if (!Number.isFinite(hottest)) continue;
|
||||
if (CPU_SENSORS.has(name)) cpu = Math.max(cpu ?? -Infinity, hottest);
|
||||
else if (DISK_SENSORS.has(name)) ssd = Math.max(ssd ?? -Infinity, hottest);
|
||||
}
|
||||
return { cpuTempC: cpu === null ? null : Math.round(cpu), ssdTempC: ssd === null ? null : Math.round(ssd) };
|
||||
}
|
||||
|
||||
export async function readLinuxTemperatures({ base = '/sys/class/hwmon', read = readFile, list = readdir } = {}) {
|
||||
const entries = [];
|
||||
let folders = [];
|
||||
try { folders = await list(base); } catch { return { cpuTempC: null, ssdTempC: null }; }
|
||||
for (const folder of folders) {
|
||||
try {
|
||||
const name = String(await read(`${base}/${folder}/name`, 'utf8')).trim();
|
||||
if (!CPU_SENSORS.has(name) && !DISK_SENSORS.has(name)) continue;
|
||||
const files = (await list(`${base}/${folder}`)).filter(f => /^temp\d+_input$/.test(f));
|
||||
const temps = [];
|
||||
for (const file of files) temps.push(Number(String(await read(`${base}/${folder}/${file}`, 'utf8')).trim()));
|
||||
entries.push({ name, temps });
|
||||
} catch { /* a sensor that disappears is skipped */ }
|
||||
}
|
||||
return pickTemperatures(entries);
|
||||
}
|
||||
|
||||
/** One line of the Windows loop: "ssd 53" or "ssd -". */
|
||||
export function parseSsdLine(line) {
|
||||
const m = /^\s*ssd\s+(-?\d+|-)\s*$/.exec(String(line));
|
||||
if (!m) return undefined;
|
||||
const value = m[1] === '-' ? NaN : Number(m[1]);
|
||||
return plausible(value) ? value : null;
|
||||
}
|
||||
|
||||
const WINDOWS_SCRIPT = String.raw`
|
||||
$ErrorActionPreference='SilentlyContinue'
|
||||
$cs=@'
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
public static class StrataDiskTemp {
|
||||
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Unicode)] static extern IntPtr CreateFile(string n, uint a, uint s, IntPtr p, uint d, uint f, IntPtr t);
|
||||
[DllImport("kernel32.dll", SetLastError=true)] static extern bool DeviceIoControl(IntPtr h, uint c, byte[] i, uint il, byte[] o, uint ol, out uint r, IntPtr ov);
|
||||
[DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr h);
|
||||
public static int Read(int n) {
|
||||
IntPtr h = CreateFile("\\\\.\\PhysicalDrive" + n, 0, 3, IntPtr.Zero, 3, 0, IntPtr.Zero);
|
||||
if (h == (IntPtr)(-1)) return -1;
|
||||
try {
|
||||
byte[] q = new byte[12]; q[0] = 0x34; byte[] o = new byte[512]; uint r;
|
||||
if (!DeviceIoControl(h, 0x002D1400, q, 12, o, 512, out r, IntPtr.Zero)) return -1;
|
||||
if (BitConverter.ToUInt16(o, 12) < 1) return -1;
|
||||
return BitConverter.ToInt16(o, 26);
|
||||
} finally { CloseHandle(h); }
|
||||
}
|
||||
}
|
||||
'@
|
||||
$compiled=$false
|
||||
while($true){
|
||||
$max=-1
|
||||
$c=@(Get-PhysicalDisk | Get-StorageReliabilityCounter | Where-Object { $_.Temperature -gt 0 })
|
||||
if($c.Count -gt 0){ $max=($c | Measure-Object Temperature -Maximum).Maximum }
|
||||
else {
|
||||
if(-not $compiled){ Add-Type -TypeDefinition $cs; $compiled=$true }
|
||||
foreach($n in 0..15){ $v=[StrataDiskTemp]::Read($n); if($v -gt $max){ $max=$v } }
|
||||
}
|
||||
if($max -gt 0){ [Console]::Out.WriteLine('ssd '+$max) } else { [Console]::Out.WriteLine('ssd -') }
|
||||
[Console]::Out.Flush()
|
||||
Start-Sleep -Seconds 30
|
||||
}`;
|
||||
|
||||
export function createWindowsSsdReader({ spawnFn = spawn, maxStarts = 2, now = Date.now, intervalSec = 30 } = {}) {
|
||||
let latest = null;
|
||||
const loop = createPowerShellLoop({
|
||||
script: WINDOWS_SCRIPT, spawnFn, maxStarts,
|
||||
onLine: line => {
|
||||
const parsed = parseSsdLine(line);
|
||||
if (parsed === undefined) return false;
|
||||
latest = { value: parsed, at: now() };
|
||||
return true;
|
||||
},
|
||||
});
|
||||
return {
|
||||
read() { loop.start(); return latest && now() - latest.at < 4 * intervalSec * 1000 ? latest.value : null; },
|
||||
stop() { loop.stop(); },
|
||||
get starts() { return loop.starts; },
|
||||
};
|
||||
}
|
||||
|
||||
let windowsReader = null;
|
||||
let linuxCache = { at: 0, value: { cpuTempC: null, ssdTempC: null } };
|
||||
|
||||
/** The temperatures this PC can give now: { cpuTempC, ssdTempC } (null where unreadable). Cheap to call every few seconds. */
|
||||
export async function readTemperatures({ platform = process.platform, now = Date.now } = {}) {
|
||||
if (platform === 'linux') {
|
||||
if (now() - linuxCache.at > 10_000) linuxCache = { at: now(), value: await readLinuxTemperatures() };
|
||||
return linuxCache.value;
|
||||
}
|
||||
if (platform === 'win32') {
|
||||
windowsReader ??= endWithHost(createWindowsSsdReader());
|
||||
return { cpuTempC: null, ssdTempC: windowsReader.read() };
|
||||
}
|
||||
return { cpuTempC: null, ssdTempC: null };
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export async function checkComponentUpdates({ control, appUpdater = null, appVer
|
||||
const message = /update server|aren't available|No internet/.test(plain.headline) ? plain.message : `Couldn't check for updates. Try again in a moment.`;
|
||||
return { checkedAt, strata: { installedVersion: appVersion ?? control.version ?? null, status: 'error', message, details: plain.details, canInstall: false }, engine: { installedVersion: null, status: 'error', message, details: plain.details, canInstall: false } };
|
||||
}
|
||||
const mib = bytes => `${Math.round((bytes ?? 0) / (1 << 20))} MB`;
|
||||
const mib = bytes => `${Math.round((bytes ?? 0) / 1_000_000)} MB`; // decimal megabytes, like the Terminal and the release page
|
||||
const engine = report.engine ?? {};
|
||||
const installedEngine = engine.installed?.version ?? null;
|
||||
const offered = engine.offered?.version ?? null;
|
||||
@@ -74,6 +74,7 @@ export async function checkComponentUpdates({ control, appUpdater = null, appVer
|
||||
const app = report.app ?? {};
|
||||
let appNew = app.status === 'available' ? app.offered : null;
|
||||
let appNotes = app.notes ?? '';
|
||||
let appCheckFailed = null; // the shell's own (Tauri) check threw: before this, the Settings check hid it and showed only Control's text
|
||||
let appCannot = null; // browser mode: the app window's updater is not running, so the app itself cannot be updated from here
|
||||
if (appUpdater) {
|
||||
try {
|
||||
@@ -81,12 +82,41 @@ export async function checkComponentUpdates({ control, appUpdater = null, appVer
|
||||
appNew = verdict.available ? verdict.version : null;
|
||||
appNotes = verdict.notes ?? appNotes;
|
||||
} catch (error) {
|
||||
if (error?.code === 'app-update-unavailable' && appUpdater.unavailable) appCannot = appUpdater.unavailable; // otherwise the feed's own view stands
|
||||
if (error?.code === 'app-update-unavailable' && appUpdater.unavailable) appCannot = appUpdater.unavailable;
|
||||
else appCheckFailed = String(error?.message ?? error ?? 'The app update check failed.'); // the app's own check did not work: say so, raw text behind Details
|
||||
}
|
||||
}
|
||||
const controlNew = control_.status === 'available' ? control_.offered : null;
|
||||
const strata = { installedVersion: appVersion ?? control_.installed ?? control.version ?? null, canInstall: !!((appNew && !appCannot) || controlNew) };
|
||||
if (appNew || controlNew) Object.assign(strata, { status: 'available', latestVersion: appNew ?? controlNew, message: `A new version of Strata is available.${appNotes ? ` ${appNotes}` : ''}${appNew && appCannot ? ` ${appCannot}` : ''}` });
|
||||
const appCheckLine = "Strata couldn't check for a new version of the app itself. Try again later.";
|
||||
if (appNew || controlNew) Object.assign(strata, { status: 'available', latestVersion: appNew ?? controlNew, message: `A new version of Strata is available.${appNotes ? ` ${appNotes}` : ''}${appNew && appCannot ? ` ${appCannot}` : ''}${appCheckFailed ? ` ${appCheckLine}` : ''}` });
|
||||
else if (appCheckFailed) Object.assign(strata, { status: 'error', message: appCheckLine });
|
||||
else Object.assign(strata, { status: 'current', message: 'Strata is up to date.' });
|
||||
if (appCheckFailed) strata.details = appCheckFailed;
|
||||
return { checkedAt, feed: report.feed, strata, engine: engineView, serving: report.serving ?? [] };
|
||||
}
|
||||
|
||||
/**
|
||||
* What the first-run card shows: this PC's graphics card(s), the engine package the signed feed offers for it and how big it is.
|
||||
* One feed read, nothing downloaded. `status`: offer (a package fits), none (nothing fits; `reasons` say why), offline (the feed could not be
|
||||
* read), installed (an engine is already here), wrong-make (an engine for another make of card is installed).
|
||||
*/
|
||||
export async function engineFirstRun({ control, gpus = [] }) {
|
||||
const cards = gpus.map(g => ({ name: g.name ?? 'Graphics card', vramGb: g.vramGb ?? null }));
|
||||
let report;
|
||||
try {
|
||||
report = await control.updateCheck({});
|
||||
} catch (error) {
|
||||
const plain = plainUpdateError(error, 'Strata');
|
||||
return { status: looksOffline(error) || /update server|No internet/.test(plain.headline ?? '') ? 'offline' : 'error', gpus: cards, message: plain.message, details: plain.details };
|
||||
}
|
||||
const engine = report.engine ?? {};
|
||||
const hardware = report.hardware ?? {};
|
||||
const base = { gpus: cards, driver: hardware.nvidia_driver ?? null, backend: hardware.backend ?? null };
|
||||
if (engine.installed) return { ...base, status: 'installed', installedVersion: engine.installed.version ?? null };
|
||||
if (engine.status === 'wrong-make') return { ...base, status: 'wrong-make', message: engine.note ?? null, reasons: engine.reasons ?? [] };
|
||||
if (engine.offered && (engine.status === 'install' || engine.status === 'available')) {
|
||||
return { ...base, status: 'offer', offer: { version: engine.offered.version, bytes: engine.download_bytes || engine.offered.size || 0, variant: engine.offered.variant ?? '', backend: engine.offered.backend ?? null } };
|
||||
}
|
||||
return { ...base, status: 'none', message: engine.note ?? null, reasons: engine.reasons ?? [] };
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Windows graphics cards that nvidia-smi does not cover (AMD, Intel): their size and their load.
|
||||
* - size: the DirectX adapter list in the registry (HKLM\SOFTWARE\Microsoft\DirectX) has a 64-bit DedicatedVideoMemory and the adapter
|
||||
* LUID. Win32_VideoController.AdapterRAM is 32 bits and reads 0 or 4 GB for a 16 GB card (#3727, #3836).
|
||||
* - load and memory in use: the Windows GPU performance counters (the ones Task Manager shows), read by one long-lived PowerShell and
|
||||
* matched to the card by LUID. Temperature, power and the PCIe link need the vendor's own library, so they stay "not available".
|
||||
*/
|
||||
import { createPowerShellLoop, endWithHost } from './windows-poll.mjs';
|
||||
import { utf8Script } from './powershell-utf8.mjs';
|
||||
|
||||
export const DX_ADAPTERS_SCRIPT = utf8Script(
|
||||
"Get-ChildItem HKLM:\\SOFTWARE\\Microsoft\\DirectX | ForEach-Object { $p = Get-ItemProperty $_.PSPath; " +
|
||||
"if ($p.Description -and $null -ne $p.AdapterLuid) { [pscustomobject]@{ Description = [string]$p.Description; VendorId = [string]$p.VendorId; " +
|
||||
"Luid = [string]$p.AdapterLuid; Dedicated = [string]$p.DedicatedVideoMemory; Software = [string]$p.SoftwareAdapter } } } | ConvertTo-Json -Compress");
|
||||
|
||||
/** luid_0x<high>_0x<low> in the spelling of the performance counters, from the registry's 64-bit number. */
|
||||
export function luidName(value) {
|
||||
try {
|
||||
const n = BigInt.asUintN(64, BigInt(String(value)));
|
||||
const hex = v => '0x' + v.toString(16).padStart(8, '0');
|
||||
return `luid_${hex(n >> 32n)}_${hex(n & 0xffffffffn)}`;
|
||||
} catch { return null; }
|
||||
}
|
||||
|
||||
/** The adapters the DirectX registry lists: [{ description, vendorId, luid, bytes, software }]. Never throws. */
|
||||
export function parseDxAdapters(raw) {
|
||||
try {
|
||||
const parsed = JSON.parse(raw), rows = Array.isArray(parsed) ? parsed : [parsed];
|
||||
return rows.filter(r => r?.Description).map(r => ({
|
||||
description: String(r.Description), vendorId: Number(r.VendorId) || 0, luid: luidName(r.Luid),
|
||||
bytes: Number(r.Dedicated) || 0, software: String(r.Software) === '1' || String(r.Software).toLowerCase() === 'true',
|
||||
}));
|
||||
} catch { return []; }
|
||||
}
|
||||
|
||||
const norm = text => String(text ?? '').toLowerCase().replace(/[^a-z0-9]/g, '');
|
||||
const VIRTUAL = /virtual|remote|indirect|mirror|basic render|meta |parsec|displaylink|idd/i;
|
||||
|
||||
/**
|
||||
* Win32_VideoController rows + the DirectX adapter list -> the cards this app can show. A card keeps the size from the registry;
|
||||
* a display driver for a virtual monitor (no size, no known maker) is not a graphics card and is dropped.
|
||||
*/
|
||||
export function windowsOtherGpus(videoRows, dx) {
|
||||
const used = new Set();
|
||||
const out = [];
|
||||
for (const row of videoRows) {
|
||||
if (!row?.Name) continue;
|
||||
const match = dx.find((a, i) => !used.has(i) && !a.software && norm(a.description) === norm(row.Name));
|
||||
if (match) used.add(dx.indexOf(match));
|
||||
const vendor = /amd|radeon/i.test(row.Name) ? 'amd' : /intel/i.test(row.Name) ? 'intel' : 'unknown';
|
||||
const vramGb = match?.bytes ? Math.round(match.bytes / 1024 ** 3 * 10) / 10 : 0;
|
||||
if (vendor === 'unknown' && (!vramGb || VIRTUAL.test(row.Name))) continue;
|
||||
out.push({ id: String(row.PNPDeviceID), vendor, name: row.Name, vramGb, luid: match?.luid ?? null });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** One counter line: "G <luid> <load percent> <dedicated bytes in use>". */
|
||||
export function parseGpuCounterLine(line) {
|
||||
const m = /^G\s+(luid_0x[0-9a-f]+_0x[0-9a-f]+)\s+(\d+(?:\.\d+)?)\s+(\d+)\s*$/i.exec(String(line));
|
||||
return m ? { luid: m[1].toLowerCase(), utilizationPct: Math.max(0, Math.min(100, Number(m[2]))), memoryUsedGb: Number(m[3]) / 1024 ** 3 } : null;
|
||||
}
|
||||
|
||||
export function createWindowsGpuReader({ spawnFn, intervalSec = 4, maxStarts = 3, now = Date.now } = {}) {
|
||||
const readings = new Map();
|
||||
const script = utf8Script(
|
||||
`while($true){` +
|
||||
`$e=@(Get-CimInstance Win32_PerfFormattedData_GPUPerformanceCounters_GPUEngine);$m=@(Get-CimInstance Win32_PerfFormattedData_GPUPerformanceCounters_GPUAdapterMemory);` +
|
||||
`$u=@{};foreach($r in $e){if($r.Name -match '(luid_0x[0-9A-Fa-f]+_0x[0-9A-Fa-f]+)_phys_\\d+_eng_\\d+_engtype_(\\w+)'){$k=$matches[1].ToLower()+'|'+$matches[2];$u[$k]=[double]$u[$k]+[double]$r.UtilizationPercentage}};` +
|
||||
`$b=@{};foreach($k in $u.Keys){$l=$k.Split('|')[0];if(-not $b.ContainsKey($l) -or $u[$k] -gt $b[$l]){$b[$l]=$u[$k]}};` +
|
||||
`foreach($r in $m){if($r.Name -match '(luid_0x[0-9A-Fa-f]+_0x[0-9A-Fa-f]+)'){$l=$matches[1].ToLower();[Console]::Out.WriteLine('G '+$l+' '+[math]::Round([double]$b[$l],0)+' '+$r.DedicatedUsage)}};` +
|
||||
`[Console]::Out.Flush();Start-Sleep -Seconds ${intervalSec}}`);
|
||||
const loop = createPowerShellLoop({ script, spawnFn, maxStarts, onLine: line => {
|
||||
const parsed = parseGpuCounterLine(line);
|
||||
if (parsed) readings.set(parsed.luid, { ...parsed, at: now() });
|
||||
return !!parsed;
|
||||
} });
|
||||
return {
|
||||
read(luid) { loop.start(); const r = readings.get(String(luid ?? '').toLowerCase()); return r && now() - r.at < 6 * intervalSec * 1000 ? r : null; },
|
||||
stop() { loop.stop(); },
|
||||
};
|
||||
}
|
||||
|
||||
let shared = null;
|
||||
/** The card's load and memory in use from the Windows counters; null when there is no reading. */
|
||||
export function windowsGpuReading(luid) {
|
||||
if (process.platform !== 'win32' || !luid) return null;
|
||||
shared ??= endWithHost(createWindowsGpuReader());
|
||||
return shared.read(luid);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* One long-lived PowerShell that prints a line per reading, in a loop. The monitor used to start a cold PowerShell for every sample;
|
||||
* its WMI start cost more than the probe timeout, so every query failed and WmiPrvSE burned a core (#3939).
|
||||
* The loop gives up after `maxStarts` early exits in a row, so a counter that cannot be read stays quiet.
|
||||
*/
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
export function createPowerShellLoop({ script, onLine, spawnFn = spawn, maxStarts = 3 }) {
|
||||
let child = null, starts = 0, buffer = '';
|
||||
function start() {
|
||||
if (child || starts >= maxStarts) return;
|
||||
starts++;
|
||||
let proc;
|
||||
try { proc = spawnFn('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'] }); }
|
||||
catch { return; }
|
||||
child = proc;
|
||||
buffer = '';
|
||||
proc.on?.('error', () => { if (child === proc) child = null; });
|
||||
proc.on?.('exit', () => { if (child === proc) child = null; });
|
||||
proc.stdout?.on('data', chunk => {
|
||||
buffer += chunk;
|
||||
let i;
|
||||
while ((i = buffer.indexOf('\n')) >= 0) {
|
||||
const line = buffer.slice(0, i);
|
||||
buffer = buffer.slice(i + 1);
|
||||
if (onLine(line)) starts = 0;
|
||||
}
|
||||
});
|
||||
proc.unref?.();
|
||||
proc.stdout?.unref?.();
|
||||
}
|
||||
return {
|
||||
start,
|
||||
stop() { try { child?.kill(); } catch { /* gone */ } child = null; },
|
||||
get starts() { return starts; },
|
||||
};
|
||||
}
|
||||
|
||||
let stoppers = null;
|
||||
/** Every loop is ended with the host. */
|
||||
export function endWithHost(loop) {
|
||||
if (!stoppers) { stoppers = new Set(); process.once('exit', () => stoppers.forEach(l => l.stop())); }
|
||||
stoppers.add(loop);
|
||||
return loop;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { useId, useRef, useState } from 'react';
|
||||
import { FloatingMenu } from './FloatingMenu';
|
||||
import { Bar, Btn, Dialog, ErrorNotice, Icon } from './ui';
|
||||
import { go, useLifecycle, loadVariant, selectRemoteModel, setSettingsSection, useStore } from '../lib/store';
|
||||
import { pickerGroups, pickerVersionState } from '../lib/model-picker';
|
||||
import { pickerGroups, pickerNativeModels, pickerVersionState } from '../lib/model-picker';
|
||||
import { versionFit } from '../lib/model-versions';
|
||||
import type { ModelVariant } from '../lib/types';
|
||||
import { sizeGb } from '../lib/format';
|
||||
@@ -37,6 +37,7 @@ function LegacyChatModelPicker() {
|
||||
const running = library?.variants.find(v => v.id === library.loaded);
|
||||
const version = library?.variants.find(v => v.id === selected);
|
||||
const groups = library ? pickerGroups(library) : [];
|
||||
const installedNative = pickerNativeModels(native?.installed?.models, native?.instances);
|
||||
const status = version ? pickerVersionState(version, library?.loaded ?? null) : null;
|
||||
const tooBig = !!version && library?.mode === 'real' && versionFit(version, hardware, contextTokens(engine?.beginner.contextLength ?? '32K')).zone === 'too-big';
|
||||
async function apply() {
|
||||
@@ -78,7 +79,8 @@ function LegacyChatModelPicker() {
|
||||
<button ref={trigger} className="chat-model-badge chat-model-picker" aria-label={tr("Choose model: {0}", [apiModel?.name ?? (running?.local ? running.name : running?.family) ?? 'No model loaded'])} title={tr(apiModel ? `${connection?.name} · ${apiModel.id}` : 'View and switch models')} disabled={!library && !providers} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(v => !v)}><Icon name={apiModel ? 'link' : modelFamilyIcon(running?.family ?? groups[0]?.family)} size={16}/><span>{tr(apiModel?.name ?? (running?.local ? running.name : running?.family) ?? groups[0]?.family ?? 'No model loaded')}</span><Icon name="chevron" size={12}/></button>
|
||||
{tr(open ? <FloatingMenu anchor={trigger.current} title={tr("Models")} width={380} onClose={() => setOpen(false)}>
|
||||
{tr(native?.instances.filter(i => i.status !== 'error').map(i => <button key={i.id} className="menu__item" role="menuitem" disabled={streaming || i.status !== 'ready'} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => { selectRemoteModel(null); setOpen(false); }).catch(e => setError(e.message))}><Icon name="models"/><span>{tr(i.label)}<small>{tr(i.gpus.map(g => `GPU ${g + 1}`).join(" + ") || "Automatic GPU")}</small></span></button>))}<p className="model-picker-heading">{tr("Local models")}</p>
|
||||
{tr(!groups.length ? <p className="model-picker-empty">{tr("No local models downloaded yet.")}</p> : null)}
|
||||
{tr(installedNative.map(m => <button key={m.config || m.model} className="menu__item model-picker-option model-picker-api" role="menuitem" disabled={streaming} onClick={() => { setOpen(false); go('models'); }}><span><strong>{tr(m.model_name || m.model)}</strong><small>{tr("Downloaded, not loaded. Open Models to load it.")}</small></span></button>))}
|
||||
{tr(!groups.length && !installedNative.length ? <p className="model-picker-empty">{tr("No local models downloaded yet.")}</p> : null)}
|
||||
{tr(groups.map(({ family, versions }, index) => {
|
||||
const main = versions[0], state = pickerVersionState(main, library!.loaded);
|
||||
const others = versions.slice(1), isExpanded = expanded.includes(family), id = `${groupsId}-${index}`;
|
||||
|
||||
@@ -5,10 +5,11 @@ import { FloatingMenu } from './FloatingMenu';
|
||||
import { DictationControl } from './DictationControl';
|
||||
import { Btn, Dialog, Icon, ErrorNotice } from './ui';
|
||||
import { MOD } from '../lib/commands';
|
||||
import { setChatPreferences, useStore } from '../lib/store';
|
||||
import { pushToast, setChatPreferences, useStore } from '../lib/store';
|
||||
import { artifactFromUrl, type PreviewArtifact } from '../lib/artifacts';
|
||||
import type { ChatMode, Session } from '../lib/types';
|
||||
import { attachChatPhoto } from '../lib/chat-photos';
|
||||
import { uploadChatFile, FILE_ACCEPT } from '../lib/chat-attach-file';
|
||||
import { useNative } from '../lib/native';
|
||||
import { pictureStatus } from '../lib/pictures';
|
||||
const modes: {
|
||||
@@ -91,6 +92,12 @@ export function ComposerControls({ session, onPreview, onAttach, onError, onSlas
|
||||
await attachChatPhoto(file, session?.id);
|
||||
continue;
|
||||
}
|
||||
if (!directory && session?.id && /\.pdf$/i.test(file.name) && file.size <= 12 * 1024 * 1024) {
|
||||
// A PDF goes to the chat's folder and is named in the next message; "Open a file" still previews it.
|
||||
const saved = await uploadChatFile(file, session.id);
|
||||
pushToast('success', 'PDF added', `${saved.name} is in this chat. Ask about it in your next message.`);
|
||||
continue;
|
||||
}
|
||||
if (!directory && (photoTypes.test(file.name) || /\.pdf$/i.test(file.name))) {
|
||||
await openFile(file);
|
||||
if (photoTypes.test(file.name))
|
||||
@@ -157,7 +164,7 @@ export function ComposerControls({ session, onPreview, onAttach, onError, onSlas
|
||||
return <>
|
||||
{tr(!remoteModel && nativeModel?.metrics?.mcp?.servers?.length ? <button className="composer-choice" aria-label={tr("Use connected MCP tools")} aria-pressed={session?.preferences?.useTools === true} onClick={() => session?.preferences?.useTools ? setChatPreferences(session.id, { useTools: false }) : setToolsOpen(true)}><Icon name="skills" size={16}/>{tr("Tools")}{tr(session?.preferences?.useTools ? ' on' : '')}</button> : null)}
|
||||
<Dialog open={toolsOpen} compact title={tr("Enable connected tools?")} onClose={() => setToolsOpen(false)} actions={<><Btn onClick={() => setToolsOpen(false)}>{tr("Keep tools off")}</Btn><Btn variant="primary" onClick={() => { setChatPreferences(session?.id, { useTools: true, mode: 'bypass' }); setToolsOpen(false); }}>{tr("Enable tools")}</Btn></>}><p>{tr("Connected servers can act on the resources you configured. Calls run automatically when the model chooses them, and their results appear in chat.")}</p><p className="small muted">{tr("This switches this conversation to Bypass permissions. Servers: ")}{tr((nativeModel?.metrics?.mcp?.servers ?? []).map((s: any) => s.name).join(', '))}.</p></Dialog>
|
||||
<input ref={files} type="file" multiple hidden accept="image/*,.pdf,.txt,.md,.markdown,.csv,.ts,.tsx,.js,.jsx,.py,.json,.css,.rs,.go,.sh,.html,.htm,.yaml,.yml,.toml,.xml,.log" onChange={e => { void addFiles(Array.from(e.target.files ?? [])); e.target.value = ''; }}/>
|
||||
<input ref={files} type="file" multiple hidden accept={FILE_ACCEPT} onChange={e => { void addFiles(Array.from(e.target.files ?? [])); e.target.value = ''; }}/>
|
||||
<input ref={folder} type="file" multiple hidden onChange={e => { void addFiles(Array.from(e.target.files ?? []), true); e.target.value = ''; }}/>
|
||||
<input ref={previewFile} type="file" hidden onChange={e => { void openFile(e.target.files?.[0]); e.target.value = ''; }}/>
|
||||
<button ref={trigger} className="composer-add" aria-label={tr("Add or open")} title={tr("Add or open")} disabled={reading || streaming} aria-haspopup="menu" aria-expanded={menu} onClick={() => { setPreferences(null); setMenu(v => !v); }}><Icon name="plus" size={22}/></button>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { parseDecimal, partialDecimal } from '../lib/decimal';
|
||||
|
||||
/** A number field that lets the person type a decimal point: it keeps the text while it is typed and tells the page the number once it is one (#3736). */
|
||||
export function DecimalInput({ value, onChange, ariaLabel, className = 'st-input', placeholder, disabled }: {
|
||||
value: number | null | undefined;
|
||||
onChange: (value: number | null) => void;
|
||||
ariaLabel: string;
|
||||
className?: string;
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
const [text, setText] = useState(value === null || value === undefined ? '' : String(value));
|
||||
// A change that came from elsewhere (Restore saved, another tab) replaces the text, but never while the typed text already means this number.
|
||||
useEffect(() => {
|
||||
const shown = text === '' ? null : parseDecimal(text);
|
||||
if ((value ?? null) !== shown) setText(value === null || value === undefined ? '' : String(value));
|
||||
}, [value]);
|
||||
return <input className={className} aria-label={ariaLabel} inputMode="decimal" disabled={disabled} placeholder={placeholder} value={text}
|
||||
onChange={e => {
|
||||
const next = e.target.value;
|
||||
if (!partialDecimal(next)) return;
|
||||
setText(next);
|
||||
if (next.trim() === '') onChange(null);
|
||||
else { const n = parseDecimal(next); if (n !== null) onChange(n); }
|
||||
}}
|
||||
onBlur={() => { const n = text.trim() === '' ? null : parseDecimal(text); setText(n === null ? '' : String(n)); }}/>;
|
||||
}
|
||||
@@ -6,16 +6,7 @@ import { Icon } from './ui';
|
||||
|
||||
/** Files dropped on the chat go where the attach button would put them: the composer reads the 'strata:drop-files' event. */
|
||||
export const DROP_EVENT = 'strata:drop-files';
|
||||
/** The pictures on the clipboard, named so each one is told apart in the composer (a pasted screenshot arrives as "image.png"). */
|
||||
export function pastedFiles(data: DataTransfer | null | undefined): File[] {
|
||||
const out: File[] = [];
|
||||
for (const file of Array.from(data?.files ?? [])) {
|
||||
if (!file.type.startsWith('image/')) continue;
|
||||
const extension = file.type.split('/')[1]?.replace('jpeg', 'jpg').replace(/[+].*/, '') || 'png';
|
||||
out.push(new File([file], `Pasted picture ${new Date().toLocaleTimeString().replace(/[^0-9]+/g, '-').replace(/-$/, '')}${out.length ? `-${out.length + 1}` : ''}.${extension}`, { type: file.type }));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
export { pastedFiles } from '../lib/pasted-files';
|
||||
const hasFiles = (e: React.DragEvent) => Array.from(e.dataTransfer?.types ?? []).includes('Files');
|
||||
|
||||
/** A file dropped outside the chat must not take the window to that file: the page ignores it (called once at start). */
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { currencyChoices, currencyLabel } from '../lib/currency';
|
||||
import { tr } from '../lib/i18n';
|
||||
import { useMoney } from '../lib/money';
|
||||
import { setElectricity, useStore } from '../lib/store';
|
||||
import { Btn, Select } from './ui';
|
||||
|
||||
/**
|
||||
* The price of one kWh for the Monitor's cost line (#3628). The person types only the number: the currency is the one of the computer's
|
||||
* region, shown beside it. "Change currency" is a way to pick another one, never a step that has to be taken.
|
||||
*/
|
||||
export function ElectricityPrice() {
|
||||
const price = useStore(s => s.electricityPrice), override = useStore(s => s.electricityCurrency);
|
||||
const money = useMoney();
|
||||
const [text, setText] = useState(price > 0 ? String(price) : ''), [picking, setPicking] = useState(false);
|
||||
useEffect(() => { setText(price > 0 ? String(price) : ''); }, [price]);
|
||||
const commit = () => setElectricity(Number(text.replace(',', '.')), override);
|
||||
const choices = useMemo(() => currencyChoices(money.locale), [money.locale]);
|
||||
return <span className="stack">
|
||||
<span className="row">
|
||||
<input className="st-input" inputMode="decimal" size={7} aria-label={tr("Price per kWh")} placeholder="0.30" value={text} onChange={e => setText(e.target.value)} onBlur={commit} onKeyDown={e => { if (e.key === 'Enter') commit(); }}/>
|
||||
<span className="small muted">{money.currency ? tr("per kWh, in {0}", [currencyLabel(money.currency, money.locale)]) : tr("per kWh")}</span>
|
||||
<Btn size="sm" onClick={() => setPicking(v => !v)}>{tr("Change currency")}</Btn>
|
||||
</span>
|
||||
{picking ? <Select ariaLabel={tr("Currency")} translateLabels={false} value={override}
|
||||
options={[{ value: '', label: tr("Automatic ({0})", [money.detected ?? '—']) }, ...choices]}
|
||||
onChange={value => { setElectricity(price, String(value)); setPicking(false); }}/> : null}
|
||||
</span>;
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
import { tr } from '../lib/i18n';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { Brand } from './Brand';
|
||||
import { Bar, Btn, Icon } from './ui';
|
||||
import { api } from '../lib/client';
|
||||
import { useDownloadEta } from '../lib/download-eta';
|
||||
import type { NativeJob } from '../lib/native';
|
||||
import { megabytes } from '../lib/format';
|
||||
|
||||
/** What the host says about this PC's engine (GET /api/engine/first-run). */
|
||||
export interface FirstRunInfo {
|
||||
status: 'offer' | 'none' | 'offline' | 'error' | 'installed' | 'wrong-make' | 'unavailable';
|
||||
gpus: { name: string; vramGb: number | null }[];
|
||||
driver?: string | null;
|
||||
offer?: { version: string; bytes: number; variant: string; backend: string | null };
|
||||
message?: string | null;
|
||||
reasons?: string[];
|
||||
details?: string;
|
||||
freeBytes?: number;
|
||||
}
|
||||
|
||||
export const mb = megabytes;
|
||||
|
||||
/**
|
||||
* Whether this PC still needs its engine. Reads only Control's local answer (no network): the engine is missing and the engine that came
|
||||
* with the app is not being unpacked. `null` while that is not known yet.
|
||||
*/
|
||||
export function useEngineNeeded(): boolean | null {
|
||||
const [needed, setNeeded] = useState<boolean | null>(null);
|
||||
useEffect(() => {
|
||||
let live = true;
|
||||
const ask = () => api.get<{ engine?: { usable?: boolean } | null; engineSetup?: boolean }>('/api/control/status').then(s => {
|
||||
if (!live) return;
|
||||
if (s.engineSetup) return setNeeded(null);
|
||||
setNeeded(!!s.engine && s.engine.usable === false);
|
||||
}, () => { if (live) setNeeded(false); });
|
||||
void ask();
|
||||
const timer = setInterval(() => void ask(), 3000);
|
||||
return () => { live = false; clearInterval(timer); };
|
||||
}, []);
|
||||
return needed;
|
||||
}
|
||||
|
||||
function gpuLine(info: FirstRunInfo) {
|
||||
// a processor's own tiny graphics (no memory of its own) is not "a card"
|
||||
const first = info.gpus.find(g => (g.vramGb ?? 0) >= 1) ?? info.gpus[0];
|
||||
if (!first) return '';
|
||||
const vram = first.vramGb ? `, ${Math.round(first.vramGb)} GB` : '';
|
||||
const driver = info.driver ? `, driver ${info.driver}` : '';
|
||||
return `${first.name}${vram}${driver}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* The first-run card: the engine this PC needs, one button to download it, progress, and the offline way (choose a downloaded file).
|
||||
* Nothing is downloaded before a button is pressed.
|
||||
*/
|
||||
export function EngineFirstRun({ onDone }: { onDone: () => void }) {
|
||||
const [info, setInfo] = useState<FirstRunInfo | null>(null);
|
||||
const [job, setJob] = useState<NativeJob | null>(null);
|
||||
const [busy, setBusy] = useState(false), [problem, setProblem] = useState('');
|
||||
const [finished, setFinished] = useState(false);
|
||||
const file = useRef<HTMLInputElement>(null);
|
||||
const started = useRef(false);
|
||||
|
||||
const look = useCallback(() => {
|
||||
setInfo(null);
|
||||
setProblem('');
|
||||
api.get<FirstRunInfo>('/api/engine/first-run').then(setInfo, e => setInfo({ status: 'error', gpus: [], message: e instanceof Error ? e.message : String(e) }));
|
||||
}, []);
|
||||
useEffect(() => { look(); }, [look]);
|
||||
|
||||
// follow the download / install job
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => {
|
||||
if (!started.current) return;
|
||||
api.get<{ job: NativeJob | null }>('/api/engine/job').then(r => {
|
||||
setJob(r.job);
|
||||
if (r.job?.state === 'done') setFinished(true);
|
||||
if (r.job && r.job.state !== 'running') started.current = false;
|
||||
}, () => { });
|
||||
}, 700);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
async function start() {
|
||||
setBusy(true);
|
||||
setProblem('');
|
||||
try {
|
||||
started.current = true;
|
||||
setJob(await api.post<NativeJob>('/api/native/operations', { kind: 'update-engine', args: {} }));
|
||||
}
|
||||
catch (e) {
|
||||
started.current = false;
|
||||
setProblem(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
async function chosen(files: FileList | null) {
|
||||
const picked = files?.[0];
|
||||
if (!picked) return;
|
||||
setBusy(true);
|
||||
setProblem('');
|
||||
try {
|
||||
const response = await fetch('/api/engine/from-file', { method: 'POST', headers: { 'x-file-name': picked.name }, body: picked });
|
||||
const body = await response.json().catch(() => ({}));
|
||||
if (!response.ok) throw new Error(body?.error ?? `The file could not be used (${response.status}).`);
|
||||
started.current = true;
|
||||
setJob(body as NativeJob);
|
||||
}
|
||||
catch (e) {
|
||||
setProblem(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
finally {
|
||||
setBusy(false);
|
||||
if (file.current) file.current.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
const running = job?.state === 'running';
|
||||
const failed = !!job && (job.state === 'error' || job.state === 'cancelled');
|
||||
const percent = Number(job?.result?.install?.download?.percent ?? 0);
|
||||
const bytes = info?.offer?.bytes ?? 0;
|
||||
const doneMb = Math.round(mb(bytes) * percent / 100);
|
||||
const eta = useDownloadEta(running && bytes ? { done_gb: bytes * percent / 100 / 1e9, remaining_gb: bytes * (100 - percent) / 100 / 1e9 } : undefined, job?.id);
|
||||
const cards = (info?.gpus ?? []).filter(g => (g.vramGb ?? 0) >= 1).length;
|
||||
const hidden = <input ref={file} type="file" accept=".gz,.tgz,.xz,.zip" hidden onChange={e => void chosen(e.target.files)}/>;
|
||||
const pick = (label: string) => <button type="button" className="onboard-continue-anyway" disabled={busy || running} onClick={() => file.current?.click()}>{tr(label)}</button>;
|
||||
|
||||
let body;
|
||||
if (finished) {
|
||||
body = <><div className="onboard-welcome-copy"><h1 tabIndex={-1} data-initial-focus>{tr("The engine is ready.")}</h1><p>{tr("Next: pick a model.")}</p></div>
|
||||
<footer className="onboard-footer onboard-footer--welcome"><Btn variant="primary" onClick={onDone}>{tr("Continue")}<Icon name="chevron" size={16}/></Btn></footer></>;
|
||||
}
|
||||
else if (running) {
|
||||
body = <><div className="onboard-welcome-copy"><h1 tabIndex={-1} data-initial-focus>{tr("Downloading the engine")}</h1>
|
||||
<p>{bytes && job?.result?.install?.download ? `${doneMb} of ${mb(bytes)} MB${eta ? ' · ' + eta : ''}` : tr(job?.summary ?? 'Starting…')}</p></div>
|
||||
<div className="onboard-error" style={{ maxWidth: 520, margin: '0 auto', width: '100%' }}><Bar value={percent} label="Downloading the engine"/><p className="small muted" style={{ textAlign: 'center' }}>{tr("You can close Strata; it continues where it stopped.")}</p></div></>;
|
||||
}
|
||||
else if (!info) {
|
||||
body = <div className="onboard-welcome-copy"><h1 tabIndex={-1} data-initial-focus>{tr("Welcome to Strata")}</h1><p role="status">{tr("Looking at your graphics card…")}</p></div>;
|
||||
}
|
||||
else {
|
||||
const card = gpuLine(info);
|
||||
const found = card ? <p>{tr("Strata found your graphics card:")}<br/><strong>{card}</strong>{cards > 1 ? <><br/><span className="small muted">{tr("{0} cards found. Strata uses the first one for the engine; change it later in Settings.", [cards])}</span></> : null}</p>
|
||||
: <p>{tr("Strata did not recognise a supported graphics card.")}</p>;
|
||||
let main, actions;
|
||||
if (info.status === 'offer' && info.offer) {
|
||||
main = <>{found}<p>{tr("To run models on it, Strata needs one download:")}<br/><strong>{tr("The engine for this card")}: {mb(info.offer.bytes)} MB</strong></p>
|
||||
{info.freeBytes !== undefined && info.freeBytes < info.offer.bytes * 2.5 ? <p className="small inline-error">{tr("The engine needs about {0} GB of free space on this drive and only {1} GB is free. Free some space, then continue.", [Math.ceil(info.offer.bytes * 2.5 / 1e9), (info.freeBytes / 1e9).toFixed(1)])}</p> : null}
|
||||
<p className="small muted">{tr("It comes from Strata’s own update server and is checked before it is used. Your models and chats are never touched by it.")}</p></>;
|
||||
actions = <><Btn variant="primary" disabled={busy} onClick={() => void start()}>{tr(failed ? 'Continue' : 'Download the engine')}</Btn>{pick("I already have the file…")}</>;
|
||||
}
|
||||
else if (info.status === 'offline') {
|
||||
main = <>{found}<p>{tr("Strata could not reach github.com. Check your connection and try again, or download the engine file on another PC and choose it here.")}</p></>;
|
||||
actions = <><Btn variant="primary" disabled={busy} onClick={look}>{tr("Try again")}</Btn>{pick("Choose a downloaded file…")}</>;
|
||||
}
|
||||
else if (info.status === 'wrong-make') {
|
||||
main = <>{found}<p>{info.message ?? tr("The engine installed here is for another make of graphics card.")}</p></>;
|
||||
actions = <><Btn variant="primary" disabled={busy} onClick={look}>{tr("Try again")}</Btn>{pick("Choose a downloaded file…")}</>;
|
||||
}
|
||||
else {
|
||||
main = <>{found}<p>{tr("Strata can’t pick an engine for this PC from its update list.")}</p>{info.message ? <p className="small muted">{info.message}</p> : null}{(info.reasons ?? []).length ? <ul className="small muted" style={{ textAlign: 'left', display: 'inline-block' }}>{(info.reasons ?? []).map(r => <li key={r}>{r}</li>)}</ul> : null}</>;
|
||||
actions = <><Btn variant="primary" disabled={busy} onClick={look}>{tr("Try again")}</Btn>{pick("Choose a downloaded file…")}<button type="button" className="onboard-continue-anyway" onClick={onDone}>{tr("Continue without an engine")}</button></>;
|
||||
}
|
||||
body = <><div className="onboard-welcome-copy"><h1 tabIndex={-1} data-initial-focus>{tr("Welcome to Strata")}</h1>{main}</div>
|
||||
{failed ? <div className="onboard-error" style={{ maxWidth: 560, margin: '0 auto' }}><p role="alert" className="small inline-error">{job?.error ?? job?.summary}</p><p className="small muted">{tr("The download stopped. Continue picks it up where it stopped.")}</p></div> : null}
|
||||
{problem ? <div className="onboard-error" style={{ maxWidth: 560, margin: '0 auto' }}><p role="alert" className="small inline-error">{problem}</p></div> : null}
|
||||
<footer className="onboard-footer onboard-footer--welcome">{actions}</footer></>;
|
||||
}
|
||||
return <div className="setup guided-onboarding" data-step="engine">{hidden}<header className="onboard-header"><Brand variant="lockup" height={22}/></header>{body}</div>;
|
||||
}
|
||||
@@ -22,6 +22,15 @@ type Choices = NonNullable<NonNullable<SetupState['choices']>['onboarding']>;
|
||||
function radioKeys(event: KeyboardEvent<HTMLDivElement>) { if (!['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key))
|
||||
return; event.preventDefault(); const items = Array.from(event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=radio]')); const current = items.indexOf(event.target as HTMLButtonElement); const next = event.key === 'Home' ? 0 : event.key === 'End' ? items.length - 1 : (current + (['ArrowLeft', 'ArrowUp'].includes(event.key) ? -1 : 1) + items.length) % items.length; items[next]?.focus(); items[next]?.click(); }
|
||||
const steps = ['Welcome', 'Your model', 'Prepare', 'Make it yours'];
|
||||
/** What a person is told before choosing DeepSeek: the size, where it runs, how fast, what it needs. Every line is a warning or a fact; nothing here stops the download. */
|
||||
function DeepSeekNote({ version, plan }: { version: NonNullable<ReturnType<typeof nativeCatalogModels>[number]['sizes'][number]>; plan: Record<string, any> | null }) {
|
||||
void plan; // the plan's own disk line repeats what the version says in on_this_pc
|
||||
return <div className="engine-warning" role="status"><Icon name="info" size={18}/><div>
|
||||
<p>{tr("This is a very large model. The download is {0} GB and it needs about as much free disk space. It runs on NVIDIA RTX 30, 40 and 50 cards, on a Radeon AI PRO R9700 (Linux) or on a Ryzen AI Max / Strix Halo PC (Windows); how fast it is depends on the memory and card (the line below says what to expect on this computer). What does not fit in memory is read from your SSD, so an NVMe drive matters.", [Math.round(version.download_gb)])}</p>
|
||||
{version.on_this_pc ? <p className="small muted">{version.on_this_pc}</p> : null}
|
||||
<p className="small muted">{tr("You can stop the download and continue later; it picks up where it stopped. Strata warns you here but never blocks you.")}</p>
|
||||
</div></div>;
|
||||
}
|
||||
export function GuidedSetup() {
|
||||
const native = useNative(), setup = useStore(s => s.setup), hardware = useStore(s => s.hardware);
|
||||
const families = nativeCatalogModels(native?.catalog?.families ?? []);
|
||||
@@ -132,7 +141,8 @@ export function GuidedSetup() {
|
||||
setTuneJobId(tuneJob.id);
|
||||
void persist(4, { tuneJobId: tuneJob.id }).catch(e => setError(e.message));
|
||||
} }, [step, installJob?.id, tuneJob?.id]);
|
||||
const values = { guided: true, family: version?.sourceFamily, model: version?.model, context, vision: version?.images ? 'yes' : 'no', kv: 'int8', low_ram: 'auto', loadAfter: false, multiple: false, ...(directory ? { data_dir: directory } : {}) };
|
||||
const fixedContext = version?.multi_file ? 8192 : null; // the one context DeepSeek's engine was checked at
|
||||
const values = { guided: true, family: version?.sourceFamily, model: version?.model, context: fixedContext ?? context, vision: version?.images ? 'yes' : 'no', kv: 'int8', low_ram: 'auto', loadAfter: false, multiple: false, ...(directory ? { data_dir: directory } : {}) };
|
||||
async function review() {
|
||||
await perform(async () => {
|
||||
setInstallJobId('');
|
||||
@@ -154,7 +164,7 @@ export function GuidedSetup() {
|
||||
}
|
||||
async function tune() {
|
||||
await perform(async () => {
|
||||
const result = await nativeAction<NativeJob>('operations', { kind: 'tune', args: { guided: true, model: version?.id, profile, calibrate, vision: version?.images && vision ? 'yes' : 'no', multiple: false } });
|
||||
const result = await nativeAction<NativeJob>('operations', { kind: 'tune', args: { guided: true, model: version?.id, profile, calibrate: calibrate && !version?.multi_file, vision: version?.images && vision ? 'yes' : 'no', multiple: false } });
|
||||
setTuneJobId(result.id);
|
||||
await persist(4, { tuneJobId: result.id });
|
||||
});
|
||||
@@ -201,9 +211,10 @@ export function GuidedSetup() {
|
||||
<div className="onboard-stage-heading"><h1 ref={titleRef} tabIndex={-1} data-initial-focus>{tr(title)}</h1>{tr(step === 2 ? <p>{tr("You can always change your models later.")}</p> : step === 4 && tuneJob?.state === 'running' ? <p>{tr("We\u2019re measuring, applying your preference, and getting ready to chat.")}</p> : null)}</div>
|
||||
{tr(step === 2 ? <div className="onboard-model-stage">
|
||||
{tr(selectedFamily ? <>
|
||||
<div className="onboard-model-top"><div className="onboard-model-picker"><span className="onboard-control-label">{tr("Model")}</span><div><span className="onboard-model-symbol"><Icon name="models" size={23}/></span><Select ariaLabel={tr("Setup model")} value={selectedFamily.family} options={families.map(f => ({ value: f.family, label: f.title }))} onChange={value => chooseNative(value, '')}/></div></div><div className="onboard-context"><span className="onboard-control-label">{tr("Conversation context")}</span><Select ariaLabel={tr("Setup conversation context")} value={String(context)} options={(native?.catalog?.contexts ?? [32768]).map(n => ({ value: String(n), label: `${n / 1024}K` }))} onChange={value => setContext(Number(value))}/></div></div>
|
||||
<div className="onboard-model-top"><div className="onboard-model-picker"><span className="onboard-control-label">{tr("Model")}</span><div><span className="onboard-model-symbol"><Icon name="models" size={23}/></span><Select ariaLabel={tr("Setup model")} value={selectedFamily.family} options={families.map(f => ({ value: f.family, label: f.title }))} onChange={value => chooseNative(value, '')}/></div></div><div className="onboard-context"><span className="onboard-control-label">{tr("Conversation context")}</span><Select ariaLabel={tr("Setup conversation context")} value={String(version?.multi_file ? 8192 : context)} options={(version?.multi_file ? [8192] : native?.catalog?.contexts ?? [32768]).map(n => ({ value: String(n), label: `${n / 1024}K` }))} onChange={value => setContext(Number(value))}/></div></div>
|
||||
<OnboardingMemory hardware={hardware} native={native?.hardware}/>{tr(!version || version.needsNewerEngine ? <p className="small muted">{tr("This model needs a newer engine. Update your engine or import a local GGUF for this model.")}</p> : null)}
|
||||
<div className="onboard-version-heading"><strong>{tr("Choose a version")}</strong><span>{tr(version ? `${catalogVersionLabel(version)} selected` : '')}</span></div>
|
||||
{tr(version?.multi_file ? <DeepSeekNote version={version} plan={plan}/> : null)}
|
||||
<div className="onboard-versions" role="radiogroup" aria-label={tr("Model version")} onKeyDown={radioKeys}>{tr(cards.map(v => versionCard(v)))}</div>
|
||||
{tr(others.length ? <div className="onboard-more-versions"><VersionPicker versions={others} selectedId={version?.id ?? ''} hardware={hardware ? { ram_gb: native?.hardware?.ram_gb ?? hardware.memory.totalGb, vram_gb: Math.max(0, ...(native?.hardware?.gpus ?? []).filter(g => g.usable !== false).map(g => g.vram_gb)) } : null} downloaded={readyIds} showRecommended={false} moreLabel="More versions" onSelect={id => { setSize(id); setPlan(null); }} onOwnGguf={() => void ownModel()}/></div> : null)}
|
||||
<div className="onboard-folder"><Icon name="folder" size={20}/><div><strong>{tr(directory ? 'Your model folder' : 'Already downloaded the model?')}</strong><small>{tr(directory || "Choose the folder and we'll start your models with Strata.")}</small></div><Btn size="sm" onClick={() => setFolderOpen(v => !v)}>{tr(folderOpen ? 'Close' : directory ? 'Change' : 'Choose folder')}</Btn></div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { tr } from '../lib/i18n';
|
||||
import { copyText } from '../lib/clipboard';
|
||||
/** Safe, dependency-free rendering of the Markdown structures used in answers. */
|
||||
import { Fragment, type ReactNode } from 'react';
|
||||
import { Btn, IconBtn } from './ui';
|
||||
@@ -47,6 +48,20 @@ function inline(text: string, onOpenLink?: (url: string) => void, imageSession?:
|
||||
: <Fragment key={p}>{inlineMarks(part.text, onOpenLink, imageSession)}</Fragment>)}</Fragment>;
|
||||
});
|
||||
}
|
||||
/** Does this line continue the paragraph above it, or does it start a block of its own? */
|
||||
export function continuesParagraph(lines: string[], at: number): boolean {
|
||||
const line = lines[at];
|
||||
if (!line.trim() || /^\s*```/.test(line) || /^(#{1,6})\s+(.+)$/.test(line) || /^\s*[-*+]\s+\S/.test(line) || /^\s*\d+[.)]\s+\S/.test(line) || /^>\s?/.test(line))
|
||||
return false;
|
||||
if (line.includes('|') && at + 1 < lines.length && /^\s*\|?\s*:?-{3,}/.test(lines[at + 1]))
|
||||
return false;
|
||||
return !displayBlock(lines, at);
|
||||
}
|
||||
/** Copy a code block. The toast store needs a browser, so it is loaded here, when someone copies: the renderer itself must render without one. */
|
||||
async function copyCode(text: string) {
|
||||
const { pushToast } = await import('../lib/store');
|
||||
await copyText(text, 'Code', { toast: pushToast });
|
||||
}
|
||||
export function Markdown({ text, onOpenLink, onPreviewHtml, imageSession }: {
|
||||
text: string;
|
||||
onOpenLink?: (url: string) => void;
|
||||
@@ -69,7 +84,7 @@ export function Markdown({ text, onOpenLink, onPreviewHtml, imageSession }: {
|
||||
while (i < lines.length && !/^\s*```/.test(lines[i]))
|
||||
body.push(lines[i++]);
|
||||
i++;
|
||||
nodes.push(<div className="st-code" key={key}><div className="st-code__head"><span>{language || tr('code')}</span>{tr(/^html$/i.test(language) && onPreviewHtml ? <Btn size="sm" onClick={() => onPreviewHtml(body.join('\n'))}>{tr("Open preview")}</Btn> : null)}<IconBtn name="copy" title={tr("Copy code")} onClick={() => void navigator.clipboard.writeText(body.join('\n'))}/></div><SyntaxCode text={body.join('\n')} language={language}/></div>);
|
||||
nodes.push(<div className="st-code" key={key}><div className="st-code__head"><span>{language || tr('code')}</span>{tr(/^html$/i.test(language) && onPreviewHtml ? <Btn size="sm" onClick={() => onPreviewHtml(body.join('\n'))}>{tr("Open preview")}</Btn> : null)}<IconBtn name="copy" title={tr("Copy code")} onClick={() => void copyCode(body.join('\n'))}/></div><SyntaxCode text={body.join('\n')} language={language}/></div>);
|
||||
continue;
|
||||
}
|
||||
const block = displayBlock(lines, i);
|
||||
@@ -113,8 +128,19 @@ export function Markdown({ text, onOpenLink, onPreviewHtml, imageSession }: {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
nodes.push(<p key={i}>{tr(inline(line, onOpenLink, imageSession))}</p>);
|
||||
// One paragraph: a single newline inside it is a soft break (a space); two spaces or a backslash at the end of a line is a hard break (#3818).
|
||||
const key = i, parts: ReactNode[] = [];
|
||||
let current = line;
|
||||
i++;
|
||||
while (true) {
|
||||
const hard = /( {2,}|\\)$/.test(current);
|
||||
parts.push(<Fragment key={parts.length}>{tr(inline(current.replace(/( {2,}|\\)$/, ''), onOpenLink, imageSession))}</Fragment>);
|
||||
if (i >= lines.length || !continuesParagraph(lines, i))
|
||||
break;
|
||||
parts.push(hard ? <br key={`b${parts.length}`}/> : ' ');
|
||||
current = lines[i++].trimStart();
|
||||
}
|
||||
nodes.push(<p key={key}>{tr(parts)}</p>);
|
||||
}
|
||||
return <>{tr(nodes)}</>;
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import { nativeAction, useNative, type NativeJob } from '../lib/native';
|
||||
import { tuneEffective } from '../lib/native-tune';
|
||||
import { tunedFields } from '../lib/tune-values';
|
||||
import { draftingChoices as draftingOptions } from '../lib/drafting';
|
||||
import { deepseekContexts, deepseekContextNote } from '../lib/deepseek-context';
|
||||
import { NativeSettings } from './NativeSettings';
|
||||
import { NativeSettingsFile } from './NativeSettingsFile';
|
||||
import { RunImageModel } from './RunImageModel';
|
||||
@@ -83,7 +84,12 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
|
||||
}, [selectedSize?.id, installed?.ready, resourceProfile, vision, native?.jobs.filter(j => j.state === 'done').length]);
|
||||
useEffect(() => { if (tunedNow?.fields.kv) setKv(tunedNow.fields.kv as typeof kv); if (tunedNow?.fields.lowRam) setLowRam(tunedNow.fields.lowRam as typeof lowRam); }, [tunedNow]);
|
||||
const active = native?.jobs.find(j => j.state === 'running');
|
||||
const job = native?.jobs.find(j => j.id === jobId) ?? (!jobId ? native?.jobs.filter(j => ['load', 'install'].includes(j.kind)).at(-1) : undefined);
|
||||
// Catalog groups share quantization names. A remembered job must still belong
|
||||
// to the selected version; another family's failure stays in diagnostics.
|
||||
const selectedJob = (j: NativeJob) => !!selectedSize && (j.model === selectedSize.id ||
|
||||
(j.model === selectedSize.model && j.family === selectedSize.sourceFamily));
|
||||
const job = native?.jobs.find(j => j.id === jobId && selectedJob(j)) ??
|
||||
native?.jobs.filter(j => ['load', 'install'].includes(j.kind) && selectedJob(j)).at(-1);
|
||||
const noFit = selectedSize?.on_this_pc === 'does not fit';
|
||||
// Graphics cards (strata_control/gpu_fit.py: the one rule of the app, the Terminal and setup): the recommended option is pre-selected, the person may pick another
|
||||
// A card a loaded model already uses (a second model on it usually does not fit): said on its row, and not the pre-selected one while another is free.
|
||||
@@ -138,8 +144,11 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
|
||||
if (installed.resourceProfile && !loadedSelected?.resourceProfile)
|
||||
setResourceProfile(installed.resourceProfile);
|
||||
}
|
||||
else
|
||||
else {
|
||||
setVision('yes');
|
||||
if (selectedSize.multi_file)
|
||||
setContext(8192); // DeepSeek runs at the one context its engine was checked at (as in the guided setup)
|
||||
}
|
||||
}, [selectedSize?.id, installed?.model, installed?.ready, installed?.context, installed?.kv, installed?.images, installed?.visionEnabled, installed?.visionDevice, installed?.lowRamMode, installed?.resourceProfile]);
|
||||
useEffect(() => { if (jobId && job?.state === 'done' && job.id !== toastedJob && (job.kind === 'load' || job.kind === 'install')) {
|
||||
setToastedJob(job.id);
|
||||
@@ -183,8 +192,9 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
|
||||
return; presetPending.current = true; setFamily(f.family); setSize(f.sizes.find(s => s.model === v.model && (s.sourceFamily === v.family || f.family === v.family))?.id ?? ''); setContext(v.context ?? 32768); setVision(v.vision ?? 'no'); setKv(v.kv ?? 'int8'); setLowRam(v.low_ram ?? 'auto'); }}/><Btn icon="models" onClick={() => setManage(true)}>{tr("Manage models")}</Btn></span></div>
|
||||
<div className="native-version"><VersionPicker pick={native?.catalog?.recommendation} versions={allSizes} selectedId={selectedSize.id} hardware={fitHardware} downloaded={readyIds} onSelect={id => { const f = families.find(f => f.sizes.some(s => s.id === id)); if (f) { setFamily(f.family); setSize(id); setError(''); } }} onOwnGguf={() => (onImport ?? onOtherModels)()}/></div>
|
||||
{tr(noFit ? <p className="small muted native-spill-note"><Icon name="disk" size={16}/>{tr("May run slower \u00B7 Model data can be read from SSD.")}</p> : null)}
|
||||
{tr(selectedSize?.multi_file && deepseekContextNote(context) ? <p className="small muted native-spill-note"><Icon name="info" size={16}/>{tr(deepseekContextNote(context))}</p> : null)}
|
||||
<div className="native-choice__row">
|
||||
<div className="native-choice__col"><span className="native-choice__label">{tr("Conversation context")}</span><Select ariaLabel={tr("Conversation context")} value={String(context)} options={contextChoices(native?.catalog?.contexts ?? [8192, 32768, 65536, 131072, 262144], context).map(n => ({ value: String(n), label: n % 1024 === 0 ? `${n / 1024}K` : `${n.toLocaleString()} tokens` }))} onChange={n => setContext(Number(n))}/></div>
|
||||
<div className="native-choice__col"><span className="native-choice__label">{tr("Conversation context")}</span><Select ariaLabel={tr("Conversation context")} value={String(context)} options={contextChoices(selectedSize?.multi_file ? deepseekContexts(installed?.contextMax) : native?.catalog?.contexts ?? [8192, 32768, 65536, 131072, 262144], context).map(n => ({ value: String(n), label: n % 1024 === 0 ? `${n / 1024}K` : `${n.toLocaleString()} tokens` }))} onChange={n => setContext(Number(n))}/></div>
|
||||
{tr(draftingChoices ? <div className="native-choice__col"><span className="native-choice__label">{tr("Drafting")}</span><Select ariaLabel={tr("Drafting")} value={drafting} disabled={!!active} options={draftingChoices.map(v => ({ value: v, label: tr(draftingWords[v]) }))} onChange={v => setDrafting(String(v))}/></div> : null)}
|
||||
<div className="native-choice__col"><span className="native-choice__label">{tr("Computer use")}</span><div className="native-resource-choice"><button aria-pressed={resourceProfile === 'work'} data-selected={resourceProfile === 'work'} onClick={() => setResourceProfile('work')}><Icon name="computer" size={20}/><span><strong>{tr("Leave 20% for my work")}</strong><small>{tr("Headroom for your other apps")}</small></span>{tr(resourceProfile === 'work' ? <Icon name="check" size={15}/> : null)}</button><button aria-pressed={resourceProfile === 'performance'} data-selected={resourceProfile === 'performance'} onClick={() => setResourceProfile('performance')}><Icon name="bolt" size={20}/><span><strong>{tr("Full performance")}</strong><small>{tr("Give Strata priority")}</small></span>{tr(resourceProfile === 'performance' ? <Icon name="check" size={15}/> : null)}</button></div></div>
|
||||
</div>
|
||||
@@ -204,13 +214,13 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
|
||||
{tr(expert && IMAGE_GENERATION_VISIBLE ? <><details className="native-generation"><summary>{tr("Image generation ")}<span className="muted">{tr("Optional")}</span></summary><RunImageModel library={imageLibrary} disabled={pending || !!active} onChange={() => { }}/></details></> : null)}
|
||||
{tr(expert ? <section id="native-expert-settings" ref={expertSection} className="st-card native-execution"><h2 className="h4">{tr("Expert settings")}</h2>{tr(tunedNow ? <p className="small muted native-tuned-note">{tr("Showing the values of your tuning '{0}'.", [tunedNow.name])}</p> : null)}<label className="native-toggle"><span><strong>{tr("Run multiple models")}</strong><small>{tr("Loading another model keeps the others loaded.")}</small></span><button className="st-toggle" role="switch" aria-label={tr("Run multiple models")} aria-checked={multiple} onClick={() => setMultiple(v => !v)}/></label>{tr(cardsGpus.length > 1 ? <label className="input-field"><span>{tr("Layer split")}</span><input className="st-input" value={split} placeholder={tr("auto or 16,32")} onChange={e => setSplit(e.target.value)}/></label> : null)}<div className="native-field-grid"><label className="input-field"><span>{tr("Context memory")}</span><Select ariaLabel={tr("Native KV format")} value={kv} options={[{ value: 'int8', label: 'INT8' }, { value: 'q4_0', label: 'Q4' }, { value: 'k8v4', label: 'K8 / V4' }]} onChange={setKv}/></label><label className="input-field"><span>{tr("Low-RAM mode")}</span><Select ariaLabel={tr("Native low RAM mode")} value={lowRam} options={['auto', 'resident', 'mmap'].map(v => ({ value: v, label: v === 'auto' ? 'Automatic' : v === 'resident' ? 'Keep experts in RAM' : 'Read experts from disk' }))} onChange={setLowRam}/></label></div>{tr(installed ? <><NativeSettingsFile model={installed.model}/><NativeSettings model={installed.model}/></> : <p className="small muted">{tr("More engine parameters become available after preparing this version.")}</p>)}</section> : null)}
|
||||
</div>
|
||||
<aside className="stack stack--lg"><PcFitCard gpuName={pcGpu?.name} ramGb={pcRam} vramGb={pcVram} inUse={keptModels.length ? { ramGb: Math.round(keptRam), vramGb: Math.round(keptVramOn(chosenCards)) } : null} fit={selectedSize ? fitOn(selectedSize, fitHardware) : null}/><section className="st-card"><h2 className="h4">{tr("Model files")}</h2><p className="small muted">{tr("Strata prepares all shards, the draft layer and shared files. Completed downloads are reused.")}</p><code className="native-path">{installed?.dataFolder ?? native?.downloadDirectory ?? native?.installed?.data_folder ?? 'Choose an installation'}</code><Btn size="sm" variant="ghost" onClick={() => { setSettingsSection('Storage'); go('settings'); }}>{tr("Storage settings")}</Btn></section><Btn size="sm" variant="ghost" onClick={onOtherModels}>{tr("Other local models\u2026")}</Btn></aside>
|
||||
<aside className="stack stack--lg"><PcFitCard gpuName={pcGpu?.name} ramGb={pcRam} vramGb={pcVram} diskGb={selectedSize?.multi_file ? selectedSize.disk_gb ?? selectedSize.download_gb : null} inUse={keptModels.length ? { ramGb: Math.round(keptRam), vramGb: Math.round(keptVramOn(chosenCards)) } : null} fit={selectedSize ? fitOn(selectedSize, fitHardware, true, { context, kv }) : null}/><section className="st-card"><h2 className="h4">{tr("Model files")}</h2><p className="small muted">{tr("Strata prepares all shards, the draft layer and shared files. Completed downloads are reused.")}</p><code className="native-path">{installed?.dataFolder ?? native?.downloadDirectory ?? native?.installed?.data_folder ?? 'Choose an installation'}</code><Btn size="sm" variant="ghost" onClick={() => { setSettingsSection('Storage'); go('settings'); }}>{tr("Storage settings")}</Btn></section><Btn size="sm" variant="ghost" onClick={onOtherModels}>{tr("Other local models\u2026")}</Btn></aside>
|
||||
</div>
|
||||
|
||||
<Dialog open={!!plan} title={tr(installed?.ready ? "Apply settings and load" : "Download and prepare")} compact onClose={() => !pending && setPlan(null)} actions={<><Btn disabled={pending} onClick={() => setPlan(null)}>{tr("Cancel")}</Btn><Btn variant="primary" disabled={pending || !!plan?.plan?.disk_short} onClick={() => void download()}>{tr(installed?.ready ? "Apply & load" : "Download & load")}</Btn></>}><p><strong>{tr(plan?.plan?.title ?? selectedFamily?.title)}</strong>{tr(installed?.ready ? null : <>{tr(" \u00B7 approximately ")}{tr(plan?.plan?.download_gb ?? selectedSize?.download_gb)}{tr(" GB")}</>)}</p>{tr(plan?.drafting?.needed ? <p className="small muted">{tr("Choosing DFlash2 also downloads its drafter: about {0} GB, once. If it does not fit in graphics memory, the model uses the MTP instead.", [plan.drafting.gb])}</p> : null)}{tr(installed?.ready ? <p className="small muted">{tr("The model files are already on this computer. Nothing will be downloaded; only the settings you chose are applied.")}</p> : null)}{tr(plan?.plan?.disk_short ? <ErrorNotice message={plan.plan.disk_short}/> : null)}{tr(installed?.ready ? <p className="small muted">{tr("Any currently loaded native models will be unloaded first.")}</p> : <><p className="small muted">{tr("Existing files are checked and reused. Any currently loaded native models will be unloaded before preparing files.")}</p><p className="small muted">{tr("Your computer may feel slower while weights load. You can stop the download and resume later.")}</p></>)}{tr(selectedSize?.images ? <p className="small muted">{tr("Vision encoder files are included. Picture reading loads only when enabled.")}</p> : null)}</Dialog>
|
||||
<NativeDeleteDialog id={deleting} onClose={() => setDeleting(null)}/>
|
||||
<Dialog open={manage} title={tr("Manage models")} onClose={() => setManage(false)} actions={<Btn onClick={() => setManage(false)}>{tr("Done")}</Btn>}><div className="native-manage">
|
||||
{tr(downloaded.length ? <div className="native-manage-list" role="list">{tr(downloaded.map(m => { const v = allSizes.find(x => x.id === m.model), loaded = native?.instances.some(i => i.model === m.model && i.status === 'ready'); return <div className="native-manage-row" role="listitem" key={m.model} data-selected={selectedSize?.id === m.model || undefined}>
|
||||
{tr(downloaded.some(m => m.ready || m.diskGb) ? <div className="native-manage-list" role="list">{tr(downloaded.filter(m => m.ready || m.diskGb).map(m => { const v = allSizes.find(x => x.id === m.model), loaded = native?.instances.some(i => i.model === m.model && i.status === 'ready'); return <div className="native-manage-row" role="listitem" key={m.model} data-selected={selectedSize?.id === m.model || undefined}>
|
||||
<span className="native-manage-name"><strong>{tr(v ? `${catalogVersionLabel(v)}` : m.model_name ?? m.model)}</strong><small>{tr(v ? v.model : m.model)}{tr(m.diskGb ? ` · ${sizeGb(m.diskGb)}` : '')}</small></span>
|
||||
<span className={loaded ? 'st-pill st-pill--accent' : 'st-pill'}>{tr(loaded ? 'Loaded' : 'Downloaded')}</span>
|
||||
<span className="native-manage-actions"><Btn size="sm" disabled={!!active || !v} onClick={() => { if (v) setSize(v.id); setManage(false); }}>{tr(selectedSize?.id === m.model ? 'Selected' : 'Use version')}</Btn><Btn size="sm" variant="danger" disabled={!!active} onClick={() => setDeleting(m.model)}>{tr("Delete")}</Btn></span>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { DecimalInput } from './DecimalInput';
|
||||
import { tr } from '../lib/i18n';
|
||||
import {nativeSettingsResponse,nativeSettingsValues} from '../lib/native-settings-response';
|
||||
import { describeChange, type TunedChange } from '../lib/tune-values';
|
||||
@@ -5,12 +6,29 @@ import { useEffect, useState } from 'react';
|
||||
import { api } from '../lib/client';
|
||||
import { refreshNative, useNative, type NativeField } from '../lib/native';
|
||||
import { Btn, ErrorNotice, Select } from './ui';
|
||||
import { speedOptions } from '../lib/deepseek-speed';
|
||||
import type { RunCard } from '../lib/native-fit';
|
||||
import { NativeMcpEditor } from './NativeMcpEditor';
|
||||
/** One of the speed features: what it is called, what it does, whether it is on by default, and the engine environment it writes outside its default (server/native-settings.mjs). */
|
||||
interface SpeedSwitch {
|
||||
id: string;
|
||||
label: string;
|
||||
hint: string;
|
||||
default: 'on' | 'off';
|
||||
env: Record<string, string>;
|
||||
/** What an earlier test build wrote for the same state: it reads as set, and goes with it. */
|
||||
legacy?: Record<string, string>;
|
||||
}
|
||||
const switchHas = (entries: Record<string, string> | undefined, env: Record<string, string> | undefined) => !!entries && Object.keys(entries).length > 0 && Object.entries(entries).every(([name, value]) => env?.[name] === value);
|
||||
const switchIsSet = (sw: SpeedSwitch, env: Record<string, string> | undefined) => switchHas(sw.env, env) || switchHas(sw.legacy, env);
|
||||
const switchIsOn = (sw: SpeedSwitch, env: Record<string, string> | undefined) => switchIsSet(sw, env) !== (sw.default === 'on');
|
||||
export function NativeSettings({ model }: {
|
||||
model: string;
|
||||
}) {
|
||||
const native = useNative();
|
||||
const [revision,setRevision]=useState(0);
|
||||
const [switches, setSwitches] = useState<SpeedSwitch[]>([]); // the speed switches that apply to this model on this PC
|
||||
const [dsExperts, setDsExperts] = useState(false); // the installed DeepSeek engine knows --experts (0.1.50 or newer)
|
||||
const [tuned, setTuned] = useState<{ preset: { name: string } | null; changed: TunedChange[] } | null>(null);
|
||||
const [values, setValues] = useState<Record<string, any>>({}), [mcp, setMcp] = useState('{}'), [original, setOriginal] = useState(''), [text, setText] = useState(''), [tab, setTab] = useState('fields'), [pending, setPending] = useState(false), [error, setError] = useState(''), [notice, setNotice] = useState(''), [query, setQuery] = useState('');
|
||||
useEffect(() => {
|
||||
@@ -25,9 +43,13 @@ export function NativeSettings({ model }: {
|
||||
values: Record<string, any>;
|
||||
mcp: Record<string, any>;
|
||||
tuned?: { preset: { name: string } | null; changed: TunedChange[] } | null;
|
||||
capabilities?: { dsExperts?: boolean };
|
||||
speedSwitches?: SpeedSwitch[];
|
||||
}>(`/api/native/models/${model}/settings`).then(input => {
|
||||
if (!active)
|
||||
return;
|
||||
setDsExperts(!!input.capabilities?.dsExperts);
|
||||
setSwitches(input.speedSwitches ?? []);
|
||||
setTuned(input.tuned ?? null);
|
||||
const value = nativeSettingsResponse(input);
|
||||
setValues(value.values);
|
||||
@@ -41,6 +63,8 @@ export function NativeSettings({ model }: {
|
||||
return () => { active = false; };
|
||||
}, [model,revision]);
|
||||
const change = (id: string, value: any) => { const next = { ...values, [id]: value }; setValues(next); setText(JSON.stringify(next, null, 2)); setNotice(''); };
|
||||
/** The default removes the switch's environment entries, the other state writes them: the model's file then carries nothing for a default launch. */
|
||||
const changeSwitch = (sw: SpeedSwitch, on: boolean) => { const env = { ...(values.env ?? {}) }; const write = on !== (sw.default === 'on'); for (const [name, value] of Object.entries(sw.env)) { if (write) env[name] = value; else delete env[name]; } if (!write) for (const name of Object.keys(sw.legacy ?? {})) delete env[name]; change('env', env); };
|
||||
async function save() {
|
||||
setPending(true);
|
||||
setError('');
|
||||
@@ -90,16 +114,10 @@ export function NativeSettings({ model }: {
|
||||
<summary>{tr('Native engine settings')}</summary>
|
||||
{error ? <><ErrorNotice message={tr('Couldn’t load model settings.')} next={tr('Check that the engine is connected and this model is installed, then try again.')} onRetry={() => setRevision(value => value + 1)}/><details className="native-settings-diagnostic"><summary className="small">{tr('Details')}</summary><p className="small muted">{error}</p></details></> : <p className="small muted" role="status">{tr('Reading saved settings…')}</p>}
|
||||
</details>;
|
||||
const rows = (native?.fields ?? []).filter(f => `${tr(f.label)} ${f.id} ${tr(f.group)}`.toLowerCase().includes(query.toLowerCase()));
|
||||
const rows = (native?.fields ?? []).filter(f => (!f.forModel || (model.toLowerCase().includes(f.forModel) && (f.id !== 'ds_experts' || dsExperts))) && `${tr(f.label)} ${f.id} ${tr(f.group)}`.toLowerCase().includes(query.toLowerCase()));
|
||||
const switchRows = switches.filter(sw => `${tr(sw.label)} ${sw.id} ${tr('Speed')}`.toLowerCase().includes(query.toLowerCase()));
|
||||
return <details className="native-settings"><summary>{tr("Native engine settings")}</summary>{tr(tuned?.changed?.length ? <div className="native-tuned"><p className="small"><strong>{tr("Your tuning '{0}' sets", [tuned.preset?.name ?? ''])}</strong></p><ul>{tuned.changed.map(c => { const d = describeChange(c); return <li key={c.flag}><span>{d.name}</span><b>{d.now || tr('off')}</b>{d.was !== null ? <small className="muted">{tr("was {0}", [d.was])}</small> : null}</li>; })}</ul></div> : null)}<p className="small muted">{tr(!original ? 'Reading saved settings… ' : '')}{tr("Settings for this model. Blank values use Strata\u2019s defaults.")}</p><div className="editor-tabs" role="tablist" aria-label={tr("Native settings editor")}>{tr(['fields', 'json', 'tools'].map(t => <button key={t} role="tab" aria-selected={tab === t} onClick={() => chooseTab(t)}>{tr(t === 'fields' ? 'Parameters' : t === 'json' ? 'JSON' : 'MCP tools')}</button>))}</div>
|
||||
{tr(tab === 'fields' ? <><input className="st-input" type="search" aria-label={tr("Search native parameters")} placeholder={tr("Search parameters…")} value={query} onChange={e => setQuery(e.target.value)}/>{tr(['Responses', 'GPU & memory', 'Serving', 'Image reading', 'Tools', 'Recovery'].map(group => rows.some(f => f.group === group) ? <section className="native-settings-group" key={group}><h3 className="h4">{tr(group)}</h3>{tr(rows.filter(f => f.group === group).map(f => <label className="native-setting-row" key={f.id}><span><strong>{tr(f.label)}</strong>{tr(f.supported === false ? <small>{tr("Requires a newer Strata installation.")}</small> : f.hint ? <small>{tr(f.hint)}</small> : null)}</span><NativeFieldInput field={f} value={values[f.id]} onChange={v => change(f.id, v)}/></label>))}</section> : null))}<section className="native-settings-group"><h3 className="h4">{tr("Sampling")}</h3>{tr([['temperature', 'Temperature'], ['top_p', 'Top-p'], ['top_k', 'Top-k'], ['min_p', 'Min-p'], ['repetition_penalty', 'Repetition penalty'], ['presence_penalty', 'Presence penalty'], ['frequency_penalty', 'Frequency penalty'], ['penalty_last_n', 'Penalty window'], ['seed', 'Seed']].map(([id, label]) => <label className="native-setting-row" key={id}><span><strong>{tr(label)}</strong></span><input className="st-input" aria-label={tr("Native {0}", [label])} inputMode="decimal" value={values.sampling?.[id] ?? ''} onChange={e => {
|
||||
const sampling = { ...values.sampling };
|
||||
if (e.target.value === '')
|
||||
delete sampling[id];
|
||||
else
|
||||
sampling[id] = Number(e.target.value);
|
||||
change('sampling', sampling);
|
||||
}}/></label>))}</section></> : tab === 'json' ? <><p className="small muted">{tr("Engine arguments and STRATA environment flags are editable here. Program paths and network access remain managed by the host.")}</p><textarea className="st-input native-json" aria-label={tr("Native configuration JSON")} spellCheck={false} value={text} onChange={e => { setText(e.target.value); setNotice(''); }}/></> : <><p className="small muted">{tr("Add local programs or HTTP MCP servers. Connected tools can read or change the resources you give them access to. Enable tools in chat when you want the model to use them.")}</p><NativeMcpEditor text={mcp} onChange={value => { setMcp(value); setNotice(''); }}/><details><summary className="small">{tr("Configuration example")}</summary><pre className="native-example">{'{\n "files": {\n "command": "npx",\n "args": ["-y", "@modelcontextprotocol/server-filesystem", "/your/folder"],\n "disabled": false\n }\n}'}</pre><p className="xs muted">{tr("Saved credentials are masked. Keep the mask to preserve an existing value; type a new value to replace it.")}</p></details></>)}
|
||||
{tr(tab === 'fields' ? <><input className="st-input" type="search" aria-label={tr("Search native parameters")} placeholder={tr("Search parameters…")} value={query} onChange={e => setQuery(e.target.value)}/>{tr(['Responses', 'GPU & memory', 'Serving', 'Image reading', 'Tools', 'Recovery'].map(group => rows.some(f => f.group === group) ? <section className="native-settings-group" key={group}><h3 className="h4">{tr(group)}</h3>{tr(rows.filter(f => f.group === group).map(f => <label className="native-setting-row" key={f.id}><span><strong>{tr(f.label)}</strong>{tr(f.supported === false ? <small>{tr("Requires a newer Strata installation.")}</small> : f.hint ? <small>{tr(f.hint)}</small> : null)}</span><NativeFieldInput field={f} value={values[f.id]} onChange={v => change(f.id, v)}/></label>))}</section> : null))}{tr(switchRows.length ? <section className="native-settings-group"><h3 className="h4">{tr("Speed")}</h3>{tr(switchRows.map(sw => <label className="native-setting-row" key={sw.id}><span><strong>{tr(sw.label)}</strong><small>{tr(sw.hint)}</small></span><Select ariaLabel={tr(sw.label)} value={switchIsOn(sw, values.env) ? 'on' : 'off'} options={sw.default === 'on' ? [{ value: 'on', label: 'On (recommended)' }, { value: 'off', label: 'Off' }] : [{ value: 'off', label: 'Off (recommended)' }, { value: 'on', label: 'On' }]} onChange={v => changeSwitch(sw, v === 'on')}/></label>))}</section> : null)}<section className="native-settings-group"><h3 className="h4">{tr("Sampling")}</h3>{tr([['temperature', 'Temperature'], ['top_p', 'Top-p'], ['top_k', 'Top-k'], ['min_p', 'Min-p'], ['repetition_penalty', 'Repetition penalty'], ['presence_penalty', 'Presence penalty'], ['frequency_penalty', 'Frequency penalty'], ['penalty_last_n', 'Penalty window'], ['seed', 'Seed']].map(([id, label]) => <label className="native-setting-row" key={id}><span><strong>{tr(label)}</strong></span><DecimalInput ariaLabel={tr("Native {0}", [label])} value={values.sampling?.[id] ?? null} onChange={n => { const sampling = { ...values.sampling }; if (n === null) delete sampling[id]; else sampling[id] = n; change('sampling', sampling); }}/></label>))}</section></> : tab === 'json' ? <><p className="small muted">{tr("Engine arguments and STRATA environment flags are editable here. Program paths and network access remain managed by the host.")}</p><textarea className="st-input native-json" aria-label={tr("Native configuration JSON")} spellCheck={false} value={text} onChange={e => { setText(e.target.value); setNotice(''); }}/></> : <><p className="small muted">{tr("Add local programs or HTTP MCP servers. Connected tools can read or change the resources you give them access to. Enable tools in chat when you want the model to use them.")}</p><NativeMcpEditor text={mcp} onChange={value => { setMcp(value); setNotice(''); }}/><details><summary className="small">{tr("Configuration example")}</summary><pre className="native-example">{'{\n "files": {\n "command": "npx",\n "args": ["-y", "@modelcontextprotocol/server-filesystem", "/your/folder"],\n "disabled": false\n }\n}'}</pre><p className="xs muted">{tr("Saved credentials are masked. Keep the mask to preserve an existing value; type a new value to replace it.")}</p></details></>)}
|
||||
<div className="native-settings-actions"><Btn disabled={pending || !original || !dirty} variant="primary" onClick={() => void save()}>{tr(pending ? 'Saving…' : 'Save settings')}</Btn><Btn disabled={pending} onClick={() => { const saved = JSON.parse(original || '{"values":{},"mcp":{}}'); setValues(saved.values); setText(JSON.stringify(saved.values, null, 2)); setMcp(JSON.stringify(saved.mcp, null, 2)); setError(''); }}>{tr("Restore saved")}</Btn></div>{tr(notice ? <p role="status" className="small">{tr(notice)}</p> : null)}{tr(error ? <ErrorNotice message={error} onRetry={() => setRevision(value => value + 1)}/> : null)}
|
||||
</details>;
|
||||
}
|
||||
@@ -112,9 +130,20 @@ function NativeFieldInput({ field, value, onChange }: {
|
||||
return <NativeAliases field={field} value={value} onChange={onChange}/>;
|
||||
if (field.type === 'boolean')
|
||||
return <Select disabled={field.supported === false} ariaLabel={tr(field.label)} value={value === null || value === undefined ? '' : String(value)} options={[{ value: '', label: 'Default' }, { value: 'true', label: 'On' }, { value: 'false', label: 'Off' }]} onChange={v => onChange(v === '' ? null : v === 'true')}/>;
|
||||
if (field.id === 'ds_experts')
|
||||
return <DeepSeekSpeed field={field} value={value} onChange={onChange}/>;
|
||||
if (field.type === 'enum')
|
||||
return <Select disabled={field.supported === false} ariaLabel={tr(field.label)} value={value ?? ''} options={[{ value: '', label: 'Default' }, ...(field.choices ?? []).map(v => ({ value: v, label: v }))]} onChange={v => onChange(v || null)}/>;
|
||||
return <input disabled={field.supported === false} className="st-input" aria-label={tr(field.label)} inputMode={field.type === 'number' ? 'numeric' : undefined} placeholder={tr("Default")} value={Array.isArray(value) ? value.join(', ') : value ?? ''} onChange={e => onChange(e.target.value === '' ? null : field.type === 'array' ? e.target.value.split(',').map(s => s.trim()).filter(Boolean) : field.type === 'number' ? Number(e.target.value) : e.target.value)}/>;
|
||||
if (field.type === 'number')
|
||||
return <DecimalInput disabled={field.supported === false} ariaLabel={tr(field.label)} placeholder={tr("Default")} value={value === null || value === undefined || value === '' || !Number.isFinite(Number(value)) ? null : Number(value)} onChange={onChange}/>;
|
||||
return <input disabled={field.supported === false} className="st-input" aria-label={tr(field.label)} placeholder={tr("Default")} value={Array.isArray(value) ? value.join(', ') : value ?? ''} onChange={e => onChange(e.target.value === '' ? null : field.type === 'array' ? e.target.value.split(',').map(s => s.trim()).filter(Boolean) : field.type === 'number' ? Number(e.target.value) : e.target.value)}/>;
|
||||
}
|
||||
/** DeepSeek's Speed choice. The engine decides the default itself (--experts auto); the labels name the same default (lib/deepseek-speed.ts). */
|
||||
function DeepSeekSpeed({ field, value, onChange }: { field: NativeField; value: any; onChange: (v: any) => void }) {
|
||||
const native = useNative();
|
||||
const options = speedOptions(native?.hardware?.gpus as RunCard[] | undefined).map(o => ({ ...o, label: tr(o.label) }));
|
||||
return <Select disabled={field.supported === false} ariaLabel={tr(field.label)} value={value === null || value === undefined ? '' : String(value)}
|
||||
options={options} onChange={v => onChange(v === '' ? null : v)}/>;
|
||||
}
|
||||
function NativeAliases({ field, value, onChange }: {
|
||||
field: NativeField;
|
||||
|
||||
@@ -8,9 +8,20 @@ export function OnboardingMemory({ hardware, native }: {
|
||||
hardware: Hardware | null;
|
||||
native: NativeState['hardware'] | undefined;
|
||||
}) {
|
||||
const gpus = hardware ? hardware.gpus.filter(gpu => gpu.backend !== 'cpu').map(gpu => ({ id: gpu.id ?? String(gpu.index), name: gpu.name, memory: gpu.vramGb, shared: gpu.unified })) : native?.gpus.map(gpu => ({ id: String(gpu.index), name: gpu.name, memory: gpu.vram_gb, shared: false })) ?? [];
|
||||
// The Windows host probe (Win32_VideoController) cannot read the VRAM of AMD cards and reports 0 for them; the engine's own list has
|
||||
// the real size. For a dedicated card the host reports as 0, take the engine's figure for the card of the same name, or for the
|
||||
// card in the same position when both lists have the same length. A card the engine does not list stays at 0.
|
||||
const nativeGpus = native?.gpus ?? [];
|
||||
const hostGpus = hardware ? hardware.gpus.filter(gpu => gpu.backend !== 'cpu') : [];
|
||||
const engineVram = (name: string, position: number) => {
|
||||
const norm = (value: string) => value.toLowerCase().replace(/[^a-z0-9]/g, '');
|
||||
const byName = nativeGpus.find(g => norm(g.name).includes(norm(name)) || norm(name).includes(norm(g.name)));
|
||||
return (byName ?? (nativeGpus.length === hostGpus.length ? nativeGpus[position] : undefined))?.vram_gb || 0;
|
||||
};
|
||||
const gpus = hardware ? hostGpus.map((gpu, position) => ({ id: gpu.id ?? String(gpu.index), name: gpu.name, memory: gpu.unified || gpu.vramGb > 0 ? gpu.vramGb : engineVram(gpu.name, position), shared: gpu.unified })) : nativeGpus.map(gpu => ({ id: String(gpu.index), name: gpu.name, memory: gpu.vram_gb, shared: false }));
|
||||
const dedicatedCount = gpus.filter(gpu => !gpu.shared).length;
|
||||
const memory = hardware ? memoryInventory(hardware) : native ? { ram: native.ram_gb, vram: native.gpus.reduce((sum, gpu) => sum + Math.max(0, gpu.vram_gb || 0), 0), total: 0, shared: false } : null;
|
||||
const base = hardware ? memoryInventory(hardware) : null;
|
||||
const memory = base ? (base.shared ? base : { ...base, vram: gpus.reduce((sum, gpu) => sum + (gpu.shared ? 0 : Math.max(0, gpu.memory || 0)), 0) }) : native ? { ram: native.ram_gb, vram: native.gpus.reduce((sum, gpu) => sum + Math.max(0, gpu.vram_gb || 0), 0), total: 0, shared: false } : null;
|
||||
if (!memory)
|
||||
return <div className="onboard-hardware" role="group" aria-label={tr("Computer memory")}><div className="onboard-memory-intro"><Icon name="memory" size={18}/><span>{tr("Reading memory\u2026")}</span></div></div>;
|
||||
const total = memory.ram + memory.vram;
|
||||
|
||||
@@ -15,7 +15,7 @@ function Meter({ label, total, use }: { label: string; total: number; use: numbe
|
||||
* "This computer": the graphics memory and RAM, and what the chosen version would take of each. One plain line says whether it fits
|
||||
* or how much would be read from the SSD (the n-gram table, which always sits on the SSD, is not counted).
|
||||
*/
|
||||
export function PcFitCard({ gpuName, ramGb, vramGb, fit, inUse = null }: { gpuName?: string | null; ramGb: number | null; vramGb: number; fit: Fit | null; inUse?: { ramGb: number; vramGb: number } | null }) {
|
||||
export function PcFitCard({ gpuName, ramGb, vramGb, fit, inUse = null, diskGb = null }: { gpuName?: string | null; ramGb: number | null; vramGb: number; fit: Fit | null; inUse?: { ramGb: number; vramGb: number } | null; diskGb?: number | null }) {
|
||||
const freeVram = Math.max(0, vramGb - (inUse?.vramGb ?? 0)), freeRam = ramGb ? Math.max(0, ramGb - (inUse?.ramGb ?? 0)) : 0;
|
||||
return <section className="st-card pc-card">
|
||||
<div><h2 className="h4">{tr("This computer")}</h2>
|
||||
@@ -23,6 +23,7 @@ export function PcFitCard({ gpuName, ramGb, vramGb, fit, inUse = null }: { gpuNa
|
||||
{tr(fit?.known && vramGb > 0 ? <Meter label="Graphics memory" total={freeVram} use={fit.vramUseGb}/> : null)}
|
||||
{tr(fit?.known && ramGb ? <Meter label="RAM" total={freeRam} use={fit.ramUseGb}/> : null)}
|
||||
{tr(inUse ? <p className="xs muted">{tr("Models that stay loaded use about {0} GB of RAM and {1} GB of this card’s memory.", [inUse.ramGb, inUse.vramGb])}</p> : null)}
|
||||
{tr(fit?.known ? <p className="pc-note">{tr(fit.spillGb >= 1 ? 'About {0} GB will be read from the SSD, so answers can be a little slower.' : 'Fits fully in memory.', [Math.round(fit.spillGb)])}</p> : null)}
|
||||
{tr(diskGb ? <p className="pc-note">{tr("Needs about {0} GB of free disk space. What does not fit in memory is read from your SSD.", [Math.round(diskGb)])}</p> : null)}
|
||||
{tr(fit?.known && (diskGb ? fit.spillGb >= 1 : true) ? <p className="pc-note">{tr(fit.spillGb >= 1 ? 'About {0} GB will be read from the SSD, so answers can be a little slower.' : 'Fits fully in memory.', [Math.round(fit.spillGb)])}</p> : null)}
|
||||
</section>;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ export function SettingsStorage() {
|
||||
const library = state.library;
|
||||
const versions = library ? pickerGroups(library).flatMap(group => group.versions) : [];
|
||||
// ONE list and ONE total: the optimized models (sizes from their real files, shared files counted once) and the other local models together.
|
||||
const nativeModels = native?.installed?.models ?? [];
|
||||
const nativeModels = (native?.installed?.models ?? []).filter(m => m.ready || (m.diskGb ?? 0) > 0); // a model whose files are all gone (an old config) is not a 0.0 GB download
|
||||
const sharedGb = (native?.installed?.usage?.shared_bytes ?? 0) / 1e9;
|
||||
const nativeGb = native?.installed?.usage ? native.installed.usage.total_gb : nativeModels.reduce((n, m) => n + (m.diskGb ?? 0), 0);
|
||||
const totalGb = nativeGb + versions.reduce((n, v) => n + (v.diskGb ?? 0), 0);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { NativeProgress } from './NativeModels';
|
||||
import { jobErrorText } from '../lib/native-job-diagnostics';
|
||||
import { appVersionLabel } from '../lib/app-version';
|
||||
import { fetchUpdateCheck, publishUpdateCheck, useInstalledVersions, useLastUpdateCheck } from '../lib/update-check';
|
||||
import { shownEngineVersion } from '../lib/engine-version';
|
||||
/** A check from an earlier day shows its date too, because the result is kept between visits. */
|
||||
function checkedLabel(at: string) {
|
||||
const when = new Date(at), sameDay = when.toDateString() === new Date().toDateString();
|
||||
@@ -30,7 +31,7 @@ export function SettingsUpdates() {
|
||||
const [error, setError] = useState('');
|
||||
const request = useRef<AbortController | null>(null);
|
||||
useEffect(() => () => request.current?.abort(), []);
|
||||
const installed = component === 'strata' ? appVersion : native?.available ? (native.installed?.engine?.version ?? 'Not installed') : engineVersion;
|
||||
const installed = component === 'strata' ? appVersion : native?.available ? (native.installed?.engine?.version ?? 'Not installed') : shownEngineVersion(native, engineVersion);
|
||||
const active = native?.jobs.find(j => j.state === 'running');
|
||||
const result = checking || error ? null : (fresh ?? last);
|
||||
async function operate(kind: string) {
|
||||
@@ -71,14 +72,14 @@ export function SettingsUpdates() {
|
||||
const labels: Record<SoftwareUpdate['status'], string> = { available: 'Update available', current: 'Up to date', unavailable: 'Check unavailable', error: 'Check failed', 'no-releases': 'No release yet' };
|
||||
return <div className="settings-version" data-update={update?.status}>
|
||||
<Icon name={name === 'Strata' ? 'layers' : 'engine'} size={20}/>
|
||||
<span><strong>{tr(name)}</strong><small>{tr(version ?? 'Version unavailable')}</small>{tr(!checking && update ? <small className="settings-version__message">{tr(update.message)}</small> : null)}</span>
|
||||
<span><strong>{tr(name)}</strong><small>{tr(version ?? 'Version unavailable')}</small>{tr(!checking && update ? <small className="settings-version__message">{tr(update.message)}</small> : null)}{tr(!checking && name === 'Strata' && update?.details ? <details className="native-settings-diagnostic"><summary className="small">{tr("Details")}</summary><p className="small muted">{update.details}</p></details> : null)}</span>
|
||||
{tr(!checking && update?.status === 'available' ? (native?.available ? <Btn size="sm" variant="primary" disabled={!!active || (name === 'Engine' && !native.installed?.models.length && !native.capabilities.componentUpdates)} onClick={() => setConfirm(name === 'Strata' ? 'update-strata' : 'update-engine')}>{tr("Update available")}</Btn> : update.releaseUrl ? <a className="st-btn st-btn--secondary st-btn--sm" href={update.releaseUrl} target="_blank" rel="noreferrer" title={tr("Open the release page to update this installation")}>{tr("Update available")}<Icon name="download" size={15}/></a> : <span className="settings-version__label">{tr(labels[update.status])}</span>) : <span className="settings-version__label">{tr(checking ? 'Checking…' : update ? labels[update.status] : version === 'Not installed' ? 'Not installed' : 'Installed')}</span>)}
|
||||
</div>;
|
||||
}
|
||||
return <>
|
||||
<div className="settings-versions" aria-busy={checking}>
|
||||
{tr(versionRow('Strata', appVersion, result?.strata))}
|
||||
{tr(versionRow('Engine', native?.available ? (native.installed?.engine?.version ?? 'Not installed') : engineVersion, result?.engine))}
|
||||
{tr(versionRow('Engine', native?.available ? (native.installed?.engine?.version ?? 'Not installed') : shownEngineVersion(native, engineVersion), result?.engine))}
|
||||
<div className="settings-update-actions"><Btn size="sm" icon="refresh" disabled={checking} className={checking ? 'settings-update-checking' : undefined} onClick={() => void check()}>{tr(checking ? 'Checking…' : error || result?.strata.status === 'error' ? 'Try again' : result ? 'Check again' : 'Check for updates')}</Btn><Btn size="sm" variant="ghost" onClick={() => setRollback(true)}>{tr("Roll back\u2026")}</Btn></div>
|
||||
<div className="settings-update-inline" role="status" aria-live="polite">{tr(checking ? 'Checking for new versions…' : error ? <span className="inline-error">{tr(error)}</span> : result ? <><span className="sr-only">{tr(result.strata.message)} {tr(result.engine.message)} </span>{tr("Checked at ")}{tr(checkedLabel(result.checkedAt))}</> : null)}</div>
|
||||
</div>
|
||||
@@ -95,11 +96,11 @@ export function SettingsUpdates() {
|
||||
</>;
|
||||
}
|
||||
|
||||
/** "Strata 0.2.3 · Engine 0.1.48": the app's own version first, the engine's beside it (About). */
|
||||
/** "Strata 0.2.7 · Engine 0.1.52": the app's own version first, the engine's beside it (About). */
|
||||
export function AboutVersions() {
|
||||
const native = useNative();
|
||||
const app = appVersionLabel(useStore(s => s.setup?.app.version), native?.version);
|
||||
const engineVersion = useStore(s => s.engine?.engine.version);
|
||||
const engine = native?.available ? native.installed?.engine?.version : engineVersion;
|
||||
const engine = shownEngineVersion(native, engineVersion);
|
||||
return <p className="settings-about-version"><strong>{tr("Strata")} {app ?? ''}</strong>{engine ? <span className="muted"> · {tr("Engine")} {engine}</span> : null}</p>;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { api } from '../lib/client';
|
||||
import { tr } from '../lib/i18n';
|
||||
import { askNotificationPermission, playDoneSound } from '../lib/attention';
|
||||
import { setApprovalNotify, setDoneSound, useStore } from '../lib/store';
|
||||
import { Btn } from './ui';
|
||||
|
||||
/** What the host says about the desktop shell (GET /api/shell): null in a browser or while it loads. */
|
||||
export interface ShellState {
|
||||
desktop: boolean;
|
||||
tray: boolean;
|
||||
port: number;
|
||||
defaultPort: number;
|
||||
pinnedPort: number | null;
|
||||
minimizeToTray: boolean;
|
||||
portNotice: { wanted: number; used: number } | null;
|
||||
}
|
||||
|
||||
export function useShellState(): [ShellState | null, (patch: { port?: number | null; tray?: boolean }) => Promise<string | null>] {
|
||||
const [shell, setShell] = useState<ShellState | null>(null);
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
api.get<ShellState>('/api/shell').then(s => { if (alive) setShell(s); }).catch(() => undefined);
|
||||
return () => { alive = false; };
|
||||
}, []);
|
||||
const save = async (patch: { port?: number | null; tray?: boolean }) => {
|
||||
try { setShell(await api.post<ShellState>('/api/shell/prefs', patch)); return null; }
|
||||
catch (error) { return error instanceof Error ? error.message : 'The choice was not saved.'; }
|
||||
};
|
||||
return [shell, save];
|
||||
}
|
||||
|
||||
/** The sound for finished work (#3586): off until switched on, with a button to hear it. */
|
||||
export function DoneSoundSetting() {
|
||||
const on = useStore(s => s.doneSound);
|
||||
return <span className="row">
|
||||
<Btn size="sm" onClick={() => playDoneSound()}>{tr("Play sound")}</Btn>
|
||||
<button className="st-toggle" role="switch" aria-checked={on} aria-label={tr("Sound when work finishes")} onClick={() => setDoneSound(!on)}/>
|
||||
</span>;
|
||||
}
|
||||
|
||||
/** A desktop notification when Manual mode waits for an approval (#3477). */
|
||||
export function ApprovalNotifySetting() {
|
||||
const on = useStore(s => s.approvalNotify);
|
||||
return <button className="st-toggle" role="switch" aria-checked={on} aria-label={tr("Notify me when Strata needs an answer")}
|
||||
onClick={() => { if (!on) void askNotificationPermission(); setApprovalNotify(!on); }}/>;
|
||||
}
|
||||
|
||||
/** Keep the app running in the tray when its window is closed (#3477). Desktop app on Windows and macOS only. */
|
||||
export function TraySetting({ shell, save }: { shell: ShellState; save: (patch: { tray: boolean }) => Promise<string | null> }) {
|
||||
return <button className="st-toggle" role="switch" aria-checked={shell.minimizeToTray} aria-label={tr("Minimise to tray")} onClick={() => void save({ tray: !shell.minimizeToTray })}/>;
|
||||
}
|
||||
|
||||
/** The port the app's window and local address use (#3402). Empty lets Strata choose; the choice applies the next time Strata starts. */
|
||||
export function PortSetting({ shell, save }: { shell: ShellState; save: (patch: { port: number | null }) => Promise<string | null> }) {
|
||||
const [text, setText] = useState(shell.pinnedPort ? String(shell.pinnedPort) : ''), [problem, setProblem] = useState('');
|
||||
useEffect(() => { setText(shell.pinnedPort ? String(shell.pinnedPort) : ''); }, [shell.pinnedPort]);
|
||||
const commit = async () => {
|
||||
const trimmed = text.trim();
|
||||
if (trimmed === (shell.pinnedPort ? String(shell.pinnedPort) : '')) { setProblem(''); return; }
|
||||
if (trimmed === '') { setProblem((await save({ port: null })) ?? ''); return; }
|
||||
const value = Number(trimmed);
|
||||
if (!Number.isInteger(value) || value < 1024 || value > 65535) { setProblem(tr("Choose a port between 1024 and 65535, or leave it empty.")); return; }
|
||||
setProblem((await save({ port: value })) ?? '');
|
||||
};
|
||||
return <span className="stack">
|
||||
<span className="row">
|
||||
<input className="st-input" inputMode="numeric" size={7} aria-label={tr("Port (empty = automatic)")} placeholder={String(shell.defaultPort)} value={text}
|
||||
onChange={e => setText(e.target.value.replace(/[^0-9]/g, '').slice(0, 5))} onBlur={() => void commit()} onKeyDown={e => { if (e.key === 'Enter') void commit(); }}/>
|
||||
</span>
|
||||
<span className="xs muted">{tr("Using port {0} now.", [shell.port])}</span>
|
||||
{problem ? <span className="xs" role="alert">{problem}</span> : null}
|
||||
</span>;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnG
|
||||
return <>
|
||||
<button ref={trigger} type="button" className="version-trigger" aria-haspopup="menu" aria-expanded={open} aria-label={tr("Model version")} onClick={() => setOpen(v => !v)}>
|
||||
<strong>{selected && !apart.has(selected.id) ? versionName(selected, true) : tr(moreLabel ?? "Choose a version")}</strong>{tr(selected && !apart.has(selected.id) && downloaded?.has(selected.id) ? <span className="version-row__have">{tr("Downloaded")}</span> : null)}
|
||||
<span className="version-trigger__need muted">{tr(fit ? `${gb(fit.memoryGb)} RAM + VRAM` : '')}</span>
|
||||
<span className="version-trigger__need muted">{tr(fit && selected?.multi_file && selected.disk_gb ? tr("{0} RAM + VRAM, plus about {1} GB of disk", [gb(fit.memoryGb), Math.round(selected.disk_gb)]) : fit ? `${gb(fit.memoryGb)} RAM + VRAM` : '')}</span>
|
||||
<Icon name="chevron" size={14} className="version-trigger__chev"/>
|
||||
</button>
|
||||
{tr(open ? <FloatingMenu anchor={trigger.current} title={tr("Model version")} width={620} onClose={() => setOpen(false)}>
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Telling the person that Strata needs them or has finished (#3586, #3477). Both are opt-in and off by default.
|
||||
*
|
||||
* - A short sound when an answer or task that took a while is finished, or when Strata is in the background (public/strata-done-sound.wav,
|
||||
* made for Strata from sine waves, no sample).
|
||||
* - A desktop notification when Manual mode waits for an approval and Strata is in the background. The desktop app shows it through its own
|
||||
* shell (the host passes it on, so it also works while the window is hidden in the tray); a browser uses the page's notifications.
|
||||
*/
|
||||
import { api } from './client';
|
||||
import { tr } from './i18n';
|
||||
|
||||
/** An answer that came back faster than this does not chime while the person is looking at the window. */
|
||||
export const QUICK_MS = 8000;
|
||||
const SOUND_URL = '/strata-done-sound.wav';
|
||||
const MIN_GAP_MS = 2000;
|
||||
let lastPlayed = 0;
|
||||
|
||||
export interface DoneContext { enabled: boolean; durationMs: number; focused: boolean; now?: number }
|
||||
|
||||
/** Whether the finished-work sound should play now: only when asked for, only for work that took a while or when the window is not in front. */
|
||||
export function shouldPlayDone({ enabled, durationMs, focused, now = Date.now() }: DoneContext): boolean {
|
||||
if (!enabled) return false;
|
||||
if (now - lastPlayed < MIN_GAP_MS) return false;
|
||||
return !focused || durationMs >= QUICK_MS;
|
||||
}
|
||||
|
||||
export const windowInFront = (): boolean => typeof document !== 'undefined' && document.visibilityState === 'visible' && document.hasFocus();
|
||||
|
||||
export function playDoneSound(make: (url: string) => { volume: number; play(): Promise<void> | void } = url => new Audio(url)): boolean {
|
||||
try {
|
||||
const audio = make(SOUND_URL);
|
||||
audio.volume = 0.6;
|
||||
lastPlayed = Date.now();
|
||||
const started = audio.play();
|
||||
if (started && typeof (started as Promise<void>).catch === 'function') (started as Promise<void>).catch(() => { /* the browser asked for a click first: no sound this time */ });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when an answer or a task is finished. */
|
||||
export function workFinished(enabled: boolean, durationMs: number): void {
|
||||
if (shouldPlayDone({ enabled, durationMs, focused: windowInFront() })) playDoneSound();
|
||||
}
|
||||
|
||||
export interface Notice { title: string; body: string }
|
||||
|
||||
/** The sentence of the approval notification, in the person's language. */
|
||||
export function approvalNotice(tool: string): Notice {
|
||||
return { title: tr('Strata needs your answer'), body: tr('The assistant wants to use {0}. Open Strata to approve or deny.', [tool || tr('a tool')]) };
|
||||
}
|
||||
|
||||
/** Shows a notification through the desktop shell when there is one, else through the page. Returns whether something was shown. */
|
||||
export async function showNotice(notice: Notice, deps: { post?: (body: Notice) => Promise<{ shown?: boolean }>; page?: (notice: Notice) => boolean } = {}): Promise<boolean> {
|
||||
const post = deps.post ?? (body => api.post<{ shown?: boolean }>('/api/shell/notify', body));
|
||||
try {
|
||||
const result = await post(notice);
|
||||
if (result?.shown) return true;
|
||||
} catch { /* no shell here: the page's own notification below */ }
|
||||
return (deps.page ?? pageNotification)(notice);
|
||||
}
|
||||
|
||||
function pageNotification(notice: Notice): boolean {
|
||||
try {
|
||||
if (typeof Notification === 'undefined' || Notification.permission !== 'granted') return false;
|
||||
new Notification(notice.title, { body: notice.body, tag: 'strata-approval' });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Manual mode waits for an approval. Only a window that is not in front needs the notification. */
|
||||
export function approvalNeeded(enabled: boolean, tool: string, focused = windowInFront()): Promise<boolean> {
|
||||
if (!enabled || focused) return Promise.resolve(false);
|
||||
return showNotice(approvalNotice(tool));
|
||||
}
|
||||
|
||||
/** Turning approval notifications on in a browser asks the page's permission once; the desktop shell needs none. */
|
||||
export async function askNotificationPermission(): Promise<void> {
|
||||
try {
|
||||
if (typeof Notification !== 'undefined' && Notification.permission === 'default') await Notification.requestPermission();
|
||||
} catch { /* some web views have none */ }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/** A file that is not a picture or plain text (a PDF) is saved by the host in the chat's folder and named in the next message, so the assistant can open it (#3838). */
|
||||
export async function uploadChatFile(file: File, sessionId: string, fetchFn: typeof fetch = fetch): Promise<{ name: string }> {
|
||||
const host = (globalThis as { __STRATA_HOST__?: string }).__STRATA_HOST__ ?? '';
|
||||
const res = await fetchFn(`${host}/api/chat/upload?sessionId=${encodeURIComponent(sessionId)}&name=${encodeURIComponent(file.name)}`, { method: 'POST', headers: { 'content-type': file.type || 'application/octet-stream' }, body: file });
|
||||
const data = await res.json().catch(() => ({})) as { files?: { name: string; attached?: boolean }[]; error?: string };
|
||||
if (!res.ok) throw new Error(data.error || 'The file could not be added. Try again.');
|
||||
return { name: data.files?.find(f => f.attached)?.name ?? file.name };
|
||||
}
|
||||
|
||||
/** Types the Linux file dialog needs next to the extensions (WebKitGTK reads only the type part of `accept`). */
|
||||
export const FILE_ACCEPT = 'image/*,application/pdf,text/*,application/json,application/xml,.pdf,.txt,.md,.markdown,.csv,.ts,.tsx,.js,.jsx,.py,.json,.css,.rs,.go,.sh,.html,.htm,.yaml,.yml,.toml,.xml,.log';
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copy text for the person. The browser clipboard call can be refused (the desktop web view asks for permission, or has no clipboard
|
||||
* object); the older copy command through a hidden field still works there. The answer is always a toast: "Copied", or one plain
|
||||
* sentence and what to do next (#3731).
|
||||
*/
|
||||
export interface ClipboardDeps {
|
||||
clipboard?: { writeText(text: string): Promise<void> } | null;
|
||||
legacyCopy?: (text: string) => boolean;
|
||||
toast: (tone: 'success' | 'warn', title: string, body?: string) => void;
|
||||
}
|
||||
|
||||
function legacyCopy(text: string): boolean {
|
||||
if (typeof document === 'undefined') return false;
|
||||
const field = document.createElement('textarea');
|
||||
field.value = text;
|
||||
field.setAttribute('readonly', '');
|
||||
field.style.cssText = 'position:fixed;top:0;left:0;opacity:0;pointer-events:none';
|
||||
document.body.appendChild(field);
|
||||
const active = document.activeElement as HTMLElement | null;
|
||||
try {
|
||||
field.select();
|
||||
return document.execCommand('copy');
|
||||
} catch { return false; }
|
||||
finally { field.remove(); active?.focus?.(); }
|
||||
}
|
||||
|
||||
export async function copyText(text: string, label: string, deps: ClipboardDeps): Promise<boolean> {
|
||||
const clipboard = deps.clipboard === undefined ? (typeof navigator === 'undefined' ? null : navigator.clipboard) : deps.clipboard;
|
||||
let done = false;
|
||||
try { if (clipboard) { await clipboard.writeText(text); done = true; } } catch { /* the fallback is next */ }
|
||||
if (!done) { try { done = (deps.legacyCopy ?? legacyCopy)(text); } catch { done = false; } }
|
||||
if (done) deps.toast('success', 'Copied', label);
|
||||
else deps.toast('warn', 'Couldn’t copy', 'Select the text and copy it with Ctrl+C.');
|
||||
return done;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* The currency of the Monitor's cost line (#3628): the person's own, found from the computer's region, never typed and never a guess.
|
||||
*
|
||||
* Order: the system (the host reads the regional format of Windows, macOS or Linux: its region, or its currency when the system names one),
|
||||
* then the browser's language list, then the region of the app's language, and then no currency at all: the number is shown without a
|
||||
* symbol rather than in a currency the person does not use. A currency picked in Settings overrides all of this.
|
||||
*/
|
||||
|
||||
/** ISO 3166 region -> ISO 4217 currency. */
|
||||
const PAIRS = `AD:EUR AE:AED AF:AFN AG:XCD AI:XCD AL:ALL AM:AMD AO:AOA AR:ARS AS:USD AT:EUR AU:AUD AW:AWG AX:EUR AZ:AZN
|
||||
BA:BAM BB:BBD BD:BDT BE:EUR BF:XOF BG:EUR BH:BHD BI:BIF BJ:XOF BL:EUR BM:BMD BN:BND BO:BOB BQ:USD BR:BRL BS:BSD BT:BTN BV:NOK BW:BWP BY:BYN BZ:BZD
|
||||
CA:CAD CC:AUD CD:CDF CF:XAF CG:XAF CH:CHF CI:XOF CK:NZD CL:CLP CM:XAF CN:CNY CO:COP CR:CRC CU:CUP CV:CVE CW:XCG CX:AUD CY:EUR CZ:CZK
|
||||
DE:EUR DJ:DJF DK:DKK DM:XCD DO:DOP DZ:DZD EC:USD EE:EUR EG:EGP EH:MAD ER:ERN ES:EUR ET:ETB FI:EUR FJ:FJD FK:FKP FM:USD FO:DKK FR:EUR
|
||||
GA:XAF GB:GBP GD:XCD GE:GEL GF:EUR GG:GBP GH:GHS GI:GIP GL:DKK GM:GMD GN:GNF GP:EUR GQ:XAF GR:EUR GS:GBP GT:GTQ GU:USD GW:XOF GY:GYD
|
||||
HK:HKD HM:AUD HN:HNL HR:EUR HT:HTG HU:HUF ID:IDR IE:EUR IL:ILS IM:GBP IN:INR IO:USD IQ:IQD IR:IRR IS:ISK IT:EUR
|
||||
JE:GBP JM:JMD JO:JOD JP:JPY KE:KES KG:KGS KH:KHR KI:AUD KM:KMF KN:XCD KP:KPW KR:KRW KW:KWD KY:KYD KZ:KZT
|
||||
LA:LAK LB:LBP LC:XCD LI:CHF LK:LKR LR:LRD LS:LSL LT:EUR LU:EUR LV:EUR LY:LYD
|
||||
MA:MAD MC:EUR MD:MDL ME:EUR MF:EUR MG:MGA MH:USD MK:MKD ML:XOF MM:MMK MN:MNT MO:MOP MP:USD MQ:EUR MR:MRU MS:XCD MT:EUR MU:MUR MV:MVR MW:MWK MX:MXN MY:MYR MZ:MZN
|
||||
NA:NAD NC:XPF NE:XOF NF:AUD NG:NGN NI:NIO NL:EUR NO:NOK NP:NPR NR:AUD NU:NZD NZ:NZD OM:OMR
|
||||
PA:PAB PE:PEN PF:XPF PG:PGK PH:PHP PK:PKR PL:PLN PM:EUR PR:USD PS:ILS PT:EUR PW:USD PY:PYG QA:QAR RE:EUR RO:RON RS:RSD RU:RUB RW:RWF
|
||||
SA:SAR SB:SBD SC:SCR SD:SDG SE:SEK SG:SGD SH:SHP SI:EUR SJ:NOK SK:EUR SL:SLE SM:EUR SN:XOF SO:SOS SR:SRD SS:SSP ST:STN SV:USD SX:XCG SY:SYP SZ:SZL
|
||||
TC:USD TD:XAF TF:EUR TG:XOF TH:THB TJ:TJS TK:NZD TL:USD TM:TMT TN:TND TO:TOP TR:TRY TT:TTD TV:AUD TW:TWD TZ:TZS
|
||||
UA:UAH UG:UGX UM:USD US:USD UY:UYU UZ:UZS VA:EUR VC:XCD VE:VES VG:USD VI:USD VN:VND VU:VUV WF:XPF WS:WST XK:EUR YE:YER YT:EUR ZA:ZAR ZM:ZMW ZW:ZWG`;
|
||||
|
||||
export const REGION_CURRENCY: Readonly<Record<string, string>> = Object.freeze(Object.fromEntries(PAIRS.split(/\s+/).map(pair => pair.split(':') as [string, string])));
|
||||
|
||||
/** The region of each app language that has one region of its own; English and Spanish-speaking countries are many, so only the first is a guess. */
|
||||
export const LANGUAGE_REGION: Readonly<Record<string, string>> = Object.freeze({ zh: 'CN', ja: 'JP', de: 'DE', es: 'ES', ru: 'RU', pt: 'BR', ko: 'KR' });
|
||||
|
||||
export const currencyForRegion = (region: string | null | undefined): string | null => (region ? REGION_CURRENCY[region.toUpperCase()] ?? null : null);
|
||||
|
||||
/** The region in a language tag ("en-US", "de_DE.UTF-8", "zh-Hans-CN"), or null when the tag names none. */
|
||||
export function regionOfLocale(tag: string | null | undefined): string | null {
|
||||
if (!tag) return null;
|
||||
const clean = String(tag).replace(/[.@].*$/, '').replace(/_/g, '-');
|
||||
try {
|
||||
const region = new Intl.Locale(clean).region;
|
||||
return region ?? null;
|
||||
} catch {
|
||||
const found = /-([A-Za-z]{2})(?:-|$)/.exec(clean);
|
||||
return found ? found[1].toUpperCase() : null;
|
||||
}
|
||||
}
|
||||
|
||||
/** What the host read from the system (GET /api/locale). */
|
||||
export interface SystemLocale { locale: string | null; region: string | null; currency: string | null; source: string | null }
|
||||
|
||||
export interface ResolvedCurrency { currency: string | null; locale: string; source: 'system' | 'browser' | 'language' | 'none' }
|
||||
|
||||
/**
|
||||
* The currency to show money in, and the locale to write the number in.
|
||||
* `override` is the currency the person chose in Settings (empty: automatic).
|
||||
*/
|
||||
export function resolveCurrency({ system, browserLanguages = [], language, override = '' }: { system?: SystemLocale | null; browserLanguages?: readonly string[]; language: string; override?: string }): ResolvedCurrency {
|
||||
const appTag = language === 'zh' ? 'zh-CN' : language;
|
||||
const locale = system?.locale ?? browserLanguages.find(tag => regionOfLocale(tag)) ?? browserLanguages[0] ?? appTag;
|
||||
if (/^[A-Za-z]{3}$/.test(override)) return { currency: override.toUpperCase(), locale, source: 'system' };
|
||||
const fromSystem = system?.currency ?? currencyForRegion(system?.region);
|
||||
if (fromSystem) return { currency: fromSystem, locale, source: 'system' };
|
||||
for (const tag of browserLanguages) {
|
||||
const found = currencyForRegion(regionOfLocale(tag));
|
||||
if (found) return { currency: found, locale, source: 'browser' };
|
||||
}
|
||||
const fromLanguage = currencyForRegion(LANGUAGE_REGION[language]);
|
||||
if (fromLanguage) return { currency: fromLanguage, locale, source: 'language' };
|
||||
return { currency: null, locale, source: 'none' };
|
||||
}
|
||||
|
||||
/** How many decimals this currency normally has (2 for dollars and euros, 0 for yen); 2 when there is no currency. */
|
||||
export function minorDigits(currency: string | null, locale: string): number {
|
||||
if (!currency) return 2;
|
||||
try { return new Intl.NumberFormat(locale, { style: 'currency', currency }).resolvedOptions().maximumFractionDigits ?? 2; } catch { return 2; }
|
||||
}
|
||||
|
||||
/**
|
||||
* An amount of money, written for the person's locale with the currency's usual digits ("$0.12", "$1.23", "1,23 €", "¥3").
|
||||
* An amount below the smallest normal unit (one cent; one yen) is not shown as 0.00 or as a long run of decimals but as
|
||||
* "less than $0.01" (`lessThan` writes the sentence in the person's language). With no currency the number is shown alone,
|
||||
* and never in a currency that was only guessed.
|
||||
*/
|
||||
export function formatMoney(amount: number, { currency, locale, lessThan = shown => `less than ${shown}` }: { currency: string | null; locale: string; lessThan?: (shown: string) => string }): string {
|
||||
if (!Number.isFinite(amount) || amount < 0) return '—';
|
||||
const digits = minorDigits(currency, locale), unit = 10 ** -digits;
|
||||
const write = (value: number): string => {
|
||||
try {
|
||||
if (currency) return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(value);
|
||||
} catch { /* an unknown currency code or locale: the number alone */ }
|
||||
try {
|
||||
return new Intl.NumberFormat(locale, { minimumFractionDigits: digits, maximumFractionDigits: digits }).format(value);
|
||||
} catch {
|
||||
return value.toFixed(digits);
|
||||
}
|
||||
};
|
||||
return amount > 0 && amount < unit ? lessThan(write(unit)) : write(amount);
|
||||
}
|
||||
|
||||
/** "USD ($)": the code and its symbol in the person's locale, for the Settings line. */
|
||||
export function currencyLabel(currency: string, locale: string): string {
|
||||
try {
|
||||
const symbol = new Intl.NumberFormat(locale, { style: 'currency', currency, currencyDisplay: 'narrowSymbol' }).formatToParts(0).find(part => part.type === 'currency')?.value;
|
||||
return symbol && symbol !== currency ? `${currency} (${symbol})` : currency;
|
||||
} catch {
|
||||
return currency;
|
||||
}
|
||||
}
|
||||
|
||||
/** Every currency this web view knows, by name, for the override list. */
|
||||
export function currencyChoices(locale: string): { value: string; label: string }[] {
|
||||
let codes: string[] = [];
|
||||
try { codes = (Intl as unknown as { supportedValuesOf?: (key: string) => string[] }).supportedValuesOf?.('currency') ?? []; } catch { /* an older web view */ }
|
||||
let names: Intl.DisplayNames | null = null;
|
||||
try { names = new Intl.DisplayNames([locale], { type: 'currency' }); } catch { /* no names */ }
|
||||
return codes.map(code => ({ value: code, label: `${code} – ${names?.of(code) ?? code}` }));
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/** A number typed by a person: "0.95", ".95", "0,95" (a comma is a decimal point in many languages). null while it is not a whole number yet ("", ".", "0.", "-"). */
|
||||
export function parseDecimal(text: string): number | null {
|
||||
const t = String(text ?? '').trim().replace(',', '.');
|
||||
if (!/^-?(\d+\.?\d*|\.\d+)$/.test(t) || t.endsWith('.')) return null;
|
||||
const n = Number(t);
|
||||
return Number.isFinite(n) ? n : null;
|
||||
}
|
||||
/** Whether what is typed could still become a number: the field keeps it while the person is in the middle of "0." */
|
||||
export const partialDecimal = (text: string) => /^-?\d*[.,]?\d*$/.test(String(text ?? '').trim());
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* DeepSeek-V4.1-Flash's context sizes in the app: 8K up to the pack's own limit (the model reads 1,048,576 positions natively).
|
||||
* Project Maya v1.1.28 (#442, @needmorevram, MIT) offered 512K and 1M the same way. strata_control/dsv41_context.py says the same for setup and the
|
||||
* Terminal (tests/terminal/test_dsv41_context.py compares the two). The engine takes whatever --max-context it is given; the rope settings come from the pack.
|
||||
*/
|
||||
export const CONTEXT_CHOICES = [8192, 32768, 65536, 131072, 262144, 524288, 1048576];
|
||||
/** The largest size not flagged as untested; also how far the list goes while the pack does not say more (a pack without ds4.txt behaves as before). */
|
||||
export const TESTED_CONTEXT = 262144;
|
||||
/** The model's own length: the most any pack can say. */
|
||||
export const NATIVE_CONTEXT = 1048576;
|
||||
export const UNTESTED_NOTE = 'Not tested yet. A context this long takes graphics memory from the model and reads long prompts slowly.';
|
||||
|
||||
/** The sizes to offer: up to the pack's limit (`contextMax`, from its ds4.txt) when the installed model has one, else up to 256K. */
|
||||
export function deepseekContexts(limit?: number | null): number[] {
|
||||
const cap = typeof limit === 'number' && Number.isFinite(limit) && limit > 0 ? limit : TESTED_CONTEXT;
|
||||
return CONTEXT_CHOICES.filter(size => size <= cap);
|
||||
}
|
||||
|
||||
/** An empty string when the size can run; otherwise one sentence (only a size the model cannot address is refused). */
|
||||
export function deepseekContextProblem(context: number, limit?: number | null): string {
|
||||
const cap = typeof limit === 'number' && Number.isFinite(limit) && limit > 0 ? limit : NATIVE_CONTEXT;
|
||||
if (!Number.isInteger(context) || context < 1024) return 'Choose a context of at least 1,024 tokens.';
|
||||
return context > cap ? `A context past ${cap.toLocaleString('en-US')} tokens is more than this model reads.` : '';
|
||||
}
|
||||
|
||||
/** The plain words past 256K, an empty string otherwise. */
|
||||
export const deepseekContextNote = (context: number): string => (context > TESTED_CONTEXT ? UNTESTED_NOTE : '');
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { RunCard } from './native-fit';
|
||||
|
||||
/**
|
||||
* DeepSeek's Speed default, said the way the engine decides it (`--experts auto`, src/dsv41/ds4_experts_rule.hpp): Faster (5 experts a word) when
|
||||
* a card in use is an integrated / unified-memory GPU (Strix Halo, gfx1151: the model shares the PC's memory), or when the cards in use total
|
||||
* 16 GiB or less; otherwise Full quality (6). The app never decides: the engine does; this only names the same default beside the choice.
|
||||
* The total is compared in whole MiB (a 16 GB card reports 16376 MiB = 15.99 GiB and counts as 16 GiB or less).
|
||||
*/
|
||||
export const FASTER_MIB = 16 * 1024;
|
||||
|
||||
export const isIntegrated = (card: RunCard) => !!(card.uma || card.integrated || (card.unified_gb ?? 0) > 0);
|
||||
|
||||
export function fasterByDefault(cards: readonly RunCard[] | null | undefined): boolean {
|
||||
const used = (cards ?? []).filter(card => card.usable !== false);
|
||||
if (!used.length) return false;
|
||||
if (used.some(isIntegrated)) return true;
|
||||
const mib = used.reduce((sum, card) => sum + Math.round((card.vram_gb ?? 0) * 1024), 0);
|
||||
return mib > 0 && mib <= FASTER_MIB;
|
||||
}
|
||||
|
||||
/** The three entries of the Speed select: "Faster" or "Full quality" says "(default on this PC)" when it is what the engine picks by itself. */
|
||||
export function speedOptions(cards: readonly RunCard[] | null | undefined): { value: string; label: string }[] {
|
||||
const faster = fasterByDefault(cards);
|
||||
const mark = ' (default on this PC)';
|
||||
return [
|
||||
{ value: '', label: faster ? 'Default (Faster on this PC)' : 'Default (Full quality on this PC)' },
|
||||
{ value: '5', label: 'Faster' + (faster ? mark : '') },
|
||||
{ value: '6', label: 'Full quality' + (faster ? '' : mark) },
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/** The host's design-mode placeholder for the engine version; it is not an engine anyone installed. */
|
||||
const PLACEHOLDER_ENGINE = /^strata-engine 0\.1\.0$/;
|
||||
/** The engine version the app shows: the installed engine's once the host has read it; until then nothing (never the placeholder). */
|
||||
export function shownEngineVersion(native: { available?: boolean; installed?: { engine?: { version?: string | null } | null } | null } | null | undefined, storeVersion: string | undefined): string | undefined {
|
||||
if (native?.available) return native.installed?.engine?.version ?? undefined;
|
||||
return storeVersion && !PLACEHOLDER_ENGINE.test(storeVersion) ? storeVersion : undefined;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* When a chat follows the newest token, and when the reader has let go (#4014).
|
||||
*
|
||||
* The old rule asked "is the reader within 120 px of the bottom?" on every streamed token and pulled the view
|
||||
* back if so. One wheel notch is about 100 px, so it always landed inside that band and was undone by the next
|
||||
* token; only a scrollbar drag, which jumps further, got away. The rule now follows what the reader did:
|
||||
* a wheel, finger or key moving up lets go at once, and the chat follows again when the reader is back at
|
||||
* the bottom.
|
||||
*/
|
||||
export interface Scroller { scrollHeight: number; scrollTop: number; clientHeight: number }
|
||||
|
||||
/** Pixels of slack that still count as "at the bottom" (the same as `atBottom` in reasoning.ts). */
|
||||
export const FOLLOW_SLACK = 24;
|
||||
/** Past this far from the bottom the "jump to latest" button is offered. */
|
||||
export const PILL_DISTANCE = 400;
|
||||
/** A scroll this soon after the reader's own input was the reader's. */
|
||||
export const INPUT_WINDOW_MS = 400;
|
||||
|
||||
export const distanceFromBottom = (el: Scroller): number => el.scrollHeight - el.scrollTop - el.clientHeight;
|
||||
|
||||
/**
|
||||
* Whether the chat should keep following after a scroll event.
|
||||
* - back at the bottom: follow again;
|
||||
* - the reader moved it (a wheel, finger, key or the scrollbar a moment ago) and it is not at the bottom: let go;
|
||||
* - far away whatever moved it (a jump): let go;
|
||||
* - otherwise (the page grew under a following reader and no input came): keep the state it had.
|
||||
*/
|
||||
export function followAfterScroll(distance: number, wasFollowing: boolean, msSinceInput: number): boolean {
|
||||
if (distance <= FOLLOW_SLACK) return true;
|
||||
if (msSinceInput <= INPUT_WINDOW_MS || distance > PILL_DISTANCE) return false;
|
||||
return wasFollowing;
|
||||
}
|
||||
|
||||
/** A wheel turned up (negative delta) or a finger dragging the content down: the reader wants to go back. */
|
||||
export const wheelLeavesBottom = (deltaY: number): boolean => deltaY < 0;
|
||||
|
||||
/** Keys that move a scroller up. */
|
||||
export const KEYS_UP = new Set(['PageUp', 'ArrowUp', 'Home']);
|
||||
@@ -128,3 +128,6 @@ export function formatModelName(model: {
|
||||
export function userError(message: string): string {
|
||||
return message.replace(/^\s*Fixture:\s*/i, '').replace(/^./, c => c.toUpperCase());
|
||||
}
|
||||
|
||||
/** Decimal megabytes (1 MB = 1,000,000 bytes, at least 1): the same figure as the Terminal and the release page. The only size helper in MB; no binary units. */
|
||||
export const megabytes = (bytes: number) => Math.max(1, Math.round(bytes / 1_000_000));
|
||||
@@ -7,6 +7,7 @@ import tune_es from '../locales/tune-es.json';
|
||||
import tune_ru from '../locales/tune-ru.json';
|
||||
import tune_pt from '../locales/tune-pt.json';
|
||||
import tune_ko from '../locales/tune-ko.json';
|
||||
import tune_fr from '../locales/tune-fr.json';
|
||||
import tools_en from '../locales/tools-en.json';
|
||||
import tools_zh from '../locales/tools-zh.json';
|
||||
import tools_ja from '../locales/tools-ja.json';
|
||||
@@ -15,6 +16,26 @@ import tools_es from '../locales/tools-es.json';
|
||||
import tools_ru from '../locales/tools-ru.json';
|
||||
import tools_pt from '../locales/tools-pt.json';
|
||||
import tools_ko from '../locales/tools-ko.json';
|
||||
import tools_fr from '../locales/tools-fr.json';
|
||||
import fix_en from '../locales/fix-en.json';
|
||||
import fix_zh from '../locales/fix-zh.json';
|
||||
import fix_ja from '../locales/fix-ja.json';
|
||||
import fix_de from '../locales/fix-de.json';
|
||||
import fix_es from '../locales/fix-es.json';
|
||||
import fix_ru from '../locales/fix-ru.json';
|
||||
import fix_pt from '../locales/fix-pt.json';
|
||||
import fix_ko from '../locales/fix-ko.json';
|
||||
import fix_fr from '../locales/fix-fr.json';
|
||||
/* The strings of the 0.2.7 GitHub items (gh-<lang>.json, scripts/make-gh-locales.py). */
|
||||
import gh_en from '../locales/gh-en.json';
|
||||
import gh_zh from '../locales/gh-zh.json';
|
||||
import gh_ja from '../locales/gh-ja.json';
|
||||
import gh_de from '../locales/gh-de.json';
|
||||
import gh_es from '../locales/gh-es.json';
|
||||
import gh_ru from '../locales/gh-ru.json';
|
||||
import gh_pt from '../locales/gh-pt.json';
|
||||
import gh_ko from '../locales/gh-ko.json';
|
||||
import gh_fr from '../locales/gh-fr.json';
|
||||
import base_zh from '../locales/zh.json';
|
||||
import base_ja from '../locales/ja.json';
|
||||
import base_de from '../locales/de.json';
|
||||
@@ -22,14 +43,16 @@ import base_es from '../locales/es.json';
|
||||
import base_ru from '../locales/ru.json';
|
||||
import base_pt from '../locales/pt.json';
|
||||
import base_ko from '../locales/ko.json';
|
||||
import base_fr from '../locales/fr.json';
|
||||
|
||||
export const LANGUAGES=[{value:'en',label:'English'},{value:'zh',label:'中文(简体)'},{value:'ja',label:'日本語'},{value:'de',label:'Deutsch'},{value:'es',label:'Español'},{value:'ru',label:'Русский'},{value:'pt',label:'Português'},{value:'ko',label:'한국어'}] as const;
|
||||
export const LANGUAGES=[{value:'en',label:'English'},{value:'zh',label:'中文(简体)'},{value:'ja',label:'日本語'},{value:'de',label:'Deutsch'},{value:'fr',label:'Français'},{value:'es',label:'Español'},{value:'ru',label:'Русский'},{value:'pt',label:'Português'},{value:'ko',label:'한국어'}] as const;
|
||||
export type Language=typeof LANGUAGES[number]['value'];
|
||||
/* The Tune model dialog's strings live in tune-<lang>.json (apps/host/scripts/make-tune-locales.py) so other interface work does not collide with them. */
|
||||
/* The tool-server, picture and agent-result strings of the tools and images fixes live in tools-<lang>.json for the same reason. */
|
||||
const english:Record<string,string>={...baseEnglish,...tune_en,...tools_en};
|
||||
const [zh,ja,de,es,ru,pt,ko]=[{...base_zh,...tune_zh,...tools_zh},{...base_ja,...tune_ja,...tools_ja},{...base_de,...tune_de,...tools_de},{...base_es,...tune_es,...tools_es},{...base_ru,...tune_ru,...tools_ru},{...base_pt,...tune_pt,...tools_pt},{...base_ko,...tune_ko,...tools_ko}] as Record<string,string>[];
|
||||
const catalogs:Record<Language,Record<string,string>>={en:english,zh,ja,de,es,ru,pt,ko};
|
||||
/* The strings that had no key in the files above (#3479, #3825) and the 0.2.4.3 fixes live in fix-<lang>.json (scripts/make-fix-locales.py). */
|
||||
const english:Record<string,string>={...baseEnglish,...tune_en,...tools_en,...fix_en,...gh_en};
|
||||
const [zh,ja,de,es,ru,pt,ko,fr]=[{...base_zh,...tune_zh,...tools_zh,...fix_zh,...gh_zh},{...base_ja,...tune_ja,...tools_ja,...fix_ja,...gh_ja},{...base_de,...tune_de,...tools_de,...fix_de,...gh_de},{...base_es,...tune_es,...tools_es,...fix_es,...gh_es},{...base_ru,...tune_ru,...tools_ru,...fix_ru,...gh_ru},{...base_pt,...tune_pt,...tools_pt,...fix_pt,...gh_pt},{...base_ko,...tune_ko,...tools_ko,...fix_ko,...gh_ko},{...base_fr,...tune_fr,...tools_fr,...fix_fr,...gh_fr}] as Record<string,string>[];
|
||||
const catalogs:Record<Language,Record<string,string>>={en:english,zh,ja,de,fr,es,ru,pt,ko};
|
||||
const entities:Record<string,string>={amp:'&',lt:'<',gt:'>',quot:'"',apos:"'",nbsp:'\u00a0'};
|
||||
const decode=(text:string)=>text.replace(/&(#x[\da-f]+|#\d+|amp|lt|gt|quot|apos|nbsp);/gi,(whole,key:string)=>key[0]==='#'?String.fromCodePoint(key[1].toLowerCase()==='x'?parseInt(key.slice(2),16):parseInt(key.slice(1),10)):entities[key]??whole);
|
||||
const ids=new Map(Object.entries(english).map(([id,value])=>[decode(value),id]));
|
||||
@@ -45,7 +68,7 @@ const patterns=Object.entries(english).filter(([,value])=>/\{\d+\}/.test(value))
|
||||
expression+=escape(value.slice(at));
|
||||
return{id,slots,pattern:new RegExp('^'+expression+'$'),specificity:value.replace(/\{\d+\}/g,'').length};
|
||||
}).sort((a,b)=>b.specificity-a.specificity);
|
||||
const localizedTemplateSlots:Record<string,number[]>={s2473:[1,2],s0825:[0,1],s2455:[0],s2456:[0],s7400:[1]};
|
||||
const localizedTemplateSlots:Record<string,number[]>={s1242:[0],s2473:[1,2],s0825:[0,1],s2455:[0],s2456:[0],s7400:[1]};
|
||||
|
||||
/** Translate interface copy only. Non-string React children pass through unchanged. */
|
||||
export function tr<T>(value:T,values?:readonly unknown[]):T{
|
||||
|
||||
@@ -22,3 +22,9 @@ export function pickerGroups(library: ModelLibrary) {
|
||||
}
|
||||
return Array.from(groups, ([family, versions]) => ({ family, versions }));
|
||||
}
|
||||
|
||||
/** Optimized models that are on this PC but not loaded yet: the chat picker must list them, or it says "none downloaded" while Storage shows them (#3814). */
|
||||
export function pickerNativeModels<M extends { model: string; model_name?: string; ready?: boolean }>(installed: M[] | undefined | null, instances: { label: string }[] | undefined | null): M[] {
|
||||
const loaded = new Set((instances ?? []).map(i => i.label));
|
||||
return (installed ?? []).filter(m => m.ready !== false && !loaded.has(m.model_name ?? m.model));
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { tr } from './i18n';
|
||||
import { api } from './client';
|
||||
import { formatMoney, resolveCurrency, type ResolvedCurrency, type SystemLocale } from './currency';
|
||||
import { useStore } from './store';
|
||||
|
||||
let asked: Promise<SystemLocale | null> | null = null;
|
||||
|
||||
/** The computer's regional format, read once from the host (null in a browser build that has none, or while it loads). */
|
||||
export function useSystemLocale(): SystemLocale | null {
|
||||
const [value, setValue] = useState<SystemLocale | null>(null);
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
asked ??= api.get<SystemLocale>('/api/locale').catch(() => null);
|
||||
void asked.then(v => { if (alive) setValue(v); });
|
||||
return () => { alive = false; };
|
||||
}, []);
|
||||
return value;
|
||||
}
|
||||
|
||||
/** The person's currency and locale for money (#3628) and a function that writes an amount in them. */
|
||||
export function useMoney(): ResolvedCurrency & { format: (amount: number) => string; detected: string | null } {
|
||||
const system = useSystemLocale(), language = useStore(s => s.language), override = useStore(s => s.electricityCurrency);
|
||||
const browserLanguages = typeof navigator === 'undefined' ? [] : [...(navigator.languages ?? [navigator.language])].filter(Boolean);
|
||||
const resolved = resolveCurrency({ system, browserLanguages, language, override });
|
||||
const detected = override ? resolveCurrency({ system, browserLanguages, language }).currency : resolved.currency;
|
||||
return { ...resolved, detected, format: amount => formatMoney(amount, { ...resolved, lessThan: shown => tr('less than {0}', [shown]) }) };
|
||||
}
|
||||
@@ -13,7 +13,32 @@ export function gpuMetric(devices:GpuInfo[],readings:GpuReading[]|undefined,key:
|
||||
return mode==='max'?Math.max(...values):values.reduce((n,v)=>n+v,0)/(mode==='mean'?values.length:1);
|
||||
}
|
||||
|
||||
/** The card's name without its maker: "NVIDIA GeForce RTX 5070" -> "RTX 5070". */
|
||||
export const shortGpuName=(name:string)=>String(name??'').replace(/^(NVIDIA|AMD|Intel)(\(R\)|\(TM\))?\s+/i,'').replace(/^(GeForce|Radeon|Arc)(\(TM\))?\s+/i,'').trim()||String(name??'');
|
||||
|
||||
/**
|
||||
* The reading over the cards that DO report this value. A card that cannot report it (an integrated one without a temperature sensor) is left
|
||||
* out instead of blanking the figure; `partial` says some were left out, and `devices` names the cards the figure is from.
|
||||
*/
|
||||
export function gpuReported(devices:GpuInfo[],readings:GpuReading[]|undefined,key:keyof GpuReading,mode:'sum'|'mean'|'max'='sum'):{value:number|null;devices:GpuInfo[];partial:boolean} {
|
||||
const reporting=devices.filter(device=>hasReading(readings?.find(reading=>reading.id===gpuId(device))?.[key]));
|
||||
return {value:reporting.length?gpuMetric(reporting,readings,key,mode):null,devices:reporting,partial:reporting.length>0&&reporting.length<devices.length};
|
||||
}
|
||||
|
||||
export function gpuCapacity(devices:GpuInfo[]) {
|
||||
const shared=devices.filter(g=>g.unified).map(g=>g.vramGb);
|
||||
return devices.filter(g=>!g.unified).reduce((n,g)=>n+g.vramGb,0)+(shared.length?Math.max(...shared):0);
|
||||
}
|
||||
|
||||
/**
|
||||
* The cards "All GPUs" covers by default. A small integrated chip (an AMD or Intel adapter on the Windows/Vulkan list with a carve-out under
|
||||
* 2 GB) beside a real card is left out: Strata cannot run a model on it (the native engine report marks it unusable), and counting it adds a
|
||||
* second "GPU" and half a gigabyte to every total. It stays in the picker. Alone (a Strix Halo, an iGPU-only PC) it stays the default.
|
||||
*/
|
||||
export function defaultGpuSet(devices:GpuInfo[]):GpuInfo[] {
|
||||
const real=(g:GpuInfo)=>g.vramGb>=4||g.vendor==='nvidia'||g.backend==='cuda';
|
||||
const small=(g:GpuInfo)=>g.backend==='vulkan'&&(g.vendor==='amd'||g.vendor==='intel')&&g.vramGb<2&&!g.unified;
|
||||
if(!devices.some(real))return devices;
|
||||
const kept=devices.filter(g=>!small(g));
|
||||
return kept.length?kept:devices;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import {tr} from './i18n';
|
||||
import {nvfp4Version} from './native-names';
|
||||
export interface CatalogVersion extends NativeSize{sourceFamily:string;edition:string;images:boolean}
|
||||
export interface CatalogModel extends Omit<NativeFamily,'sizes'>{sizes:CatalogVersion[]}
|
||||
export function nativeVersionLabel(model:string){const nv=nvfp4Version(model);if(nv)return tr(nv.name);return tr(({Q2_0:'Fastest',IQ2_XS:'Compact',IQ3_XXS:'Balanced',IQ3_S:'High quality',IQ1_M:'Coding','Gyro-S':'Smallest','Gyro-M':'Small memory'} as Record<string,string>)[model]??model);}
|
||||
export function nativeVersionLabel(model:string){const nv=nvfp4Version(model);if(nv)return tr(nv.name);return tr(({Q2_0:'Fastest',IQ2_XS:'Compact',IQ3_XXS:'Balanced',IQ3_S:'High quality',IQ1_M:'Coding','Gyro-S':'Smallest','Gyro-M':'Small memory','IST-DAS-1.75bpw':'Smallest','IST-DAS-2.00bpw':'Balanced','IST-DAS-2.25bpw':'Best quality'} as Record<string,string>)[model]??model);}
|
||||
export const catalogVersionLabel=(version:CatalogVersion)=>{const label=nativeVersionLabel(version.model);return [tr(version.edition),label===version.model&&version.edition?'':label].filter(Boolean).join(' · ');};
|
||||
/** The one line that says how a version differs from its neighbours (the three NVFP4 versions); empty for the rest. */
|
||||
export const versionNote=(model:string)=>{const nv=nvfp4Version(model);return nv?tr(nv.note):'';};
|
||||
@@ -12,6 +12,7 @@ export function nativeCatalogModels(families:NativeFamily[]):CatalogModel[]{
|
||||
if(!families.length)return[];
|
||||
const groups:CatalogModel[]=[{family:'qwen3.8',title:'Qwen3.8-Flash-Next',about:'',experimental:false,images:false,sizes:[]},{family:'qwen3.6',title:'Qwen3.6-35B-A3B',about:'',experimental:false,images:false,sizes:[]}];
|
||||
for(const family of families){
|
||||
if(family.family==='deepseek41'){const sizes=family.sizes.filter(size=>!/^UD-Q8/i.test(size.model));if(sizes.length)groups.push({family:'deepseek41',title:family.title||'DeepSeek-V4.1-Flash',about:family.about??'',experimental:false,images:false,sizes:sizes.map(size=>({...size,sourceFamily:family.family,edition:'',images:false}))});continue;}
|
||||
const target=/qwen3[._-]?6|35b[-_]?a3b/i.test(family.title+' '+family.family)?groups[1]:['qwen','swift','coder','unsloth','gyro'].includes(family.family)||/qwen3[._-]?8|flash.next/i.test(family.title)?groups[0]:undefined;
|
||||
if(!target)continue;
|
||||
const edition=target===groups[0]?({swift:'Swift 1.5',coder:'Coder',unsloth:'Unsloth',gyro:'Gyro'} as Record<string,string>)[family.family]??'':'';
|
||||
|
||||
@@ -30,16 +30,27 @@ export function memoryNeeded(v: FitInput): number {
|
||||
return round1((v.experts_gb ?? v.ram_needed_gb ?? 0) + DENSE_EXTRA_GB);
|
||||
}
|
||||
|
||||
export function fitOn(v: FitInput, hw: FitHardware | null | undefined, mtp = true): Fit {
|
||||
/** The conversation cache of Flash-Next: 13 attention layers, bytes per token per layer by cache format, 5.4% over the bare cache
|
||||
* (strata_control/vram_fit.py KV_BYTES, KV_MEASURED_FACTOR; setup.py UD_FIT_KV_BYTES). */
|
||||
const KV_BYTES: Record<string, number> = { fp16: 2112, int8: 1056, q4_0: 576, k8v4: 816 };
|
||||
const KV_LAYERS = 13, KV_FACTOR = 1.054, BASE_CONTEXT = 32768;
|
||||
export function cacheGb(context: number, kv = 'int8'): number {
|
||||
return (121 + context * KV_LAYERS * (KV_BYTES[String(kv).toLowerCase()] ?? KV_BYTES.int8) * KV_FACTOR / 2 ** 20) / 1024; // 121 MiB fixed per session
|
||||
}
|
||||
export interface CacheChoice { context: number; kv?: string }
|
||||
|
||||
export function fitOn(v: FitInput, hw: FitHardware | null | undefined, mtp = true, cache?: CacheChoice | null): Fit {
|
||||
const memoryGb = memoryNeeded(v);
|
||||
// DENSE_GB already holds a 32K cache in the default format; the person's context and format replace it (#3832).
|
||||
const denseGb = cache && cache.context > 0 ? Math.max(DENSE_GB - cacheGb(BASE_CONTEXT), 0) + cacheGb(cache.context, cache.kv) : DENSE_GB;
|
||||
const ram = Number(hw?.ram_gb), vram = Number(hw?.vram_gb) || 0;
|
||||
if (!Number.isFinite(ram) || ram <= 0) return { memoryGb, vramUseGb: 0, ramUseGb: 0, spillGb: 0, known: false };
|
||||
const experts = Math.max(0, memoryNeeded(v) - DENSE_EXTRA_GB);
|
||||
const onGpu = Math.max(0, Math.min(experts, vram - DENSE_GB - (mtp && vram > 0 ? MTP_VRAM_GB : 0)));
|
||||
const onGpu = Math.max(0, Math.min(experts, vram - denseGb - (mtp && vram > 0 ? MTP_VRAM_GB : 0)));
|
||||
const ramRoom = Math.max(0, ram - SYSTEM_ROOM_GB);
|
||||
const spillGb = Math.max(0, experts - onGpu - ramRoom);
|
||||
const inRam = Math.max(0, experts - onGpu - spillGb);
|
||||
const vramUseGb = vram > 0 ? Math.min(vram, DENSE_GB + (mtp ? MTP_VRAM_GB : 0) + onGpu) : 0;
|
||||
const vramUseGb = vram > 0 ? Math.min(vram, denseGb + (mtp ? MTP_VRAM_GB : 0) + onGpu) : 0;
|
||||
return { memoryGb, vramUseGb: round1(vramUseGb), ramUseGb: round1(inRam + DENSE_EXTRA_GB * (vram > 0 ? 0 : 1)), spillGb: round1(spillGb), known: true };
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,9 @@ export function withHostSensors(live:MonitorState,host:MonitorState|null):Monito
|
||||
const empty=(g:GpuReading)=>![g.utilizationPct,g.temperatureC,g.memoryUsedGb,g.powerW].some(hasReading);
|
||||
const pick=<T,>(a:T,b:T)=>hasReading(a as unknown)?a:b;
|
||||
return {...live,hardware:{...h,
|
||||
gpus:(h.gpus??[]).map(g=>{const sensor=s.gpus?.find(x=>x.id===g.id);return sensor&&empty(g)?{...g,...sensor}:g;}),
|
||||
// The fan and the clock are the host's own readings; the engine's metrics do not carry them (#3628).
|
||||
gpus:(h.gpus??[]).map(g=>{const sensor=s.gpus?.find(x=>x.id===g.id);const own=sensor&&empty(g)?{...g,...sensor}:g;return sensor?{...own,fanPct:own.fanPct??sensor.fanPct,clockMhz:own.clockMhz??sensor.clockMhz}:own;}),
|
||||
cpuTempC:s.cpuTempC,ssdTempC:s.ssdTempC,energyWh:s.energyWh,
|
||||
gpuLoad:pick(h.gpuLoad,s.gpuLoad),vramUsedGb:pick(h.vramUsedGb,s.vramUsedGb),vramTotalGb:pick(h.vramTotalGb,s.vramTotalGb),gpuTempC:pick(h.gpuTempC,s.gpuTempC),
|
||||
powerW:pick(h.powerW,s.powerW),powerLimitW:pick(h.powerLimitW,s.powerLimitW),pcieRxMbs:pick(h.pcieRxMbs,s.pcieRxMbs)}};
|
||||
}
|
||||
@@ -3,18 +3,22 @@ import { api } from './client';
|
||||
import type { Hardware, RuntimeModels } from './types';
|
||||
export interface GpuChoiceOption {key:string;cards:number[];label:string;verdict:'fits'|'tight'|'spills'|'unknown';words:string;notes:string[];recommended:boolean}
|
||||
export interface GpuChoice {options:GpuChoiceOption[];recommended:string|null;ignored:{name?:string;why_ignored:string}[];cards:number}
|
||||
export interface NativeSize {/** The first engine that reads this size's files (the catalog), and whether the installed engine is older: the screen then says "needs a newer engine" and offers the update. */engine_min?:string|null;needsNewerEngine?:boolean;id:string;model:string;about:string;download_gb:number;ram_needed_gb:number;experts_gb:number;on_this_pc:string|null;installed:boolean;gpu_options?:GpuChoice|null;images?:boolean;imagesCapable?:boolean}
|
||||
export interface NativeSize {/** The first engine that reads this size's files (the catalog), and whether the installed engine is older: the screen then says "needs a newer engine" and offers the update. */engine_min?:string|null;needsNewerEngine?:boolean;id:string;model:string;about:string;download_gb:number;ram_needed_gb:number;experts_gb:number;on_this_pc:string|null;installed:boolean;gpu_options?:GpuChoice|null;images?:boolean;imagesCapable?:boolean;/** DeepSeek-V4.1-Flash and the like: several big files and an engine of their own. */multi_file?:boolean;/** DeepSeek: the free disk the set needs (its download plus the pack and room to work), from the set itself. */disk_gb?:number}
|
||||
export interface NativeFamily {family:string;title:string;about:string;experimental:boolean;images:boolean;sizes:NativeSize[]}
|
||||
export interface NativeField {id:string;label:string;group:string;type:'number'|'boolean'|'string'|'enum'|'array';min?:number;max?:number;choices?:string[];hint?:string;supported?:boolean}
|
||||
export interface NativeField {id:string;label:string;group:string;type:'number'|'boolean'|'string'|'enum'|'array';min?:number;max?:number;choices?:string[];hint?:string;supported?:boolean;forModel?:string}
|
||||
export interface NativeJob {id:string;kind:string;guided?:boolean;model?:string;family?:string;state:'running'|'done'|'error'|'cancelled';startedAt:string;summary:string;error:string|null;details?:string;result:Record<string,any>|null;progress?:Record<string,any>|null}
|
||||
export interface NativeInstance {id:string;apiModelId:string;model:string;label:string;aliases?:string[];vision?:boolean;resourceProfile?:'work'|'performance'|null;context?:number;port:number;gpus:number[];status:'loading'|'ready'|'unloading'|'error';phase:string;loadedAt:string;error:string|null;metrics:Record<string,any>|null}
|
||||
export interface NativeState {
|
||||
/** The picture reader (strata-vision) is installed with the engine, so models marked for pictures can read them here. */
|
||||
/** Strata Control's view of the engine for this computer (the app): usable false = none found or recognised; `notice` says why in plain words. */
|
||||
engine?:{usable:boolean;notice?:string|null;wrongMake?:boolean;version?:string|null};
|
||||
visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;/** Free bytes on the drive that holds the models folder. */downloadFreeBytes?:number|null;downloadTotalBytes?:number|null;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';/** The Drafting choice saved with the model: auto | mtp | dflash2 | off. */drafting?:string;dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;/** SMs x clock: only the order between cards matters (strata_control/gpu_roles.py). */speed?:number;vendor?:string;uma?:boolean;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{/** The engine serves DFlash2 (Control says): the Drafting choice then offers it. */dflash2?:boolean;responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
|
||||
visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;/** Free bytes on the drive that holds the models folder. */downloadFreeBytes?:number|null;downloadTotalBytes?:number|null;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';/** The Drafting choice saved with the model: auto | mtp | dflash2 | off. */drafting?:string;/** DeepSeek: the most context its pack reads (max_position_embeddings in the pack's ds4.txt); absent when the pack does not say. */contextMax?:number;dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;/** SMs x clock: only the order between cards matters (strata_control/gpu_roles.py). */speed?:number;vendor?:string;uma?:boolean;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{/** The engine serves DFlash2 (Control says): the Drafting choice then offers it. */dflash2?:boolean;responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
|
||||
let state:NativeState|null=null;
|
||||
const listeners=new Set<()=>void>();
|
||||
/** True once the first read of the native state has ended, whatever its answer: until then the Models page must not pick a model of its own (#3740). */
|
||||
let settled=false;
|
||||
export const nativeSettled=()=>settled;
|
||||
export function subscribeNative(fn:()=>void){listeners.add(fn);return()=>{listeners.delete(fn);};}
|
||||
function put(value:NativeState){if(state&&JSON.stringify(state)===JSON.stringify(value))return;state=value;listeners.forEach(fn=>fn());}
|
||||
/** The host pushes its whole native state (jobs included) at every progress step: the page shows it at once, without waiting for the next poll. */
|
||||
export function applyNativeEvent(value:unknown){if(value&&typeof value==='object'&&'available' in value&&'jobs' in value)put(value as NativeState);}
|
||||
@@ -24,7 +28,7 @@ function read(force:boolean):Promise<void>{
|
||||
// A read that never answers must not freeze the page: after the limit the next poll starts a fresh one.
|
||||
let stop:ReturnType<typeof setTimeout>|undefined;
|
||||
const limit=new Promise<never>((_,reject)=>{stop=setTimeout(()=>reject(new Error('The host did not answer in time.')),READ_LIMIT_MS);});
|
||||
return Promise.race([request,limit]).then(put).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>clearTimeout(stop));
|
||||
return Promise.race([request,limit]).then(put).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>{clearTimeout(stop);if(!settled){settled=true;listeners.forEach(fn=>fn());}});
|
||||
}
|
||||
/* Two kinds of read that never wait for each other: the light poll (the host answers at once with the jobs it holds) and the forced read after an action (the host
|
||||
re-reads the installation, which can take many seconds while a download is writing). A slow forced read used to hold every later poll, so a running download looked stuck. */
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/** The pictures on the clipboard, named so each one is told apart in the composer (a pasted screenshot arrives as "image.png"). */
|
||||
export function pastedFiles(data: DataTransfer | null | undefined): File[] {
|
||||
const out: File[] = [];
|
||||
const found: File[] = Array.from(data?.files ?? []);
|
||||
// A screenshot from the clipboard (Win+Shift+S) often comes as an item and not in `files` (#3748).
|
||||
if (!found.some(f => f.type.startsWith('image/'))) {
|
||||
for (const item of Array.from(data?.items ?? [])) {
|
||||
if (item.kind !== 'file' || !item.type.startsWith('image/')) continue;
|
||||
const file = item.getAsFile();
|
||||
if (file) found.push(file);
|
||||
}
|
||||
}
|
||||
for (const file of found) {
|
||||
if (!file.type.startsWith('image/')) continue;
|
||||
const extension = file.type.split('/')[1]?.replace('jpeg', 'jpg').replace(/[+].*/, '') || 'png';
|
||||
out.push(new File([file], `Pasted picture ${new Date().toLocaleTimeString().replace(/[^0-9]+/g, '-').replace(/-$/, '')}${out.length ? `-${out.length + 1}` : ''}.${extension}`, { type: file.type }));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Loaded 100 of 657 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user