FN-5834: enforce explicit developer-role compatibility for custom providers

Prevent unsupported developer-role API failures by making provider role compatibility explicit and covered by regression safeguards.

- Add explicit supportsDeveloperRole capability to custom provider metadata/types and wire it through provider registration.
- Update CLI custom-provider registration behavior and tests to persist and validate developer-role compatibility settings.
- Add/adjust engine regression coverage for openai-completions message role conversion, including reasoning-model fallback behavior.
- Document the new custom provider setting and add a published changeset for @runfusion/fusion.

Files changed:
 .changeset/fn-5834-developer-role-compat.md        |  5 ++
 docs/settings-reference.md                         |  2 +-
 packages/cli/src/commands/__tests__/custom-provider-registry.test.ts     | 44 +++++++++++-
 packages/cli/src/commands/custom-provider-registry.ts   |  9 ++-
 packages/core/src/types.ts                         |  5 ++
 packages/engine/src/__tests__/custom-providers-openai-completions.test.ts    | 84 +++++++++++-----------
 6 files changed, 106 insertions(+), 43 deletions(-)

Fusion-Task-Id: FN-5834
Fusion-Task-Lineage: 4edc80c9-5e60-41e4-bce1-662d18255d88
This commit is contained in:
gsxdsm
2026-06-01 09:05:05 -07:00
parent f76716e55b
commit 130f6f1e9a
6 changed files with 106 additions and 43 deletions

View File

@@ -57,7 +57,7 @@ Fusion automatically falls back to ntfy's JSON publish format when a notificatio
| `webhookFormat` | `"slack" \| "discord" \| "generic"` | `"generic"` | Webhook payload format. Part of legacy flat settings. |
| `webhookEvents` | `string[]` | `[]` | Event filter for webhook notifications. Empty/omitted means all events. Part of legacy flat settings. |
| `notificationProviders` | `NotificationProviderConfig[]` | `[]` | Array of pluggable notification provider configurations. Each entry uses `{ id, name, enabled, config }` and is dispatched by provider ID (for example `ntfy` or `webhook`). |
| `customProviders` | `CustomProvider[]` | `[]` | User-defined OpenAI-compatible, OpenAI Responses API (`apiType: "openai-responses"`), or Anthropic-compatible providers used by the custom-provider API (`/api/custom-providers`). Each entry uses `{ id, name, apiType, baseUrl, apiKey?, models? }`; API keys are stored raw but masked in API responses. Fusion resolves these providers from the active global settings directory (`~/.fusion`, with legacy `~/.pi/fusion` and `~/.pi/kb` migration support) so custom-provider models remain available after restart. |
| `customProviders` | `CustomProvider[]` | `[]` | User-defined OpenAI-compatible, OpenAI Responses API (`apiType: "openai-responses"`), or Anthropic-compatible providers used by the custom-provider API (`/api/custom-providers`). Each entry uses `{ id, name, apiType, baseUrl, apiKey?, supportsDeveloperRole?, models? }`; `supportsDeveloperRole` is an OpenAI-compatible opt-in that enables `developer` role emission (default/omitted is `false`, forcing safe `system` role). API keys are stored raw but masked in API responses. Fusion resolves these providers from the active global settings directory (`~/.fusion`, with legacy `~/.pi/fusion` and `~/.pi/kb` migration support) so custom-provider models remain available after restart. |
| `defaultProjectId` | `string` | `undefined` | Default project for multi-project CLI operations when `--project` is omitted. |
| `setupComplete` | `boolean` | `undefined` | Tracks completion of first-run setup. |
| `favoriteProviders` | `string[]` | `undefined` | Pinned providers shown first in model selectors. |