pmx-canvas 0.6.5 → 0.7.1

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 (181) hide show
  1. package/.github/extensions/pmx-canvas/extension.mjs +139 -14
  2. package/CHANGELOG.md +70 -0
  3. package/Readme.md +32 -6
  4. package/dist/canvas/global.css +510 -31
  5. package/dist/canvas/index.js +92 -77
  6. package/dist/types/cli/agent.d.ts +3 -0
  7. package/dist/types/cli/commands/backup.d.ts +1 -0
  8. package/dist/types/cli/commands/boards.d.ts +1 -0
  9. package/dist/types/cli/commands/export.d.ts +1 -0
  10. package/dist/types/cli/daemon.d.ts +5 -5
  11. package/dist/types/cli/shared.d.ts +3 -1
  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/nodes/AttachmentNode.d.ts +6 -0
  19. package/dist/types/client/nodes/BoardNode.d.ts +5 -0
  20. package/dist/types/client/state/boards-store.d.ts +79 -0
  21. package/dist/types/client/state/canvas-store.d.ts +2 -0
  22. package/dist/types/client/state/intent-bridge.d.ts +1 -0
  23. package/dist/types/client/state/session-store.d.ts +7 -0
  24. package/dist/types/client/types.d.ts +2 -2
  25. package/dist/types/json-render/catalog.d.ts +1 -1
  26. package/dist/types/json-render/charts/definitions.d.ts +1 -1
  27. package/dist/types/json-render/server.d.ts +6 -0
  28. package/dist/types/mcp/canvas-access.d.ts +10 -3
  29. package/dist/types/mcp/context-uri-template.d.ts +6 -0
  30. package/dist/types/server/agent-presence.d.ts +1 -1
  31. package/dist/types/server/attribution.d.ts +11 -0
  32. package/dist/types/server/ax-context.d.ts +3 -1
  33. package/dist/types/server/ax-interaction.d.ts +2 -2
  34. package/dist/types/server/ax-state.d.ts +13 -3
  35. package/dist/types/server/backup.d.ts +36 -0
  36. package/dist/types/server/board-export.d.ts +45 -0
  37. package/dist/types/server/canvas-db.d.ts +63 -9
  38. package/dist/types/server/canvas-operations.d.ts +23 -0
  39. package/dist/types/server/canvas-provenance.d.ts +1 -1
  40. package/dist/types/server/canvas-state.d.ts +140 -3
  41. package/dist/types/server/context-brief.d.ts +111 -0
  42. package/dist/types/server/context-reads.d.ts +55 -0
  43. package/dist/types/server/document-import.d.ts +66 -0
  44. package/dist/types/server/index.d.ts +103 -4
  45. package/dist/types/server/mutation-history.d.ts +1 -0
  46. package/dist/types/server/operations/invoker.d.ts +2 -0
  47. package/dist/types/server/operations/mcp.d.ts +7 -1
  48. package/dist/types/server/operations/ops/ax-shared.d.ts +2 -2
  49. package/dist/types/server/operations/ops/backup.d.ts +2 -0
  50. package/dist/types/server/operations/ops/boards.d.ts +10 -0
  51. package/dist/types/server/operations/ops/export.d.ts +2 -0
  52. package/dist/types/server/operations/ops/imports.d.ts +2 -0
  53. package/dist/types/server/operations/ops/nodes.d.ts +1 -1
  54. package/dist/types/server/operations/ops/query.d.ts +2 -0
  55. package/dist/types/server/operations/registry.d.ts +9 -1
  56. package/dist/types/server/operations/types.d.ts +1 -1
  57. package/dist/types/server/server.d.ts +1 -0
  58. package/dist/types/server/trace-manager.d.ts +7 -0
  59. package/dist/types/server/webpage-node.d.ts +22 -1
  60. package/dist/types/server/workbench-auth.d.ts +3 -0
  61. package/dist/types/shared/boards.d.ts +6 -0
  62. package/docs/RELEASE.md +5 -0
  63. package/docs/cli.md +73 -0
  64. package/docs/http-api.md +198 -2
  65. package/docs/mcp.md +71 -6
  66. package/docs/node-types.md +26 -0
  67. package/docs/plans/plan-010-attributed-ask-answers.md +39 -0
  68. package/docs/plans/plan-011-context-read-instrumentation.md +54 -0
  69. package/docs/plans/plan-012-many-boards-stage-1.md +98 -0
  70. package/docs/plans/plan-013-static-board-export.md +47 -0
  71. package/docs/plans/plan-014-connected-board-memory.md +140 -0
  72. package/docs/product-vision-2026-09.md +118 -18
  73. package/docs/sdk.md +50 -0
  74. package/package.json +1 -1
  75. package/skills/pmx-canvas/SKILL.md +68 -11
  76. package/skills/pmx-canvas/evals/evals.json +130 -0
  77. package/skills/pmx-canvas/references/full-reference.md +43 -7
  78. package/skills/pmx-canvas/references/github-copilot-app-adapter.md +3 -0
  79. package/skills/pmx-canvas/references/installing-pmx-canvas.md +4 -4
  80. package/skills/pmx-canvas/references/tours-and-recording.md +69 -0
  81. package/skills/pmx-canvas-orchestration/SKILL.md +5 -0
  82. package/skills/pmx-canvas-testing/SKILL.md +11 -2
  83. package/src/cli/agent.ts +4 -0
  84. package/src/cli/commands/apps.ts +1 -1
  85. package/src/cli/commands/ax.ts +13 -0
  86. package/src/cli/commands/backup.ts +66 -0
  87. package/src/cli/commands/boards.ts +71 -0
  88. package/src/cli/commands/export.ts +37 -0
  89. package/src/cli/commands/nodes.ts +4 -1
  90. package/src/cli/commands/pins.ts +6 -2
  91. package/src/cli/commands/pump.ts +3 -0
  92. package/src/cli/commands/query.ts +33 -7
  93. package/src/cli/commands/view.ts +7 -5
  94. package/src/cli/daemon.ts +37 -7
  95. package/src/cli/index.ts +19 -9
  96. package/src/cli/shared.ts +11 -2
  97. package/src/client/App.tsx +21 -4
  98. package/src/client/canvas/AttentionToast.tsx +5 -3
  99. package/src/client/canvas/BoardCopyDialog.tsx +153 -0
  100. package/src/client/canvas/BoardFolderDialog.tsx +120 -0
  101. package/src/client/canvas/BoardLinkDialog.tsx +93 -0
  102. package/src/client/canvas/BoardSwitcher.tsx +149 -0
  103. package/src/client/canvas/CanvasNode.tsx +0 -1
  104. package/src/client/canvas/CanvasViewport.tsx +3 -0
  105. package/src/client/canvas/CommandPalette.tsx +107 -4
  106. package/src/client/canvas/ContextMenu.tsx +4 -1
  107. package/src/client/canvas/ExpandedNodeOverlay.tsx +3 -0
  108. package/src/client/canvas/ExportDialog.tsx +199 -0
  109. package/src/client/canvas/HomeView.tsx +277 -0
  110. package/src/client/canvas/Presentation.tsx +39 -9
  111. package/src/client/canvas/SelectionBar.tsx +0 -2
  112. package/src/client/canvas/SessionPanel.tsx +28 -1
  113. package/src/client/canvas/ToolRail.tsx +38 -3
  114. package/src/client/canvas/TopBar.tsx +34 -18
  115. package/src/client/canvas/import-files.ts +19 -1
  116. package/src/client/canvas/kind-colors.ts +1 -0
  117. package/src/client/icons.tsx +2 -0
  118. package/src/client/nodes/AttachmentNode.tsx +145 -0
  119. package/src/client/nodes/BoardNode.tsx +35 -0
  120. package/src/client/nodes/FileNode.tsx +6 -0
  121. package/src/client/nodes/MarkdownNode.tsx +47 -19
  122. package/src/client/nodes/ax-node-actions.ts +2 -5
  123. package/src/client/nodes/use-ax-surface-bridge.ts +1 -1
  124. package/src/client/state/attention-bridge.ts +3 -1
  125. package/src/client/state/boards-store.ts +167 -0
  126. package/src/client/state/canvas-store.ts +22 -0
  127. package/src/client/state/intent-bridge.ts +30 -2
  128. package/src/client/state/node-factory.ts +1 -0
  129. package/src/client/state/session-store.ts +5 -0
  130. package/src/client/state/sse-bridge.ts +52 -6
  131. package/src/client/theme/global.css +510 -31
  132. package/src/client/types.ts +2 -0
  133. package/src/json-render/server.ts +16 -9
  134. package/src/mcp/canvas-access.ts +59 -22
  135. package/src/mcp/context-uri-template.ts +28 -0
  136. package/src/mcp/server.ts +122 -15
  137. package/src/server/agent-context.ts +116 -29
  138. package/src/server/attribution.ts +29 -0
  139. package/src/server/ax-context.ts +4 -2
  140. package/src/server/ax-interaction.ts +1 -0
  141. package/src/server/ax-state-manager.ts +72 -3
  142. package/src/server/ax-state.ts +41 -0
  143. package/src/server/backup.ts +178 -0
  144. package/src/server/board-export.ts +686 -0
  145. package/src/server/canvas-db.ts +599 -107
  146. package/src/server/canvas-operations.ts +68 -9
  147. package/src/server/canvas-provenance.ts +1 -0
  148. package/src/server/canvas-schema.ts +12 -0
  149. package/src/server/canvas-state.ts +774 -45
  150. package/src/server/context-brief.ts +372 -0
  151. package/src/server/context-reads.ts +238 -0
  152. package/src/server/demo-state.json +659 -2
  153. package/src/server/document-import.ts +223 -0
  154. package/src/server/index.ts +231 -5
  155. package/src/server/mutation-history.ts +10 -13
  156. package/src/server/operations/composites.ts +26 -4
  157. package/src/server/operations/http.ts +9 -3
  158. package/src/server/operations/index.ts +8 -0
  159. package/src/server/operations/invoker.ts +14 -3
  160. package/src/server/operations/mcp.ts +50 -11
  161. package/src/server/operations/ops/app.ts +5 -0
  162. package/src/server/operations/ops/ax-read.ts +10 -6
  163. package/src/server/operations/ops/ax-timeline.ts +75 -0
  164. package/src/server/operations/ops/backup.ts +134 -0
  165. package/src/server/operations/ops/batch.ts +8 -1
  166. package/src/server/operations/ops/boards.ts +351 -0
  167. package/src/server/operations/ops/export.ts +74 -0
  168. package/src/server/operations/ops/ext-app.ts +4 -0
  169. package/src/server/operations/ops/imports.ts +236 -0
  170. package/src/server/operations/ops/nodes.ts +57 -5
  171. package/src/server/operations/ops/query.ts +206 -9
  172. package/src/server/operations/registry.ts +123 -31
  173. package/src/server/operations/types.ts +1 -1
  174. package/src/server/server.ts +146 -2
  175. package/src/server/spatial-analysis.ts +9 -17
  176. package/src/server/trace-manager.ts +19 -0
  177. package/src/server/web-artifacts.ts +2 -1
  178. package/src/server/webpage-node.ts +173 -13
  179. package/src/server/workbench-auth.ts +11 -0
  180. package/src/shared/boards.ts +18 -0
  181. package/src/shared/node-sizes.ts +1 -0
@@ -17,6 +17,9 @@ 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';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -2,15 +2,15 @@ export declare function outputJson(data: unknown): void;
2
2
  export declare function readPidFile(path: string): number | null;
3
3
  export declare function isProcessRunning(pid: number): boolean;
4
4
  /**
5
- * Whether pid's command line contains `needle`. Returns null when `ps` cannot
6
- * answer (no such process, unsupported platform) — callers fall back to the
7
- * plain liveness signal.
5
+ * Whether pid's command line contains `needle`. Returns null when the OS probe
6
+ * cannot answer (no such process or unavailable command). Stop must not treat
7
+ * an unknown identity as permission to signal a live process.
8
8
  */
9
9
  export declare function processCommandMatches(pid: number, needle: string): boolean | null;
10
10
  /**
11
11
  * Liveness with a PID-recycling guard: the pid must be alive AND its command
12
- * line must still look like our daemon (unless `ps` is unavailable, in which
13
- * case the plain liveness signal wins).
12
+ * line must still look like our daemon. Status falls back to plain liveness
13
+ * when the command probe is unavailable; stop requires a verified match.
14
14
  */
15
15
  export declare function isOwnDaemonProcess(pid: number, entryNeedle: string): boolean;
16
16
  export declare function removePidFile(path: string): void;
@@ -20,7 +20,8 @@ declare function die(message: string, hint?: string): never;
20
20
  declare function output(data: unknown): void;
21
21
  declare function invokeOperation(name: string, input: Record<string, unknown>): Promise<unknown>;
22
22
  /**
23
- * `options.boolFlags` marks flags that are boolean FOR THIS COMMAND. Value
23
+ * `options.boolFlags` marks flags that are boolean FOR THIS COMMAND, while
24
+ * `options.valueFlags` overrides a globally boolean flag for one command. Value
24
25
  * flags consume the next token verbatim (so a unified diff beginning with
25
26
  * `--- a/file` survives), which makes a flag that is boolean here and
26
27
  * value-taking elsewhere ambiguous — `--summary` is boolean in `history` /
@@ -31,6 +32,7 @@ declare function invokeOperation(name: string, input: Record<string, unknown>):
31
32
  */
32
33
  declare function parseFlags(args: string[], options?: {
33
34
  boolFlags?: readonly string[];
35
+ valueFlags?: readonly string[];
34
36
  }): {
35
37
  positional: string[];
36
38
  flags: Record<string, string | true>;
@@ -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,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;
@@ -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;
@@ -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<"file" | "group" | "html" | "markdown" | "mcp-app" | "webpage" | "json-render" | "graph" | "prompt" | "response" | "status" | "context" | "ledger" | "trace" | "diff" | "mermaid" | "image">;
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<{
@@ -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,6 +63,7 @@ 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;
68
69
  /** shadcn 0.21 ignores these props unless the renderer supplies a two-way binding. */
@@ -86,6 +87,11 @@ export declare function applyJsonRenderStreamPatches(currentSpec: JsonRenderSpec
86
87
  skipped: number;
87
88
  };
88
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
+ }>;
89
95
  export declare function buildJsonRenderViewerHtml(options: {
90
96
  title: string;
91
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;
@@ -21,8 +21,27 @@ export interface PersistedCanvasState {
21
21
  annotations?: CanvasAnnotation[];
22
22
  contextPins: string[];
23
23
  ax?: PmxAxState;
24
+ revisionState?: PersistedRevisionState;
24
25
  }
25
- export declare function openCanvasDb(dbPath: string): Database;
26
+ export interface PersistedRevisionState {
27
+ revision: number;
28
+ floor: number;
29
+ tombstones: Array<{
30
+ nodeId: string;
31
+ revision: number;
32
+ deletedBy: import('./attribution.js').ActorAttribution;
33
+ }>;
34
+ }
35
+ /** Durable, delivery-based context cursor. This is separate from the bounded diagnostic read log. */
36
+ export declare function readContextBriefCursor(db: Database, boardId: string, consumer: string): number | null;
37
+ /** Monotonic update prevents a stale concurrent response from regressing a consumer. */
38
+ export declare function advanceContextBriefCursor(db: Database, boardId: string, consumer: string, revision: number): void;
39
+ export interface OpenCanvasDbOptions {
40
+ /** Name for the board a pre-boards (0.6.x) database migrates into. */
41
+ migratedBoardName?: string;
42
+ }
43
+ export declare function openCanvasDb(dbPath: string, options?: OpenCanvasDbOptions): Database;
44
+ export declare function createBoardId(): string;
26
45
  export declare function checkpointCanvasDb(db: Database): void;
27
46
  /**
28
47
  * Delete blob rows nothing references any more. Blobs are content-addressed and
@@ -39,17 +58,52 @@ export declare function checkpointCanvasDb(db: Database): void;
39
58
  */
40
59
  export declare function gcBlobsInDB(db: Database): number;
41
60
  export declare function finalizeCanvasDbForClose(db: Database): void;
42
- export declare function saveStateToDB(db: Database, state: PersistedCanvasState): void;
43
- /** Check if the DB has been populated with canvas state at least once. */
44
- export declare function isDbPopulated(db: Database): boolean;
45
- export declare function loadStateFromDB(db: Database): PersistedCanvasState | null;
46
- export declare function saveSnapshotToDB(db: Database, snapshot: CanvasSnapshot, state: PersistedCanvasState): void;
47
- export declare function loadSnapshotFromDB(db: Database, idOrName: string): {
61
+ /** The theme is workspace-wide: it is saved even while no board is open. */
62
+ export declare function saveThemeToDB(db: Database, theme: CanvasTheme | undefined): void;
63
+ export declare function readThemeFromDB(db: Database): CanvasTheme | undefined;
64
+ /** Saves one board's state; every other board's rows are untouched. */
65
+ export declare function saveStateToDB(db: Database, boardId: string, state: PersistedCanvasState): void;
66
+ /** Loads one board (the open board when `boardId` is omitted); null when there is no such board. */
67
+ export declare function loadStateFromDB(db: Database, boardId?: string): PersistedCanvasState | null;
68
+ export interface CanvasBoard {
69
+ id: string;
70
+ name: string;
71
+ /** A human-chosen shelf on Home ("Planning", "Research"); null is uncategorized. */
72
+ category: string | null;
73
+ createdAt: string;
74
+ lastOpenedAt: string | null;
75
+ nodeCount: number;
76
+ /** Markdown node used as this board's introduction. */
77
+ readmeNodeId: string | null;
78
+ }
79
+ /** Most recently opened first, then never-opened boards, newest first. */
80
+ export declare function listBoardsFromDB(db: Database): CanvasBoard[];
81
+ export declare function getBoardFromDB(db: Database, id: string): CanvasBoard | null;
82
+ export declare function createBoardInDB(db: Database, name: string, category?: string | null): CanvasBoard;
83
+ /** Rename and/or re-shelve a board; `category: null` removes it from its category. */
84
+ export declare function updateBoardInDB(db: Database, id: string, patch: {
85
+ name?: string;
86
+ category?: string | null;
87
+ readmeNodeId?: string | null;
88
+ }): boolean;
89
+ /** Create and populate an inactive board as one SQLite transaction. */
90
+ export declare function createBoardWithStateInDB(db: Database, name: string, category: string | null, state: PersistedCanvasState, readmeNodeId: string | null): CanvasBoard;
91
+ /** Deletes a board with its rows and its snapshots. */
92
+ export declare function deleteBoardFromDB(db: Database, id: string): boolean;
93
+ export declare function readMetaFromDB(db: Database, key: string): string | null;
94
+ /** Write a workspace-wide meta value; null removes it. */
95
+ export declare function writeMetaToDB(db: Database, key: string, value: string | null): void;
96
+ /** The board that was open last, if it still exists. */
97
+ export declare function getActiveBoardIdFromDB(db: Database): string | null;
98
+ export declare function setActiveBoardIdInDB(db: Database, id: string | null): void;
99
+ export declare function saveSnapshotToDB(db: Database, boardId: string, snapshot: CanvasSnapshot, state: PersistedCanvasState): void;
100
+ /** By id or name (most recent match) on `boardId`. */
101
+ export declare function loadSnapshotFromDB(db: Database, idOrName: string, boardId: string | null): {
48
102
  snapshot: CanvasSnapshot;
49
103
  state: PersistedCanvasState;
50
104
  } | null;
51
- export declare function listSnapshotsFromDB(db: Database, options?: CanvasSnapshotListOptions): CanvasSnapshot[];
52
- export declare function renameSnapshotInDB(db: Database, id: string, name: string): boolean;
105
+ export declare function listSnapshotsFromDB(db: Database, boardId: string, options?: CanvasSnapshotListOptions): CanvasSnapshot[];
106
+ export declare function renameSnapshotInDB(db: Database, boardId: string, id: string, name: string): boolean;
53
107
  export declare function deleteSnapshotFromDB(db: Database, id: string): boolean;
54
108
  export declare function writeBlobToDB(db: Database, sha256: string, jsonValue: string): number;
55
109
  export declare function readBlobFromDB(db: Database, sha256: string): string | null;