Files
dify/web/app/components/dify-builder
Charles YaoandClaude Opus 4.8 c6f7b9b832 refactor(dify-builder): consume contract from @dify/contracts/dify-builder
Also repoints 4 additional consumers under web/app/components/dify-builder/
(state.ts, types.ts, use-dify-builder-session.ts, and its test) that
imported the contract via a relative path ('./contract/types' /
'../contract/types') rather than the '@/app/...' alias the brief's grep
pattern searched for. Deleting the old generated file without updating
these would have broken the build; a full `pnpm run type-check` confirms
they were the only additional consumers and the fix introduces no new
errors (baseline vs. post-change error sets are identical, both containing
only 27 pre-existing, unrelated .next/ typegen errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-31 23:46:04 -07:00
..
2026-08-31 18:18:30 +08:00

Dify Builder

Shared session/stream logic for the App Builder Build, Edit, and Fix APIs. It is consumed by both the standalone debug page and the in-editor App Builder panel.

Internal Modules

  • state.ts: primitive session atoms. Feature consumers scope these atoms per app with ScopeProvider.
  • use-dify-builder-session.ts: the controller writes session atoms without subscribing to them. useDifyBuilderSession is the read-and-write wrapper used by the debug page.

Keep UI-only state, such as composer drafts and expanded cards, in the owning component. Add derived atoms for shared fields instead of passing the complete SessionView through React Context.

External Modules

  • config: CSRF_COOKIE_NAME, CSRF_HEADER_NAME for authenticated console requests.