Comfy-Org / Comfy-Org/ComfyUI_frontend

Centralize standalone agent availability and transport policy

Open
#17,347 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Centralize the standalone agent availability and transport policy at the agent connection boundary.

This work is intentionally deferred from #16877. The current implementation uses bare `VITE_AGENT_STANDALONE` and `__DISTRIBUTION__` compile-time literals in multiple consumer sites. This preserves OSS dead-code elimination for the agent store and panel chunks. A direct replacement with a shared resolved runtime value can regress tree-shaking.

## Rationale

The registration, mounting, and event-source decisions must remain consistent. The current distributed conditions can diverge when the policy changes.

The follow-up must redesign the connection boundary so consumers receive a consistent resolved availability and transport decision without losing compile-time elimination in OSS builds.

## Affected areas

- `src/extensions/core/index.ts`: agent extension registration.
- `src/workbench/extensions/agent/composables/useAgentDockMount.ts`: agent dock mounting.
- `src/workbench/extensions/agent/AgentPanelRoot.vue`: agent event-source selection.
- The agent connection boundary and its tests.

## Required changes

1. Define the agent availability and transport policy at the connection boundary.
2. Update the three consumer sites to use that policy.
3. Preserve bare compile-time literals where they are necessary for OSS dead-code elimination.
4. Keep the current cloud and standalone-harness behavior.
5. Add tests for policy consistency.
6. Add a bundle-size or equivalent tree-shaking validation for OSS builds.

## Acceptance criteria

- Registration, dock mounting, and event-source selection use one consistent policy.
- OSS builds do not include the agent store or panel chunks when the feature is disabled.
- Cloud behavior remains unchanged.
- `VITE_AGENT_STANDALONE='true'` still enables the local standalone harness in supported non-cloud distributions.
- The implementation includes automated tests and a documented bundle/tree-shaking verification.

## Backlinks

- Deferred from pull request #16877: https://github.com/Comfy-Org/ComfyUI_frontend/pull/16877
- Review discussion: https://github.com/Comfy-Org/ComfyUI_frontend/pull/16877#discussion_r3956348739

Requested by @christian-byrne.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.