@cuongtran001/kanna 1.71.0 → 1.71.2
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/client/assets/{BoardsPage-CwmfG7r7.js → BoardsPage-DudYbDyu.js} +1 -1
- package/dist/client/assets/{BoardsRoutePage-CEqcmgEs.js → BoardsRoutePage-DUvJAyzh.js} +1 -1
- package/dist/client/assets/{ChatPage-CDYlmvTh.js → ChatPage-ChFKw7nK.js} +6 -6
- package/dist/client/assets/{CronJobRow-Clz1CMaP.js → CronJobRow-DU1RtrCs.js} +1 -1
- package/dist/client/assets/{CronJobsPage-Cp2ljuzG.js → CronJobsPage-cjH7p3lh.js} +1 -1
- package/dist/client/assets/{FilePreviewSheet-Dz2nMmpT.js → FilePreviewSheet-wcpWIb90.js} +1 -1
- package/dist/client/assets/{FlowSurface-D8jEIDTL.js → FlowSurface-Doyyct0h.js} +1 -1
- package/dist/client/assets/{GenUIBlock-wR_ASBOI.js → GenUIBlock-D-TBN4Um.js} +2 -2
- package/dist/client/assets/{KannaSocketProvider-CjyunR2e.js → KannaSocketProvider-uWU6WkNo.js} +1 -1
- package/dist/client/assets/{LocalProjectsPage-BSEd-eik.js → LocalProjectsPage-D8V8a3WM.js} +1 -1
- package/dist/client/assets/{SettingsPage-lO0j29v6.js → SettingsPage-CiCU3nka.js} +1 -1
- package/dist/client/assets/{StackBoardsRoutePage-Bln20SrZ.js → StackBoardsRoutePage-DDvdmA3Y.js} +1 -1
- package/dist/client/assets/{ToolCallMessage-BU_kRKSX.js → ToolCallMessage-CHJSiauG.js} +1 -1
- package/dist/client/assets/{VChartSurface-DGt2rY1C.js → VChartSurface-DVRoAi5e.js} +1 -1
- package/dist/client/assets/{WorkflowsPage-5x1x5lh7.js → WorkflowsPage-LwL034ZP.js} +1 -1
- package/dist/client/assets/{WorkflowsSection-qmqlEagS.js → WorkflowsSection-HlGaR0pJ.js} +1 -1
- package/dist/client/assets/{chart-renderer-B4RB_Vl1.js → chart-renderer-BZXJQWtw.js} +1 -1
- package/dist/client/assets/{chatSounds-o52bjGQP.js → chatSounds-BNvUSPAi.js} +1 -1
- package/dist/client/assets/chevron-left-FnMbL2tA.js +1 -0
- package/dist/client/assets/{clipboard.adapter-BvGCjfPV.js → clipboard.adapter-CIRv1YNb.js} +1 -1
- package/dist/client/assets/{columnStyle-Drcf36na.js → columnStyle-mS8DKLCV.js} +1 -1
- package/dist/client/assets/{copyFeedbackStore-FlVcAL_c.js → copyFeedbackStore-DHAfKV4i.js} +1 -1
- package/dist/client/assets/{createScopedStore-D5Oag_wd.js → createScopedStore-or82_bxr.js} +1 -1
- package/dist/client/assets/{dist-u3-1WIv4.js → dist-Cvh6FEf5.js} +1 -1
- package/dist/client/assets/{ellipsis-EuMuTlhJ.js → ellipsis-CWiRFysC.js} +1 -1
- package/dist/client/assets/{flow-kinds-BzdVFTwx.js → flow-kinds-Digyo6AB.js} +1 -1
- package/dist/client/assets/{folder-ByOaA11q.js → folder-CnSb5m9v.js} +1 -1
- package/dist/client/assets/{formatDuration-B6E9KTDu.js → formatDuration-DsrNkArK.js} +1 -1
- package/dist/client/assets/{genui-BnrsDpVz.js → genui-BagNQVNI.js} +1 -1
- package/dist/client/assets/{globe-BqmhnccZ.js → globe-tc_9UiU3.js} +1 -1
- package/dist/client/assets/{host-2KzofXms.js → host-C7I7nFuH.js} +1 -1
- package/dist/client/assets/index-D9OYZjb7.js +26 -0
- package/dist/client/assets/{info-BcTChXV5.js → info-CgLDBnLR.js} +1 -1
- package/dist/client/assets/{input-Pqq9209u.js → input-BaAZ4OHy.js} +1 -1
- package/dist/client/assets/{lexicalToReact-w1LjYOTM.js → lexicalToReact-ClgTGbzM.js} +3 -3
- package/dist/client/assets/{log-OCZfBFFe.js → log-Ch_SNBXH.js} +1 -1
- package/dist/client/assets/{monitor-fn5oGNs1.js → monitor-fFRMWd1S.js} +1 -1
- package/dist/client/assets/{pendingActionsStore-2ldF8rQh.js → pendingActionsStore-CWNaCyjS.js} +1 -1
- package/dist/client/assets/{play-BP4EBjZw.js → play-DD0bVaYg.js} +1 -1
- package/dist/client/assets/{plus-WDHArJ5z.js → plus-By3sppx5.js} +1 -1
- package/dist/client/assets/{popover-DkE_RkoX.js → popover-CJNN95M0.js} +1 -1
- package/dist/client/assets/{pushClient-BOEoH4vb.js → pushClient-DbwI0iz1.js} +1 -1
- package/dist/client/assets/runDetached-CQOu05LK.js +1 -0
- package/dist/client/assets/{segmented-control-B2_6WsRn.js → segmented-control-DYmNRyQy.js} +1 -1
- package/dist/client/assets/{select-Dq6C29O9.js → select-Dam9e0mi.js} +1 -1
- package/dist/client/assets/{settings-header-button-D76GLmVM.js → settings-header-button-DaCbsV31.js} +1 -1
- package/dist/client/assets/{sidebarPendingActions-CZXv60kH.js → sidebarPendingActions-DxI6ubAL.js} +1 -1
- package/dist/client/assets/{square-pen-BjyjvjOJ.js → square-pen-DKZvXh3R.js} +1 -1
- package/dist/client/assets/{state-mark-BAeEZoKQ.js → state-mark-DxzVQsVa.js} +1 -1
- package/dist/client/assets/{status-pill-bp46I9cx.js → status-pill-BFLy7eN9.js} +1 -1
- package/dist/client/assets/{terminal-DjwzMh1O.js → terminal-DRYQ5avJ.js} +1 -1
- package/dist/client/assets/{timer.adapter-LKIP589r.js → timer.adapter-BDh0KX9G.js} +1 -1
- package/dist/client/assets/{tools-wno-tGL1.js → tools-toomKvSw.js} +1 -1
- package/dist/client/assets/{triangle-alert-whYeOlEg.js → triangle-alert-CM5uh-kq.js} +1 -1
- package/dist/client/assets/{useAppGlobalState-DXhTq0lh.js → useAppGlobalState-BCUZEZEi.js} +1 -1
- package/dist/client/assets/useKannaState-BvJAZTpL.js +5 -0
- package/dist/client/assets/{useTheme-B-LhXBrA.js → useTheme-B6cYOPpe.js} +1 -1
- package/dist/client/icon.svg +11 -3
- package/dist/client/index.html +34 -33
- package/package.json +1 -1
- package/src/server/read-models.test.ts +59 -0
- package/src/server/read-models.ts +26 -1
- package/src/shared/stack-activity.ts +10 -0
- package/dist/client/assets/chevron-left-skoFcSB-.js +0 -1
- package/dist/client/assets/index-DfVAvdFs.js +0 -26
- package/dist/client/assets/runDetached-C-0G41cV.js +0 -1
- package/dist/client/assets/useKannaState-D7y1UZxg.js +0 -5
|
@@ -190,6 +190,65 @@ describe("read models", () => {
|
|
|
190
190
|
expect(chat?.runtime.backgroundTasks).toEqual(tasks)
|
|
191
191
|
})
|
|
192
192
|
|
|
193
|
+
describe("background subagent runs", () => {
|
|
194
|
+
function stateWithRuns(runs: { runId: string; status: string; parentRunId: string | null; startedAt: number; label: string | null }[]) {
|
|
195
|
+
const state = createEmptyState()
|
|
196
|
+
state.projectsById.set("project-1", {
|
|
197
|
+
id: "project-1", localPath: "/tmp/project", title: "Project", createdAt: 1, updatedAt: 1,
|
|
198
|
+
})
|
|
199
|
+
state.chatsById.set("chat-1", {
|
|
200
|
+
id: "chat-1", projectId: "project-1", title: "Chat", createdAt: 1, updatedAt: 1,
|
|
201
|
+
unread: false, provider: "claude", planMode: false,
|
|
202
|
+
sessionTokensByProvider: {}, sourceHash: null, lastTurnOutcome: null,
|
|
203
|
+
})
|
|
204
|
+
state.subagentRunsByChatId.set("chat-1", new Map(runs.map((run) => [
|
|
205
|
+
run.runId,
|
|
206
|
+
{
|
|
207
|
+
runId: run.runId, chatId: "chat-1", subagentId: "s1", subagentName: "researcher", label: run.label,
|
|
208
|
+
provider: "claude", model: "m", status: run.status, parentUserMessageId: "u1", parentRunId: run.parentRunId,
|
|
209
|
+
depth: 0, startedAt: run.startedAt, finishedAt: null, finalText: null, error: null,
|
|
210
|
+
usage: null, entries: [], pendingTool: null,
|
|
211
|
+
},
|
|
212
|
+
])) as never)
|
|
213
|
+
return state
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function snapshotOf(state: ReturnType<typeof stateWithRuns>, sdkTasks: { id: string; taskType: string; description: string; startedAt: number; hasOutput: boolean }[]) {
|
|
217
|
+
return deriveChatSnapshot(
|
|
218
|
+
state,
|
|
219
|
+
new Map(),
|
|
220
|
+
new Set(),
|
|
221
|
+
"chat-1",
|
|
222
|
+
() => ({ messages: [], history: { hasOlder: false, olderCursor: null, recentLimit: 200 } }),
|
|
223
|
+
() => [],
|
|
224
|
+
new Map(),
|
|
225
|
+
Date.now(),
|
|
226
|
+
new Map(),
|
|
227
|
+
[],
|
|
228
|
+
new Map([["chat-1", sdkTasks]]),
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
test("runtime.backgroundTasks lists a running top-level subagent run after the SDK tasks", () => {
|
|
233
|
+
const sdkTask = { id: "bsh42", taskType: "local_bash", description: "CI watch", startedAt: 100, hasOutput: false }
|
|
234
|
+
const state = stateWithRuns([
|
|
235
|
+
{ runId: "run-1", status: "running", parentRunId: null, startedAt: 200, label: "Survey the repo" },
|
|
236
|
+
])
|
|
237
|
+
expect(snapshotOf(state, [sdkTask])?.runtime.backgroundTasks).toEqual([
|
|
238
|
+
sdkTask,
|
|
239
|
+
{ id: "run-1", taskType: "subagent", description: "Survey the repo", startedAt: 200, hasOutput: false },
|
|
240
|
+
])
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
test("a settled run and a child run are not background tasks", () => {
|
|
244
|
+
const state = stateWithRuns([
|
|
245
|
+
{ runId: "run-done", status: "completed", parentRunId: null, startedAt: 100, label: null },
|
|
246
|
+
{ runId: "run-child", status: "running", parentRunId: "other", startedAt: 150, label: null },
|
|
247
|
+
])
|
|
248
|
+
expect(snapshotOf(state, [])?.runtime.backgroundTasks).toEqual([])
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
|
|
193
252
|
test("prefers saved project metadata over discovered entries for the same path", () => {
|
|
194
253
|
const state = createEmptyState()
|
|
195
254
|
state.projectsById.set("project-1", {
|
|
@@ -377,6 +377,31 @@ export function deriveTimings(
|
|
|
377
377
|
|
|
378
378
|
const EMPTY_BACKGROUND_TASKS: ChatBackgroundTask[] = []
|
|
379
379
|
|
|
380
|
+
export function subagentBackgroundTasks(state: StoreState, chatId: string): ChatBackgroundTask[] {
|
|
381
|
+
const runs = state.subagentRunsByChatId.get(chatId)
|
|
382
|
+
if (!runs) return []
|
|
383
|
+
return [...runs.values()]
|
|
384
|
+
.filter((run) => run.status === "running" && run.parentRunId === null)
|
|
385
|
+
.sort((a, b) => a.startedAt - b.startedAt || a.runId.localeCompare(b.runId))
|
|
386
|
+
.map((run) => ({
|
|
387
|
+
id: run.runId,
|
|
388
|
+
taskType: "subagent",
|
|
389
|
+
description: run.label ?? run.subagentName,
|
|
390
|
+
startedAt: run.startedAt,
|
|
391
|
+
hasOutput: false,
|
|
392
|
+
}))
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function chatBackgroundTasks(
|
|
396
|
+
state: StoreState,
|
|
397
|
+
chatId: string,
|
|
398
|
+
sdkTasks: ChatBackgroundTask[] | undefined,
|
|
399
|
+
): ChatBackgroundTask[] {
|
|
400
|
+
const subagentTasks = subagentBackgroundTasks(state, chatId)
|
|
401
|
+
if (subagentTasks.length === 0) return sdkTasks ?? EMPTY_BACKGROUND_TASKS
|
|
402
|
+
return [...(sdkTasks ?? []), ...subagentTasks]
|
|
403
|
+
}
|
|
404
|
+
|
|
380
405
|
export function deriveChatSnapshot(
|
|
381
406
|
state: StoreState,
|
|
382
407
|
activeStatuses: Map<string, KannaStatus>,
|
|
@@ -414,7 +439,7 @@ export function deriveChatSnapshot(
|
|
|
414
439
|
),
|
|
415
440
|
policyOverride: chat.policyOverride ?? null,
|
|
416
441
|
sessionState: claudeSessionStates.get(chat.id) ?? "cold",
|
|
417
|
-
backgroundTasks: backgroundTasksByChatId.get(chat.id)
|
|
442
|
+
backgroundTasks: chatBackgroundTasks(state, chat.id, backgroundTasksByChatId.get(chat.id)),
|
|
418
443
|
}
|
|
419
444
|
|
|
420
445
|
const transcript = getMessages(chat.id)
|
|
@@ -57,3 +57,13 @@ export function formatStackActivity(activity: StackActivity): string | null {
|
|
|
57
57
|
if (parts.length === 0) return `${activity.activeChats} active`
|
|
58
58
|
return parts.join(", ")
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
export function formatBackgroundWork(
|
|
62
|
+
activity: Pick<ChatActivity, "agents" | "backgroundTasks" | "workflow">,
|
|
63
|
+
): string | null {
|
|
64
|
+
const parts: string[] = []
|
|
65
|
+
if (activity.agents > 0) parts.push(`${activity.agents} agent${activity.agents === 1 ? "" : "s"}`)
|
|
66
|
+
if (activity.workflow !== null) parts.push("workflow")
|
|
67
|
+
if (activity.backgroundTasks > 0) parts.push(`${activity.backgroundTasks} task${activity.backgroundTasks === 1 ? "" : "s"}`)
|
|
68
|
+
return parts.length === 0 ? null : parts.join(", ")
|
|
69
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e}from"./pendingActionsStore-2ldF8rQh.js";var t={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};t.node;var n=e(t);export{n as t};
|