@creator-notes/cnotes 0.91.0 → 0.93.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/.claude-plugin/plugin.json +1 -1
- package/dist/commands/canvas.d.ts.map +1 -1
- package/dist/commands/canvas.js +14 -8
- package/dist/commands/canvas.js.map +1 -1
- package/dist/commands/draft.d.ts.map +1 -1
- package/dist/commands/draft.js +26 -2
- package/dist/commands/draft.js.map +1 -1
- package/dist/lib/draft-view.d.ts +6 -0
- package/dist/lib/draft-view.d.ts.map +1 -1
- package/dist/lib/draft-view.js +3 -1
- package/dist/lib/draft-view.js.map +1 -1
- package/dist/lib/share-link.d.ts +19 -0
- package/dist/lib/share-link.d.ts.map +1 -0
- package/dist/lib/share-link.js +33 -0
- package/dist/lib/share-link.js.map +1 -0
- package/dist/mcp-server.js +7 -6
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/skills/cnotes/references/drafts.md +7 -0
- package/dist/lib/canvas-read.d.ts +0 -180
- package/dist/lib/canvas-read.d.ts.map +0 -1
- package/dist/lib/canvas-read.js +0 -624
- package/dist/lib/canvas-read.js.map +0 -1
package/dist/lib/canvas-read.js
DELETED
|
@@ -1,624 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared helper for `cnotes canvas read` and the `cn_canvas_read` MCP tool.
|
|
3
|
-
*
|
|
4
|
-
* Fetches a canvas + its referenced notes (one bulk call, never N+1) and
|
|
5
|
-
* returns the canvas as STRUCTURE, not just a bag of content:
|
|
6
|
-
*
|
|
7
|
-
* - `sections` the frames, in reading order, each with its bounds
|
|
8
|
-
* - `elements` the renderable content, each tagged with the section it
|
|
9
|
-
* sits inside (so the grouping the canvas *shows* survives)
|
|
10
|
-
* - `edges` the argument — which element points at which, and why
|
|
11
|
-
* - `portals` the navigation — links out to other canvases
|
|
12
|
-
*
|
|
13
|
-
* Elements are ordered top-to-bottom, left-to-right with a small Y tolerance
|
|
14
|
-
* so visually-aligned rows stay together. Heuristic, not a layout-aware sort —
|
|
15
|
-
* fine for a "thinking aid" but not authoritative.
|
|
16
|
-
*/
|
|
17
|
-
import { formatSupersededBy, readSupersededBy, } from "./superseded-by.js";
|
|
18
|
-
const ROW_TOLERANCE = 80;
|
|
19
|
-
/**
|
|
20
|
-
* Last-resort footprint for a node that has no entry in the canvas payload's
|
|
21
|
-
* `allNodes` occupancy view at all — a shape the current server never sends
|
|
22
|
-
* (`allNodes` covers all five node kinds and always carries width/height), so
|
|
23
|
-
* this fires only if that view ever goes partial.
|
|
24
|
-
*
|
|
25
|
-
* It is NOT the number the center rule normally uses: see `sectionFor` below
|
|
26
|
-
* for which footprints are in play and where they disagree with Convex.
|
|
27
|
-
*/
|
|
28
|
-
const UNMEASURED_NODE_FOOTPRINT = { width: 400, height: 150 };
|
|
29
|
-
/** Shorten free text to a stable one-line ref for edge endpoints. */
|
|
30
|
-
function shortLabel(s, max = 32) {
|
|
31
|
-
const flat = s.replace(/\s+/g, " ").trim();
|
|
32
|
-
return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
|
|
33
|
-
}
|
|
34
|
-
function num(v) {
|
|
35
|
-
return typeof v === "number" ? v : undefined;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The canvas id inside a share link (`https://<host>/shared/<canvasId>`), with
|
|
39
|
-
* the link's origin so the caller can check it points at the server it is
|
|
40
|
-
* signed in to. Null for anything that isn't a share link.
|
|
41
|
-
*/
|
|
42
|
-
export function parseSharedCanvasLink(input) {
|
|
43
|
-
let url;
|
|
44
|
-
try {
|
|
45
|
-
url = new URL(input.trim());
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
51
|
-
return null;
|
|
52
|
-
const m = /^\/shared\/([a-z0-9]+)\/?$/.exec(url.pathname);
|
|
53
|
-
return m ? { canvasId: m[1], origin: url.origin } : null;
|
|
54
|
-
}
|
|
55
|
-
/** Whether a share link's origin is the server the CLI talks to. `www.` and
|
|
56
|
-
* the bare domain serve the same app, so they count as one. */
|
|
57
|
-
export function sameServerOrigin(linkOrigin, serverUrl) {
|
|
58
|
-
const norm = (u) => {
|
|
59
|
-
const url = new URL(u);
|
|
60
|
-
return `${url.protocol}//${url.host.replace(/^www\./, "")}`;
|
|
61
|
-
};
|
|
62
|
-
try {
|
|
63
|
-
return norm(linkOrigin) === norm(serverUrl);
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export async function readCanvasMarkdown(api, workspaceId, canvasId, opts = {}) {
|
|
70
|
-
// A shared read goes through the share link's access rules and names no
|
|
71
|
-
// workspace: the canvas may belong to one the reader isn't a member of.
|
|
72
|
-
const data = await api.get(`/api/canvas/${encodeURIComponent(canvasId)}`, opts.shared ? { access: "shared", format: "markdown" } : { workspaceId, format: "markdown" });
|
|
73
|
-
const nodes = data.nodes || [];
|
|
74
|
-
const textNodes = data.textNodes || [];
|
|
75
|
-
const richtextNodes = data.richtextNodes || [];
|
|
76
|
-
const listNodes = data.listNodes || [];
|
|
77
|
-
const sectionNodes = data.sectionNodes || [];
|
|
78
|
-
const canvasLinkNodes = data.canvasLinkNodes || [];
|
|
79
|
-
const rawEdges = data.edges || [];
|
|
80
|
-
const wantedDisplayIds = new Set();
|
|
81
|
-
for (const n of nodes) {
|
|
82
|
-
const note = n.note;
|
|
83
|
-
const id = note?.displayId;
|
|
84
|
-
if (typeof id === "string")
|
|
85
|
-
wantedDisplayIds.add(id);
|
|
86
|
-
}
|
|
87
|
-
const idsArr = Array.from(wantedDisplayIds);
|
|
88
|
-
// Shared reads carry the bodies of the canvas's cards in the same response
|
|
89
|
-
// (`noteBodies`), because `/api/notes` is scoped to the reader's own
|
|
90
|
-
// workspaces. They have no supersededBy: that needs the owner's graph.
|
|
91
|
-
const sharedBodies = opts.shared
|
|
92
|
-
? (data.noteBodies ?? []).map((b) => ({
|
|
93
|
-
displayId: b.displayId,
|
|
94
|
-
content: b.content,
|
|
95
|
-
}))
|
|
96
|
-
: null;
|
|
97
|
-
const bulk = sharedBodies !== null
|
|
98
|
-
? sharedBodies
|
|
99
|
-
: idsArr.length === 0
|
|
100
|
-
? []
|
|
101
|
-
: await api.get("/api/notes", {
|
|
102
|
-
workspaceId,
|
|
103
|
-
exact_ids: idsArr.join(","),
|
|
104
|
-
format: "markdown",
|
|
105
|
-
});
|
|
106
|
-
const markdownByDisplayId = new Map();
|
|
107
|
-
const supersededByDisplayId = new Map();
|
|
108
|
-
for (const n of bulk) {
|
|
109
|
-
const id = n.displayId;
|
|
110
|
-
const md = n.latestVersion?.content ?? n.content;
|
|
111
|
-
if (typeof id === "string" && typeof md === "string") {
|
|
112
|
-
markdownByDisplayId.set(id, md);
|
|
113
|
-
}
|
|
114
|
-
const supersededBy = readSupersededBy(n);
|
|
115
|
-
if (typeof id === "string" && supersededBy) {
|
|
116
|
-
supersededByDisplayId.set(id, supersededBy);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
// --- Sections -----------------------------------------------------------
|
|
120
|
-
// Containment is CENTER-in-rect against the SMALLEST enclosing frame, so a
|
|
121
|
-
// nested frame wins over its parent.
|
|
122
|
-
//
|
|
123
|
-
// The center rule is not a detail: it is the rule the canvas itself uses
|
|
124
|
-
// (useSectionDrag on the client, getSectionNoteIdsGeometric on the server).
|
|
125
|
-
// Testing the top-left corner instead — which this did until the section read
|
|
126
|
-
// was added — disagrees with the canvas for any card straddling a frame edge,
|
|
127
|
-
// in both directions: a card whose corner is inside but whose body hangs out
|
|
128
|
-
// reads as contained, and a card overlapping the top edge reads as loose. Frames
|
|
129
|
-
// are drawn tight around their contents, so edge cards are the common case,
|
|
130
|
-
// not the exotic one.
|
|
131
|
-
//
|
|
132
|
-
// `allNodes` carries the server's resolved width/height per node id — the
|
|
133
|
-
// occupancy view the layout solver avoids — which is what makes a center
|
|
134
|
-
// computable here at all. Those are the PAINTED footprints: a stored dim when
|
|
135
|
-
// there is one, otherwise the per-kind default for notes/stickies and a live
|
|
136
|
-
// measurement for richtext, lists and portals (NODE_KIND_DEFAULT_DIMS /
|
|
137
|
-
// measureRichtextBox et al in app/api/canvas/[canvasId]/route.ts).
|
|
138
|
-
//
|
|
139
|
-
// KNOWN DIVERGENCE, read this before "fixing" either side. Convex's
|
|
140
|
-
// makeCenterInsideTest — the authority for section sketches and for what
|
|
141
|
-
// travels when a frame moves — has only ONE fallback for a row with no stored
|
|
142
|
-
// width/height: UNMEASURED_NODE_FOOTPRINT, 400x150. So for a node whose dims
|
|
143
|
-
// were never persisted the two compute different centers:
|
|
144
|
-
// - note: 280x130 here vs 400x150 there → centers 60px/10px apart
|
|
145
|
-
// - richtext: measured 560–1680 wide here vs 400 there → up to ~640px apart
|
|
146
|
-
// Near a frame edge that flips membership, so `canvas read` can group a card
|
|
147
|
-
// that a section sketch or a frame move treats as loose. This side is the one
|
|
148
|
-
// that matches what the user SEES, which is why it stays; the divergence
|
|
149
|
-
// closes for real when dims are persisted rather than assumed — that is what
|
|
150
|
-
// convex/migrations/backfillRichtextNodeDims.ts is for (still pending in
|
|
151
|
-
// prod). Do not "align" the two by copying 400x150 down here: that would make
|
|
152
|
-
// the read disagree with the painted canvas as well.
|
|
153
|
-
const allNodes = data.allNodes || [];
|
|
154
|
-
const dimsByNodeId = new Map();
|
|
155
|
-
for (const n of allNodes) {
|
|
156
|
-
const id = n.id;
|
|
157
|
-
const width = num(n.width);
|
|
158
|
-
const height = num(n.height);
|
|
159
|
-
if (typeof id === "string" && width !== undefined && height !== undefined) {
|
|
160
|
-
dimsByNodeId.set(id, { width, height });
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
const sections = sectionNodes
|
|
164
|
-
.map((s) => ({
|
|
165
|
-
displayId: String(s.displayId || ""),
|
|
166
|
-
name: String(s.name || "(unnamed)"),
|
|
167
|
-
bounds: {
|
|
168
|
-
x: num(s.positionX) ?? 0,
|
|
169
|
-
y: num(s.positionY) ?? 0,
|
|
170
|
-
width: num(s.width) ?? 0,
|
|
171
|
-
height: num(s.height) ?? 0,
|
|
172
|
-
},
|
|
173
|
-
...(typeof s.colorHex === "string" && s.colorHex
|
|
174
|
-
? { colorHex: s.colorHex }
|
|
175
|
-
: {}),
|
|
176
|
-
}))
|
|
177
|
-
.sort((a, b) => Math.abs(a.bounds.y - b.bounds.y) > ROW_TOLERANCE
|
|
178
|
-
? a.bounds.y - b.bounds.y
|
|
179
|
-
: a.bounds.x - b.bounds.x);
|
|
180
|
-
const sectionFor = (pos, nodeId) => {
|
|
181
|
-
// Dims come from the payload's occupancy view; the constant is only for a
|
|
182
|
-
// node absent from it entirely. See the KNOWN DIVERGENCE note above for
|
|
183
|
-
// which footprints these are and where they part company with Convex.
|
|
184
|
-
const dims = (typeof nodeId === "string" ? dimsByNodeId.get(nodeId) : undefined) ??
|
|
185
|
-
UNMEASURED_NODE_FOOTPRINT;
|
|
186
|
-
const cx = (pos.positionX ?? 0) + dims.width / 2;
|
|
187
|
-
const cy = (pos.positionY ?? 0) + dims.height / 2;
|
|
188
|
-
let best;
|
|
189
|
-
for (const s of sections) {
|
|
190
|
-
const { x: sx, y: sy, width, height } = s.bounds;
|
|
191
|
-
const inside = cx >= sx && cx <= sx + width && cy >= sy && cy <= sy + height;
|
|
192
|
-
if (!inside)
|
|
193
|
-
continue;
|
|
194
|
-
if (!best || width * height < best.bounds.width * best.bounds.height) {
|
|
195
|
-
best = s;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return best?.displayId;
|
|
199
|
-
};
|
|
200
|
-
// Which frame each node landed in, keyed by node id. Edges reference nodes by
|
|
201
|
-
// id, so this is what lets an edge report the frames it spans without
|
|
202
|
-
// re-deriving containment from the refs (which are lossy for unlabeled
|
|
203
|
-
// stickies).
|
|
204
|
-
const sectionByNodeId = new Map();
|
|
205
|
-
const withSection = (el, nodeId) => {
|
|
206
|
-
const section = sectionFor(el.pos, nodeId);
|
|
207
|
-
if (section && typeof nodeId === "string") {
|
|
208
|
-
sectionByNodeId.set(nodeId, section);
|
|
209
|
-
}
|
|
210
|
-
return section ? { ...el, section } : el;
|
|
211
|
-
};
|
|
212
|
-
// --- Elements -----------------------------------------------------------
|
|
213
|
-
const elements = [];
|
|
214
|
-
for (const n of nodes) {
|
|
215
|
-
const note = n.note;
|
|
216
|
-
const displayId = note?.displayId;
|
|
217
|
-
if (!displayId)
|
|
218
|
-
continue;
|
|
219
|
-
const supersededBy = supersededByDisplayId.get(displayId);
|
|
220
|
-
elements.push(withSection({
|
|
221
|
-
kind: "note",
|
|
222
|
-
pos: {
|
|
223
|
-
positionX: n.positionX,
|
|
224
|
-
positionY: n.positionY,
|
|
225
|
-
},
|
|
226
|
-
displayId,
|
|
227
|
-
title: note?.title || "(untitled)",
|
|
228
|
-
type: note?.type || "Note",
|
|
229
|
-
markdown: markdownByDisplayId.get(displayId) ?? "",
|
|
230
|
-
...(supersededBy ? { supersededBy } : {}),
|
|
231
|
-
}, n.id));
|
|
232
|
-
}
|
|
233
|
-
for (const t of textNodes) {
|
|
234
|
-
elements.push(withSection({
|
|
235
|
-
kind: "text",
|
|
236
|
-
pos: {
|
|
237
|
-
positionX: t.positionX,
|
|
238
|
-
positionY: t.positionY,
|
|
239
|
-
},
|
|
240
|
-
text: String(t.text || ""),
|
|
241
|
-
headingSize: t.headingSize,
|
|
242
|
-
}, t.id));
|
|
243
|
-
}
|
|
244
|
-
for (const r of richtextNodes) {
|
|
245
|
-
elements.push(withSection({
|
|
246
|
-
kind: "richtext",
|
|
247
|
-
...(typeof r.id === "string" ? { id: r.id } : {}),
|
|
248
|
-
pos: {
|
|
249
|
-
positionX: r.positionX,
|
|
250
|
-
positionY: r.positionY,
|
|
251
|
-
},
|
|
252
|
-
markdown: typeof r.content === "string" ? r.content : "",
|
|
253
|
-
}, r.id));
|
|
254
|
-
}
|
|
255
|
-
for (const l of listNodes) {
|
|
256
|
-
const items = l.items || [];
|
|
257
|
-
elements.push(withSection({
|
|
258
|
-
kind: "list",
|
|
259
|
-
pos: {
|
|
260
|
-
positionX: l.positionX,
|
|
261
|
-
positionY: l.positionY,
|
|
262
|
-
},
|
|
263
|
-
title: String(l.title || "List"),
|
|
264
|
-
items: items.map((it) => {
|
|
265
|
-
const note = it.note;
|
|
266
|
-
return {
|
|
267
|
-
displayId: note?.displayId,
|
|
268
|
-
title: note?.title,
|
|
269
|
-
type: note?.type,
|
|
270
|
-
};
|
|
271
|
-
}),
|
|
272
|
-
}, l.id));
|
|
273
|
-
}
|
|
274
|
-
elements.sort((a, b) => {
|
|
275
|
-
const ay = a.pos.positionY ?? 0;
|
|
276
|
-
const by = b.pos.positionY ?? 0;
|
|
277
|
-
if (Math.abs(ay - by) > ROW_TOLERANCE)
|
|
278
|
-
return ay - by;
|
|
279
|
-
return (a.pos.positionX ?? 0) - (b.pos.positionX ?? 0);
|
|
280
|
-
});
|
|
281
|
-
// --- Portals ------------------------------------------------------------
|
|
282
|
-
const portals = canvasLinkNodes.map((c) => {
|
|
283
|
-
const linked = c.linkedCanvas ?? {};
|
|
284
|
-
const pos = {
|
|
285
|
-
positionX: c.positionX,
|
|
286
|
-
positionY: c.positionY,
|
|
287
|
-
};
|
|
288
|
-
const section = sectionFor(pos, c.id);
|
|
289
|
-
if (section && typeof c.id === "string")
|
|
290
|
-
sectionByNodeId.set(c.id, section);
|
|
291
|
-
return {
|
|
292
|
-
canvasId: String(linked.id ?? c.linkedCanvasId ?? ""),
|
|
293
|
-
title: String(linked.name || "(untitled canvas)"),
|
|
294
|
-
...(linked.isDefault ? { isDefault: true } : {}),
|
|
295
|
-
pos,
|
|
296
|
-
...(section ? { section } : {}),
|
|
297
|
-
};
|
|
298
|
-
});
|
|
299
|
-
// --- Edges --------------------------------------------------------------
|
|
300
|
-
// The server resolves `sourceRef`/`targetRef` for NOTE endpoints only. Build
|
|
301
|
-
// a ref map across every node kind so an edge anchored on a section, sticky,
|
|
302
|
-
// or portal reports something readable instead of a raw Convex id.
|
|
303
|
-
const refByNodeId = new Map();
|
|
304
|
-
for (const n of nodes) {
|
|
305
|
-
const note = n.note;
|
|
306
|
-
const ref = n.ref || note?.displayId;
|
|
307
|
-
if (typeof n.id === "string" && ref)
|
|
308
|
-
refByNodeId.set(n.id, ref);
|
|
309
|
-
}
|
|
310
|
-
for (const s of sectionNodes) {
|
|
311
|
-
if (typeof s.id === "string" && s.displayId) {
|
|
312
|
-
refByNodeId.set(s.id, String(s.displayId));
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
for (const t of textNodes) {
|
|
316
|
-
if (typeof t.id === "string") {
|
|
317
|
-
refByNodeId.set(t.id, `text:"${shortLabel(String(t.text || ""))}"`);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
for (const r of richtextNodes) {
|
|
321
|
-
if (typeof r.id === "string") {
|
|
322
|
-
refByNodeId.set(r.id, `richtext:"${shortLabel(String(r.content || ""))}"`);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
for (const l of listNodes) {
|
|
326
|
-
if (typeof l.id === "string") {
|
|
327
|
-
refByNodeId.set(l.id, `list:"${shortLabel(String(l.title || "List"))}"`);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
for (const c of canvasLinkNodes) {
|
|
331
|
-
const linked = c.linkedCanvas ?? {};
|
|
332
|
-
if (typeof c.id === "string") {
|
|
333
|
-
refByNodeId.set(c.id, `canvas:"${shortLabel(String(linked.name || "canvas"))}"`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
// The local map wins over `serverRef`. The server resolves a ref for NOTE
|
|
337
|
-
// endpoints and falls back to the RAW NODE ID for every other kind — a
|
|
338
|
-
// non-empty string, so preferring `serverRef` would short-circuit every
|
|
339
|
-
// lookup and print `k9x2…` for section/sticky/portal endpoints, which is the
|
|
340
|
-
// whole thing this map exists to prevent. The map already carries the note
|
|
341
|
-
// displayIds, so checking it first loses nothing.
|
|
342
|
-
const refFor = (nodeId, serverRef) => {
|
|
343
|
-
const id = String(nodeId ?? "");
|
|
344
|
-
const local = refByNodeId.get(id);
|
|
345
|
-
if (local)
|
|
346
|
-
return local;
|
|
347
|
-
if (typeof serverRef === "string" && serverRef)
|
|
348
|
-
return serverRef;
|
|
349
|
-
return id;
|
|
350
|
-
};
|
|
351
|
-
// A section node can itself be an edge endpoint; treat a frame as sitting in
|
|
352
|
-
// itself so an edge drawn to the frame counts as touching it.
|
|
353
|
-
for (const s of sectionNodes) {
|
|
354
|
-
if (typeof s.id === "string" && s.displayId) {
|
|
355
|
-
sectionByNodeId.set(s.id, String(s.displayId));
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
const edges = rawEdges.map((e) => ({
|
|
359
|
-
from: refFor(e.sourceNodeId, e.sourceRef),
|
|
360
|
-
to: refFor(e.targetNodeId, e.targetRef),
|
|
361
|
-
...(typeof e.sourceNodeId === "string" &&
|
|
362
|
-
sectionByNodeId.has(e.sourceNodeId)
|
|
363
|
-
? { fromSection: sectionByNodeId.get(e.sourceNodeId) }
|
|
364
|
-
: {}),
|
|
365
|
-
...(typeof e.targetNodeId === "string" &&
|
|
366
|
-
sectionByNodeId.has(e.targetNodeId)
|
|
367
|
-
? { toSection: sectionByNodeId.get(e.targetNodeId) }
|
|
368
|
-
: {}),
|
|
369
|
-
...(typeof e.label === "string" && e.label ? { label: e.label } : {}),
|
|
370
|
-
...(typeof e.lineStyle === "string" && e.lineStyle
|
|
371
|
-
? { lineStyle: e.lineStyle }
|
|
372
|
-
: {}),
|
|
373
|
-
...(e.arrowStart === true ? { arrowStart: true } : {}),
|
|
374
|
-
...(e.arrowEnd === false ? { arrowEnd: false } : {}),
|
|
375
|
-
}));
|
|
376
|
-
return {
|
|
377
|
-
canvas: data.canvas ?? { id: canvasId },
|
|
378
|
-
sections,
|
|
379
|
-
elements,
|
|
380
|
-
edges,
|
|
381
|
-
portals,
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
/** Is `inner` wholly within `outer`? Used to find frames nested in a frame. */
|
|
385
|
-
function rectInside(inner, outer) {
|
|
386
|
-
return (inner.x >= outer.x &&
|
|
387
|
-
inner.y >= outer.y &&
|
|
388
|
-
inner.x + inner.width <= outer.x + outer.width &&
|
|
389
|
-
inner.y + inner.height <= outer.y + outer.height);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Read ONE section frame: resolve a SECTION-<n> handle to its canvas, then
|
|
393
|
-
* return just what that frame contains.
|
|
394
|
-
*
|
|
395
|
-
* Two hops by design. The first resolves the address (which canvas holds this
|
|
396
|
-
* frame — the caller doesn't have to know); the second reads the canvas through
|
|
397
|
-
* the same path `canvas read` uses, and the frame is applied as a filter. The
|
|
398
|
-
* canvas fetch is not smaller for being filtered, but what comes BACK is, and
|
|
399
|
-
* for an agent that is the cost that matters: a section read is the frame's
|
|
400
|
-
* content, not a whole canvas to scroll past. Filtering here rather than
|
|
401
|
-
* server-side also keeps ONE implementation of how a canvas turns into
|
|
402
|
-
* elements — a second one would drift, and drift about what a frame contains is
|
|
403
|
-
* exactly what makes the answer untrustworthy.
|
|
404
|
-
*
|
|
405
|
-
* Cost ceiling worth knowing: the second hop bulk-fetches the markdown of EVERY
|
|
406
|
-
* note on the canvas (one call, never N+1) and then discards the ones outside
|
|
407
|
-
* the frame. Reading a small frame on a large canvas therefore costs the canvas,
|
|
408
|
-
* not the frame. Acceptable while it buys one shaping implementation; if a
|
|
409
|
-
* canvas ever grows big enough for that to hurt, the fix is to resolve
|
|
410
|
-
* membership first and fetch only those bodies, not to fork the shaping.
|
|
411
|
-
*
|
|
412
|
-
* A frame nested inside the target travels WITH it: its cards would otherwise
|
|
413
|
-
* vanish from the answer entirely, since `sectionFor` tags each element with the
|
|
414
|
-
* SMALLEST frame containing it. `getSectionMemberNodes` in Convex makes the same
|
|
415
|
-
* call for a frame move, so "read a frame" and "move a frame" cover the same
|
|
416
|
-
* cards.
|
|
417
|
-
*/
|
|
418
|
-
export async function readCanvasSection(api, workspaceId, sectionHandle) {
|
|
419
|
-
// "SECTION-7" is the display handle; anything else is treated as a raw id.
|
|
420
|
-
const isDisplayId = /^section-/i.test(sectionHandle.trim());
|
|
421
|
-
const located = await api.get("/api/canvas/section", {
|
|
422
|
-
workspaceId,
|
|
423
|
-
...(isDisplayId
|
|
424
|
-
? { sectionDisplayId: sectionHandle.trim().toUpperCase() }
|
|
425
|
-
: { sectionNodeId: sectionHandle.trim() }),
|
|
426
|
-
});
|
|
427
|
-
const full = await readCanvasMarkdown(api, workspaceId, located.canvas.id);
|
|
428
|
-
const displayId = located.section.displayId;
|
|
429
|
-
// Prefer the frame as the canvas read saw it: same bounds, but it also
|
|
430
|
-
// carries colorHex in the shape the renderer expects.
|
|
431
|
-
const section = full.sections.find((s) => s.displayId === displayId) ?? {
|
|
432
|
-
displayId,
|
|
433
|
-
name: located.section.name,
|
|
434
|
-
bounds: located.section.bounds,
|
|
435
|
-
...(located.section.colorHex
|
|
436
|
-
? { colorHex: located.section.colorHex }
|
|
437
|
-
: {}),
|
|
438
|
-
};
|
|
439
|
-
// A frame wholly inside this one belongs to this read. Rect-containment, not
|
|
440
|
-
// center-containment: every point of an enclosed frame is inside this one, so
|
|
441
|
-
// anything the inner frame claims is inside this frame too. A frame that
|
|
442
|
-
// merely OVERLAPS is left alone — its cards may well sit outside.
|
|
443
|
-
const nestedSections = full.sections.filter((s) => s.displayId !== displayId && rectInside(s.bounds, section.bounds));
|
|
444
|
-
const own = new Set([displayId, ...nestedSections.map((s) => s.displayId)]);
|
|
445
|
-
const inFrame = (id) => !!id && own.has(id);
|
|
446
|
-
return {
|
|
447
|
-
canvas: located.canvas,
|
|
448
|
-
section,
|
|
449
|
-
nestedSections,
|
|
450
|
-
elements: full.elements.filter((e) => inFrame(e.section)),
|
|
451
|
-
edges: full.edges.filter((e) => inFrame(e.fromSection) || inFrame(e.toSection)),
|
|
452
|
-
portals: full.portals.filter((p) => inFrame(p.section)),
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* One element as markdown, appended to `lines`. Shared by the whole-canvas and
|
|
457
|
-
* single-section renderers so a card reads identically either way — two copies
|
|
458
|
-
* would drift, and a card that reads differently depending on which command
|
|
459
|
-
* printed it is a card an agent can't quote.
|
|
460
|
-
*/
|
|
461
|
-
function renderElement(lines, r) {
|
|
462
|
-
if (r.kind === "note") {
|
|
463
|
-
lines.push(`### ${r.displayId}: ${r.title}`, `*${r.type}*`, "");
|
|
464
|
-
// Between the header and the body, never inside it: an agent quoting the
|
|
465
|
-
// body back into an edit must not carry the warning with it.
|
|
466
|
-
if (r.supersededBy) {
|
|
467
|
-
lines.push(`> Superseded by ${formatSupersededBy(r.supersededBy)}`, "");
|
|
468
|
-
}
|
|
469
|
-
if (r.markdown)
|
|
470
|
-
lines.push(r.markdown.trim(), "");
|
|
471
|
-
}
|
|
472
|
-
else if (r.kind === "text") {
|
|
473
|
-
lines.push(`**${r.text}**`, "");
|
|
474
|
-
}
|
|
475
|
-
else if (r.kind === "richtext") {
|
|
476
|
-
if (r.markdown)
|
|
477
|
-
lines.push(r.markdown.trim(), "");
|
|
478
|
-
}
|
|
479
|
-
else if (r.kind === "list") {
|
|
480
|
-
lines.push(`### List: ${r.title}`, "");
|
|
481
|
-
for (const it of r.items) {
|
|
482
|
-
if (it.displayId) {
|
|
483
|
-
lines.push(`- [${it.displayId}: ${it.title ?? ""}](relationship:references)`);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
lines.push("");
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
function renderPortal(lines, p) {
|
|
490
|
-
lines.push(`- Portal → **${p.title}** (\`${p.canvasId}\`)`);
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* The `->` / `<->` / `--` glyph for an edge. `arrowEnd` defaults to true and is
|
|
494
|
-
* only carried when explicitly false, so a both-ends-bare edge reads as a plain
|
|
495
|
-
* line rather than a false arrow.
|
|
496
|
-
*/
|
|
497
|
-
function arrowGlyph(e) {
|
|
498
|
-
if (e.arrowEnd === false)
|
|
499
|
-
return e.arrowStart ? "<-" : "--";
|
|
500
|
-
return e.arrowStart ? "<->" : "->";
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* Render one section frame as a markdown document.
|
|
504
|
-
*
|
|
505
|
-
* Leads with the frame's own identity and the canvas it belongs to, so an agent
|
|
506
|
-
* that was handed only "SECTION-6GC" still knows where it is looking. Nested
|
|
507
|
-
* frames get their own heading rather than being flattened in, so the structure
|
|
508
|
-
* the canvas shows survives. Edges name the frame on the far end when they leave
|
|
509
|
-
* it — a section's argument usually points somewhere, and hiding that would make
|
|
510
|
-
* the frame read as more self-contained than it is.
|
|
511
|
-
*/
|
|
512
|
-
export function renderCanvasSectionMarkdown(result) {
|
|
513
|
-
const { section, canvas, nestedSections } = result;
|
|
514
|
-
const canvasRef = canvas.displayId ? ` (${canvas.displayId})` : "";
|
|
515
|
-
const lines = [
|
|
516
|
-
`# ${section.displayId}: ${section.name}`,
|
|
517
|
-
`*Section of canvas: ${canvas.name}${canvasRef}*`,
|
|
518
|
-
"",
|
|
519
|
-
];
|
|
520
|
-
const ownElements = result.elements.filter((e) => e.section === section.displayId);
|
|
521
|
-
const ownPortals = result.portals.filter((p) => p.section === section.displayId);
|
|
522
|
-
if (ownElements.length === 0 &&
|
|
523
|
-
ownPortals.length === 0 &&
|
|
524
|
-
nestedSections.length === 0) {
|
|
525
|
-
lines.push("*(empty frame)*", "");
|
|
526
|
-
}
|
|
527
|
-
for (const r of ownElements)
|
|
528
|
-
renderElement(lines, r);
|
|
529
|
-
for (const p of ownPortals)
|
|
530
|
-
renderPortal(lines, p);
|
|
531
|
-
if (ownPortals.length)
|
|
532
|
-
lines.push("");
|
|
533
|
-
for (const nested of nestedSections) {
|
|
534
|
-
const inNested = result.elements.filter((e) => e.section === nested.displayId);
|
|
535
|
-
const portalsHere = result.portals.filter((p) => p.section === nested.displayId);
|
|
536
|
-
lines.push("---", "", `## ${nested.displayId}: ${nested.name} (nested)`, "");
|
|
537
|
-
if (inNested.length === 0 && portalsHere.length === 0) {
|
|
538
|
-
lines.push("*(empty frame)*", "");
|
|
539
|
-
}
|
|
540
|
-
for (const el of inNested)
|
|
541
|
-
renderElement(lines, el);
|
|
542
|
-
for (const p of portalsHere)
|
|
543
|
-
renderPortal(lines, p);
|
|
544
|
-
if (portalsHere.length)
|
|
545
|
-
lines.push("");
|
|
546
|
-
}
|
|
547
|
-
if (result.edges.length) {
|
|
548
|
-
// Anything in this frame or a frame nested inside it counts as "in here";
|
|
549
|
-
// only a genuinely outside endpoint gets called out.
|
|
550
|
-
const inFrame = new Set([
|
|
551
|
-
section.displayId,
|
|
552
|
-
...nestedSections.map((s) => s.displayId),
|
|
553
|
-
]);
|
|
554
|
-
lines.push(`## Edges (${result.edges.length})`, "");
|
|
555
|
-
for (const e of result.edges) {
|
|
556
|
-
const label = e.label ? ` — *${e.label}*` : "";
|
|
557
|
-
// Mark the endpoint that lives outside this frame, so a reader can tell
|
|
558
|
-
// an internal link from one that leaves the section.
|
|
559
|
-
const outward = !inFrame.has(e.fromSection ?? "")
|
|
560
|
-
? ` (from ${e.fromSection ?? "outside"})`
|
|
561
|
-
: !inFrame.has(e.toSection ?? "")
|
|
562
|
-
? ` (to ${e.toSection ?? "outside"})`
|
|
563
|
-
: "";
|
|
564
|
-
lines.push(`- ${e.from} ${arrowGlyph(e)} ${e.to}${label}${outward}`);
|
|
565
|
-
}
|
|
566
|
-
lines.push("");
|
|
567
|
-
}
|
|
568
|
-
return lines.join("\n");
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Render a CanvasReadResult as a single concatenated markdown document.
|
|
572
|
-
* Used by the CLI's text output mode; the MCP tool returns the structured
|
|
573
|
-
* form directly so the model can do its own rendering if needed.
|
|
574
|
-
*
|
|
575
|
-
* Elements are grouped under their section frame, so the document mirrors the
|
|
576
|
-
* canvas's own argument rather than flattening it into an undifferentiated
|
|
577
|
-
* stream. Edges and portals are rendered as their own sections at the end.
|
|
578
|
-
*/
|
|
579
|
-
export function renderCanvasMarkdown(result) {
|
|
580
|
-
const canvas = result.canvas;
|
|
581
|
-
const canvasName = canvas?.title || canvas?.name || "(unnamed)";
|
|
582
|
-
const lines = [`# Canvas: ${canvasName}`, ""];
|
|
583
|
-
// Unframed elements first — they're the canvas's preamble (title sticky,
|
|
584
|
-
// "how to read this" richtext) and read as a lede.
|
|
585
|
-
const unframed = result.elements.filter((e) => !e.section);
|
|
586
|
-
for (const el of unframed)
|
|
587
|
-
renderElement(lines, el);
|
|
588
|
-
for (const section of result.sections) {
|
|
589
|
-
const inSection = result.elements.filter((e) => e.section === section.displayId);
|
|
590
|
-
const portalsHere = result.portals.filter((p) => p.section === section.displayId);
|
|
591
|
-
// Note bodies bring their own heading trees (a body routinely contains
|
|
592
|
-
// "## Tasks"), so a bare "## " section header does not scan as a boundary.
|
|
593
|
-
// The rule + the SECTION-n prefix make frames unambiguous to both a human
|
|
594
|
-
// skimming and an agent grepping ^## SECTION-.
|
|
595
|
-
lines.push("---", "", `## ${section.displayId}: ${section.name}`, "");
|
|
596
|
-
if (inSection.length === 0 && portalsHere.length === 0) {
|
|
597
|
-
lines.push("*(empty frame)*", "");
|
|
598
|
-
}
|
|
599
|
-
for (const el of inSection)
|
|
600
|
-
renderElement(lines, el);
|
|
601
|
-
for (const p of portalsHere)
|
|
602
|
-
renderPortal(lines, p);
|
|
603
|
-
if (portalsHere.length)
|
|
604
|
-
lines.push("");
|
|
605
|
-
}
|
|
606
|
-
if (result.edges.length) {
|
|
607
|
-
lines.push(`## Edges (${result.edges.length})`, "");
|
|
608
|
-
for (const e of result.edges) {
|
|
609
|
-
const label = e.label ? ` — *${e.label}*` : "";
|
|
610
|
-
lines.push(`- ${e.from} ${arrowGlyph(e)} ${e.to}${label}`);
|
|
611
|
-
}
|
|
612
|
-
lines.push("");
|
|
613
|
-
}
|
|
614
|
-
const loosePortals = result.portals.filter((p) => !p.section);
|
|
615
|
-
if (loosePortals.length) {
|
|
616
|
-
lines.push(`## Portals (${loosePortals.length})`, "");
|
|
617
|
-
for (const p of loosePortals) {
|
|
618
|
-
lines.push(`- **${p.title}** (\`${p.canvasId}\`)`);
|
|
619
|
-
}
|
|
620
|
-
lines.push("");
|
|
621
|
-
}
|
|
622
|
-
return lines.join("\n");
|
|
623
|
-
}
|
|
624
|
-
//# sourceMappingURL=canvas-read.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-read.js","sourceRoot":"","sources":["../../src/lib/canvas-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAiF5B,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,yBAAyB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAW,CAAC;AAEvE,qEAAqE;AACrE,SAAS,UAAU,CAAC,CAAS,EAAE,GAAG,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,OAAO,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC;AAED,SAAS,GAAG,CAAC,CAAU;IACrB,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAA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