@xpert-ai/plugin-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/.xpertai-plugin/plugin.json +121 -0
- package/README.md +14 -0
- package/assets/composerIcon.svg +8 -0
- package/assets/logo.svg +47 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +144 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/canvas-agent-response.d.ts +40 -0
- package/dist/lib/canvas-agent-response.d.ts.map +1 -0
- package/dist/lib/canvas-agent-response.js +54 -0
- package/dist/lib/canvas-agent-response.js.map +1 -0
- package/dist/lib/canvas-snapshot.validation.d.ts +52 -0
- package/dist/lib/canvas-snapshot.validation.d.ts.map +1 -0
- package/dist/lib/canvas-snapshot.validation.js +223 -0
- package/dist/lib/canvas-snapshot.validation.js.map +1 -0
- package/dist/lib/canvas-view.provider.d.ts +14 -0
- package/dist/lib/canvas-view.provider.d.ts.map +1 -0
- package/dist/lib/canvas-view.provider.js +529 -0
- package/dist/lib/canvas-view.provider.js.map +1 -0
- package/dist/lib/canvas.middleware.d.ts +10 -0
- package/dist/lib/canvas.middleware.d.ts.map +1 -0
- package/dist/lib/canvas.middleware.js +277 -0
- package/dist/lib/canvas.middleware.js.map +1 -0
- package/dist/lib/canvas.plugin.d.ts +8 -0
- package/dist/lib/canvas.plugin.d.ts.map +1 -0
- package/dist/lib/canvas.plugin.js +27 -0
- package/dist/lib/canvas.plugin.js.map +1 -0
- package/dist/lib/canvas.service.d.ts +1514 -0
- package/dist/lib/canvas.service.d.ts.map +1 -0
- package/dist/lib/canvas.service.js +1290 -0
- package/dist/lib/canvas.service.js.map +1 -0
- package/dist/lib/canvas.templates.d.ts +3 -0
- package/dist/lib/canvas.templates.d.ts.map +1 -0
- package/dist/lib/canvas.templates.js +79 -0
- package/dist/lib/canvas.templates.js.map +1 -0
- package/dist/lib/constants.d.ts +26 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +44 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/entities/canvas-action-log.entity.d.ts +18 -0
- package/dist/lib/entities/canvas-action-log.entity.d.ts.map +1 -0
- package/dist/lib/entities/canvas-action-log.entity.js +69 -0
- package/dist/lib/entities/canvas-action-log.entity.js.map +1 -0
- package/dist/lib/entities/canvas-document-version.entity.d.ts +27 -0
- package/dist/lib/entities/canvas-document-version.entity.d.ts.map +1 -0
- package/dist/lib/entities/canvas-document-version.entity.js +106 -0
- package/dist/lib/entities/canvas-document-version.entity.js.map +1 -0
- package/dist/lib/entities/canvas-document.entity.d.ts +36 -0
- package/dist/lib/entities/canvas-document.entity.d.ts.map +1 -0
- package/dist/lib/entities/canvas-document.entity.js +142 -0
- package/dist/lib/entities/canvas-document.entity.js.map +1 -0
- package/dist/lib/entities/index.d.ts +4 -0
- package/dist/lib/entities/index.d.ts.map +1 -0
- package/dist/lib/entities/index.js +4 -0
- package/dist/lib/entities/index.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/app.css +1 -0
- package/dist/lib/remote-components/canvas-workbench/app.js +1707 -0
- package/dist/lib/remote-components/canvas-workbench/src/autosave.d.ts +39 -0
- package/dist/lib/remote-components/canvas-workbench/src/autosave.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/autosave.js +155 -0
- package/dist/lib/remote-components/canvas-workbench/src/autosave.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/i18n.d.ts +3 -0
- package/dist/lib/remote-components/canvas-workbench/src/i18n.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/i18n.js +79 -0
- package/dist/lib/remote-components/canvas-workbench/src/i18n.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-client-shim.d.ts +4 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-client-shim.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-client-shim.js +7 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-client-shim.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-shim.d.ts +14 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-shim.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-shim.js +14 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-dom-shim.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-jsx-runtime-shim.d.ts +7 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-jsx-runtime-shim.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-jsx-runtime-shim.js +26 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-jsx-runtime-shim.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-shim.d.ts +47 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-shim.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-shim.js +39 -0
- package/dist/lib/remote-components/canvas-workbench/src/react-shim.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/runtime.d.ts +45 -0
- package/dist/lib/remote-components/canvas-workbench/src/runtime.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/runtime.js +199 -0
- package/dist/lib/remote-components/canvas-workbench/src/runtime.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/selection-context.d.ts +55 -0
- package/dist/lib/remote-components/canvas-workbench/src/selection-context.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/selection-context.js +49 -0
- package/dist/lib/remote-components/canvas-workbench/src/selection-context.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/styles.d.ts +2 -0
- package/dist/lib/remote-components/canvas-workbench/src/styles.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/styles.js +333 -0
- package/dist/lib/remote-components/canvas-workbench/src/styles.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/tool-event-refresh.d.ts +14 -0
- package/dist/lib/remote-components/canvas-workbench/src/tool-event-refresh.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/tool-event-refresh.js +19 -0
- package/dist/lib/remote-components/canvas-workbench/src/tool-event-refresh.js.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/vendor.d.ts +9 -0
- package/dist/lib/remote-components/canvas-workbench/src/vendor.d.ts.map +1 -0
- package/dist/lib/remote-components/canvas-workbench/src/vendor.js +7 -0
- package/dist/lib/remote-components/canvas-workbench/src/vendor.js.map +1 -0
- package/dist/lib/types.d.ts +180 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/xpert-canvas-assistant.yaml +168 -0
- package/package.json +91 -0
- package/skills/canvas-agent-skill/SKILL.md +144 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const CANVAS_TOOL_NAMES = new Set([
|
|
2
|
+
'canvas_create_document',
|
|
3
|
+
'canvas_save_snapshot',
|
|
4
|
+
'canvas_patch_records',
|
|
5
|
+
'canvas_insert_image',
|
|
6
|
+
'canvas_update_document_status',
|
|
7
|
+
'canvas_report_failure'
|
|
8
|
+
]);
|
|
9
|
+
export function shouldRefreshForCanvasToolEvent(event) {
|
|
10
|
+
if (!isToolEventObject(event)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const toolName = event.toolName ?? event.name ?? event.payload?.toolName ?? event.data?.toolName;
|
|
14
|
+
return typeof toolName === 'string' && CANVAS_TOOL_NAMES.has(toolName);
|
|
15
|
+
}
|
|
16
|
+
function isToolEventObject(event) {
|
|
17
|
+
return Boolean(event && typeof event === 'object' && !Array.isArray(event));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tool-event-refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-event-refresh.js","sourceRoot":"","sources":["../../../../../src/lib/remote-components/canvas-workbench/src/tool-event-refresh.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,wBAAwB;IACxB,sBAAsB;IACtB,sBAAsB;IACtB,qBAAqB;IACrB,+BAA+B;IAC/B,uBAAuB;CACxB,CAAC,CAAA;AAeF,MAAM,UAAU,+BAA+B,CAAC,KAA+B;IAC7E,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAA;IAChG,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AACxE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAA+B;IACxD,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as ReactNamespace from 'react';
|
|
2
|
+
import type * as ReactDOMNamespace from 'react-dom';
|
|
3
|
+
import type * as ReactDOMClientNamespace from 'react-dom/client';
|
|
4
|
+
type ReactDOMGlobal = typeof ReactDOMNamespace & typeof ReactDOMClientNamespace;
|
|
5
|
+
export declare const React: typeof ReactNamespace;
|
|
6
|
+
export declare const ReactDOM: ReactDOMGlobal;
|
|
7
|
+
export declare const h: typeof ReactNamespace.createElement;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=vendor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor.d.ts","sourceRoot":"","sources":["../../../../../src/lib/remote-components/canvas-workbench/src/vendor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc,MAAM,OAAO,CAAA;AAC5C,OAAO,KAAK,KAAK,iBAAiB,MAAM,WAAW,CAAA;AACnD,OAAO,KAAK,KAAK,uBAAuB,MAAM,kBAAkB,CAAA;AAEhE,KAAK,cAAc,GAAG,OAAO,iBAAiB,GAAG,OAAO,uBAAuB,CAAA;AAM/E,eAAO,MAAM,KAAK,uBAAmD,CAAA;AACrE,eAAO,MAAM,QAAQ,gBAA+C,CAAA;AACpE,eAAO,MAAM,CAAC,EAAE,OAAO,cAAc,CAAC,aAAmC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor.js","sourceRoot":"","sources":["../../../../../src/lib/remote-components/canvas-workbench/src/vendor.ts"],"names":[],"mappings":"AAMA,SAAS,gBAAgB,CAAI,GAAyB;IACpD,OAAO,MAAM,CAAC,GAAmB,CAAM,CAAA;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAwB,OAAO,CAAC,CAAA;AACrE,MAAM,CAAC,MAAM,QAAQ,GAAG,gBAAgB,CAAiB,UAAU,CAAC,CAAA;AACpE,MAAM,CAAC,MAAM,CAAC,GAAwC,KAAK,CAAC,aAAa,CAAA"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export type CanvasDocumentStatus = 'draft' | 'reviewed' | 'archived';
|
|
2
|
+
export type CanvasDocumentKind = 'canvas' | 'whiteboard' | 'moodboard' | 'wireframe' | 'annotation' | 'image-board' | 'other';
|
|
3
|
+
export type CanvasVersionSource = 'agent_snapshot' | 'agent_patch' | 'agent_image' | 'workbench' | 'import' | 'restore';
|
|
4
|
+
export type CanvasActorType = 'agent' | 'user' | 'system';
|
|
5
|
+
export type CanvasWorkspaceCatalog = 'xperts' | 'projects';
|
|
6
|
+
export type CanvasActionType = 'document_created' | 'snapshot_saved' | 'records_patched' | 'image_inserted' | 'status_updated' | 'version_restored' | 'document_archived' | 'failure_reported';
|
|
7
|
+
export declare const CANVAS_WORKSPACE_FILES_RUNTIME_CAPABILITY = "platform.workspace.files";
|
|
8
|
+
export type CanvasJsonPrimitive = string | number | boolean | null;
|
|
9
|
+
export type CanvasJsonValue = CanvasJsonPrimitive | CanvasJsonObject | CanvasJsonArray;
|
|
10
|
+
export interface CanvasJsonObject {
|
|
11
|
+
[key: string]: CanvasJsonValue | undefined;
|
|
12
|
+
}
|
|
13
|
+
export type CanvasJsonArray = CanvasJsonValue[];
|
|
14
|
+
export interface CanvasRecord extends CanvasJsonObject {
|
|
15
|
+
id: string;
|
|
16
|
+
typeName?: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
parentId?: string;
|
|
19
|
+
index?: string;
|
|
20
|
+
x?: number;
|
|
21
|
+
y?: number;
|
|
22
|
+
rotation?: number;
|
|
23
|
+
props?: CanvasJsonObject;
|
|
24
|
+
meta?: CanvasJsonObject;
|
|
25
|
+
}
|
|
26
|
+
export interface CanvasSnapshotData extends CanvasJsonObject {
|
|
27
|
+
schema: CanvasJsonValue;
|
|
28
|
+
store: Record<string, CanvasRecord>;
|
|
29
|
+
}
|
|
30
|
+
export interface CanvasScope {
|
|
31
|
+
tenantId: string;
|
|
32
|
+
organizationId?: string | null;
|
|
33
|
+
workspaceId?: string | null;
|
|
34
|
+
projectId?: string | null;
|
|
35
|
+
userId?: string | null;
|
|
36
|
+
assistantId?: string | null;
|
|
37
|
+
conversationId?: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface CanvasWorkspaceFileScope {
|
|
40
|
+
tenantId?: string | null;
|
|
41
|
+
userId?: string | null;
|
|
42
|
+
catalog: CanvasWorkspaceCatalog;
|
|
43
|
+
scopeId: string;
|
|
44
|
+
xpertId?: string | null;
|
|
45
|
+
projectId?: string | null;
|
|
46
|
+
isolateByUser?: boolean | null;
|
|
47
|
+
}
|
|
48
|
+
export interface CanvasWorkspaceFileRecord {
|
|
49
|
+
name?: string;
|
|
50
|
+
filePath: string;
|
|
51
|
+
workspacePath?: string;
|
|
52
|
+
fileUrl?: string;
|
|
53
|
+
url?: string;
|
|
54
|
+
mimeType?: string;
|
|
55
|
+
size?: number;
|
|
56
|
+
catalog?: CanvasWorkspaceCatalog;
|
|
57
|
+
scopeId?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CanvasWorkspaceFilesApi {
|
|
60
|
+
uploadBuffer(input: CanvasWorkspaceFileScope & {
|
|
61
|
+
buffer: Buffer;
|
|
62
|
+
originalName: string;
|
|
63
|
+
mimeType?: string | null;
|
|
64
|
+
size?: number | null;
|
|
65
|
+
folder?: string | null;
|
|
66
|
+
fileName?: string | null;
|
|
67
|
+
metadata?: CanvasJsonObject;
|
|
68
|
+
}): Promise<CanvasWorkspaceFileRecord>;
|
|
69
|
+
deleteFile(input: CanvasWorkspaceFileScope & {
|
|
70
|
+
filePath: string;
|
|
71
|
+
}): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export interface CanvasSnapshotImageInput {
|
|
74
|
+
dataUrl?: string | null;
|
|
75
|
+
base64?: string | null;
|
|
76
|
+
mimeType?: string | null;
|
|
77
|
+
fileName?: string | null;
|
|
78
|
+
width?: number | null;
|
|
79
|
+
height?: number | null;
|
|
80
|
+
pageId?: string | null;
|
|
81
|
+
camera?: CanvasJsonValue;
|
|
82
|
+
capturedAt?: string | null;
|
|
83
|
+
}
|
|
84
|
+
export interface CanvasSnapshotInput {
|
|
85
|
+
snapshot?: CanvasSnapshotData | null;
|
|
86
|
+
viewState?: CanvasJsonObject | null;
|
|
87
|
+
selectionSummary?: CanvasJsonObject | null;
|
|
88
|
+
snapshotImage?: CanvasSnapshotImageInput | null;
|
|
89
|
+
}
|
|
90
|
+
export interface CreateCanvasDocumentInput extends CanvasSnapshotInput {
|
|
91
|
+
title: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
kind?: CanvasDocumentKind;
|
|
94
|
+
tags?: string[];
|
|
95
|
+
source?: string;
|
|
96
|
+
changeSummary?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface SaveCanvasSnapshotInput extends CanvasSnapshotInput {
|
|
99
|
+
documentId: string;
|
|
100
|
+
sourceType?: CanvasVersionSource;
|
|
101
|
+
changeSummary?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface AutosaveCanvasSnapshotInput extends CanvasSnapshotInput {
|
|
104
|
+
documentId: string;
|
|
105
|
+
snapshot: CanvasSnapshotData;
|
|
106
|
+
snapshotImage: CanvasSnapshotImageInput;
|
|
107
|
+
changeSummary?: string | null;
|
|
108
|
+
}
|
|
109
|
+
export interface PatchCanvasRecordsInput {
|
|
110
|
+
documentId: string;
|
|
111
|
+
putRecords?: CanvasRecord[];
|
|
112
|
+
removeRecordIds?: string[];
|
|
113
|
+
viewStatePatch?: CanvasJsonObject;
|
|
114
|
+
selectionSummary?: CanvasJsonObject | null;
|
|
115
|
+
changeSummary?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface InsertCanvasImageInput {
|
|
118
|
+
documentId?: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
kind?: CanvasDocumentKind;
|
|
122
|
+
dataUrl?: string;
|
|
123
|
+
base64?: string;
|
|
124
|
+
mimeType?: string;
|
|
125
|
+
fileName?: string;
|
|
126
|
+
width?: number;
|
|
127
|
+
height?: number;
|
|
128
|
+
displayWidth?: number;
|
|
129
|
+
displayHeight?: number;
|
|
130
|
+
pageId?: string;
|
|
131
|
+
anchorShapeId?: string;
|
|
132
|
+
placement?: 'right' | 'left' | 'below' | 'center';
|
|
133
|
+
margin?: number;
|
|
134
|
+
matchAnchor?: boolean;
|
|
135
|
+
altText?: string;
|
|
136
|
+
shapeMeta?: CanvasJsonObject;
|
|
137
|
+
assetMeta?: CanvasJsonObject;
|
|
138
|
+
changeSummary?: string;
|
|
139
|
+
}
|
|
140
|
+
export interface SearchCanvasDocumentsInput {
|
|
141
|
+
status?: CanvasDocumentStatus;
|
|
142
|
+
kind?: CanvasDocumentKind;
|
|
143
|
+
search?: string;
|
|
144
|
+
page?: number;
|
|
145
|
+
pageSize?: number;
|
|
146
|
+
}
|
|
147
|
+
export interface GetCanvasDocumentInput {
|
|
148
|
+
documentId: string;
|
|
149
|
+
versionId?: string;
|
|
150
|
+
versionNumber?: number;
|
|
151
|
+
includeSnapshot?: boolean;
|
|
152
|
+
versionLimit?: number;
|
|
153
|
+
includeLogs?: boolean;
|
|
154
|
+
logLimit?: number;
|
|
155
|
+
}
|
|
156
|
+
export interface GetCanvasRecordInput {
|
|
157
|
+
documentId: string;
|
|
158
|
+
recordId: string;
|
|
159
|
+
versionId?: string;
|
|
160
|
+
versionNumber?: number;
|
|
161
|
+
}
|
|
162
|
+
export interface UpdateCanvasDocumentStatusInput {
|
|
163
|
+
documentId: string;
|
|
164
|
+
status: CanvasDocumentStatus;
|
|
165
|
+
reason?: string;
|
|
166
|
+
}
|
|
167
|
+
export interface ReportCanvasFailureInput {
|
|
168
|
+
documentId?: string;
|
|
169
|
+
versionId?: string;
|
|
170
|
+
operation: string;
|
|
171
|
+
errorMessage: string;
|
|
172
|
+
recoverable?: boolean;
|
|
173
|
+
evidence?: CanvasJsonValue;
|
|
174
|
+
}
|
|
175
|
+
export interface PrepareCanvasAssistantPromptInput {
|
|
176
|
+
documentId: string;
|
|
177
|
+
instruction?: string | null;
|
|
178
|
+
includeSceneSummary?: boolean | null;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;AACpE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,OAAO,CAAA;AAC7H,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,aAAa,GAAG,aAAa,GAAG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AO,CAAA;IACrB,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B;AAED,MAAM,WAAW,iCAAiC;IAChD,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,mBAAmB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,yCAAyC,GAAG,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
team:
|
|
2
|
+
name: canvas-assistant
|
|
3
|
+
type: agent
|
|
4
|
+
title: Canvas Assistant
|
|
5
|
+
description: Agentic visual canvas assistant for infinite whiteboards, AI image slots, annotation workflows, and moodboards
|
|
6
|
+
avatar:
|
|
7
|
+
emoji:
|
|
8
|
+
id: art
|
|
9
|
+
background: rgb(204, 251, 241)
|
|
10
|
+
options:
|
|
11
|
+
templateKey: canvas-assistant
|
|
12
|
+
dataXpert:
|
|
13
|
+
managedBy: data-xpert
|
|
14
|
+
templateKey: canvas-assistant
|
|
15
|
+
assistantKind: business-assistant
|
|
16
|
+
businessDomain: canvas
|
|
17
|
+
requiredPlugin: '@xpert-ai/plugin-canvas'
|
|
18
|
+
requiredPlugins:
|
|
19
|
+
- '@xpert-ai/plugin-canvas'
|
|
20
|
+
- '@xpert-ai/plugin-view-image'
|
|
21
|
+
requiredCapabilities:
|
|
22
|
+
- canvas
|
|
23
|
+
- canvas-workbench
|
|
24
|
+
- agent-canvas
|
|
25
|
+
agentConfig:
|
|
26
|
+
stateVariables:
|
|
27
|
+
- name: currentCanvasDocumentId
|
|
28
|
+
type: string
|
|
29
|
+
default: ""
|
|
30
|
+
description: Current Canvas document id selected in the workbench
|
|
31
|
+
operation: null
|
|
32
|
+
- name: currentCanvasVersionId
|
|
33
|
+
type: string
|
|
34
|
+
default: ""
|
|
35
|
+
description: Current Canvas version id selected in the workbench
|
|
36
|
+
operation: null
|
|
37
|
+
recursionLimit: 10000
|
|
38
|
+
features:
|
|
39
|
+
sandbox:
|
|
40
|
+
enabled: true
|
|
41
|
+
provider: docker-sandbox
|
|
42
|
+
version: "1"
|
|
43
|
+
agent:
|
|
44
|
+
key: Agent_Canvas
|
|
45
|
+
copilotModel:
|
|
46
|
+
referencedId: null
|
|
47
|
+
modelType: llm
|
|
48
|
+
model: qwen3.6-plus
|
|
49
|
+
options:
|
|
50
|
+
context_size: 1000000
|
|
51
|
+
temperature: 0.2
|
|
52
|
+
maxRetries: 6
|
|
53
|
+
max_tokens: 8192
|
|
54
|
+
top_p: 0.95
|
|
55
|
+
knowledgebases: []
|
|
56
|
+
toolsets: []
|
|
57
|
+
tags: []
|
|
58
|
+
nodes:
|
|
59
|
+
- type: agent
|
|
60
|
+
key: Agent_Canvas
|
|
61
|
+
position:
|
|
62
|
+
x: 860
|
|
63
|
+
y: 20
|
|
64
|
+
entity:
|
|
65
|
+
key: Agent_Canvas
|
|
66
|
+
name: canvas-assistant
|
|
67
|
+
title: Canvas Assistant
|
|
68
|
+
description: Agentic visual canvas assistant for infinite whiteboards, AI image slots, annotation workflows, and moodboards
|
|
69
|
+
avatar:
|
|
70
|
+
emoji:
|
|
71
|
+
id: art
|
|
72
|
+
background: rgb(204, 251, 241)
|
|
73
|
+
prompt: >
|
|
74
|
+
You are Canvas Assistant, a data-xpert business assistant for creating and
|
|
75
|
+
managing reviewable tldraw infinite canvases.
|
|
76
|
+
|
|
77
|
+
Use Canvas middleware tools as the system of record. Do not claim that a
|
|
78
|
+
canvas was saved unless a tool call succeeded. Keep every canvas reviewable,
|
|
79
|
+
editable, and versioned.
|
|
80
|
+
|
|
81
|
+
Runtime Canvas Workbench context rendered from request state variables may be
|
|
82
|
+
empty when no canvas or shape is selected:
|
|
83
|
+
- canvasDocumentId: {{env.canvasDocumentId}}
|
|
84
|
+
- canvasVersionId: {{env.canvasVersionId}}
|
|
85
|
+
- canvasPageId: {{env.canvasPageId}}
|
|
86
|
+
- canvasSelectionJson: {{{env.canvasSelectionJson}}}
|
|
87
|
+
- canvasSceneDirty: {{env.canvasSceneDirty}}
|
|
88
|
+
- canvasContextJson: {{{env.canvasContextJson}}}
|
|
89
|
+
- canvasSnapshotImagePath: {{env.canvasSnapshotImagePath}}
|
|
90
|
+
- canvasSnapshotImageUpdatedAt: {{env.canvasSnapshotImageUpdatedAt}}
|
|
91
|
+
- canvasSceneSource: {{env.canvasSceneSource}}
|
|
92
|
+
|
|
93
|
+
If canvasContextJson is non-empty, parse it as the current Workbench Canvas
|
|
94
|
+
context. Treat currentCanvas.selection.type = "canvas.selection.v1" as the
|
|
95
|
+
explicit machine-readable current selection for this turn.
|
|
96
|
+
|
|
97
|
+
If canvasSnapshotImagePath is non-empty and the user asks you to understand
|
|
98
|
+
visual content, inspect layout, follow annotations, describe the board, or
|
|
99
|
+
edit an image based on marked-up feedback, first call view_image with path
|
|
100
|
+
equal to canvasSnapshotImagePath. Do not guess the current visual contents
|
|
101
|
+
from tldraw JSON alone when a viewport snapshot image is available.
|
|
102
|
+
|
|
103
|
+
Canvas workflow:
|
|
104
|
+
1. Clarify the visual goal, audience, key regions, labels, and image needs
|
|
105
|
+
when the request is ambiguous.
|
|
106
|
+
2. Create a canvas with canvas_create_document, then save generated tldraw
|
|
107
|
+
snapshots with canvas_save_snapshot or targeted record changes with
|
|
108
|
+
canvas_patch_records.
|
|
109
|
+
3. Use canvas_insert_image only after an image has been generated or provided.
|
|
110
|
+
Pass dataUrl or base64. If a selected shape is an AI image holder frame,
|
|
111
|
+
pass its id as anchorShapeId so the image fills that slot.
|
|
112
|
+
4. When updating an existing canvas, call canvas_get_document first. Use
|
|
113
|
+
canvas_get_record for exact record JSON before patching selected shapes,
|
|
114
|
+
assets, bindings, image holders, or pages.
|
|
115
|
+
5. When request context contains currentCanvas.selection with type
|
|
116
|
+
"canvas.selection.v1", treat selectedShapeIds as the explicit user
|
|
117
|
+
selection. Only modify selected shapes unless the user explicitly asks to
|
|
118
|
+
affect other content.
|
|
119
|
+
6. Keep changeSummary short and operational. Use canvas_report_failure when
|
|
120
|
+
a snapshot, patch, image insertion, or requested edit cannot be completed.
|
|
121
|
+
|
|
122
|
+
tldraw rules:
|
|
123
|
+
- Preserve user-created records and pages unless the user asks for removal.
|
|
124
|
+
- Prefer small record patches for edits; use full snapshots for imports or
|
|
125
|
+
intentional complete replacements.
|
|
126
|
+
- Use AI image holder frames for future generated images and annotation
|
|
127
|
+
arrows/text for visible edit briefs.
|
|
128
|
+
- Do not include secrets, tokens, tenant ids, or organization ids in canvas
|
|
129
|
+
records.
|
|
130
|
+
|
|
131
|
+
Match the user's language. If the user's language is unclear, respond in English.
|
|
132
|
+
collaboratorNames: []
|
|
133
|
+
toolsetIds: []
|
|
134
|
+
knowledgebaseIds: []
|
|
135
|
+
hash: canvas-agent-v1
|
|
136
|
+
- type: workflow
|
|
137
|
+
key: Middleware_Canvas
|
|
138
|
+
position:
|
|
139
|
+
x: 1160
|
|
140
|
+
y: 332
|
|
141
|
+
entity:
|
|
142
|
+
type: middleware
|
|
143
|
+
key: Middleware_Canvas
|
|
144
|
+
title: Canvas Agent Tools
|
|
145
|
+
provider: CanvasMiddleware
|
|
146
|
+
required: true
|
|
147
|
+
hash: canvas-middleware-v1
|
|
148
|
+
- type: workflow
|
|
149
|
+
key: Middleware_ViewImage
|
|
150
|
+
position:
|
|
151
|
+
x: 1160
|
|
152
|
+
y: 480
|
|
153
|
+
entity:
|
|
154
|
+
type: middleware
|
|
155
|
+
key: Middleware_ViewImage
|
|
156
|
+
title: View Canvas Snapshot Images
|
|
157
|
+
provider: ViewImageMiddleware
|
|
158
|
+
required: true
|
|
159
|
+
hash: canvas-view-image-middleware-v1
|
|
160
|
+
connections:
|
|
161
|
+
- type: workflow
|
|
162
|
+
key: Agent_Canvas/Middleware_Canvas
|
|
163
|
+
from: Agent_Canvas
|
|
164
|
+
to: Middleware_Canvas
|
|
165
|
+
- type: workflow
|
|
166
|
+
key: Agent_Canvas/Middleware_ViewImage
|
|
167
|
+
from: Agent_Canvas
|
|
168
|
+
to: Middleware_ViewImage
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xpert-ai/plugin-canvas",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Canvas app plugin for agent-managed tldraw infinite canvases, image holders, annotation workflows, reviewable versions, and an editable workbench.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "XpertAI",
|
|
7
|
+
"url": "https://xpertai.cn"
|
|
8
|
+
},
|
|
9
|
+
"license": "AGPL-3.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/xpert-ai/xpert-plugins.git",
|
|
13
|
+
"directory": "xpertai/apps/canvas"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/xpert-ai/xpert-plugins/issues"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"module": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
".": {
|
|
25
|
+
"@xpert-plugins-starter/source": "./src/index.ts",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
".xpertai-plugin",
|
|
34
|
+
"assets",
|
|
35
|
+
"skills",
|
|
36
|
+
"README.md",
|
|
37
|
+
"!**/*.tsbuildinfo"
|
|
38
|
+
],
|
|
39
|
+
"xpert": {
|
|
40
|
+
"plugin": {
|
|
41
|
+
"level": "system"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@tldraw/tlschema": "5.1.1",
|
|
46
|
+
"fractional-indexing": "^3.2.0",
|
|
47
|
+
"tldraw": "5.1.1",
|
|
48
|
+
"tslib": "^2.3.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@langchain/core": ">=0.3.0",
|
|
52
|
+
"@nestjs/common": "^11.1.6",
|
|
53
|
+
"@nestjs/core": "^11.1.6",
|
|
54
|
+
"@nestjs/typeorm": "^11.0.0",
|
|
55
|
+
"@xpert-ai/contracts": "^3.10.1",
|
|
56
|
+
"@xpert-ai/plugin-sdk": "^3.10.1",
|
|
57
|
+
"react": ">=18",
|
|
58
|
+
"react-dom": ">=18",
|
|
59
|
+
"typeorm": "^0.3.24",
|
|
60
|
+
"zod": "3.25.67"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@langchain/core": "0.3.72",
|
|
64
|
+
"@nestjs/common": "^11.1.6",
|
|
65
|
+
"@nestjs/core": "^11.1.6",
|
|
66
|
+
"@nestjs/typeorm": "^11.0.0",
|
|
67
|
+
"@types/node": "^20.19.9",
|
|
68
|
+
"@types/react": "^18.3.31",
|
|
69
|
+
"@types/react-dom": "^18.3.7",
|
|
70
|
+
"@xpert-ai/contracts": "3.10.1",
|
|
71
|
+
"@xpert-ai/plugin-sdk": "^3.10.1",
|
|
72
|
+
"esbuild": "^0.27.0",
|
|
73
|
+
"jest": "^30.0.2",
|
|
74
|
+
"react": "^18.3.1",
|
|
75
|
+
"react-dom": "^18.3.1",
|
|
76
|
+
"reflect-metadata": "^0.2.2",
|
|
77
|
+
"typeorm": "^0.3.24",
|
|
78
|
+
"typescript": "^5.9.2",
|
|
79
|
+
"zod": "3.25.67",
|
|
80
|
+
"@xpert-ai/plugin-shadcn-ui": "0.1.0"
|
|
81
|
+
},
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public"
|
|
84
|
+
},
|
|
85
|
+
"scripts": {
|
|
86
|
+
"build": "node scripts/build-remote-components.mjs && tsc -p tsconfig.lib.json && node scripts/copy-assets.mjs",
|
|
87
|
+
"lint": "echo \"(todo) add lint\"",
|
|
88
|
+
"test": "jest --config jest.config.ts && tsc -p tsconfig.spec.json --noEmit && tsc -p tsconfig.remote.json --noEmit && node scripts/build-remote-components.mjs --check",
|
|
89
|
+
"typecheck": "tsc -p tsconfig.spec.json --noEmit && tsc -p tsconfig.remote.json --noEmit && node scripts/build-remote-components.mjs --check"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: canvas-agent-skill
|
|
3
|
+
description: "Use when an Agent needs to use @xpert-ai/plugin-canvas middleware tools to create, inspect, patch, version, review, annotate, insert images into, or recover tldraw Canvas documents, including Workbench selection context and AI image holders."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Canvas Agent Skill
|
|
7
|
+
|
|
8
|
+
Use this skill when a user asks an Agent to create, update, inspect, review, annotate, or recover a Canvas document through the Xpert Canvas plugin.
|
|
9
|
+
|
|
10
|
+
The plugin has two surfaces:
|
|
11
|
+
|
|
12
|
+
- Workbench: the human review and editing surface. It can list canvases, edit the tldraw board, create AI image holders, add annotations, save versions, import/export snapshots, restore versions, mark reviewed/draft, archive, and delete canvases.
|
|
13
|
+
- Middleware tools: the Agent-callable system of record. These tools create canvas records, save snapshots, patch tldraw records, insert image data URLs, search/read metadata, fetch exact records, update lifecycle status, and report failures.
|
|
14
|
+
- View image: the Canvas Assistant template should include `@xpert-ai/plugin-view-image`. Use `view_image` to inspect the latest viewport snapshot image before reasoning about visible layout, annotations, or image feedback.
|
|
15
|
+
|
|
16
|
+
Do not treat Workbench view actions as Agent middleware tools. Use only the middleware tool names documented below when acting from an Agent.
|
|
17
|
+
|
|
18
|
+
## Core Rules
|
|
19
|
+
|
|
20
|
+
1. Do not invent document ids, version ids, page ids, shape ids, asset ids, or binding ids for existing canvases. Use Workbench context, `canvas_search_documents`, `canvas_get_document`, or `canvas_get_record`.
|
|
21
|
+
2. Before editing an existing canvas, call `canvas_get_document` unless the current prompt already contains trustworthy Workbench context with the document id and version ref. By default this reads the latest autosaved working copy.
|
|
22
|
+
3. Prefer `canvas_patch_records` for targeted edits. Use `canvas_save_snapshot` only for a full snapshot import or intentional complete replacement.
|
|
23
|
+
4. Use `canvas_insert_image` only after image generation or when the user provides image data. Pass `dataUrl` or `base64`; the tool stores image data inside tldraw asset records for v1.
|
|
24
|
+
5. If the selected shape is an AI image holder frame, pass that frame id as `anchorShapeId`; the image will be inserted as a child of the frame and sized to the holder.
|
|
25
|
+
6. Do not delete or move annotations unless the user explicitly asks. Annotation arrows and notes are review evidence.
|
|
26
|
+
7. Do not claim a canvas was saved unless the tool call succeeded. Tool results are the source of truth.
|
|
27
|
+
8. Do not route logic from display text or localized labels. Use explicit fields such as `selection.type`, `selectedShapeIds`, `kind`, `status`, and `sourceType`.
|
|
28
|
+
9. When the user asks what is currently visible, asks you to follow markups, asks for layout critique, or asks for image edits based on annotations, call `view_image` first with `env.canvasSnapshotImagePath` or the `snapshotImagePath` returned by `canvas_get_document`.
|
|
29
|
+
|
|
30
|
+
## Workbench Selection Context
|
|
31
|
+
|
|
32
|
+
The Workbench can send `assistant.context.set` when the user selects shapes. That request state is not automatically visible to the model unless the assistant prompt renders it through prompt variables.
|
|
33
|
+
|
|
34
|
+
When the prompt includes these variables, use them before searching broadly:
|
|
35
|
+
|
|
36
|
+
- `env.canvasDocumentId`
|
|
37
|
+
- `env.canvasVersionId`
|
|
38
|
+
- `env.canvasPageId`
|
|
39
|
+
- `env.canvasSelectionJson`
|
|
40
|
+
- `env.canvasContextJson`
|
|
41
|
+
- `env.canvasSceneDirty`
|
|
42
|
+
- `env.canvasSnapshotImagePath`
|
|
43
|
+
- `env.canvasSnapshotImageUpdatedAt`
|
|
44
|
+
- `env.canvasSceneSource`
|
|
45
|
+
|
|
46
|
+
If `env.canvasContextJson` is non-empty, parse it as JSON. The expected shape is:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"currentCanvas": {
|
|
51
|
+
"documentId": "document-id",
|
|
52
|
+
"title": "Canvas title",
|
|
53
|
+
"currentVersionId": "version-id",
|
|
54
|
+
"currentVersionNumber": 12,
|
|
55
|
+
"isDirty": true,
|
|
56
|
+
"sceneSource": "autosave",
|
|
57
|
+
"snapshotImagePath": "files/canvas/documents/document-id/snapshots/current.png",
|
|
58
|
+
"snapshotImageUpdatedAt": "2026-06-25T15:22:28.459Z",
|
|
59
|
+
"selection": {
|
|
60
|
+
"type": "canvas.selection.v1",
|
|
61
|
+
"pageId": "page:page",
|
|
62
|
+
"selectedShapeIds": ["shape:id"],
|
|
63
|
+
"selectedShapeCount": 1,
|
|
64
|
+
"shapes": [
|
|
65
|
+
{
|
|
66
|
+
"id": "shape:id",
|
|
67
|
+
"type": "frame",
|
|
68
|
+
"x": 10,
|
|
69
|
+
"y": 20,
|
|
70
|
+
"w": 512,
|
|
71
|
+
"h": 683,
|
|
72
|
+
"isAiImageHolder": true
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"capturedAt": "2026-06-25T15:22:28.459Z"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Selection rules:
|
|
82
|
+
|
|
83
|
+
- Treat `currentCanvas.selection.type === "canvas.selection.v1"` as the only valid machine-readable selection discriminator.
|
|
84
|
+
- If a valid selection exists, modify only `selectedShapeIds` unless the user explicitly asks to affect neighboring or unselected shapes.
|
|
85
|
+
- Use compact `selection.shapes` only for orientation, bounds, and intent. Fetch full record JSON with `canvas_get_record` before changing exact geometry, style, bindings, text, asset refs, or page membership.
|
|
86
|
+
- If `currentCanvas.isDirty === true` or `env.canvasSceneDirty === "true"`, Workbench may still be autosaving. Use the newest autosaved working copy from `canvas_get_document` before patching.
|
|
87
|
+
- If `currentCanvas.snapshotImagePath` or `env.canvasSnapshotImagePath` is present, it points to the latest fixed viewport snapshot image, usually `files/canvas/documents/{documentId}/snapshots/current.png`.
|
|
88
|
+
|
|
89
|
+
## Visual Snapshot Reading
|
|
90
|
+
|
|
91
|
+
Use `view_image` when visual understanding matters:
|
|
92
|
+
|
|
93
|
+
- Current board description, visual QA, layout critique, or “what did I draw?”
|
|
94
|
+
- Annotation-driven image iteration, such as arrows/text pointing to regions to change
|
|
95
|
+
- Comparing what is visible in the viewport with a requested change
|
|
96
|
+
- Any task where tldraw JSON alone would be a guess about rendered appearance
|
|
97
|
+
|
|
98
|
+
Call shape:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"path": "files/canvas/documents/document-id/snapshots/current.png"
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
After `view_image` returns, combine the visual evidence with `canvas_get_document` or `canvas_get_record` when exact record edits are needed.
|
|
107
|
+
|
|
108
|
+
## Tool Contracts
|
|
109
|
+
|
|
110
|
+
### `canvas_create_document`
|
|
111
|
+
|
|
112
|
+
Create a managed canvas metadata record. Required input: `title`. Optional inputs: `description`, `kind`, `tags`, `source`, `snapshot`, `viewState`, `selectionSummary`, `changeSummary`.
|
|
113
|
+
|
|
114
|
+
### `canvas_save_snapshot`
|
|
115
|
+
|
|
116
|
+
Save a complete valid tldraw snapshot as a new version. Required input: `documentId`, `snapshot`. Optional inputs: `viewState`, `selectionSummary`, `snapshotImage`, `sourceType`, `changeSummary`. Workbench autosaves current viewport images separately; Agents may omit `snapshotImage` when they only have JSON.
|
|
117
|
+
|
|
118
|
+
### `canvas_patch_records`
|
|
119
|
+
|
|
120
|
+
Patch the current tldraw snapshot. Required input: `documentId`. Optional inputs: `putRecords`, `removeRecordIds`, `viewStatePatch`, `selectionSummary`, `changeSummary`.
|
|
121
|
+
|
|
122
|
+
### `canvas_insert_image`
|
|
123
|
+
|
|
124
|
+
Insert a bitmap into a canvas. Required image input: `dataUrl` or `base64`. Optional positioning inputs: `documentId`, `pageId`, `anchorShapeId`, `placement`, `displayWidth`, `displayHeight`, `matchAnchor`, `shapeMeta`, `assetMeta`.
|
|
125
|
+
|
|
126
|
+
### `canvas_search_documents`
|
|
127
|
+
|
|
128
|
+
Find existing canvases by `status`, `kind`, `search`, `page`, and `pageSize`.
|
|
129
|
+
|
|
130
|
+
### `canvas_get_document`
|
|
131
|
+
|
|
132
|
+
Read compact canvas metadata, the latest autosaved working-copy scene by default, current version metadata, versions, optional logs, and compact scene summary. Set `includeSnapshot=true` only when a full snapshot is required. Use `versionId` or `versionNumber` to read a historical version.
|
|
133
|
+
|
|
134
|
+
### `canvas_get_record`
|
|
135
|
+
|
|
136
|
+
Fetch one exact tldraw record from the latest autosaved working copy by default, or from a requested `versionId` / `versionNumber`. Use this before targeted selected-shape or asset edits.
|
|
137
|
+
|
|
138
|
+
### `canvas_update_document_status`
|
|
139
|
+
|
|
140
|
+
Update status to `draft`, `reviewed`, or `archived`. Mark reviewed only after user or workflow confirmation.
|
|
141
|
+
|
|
142
|
+
### `canvas_report_failure`
|
|
143
|
+
|
|
144
|
+
Record a failed generation, validation, import, inspection, image insertion, or patch attempt.
|