-
Notifications
You must be signed in to change notification settings - Fork 140
feat(workflow): agent-first workflow editing — CRDT edit primitives, recipes, offline catalog, cloud run association #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
skishore23
wants to merge
18
commits into
main
Choose a base branch
from
fix/validate-lowers-ui-to-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f795e39
feat(workflow): agent-first workflow editing — CRDT edit primitives, …
skishore23 baf71ad
fix(workflow): address high/medium review findings on agent-workflow …
skishore23 e24be64
chore: ruff 0.15.15 format (match CI pin)
skishore23 d8d76b6
fix(security): derive subgraph fork id with SHA-256, not SHA-1
skishore23 6513fa2
fix(error-codes): register the normalized_value warning code
skishore23 0c37bd0
fix(run,workflow): telemetry cloud lifecycle + address CodeRabbit review
skishore23 1fde508
fix(workflow): reject malformed autogrow connect targets instead of g…
skishore23 5b3292d
fix(workflow): resolve bare autogrow element names (image1) against t…
skishore23 9dea33b
fix(workflow,validate): unify subgraph interior id namespaces across …
skishore23 919420c
feat(layout): deterministic placement primitives for CLI-minted nodes
skishore23 7289a5a
style: ruff-format layout module
skishore23 3a6e555
feat(workflow): layout-aware default position + real size estimate fo…
skishore23 6c3f0f7
feat(workflow): topology-aware batch layout pre-pass in apply_specs
skishore23 d6977a7
fix(layout): directional anchors + full longest-path relaxation in as…
skishore23 9f60306
feat(workflow): first-class clear command (single clear op, ids stay …
skishore23 e5f4b8e
fix(workflow): a failed batch must not advertise ids the rollback dis…
skishore23 25ee3b9
fix(workflow): accept a connect whose target input declares a type UNION
skishore23 315249d
fix(workflow): give callers the identifiers they were missing
skishore23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| """``comfy assets library`` — browse and borrow assets from Comfy Cloud's | ||
| asset library. | ||
|
|
||
| Mirrors the cloud-saved-workflow subcommands in ``workflow.py`` (``list``, | ||
| ``get``, ...): thin Typer commands over ``cloud_http``'s shared helpers, | ||
| emitting a JSON envelope via the renderer. Cloud-only — there is no local | ||
| ``/api/assets`` surface. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Annotated, Any | ||
|
|
||
| import typer | ||
|
|
||
| from comfy_cli import tracking | ||
| from comfy_cli.command.cloud_http import ( | ||
| cloud_target_or_local_error, | ||
| handle_cloud_http_error, | ||
| http_request, | ||
| ) | ||
| from comfy_cli.output.renderer import get_renderer | ||
|
|
||
| app = typer.Typer(help="Browse your Comfy Cloud asset library (list, borrow).") | ||
|
|
||
|
|
||
| @app.command("ls", help="List your assets on Comfy Cloud.") | ||
| @tracking.track_command("assets") | ||
| def ls_cmd( | ||
| name: Annotated[ | ||
| str | None, | ||
| typer.Option("--name", show_default=False, help="Case-insensitive substring match on asset name."), | ||
| ] = None, | ||
| tags: Annotated[ | ||
| str | None, | ||
| typer.Option( | ||
| "--tags", show_default=False, help="Comma-separated tags; assets must have ALL of them (e.g. input,output)." | ||
| ), | ||
| ] = None, | ||
| limit: Annotated[int, typer.Option("--limit", help="Cap rows returned (max 500).")] = 20, | ||
| where: Annotated[str | None, typer.Option("--where", show_default=False)] = None, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| ): | ||
| import urllib.error | ||
| import urllib.parse | ||
|
|
||
| renderer = get_renderer() | ||
| target = cloud_target_or_local_error(where, renderer) | ||
|
|
||
| params: list[tuple[str, Any]] = [("limit", min(max(limit, 1), 500))] | ||
| if name: | ||
| params.append(("name_contains", name)) | ||
| for t in tags.split(",") if tags else []: | ||
| t = t.strip() | ||
| if t: | ||
| params.append(("include_tags", t)) | ||
| url = target.url("assets") + "?" + urllib.parse.urlencode(params) | ||
|
|
||
| try: | ||
| _, body = http_request(url, target) | ||
| except (urllib.error.HTTPError, urllib.error.URLError, OSError) as e: | ||
| raise handle_cloud_http_error(renderer, e, operation="list") from e | ||
|
|
||
| rows = (body or {}).get("assets") or [] | ||
| payload = { | ||
| "count": len(rows), | ||
| "assets": [ | ||
| { | ||
| "id": r.get("id"), | ||
| "name": r.get("name"), | ||
| "hash": r.get("hash"), | ||
| "mime_type": r.get("mime_type"), | ||
| "size": r.get("size"), | ||
| "tags": r.get("tags"), | ||
| "preview_url": r.get("preview_url"), | ||
| "job_id": r.get("job_id"), | ||
| "created_at": r.get("created_at"), | ||
| } | ||
| for r in rows | ||
| if isinstance(r, dict) | ||
| ], | ||
| } | ||
| renderer.emit(payload, command="assets library ls", where="cloud") | ||
|
|
||
|
|
||
| @app.command("ensure", help="Ensure you own an asset by content hash (borrows public/shared bytes, no re-upload).") | ||
| @tracking.track_command("assets") | ||
| def ensure_cmd( | ||
| hash: Annotated[str, typer.Option("--hash", help="Asset content hash (as returned by `assets library ls`).")], | ||
| tags: Annotated[ | ||
| str, | ||
| typer.Option("--tags", help="Comma-separated tags to attach (>=1 required by the API)."), | ||
| ] = "input", | ||
| where: Annotated[str | None, typer.Option("--where", show_default=False)] = None, | ||
| ): | ||
| import urllib.error | ||
|
|
||
| renderer = get_renderer() | ||
| target = cloud_target_or_local_error(where, renderer) | ||
|
|
||
| tag_list = [t.strip() for t in tags.split(",") if t.strip()] or ["input"] | ||
| url = target.url("assets/from-hash") | ||
| try: | ||
| status, body = http_request(url, target, method="POST", body={"hash": hash, "tags": tag_list}) | ||
| except (urllib.error.HTTPError, urllib.error.URLError, OSError) as e: | ||
| raise handle_cloud_http_error(renderer, e, operation="ensure") from e | ||
|
|
||
| b = body or {} | ||
| payload = { | ||
| "id": b.get("id"), | ||
| "hash": b.get("hash", hash), | ||
| "created_new": status == 201, | ||
| } | ||
| renderer.emit(payload, command="assets library ensure", where="cloud") | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.