pmx-canvas 0.1.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.
- package/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/Readme.md +865 -0
- package/dist/canvas/global.css +3173 -0
- package/dist/canvas/index.js +183 -0
- package/dist/json-render/index.css +2 -0
- package/dist/json-render/index.js +389 -0
- package/dist/types/cli/agent.d.ts +13 -0
- package/dist/types/cli/index.d.ts +2 -0
- package/dist/types/cli/watch.d.ts +5 -0
- package/dist/types/client/App.d.ts +1 -0
- package/dist/types/client/canvas/AttentionHistory.d.ts +1 -0
- package/dist/types/client/canvas/AttentionToast.d.ts +1 -0
- package/dist/types/client/canvas/CanvasNode.d.ts +8 -0
- package/dist/types/client/canvas/CanvasViewport.d.ts +8 -0
- package/dist/types/client/canvas/CommandPalette.d.ts +4 -0
- package/dist/types/client/canvas/ContextMenu.d.ts +24 -0
- package/dist/types/client/canvas/ContextPinBar.d.ts +1 -0
- package/dist/types/client/canvas/ContextPinHud.d.ts +1 -0
- package/dist/types/client/canvas/DockedNode.d.ts +4 -0
- package/dist/types/client/canvas/EdgeLayer.d.ts +8 -0
- package/dist/types/client/canvas/ExpandedNodeOverlay.d.ts +1 -0
- package/dist/types/client/canvas/FocusFieldLayer.d.ts +1 -0
- package/dist/types/client/canvas/Minimap.d.ts +23 -0
- package/dist/types/client/canvas/SelectionBar.d.ts +1 -0
- package/dist/types/client/canvas/ShortcutOverlay.d.ts +3 -0
- package/dist/types/client/canvas/SnapshotPanel.d.ts +7 -0
- package/dist/types/client/canvas/snap-guides.d.ts +23 -0
- package/dist/types/client/canvas/use-node-drag.d.ts +15 -0
- package/dist/types/client/canvas/use-node-resize.d.ts +15 -0
- package/dist/types/client/canvas/use-pan-zoom.d.ts +16 -0
- package/dist/types/client/ext-app/bridge.d.ts +161 -0
- package/dist/types/client/icons.d.ts +70 -0
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/client/nodes/ContextNode.d.ts +34 -0
- package/dist/types/client/nodes/ExtAppFrame.d.ts +18 -0
- package/dist/types/client/nodes/FileNode.d.ts +5 -0
- package/dist/types/client/nodes/GroupNode.d.ts +6 -0
- package/dist/types/client/nodes/ImageNode.d.ts +10 -0
- package/dist/types/client/nodes/InlineFormatBar.d.ts +7 -0
- package/dist/types/client/nodes/InlineMarkdownEditor.d.ts +14 -0
- package/dist/types/client/nodes/LedgerNode.d.ts +4 -0
- package/dist/types/client/nodes/MarkdownNode.d.ts +6 -0
- package/dist/types/client/nodes/McpAppNode.d.ts +4 -0
- package/dist/types/client/nodes/MdFormatBar.d.ts +8 -0
- package/dist/types/client/nodes/PromptNode.d.ts +5 -0
- package/dist/types/client/nodes/ResponseNode.d.ts +5 -0
- package/dist/types/client/nodes/StatusNode.d.ts +4 -0
- package/dist/types/client/nodes/StatusSummary.d.ts +4 -0
- package/dist/types/client/nodes/TraceNode.d.ts +4 -0
- package/dist/types/client/nodes/WebpageNode.d.ts +5 -0
- package/dist/types/client/nodes/image-warnings.d.ts +6 -0
- package/dist/types/client/nodes/inline-editor-commands.d.ts +11 -0
- package/dist/types/client/nodes/md-format.d.ts +25 -0
- package/dist/types/client/state/attention-bridge.d.ts +3 -0
- package/dist/types/client/state/attention-store.d.ts +25 -0
- package/dist/types/client/state/canvas-store.d.ts +74 -0
- package/dist/types/client/state/intent-bridge.d.ts +158 -0
- package/dist/types/client/state/sse-bridge.d.ts +5 -0
- package/dist/types/client/theme/tokens.d.ts +27 -0
- package/dist/types/client/types.d.ts +40 -0
- package/dist/types/client/utils/ext-app-tool-result.d.ts +1 -0
- package/dist/types/client/utils/placement.d.ts +1 -0
- package/dist/types/client/utils/platform.d.ts +2 -0
- package/dist/types/json-render/catalog.d.ts +815 -0
- package/dist/types/json-render/charts/components.d.ts +54 -0
- package/dist/types/json-render/charts/definitions.d.ts +103 -0
- package/dist/types/json-render/charts/extra-components.d.ts +58 -0
- package/dist/types/json-render/charts/extra-definitions.d.ts +181 -0
- package/dist/types/json-render/renderer/index.d.ts +16 -0
- package/dist/types/json-render/schema.d.ts +46 -0
- package/dist/types/json-render/server.d.ts +55 -0
- package/dist/types/mcp/server.d.ts +22 -0
- package/dist/types/server/agent-context.d.ts +21 -0
- package/dist/types/server/artifact-paths.d.ts +3 -0
- package/dist/types/server/canvas-operations.d.ts +154 -0
- package/dist/types/server/canvas-provenance.d.ts +13 -0
- package/dist/types/server/canvas-schema.d.ts +49 -0
- package/dist/types/server/canvas-serialization.d.ts +25 -0
- package/dist/types/server/canvas-state.d.ts +174 -0
- package/dist/types/server/canvas-validation.d.ts +33 -0
- package/dist/types/server/chart-template.d.ts +29 -0
- package/dist/types/server/code-graph.d.ts +67 -0
- package/dist/types/server/context-cards.d.ts +24 -0
- package/dist/types/server/diagram-presets.d.ts +28 -0
- package/dist/types/server/ext-app-call-registry.d.ts +16 -0
- package/dist/types/server/ext-app-tool-result.d.ts +1 -0
- package/dist/types/server/file-watcher.d.ts +16 -0
- package/dist/types/server/index.d.ts +243 -0
- package/dist/types/server/mcp-app-candidate.d.ts +25 -0
- package/dist/types/server/mcp-app-host.d.ts +65 -0
- package/dist/types/server/mcp-app-runtime.d.ts +47 -0
- package/dist/types/server/mutation-history.d.ts +105 -0
- package/dist/types/server/placement.d.ts +37 -0
- package/dist/types/server/server.d.ts +103 -0
- package/dist/types/server/spatial-analysis.d.ts +87 -0
- package/dist/types/server/trace-manager.d.ts +48 -0
- package/dist/types/server/web-artifacts.d.ts +50 -0
- package/dist/types/server/webpage-node.d.ts +25 -0
- package/dist/types/shared/auto-arrange.d.ts +29 -0
- package/dist/types/shared/ext-app-tool-result.d.ts +9 -0
- package/dist/types/shared/placement.d.ts +26 -0
- package/dist/types/shared/semantic-attention.d.ts +97 -0
- package/package.json +109 -0
- package/skills/data-analysis/SKILL.md +324 -0
- package/skills/doc-coauthoring/SKILL.md +375 -0
- package/skills/frontend-design/SKILL.md +45 -0
- package/skills/json-render-codegen/SKILL.md +112 -0
- package/skills/json-render-core/SKILL.md +265 -0
- package/skills/json-render-ink/SKILL.md +273 -0
- package/skills/json-render-mcp/SKILL.md +132 -0
- package/skills/json-render-react/SKILL.md +264 -0
- package/skills/json-render-shadcn/SKILL.md +159 -0
- package/skills/playwright-cli/SKILL.md +67 -0
- package/skills/pmx-canvas/SKILL.md +668 -0
- package/skills/pmx-canvas/evals/evals.json +186 -0
- package/skills/pmx-canvas-testing/SKILL.md +78 -0
- package/skills/published-consumer-e2e/SKILL.md +43 -0
- package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +241 -0
- package/skills/web-artifacts-builder/SKILL.md +80 -0
- package/skills/web-artifacts-builder/scripts/bundle-artifact.sh +167 -0
- package/skills/web-artifacts-builder/scripts/init-artifact.sh +425 -0
- package/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/src/cli/agent.ts +2144 -0
- package/src/cli/index.ts +622 -0
- package/src/cli/watch.ts +88 -0
- package/src/client/App.tsx +507 -0
- package/src/client/canvas/AttentionHistory.tsx +81 -0
- package/src/client/canvas/AttentionToast.tsx +19 -0
- package/src/client/canvas/CanvasNode.tsx +363 -0
- package/src/client/canvas/CanvasViewport.tsx +590 -0
- package/src/client/canvas/CommandPalette.tsx +302 -0
- package/src/client/canvas/ContextMenu.tsx +601 -0
- package/src/client/canvas/ContextPinBar.tsx +25 -0
- package/src/client/canvas/ContextPinHud.tsx +22 -0
- package/src/client/canvas/DockedNode.tsx +66 -0
- package/src/client/canvas/EdgeLayer.tsx +280 -0
- package/src/client/canvas/ExpandedNodeOverlay.tsx +260 -0
- package/src/client/canvas/FocusFieldLayer.tsx +107 -0
- package/src/client/canvas/Minimap.tsx +301 -0
- package/src/client/canvas/SelectionBar.tsx +69 -0
- package/src/client/canvas/ShortcutOverlay.tsx +69 -0
- package/src/client/canvas/SnapshotPanel.tsx +236 -0
- package/src/client/canvas/snap-guides.ts +170 -0
- package/src/client/canvas/use-node-drag.ts +51 -0
- package/src/client/canvas/use-node-resize.ts +59 -0
- package/src/client/canvas/use-pan-zoom.ts +191 -0
- package/src/client/ext-app/bridge.ts +542 -0
- package/src/client/icons.tsx +424 -0
- package/src/client/index.tsx +7 -0
- package/src/client/nodes/ContextNode.tsx +412 -0
- package/src/client/nodes/ExtAppFrame.tsx +509 -0
- package/src/client/nodes/FileNode.tsx +256 -0
- package/src/client/nodes/GroupNode.tsx +39 -0
- package/src/client/nodes/ImageNode.tsx +160 -0
- package/src/client/nodes/InlineFormatBar.tsx +169 -0
- package/src/client/nodes/InlineMarkdownEditor.tsx +123 -0
- package/src/client/nodes/LedgerNode.tsx +37 -0
- package/src/client/nodes/MarkdownNode.tsx +359 -0
- package/src/client/nodes/McpAppNode.tsx +85 -0
- package/src/client/nodes/MdFormatBar.tsx +109 -0
- package/src/client/nodes/PromptNode.tsx +597 -0
- package/src/client/nodes/ResponseNode.tsx +153 -0
- package/src/client/nodes/StatusNode.tsx +84 -0
- package/src/client/nodes/StatusSummary.tsx +38 -0
- package/src/client/nodes/TraceNode.tsx +120 -0
- package/src/client/nodes/WebpageNode.tsx +288 -0
- package/src/client/nodes/image-warnings.ts +95 -0
- package/src/client/nodes/inline-editor-commands.ts +37 -0
- package/src/client/nodes/md-format.ts +206 -0
- package/src/client/state/attention-bridge.ts +328 -0
- package/src/client/state/attention-store.ts +73 -0
- package/src/client/state/canvas-store.ts +631 -0
- package/src/client/state/intent-bridge.ts +315 -0
- package/src/client/state/sse-bridge.ts +965 -0
- package/src/client/theme/global.css +3173 -0
- package/src/client/theme/tokens.ts +72 -0
- package/src/client/types-shims.d.ts +5 -0
- package/src/client/types.ts +81 -0
- package/src/client/utils/ext-app-tool-result.ts +4 -0
- package/src/client/utils/placement.ts +4 -0
- package/src/client/utils/platform.ts +2 -0
- package/src/json-render/catalog.ts +256 -0
- package/src/json-render/charts/components.tsx +198 -0
- package/src/json-render/charts/definitions.ts +81 -0
- package/src/json-render/charts/extra-components.tsx +267 -0
- package/src/json-render/charts/extra-definitions.ts +145 -0
- package/src/json-render/renderer/index.css +174 -0
- package/src/json-render/renderer/index.tsx +86 -0
- package/src/json-render/schema.ts +62 -0
- package/src/json-render/server.ts +597 -0
- package/src/mcp/server.ts +1377 -0
- package/src/server/agent-context.ts +242 -0
- package/src/server/artifact-paths.ts +17 -0
- package/src/server/canvas-operations.ts +1279 -0
- package/src/server/canvas-provenance.ts +243 -0
- package/src/server/canvas-schema.ts +432 -0
- package/src/server/canvas-serialization.ts +95 -0
- package/src/server/canvas-state.ts +1134 -0
- package/src/server/canvas-validation.ts +114 -0
- package/src/server/chart-template.ts +449 -0
- package/src/server/code-graph.ts +370 -0
- package/src/server/context-cards.ts +31 -0
- package/src/server/diagram-presets.ts +71 -0
- package/src/server/ext-app-call-registry.ts +77 -0
- package/src/server/ext-app-tool-result.ts +4 -0
- package/src/server/file-watcher.ts +121 -0
- package/src/server/index.ts +647 -0
- package/src/server/mcp-app-candidate.ts +174 -0
- package/src/server/mcp-app-host.ts +814 -0
- package/src/server/mcp-app-runtime.ts +459 -0
- package/src/server/mutation-history.ts +350 -0
- package/src/server/placement.ts +125 -0
- package/src/server/server.ts +3846 -0
- package/src/server/spatial-analysis.ts +356 -0
- package/src/server/trace-manager.ts +333 -0
- package/src/server/web-artifacts/scripts/bundle-artifact.sh +167 -0
- package/src/server/web-artifacts/scripts/init-artifact.sh +426 -0
- package/src/server/web-artifacts/scripts/shadcn-components.tar.gz +0 -0
- package/src/server/web-artifacts.ts +442 -0
- package/src/server/webpage-node.ts +328 -0
- package/src/shared/auto-arrange.ts +439 -0
- package/src/shared/ext-app-tool-result.ts +76 -0
- package/src/shared/placement.ts +81 -0
- package/src/shared/semantic-attention.ts +598 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Shared contentEditable command helpers used by both the inline editor
|
|
2
|
+
* and its floating toolbar. Kept in a module that neither component
|
|
3
|
+
* depends on transitively so we don't get a circular import. */
|
|
4
|
+
/** Prompt for a URL and insert it as a link on the current selection.
|
|
5
|
+
* Rejects `javascript:` and `data:` schemes so a link can't execute script
|
|
6
|
+
* when clicked. */
|
|
7
|
+
export declare function promptAndInsertLink(): void;
|
|
8
|
+
/** Wrap the current non-empty selection in an inline `<code>` element and
|
|
9
|
+
* place the caret immediately after the new element. No-op on collapsed
|
|
10
|
+
* selections. */
|
|
11
|
+
export declare function wrapSelectionInCode(): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown formatting helpers for textarea elements.
|
|
3
|
+
* Handles: wrap-style formatting (bold, italic, code, strikethrough),
|
|
4
|
+
* prefix-style formatting (headings, lists, quotes),
|
|
5
|
+
* Tab/Shift+Tab indentation, and floating toolbar positioning.
|
|
6
|
+
*/
|
|
7
|
+
export interface FormatAction {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
shortcut?: string;
|
|
12
|
+
action: (ta: HTMLTextAreaElement) => void;
|
|
13
|
+
}
|
|
14
|
+
/** Handle Tab/Shift+Tab for indentation on current line(s). */
|
|
15
|
+
export declare function handleTab(ta: HTMLTextAreaElement, shiftKey: boolean): void;
|
|
16
|
+
/** Format actions available in the toolbar. */
|
|
17
|
+
export declare const FORMAT_ACTIONS: FormatAction[];
|
|
18
|
+
/** Handle Cmd/Ctrl+key formatting shortcuts in a textarea. Returns true if handled. */
|
|
19
|
+
export declare function handleFormatShortcut(e: KeyboardEvent, ta: HTMLTextAreaElement): boolean;
|
|
20
|
+
/** Get the screen rect of the current text selection for positioning a floating toolbar. */
|
|
21
|
+
export declare function getSelectionRect(ta: HTMLTextAreaElement): {
|
|
22
|
+
top: number;
|
|
23
|
+
left: number;
|
|
24
|
+
width: number;
|
|
25
|
+
} | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SemanticAttentionRegion } from '../../shared/semantic-attention.js';
|
|
2
|
+
export type AttentionTone = 'context' | 'relationship' | 'group' | 'cluster' | 'neighborhood' | 'remove';
|
|
3
|
+
export interface AttentionEntry {
|
|
4
|
+
id: string;
|
|
5
|
+
tone: AttentionTone;
|
|
6
|
+
title: string;
|
|
7
|
+
detail: string;
|
|
8
|
+
nodeIds: string[];
|
|
9
|
+
createdAt: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const attentionToast: import("@preact/signals-core").Signal<AttentionEntry | null>;
|
|
12
|
+
export declare const attentionHistory: import("@preact/signals-core").Signal<AttentionEntry[]>;
|
|
13
|
+
export declare const attentionPrimaryNodeIds: import("@preact/signals-core").Signal<Set<string>>;
|
|
14
|
+
export declare const attentionSecondaryNodeIds: import("@preact/signals-core").Signal<Set<string>>;
|
|
15
|
+
export declare const attentionRegions: import("@preact/signals-core").Signal<SemanticAttentionRegion[]>;
|
|
16
|
+
export declare const attentionPulseNodeIds: import("@preact/signals-core").Signal<Set<string>>;
|
|
17
|
+
export declare const attentionHistoryOpen: import("@preact/signals-core").Signal<boolean>;
|
|
18
|
+
export declare const attentionHistoryUnread: import("@preact/signals-core").Signal<number>;
|
|
19
|
+
export declare function resetAttentionState(): void;
|
|
20
|
+
export declare function openAttentionHistory(): void;
|
|
21
|
+
export declare function closeAttentionHistory(): void;
|
|
22
|
+
export declare function setAttentionFocus(primaryNodeIds: string[], secondaryNodeIds: string[], regions: SemanticAttentionRegion[]): void;
|
|
23
|
+
export declare function setAttentionToast(entry: AttentionEntry | null): void;
|
|
24
|
+
export declare function pushAttentionHistory(entry: AttentionEntry, limit?: number): void;
|
|
25
|
+
export declare function setAttentionPulse(nodeIds: string[]): void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CanvasEdge, CanvasLayout, CanvasNodeState, ConnectionStatus, ViewportState } from '../types';
|
|
2
|
+
export declare const viewport: import("@preact/signals-core").Signal<ViewportState>;
|
|
3
|
+
export declare const nodes: import("@preact/signals-core").Signal<Map<string, CanvasNodeState>>;
|
|
4
|
+
export declare const edges: import("@preact/signals-core").Signal<Map<string, CanvasEdge>>;
|
|
5
|
+
export declare const activeNodeId: import("@preact/signals-core").Signal<string | null>;
|
|
6
|
+
export declare const connectionStatus: import("@preact/signals-core").Signal<ConnectionStatus>;
|
|
7
|
+
export declare const sessionId: import("@preact/signals-core").Signal<string>;
|
|
8
|
+
export declare const traceEnabled: import("@preact/signals-core").Signal<boolean>;
|
|
9
|
+
export declare const canvasTheme: import("@preact/signals-core").Signal<string>;
|
|
10
|
+
export declare const hasInitialServerLayout: import("@preact/signals-core").Signal<boolean>;
|
|
11
|
+
export declare const expandedNodeId: import("@preact/signals-core").Signal<string | null>;
|
|
12
|
+
export declare const pendingConnection: import("@preact/signals-core").Signal<{
|
|
13
|
+
from: string;
|
|
14
|
+
} | null>;
|
|
15
|
+
export declare const draggingEdge: import("@preact/signals-core").Signal<{
|
|
16
|
+
fromId: string;
|
|
17
|
+
fromX: number;
|
|
18
|
+
fromY: number;
|
|
19
|
+
cursorX: number;
|
|
20
|
+
cursorY: number;
|
|
21
|
+
} | null>;
|
|
22
|
+
export declare const searchHighlightIds: import("@preact/signals-core").Signal<Set<string> | null>;
|
|
23
|
+
export declare const selectedNodeIds: import("@preact/signals-core").Signal<Set<string>>;
|
|
24
|
+
export declare const contextPinnedNodeIds: import("@preact/signals-core").Signal<Set<string>>;
|
|
25
|
+
export declare function getNeighborNodeIds(nodeId: string | null, edgeMap: Map<string, CanvasEdge>): Set<string>;
|
|
26
|
+
export declare const activeNeighborNodeIds: import("@preact/signals-core").ReadonlySignal<Set<string>>;
|
|
27
|
+
export declare function toggleSelected(id: string): void;
|
|
28
|
+
export declare function selectNodes(ids: string[]): void;
|
|
29
|
+
export declare function clearSelection(): void;
|
|
30
|
+
export declare function getSelectedNodes(): CanvasNodeState[];
|
|
31
|
+
export declare function toggleContextPin(id: string): void;
|
|
32
|
+
export declare function addContextPins(ids: string[]): void;
|
|
33
|
+
export declare function clearContextPins(): void;
|
|
34
|
+
export declare function replaceContextPinsFromServer(ids: string[]): void;
|
|
35
|
+
export declare function getContextPinnedNodes(): CanvasNodeState[];
|
|
36
|
+
export declare function addNode(node: CanvasNodeState): void;
|
|
37
|
+
export declare function updateNode(id: string, patch: Partial<CanvasNodeState>): void;
|
|
38
|
+
export declare function updateNodeData(id: string, dataPatch: Record<string, unknown>): void;
|
|
39
|
+
export declare function removeNode(id: string): void;
|
|
40
|
+
export declare function addEdge(edge: CanvasEdge): void;
|
|
41
|
+
export declare function removeEdge(id: string): void;
|
|
42
|
+
export declare function removeEdgesForNode(nodeId: string): void;
|
|
43
|
+
export declare function resizeNode(id: string, size: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
}): void;
|
|
47
|
+
export declare function bringToFront(id: string): void;
|
|
48
|
+
export declare function toggleCollapsed(id: string): void;
|
|
49
|
+
export declare function dockNode(id: string, position: 'left' | 'right'): void;
|
|
50
|
+
export declare function undockNode(id: string): void;
|
|
51
|
+
export declare function setViewport(v: Partial<ViewportState>): void;
|
|
52
|
+
export declare function replaceViewport(next: ViewportState): void;
|
|
53
|
+
export declare function commitViewport(next: ViewportState): void;
|
|
54
|
+
export declare function applyServerCanvasLayout(layout: Pick<CanvasLayout, 'nodes' | 'edges'> & {
|
|
55
|
+
viewport?: ViewportState;
|
|
56
|
+
}): void;
|
|
57
|
+
/**
|
|
58
|
+
* Smoothly animate the viewport to a target state.
|
|
59
|
+
* Cancels any in-flight animation. Direct manipulation (pan/zoom gestures)
|
|
60
|
+
* should use setViewport() instead for instant response.
|
|
61
|
+
*/
|
|
62
|
+
export declare function animateViewport(target: ViewportState, duration?: number): void;
|
|
63
|
+
/** Cancel any in-flight viewport animation (e.g. when user starts dragging). */
|
|
64
|
+
export declare function cancelViewportAnimation(): void;
|
|
65
|
+
export declare function persistLayout(): void;
|
|
66
|
+
export declare function restoreLayout(): Map<string, Partial<CanvasNodeState>> | null;
|
|
67
|
+
export declare function fitAll(containerW: number, containerH: number): void;
|
|
68
|
+
export declare function focusNode(id: string): void;
|
|
69
|
+
export declare function cycleActiveNode(direction?: 1 | -1): void;
|
|
70
|
+
export declare function walkGraph(direction: 'up' | 'down' | 'left' | 'right'): void;
|
|
71
|
+
export declare function expandNode(id: string): void;
|
|
72
|
+
export declare function collapseExpandedNode(): void;
|
|
73
|
+
export declare function autoArrange(): void;
|
|
74
|
+
export declare function forceDirectedArrange(): void;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/** Dispatch user intents from the canvas to the server (for TUI consumption). */
|
|
2
|
+
export declare function sendIntent(type: string, payload?: Record<string, unknown>): Promise<{
|
|
3
|
+
ok: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
/** Fetch rendered markdown HTML from the server. */
|
|
6
|
+
export declare function renderMarkdown(markdown: string): Promise<string>;
|
|
7
|
+
/** Fetch file content from the server. */
|
|
8
|
+
export declare function fetchFile(path: string): Promise<{
|
|
9
|
+
content: string;
|
|
10
|
+
provenance?: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
/** Save file content to the server. */
|
|
13
|
+
export declare function saveFile(path: string, content: string): Promise<{
|
|
14
|
+
ok: boolean;
|
|
15
|
+
updatedAt?: string;
|
|
16
|
+
}>;
|
|
17
|
+
/** Fetch current workbench state. */
|
|
18
|
+
export declare function fetchWorkbenchState(): Promise<Record<string, unknown>>;
|
|
19
|
+
/** Open a markdown file in the workbench/canvas. */
|
|
20
|
+
export declare function openWorkbenchFile(path: string): Promise<{
|
|
21
|
+
ok: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
/** Fetch canvas state from server. */
|
|
24
|
+
export declare function fetchCanvasState(): Promise<Record<string, unknown>>;
|
|
25
|
+
/** Fetch available slash commands for prompt completion. */
|
|
26
|
+
export declare function fetchSlashCommands(): Promise<Array<{
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
}>>;
|
|
30
|
+
/** Submit a new canvas prompt. */
|
|
31
|
+
export declare function submitCanvasPrompt(text: string, position?: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}, parentNodeId?: string, contextNodeIds?: string[], threadNodeId?: string): Promise<{
|
|
35
|
+
ok: boolean;
|
|
36
|
+
nodeId?: string;
|
|
37
|
+
error?: string;
|
|
38
|
+
}>;
|
|
39
|
+
/** Submit a reply into an existing prompt thread. */
|
|
40
|
+
export declare function submitThreadReply(threadNodeId: string, text: string): Promise<{
|
|
41
|
+
ok: boolean;
|
|
42
|
+
nodeId?: string;
|
|
43
|
+
error?: string;
|
|
44
|
+
}>;
|
|
45
|
+
/** Push canvas node updates to server. */
|
|
46
|
+
export declare function pushCanvasUpdate(updates: Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
position?: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
};
|
|
52
|
+
size?: {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
};
|
|
56
|
+
collapsed?: boolean;
|
|
57
|
+
dockPosition?: 'left' | 'right' | null;
|
|
58
|
+
}>): Promise<void>;
|
|
59
|
+
/** Create a canvas edge via the server. */
|
|
60
|
+
export declare function createEdgeFromClient(from: string, to: string, type: string, label?: string): Promise<{
|
|
61
|
+
ok: boolean;
|
|
62
|
+
id?: string;
|
|
63
|
+
}>;
|
|
64
|
+
/** Create a canvas node via the server. Returns the new node ID. */
|
|
65
|
+
export declare function createNodeFromClient(opts: {
|
|
66
|
+
type?: string;
|
|
67
|
+
title?: string;
|
|
68
|
+
content?: string;
|
|
69
|
+
x?: number;
|
|
70
|
+
y?: number;
|
|
71
|
+
width?: number;
|
|
72
|
+
height?: number;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
ok: boolean;
|
|
75
|
+
id?: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** Update a canvas node via the server. */
|
|
78
|
+
export declare function updateNodeFromClient(id: string, patch: {
|
|
79
|
+
position?: {
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
};
|
|
83
|
+
size?: {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
};
|
|
87
|
+
collapsed?: boolean;
|
|
88
|
+
pinned?: boolean;
|
|
89
|
+
dockPosition?: 'left' | 'right' | null;
|
|
90
|
+
title?: string;
|
|
91
|
+
content?: string;
|
|
92
|
+
data?: Record<string, unknown>;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
ok: boolean;
|
|
95
|
+
id?: string;
|
|
96
|
+
}>;
|
|
97
|
+
/** Refresh a webpage node from its persisted URL on the server. */
|
|
98
|
+
export declare function refreshWebpageNodeFromClient(id: string, url?: string): Promise<{
|
|
99
|
+
ok: boolean;
|
|
100
|
+
id?: string;
|
|
101
|
+
error?: string;
|
|
102
|
+
}>;
|
|
103
|
+
/** Remove a canvas node via the server. */
|
|
104
|
+
export declare function removeNodeFromClient(id: string): Promise<{
|
|
105
|
+
ok: boolean;
|
|
106
|
+
removed?: string;
|
|
107
|
+
}>;
|
|
108
|
+
/** Commit the current viewport to the authoritative server state. */
|
|
109
|
+
export declare function updateViewportFromClient(viewport: {
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
scale: number;
|
|
113
|
+
}): Promise<{
|
|
114
|
+
ok: boolean;
|
|
115
|
+
}>;
|
|
116
|
+
/** Create a group containing the given child node IDs. */
|
|
117
|
+
export declare function createGroupFromClient(opts: {
|
|
118
|
+
title?: string;
|
|
119
|
+
childIds?: string[];
|
|
120
|
+
color?: string;
|
|
121
|
+
x?: number;
|
|
122
|
+
y?: number;
|
|
123
|
+
width?: number;
|
|
124
|
+
height?: number;
|
|
125
|
+
}): Promise<{
|
|
126
|
+
ok: boolean;
|
|
127
|
+
id?: string;
|
|
128
|
+
}>;
|
|
129
|
+
/** Add nodes to an existing group. */
|
|
130
|
+
export declare function addToGroupFromClient(groupId: string, childIds: string[]): Promise<{
|
|
131
|
+
ok: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
/** Ungroup all children from a group. */
|
|
134
|
+
export declare function ungroupFromClient(groupId: string): Promise<{
|
|
135
|
+
ok: boolean;
|
|
136
|
+
}>;
|
|
137
|
+
export interface CanvasSnapshotInfo {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
nodeCount: number;
|
|
142
|
+
edgeCount: number;
|
|
143
|
+
}
|
|
144
|
+
export declare function listSnapshots(): Promise<CanvasSnapshotInfo[]>;
|
|
145
|
+
export declare function saveSnapshot(name: string): Promise<{
|
|
146
|
+
ok: boolean;
|
|
147
|
+
snapshot?: CanvasSnapshotInfo;
|
|
148
|
+
}>;
|
|
149
|
+
export declare function restoreSnapshot(id: string): Promise<{
|
|
150
|
+
ok: boolean;
|
|
151
|
+
}>;
|
|
152
|
+
export declare function deleteSnapshot(id: string): Promise<{
|
|
153
|
+
ok: boolean;
|
|
154
|
+
}>;
|
|
155
|
+
/** Remove a canvas edge via the server. */
|
|
156
|
+
export declare function removeEdgeFromClient(edgeId: string): Promise<{
|
|
157
|
+
ok: boolean;
|
|
158
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** @internal — exported for testing */
|
|
2
|
+
export declare function hashPath(path: string): string;
|
|
3
|
+
/** @internal — exported for testing */
|
|
4
|
+
export declare const EVENT_HANDLERS: Record<string, (data: Record<string, unknown>) => void>;
|
|
5
|
+
export declare function connectSSE(): () => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Canvas design tokens — reads from CSS custom properties for theme support. */
|
|
2
|
+
export interface CanvasTokens {
|
|
3
|
+
bg: string;
|
|
4
|
+
panel: string;
|
|
5
|
+
panelSoft: string;
|
|
6
|
+
line: string;
|
|
7
|
+
text: string;
|
|
8
|
+
textSoft: string;
|
|
9
|
+
muted: string;
|
|
10
|
+
dim: string;
|
|
11
|
+
accent: string;
|
|
12
|
+
ok: string;
|
|
13
|
+
warn: string;
|
|
14
|
+
warnAlt: string;
|
|
15
|
+
danger: string;
|
|
16
|
+
purple: string;
|
|
17
|
+
thinking: string;
|
|
18
|
+
subagent: string;
|
|
19
|
+
font: string;
|
|
20
|
+
mono: string;
|
|
21
|
+
}
|
|
22
|
+
/** Return current canvas tokens (reads computed CSS vars). */
|
|
23
|
+
export declare function getCanvasTokens(): CanvasTokens;
|
|
24
|
+
/** Invalidate the cached tokens (call after theme switch). */
|
|
25
|
+
export declare function invalidateTokenCache(): void;
|
|
26
|
+
/** Agent execution phase → CSS color mapping. Shared by StatusNode and StatusSummary. */
|
|
27
|
+
export declare const PHASE_COLORS: Record<string, string>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface ViewportState {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
scale: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CanvasNodeState {
|
|
7
|
+
id: string;
|
|
8
|
+
type: 'markdown' | 'mcp-app' | 'webpage' | 'json-render' | 'graph' | 'prompt' | 'response' | 'status' | 'context' | 'ledger' | 'trace' | 'file' | 'image' | 'group';
|
|
9
|
+
position: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
size: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
zIndex: number;
|
|
18
|
+
collapsed: boolean;
|
|
19
|
+
pinned: boolean;
|
|
20
|
+
dockPosition: 'left' | 'right' | null;
|
|
21
|
+
data: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export interface CanvasEdge {
|
|
24
|
+
id: string;
|
|
25
|
+
from: string;
|
|
26
|
+
to: string;
|
|
27
|
+
type: 'relation' | 'depends-on' | 'flow' | 'references';
|
|
28
|
+
label?: string;
|
|
29
|
+
style?: 'solid' | 'dashed' | 'dotted';
|
|
30
|
+
animated?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export type ConnectionStatus = 'connecting' | 'connected' | 'disconnected';
|
|
33
|
+
export declare const TYPE_LABELS: Record<CanvasNodeState['type'], string>;
|
|
34
|
+
/** Node types that support the full-viewport expand/focus overlay. */
|
|
35
|
+
export declare const EXPANDABLE_TYPES: Set<"markdown" | "mcp-app" | "webpage" | "json-render" | "graph" | "prompt" | "response" | "status" | "context" | "ledger" | "trace" | "file" | "image" | "group">;
|
|
36
|
+
export interface CanvasLayout {
|
|
37
|
+
viewport: ViewportState;
|
|
38
|
+
nodes: CanvasNodeState[];
|
|
39
|
+
edges: CanvasEdge[];
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { normalizeExtAppToolResult, type NormalizeExtAppToolResultInput, } from '../../shared/ext-app-tool-result.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { findOpenCanvasPosition, type CanvasPlacementRect, } from '../../shared/placement.js';
|