@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
@@ -0,0 +1,16 @@
1
+ import { type CanvasComponents } from './compiler';
2
+ import { type AssertReadable } from './file-admission';
3
+ import type { SessionManager } from './session';
4
+ type BroadcastFn = (sessionId: string) => void;
5
+ export interface WatchOptions {
6
+ assertReadable?: AssertReadable;
7
+ /** Scratch dir for recompiles, from `createCanvasPaths()`. */
8
+ tempDir?: string;
9
+ /** Host components, same value the push path compiles with — a recompile
10
+ * that dropped them would fail on canvases the original push accepted. */
11
+ components?: CanvasComponents;
12
+ }
13
+ export declare function watchSession(sessionId: string, sessionManager: SessionManager, broadcast: BroadcastFn, options?: WatchOptions): void;
14
+ export declare function unwatchSession(sessionId: string): void;
15
+ export declare function unwatchAll(): void;
16
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The canvas vocabulary on top of the generic channel: topic = session id,
3
+ * `submit` persists feedback, and a waiter is the CLI blocking on one answer,
4
+ * so a delivery closes it.
5
+ */
6
+ import { type ChannelSocket } from '@fabrika/daemon-kit';
7
+ import type { RemoteFeedbackEntry, SessionManager } from './session';
8
+ export type WSData = {
9
+ type: 'browser' | 'wait';
10
+ sessionId: string;
11
+ };
12
+ export interface CanvasSocket extends ChannelSocket {
13
+ data: WSData;
14
+ }
15
+ export interface WebSocketManagerOptions {
16
+ /**
17
+ * Who marks feedback consumed once a waiting client has been handed it.
18
+ *
19
+ * `"on-delivery"` (default) clears it in the same step, so the same feedback
20
+ * can never be delivered twice — right when the waiting client *is* the
21
+ * consumer. `"external"` leaves it pending for a separate gate to claim
22
+ * through the consume endpoint, for hosts where delivery and consumption are
23
+ * different steps.
24
+ */
25
+ feedbackConsumption?: 'on-delivery' | 'external';
26
+ }
27
+ export declare function createWebSocketManager(sessionManager: SessionManager, options?: WebSocketManagerOptions): {
28
+ handlers: {
29
+ open(socket: CanvasSocket): void;
30
+ message(socket: CanvasSocket, message: string | Buffer): void;
31
+ pong(socket: CanvasSocket): void;
32
+ close(socket: CanvasSocket): void;
33
+ };
34
+ broadcastPlanUpdate: (sessionId: string) => void;
35
+ broadcastRevisionUpdate: (sessionId: string) => void;
36
+ broadcastWatcherStatus: (sessionId: string) => void;
37
+ broadcastRemoteFeedback: (sessionId: string, revision: number, entries: RemoteFeedbackEntry[]) => void;
38
+ };