kanna-code 0.15.0 → 0.16.0
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 +10 -0
- package/dist/client/assets/index-BET6YVYr.css +32 -0
- package/dist/client/assets/index-DMxCijCf.js +533 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/src/server/agent.ts +4 -2
- package/src/server/cli-runtime.ts +5 -1
- package/src/server/codex-app-server-protocol.ts +8 -1
- package/src/server/codex-app-server.ts +1 -1
- package/src/server/event-store.test.ts +112 -1
- package/src/server/event-store.ts +170 -26
- package/src/server/events.ts +1 -3
- package/src/server/provider-catalog.test.ts +29 -1
- package/src/server/provider-catalog.ts +8 -1
- package/src/server/read-models.test.ts +1 -1
- package/src/server/read-models.ts +3 -3
- package/src/server/server.ts +2 -0
- package/src/server/ws-router.ts +1 -1
- package/src/shared/types.ts +40 -2
- package/dist/client/assets/index-C6R1P_HL.js +0 -523
- package/dist/client/assets/index-CA-kJR8F.css +0 -32
package/src/server/server.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface StartKannaServerOptions {
|
|
|
14
14
|
port?: number
|
|
15
15
|
host?: string
|
|
16
16
|
strictPort?: boolean
|
|
17
|
+
onMigrationProgress?: (message: string) => void
|
|
17
18
|
update?: {
|
|
18
19
|
version: string
|
|
19
20
|
fetchLatestVersion: (packageName: string) => Promise<string>
|
|
@@ -28,6 +29,7 @@ export async function startKannaServer(options: StartKannaServerOptions = {}) {
|
|
|
28
29
|
const store = new EventStore()
|
|
29
30
|
const machineDisplayName = getMachineDisplayName()
|
|
30
31
|
await store.initialize()
|
|
32
|
+
await store.migrateLegacyTranscripts(options.onMigrationProgress)
|
|
31
33
|
let discoveredProjects: DiscoveredProject[] = []
|
|
32
34
|
|
|
33
35
|
async function refreshDiscovery() {
|
package/src/server/ws-router.ts
CHANGED
|
@@ -121,7 +121,7 @@ export function createWsRouter({
|
|
|
121
121
|
id,
|
|
122
122
|
snapshot: {
|
|
123
123
|
type: "chat",
|
|
124
|
-
data: deriveChatSnapshot(store.state, agent.getActiveStatuses(), topic.chatId),
|
|
124
|
+
data: deriveChatSnapshot(store.state, agent.getActiveStatuses(), topic.chatId, (chatId) => store.getMessages(chatId)),
|
|
125
125
|
},
|
|
126
126
|
}
|
|
127
127
|
}
|
package/src/shared/types.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface ProviderModelOption {
|
|
|
7
7
|
id: string
|
|
8
8
|
label: string
|
|
9
9
|
supportsEffort: boolean
|
|
10
|
+
contextWindowOptions?: readonly ProviderContextWindowOption[]
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export interface ProviderEffortOption {
|
|
@@ -14,6 +15,11 @@ export interface ProviderEffortOption {
|
|
|
14
15
|
label: string
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
export interface ProviderContextWindowOption {
|
|
19
|
+
id: ClaudeContextWindow
|
|
20
|
+
label: string
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
export const CLAUDE_REASONING_OPTIONS = [
|
|
18
24
|
{ id: "low", label: "Low" },
|
|
19
25
|
{ id: "medium", label: "Medium" },
|
|
@@ -31,10 +37,12 @@ export const CODEX_REASONING_OPTIONS = [
|
|
|
31
37
|
|
|
32
38
|
export type ClaudeReasoningEffort = (typeof CLAUDE_REASONING_OPTIONS)[number]["id"]
|
|
33
39
|
export type CodexReasoningEffort = (typeof CODEX_REASONING_OPTIONS)[number]["id"]
|
|
40
|
+
export type ClaudeContextWindow = "200k" | "1m"
|
|
34
41
|
export type ServiceTier = "fast"
|
|
35
42
|
|
|
36
43
|
export interface ClaudeModelOptions {
|
|
37
44
|
reasoningEffort: ClaudeReasoningEffort
|
|
45
|
+
contextWindow?: ClaudeContextWindow
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
export interface CodexModelOptions {
|
|
@@ -53,6 +61,7 @@ export type ModelOptions = Partial<{
|
|
|
53
61
|
|
|
54
62
|
export const DEFAULT_CLAUDE_MODEL_OPTIONS = {
|
|
55
63
|
reasoningEffort: "high",
|
|
64
|
+
contextWindow: "200k",
|
|
56
65
|
} as const satisfies ClaudeModelOptions
|
|
57
66
|
|
|
58
67
|
export const DEFAULT_CODEX_MODEL_OPTIONS = {
|
|
@@ -68,6 +77,15 @@ export function isCodexReasoningEffort(value: unknown): value is CodexReasoningE
|
|
|
68
77
|
return CODEX_REASONING_OPTIONS.some((option) => option.id === value)
|
|
69
78
|
}
|
|
70
79
|
|
|
80
|
+
export const CLAUDE_CONTEXT_WINDOW_OPTIONS = [
|
|
81
|
+
{ id: "200k", label: "200k" },
|
|
82
|
+
{ id: "1m", label: "1M" },
|
|
83
|
+
] as const satisfies readonly ProviderContextWindowOption[]
|
|
84
|
+
|
|
85
|
+
export function isClaudeContextWindow(value: unknown): value is ClaudeContextWindow {
|
|
86
|
+
return CLAUDE_CONTEXT_WINDOW_OPTIONS.some((option) => option.id === value)
|
|
87
|
+
}
|
|
88
|
+
|
|
71
89
|
export interface ProviderCatalogEntry {
|
|
72
90
|
id: AgentProvider
|
|
73
91
|
label: string
|
|
@@ -86,8 +104,8 @@ export const PROVIDERS: ProviderCatalogEntry[] = [
|
|
|
86
104
|
defaultEffort: "high",
|
|
87
105
|
supportsPlanMode: true,
|
|
88
106
|
models: [
|
|
89
|
-
{ id: "opus", label: "Opus", supportsEffort: true },
|
|
90
|
-
{ id: "sonnet", label: "Sonnet", supportsEffort: true },
|
|
107
|
+
{ id: "opus", label: "Opus", supportsEffort: true, contextWindowOptions: [...CLAUDE_CONTEXT_WINDOW_OPTIONS] },
|
|
108
|
+
{ id: "sonnet", label: "Sonnet", supportsEffort: true, contextWindowOptions: [...CLAUDE_CONTEXT_WINDOW_OPTIONS] },
|
|
91
109
|
{ id: "haiku", label: "Haiku", supportsEffort: true },
|
|
92
110
|
],
|
|
93
111
|
efforts: [...CLAUDE_REASONING_OPTIONS],
|
|
@@ -114,6 +132,26 @@ export function getProviderCatalog(provider: AgentProvider): ProviderCatalogEntr
|
|
|
114
132
|
return entry
|
|
115
133
|
}
|
|
116
134
|
|
|
135
|
+
export function getClaudeModelOption(modelId: string): ProviderModelOption | undefined {
|
|
136
|
+
return getProviderCatalog("claude").models.find((candidate) => candidate.id === modelId)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function getClaudeContextWindowOptions(modelId: string): readonly ProviderContextWindowOption[] {
|
|
140
|
+
return getClaudeModelOption(modelId)?.contextWindowOptions ?? []
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function normalizeClaudeContextWindow(modelId: string, contextWindow?: unknown): ClaudeContextWindow | undefined {
|
|
144
|
+
const options = getClaudeContextWindowOptions(modelId)
|
|
145
|
+
if (options.length === 0) return undefined
|
|
146
|
+
return options.some((option) => option.id === contextWindow)
|
|
147
|
+
? contextWindow as ClaudeContextWindow
|
|
148
|
+
: DEFAULT_CLAUDE_MODEL_OPTIONS.contextWindow
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function resolveClaudeApiModelId(modelId: string, contextWindow?: ClaudeContextWindow): string {
|
|
152
|
+
return contextWindow === "1m" ? `${modelId}[1m]` : modelId
|
|
153
|
+
}
|
|
154
|
+
|
|
117
155
|
export type KannaStatus =
|
|
118
156
|
| "idle"
|
|
119
157
|
| "starting"
|