pmx-canvas 0.6.4 → 0.7.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 (204) hide show
  1. package/.github/extensions/pmx-canvas/extension.mjs +67 -3
  2. package/CHANGELOG.md +73 -0
  3. package/Readme.md +35 -5
  4. package/dist/canvas/global.css +498 -28
  5. package/dist/canvas/index.js +110 -95
  6. package/dist/canvas/mermaid-entry.js +258 -258
  7. package/dist/types/cli/agent.d.ts +4 -0
  8. package/dist/types/cli/commands/backup.d.ts +1 -0
  9. package/dist/types/cli/commands/boards.d.ts +1 -0
  10. package/dist/types/cli/commands/export.d.ts +1 -0
  11. package/dist/types/cli/commands/record.d.ts +12 -0
  12. package/dist/types/client/canvas/BoardCopyDialog.d.ts +5 -0
  13. package/dist/types/client/canvas/BoardFolderDialog.d.ts +7 -0
  14. package/dist/types/client/canvas/BoardLinkDialog.d.ts +3 -0
  15. package/dist/types/client/canvas/BoardSwitcher.d.ts +8 -0
  16. package/dist/types/client/canvas/ExportDialog.d.ts +7 -0
  17. package/dist/types/client/canvas/HomeView.d.ts +9 -0
  18. package/dist/types/client/canvas/Presentation.d.ts +13 -0
  19. package/dist/types/client/canvas/use-node-drag.d.ts +2 -1
  20. package/dist/types/client/nodes/AttachmentNode.d.ts +6 -0
  21. package/dist/types/client/nodes/BoardNode.d.ts +5 -0
  22. package/dist/types/client/nodes/McpAppNode.d.ts +24 -1
  23. package/dist/types/client/state/boards-store.d.ts +79 -0
  24. package/dist/types/client/state/canvas-store.d.ts +2 -0
  25. package/dist/types/client/state/intent-bridge.d.ts +1 -0
  26. package/dist/types/client/state/presentation.d.ts +3 -0
  27. package/dist/types/client/state/session-store.d.ts +7 -0
  28. package/dist/types/client/types.d.ts +2 -2
  29. package/dist/types/json-render/catalog.d.ts +3 -3
  30. package/dist/types/json-render/charts/definitions.d.ts +1 -1
  31. package/dist/types/json-render/server.d.ts +8 -0
  32. package/dist/types/mcp/canvas-access.d.ts +10 -3
  33. package/dist/types/mcp/context-uri-template.d.ts +6 -0
  34. package/dist/types/server/agent-presence.d.ts +1 -1
  35. package/dist/types/server/attribution.d.ts +11 -0
  36. package/dist/types/server/ax-context.d.ts +3 -1
  37. package/dist/types/server/ax-interaction.d.ts +2 -2
  38. package/dist/types/server/ax-state.d.ts +13 -3
  39. package/dist/types/server/backup.d.ts +36 -0
  40. package/dist/types/server/board-export.d.ts +45 -0
  41. package/dist/types/server/canvas-db.d.ts +65 -9
  42. package/dist/types/server/canvas-operations.d.ts +45 -0
  43. package/dist/types/server/canvas-provenance.d.ts +1 -1
  44. package/dist/types/server/canvas-schema.d.ts +1 -0
  45. package/dist/types/server/canvas-state.d.ts +146 -3
  46. package/dist/types/server/canvas-validation.d.ts +3 -0
  47. package/dist/types/server/context-brief.d.ts +111 -0
  48. package/dist/types/server/context-reads.d.ts +55 -0
  49. package/dist/types/server/document-import.d.ts +66 -0
  50. package/dist/types/server/html-surface.d.ts +1 -1
  51. package/dist/types/server/index.d.ts +107 -4
  52. package/dist/types/server/mutation-history.d.ts +1 -0
  53. package/dist/types/server/operations/invoker.d.ts +2 -0
  54. package/dist/types/server/operations/mcp.d.ts +7 -1
  55. package/dist/types/server/operations/ops/app.d.ts +2 -0
  56. package/dist/types/server/operations/ops/ax-shared.d.ts +2 -2
  57. package/dist/types/server/operations/ops/backup.d.ts +2 -0
  58. package/dist/types/server/operations/ops/boards.d.ts +10 -0
  59. package/dist/types/server/operations/ops/export.d.ts +2 -0
  60. package/dist/types/server/operations/ops/imports.d.ts +2 -0
  61. package/dist/types/server/operations/ops/json-render.d.ts +2 -0
  62. package/dist/types/server/operations/ops/nodes.d.ts +4 -2
  63. package/dist/types/server/operations/ops/query.d.ts +2 -0
  64. package/dist/types/server/operations/registry.d.ts +9 -1
  65. package/dist/types/server/operations/types.d.ts +1 -1
  66. package/dist/types/server/server.d.ts +1 -0
  67. package/dist/types/server/trace-manager.d.ts +7 -0
  68. package/dist/types/server/web-artifacts.d.ts +3 -0
  69. package/dist/types/server/webpage-node.d.ts +22 -1
  70. package/dist/types/server/workbench-auth.d.ts +3 -0
  71. package/dist/types/shared/boards.d.ts +6 -0
  72. package/dist/types/shared/tour.d.ts +72 -0
  73. package/docs/RELEASE.md +5 -0
  74. package/docs/cli.md +157 -0
  75. package/docs/http-api.md +277 -6
  76. package/docs/mcp.md +96 -7
  77. package/docs/node-types.md +106 -0
  78. package/docs/plans/plan-010-attributed-ask-answers.md +39 -0
  79. package/docs/plans/plan-011-context-read-instrumentation.md +54 -0
  80. package/docs/plans/plan-012-many-boards-stage-1.md +98 -0
  81. package/docs/plans/plan-013-static-board-export.md +47 -0
  82. package/docs/plans/plan-014-connected-board-memory.md +140 -0
  83. package/docs/product-vision-2026-09.md +118 -18
  84. package/docs/sdk.md +50 -0
  85. package/package.json +1 -1
  86. package/skills/pmx-canvas/SKILL.md +62 -5
  87. package/skills/pmx-canvas/references/full-reference.md +44 -8
  88. package/skills/pmx-canvas/references/github-copilot-app-adapter.md +3 -0
  89. package/skills/pmx-canvas/references/installing-pmx-canvas.md +4 -4
  90. package/skills/pmx-canvas-orchestration/SKILL.md +5 -0
  91. package/skills/pmx-canvas-testing/SKILL.md +4 -0
  92. package/src/cli/agent.ts +9 -0
  93. package/src/cli/commands/ax.ts +13 -0
  94. package/src/cli/commands/backup.ts +66 -0
  95. package/src/cli/commands/boards.ts +71 -0
  96. package/src/cli/commands/export.ts +30 -0
  97. package/src/cli/commands/nodes.ts +14 -1
  98. package/src/cli/commands/pins.ts +6 -2
  99. package/src/cli/commands/pump.ts +3 -0
  100. package/src/cli/commands/query.ts +33 -7
  101. package/src/cli/commands/record.ts +218 -0
  102. package/src/cli/commands/view.ts +7 -5
  103. package/src/cli/index.ts +21 -9
  104. package/src/client/App.tsx +28 -4
  105. package/src/client/canvas/AgentPresenceLayer.tsx +1 -1
  106. package/src/client/canvas/BoardCopyDialog.tsx +153 -0
  107. package/src/client/canvas/BoardFolderDialog.tsx +120 -0
  108. package/src/client/canvas/BoardLinkDialog.tsx +93 -0
  109. package/src/client/canvas/BoardSwitcher.tsx +149 -0
  110. package/src/client/canvas/CanvasNode.tsx +8 -0
  111. package/src/client/canvas/CanvasViewport.tsx +3 -0
  112. package/src/client/canvas/CommandPalette.tsx +107 -4
  113. package/src/client/canvas/ContextMenu.tsx +4 -0
  114. package/src/client/canvas/ExpandedNodeOverlay.tsx +3 -0
  115. package/src/client/canvas/ExportDialog.tsx +197 -0
  116. package/src/client/canvas/HomeView.tsx +277 -0
  117. package/src/client/canvas/IntentLayer.tsx +9 -2
  118. package/src/client/canvas/Presentation.tsx +108 -0
  119. package/src/client/canvas/SessionPanel.tsx +28 -1
  120. package/src/client/canvas/ToolRail.tsx +38 -3
  121. package/src/client/canvas/TopBar.tsx +49 -7
  122. package/src/client/canvas/import-files.ts +19 -1
  123. package/src/client/canvas/kind-colors.ts +1 -0
  124. package/src/client/canvas/use-node-drag.ts +8 -3
  125. package/src/client/icons.tsx +2 -0
  126. package/src/client/mermaid-entry.ts +39 -0
  127. package/src/client/nodes/AttachmentNode.tsx +148 -0
  128. package/src/client/nodes/BoardNode.tsx +35 -0
  129. package/src/client/nodes/FileNode.tsx +6 -0
  130. package/src/client/nodes/HtmlNode.tsx +12 -13
  131. package/src/client/nodes/MarkdownNode.tsx +47 -19
  132. package/src/client/nodes/McpAppNode.tsx +105 -13
  133. package/src/client/nodes/MermaidNode.tsx +3 -2
  134. package/src/client/nodes/ax-node-actions.ts +2 -5
  135. package/src/client/nodes/use-ax-surface-bridge.ts +1 -1
  136. package/src/client/state/boards-store.ts +167 -0
  137. package/src/client/state/canvas-store.ts +22 -0
  138. package/src/client/state/intent-bridge.ts +30 -2
  139. package/src/client/state/intent-store.ts +5 -1
  140. package/src/client/state/node-factory.ts +1 -0
  141. package/src/client/state/presentation.ts +7 -0
  142. package/src/client/state/session-store.ts +8 -0
  143. package/src/client/state/sse-bridge.ts +52 -5
  144. package/src/client/theme/global.css +498 -28
  145. package/src/client/types.ts +2 -0
  146. package/src/json-render/server.ts +45 -9
  147. package/src/mcp/canvas-access.ts +59 -22
  148. package/src/mcp/context-uri-template.ts +28 -0
  149. package/src/mcp/server.ts +122 -15
  150. package/src/server/agent-context.ts +116 -29
  151. package/src/server/agent-presence.ts +15 -9
  152. package/src/server/attribution.ts +29 -0
  153. package/src/server/ax-context.ts +4 -2
  154. package/src/server/ax-interaction.ts +1 -0
  155. package/src/server/ax-state-manager.ts +72 -3
  156. package/src/server/ax-state.ts +41 -0
  157. package/src/server/backup.ts +178 -0
  158. package/src/server/board-export.ts +686 -0
  159. package/src/server/canvas-db.ts +612 -105
  160. package/src/server/canvas-operations.ts +183 -31
  161. package/src/server/canvas-provenance.ts +1 -0
  162. package/src/server/canvas-schema.ts +22 -0
  163. package/src/server/canvas-state.ts +812 -48
  164. package/src/server/canvas-validation.ts +9 -1
  165. package/src/server/context-brief.ts +372 -0
  166. package/src/server/context-reads.ts +238 -0
  167. package/src/server/demo-state.json +670 -9
  168. package/src/server/document-import.ts +223 -0
  169. package/src/server/html-primitives.ts +199 -91
  170. package/src/server/html-surface.ts +8 -3
  171. package/src/server/index.ts +243 -5
  172. package/src/server/mutation-history.ts +10 -13
  173. package/src/server/operations/composites.ts +29 -5
  174. package/src/server/operations/http.ts +9 -3
  175. package/src/server/operations/index.ts +8 -0
  176. package/src/server/operations/invoker.ts +14 -3
  177. package/src/server/operations/mcp.ts +50 -11
  178. package/src/server/operations/ops/app.ts +15 -0
  179. package/src/server/operations/ops/ax-read.ts +10 -6
  180. package/src/server/operations/ops/ax-timeline.ts +75 -0
  181. package/src/server/operations/ops/backup.ts +134 -0
  182. package/src/server/operations/ops/batch.ts +20 -4
  183. package/src/server/operations/ops/boards.ts +351 -0
  184. package/src/server/operations/ops/export.ts +74 -0
  185. package/src/server/operations/ops/ext-app.ts +4 -0
  186. package/src/server/operations/ops/groups.ts +14 -7
  187. package/src/server/operations/ops/imports.ts +220 -0
  188. package/src/server/operations/ops/json-render.ts +37 -5
  189. package/src/server/operations/ops/nodes.ts +99 -21
  190. package/src/server/operations/ops/query.ts +206 -9
  191. package/src/server/operations/ops/viewport.ts +32 -0
  192. package/src/server/operations/registry.ts +129 -31
  193. package/src/server/operations/types.ts +1 -1
  194. package/src/server/scope-fence.ts +1 -1
  195. package/src/server/server.ts +155 -8
  196. package/src/server/spatial-analysis.ts +9 -17
  197. package/src/server/trace-manager.ts +19 -0
  198. package/src/server/web-artifacts.ts +11 -3
  199. package/src/server/webpage-node.ts +173 -13
  200. package/src/server/workbench-auth.ts +11 -0
  201. package/src/server/workboard.ts +3 -3
  202. package/src/shared/boards.ts +18 -0
  203. package/src/shared/node-sizes.ts +1 -0
  204. package/src/shared/tour.ts +87 -0
@@ -17,10 +17,14 @@ import './commands/groups.js';
17
17
  import './commands/view.js';
18
18
  import './commands/query.js';
19
19
  import './commands/pins.js';
20
+ import './commands/boards.js';
21
+ import './commands/backup.js';
22
+ import './commands/export.js';
20
23
  import './commands/history.js';
21
24
  import './commands/ax.js';
22
25
  import './commands/pump.js';
23
26
  import './commands/webview.js';
27
+ import './commands/record.js';
24
28
  import './commands/apps.js';
25
29
  import './commands/copilot.js';
26
30
  import './commands/skills.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare function parseRecordOptions(flags: Record<string, string | boolean>): {
2
+ theme: "dark" | "light" | "high-contrast" | "midnight" | "sepia" | "arctic" | "ember" | "forest" | "volt" | undefined;
3
+ present: boolean;
4
+ tourFile: string | undefined;
5
+ chromePath: string | undefined;
6
+ width: number;
7
+ height: number;
8
+ fps: number;
9
+ mode: "realtime" | "deterministic";
10
+ output: string;
11
+ duration?: number | undefined;
12
+ };
@@ -0,0 +1,5 @@
1
+ import { type BoardSummary } from '../state/boards-store';
2
+ export declare function BoardCopyDialog({ board, onClose }: {
3
+ board: BoardSummary;
4
+ onClose: () => void;
5
+ }): import("preact/src").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { type BoardSummary } from '../state/boards-store';
2
+ /** A destination picker: select an existing folder, optionally create a child, then move. */
3
+ export declare function BoardFolderDialog({ board, folders, onClose, }: {
4
+ board: BoardSummary;
5
+ folders: string[];
6
+ onClose: () => void;
7
+ }): import("preact/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function BoardLinkDialog({ onClose }: {
2
+ onClose: () => void;
3
+ }): import("preact/src").JSX.Element;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The top bar's board identity (plan 012): the open board's name, or "Home".
3
+ * Clicking it lists recent boards, New board, and Home. The menu is fixed-
4
+ * positioned so the bar's overflow clip cannot cut it off.
5
+ */
6
+ export declare function BoardSwitcher({ fallbackName }: {
7
+ fallbackName: string;
8
+ }): import("preact").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export declare const exportDialogOpen: import("@preact/signals-core").Signal<boolean>;
2
+ /**
3
+ * Export the open board as one HTML file (plan 013). An export is a share, so
4
+ * the dialog lists what goes into the file before it is written; file contents
5
+ * stay out unless the owner ticks them in.
6
+ */
7
+ export declare function ExportDialog(): import("preact/src").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ export declare function promptNewBoard(): Promise<void>;
2
+ /**
3
+ * Home (plan 012): the view when no board is open — every board, filed under
4
+ * its category (most recently opened first within each). Categories keep the
5
+ * library findable as it grows into the working memory of many sessions.
6
+ * Deleting asks in place, naming the board and what it holds; browser confirm
7
+ * dialogs are no-ops in agent panes.
8
+ */
9
+ export declare function HomeView(): import("preact").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { type Camera } from '../../shared/tour.js';
2
+ import { canvasArea } from './canvas-area';
3
+ declare global {
4
+ interface Window {
5
+ pmxCapture?: {
6
+ ready: () => boolean;
7
+ area: typeof canvasArea;
8
+ camera: () => Camera;
9
+ frame: (camera: Camera) => Promise<Camera>;
10
+ };
11
+ }
12
+ }
13
+ export declare function Presentation(): import("preact/jsx-runtime").JSX.Element | null;
@@ -5,11 +5,12 @@ interface NodeDragOptions {
5
5
  viewport: Signal<ViewportState>;
6
6
  onMove: (id: string, x: number, y: number) => void;
7
7
  onDragEnd: () => void;
8
+ onClick?: () => void;
8
9
  }
9
10
  /**
10
11
  * Hook for dragging canvas nodes by their title bar.
11
12
  * Converts screen-space pointer delta to canvas-space position delta
12
13
  * (accounting for current viewport scale).
13
14
  */
14
- export declare function useNodeDrag({ nodeId, viewport, onMove, onDragEnd }: NodeDragOptions): (e: PointerEvent, currentX: number, currentY: number) => void;
15
+ export declare function useNodeDrag({ nodeId, viewport, onMove, onDragEnd, onClick }: NodeDragOptions): (e: PointerEvent, currentX: number, currentY: number) => void;
15
16
  export {};
@@ -0,0 +1,6 @@
1
+ import type { CanvasNodeState } from '../types';
2
+ /** Originals stay useful even when the connected host cannot extract them. */
3
+ export declare function AttachmentNode({ node, expanded }: {
4
+ node: CanvasNodeState;
5
+ expanded?: boolean;
6
+ }): import("preact/src").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { CanvasNodeState } from '../types';
2
+ /** Native text-only cross-board link. Target identity is the durable board id. */
3
+ export declare function BoardNode({ node }: {
4
+ node: CanvasNodeState;
5
+ }): import("preact/src").JSX.Element;
@@ -1,6 +1,29 @@
1
+ import type { RefObject } from 'preact';
1
2
  import type { CanvasNodeState } from '../types';
2
3
  export declare function isSameOriginFrameDocumentUrl(url: string, origin?: string): boolean;
4
+ type ViewerFrameSource = {
5
+ src?: string;
6
+ srcdoc?: string;
7
+ };
8
+ /**
9
+ * Keep the last painted viewer in front while its replacement navigates. Viewer
10
+ * specs are immutable documents, so updates normally change `?v=` and reload the
11
+ * iframe; putting the new document in a hidden sibling avoids exposing Chromium's
12
+ * white navigation paint. Two animation frames after load gives the new document
13
+ * a composited paint before the old one is removed.
14
+ */
15
+ export declare function RefreshingViewerFrame({ source, iframeRef, onLoad, title, className, sandbox, allow, tabIndex, }: {
16
+ source: ViewerFrameSource;
17
+ iframeRef: RefObject<HTMLIFrameElement>;
18
+ onLoad: () => void;
19
+ title: string;
20
+ className?: string;
21
+ sandbox?: string;
22
+ allow?: string;
23
+ tabIndex?: number;
24
+ }): import("preact").JSX.Element;
3
25
  export declare function McpAppNode({ node, expanded }: {
4
26
  node: CanvasNodeState;
5
27
  expanded?: boolean;
6
- }): import("preact/jsx-runtime").JSX.Element;
28
+ }): import("preact").JSX.Element;
29
+ export {};
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Many boards (plan 012): the workspace's boards and which one is open. The
3
+ * server is the authority; this mirrors GET /api/canvas/boards and the
4
+ * `boards-changed` SSE frame. `activeBoardId === null` is Home.
5
+ */
6
+ export interface BoardSummary {
7
+ id: string;
8
+ name: string;
9
+ category: string | null;
10
+ createdAt: string;
11
+ lastOpenedAt: string | null;
12
+ nodeCount: number;
13
+ readmeNodeId?: string | null;
14
+ summary?: string | null;
15
+ pinnedTitles?: Array<{
16
+ nodeId: string;
17
+ title: string;
18
+ }>;
19
+ links?: Array<{
20
+ nodeId: string;
21
+ boardId: string;
22
+ title: string | null;
23
+ missing: boolean;
24
+ }>;
25
+ backlinks?: Array<{
26
+ boardId: string;
27
+ title: string;
28
+ nodeId: string;
29
+ }>;
30
+ }
31
+ export declare const boardList: import("@preact/signals-core").Signal<BoardSummary[]>;
32
+ export declare const activeBoardId: import("@preact/signals-core").Signal<string | null>;
33
+ /** False until the first list arrives — Home must not flash before the server answers. */
34
+ export declare const boardsLoaded: import("@preact/signals-core").Signal<boolean>;
35
+ /** The SSE bridge resyncs the canvas when the open board changes under it. */
36
+ export declare function setBoardSwitchHandler(handler: (() => void) | null): void;
37
+ export declare function applyBoards(data: {
38
+ activeBoardId?: unknown;
39
+ boards?: unknown;
40
+ reloaded?: unknown;
41
+ } | null): void;
42
+ export declare function loadBoards(): Promise<void>;
43
+ /** Open a board, or Home with null. */
44
+ export declare function openBoard(id: string | null): Promise<void>;
45
+ export declare function createAndOpenBoard(name: string): Promise<void>;
46
+ export interface BoardCopyCard {
47
+ id: string;
48
+ type: string;
49
+ title: string | null;
50
+ reusable: boolean;
51
+ }
52
+ export interface BoardCopyPreview {
53
+ sourceBoardId: string;
54
+ readmeNodeId: string | null;
55
+ cards: BoardCopyCard[];
56
+ edges: Array<{
57
+ id: string;
58
+ from: string;
59
+ to: string;
60
+ type: string;
61
+ }>;
62
+ }
63
+ export declare function previewBoardCopy(sourceBoardId: string): Promise<BoardCopyPreview | null>;
64
+ export declare function createBoardFrom(opts: {
65
+ sourceBoardId: string;
66
+ name: string;
67
+ category?: string;
68
+ nodeIds: string[];
69
+ includeReadme: boolean;
70
+ includeStructure: boolean;
71
+ }): Promise<BoardSummary | null>;
72
+ /** Rename and/or re-file a board; `category: null` removes it from its category. */
73
+ export declare function updateBoard(id: string, patch: {
74
+ name?: string;
75
+ category?: string | null;
76
+ }): Promise<void>;
77
+ export declare function setBoardReadme(id: string, readmeNodeId: string | null): Promise<void>;
78
+ export declare function deleteBoard(id: string): Promise<void>;
79
+ export declare function activeBoard(): BoardSummary | null;
@@ -50,6 +50,8 @@ export declare const activeNeighborNodeIds: import("@preact/signals-core").Reado
50
50
  export declare function toggleSelected(id: string): void;
51
51
  export declare function selectNodes(ids: string[]): void;
52
52
  export declare function clearSelection(): void;
53
+ /** Clear transient UI state that must never follow a node id onto another board. */
54
+ export declare function resetCanvasInteractionState(): void;
53
55
  /**
54
56
  * Membership feedback while a node is being dragged: the group it would join
55
57
  * on release (`add`), or the parent it would leave (`remove`). Membership
@@ -98,6 +98,7 @@ export declare function createNodeFromClient(opts: {
98
98
  y?: number;
99
99
  width?: number;
100
100
  height?: number;
101
+ boardId?: string;
101
102
  }): Promise<{
102
103
  ok: boolean;
103
104
  id?: string;
@@ -0,0 +1,3 @@
1
+ export declare const presenting: import("@preact/signals-core").Signal<boolean>;
2
+ export declare const recordingCamera: import("@preact/signals-core").Signal<boolean>;
3
+ export declare function ownsCamera(): boolean;
@@ -17,6 +17,12 @@ export interface ApprovalGateView {
17
17
  createdAt: string;
18
18
  /** Unattended-approval TTL: when a pending gate auto-holds. */
19
19
  expiresAt: string | null;
20
+ resolvedBy?: {
21
+ actor: 'human' | 'agent' | 'system' | 'unknown';
22
+ source: string;
23
+ agentId?: string;
24
+ } | null;
25
+ selfAnswer?: boolean;
20
26
  }
21
27
  export interface AxEventView {
22
28
  id: string;
@@ -69,6 +75,7 @@ export declare const scopeFence: import("@preact/signals-core").ReadonlySignal<S
69
75
  export declare function setScopeFence(nodeIds: string[] | null): Promise<boolean>;
70
76
  /** Auto-held gates: the policy said no on the human's behalf; they can be reopened. */
71
77
  export declare const heldGates: import("@preact/signals-core").ReadonlySignal<ApprovalGateView[]>;
78
+ export declare const resolvedGates: import("@preact/signals-core").ReadonlySignal<ApprovalGateView[]>;
72
79
  export interface AxTimelineView {
73
80
  events: AxEventView[];
74
81
  evidence: AxEvidenceView[];
@@ -6,7 +6,7 @@ export interface ViewportState {
6
6
  }
7
7
  export interface CanvasNodeState {
8
8
  id: string;
9
- type: 'markdown' | 'mcp-app' | 'webpage' | 'json-render' | 'graph' | 'prompt' | 'response' | 'status' | 'context' | 'ledger' | 'trace' | 'file' | 'diff' | 'mermaid' | 'image' | 'html' | 'group';
9
+ type: 'markdown' | 'mcp-app' | 'webpage' | 'json-render' | 'graph' | 'board' | 'prompt' | 'response' | 'status' | 'context' | 'ledger' | 'trace' | 'file' | 'diff' | 'mermaid' | 'image' | 'html' | 'group';
10
10
  position: {
11
11
  x: number;
12
12
  y: number;
@@ -54,7 +54,7 @@ export type AnnotationTool = 'pen' | 'eraser' | 'text' | null;
54
54
  export type ConnectionStatus = 'connecting' | 'connected' | 'disconnected';
55
55
  export declare const TYPE_LABELS: Record<CanvasNodeState['type'], string>;
56
56
  /** Node types that support the full-viewport expand/focus overlay. */
57
- export declare const EXPANDABLE_TYPES: Set<"html" | "markdown" | "mcp-app" | "webpage" | "json-render" | "graph" | "prompt" | "response" | "status" | "context" | "ledger" | "trace" | "file" | "diff" | "mermaid" | "image" | "group">;
57
+ export declare const EXPANDABLE_TYPES: Set<"file" | "group" | "html" | "markdown" | "mcp-app" | "webpage" | "json-render" | "graph" | "board" | "prompt" | "response" | "status" | "context" | "ledger" | "trace" | "diff" | "mermaid" | "image">;
58
58
  export declare const EXCALIDRAW_SERVER_NAME = "Excalidraw";
59
59
  export declare const EXCALIDRAW_CREATE_VIEW_TOOL = "create_view";
60
60
  export declare function isExcalidrawNode(node: CanvasNodeState): boolean;
@@ -388,8 +388,8 @@ export declare const allComponentDefinitions: {
388
388
  height: z.ZodNullable<z.ZodNumber>;
389
389
  colorBy: z.ZodNullable<z.ZodEnum<{
390
390
  value: "value";
391
- series: "series";
392
391
  category: "category";
392
+ series: "series";
393
393
  none: "none";
394
394
  }>>;
395
395
  highlight: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodEnum<{
@@ -474,10 +474,10 @@ export declare const allComponentDefinitions: {
474
474
  text: z.ZodString;
475
475
  variant: z.ZodNullable<z.ZodEnum<{
476
476
  error: "error";
477
+ success: "success";
478
+ default: "default";
477
479
  info: "info";
478
480
  warning: "warning";
479
- default: "default";
480
- success: "success";
481
481
  secondary: "secondary";
482
482
  destructive: "destructive";
483
483
  outline: "outline";
@@ -55,8 +55,8 @@ export declare const chartComponentDefinitions: {
55
55
  height: z.ZodNullable<z.ZodNumber>;
56
56
  colorBy: z.ZodNullable<z.ZodEnum<{
57
57
  value: "value";
58
- series: "series";
59
58
  category: "category";
59
+ series: "series";
60
60
  none: "none";
61
61
  }>>;
62
62
  highlight: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodEnum<{
@@ -63,8 +63,11 @@ export declare const GRAPH_NODE_SIZE: {
63
63
  height: number;
64
64
  };
65
65
  export type GraphChartType = 'LineChart' | 'BarChart' | 'PieChart' | 'AreaChart' | 'ScatterChart' | 'RadarChart' | 'StackedBarChart' | 'ComposedChart' | 'Sparkline' | 'DotPlot' | 'BulletChart' | 'Slopegraph';
66
+ export declare function escapeInlineScriptSource(source: string): string;
66
67
  export declare function inferJsonRenderNodeTitle(spec: JsonRenderSpec, fallback?: string): string;
67
68
  export declare function normalizeAndValidateJsonRenderSpec(spec: unknown): JsonRenderSpec;
69
+ /** shadcn 0.21 ignores these props unless the renderer supplies a two-way binding. */
70
+ export declare function jsonRenderFormWarnings(spec: JsonRenderSpec): string[];
68
71
  export declare function normalizeGraphType(value: string): GraphChartType;
69
72
  export declare function buildGraphSpec(input: GraphNodeInput): JsonRenderSpec;
70
73
  export declare function buildGraphConfig(input: GraphNodeInput): Record<string, unknown>;
@@ -84,6 +87,11 @@ export declare function applyJsonRenderStreamPatches(currentSpec: JsonRenderSpec
84
87
  skipped: number;
85
88
  };
86
89
  export declare function createJsonRenderNodeData(nodeId: string, title: string, spec: JsonRenderSpec, extra?: Record<string, unknown>): Record<string, unknown>;
90
+ /** The viewer bundle's script and stylesheet, as the viewer document inlines them. */
91
+ export declare function readJsonRenderBundle(): Promise<{
92
+ js: string;
93
+ css: string;
94
+ }>;
87
95
  export declare function buildJsonRenderViewerHtml(options: {
88
96
  title: string;
89
97
  spec: JsonRenderSpec;
@@ -1,5 +1,6 @@
1
1
  import { type CanvasLayout, type CanvasNodeState, type PmxCanvas } from '../server/index.js';
2
2
  import type { PmxAxSource } from '../server/ax-state.js';
3
+ import type { ContextReadInput } from '../server/context-reads.js';
3
4
  import { type OperationInvoker } from '../server/operations/index.js';
4
5
  type AxStateResult = ReturnType<PmxCanvas['getAxState']>;
5
6
  type AxContextResult = ReturnType<PmxCanvas['getAxContext']>;
@@ -27,8 +28,8 @@ export interface CanvasAccess {
27
28
  readonly remoteBaseUrl: string | null;
28
29
  /** Operation-registry invoker (plan-005): local in-process or HTTP, matching the access mode. */
29
30
  invoker(): OperationInvoker;
30
- getLayout(): Promise<CanvasLayout>;
31
- getNode(id: string): Promise<CanvasNodeState | undefined>;
31
+ getLayout(board?: string): Promise<CanvasLayout>;
32
+ getNode(id: string, board?: string): Promise<CanvasNodeState | undefined>;
32
33
  getAxState(): Promise<AxStateResult>;
33
34
  getAxContext(options?: {
34
35
  consumer?: string;
@@ -51,7 +52,13 @@ export interface CanvasAccess {
51
52
  }): Promise<IngestActivityResult>;
52
53
  getPolicy(): Promise<GetPolicyResult>;
53
54
  getHistory(): Promise<HistoryResult>;
54
- getPinnedNodeIds(): Promise<string[]>;
55
+ getPinnedNodeIds(board?: string): Promise<string[]>;
56
+ prepareContextRead(board?: string): Promise<{
57
+ boardId: string | null;
58
+ pinnedNodeIds: string[];
59
+ }>;
60
+ /** Record a context read the agent made through this MCP server (plan-011). */
61
+ recordContextRead(read: ContextReadInput): Promise<void>;
55
62
  runBatch(operations: RunBatchInput): Promise<RunBatchResult>;
56
63
  getCodeGraph(): Promise<CodeGraphResult>;
57
64
  getAutomationWebViewStatus(): Promise<AutomationWebViewStatus>;
@@ -0,0 +1,6 @@
1
+ import { UriTemplate } from '@modelcontextprotocol/sdk/shared/uriTemplate.js';
2
+ /** SDK v1 matches {?a,b} as two required, ordered parameters, unlike its expansion. */
3
+ export declare class ContextUriTemplate extends UriTemplate {
4
+ constructor();
5
+ match(uri: string): Record<string, string> | null;
6
+ }
@@ -86,8 +86,8 @@ export declare const PRESENCE_SET_SHAPE: {
86
86
  attached: z.ZodOptional<z.ZodBoolean>;
87
87
  parentAgentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
88
  endedBy: z.ZodOptional<z.ZodEnum<{
89
- agent: "agent";
90
89
  human: "human";
90
+ agent: "agent";
91
91
  }>>;
92
92
  contextUsage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
93
93
  used: z.ZodNumber;
@@ -0,0 +1,11 @@
1
+ export type AttributionActor = 'human' | 'agent' | 'system' | 'unknown';
2
+ export interface ActorAttribution {
3
+ actor: AttributionActor;
4
+ source: string;
5
+ agentId?: string;
6
+ }
7
+ export declare function setCurrentActor(actor: ActorAttribution | null): void;
8
+ export declare function withCurrentActor<T>(actor: ActorAttribution, action: () => T): T;
9
+ /** Direct state/SDK writes are agents unless an operation installed a narrower context. */
10
+ export declare function currentActor(fallbackSource?: string): ActorAttribution;
11
+ export declare function unknownActor(): ActorAttribution;
@@ -23,4 +23,6 @@ export interface PmxAxSurfaceSnapshot {
23
23
  */
24
24
  export declare function buildCanvasAxSurfaceSnapshot(): PmxAxSurfaceSnapshot;
25
25
  export declare function buildCanvasAxPinnedContext(): PmxAxPinnedContext;
26
- export declare function buildCanvasAxContext(consumer?: string): PmxAxContext;
26
+ export declare function buildCanvasAxContext(consumer?: string): PmxAxContext & {
27
+ boardId: string | null;
28
+ };
@@ -65,15 +65,15 @@ declare const InteractionEnvelopeSchema: z.ZodObject<{
65
65
  sourceSurface: z.ZodOptional<z.ZodEnum<{
66
66
  "mcp-app": "mcp-app";
67
67
  "json-render": "json-render";
68
+ adapter: "adapter";
68
69
  "native-node": "native-node";
69
70
  "html-node": "html-node";
70
- adapter: "adapter";
71
71
  }>>;
72
72
  actor: z.ZodOptional<z.ZodObject<{
73
73
  kind: z.ZodEnum<{
74
+ human: "human";
74
75
  agent: "agent";
75
76
  system: "system";
76
- human: "human";
77
77
  }>;
78
78
  id: z.ZodOptional<z.ZodString>;
79
79
  displayName: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,7 @@
1
1
  import type { CanvasLayout, CanvasNodeState } from './canvas-state.js';
2
2
  import type { AxApprovalStatus, AxEventKind, AxWorkItemStatus } from '../shared/ax-kinds.js';
3
3
  import type { AgentContextNode } from './agent-context.js';
4
+ import type { ActorAttribution } from './attribution.js';
4
5
  export type PmxAxSource = 'agent' | 'amp' | 'api' | 'browser' | 'cli' | 'codex' | 'copilot' | 'mcp' | 'sdk' | 'system';
5
6
  export interface PmxAxFocusState {
6
7
  nodeIds: string[];
@@ -40,6 +41,9 @@ export interface PmxAxApprovalGate {
40
41
  resolvedAt: string | null;
41
42
  resolution: string | null;
42
43
  source: PmxAxSource | null;
44
+ requestedBy?: ActorAttribution;
45
+ resolvedBy?: ActorAttribution | null;
46
+ selfAnswer?: boolean;
43
47
  }
44
48
  export interface PmxAxReviewRegion {
45
49
  line?: number;
@@ -263,13 +267,16 @@ export interface PmxAxElicitation {
263
267
  createdAt: string;
264
268
  resolvedAt: string | null;
265
269
  source: PmxAxSource | null;
270
+ requestedBy?: ActorAttribution;
271
+ resolvedBy?: ActorAttribution | null;
272
+ selfAnswer?: boolean;
266
273
  }
267
274
  export declare function normalizeAxElicitation(input: unknown, validNodeIds?: Set<string>): PmxAxElicitation | null;
268
275
  export declare function createAxElicitation(input: {
269
276
  prompt: string;
270
277
  fields?: string[];
271
278
  nodeIds?: string[];
272
- }, source: PmxAxSource | null, validNodeIds?: Set<string>): PmxAxElicitation;
279
+ }, source: PmxAxSource | null, validNodeIds?: Set<string>, requestedBy?: ActorAttribution): PmxAxElicitation;
273
280
  export type PmxAxMode = 'plan' | 'execute' | 'autonomous';
274
281
  export type PmxAxModeRequestStatus = 'pending' | 'approved' | 'rejected';
275
282
  export interface PmxAxModeRequest {
@@ -282,13 +289,16 @@ export interface PmxAxModeRequest {
282
289
  resolvedAt: string | null;
283
290
  resolution: string | null;
284
291
  source: PmxAxSource | null;
292
+ requestedBy?: ActorAttribution;
293
+ resolvedBy?: ActorAttribution | null;
294
+ selfAnswer?: boolean;
285
295
  }
286
296
  export declare function normalizeAxModeRequest(input: unknown, validNodeIds?: Set<string>): PmxAxModeRequest | null;
287
297
  export declare function createAxModeRequest(input: {
288
298
  mode: PmxAxMode;
289
299
  reason?: string | null;
290
300
  nodeIds?: string[];
291
- }, source: PmxAxSource | null, validNodeIds?: Set<string>): PmxAxModeRequest;
301
+ }, source: PmxAxSource | null, validNodeIds?: Set<string>, requestedBy?: ActorAttribution): PmxAxModeRequest;
292
302
  export declare function createEmptyAxState(): PmxAxState;
293
303
  export declare function createEmptyAxHostCapability(): PmxAxHostCapability;
294
304
  export declare function normalizeAxFocusState(input: unknown, validNodeIds?: Set<string>): PmxAxFocusState;
@@ -312,7 +322,7 @@ export declare function createAxApprovalGate(input: {
312
322
  action?: string | null;
313
323
  nodeIds?: string[];
314
324
  ttlMs?: number;
315
- }, source: PmxAxSource | null, validNodeIds?: Set<string>): PmxAxApprovalGate;
325
+ }, source: PmxAxSource | null, validNodeIds?: Set<string>, requestedBy?: ActorAttribution): PmxAxApprovalGate;
316
326
  /** Server default for a gate's TTL: `PMX_CANVAS_GATE_TTL_MS`, else five minutes. */
317
327
  export declare function defaultGateTtlMs(): number;
318
328
  export declare function createAxReviewAnnotation(input: {
@@ -0,0 +1,36 @@
1
+ export interface BackupFile {
2
+ path: string;
3
+ bytes: number;
4
+ at: string;
5
+ }
6
+ export interface BackupStatus {
7
+ folder: string;
8
+ keep: number;
9
+ everyMs: number | null;
10
+ lastAt: string | null;
11
+ lastPath: string | null;
12
+ backups: BackupFile[];
13
+ }
14
+ /** "90s", "30m", "24h", "7d" → milliseconds. */
15
+ export declare function parseBackupInterval(value: string): number | null;
16
+ export declare function getBackupStatus(): BackupStatus;
17
+ /** Back up now; keeps the newest `keep` backups in the folder and removes older ones. */
18
+ export declare function runBackup(options?: {
19
+ folder?: string;
20
+ keep?: number;
21
+ }): {
22
+ backup: BackupFile;
23
+ removed: string[];
24
+ };
25
+ /** Set the schedule (`everyMs` null turns it off). Folder and keep also apply to manual backups. */
26
+ export declare function setBackupSchedule(options: {
27
+ everyMs: number | null;
28
+ folder?: string;
29
+ keep?: number;
30
+ }): BackupStatus;
31
+ /** Runs a scheduled backup when one is due. Returns whether it ran. */
32
+ export declare function runDueBackup(now?: number): boolean;
33
+ /** Rejects anything that is not a canvas database before the live file is touched. */
34
+ export declare function assertRestorableBackup(file: string): void;
35
+ export declare function startBackupScheduler(): void;
36
+ export declare function stopBackupScheduler(): void;
@@ -0,0 +1,45 @@
1
+ export interface ExportManifest {
2
+ boardId: string;
3
+ boardName: string;
4
+ cards: number;
5
+ connections: number;
6
+ /** Cards shown in sandboxed frames: html, charts, diagrams, built apps. */
7
+ frames: number;
8
+ placeholders: Array<{
9
+ nodeId: string;
10
+ title: string;
11
+ reason: string;
12
+ }>;
13
+ files: Array<{
14
+ nodeId: string;
15
+ path: string;
16
+ included: boolean;
17
+ }>;
18
+ attachments: Array<{
19
+ nodeId: string;
20
+ name: string;
21
+ }>;
22
+ sourceDerivedCards: Array<{
23
+ nodeId: string;
24
+ included: boolean;
25
+ }>;
26
+ embeddedImages: number;
27
+ /** Web images the file loads when opened. */
28
+ remoteImages: string[];
29
+ /** Navigable links present in markdown and webpage cards. */
30
+ links: string[];
31
+ /** Statically visible network destinations in sandboxed HTML frames. */
32
+ frameNetworkDestinations: string[];
33
+ /** Scripts in embedded frames can make requests that static inspection cannot enumerate. */
34
+ embeddedCodeCanAccessNetwork: boolean;
35
+ includeFiles: boolean;
36
+ }
37
+ /** What an export of `boardId` would put in the file, without building it. */
38
+ export declare function previewBoardExport(boardId: string, includeFiles: boolean, includeDerivedText?: boolean): Promise<ExportManifest | null>;
39
+ export declare function buildBoardExport(boardId: string, includeFiles: boolean, includeDerivedText?: boolean): Promise<{
40
+ html: string;
41
+ manifest: ExportManifest;
42
+ } | null>;
43
+ /** Writes the export beside the database (`exports/`) and returns its path. */
44
+ export declare function writeBoardExport(html: string, boardName: string): string;
45
+ export declare function exportsFolder(): string | null;