@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.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -5063,28 +5063,37 @@ var StreamerServer = class {
|
|
|
5063
5063
|
projectName: body.projectName,
|
|
5064
5064
|
branch: body.branch
|
|
5065
5065
|
});
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
session.
|
|
5079
|
-
session.
|
|
5066
|
+
this.sessionStore.addManaged(session);
|
|
5067
|
+
void this.watchConversationFile(sessionId);
|
|
5068
|
+
const resp = this.sessionStore.get(session.id, this.ptyAttachedIds());
|
|
5069
|
+
this.broadcastOrUnicastSessionList(req);
|
|
5070
|
+
json(res, 201, resp ?? session);
|
|
5071
|
+
this.enrichResumedSessionAsync(sessionId, projectPath, conv);
|
|
5072
|
+
}
|
|
5073
|
+
enrichResumedSessionAsync(sessionId, projectPath, conv) {
|
|
5074
|
+
try {
|
|
5075
|
+
const session = this.sessionStore.get(sessionId, this.ptyAttachedIds());
|
|
5076
|
+
if (!session) return;
|
|
5077
|
+
if (conv) {
|
|
5078
|
+
session.sessionName = conv.sessionName ?? void 0;
|
|
5079
|
+
session.messageCount = conv.messageCount ?? 0;
|
|
5080
|
+
session.account = conv.account ?? void 0;
|
|
5081
|
+
session.filePath = conv.filePath ?? void 0;
|
|
5080
5082
|
}
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5083
|
+
if (!this.cache || !this.projectsRepo || !this.conversationsRepo) return;
|
|
5084
|
+
const cached2 = this.cache.getMetaById(sessionId);
|
|
5085
|
+
if (cached2) {
|
|
5086
|
+
session.model = cached2.model ?? void 0;
|
|
5087
|
+
session.preview = cached2.preview ?? void 0;
|
|
5088
|
+
const first = cached2.firstMessage ? JSON.parse(cached2.firstMessage) : null;
|
|
5089
|
+
const last = cached2.lastMessage ? JSON.parse(cached2.lastMessage) : null;
|
|
5090
|
+
session.firstMessageText = first?.text ?? void 0;
|
|
5091
|
+
session.firstMessageAt = first?.timestamp ? new Date(first.timestamp).toISOString() : void 0;
|
|
5092
|
+
session.lastMessageText = last?.text ?? void 0;
|
|
5093
|
+
session.lastMessageAt = last?.timestamp ? new Date(last.timestamp).toISOString() : void 0;
|
|
5094
|
+
}
|
|
5095
|
+
let resolvedProjectId = cached2?.projectId ?? null;
|
|
5096
|
+
if (!resolvedProjectId) {
|
|
5088
5097
|
const project = this.projectsRepo.upsertProjectByPath(projectPath);
|
|
5089
5098
|
resolvedProjectId = project.id;
|
|
5090
5099
|
this.conversationsRepo.updateConversationProjectId({
|
|
@@ -5096,12 +5105,9 @@ var StreamerServer = class {
|
|
|
5096
5105
|
session.projectId = resolvedProjectId;
|
|
5097
5106
|
session.resumedFromConversationId = sessionId;
|
|
5098
5107
|
}
|
|
5108
|
+
} catch (err) {
|
|
5109
|
+
console.error(`[enrichResumedSessionAsync] ${sessionId}:`, err);
|
|
5099
5110
|
}
|
|
5100
|
-
this.sessionStore.addManaged(session);
|
|
5101
|
-
void this.watchConversationFile(sessionId);
|
|
5102
|
-
const resp = this.sessionStore.get(session.id, this.ptyAttachedIds());
|
|
5103
|
-
this.broadcastOrUnicastSessionList(req);
|
|
5104
|
-
json(res, 201, resp ?? session);
|
|
5105
5111
|
}
|
|
5106
5112
|
async handleSendInput(sessionId, req, res) {
|
|
5107
5113
|
if (this.agentConfig.enabled) {
|