@fabrika/canvas-kernel 0.1.44 → 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.
Files changed (66) hide show
  1. package/README.md +33 -67
  2. package/index.ts +19 -83
  3. package/package.json +68 -72
  4. package/src/client/AnnotationProvider.tsx +227 -268
  5. package/src/client/AnnotationSidebar.tsx +392 -338
  6. package/src/client/FileIcon.tsx +106 -65
  7. package/src/client/PlanRenderer.tsx +607 -551
  8. package/src/client/RenderErrorContext.ts +7 -7
  9. package/src/client/ResponsePreview.tsx +192 -173
  10. package/src/client/annotationDom.ts +43 -97
  11. package/src/client/annotationDraft.ts +98 -92
  12. package/src/client/appContext.tsx +40 -40
  13. package/src/client/components/Callout.tsx +20 -20
  14. package/src/client/components/Checklist.tsx +28 -28
  15. package/src/client/components/Choice.tsx +178 -159
  16. package/src/client/components/CodeBlock.tsx +26 -26
  17. package/src/client/components/Diff.tsx +17 -17
  18. package/src/client/components/FilePreview.tsx +99 -74
  19. package/src/client/components/Image.tsx +41 -39
  20. package/src/client/components/Markdown.tsx +33 -32
  21. package/src/client/components/Mermaid.tsx +592 -542
  22. package/src/client/components/Note.tsx +8 -8
  23. package/src/client/components/Priority.tsx +11 -11
  24. package/src/client/components/ResponseNote.tsx +17 -15
  25. package/src/client/components/Section.tsx +28 -26
  26. package/src/client/components/Table.tsx +34 -29
  27. package/src/client/components/Task.tsx +58 -60
  28. package/src/client/components/UserInput.tsx +169 -152
  29. package/src/client/components/index.ts +16 -16
  30. package/src/client/components/renderMarkdownChildren.tsx +86 -68
  31. package/src/client/diffLines.ts +51 -39
  32. package/src/client/generateMarkdown.ts +197 -191
  33. package/src/client/hostContext.tsx +34 -34
  34. package/src/client/index.ts +43 -125
  35. package/src/client/preact-all.ts +4 -4
  36. package/src/client/runtime.ts +58 -111
  37. package/src/client/styles.css +1 -74
  38. package/src/engine/compiler.ts +316 -313
  39. package/src/engine/paths.ts +44 -44
  40. package/src/engine/session.ts +623 -618
  41. package/src/engine/watcher.ts +63 -60
  42. package/src/engine/websocket.ts +123 -121
  43. package/annotate.ts +0 -94
  44. package/daemon.ts +0 -46
  45. package/src/client/AnnotationDraftFooter.tsx +0 -76
  46. package/src/client/AnnotationEditor.tsx +0 -320
  47. package/src/client/AnnotationList.tsx +0 -190
  48. package/src/client/Popover.tsx +0 -361
  49. package/src/client/SessionContext.tsx +0 -3
  50. package/src/client/annotationContext.ts +0 -130
  51. package/src/client/annotationMarkdown.ts +0 -102
  52. package/src/client/annotationTarget.ts +0 -73
  53. package/src/client/blockTarget.ts +0 -127
  54. package/src/client/highlightRange.ts +0 -262
  55. package/src/client/popoverPosition.ts +0 -46
  56. package/src/client/regionTarget.ts +0 -180
  57. package/src/client/testing/dom.ts +0 -58
  58. package/src/client/textTarget.ts +0 -31
  59. package/src/client/useRegionAnnotation.tsx +0 -188
  60. package/src/client/useTextAnnotation.tsx +0 -194
  61. package/src/client/utils.ts +0 -33
  62. package/src/engine/channel.ts +0 -278
  63. package/src/engine/http-utils.ts +0 -14
  64. package/src/engine/lifecycle.ts +0 -302
  65. package/src/engine/router.ts +0 -16
  66. package/src/engine/waiter.ts +0 -188
@@ -1,6 +1,6 @@
1
- import { join } from "path";
2
- import { tmpdir, homedir } from "os";
3
- import { mkdirSync } from "fs";
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
- /** 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;
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
- /** 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;
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
- const { appName, ensure = true } = config;
44
- const dataDir = config.dataDir ?? join(homedir(), ".claude", appName);
45
- const tempDir = config.tempDir ?? join(tmpdir(), appName);
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
- 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
- };
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
- if (ensure) {
57
- mkdirSync(paths.sessionsDir, { recursive: true });
58
- mkdirSync(paths.compileTempDir, { recursive: true });
59
- mkdirSync(paths.uploadsDir, { recursive: true });
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
- return paths;
62
+ return paths
63
63
  }