docs(image): point the hosted-provider bead at ai-sdk's existing image facility
ai-sdk (already a dependency) has a provider-agnostic image.Provider, core.GenerateImage, and registry.RegisterImage -- three backends (azure/togetherai/xai) implement it, OpenAI doesn't yet. The next bead should adapt that instead of a raw HTTP client, mirroring how curatorLLMRunner adapts runtime.Runtime for chat. Noted the one real gap (no edit/mask support in ai-sdk's request type) for that bead to resolve at its own design step.
This commit is contained in:
1 parent
cfc296f17f
commit
b46b7691d8
2 files changed
+27
-1
No files matched your search
+1
-1
@@ -159,7 +159,7 @@
|
||||
{"_type":"issue","id":"archie-core-1786748942243-6-f109697e","title":"Deliver generated images through channel and web abstractions","description":"## Scope\nExtend the existing message/result delivery abstraction so generated images can reach users safely through supported channels and the web UI. Preserve useful metadata such as prompt/provider/model and errors without exposing credentials or internal filesystem paths.\n\nUse bounded temporary storage/cleanup and a clear policy for formats, dimensions, compression, and maximum response size. Ensure a failed upload does not leave the user with a success-looking text response.\n\n## Acceptance criteria\n- A provider result can be delivered as an image through each currently supported delivery path, or unsupported paths report a clear limitation.\n- Temporary files and downloaded inputs have bounded size and deterministic cleanup.\n- MIME/format handling, alt text/caption, and metadata are tested.\n- Delivery failures, retries/cancellation, and partial-success behavior are tested.\n- Existing text and file delivery behavior remains unchanged.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:44Z","updated_at":"2026-08-14T21:55:44Z","external_ref":"https://github.com/samcharles93/archie-core/issues/501","source_system":"github:https://github.com/samcharles93/archie-core/issues/501:501","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942243-6-f109697e","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:19Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-1786748942193-4-5072b564","title":"Implement /image mechanism clarification and routing flow","description":"## Scope\nMake the default `/image` workflow ask the user for their preferred generation mechanism before running a request when no mechanism is already selected: hosted API or local GPU. Present the choices and relevant constraints concisely, then collect only the options needed for the selected mechanism.\n\nSupport an explicit per-request override and a clearly scoped remembered preference only where existing session/config conventions support it. Never silently fall back from hosted to local or local to hosted.\n\n## Acceptance criteria\n- `/image` with no mechanism produces a clarification prompt and does not invoke a provider.\n- Hosted and local selections route to the correct provider with the selected options.\n- The flow supports generation and edit requests, including input-image validation.\n- Invalid choices, missing credentials, unavailable GPU backends, and cancellation produce actionable replies.\n- Channel-neutral tests cover the state machine; Telegram/web behavior is covered at the adapter boundary where applicable.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:43Z","updated_at":"2026-08-14T21:55:43Z","external_ref":"https://github.com/samcharles93/archie-core/issues/500","source_system":"github:https://github.com/samcharles93/archie-core/issues/500:500","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942193-4-5072b564","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:18Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-1786748942219-5-9844a72e","title":"Add local GPU image generation backend and tested model recipes","description":"## Scope\nAdd a local GPU path that can execute image generation on an existing user GPU through a supported local backend/API. Prefer integration with an established server/workflow interface over embedding model runtimes or downloading weights from Archie.\n\nShip a tested initial recipe set for common models appropriate to consumer GPUs, with the exact model files, backend versions, VRAM/RAM expectations, supported operations, and known limitations recorded. Include runnable code/config examples that Archie can use to assist a user in setting up and calling the backend.\n\nThe implementation must report unavailable hardware/backend/model conditions clearly and must not pretend an untested model is supported.\n\n## Acceptance criteria\n- At least one local GPU recipe is exercised end-to-end on real hardware or a reproducible maintained test harness.\n- Additional recipes are included only with evidence, covering model/backend/version, VRAM, image sizes, and speed/quality trade-offs.\n- Backend URL/auth/timeout and model selection are configurable.\n- Local generation returns the same provider-neutral result shape as hosted generation.\n- Tests cover backend unavailable, malformed response, timeout, cancellation, and model-not-found paths.\n- No model weights are committed or downloaded into the repository/home partition.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:43Z","updated_at":"2026-08-14T21:55:43Z","external_ref":"https://github.com/samcharles93/archie-core/issues/499","source_system":"github:https://github.com/samcharles93/archie-core/issues/499:499","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942219-5-9844a72e","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:18Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-1786748942169-3-ae7cfaea","title":"Implement hosted gpt-image-2-compatible image provider","description":"## Scope\nImplement the hosted image provider behind the image capability contract, targeting the practical baseline of the OpenAI `gpt-image-2` API.\n\nCover text-to-image and image editing where supported by the API, prompt and image inputs, size/quality/background/output-format/compression-style options exposed by the baseline, response decoding, and provider error mapping. Do not claim unsupported parity: document exact API version/endpoint assumptions and any deliberate differences.\n\n## Acceptance criteria\n- Uses the existing HTTP/auth/configuration patterns rather than a one-off client.\n- Request serialization and response decoding are covered with httptest fixtures.\n- Provider failures, malformed responses, timeouts, oversized inputs, and cancellation are handled without panics or leaked secrets.\n- No live API key is needed for tests.\n- A small runnable example shows the request shape and configuration.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:42Z","updated_at":"2026-08-14T21:55:42Z","external_ref":"https://github.com/samcharles93/archie-core/issues/498","source_system":"github:https://github.com/samcharles93/archie-core/issues/498:498","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942169-3-ae7cfaea","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:17Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-1786748942169-3-ae7cfaea","title":"Implement hosted gpt-image-2-compatible image provider","description":"## Scope\nImplement the hosted image provider behind the image capability contract, targeting the practical baseline of the OpenAI `gpt-image-2` API.\n\nCover text-to-image and image editing where supported by the API, prompt and image inputs, size/quality/background/output-format/compression-style options exposed by the baseline, response decoding, and provider error mapping. Do not claim unsupported parity: document exact API version/endpoint assumptions and any deliberate differences.\n\n## Acceptance criteria\n- Uses the existing HTTP/auth/configuration patterns rather than a one-off client.\n- Request serialization and response decoding are covered with httptest fixtures.\n- Provider failures, malformed responses, timeouts, oversized inputs, and cancellation are handled without panics or leaked secrets.\n- No live API key is needed for tests.\n- A small runnable example shows the request shape and configuration.","notes":"Leverage github.com/samcharles93/ai-sdk's existing image.Provider/core.GenerateImage/registry.RegisterImage for the generate path (azure/togetherai/xai already implement it; OpenAI does not yet) instead of writing a raw HTTP client -- same adapter pattern curatorLLMRunner uses for chat. Gap: ai-sdk's GenerateImageRequest has no input-image/mask fields, so editing needs either an upstream ai-sdk change or a separate direct client for the edit endpoint. Decide which at this bead's own design step. See docs/prds/image-capability-contract.md's closing note.","status":"open","priority":2,"issue_type":"task","created_at":"2026-08-14T21:55:42Z","updated_at":"2026-09-02T10:23:10Z","external_ref":"https://github.com/samcharles93/archie-core/issues/498","source_system":"github:https://github.com/samcharles93/archie-core/issues/498:498","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942169-3-ae7cfaea","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:17Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-1786748942147-2-47cd5bd1","title":"Define provider-neutral image capability contract and configuration","description":"## Scope\nDefine the internal image-generation capability boundary used by hosted and local providers. Keep it narrow and provider-neutral: generation, editing with input images, prompt/options, output metadata, cancellation/timeouts, and capability discovery.\n\nAdd configuration and provider selection that fit the existing model/provider conventions. A missing credential or unavailable backend must make the capability unavailable with a useful user-facing error, not prevent Archie from starting or break text chat.\n\n## Acceptance criteria\n- Typed request/result/options contract covers the agreed gpt-image-2 baseline without baking in OpenAI types.\n- Provider registry/resolution and capability discovery are testable with fakes.\n- Hosted vs local selection is explicit and cannot silently incur cost.\n- Timeouts, maximum input/output sizes, cancellation, and error taxonomy are defined and tested.\n- Configuration validation rejects unsafe/ambiguous settings and preserves existing config behavior.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","created_at":"2026-08-14T21:55:41Z","updated_at":"2026-09-02T10:20:48Z","started_at":"2026-09-02T10:17:22Z","closed_at":"2026-09-02T10:20:48Z","close_reason":"Shipped docs/prds/image-capability-contract.md plus internal/domain/image (Provider contract, Registry — no Lifecycle, provider is call-scoped) and config.ImageConfig/validateImage. Provider-neutral, tested with fakes, hosted+local both gated by explicit enabled=true. Also linked all 7 orphaned epic children (found unlinked again, same pattern as the curator/memory epics).","external_ref":"https://github.com/samcharles93/archie-core/issues/497","source_system":"github:https://github.com/samcharles93/archie-core/issues/497:497","metadata":null,"labels":["task"],"dependencies":[{"issue_id":"archie-core-1786748942147-2-47cd5bd1","depends_on_id":"archie-core-1786748942120-1-6636e629","type":"parent-child","created_at":"2026-09-02T10:17:16Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-1786748942120-1-6636e629","title":"[EPIC] Image generation capability: hosted API baseline plus local GPU workflows","description":"## Goal\nAdd first-class image generation to Archie, with a capability surface targeting the practical baseline of the OpenAI `gpt-image-2` API while also supporting image generation on a user's existing GPU.\n\nThe capability must not assume one backend. A user asking for `/image` is first asked which generation mechanism they prefer:\n- hosted API (starting with an OpenAI-compatible `gpt-image-2` provider), or\n- local GPU generation using one of Archie's tested model/backend recipes.\n\n## Scope\n- A provider-neutral image capability contract and routing/configuration.\n- Hosted generation/editing with an OpenAI `gpt-image-2`-class API baseline.\n- Local GPU generation through tested, documented model/backend recipes suitable for common consumer GPUs.\n- `/image` clarification and execution flow across supported channels.\n- Returned image delivery, bounded inputs/outputs, errors, and tests.\n\n## Non-goals\n- Training or fine-tuning image models.\n- Bundling multi-gigabyte model weights in Archie.\n- Pretending every GPU/model combination is supported; local support must be explicit and evidence-backed.\n- Replacing the existing text-chat capability or silently selecting a paid hosted provider.\n\n## Definition of done\n- `/image` asks for the preferred mechanism before generation when no mechanism is already selected for the request/session.\n- Hosted generation and editing cover the documented gpt-image-2 baseline, with provider-specific differences exposed rather than hidden.\n- Local GPU generation works end-to-end with at least one tested recipe, and additional tested common models are documented with VRAM/backend requirements and runnable examples.\n- Images can be delivered through the existing channel abstractions without leaking temporary files or unbounded data.\n- Unit, integration, and failure-path tests cover routing, provider errors, clarification, local execution, and delivery.\n- Configuration, security, and operational documentation are complete.\n\nSubtasks below are dependency-ordered where practical; each must link back to this epic and state any deliberate deviations from the hosted API baseline.","status":"open","priority":2,"issue_type":"epic","created_at":"2026-08-14T21:55:40Z","updated_at":"2026-08-14T21:55:40Z","external_ref":"https://github.com/samcharles93/archie-core/issues/496","source_system":"github:https://github.com/samcharles93/archie-core/issues/496:496","metadata":null,"labels":["epic"],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-hlxd","title":"telegram: a tool-use turn ending with no answer posts the tool line alone as the finished message","description":"finalText returns the tool block alone when the reply is empty, and finalize sends it as the authoritative finished message — content == '' is the only silence path, so an empty-reply turn with completed tools permanently delivers '🔧 shell — exit 0' with no answer. The old path guarded 'if reply != \"\"'. Telegram messages are immutable, so it can never be corrected. Gated on show_tool_calls (off by default), so it bites opt-in deployments. No test covers finalize with an empty reply and tools.\n\nFailure: the model ends a tool-use loop without a final summary (empty ResponseText); the finished message shows only the tool line, looking like a completed answer that said nothing.","design":"When the reply is empty, do not post the tool block as the answer — either skip the final send (leave the cursor-cleaned live message) or emit an explicit 'no reply' marker. Add a test for finalize(empty, tools).","acceptance_criteria":"A turn that ends with tools but no answer text does not post a bare tool line as the final message.","status":"closed","priority":2,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-14T14:43:38Z","created_by":"Sam Catlow","updated_at":"2026-08-14T15:25:44Z","started_at":"2026-08-14T15:07:52Z","closed_at":"2026-08-14T15:25:44Z","close_reason":"Fixed in internal/channels/telegram/live.go: framedText keeps tool lines whole ahead of the clamped answer tail (fixes wpq6); finalText appends a '(no response)' marker when tools ran but the reply is empty (fixes hlxd); abandonFailed marks a provider-error partial distinctly from a clean /stop abandon (fixes c3w2). Regression tests verified red-then-green; adversarial review found no blocking issues (added one more test for the degenerate oversized-tool-block case it flagged). task check clean, committed as 587b9b9.","external_ref":"https://github.com/samcharles93/archie-core/issues/486","labels":["code-review","streaming","telegram"],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
|
||||
@@ -241,3 +241,29 @@ whole point of the contract being provider-neutral.
|
||||
- Delivery through channel abstractions.
|
||||
- Wiring `Registry` into `bootstrap.go` (nothing to wire until a real
|
||||
provider exists to register).
|
||||
|
||||
## Note for the hosted-provider bead (archie-core-1786748942169-3-ae7cfaea)
|
||||
|
||||
`github.com/samcharles93/ai-sdk` (already a repo dependency) has its own
|
||||
provider-agnostic image facility: `image.Provider` (`Name`,
|
||||
`GenerateImage(ctx, GenerateImageRequest) (GenerateImageResponse, error)`),
|
||||
`image.Client`/`core.GenerateImage`, and `registry.Registry.RegisterImage`/
|
||||
`.Image(name)` — the same shape chat model registration already uses. Three
|
||||
backends implement it today (azure, togetherai, xai); OpenAI does not yet.
|
||||
|
||||
The hosted-provider bead should adapt this instead of writing a raw HTTP
|
||||
client, the same way `curatorLLMRunner` (internal/app/archied/main.go)
|
||||
adapts `runtime.Runtime` for chat rather than the domain layer talking to
|
||||
ai-sdk directly — `internal/infrastructure/image.<name>Provider` wraps an
|
||||
`ai-sdk/image.Provider` (or a new `ai-sdk/provider/openai` image
|
||||
implementation, upstream, if one is added) behind this package's `Provider`
|
||||
interface.
|
||||
|
||||
One real gap: ai-sdk's `image.GenerateImageRequest` has no input-image or
|
||||
mask fields — text-to-image only. `EditRequest`/`Capability.Edit` in this
|
||||
contract has nothing to adapt to yet. The hosted-provider bead needs either
|
||||
an upstream ai-sdk change (adding edit support to the `image` package) or a
|
||||
direct, non-ai-sdk client for the edit endpoint specifically, with
|
||||
generation still going through ai-sdk. Decide and record which at that
|
||||
bead's own design-doc step; this doc takes no position since editing was
|
||||
out of scope here.
|
||||
Reference in new issue
Block a user