agentic-canvas 0.12.1 → 0.14.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/README.md +44 -7
- package/dist/account.d.ts +33 -0
- package/dist/account.js +213 -0
- package/dist/{chunk-5II2WZIL.js → chunk-5QUL3URJ.js} +9 -151
- package/dist/chunk-A2F73EQJ.js +188 -0
- package/dist/{chunk-EDQNA2SU.js → chunk-BKG3FXX3.js} +1 -1
- package/dist/{chunk-Z6KLGAFP.js → chunk-GLNF43N4.js} +4 -2
- package/dist/{chunk-7EWHZCKY.js → chunk-YKUHPOQV.js} +20 -2
- package/dist/{chunk-MVWUIBGV.js → chunk-ZP6BLCB7.js} +57 -0
- package/dist/cli.js +22 -4
- package/dist/{client-Dyd30StF.d.ts → client-BKTZ1pM5.d.ts} +34 -2
- package/dist/client.d.ts +34 -2
- package/dist/client.js +3 -0
- package/dist/embed.d.ts +3 -2
- package/dist/embed.js +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +4 -4
- package/dist/live-worker.d.ts +4 -3
- package/dist/live-worker.js +5 -4
- package/dist/live.d.ts +3 -2
- package/dist/live.js +2 -2
- package/dist/principal-blhsFbdS.d.ts +23 -0
- package/dist/{read-UIJlrkwx.d.ts → read-DeS2Zaz8.d.ts} +24 -22
- package/dist/{service-ojpxVNVl.d.ts → service-BNEH2Z12.d.ts} +2 -1
- package/dist/worker.d.ts +20 -5
- package/dist/worker.js +5 -4
- package/llms.txt +2 -2
- package/package.json +5 -1
package/dist/live.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
drawFlow,
|
|
3
3
|
toSvg
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BKG3FXX3.js";
|
|
5
5
|
import {
|
|
6
6
|
Board,
|
|
7
7
|
CanvasError,
|
|
8
8
|
readBoard
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZP6BLCB7.js";
|
|
10
10
|
|
|
11
11
|
// src/live.ts
|
|
12
12
|
import { parsePrincipal } from "agentic-identity";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PrincipalKind } from 'agentic-identity';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The actor of a new write. The rule is the identity kernel's `parsePrincipal`: a known kind, and an id of 1 to 128
|
|
6
|
+
* characters from A-Z, a-z, 0-9, ".", "_" and "-". The Worker, the CLI and the SDK all use it.
|
|
7
|
+
*/
|
|
8
|
+
declare const principalSchema: z.ZodPipe<z.ZodObject<{
|
|
9
|
+
kind: z.ZodString;
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
12
|
+
kind: PrincipalKind;
|
|
13
|
+
id: string;
|
|
14
|
+
}, {
|
|
15
|
+
kind: string;
|
|
16
|
+
id: string;
|
|
17
|
+
}>>;
|
|
18
|
+
type Principal = {
|
|
19
|
+
kind: PrincipalKind;
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { type Principal as P, principalSchema as p };
|
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
|
-
import {
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The actor of a new write. The rule is the identity kernel's `parsePrincipal`: a known kind, and an id of 1 to 128
|
|
7
|
-
* characters from A-Z, a-z, 0-9, ".", "_" and "-". The Worker, the CLI and the SDK all use it.
|
|
8
|
-
*/
|
|
9
|
-
declare const principalSchema: z.ZodPipe<z.ZodObject<{
|
|
10
|
-
kind: z.ZodString;
|
|
11
|
-
id: z.ZodString;
|
|
12
|
-
}, z.core.$strict>, z.ZodTransform<{
|
|
13
|
-
kind: PrincipalKind;
|
|
14
|
-
id: string;
|
|
15
|
-
}, {
|
|
16
|
-
kind: string;
|
|
17
|
-
id: string;
|
|
18
|
-
}>>;
|
|
19
|
-
type Principal = {
|
|
20
|
-
kind: PrincipalKind;
|
|
21
|
-
id: string;
|
|
22
|
-
};
|
|
2
|
+
import { P as Principal } from './principal-blhsFbdS.js';
|
|
23
3
|
|
|
24
4
|
type ErrorCode = "INVALID" | "DUPLICATE_ID" | "NOT_FOUND" | "BAD_REFERENCE" | "LIMIT" | "UNAVAILABLE" | "FORBIDDEN";
|
|
25
5
|
declare class CanvasError extends Error {
|
|
@@ -132,6 +112,28 @@ declare class Board {
|
|
|
132
112
|
update(elementId: string, patch: unknown, actor: Principal): CanvasElement;
|
|
133
113
|
/** Shift an element, or a whole group. Returns the ids that moved. Bound connector ends follow their shapes. */
|
|
134
114
|
move(elementId: string, dx: number, dy: number, actor: Principal): string[];
|
|
115
|
+
/** Every stored entry as it is, valid or not, with its key as `id`. */
|
|
116
|
+
rawElements(): Record<string, unknown>[];
|
|
117
|
+
/**
|
|
118
|
+
* The raw stored elements that `who` made (`author`) and the ids of those that `who` last edited but did not make.
|
|
119
|
+
* It reads entries as they are, with no element checks, so a damaged entry still shows. Account export uses it.
|
|
120
|
+
*/
|
|
121
|
+
stampedBy(who: Principal): {
|
|
122
|
+
authored: Record<string, unknown>[];
|
|
123
|
+
edited: string[];
|
|
124
|
+
titleBy: boolean;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Erase `who` from the board. An element they made is deleted alone: its members go to its parent group, and a
|
|
128
|
+
* connector of someone else that was bound to it goes too, because it would be hidden. An element they only edited
|
|
129
|
+
* keeps its content, and its editor becomes `(erased)`. A title they set is cleared. Idempotent. Returns the counts.
|
|
130
|
+
*/
|
|
131
|
+
eraseStamps(who: Principal, erased: Principal): {
|
|
132
|
+
authored: number;
|
|
133
|
+
edited: number;
|
|
134
|
+
dangling: number;
|
|
135
|
+
title: boolean;
|
|
136
|
+
};
|
|
135
137
|
/** Delete an element. A shape takes its connectors and a group takes its members. Returns the ids removed. */
|
|
136
138
|
remove(elementId: string): string[];
|
|
137
139
|
group(ids: string[], actor: Principal, groupId?: string): Group;
|
|
@@ -181,4 +183,4 @@ interface BoardData {
|
|
|
181
183
|
/** The board as plain data for an agent. Reads only. Embedded image bytes are left out. */
|
|
182
184
|
declare function readBoard(board: Board): BoardData;
|
|
183
185
|
|
|
184
|
-
export { Board as B, type Connector as C, type Endpoint as E, type Group as G, MAX_ELEMENTS as M, type NodeData as N, type
|
|
186
|
+
export { Board as B, type Connector as C, type Endpoint as E, type Group as G, MAX_ELEMENTS as M, type NodeData as N, type Shape as S, type BoardData as a, type CanvasElement as b, type ShapeType as c, CanvasError as d, type EdgeData as e, type ErrorCode as f, MAX_TEXT as g, SHAPE_TYPES as h, readBoard as r };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { c as ShapeType, B as Board,
|
|
1
|
+
import { c as ShapeType, B as Board, a as BoardData, S as Shape, C as Connector, b as CanvasElement } from './read-DeS2Zaz8.js';
|
|
2
2
|
import { Store } from 'agentic-identity';
|
|
3
|
+
import { P as Principal } from './principal-blhsFbdS.js';
|
|
3
4
|
|
|
4
5
|
declare const MAX_FLOW_NODES = 500;
|
|
5
6
|
declare const MAX_FLOW_EDGES = 2000;
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import { Store, PrincipalContext, Action, Grant, InviteSummary, Blobs } from 'agentic-identity';
|
|
1
|
+
import { Store, PrincipalContext, Action, Grant, InviteSummary, Role as Role$1, Blobs } from 'agentic-identity';
|
|
2
2
|
import { Realtime } from 'agentic-realtime';
|
|
3
3
|
import { D1Like, R2Like } from 'agentic-identity/cloudflare';
|
|
4
4
|
import { Hono } from 'hono';
|
|
5
|
-
import { P as Principal } from './
|
|
6
|
-
import { C as CanvasService } from './service-
|
|
7
|
-
import 'yjs';
|
|
5
|
+
import { P as Principal } from './principal-blhsFbdS.js';
|
|
6
|
+
import { C as CanvasService } from './service-BNEH2Z12.js';
|
|
8
7
|
import 'zod';
|
|
8
|
+
import './read-DeS2Zaz8.js';
|
|
9
|
+
import 'yjs';
|
|
9
10
|
|
|
11
|
+
/** A share link without its token. `revokedAt` is set once the link is revoked. */
|
|
12
|
+
interface LinkSummary {
|
|
13
|
+
id: string;
|
|
14
|
+
role: Exclude<Role$1, "owner">;
|
|
15
|
+
signedInOnly: boolean;
|
|
16
|
+
expiresAt?: number;
|
|
17
|
+
revokedAt?: number;
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
20
|
* Who may do what on a board. A board is an identity resource of type `canvas`. The roles, the grants, the invites,
|
|
12
21
|
* and the links are those of agentic-identity: this class checks input and maps its failures to `CanvasError`.
|
|
@@ -50,7 +59,7 @@ declare class CanvasAccess {
|
|
|
50
59
|
}): Promise<{
|
|
51
60
|
ok: true;
|
|
52
61
|
}>;
|
|
53
|
-
/** The grants and the invites on a board. An invite never shows its email.
|
|
62
|
+
/** The grants and the invites on a board. An invite never shows its email. `listLinks` lists the links, and never a token. */
|
|
54
63
|
list(ctx: PrincipalContext, id: string): Promise<{
|
|
55
64
|
grants: Grant[];
|
|
56
65
|
invites: InviteSummary[];
|
|
@@ -76,6 +85,12 @@ declare class CanvasAccess {
|
|
|
76
85
|
id: string;
|
|
77
86
|
token: string;
|
|
78
87
|
}>;
|
|
88
|
+
/** The links of a board. A summary never holds the token or its hash. Needs an owner. */
|
|
89
|
+
listLinks(ctx: PrincipalContext, id: string): Promise<{
|
|
90
|
+
links: LinkSummary[];
|
|
91
|
+
truncated?: true;
|
|
92
|
+
skipped?: number;
|
|
93
|
+
}>;
|
|
79
94
|
/** Revoke a link of this board. A link of another board is NOT_FOUND here, even for an owner of both. */
|
|
80
95
|
revokeLink(ctx: PrincipalContext, id: string, linkId: string): Promise<{
|
|
81
96
|
ok: true;
|
package/dist/worker.js
CHANGED
|
@@ -5,11 +5,12 @@ import {
|
|
|
5
5
|
identify,
|
|
6
6
|
sniffImage,
|
|
7
7
|
worker_default
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-5QUL3URJ.js";
|
|
9
|
+
import "./chunk-A2F73EQJ.js";
|
|
10
|
+
import "./chunk-GLNF43N4.js";
|
|
10
11
|
import "./chunk-NWQED42L.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-BKG3FXX3.js";
|
|
13
|
+
import "./chunk-ZP6BLCB7.js";
|
|
13
14
|
export {
|
|
14
15
|
WS_PROTOCOL,
|
|
15
16
|
authenticate,
|
package/llms.txt
CHANGED
|
@@ -6,11 +6,11 @@ Keywords: whiteboard,canvas,diagrams,drawing,collaboration,agents,mcp,cli.
|
|
|
6
6
|
|
|
7
7
|
- SDK: import { Board, drawFlow, readBoard, toSvg } from "agentic-canvas".
|
|
8
8
|
- Exports: the README "Exports" section lists every name of each entry point: agentic-canvas, /client, /file-store, /live, /worker and /live-worker.
|
|
9
|
-
- CLI: agentic-canvas new|list|read|add|connect|update|move|rm|delete|flow|export, and with CANVAS_SERVER: access|grant|revoke|invite. MCP tools for sharing: list_access, grant_access, revoke_access, create_invite.
|
|
9
|
+
- CLI: agentic-canvas new|list|read|add|connect|update|move|rm|delete|flow|export, and with CANVAS_SERVER: access|grant|revoke|invite|links|link|revoke-link. MCP tools for sharing: list_access, grant_access, revoke_access, create_invite, list_links, create_link, revoke_link.
|
|
10
10
|
- UI: the Worker serves a web UI at its root (run `npm run build`, then `wrangler dev`). A person signs in with a bearer token: an agentic-identity credential (scope canvas:write or canvas:read). A static CANVAS_API_TOKENS list works only with CANVAS_UNSAFE_STATIC_TOKENS=1 (dev).
|
|
11
11
|
- Live: set CANVAS_SERVER and CANVAS_TOKEN, and the CLI and `agentic-canvas mcp` edit the board in its live room.
|
|
12
12
|
- SDK: import { LiveBoard, LiveService } from "agentic-canvas/live".
|
|
13
|
-
- SDK: import { createClient, CanvasApiError } from "agentic-canvas/client". It calls the Worker API with fetch. Methods: me, listBoards, createBoard, readBoard, deleteBoard, exportSvg, addShape, addConnector, drawFlow, update, move, remove, access, grant, revoke, invite, uploadImage, getImage, state, checkpoint. A failure throws CanvasApiError with `code` and `status`. No retries.
|
|
13
|
+
- SDK: import { createClient, CanvasApiError } from "agentic-canvas/client". It calls the Worker API with fetch. Methods: me, listBoards, createBoard, readBoard, deleteBoard, exportSvg, addShape, addConnector, drawFlow, update, move, remove, access, grant, revoke, invite, links, createLink, revokeLink, uploadImage, getImage, state, checkpoint. A failure throws CanvasApiError with `code` and `status`. No retries.
|
|
14
14
|
- UI: import { mount } from "agentic-canvas/ui"; import "agentic-canvas/ui.css" (with agentic-design/styles.css). mount(element, { boardId, client, principal: { kind, name, role, id? }, readOnly?, room?: { baseUrl, token } }) (or host: { doc, presence?, status?, onStatus? } instead of client and room; in host mode id (default name) must be letters, digits, . _ -, to edit the app's own Yjs document with no HTTP call) renders the board and returns { update(options), unmount() }. BoardEditor is the same as a React component. React 19 is a peer dependency.
|
|
15
15
|
|
|
16
16
|
## Docs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-canvas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "A shared whiteboard for diagrams, drawn by people and agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whiteboard",
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
"types": "./dist/worker.d.ts",
|
|
45
45
|
"import": "./dist/worker.js"
|
|
46
46
|
},
|
|
47
|
+
"./account": {
|
|
48
|
+
"types": "./dist/account.d.ts",
|
|
49
|
+
"import": "./dist/account.js"
|
|
50
|
+
},
|
|
47
51
|
"./live": {
|
|
48
52
|
"types": "./dist/live.d.ts",
|
|
49
53
|
"import": "./dist/live.js"
|