kanna-code 0.34.4 → 0.35.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/dist/client/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
- package/dist/client/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
- package/dist/client/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
- package/dist/client/assets/index-BbuEYb7n.css +32 -0
- package/dist/client/assets/index-Dj4wUBuS.js +2613 -0
- package/dist/client/index.html +3 -3
- package/dist/export-viewer/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
- package/dist/export-viewer/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
- package/dist/export-viewer/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
- package/dist/export-viewer/assets/index-BcwN0dxP.css +1 -0
- package/dist/export-viewer/assets/index-BmJ7RE79.js +400 -0
- package/dist/export-viewer/fonts/body-medium.woff2 +0 -0
- package/dist/export-viewer/fonts/body-regular-italic.woff2 +0 -0
- package/dist/export-viewer/fonts/body-regular.woff2 +0 -0
- package/dist/export-viewer/fonts/body-semibold.woff2 +0 -0
- package/dist/export-viewer/index.html +14 -0
- package/package.json +10 -5
- package/src/server/codex-app-server.test.ts +3 -1
- package/src/server/codex-app-server.ts +2 -2
- package/src/server/paths.ts +4 -0
- package/src/server/provider-catalog.test.ts +1 -0
- package/src/server/provider-catalog.ts +2 -1
- package/src/server/read-models.test.ts +1 -0
- package/src/server/standalone-export.test.ts +173 -0
- package/src/server/standalone-export.ts +402 -0
- package/src/server/ws-router.ts +14 -0
- package/src/shared/branding.ts +1 -0
- package/src/shared/protocol.ts +9 -1
- package/src/shared/types.test.ts +2 -1
- package/src/shared/types.ts +29 -2
- package/dist/client/assets/index-C661c2yH.js +0 -2608
- package/dist/client/assets/index-N86Y2O-U.css +0 -32
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
6
|
+
<meta name="theme-color" content="#ffffff" />
|
|
7
|
+
<title>Kanna Transcript</title>
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-BmJ7RE79.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BcwN0dxP.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kanna-code",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"description": "A beautiful web UI for Claude Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -27,21 +27,25 @@
|
|
|
27
27
|
"bin/",
|
|
28
28
|
"src/server/",
|
|
29
29
|
"src/shared/",
|
|
30
|
-
"dist/client/"
|
|
30
|
+
"dist/client/",
|
|
31
|
+
"dist/export-viewer/"
|
|
31
32
|
],
|
|
32
33
|
"engines": {
|
|
33
34
|
"bun": ">=1.3.5"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
|
-
"build": "
|
|
37
|
-
"
|
|
37
|
+
"build": "bun run build:client && bun run build:export-viewer",
|
|
38
|
+
"build:client": "vite build",
|
|
39
|
+
"build:export-viewer": "vite build --config vite.export-viewer.config.ts",
|
|
40
|
+
"prepare:export-viewer-release-assets": "bun run ./scripts/prepare-export-viewer-release-assets.ts",
|
|
41
|
+
"check": "tsc --noEmit && bun run build:client && bun run build:export-viewer",
|
|
38
42
|
"dev": "bun run ./scripts/dev.ts",
|
|
39
43
|
"dev:client": "vite --host 0.0.0.0 --port 5174",
|
|
40
44
|
"dev:server": "bun run ./scripts/dev-server.ts --no-open --port 5175",
|
|
41
45
|
"install:dev": "bun install && bun run build && bun install -g .",
|
|
42
46
|
"start": "bun run ./src/server/cli.ts",
|
|
43
47
|
"test": "bun test",
|
|
44
|
-
"prepublishOnly": "
|
|
48
|
+
"prepublishOnly": "bun run build"
|
|
45
49
|
},
|
|
46
50
|
"dependencies": {
|
|
47
51
|
"@anthropic-ai/claude-agent-sdk": "^0.2.39",
|
|
@@ -65,6 +69,7 @@
|
|
|
65
69
|
"@dnd-kit/core": "^6.3.1",
|
|
66
70
|
"@dnd-kit/sortable": "^10.0.0",
|
|
67
71
|
"@dnd-kit/utilities": "^3.2.2",
|
|
72
|
+
"@fontsource-variable/bricolage-grotesque": "^5.2.10",
|
|
68
73
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
69
74
|
"@radix-ui/react-popover": "^1.1.15",
|
|
70
75
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
@@ -308,7 +308,7 @@ describe("CodexAppServerManager", () => {
|
|
|
308
308
|
} else if (message.method === "thread/start") {
|
|
309
309
|
child.writeServerMessage({
|
|
310
310
|
id: message.id,
|
|
311
|
-
result: { thread: { id: "thread-structured" }, model: "gpt-5.
|
|
311
|
+
result: { thread: { id: "thread-structured" }, model: "gpt-5.5", reasoningEffort: "high" },
|
|
312
312
|
})
|
|
313
313
|
} else if (message.method === "turn/start") {
|
|
314
314
|
child.writeServerMessage({
|
|
@@ -349,6 +349,8 @@ describe("CodexAppServerManager", () => {
|
|
|
349
349
|
|
|
350
350
|
expect(result).toBe("{\"title\":\"Codex title\"}")
|
|
351
351
|
expect(process.killed).toBe(true)
|
|
352
|
+
expect((process.messages.find((message: any) => message.method === "thread/start") as any)?.params.model).toBe("gpt-5.5")
|
|
353
|
+
expect((process.messages.find((message: any) => message.method === "turn/start") as any)?.params.model).toBe("gpt-5.5")
|
|
352
354
|
})
|
|
353
355
|
|
|
354
356
|
test("maps command execution and agent output into the shared transcript stream", async () => {
|
|
@@ -928,14 +928,14 @@ export class CodexAppServerManager {
|
|
|
928
928
|
await this.startSession({
|
|
929
929
|
chatId,
|
|
930
930
|
cwd: args.cwd,
|
|
931
|
-
model: args.model ?? "gpt-5.
|
|
931
|
+
model: args.model ?? "gpt-5.5",
|
|
932
932
|
serviceTier: args.serviceTier ?? "fast",
|
|
933
933
|
sessionToken: null,
|
|
934
934
|
})
|
|
935
935
|
|
|
936
936
|
turn = await this.startTurn({
|
|
937
937
|
chatId,
|
|
938
|
-
model: args.model ?? "gpt-5.
|
|
938
|
+
model: args.model ?? "gpt-5.5",
|
|
939
939
|
effort: args.effort,
|
|
940
940
|
serviceTier: args.serviceTier ?? "fast",
|
|
941
941
|
content: args.prompt,
|
package/src/server/paths.ts
CHANGED
|
@@ -29,3 +29,7 @@ export async function ensureProjectDirectory(localPath: string) {
|
|
|
29
29
|
export function getProjectUploadDir(localPath: string) {
|
|
30
30
|
return path.join(resolveLocalPath(localPath), ".kanna", "uploads")
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
export function getProjectExportDir(localPath: string) {
|
|
34
|
+
return path.join(resolveLocalPath(localPath), ".kanna", "exports")
|
|
35
|
+
}
|
|
@@ -57,6 +57,7 @@ describe("provider catalog normalization", () => {
|
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
test("normalizes server model ids through the shared alias catalog", () => {
|
|
60
|
+
expect(normalizeServerModel("codex")).toBe("gpt-5.5")
|
|
60
61
|
expect(normalizeServerModel("claude", "opus")).toBe("claude-opus-4-7")
|
|
61
62
|
expect(normalizeServerModel("codex", "gpt-5-codex")).toBe("gpt-5.3-codex")
|
|
62
63
|
})
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "../shared/types"
|
|
20
20
|
|
|
21
21
|
const HARD_CODED_CODEX_MODELS: ProviderModelOption[] = [
|
|
22
|
+
{ id: "gpt-5.5", label: "GPT-5.5", supportsEffort: false },
|
|
22
23
|
{ id: "gpt-5.4", label: "GPT-5.4", supportsEffort: false },
|
|
23
24
|
{ id: "gpt-5.3-codex", label: "GPT-5.3 Codex", supportsEffort: false },
|
|
24
25
|
{ id: "gpt-5.3-codex-spark", label: "GPT-5.3 Codex Spark", supportsEffort: false },
|
|
@@ -28,7 +29,7 @@ export const SERVER_PROVIDERS: ProviderCatalogEntry[] = PROVIDERS.map((provider)
|
|
|
28
29
|
provider.id === "codex"
|
|
29
30
|
? {
|
|
30
31
|
...provider,
|
|
31
|
-
defaultModel: "gpt-5.
|
|
32
|
+
defaultModel: "gpt-5.5",
|
|
32
33
|
models: HARD_CODED_CODEX_MODELS,
|
|
33
34
|
}
|
|
34
35
|
: provider
|
|
@@ -86,6 +86,7 @@ describe("read models", () => {
|
|
|
86
86
|
expect(chat?.history.recentLimit).toBe(200)
|
|
87
87
|
expect(chat?.availableProviders.length).toBeGreaterThan(1)
|
|
88
88
|
expect(chat?.availableProviders.find((provider) => provider.id === "codex")?.models.map((model) => model.id)).toEqual([
|
|
89
|
+
"gpt-5.5",
|
|
89
90
|
"gpt-5.4",
|
|
90
91
|
"gpt-5.3-codex",
|
|
91
92
|
"gpt-5.3-codex-spark",
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from "bun:test"
|
|
2
|
+
import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises"
|
|
3
|
+
import { tmpdir } from "node:os"
|
|
4
|
+
import path from "node:path"
|
|
5
|
+
import type { TranscriptEntry } from "../shared/types"
|
|
6
|
+
import { writeStandaloneTranscriptExport } from "./standalone-export"
|
|
7
|
+
|
|
8
|
+
const tempDirs: string[] = []
|
|
9
|
+
|
|
10
|
+
async function createTempDir(prefix: string) {
|
|
11
|
+
const dir = await mkdtemp(path.join(tmpdir(), prefix))
|
|
12
|
+
tempDirs.push(dir)
|
|
13
|
+
return dir
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
afterEach(async () => {
|
|
17
|
+
await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })))
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
async function createViewerDist() {
|
|
21
|
+
const viewerDistDir = await createTempDir("kanna-viewer-")
|
|
22
|
+
await mkdir(path.join(viewerDistDir, "assets"), { recursive: true })
|
|
23
|
+
await writeFile(path.join(viewerDistDir, "index.html"), "<!doctype html><html><body><div id=\"root\"></div></body></html>\n", "utf8")
|
|
24
|
+
await writeFile(path.join(viewerDistDir, "assets", "viewer.js"), "console.log('viewer')\n", "utf8")
|
|
25
|
+
return viewerDistDir
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function createMessages(attachmentAbsolutePath: string): TranscriptEntry[] {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
_id: "user-1",
|
|
32
|
+
createdAt: Date.now(),
|
|
33
|
+
kind: "user_prompt",
|
|
34
|
+
messageId: "message-1",
|
|
35
|
+
content: "Please review this attachment.",
|
|
36
|
+
attachments: [{
|
|
37
|
+
id: "attachment-1",
|
|
38
|
+
kind: "image",
|
|
39
|
+
displayName: "mock.png",
|
|
40
|
+
absolutePath: attachmentAbsolutePath,
|
|
41
|
+
relativePath: "./.kanna/uploads/mock.png",
|
|
42
|
+
contentUrl: "/api/projects/project-1/uploads/mock.png/content",
|
|
43
|
+
mimeType: "image/png",
|
|
44
|
+
size: 4,
|
|
45
|
+
}],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
_id: "assistant-1",
|
|
49
|
+
createdAt: Date.now(),
|
|
50
|
+
kind: "assistant_text",
|
|
51
|
+
messageId: "message-2",
|
|
52
|
+
text: `Looks good in ${attachmentAbsolutePath}.`,
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
describe("writeStandaloneTranscriptExport", () => {
|
|
58
|
+
test("writes a metadata-only export with viewer assets and sanitized attachments", async () => {
|
|
59
|
+
const viewerDistDir = await createViewerDist()
|
|
60
|
+
const projectDir = await createTempDir("kanna-project-")
|
|
61
|
+
const uploadsDir = path.join(projectDir, ".kanna", "uploads")
|
|
62
|
+
await mkdir(uploadsDir, { recursive: true })
|
|
63
|
+
const attachmentPath = path.join(uploadsDir, "mock.png")
|
|
64
|
+
await writeFile(attachmentPath, "mock", "utf8")
|
|
65
|
+
const uploadedRequests = new Map<string, string>()
|
|
66
|
+
|
|
67
|
+
const result = await writeStandaloneTranscriptExport({
|
|
68
|
+
chatId: "chat-1",
|
|
69
|
+
title: "Release Review",
|
|
70
|
+
localPath: projectDir,
|
|
71
|
+
theme: "dark",
|
|
72
|
+
attachmentMode: "metadata",
|
|
73
|
+
messages: createMessages(attachmentPath),
|
|
74
|
+
}, {
|
|
75
|
+
fetch: async (input, init) => {
|
|
76
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url
|
|
77
|
+
const body = init?.body
|
|
78
|
+
const bodyText = typeof body === "string"
|
|
79
|
+
? body
|
|
80
|
+
: body instanceof Uint8Array
|
|
81
|
+
? new TextDecoder().decode(body)
|
|
82
|
+
: ""
|
|
83
|
+
uploadedRequests.set(url, bodyText)
|
|
84
|
+
expect(init?.method).toBe("PUT")
|
|
85
|
+
return new Response(JSON.stringify({ ok: true }), {
|
|
86
|
+
status: 200,
|
|
87
|
+
headers: {
|
|
88
|
+
"content-type": "application/json",
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
},
|
|
92
|
+
sharePublicBaseUrl: "https://share.example.com",
|
|
93
|
+
shareSlugSuffix: "ax71234ka",
|
|
94
|
+
shareUploadBaseUrl: "https://upload.example.com/api/share",
|
|
95
|
+
viewerDistDir,
|
|
96
|
+
now: new Date("2026-04-23T12:34:56.000Z"),
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
expect(await Bun.file(result.indexHtmlPath).exists()).toBe(true)
|
|
100
|
+
expect(await Bun.file(path.join(result.outputDir, "assets", "viewer.js")).exists()).toBe(true)
|
|
101
|
+
expect(result.totalAttachmentCount).toBe(1)
|
|
102
|
+
expect(result.bundledAttachmentCount).toBe(0)
|
|
103
|
+
expect(result.shareSlug).toBe("release-review-ax71234ka")
|
|
104
|
+
expect(result.shareUrl).toBe("https://share.example.com/release-review-ax71234ka")
|
|
105
|
+
expect(result.uploadedFileCount).toBe(1)
|
|
106
|
+
|
|
107
|
+
const bundle = await Bun.file(result.transcriptJsonPath).json()
|
|
108
|
+
expect(bundle.title).toBe("Release Review")
|
|
109
|
+
expect(bundle.viewerVersion).toBeDefined()
|
|
110
|
+
expect(bundle.theme).toBe("dark")
|
|
111
|
+
expect(bundle.attachmentMode).toBe("metadata")
|
|
112
|
+
expect(bundle.localPath).toBe("/workspace")
|
|
113
|
+
expect(bundle.messages[0].attachments[0].contentUrl).toBe("")
|
|
114
|
+
expect(bundle.messages[0].attachments[0].absolutePath).toBe("")
|
|
115
|
+
expect(bundle.messages[0].attachments[0].relativePath).toBe("")
|
|
116
|
+
expect(JSON.stringify(bundle)).not.toContain(projectDir)
|
|
117
|
+
expect([...uploadedRequests.keys()]).toEqual([
|
|
118
|
+
"https://upload.example.com/api/share/release-review-ax71234ka/transcript.json",
|
|
119
|
+
])
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
test("copies attachments into the export when bundle mode is selected", async () => {
|
|
123
|
+
const viewerDistDir = await createViewerDist()
|
|
124
|
+
const projectDir = await createTempDir("kanna-project-")
|
|
125
|
+
const uploadsDir = path.join(projectDir, ".kanna", "uploads")
|
|
126
|
+
await mkdir(uploadsDir, { recursive: true })
|
|
127
|
+
const attachmentPath = path.join(uploadsDir, "mock.png")
|
|
128
|
+
await writeFile(attachmentPath, "mock", "utf8")
|
|
129
|
+
const uploadedPaths: string[] = []
|
|
130
|
+
|
|
131
|
+
const result = await writeStandaloneTranscriptExport({
|
|
132
|
+
chatId: "chat-1",
|
|
133
|
+
title: "Release Review",
|
|
134
|
+
localPath: projectDir,
|
|
135
|
+
theme: "light",
|
|
136
|
+
attachmentMode: "bundle",
|
|
137
|
+
messages: createMessages(attachmentPath),
|
|
138
|
+
}, {
|
|
139
|
+
fetch: async (input) => {
|
|
140
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url
|
|
141
|
+
uploadedPaths.push(url)
|
|
142
|
+
return new Response(JSON.stringify({ ok: true }), {
|
|
143
|
+
status: 200,
|
|
144
|
+
headers: {
|
|
145
|
+
"content-type": "application/json",
|
|
146
|
+
},
|
|
147
|
+
})
|
|
148
|
+
},
|
|
149
|
+
sharePublicBaseUrl: "https://share.example.com",
|
|
150
|
+
shareSlugSuffix: "bundle123",
|
|
151
|
+
shareUploadBaseUrl: "https://upload.example.com/api/share",
|
|
152
|
+
viewerDistDir,
|
|
153
|
+
now: new Date("2026-04-23T12:34:56.000Z"),
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
expect(result.totalAttachmentCount).toBe(1)
|
|
157
|
+
expect(result.bundledAttachmentCount).toBe(1)
|
|
158
|
+
expect(result.shareUrl).toBe("https://share.example.com/release-review-bundle123")
|
|
159
|
+
expect(result.uploadedFileCount).toBe(2)
|
|
160
|
+
|
|
161
|
+
const bundle = await Bun.file(result.transcriptJsonPath).json()
|
|
162
|
+
const exportedAttachment = bundle.messages[0].attachments[0]
|
|
163
|
+
expect(bundle.viewerVersion).toBeDefined()
|
|
164
|
+
expect(exportedAttachment.contentUrl).toStartWith("./attachments/")
|
|
165
|
+
expect(exportedAttachment.absolutePath).toStartWith("./attachments/")
|
|
166
|
+
expect(exportedAttachment.relativePath).toStartWith("./attachments/")
|
|
167
|
+
expect(await Bun.file(path.join(result.outputDir, exportedAttachment.contentUrl.replace(/^\.\//u, ""))).text()).toBe("mock")
|
|
168
|
+
expect(uploadedPaths).toEqual([
|
|
169
|
+
"https://upload.example.com/api/share/release-review-bundle123/transcript.json",
|
|
170
|
+
expect.stringContaining("https://upload.example.com/api/share/release-review-bundle123/attachments/"),
|
|
171
|
+
])
|
|
172
|
+
})
|
|
173
|
+
})
|