sessix-server 0.3.2 → 0.3.3
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/dist/index.js +11 -4
- package/dist/server.js +11 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1601,8 +1601,15 @@ var SessionManager = class {
|
|
|
1601
1601
|
* 调用 provider.startSession(),订阅事件流,
|
|
1602
1602
|
* 将 ClaudeStreamEvent 包装为 ServerEvent 转发。
|
|
1603
1603
|
*/
|
|
1604
|
-
async createSession(projectPath, message, resumeSessionId, newSessionId, model, permissionMode, effort, images, agentType
|
|
1605
|
-
|
|
1604
|
+
async createSession(projectPath, message, resumeSessionId, newSessionId, model, permissionMode, effort, images, agentType) {
|
|
1605
|
+
let resolvedAgentType = agentType ?? "claude-code";
|
|
1606
|
+
if (!agentType && resumeSessionId && this.providerFactory) {
|
|
1607
|
+
const codexProvider = this.providerFactory.getProvider("codex");
|
|
1608
|
+
if (codexProvider instanceof CodexProvider && codexProvider.isKnownSession(resumeSessionId)) {
|
|
1609
|
+
resolvedAgentType = "codex";
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
const provider = this.providerFactory ? this.providerFactory.getProvider(resolvedAgentType) : this.provider;
|
|
1606
1613
|
const session = await provider.startSession({
|
|
1607
1614
|
projectPath,
|
|
1608
1615
|
message,
|
|
@@ -1613,7 +1620,7 @@ var SessionManager = class {
|
|
|
1613
1620
|
effort,
|
|
1614
1621
|
images
|
|
1615
1622
|
});
|
|
1616
|
-
this.sessionAgentType.set(session.id,
|
|
1623
|
+
this.sessionAgentType.set(session.id, resolvedAgentType);
|
|
1617
1624
|
this.lastBroadcastStatus.set(session.id, session.status);
|
|
1618
1625
|
this.sessionProjectPaths.set(session.id, projectPath);
|
|
1619
1626
|
this.unsubscribeSession(session.id);
|
|
@@ -3844,7 +3851,7 @@ async function getSessionHistory(projectPath, sessionId) {
|
|
|
3844
3851
|
if (err.code === "ENOENT") return null;
|
|
3845
3852
|
throw err;
|
|
3846
3853
|
});
|
|
3847
|
-
if (raw === null) return { ok:
|
|
3854
|
+
if (raw === null) return { ok: true, value: [] };
|
|
3848
3855
|
const lines = raw.split("\n").filter((l) => l.trim());
|
|
3849
3856
|
const events = [];
|
|
3850
3857
|
for (const line of lines) {
|
package/dist/server.js
CHANGED
|
@@ -1606,8 +1606,15 @@ var SessionManager = class {
|
|
|
1606
1606
|
* 调用 provider.startSession(),订阅事件流,
|
|
1607
1607
|
* 将 ClaudeStreamEvent 包装为 ServerEvent 转发。
|
|
1608
1608
|
*/
|
|
1609
|
-
async createSession(projectPath, message, resumeSessionId, newSessionId, model, permissionMode, effort, images, agentType
|
|
1610
|
-
|
|
1609
|
+
async createSession(projectPath, message, resumeSessionId, newSessionId, model, permissionMode, effort, images, agentType) {
|
|
1610
|
+
let resolvedAgentType = agentType ?? "claude-code";
|
|
1611
|
+
if (!agentType && resumeSessionId && this.providerFactory) {
|
|
1612
|
+
const codexProvider = this.providerFactory.getProvider("codex");
|
|
1613
|
+
if (codexProvider instanceof CodexProvider && codexProvider.isKnownSession(resumeSessionId)) {
|
|
1614
|
+
resolvedAgentType = "codex";
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
const provider = this.providerFactory ? this.providerFactory.getProvider(resolvedAgentType) : this.provider;
|
|
1611
1618
|
const session = await provider.startSession({
|
|
1612
1619
|
projectPath,
|
|
1613
1620
|
message,
|
|
@@ -1618,7 +1625,7 @@ var SessionManager = class {
|
|
|
1618
1625
|
effort,
|
|
1619
1626
|
images
|
|
1620
1627
|
});
|
|
1621
|
-
this.sessionAgentType.set(session.id,
|
|
1628
|
+
this.sessionAgentType.set(session.id, resolvedAgentType);
|
|
1622
1629
|
this.lastBroadcastStatus.set(session.id, session.status);
|
|
1623
1630
|
this.sessionProjectPaths.set(session.id, projectPath);
|
|
1624
1631
|
this.unsubscribeSession(session.id);
|
|
@@ -3849,7 +3856,7 @@ async function getSessionHistory(projectPath, sessionId) {
|
|
|
3849
3856
|
if (err.code === "ENOENT") return null;
|
|
3850
3857
|
throw err;
|
|
3851
3858
|
});
|
|
3852
|
-
if (raw === null) return { ok:
|
|
3859
|
+
if (raw === null) return { ok: true, value: [] };
|
|
3853
3860
|
const lines = raw.split("\n").filter((l) => l.trim());
|
|
3854
3861
|
const events = [];
|
|
3855
3862
|
for (const line of lines) {
|