Repository navigation
Conversation
Move ComfyApi and its transport, retry, auth-transport and remote response types into @comfyorg/api-client, and the setting definitions, types and store factory into @comfyorg/settings-core. Neither package imports from the app. The client takes host capabilities through ComfyApiPorts: the distribution, the session and dev feature-flag override, and a freeMemory result callback that the app turns into the existing toasts. The setting store persists through a SettingPersistence port, which the app satisfies with the api singleton. src/scripts/api.ts keeps exporting api and ComfyApi, so the legacy scripts/api.js shim and window.comfyAPI.api still expose both. It no longer re-exports UnauthorizedError or PromptExecutionError; a GitHub code search found no custom node importing either from scripts/api. Fixes FRONT-3635
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
API client package and implementation packages/api-client/*, packages/api-client/src/* |
Adds the API client package and ComfyApi, covering HTTP requests, WebSocket handling, prompt and job operations, user data, settings, logs, and server feature flags. Adds package-local types and configuration. |
Settings store package and implementation packages/settings-core/*, packages/settings-core/src/*, src/platform/settings/settingStore.ts |
Adds settings persistence, registration, reads and writes, telemetry, and migrations to settings-core. The platform store delegates setup to the new package. |
Application and test package imports browser_tests/*, src/* |
Updates application code, fixtures, and tests to import API-client and settings types and helpers from package paths. The summarized import changes leave existing test behavior and application logic unchanged. |
Package tooling and architecture records .fallow*, .gitattributes, .github/*, .oxlintrc.json, knip.config.ts, oxlint-suppressions.json, package.json, docs/architecture/domains/* |
Updates workspace dependencies, lint and resolver settings, generated manager-type paths, CI checks, review configuration, and architecture boundaries and records. |
Priority:
Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Refactor
Merge Risk: 
Minimal · up to d9290
-
No verified merge-blocking risk remains in the reviewed extraction boundaries.
Pre-merge checks: 
6
-
Full details: Description check
-
Explanation
The description includes the required Summary and Verification sections. It explains the extracted packages, port-based design, compatibility considerations, known API changes, linked issues, and detailed verification results, including the browser-test gap.
Full details: End-To-End Test Suggestion For User-Facing Changes
-
Explanation
The diff is an internal extraction and import rewire for the API client and settings core. The changed application code preserves existing behavior; it does not add or change a user-facing feature or fix a user-triggerable bug. The browser-test changes update type imports only. Therefore, the end-to-end test suggestion condition is not met.
Full details: Adr Compliance For Entity/Litegraph Changes
-
Explanation
The PR is applicable because it changes
src/lib/litegraph/src/LGraphNode.tsand other graph-related files. The supplied diff content shows import-only changes in those files. It does not show entity state mutations, new god-object methods, component methods or back-references, or extension-callback changes. No ADR-LAYOUT or ADR-ECS warning is required.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
dante01yoon
left a comment
There was a problem hiding this comment.
Review at bbd91b3efd.
Why COMMENT and not APPROVE: the PR is CONFLICTING with main. Only the bookkeeping checks ran (CLA, Socket, CodeRabbit). lint-pr, typecheck, unit and the Playwright suites have not run on this head. For a 392-file move I'd like CI green after the rebase before approving. Your local verification list is thorough, and none of what follows blocks.
What I verified by diffing the moved code against main:
packages/api-client/src/ComfyApi.tsmatches the oldsrc/scripts/api.ts, apart from imports and the three ports.isCloud,featureFlagOverrideandonFreeMemoryare each replaced one-for-one. The twoapi.fetchApi→this.fetchApichanges in the global-subgraph methods are correct now that the singleton lives outside the class module.notifyFreeMemorymapsok/rejected/unreachableto the same three toast keys as before.featureFlagOverridekeeps the old order: the session override first, then the dev override.serverSupportsFeaturenow returnsoverride === truefor a dev override, where it used to return the raw value. This only matters in DEV, and the method always returns a real boolean now, so it's fine.packages/settings-core/src/settingStore.tsis the old store, re-indented insidedefineSettingStore(persistence). All fiveapi.*calls go throughpersistence.*.defineSettingStore(api)passes the instance, sothisbinding holds, and extensions that patchapi.storeSettingstill take effect.- Gate 3:
ModelFolderInfois now an intersection on the generatedModelFolder, which improves on the old hand-written interface. The other addedtypehits are FE-only (event payload aliases and theFreeMemoryResultport type). - Shim surface:
comfyAPIPluginmatchesexport const ComfyApi = ComfyApiClientandexport const api = ..., soscripts/api.jsandwindow.comfyAPI.apistill expose both. Your compatibility notes list the two dropped error classes.
One non-blocking suggestion is inline. Happy to approve once it's rebased and CI is green.
| } | ||
|
|
||
| export const api = new ComfyApi() | ||
| export const ComfyApi = ComfyApiClient |
There was a problem hiding this comment.
suggestion: The compatibility section lists the two error classes scripts/api.js drops. This PR also deletes src/scripts/apiTimeouts.ts, which comfyAPIPlugin used to emit as its own scripts/apiTimeouts.js shim (window.comfyAPI.apiTimeouts.AUTH_INIT_TIMEOUT_MS / FETCH_RESPONSE_HEADERS_TIMEOUT_MS). Any scripts/*.ts file gets a shim, and this one already carries the "internal module" notice, so I'd expect no real consumers. Could you add a line about it to the compatibility notes, so the release notes cover every removed shim path?
There was a problem hiding this comment.
Left for DrJKL: the finding is correct. On main, comfyAPIPlugin emits scripts/apiTimeouts.js with AUTH_INIT_TIMEOUT_MS and FETCH_RESPONSE_HEADERS_TIMEOUT_MS from window.comfyAPI.apiTimeouts, behind the "internal module" notice. This PR moves the file into @comfyorg/api-client, so neither the shim nor that window.comfyAPI entry is emitted anymore. GitHub code search for comfyAPI.apiTimeouts and scripts/apiTimeouts finds no use outside this repo. The fix is one line in the PR description, and this round does not allow editing PR metadata. Suggested line for the compatibility notes: "scripts/apiTimeouts.js and window.comfyAPI.apiTimeouts are no longer emitted; the module was internal, and code search found no external consumers."
Amp-Thread-ID: https://ampcode.com/threads/T-76b6f91c-1930-4c20-9940-ec86787aaccf # Conflicts: # .github/workflows/ci-oss-assets-validation.yaml # browser_tests/fixtures/helpers/CommandHelper.ts # browser_tests/tests/dialogs/settingsDialog.spec.ts # docs/architecture/domains/boundaries.json # docs/architecture/domains/records/extension-runtime.domain.json # docs/architecture/domains/records/keybindings.domain.json # knip.config.ts # packages/keybindings/src/types.ts # packages/settings-core/src/keybindingTypes.ts # packages/settings-core/src/types.ts # src/platform/keybindings/defaults.ts # src/platform/keybindings/presetService.test.ts # src/platform/keybindings/presetService.ts # src/platform/keybindings/types.ts # src/platform/settings/constants/coreSettings.ts # src/platform/settings/settingStore.test.ts # src/types/comfy.ts # tools/types-consumer-check/src/cli.ts # tsconfig.packages.json # tsconfig.types.json
|
Merged The conflicts came from #22154, which moved the keybinding types into
Checks run after the merge: both packages typecheck and build, |
📦 Bundle: 12 MB gzip 🔴 +1.04 kBDetailsSummary
Category Glance App Entry Points — 6.71 kB (baseline 6.71 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 2.6 MB (baseline 2.6 MB) • 🔴 +17 BGraph editor runtime, canvas, workflow orchestration
Status: 2 added / 2 removed / 1 unchanged Views & Navigation — 148 kB (baseline 148 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 14 added / 14 removed / 4 unchanged Panels & Settings — 878 kB (baseline 878 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 14 added / 14 removed / 21 unchanged User & Accounts — 159 kB (baseline 159 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 10 added / 10 removed / 8 unchanged Editors & Dialogs — 502 kB (baseline 502 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 11 added / 11 removed / 6 unchanged UI Components — 359 kB (baseline 359 kB) • ⚪ 0 BReusable component library chunks
Status: 9 added / 9 removed / 22 unchanged Data & Services — 1.93 MB (baseline 1.93 MB) • 🔴 +1.98 kBStores, services, APIs, and repositories
Status: 35 added / 35 removed / 7 unchanged Utilities & Hooks — 2.46 MB (baseline 2.46 MB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 46 added / 46 removed / 37 unchanged Vendor & Third-Party — 9.69 MB (baseline 9.69 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 16 unchanged Other — 34.8 MB (baseline 34.8 MB) • 🟢 -10 BBundles that do not match a named category
Status: 110 added / 110 removed / 640 unchanged ⚡ Performance
🎭 Playwright: ✅ 3183 passed, 0 failed · 2 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight
Findings and check detailsThe matrix runs on same-repository version-bump PRs with relevant changes, main-branch pushes, and manual dispatches. This candidate does not qualify, so every expensive stage was skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md 🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. Findings and check detailsNo new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since c68df19e41751b11640807b1dd8497b02472470e
Full docs: ADR-DEVEX-LINT-0015 🏛️ Architecture: ✅ PassedFindings and check detailsWarnings (291)
Reproduce locallypnpm architecture:checkFull docs: Frontend domain catalog |
|
Feedback round for dante01yoon's review at
No commits were pushed in this round. |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #22186 +/- ##
==========================================
- Coverage 87.61% 87.60% -0.01%
==========================================
Files 2957 2936 -21
Lines 161209 160002 -1207
Branches 41286 43050 +1764
==========================================
- Hits 141248 140177 -1071
+ Misses 19038 18902 -136
Partials 923 923
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 40 files with indirect coverage changes 🚀 New features to boost your workflow:
|
…neStore The globalPinia lint rule recognises store modules by a defineStore call. settings-core now exports the store setup function and the app module wraps it with defineStore, so the package no longer depends on pinia. Amp-Thread-ID: https://ampcode.com/threads/T-76b6f91c-1930-4c20-9940-ec86787aaccf
dialogService now imports PromptExecutionError from the api-client package, which the test's @/scripts/api mock no longer shadows. The Firebase error dialog for the fake user's missing getIdToken therefore opens and defers the onboarding coach. Previously the instanceof check threw on the undefined mock export and hid the dialog. Amp-Thread-ID: https://ampcode.com/threads/T-76b6f91c-1930-4c20-9940-ec86787aaccf
…nk-the-api-client-and-setting-store-to-an-extractable Amp-Thread-ID: https://ampcode.com/threads/T-76b6f91c-1930-4c20-9940-ec86787aaccf
…nk-the-api-client-and-setting-store-to-an-extractable Amp-Thread-ID: https://ampcode.com/threads/T-76b6f91c-1930-4c20-9940-ec86787aaccf
|
Merged One conflict, in the imports of |
dante01yoon
left a comment
There was a problem hiding this comment.
Re-reviewed at 946262f. My last review held approval for two reasons: the PR conflicted with main, and the real CI suites had not run. It is now MERGEABLE, and lint-pr (lint, typecheck, typecheck-aux, repo-checks), all 8 unit shards plus test-packages, fallow, and every chromium and cloud Playwright shard pass on this head.
New own commits since bbd91b3:
cf9d953:settings-corenow exportssettingStoreSetup(persistence), and the app wraps it asdefineStore('setting', () => settingStoreSetup(api)). The store id and the persistence port are unchanged, the package drops itspiniadependency, andglobalPiniastore detection sees thedefineStorecall again. The body is the same code, re-indented one level.c977ba9: theAgentPanelRootfake user getsgetIdToken. The commit message explains why:dialogServicenow importsPromptExecutionErrorfrom@comfyorg/api-client, which the@/scripts/apimock no longer shadows. That is a correct fixture fix, not a weakened assertion.- The two merges pull in
@comfyorg/keybindings(#22154). TheexcludePackageslist, the boundaries records and theKeyCombo/Keybindingimports were rebased onto it without leftovers.
Red check (CONFIRMED log, PLAUSIBLE flake): playwright-video-new-tests (cloud, …assets-output-dedupe.spec.ts) fails toHaveCount(4) with 3 at line 102. The only change this PR makes to that spec is the type-only JobDetail import path. The same spec passes in playwright-tests-cloud-sharded on this same head; shard 2's single flaky test is an unrelated agent spec. The video job runs with --retries=0. A rerun of that job should confirm it before merge. If it fails again, it needs a look, because the jobs code this spec exercises moved into @comfyorg/api-client.
Still open, non-blocking: the scripts/apiTimeouts.js shim thread on src/scripts/api.ts. The bot reply confirms the shim disappears. A line in the compatibility section of the description, next to the two dropped error classes, would close it.
Approving.
The jobTypes exclusion had moved to its package path, but the rule's file globs never included packages, so the moved sources lost the check. Amp-Thread-ID: https://ampcode.com/threads/T-76b6f91c-1930-4c20-9940-ec86787aaccf
|
Review round on
Commits pushed: none. Both fixes are on local branch |
|
Review round, follow-up:
Commits pushed: 802a284, d9290b0. This push dismisses the approval on |
dante01yoon
left a comment
There was a problem hiding this comment.
Re-reviewed only the delta since my last approval (f33ca37b..d9290b08):
802a284claims every movedpackages/api-client/srcandpackages/settings-core/srcfile under the domain and role its oldsrcpath had, and moves the comfyui-api public entry point topackages/api-client/src/executionTypes.ts. That resolves my earlierpublicEntryPointssuggestion. I checked that the records gain no new stale paths compared with main.d9290b0extendsno-unsafe-error-assertionto both packages' sources.
The only package sources still unclaimed (fetchWithRetry, retryPolicy, statusRetryTelemetry, fetchRouteTemplate, clientFeatureFlags.json) were also unclassified at their old src/ paths on main, so nothing regressed. The scripts/apiTimeouts.js shim note stays a non-blocking follow-up. CI is green. Approving.
Reconciles the branch with main, which advanced 73 commits. Three conflicts, resolved in main's favour on every axis where the two sides genuinely disagreed: - changeTracker.ts imports: main's @comfyorg/api-client/executionTypes path for ExecutedWsMessage (#22186 package extraction), keeping this branch's canvasTrackerOwnership import beside it. - changeTracker.ts squashState guard: conjoin main's isChangeCaptureSuppressed() with this branch's !canCaptureCanvas(this). Independent early-return conditions; neither side loses a guard. - workflowService.ts imports: union of both sides minus defaultGraph, whose only use #22124 replaced with getDefaultWorkflow(). - app.ts x3 call sites: adopt main's ordering wholesale. #21983 deliberately inverted beforeLoadNewGraph and the beforeLoadGraph hook and pinned the new order, so this branch's beginGraphLoad helper encoded an ordering main no longer has. The helper is dissolved and the invalidator beforeLoadNewGraph returns is invoked inline at each site. Both canvas-ownership pins from this branch pass unmodified, as does main's new hook-order pin: 477 passed, 1 skipped across the three touched suites.
…y-Org#22013) ## Summary Uses the websocket contract Comfy-Org/ComfyUI#16763 and Comfy-Org#16809 shipped, which the frontend never adopted: `queuePrompt` sent no `workflow_metadata`, so the server had nothing to stamp beyond the id inside `extra_pnginfo`. This sends it, reads what comes back, and uses it to place a job that no per-tab mapping knows about. Replaces Comfy-Org#20045. Comfy-Org#21666 landed the instance-keyed gate for the Agent while that PR was in review, so the headline cross-tab fix is already on main. What was left is here, rebuilt on top of it. ## Changes - `queuePrompt` sends `workflow_metadata: { workflow_id }`, and the stamped id is forwarded to the gate from `execution_start`, `progress_state`, the `executed` listener, and the binary preview header, whose decoder was dropping it. - The ownership gate — now `rememberStampAndCheckActiveWorkflow`, named for the per-job stamp it records — gains two legs below `instanceId`: the session path, then the frame's own workflow id. The graph id is the weakest leg on purpose, because every copy of a workflow shares it, so copy-paste into a new tab gives two tabs one id and keying on it first makes each match the other's jobs. - The all-zero UUID is discarded rather than compared, on both sides. It is `LGraph._id`'s default and the codebase reads it as "no id yet", so comparing it as a real id matched nothing and rejected a fresh graph's own frames. - `forgetFinishedJobs` releases the tab's workflow status. Only a terminal frame cleared it, so a job that ended without one left the badge claiming the tab was running for the rest of the session. It releases an orphaned Running badge only: a workflow whose newer job already completed keeps its Completed or Failed badge when an older unreadable job is forgotten. - ADR-EXECUTION-ROUTING-0049 records the resolution order and that the unresolvable-frame fallback departs from ADR-GRAPH-DOCUMENT-0026 D2, with the condition for removing the exception. ## Review focus - **Comfy-Org#21666's gate had no unit coverage**, and the existing `executionStore` fixtures carry no `instanceId`, so nothing exercised the instance leg. `executionStore.workflowOwnership.test.ts` covers it first, so the behaviour this builds on is pinned before anything is added to it. - **The unresolvable fallback is the weakest point.** It is narrower than permissive, since a foreign job's unresolvable frame is dropped while another job is active, but with two tabs open and a frame unresolvable it can still land on the wrong one. The ADR says so. - **`progress_text` is still unattributable on current core.** Core packs it as a binary frame `send_sync` cannot stamp, and the frontend decodes a job id out of it only under `supports_progress_text_metadata`, which no core version sets — so the gate is called with no job id and returns before any stamp lookup. Comfy-Org/ComfyUI#16887 is what unblocks the leg. ## Tests Every change is verified by mutation: the fix reverted and the test confirmed to fail. Each wire boundary falsifies on its own — dropping the `workflow_metadata` spread fails the request rows, dropping the `!== zeroUuid` guard fails the sentinel row, removing `workflowId` from the type-4 decoder fails the preview decode, and removing either app forwarding argument fails the unmapped-routing case. Removing the instance comparison fails the shared-graph case, the path leg two, the workflow-id leg one, and the status release one. Store, request and decoder coverage lives in `executionStore.workflowOwnership.test.ts`, `executionStore.terminalRecovery.test.ts`, `api.queuePrompt.test.ts`, `api.previewMetadata.test.ts` and `app.test.ts`. `typecheck:app`, `typecheck:browser` and the `fallow` audit gate are clean, with 0 introduced findings of any kind. Both store suites register tabs through `workflowStore.attachWorkflow` rather than assigning `openWorkflows`, because `applyWorkflowStatus` refuses to record a status for a workflow the real `isOpen` does not consider open. Assigning the computed made the premise silently false. `browser_tests/tests/wsReconnectStaleJob.spec.ts` carries the black-box regression for the status release. It strands one unreadable job on each of two workflows — one of them the workflow's only job, the other alongside a live sibling — and uses the orphaned workflow's badge disappearing as the cleanup barrier before asserting the sibling's badge survives, because the detail-request counters move before the responses are fulfilled and cannot establish completion. Verified three ways on `--project=chromium`: 6/6 green on the repair and 3/3 on `--repeat-each=3`; failing at the barrier when cleanup is prevented from running, so the barrier is not vacuous; and failing at the sibling assertion under the pre-Comfy-Org#22013 clear ordering. Comfy-Org#20700 still covers replacing the remaining scripted reconnect specs with real-backend tests. ## Sibling overlap Overlaps Comfy-Org#20982 (draft) at `packages/api-client/src/ComfyApi.ts`, where both add a different member to the same `BackendApiCalls` interface: that PR an `agent_status` entry, this one `workflowId` on the existing `b_preview_with_metadata` entry. No shared behaviour or symbol. **Comfy-Org#11951 conflicts on policy, not on text.** It proposes a `messageMatchesActiveWorkflow` resolver that consults the frame's workflow id ahead of session ownership — the inverse of the order decided here, and the order that makes two tabs sharing one copied graph id match each other's jobs. Its resolver is superseded; remaining work there should be carried onto this gate rather than restoring the id-first policy during integration. Recorded in ADR-EXECUTION-ROUTING-0049 under the rejected alternatives. Needs a human call rather than being settled by this PR. **Comfy-Org#22186 landed first, and this branch carried the contracts across.** It merged 2026-10-30 (`d9290b0`), moving the API and execution contracts into `packages/api-client`. The merge of `main` at `24b64d62` relocated this PR's request field, preview decoding and stamped types into `packages/api-client/src/ComfyApi.ts` and `packages/api-client/src/executionTypes.ts`. The relocation is content-identical: comparing this PR's own diff before the merge (`9facf6c7`..`a8e25943`) against after it (`1bbea48f`..`24b64d62`), the entire changed-line delta is two lines out and six in, all in `api.previewMetadata.test.ts` — the `ComfyApi` import path and the constructor options the package now requires. No production line changed. **Comfy-Org#22271 (open) overlaps on ownership policy.** It adds an unconditional `detail.workflow_id !== this.rootGraph.id` rejection after the output ownership check, which can reject a job this PR's stronger instance/path identity accepts, and treats the all-zero UUID as a real identity rather than the "no id yet" default this PR discards. Its remaining coverage should be carried onto this PR's single ownership decision rather than kept as an independent guard. Same class of conflict as Comfy-Org#11951, and the same kind of human call. Proposed order is this PR first, since Comfy-Org#20982 is a draft that has not moved since 2026-10-18, then a one-line rebase there. Reversed is equally cheap: this branch would merge main and re-add its line. ## Derivation, and the control that it is load-bearing `workflow_metadata` is no longer hand-declared. Comfy-Org#22426 is on `main`, so both wire types now come from `@comfyorg/comfyui-api-types`, which generates core's `PromptRequest` from `openapi.yaml` pinned at `4281eb0a14`: ```ts // request — the spec's map narrowed to the one key this client sends workflow_metadata?: Pick<PromptWorkflowMetadata, 'workflow_id'> // frame — the map's VALUE type, not the map type StampedWorkflowId = { workflow_id?: PromptWorkflowMetadata[string] } ``` Core's spec defines no websocket frame schemas. It documents that `workflow_metadata` is echoed onto every JSON frame carrying a `prompt_id`, so the frame field is that request contract read back. The frame carries the map's contents merged into the frame object, which is why the value type is what transfers — a `Pick` or `Partial` of the map would describe the wrong shape here even though it would compile. The dependency is on `packages/api-client`, not the app, since `ComfyApi` builds the body. ### Verification Evidence **1. Delete the member from the pinned spec, regenerate — `pnpm typecheck` fails.** ``` packages/comfyui-api-types/src/index.ts(9,29): error TS2339: Property 'workflow_metadata' does not exist on type 'PromptRequest'. ``` Restored: spec hash back to `8f0da854…`, `check:generated` 0, `typecheck` 0. **2. That is not sufficient on its own.** The error above surfaces at the package's own alias — the first link in the chain — so it does not show that consumers are tied to the spec. Isolating them: retype the spec's value to `integer` *and* relax the package's `Record<string, string>` constraint, leaving consumers as the only thing that can fail. The retype reaches real call sites: ``` src/stores/executionStore.ts(592,38): error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'string | undefined'. src/stores/executionStore.ts(593,55): error TS2345: … src/stores/executionStore.ts(752,64): error TS2345: … src/scripts/app.ts(782,11): error TS2345: … ``` Both controls reverted. Gates after restore: `typecheck` 0, `typecheck:browser` 0, `oxlint --type-aware` on both changed files 0 (verified scanning — an injected `no-explicit-any` is reported), 239 `packages/api-client` tests passing. `main` was merged rather than rebased, so existing review anchors are preserved.
…t from the Cloud setup card (#23077) (#23158) Backport of #23077 to `cloud/1.59`. Opened by hand: the PR Backport workflow is hitting `startup_failure` (every `pull_request_target` workflow since 2026-11-09 16:03 UTC). Adapted for cloud/1.59: - globalSettingsApi.ts keeps this branch's in-tree imports (cloud/1.59 has no @comfyorg/api-client, #22186) and getGlobalSettingsAuthHeader, and takes this PR's switch to ingestApiUrl for the request URL. - src/platform/remote/ingest/ingestApiUrl.ts is copied from main (#22037), which is not on cloud/1.59. - DeploySetupAgentMenu imports the in-tree Menu and MenuItem components instead of @comfyorg/design-system/menu. Typecheck (app and browser tests) and the affected unit suites pass locally. --------- Co-authored-by: huang47 <157390+huang47@users.noreply.github.com>
Summary
Extract the API client into
@comfyorg/api-clientand the setting store core into@comfyorg/settings-core. Neither package imports from@/. App-specific behavior goes in through ports.Fixes FRONT-3635. Part of FRONT-3578.
How the issue's inventory compares with current main:
sessionFeatureFlagOverride→firebaseIdentity, not through telemetry. That route is now a port.ApiAuthProvider,webSessionFetch,authCredential,sessionMediaUrl) needed no injection because it was already app-free. It moved with the client, as did the remote response, job and template types.@comfyorg/billing-core's transport was not reused. The client already took its credentials throughApiAuthProvider.ModelFolderInfonow derives from the generatedModelFolderinstead of a hand-written interface.Custom-node compatibility.
app.api,window.comfyAPI.api.api,window.comfyAPI.api.ComfyApiand thescripts/api.jsshim exportsapiandComfyApiare unchanged.ComfyApi.prototype.queuePrompt.call(...)(ComfyUI_Fill-Nodes) and patchingapi.freeMemory(lf-nodes) still work. The setting API (app.ui.settings,useSettingStore) is unchanged. Two things changed:scripts/api.jsno longer exportsUnauthorizedErrororPromptExecutionError. A GitHub code search found no custom node importing either fromscripts/api.new ComfyApi()now requires ports. Every externalnew ComfyApi(hit is a vendored copy of an old frontend or an SDK with its own class, so no shim was added.isCloudis passed as a getter so that suites which mock the distribution per test still see the current value.Fallow baselines are re-keyed to the moved paths. The
ComfyApifindings match what main reports forsrc/scripts/api.ts. ThesettingStorefindings show a higher estimated CRAP because its tests now reach the store through the app wrapper; the code metrics are the same as on main. Remote config now lists its two override modules as public entry points for extension-runtime, which records the dependencyapi.tsalready had.Verification
rg "'@/" packages/api-client/src packages/settings-core/srcreturns nothing for non-test sources. Package declaration builds and isolated typechecks pass.typecheck:app,typecheck:browser,typecheck:tools, oxlint, eslint, knip,deps:audit,architecture:check(warnings 272 → 266) andfallow auditpass.src/scripts,src/platform/settings,src/platform/auth,authStoreand both packages: 179 files, 3794 passed.freeMemorystill shows the same toast text for cache-cleared, unloaded, rejected and unreachable.build:typespluscheck:types-consumerpass, and the published bundle does not reference the private packages.scripts/api.jsshim was inspected: it exportsComfyApiandapi.