refactor(store): replace project and skill models with generated models
Some checks failed
CI / build-and-test (push) Failing after -31m25s

* Update project creation and retrieval to use generated models
* Modify skill addition and listing to utilize generated models
* Refactor thought handling to incorporate generated models
* Adjust tool annotations to align with new model structure
* Update API calls in the UI to use new ResolveSpec-based endpoints
* Enhance stats retrieval logic to aggregate thought metadata
This commit is contained in:
2026-04-26 12:56:32 +02:00
parent da7220ad64
commit db7b152852
53 changed files with 3638 additions and 426 deletions

View File

@@ -26,10 +26,18 @@
GlobalStateStore.setState({
onFetchSession: async (state) => {
const token = state.session.authToken;
if (!token) return null;
const res = await fetch('/api/admin/stats', {
headers: { Authorization: `Bearer ${token}` }
const token = state.session?.authToken;
if (!token) return {};
const res = await fetch('/api/rs/public/projects', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
},
body: JSON.stringify({
operation: 'read',
options: { limit: 1 }
})
});
if (!res.ok) return { session: { loggedIn: false } };
return { session: { loggedIn: true, authToken: token } };
@@ -47,14 +55,7 @@
try {
const token = await loginWithCredentials(username, password);
const state = GlobalStateStore.getState();
state.setSession({
authToken: token,
loggedIn: true,
validated: true,
expiryDate: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString()
});
state.setUser({ username });
await GlobalStateStore.getState().login(token, { username });
authMessage = 'Login successful.';
await loadStatus();
} catch (err) {
@@ -128,7 +129,9 @@
return;
}
if (isLoggedIn.current) {
await GlobalStateStore.getState().fetchData();
if (GlobalStateStore.getState().isLoggedIn()) {
await loadStatus();
}
});