clay-server 5.0.0-beta.1 → 5.0.0-beta.2

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.
@@ -84,13 +84,19 @@ function attachSessionDocument(ctx) {
84
84
  function presentWireframe(args, caller) {
85
85
  if (!caller) return toolError("present_wireframe requires a session-bound tool server");
86
86
  if (typeof args.source !== "string" || !/^[a-zA-Z0-9_-]{1,80}$/.test(args.id || "")) return toolError("Provide source and a short stable id using letters, digits, hyphens or underscores.");
87
+ var source;
87
88
  try {
88
- var source = wireframeRenderer.prepareSource(args.source, "diagram.puml");
89
- require("./salt-parser").parseSalt(source);
89
+ source = wireframeRenderer.prepareSource(args.source, "diagram.puml");
90
90
  if (!/^\s*@end(?:salt|uml)\b/im.test(source)) return toolError("Provide a complete @startsalt/@endsalt or @startuml/@enduml diagram.");
91
+ } catch (e) {
92
+ return toolError(e.message || String(e));
93
+ }
94
+ return wireframeRenderer.renderPlantUml(source).then(function () {
91
95
  sendToSession(caller.localId, { type: "wireframe_present", source: source, id: args.id, title: String(args.title || "clay-sketch").slice(0, 100), sessionId: caller.localId });
92
96
  return toolResult({ ready: true, id: args.id, saved: false });
93
- } catch (e) { return toolError(e.message); }
97
+ }).catch(function (e) {
98
+ return toolError(e && e.message ? e.message : String(e));
99
+ });
94
100
  }
95
101
 
96
102
  function getToolDefs(boundSession) {
package/lib/sdk-bridge.js CHANGED
@@ -537,7 +537,7 @@ function createSDKBridge(opts) {
537
537
  // Auto-approve read-only tools for ALL sessions.
538
538
  // These tools only inspect files and fetch data — no side effects.
539
539
  var readOnlyTools = { Read: true, Glob: true, Grep: true, WebFetch: true, WebSearch: true };
540
- if (readOnlyTools[toolName]) {
540
+ if (readOnlyTools[toolName] === true) {
541
541
  return { behavior: "allow", updatedInput: input };
542
542
  }
543
543
 
@@ -569,7 +569,7 @@ function createSDKBridge(opts) {
569
569
  var safeBrowserTools = { browser_watch_tab: true, browser_unwatch_tab: true };
570
570
  if (toolName.indexOf("mcp__") === 0 && toolName.indexOf("__browser_") !== -1) {
571
571
  var mcpToolName = toolName.substring(toolName.lastIndexOf("__") + 2);
572
- if (safeBrowserTools[mcpToolName]) {
572
+ if (safeBrowserTools[mcpToolName] === true) {
573
573
  return { behavior: "allow", updatedInput: input };
574
574
  }
575
575
  }
@@ -610,7 +610,7 @@ function createSDKBridge(opts) {
610
610
  clay_tool_source: true,
611
611
  };
612
612
  if (toolName.indexOf("mcp__clay-tools__") === 0
613
- && safeCapsuleTools[toolName.substring(toolName.lastIndexOf("__") + 2)]) {
613
+ && safeCapsuleTools[toolName.substring(toolName.lastIndexOf("__") + 2)] === true) {
614
614
  return { behavior: "allow", updatedInput: input };
615
615
  }
616
616
 
@@ -678,10 +678,10 @@ function createSDKBridge(opts) {
678
678
  };
679
679
  if (toolName.indexOf("mcp__") === 0) {
680
680
  if (toolName.indexOf(PAIR_MCP_PREFIX) === 0
681
- && pairMcpTools[toolName.slice(PAIR_MCP_PREFIX.length)]) {
681
+ && pairMcpTools[toolName.slice(PAIR_MCP_PREFIX.length)] === true) {
682
682
  return { behavior: "allow", updatedInput: input };
683
683
  }
684
- } else if (pairDynamicTools[toolName]) {
684
+ } else if (pairDynamicTools[toolName] === true) {
685
685
  return { behavior: "allow", updatedInput: input };
686
686
  }
687
687
 
@@ -698,7 +698,7 @@ function createSDKBridge(opts) {
698
698
  remove_note: true,
699
699
  };
700
700
  if (toolName.indexOf(NOTES_MCP_PREFIX) === 0
701
- && notesTools[toolName.slice(NOTES_MCP_PREFIX.length)]) {
701
+ && notesTools[toolName.slice(NOTES_MCP_PREFIX.length)] === true) {
702
702
  return { behavior: "allow", updatedInput: input };
703
703
  }
704
704
 
@@ -710,12 +710,19 @@ function createSDKBridge(opts) {
710
710
  return { behavior: "allow", updatedInput: input };
711
711
  }
712
712
 
713
- // This tool only prepares a read-only UI projection for the document the
714
- // agent is about to edit. The subsequent Edit/Write keeps its own normal
715
- // permission behavior.
716
- if (toolName === "mcp__clay-documents__present_wireframe" || toolName === "clay-documents__present_wireframe" ||
717
- toolName.indexOf("mcp__clay-documents__present_markdown_edit") === 0 ||
718
- toolName.indexOf("clay-documents__present_markdown_edit") !== -1) {
713
+ // These exact session-bound tools only prepare visible UI projections.
714
+ // The Markdown Edit/Write and the wireframe Save/Download flows retain
715
+ // their own normal authorization. Include Codex's resumed-session wrapper
716
+ // without trusting lookalike tools or another MCP server.
717
+ var safeDocumentPresentationTools = {
718
+ "mcp__clay-documents__present_markdown_edit": true,
719
+ "clay-documents__present_markdown_edit": true,
720
+ "mcp__clay-session-tools__clay-documents__present_markdown_edit": true,
721
+ "mcp__clay-documents__present_wireframe": true,
722
+ "clay-documents__present_wireframe": true,
723
+ "mcp__clay-session-tools__clay-documents__present_wireframe": true,
724
+ };
725
+ if (safeDocumentPresentationTools[toolName] === true) {
719
726
  return { behavior: "allow", updatedInput: input };
720
727
  }
721
728
 
@@ -730,7 +737,7 @@ function createSDKBridge(opts) {
730
737
  };
731
738
  if (toolName.indexOf("mcp__clay-email__") === 0) {
732
739
  var emailToolName = toolName.substring(toolName.lastIndexOf("__") + 2);
733
- if (safeEmailTools[emailToolName]) {
740
+ if (safeEmailTools[emailToolName] === true) {
734
741
  return { behavior: "allow", updatedInput: input };
735
742
  }
736
743
  }
@@ -748,7 +755,7 @@ function createSDKBridge(opts) {
748
755
  "mcp__clay-workspace__propose_project_follow_up": true,
749
756
  "mcp__clay-workspace__get_assignment_status": true,
750
757
  };
751
- if (safeWorkspaceTools[toolName] || toolName.indexOf("mcp__clay-history__") === 0) {
758
+ if (safeWorkspaceTools[toolName] === true || toolName.indexOf("mcp__clay-history__") === 0) {
752
759
  return { behavior: "allow", updatedInput: input };
753
760
  }
754
761
 
@@ -43,9 +43,9 @@ var CODEX_NOTE_TOOLS = {
43
43
  };
44
44
 
45
45
  function canonicalDynamicPermissionToolName(toolName) {
46
- if (CODEX_NOTE_TOOLS[toolName]) return "mcp__clay-notes__" + toolName;
46
+ if (CODEX_NOTE_TOOLS[toolName] === true) return "mcp__clay-notes__" + toolName;
47
47
  if (toolName === "send_to_partner" || toolName === "read_partner") return "mcp__clay-sessions__" + toolName;
48
- if (toolName === "present_markdown_edit") return "mcp__clay-documents__" + toolName;
48
+ if (toolName === "present_markdown_edit" || toolName === "present_wireframe") return "mcp__clay-documents__" + toolName;
49
49
  return toolName;
50
50
  }
51
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.2",
4
4
  "description": "Self-hosted team workspace for Claude Code and Codex. Multi-user, browser-based, with persistent AI mates.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js"