@lambdacurry/arbor 0.22.29 → 0.22.30

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.
Files changed (2) hide show
  1. package/dist/arbor.js +79 -3
  2. package/package.json +1 -1
package/dist/arbor.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // package.json
3
3
  var package_default = {
4
4
  name: "@lambdacurry/arbor",
5
- version: "0.22.29",
5
+ version: "0.22.30",
6
6
  description: "The Arbor CLI — a shared workspace for people and agents. The human + headless-agent write path over Arbor's guarded operation surface.",
7
7
  keywords: [
8
8
  "agents",
@@ -9946,6 +9946,8 @@ ${orientation}
9946
9946
 
9947
9947
  // ../actions/src/tldraw-agent.ts
9948
9948
  var TLDRAW_EXEC_MAX_OPERATIONS = 100;
9949
+ var TLDRAW_DIAGRAM_MAX_NODES = 64;
9950
+ var TLDRAW_DIAGRAM_MAX_EDGES = 96;
9949
9951
  var shapeId = string2().regex(/^shape:[A-Za-z0-9_-]{1,128}$/).describe("stable tldraw shape id, shape:…");
9950
9952
  var shapeType = _enum(["geo", "text", "note", "frame", "arrow", "line", "draw", "group"]).describe("built-in tldraw shape type; use code mode for custom or asset-backed shapes");
9951
9953
  var finite = number2().finite();
@@ -9977,6 +9979,21 @@ var update = object({
9977
9979
  meta: jsonRecord.optional()
9978
9980
  }).strict();
9979
9981
  var shapeIds = array(shapeId).min(1).max(TLDRAW_EXEC_MAX_OPERATIONS);
9982
+ var diagramKey = string2().min(1).max(80).describe("caller-meaningful node key; returned as the alias for its generated tldraw shape id");
9983
+ var diagramLabel = string2().min(1).max(160);
9984
+ var diagram = object({
9985
+ op: literal("diagram"),
9986
+ direction: _enum(["LR", "RL", "TB", "BT"]).describe("graph reading direction: left/right or top/bottom"),
9987
+ nodes: array(object({
9988
+ key: diagramKey,
9989
+ label: diagramLabel
9990
+ }).strict()).min(1).max(TLDRAW_DIAGRAM_MAX_NODES),
9991
+ edges: array(object({
9992
+ from: diagramKey,
9993
+ to: diagramKey,
9994
+ label: diagramLabel.optional()
9995
+ }).strict()).max(TLDRAW_DIAGRAM_MAX_EDGES)
9996
+ }).strict();
9980
9997
  var TLDRAW_EXEC_OPERATION_SCHEMA = discriminatedUnion("op", [
9981
9998
  create,
9982
9999
  update,
@@ -9995,10 +10012,14 @@ var TLDRAW_EXEC_OPERATION_SCHEMA = discriminatedUnion("op", [
9995
10012
  op: literal("group"),
9996
10013
  ids: shapeIds.min(2),
9997
10014
  groupId: shapeId.optional()
9998
- }).strict()
10015
+ }).strict(),
10016
+ diagram
9999
10017
  ]);
10000
10018
  var TLDRAW_EXEC_OPERATIONS_SCHEMA = array(TLDRAW_EXEC_OPERATION_SCHEMA).min(1).max(TLDRAW_EXEC_MAX_OPERATIONS).superRefine((operations, ctx) => {
10001
10019
  const createdIds = new Set;
10020
+ const diagramKeys = new Set;
10021
+ let totalDiagramNodes = 0;
10022
+ let totalDiagramEdges = 0;
10002
10023
  operations.forEach((operation, index) => {
10003
10024
  if (operation.op === "create") {
10004
10025
  if (createdIds.has(operation.id)) {
@@ -10023,6 +10044,61 @@ var TLDRAW_EXEC_OPERATIONS_SCHEMA = array(TLDRAW_EXEC_OPERATION_SCHEMA).min(1).m
10023
10044
  seen.add(id);
10024
10045
  });
10025
10046
  }
10047
+ if (operation.op === "diagram") {
10048
+ const previousNodeTotal = totalDiagramNodes;
10049
+ const previousEdgeTotal = totalDiagramEdges;
10050
+ totalDiagramNodes += operation.nodes.length;
10051
+ totalDiagramEdges += operation.edges.length;
10052
+ if (previousNodeTotal <= TLDRAW_DIAGRAM_MAX_NODES && totalDiagramNodes > TLDRAW_DIAGRAM_MAX_NODES) {
10053
+ ctx.addIssue({
10054
+ code: "custom",
10055
+ message: `diagram nodes exceed execution limit: ${TLDRAW_DIAGRAM_MAX_NODES}`,
10056
+ path: [index, "nodes"]
10057
+ });
10058
+ }
10059
+ if (previousEdgeTotal <= TLDRAW_DIAGRAM_MAX_EDGES && totalDiagramEdges > TLDRAW_DIAGRAM_MAX_EDGES) {
10060
+ ctx.addIssue({
10061
+ code: "custom",
10062
+ message: `diagram edges exceed execution limit: ${TLDRAW_DIAGRAM_MAX_EDGES}`,
10063
+ path: [index, "edges"]
10064
+ });
10065
+ }
10066
+ const keys = new Set;
10067
+ operation.nodes.forEach((node, nodeIndex) => {
10068
+ if (keys.has(node.key)) {
10069
+ ctx.addIssue({
10070
+ code: "custom",
10071
+ message: `duplicate diagram node key: ${node.key}`,
10072
+ path: [index, "nodes", nodeIndex, "key"]
10073
+ });
10074
+ }
10075
+ if (diagramKeys.has(node.key)) {
10076
+ ctx.addIssue({
10077
+ code: "custom",
10078
+ message: `diagram node key is already used in this execution: ${node.key}`,
10079
+ path: [index, "nodes", nodeIndex, "key"]
10080
+ });
10081
+ }
10082
+ keys.add(node.key);
10083
+ diagramKeys.add(node.key);
10084
+ });
10085
+ operation.edges.forEach((edge, edgeIndex) => {
10086
+ if (!keys.has(edge.from)) {
10087
+ ctx.addIssue({
10088
+ code: "custom",
10089
+ message: `diagram edge source does not name a node: ${edge.from}`,
10090
+ path: [index, "edges", edgeIndex, "from"]
10091
+ });
10092
+ }
10093
+ if (!keys.has(edge.to)) {
10094
+ ctx.addIssue({
10095
+ code: "custom",
10096
+ message: `diagram edge target does not name a node: ${edge.to}`,
10097
+ path: [index, "edges", edgeIndex, "to"]
10098
+ });
10099
+ }
10100
+ });
10101
+ }
10026
10102
  });
10027
10103
  }).describe("preferred declarative edits, applied in order; mutually exclusive with code");
10028
10104
  // ../actions/src/index.ts
@@ -12267,7 +12343,7 @@ var ACTION_DEFINITIONS = [
12267
12343
  {
12268
12344
  name: "tldraw_exec",
12269
12345
  title: "Run a one-shot tldraw program",
12270
- description: `Modify the current live tldraw board with preferred declarative operations or bounded JavaScript, then return a durable execution receipt; use IDs from a fresh observe, reacquire this current schema after compaction, and never replay an unknown result. First use: read the tldraw guide at ${AGENT_GUIDE_URLS.tldraw}.`,
12346
+ description: `Modify the current live tldraw board with preferred declarative operations or bounded JavaScript, including a graph-scoped diagram operation that lays out keyed nodes and native bound edges without caller-supplied coordinates, then return a durable execution receipt; use IDs from a fresh observe, reacquire this current schema after compaction, and never replay an unknown result. First use: read the tldraw guide at ${AGENT_GUIDE_URLS.tldraw}.`,
12271
12347
  inputSchema: {
12272
12348
  artifactId: string2().describe("the tldraw Artifact, art_…"),
12273
12349
  code: string2().min(1).max(1e5).optional().describe("advanced script source; mutually exclusive with operations"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdacurry/arbor",
3
- "version": "0.22.29",
3
+ "version": "0.22.30",
4
4
  "description": "The Arbor CLI — a shared workspace for people and agents. The human + headless-agent write path over Arbor's guarded operation surface.",
5
5
  "keywords": [
6
6
  "agents",