agentic-canvas 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -279,12 +279,20 @@ Every name that each entry point exports is listed here. A name marked (type) ex
279
279
  | `FlowGraph` (type), `FlowNode` (type), `FlowEdge` (type), `Placement` (type), `DrawOptions` (type) | Types for a flow and its layout. |
280
280
  | `readBoard`, `BoardData` (type), `NodeData` (type), `EdgeData` (type) | Read a board as plain data. |
281
281
  | `toSvg(board)`, `svgToPng(svg)` | `toSvg` returns the board as SVG. `svgToPng` turns an SVG string into PNG through Chromium. |
282
- | `PRINCIPAL_KINDS`, `PrincipalKind` (type), `Principal` (type), `principalSchema`, `isMachineMade` | The principal kinds, the schema of a principal, and the rule that marks machine-made kinds. |
282
+ | `PRINCIPAL_KINDS`, `PrincipalKind` (type), `Principal` (type), `principalSchema`, `isMachineMade` | The principal kinds, the schema of a principal, and the rule that marks machine-made kinds. `principalSchema` uses the identity rule below. |
283
283
  | `operatorActor(env?)`, `ActorConfigError` | Read the actor from `CANVAS_ACTOR` as `<kind>:<id>`. It throws `ActorConfigError` when the value is missing or bad. |
284
284
  | `CanvasService` | The board operations that the CLI, the MCP server and the Worker share. It takes a `Store`. |
285
285
  | `createMcpServer(service, actor)`, `runMcp(service, actor)` | Make the MCP server, or run it on stdio. |
286
286
  | `createFileStore`, `openLocalStore`, `FileStoreOptions` (type) | Stores on one local file. See `agentic-canvas/file-store`. |
287
287
 
288
+ ### Actor ids
289
+
290
+ One rule names an actor in every new write, in the SDK, the CLI, the MCP server and the Worker. The kind must be
291
+ one of `PRINCIPAL_KINDS`. The id has 1 to 128 characters from `A-Z`, `a-z`, `0-9`, `.`, `_` and `-`, and starts
292
+ with a letter, digit, `_` or `-`. The rule comes from `parsePrincipal` in `agentic-identity`. A write with another
293
+ id fails with `INVALID`. A board that was stored with an older, looser id (up to 200 characters) still opens. The
294
+ old author stays on its elements. Only new writes follow the strict rule.
295
+
288
296
  ### `agentic-canvas/client`
289
297
 
290
298
  | Name | What it is |
@@ -7,10 +7,10 @@ import {
7
7
  drawFlow,
8
8
  readBoard,
9
9
  toSvg
10
- } from "./chunk-JCYNPYYJ.js";
10
+ } from "./chunk-ZSPZMGHG.js";
11
11
  import {
12
12
  principalSchema
13
- } from "./chunk-SPP6PINW.js";
13
+ } from "./chunk-JOBTIAFJ.js";
14
14
 
15
15
  // src/service.ts
16
16
  import * as Y from "yjs";
@@ -0,0 +1,19 @@
1
+ // src/core/principal.ts
2
+ import { PRINCIPAL_KINDS, isMachineMade, parsePrincipal } from "agentic-identity";
3
+ import { z } from "zod";
4
+ var principalSchema = z.object({ kind: z.string(), id: z.string() }).strict().transform((value, ctx) => {
5
+ try {
6
+ return parsePrincipal(value);
7
+ } catch (error) {
8
+ ctx.addIssue({ code: "custom", message: error instanceof Error ? error.message : "invalid principal" });
9
+ return z.NEVER;
10
+ }
11
+ });
12
+ var storedPrincipalSchema = z.object({ kind: z.enum(PRINCIPAL_KINDS), id: z.string().min(1).max(200) }).strict();
13
+
14
+ export {
15
+ PRINCIPAL_KINDS,
16
+ isMachineMade,
17
+ principalSchema,
18
+ storedPrincipalSchema
19
+ };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  CanvasService,
3
3
  MAX_LIVE_BYTES
4
- } from "./chunk-G4YTESPS.js";
4
+ } from "./chunk-66FFQMHI.js";
5
5
  import {
6
6
  CanvasError
7
- } from "./chunk-JCYNPYYJ.js";
7
+ } from "./chunk-ZSPZMGHG.js";
8
8
 
9
9
  // src/worker.ts
10
10
  import { hasScope, parsePrincipal, parseRegion } from "agentic-identity";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  CanvasError,
3
3
  SHAPE_TYPES
4
- } from "./chunk-JCYNPYYJ.js";
4
+ } from "./chunk-ZSPZMGHG.js";
5
5
  import {
6
6
  PRINCIPAL_KINDS
7
- } from "./chunk-SPP6PINW.js";
7
+ } from "./chunk-JOBTIAFJ.js";
8
8
 
9
9
  // src/version.ts
10
10
  import { createRequire } from "module";
11
- var VERSION = true ? "0.6.0" : readPackageVersion();
11
+ var VERSION = true ? "0.6.1" : readPackageVersion();
12
12
 
13
13
  // src/brand.ts
14
14
  var BRAND = {
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  isMachineMade,
3
- principalSchema
4
- } from "./chunk-SPP6PINW.js";
3
+ principalSchema,
4
+ storedPrincipalSchema
5
+ } from "./chunk-JOBTIAFJ.js";
5
6
 
6
7
  // src/core/board.ts
7
8
  import { randomUUID } from "crypto";
@@ -58,8 +59,8 @@ var stampFields = {
58
59
  id,
59
60
  z: z.number().finite().min(-MAX_Z).max(MAX_Z),
60
61
  groupId: id.optional(),
61
- author: principalSchema,
62
- editedBy: principalSchema
62
+ author: storedPrincipalSchema,
63
+ editedBy: storedPrincipalSchema
63
64
  };
64
65
  var storedShape = z.object({ ...stampFields, type: z.enum(SHAPE_TYPES), x: coord, y: coord, w: size, h: size, text, fill: color.optional(), stroke: color.optional(), src: imageSrc.optional() }).refine((s) => s.type === "image" === (s.src !== void 0), { message: "src is required for image shapes and allowed on no other type" });
65
66
  var storedConnector = z.object({
@@ -129,7 +130,7 @@ var Board = class _Board {
129
130
  return value.success ? value.data : "";
130
131
  }
131
132
  get titleBy() {
132
- const value = principalSchema.safeParse(this.meta.get("titleBy"));
133
+ const value = storedPrincipalSchema.safeParse(this.meta.get("titleBy"));
133
134
  return value.success ? value.data : void 0;
134
135
  }
135
136
  setTitle(title, actor) {
package/dist/cli.js CHANGED
@@ -5,18 +5,18 @@ import {
5
5
  operatorActor,
6
6
  runMcp,
7
7
  svgToPng
8
- } from "./chunk-SIDWRC3P.js";
8
+ } from "./chunk-VFJJGXTK.js";
9
9
  import {
10
10
  openLocalStore
11
11
  } from "./chunk-UKST5A57.js";
12
12
  import {
13
13
  CanvasService
14
- } from "./chunk-G4YTESPS.js";
14
+ } from "./chunk-66FFQMHI.js";
15
15
  import "./chunk-NWQED42L.js";
16
16
  import {
17
17
  CanvasError
18
- } from "./chunk-JCYNPYYJ.js";
19
- import "./chunk-SPP6PINW.js";
18
+ } from "./chunk-ZSPZMGHG.js";
19
+ import "./chunk-JOBTIAFJ.js";
20
20
 
21
21
  // src/cli.ts
22
22
  import { readFileSync, writeFileSync } from "fs";
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as ErrorCode, a as BoardData, c as ShapeType, S as Shape, d as Endpoint, C as Connector } from './read-BupIJSPJ.js';
1
+ import { E as ErrorCode, a as BoardData, c as ShapeType, S as Shape, d as Endpoint, C as Connector } from './read-CeWoSAAy.js';
2
2
  import { PrincipalKind } from 'agentic-identity';
3
3
  import 'yjs';
4
4
  import 'zod';
package/dist/embed.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { CanvasClient } from './client.js';
3
3
  import { PrincipalKind } from 'agentic-identity';
4
- import './read-BupIJSPJ.js';
4
+ import './read-CeWoSAAy.js';
5
5
  import 'yjs';
6
6
  import 'zod';
7
7
 
package/dist/embed.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRINCIPAL_KINDS
3
- } from "./chunk-SPP6PINW.js";
3
+ } from "./chunk-JOBTIAFJ.js";
4
4
 
5
5
  // ui/embed.tsx
6
6
  import { ToastProvider, TooltipProvider } from "agentic-design/react";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { B as Board, P as Principal } from './read-BupIJSPJ.js';
2
- export { a as BoardData, b as CanvasElement, e as CanvasError, C as Connector, f as EdgeData, d as Endpoint, E as ErrorCode, G as Group, M as MAX_ELEMENTS, g as MAX_TEXT, N as NodeData, h as SHAPE_TYPES, S as Shape, c as ShapeType, p as principalSchema, r as readBoard } from './read-BupIJSPJ.js';
3
- import { B as BoardAccess } from './service-CR4-r1yx.js';
4
- export { C as CanvasService, D as DrawOptions, F as FlowEdge, a as FlowGraph, b as FlowNode, M as MAX_FLOW_EDGES, c as MAX_FLOW_NODES, P as Placement, d as drawFlow, l as layoutFlow, p as parseFlow } from './service-CR4-r1yx.js';
1
+ import { B as Board, P as Principal } from './read-CeWoSAAy.js';
2
+ export { a as BoardData, b as CanvasElement, e as CanvasError, C as Connector, f as EdgeData, d as Endpoint, E as ErrorCode, G as Group, M as MAX_ELEMENTS, g as MAX_TEXT, N as NodeData, h as SHAPE_TYPES, S as Shape, c as ShapeType, p as principalSchema, r as readBoard } from './read-CeWoSAAy.js';
3
+ import { B as BoardAccess } from './service-Ckz-3qhK.js';
4
+ export { C as CanvasService, D as DrawOptions, F as FlowEdge, a as FlowGraph, b as FlowNode, M as MAX_FLOW_EDGES, c as MAX_FLOW_NODES, P as Placement, d as drawFlow, l as layoutFlow, p as parseFlow } from './service-Ckz-3qhK.js';
5
5
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
6
  export { FileStoreOptions, createFileStore, openLocalStore } from './store-file.js';
7
7
  export { PRINCIPAL_KINDS, PrincipalKind, isMachineMade } from 'agentic-identity';
package/dist/index.js CHANGED
@@ -6,14 +6,14 @@ import {
6
6
  operatorActor,
7
7
  runMcp,
8
8
  svgToPng
9
- } from "./chunk-SIDWRC3P.js";
9
+ } from "./chunk-VFJJGXTK.js";
10
10
  import {
11
11
  createFileStore,
12
12
  openLocalStore
13
13
  } from "./chunk-UKST5A57.js";
14
14
  import {
15
15
  CanvasService
16
- } from "./chunk-G4YTESPS.js";
16
+ } from "./chunk-66FFQMHI.js";
17
17
  import "./chunk-NWQED42L.js";
18
18
  import {
19
19
  Board,
@@ -28,12 +28,12 @@ import {
28
28
  parseFlow,
29
29
  readBoard,
30
30
  toSvg
31
- } from "./chunk-JCYNPYYJ.js";
31
+ } from "./chunk-ZSPZMGHG.js";
32
32
  import {
33
33
  PRINCIPAL_KINDS,
34
34
  isMachineMade,
35
35
  principalSchema
36
- } from "./chunk-SPP6PINW.js";
36
+ } from "./chunk-JOBTIAFJ.js";
37
37
  export {
38
38
  ActorConfigError,
39
39
  BRAND,
@@ -5,10 +5,10 @@ import 'agentic-identity';
5
5
  import 'agentic-realtime';
6
6
  import 'agentic-identity/cloudflare';
7
7
  import 'hono';
8
- import './read-BupIJSPJ.js';
8
+ import './read-CeWoSAAy.js';
9
9
  import 'yjs';
10
10
  import 'zod';
11
- import './service-CR4-r1yx.js';
11
+ import './service-Ckz-3qhK.js';
12
12
 
13
13
  type Namespace = Parameters<typeof createDurableObjectRealtime>[0];
14
14
  interface LiveEnv extends WorkerEnv {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createApp
3
- } from "./chunk-BIIC2DPZ.js";
4
- import "./chunk-G4YTESPS.js";
3
+ } from "./chunk-PH67TSYW.js";
4
+ import "./chunk-66FFQMHI.js";
5
5
  import "./chunk-NWQED42L.js";
6
6
  import {
7
7
  CanvasError
8
- } from "./chunk-JCYNPYYJ.js";
9
- import "./chunk-SPP6PINW.js";
8
+ } from "./chunk-ZSPZMGHG.js";
9
+ import "./chunk-JOBTIAFJ.js";
10
10
 
11
11
  // src/live-worker.ts
12
12
  import { parseRegion } from "agentic-identity";
package/dist/live.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { B as Board, P as Principal, a as BoardData, S as Shape, C as Connector, b as CanvasElement } from './read-BupIJSPJ.js';
1
+ import { B as Board, P as Principal, a as BoardData, S as Shape, C as Connector, b as CanvasElement } from './read-CeWoSAAy.js';
2
2
  import { Peer } from 'agentic-realtime/client';
3
- import { B as BoardAccess, D as DrawOptions } from './service-CR4-r1yx.js';
3
+ import { B as BoardAccess, D as DrawOptions } from './service-Ckz-3qhK.js';
4
4
  import 'yjs';
5
- import 'zod';
6
5
  import 'agentic-identity';
6
+ import 'zod';
7
7
 
8
8
  interface LiveOptions {
9
9
  /** The Worker address, such as `https://canvas.example.com`. */
package/dist/live.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  drawFlow,
5
5
  readBoard,
6
6
  toSvg
7
- } from "./chunk-JCYNPYYJ.js";
8
- import "./chunk-SPP6PINW.js";
7
+ } from "./chunk-ZSPZMGHG.js";
8
+ import "./chunk-JOBTIAFJ.js";
9
9
 
10
10
  // src/live.ts
11
11
  import { parsePrincipal } from "agentic-identity";
@@ -1,17 +1,31 @@
1
1
  import * as Y from 'yjs';
2
+ import { PrincipalKind } from 'agentic-identity';
2
3
  import { z } from 'zod';
3
4
 
4
- declare const principalSchema: z.ZodObject<{
5
- kind: z.ZodEnum<["human", "agent_of_human", "agent_of_agent", "agent", "user_token"]>;
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.ZodEffects<z.ZodObject<{
10
+ kind: z.ZodString;
6
11
  id: z.ZodString;
7
12
  }, "strict", z.ZodTypeAny, {
8
- kind: "human" | "agent_of_human" | "agent_of_agent" | "agent" | "user_token";
13
+ kind: string;
9
14
  id: string;
10
15
  }, {
11
- kind: "human" | "agent_of_human" | "agent_of_agent" | "agent" | "user_token";
16
+ kind: string;
17
+ id: string;
18
+ }>, {
19
+ kind: PrincipalKind;
20
+ id: string;
21
+ }, {
22
+ kind: string;
12
23
  id: string;
13
24
  }>;
14
- type Principal = z.infer<typeof principalSchema>;
25
+ type Principal = {
26
+ kind: PrincipalKind;
27
+ id: string;
28
+ };
15
29
 
16
30
  type ErrorCode = "INVALID" | "DUPLICATE_ID" | "NOT_FOUND" | "BAD_REFERENCE" | "LIMIT" | "UNAVAILABLE" | "FORBIDDEN";
17
31
  declare class CanvasError extends Error {
@@ -1,4 +1,4 @@
1
- import { c as ShapeType, B as Board, P as Principal, a as BoardData, S as Shape, C as Connector, b as CanvasElement } from './read-BupIJSPJ.js';
1
+ import { c as ShapeType, B as Board, P as Principal, a as BoardData, S as Shape, C as Connector, b as CanvasElement } from './read-CeWoSAAy.js';
2
2
  import { Store } from 'agentic-identity';
3
3
 
4
4
  declare const MAX_FLOW_NODES = 500;
package/dist/worker.d.ts CHANGED
@@ -2,8 +2,8 @@ import { 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 './read-BupIJSPJ.js';
6
- import { C as CanvasService } from './service-CR4-r1yx.js';
5
+ import { P as Principal } from './read-CeWoSAAy.js';
6
+ import { C as CanvasService } from './service-Ckz-3qhK.js';
7
7
  import 'yjs';
8
8
  import 'zod';
9
9
 
package/dist/worker.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  createApp,
5
5
  sniffImage,
6
6
  worker_default
7
- } from "./chunk-BIIC2DPZ.js";
8
- import "./chunk-G4YTESPS.js";
7
+ } from "./chunk-PH67TSYW.js";
8
+ import "./chunk-66FFQMHI.js";
9
9
  import "./chunk-NWQED42L.js";
10
- import "./chunk-JCYNPYYJ.js";
11
- import "./chunk-SPP6PINW.js";
10
+ import "./chunk-ZSPZMGHG.js";
11
+ import "./chunk-JOBTIAFJ.js";
12
12
  export {
13
13
  WS_PROTOCOL,
14
14
  authenticate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-canvas",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "A shared whiteboard for diagrams, drawn by people and agents.",
5
5
  "keywords": [
6
6
  "whiteboard",
@@ -1,10 +0,0 @@
1
- // src/core/principal.ts
2
- import { PRINCIPAL_KINDS, isMachineMade } from "agentic-identity";
3
- import { z } from "zod";
4
- var principalSchema = z.object({ kind: z.enum(PRINCIPAL_KINDS), id: z.string().min(1).max(200) }).strict();
5
-
6
- export {
7
- PRINCIPAL_KINDS,
8
- isMachineMade,
9
- principalSchema
10
- };