@fabrika/canvas-kernel 0.9.0-dev.1 → 0.9.0-dev.3

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 (44) hide show
  1. package/package.json +18 -11
  2. package/types/index.d.ts +11 -0
  3. package/types/src/client/AnnotationProvider.d.ts +31 -0
  4. package/types/src/client/AnnotationSidebar.d.ts +12 -0
  5. package/types/src/client/FileIcon.d.ts +8 -0
  6. package/types/src/client/PlanRenderer.d.ts +7 -0
  7. package/types/src/client/RenderErrorContext.d.ts +8 -0
  8. package/types/src/client/ResponsePreview.d.ts +12 -0
  9. package/types/src/client/annotationDom.d.ts +12 -0
  10. package/types/src/client/annotationDraft.d.ts +18 -0
  11. package/types/src/client/appContext.d.ts +48 -0
  12. package/types/src/client/components/Callout.d.ts +7 -0
  13. package/types/src/client/components/Checklist.d.ts +9 -0
  14. package/types/src/client/components/Choice.d.ts +21 -0
  15. package/types/src/client/components/CodeBlock.d.ts +7 -0
  16. package/types/src/client/components/Diff.d.ts +7 -0
  17. package/types/src/client/components/FilePreview.d.ts +8 -0
  18. package/types/src/client/components/Image.d.ts +9 -0
  19. package/types/src/client/components/Markdown.d.ts +11 -0
  20. package/types/src/client/components/Mermaid.d.ts +6 -0
  21. package/types/src/client/components/Note.d.ts +6 -0
  22. package/types/src/client/components/Priority.d.ts +5 -0
  23. package/types/src/client/components/ResponseNote.d.ts +7 -0
  24. package/types/src/client/components/Section.d.ts +7 -0
  25. package/types/src/client/components/Table.d.ts +6 -0
  26. package/types/src/client/components/Task.d.ts +15 -0
  27. package/types/src/client/components/UserInput.d.ts +22 -0
  28. package/types/src/client/components/index.d.ts +16 -0
  29. package/types/src/client/components/renderMarkdownChildren.d.ts +8 -0
  30. package/types/src/client/diffLines.d.ts +7 -0
  31. package/types/src/client/generateMarkdown.d.ts +29 -0
  32. package/types/src/client/hostContext.d.ts +30 -0
  33. package/types/src/client/index.d.ts +20 -0
  34. package/types/src/client/pageGlobals.d.ts +29 -0
  35. package/types/src/client/persistenceSchemas.d.ts +1147 -0
  36. package/types/src/client/preact-all.d.ts +4 -0
  37. package/types/src/client/runtime.d.ts +62 -0
  38. package/types/src/engine/compiler.d.ts +44 -0
  39. package/types/src/engine/file-admission.d.ts +6 -0
  40. package/types/src/engine/paths.d.ts +36 -0
  41. package/types/src/engine/session.d.ts +176 -0
  42. package/types/src/engine/sessionSchemas.d.ts +2630 -0
  43. package/types/src/engine/watcher.d.ts +16 -0
  44. package/types/src/engine/websocket.d.ts +38 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/canvas-kernel",
3
- "version": "0.9.0-dev.1",
3
+ "version": "0.9.0-dev.3",
4
4
  "type": "module",
5
5
  "description": "Canvas JSX compiler, session/revision store, renderer and interactive component library.",
6
6
  "license": "MIT",
@@ -16,40 +16,47 @@
16
16
  "index.ts",
17
17
  "src",
18
18
  "!src/**/*.test.ts",
19
- "!src/**/*.test.tsx"
19
+ "!src/**/*.test.tsx",
20
+ "types"
20
21
  ],
21
22
  "exports": {
22
23
  ".": {
23
24
  "bun": "./index.ts",
24
- "types": "./index.ts",
25
+ "types": "./types/index.d.ts",
25
26
  "default": "./index.ts"
26
27
  },
27
28
  "./server": {
28
29
  "bun": "./index.ts",
29
- "types": "./index.ts",
30
+ "types": "./types/index.d.ts",
30
31
  "default": "./index.ts"
31
32
  },
32
33
  "./client": {
33
34
  "bun": "./src/client/index.ts",
34
- "types": "./src/client/index.ts",
35
+ "types": "./types/src/client/index.d.ts",
35
36
  "default": "./src/client/index.ts"
36
37
  },
37
38
  "./components": {
38
39
  "bun": "./src/client/components/index.ts",
39
- "types": "./src/client/components/index.ts",
40
+ "types": "./types/src/client/components/index.d.ts",
40
41
  "default": "./src/client/components/index.ts"
41
42
  },
42
43
  "./runtime": {
43
44
  "bun": "./src/client/runtime.ts",
44
- "types": "./src/client/runtime.ts",
45
+ "types": "./types/src/client/runtime.d.ts",
45
46
  "default": "./src/client/runtime.ts"
46
47
  },
47
48
  "./styles.css": "./src/client/styles.css",
48
49
  "./theme.css": "./src/client/theme.css"
49
50
  },
50
51
  "imports": {
51
- "#canvas/components": "./src/client/components/index.ts",
52
- "#canvas/runtime": "./src/client/runtime.ts"
52
+ "#canvas/components": {
53
+ "types": "./types/src/client/components/index.d.ts",
54
+ "default": "./src/client/components/index.ts"
55
+ },
56
+ "#canvas/runtime": {
57
+ "types": "./types/src/client/runtime.d.ts",
58
+ "default": "./src/client/runtime.ts"
59
+ }
53
60
  },
54
61
  "scripts": {
55
62
  "typecheck": "tsc --noEmit",
@@ -57,8 +64,8 @@
57
64
  },
58
65
  "dependencies": {
59
66
  "zod": "^3.25.76",
60
- "@fabrika/annotations": "0.9.0-dev.1",
61
- "@fabrika/daemon-kit": "0.9.0-dev.1",
67
+ "@fabrika/annotations": "0.9.0-dev.3",
68
+ "@fabrika/daemon-kit": "0.9.0-dev.3",
62
69
  "marked": "^17.0.4",
63
70
  "mermaid-parser-bundle": "^0.1.2",
64
71
  "preact": "^10.25.0",
@@ -0,0 +1,11 @@
1
+ export { compileJsx, compilePlan, KERNEL_COMPONENTS } from './src/engine/compiler';
2
+ export type { CanvasComponents, CanvasComponentSpec, CompileOptions, CompileResult } from './src/engine/compiler';
3
+ export type { AssertReadable } from './src/engine/file-admission';
4
+ export { createCanvasPaths } from './src/engine/paths';
5
+ export type { CanvasPaths, CanvasPathsConfig } from './src/engine/paths';
6
+ export { SessionManager } from './src/engine/session';
7
+ export type { CanvasFileInfo, CanvasScope, DiffStats, RemoteAnnotation, RemoteFeedbackEntry, RevisionInfo, SecretResolution, SessionData, ShareEntry, } from './src/engine/session';
8
+ export { unwatchAll, unwatchSession, watchSession } from './src/engine/watcher';
9
+ export type { WatchOptions } from './src/engine/watcher';
10
+ export { createWebSocketManager } from './src/engine/websocket';
11
+ export type { CanvasSocket, WebSocketManagerOptions, WSData } from './src/engine/websocket';
@@ -0,0 +1,31 @@
1
+ import type { Annotation, AnnotationContext, AnnotationContextValue, FeedbackEntry, PlanResponse } from '#canvas/runtime';
2
+ import React from 'react';
3
+ import { type AnnotationDraftPhase } from './annotationDraft';
4
+ export type { Annotation, AnnotationContext, AnnotationContextValue, FeedbackEntry, PlanResponse };
5
+ export { useAnnotations } from '#canvas/runtime';
6
+ export interface PersistedState {
7
+ annotations: Annotation[];
8
+ generalNote: string;
9
+ responses: [string, PlanResponse][];
10
+ feedbackEntries?: [string, FeedbackEntry][];
11
+ }
12
+ interface AnnotationProviderProps {
13
+ sessionId: string;
14
+ revision: number;
15
+ isReadOnly: boolean;
16
+ draftPhase: AnnotationDraftPhase;
17
+ /** Remote annotations fetched from shared views. Merged read-only into
18
+ * the annotation list so they render alongside the author's own. */
19
+ remoteAnnotations?: Annotation[];
20
+ /** Canvas files this revision is made of. Supplying it enables pruning of
21
+ * answers to questions the revision no longer asks; omit it and every
22
+ * answer is submitted, which is what a host without canvas tabs wants. */
23
+ canvasFiles?: readonly string[];
24
+ /** Server-authoritative persistence. When supplied, the draft is loaded and
25
+ * saved through these instead of localStorage, so it survives reloads and
26
+ * follows the author across browsers. Omit for the localStorage default. */
27
+ loadState?: (sessionId: string, revision: number, phase: AnnotationDraftPhase) => Promise<PersistedState | null>;
28
+ saveState?: (sessionId: string, revision: number, state: PersistedState, phase: AnnotationDraftPhase) => void;
29
+ children: React.ReactNode;
30
+ }
31
+ export declare function AnnotationProvider({ sessionId, revision, isReadOnly, draftPhase, remoteAnnotations, canvasFiles, loadState, saveState, children }: AnnotationProviderProps): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ /**
3
+ * The canvas host's sidebar: the reusable annotation list and draft footer,
4
+ * wrapped in the chrome only a canvas has — revisions, per-revision feedback,
5
+ * canvas files, agent responses, and the wait for the agent to come back.
6
+ */
7
+ interface AnnotationSidebarProps {
8
+ onSubmit: (feedback: string) => void;
9
+ collapseButton?: React.ReactNode;
10
+ }
11
+ export declare function AnnotationSidebar({ onSubmit, collapseButton }: AnnotationSidebarProps): React.JSX.Element;
12
+ export {};
@@ -0,0 +1,8 @@
1
+ interface FileIconProps {
2
+ name: string;
3
+ type: 'file' | 'dir';
4
+ expanded?: boolean;
5
+ className?: string;
6
+ }
7
+ export declare function FileIcon({ name, type, expanded, className }: FileIconProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface PlanRendererProps {
3
+ revision: number;
4
+ filename: string;
5
+ }
6
+ export declare function PlanRenderer({ revision, filename }: PlanRendererProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface CanvasRenderError {
2
+ revision: number;
3
+ filename: string;
4
+ message: string;
5
+ stack?: string;
6
+ componentStack?: string;
7
+ }
8
+ export declare const RenderErrorContext: import("react").Context<(error: CanvasRenderError) => void>;
@@ -0,0 +1,12 @@
1
+ interface ResponsePreviewProps {
2
+ open: boolean;
3
+ onClose: () => void;
4
+ onSubmit: (feedback: string) => void;
5
+ includedRemoteIds: Set<string>;
6
+ onToggleRemoteId: (id: string) => void;
7
+ }
8
+ export declare function ResponsePreview({ open, onClose, onSubmit, includedRemoteIds, onToggleRemoteId }: ResponsePreviewProps): import("react").JSX.Element | null;
9
+ export declare function MarkdownPreview({ text }: {
10
+ text: string;
11
+ }): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Annotation } from './AnnotationProvider';
2
+ import type { ActiveView } from './appContext';
3
+ /**
4
+ * Find the DOM element for an annotation — the decoration this kernel drew for
5
+ * it, or failing that whatever its snippet names.
6
+ */
7
+ export declare function findAnnotationElement(ann: Annotation): HTMLElement | null;
8
+ /**
9
+ * Scroll the canvas/file view to an annotation element and flash it.
10
+ * Handles file annotations by switching view first.
11
+ */
12
+ export declare function scrollToAnnotation(ann: Annotation, setActiveView: (view: ActiveView) => void): void;
@@ -0,0 +1,18 @@
1
+ interface RevisionState {
2
+ revision: number;
3
+ hasFeedback: boolean;
4
+ }
5
+ interface AnnotationStorage {
6
+ getItem(key: string): string | null;
7
+ setItem(key: string, value: string): void;
8
+ removeItem(key: string): void;
9
+ }
10
+ interface RemovableAnnotationStorage {
11
+ removeItem(key: string): void;
12
+ }
13
+ export type AnnotationDraftPhase = 'current' | 'next';
14
+ export declare function annotationDraftKey(sessionId: string, revision: number, phase?: AnnotationDraftPhase): string;
15
+ export declare function clearPersistedDraft(storage: RemovableAnnotationStorage, sessionId: string, revision: number): void;
16
+ /** Carry an unsent draft forward without crossing submitted revisions. */
17
+ export declare function carryUnsubmittedDraft(storage: AnnotationStorage, sessionId: string, targetRevision: number, revisions: RevisionState[]): number | null;
18
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { ActiveView } from '#canvas/runtime';
2
+ /**
3
+ * Shell state the annotation surface reads but does not own.
4
+ *
5
+ * The kernel ships no app shell — each host builds its own chrome — but the
6
+ * reusable annotation surface still needs to know which revision is on screen
7
+ * and how to navigate. The host provides both contexts around the surface.
8
+ */
9
+ export type { ActiveView };
10
+ export interface CanvasFileInfo {
11
+ filename: string;
12
+ diffStats?: {
13
+ added: number;
14
+ removed: number;
15
+ };
16
+ }
17
+ export interface RevisionInfo {
18
+ revision: number;
19
+ label?: string;
20
+ canvasFiles: CanvasFileInfo[];
21
+ createdAt: string;
22
+ hasFeedback: boolean;
23
+ feedbackConsumed: boolean;
24
+ response?: string;
25
+ }
26
+ export declare const ActiveViewContext: import("react").Context<{
27
+ activeView: ActiveView;
28
+ setActiveView: (v: ActiveView) => void;
29
+ openFiles: string[];
30
+ closeFile: (path: string) => void;
31
+ canvasFiles: string[];
32
+ }>;
33
+ export declare const RevisionContext: import("react").Context<{
34
+ currentRevision: number;
35
+ selectedRevision: number;
36
+ revisions: RevisionInfo[];
37
+ setSelectedRevision: (rev: number) => void;
38
+ isReadOnly: boolean;
39
+ compareRevision: {
40
+ left: number;
41
+ right: number;
42
+ } | null;
43
+ setCompareRevision: (rev: {
44
+ left: number;
45
+ right: number;
46
+ } | null) => void;
47
+ agentWatching: boolean;
48
+ }>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface CalloutProps {
3
+ type?: 'info' | 'warning' | 'danger' | 'tip';
4
+ children?: React.ReactNode;
5
+ }
6
+ export declare function Callout({ type, children }: CalloutProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ interface ChecklistItem {
2
+ label: string;
3
+ checked: boolean;
4
+ }
5
+ interface ChecklistProps {
6
+ items: ChecklistItem[];
7
+ }
8
+ export declare function Checklist({ items }: ChecklistProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ export type ChoiceOption = string | {
2
+ value: string;
3
+ label?: string;
4
+ };
5
+ /** Radio — pick one option */
6
+ interface ChoiceProps {
7
+ id: string;
8
+ label: string;
9
+ options: ChoiceOption[];
10
+ required?: boolean;
11
+ }
12
+ export declare function Choice({ id, label, options, required }: ChoiceProps): import("react").JSX.Element;
13
+ /** Checkbox — pick multiple options */
14
+ interface MultiChoiceProps {
15
+ id: string;
16
+ label: string;
17
+ options: ChoiceOption[];
18
+ required?: boolean;
19
+ }
20
+ export declare function MultiChoice({ id, label, options, required }: MultiChoiceProps): import("react").JSX.Element;
21
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface CodeBlockProps {
3
+ language?: string;
4
+ children?: React.ReactNode;
5
+ }
6
+ export declare function CodeBlock({ language, children }: CodeBlockProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ interface DiffProps {
2
+ before: string;
3
+ after: string;
4
+ language?: string;
5
+ }
6
+ export declare function Diff({ before, after, language }: DiffProps): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ interface FilePreviewProps {
2
+ path: string;
3
+ lines?: [number, number];
4
+ /** Injected by compiler at build time — skip runtime fetch when present */
5
+ __content?: string;
6
+ }
7
+ export declare function FilePreview({ path, lines, __content }: FilePreviewProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ interface ImageProps {
2
+ src: string;
3
+ alt?: string;
4
+ caption?: string;
5
+ width?: number | string;
6
+ height?: number | string;
7
+ }
8
+ export declare function ImageView({ src, alt, caption, width, height }: ImageProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface MarkdownProps {
3
+ /** Inline markdown source (via children) */
4
+ children?: React.ReactNode;
5
+ /** File path (resolved at compile time) */
6
+ file?: string;
7
+ /** Injected by compiler when file prop is used */
8
+ __content?: string;
9
+ }
10
+ export declare function Markdown({ children, file, __content }: MarkdownProps): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface MermaidProps {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare function Mermaid({ children }: MermaidProps): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface NoteProps {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare function Note({ children }: NoteProps): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ interface PriorityProps {
2
+ level: 'high' | 'medium' | 'low';
3
+ }
4
+ export declare function Priority({ level }: PriorityProps): import("react").JSX.Element;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ /** Seamless note input for response components */
2
+ export declare function ResponseNote({ note, onChange }: {
3
+ show?: boolean;
4
+ note: string;
5
+ onToggle?: () => void;
6
+ onChange: (n: string) => void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface SectionProps {
3
+ title: string;
4
+ children?: React.ReactNode;
5
+ }
6
+ export declare function Section({ title, children }: SectionProps): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ interface TableProps {
2
+ headers: string[];
3
+ rows: string[][];
4
+ }
5
+ export declare function Table({ headers, rows }: TableProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ type Status = 'todo' | 'done' | 'blocked' | 'in-progress';
3
+ type BadgeVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';
4
+ interface ItemProps {
5
+ id: string;
6
+ label: string;
7
+ status?: Status;
8
+ badge?: string;
9
+ badgeVariant?: BadgeVariant;
10
+ children?: React.ReactNode;
11
+ }
12
+ export declare function Item({ id, label, status, badge, badgeVariant, children }: ItemProps): React.JSX.Element;
13
+ /** @deprecated Use <Item> instead */
14
+ export declare function Task(props: ItemProps): React.JSX.Element;
15
+ export {};
@@ -0,0 +1,22 @@
1
+ /** Free text input from user */
2
+ interface UserInputProps {
3
+ id: string;
4
+ label: string;
5
+ placeholder?: string;
6
+ multiline?: boolean;
7
+ required?: boolean;
8
+ }
9
+ export declare function UserInput({ id, label, placeholder, multiline, required }: UserInputProps): import("react").JSX.Element;
10
+ /** Numeric range / slider */
11
+ interface RangeInputProps {
12
+ id: string;
13
+ label: string;
14
+ min?: number;
15
+ max?: number;
16
+ step?: number;
17
+ required?: boolean;
18
+ minLabel?: string;
19
+ maxLabel?: string;
20
+ }
21
+ export declare function RangeInput({ id, label, min, max, step, required, minLabel, maxLabel }: RangeInputProps): import("react").JSX.Element;
22
+ export {};
@@ -0,0 +1,16 @@
1
+ export { useFeedback } from '#canvas/runtime';
2
+ export { Callout } from './Callout';
3
+ export { Checklist } from './Checklist';
4
+ export { Choice, MultiChoice } from './Choice';
5
+ export { CodeBlock } from './CodeBlock';
6
+ export { Diff } from './Diff';
7
+ export { FilePreview } from './FilePreview';
8
+ export { ImageView } from './Image';
9
+ export { Markdown } from './Markdown';
10
+ export { Mermaid } from './Mermaid';
11
+ export { Note } from './Note';
12
+ export { Priority } from './Priority';
13
+ export { Section } from './Section';
14
+ export { Table } from './Table';
15
+ export { Item, Task } from './Task';
16
+ export { RangeInput, UserInput } from './UserInput';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ /**
3
+ * Auto-render markdown for string children, passing JSX children through.
4
+ * Block-level JSX (Callout, Diff, etc.) breaks the prose into separate markdown blocks,
5
+ * while inline JSX (code, strong, links) stays within the surrounding paragraph so text
6
+ * keeps flowing instead of stacking one fragment per line.
7
+ */
8
+ export declare function renderMarkdownChildren(children: React.ReactNode): React.ReactNode;
@@ -0,0 +1,7 @@
1
+ export interface DiffLine {
2
+ type: 'same' | 'removed' | 'added';
3
+ line: string;
4
+ }
5
+ /** Line-level diff of two texts, longest-common-subsequence based. */
6
+ export declare function buildDiffLines(before: string, after: string): DiffLine[];
7
+ export declare function computeLCS(a: string[], b: string[]): string[];
@@ -0,0 +1,29 @@
1
+ import type { Annotation, FeedbackEntry, PlanResponse } from './AnnotationProvider';
2
+ /**
3
+ * Drop answers whose question is not in this revision's canvas. A draft carried
4
+ * forward by carryUnsubmittedDraft() can hold an answer to a question the new
5
+ * revision removed; submitting that would report an answer the author was never
6
+ * asked for.
7
+ *
8
+ * `seenResponseIds` must be the sticky set of controls that have mounted at any
9
+ * point in this draft, never the currently-mounted ones — see canPruneResponses.
10
+ */
11
+ export declare function pruneStaleResponses(responses: Map<string, PlanResponse>, seenResponseIds: ReadonlySet<string>): Map<string, PlanResponse>;
12
+ /**
13
+ * Whether the set of seen response ids is complete enough to prune against.
14
+ *
15
+ * An id is only evidence of absence once every canvas that could host it has
16
+ * rendered. Until then "not seen" means "not looked at yet" — the host opens
17
+ * multi-canvas sessions on the overview, where no canvas is mounted at all, so
18
+ * pruning early would throw away every answer the author gave.
19
+ */
20
+ export declare function canPruneResponses(canvasFiles: readonly string[] | undefined, renderedCanvases: ReadonlySet<string>): boolean;
21
+ /**
22
+ * Generate human-readable markdown feedback from annotations and responses.
23
+ */
24
+ export declare function generateMarkdown(annotations: Annotation[], generalNote: string, responses?: Map<string, PlanResponse>, feedbackEntries?: Map<string, FeedbackEntry>, includedRemoteIds?: Set<string>): string;
25
+ export declare function hasValue(r: PlanResponse): boolean;
26
+ export declare function getMissingRequired(responses: Map<string, PlanResponse>): PlanResponse[];
27
+ export declare function getMissingRequiredFeedback(entries: Map<string, FeedbackEntry>): FeedbackEntry[];
28
+ /** Returns list of missing required field labels, or empty if all valid */
29
+ export declare function getMissingRequiredLabels(responses: Map<string, PlanResponse>, feedbackEntries: Map<string, FeedbackEntry>): string[];
@@ -0,0 +1,30 @@
1
+ import { type ComponentType } from 'react';
2
+ /**
3
+ * What the annotation surface needs from the host serving it.
4
+ *
5
+ * The kernel ships a local-daemon implementation, so a host that serves
6
+ * canvases straight off its own daemon needs no provider. Hosts with extra
7
+ * delivery modes (agent-canvas also serves read-only encrypted share links)
8
+ * provide their own.
9
+ */
10
+ export interface CanvasHost {
11
+ /** Session the canvas belongs to. */
12
+ sessionId: string;
13
+ /** Read-only share view — local-only affordances stay hidden. */
14
+ isShared: boolean;
15
+ /** Host can read project files (feedback bodies, file browser). */
16
+ fsAvailable: boolean;
17
+ /** Endpoint accepting annotation image uploads, or `null` for a host that
18
+ * has none — the attach affordances then stay hidden rather than posting
19
+ * into the void. Required, not optional, so no host can be silent about it. */
20
+ uploadUrl: (() => string) | null;
21
+ /** Fetch and `import()` a compiled canvas module. */
22
+ loadCanvasModule: (filename: string, revision?: number) => Promise<CanvasModule>;
23
+ }
24
+ /** What the canvas compiler emits: one module whose default export renders the canvas. */
25
+ export interface CanvasModule {
26
+ default: ComponentType;
27
+ }
28
+ export declare const localCanvasHost: CanvasHost;
29
+ export declare const CanvasHostContext: import("react").Context<CanvasHost>;
30
+ export declare function useCanvasHost(): CanvasHost;
@@ -0,0 +1,20 @@
1
+ export { AnnotationProvider } from './AnnotationProvider';
2
+ export type { PersistedState } from './AnnotationProvider';
3
+ export { feedbackEntrySchema, filePreviewResponseSchema, parsePersistedState, persistedStateSchema, planResponseSchema } from './persistenceSchemas';
4
+ export { ActiveViewCtx, AnnotationCtx, CanvasFileCtx, SessionContext, useAnnotations, useCanvasFile, useFeedback, useResponseRegistration, } from '#canvas/runtime';
5
+ export type { ActiveView, Annotation, AnnotationAttachment, AnnotationAuthor, AnnotationContext, AnnotationContextValue, FeedbackEntry, PlanResponse, } from '#canvas/runtime';
6
+ export { findAnnotationElement, scrollToAnnotation } from './annotationDom';
7
+ export { annotationDraftKey, carryUnsubmittedDraft, clearPersistedDraft } from './annotationDraft';
8
+ export type { AnnotationDraftPhase } from './annotationDraft';
9
+ export { AnnotationSidebar } from './AnnotationSidebar';
10
+ export { ActiveViewContext, RevisionContext } from './appContext';
11
+ export type { CanvasFileInfo, RevisionInfo } from './appContext';
12
+ export * as components from './components';
13
+ export { FileIcon } from './FileIcon';
14
+ export { canPruneResponses, generateMarkdown, getMissingRequired, getMissingRequiredFeedback, getMissingRequiredLabels, hasValue, pruneStaleResponses, } from './generateMarkdown';
15
+ export { CanvasHostContext, localCanvasHost, useCanvasHost } from './hostContext';
16
+ export type { CanvasHost } from './hostContext';
17
+ export { PlanRenderer } from './PlanRenderer';
18
+ export { RenderErrorContext } from './RenderErrorContext';
19
+ export type { CanvasRenderError } from './RenderErrorContext';
20
+ export { MarkdownPreview, ResponsePreview } from './ResponsePreview';
@@ -0,0 +1,29 @@
1
+ interface HighlightJs {
2
+ highlightElement(element: HTMLElement): void;
3
+ highlight(code: string, options: {
4
+ language: string;
5
+ }): {
6
+ value: string;
7
+ };
8
+ highlightAuto(code: string): {
9
+ value: string;
10
+ };
11
+ }
12
+ interface MermaidApi {
13
+ initialize(config: {
14
+ startOnLoad: boolean;
15
+ theme: string;
16
+ }): void;
17
+ render(id: string, source: string): Promise<{
18
+ svg: string;
19
+ }>;
20
+ }
21
+ declare global {
22
+ interface Window {
23
+ hljs?: HighlightJs;
24
+ mermaid?: MermaidApi;
25
+ }
26
+ }
27
+ export declare function pageHighlighter(): HighlightJs | undefined;
28
+ export declare function pageMermaid(): MermaidApi | undefined;
29
+ export {};