@yeaft/webchat-agent 1.0.339 → 1.0.341
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/local-runtime/server/db/connection.js +3 -0
- package/local-runtime/server/db/yeaft-project-db.js +24 -0
- package/local-runtime/server/handlers/client-conversation.js +1 -0
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +110 -101
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +2 -2
- package/local-runtime/web/style.bundle.css +1 -1
- package/local-runtime/web/style.bundle.css.gz +0 -0
- package/package.json +1 -1
- package/yeaft/engine.js +21 -17
- package/yeaft/projects/store.js +15 -0
- package/yeaft/web-bridge.js +2 -0
|
Binary file
|
package/package.json
CHANGED
package/yeaft/engine.js
CHANGED
|
@@ -3437,24 +3437,28 @@ export class Engine {
|
|
|
3437
3437
|
|
|
3438
3438
|
// If new user input was appended while this loop was streaming and
|
|
3439
3439
|
// there are no tools to force another loop, splice it now and continue
|
|
3440
|
-
// instead of ending the thread.
|
|
3441
|
-
//
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3440
|
+
// instead of ending the thread. A tool response must execute first: an
|
|
3441
|
+
// append between assistant(toolCalls) and its tool results would break
|
|
3442
|
+
// the provider protocol and discard the entire tool batch. The regular
|
|
3443
|
+
// pre-stream drain on the next iteration appends input after those results.
|
|
3444
|
+
if (toolCalls.length === 0) {
|
|
3445
|
+
const appendedAfterAssistant = this.#drainPendingUserMessages(drainPendingUserMessages);
|
|
3446
|
+
if (appendedAfterAssistant.length > 0) {
|
|
3447
|
+
for (const item of appendedAfterAssistant) {
|
|
3448
|
+
this.#persistAppendedUserMessage(item, runtimeSessionId);
|
|
3449
|
+
conversationMessages.push({ role: 'user', content: item.content });
|
|
3450
|
+
yield {
|
|
3451
|
+
type: 'user_append',
|
|
3452
|
+
turnId: queryTurnId,
|
|
3453
|
+
loopNumber: turnNumber,
|
|
3454
|
+
threadId,
|
|
3455
|
+
preview: String(item.preview || '').slice(0, 200),
|
|
3456
|
+
internal: Boolean(item.internal),
|
|
3457
|
+
};
|
|
3458
|
+
}
|
|
3459
|
+
yield { type: 'turn_end', turnNumber, stopReason: 'user_append_continue', threadId };
|
|
3460
|
+
continue;
|
|
3455
3461
|
}
|
|
3456
|
-
yield { type: 'turn_end', turnNumber, stopReason: 'user_append_continue', threadId };
|
|
3457
|
-
continue;
|
|
3458
3462
|
}
|
|
3459
3463
|
|
|
3460
3464
|
// If no tool calls, we're done — UNLESS we still own a pending
|
package/yeaft/projects/store.js
CHANGED
|
@@ -135,6 +135,21 @@ export function deleteProject(yeaftDir, projectId) {
|
|
|
135
135
|
return { projectId };
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
export function reorderProjects(yeaftDir, projectIds) {
|
|
139
|
+
const projects = loadProjects(yeaftDir);
|
|
140
|
+
const ids = Array.isArray(projectIds)
|
|
141
|
+
? projectIds.map(value => typeof value === 'string' ? value.trim() : '')
|
|
142
|
+
: [];
|
|
143
|
+
const currentIds = new Set(projects.map(project => project.id));
|
|
144
|
+
if (ids.length !== projects.length
|
|
145
|
+
|| ids.some(id => !id || !currentIds.has(id))
|
|
146
|
+
|| new Set(ids).size !== ids.length) {
|
|
147
|
+
throw new ProjectStoreError('invalid_project_order', 'Complete Project order is required');
|
|
148
|
+
}
|
|
149
|
+
const projectsById = new Map(projects.map(project => [project.id, project]));
|
|
150
|
+
return saveProjects(yeaftDir, ids.map(id => projectsById.get(id)));
|
|
151
|
+
}
|
|
152
|
+
|
|
138
153
|
export function moveSessionToProject(yeaftDir, sessionId, projectId = null) {
|
|
139
154
|
const id = typeof sessionId === 'string' ? sessionId.trim() : '';
|
|
140
155
|
if (!id) throw new ProjectStoreError('invalid_session_id', 'Session id is required');
|
package/yeaft/web-bridge.js
CHANGED
|
@@ -77,6 +77,7 @@ import {
|
|
|
77
77
|
moveSessionToProject,
|
|
78
78
|
removeSessionFromProjects,
|
|
79
79
|
renameProject,
|
|
80
|
+
reorderProjects,
|
|
80
81
|
updateProjectInstruction,
|
|
81
82
|
} from './projects/store.js';
|
|
82
83
|
import { readSummary as readScopeSummary } from './memory/store.js';
|
|
@@ -3239,6 +3240,7 @@ export function handleYeaftProjectMutation(msg) {
|
|
|
3239
3240
|
else if (op === 'update_instruction') {
|
|
3240
3241
|
result = updateProjectInstruction(yeaftDir, msg.projectId, msg.instruction);
|
|
3241
3242
|
} else if (op === 'delete') result = deleteProject(yeaftDir, msg.projectId);
|
|
3243
|
+
else if (op === 'reorder') result = reorderProjects(yeaftDir, msg.projectIds);
|
|
3242
3244
|
else if (op === 'move_session') {
|
|
3243
3245
|
if (!snapshotSessions(yeaftDir).some(row => row.id === msg.sessionId)) {
|
|
3244
3246
|
throw new ProjectStoreError('session_not_found', 'Session not found');
|