Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(thread): add thread API service and slice

Steven Enamakelb633c7db3ea6
diff --git a/app/src/services/api/threadApi.ts b/app/src/services/api/threadApi.ts
index a32838e217..c7a65fb799 100644
--- a/app/src/services/api/threadApi.ts
+++ b/app/src/services/api/threadApi.ts
@@ -262,6 +262,19 @@ export const threadApi = {
return unwrapEnvelope(response);
},
+ /**
+ * Bind (absolute path) or clear (`''`) the working folder of a thread that
+ * has no messages yet. The core validates the folder and refuses once the
+ * conversation has started.
+ */
+ updateWorkingDir: async (threadId: string, actionDir: string): Promise<Thread> => {
+ const response = await callCoreRpc<Envelope<Thread>>({
+ method: 'openhuman.threads_update_working_dir',
+ params: { thread_id: threadId, action_dir: actionDir },
+ });
+ return unwrapEnvelope(response);
+ },
+
updateTitle: async (threadId: string, title: string): Promise<Thread> => {
const response = await callCoreRpc<Envelope<Thread>>({
method: 'openhuman.threads_update_title',
diff --git a/app/src/store/threadSlice.ts b/app/src/store/threadSlice.ts
index 86a282ddae..1487ab0a41 100644
--- a/app/src/store/threadSlice.ts
+++ b/app/src/store/threadSlice.ts
@@ -444,6 +444,19 @@ export const updateThreadTitle = createAsyncThunk(
}
);
+export const updateThreadWorkingDir = createAsyncThunk(
+ 'thread/updateThreadWorkingDir',
+ async (payload: { threadId: string; actionDir: string | null }, { rejectWithValue }) => {
+ try {
+ return await threadApi.updateWorkingDir(payload.threadId, payload.actionDir ?? '');
+ } catch (error) {
+ return rejectWithValue(
+ error instanceof Error ? error.message : 'Failed to update the working folder'
+ );
+ }
+ }
+);
+
// ── Slice ─────────────────────────────────────────────────────────
const threadSlice = createSlice({
@@ -667,6 +680,12 @@ const threadSlice = createSlice({
state.threads[idx] = action.payload;
}
})
+ .addCase(updateThreadWorkingDir.fulfilled, (state, action) => {
+ const idx = state.threads.findIndex(t => t.id === action.payload.id);
+ if (idx >= 0) {
+ state.threads[idx] = action.payload;
+ }
+ })
.addCase(resetUserScopedState, () => initialState);
},
});