@fabrika/canvas-kernel 0.1.45 → 0.2.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 +33 -67
- package/index.ts +19 -83
- package/package.json +68 -72
- package/src/client/AnnotationProvider.tsx +227 -268
- package/src/client/AnnotationSidebar.tsx +392 -338
- package/src/client/FileIcon.tsx +106 -65
- package/src/client/PlanRenderer.tsx +607 -551
- package/src/client/RenderErrorContext.ts +7 -7
- package/src/client/ResponsePreview.tsx +192 -173
- package/src/client/annotationDom.ts +43 -97
- package/src/client/annotationDraft.ts +98 -92
- package/src/client/appContext.tsx +40 -40
- package/src/client/components/Callout.tsx +20 -20
- package/src/client/components/Checklist.tsx +28 -28
- package/src/client/components/Choice.tsx +178 -159
- package/src/client/components/CodeBlock.tsx +26 -26
- package/src/client/components/Diff.tsx +17 -17
- package/src/client/components/FilePreview.tsx +99 -74
- package/src/client/components/Image.tsx +41 -39
- package/src/client/components/Markdown.tsx +33 -32
- package/src/client/components/Mermaid.tsx +592 -542
- package/src/client/components/Note.tsx +8 -8
- package/src/client/components/Priority.tsx +11 -11
- package/src/client/components/ResponseNote.tsx +17 -15
- package/src/client/components/Section.tsx +28 -26
- package/src/client/components/Table.tsx +34 -29
- package/src/client/components/Task.tsx +58 -60
- package/src/client/components/UserInput.tsx +169 -152
- package/src/client/components/index.ts +16 -16
- package/src/client/components/renderMarkdownChildren.tsx +86 -68
- package/src/client/diffLines.ts +51 -39
- package/src/client/generateMarkdown.ts +197 -191
- package/src/client/hostContext.tsx +34 -34
- package/src/client/index.ts +43 -125
- package/src/client/preact-all.ts +4 -4
- package/src/client/runtime.ts +58 -111
- package/src/client/styles.css +1 -74
- package/src/engine/compiler.ts +316 -313
- package/src/engine/paths.ts +44 -44
- package/src/engine/session.ts +623 -618
- package/src/engine/watcher.ts +63 -60
- package/src/engine/websocket.ts +123 -121
- package/annotate.ts +0 -94
- package/daemon.ts +0 -46
- package/src/client/AnnotationDraftFooter.tsx +0 -76
- package/src/client/AnnotationEditor.tsx +0 -320
- package/src/client/AnnotationList.tsx +0 -190
- package/src/client/Popover.tsx +0 -361
- package/src/client/SessionContext.tsx +0 -3
- package/src/client/annotationContext.ts +0 -130
- package/src/client/annotationMarkdown.ts +0 -102
- package/src/client/annotationTarget.ts +0 -73
- package/src/client/blockTarget.ts +0 -127
- package/src/client/highlightRange.ts +0 -262
- package/src/client/popoverPosition.ts +0 -46
- package/src/client/regionTarget.ts +0 -180
- package/src/client/testing/dom.ts +0 -74
- package/src/client/textTarget.ts +0 -31
- package/src/client/useRegionAnnotation.tsx +0 -188
- package/src/client/useTextAnnotation.tsx +0 -194
- package/src/client/utils.ts +0 -33
- package/src/engine/channel.ts +0 -278
- package/src/engine/http-utils.ts +0 -14
- package/src/engine/lifecycle.ts +0 -302
- package/src/engine/router.ts +0 -16
- package/src/engine/waiter.ts +0 -188
package/src/engine/paths.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { mkdirSync } from 'fs'
|
|
2
|
+
import { homedir, tmpdir } from 'os'
|
|
3
|
+
import { join } from 'path'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* On-disk layout for one canvas host (agent-canvas, fabrika, …).
|
|
@@ -10,54 +10,54 @@ import { mkdirSync } from "fs";
|
|
|
10
10
|
* coexist in one process (tests rely on this).
|
|
11
11
|
*/
|
|
12
12
|
export interface CanvasPaths {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
/** Persistent root — survives reboots. */
|
|
14
|
+
dataDir: string
|
|
15
|
+
/** Session + revision store. */
|
|
16
|
+
sessionsDir: string
|
|
17
|
+
/** Ephemeral root — may be lost on reboot. */
|
|
18
|
+
tempDir: string
|
|
19
|
+
/** Daemon PID file. */
|
|
20
|
+
pidFile: string
|
|
21
|
+
/** Scratch space for JSX compilation. */
|
|
22
|
+
compileTempDir: string
|
|
23
|
+
/** Uploaded annotation images. */
|
|
24
|
+
uploadsDir: string
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface CanvasPathsConfig {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
/** Namespace for on-disk locations, e.g. `"agent-canvas"` or `"fabrika"`. */
|
|
29
|
+
appName: string
|
|
30
|
+
/**
|
|
31
|
+
* Persistent root. Defaults to `~/.claude/<appName>`. Hosts that keep data
|
|
32
|
+
* elsewhere — or that migrate from a legacy location — resolve it themselves
|
|
33
|
+
* and pass the result; the kernel holds no migration policy.
|
|
34
|
+
*/
|
|
35
|
+
dataDir?: string
|
|
36
|
+
/** Ephemeral root. Defaults to `<tmpdir>/<appName>`. */
|
|
37
|
+
tempDir?: string
|
|
38
|
+
/** Create the directories. Pass `false` when only the strings are needed. */
|
|
39
|
+
ensure?: boolean
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export function createCanvasPaths(config: CanvasPathsConfig): CanvasPaths {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const { appName, ensure = true } = config
|
|
44
|
+
const dataDir = config.dataDir ?? join(homedir(), '.claude', appName)
|
|
45
|
+
const tempDir = config.tempDir ?? join(tmpdir(), appName)
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
const paths: CanvasPaths = {
|
|
48
|
+
dataDir,
|
|
49
|
+
sessionsDir: join(dataDir, 'sessions'),
|
|
50
|
+
tempDir,
|
|
51
|
+
pidFile: join(tempDir, 'daemon.pid'),
|
|
52
|
+
compileTempDir: join(tempDir, 'compile'),
|
|
53
|
+
uploadsDir: join(tempDir, 'uploads'),
|
|
54
|
+
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
if (ensure) {
|
|
57
|
+
mkdirSync(paths.sessionsDir, { recursive: true })
|
|
58
|
+
mkdirSync(paths.compileTempDir, { recursive: true })
|
|
59
|
+
mkdirSync(paths.uploadsDir, { recursive: true })
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
return paths
|
|
63
63
|
}
|