free-coding-models 0.5.6 → 0.5.9
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/README.md +14 -9
- package/changelog/v0.5.7.md +20 -0
- package/changelog/v0.5.8.md +23 -0
- package/package.json +1 -1
- package/src/core/endpoint-installer.js +3 -3
- package/src/core/tool-launchers.js +2 -2
- package/web/dist/assets/index-27IYGKp2.js +39 -0
- package/web/dist/assets/index-DKmmiDip.css +1 -0
- package/web/dist/index.html +2 -2
- package/web/server.js +386 -1
- package/web/src/App.jsx +145 -26
- package/web/src/components/analytics/AnalyticsView.jsx +4 -0
- package/web/src/components/analytics/TokenUsagePanel.jsx +105 -0
- package/web/src/components/analytics/TokenUsagePanel.module.css +126 -0
- package/web/src/components/atoms/TierBadge.module.css +3 -3
- package/web/src/components/dashboard/DetailPanel.jsx +29 -4
- package/web/src/components/dashboard/DetailPanel.module.css +26 -0
- package/web/src/components/dashboard/FilterBar.jsx +17 -2
- package/web/src/components/dashboard/FilterBar.module.css +17 -0
- package/web/src/components/dashboard/ModelTable.jsx +17 -5
- package/web/src/components/dashboard/ModelTable.module.css +14 -1
- package/web/src/components/help/HelpView.jsx +1 -1
- package/web/src/components/install/InstallEndpointsView.jsx +278 -0
- package/web/src/components/install/InstallEndpointsView.module.css +351 -0
- package/web/src/components/installed/InstalledModelsView.jsx +89 -0
- package/web/src/components/installed/InstalledModelsView.module.css +200 -0
- package/web/src/components/launch/IncompatibleFallbackModal.jsx +69 -0
- package/web/src/components/launch/LaunchButton.jsx +30 -0
- package/web/src/components/launch/LaunchButton.module.css +35 -0
- package/web/src/components/launch/LaunchModal.module.css +125 -0
- package/web/src/components/layout/Header.jsx +70 -11
- package/web/src/components/layout/Header.module.css +62 -2
- package/web/src/components/recommend/RecommendView.jsx +121 -0
- package/web/src/components/recommend/RecommendView.module.css +55 -0
- package/web/src/components/router/RouterView.jsx +286 -0
- package/web/src/components/router/RouterView.module.css +357 -0
- package/web/src/components/tools/ToolPicker.jsx +86 -0
- package/web/src/components/tools/ToolPicker.module.css +84 -0
- package/web/src/global.css +23 -0
- package/web/src/hooks/urlState.constants.js +3 -0
- package/web/src/hooks/useInstalledModels.js +42 -0
- package/web/src/hooks/useRecommend.js +67 -0
- package/web/src/hooks/useRouterDashboard.js +133 -0
- package/web/src/hooks/useTokenUsage.js +103 -0
- package/web/src/hooks/useToolMode.js +77 -0
- package/web/src/hooks/useUrlState.js +4 -3
- package/web/src/utils/m3.js +55 -0
- package/web/dist/assets/index-Blp9QJev.js +0 -39
- package/web/dist/assets/index-Cz_aCLTR.css +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file web/src/utils/m3.js
|
|
3
|
+
* @description Small pure helpers for M3 Web parity tests. They keep payload
|
|
4
|
+
* validation/formatting deterministic without importing React components.
|
|
5
|
+
*
|
|
6
|
+
* @functions
|
|
7
|
+
* → recommendScoreShape — validates `/api/recommend` Top 3 payload shape
|
|
8
|
+
* → toolInstallSummary — formats a tool install plan for display
|
|
9
|
+
* @exports INSTALL_ENDPOINT_TOOL_MODES, recommendScoreShape, toolInstallSummary
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const INSTALL_ENDPOINT_TOOL_MODES = [
|
|
13
|
+
'opencode',
|
|
14
|
+
'opencode-desktop',
|
|
15
|
+
'opencode-web',
|
|
16
|
+
'openclaw',
|
|
17
|
+
'crush',
|
|
18
|
+
'goose',
|
|
19
|
+
'pi',
|
|
20
|
+
'aider',
|
|
21
|
+
'qwen',
|
|
22
|
+
'openhands',
|
|
23
|
+
'amp',
|
|
24
|
+
'forgecode',
|
|
25
|
+
'fcm_router',
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
export function recommendScoreShape(payload) {
|
|
29
|
+
const top3 = Array.isArray(payload?.top3) ? payload.top3 : []
|
|
30
|
+
return top3.every((entry) => {
|
|
31
|
+
const result = entry?.result
|
|
32
|
+
return Boolean(result)
|
|
33
|
+
&& typeof result.providerKey === 'string'
|
|
34
|
+
&& typeof result.modelId === 'string'
|
|
35
|
+
&& typeof result.label === 'string'
|
|
36
|
+
&& typeof entry.score === 'number'
|
|
37
|
+
&& entry.score >= 0
|
|
38
|
+
&& entry.score <= 100
|
|
39
|
+
&& typeof entry.reason === 'string'
|
|
40
|
+
&& entry.reason.length > 0
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function toolInstallSummary(plan) {
|
|
45
|
+
if (!plan || typeof plan !== 'object') {
|
|
46
|
+
return { supported: false, title: 'Unknown tool', command: null, docsUrl: null, note: null }
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
supported: plan.supported === true,
|
|
50
|
+
title: plan.summary || plan.reason || `Install ${plan.mode || 'tool'}`,
|
|
51
|
+
command: typeof plan.shellCommand === 'string' ? plan.shellCommand : null,
|
|
52
|
+
docsUrl: typeof plan.docsUrl === 'string' ? plan.docsUrl : null,
|
|
53
|
+
note: typeof plan.note === 'string' ? plan.note : null,
|
|
54
|
+
}
|
|
55
|
+
}
|