Просмотр исходного кода

Update CLI run command and session handling

🤖 Generated with [OpenCode](https://opencode.ai)

Co-Authored-By: OpenCode <[email protected]>
Dax Raad 8 месяцев назад
Родитель
Сommit
29a6603a89
2 измененных файлов с 6 добавлено и 2 удалено
  1. 1 0
      packages/opencode/src/cli/cmd/run.ts
  2. 5 2
      packages/opencode/src/session/index.ts

+ 1 - 0
packages/opencode/src/cli/cmd/run.ts

@@ -83,6 +83,7 @@ export const RunCommand = {
         }
 
         Bus.subscribe(Message.Event.PartUpdated, async (evt) => {
+          if (evt.properties.sessionID !== session.id) return
           const part = evt.properties.part
           const message = await Session.getMessage(
             evt.properties.sessionID,

+ 5 - 2
packages/opencode/src/session/index.ts

@@ -81,7 +81,9 @@ export namespace Session {
     const result: Info = {
       id: Identifier.descending("session"),
       parentID,
-      title: "Child Session - " + new Date().toISOString(),
+      title:
+        (parentID ? "Child session - " : "New Session - ") +
+        new Date().toISOString(),
       time: {
         created: Date.now(),
         updated: Date.now(),
@@ -221,7 +223,8 @@ export namespace Session {
     if (lastSummary) msgs = msgs.filter((msg) => msg.id >= lastSummary.id)
 
     const app = App.info()
-    if (msgs.length === 0) {
+    const session = await get(input.sessionID)
+    if (msgs.length === 0 && !session.parentID) {
       generateText({
         maxOutputTokens: 20,
         messages: convertToModelMessages([