Skip to content

OrcaRouter翻訳プラグインを追加 - #696

Open
Freeesia wants to merge 6 commits into
masterfrom
codex/issue-692-orcarouter
Open

OrcaRouter翻訳プラグインを追加#696
Freeesia wants to merge 6 commits into
masterfrom
codex/issue-692-orcarouter

Conversation

@Freeesia

@FreeesiaFreeesia commented Sep 7, 2026

Copy link
Copy Markdown
Owner

概要

Closes#692

  • OrcaRouter の OAuth 2.0 + PKCE ブラウザー認証と loopback callback を実装
  • 発行された sk-orca-* キーを対象設定の PluginParams に保存し、設定UIでは非表示化
  • 固定エンドポイント https://api.orcarouter.ai/v1 と OpenAI .NET SDK を使った翻訳を実装
  • /v1/models からモデル名・入出力料金を取得し、orcarouter/auto を既定値とするモデル選択を追加
  • 本体設定画面に、保存値と表示名を分離できる汎用 DynamicItemsSource ComboBox を追加
  • JSON応答の件数検証と最大5回の再試行、文脈・CSV用語集に対応
  • 設定表示と認証メッセージを既存の対応言語へ追加
  • 公式プラグインのREADME規約に合わせ、利用者向け説明を22言語で収録
  • .NET Core Package で生成した各 .nupkg を、ZIP化しない個別のGitHub Actions成果物として公開

動作確認

  • dotnet test WindowTranslator.Tests/WindowTranslator.Tests.csproj --filter FullyQualifiedName~OrcaRouterTests(5件成功)
  • dotnet test WindowTranslator.Tests/WindowTranslator.Tests.csproj --filter FullyQualifiedName~LocalizedReadmeSelectorTests(成功)
  • dotnet pack Plugins/WindowTranslator.Plugin.OrcaRouterPlugin/WindowTranslator.Plugin.OrcaRouterPlugin.csproj(成功、README・22言語セクション・全言語リソースを含むことを確認)
  • CI相当の dotnet nuget-license(成功)
  • 全体テストは145件中144件成功。既存の DependencyWithIncompatibleLibStillInstallsCompatibleNativeAssets 1件のみ、compatible.dll が一時配置先に存在しないため失敗し、単独再実行でも再現(今回変更していないNuGetインストーラー系テスト)

if (discovery.IsError || NormalizeEndpoint(discovery.Issuer).AbsoluteUri.TrimEnd('/') != Authority
|| !discovery.CodeChallengeMethodsSupported.Contains("S256"))
{
throw new InvalidOperationException("Invalid OrcaRouter discovery response.");

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下のレスポンスが返ってきているがエラー扱いになる

{"authorization_endpoint":"http://www.orcarouter.ai/auth","code_challenge_methods_supported":["S256","plain"],"grant_types_supported":["authorization_code"],"issuer":"http://www.orcarouter.ai","response_types_supported":["code"],"token_endpoint":"http://www.orcarouter.ai/api/v1/auth/keys","token_endpoint_auth_methods_supported":["none"]}

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

対応しました(a5f8648)。Discovery の http スキームを IdentityModel が先にエラーにしないよう RequireHttps = false を設定しました。受け取った issuer / authorization endpoint / token endpoint は、引き続き www.orcarouter.ai・標準ポート等を検証したうえで、実際に使用する URL を必ず HTTPS へ正規化します。いただいたレスポンスをそのまま使う回帰テストも追加し、成功を確認しています。

Comment thread.github/workflows/dotnet-package.yml Outdated
-p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} `
-p:InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} `
-p:DecryptKey="${{ secrets.WINDOWTRANSLATOR_DECRYPTKEY }}"
- name: Upload WindowTranslator.Abstractions

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

パッケージごとにステップはやめて。パッケージが増えても対応不要な形式にして。

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

対応しました(a5f8648)。パッケージ名ごとの固定ステップを削除し、pack 内の .nupkg を動的に列挙して、各ファイルを skipArchive 付きで個別成果物としてアップロードするスクリプトへ変更しました。今後パッケージが増えてもワークフローの追記は不要で、0件の場合はエラーになります。2つのダミーパッケージを使い、個別アップロード呼び出しになることも確認しました。

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追記です。初回CI(Package #250)で通常の run ステップには成果物API用のランタイムトークンが渡らないことを確認したため、bc85f0a でアップローダーをローカルNodeアクション化し、固定依存をバンドルしました。動的列挙・パッケージごとの個別アップロードという構成は維持したまま、アクション実行コンテキストで成果物APIを呼び出す形に修正しています。

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再実行した Package #251 は成功しました。生成された14個の .nupkg が、すべてファイル名ごとの独立した成果物として登録されていることも確認済みです。

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ必要?
非同期で一覧取れたらリストプロパティに値を設定して通知してバインド経由で普通のComboboxでも更新できない?

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

対応しました(a5f8648)。独自の DynamicItemsSourceAttribute / IDynamicItemsSource / DynamicItemsComboBox を削除し、OrcaRouterOptions.ModelItems を非同期更新して変更通知する形にしました。Model は PropertyTools 標準の ItemsSourceProperty / DisplayMemberPath / SelectedValuePath を使い、通常の ComboBox で更新されます。入れ子のプラグイン設定でも ItemsSource の所有元へ正しくバインドし、取得中に保存済みモデルが失われないようにしています。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OrcaRouter 専用プラグインを追加する

1 participant

@Freeesia