kanna-code 0.26.10 → 0.26.12

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/png" href="/favicon.png" />
7
7
  <title>Kanna</title>
8
- <script type="module" crossorigin src="/assets/index-DmyPGZQY.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BbGttvBZ.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-Dx_Ruzm5.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kanna-code",
3
3
  "type": "module",
4
- "version": "0.26.10",
4
+ "version": "0.26.12",
5
5
  "description": "A beautiful web UI for Claude Code",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -91,7 +91,7 @@ interface ClaudeSessionState {
91
91
 
92
92
  interface AgentCoordinatorArgs {
93
93
  store: EventStore
94
- onStateChange: (chatId?: string) => void
94
+ onStateChange: (chatId?: string, options?: { immediate?: boolean }) => void
95
95
  codexManager?: CodexAppServerManager
96
96
  generateTitle?: (messageContent: string, cwd: string) => Promise<GenerateChatTitleResult>
97
97
  startClaudeSession?: (args: {
@@ -629,7 +629,7 @@ async function startClaudeSession(args: {
629
629
 
630
630
  export class AgentCoordinator {
631
631
  private readonly store: EventStore
632
- private readonly onStateChange: (chatId?: string) => void
632
+ private readonly onStateChange: (chatId?: string, options?: { immediate?: boolean }) => void
633
633
  private readonly codexManager: CodexAppServerManager
634
634
  private readonly generateTitle: (messageContent: string, cwd: string) => Promise<GenerateChatTitleResult>
635
635
  private readonly startClaudeSessionFn: NonNullable<AgentCoordinatorArgs["startClaudeSession"]>
@@ -668,8 +668,8 @@ export class AgentCoordinator {
668
668
  return new Set(this.drainingStreams.keys())
669
669
  }
670
670
 
671
- private emitStateChange(chatId?: string) {
672
- this.onStateChange(chatId)
671
+ private emitStateChange(chatId?: string, options?: { immediate?: boolean }) {
672
+ this.onStateChange(chatId, options)
673
673
  }
674
674
 
675
675
  getActiveTurnProfile(chatId: string): SendToStartingProfile | null {
@@ -905,7 +905,7 @@ export class AgentCoordinator {
905
905
  chatId: args.chatId,
906
906
  status: active.status,
907
907
  })
908
- this.emitStateChange(args.chatId)
908
+ this.emitStateChange(args.chatId, { immediate: active.status === "starting" })
909
909
  logSendToStartingProfile(args.profile, "start_turn.state_change_emitted", {
910
910
  chatId: args.chatId,
911
911
  status: active.status,
@@ -99,8 +99,12 @@ export async function startKannaServer(options: StartKannaServerOptions = {}) {
99
99
  : null
100
100
  const agent = new AgentCoordinator({
101
101
  store,
102
- onStateChange: (chatId?: string) => {
102
+ onStateChange: (chatId?: string, options?: { immediate?: boolean }) => {
103
103
  if (chatId) {
104
+ if (options?.immediate) {
105
+ void router.broadcastChatStateImmediately(chatId)
106
+ return
107
+ }
104
108
  router.scheduleChatStateBroadcast(chatId)
105
109
  return
106
110
  }
@@ -512,6 +512,10 @@ export function createWsRouter({
512
512
  })
513
513
  }
514
514
 
515
+ async function broadcastChatStateImmediately(chatId: string) {
516
+ await broadcastChatAndSidebar(chatId)
517
+ }
518
+
515
519
  function broadcastError(message: string) {
516
520
  for (const ws of sockets) {
517
521
  send(ws, {
@@ -980,6 +984,7 @@ export function createWsRouter({
980
984
  sockets.delete(ws)
981
985
  },
982
986
  broadcastSnapshots,
987
+ broadcastChatStateImmediately,
983
988
  scheduleBroadcast,
984
989
  scheduleChatStateBroadcast,
985
990
  pruneStaleEmptyChats: () => maybePruneStaleEmptyChats(),