Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fvm flutter pub get
fvm flutter run -d chrome
```

Scroll down on the landing screen and choose **Explore component catalog** for a free first run with no API key. To use the stylist, choose **Connect your model** and supply a tool-capable Gemini, OpenAI, Anthropic or OpenAI-compatible model and your own API key. Connecting makes no model request; stylist interactions can incur provider charges. Keys stay in session memory. There is no application backend to deploy.
Scroll down on the landing screen and choose **Explore component catalog** for a free first run with no API key. To use the stylist, choose **Connect your model**, select a provider and supply your own API key. Alder preselects a current tool-capable model for each bundled provider, with alternative curated choices and a manual **Other…** option. Connecting makes no model request; stylist interactions can incur provider charges. Keys stay in session memory. There is no application backend to deploy.

Browser connections require provider CORS support. iOS builds require an **iOS 27.1 SDK or newer**; the minimum deployment target is iOS 15.0. See [getting started](docs/getting-started.md) for platform setup and troubleshooting.

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Progressive rendering uses a separate, temporary inline surface. It starts with

`genkit_providers.dart` configures the official Gemini, OpenAI, Anthropic, and OpenAI-compatible plugins. OpenAI uses Chat Completions with `store: false`. Real keys enter HTTP headers at the transport boundary; plugin configurations contain a placeholder. The transport validates destinations, refuses redirects, sanitizes provider failures before SDK errors/traces, and bounds provider requests. A Dart Zone carries mutable per-turn draft state outside serialized flow context. Disconnect clears the key, cancels outstanding work, disposes the owned HTTP client and Genkit runtime, and discards the session.

The same flow runs in the optional Genkit Developer UI through `tools/genkit/stylist.dart`, using a free offline model. The connected Flutter runtime disables reflection and automatic telemetry. The optional Genkit CLI is a development dependency only. Genkit Dart, its provider plugins, and Schemantic are pinned to 1.0.0. Provider models are resolved through the public `GenkitPlugin.model` API and invoked with the turn cancellation token. OpenAI and Anthropic accept an injected HTTP client; Google uses the documented `http.runWithClient` factory scoped to each invocation. There are no private package imports. See [genkit-reference.md](genkit-reference.md) for the integration contract, upgrade guidance, and regression coverage.
The same flow runs in the optional Genkit Developer UI through `tools/genkit/stylist.dart`, using a free offline model. The connected Flutter runtime disables reflection and automatic telemetry. The optional Genkit CLI is a development dependency only. Genkit Dart and its provider plugins are pinned to 1.0.1; Schemantic remains pinned to 1.0.0. Provider models are resolved through the public `GenkitPlugin.model` API and invoked with the turn cancellation token. OpenAI and Anthropic accept an injected HTTP client; Google uses the documented `http.runWithClient` factory scoped to each invocation. There are no private package imports. See [genkit-reference.md](genkit-reference.md) for the integration contract, upgrade guidance, and regression coverage.

The Flutter app runs natively and builds for web. Direct browser requests depend on provider CORS support; native apps do not require CORS. Keys must not appear in assets, source, generated bundles, saved browser state, or committed environment files.

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-tools.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Genkit developer tools

The app pins Genkit Dart, its three official provider plugins, and Schemantic to 1.0.0. The integration uses public APIs only. See the [Genkit 1.0 implementation reference](genkit-reference.md) for provider setup, typed tool selection, cancellation, retry policy, transport ownership, and the remaining upstream compatibility exception.
The app pins Genkit Dart and its three official provider plugins to 1.0.1, and Schemantic to 1.0.0. The integration uses public APIs only. See the [Genkit 1.0 implementation reference](genkit-reference.md) for provider setup, typed tool selection, cancellation, retry policy, transport ownership, and the remaining upstream compatibility exception.

For an explicitly opted-in live OpenAI smoke test, put `OPENAI_API_KEY` and `OPENAI_MODEL` in the ignored `.env.local` file or your process environment, then run:

Expand Down
18 changes: 9 additions & 9 deletions docs/genkit-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The [flow edge-case matrix](stylist-flow-edge-cases.md) documents restart, cance

This is the integration contract for implementers and coding agents working on
Alder. The reference pins `genkit`, `genkit_openai`, `genkit_anthropic`,
`genkit_google_genai`, and `schemantic` to **1.0.0**. Its lockfile resolves
`genkit_google_genai` to **1.0.1**, and `schemantic` to **1.0.0**. Its lockfile resolves
`dotprompt` 2.0.0.
Flutter remains pinned by `.fvmrc`; unrelated GenUI/A2UI packages are unchanged.

Expand Down Expand Up @@ -99,7 +99,7 @@ in model configuration, flow inputs, trace context, assets or persistent state.
Connection setup is network-free; model discovery is deliberately not called.

OpenAI's `store: false` is enforced at this boundary because the pinned plugin's
Chat Completions options do not expose it. The Luna tool-call configuration uses
Chat Completions options do not expose it. The GPT-6 Sol tool-call configuration uses
the public `OpenAIChatOptions(reasoningEffort: 'none')` schema, not a raw request
rewrite. Other models and compatible hosts do not inherit that setting.

Expand All @@ -124,7 +124,7 @@ must never silently expand them.
`StylistRuntime.turn(onText: ...)` streams cumulative, display-only prose from
only the final tool-free request using the public `Model(..., onChunk: ...)`
API. Tool requests stay non-streaming. Turns introducing destination weather hold prose until the validated response can show the forecast first. The provider wrapper forwards chunks and
cancellation through its public action context. OpenAI Luna continues to send
cancellation through its public action context. OpenAI GPT-6 Sol continues to send
`reasoning_effort: none`, including the streaming request.

The runtime buffers complete sentences before applying the final reply's
Expand All @@ -139,7 +139,7 @@ and direct host replies keep the existing paragraph queue.

## Remaining upstream exception

The published `genkit_openai` 1.0.0 non-streaming converter passes the SDK enum's
The published `genkit_openai` 1.0.1 non-streaming converter passes the SDK enum's
`.name` (`toolCalls`) to a mapping expecting `tool_calls`. The narrow
`_normalizeResponse` adapter accepts only an unknown finish reason accompanied
by real tool requests and raw `choices[0].finish_reason == 'tool_calls'`.
Expand Down Expand Up @@ -189,8 +189,8 @@ Reduce Motion. This does not add or change Genkit requests. See the
[GenUI SurfaceContext API](https://pub.dev/documentation/genui/latest/genui/SurfaceContext-class.html).

- [Genkit version history](https://pub.dev/packages/genkit/versions)
- [Genkit 1.0 changes](https://pub.dev/packages/genkit/versions/1.0.0/changelog)
- [Genkit public API](https://pub.dev/documentation/genkit/1.0.0/genkit/)
- [Anthropic public API](https://pub.dev/documentation/genkit_anthropic/1.0.0/genkit_anthropic/)
- [Google public API](https://pub.dev/documentation/genkit_google_genai/1.0.0/genkit_google_genai/)
- [OpenAI public API](https://pub.dev/documentation/genkit_openai/1.0.0/genkit_openai/)
- [Genkit 1.0.1 changes](https://pub.dev/packages/genkit/versions/1.0.1/changelog)
- [Genkit public API](https://pub.dev/documentation/genkit/1.0.1/genkit/)
- [Anthropic public API](https://pub.dev/documentation/genkit_anthropic/1.0.1/genkit_anthropic/)
- [Google public API](https://pub.dev/documentation/genkit_google_genai/1.0.1/genkit_google_genai/)
- [OpenAI public API](https://pub.dev/documentation/genkit_openai/1.0.1/genkit_openai/)
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For a deterministic connected demonstration, use the explicit [offline developer

## Connect a model

Choose **Connect your model**, select Google Gemini, OpenAI, Anthropic or OpenAI-compatible, and enter a model ID supporting function tools and a provider API key. There is no default provider/model/key in the public app. OpenAI-compatible connections also require the API base URL, including its version path, such as `https://your-provider.example/v1`.
Choose **Connect your model**, select Google Gemini, OpenAI, Anthropic or OpenAI-compatible, and enter your provider API key. Alder preselects a current tool-capable model for each bundled provider: Gemini 4 Argon, GPT-6 Sol or Claude Fable 5.1. You can choose another curated model or **Other…** to enter a model ID manually. OpenAI-compatible connections always use **Other…** and also require the API base URL, including its version path, such as `https://your-provider.example/v1`.

Remote providers require HTTPS; loopback HTTP is accepted for local compatible endpoints. Native operating systems may require additional configuration for cleartext local HTTP. Web requires the provider to allow browser requests through CORS; a working native connection does not establish browser support.

Expand All @@ -50,7 +50,7 @@ Dictation requests microphone/speech permissions on first use. Recognition depen
| Symptom | Check |
| --- | --- |
| Missing images or invalid JPEG bytes | Run `git lfs pull` and the catalog/release-asset checks in CONTRIBUTING. |
| Connected, but the first message fails | Setup does not verify credentials. Check the key, model ID, tool support, quota and provider error. |
| Connected, but the first message fails | Setup does not verify credentials or model access. Check the key, selected model, tool support, quota and provider error. |
| Native works, browser fails | Check provider CORS support; do not weaken browser security or put keys in a public proxy. |
| iOS SDK build failure | Select Xcode with iOS 27.1 or newer and run the iOS gate. |
| Dictation unavailable | Check platform recognition support and permissions; rebuild after plugin changes. |
Expand Down
4 changes: 2 additions & 2 deletions docs/stylist-flow-edge-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The official [GenUI input and events guide](https://docs.flutter.dev/ai/genui/in

[GenUI component bindings](https://docs.flutter.dev/ai/genui/components) use per-surface observable data. Size/fit selection stays in that surface's data model until its existing Save action commits. Do not copy these drafts into another widget's global state.

[Genkit Dart generation and cancellation](https://genkit.dev/docs/dart/models/) supports cooperative cancellation. Our pinned `genkit` 1.0.0 exposes `CancellationController`, `CancellationToken.whenCancelled` and `CancelledException`. Cancelling cannot force an uncooperative provider future to finish. The runtime races draft generation against cancellation, then rejects late work through the draft's token and the agent epoch. Persistence writes and rollback remain serialized outside that race.
[Genkit Dart generation and cancellation](https://genkit.dev/docs/dart/models/) supports cooperative cancellation. Our pinned `genkit` 1.0.1 exposes `CancellationController`, `CancellationToken.whenCancelled` and `CancelledException`. Cancelling cannot force an uncooperative provider future to finish. The runtime races draft generation against cancellation, then rejects late work through the draft's token and the agent epoch. Persistence writes and rollback remain serialized outside that race.

The online docs evolve faster than our pins: `genui` 0.10.3, `a2ui_core` 0.1.1, Genkit/provider plugins/Schemantic 1.0.0. Verify signatures against those installed sources. The newer [full-agent run/session APIs](https://genkit.dev/docs/dart/agents/run/) are not a reason to migrate the existing `stylistTurn` flow during a UX fix.
The online docs evolve faster than our pins: `genui` 0.10.3, `a2ui_core` 0.1.1, Genkit/provider plugins 1.0.1 and Schemantic 1.0.0. Verify signatures against those installed sources. The newer [full-agent run/session APIs](https://genkit.dev/docs/dart/agents/run/) are not a reason to migrate the existing `stylistTurn` flow during a UX fix.

## Flow matrix

Expand Down
3 changes: 3 additions & 0 deletions lib/app/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"connectionBaseUrl": "Provider API base URL",
"connectionBaseUrlHint": "https://your-provider.example/v1",
"connectionInvalidBaseUrl": "Use HTTPS or a local loopback HTTP address",
"connectionModel": "Model",
"connectionModelOther": "Other…",
"connectionModelId": "Model ID",
"connectionModelOtherHelp": "The model must support tool calling through the selected provider.",
"connectionApiKey": "API key",
"connectionUsageNotice": "Connecting makes no model request. Starting a journey, chatting, selecting pieces, and retrying use your provider account and may incur charges.",
"connectionSubmit": "Connect model",
Expand Down
18 changes: 18 additions & 0 deletions lib/app/l10n/generated/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,30 @@ abstract class AppLocalizations {
/// **'Use HTTPS or a local loopback HTTP address'**
String get connectionInvalidBaseUrl;

/// No description provided for @connectionModel.
///
/// In en, this message translates to:
/// **'Model'**
String get connectionModel;

/// No description provided for @connectionModelOther.
///
/// In en, this message translates to:
/// **'Other…'**
String get connectionModelOther;

/// No description provided for @connectionModelId.
///
/// In en, this message translates to:
/// **'Model ID'**
String get connectionModelId;

/// No description provided for @connectionModelOtherHelp.
///
/// In en, this message translates to:
/// **'The model must support tool calling through the selected provider.'**
String get connectionModelOtherHelp;

/// No description provided for @connectionApiKey.
///
/// In en, this message translates to:
Expand Down
10 changes: 10 additions & 0 deletions lib/app/l10n/generated/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ class AppLocalizationsEn extends AppLocalizations {
String get connectionInvalidBaseUrl =>
'Use HTTPS or a local loopback HTTP address';

@override
String get connectionModel => 'Model';

@override
String get connectionModelOther => 'Other…';

@override
String get connectionModelId => 'Model ID';

@override
String get connectionModelOtherHelp =>
'The model must support tool calling through the selected provider.';

@override
String get connectionApiKey => 'API key';

Expand Down
33 changes: 33 additions & 0 deletions lib/data/stylist/model/provider_model_catalog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/// A model that Alder can offer without remote discovery.
class ProviderModelPreset {
const ProviderModelPreset({required this.id, required this.label});

final String id;
final String label;
}

/// Curated, tool-capable models for the bundled provider adapters.
///
/// OpenAI-compatible endpoints deliberately have no presets because their
/// model identifiers depend on the configured host.
const providerModelPresets = <String, List<ProviderModelPreset>>{
'googleai': [
ProviderModelPreset(id: 'gemini-4-argon', label: 'Gemini 4 Argon'),
ProviderModelPreset(id: 'gemini-3.8-flash', label: 'Gemini 3.8 Flash'),
],
'openai': [ProviderModelPreset(id: 'gpt-6-sol', label: 'GPT-6 Sol')],
'anthropic': [
ProviderModelPreset(id: 'claude-fable-5-1', label: 'Claude Fable 5.1'),
ProviderModelPreset(id: 'claude-opus-5-5', label: 'Claude Opus 5.5'),
ProviderModelPreset(id: 'claude-sonnet-5-5', label: 'Claude Sonnet 5.5'),
],
'openai-compatible': [],
};

List<ProviderModelPreset> modelsForProvider(String provider) =>
providerModelPresets[provider] ?? const [];

String? defaultModelForProvider(String provider) {
final models = modelsForProvider(provider);
return models.isEmpty ? null : models.first.id;
}
6 changes: 3 additions & 3 deletions lib/data/stylist/service/remote/genkit_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class GenkitProvider {
name: providerModel.name,
customOptions: providerModel.customOptions,
fn: (request, context) {
if (settings.provider == 'openai' && settings.model == 'gpt-6-luna') {
// This model supports Chat Completions tools without reasoning.
if (settings.provider == 'openai' && settings.model == 'gpt-6-sol') {
// GPT-6 Sol supports Chat Completions tools without reasoning.
// Use the plugin's public options rather than patching its wire JSON.
request = ModelRequest.fromJson(request.toJson())
..config = {
Expand Down Expand Up @@ -73,7 +73,7 @@ class GenkitProvider {
void beginTurn() => _transport.beginTurn();
void cancelTurn() => _transport.cancelTurn();
ModelResponse _normalizeResponse(ModelResponse response) {
// genkit_openai 1.0.0 still maps the SDK's camel-case enum name, whereas its
// genkit_openai 1.0.1 still maps the SDK's camel-case enum name, whereas its
// converter expects the wire value "tool_calls". Accept only that explicit
// finish reason with real tool requests; truncated output stays rejected.
if ((settings.provider == 'openai' ||
Expand Down
Loading
Loading