Skip to content

feat(custom-blocks): add deploy_custom_block copilot tool#5532

Merged
TheodoreSpeaks merged 8 commits into
stagingfrom
feat/custom-block-mothership
Jul 11, 2026
Merged

feat(custom-blocks): add deploy_custom_block copilot tool#5532
TheodoreSpeaks merged 8 commits into
stagingfrom
feat/custom-block-mothership

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • new deploy_custom_block copilot tool handler: the deploy agent can publish a deployed workflow as an org-wide custom block, update it in place (re-deploy upserts), or unpublish with action: undeploy
  • same gates as the REST routes: workspace admin via ensureWorkflowAccess (denied → clean "requires admin permission" message), deploy-as-block flag, enterprise plan; audit events recorded with source: copilot
  • iconUrl accepts a workspace file VFS path (files/icon.png) — bytes are copied into the public workspace-logos context (key prefixed so the serve route treats it as public) so the icon renders org-wide; external URLs pass through
  • entitlements: new computeWorkspaceEntitlements(workspaceId, userId) (flag + enterprise → ['custom-blocks'], 5s promise cache) sent as entitlements in every mothership payload — interactive chat (both branches), /api/mothership/execute (executor block + scheduled tasks), and the inbox executor. The Go side hides the custom-block tool/prompt/skill entirely when absent; fail-closed
  • eligibleOrgForWorkspace now takes an optional userId so per-user flag targeting matches the REST routes
  • synced tool catalog from the copilot repo (adds DeployCustomBlock; regen formatting churn in tool-schemas-v1.ts is from the current generator)
  • new getCustomBlockWithInputsByWorkflowId operation + shared row-hydration helper

Companion PR simstudioai/mothership#346 adds the tool definition, deploy agent wiring, entitlement gating, prompts, and skill — this handler is inert until that ships.

Type of Change

  • New feature

Testing

Tested manually end-to-end via Chat (published a block with a generated icon, verified render + upsert). 15 handler tests incl. icon ingestion + permission errors, payload pass-through tests. lint, type-check, and check:api-validation:strict pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Companion: simstudioai/mothership#346

@TheodoreSpeaks TheodoreSpeaks requested a review from a team as a code owner July 9, 2026 02:58
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 11, 2026 5:40pm

Request Review

@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches deployment/admin paths and billing/feature-flag gates; execution is re-checked in sim but incorrect entitlement wiring could expose or hide agent surfaces until the companion mothership PR ships.

Overview
Adds a deploy_custom_block copilot tool so agents can publish, update, or unpublish a workflow as an org custom block, with the same gates as REST (admin, deploy-as-block, enterprise on first publish) and sim-side enforcement in the handler.

Introduces computeWorkspaceEntitlements and threads an optional entitlements array (e.g. custom-blocks) into mothership payloads from interactive chat, /api/mothership/execute, and the inbox executor so Go can hide gated tools/prompts; empty arrays are omitted from the payload.

Syncs the generated tool catalog/schemas for deploy_custom_block, registers the server handler (including workspace-file icon ingestion into public storage), and adds getCustomBlockWithInputsByWorkflowId plus optional userId on custom-block eligibility checks for per-user flag targeting.

Reviewed by Cursor Bugbot for commit 9e9abd0. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds copilot support for deploying workflows as custom blocks. The main changes are:

  • New deploy_custom_block tool catalog entry and server handler.
  • Entitlement propagation in chat, execute, and inbox mothership payloads.
  • Custom-block workflow lookup and shared hydration helpers.
  • Workspace-file icon ingestion into public icon storage.
  • Tests for deployment, undeploy, permissions, entitlement payloads, and validation.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/lib/copilot/tools/handlers/deployment/custom-block.ts Adds the custom-block deploy handler with permission, feature, plan, icon, and persisted-field validation.
apps/sim/lib/copilot/entitlements.ts Adds cached workspace entitlement evaluation for mothership payloads.
apps/sim/lib/workflows/custom-blocks/operations.ts Adds custom-block workflow lookup and reuses shared row hydration.
apps/sim/lib/copilot/tool-executor/register-handlers.ts Registers the new custom-block deployment handler.

Reviews (5): Last reviewed commit: "fix(custom-blocks): enterprise gate appl..." | Re-trigger Greptile

Comment thread apps/sim/lib/copilot/tools/handlers/deployment/custom-block.ts
Comment thread apps/sim/lib/copilot/tools/handlers/deployment/custom-block.ts
Comment thread apps/sim/lib/copilot/tools/handlers/deployment/custom-block.ts
@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Jul 10, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • simstudioai/mothership#346OPEN, not merged (targets staging) — feat(deploy): add deploy_custom_block tool, skill, and prompts

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

Comment thread apps/sim/lib/copilot/tools/handlers/deployment/custom-block.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

Comment thread apps/sim/lib/copilot/tools/handlers/deployment/custom-block.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0b2184b. Configure here.

Comment thread apps/sim/lib/copilot/tools/handlers/deployment/custom-block.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

@TheodoreSpeaks TheodoreSpeaks force-pushed the feat/custom-block-mothership branch from 160c866 to 9e9abd0 Compare July 11, 2026 17:40
@TheodoreSpeaks TheodoreSpeaks merged commit 3a2f4e5 into staging Jul 11, 2026
17 checks passed
@TheodoreSpeaks TheodoreSpeaks deleted the feat/custom-block-mothership branch July 11, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant