@threadbase-sh/streamer 1.15.0 → 1.15.1
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 +15 -1
- package/dist/cli.cjs +81 -74
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +32 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -26
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -5104,28 +5104,37 @@ var StreamerServer = class {
|
|
|
5104
5104
|
projectName: body.projectName,
|
|
5105
5105
|
branch: body.branch
|
|
5106
5106
|
});
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
session.
|
|
5120
|
-
session.
|
|
5107
|
+
this.sessionStore.addManaged(session);
|
|
5108
|
+
void this.watchConversationFile(sessionId);
|
|
5109
|
+
const resp = this.sessionStore.get(session.id, this.ptyAttachedIds());
|
|
5110
|
+
this.broadcastOrUnicastSessionList(req);
|
|
5111
|
+
json(res, 201, resp ?? session);
|
|
5112
|
+
this.enrichResumedSessionAsync(sessionId, projectPath, conv);
|
|
5113
|
+
}
|
|
5114
|
+
enrichResumedSessionAsync(sessionId, projectPath, conv) {
|
|
5115
|
+
try {
|
|
5116
|
+
const session = this.sessionStore.get(sessionId, this.ptyAttachedIds());
|
|
5117
|
+
if (!session) return;
|
|
5118
|
+
if (conv) {
|
|
5119
|
+
session.sessionName = conv.sessionName ?? void 0;
|
|
5120
|
+
session.messageCount = conv.messageCount ?? 0;
|
|
5121
|
+
session.account = conv.account ?? void 0;
|
|
5122
|
+
session.filePath = conv.filePath ?? void 0;
|
|
5121
5123
|
}
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5124
|
+
if (!this.cache || !this.projectsRepo || !this.conversationsRepo) return;
|
|
5125
|
+
const cached2 = this.cache.getMetaById(sessionId);
|
|
5126
|
+
if (cached2) {
|
|
5127
|
+
session.model = cached2.model ?? void 0;
|
|
5128
|
+
session.preview = cached2.preview ?? void 0;
|
|
5129
|
+
const first = cached2.firstMessage ? JSON.parse(cached2.firstMessage) : null;
|
|
5130
|
+
const last = cached2.lastMessage ? JSON.parse(cached2.lastMessage) : null;
|
|
5131
|
+
session.firstMessageText = first?.text ?? void 0;
|
|
5132
|
+
session.firstMessageAt = first?.timestamp ? new Date(first.timestamp).toISOString() : void 0;
|
|
5133
|
+
session.lastMessageText = last?.text ?? void 0;
|
|
5134
|
+
session.lastMessageAt = last?.timestamp ? new Date(last.timestamp).toISOString() : void 0;
|
|
5135
|
+
}
|
|
5136
|
+
let resolvedProjectId = cached2?.projectId ?? null;
|
|
5137
|
+
if (!resolvedProjectId) {
|
|
5129
5138
|
const project = this.projectsRepo.upsertProjectByPath(projectPath);
|
|
5130
5139
|
resolvedProjectId = project.id;
|
|
5131
5140
|
this.conversationsRepo.updateConversationProjectId({
|
|
@@ -5137,12 +5146,9 @@ var StreamerServer = class {
|
|
|
5137
5146
|
session.projectId = resolvedProjectId;
|
|
5138
5147
|
session.resumedFromConversationId = sessionId;
|
|
5139
5148
|
}
|
|
5149
|
+
} catch (err) {
|
|
5150
|
+
console.error(`[enrichResumedSessionAsync] ${sessionId}:`, err);
|
|
5140
5151
|
}
|
|
5141
|
-
this.sessionStore.addManaged(session);
|
|
5142
|
-
void this.watchConversationFile(sessionId);
|
|
5143
|
-
const resp = this.sessionStore.get(session.id, this.ptyAttachedIds());
|
|
5144
|
-
this.broadcastOrUnicastSessionList(req);
|
|
5145
|
-
json(res, 201, resp ?? session);
|
|
5146
5152
|
}
|
|
5147
5153
|
async handleSendInput(sessionId, req, res) {
|
|
5148
5154
|
if (this.agentConfig.enabled) {
|