Skip to content

refactor(core): deliver image generation notices via the job service - #60708

Open
kitlangton wants to merge 1 commit into
job-seam-4-shell-yieldfrom
job-seam-5-image-wrapper
Open

kitlangton wants to merge 1 commit into
job-seam-4-shell-yieldfrom
job-seam-5-image-wrapper

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Image generation now delegates completion notices to the job service, deleting 32 net lines from image-generate.ts.
Passing sessionID to jobs.start lets Job format and deliver <image> completion, failure, and cancellation notices directly, removing ImageGenerateTool.notifyWhenDone and its plugin-scoped watcher fiber.

❌ Before

  • ImageGenerateTool pre-allocated notificationID, forked notifyWhenDone in the plugin scope, and formatted ImageNotice itself.

✅ After

  • ImageGenerateTool passes sessionID: context.sessionID to jobs.start and calls jobs.background(id); Job handles persistence, formatting, delivery, and cleanup.

🟰 Behavior change: notices survive plugin/location reloads instead of depending on the plugin's scope; output format and metadata are unchanged.

- const notifyWhenDone = Effect.fn("ImageGenerateTool.notifyWhenDone")(...)
- yield* jobs.start({ id, notificationID, ... })
- yield* notifyWhenDone({ sessionID, id, notificationID, file: stem })
+ yield* jobs.start({ id, sessionID: context.sessionID, ... })
+ yield* jobs.background(id)

📊 Numbers

File Change
packages/core/src/tool/plugin/image-generate.ts +2 −34 (−32 net lines)

Tests: all 15 tests in tool-image-generate.test.ts pass.

👀 Read: packages/core/src/tool/plugin/image-generate.ts around jobs.start. Everything else is deletion.

🔍 Split 5 of 6 from #60495 · shrinks production code by 32 lines

Checks run
  • bun run --cwd packages/core typecheck
  • bun --cwd packages/core test test/tool-image-generate.test.ts: 15 pass

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant