@llmnative/react 1.27.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2341 -2074
- package/dist/index.mjs.map +1 -1
- package/dist/server-BFQ0FDEk.js +2 -0
- package/dist/server-BFQ0FDEk.js.map +1 -0
- package/dist/server-BYI2zjyG.mjs +107 -0
- package/dist/server-BYI2zjyG.mjs.map +1 -0
- package/dist/server.js +1 -2
- package/dist/server.mjs +3 -41
- package/dist/types/src/Config.d.ts +5 -0
- package/dist/types/src/Theme.d.ts +3 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/providers/ai/server.d.ts +2 -0
- package/dist/types/src/providers/auth/github/GitHubAuthProvider.d.ts +38 -0
- package/dist/types/src/providers/auth/github/githubOAuth.d.ts +43 -0
- package/dist/types/src/providers/manifest.d.ts +3 -2
- package/dist/types/themes/vscode-dark-modern.d.ts +3 -0
- package/dist/types/themes/vscode-light-modern.d.ts +3 -0
- package/dist/vite.js +2 -2
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1 -1
- package/llms-full.txt +29 -3
- package/package.json +1 -1
- package/scripts/cli/setup-project.js +1 -0
- package/themes/default.ts +2 -0
- package/themes/tokyo-night-light.ts +41 -19
- package/themes/tokyo-night.ts +41 -19
- package/themes/vscode-dark-modern.ts +60 -0
- package/themes/vscode-dark-plus.ts +41 -10
- package/themes/vscode-light-modern.ts +60 -0
- package/themes/vscode-light-plus.ts +41 -10
- package/dist/server.js.map +0 -1
- package/dist/server.mjs.map +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Generated by scripts/themes/compile-vscode-themes.js from the VS Code themes
|
|
2
|
+
// "Tokyo Night Light" (light) and "Tokyo Night" (dark). Do not edit: change the sources or the compiler.
|
|
1
3
|
import baseTheme from './default';
|
|
2
4
|
import type { ThemeDefinition } from '../src/Theme';
|
|
3
5
|
|
|
@@ -9,28 +11,48 @@ const definition: ThemeDefinition = {
|
|
|
9
11
|
colors: {
|
|
10
12
|
...baseTheme.preset.colors,
|
|
11
13
|
...{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
background: '231.4 16.3% 91.6%',
|
|
15
|
+
foreground: '228.6 26.2% 27.6%',
|
|
16
|
+
canvas: '226.7 12.3% 85.7%',
|
|
17
|
+
card: '231.4 16.3% 91.6%',
|
|
18
|
+
cardForeground: '228.6 26.2% 27.6%',
|
|
19
|
+
popover: '226.7 12.3% 85.7%',
|
|
20
|
+
popoverForeground: '224.3 17.6% 25.7%',
|
|
21
|
+
primary: '217.7 46.1% 48%',
|
|
22
|
+
primaryForeground: '0 0% 100%',
|
|
23
|
+
secondary: '232.5 6.7% 47.1%',
|
|
24
|
+
secondaryForeground: '224.3 17.6% 25.7%',
|
|
25
|
+
muted: '231.4 13.2% 89.6%',
|
|
26
|
+
mutedForeground: '232.5 6.7% 47.1%',
|
|
27
|
+
accent: '231.4 13.2% 89.6%',
|
|
28
|
+
accentForeground: '224.3 17.6% 25.7%',
|
|
29
|
+
border: '230 5.1% 76.9%',
|
|
30
|
+
input: '230 5.1% 76.9%',
|
|
31
|
+
ring: '226.7 10.1% 82.5%'
|
|
32
|
+
},
|
|
30
33
|
},
|
|
31
34
|
dark: {
|
|
32
35
|
...baseTheme.preset.dark,
|
|
33
|
-
...{
|
|
36
|
+
...{
|
|
37
|
+
background: '235 18.8% 12.5%',
|
|
38
|
+
foreground: '229.3 35.4% 75.1%',
|
|
39
|
+
canvas: '240 15.4% 10.2%',
|
|
40
|
+
card: '235 18.8% 12.5%',
|
|
41
|
+
cardForeground: '229.3 35.4% 75.1%',
|
|
42
|
+
popover: '240 15.4% 10.2%',
|
|
43
|
+
popoverForeground: '232.7 13.9% 53.5%',
|
|
44
|
+
primary: '223.1 44.3% 39.4%',
|
|
45
|
+
primaryForeground: '0 0% 100%',
|
|
46
|
+
secondary: '232.2 16.3% 27.6%',
|
|
47
|
+
secondaryForeground: '232.7 13.9% 53.5%',
|
|
48
|
+
muted: '240 15.6% 8.8%',
|
|
49
|
+
mutedForeground: '230.3 16.1% 37.8%',
|
|
50
|
+
accent: '240 15.6% 8.8%',
|
|
51
|
+
accentForeground: '229.3 35.4% 75.1%',
|
|
52
|
+
border: '240 11.1% 7.1%',
|
|
53
|
+
input: '240 14.3% 6.9%',
|
|
54
|
+
ring: '233.3 19.1% 18.4%'
|
|
55
|
+
},
|
|
34
56
|
},
|
|
35
57
|
},
|
|
36
58
|
};
|
package/themes/tokyo-night.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Generated by scripts/themes/compile-vscode-themes.js from the VS Code themes
|
|
2
|
+
// "Tokyo Night Light" (light) and "Tokyo Night" (dark). Do not edit: change the sources or the compiler.
|
|
1
3
|
import baseTheme from './default';
|
|
2
4
|
import type { ThemeDefinition } from '../src/Theme';
|
|
3
5
|
|
|
@@ -8,29 +10,49 @@ const definition: ThemeDefinition = {
|
|
|
8
10
|
mode: 'dark',
|
|
9
11
|
colors: {
|
|
10
12
|
...baseTheme.preset.colors,
|
|
11
|
-
...{
|
|
13
|
+
...{
|
|
14
|
+
background: '231.4 16.3% 91.6%',
|
|
15
|
+
foreground: '228.6 26.2% 27.6%',
|
|
16
|
+
canvas: '226.7 12.3% 85.7%',
|
|
17
|
+
card: '231.4 16.3% 91.6%',
|
|
18
|
+
cardForeground: '228.6 26.2% 27.6%',
|
|
19
|
+
popover: '226.7 12.3% 85.7%',
|
|
20
|
+
popoverForeground: '224.3 17.6% 25.7%',
|
|
21
|
+
primary: '217.7 46.1% 48%',
|
|
22
|
+
primaryForeground: '0 0% 100%',
|
|
23
|
+
secondary: '232.5 6.7% 47.1%',
|
|
24
|
+
secondaryForeground: '224.3 17.6% 25.7%',
|
|
25
|
+
muted: '231.4 13.2% 89.6%',
|
|
26
|
+
mutedForeground: '232.5 6.7% 47.1%',
|
|
27
|
+
accent: '231.4 13.2% 89.6%',
|
|
28
|
+
accentForeground: '224.3 17.6% 25.7%',
|
|
29
|
+
border: '230 5.1% 76.9%',
|
|
30
|
+
input: '230 5.1% 76.9%',
|
|
31
|
+
ring: '226.7 10.1% 82.5%'
|
|
32
|
+
},
|
|
12
33
|
},
|
|
13
34
|
dark: {
|
|
14
35
|
...baseTheme.preset.dark,
|
|
15
36
|
...{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
background: '235 18.8% 12.5%',
|
|
38
|
+
foreground: '229.3 35.4% 75.1%',
|
|
39
|
+
canvas: '240 15.4% 10.2%',
|
|
40
|
+
card: '235 18.8% 12.5%',
|
|
41
|
+
cardForeground: '229.3 35.4% 75.1%',
|
|
42
|
+
popover: '240 15.4% 10.2%',
|
|
43
|
+
popoverForeground: '232.7 13.9% 53.5%',
|
|
44
|
+
primary: '223.1 44.3% 39.4%',
|
|
45
|
+
primaryForeground: '0 0% 100%',
|
|
46
|
+
secondary: '232.2 16.3% 27.6%',
|
|
47
|
+
secondaryForeground: '232.7 13.9% 53.5%',
|
|
48
|
+
muted: '240 15.6% 8.8%',
|
|
49
|
+
mutedForeground: '230.3 16.1% 37.8%',
|
|
50
|
+
accent: '240 15.6% 8.8%',
|
|
51
|
+
accentForeground: '229.3 35.4% 75.1%',
|
|
52
|
+
border: '240 11.1% 7.1%',
|
|
53
|
+
input: '240 14.3% 6.9%',
|
|
54
|
+
ring: '233.3 19.1% 18.4%'
|
|
55
|
+
},
|
|
34
56
|
},
|
|
35
57
|
},
|
|
36
58
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Generated by scripts/themes/compile-vscode-themes.js from the VS Code themes
|
|
2
|
+
// "Light Modern" (light) and "Dark Modern" (dark). Do not edit: change the sources or the compiler.
|
|
3
|
+
import baseTheme from './default';
|
|
4
|
+
import type { ThemeDefinition } from '../src/Theme';
|
|
5
|
+
|
|
6
|
+
const definition: ThemeDefinition = {
|
|
7
|
+
...baseTheme,
|
|
8
|
+
preset: {
|
|
9
|
+
...baseTheme.preset,
|
|
10
|
+
mode: 'dark',
|
|
11
|
+
colors: {
|
|
12
|
+
...baseTheme.preset.colors,
|
|
13
|
+
...{
|
|
14
|
+
background: '0 0% 100%',
|
|
15
|
+
foreground: '0 0% 23.1%',
|
|
16
|
+
canvas: '0 0% 97.3%',
|
|
17
|
+
card: '0 0% 100%',
|
|
18
|
+
cardForeground: '0 0% 23.1%',
|
|
19
|
+
popover: '0 0% 100%',
|
|
20
|
+
popoverForeground: '0 0% 23.1%',
|
|
21
|
+
primary: '209 100% 36.1%',
|
|
22
|
+
primaryForeground: '0 0% 100%',
|
|
23
|
+
secondary: '0 0% 89.8%',
|
|
24
|
+
secondaryForeground: '0 0% 23.1%',
|
|
25
|
+
muted: '0 0% 94.9%',
|
|
26
|
+
mutedForeground: '0 0% 23.1%',
|
|
27
|
+
accent: '0 0% 94.9%',
|
|
28
|
+
accentForeground: '0 0% 23.1%',
|
|
29
|
+
border: '0 0% 89.8%',
|
|
30
|
+
input: '0 0% 80.8%',
|
|
31
|
+
ring: '209 100% 36.1%'
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
dark: {
|
|
35
|
+
...baseTheme.preset.dark,
|
|
36
|
+
...{
|
|
37
|
+
background: '0 0% 12.2%',
|
|
38
|
+
foreground: '0 0% 80%',
|
|
39
|
+
canvas: '0 0% 9.4%',
|
|
40
|
+
card: '0 0% 12.2%',
|
|
41
|
+
cardForeground: '0 0% 80%',
|
|
42
|
+
popover: '0 0% 12.2%',
|
|
43
|
+
popoverForeground: '0 0% 80%',
|
|
44
|
+
primary: '206 100% 41.6%',
|
|
45
|
+
primaryForeground: '0 0% 100%',
|
|
46
|
+
secondary: '195 4.5% 17.3%',
|
|
47
|
+
secondaryForeground: '0 0% 80%',
|
|
48
|
+
muted: '195 4.5% 17.3%',
|
|
49
|
+
mutedForeground: '0 0% 61.6%',
|
|
50
|
+
accent: '195 4.5% 17.3%',
|
|
51
|
+
accentForeground: '0 0% 80%',
|
|
52
|
+
border: '0 0% 16.9%',
|
|
53
|
+
input: '0 0% 23.5%',
|
|
54
|
+
ring: '206 100% 41.6%'
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default definition;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Generated by scripts/themes/compile-vscode-themes.js from the VS Code themes
|
|
2
|
+
// "Light+" (light) and "Dark+" (dark). Do not edit: change the sources or the compiler.
|
|
1
3
|
import baseTheme from './default';
|
|
2
4
|
import type { ThemeDefinition } from '../src/Theme';
|
|
3
5
|
|
|
@@ -8,20 +10,49 @@ const definition: ThemeDefinition = {
|
|
|
8
10
|
mode: 'dark',
|
|
9
11
|
colors: {
|
|
10
12
|
...baseTheme.preset.colors,
|
|
11
|
-
...{
|
|
13
|
+
...{
|
|
14
|
+
background: '0 0% 100%',
|
|
15
|
+
foreground: '0 0% 0%',
|
|
16
|
+
canvas: '0 0% 95.3%',
|
|
17
|
+
card: '0 0% 100%',
|
|
18
|
+
cardForeground: '0 0% 0%',
|
|
19
|
+
popover: '0 0% 100%',
|
|
20
|
+
popoverForeground: '0 0% 38%',
|
|
21
|
+
primary: '204.1 100% 40%',
|
|
22
|
+
primaryForeground: '0 0% 100%',
|
|
23
|
+
secondary: '0 0% 91%',
|
|
24
|
+
secondaryForeground: '0 0% 38%',
|
|
25
|
+
muted: '0 0% 91%',
|
|
26
|
+
mutedForeground: '0 0% 44.3%',
|
|
27
|
+
accent: '0 0% 91%',
|
|
28
|
+
accentForeground: '0 0% 38%',
|
|
29
|
+
border: '0 0% 82.7%',
|
|
30
|
+
input: '0 0% 80.8%',
|
|
31
|
+
ring: '204.1 100% 47.3%'
|
|
32
|
+
},
|
|
12
33
|
},
|
|
13
34
|
dark: {
|
|
14
35
|
...baseTheme.preset.dark,
|
|
15
36
|
...{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
37
|
+
background: '0 0% 11.8%',
|
|
38
|
+
foreground: '0 0% 83.1%',
|
|
39
|
+
canvas: '0 0% 11.8%',
|
|
40
|
+
card: '240 1.3% 14.7%',
|
|
41
|
+
cardForeground: '0 0% 83.1%',
|
|
42
|
+
popover: '240 1.3% 14.7%',
|
|
43
|
+
popoverForeground: '0 0% 80%',
|
|
44
|
+
primary: '204.1 83.5% 33.3%',
|
|
45
|
+
primaryForeground: '0 0% 100%',
|
|
46
|
+
secondary: '195 4.5% 17.3%',
|
|
47
|
+
secondaryForeground: '0 0% 80%',
|
|
48
|
+
muted: '195 4.5% 17.3%',
|
|
49
|
+
mutedForeground: '240 0.5% 60.6%',
|
|
50
|
+
accent: '195 4.5% 17.3%',
|
|
51
|
+
accentForeground: '0 0% 80%',
|
|
52
|
+
border: '0 0% 27.1%',
|
|
53
|
+
input: '0 0% 23.5%',
|
|
54
|
+
ring: '204.1 100% 41.6%'
|
|
55
|
+
},
|
|
25
56
|
},
|
|
26
57
|
},
|
|
27
58
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Generated by scripts/themes/compile-vscode-themes.js from the VS Code themes
|
|
2
|
+
// "Light Modern" (light) and "Dark Modern" (dark). Do not edit: change the sources or the compiler.
|
|
3
|
+
import baseTheme from './default';
|
|
4
|
+
import type { ThemeDefinition } from '../src/Theme';
|
|
5
|
+
|
|
6
|
+
const definition: ThemeDefinition = {
|
|
7
|
+
...baseTheme,
|
|
8
|
+
preset: {
|
|
9
|
+
...baseTheme.preset,
|
|
10
|
+
mode: 'light',
|
|
11
|
+
colors: {
|
|
12
|
+
...baseTheme.preset.colors,
|
|
13
|
+
...{
|
|
14
|
+
background: '0 0% 100%',
|
|
15
|
+
foreground: '0 0% 23.1%',
|
|
16
|
+
canvas: '0 0% 97.3%',
|
|
17
|
+
card: '0 0% 100%',
|
|
18
|
+
cardForeground: '0 0% 23.1%',
|
|
19
|
+
popover: '0 0% 100%',
|
|
20
|
+
popoverForeground: '0 0% 23.1%',
|
|
21
|
+
primary: '209 100% 36.1%',
|
|
22
|
+
primaryForeground: '0 0% 100%',
|
|
23
|
+
secondary: '0 0% 89.8%',
|
|
24
|
+
secondaryForeground: '0 0% 23.1%',
|
|
25
|
+
muted: '0 0% 94.9%',
|
|
26
|
+
mutedForeground: '0 0% 23.1%',
|
|
27
|
+
accent: '0 0% 94.9%',
|
|
28
|
+
accentForeground: '0 0% 23.1%',
|
|
29
|
+
border: '0 0% 89.8%',
|
|
30
|
+
input: '0 0% 80.8%',
|
|
31
|
+
ring: '209 100% 36.1%'
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
dark: {
|
|
35
|
+
...baseTheme.preset.dark,
|
|
36
|
+
...{
|
|
37
|
+
background: '0 0% 12.2%',
|
|
38
|
+
foreground: '0 0% 80%',
|
|
39
|
+
canvas: '0 0% 9.4%',
|
|
40
|
+
card: '0 0% 12.2%',
|
|
41
|
+
cardForeground: '0 0% 80%',
|
|
42
|
+
popover: '0 0% 12.2%',
|
|
43
|
+
popoverForeground: '0 0% 80%',
|
|
44
|
+
primary: '206 100% 41.6%',
|
|
45
|
+
primaryForeground: '0 0% 100%',
|
|
46
|
+
secondary: '195 4.5% 17.3%',
|
|
47
|
+
secondaryForeground: '0 0% 80%',
|
|
48
|
+
muted: '195 4.5% 17.3%',
|
|
49
|
+
mutedForeground: '0 0% 61.6%',
|
|
50
|
+
accent: '195 4.5% 17.3%',
|
|
51
|
+
accentForeground: '0 0% 80%',
|
|
52
|
+
border: '0 0% 16.9%',
|
|
53
|
+
input: '0 0% 23.5%',
|
|
54
|
+
ring: '206 100% 41.6%'
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default definition;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Generated by scripts/themes/compile-vscode-themes.js from the VS Code themes
|
|
2
|
+
// "Light+" (light) and "Dark+" (dark). Do not edit: change the sources or the compiler.
|
|
1
3
|
import baseTheme from './default';
|
|
2
4
|
import type { ThemeDefinition } from '../src/Theme';
|
|
3
5
|
|
|
@@ -9,19 +11,48 @@ const definition: ThemeDefinition = {
|
|
|
9
11
|
colors: {
|
|
10
12
|
...baseTheme.preset.colors,
|
|
11
13
|
...{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
background: '0 0% 100%',
|
|
15
|
+
foreground: '0 0% 0%',
|
|
16
|
+
canvas: '0 0% 95.3%',
|
|
17
|
+
card: '0 0% 100%',
|
|
18
|
+
cardForeground: '0 0% 0%',
|
|
19
|
+
popover: '0 0% 100%',
|
|
20
|
+
popoverForeground: '0 0% 38%',
|
|
21
|
+
primary: '204.1 100% 40%',
|
|
22
|
+
primaryForeground: '0 0% 100%',
|
|
23
|
+
secondary: '0 0% 91%',
|
|
24
|
+
secondaryForeground: '0 0% 38%',
|
|
25
|
+
muted: '0 0% 91%',
|
|
26
|
+
mutedForeground: '0 0% 44.3%',
|
|
27
|
+
accent: '0 0% 91%',
|
|
28
|
+
accentForeground: '0 0% 38%',
|
|
29
|
+
border: '0 0% 82.7%',
|
|
30
|
+
input: '0 0% 80.8%',
|
|
31
|
+
ring: '204.1 100% 47.3%'
|
|
32
|
+
},
|
|
21
33
|
},
|
|
22
34
|
dark: {
|
|
23
35
|
...baseTheme.preset.dark,
|
|
24
|
-
...{
|
|
36
|
+
...{
|
|
37
|
+
background: '0 0% 11.8%',
|
|
38
|
+
foreground: '0 0% 83.1%',
|
|
39
|
+
canvas: '0 0% 11.8%',
|
|
40
|
+
card: '240 1.3% 14.7%',
|
|
41
|
+
cardForeground: '0 0% 83.1%',
|
|
42
|
+
popover: '240 1.3% 14.7%',
|
|
43
|
+
popoverForeground: '0 0% 80%',
|
|
44
|
+
primary: '204.1 83.5% 33.3%',
|
|
45
|
+
primaryForeground: '0 0% 100%',
|
|
46
|
+
secondary: '195 4.5% 17.3%',
|
|
47
|
+
secondaryForeground: '0 0% 80%',
|
|
48
|
+
muted: '195 4.5% 17.3%',
|
|
49
|
+
mutedForeground: '240 0.5% 60.6%',
|
|
50
|
+
accent: '195 4.5% 17.3%',
|
|
51
|
+
accentForeground: '0 0% 80%',
|
|
52
|
+
border: '0 0% 27.1%',
|
|
53
|
+
input: '0 0% 23.5%',
|
|
54
|
+
ring: '204.1 100% 41.6%'
|
|
55
|
+
},
|
|
25
56
|
},
|
|
26
57
|
},
|
|
27
58
|
};
|
package/dist/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["findServerCredentials","isAIProviderTarget","require_modelIdentity","resolveServerCredentials","found","request","target","headers","done","placeholder","secret","lookup","scope","provider","url","name","value"],"sources":["../src/providers/ai/server.ts"],"sourcesContent":["// `@llmnative/react/server`: what a Node proxy needs for server-held AI credentials (CR-102).\r\n// No React and no browser API: it runs in the app's own server or in the Vite dev proxy.\r\n\r\nimport { findServerCredentials, isAIProviderTarget, type ServerAIConnection } from './serverCredentials';\r\n\r\nexport { AI_PROVIDER_HOSTS, isAIProviderTarget, serverCredential, SERVER_CREDENTIAL_PREFIX } from './serverCredentials';\r\nexport type { ServerAIConnection } from './serverCredentials';\r\n// Provider-agnostic identity of models (CR-103): pure, so a server or a generator can resolve them too.\r\nexport { canonicalModelName, buildModelIdentityIndex, resolveModel, loadModelIdentityIndex } from './modelIdentity';\r\nexport type { ModelIdentity, ModelIdentityEntry, ModelIdentityIndex, ResolvedModel } from './modelIdentity';\r\n\r\n/** The connection of a provider as the server keeps it, key included. */\r\nexport type ServerAISecret = ServerAIConnection & { apiKey: string };\r\n\r\n/** The key of `provider` for `scope` (e.g. a company), or nothing when it is not connected. */\r\nexport type ServerCredentialLookup = (scope: string, provider: string) => ServerAISecret | undefined | Promise<ServerAISecret | undefined>;\r\n\r\nexport type ServerCredentialRequest = { url: string; headers: Record<string, string> };\r\n\r\nexport type ServerCredentialResolution =\r\n | { ok: true; url: string; headers: Record<string, string> }\r\n /** 404: the provider is not connected for that scope; 403: the target is not a host of that provider. */\r\n | { ok: false; status: 403 | 404; error: 'unknown-credential' | 'forbidden-target'; provider: string };\r\n\r\n/**\r\n * Swaps every server-credential placeholder of a proxied request (headers and URL) for the key it\r\n * stands for. The key only goes to a host of its provider: any other target is refused, so a\r\n * placeholder can never carry a key elsewhere. A request without placeholders passes unchanged.\r\n */\r\nexport async function resolveServerCredentials(request: ServerCredentialRequest, lookup: ServerCredentialLookup): Promise<ServerCredentialResolution> {\r\n const found = [request.url, ...Object.values(request.headers)].flatMap(findServerCredentials);\r\n if (found.length === 0) return { ok: true, url: request.url, headers: request.headers };\r\n\r\n const target = new URL(request.url);\r\n let { url } = request;\r\n let headers = { ...request.headers };\r\n const done = new Set<string>();\r\n for (const { placeholder, scope, provider } of found) {\r\n if (done.has(placeholder)) continue;\r\n done.add(placeholder);\r\n const secret = await lookup(scope, provider);\r\n if (!secret?.apiKey) return { ok: false, status: 404, error: 'unknown-credential', provider };\r\n if (!isAIProviderTarget({ ...secret, id: provider }, target)) return { ok: false, status: 403, error: 'forbidden-target', provider };\r\n url = url.split(placeholder).join(encodeURIComponent(secret.apiKey));\r\n headers = Object.fromEntries(Object.entries(headers).map(([name, value]) => [name, value.split(placeholder).join(secret.apiKey)]));\r\n }\r\n return { ok: true, url, headers };\r\n}\r\n"],"mappings":"kHA6BA,eAAsBG,EAAyB,EAAkC,EAAqE,CAClJ,IAAMC,EAAQ,CAACC,EAAQ,IAAK,GAAG,OAAO,OAAOA,EAAQ,OAAO,CAAC,CAAC,CAAC,QAAQL,EAAAA,CAAqB,EAC5F,GAAII,EAAM,SAAW,EAAG,MAAO,CAAE,GAAI,GAAM,IAAKC,EAAQ,IAAK,QAASA,EAAQ,OAAQ,EAEtF,IAAMC,EAAS,IAAI,IAAID,EAAQ,GAAG,EAC9B,CAAE,OAAQA,EACVE,EAAU,CAAE,GAAGF,EAAQ,OAAQ,EAC7BG,EAAO,IAAI,IACjB,IAAK,GAAM,CAAE,cAAa,QAAO,cAAcJ,EAAO,CAClD,GAAII,EAAK,IAAIC,CAAW,EAAG,SAC3BD,EAAK,IAAIC,CAAW,EACpB,IAAMC,EAAS,MAAMC,EAAOC,EAAOC,CAAQ,EAC3C,GAAI,CAACH,GAAQ,OAAQ,MAAO,CAAE,GAAI,GAAO,OAAQ,IAAK,MAAO,qBAAsB,UAAS,EAC5F,GAAI,CAACT,EAAAA,EAAmB,CAAE,GAAGS,EAAQ,GAAIG,CAAS,EAAGP,CAAM,EAAG,MAAO,CAAE,GAAI,GAAO,OAAQ,IAAK,MAAO,mBAAoB,UAAS,EACnI,EAAMQ,EAAI,MAAML,CAAW,CAAC,CAAC,KAAK,mBAAmBC,EAAO,MAAM,CAAC,EACnE,EAAU,OAAO,YAAY,OAAO,QAAQH,CAAO,CAAC,CAAC,KAAK,CAACQ,EAAMC,KAAW,CAACD,EAAMC,EAAM,MAAMP,CAAW,CAAC,CAAC,KAAKC,EAAO,MAAM,CAAC,CAAC,CAAC,CACrI,CACA,MAAO,CAAE,GAAI,GAAM,MAAK,SAAQ,CACpC"}
|
package/dist/server.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["serverCredential","resolveModel","findServerCredentials","canonicalModelName","AI_PROVIDER_HOSTS","loadModelIdentityIndex","SERVER_CREDENTIAL_PREFIX","buildModelIdentityIndex","isAIProviderTarget","resolveServerCredentials","found","request","target","headers","done","placeholder","secret","lookup","scope","provider","url","name","value"],"sources":["../src/providers/ai/server.ts"],"sourcesContent":["// `@llmnative/react/server`: what a Node proxy needs for server-held AI credentials (CR-102).\r\n// No React and no browser API: it runs in the app's own server or in the Vite dev proxy.\r\n\r\nimport { findServerCredentials, isAIProviderTarget, type ServerAIConnection } from './serverCredentials';\r\n\r\nexport { AI_PROVIDER_HOSTS, isAIProviderTarget, serverCredential, SERVER_CREDENTIAL_PREFIX } from './serverCredentials';\r\nexport type { ServerAIConnection } from './serverCredentials';\r\n// Provider-agnostic identity of models (CR-103): pure, so a server or a generator can resolve them too.\r\nexport { canonicalModelName, buildModelIdentityIndex, resolveModel, loadModelIdentityIndex } from './modelIdentity';\r\nexport type { ModelIdentity, ModelIdentityEntry, ModelIdentityIndex, ResolvedModel } from './modelIdentity';\r\n\r\n/** The connection of a provider as the server keeps it, key included. */\r\nexport type ServerAISecret = ServerAIConnection & { apiKey: string };\r\n\r\n/** The key of `provider` for `scope` (e.g. a company), or nothing when it is not connected. */\r\nexport type ServerCredentialLookup = (scope: string, provider: string) => ServerAISecret | undefined | Promise<ServerAISecret | undefined>;\r\n\r\nexport type ServerCredentialRequest = { url: string; headers: Record<string, string> };\r\n\r\nexport type ServerCredentialResolution =\r\n | { ok: true; url: string; headers: Record<string, string> }\r\n /** 404: the provider is not connected for that scope; 403: the target is not a host of that provider. */\r\n | { ok: false; status: 403 | 404; error: 'unknown-credential' | 'forbidden-target'; provider: string };\r\n\r\n/**\r\n * Swaps every server-credential placeholder of a proxied request (headers and URL) for the key it\r\n * stands for. The key only goes to a host of its provider: any other target is refused, so a\r\n * placeholder can never carry a key elsewhere. A request without placeholders passes unchanged.\r\n */\r\nexport async function resolveServerCredentials(request: ServerCredentialRequest, lookup: ServerCredentialLookup): Promise<ServerCredentialResolution> {\r\n const found = [request.url, ...Object.values(request.headers)].flatMap(findServerCredentials);\r\n if (found.length === 0) return { ok: true, url: request.url, headers: request.headers };\r\n\r\n const target = new URL(request.url);\r\n let { url } = request;\r\n let headers = { ...request.headers };\r\n const done = new Set<string>();\r\n for (const { placeholder, scope, provider } of found) {\r\n if (done.has(placeholder)) continue;\r\n done.add(placeholder);\r\n const secret = await lookup(scope, provider);\r\n if (!secret?.apiKey) return { ok: false, status: 404, error: 'unknown-credential', provider };\r\n if (!isAIProviderTarget({ ...secret, id: provider }, target)) return { ok: false, status: 403, error: 'forbidden-target', provider };\r\n url = url.split(placeholder).join(encodeURIComponent(secret.apiKey));\r\n headers = Object.fromEntries(Object.entries(headers).map(([name, value]) => [name, value.split(placeholder).join(secret.apiKey)]));\r\n }\r\n return { ok: true, url, headers };\r\n}\r\n"],"mappings":";;AA6BA,eAAsBS,EAAyB,GAAkC,GAAqE;CAClJ,IAAMC,IAAQ,CAACC,EAAQ,KAAK,GAAG,OAAO,OAAOA,EAAQ,OAAO,CAAC,CAAC,CAAC,QAAQT,CAAqB;CAC5F,IAAIQ,EAAM,WAAW,GAAG,OAAO;EAAE,IAAI;EAAM,KAAKC,EAAQ;EAAK,SAASA,EAAQ;CAAQ;CAEtF,IAAMC,IAAS,IAAI,IAAID,EAAQ,GAAG,GAC9B,EAAE,WAAQA,GACVE,IAAU,EAAE,GAAGF,EAAQ,QAAQ,GAC7BG,oBAAO,IAAI,IAAY;CAC7B,KAAK,IAAM,EAAE,gBAAa,UAAO,iBAAcJ,GAAO;EAClD,IAAII,EAAK,IAAIC,CAAW,GAAG;EAC3B,EAAK,IAAIA,CAAW;EACpB,IAAMC,IAAS,MAAMC,EAAOC,GAAOC,CAAQ;EAC3C,IAAI,CAACH,GAAQ,QAAQ,OAAO;GAAE,IAAI;GAAO,QAAQ;GAAK,OAAO;GAAsB;EAAS;EAC5F,IAAI,CAACR,EAAmB;GAAE,GAAGQ;GAAQ,IAAIG;EAAS,GAAGP,CAAM,GAAG,OAAO;GAAE,IAAI;GAAO,QAAQ;GAAK,OAAO;GAAoB;EAAS;EAEnI,AADA,IAAMQ,EAAI,MAAML,CAAW,CAAC,CAAC,KAAK,mBAAmBC,EAAO,MAAM,CAAC,GACnE,IAAU,OAAO,YAAY,OAAO,QAAQH,CAAO,CAAC,CAAC,KAAK,CAACQ,GAAMC,OAAW,CAACD,GAAMC,EAAM,MAAMP,CAAW,CAAC,CAAC,KAAKC,EAAO,MAAM,CAAC,CAAC,CAAC;CACrI;CACA,OAAO;EAAE,IAAI;EAAM;EAAK;CAAQ;AACpC"}
|